KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > compiere > model > MPaymentProcessor


1 /******************************************************************************
2  * The contents of this file are subject to the Compiere License Version 1.1
3  * ("License"); You may not use this file except in compliance with the License
4  * You may obtain a copy of the License at http://www.compiere.org/license.html
5  * Software distributed under the License is distributed on an "AS IS" basis,
6  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
7  * the specific language governing rights and limitations under the License.
8  * The Original Code is Compiere ERP & CRM Smart Business Solution
9  * The Initial Developer of the Original Code is Jorg Janke and ComPiere, Inc.
10  * Portions created by Jorg Janke are Copyright (C) 1999-2003 Jorg Janke, parts
11  * created by ComPiere are Copyright (C) ComPiere, Inc.; All Rights Reserved.
12  * Contributor(s): ______________________________________.
13  *****************************************************************************/

14 package org.compiere.model;
15
16 import java.util.*;
17 import java.sql.*;
18 import java.math.*;
19 import java.io.Serializable JavaDoc;
20
21 import org.compiere.util.*;
22
23
24 /**
25  * Payment Processor Model
26  *
27  * @author Jorg Janke
28  * @version $Id: MPaymentProcessor.java,v 1.4 2003/09/05 04:59:48 jjanke Exp $
29  */

30 public class MPaymentProcessor extends X_C_PaymentProcessor
31 {
32     /**
33      * Payment Processor Model
34      * @param ctx context
35      * @param C_PaymentProcessor_ID payment processor
36      */

37     public MPaymentProcessor (Properties ctx, int C_PaymentProcessor_ID)
38     {
39         super (ctx, C_PaymentProcessor_ID);
40         if (C_PaymentProcessor_ID == 0)
41         {
42             setC_PaymentProcessor_ID (0);
43             setCommission (Env.ZERO);
44             setPassword (null);
45             setC_BankAccount_ID (0);
46             setAcceptVisa (false);
47             setAcceptMC (false);
48             setAcceptAMEX (false);
49             setAcceptDiners (false);
50             setCostPerTrx (Env.ZERO);
51             setUserID (null);
52             setHostPort (0);
53             setAcceptCheck (false);
54             setHostAddress (null);
55             setRequireVV (false);
56             setAcceptCorporate (false);
57             setAcceptDiscover (false);
58             setAcceptATM (false);
59             setAcceptACH (false);
60             setName (null);
61         }
62     } // MPaymentProcessor
63

64     /**
65      * Payment Processor Model
66      * @param ctx context
67      * @param rs result set
68      */

69     public MPaymentProcessor (Properties ctx, ResultSet rs)
70     {
71         super (ctx, rs);
72     } // MPaymentProcessor
73

74
75     public String JavaDoc toString ()
76     {
77         StringBuffer JavaDoc sb = new StringBuffer JavaDoc ("MPaymentProcessor[")
78             .append(getID ()).append("-").append(getName())
79             .append ("]");
80         return sb.toString ();
81     } // toString
82

83     /**
84      * Does Payment Processor accepts tender / CC
85      * @param TenderType tender type
86      * @param CreditCardType credit card type
87      * @return true if acceptes
88      */

89     public boolean accepts (String JavaDoc TenderType, String JavaDoc CreditCardType)
90     {
91         if ((MPayment.TENDERTYPE_ACH.equals(TenderType) && isAcceptACH())
92             || (MPayment.TENDERTYPE_Check.equals(TenderType) && isAcceptCheck())
93             || (MPayment.CREDITCARDTYPE_ATM.equals(TenderType) && isAcceptATM())
94             || (MPayment.CREDITCARDTYPE_Amex.equals(CreditCardType) && isAcceptAMEX())
95             || (MPayment.CREDITCARDTYPE_PurchaseCard.equals(CreditCardType) && isAcceptCorporate())
96             || (MPayment.CREDITCARDTYPE_Diners.equals(CreditCardType) && isAcceptDiners())
97             || (MPayment.CREDITCARDTYPE_Discover.equals(CreditCardType) && isAcceptDiscover())
98             || (MPayment.CREDITCARDTYPE_MasterCard.equals(CreditCardType) && isAcceptMC())
99             || (MPayment.CREDITCARDTYPE_Visa.equals(CreditCardType) && isAcceptVisa()))
100             return true;
101         return false;
102     } // accepts
103

104 } // MPaymentProcessor
105
Popular Tags