Class BaseTransaction
- Direct Known Subclasses:
AuthorizationTransaction,BuyerAuthTransaction,CreditTransaction,RecurringTransaction,ReferenceTransaction,SaleTransaction,VoiceAuthTransaction
This class can be extended to create a new transaction type.
This example shows how to create and perform an Sale transaction using a Basetransaction Object. *.......... .......... //Populate required data objects. .......... .......... *
//Create a new Base Transaction. BaseTransaction trans = new BaseTransaction("S",User, Connection, Inv, Card, PayflowUtility.RequestId); *
//Submit the transaction. trans.submitTransaction(); // Get the Response Response resp = trans.getResponse(); *
// Display the transaction response parameters. if (resp != null) { // Get the Transaction Response parameters. TransactionResponse trxnResponse = resp.getTransactionResponse(); *
if (TrxnResponse != null) { System.out.println("RESULT = " + trxnResponse.getResult()); System.out.println("PNREF = " + trxnResponse.getPnref()); System.out.println("RESPMSG = " + trxnResponse.getRespMsg()); System.out.println("AUTHCODE = " + trxnResponse.getAuthCode()); System.out.println("AVSADDR = " + trxnResponse.getAVSAddr()); System.out.println("AVSZIP = " + trxnResponse.getAVSZip()); System.out.println("IAVS = " + trxnResponse.getIAVS()); } // Get the Fraud Response parameters. FraudResponse fraudResp = resp.getFraudResponse(); if (fraudResp != null) { System.out.println("PREFPSMSG = " + fraudResp.getPreFpsMsg()); System.out.println("POSTFPSMSG = " + fraudResp.getPostFpsMsg()); } *
// Display the response. System.out.println(PayflowUtility.getStatus(Resp)); *
// Get the Transaction Context and check for any contained SDK specific errors (optional code). Context transCtx = resp.getTransactionContext(); if (transCtx != null && transCtx.getErrorCount() %3E 0) { System.out.println(+ "Transaction Errors = " + transCtx.toString()); } }
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedprotected Constructor.BaseTransaction(String strTrxType, UserInfo objUserInfo, String requestId) BaseTransaction(String strTrxType, UserInfo objUserInfo, Invoice objInvoice, String requestId) BaseTransaction(String strTrxType, UserInfo objUserInfo, Invoice objInvoice, BaseTender objTender, String requestId) BaseTransaction(String strTrxType, UserInfo objUserInfo, PayflowConnectionData objpayflowConnectionData, String requestId) BaseTransaction(String strTrxType, UserInfo objUserInfo, PayflowConnectionData objpayflowConnectionData, Invoice objInvoice, String requestId) BaseTransaction(String strTrxType, UserInfo objUserInfo, PayflowConnectionData objpayflowConnectionData, Invoice objInvoice, BaseTender objTender, String requestId) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidClears the Extend Data list held by transaction object.protected voidGenerates the transaction request.protected ContextGets the context object of the current transaction.Gets the extend data list.Transaction request in Name-Value Pair format.protected StringBufferGets the StringBuffer object for RequestBuffer.Gets the transaction response object.gets the tender objectType of transaction to perform, indicated by a single character.Value (LOW, MEDIUM or HIGH) that controls the detail level and format of transaction results.voidRemoveTransHeader(String headerName) voidsetBuyerAuthStatus(BuyerAuthStatus buyerAuthStatus) Sets buyervoidsetClientInfo(ClientInfo clientInfo) protected voidsetContext(Context context) voidsetExtData(ExtendData extData) sets extData ArrayListvoidsetRequestId(String requestId) voidsetTender(BaseTender tender) Tender object for ACH, Credit Card, PINless Debit & eCheck.voidsetVerbosity(String verbosity) Value (LOW, MEDIUM or HIGH) that controls the detail level and format of transaction results.This method submits the transaction to the PayPal Payment Gateway.
-
Field Details
-
requestId
Unique request id for the transaction.Maps to Payflow Parameter in header - PAYFLOW-REQUEST-ID
-
-
Constructor Details
-
BaseTransaction
protected BaseTransaction()protected Constructor. This prevents creation of an empty Transaction object. -
BaseTransaction
public BaseTransaction(String strTrxType, UserInfo objUserInfo, PayflowConnectionData objpayflowConnectionData, String requestId) - Parameters:
strTrxType- String transaction typeobjUserInfo- UserInfo : UserInfo object populated with user credentialsobjpayflowConnectionData- PayflowConnectionDatarequestId- String
-
BaseTransaction
- Parameters:
strTrxType- StringobjUserInfo- UserInfo : UserInfo object populated with user credentialsrequestId- String
-
BaseTransaction
public BaseTransaction(String strTrxType, UserInfo objUserInfo, PayflowConnectionData objpayflowConnectionData, Invoice objInvoice, String requestId) - Parameters:
strTrxType- StringobjUserInfo- UserInfo : UserInfo object populated with user credentialsobjpayflowConnectionData- PayflowConnectionData : Connection credentials objectobjInvoice- Invoice : Invoice objectrequestId- String
-
BaseTransaction
public BaseTransaction(String strTrxType, UserInfo objUserInfo, Invoice objInvoice, String requestId) - Parameters:
strTrxType- String : transaction typeobjUserInfo- UserInfo : UserInfo object populated with user credentialsobjInvoice- Invoice : Invoice ObjectrequestId- String
-
BaseTransaction
public BaseTransaction(String strTrxType, UserInfo objUserInfo, PayflowConnectionData objpayflowConnectionData, Invoice objInvoice, BaseTender objTender, String requestId) - Parameters:
strTrxType- String : Transaction typeobjUserInfo- UserInfo : UserInfo object populated with user credentialsobjpayflowConnectionData- PayflowConnectionData : Connection credentials objectobjInvoice- Invoice : Invoice objectobjTender- BaseTender : Tender object such as CardTenderrequestId- String
-
BaseTransaction
public BaseTransaction(String strTrxType, UserInfo objUserInfo, Invoice objInvoice, BaseTender objTender, String requestId) - Parameters:
strTrxType- String : Transaction typeobjUserInfo- UserInfo : UserInfo object populated with user credentialsobjInvoice- : Invoice objectobjTender- BaseTender : Tender object such as CardTenderrequestId- String
-
-
Method Details
-
getBuyerAuthStatus
- Returns:
- Buyer auth status object
-
setBuyerAuthStatus
Sets buyer- Parameters:
buyerAuthStatus- buyer auth status object
-
getClientInfo
-
setClientInfo
-
getExtData
Gets the extend data list.- Returns:
- extData ArrayList ............ //Trans is the transaction object. ............ ArrayList extDataList = trans.getExtendData();
-
setExtData
sets extData ArrayList- Parameters:
extData- ArrayList
-
getRequest
Transaction request in Name-Value Pair format.- Returns:
- request String TRXTYPE[1]=S&ACCT[16]=5105105105105100&EXPDATE[4]=0109&TENDER[1]=C&INVNUM[8]=INV12345&AMT[5]=25.12 USER=user&VENDOR=vendor&PARTNER=partner&PWD=password
-
getRequestId
-
setRequestId
- Parameters:
requestId- String ............ //Trans is the transaction object. //A unique RequestId can be generated //using the PayflowUtility.getRequestId() property. ............ trans.setRequestId(PayflowUtility.getRequestId(); System.out.println("Transaction RequestId = " + trans.getRequestId());
-
getResponse
Gets the transaction response object.- Returns:
- response Response
............
//Trans is the transaction object.
............
*
//Submit the transaction. trans.submitTransaction(); *
// Get the Response. Response resp = trans.getResponse(); if (resp != null) { // Get the Transaction Response parameters. TransactionResponse trxnResponse = resp.getTransactionResponse(); if (trxnResponse != null) { System.out.println("RESULT = " + trxnResponse.getResult()); System.out.println("PNREF = " + trxnResponse.getPnref()); System.out.println("RESPMSG = " + trxnResponse.getRespMsg()); System.out.println("AUTHCODE = " + trxnResponse.getAuthCode()); System.out.println("AVSADDR = " + trxnResponse.getAVSAddr()); System.out.println("AVSZIP = " + trxnResponse.getAVSZip()); System.out.println("IAVS = " + trxnResponse.getIAVS()); } // Get the Fraud Response parameters. FraudResponse fraudResp = resp.getFraudResponse(); if (fraudResp != null) { System.out.println("PREFPSMSG = " + fraudResp.getPreFpsMsg()); System.out.println("POSTFPSMSG = " + fraudResp.getPostFpsMsg()); } } // Get the Context and check for any contained SDK specific errors. Context ctx = resp.getTransactionContext(); if (ctx != null ++ Ctx.getErrorCount() %3E 0) { System.out.println(Environment.NewLine + "Errors = " + Ctx.ToString()); }
-
getTender
gets the tender object- Returns:
- tender BaseTender
-
setTender
Tender object for ACH, Credit Card, PINless Debit & eCheck.- Parameters:
tender- BaseTender Allowed Tender Types are: Tender Type : Tender Name A - ACH (Automatic Clearing House) C - Credit Card D - PINLess Debit K - e-Check (TeleCheck)Each Tender type Maps to Payflow Parameter - TENDER
- See Also:
-
getTrxType
Type of transaction to perform, indicated by a single character. Credit payments require an ORIGID referring to an earlier Debit/Sale payment, and the AMT must be empty or the exact amount of the original Debit/Sale payment.- Returns:
- trxType String
Maps to Payflow Parameter - TRXTYPE
Allowed TrxType values are: Transaction Type - Transaction Name S - Sale/Debit A - Voice Authorization/Force C - Credit V - Void D - Delayed Capture F - Force/Voice Authorization I - Inquiry R - Recurring billing
-
getVerbosity
Value (LOW, MEDIUM or HIGH) that controls the detail level and format of transaction results. LOW (default) returns normalized values. MEDIUM or HIGH return the processor's raw response values.Maps to Payflow Parameter - VERBOSITY
- Returns:
- verbosity String ............ //Trans is the transaction object. ............ trans.setVerbosity( "HIGH"); System.out.println("Transaction Type = " + Trans.getTrxType())
-
setVerbosity
Value (LOW, MEDIUM or HIGH) that controls the detail level and format of transaction results. LOW (default) returns normalized values. MEDIUM or HIGH return the processor's raw response values.Maps to Payflow Parameter - VERBOSITY
- Parameters:
verbosity- String ............ //Trans is the transaction object. ............ trans.setVerbosity( "HIGH"); System.out.println("Transaction Type = " + Trans.getTrxType())
-
getContext
Gets the context object of the current transaction.- Returns:
- context Context
-
setContext
-
getRequestBuffer
Gets the StringBuffer object for RequestBuffer.- Returns:
- requestBuffer StringBuffer
-
submitTransaction
This method submits the transaction to the PayPal Payment Gateway. The response is obtained from the gateway and response object is populated with the response values along with the sdk specific errors in context, if any.- Returns:
- response String
............
//Trans is the transaction object.
............
*
//Submit the transaction. trans.submitTransaction(); *
// Get the Response. Response resp = trans.getResponse(); if (Resp != null) { // Get the Transaction Response parameters. TransactionResponse trxnResponse = resp.transactionResponse(); if (trxnResponse != null) { System.out.println("RESULT = " + trxnResponse.getResult()); System.out.println("PNREF = " + trxnResponse.getPnref()); System.out.println("RESPMSG = " + trxnResponse.getRespMsg()); System.out.println("AUTHCODE = " + trxnResponse.getAuthCode()); System.out.println("AVSADDR = " + trxnResponse.getAVSAddr()); System.out.println("AVSZIP = " + trxnResponse.getAVSZip()); System.out.println("IAVS = " + trxnResponse.getIAVS()); } // Get the Fraud Response parameters. FraudResponse fraudResp = resp.getFraudResponse(); if (FraudResp != null) { System.out.println("PREFPSMSG = " + fraudResp.getPreFpsMsg()); System.out.println("POSTFPSMSG = " + fraudResp.getPostFpsMsg()); } } // Get the Context and check for any contained SDK specific errors. Context ctx = resp.getTransactionContext(); if (ctx != null && ctx.getErrorCount() %3E 0) { System.out.println("Errors = " + ctx.ToString()); }
-
generateRequest
protected void generateRequest()Generates the transaction request. -
clearExtendData
public void clearExtendData()Clears the Extend Data list held by transaction object. -
addHeader
- Parameters:
headerName- StringheaderValue- String
-
RemoveTransHeader
- Parameters:
headerName- String
-