Skip to content

Commit a3eb751

Browse files
author
srathod
committed
- Updated sample codes for RefundTransaction and CreditBankAccount.
1 parent 268369e commit a3eb751

4 files changed

Lines changed: 5 additions & 11 deletions

File tree

src/main/java/net/authorize/sample/PaymentTransactions/CreditBankAccount.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public class CreditBankAccount {
1313
// Run this sample from command line with:
1414
// java -jar target/ChargeCreditCard-jar-with-dependencies.jar
1515
//
16-
public static ANetApiResponse run(String apiLoginId, String transactionKey, String transactionID) {
16+
public static ANetApiResponse run(String apiLoginId, String transactionKey, String transactionID, Double amount) {
1717

1818

1919
//Common code to set for all requests
@@ -38,7 +38,7 @@ public static ANetApiResponse run(String apiLoginId, String transactionKey, Stri
3838
txnRequest.setTransactionType(TransactionTypeEnum.REFUND_TRANSACTION.value());
3939
txnRequest.setRefTransId(transactionID);
4040
txnRequest.setPayment(paymentType);
41-
txnRequest.setAmount(new BigDecimal(500.00));
41+
txnRequest.setAmount(new BigDecimal(amount.toString()));
4242

4343
// Make the API Request
4444
CreateTransactionRequest apiRequest = new CreateTransactionRequest();

src/main/java/net/authorize/sample/PaymentTransactions/RefundTransaction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public static ANetApiResponse run(String apiLoginId, String transactionKey, Doub
3434
TransactionRequestType txnRequest = new TransactionRequestType();
3535
txnRequest.setTransactionType(TransactionTypeEnum.REFUND_TRANSACTION.value());
3636
txnRequest.setRefTransId(transactionID);
37-
txnRequest.setAmount(new BigDecimal(transactionAmount));
37+
txnRequest.setAmount(new BigDecimal(transactionAmount.toString()));
3838
txnRequest.setPayment(paymentType);
3939

4040
// Make the API Request

src/main/java/net/authorize/sample/SampleCode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ private static void RunMethod(String methodName)
170170
DebitBankAccount.run(apiLoginId, transactionKey, 12.93);
171171
break;
172172
case "CreditBankAccount":
173-
CreditBankAccount.run(apiLoginId, transactionKey, transactionId);
173+
CreditBankAccount.run(apiLoginId, transactionKey, transactionId, 12.23);
174174
break;
175175
case "ChargeTokenizedCreditCard":
176176
ChargeTokenizedCreditCard.run(apiLoginId, transactionKey, 12.89);

src/test/java/net/authorize/sample/SampleCodeTest/TestRunner.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ private static Double getAmount()
9090
double d = (double)(1.05 + (450.0 * rgenerator.nextDouble()));
9191
DecimalFormat df = new DecimalFormat("#.##");
9292
d = Double.valueOf(df.format(d));
93-
System.out.println("Amount : " + d);
9493
return d;
9594
}
9695

@@ -257,11 +256,6 @@ public ANetApiResponse TestGetCustomerShippingAddress()
257256
return getResponse;
258257
}
259258

260-
// public ANetApiResponse TestGetCustomerProfileIds()
261-
// {
262-
// return GetCustomerProfileIds.run(apiLoginId, transactionKey);
263-
// }
264-
265259
public ANetApiResponse TestGetCustomerProfile()
266260
{
267261
CreateCustomerProfileResponse response = (CreateCustomerProfileResponse)CreateCustomerProfile.run(apiLoginId, transactionKey, getEmail());
@@ -383,7 +377,7 @@ public ANetApiResponse TestVoidTransaction()
383377

384378
public ANetApiResponse TestCreditBankAccount()
385379
{
386-
return CreditBankAccount.run(apiLoginId, transactionKey, TransactionID);
380+
return CreditBankAccount.run(apiLoginId, transactionKey, TransactionID, getAmount());
387381
}
388382

389383
public ANetApiResponse TestChargeCustomerProfile()

0 commit comments

Comments
 (0)