Skip to content

Commit c7b88bb

Browse files
author
sunnyrajrathod
committed
- Adding samples for new APIs.
1 parent c24fac3 commit c7b88bb

3 files changed

Lines changed: 20 additions & 16 deletions

File tree

src/main/java/net/authorize/sample/CustomerProfiles/GetHostedPaymentPage.java renamed to src/main/java/net/authorize/sample/PaymentTransactions/GetHostedPaymentPage.java

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package net.authorize.sample.CustomerProfiles;
1+
package net.authorize.sample.PaymentTransactions;
22

33
import java.math.BigDecimal;
44
import java.math.RoundingMode;
@@ -7,7 +7,6 @@
77
import net.authorize.api.contract.v1.*;
88
import net.authorize.api.controller.base.ApiOperationBase;
99
import net.authorize.api.controller.GetHostedPaymentPageController;
10-
import net.authorize.api.controller.GetHostedProfilePageController;
1110
import net.authorize.api.controller.base.ApiOperationBase;
1211

1312
public class GetHostedPaymentPage {
@@ -21,24 +20,22 @@ public static ANetApiResponse run(String apiLoginId, String transactionKey, Doub
2120
merchantAuthenticationType.setTransactionKey(transactionKey);
2221
ApiOperationBase.setMerchantAuthentication(merchantAuthenticationType);
2322

24-
PaymentType paymentType = new PaymentType();
25-
CreditCardType creditCard = new CreditCardType();
26-
creditCard.setCardNumber("4242424242424242");
27-
creditCard.setExpirationDate("0822");
28-
paymentType.setCreditCard(creditCard);
29-
3023
// Create the payment transaction request
3124
TransactionRequestType txnRequest = new TransactionRequestType();
3225
txnRequest.setTransactionType(TransactionTypeEnum.AUTH_CAPTURE_TRANSACTION.value());
33-
txnRequest.setPayment(paymentType);
3426
txnRequest.setAmount(new BigDecimal(amount).setScale(2, RoundingMode.CEILING));
3527

36-
SettingType setting = new SettingType();
37-
setting.setSettingName("hostedPaymentReturnOptions");
38-
setting.setSettingValue("https://returnurl.com/return/");
28+
SettingType setting1 = new SettingType();
29+
setting1.setSettingName("hostedPaymentButtonOptions");
30+
setting1.setSettingValue("{\"text\": \"Pay\"}");
31+
32+
SettingType setting2 = new SettingType();
33+
setting2.setSettingName("hostedPaymentOrderOptions");
34+
setting2.setSettingValue("{\"show\": false}");
3935

4036
ArrayOfSetting alist = new ArrayOfSetting();
41-
alist.getSetting().add(setting);
37+
alist.getSetting().add(setting1);
38+
alist.getSetting().add(setting2);
4239

4340
GetHostedPaymentPageRequest apiRequest = new GetHostedPaymentPageRequest();
4441
apiRequest.setTransactionRequest(txnRequest);

src/test/java/net/authorize/sample/SampleCodeTest/SampleCodeList.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ CustomerProfiles.GetCustomerShippingAddress 1 1
1414
CustomerProfiles.GetCustomerProfileIds 0 1
1515
CustomerProfiles.GetCustomerProfile 1 1
1616
CustomerProfiles.GetHostedProfilePage 1 1
17-
CustomerProfiles.GetHostedPaymentPage 0 0
1817
CustomerProfiles.GetCustomerPaymentProfile 1 1
1918
CustomerProfiles.DeleteCustomerShippingAddress 1 1
2019
CustomerProfiles.DeleteCustomerProfile 1 1
@@ -44,12 +43,13 @@ PaymentTransactions.DebitBankAccount 1 1
4443
PaymentTransactions.ChargeTokenizedCreditCard 1 1
4544
PaymentTransactions.UpdateSplitTenderGroup 0 1
4645
PaymentTransactions.UpdateHeldTransation 0 0
46+
PaymentTransactions.GetHostedPaymentPage 1 1
4747
TransactionReporting.GetTransactionList 0 1
4848
TransactionReporting.GetUnsettledTransactionList 0 1
4949
TransactionReporting.GetBatchStatistics 0 1
5050
TransactionReporting.GetSettledBatchList 0 1
5151
TransactionReporting.GetTransactionDetails 1 1
52-
TransactionReporting.GetMerchantDetails 1 1
52+
TransactionReporting.GetMerchantDetails 0 1
5353
MobileInappTransactions.CreateAnApplePayTransaction 0 0
5454
MobileInappTransactions.CreateAnAndroidPayTransaction 0 0
5555
MobileInappTransactions.CreateAnAcceptTransaction 0 0

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
import net.authorize.sample.RecurringBilling.GetSubscriptionStatus;
7272
import net.authorize.sample.RecurringBilling.UpdateSubscription;
7373
import net.authorize.sample.TransactionReporting.GetTransactionDetails;
74+
import net.authorize.sample.PaymentTransactions.GetHostedPaymentPage;
7475

7576
public class TestRunner {
7677

@@ -441,7 +442,8 @@ public ANetApiResponse TestPayPalCredit()
441442
public ANetApiResponse TestPayPalGetDetails()
442443
{
443444
CreateTransactionResponse response = (CreateTransactionResponse)AuthorizationAndCapture.run(apiLoginId, transactionKey, getAmount());
444-
return GetDetails.run(apiLoginId, transactionKey, response.getTransactionResponse().getTransId());
445+
return GetDetails.run(apiLoginId, transactionKey, response.getTransactionResponse()
446+
.getTransId());
445447
}
446448

447449
public ANetApiResponse TestPayPalPriorAuthorizationCapture()
@@ -532,4 +534,9 @@ public ANetApiResponse TestCreateCustomerPaymentProfile()
532534
CreateCustomerProfileResponse response = (CreateCustomerProfileResponse)CreateCustomerProfile.run(apiLoginId, transactionKey, getEmail());
533535
return CreateCustomerPaymentProfile.run(apiLoginId, transactionKey, response.getCustomerProfileId());
534536
}
537+
538+
public ANetApiResponse TestGetHostedPaymentPage()
539+
{
540+
return GetHostedPaymentPage.run(apiLoginId, transactionKey, getAmount());
541+
}
535542
}

0 commit comments

Comments
 (0)