paymentprocessor.java
来自「Java写的ERP系统」· Java 代码 · 共 127 行
JAVA
127 行
/******************************************************************************
* The contents of this file are subject to the Compiere License Version 1.1
* ("License"); You may not use this file except in compliance with the License
* You may obtain a copy of the License at http://www.compiere.org/license.html
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
* The Original Code is Compiere ERP & CRM Business Solution
* The Initial Developer of the Original Code is Jorg Janke and ComPiere, Inc.
* Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke, parts
* created by ComPiere are Copyright (C) ComPiere, Inc.; All Rights Reserved.
* Contributor(s): ______________________________________.
*****************************************************************************/
package org.compiere.model;
import java.sql.*;
import java.math.*;
import java.io.*;
import java.util.*;
import org.apache.log4j.Logger;
import org.compiere.util.DB;
/**
* Payment Processor Abstract Class
*
* @author Jorg Janke
* @version $Id: PaymentProcessor.java,v 1.8 2003/04/22 05:32:20 jjanke Exp $
*/
public abstract class PaymentProcessor
{
/**
* Public Constructor
*/
public PaymentProcessor()
{
} // PaymentProcessor
/** Logger */
protected Logger log = Logger.getLogger (getClass());
static private Logger s_log = Logger.getLogger (PaymentProcessor.class);
/**
* Factory
* @param mpp payment processor model
* @param mp payment model
* @return initialized PaymentProcessor or null
*/
public static PaymentProcessor create (MPaymentProcessor mpp, MPayment mp)
{
s_log.info("create for " + mpp);
String className = mpp.getPayProcessorClass();
if (className == null && className.length() == 0)
{
s_log.error("create - no class name");
return null;
}
//
PaymentProcessor myProcessor = null;
try
{
Class ppClass = Class.forName(className);
if (ppClass != null)
myProcessor = (PaymentProcessor)ppClass.newInstance();
}
catch (Error e1) // NoClassDefFound
{
s_log.error("create - " + className + " - " + e1.getMessage());
myProcessor = null;
}
catch (Exception e2)
{
s_log.error("create - " + className, e2);
myProcessor = null;
}
if (myProcessor == null)
{
s_log.error("create - no class");
return null;
}
// Initialize
myProcessor.p_mpp = mpp;
myProcessor.p_mp = mp;
//
return myProcessor;
} // create
/*************************************************************************/
protected MPaymentProcessor p_mpp = null;
protected MPayment p_mp = null;
//
private int m_timeout = 30;
/*************************************************************************/
/**
* Process CreditCard (no date check)
* @return true if processed successfully
* @throws IllegalArgumentException
*/
public abstract boolean processCC () throws IllegalArgumentException;
/**
* Payment is procesed successfully
* @return true if OK
*/
public abstract boolean isProcessedOK();
/*************************************************************************/
/**
* Set Timeout
* @param newTimeout timeout
*/
public void setTimeout(int newTimeout)
{
m_timeout = newTimeout;
}
public int getTimeout()
{
return m_timeout;
}
} // PaymentProcessor
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?