Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pushing GetCustomerPaymentProfileNounce changes in sample code #87

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package net.authorize.sample.CustomerProfiles;

import net.authorize.Environment;
import net.authorize.api.contract.v1.ANetApiResponse;
import net.authorize.api.contract.v1.GetCustomerPaymentProfileNonceRequest;
import net.authorize.api.contract.v1.GetCustomerPaymentProfileNonceResponse;
import net.authorize.api.contract.v1.MerchantAuthenticationType;
import net.authorize.api.contract.v1.MessageTypeEnum;
import net.authorize.api.controller.GetCustomerPaymentProfileNonceController;
import net.authorize.api.controller.base.ApiOperationBase;

public class GetCustomerPaymentProfileNounce {
public static ANetApiResponse run(String apiLoginId, String transactionKey, String customerProfileId,
String customerPaymentProfileId) {

ApiOperationBase.setEnvironment(Environment.SANDBOX);

MerchantAuthenticationType merchantAuthenticationType = new MerchantAuthenticationType();
merchantAuthenticationType.setName(apiLoginId);
merchantAuthenticationType.setTransactionKey(transactionKey);
ApiOperationBase.setMerchantAuthentication(merchantAuthenticationType);

GetCustomerPaymentProfileNonceRequest apiRequest = new GetCustomerPaymentProfileNonceRequest();
apiRequest.setMerchantAuthentication(merchantAuthenticationType);

String refId = "eyJraWQiOiJlOTQ0MDI3Zjg2YWIwMDkxMDAwMDAwMDA1NGNlYTM0ZiIsImFsZyI6IlJTMjU2In0.eyJqdGkiOiIzMjkzMmQwYy1mMzY5LTQ5OWMtOGE1OS0yZWQ1MGNmMDM3NDUiLCJzY29wZXMiOlsicmVhZCIsIndyaXRlIl0sImlhdCI6MTU0MDI0NzY4NTg1MiwiYXNzb2NpYXRlZF9pZCI6IjI0MDY4IiwiY2xpZW50X2lkIjoiVlJsVjZZZXhpRCIsIm1lcmNoYW50X2lkIjoiNzA1ODU4IiwiYWRkaXRpb25hbEluZm8iOiJ7XCJhcGlMb2dpbklkXCI6XCI5MnRrQ0w3cyAgICAgICAgICAgIFwiLFwicm91dGluZ0lkXCI6XCIkJDkydGtDTDdzJCRcIn0iLCJleHBpcmVzX2luIjoxNTQwMjc2NDg1ODU0LCJncmFudF90eXBlIjoiYXV0aG9yaXphdGlvbl9jb2RlIn0.I6KrX2YYF_qhY75cxE84dGuhlwxbLo-AnzNj-k3SdWx74xVT4ptB1S4wzMlf94zJoPt-RxCyzu2ZH20bWJOa-wCd-xmBjT6qDOMzxYz6hmiqzOf7WbaOi5ByaYWcqcU-37z3OMHVwajU2EvHpkK_g38eka17jLajI1YCv41B8suGoxYuSGzKhOWVq0JKAgo9x-Ne7rLiILDPJjqJsoSMsqlGDHbLQ4lVD1YKOila6hlntmnN80g7TBbV_f_ODgwbUXTMhynBB94Nu2SCGWhuOB8y97lRptuT00o9V8JuO_nwZRApHAnMtzihl9pSaXHiDsu5lN36Xxqos-x7BILRgA";
apiRequest.setConnectedAccessToken("refId");
apiRequest.setCustomerProfileId(customerProfileId);
apiRequest.setCustomerPaymentProfileId(customerPaymentProfileId);
GetCustomerPaymentProfileNonceController controller = new GetCustomerPaymentProfileNonceController(apiRequest);
controller.execute();
GetCustomerPaymentProfileNonceResponse response = new GetCustomerPaymentProfileNonceResponse();
response = controller.getApiResponse();

if (response != null) {

if (response.getMessages().getResultCode() == MessageTypeEnum.OK) {

System.out.println("Data Descriptor: " + response.getOpaqueData().getDataDescriptor());
System.out.println("Data Key: " + response.getOpaqueData().getDataKey());
System.out.println("Expiration Time Stamp: " + response.getOpaqueData().getExpirationTimeStamp());
} else {
System.out.println("Invalid Response: " + response.getMessages().getMessage().get(0).getText());
}
}

return response;
}

}
5 changes: 5 additions & 0 deletions src/main/java/net/authorize/sample/SampleCode.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ private static void ShowMethods() {
System.out.println(" ApproveOrDeclineHeldTransaction");
System.out.println(" GetAnAcceptPaymentPage");
System.out.println(" CreateChasePayTransaction");
System.out.println(" GetCustomerPaymentProfileNounce");
}

private static void RunMethod(String methodName) {
Expand Down Expand Up @@ -340,6 +341,10 @@ private static void RunMethod(String methodName) {
case "CreateChasePayTransaction":
CreateChasePayTransaction.run(apiLoginId, transactionKey, amount);
break;
case "GetCustomerPaymentProfileNounce":
GetCustomerPaymentProfileNounce.run(apiLoginId, transactionKey, customerProfileId,
customerPaymentProfileId);
break;
default:
ShowUsage();
break;
Expand Down