@@ -23,10 +23,19 @@ public static void run(String apiLoginId, String transactionKey) {
2323 merchantAuthenticationType .setTransactionKey (transactionKey );
2424 ApiOperationBase .setMerchantAuthentication (merchantAuthenticationType );
2525
26+ // Create a payment object, last 4 of the credit card and expiration date are required
27+ PaymentType paymentType = new PaymentType ();
28+ CreditCardType creditCard = new CreditCardType ();
29+ creditCard .setCardNumber ("0015" );
30+ creditCard .setExpirationDate ("1220" );
31+ paymentType .setCreditCard (creditCard );
32+
2633 // Create the payment transaction request
2734 TransactionRequestType txnRequest = new TransactionRequestType ();
2835 txnRequest .setTransactionType (TransactionTypeEnum .REFUND_TRANSACTION .value ());
29- txnRequest .setRefTransId ("2238786428" );
36+ txnRequest .setRefTransId ("2245803597" );
37+ txnRequest .setAmount (new BigDecimal (1.00 ));
38+ txnRequest .setPayment (paymentType );
3039
3140 // Make the API Request
3241 CreateTransactionRequest apiRequest = new CreateTransactionRequest ();
@@ -57,6 +66,12 @@ public static void run(String apiLoginId, String transactionKey) {
5766 else
5867 {
5968 System .out .println ("Failed Transaction: " +response .getMessages ().getResultCode ());
69+ if (!response .getMessages ().getMessage ().isEmpty ())
70+ System .out .println ("Error: " + response .getMessages ().getMessage ().get (0 ).getCode () + " " + response .getMessages ().getMessage ().get (0 ).getText ());
71+
72+ if (response .getTransactionResponse () != null )
73+ if (!response .getTransactionResponse ().getErrors ().getError ().isEmpty ())
74+ System .out .println ("Transaction Error : " + response .getTransactionResponse ().getErrors ().getError ().get (0 ).getErrorCode () + " " + response .getTransactionResponse ().getErrors ().getError ().get (0 ).getErrorText ());
6075 }
6176 }
6277
0 commit comments