|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.authorize.admc.authnet.AimTransaction
public class AimTransaction
Authorize.net client. N.b. It would be very easy for a scoundrel to modify this class to steal or use your credit card information. Therefore, only use a copy of this class from a source which you trust, and verify the checksums! N.b. the difference between "transaction key", my password; and "transaction ID", the identifier for a transaction. It seems that Authorize.net is trying to force AIM users into the hands of their own partners by no longer providing easy public access to the AIM API's, like they used to do. You can see the sample code at http://developer.authorize.net/samplecode/ but they leave a lot of questions unanswered, and the code is non-scalable and non-Object Oriented.
Nested Class Summary | |
---|---|
static interface |
AimTransaction.Persistor
An implementation of this interface may be passed to the postPurchase method to perform any custom post-purchase processing. |
Field Summary | |
---|---|
private String |
address
WRITEME |
private String |
amount
WRITEME |
private String |
auth_code
WRITEME |
private String |
card_code
WRITEME |
private String |
card_num
WRITEME |
private String |
city
WRITEME |
private String |
company
WRITEME |
private AimConfig |
config
WRITEME |
private String |
country
WRITEME |
private String |
cust_id
WRITEME |
String[] |
data
WRITEME |
private String |
description
WRITEME |
private String |
email
WRITEME |
private String |
exp_date
WRITEME |
private String |
fax
WRITEME |
private String |
first_name
WRITEME |
private static char[] |
hexChars
Simple look-up table for hexadecimal digits |
private String |
invoice_num
WRITEME |
private String |
last_name
WRITEME |
static String |
LS
WRITEME: document this field (brpocock@star-hope.org, Oct 13, 2009) LS (AimTransaction) |
private static int |
MAX_RESPONSE_SIZE
WRITEME |
private String |
phone
WRITEME |
(package private) char[] |
readBuffer
WRITEME |
private BigDecimal |
requestedAmount
WRITEME |
private String |
ship_to_address
WRITEME |
private String |
ship_to_city
WRITEME |
private String |
ship_to_company
WRITEME |
private String |
ship_to_country
WRITEME |
private String |
ship_to_first_name
WRITEME |
private String |
ship_to_last_name
WRITEME |
private String |
ship_to_state
WRITEME |
private String |
ship_to_zip
WRITEME |
private String |
state
WRITEME |
private boolean |
test_request
WRITEME |
private String |
trans_id
WRITEME |
private String |
type
WRITEME |
private String |
zip
WRITEME |
Constructor Summary | |
---|---|
AimTransaction(AimConfig config1)
Purposefully has only Package visibility. |
Method Summary | |
---|---|
void |
checkMd5Hash()
|
static void |
checkMd5Hash(String md5hash,
String login,
String transID,
String paid)
|
BigDecimal |
getAmount()
WRITEME: document this method (brpocock@star-hope.org, Sep 23, 2009) |
String |
getApproval()
WRITEME: document this method (brpocock@star-hope.org, Sep 23, 2009) |
char |
getAVS()
WRITEME: document this method (brpocock@star-hope.org, Sep 23, 2009) |
String |
getPhone()
WRITEME: document this method (brpocock@star-hope.org, Oct 13, 2009) |
int |
getRcode()
WRITEME: document this method (brpocock@star-hope.org, Sep 23, 2009) |
int |
getRRcode()
WRITEME: document this method (brpocock@star-hope.org, Sep 23, 2009) |
String |
getRRtext()
WRITEME: document this method (brpocock@star-hope.org, Sep 23, 2009) |
boolean |
getTestMode()
WRITEME: document this method (brpocock@star-hope.org, Sep 23, 2009) |
BigDecimal |
getTransId()
WRITEME: document this method (brpocock@star-hope.org, Sep 23, 2009) |
String |
getTransType()
WRITEME: document this method (brpocock@star-hope.org, Sep 23, 2009) |
private static char |
hexCharFor(int i)
WRITEME: document this method (brpocock@star-hope.org, Oct 13, 2009) |
boolean |
isTestMode()
WRITEME: document this method (brpocock@star-hope.org, Sep 23, 2009) |
void |
postPurchase()
Perform post-purchase validation. |
void |
postPurchase(AimTransaction.Persistor persistor)
Purchase-specific post-processing. |
private void |
postPurchaseValidate()
Validate that a normal purchase transaction completed successfully. |
void |
setAmount(BigDecimal inInt)
WRITEME: document this method (brpocock@star-hope.org, Oct 13, 2009) |
void |
setAmount(String inString)
WRITEME: document this method (brpocock@star-hope.org, Oct 13, 2009) |
void |
setAuthCode(String inString)
WRITEME: document this method (brpocock@star-hope.org, Oct 13, 2009) |
void |
setBillAddress(String inString)
WRITEME: document this method (brpocock@star-hope.org, Oct 13, 2009) |
void |
setBillCity(String inString)
WRITEME: document this method (brpocock@star-hope.org, Oct 13, 2009) |
void |
setBillCountry(String inString)
WRITEME: document this method (brpocock@star-hope.org, Oct 13, 2009) |
void |
setBillFax(String inString)
WRITEME: document this method (brpocock@star-hope.org, Oct 13, 2009) |
void |
setBillFirstName(String inString)
WRITEME: document this method (brpocock@star-hope.org, Oct 13, 2009) |
void |
setBillLastName(String inString)
WRITEME: document this method (brpocock@star-hope.org, Oct 13, 2009) |
void |
setBillOrg(String inString)
WRITEME: document this method (brpocock@star-hope.org, Oct 13, 2009) |
void |
setBillPhone(String inString)
WRITEME: document this method (brpocock@star-hope.org, Oct 13, 2009) |
void |
setBillStateName(String inString)
WRITEME: document this method (brpocock@star-hope.org, Oct 13, 2009) |
void |
setBillZip(String inString)
WRITEME: document this method (brpocock@star-hope.org, Oct 13, 2009) |
void |
setCardCode(String inString)
WRITEME: document this method (brpocock@star-hope.org, Oct 13, 2009) |
void |
setCardNum(String inString)
WRITEME: document this method (brpocock@star-hope.org, Oct 13, 2009) |
void |
setCustId(String inString)
WRITEME: document this method (brpocock@star-hope.org, Oct 13, 2009) |
void |
setDescription(String inString)
WRITEME: document this method (brpocock@star-hope.org, Oct 13, 2009) |
void |
setEmail(String inString)
WRITEME: document this method (brpocock@star-hope.org, Oct 13, 2009) |
void |
setExp(String inString)
WRITEME: document this method (brpocock@star-hope.org, Oct 13, 2009) |
void |
setInvoiceNum(int i)
Convenience data type conversion |
void |
setInvoiceNum(String inString)
Misnomer taken from the AIM documentation. |
void |
setPhone(String phone1)
WRITEME: document this method (brpocock@star-hope.org, Oct 13, 2009) |
void |
setShipAddress(String inString)
WRITEME: document this method (brpocock@star-hope.org, Oct 13, 2009) |
void |
setShipCity(String inString)
WRITEME: document this method (brpocock@star-hope.org, Oct 13, 2009) |
void |
setShipCountry(String inString)
WRITEME: document this method (brpocock@star-hope.org, Oct 13, 2009) |
void |
setShipFirstName(String inString)
WRITEME: document this method (brpocock@star-hope.org, Oct 13, 2009) |
void |
setShipLastName(String inString)
WRITEME: document this method (brpocock@star-hope.org, Oct 13, 2009) |
void |
setShipOrg(String inString)
WRITEME: document this method (brpocock@star-hope.org, Oct 13, 2009) |
void |
setShipStateName(String inString)
WRITEME: document this method (brpocock@star-hope.org, Oct 13, 2009) |
void |
setShipZip(String inString)
WRITEME: document this method (brpocock@star-hope.org, Oct 13, 2009) |
void |
setTestMode(boolean is_this_a_test_request_QQ)
Set the test mode for this one transaction. |
void |
setTransId(int inInt)
WRITEME: document this method (brpocock@star-hope.org, Oct 13, 2009) |
void |
setType(String inString)
WRITEME: document this method (brpocock@star-hope.org, Oct 13, 2009) |
void |
submit()
WRITEME: document this method (brpocock@star-hope.org, Oct 13, 2009) |
static String |
toHex(byte[] byteArray)
Run with no parameters to see syntax, like: |
String |
toString()
Dumps entire response data array, except for empty elements, which are skipped. |
static String |
truncateIfLonger(String inString,
int maxLen)
Public utility method. |
void |
validateInput(String vehicle)
Verify that input data is good to submit a payment request. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static char[] hexChars
public static final String LS
private static final int MAX_RESPONSE_SIZE
private String address
private String amount
private String auth_code
private String card_code
private String card_num
private String city
private String company
private AimConfig config
private String country
private String cust_id
public String[] data
private String description
private String email
private String exp_date
private String fax
private String first_name
private String invoice_num
private String last_name
private String phone
char[] readBuffer
private BigDecimal requestedAmount
private String ship_to_address
private String ship_to_city
private String ship_to_company
private String ship_to_country
private String ship_to_first_name
private String ship_to_last_name
private String ship_to_state
private String ship_to_zip
private String state
private boolean test_request
private String trans_id
private String type
private String zip
Constructor Detail |
---|
AimTransaction(AimConfig config1)
config1
- WRITEMEAimConfig.newTransaction()
Method Detail |
---|
public static void checkMd5Hash(String md5hash, String login, String transID, String paid) throws AuthNetException
md5hash
- WRITEMElogin
- WRITEMEtransID
- WRITEMEpaid
- WRITEME
AuthNetException
- if received hash does not match
calculated hash.private static char hexCharFor(int i)
i
- WRITEME
public static String toHex(byte[] byteArray)
java com.admc.authnet.AimTransactionN.b. THIS IS FOR NON-SECURE TESTING! Make sure your computer (and your nework connection to it, if any) is secure before running this method, because the command-line parameters you give to this command can be observerd by others.
byteArray
- WRITEME
public static String truncateIfLonger(String inString, int maxLen)
inString
- WRITEMEmaxLen
- WRITEME
public void checkMd5Hash() throws AuthNetException
AuthNetException
- if received hash does not match
calculated hash.public BigDecimal getAmount()
public String getApproval()
public char getAVS()
public String getPhone()
public int getRcode()
public int getRRcode()
public String getRRtext()
public boolean getTestMode()
public BigDecimal getTransId()
public String getTransType()
public boolean isTestMode()
public void postPurchase() throws AuthNetException
Perform post-purchase validation.
User should call either postPurchase(Persistor) or postPurchase() after submitting a purchase transaction.
AuthNetException
- Your postPurchase call should handle
these.public void postPurchase(AimTransaction.Persistor persistor) throws SQLException, AuthNetException
User should call either postPurchase(Persistor) or postPurchase() after submitting a purchase transaction.
Does purchase-specific post-validation, and invokes the user-specified persist method.
persistor
- WRITEME
AuthNetException
- It is very important that these critical
exceptions be handled appropriately, because the customer
has been charged but you may not have a record of it. You
just need to set up a SMTP Appender or write these to a
critical log file so you know to check the details with
the Authorize.net console.
SQLException
- If you did not pass a Persistor which can
throw a SQLException, then just catch SQLException and
rethrow a RuntimeException, because you won't get it
unless your app is messed up. If you may throw
SQLException, same comment as for AuthNetException
applies.private void postPurchaseValidate() throws AuthNetException
AuthNetException
- WRITEMEpublic void setAmount(BigDecimal inInt)
inInt
- WRITEMEpublic void setAmount(String inString)
inString
- WRITEMEpublic void setAuthCode(String inString)
inString
- WRITEMEpublic void setBillAddress(String inString)
inString
- WRITEMEpublic void setBillCity(String inString)
inString
- WRITEMEpublic void setBillCountry(String inString)
inString
- WRITEMEpublic void setBillFax(String inString)
inString
- WRITEMEpublic void setBillFirstName(String inString)
inString
- WRITEMEpublic void setBillLastName(String inString)
inString
- WRITEMEpublic void setBillOrg(String inString)
inString
- WRITEMEpublic void setBillPhone(String inString)
inString
- WRITEMEpublic void setBillStateName(String inString)
inString
- WRITEMEpublic void setBillZip(String inString)
inString
- WRITEMEpublic void setCardCode(String inString)
inString
- WRITEMEpublic void setCardNum(String inString)
inString
- WRITEMEpublic void setCustId(String inString)
inString
- WRITEMEpublic void setDescription(String inString)
inString
- WRITEMEpublic void setEmail(String inString)
inString
- WRITEMEpublic void setExp(String inString)
inString
- WRITEMEpublic void setInvoiceNum(int i)
i
- WRITEMEpublic void setInvoiceNum(String inString)
inString
- WRITEMEpublic void setPhone(String phone1)
phone1
- WRITEMEpublic void setShipAddress(String inString)
inString
- WRITEMEpublic void setShipCity(String inString)
inString
- WRITEMEpublic void setShipCountry(String inString)
inString
- WRITEMEpublic void setShipFirstName(String inString)
inString
- WRITEMEpublic void setShipLastName(String inString)
inString
- WRITEMEpublic void setShipOrg(String inString)
inString
- WRITEMEpublic void setShipStateName(String inString)
inString
- WRITEMEpublic void setShipZip(String inString)
inString
- WRITEMEpublic void setTestMode(boolean is_this_a_test_request_QQ)
is_this_a_test_request_QQ
- WRITEMEpublic void setTransId(int inInt)
inInt
- WRITEMEpublic void setType(String inString)
inString
- WRITEMEpublic void submit() throws IOException
IOException
- WRITEMEpublic String toString()
toString
in class Object
public void validateInput(String vehicle) throws AuthNetException
vehicle
- WRITEME
AuthNetException
- WRITEME
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |