KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > openedit > store > PurchaseOrderMethod


1 /*
2  * Created on Nov 7, 2004
3  */

4 package com.openedit.store;
5
6 /**
7  * @author cburkey
8  *
9  */

10 public class PurchaseOrderMethod extends CreditPaymentMethod
11 {
12
13     protected String JavaDoc fieldPoNumber;
14     
15
16     public String JavaDoc getPoNumber()
17     {
18         return fieldPoNumber;
19     }
20     public void setPoNumber(String JavaDoc inOrderNumber)
21     {
22         fieldPoNumber = inOrderNumber;
23     }
24     /* (non-javadoc)
25      * @see com.openedit.store.PaymentMethod#requiresValidation()
26      */

27     public boolean requiresValidation()
28     {
29         // If a credit card number has been entered, then validate it.
30
// Otherwise, allow transaction to be approved solely based on PO #.
31
// This may need to be revisited at some point.
32
if ( getCardNumber() != null && getCardNumber().trim().length() > 0 )
33         {
34             return true;
35         }
36         else
37         {
38             return false;
39         }
40     }
41     public String JavaDoc getType()
42     {
43         if ( requiresValidation() )
44         {
45             return "creditcardwithpo";
46         }
47         return "po";
48     }
49 }
50
Popular Tags