getError() {
return this.error;
}
+ // Regardless of type of error, return the RequestId in a consistent way
public String getRequestId() {
- return requestId;
+ if (requestId != null) {
+ return requestId;
+ } else {
+ return requestID;
+ }
}
diff --git a/src/com/amazon/pay/response/model/GetMerchantAccountStatusResponse.java b/src/com/amazon/pay/response/model/GetMerchantAccountStatusResponse.java
new file mode 100644
index 0000000..c22a3a2
--- /dev/null
+++ b/src/com/amazon/pay/response/model/GetMerchantAccountStatusResponse.java
@@ -0,0 +1,65 @@
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License").
+ * You may not use this file except in compliance with the License.
+ * A copy of the License is located at
+ *
+ * http://aws.amazon.com/apache2.0
+ *
+ * or in the "license" file accompanying this file. This file is distributed
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package com.amazon.pay.response.model;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * This represents the parsed response from the Amazon Pay
+ * GetMerchantAccountStatus API.
+ *
+ * {@code
+ *
+ *
+ * ACTIVE
+ *
+ *
+ * 986dce6b-45e2-4883-bbf4-17adce5994a4
+ *
+ *
+ * }
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "getMerchantAccountStatusResult",
+ "responseMetadata"
+})
+@XmlRootElement(name = "GetMerchantAccountStatusResponse")
+public class GetMerchantAccountStatusResponse {
+
+ @XmlElement(name = "GetMerchantAccountStatusResult", required = true)
+ protected GetMerchantAccountStatusResult getMerchantAccountStatusResult;
+
+ @XmlElement(name = "ResponseMetadata", required = true)
+ protected ResponseMetadata responseMetadata;
+
+ public GetMerchantAccountStatusResponse() {
+ super();
+ }
+
+ public GetMerchantAccountStatusResult getMerchantAccountStatusResult() {
+ return getMerchantAccountStatusResult;
+ }
+
+ public ResponseMetadata getResponseMetadata() {
+ return responseMetadata;
+ }
+
+}
diff --git a/src/com/amazon/pay/response/model/GetMerchantAccountStatusResult.java b/src/com/amazon/pay/response/model/GetMerchantAccountStatusResult.java
new file mode 100644
index 0000000..d0b0d97
--- /dev/null
+++ b/src/com/amazon/pay/response/model/GetMerchantAccountStatusResult.java
@@ -0,0 +1,64 @@
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License").
+ * You may not use this file except in compliance with the License.
+ * A copy of the License is located at
+ *
+ * http://aws.amazon.com/apache2.0
+ *
+ * or in the "license" file accompanying this file. This file is distributed
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package com.amazon.pay.response.model;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * This represents the GetMerchantAccountStatusResult node parsed
+ * from the Amazon Pay GetMerchantAccountStatusResponse.
+ *
+ * {@code
+ *
+ * ACTIVE
+ *
+ * }
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "accountStatus"
+})
+@XmlRootElement(name = "GetMerchantAccountStatusResult")
+public class GetMerchantAccountStatusResult {
+
+ @XmlElement(name = "AccountStatus", required = true)
+ protected AccountStatus accountStatus;
+
+ public GetMerchantAccountStatusResult() {
+ super();
+ }
+
+ /**
+ * @return account status:
+ * ACTIVE - Merchant account is active
+ * INACTIVE - Merchant account is not active
+ */
+ public AccountStatus getAccountStatus() {
+ return accountStatus;
+ }
+
+ /**
+ * Returns the string representation of GetMerchantAccountStatusResult
+ */
+ @Override
+ public String toString() {
+ return "GetMerchantAccountStatus{" + "accountStatus=" + accountStatus + "}";
+ }
+}
diff --git a/src/com/amazon/pay/response/model/GetOrderReferenceDetailsResponse.java b/src/com/amazon/pay/response/model/GetOrderReferenceDetailsResponse.java
index 7984495..96617ec 100644
--- a/src/com/amazon/pay/response/model/GetOrderReferenceDetailsResponse.java
+++ b/src/com/amazon/pay/response/model/GetOrderReferenceDetailsResponse.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2016-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
@@ -37,7 +37,7 @@ public class GetOrderReferenceDetailsResponse {
public GetOrderReferenceDetailsResponse() {
super();
}
-
+
public GetOrderReferenceDetailsResult getGetOrderReferenceDetailsResult() {
return getOrderReferenceDetailsResult;
}
@@ -45,8 +45,7 @@ public GetOrderReferenceDetailsResult getGetOrderReferenceDetailsResult() {
public ResponseMetadata getResponseMetadata() {
return responseMetadata;
}
-
-
+
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"orderReferenceDetails"
@@ -65,4 +64,4 @@ public OrderReferenceDetails getOrderReferenceDetails() {
return orderReferenceDetails;
}
}
-}
\ No newline at end of file
+}
diff --git a/src/com/amazon/pay/response/model/OrderReferenceDetails.java b/src/com/amazon/pay/response/model/OrderReferenceDetails.java
index f122121..e1da6f1 100644
--- a/src/com/amazon/pay/response/model/OrderReferenceDetails.java
+++ b/src/com/amazon/pay/response/model/OrderReferenceDetails.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2016-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * Copyright 2016-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
@@ -44,7 +44,9 @@
"idList",
"orderLanguage",
"requestPaymentAuthorization",
- "paymentServiceProviderAttributes"
+ "paymentServiceProviderAttributes",
+ "paymentReference",
+ "paymentAuthenticationStatus"
})
public class OrderReferenceDetails {
@@ -88,6 +90,10 @@ public class OrderReferenceDetails {
protected Boolean requestPaymentAuthorization;
@XmlElement(name = "PaymentServiceProviderAttributes")
protected PaymentServiceProviderAttributes paymentServiceProviderAttributes;
+ @XmlElement(name = "PaymentReference")
+ protected PaymentReference paymentReference;
+ @XmlElement(name = "PaymentAuthenticationStatus")
+ protected PaymentAuthenticationStatus paymentAuthenticationStatus;
public OrderReferenceDetails() {
super();
@@ -284,9 +290,24 @@ public PaymentServiceProviderAttributes getPaymentServiceProviderAttributes() {
}
/**
- * String representation of OrderReferenceDetails
+ *
+ * @return paymentReference
*/
+ public PaymentReference getPaymentReference() {
+ return paymentReference;
+ }
+ /**
+ *
+ * @return paymentAuthenticationStatus
+ */
+ public PaymentAuthenticationStatus getPaymentAuthenticationStatus() {
+ return paymentAuthenticationStatus;
+ }
+
+ /**
+ * String representation of OrderReferenceDetails
+ */
@Override
public String toString() {
return "OrderReferenceDetails{"
@@ -308,6 +329,9 @@ public String toString() {
+ ", idList=" + idList
+ ", orderLanguage=" + orderLanguage
+ ", requestPaymentAuthorization=" + requestPaymentAuthorization
- + ", paymentServiceProviderAttributes=" + paymentServiceProviderAttributes + '}';
+ + ", paymentServiceProviderAttributes=" + paymentServiceProviderAttributes
+ + ", paymentReference=" + paymentReference
+ + ", paymentAuthenticationStatus=" + paymentAuthenticationStatus
+ + '}';
}
}
diff --git a/src/com/amazon/pay/response/model/OrderReferenceList.java b/src/com/amazon/pay/response/model/OrderReferenceList.java
index 8079282..e3f984f 100644
--- a/src/com/amazon/pay/response/model/OrderReferenceList.java
+++ b/src/com/amazon/pay/response/model/OrderReferenceList.java
@@ -23,6 +23,18 @@
import java.util.ArrayList;
import java.util.List;
+/**
+ * This represents the OrderReferenceList node parsed
+ * from the Amazon Pay ListOrderReference API response.
+ *
+ * <OrderReferenceList>
+ * <OrderReference>
+ * ...
+ * </OrderReference>
+ * </OrderReferenceList>
+ *
+ */
+
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"orderReferences"
@@ -47,4 +59,4 @@ public List getOrderReferences() {
}
return orderReferences;
}
-}
\ No newline at end of file
+}
diff --git a/src/com/amazon/pay/response/model/PaymentAuthenticationStatus.java b/src/com/amazon/pay/response/model/PaymentAuthenticationStatus.java
new file mode 100644
index 0000000..1bad2f1
--- /dev/null
+++ b/src/com/amazon/pay/response/model/PaymentAuthenticationStatus.java
@@ -0,0 +1,50 @@
+/**
+ * Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License").
+ * You may not use this file except in compliance with the License.
+ * A copy of the License is located at
+ *
+ * http://aws.amazon.com/apache2.0
+ *
+ * or in the "license" file accompanying this file. This file is distributed
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package com.amazon.pay.response.model;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "PaymentAuthenticationStatus", propOrder = {
+ "state"
+})
+
+public class PaymentAuthenticationStatus {
+ @XmlElement(name = "State")
+ protected String state;
+
+ public PaymentAuthenticationStatus() {
+ super();
+ }
+
+ /**
+ * @return The Strong Customer Authentication (SCA) payment authentication status flag
+ */
+ @Deprecated
+ public String getState() {
+ return state;
+ }
+
+ @Override
+ public String toString() {
+ return "PaymentAuthenticationStatus{"
+ + "state=" + state
+ + '}';
+ }
+}
diff --git a/src/com/amazon/pay/response/model/PaymentReference.java b/src/com/amazon/pay/response/model/PaymentReference.java
new file mode 100644
index 0000000..e776309
--- /dev/null
+++ b/src/com/amazon/pay/response/model/PaymentReference.java
@@ -0,0 +1,50 @@
+/**
+ * Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License").
+ * You may not use this file except in compliance with the License.
+ * A copy of the License is located at
+ *
+ * http://aws.amazon.com/apache2.0
+ *
+ * or in the "license" file accompanying this file. This file is distributed
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package com.amazon.pay.response.model;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "PaymentReference", propOrder = {
+ "staticToken"
+})
+
+public class PaymentReference {
+ @XmlElement(name = "StaticToken")
+ protected String staticToken;
+
+ public PaymentReference() {
+ super();
+ }
+
+ /**
+ * @return The unique payment instrument token.
+ */
+ @Deprecated
+ public String getStaticToken() {
+ return staticToken;
+ }
+
+ @Override
+ public String toString() {
+ return "PaymentReference{"
+ + "staticToken=" + staticToken
+ + '}';
+ }
+}
diff --git a/src/com/amazon/pay/response/model/SellerOrderAttributes.java b/src/com/amazon/pay/response/model/SellerOrderAttributes.java
index 5fa1ba9..49a652d 100644
--- a/src/com/amazon/pay/response/model/SellerOrderAttributes.java
+++ b/src/com/amazon/pay/response/model/SellerOrderAttributes.java
@@ -26,6 +26,7 @@
@XmlType(name = "SellerOrderAttributes", propOrder = {
"sellerOrderId",
"storeName",
+ "supplementaryData",
"orderItemCategories",
"customInformation",
"sellerId"
@@ -36,6 +37,8 @@ public class SellerOrderAttributes {
protected String sellerOrderId;
@XmlElement(name = "StoreName")
protected String storeName;
+ @XmlElement(name = "SupplementaryData")
+ protected String supplementaryData;
@XmlElement(name = "OrderItemCategories")
protected OrderItemCategories orderItemCategories;
@XmlElement(name = "CustomInformation")
@@ -72,6 +75,16 @@ public String getStoreName() {
}
+ /**
+ * Returns the trusted authorization supplementary data.
+ *
+ * @return supplementaryData as a JSON string
+ */
+ public String getSupplementaryData() {
+ return supplementaryData;
+ }
+
+
/**
*
* @return orderItemCategories
@@ -110,6 +123,7 @@ public String toString() {
return "SellerOrderAttributes{"
+ "sellerOrderId=" + sellerOrderId
+ ", storeName=" + storeName
+ + ", supplementaryData=" + supplementaryData
+ ", sellerId=" + sellerId
+ ", orderItemCategorie=" + orderItemCategories
+ ", customInformation=" + customInformation + '}';
diff --git a/src/com/amazon/pay/response/parser/GetMerchantAccountStatusResponseData.java b/src/com/amazon/pay/response/parser/GetMerchantAccountStatusResponseData.java
new file mode 100644
index 0000000..832942e
--- /dev/null
+++ b/src/com/amazon/pay/response/parser/GetMerchantAccountStatusResponseData.java
@@ -0,0 +1,70 @@
+/**
+ * Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License").
+ * You may not use this file except in compliance with the License.
+ * A copy of the License is located at
+ *
+ * http://aws.amazon.com/apache2.0
+ *
+ * or in the "license" file accompanying this file. This file is distributed
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package com.amazon.pay.response.parser;
+
+import com.amazon.pay.response.model.AccountStatus;
+import com.amazon.pay.response.model.GetMerchantAccountStatusResponse;
+
+import java.io.Serializable;
+
+/**
+ * Response from GetMerchantAccountStatus API, as returned by Amazon Pay
+ */
+public final class GetMerchantAccountStatusResponseData extends ResponseData implements Serializable {
+
+ private String requestId;
+ private AccountStatus accountStatus;
+
+ public GetMerchantAccountStatusResponseData(GetMerchantAccountStatusResponse response, ResponseData rawResponse) {
+ super(rawResponse);
+ if (response != null) {
+ this.requestId = response.getResponseMetadata().getRequestId();
+ if (response.getMerchantAccountStatusResult() != null) {
+ accountStatus = response.getMerchantAccountStatusResult().getAccountStatus();
+ }
+ }
+ }
+
+ /**
+ * The AccountStatus enum that identifies the merchant acconut as
+ * being ACTIVE or INACTIVE.
+ *
+ * @return The AccountStatus enum.
+ */
+ public AccountStatus getAccountStatus() {
+ return accountStatus;
+ }
+
+ /**
+ * The requestID that uniquely identifies the service request
+ * the caller made.
+ *
+ * @return The requestID that uniquely identifies the service request
+ * the caller made.
+ */
+ public String getRequestId() {
+ return requestId;
+ }
+
+ /**
+ * Returns the string representation of GetOrderReferenceDetailsResponseData
+ */
+ @Override
+ public String toString() {
+ return "GetServiceStatusResponseData{" + "requestId=" + requestId +
+ ", accountStatus=" + accountStatus + "}";
+ }
+
+}
diff --git a/src/com/amazon/pay/response/parser/GetOrderReferenceDetailsResponseData.java b/src/com/amazon/pay/response/parser/GetOrderReferenceDetailsResponseData.java
index cbf5f15..d5cb337 100644
--- a/src/com/amazon/pay/response/parser/GetOrderReferenceDetailsResponseData.java
+++ b/src/com/amazon/pay/response/parser/GetOrderReferenceDetailsResponseData.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2016-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
@@ -21,16 +21,16 @@
/**
* Response from GetOrderReferenceDetails service API, as returned by Amazon Pay
*/
-public final class GetOrderReferenceDetailsResponseData extends ResponseData implements Serializable{
-
+public final class GetOrderReferenceDetailsResponseData extends ResponseData implements Serializable {
+
private String requestId;
private OrderReferenceDetails orderReferenceDetails;
-
+
public GetOrderReferenceDetailsResponseData(GetOrderReferenceDetailsResponse response , ResponseData rawResponse) {
super(rawResponse);
- if(response != null) {
+ if (response != null) {
this.requestId = response.getResponseMetadata().getRequestId();
- if(response.getGetOrderReferenceDetailsResult() != null) {
+ if (response.getGetOrderReferenceDetailsResult() != null) {
orderReferenceDetails = response.getGetOrderReferenceDetailsResult().getOrderReferenceDetails();
}
}
@@ -39,7 +39,7 @@ public GetOrderReferenceDetailsResponseData(GetOrderReferenceDetailsResponse res
/**
* The requestID that uniquely identifies the service request
* the caller made.
- *
+ *
* @return The requestID that uniquely identifies the service request
* the caller made.
*/
@@ -63,8 +63,5 @@ public OrderReferenceDetails getDetails() {
public String toString() {
return "GetOrderReferenceDetailsResponseData{" + "requestId=" + requestId + ", orderReferenceDetails=" + orderReferenceDetails.toString() + '}';
}
-
-
-
}
diff --git a/src/com/amazon/pay/response/parser/Parser.java b/src/com/amazon/pay/response/parser/Parser.java
index 08ab564..779f3d9 100644
--- a/src/com/amazon/pay/response/parser/Parser.java
+++ b/src/com/amazon/pay/response/parser/Parser.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2016-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
@@ -29,6 +29,7 @@
import com.amazon.pay.response.model.GetBillingAgreementDetailsResponse;
import com.amazon.pay.response.model.GetCaptureDetailsResponse;
import com.amazon.pay.response.model.GetOrderReferenceDetailsResponse;
+import com.amazon.pay.response.model.GetMerchantAccountStatusResponse;
import com.amazon.pay.response.model.GetProviderCreditReversalDetailsResponse;
import com.amazon.pay.response.model.GetProviderCreditDetailsResponse;
import com.amazon.pay.response.model.GetRefundDetailsResponse;
@@ -178,17 +179,22 @@ public static CreateOrderReferenceForIdResponseData createOrderReferenceForId(
public static ListOrderReferenceResponseData listOrderReference(ResponseData rawResponse) throws AmazonServiceException {
final ListOrderReferenceResponse response = marshalXML(ListOrderReferenceResponse.class, rawResponse);
- return new ListOrderReferenceResponseData(response,rawResponse);
+ return new ListOrderReferenceResponseData(response, rawResponse);
}
public static ListOrderReferenceByNextTokenResponseData listOrderReferenceByNextToken(ResponseData rawResponse) throws AmazonServiceException {
final ListOrderReferenceByNextTokenResponse response = marshalXML(ListOrderReferenceByNextTokenResponse.class, rawResponse);
- return new ListOrderReferenceByNextTokenResponseData(response,rawResponse);
+ return new ListOrderReferenceByNextTokenResponseData(response, rawResponse);
}
public static SetOrderAttributesResponseData setOrderAttributes(ResponseData rawResponse) throws AmazonServiceException {
final SetOrderAttributesResponse response = marshalXML(SetOrderAttributesResponse.class, rawResponse);
- return new SetOrderAttributesResponseData(response,rawResponse);
+ return new SetOrderAttributesResponseData(response, rawResponse);
+ }
+
+ public static GetMerchantAccountStatusResponseData getMerchantAccountStatus(ResponseData rawResponse) throws AmazonServiceException {
+ final GetMerchantAccountStatusResponse response = marshalXML(GetMerchantAccountStatusResponse.class, rawResponse);
+ return new GetMerchantAccountStatusResponseData(response, rawResponse);
}
public static T marshalXML(Class clazz, ResponseData rawResponse) throws AmazonServiceException {
@@ -232,7 +238,7 @@ public static void generateErrorException(ResponseData rawResponse) throws Amazo
final StringReader reader = new StringReader(noNamespaceXML);
final Unmarshaller unmarshaller = context.createUnmarshaller();
- final XMLInputFactory xmlInputFactory = XMLInputFactory.newFactory();
+ final XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance();
xmlInputFactory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false);
xmlInputFactory.setProperty(XMLInputFactory.SUPPORT_DTD, false);
try {
diff --git a/src/com/amazon/pay/response/parser/ResponseData.java b/src/com/amazon/pay/response/parser/ResponseData.java
index f36a885..2d1aedd 100644
--- a/src/com/amazon/pay/response/parser/ResponseData.java
+++ b/src/com/amazon/pay/response/parser/ResponseData.java
@@ -59,6 +59,8 @@ public String toXML() {
/**
* Converts the raw XML response to JSON format
*
+ * @throws JSONException
+ * If the XML response cannot be converted into JSON
* @return
* JSON representation of response returned by Amazon Service API
*/
diff --git a/src/com/amazon/pay/types/BillingAgreementType.java b/src/com/amazon/pay/types/BillingAgreementType.java
new file mode 100644
index 0000000..3fd87c3
--- /dev/null
+++ b/src/com/amazon/pay/types/BillingAgreementType.java
@@ -0,0 +1,25 @@
+/**
+ * Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License").
+ * You may not use this file except in compliance with the License.
+ * A copy of the License is located at
+ *
+ * http://aws.amazon.com/apache2.0
+ *
+ * or in the "license" file accompanying this file. This file is distributed
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package com.amazon.pay.types;
+
+/**
+ * Attribute to determine whether the Billing Agreement is merchant initiated or customer initiated.
+ */
+
+public enum BillingAgreementType {
+ CustomerInitiatedTransaction,
+ MerchantInitiatedTransaction
+}
diff --git a/src/com/amazon/pay/types/ServiceConstants.java b/src/com/amazon/pay/types/ServiceConstants.java
index 569f636..b6ca2c0 100644
--- a/src/com/amazon/pay/types/ServiceConstants.java
+++ b/src/com/amazon/pay/types/ServiceConstants.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2016-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * Copyright 2016-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
@@ -42,11 +42,17 @@ public class ServiceConstants {
public static final String BA_CUSTOM_INFORMATION = "SellerOrderAttributes.CustomInformation";
public static final String BA_SELLER_ORDER_ID = "SellerOrderAttributes.SellerOrderId";
public static final String BA_STORE_NAME = "SellerOrderAttributes.StoreName";
+ public static final String BA_SUPPLEMENTARY_DATA = "SellerOrderAttributes.SupplementaryData";
+ public static final String BA_SELLER_NOTE = "SellerNote";
+ public static final String BA_PLATFORM_ID = "PlatformId";
public static final String BILLING_AGREEMENT_PLATFORM_ID = "BillingAgreementAttributes.PlatformId";
public static final String BILLING_AGREEMENT_SELLER_BILLING_AGREEMENT_ID = "BillingAgreementAttributes.SellerBillingAgreementAttributes.SellerBillingAgreementId";
public static final String BILLING_AGREEMENT_SELLER_CUSTOM_INFORMATION = "BillingAgreementAttributes.SellerBillingAgreementAttributes.CustomInformation";
public static final String BILLING_AGREEMENT_SELLER_NOTE = "BillingAgreementAttributes.SellerNote";
public static final String BILLING_AGREEMENT_SELLER_STORE_NAME = "BillingAgreementAttributes.SellerBillingAgreementAttributes.StoreName";
+ public static final String BILLING_AGREEMENT_TYPE = "BillingAgreementAttributes.BillingAgreementType";
+ public static final String BILLING_AGREEMENT_SUBSCRIPTION_AMOUNT_CURRENCY_CODE = "BillingAgreementAttributes.SubscriptionAmount.CurrencyCode";
+ public static final String BILLING_AGREEMENT_SUBSCRIPTION_AMOUNT_AMOUNT = "BillingAgreementAttributes.SubscriptionAmount.Amount";
public static final String CANCELATION_REASON = "CancelationReason";
public static final String CAPTURE_AMOUNT = "CaptureAmount.Amount";
public static final String CAPTURE_CURRENCEYCODE = "CaptureAmount.CurrencyCode";
@@ -75,6 +81,7 @@ public class ServiceConstants {
public static final String SELLER_REFUND_NOTE = "SellerRefundNote";
public static final String SOFT_DESCRIPTOR = "SoftDescriptor";
public static final String STORE_NAME = "OrderReferenceAttributes.SellerOrderAttributes.StoreName";
+ public static final String SUPPLEMENTARY_DATA = "OrderReferenceAttributes.SellerOrderAttributes.SupplementaryData";
public static final String REQUEST_PAYMENT_AUTHORIZATION = "OrderReferenceAttributes.RequestPaymentAuthorization";
public static final String TRANSACTION_TIMEOUT = "TransactionTimeout";
public static final String ORDER_ATTRIBUTES_AMOUNT = "OrderAttributes.OrderTotal.Amount";
@@ -88,6 +95,10 @@ public class ServiceConstants {
public static final String ORDER_ATTRIBUTES_ORDER_ITEM_CATEGORIES = "OrderAttributes.SellerOrderAttributes.OrderItemCategories.OrderItemCategory";
public static final String ORDER_ATTRIBUTES_SELLER_ORDER_ID = "OrderAttributes.SellerOrderAttributes.SellerOrderId";
public static final String ORDER_ATTRIBUTES_STORE_NAME = "OrderAttributes.SellerOrderAttributes.StoreName";
+ public static final String ORDER_ATTRIBUTES_SUPPLEMENTARY_DATA = "OrderAttributes.SellerOrderAttributes.SupplementaryData";
+ public static final String SUCCESS_URL = "SuccessUrl";
+ public static final String FAILURE_URL = "FailureUrl";
+ public static final String EXPECT_IMMEDIATE_AUTHORIZATION = "ExpectImmediateAuthorization";
// API Request Parameters - (Mostly) Required Parameters
public static final String ACTION = "Action";
@@ -139,9 +150,10 @@ public class ServiceConstants {
public static final String LIST_ORDER_REFERENCE = "ListOrderReference";
public static final String LIST_ORDER_REFERENCE_BY_NEXT_TOKEN = "ListOrderReferenceByNextToken";
public static final String SET_ORDER_ATTRIBUTES = "SetOrderAttributes";
+ public static final String GET_MERCHANT_ACCOUNT_STATUS = "GetMerchantAccountStatus";
// SDK version
- public static final String APPLICATION_LIBRARY_VERSION = "3.3.2";
+ public static final String APPLICATION_LIBRARY_VERSION = "3.7.1";
public static final String GITHUB_SDK_NAME = "amazon-pay-sdk-java";
// Exponential backoff wait times (milliseconds) for retry operations
@@ -149,6 +161,10 @@ public class ServiceConstants {
public static final int SECOND_RETRY_WAIT_TIME = 4000;
public static final int THIRD_RETRY_WAIT_TIME = 10000;
+ // HTTP timeouts (milliseconds)
+ public static final int HTTP_READ_TIMEOUT = 30000;
+ public static final int HTTP_CONNECT_TIMEOUT = 30000;
+
static {
Map mwsEndpointMappingsMap = new HashMap();
mwsEndpointMappingsMap.put(Region.UK, "https://mws-eu.amazonservices.com");
@@ -172,4 +188,13 @@ public class ServiceConstants {
profileEndpointSandboxMappings = Collections.unmodifiableMap(profileEndpointSandboxMappingsMap);
}
+ public static final String ERROR_DESCRIPTION = "error_description";
+ public static final String ERROR = "error";
+ public static final String GET = "GET";
+ public static final String UTF_8 = "UTF-8";
+ public static final String X_AMZ_ACCESS_TOKEN = "x-amz-access-token";
+ public static final String AUTH_O2_TOKENINFO_URI = "/auth/o2/tokeninfo";
+ public static final String USER_PROFILE_URI = "/user/profile";
+ public static final String HMAC_SHA256 = "HmacSHA256";
+
}
diff --git a/tst/com/amazon/pay/TestConstants.java b/tst/com/amazon/pay/TestConstants.java
index 606d27f..f5e7b9f 100644
--- a/tst/com/amazon/pay/TestConstants.java
+++ b/tst/com/amazon/pay/TestConstants.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2016-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * Copyright 2016-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
@@ -16,8 +16,9 @@
package com.amazon.pay;
public class TestConstants {
+
public static final String billingAgreementId = "CTEST_AMAZON_BILLING_AGREEMENT_ID";
- public static final String billinAgreementIdDraft ="TEST_AMAZON_BILLING_AGREEMENT_ID_DRAFT";
+ public static final String billinAgreementIdDraft = "TEST_AMAZON_BILLING_AGREEMENT_ID_DRAFT";
public static final String addressConsentToken = "TEST_ADDRESS_CONSENT_TOKEN";
public static final String clientId = "TEST_CLIENT_ID";
public static final String tokenInfoResponse = "{\"aud\":\"TEST_CLIENT_ID\",\"user_id\":\"amzn1.account.AF5W6J2OG52NKFJGEN52GEZ5CWFQ\",\"iss\":\"https://www.amazon.com\",\"exp\":2370,\"app_id\":\"amzn1.application.5286e3c9cac24d8188908b500f4a05a5\",\"iat\":1446510240}";
@@ -25,21 +26,22 @@ public class TestConstants {
public static final String userInfoResponse = "{\"user_id\":\"amzn1.account.AF5W6J2OG52NKFJGEN52GEZ5CWFQ\",\"name\":\"Test Buyer\",\"email\":\"testbuyer2@amazon.com\"}";
public static final String merchantId = "TEST_MERCHANT_ID";
public static final String accessKey = "TEST_ACCESS_KEY";
- public static final String secretKey = "TEST_SECRET_KEY";
+ public static final char [] secretKey = new char[] {'T','E','S','T','_','S','E','C','R','E','T','_','K','E','Y'};
public static final String region = "us";
public static final String sandbox_mode = "true";
- public static final String timeStamp = "2015-00-00T00:00:00Z";
- public static final String urlEncoded_TimeStamp = "2015-00-00T00%3A00%3A00Z";
+ public static final String timeStamp = "2015-12-31T23:59:58Z";
+ public static final String urlEncoded_TimeStamp = "2015-12-31T23%3A59%3A58Z";
public static final String platformId = "A11WKBU7ADWTAU";
public static final String MWS_URL = "https://mws.amazonservices.com/OffAmazonPayments_Sandbox/2013-01-01";
public static final String mwsAuthToken = "TEST_MWS_AUTH_TOKEN";
- public static final String sampletext ="testNote";
- public static final String storeName ="TestStore";
+ public static final String sampletext = "testNote";
+ public static final String storeName = "TestStore";
public static final String sellerBillingAgreementId = "TEST_BILLING_AGREEMENT_ID";
public static final String softDescriptor = "AMZNTestTest";
public static final String amazonOrderReferenceId = "AMAZON_ORDER_REFERENCE_ID";
public static final String Endpoint500 = "https://www.example.com/";
public static final String providerSellerId = "TEST_PROVIDER_SELLER_ID";
+ public static final String overrideSellerId = "OVERRIDE_SELLER_ID";
public static final String providerCreditId = "TEST_PROVIDER_CREDIT";
public static final String reversalProviderCreditId = "TEST_PROVIDER_REVERSAL_CREDIT";
public static final String reversalProviderCreditReferenceId = "TEST_PROVIDER_REVERSAL_CREDIT_REFERENCE_ID";
@@ -47,11 +49,16 @@ public class TestConstants {
public static final String creditReferenceReversalId = "TEST_CREDIT_REFERENCE_REVERSAL_ID";
public static final String authorizationReferenceId = "TEST_AUTHORIZATION_REFERENCE_ID";
public static final String userProfileURL = "https://api.sandbox.amazon.com/user/profile";
- public static final String tokenInfoURL = "https://api.sandbox.amazon.com/auth/o2/tokeninfo?access_token=";
+ public static final String tokenInfoURL = "https://api.sandbox.amazon.com/auth/o2/tokeninfo";
public static final String OVERRIDE_SERVICE_URL = "https://override.service.test";
public static final String OVERRIDE_PROFILE_URL = "https://override.profile.test";
public static final String queryId = "OR-12345";
public static final String queryIdType = "SellerOrderId";
public static final int pageSize = 5;
public static final String nextPageToken = "1eUc0QkJMVnJpcGgrbDNHclpIUT09IiwibWFya2V0cGxhY2VJZCI6IkEzQlhCMFlOM1hIMTdIIn0=";
+ public static final String SUPPLEMENTARY_DATA = "{\"AirlineMetaData\" : {\"version\": 1.0, \"airlineCode\": \"WN\", \"flightDate\": \"2018-03-24T20:29:19.22Z\", \"departureAirport\": \"CDG\", \"destinationAirport\": \"LUX\", \"bookedLastTime\": -1, \"classOfTravel\": \"F\", \"passengers\": {\"numberOfPassengers\": 4, \"numberOfChildren\": 1, \"numberOfInfants\": 1 }}, \"AccommodationMetaData\": {\"version\": 1.0, \"startDate\": \"2018-03-24T20:29:19.22Z\", \"endDate\": \"2018-03-24T20:29:19.22Z\", \"lengthOfStay\": 5, \"numberOfGuests\": 4, \"class\": \"Standard\", \"starRating\": 5, \"bookedLastTime\": -1 }, \"OrderMetaData\": {\"version\": 1.0, \"numberOfItems\": 3, \"type\": \"Digital\" }, \"BuyerMetaData\": {\"version\" : 1.0, \"isFirstTimeCustomer\" : true, \"numberOfPastPurchases\" : 2, \"numberOfDisputedPurchases\" : 3, \"hasOpenDispute\" : true, \"riskScore\" : 0.75 }}";
+ public static final String AUTHORIZE_AMOUNT = "0.01";
+ public static final String SUCCESS_URL = "https://pay.amazon.com/success.html";
+ public static final String FAILURE_URL = "https://pay.amazon.com/failure.html";
+
}
diff --git a/tst/com/amazon/pay/impl/LoginUserInfoTest.java b/tst/com/amazon/pay/impl/LoginUserInfoTest.java
index 2a2e056..fb7ae37 100644
--- a/tst/com/amazon/pay/impl/LoginUserInfoTest.java
+++ b/tst/com/amazon/pay/impl/LoginUserInfoTest.java
@@ -1,3 +1,17 @@
+/**
+ * Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License").
+ * You may not use this file except in compliance with the License.
+ * A copy of the License is located at
+ *
+ * http://aws.amazon.com/apache2.0
+ *
+ * or in the "license" file accompanying this file. This file is distributed
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
package com.amazon.pay.impl;
import com.amazon.pay.TestConstants;
@@ -5,7 +19,9 @@
import com.amazon.pay.response.parser.ResponseData;
import com.amazon.pay.types.CurrencyCode;
import com.amazon.pay.types.Region;
+import com.amazon.pay.types.ServiceConstants;
import com.amazon.pay.types.User;
+import java.net.HttpURLConnection;
import java.net.URLDecoder;
import java.util.HashMap;
import java.util.Map;
@@ -17,16 +33,15 @@
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
-
@RunWith(PowerMockRunner.class)
@PrepareForTest(Util.class)
public class LoginUserInfoTest {
-
+
private final String accessToken = TestConstants.addressConsentToken;
private final String clientId = TestConstants.clientId;
private PayConfig config;
private PayClient client;
-
+
@Before
public void setUp() throws Exception {
PowerMockito.spy(Util.class);
@@ -37,36 +52,34 @@ public void setUp() throws Exception {
.withCurrencyCode(CurrencyCode.USD)
.withSandboxMode(true)
.withRegion(Region.US);
-
client = new PayClient(config);
}
-
- @Test
+
+ @Test
public void testGetUserInfo() throws Exception {
-
- ResponseData tokenInfoResponse = new ResponseData(200 , TestConstants.tokenInfoResponse);
- String tokenInfoURL = TestConstants.tokenInfoURL + URLDecoder.decode(accessToken, "UTF-8");
- PowerMockito.doReturn(tokenInfoResponse).when(Util.class, "httpSendRequest" , "GET", tokenInfoURL , null , new HashMap(), null);
-
- ResponseData userInfoResponse = new ResponseData(200 , TestConstants.userInfoResponse);
- Map headerValues = new HashMap();
- headerValues.put("Authorization" , "bearer " + URLDecoder.decode(accessToken, "UTF-8"));
- PowerMockito.doReturn(userInfoResponse).when(Util.class, "httpSendRequest" ,
- "GET", TestConstants.userProfileURL , null , headerValues);
+ final Map headerValues = new HashMap();
+ headerValues.put(ServiceConstants.X_AMZ_ACCESS_TOKEN, accessToken);
+ final ResponseData tokenInfoResponse = new ResponseData(HttpURLConnection.HTTP_OK, TestConstants.tokenInfoResponse);
+ final String tokenInfoURL = TestConstants.tokenInfoURL;
+ PowerMockito.doReturn(tokenInfoResponse).when(Util.class, "httpSendRequest", ServiceConstants.GET, tokenInfoURL, null, headerValues, null);
+ final ResponseData userInfoResponse = new ResponseData(HttpURLConnection.HTTP_OK, TestConstants.userInfoResponse);
+ PowerMockito.doReturn(userInfoResponse).when(Util.class, "httpSendRequest",
+ ServiceConstants.GET, TestConstants.userProfileURL, null, headerValues);
User user = client.getUserInfo(accessToken, clientId);
Assert.assertEquals("testbuyer2@amazon.com", user.getEmail());
Assert.assertEquals("Test Buyer", user.getName());
Assert.assertEquals("amzn1.account.AF5W6J2OG52NKFJGEN52GEZ5CWFQ", user.getUserId());
-
}
-
+
@Test(expected=AmazonServiceException.class)
- public void testInvalidAccessToken () throws Exception{
- ResponseData userProfileErrorResponse = new ResponseData(200 , TestConstants.userProfileErrorResponse);
- String tokenInfoURL = TestConstants.tokenInfoURL + URLDecoder.decode(accessToken, "UTF-8");
- PowerMockito.doReturn(userProfileErrorResponse).when(Util.class, "httpSendRequest" , "GET", tokenInfoURL , null , new HashMap());
- User user = client.getUserInfo(accessToken, clientId);
+ public void testInvalidAccessToken() throws Exception {
+ final Map headerValues = new HashMap();
+ headerValues.put(ServiceConstants.X_AMZ_ACCESS_TOKEN, accessToken);
+ final ResponseData userProfileErrorResponse = new ResponseData(HttpURLConnection.HTTP_OK, TestConstants.userProfileErrorResponse);
+ final String tokenInfoURL = TestConstants.tokenInfoURL;
+ PowerMockito.doReturn(userProfileErrorResponse).when(Util.class, "httpSendRequest", ServiceConstants.GET, tokenInfoURL, null, headerValues);
+ final User user = client.getUserInfo(accessToken, clientId);
}
}
diff --git a/tst/com/amazon/pay/impl/PaymentsConfigTest.java b/tst/com/amazon/pay/impl/PaymentsConfigTest.java
index 8ca4a81..192a464 100644
--- a/tst/com/amazon/pay/impl/PaymentsConfigTest.java
+++ b/tst/com/amazon/pay/impl/PaymentsConfigTest.java
@@ -92,7 +92,7 @@ public void testPaymentsPropertiesConfigOverride() throws Exception {
private void assertConfigValues(PayConfig config, boolean usingOverride) {
Assert.assertEquals(config.getAccessKey() , TestConstants.accessKey);
- Assert.assertEquals(config.getSecretKey() , TestConstants.secretKey);
+ Assert.assertArrayEquals(config.getSecretKey() , TestConstants.secretKey);
Assert.assertEquals(config.getRegion(), Region.US);
Assert.assertEquals(config.getRegion().toString().toLowerCase(), "us");
Assert.assertEquals(Region.valueOf("US"), Region.US);
diff --git a/tst/com/amazon/pay/impl/SignatureAndURLTest.java b/tst/com/amazon/pay/impl/SignatureAndURLTest.java
index 5aa43c3..8773aca 100644
--- a/tst/com/amazon/pay/impl/SignatureAndURLTest.java
+++ b/tst/com/amazon/pay/impl/SignatureAndURLTest.java
@@ -1,7 +1,22 @@
+/**
+ * Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License").
+ * You may not use this file except in compliance with the License.
+ * A copy of the License is located at
+ *
+ * http://aws.amazon.com/apache2.0
+ *
+ * or in the "license" file accompanying this file. This file is distributed
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
package com.amazon.pay.impl;
import com.amazon.pay.request.RequestHelper;
import com.amazon.pay.TestConstants;
+import com.amazon.pay.request.ConfirmOrderReferenceRequest;
import com.amazon.pay.request.GetOrderReferenceDetailsRequest;
import com.amazon.pay.request.SetOrderReferenceDetailsRequest;
import com.amazon.pay.response.model.Environment;
@@ -16,16 +31,14 @@
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
-
@RunWith(PowerMockRunner.class)
@PowerMockIgnore({"javax.crypto.*" })
@PrepareForTest(Util.class)
public class SignatureAndURLTest {
-
- PayConfig config;
- String mcokTimeStamp = "2015-01-01";
- RequestHelper helper;
-
+
+ private PayConfig config;
+ private RequestHelper helper;
+
@Before
public void setUp() throws Exception {
config = new PayConfig().withAccessKey(TestConstants.accessKey)
@@ -35,33 +48,146 @@ public void setUp() throws Exception {
.withRegion(Region.US)
.withSandboxMode(true);
this.helper = new RequestHelper(config);
- PowerMockito.stub(PowerMockito.method(Util.class , "getTimestamp")).toReturn(mcokTimeStamp);
+ PowerMockito.stub(PowerMockito.method(Util.class , "getTimestamp")).toReturn(TestConstants.timeStamp);
}
- @Test
- public void testRequestUrlAndSignature() throws Exception{
+ @Test
+ public void testRequestUrlAndSignature() throws Exception {
this.helper = new RequestHelper(config);
- PowerMockito.stub(PowerMockito.method(Util.class , "getTimestamp")).toReturn(mcokTimeStamp);
- GetOrderReferenceDetailsRequest request = new GetOrderReferenceDetailsRequest(TestConstants.amazonOrderReferenceId);
- String action = "GetOrderReferenceDetails";
- String signature = "f5nzn7c4GBTiiDQC9N2uSFSmOLgOsP3ReAKTmGlNpE4%3D";
- String expectedURL = "AWSAccessKeyId="+TestConstants.accessKey+"&Action="+action+"&AmazonOrderReferenceId="+TestConstants.amazonOrderReferenceId+"&SellerId="+TestConstants.merchantId+"&Signature="+signature+"&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp="+mcokTimeStamp+"&Version=2013-01-01";
+ PowerMockito.stub(PowerMockito.method(Util.class, "getTimestamp")).toReturn(TestConstants.timeStamp);
+ final GetOrderReferenceDetailsRequest request = new GetOrderReferenceDetailsRequest(TestConstants.amazonOrderReferenceId);
+ final String action = "GetOrderReferenceDetails";
+ final String signature = "cpkDC72d5lMIbo5ET2dvERTw4F2cGQJL3eQPzUe2pAE%3D";
+ final String expectedURL =
+ "AWSAccessKeyId=" + TestConstants.accessKey
+ + "&Action=" + action
+ + "&AmazonOrderReferenceId=" + TestConstants.amazonOrderReferenceId
+ + "&SellerId=" + TestConstants.merchantId
+ + "&Signature=" + signature
+ + "&SignatureMethod=HmacSHA256"
+ + "&SignatureVersion=2"
+ + "&Timestamp=" + TestConstants.urlEncoded_TimeStamp
+ + "&Version=2013-01-01";
Assert.assertEquals(expectedURL, this.helper.getPostURL(request));
}
+ @Test
+ public void testRequestUrlAndSignatureWithMwsDelegation() throws Exception {
+ this.helper = new RequestHelper(config);
+ PowerMockito.stub(PowerMockito.method(Util.class, "getTimestamp")).toReturn(TestConstants.timeStamp);
+ final GetOrderReferenceDetailsRequest request =
+ new GetOrderReferenceDetailsRequest(TestConstants.amazonOrderReferenceId)
+ .setSellerId(TestConstants.overrideSellerId)
+ .setMWSAuthToken(TestConstants.mwsAuthToken);
+ final String action = "GetOrderReferenceDetails";
+ final String signature = "MelQJXDdQJ85Z7aB85s7eYWm5TdGv6xYAQt%2FjoOhXCo%3D";
+ final String expectedURL =
+ "AWSAccessKeyId=" + TestConstants.accessKey
+ + "&Action=" + action
+ + "&AmazonOrderReferenceId=" + TestConstants.amazonOrderReferenceId
+ + "&MWSAuthToken=" + TestConstants.mwsAuthToken
+ + "&SellerId=" + TestConstants.overrideSellerId
+ + "&Signature=" + signature
+ + "&SignatureMethod=HmacSHA256"
+ + "&SignatureVersion=2"
+ + "&Timestamp=" + TestConstants.urlEncoded_TimeStamp
+ + "&Version=2013-01-01";
+ Assert.assertEquals(expectedURL, this.helper.getPostURL(request));
+ }
@Test
- public void testRequestParameterConstructorSignature_2() throws Exception{
+ public void testRequestParameterConstructorSignature_2() throws Exception {
helper = new RequestHelper(config);
- PowerMockito.stub(PowerMockito.method(Util.class , "getTimestamp")).toReturn(mcokTimeStamp);
- String orderAmount = "2";
- SetOrderReferenceDetailsRequest request = new SetOrderReferenceDetailsRequest(TestConstants.amazonOrderReferenceId , orderAmount);
- String action = "SetOrderReferenceDetails";
- String signature = "SAz7bebEm8G63ycFtygCiAI8L4jUoK5katCaU6wlXUI%3D";
- String expectedURL = "AWSAccessKeyId="+TestConstants.accessKey+"&Action="+action+"&AmazonOrderReferenceId="+TestConstants.amazonOrderReferenceId+"&OrderReferenceAttributes.OrderTotal.Amount="+orderAmount+"&OrderReferenceAttributes.OrderTotal.CurrencyCode=USD&SellerId="+TestConstants.merchantId+"&Signature="+signature+"&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp="+mcokTimeStamp+"&Version=2013-01-01";
- Assert.assertEquals(expectedURL, this.helper.getPostURL(request));
+ PowerMockito.stub(PowerMockito.method(Util.class, "getTimestamp")).toReturn(TestConstants.timeStamp);
+ final String orderAmount = "2";
+ final SetOrderReferenceDetailsRequest request = new SetOrderReferenceDetailsRequest(TestConstants.amazonOrderReferenceId, orderAmount);
+ final String action = "SetOrderReferenceDetails";
+ final String signature = "i51MSGv9O2G2LHIlhCXLigA3ZKaZRoc7Mb5A1VX2QTA%3D";
+ final String expectedURL =
+ "AWSAccessKeyId=" + TestConstants.accessKey
+ + "&Action=" + action
+ + "&AmazonOrderReferenceId=" + TestConstants.amazonOrderReferenceId
+ + "&OrderReferenceAttributes.OrderTotal.Amount=" + orderAmount
+ + "&OrderReferenceAttributes.OrderTotal.CurrencyCode=USD"
+ + "&SellerId=" + TestConstants.merchantId
+ + "&Signature=" + signature
+ + "&SignatureMethod=HmacSHA256"
+ + "&SignatureVersion=2"
+ + "&Timestamp=" + TestConstants.urlEncoded_TimeStamp
+ + "&Version=2013-01-01";
+ Assert.assertEquals(expectedURL, this.helper.getPostURL(request));
}
+ @Test
+ public void testRequestUrlAndSignatureForConfirmOrderReference() throws Exception {
+ // Non-MFA Confirm request
+ this.helper = new RequestHelper(config);
+ PowerMockito.stub(PowerMockito.method(Util.class, "getTimestamp")).toReturn(TestConstants.timeStamp);
+ final ConfirmOrderReferenceRequest request =
+ new ConfirmOrderReferenceRequest(TestConstants.amazonOrderReferenceId)
+ .setSellerId(TestConstants.overrideSellerId)
+ .setMWSAuthToken(TestConstants.mwsAuthToken);
+ final String action = "ConfirmOrderReference";
+ final String signature = "mbJBrZKC4Jz8J%2BrhRqyfYsY6TkSapWOvCTlC%2BUDUTok%3D";
+ final String expectedURL =
+ "AWSAccessKeyId=" + TestConstants.accessKey
+ + "&Action=" + action
+ + "&AmazonOrderReferenceId=" + TestConstants.amazonOrderReferenceId
+ + "&MWSAuthToken=" + TestConstants.mwsAuthToken
+ + "&SellerId=" + TestConstants.overrideSellerId
+ + "&Signature=" + signature
+ + "&SignatureMethod=HmacSHA256"
+ + "&SignatureVersion=2"
+ + "&Timestamp=" + TestConstants.urlEncoded_TimeStamp
+ + "&Version=2013-01-01";
+ Assert.assertEquals(expectedURL, this.helper.getPostURL(request));
+
+ // Adding a curency code without an amount should result in same request
+ request.setAuthorizationCurrencyCode(CurrencyCode.EUR);
+ Assert.assertEquals(expectedURL, this.helper.getPostURL(request));
+
+ // Full MFA parameter set
+ final String mfaSignature = "KeZbecFqPMxhR4g35iFWsdLmq1rAgwdn4B2WTIFMTHg%3D";
+ request.setSuccessUrl(TestConstants.SUCCESS_URL);
+ request.setFailureUrl(TestConstants.FAILURE_URL);
+ request.setAuthorizationAmount(TestConstants.AUTHORIZE_AMOUNT);
+ final String expectedURLforMFA =
+ "AWSAccessKeyId=" + TestConstants.accessKey
+ + "&Action=" + action
+ + "&AmazonOrderReferenceId=" + TestConstants.amazonOrderReferenceId
+ + "&AuthorizationAmount.Amount=" + TestConstants.AUTHORIZE_AMOUNT
+ + "&AuthorizationAmount.CurrencyCode=" + CurrencyCode.EUR
+ + "&FailureUrl=" + Util.urlEncode(TestConstants.FAILURE_URL)
+ + "&MWSAuthToken=" + TestConstants.mwsAuthToken
+ + "&SellerId=" + TestConstants.overrideSellerId
+ + "&Signature=" + mfaSignature
+ + "&SignatureMethod=HmacSHA256"
+ + "&SignatureVersion=2"
+ + "&SuccessUrl=" + Util.urlEncode(TestConstants.SUCCESS_URL)
+ + "&Timestamp=" + TestConstants.urlEncoded_TimeStamp
+ + "&Version=2013-01-01";
+ Assert.assertEquals(expectedURLforMFA, this.helper.getPostURL(request));
+ // Partial MFA parameter set - not including FailureURL or CurrencyCode
+ // Should default to the Config object currency code in this scenario (USD instead of EUR)
+ final String partialMfaSignature = "vGiWtNsdtNKx3QGB%2BcNNq8tLisqwOeg2a5aIy3p6exw%3D";
+ request.setAuthorizationCurrencyCode(null);
+ request.setFailureUrl(null);
+ final String expectedURLforPartialMFA =
+ "AWSAccessKeyId=" + TestConstants.accessKey
+ + "&Action=" + action
+ + "&AmazonOrderReferenceId=" + TestConstants.amazonOrderReferenceId
+ + "&AuthorizationAmount.Amount=" + TestConstants.AUTHORIZE_AMOUNT
+ + "&AuthorizationAmount.CurrencyCode=" + CurrencyCode.USD
+ + "&MWSAuthToken=" + TestConstants.mwsAuthToken
+ + "&SellerId=" + TestConstants.overrideSellerId
+ + "&Signature=" + partialMfaSignature
+ + "&SignatureMethod=HmacSHA256"
+ + "&SignatureVersion=2"
+ + "&SuccessUrl=" + Util.urlEncode(TestConstants.SUCCESS_URL)
+ + "&Timestamp=" + TestConstants.urlEncoded_TimeStamp
+ + "&Version=2013-01-01";
+ Assert.assertEquals(expectedURLforPartialMFA, this.helper.getPostURL(request));
+ }
}
diff --git a/tst/com/amazon/pay/impl/ipn/NotificationFactoryTest.java b/tst/com/amazon/pay/impl/ipn/NotificationFactoryTest.java
index 2b07a90..350dde8 100644
--- a/tst/com/amazon/pay/impl/ipn/NotificationFactoryTest.java
+++ b/tst/com/amazon/pay/impl/ipn/NotificationFactoryTest.java
@@ -1,3 +1,17 @@
+/**
+ * Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License").
+ * You may not use this file except in compliance with the License.
+ * A copy of the License is located at
+ *
+ * http://aws.amazon.com/apache2.0
+ *
+ * or in the "license" file accompanying this file. This file is distributed
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
package com.amazon.pay.impl.ipn;
import com.amazon.pay.response.ipn.model.ProviderCreditNotification;
diff --git a/tst/com/amazon/pay/impl/ipn/NotificationVerificationTest.java b/tst/com/amazon/pay/impl/ipn/NotificationVerificationTest.java
index c3d77fa..663b269 100644
--- a/tst/com/amazon/pay/impl/ipn/NotificationVerificationTest.java
+++ b/tst/com/amazon/pay/impl/ipn/NotificationVerificationTest.java
@@ -1,3 +1,17 @@
+/**
+ * Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License").
+ * You may not use this file except in compliance with the License.
+ * A copy of the License is located at
+ *
+ * http://aws.amazon.com/apache2.0
+ *
+ * or in the "license" file accompanying this file. This file is distributed
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
package com.amazon.pay.impl.ipn;
import com.amazon.pay.exceptions.AmazonClientException;
diff --git a/tst/com/amazon/pay/impl/ipn/SigningCertURLTest.java b/tst/com/amazon/pay/impl/ipn/SigningCertURLTest.java
index bf461c5..c4d211d 100644
--- a/tst/com/amazon/pay/impl/ipn/SigningCertURLTest.java
+++ b/tst/com/amazon/pay/impl/ipn/SigningCertURLTest.java
@@ -1,3 +1,17 @@
+/**
+ * Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License").
+ * You may not use this file except in compliance with the License.
+ * A copy of the License is located at
+ *
+ * http://aws.amazon.com/apache2.0
+ *
+ * or in the "license" file accompanying this file. This file is distributed
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
package com.amazon.pay.impl.ipn;
import java.lang.reflect.InvocationTargetException;
@@ -6,7 +20,7 @@
import org.junit.Test;
public class SigningCertURLTest {
-
+
private static final String VALID_CERT_URL = "https://sns.us-east-1.amazonaws.com/SimpleNotificationService-bb750dd426d95ee9390147a5624348ee.pem";
private static final String VALID_CERT_CN_URL = "https://sns.us-east-1.amazonaws.com.cn/SimpleNotificationService-bb750dd426d95ee9390147a5624348ee.pem";
private static final String INVALID_PROTOCOL_CERT_URL = "http://sns.us-east-1.amazonaws.com/SimpleNotificationService-bb750dd426d95ee9390147a5624348ee.pem";
@@ -14,8 +28,8 @@ public class SigningCertURLTest {
private static final String INVALID_DOMAIN1_CERT_URL = "https://sns.us-east-1.fakecert.com/SimpleNotificationService-bb750dd426d95ee9390147a5624348ee.pem";
private static final String INVALID_DOMAIN2_CERT_URL = "https://sni.us-east-1.amazonaws.com/SimpleNotificationService-bb750dd426d95ee9390147a5624348ee.pem";
private static final String INVALID_DOMAIN3_CERT_URL = "https://sns.us.amazonaws.com/SimpleNotificationService-bb750dd426d95ee9390147a5624348ee.pem";
- private static final String INVALID_DOMAIN4_CERT_URL = "https://sns.us-east-1.amazonaws.com.com/SimpleNotificationService-bb750dd426d95ee9390147a5624348ee.pem";
-
+ private static final String INVALID_DOMAIN4_CERT_URL = "https://sns.us-east-1.amazonaws.com.com/SimpleNotificationService-bb750dd426d95ee9390147a5624348ee.pem";
+
/**
* SigningCertURL parameter with invalid protocol
*/
@@ -23,7 +37,7 @@ public class SigningCertURLTest {
public void testIllegalProtocolSigningCertURL() throws Throwable {
testSigningCertURL(INVALID_PROTOCOL_CERT_URL);
}
-
+
/**
* SigningCertURL parameter with invalid file type
*/
@@ -31,7 +45,7 @@ public void testIllegalProtocolSigningCertURL() throws Throwable {
public void testInvalidFileSigningCertURL() throws Throwable {
testSigningCertURL(INVALID_FILE_CERT_URL);
}
-
+
/**
* SigningCertURL parameter with invalid host name
*/
@@ -40,7 +54,7 @@ public void testInvalidDomain1SigningCertURL() throws Throwable {
String testURL = INVALID_DOMAIN1_CERT_URL;
testSigningCertURL(testURL);
}
-
+
/**
* SigningCertURL parameter with invalid host name
*/
@@ -49,7 +63,7 @@ public void testInvalidDomain2SigningCertURL() throws Throwable {
String testURL = INVALID_DOMAIN2_CERT_URL;
testSigningCertURL(testURL);
}
-
+
/**
* SigningCertURL parameter with invalid host name
*/
@@ -58,7 +72,7 @@ public void testInvalidDomain3SigningCertURL() throws Throwable {
String testURL = INVALID_DOMAIN3_CERT_URL;
testSigningCertURL(testURL);
}
-
+
/**
* SigningCertURL parameter with invalid host name
*/
@@ -67,7 +81,7 @@ public void testInvalidDomain4SigningCertURL() throws Throwable {
String testURL = INVALID_DOMAIN4_CERT_URL;
testSigningCertURL(testURL);
}
-
+
/**
* SigningCertURL parameter with valid URL
*/
@@ -76,7 +90,7 @@ public void testValidSigningCertURL() throws Throwable {
String testURL = VALID_CERT_URL;
testSigningCertURL(testURL);
}
-
+
/**
* SigningCertURL parameter with valid CN URL
*/
@@ -85,21 +99,19 @@ public void testValid2SigningCertURL() throws Throwable {
String testURL = VALID_CERT_CN_URL;
testSigningCertURL(testURL);
}
-
+
private void testSigningCertURL(String testURL) throws Throwable {
NotificationVerification nv = new NotificationVerification();
Method m = nv.getClass().getDeclaredMethod("isValidSigningCertURL", URL.class);
m.setAccessible(true);
- try {
- m.invoke(nv , new URL(testURL) );
- } catch(InvocationTargetException e) {
+ try {
+ m.invoke(nv , new URL(testURL) );
+ } catch (InvocationTargetException e) {
Throwable targetException = e.getTargetException();
- if(targetException instanceof SecurityException ) {
+ if (targetException instanceof SecurityException) {
throw targetException;
}
}
}
-
-
}
diff --git a/tst/com/amazon/pay/request/PaymentsAPIRequestTest.java b/tst/com/amazon/pay/request/PaymentsAPIRequestTest.java
index 8425a09..ebfdf12 100644
--- a/tst/com/amazon/pay/request/PaymentsAPIRequestTest.java
+++ b/tst/com/amazon/pay/request/PaymentsAPIRequestTest.java
@@ -1,8 +1,23 @@
+/**
+ * Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License").
+ * You may not use this file except in compliance with the License.
+ * A copy of the License is located at
+ *
+ * http://aws.amazon.com/apache2.0
+ *
+ * or in the "license" file accompanying this file. This file is distributed
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
package com.amazon.pay.request;
import com.amazon.pay.response.model.Price;
import com.amazon.pay.response.model.ProviderCredit;
import com.amazon.pay.types.AmazonReferenceIdType;
+import com.amazon.pay.types.BillingAgreementType;
import com.amazon.pay.types.CurrencyCode;
import com.amazon.pay.types.OrderReferenceStatus;
import com.amazon.pay.types.SortOrder;
@@ -23,11 +38,12 @@
public class PaymentsAPIRequestTest {
private final List PCL = Collections.singletonList(
- new ProviderCredit("providerId", new Price("1", "USD")));
+ new ProviderCredit("providerId", new Price("1", "USD")));
+ private final Price subscriptionAmount = new Price("1.25", "EUR");
@Test
public void testAuthorizeRequest() {
- AuthorizeRequest request = new AuthorizeRequest(TestConstants.amazonOrderReferenceId, TestConstants.authorizationReferenceId, "2")
+ final AuthorizeRequest request = new AuthorizeRequest(TestConstants.amazonOrderReferenceId, TestConstants.authorizationReferenceId, "2")
.setMWSAuthToken(TestConstants.mwsAuthToken)
.setCaptureNow(true)
.setSoftDescriptor(TestConstants.softDescriptor)
@@ -49,10 +65,10 @@ public void testAuthorizeRequest() {
@Test
public void testCancelOrderReferenceRequest() {
- CancelOrderReferenceRequest request =
+ final CancelOrderReferenceRequest request =
new CancelOrderReferenceRequest(TestConstants.amazonOrderReferenceId)
- .setMWSAuthToken(TestConstants.mwsAuthToken)
- .setCancelReason(TestConstants.sampletext);
+ .setMWSAuthToken(TestConstants.mwsAuthToken)
+ .setCancelReason(TestConstants.sampletext);
Assert.assertEquals(request.getAmazonOrderReferenceId(),TestConstants.amazonOrderReferenceId);
Assert.assertEquals(request.getCancelationReason(), TestConstants.sampletext);
Assert.assertEquals(request.getMwsAuthToken(), TestConstants.mwsAuthToken);
@@ -60,7 +76,7 @@ public void testCancelOrderReferenceRequest() {
@Test
public void testCapture() {
- CaptureRequest request = new CaptureRequest(TestConstants.amazonOrderReferenceId, "Capt123", "2")
+ final CaptureRequest request = new CaptureRequest(TestConstants.amazonOrderReferenceId, "Capt123", "2")
.setMWSAuthToken(TestConstants.mwsAuthToken)
.setSellerCaptureNote(TestConstants.sampletext)
.setSoftDescriptor(TestConstants.softDescriptor)
@@ -79,10 +95,10 @@ public void testCapture() {
@Test
public void testCloseAuthorizationRequest() {
- CloseAuthorizationRequest request =
+ final CloseAuthorizationRequest request =
new CloseAuthorizationRequest("Auth123")
- .setMWSAuthToken(TestConstants.mwsAuthToken)
- .setClosureReason(TestConstants.sampletext);
+ .setMWSAuthToken(TestConstants.mwsAuthToken)
+ .setClosureReason(TestConstants.sampletext);
Assert.assertEquals(request.getAmazonAuthorizationId(), "Auth123");
Assert.assertEquals(request.getClosureReason(), TestConstants.sampletext);
@@ -91,10 +107,10 @@ public void testCloseAuthorizationRequest() {
@Test
public void testCloseOrderReferenceRequest() {
- CloseOrderReferenceRequest request =
+ final CloseOrderReferenceRequest request =
new CloseOrderReferenceRequest(TestConstants.amazonOrderReferenceId)
- .setMWSAuthToken(TestConstants.mwsAuthToken)
- .setClosureReason(TestConstants.sampletext);
+ .setMWSAuthToken(TestConstants.mwsAuthToken)
+ .setClosureReason(TestConstants.sampletext);
Assert.assertEquals(request.getAmazonOrderReferenceId(),TestConstants.amazonOrderReferenceId);
Assert.assertEquals(request.getClosureReason(), TestConstants.sampletext);
@@ -103,16 +119,26 @@ public void testCloseOrderReferenceRequest() {
@Test
public void testConfirmOrderReferenceRequest() {
- ConfirmOrderReferenceRequest request = new ConfirmOrderReferenceRequest(TestConstants.amazonOrderReferenceId)
- .setMWSAuthToken(TestConstants.mwsAuthToken);
+ final ConfirmOrderReferenceRequest request = new ConfirmOrderReferenceRequest(TestConstants.amazonOrderReferenceId)
+ .setMWSAuthToken(TestConstants.mwsAuthToken)
+ .setAuthorizationAmount(TestConstants.AUTHORIZE_AMOUNT)
+ .setAuthorizationCurrencyCode(CurrencyCode.EUR)
+ .setSuccessUrl(TestConstants.SUCCESS_URL)
+ .setFailureUrl(TestConstants.FAILURE_URL)
+ .setExpectImmediateAuthorization(true);
Assert.assertEquals(request.getAmazonOrderReferenceId(),TestConstants.amazonOrderReferenceId);
Assert.assertEquals(request.getMwsAuthToken(), TestConstants.mwsAuthToken);
+ Assert.assertEquals(request.getAuthorizationAmount(), TestConstants.AUTHORIZE_AMOUNT);
+ Assert.assertEquals(request.getAuthorizationCurrencyCode(), CurrencyCode.EUR);
+ Assert.assertEquals(request.getSuccessUrl(), TestConstants.SUCCESS_URL);
+ Assert.assertEquals(request.getFailureUrl(), TestConstants.FAILURE_URL);
+ Assert.assertEquals(request.isExpectImmediateAuthorization(), true);
}
@Test
public void testGetAuthorizationDetailsRequest() {
- GetAuthorizationDetailsRequest request = new GetAuthorizationDetailsRequest("Auth123")
+ final GetAuthorizationDetailsRequest request = new GetAuthorizationDetailsRequest("Auth123")
.setMWSAuthToken(TestConstants.mwsAuthToken);
Assert.assertEquals(request.getAmazonAuthorizationId(), "Auth123");
Assert.assertEquals(request.getMwsAuthToken(), TestConstants.mwsAuthToken);
@@ -120,7 +146,7 @@ public void testGetAuthorizationDetailsRequest() {
@Test
public void testGetCaptureDetailsRequest() {
- GetCaptureDetailsRequest request = new GetCaptureDetailsRequest("Capt123")
+ final GetCaptureDetailsRequest request = new GetCaptureDetailsRequest("Capt123")
.setMWSAuthToken(TestConstants.mwsAuthToken);
Assert.assertEquals(request.getAmazonCaptureId(), "Capt123");
@@ -129,11 +155,11 @@ public void testGetCaptureDetailsRequest() {
@Test
public void testGetOrderReferenceDetailsRequest() {
- GetOrderReferenceDetailsRequest request =
+ final GetOrderReferenceDetailsRequest request =
new GetOrderReferenceDetailsRequest(TestConstants.amazonOrderReferenceId)
- .setAddressConsentToken("Atza|IwEBIDcwh13A-nf8EuZahCu")
- .setAccessToken("Atza|oVsmstLsCYekhCdyR1Hu6FFveZC")
- .setMWSAuthToken(TestConstants.mwsAuthToken);
+ .setAddressConsentToken("Atza|IwEBIDcwh13A-nf8EuZahCu")
+ .setAccessToken("Atza|oVsmstLsCYekhCdyR1Hu6FFveZC")
+ .setMWSAuthToken(TestConstants.mwsAuthToken);
Assert.assertEquals(request.getAmazonOrderReferenceId(), TestConstants.amazonOrderReferenceId);
Assert.assertEquals(request.getAddressConsentToken(), "Atza|IwEBIDcwh13A-nf8EuZahCu");
@@ -143,7 +169,7 @@ public void testGetOrderReferenceDetailsRequest() {
@Test
public void testGetRefundDetailsRequest() {
- GetRefundDetailsRequest request = new GetRefundDetailsRequest("Ref123")
+ final GetRefundDetailsRequest request = new GetRefundDetailsRequest("Ref123")
.setMWSAuthToken(TestConstants.mwsAuthToken);
Assert.assertEquals(request.getAmazonRefundId(), "Ref123");
@@ -152,7 +178,7 @@ public void testGetRefundDetailsRequest() {
@Test
public void testRefundRequest() {
- RefundRequest request = new RefundRequest("C1233421424","Ref123", "2")
+ final RefundRequest request = new RefundRequest("C1233421424","Ref123", "2")
.setMWSAuthToken(TestConstants.mwsAuthToken)
.setSellerRefundNote(TestConstants.sampletext)
.setSoftDescriptor(TestConstants.softDescriptor)
@@ -176,11 +202,12 @@ public void testRefundRequest() {
@Test
public void testSetOrderReferenceDetailsRequest() {
- SetOrderReferenceDetailsRequest request = new SetOrderReferenceDetailsRequest(TestConstants.amazonOrderReferenceId, "2")
+ final SetOrderReferenceDetailsRequest request = new SetOrderReferenceDetailsRequest(TestConstants.amazonOrderReferenceId, "2")
.setMWSAuthToken(TestConstants.mwsAuthToken)
.setPlatformId("platformId")
.setSellerOrderId("sellerOrderId")
.setStoreName("testStore")
+ .setSupplementaryData(TestConstants.SUPPLEMENTARY_DATA)
.setCustomInformation("customInfo")
.setSellerNote("sampleText")
.setOrderCurrencyCode(CurrencyCode.USD)
@@ -190,8 +217,9 @@ public void testSetOrderReferenceDetailsRequest() {
Assert.assertEquals(request.getOrderAmount(), "2");
Assert.assertEquals(request.getOrderCurrencyCode(), CurrencyCode.USD);
Assert.assertEquals(request.getMwsAuthToken(), TestConstants.mwsAuthToken);
- Assert.assertEquals(request.getSellerOrderId(),"sellerOrderId");
+ Assert.assertEquals(request.getSellerOrderId(), "sellerOrderId");
Assert.assertEquals(request.getStoreName(), "testStore");
+ Assert.assertEquals(request.getSupplementaryData(), TestConstants.SUPPLEMENTARY_DATA);
Assert.assertEquals(request.getPlatformId(), "platformId");
Assert.assertEquals(request.getCustomInformation(), "customInfo");
Assert.assertEquals(request.getSellerNote(), "sampleText");
@@ -209,6 +237,7 @@ private AuthorizeOnBillingAgreementRequest testAuthorizeOnBillingAgreementSetup(
.setSellerNote("sampletex")
.setSellerOrderId("Order123")
.setStoreName("Store")
+ .setSupplementaryData(TestConstants.SUPPLEMENTARY_DATA)
.setTransactionTimeout("10")
.setAuthorizationCurrencyCode(CurrencyCode.USD)
.setSoftDescriptor("AMZN*Test");
@@ -229,6 +258,7 @@ private void testAuthorizeOnBillingAgreementAssert(final AuthorizeOnBillingAgree
Assert.assertEquals("sampletex", request.getSellerNote());
Assert.assertEquals("Order123", request.getSellerOrderId());
Assert.assertEquals("Store", request.getStoreName());
+ Assert.assertEquals(TestConstants.SUPPLEMENTARY_DATA, request.getSupplementaryData());
Assert.assertEquals("AMZN*Test", request.getSoftDescriptor());
}
@@ -265,6 +295,20 @@ public void testConfirmBillingAgreement() {
Assert.assertEquals(request.getMwsAuthToken(), TestConstants.mwsAuthToken);
}
+ @Test
+ public void testConfirmBillingAgreementWithSCA() {
+ ConfirmBillingAgreementRequest request = new ConfirmBillingAgreementRequest(TestConstants.billingAgreementId)
+ .setMWSAuthToken(TestConstants.mwsAuthToken)
+ .setSuccessUrl(TestConstants.SUCCESS_URL)
+ .setFailureUrl(TestConstants.FAILURE_URL);
+
+
+ Assert.assertEquals(request.getAmazonBillingAgreementId(), TestConstants.billingAgreementId);
+ Assert.assertEquals(request.getMwsAuthToken(), TestConstants.mwsAuthToken);
+ Assert.assertEquals(request.getSuccessUrl(), TestConstants.SUCCESS_URL);
+ Assert.assertEquals(request.getFailureUrl(), TestConstants.FAILURE_URL);
+ }
+
@Test
public void testGetBillingAgreementDetails() {
GetBillingAgreementDetailsRequest request = new GetBillingAgreementDetailsRequest(TestConstants.billingAgreementId)
@@ -277,7 +321,7 @@ public void testGetBillingAgreementDetails() {
@Test
public void testSetBillingAgreementDetails() {
- SetBillingAgreementDetailsRequest request = new SetBillingAgreementDetailsRequest(TestConstants.billingAgreementId)
+ final SetBillingAgreementDetailsRequest request = new SetBillingAgreementDetailsRequest(TestConstants.billingAgreementId)
.setMWSAuthToken(TestConstants.mwsAuthToken)
.setCustomInformation("custom")
.setPlatformId("platformId")
@@ -294,11 +338,35 @@ public void testSetBillingAgreementDetails() {
Assert.assertEquals(request.getStoreName(), "store");
}
+ @Test
+ public void testSetBillingAgreementDetailsWithSCA() {
+ final SetBillingAgreementDetailsRequest request = new SetBillingAgreementDetailsRequest(TestConstants.billingAgreementId)
+ .setMWSAuthToken(TestConstants.mwsAuthToken)
+ .setCustomInformation("custom")
+ .setPlatformId("platformId")
+ .setSellerBillingAgreementId("B12")
+ .setSellerNote("note12")
+ .setStoreName("store")
+ .setBillingAgreementType(BillingAgreementType.CustomerInitiatedTransaction)
+ .setSubscriptionAmount(subscriptionAmount);
+
+ Assert.assertEquals(request.getAmazonBillingAgreementId(), TestConstants.billingAgreementId);
+ Assert.assertEquals(request.getMwsAuthToken(), TestConstants.mwsAuthToken);
+ Assert.assertEquals(request.getCustomInformation(), "custom");
+ Assert.assertEquals(request.getPlatformId(), "platformId");
+ Assert.assertEquals(request.getSellerBillingAgreementId(), "B12");
+ Assert.assertEquals(request.getSellerNote(), "note12");
+ Assert.assertEquals(request.getStoreName(), "store");
+ Assert.assertEquals(request.getBillingAgreementType(), BillingAgreementType.CustomerInitiatedTransaction);
+ Assert.assertEquals(request.getSubscriptionAmount().getAmount(), "1.25");
+ Assert.assertEquals(request.getSubscriptionAmount().getCurrencyCode(), "EUR");
+ }
+
@Test
public void testValidateBillingAgreement() {
- ValidateBillingAgreementRequest request =
+ final ValidateBillingAgreementRequest request =
new ValidateBillingAgreementRequest(TestConstants.billingAgreementId)
- .setMWSAuthToken(TestConstants.mwsAuthToken);
+ .setMWSAuthToken(TestConstants.mwsAuthToken);
Assert.assertEquals(request.getAmazonBillingAgreementId(), TestConstants.billingAgreementId);
Assert.assertEquals(request.getMwsAuthToken(), TestConstants.mwsAuthToken);
@@ -306,9 +374,9 @@ public void testValidateBillingAgreement() {
@Test
public void testGetProviderCreditDetails() {
- GetProviderCreditDetailsRequest request =
+ final GetProviderCreditDetailsRequest request =
new GetProviderCreditDetailsRequest(TestConstants.providerCreditId, TestConstants.providerSellerId)
- .setMwsAuthToken(TestConstants.mwsAuthToken);
+ .setMWSAuthToken(TestConstants.mwsAuthToken);
Assert.assertEquals(request.getAmazonProviderCreditId(), TestConstants.providerCreditId);
Assert.assertEquals(request.getSellerId(), TestConstants.providerSellerId);
@@ -317,10 +385,10 @@ public void testGetProviderCreditDetails() {
@Test
public void testGetProviderCreditReversalDetails() {
- GetProviderCreditReversalDetailsRequest request =
- new GetProviderCreditReversalDetailsRequest(
- TestConstants.reversalProviderCreditId, TestConstants.providerSellerId)
- .setMwsAuthToken(TestConstants.mwsAuthToken);
+ final GetProviderCreditReversalDetailsRequest request =
+ new GetProviderCreditReversalDetailsRequest(
+ TestConstants.reversalProviderCreditId, TestConstants.providerSellerId)
+ .setMWSAuthToken(TestConstants.mwsAuthToken);
Assert.assertEquals(TestConstants.reversalProviderCreditId, request.getAmazonProviderCreditReversalId());
Assert.assertEquals(TestConstants.providerSellerId, request.getSellerId());
@@ -329,11 +397,11 @@ public void testGetProviderCreditReversalDetails() {
@Test
public void testReverseProviderCreditDetails() {
- ReverseProviderCreditRequest request = new ReverseProviderCreditRequest(TestConstants.reversalProviderCreditId,
+ final ReverseProviderCreditRequest request = new ReverseProviderCreditRequest(TestConstants.reversalProviderCreditId,
TestConstants.reversalProviderCreditReferenceId,
TestConstants.providerSellerId,
TestConstants.reversalProviderAmount)
- .setMwsAuthToken(TestConstants.mwsAuthToken)
+ .setMWSAuthToken(TestConstants.mwsAuthToken)
.setCreditReversalNote(TestConstants.sampletext)
.setCreditReversalCurrencyCode(CurrencyCode.USD);
@@ -344,7 +412,7 @@ public void testReverseProviderCreditDetails() {
Assert.assertEquals(request.getMwsAuthToken(), TestConstants.mwsAuthToken);
Assert.assertEquals(request.getCreditReversalAmountCurrencyCode(), CurrencyCode.USD);
Assert.assertEquals(request.getCreditReversalNote(), TestConstants.sampletext);
- }
+ }
private ChargeRequest testChargeSetup() {
return new ChargeRequest()
@@ -397,16 +465,17 @@ public void testChargeString() {
public void testCreateOrderReferenceForId() {
final CreateOrderReferenceForIdRequest request =
new CreateOrderReferenceForIdRequest(
- TestConstants.billingAgreementId, AmazonReferenceIdType.BILLING_AGREEMENT_ID)
- .setInheritShippingAddress(false)
- .setConfirmNow(true)
- .setOrderTotalCurrencyCode(CurrencyCode.USD)
- .setSellerNote("Test Seller Note")
- .setSellerOrderId("Test Order ID")
- .setStoreName(TestConstants.storeName)
- .setCustomInformation("Test Custom Information")
- .setOrderTotalAmount("567.89")
- .setPlatformId(TestConstants.platformId);
+ TestConstants.billingAgreementId, AmazonReferenceIdType.BILLING_AGREEMENT_ID)
+ .setInheritShippingAddress(false)
+ .setConfirmNow(true)
+ .setOrderTotalCurrencyCode(CurrencyCode.USD)
+ .setSellerNote("Test Seller Note")
+ .setSellerOrderId("Test Order ID")
+ .setStoreName(TestConstants.storeName)
+ .setSupplementaryData(TestConstants.SUPPLEMENTARY_DATA)
+ .setCustomInformation("Test Custom Information")
+ .setOrderTotalAmount("567.89")
+ .setPlatformId(TestConstants.platformId);
Assert.assertEquals(request.getId(), TestConstants.billingAgreementId);
Assert.assertEquals(request.getIdType(), AmazonReferenceIdType.BILLING_AGREEMENT_ID);
@@ -416,6 +485,7 @@ public void testCreateOrderReferenceForId() {
Assert.assertEquals(request.getSellerNote(), "Test Seller Note");
Assert.assertEquals(request.getSellerOrderId(), "Test Order ID");
Assert.assertEquals(request.getStoreName(), TestConstants.storeName);
+ Assert.assertEquals(request.getSupplementaryData(), TestConstants.SUPPLEMENTARY_DATA);
Assert.assertEquals(request.getCustomInformation(), "Test Custom Information");
Assert.assertEquals(request.getOrderTotalAmount(), "567.89");
Assert.assertEquals(request.getPlatformId(), TestConstants.platformId);
@@ -455,7 +525,7 @@ public void testListOrderReferenceByNextToken() {
@Test
public void testSetOrderAttributes() {
- Set orderItemCategories = new HashSet();
+ final Set orderItemCategories = new HashSet();
orderItemCategories.add("Antiques");
orderItemCategories.add("Apparel");
final SetOrderAttributesRequest request =
@@ -466,6 +536,7 @@ public void testSetOrderAttributes() {
.setPlatformId("platformId")
.setSellerOrderId("sellerOrderId")
.setStoreName("storeName")
+ .setSupplementaryData(TestConstants.SUPPLEMENTARY_DATA)
.setRequestPaymentAuthorization(true)
.setPaymentServiceProviderId("paymentServiceProviderId")
.setPaymentServiceProviderOrderId("paymentServiceProviderOrderId")
@@ -476,8 +547,9 @@ public void testSetOrderAttributes() {
Assert.assertEquals(request.getCustomInformation(), "customInfo");
Assert.assertEquals(request.getSellerNote(), "sellerNote");
Assert.assertEquals(request.getPlatformId(), "platformId");
- Assert.assertEquals(request.getSellerOrderId(),"sellerOrderId");
- Assert.assertEquals(request.getStoreName(),"storeName");
+ Assert.assertEquals(request.getSellerOrderId(), "sellerOrderId");
+ Assert.assertEquals(request.getStoreName(), "storeName");
+ Assert.assertEquals(request.getSupplementaryData(), TestConstants.SUPPLEMENTARY_DATA);
Assert.assertEquals(request.getRequestPaymentAuthorization(),true);
Assert.assertEquals(request.getPaymentServiceProviderId(),"paymentServiceProviderId");
Assert.assertEquals(request.getPaymentServiceProviderOrderId(),"paymentServiceProviderOrderId");
@@ -485,4 +557,13 @@ public void testSetOrderAttributes() {
Assert.assertTrue(request.getOrderItemCategories().contains("Apparel"));
}
+ @Test
+ public void testGetMerchantAccountStatus() {
+ final GetMerchantAccountStatusRequest request = new GetMerchantAccountStatusRequest()
+ .setMWSAuthToken(TestConstants.mwsAuthToken)
+ .setSellerId(TestConstants.providerSellerId);
+ Assert.assertEquals(request.getSellerId(), TestConstants.providerSellerId);
+ Assert.assertEquals(request.getMwsAuthToken(), TestConstants.mwsAuthToken);
+ }
+
}
diff --git a/tst/com/amazon/pay/response/PaymentsAPIResponseTest.java b/tst/com/amazon/pay/response/PaymentsAPIResponseTest.java
index 6c7a05e..7419606 100644
--- a/tst/com/amazon/pay/response/PaymentsAPIResponseTest.java
+++ b/tst/com/amazon/pay/response/PaymentsAPIResponseTest.java
@@ -1,6 +1,25 @@
+/**
+ * Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License").
+ * You may not use this file except in compliance with the License.
+ * A copy of the License is located at
+ *
+ * http://aws.amazon.com/apache2.0
+ *
+ * or in the "license" file accompanying this file. This file is distributed
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
package com.amazon.pay.response;
+import com.amazon.pay.TestConstants;
+import com.amazon.pay.exceptions.AmazonServiceException;
+import com.amazon.pay.impl.PayLogUtil;
+import com.amazon.pay.response.model.AccountStatus;
import com.amazon.pay.response.model.AuthorizationDetails;
+import com.amazon.pay.response.model.BillingAgreementDetails;
import com.amazon.pay.response.model.CaptureDetails;
import com.amazon.pay.response.model.Environment;
import com.amazon.pay.response.model.ErrorResponse;
@@ -26,6 +45,7 @@
import com.amazon.pay.response.parser.GetBillingAgreementDetailsResponseData;
import com.amazon.pay.response.parser.GetCaptureDetailsResponseData;
import com.amazon.pay.response.parser.GetOrderReferenceDetailsResponseData;
+import com.amazon.pay.response.parser.GetMerchantAccountStatusResponseData;
import com.amazon.pay.response.parser.GetPaymentDetails;
import com.amazon.pay.response.parser.GetProviderCreditDetailsResponseData;
import com.amazon.pay.response.parser.GetProviderCreditReversalDetailsResponseData;
@@ -43,6 +63,7 @@
import com.amazon.pay.exceptions.AmazonClientException;
import com.amazon.pay.exceptions.AmazonServiceException;
import com.amazon.pay.response.parser.ResponseData;
+import com.amazon.pay.types.BillingAgreementType;
import java.io.FileInputStream;
import java.io.IOException;
@@ -96,15 +117,16 @@ public void testGetOrderReferenceDetailsResponse() throws Exception {
Assert.assertEquals(res.getRequestId(), "5f20169b-7ab2-11df-bcef-d35615e2b044");
Assert.assertEquals(res.getDetails().getReleaseEnvironment().value(), "LIVE");
Assert.assertEquals(res.getDetails().getDestination().getPhysicalDestination().getCountryCode(), "US");
- Assert.assertEquals(res.getDetails().getDestination().getPhysicalDestination().getCity(), "New York");
+ Assert.assertEquals(res.getDetails().getDestination().getPhysicalDestination().getCity(), "äöüßâêîôûàèùé");
Assert.assertEquals(res.getDetails().getDestination().getPhysicalDestination().getPostalCode(), "10101-9876");
- Assert.assertEquals(res.getDetails().getDestination().getPhysicalDestination().getStateOrRegion(), "NY");
+ Assert.assertEquals(res.getDetails().getDestination().getPhysicalDestination().getStateOrRegion(), "宋 俊华 市区-徐汇区 广东省");
Assert.assertNotNull(res.getDetails().getPaymentDescriptor());
Assert.assertEquals(res.getDetails().getPaymentDescriptor().getName() , "Visa");
Assert.assertEquals(res.getDetails().getPaymentDescriptor().getAccountNumberTail() , "11");
Assert.assertEquals(res.getDetails().getPaymentDescriptor().getFullDescriptor() , "Amazon Pay (Visa **11)");
Assert.assertEquals(res.getDetails().getPaymentDescriptor().isUseAmazonBalanceFirst() , false);
Assert.assertNotEquals(res.getDetails().getPaymentDescriptor().isUseAmazonBalanceFirst(), true);
+ Assert.assertEquals(res.getDetails().getSellerOrderAttributes().getSupplementaryData(), TestConstants.SUPPLEMENTARY_DATA);
Assert.assertEquals(res.toXML(), rawResponse);
}
@@ -131,19 +153,32 @@ public void testNoPaymentDescriptor() throws Exception {
}
@Test
- public void testSanitizedData() throws Exception {
- final String rawResponse = loadTestFile("SanitizedData.xml");
+ public void testGetOrderReferenceDetailsScaResponse() throws Exception {
+ final String rawResponse = loadTestFile("GetOrderReferenceDetailsScaResponse.xml");
final ResponseData response = new ResponseData(HttpURLConnection.HTTP_OK, rawResponse);
- final SetOrderReferenceDetailsResponseData res = Parser.setOrderReferenceDetails(response);
+ final GetOrderReferenceDetailsResponseData res = Parser.getOrderReferenceDetails(response);
+ Assert.assertEquals(res.getDetails().getPaymentReference().getStaticToken(), "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx20=");
+ Assert.assertEquals(res.getDetails().getPaymentAuthenticationStatus().getState(), "REQUIRED");
+ Assert.assertEquals(res.toXML(), rawResponse);
+ }
- Assert.assertEquals(res.getDetails().getAmazonOrderReferenceId(), "S01-9821095-0000200");
- Assert.assertEquals(res.getDetails().getOrderReferenceStatus().getState(), "Draft");
- Assert.assertEquals(res.getDetails().getDestination().getDestinationType(), "Physical");
- Assert.assertEquals(res.getDetails().getDestination().getPhysicalDestination().getCountryCode(), null);
- Assert.assertEquals(res.getDetails().getDestination().getPhysicalDestination().getStateOrRegion(), null);
- Assert.assertEquals(res.getDetails().getDestination().getPhysicalDestination().getCity(), null);
- Assert.assertEquals(res.getDetails().getDestination().getPhysicalDestination().getPostalCode(), null);
- Assert.assertEquals(res.getDetails().getSellerNote(), "*** Removed ***");
+ @Test
+ public void testSetOrderAttributesScaResponse() throws Exception {
+ final String rawResponse = loadTestFile("SetOrderAttributesScaResponse.xml");
+ final ResponseData response = new ResponseData(HttpURLConnection.HTTP_OK, rawResponse);
+ final SetOrderAttributesResponseData res = Parser.setOrderAttributes(response);
+ Assert.assertEquals(res.getOrderReferenceDetails().getPaymentAuthenticationStatus().getState(), "REQUIRED");
+ Assert.assertEquals(res.toXML(), rawResponse);
+ }
+
+ @Test
+ public void testSanitizedData() throws Exception {
+ final String rawResponse = loadTestFile("SanitizedDataBefore.xml").trim();
+ final String expectedSanitizedResponse = loadTestFile("SanitizedData.xml").trim();
+
+ final PayLogUtil logUtil = new PayLogUtil();
+ final String sanitizedString = logUtil.sanitizeString(rawResponse);
+ Assert.assertEquals(expectedSanitizedResponse, sanitizedString);
}
@Test
@@ -199,6 +234,7 @@ public void testSetOrderReferenceDetailsResponse() throws Exception {
Assert.assertEquals(res.getDetails().getOrderTotal().getCurrencyCode(), "USD");
Assert.assertEquals(res.getDetails().getSellerOrderAttributes().getSellerOrderId(), "test1234");
Assert.assertEquals(res.getDetails().getSellerOrderAttributes().getStoreName(), "myTestStore");
+ Assert.assertEquals(res.getDetails().getSellerOrderAttributes().getSupplementaryData(), TestConstants.SUPPLEMENTARY_DATA);
Assert.assertEquals(res.getDetails().getSellerOrderAttributes().getCustomInformation(), "myCustomInformation");
Assert.assertEquals(res.getDetails().getRequestPaymentAuthorization(), false);
@@ -367,7 +403,7 @@ public void testCaptureDetailsResponseMulticurrency() throws Exception {
Assert.assertEquals(res.toXML(), rawResponse);
}
- @Test
+ @Test
public void testCancelOrderReferenceResponse() throws Exception {
final String rawResponse = loadTestFile("CancelOrderReferenceResponse.xml");
final ResponseData response = new ResponseData(HttpURLConnection.HTTP_OK, rawResponse);
@@ -376,7 +412,7 @@ public void testCancelOrderReferenceResponse() throws Exception {
Assert.assertEquals(res.toXML(), rawResponse);
}
- @Test
+ @Test
public void testCloseOrderReferenceResponse() throws Exception {
final String rawResponse = loadTestFile("CloseOrderReferenceResponse.xml");
final ResponseData response = new ResponseData(HttpURLConnection.HTTP_OK, rawResponse);
@@ -385,7 +421,7 @@ public void testCloseOrderReferenceResponse() throws Exception {
Assert.assertEquals(res.toXML(), rawResponse);
}
- @Test
+ @Test
public void testCloseAuthorizationResponse() throws Exception {
final String rawResponse = loadTestFile("CloseAuthorizationResponse.xml");
final ResponseData response = new ResponseData(HttpURLConnection.HTTP_OK, rawResponse);
@@ -518,11 +554,53 @@ public void testGetBillingAgreementDetailsResponse() throws Exception {
Assert.assertEquals(res.getDetails().getBillingAddress(), null);
Assert.assertEquals(res.getDetails().getPlatformId(), null);
Assert.assertEquals(res.getDetails().getSellerNote(), null);
-
Assert.assertEquals(res.getRequestId(), "d69e8d60-3682-43d7-bf5e-e2ef64dc685e");
Assert.assertEquals(res.toXML(), rawResponse);
}
+ @Test
+ public void testGetBillingAgreementDetailsWithSCAResponse() throws Exception {
+ final String rawResponse = loadTestFile("GetBillingAgreementDetailsWithSCAResponse.xml");
+ final ResponseData response = new ResponseData(HttpURLConnection.HTTP_OK, rawResponse);
+ final GetBillingAgreementDetailsResponseData res = Parser.getBillingAgreementDetailsData(response);
+ Assert.assertEquals(res.getDetails().getAmazonBillingAgreementId(), "C02-5533845-8537141");
+ Assert.assertEquals(res.getDetails().getBillingAgreementStatus().getLastUpdatedTimestamp(), null);
+ Assert.assertEquals(res.getDetails().getBillingAgreementStatus().getState(), "Draft");
+ Assert.assertEquals(res.getDetails().getDestination().getDestinationType(), "Physical");
+ Assert.assertEquals(res.getDetails().getDestination().getPhysicalDestination().getCity(), "Chicago");
+ Assert.assertEquals(res.getDetails().getDestination().getPhysicalDestination().getCountryCode(), "US");
+ Assert.assertEquals(res.getDetails().getDestination().getPhysicalDestination().getPostalCode(), "60602");
+ Assert.assertEquals(res.getDetails().getDestination().getPhysicalDestination().getCounty(), null);
+ Assert.assertEquals(res.getDetails().getDestination().getPhysicalDestination().getDistrict(), null);
+ Assert.assertEquals(res.getDetails().getConstraints().getConstraint().get(0).getConstraintID(), "BuyerConsentNotSet");
+ Assert.assertEquals(res.getDetails().getConstraints().getConstraint().get(0).getDescription(), "The buyer has not given consent for this billing agreement.");
+ Assert.assertEquals(res.getDetails().getBillingAgreementType(), BillingAgreementType.MerchantInitiatedTransaction);
+ Assert.assertEquals(res.getDetails().getReleaseEnvironment().SANDBOX, Environment.SANDBOX);
+ final XMLGregorianCalendar xgc3 = DatatypeFactory.newInstance().newXMLGregorianCalendar("2019-08-20T22:03:09.297Z");
+ Assert.assertEquals(res.getDetails().getCreationTimestamp(), xgc3);
+ Assert.assertEquals(res.getDetails().getBillingAgreementLimits().getAmountLimitPerTimePeriod().getAmount(), "500");
+ Assert.assertEquals(res.getDetails().getBillingAgreementLimits().getAmountLimitPerTimePeriod().getCurrencyCode(), "GBP");
+ Assert.assertEquals(res.getDetails().getBillingAgreementLimits().getCurrentRemainingBalance().getAmount(), "500.00");
+ Assert.assertEquals(res.getDetails().getBillingAgreementLimits().getCurrentRemainingBalance().getCurrencyCode(), "GBP");
+ final XMLGregorianCalendar xgc2 = DatatypeFactory.newInstance().newXMLGregorianCalendar("2019-09-01T00:00:00Z");
+ Assert.assertEquals(res.getDetails().getBillingAgreementLimits().getTimePeriodEndDate(), xgc2);
+ final XMLGregorianCalendar xgc4 = DatatypeFactory.newInstance().newXMLGregorianCalendar("2019-08-01T00:00:00Z");
+ Assert.assertEquals(res.getDetails().getBillingAgreementLimits().getTimePeriodStartDate(), xgc4);
+ Assert.assertEquals(res.getDetails().getOrderLanguage(), "en-GB");
+ Assert.assertEquals(res.getDetails().isBillingAgreementConsent(), false);
+ Assert.assertEquals(res.getDetails().getExpirationTimestamp(), null);
+ Assert.assertEquals(res.getDetails().getSellerBillingAgreementAttributes().getCustomInformation(), "any custom information");
+ Assert.assertEquals(res.getDetails().getSellerBillingAgreementAttributes().getSellerBillingAgreementId(), "5678-example-order");
+ Assert.assertEquals(res.getDetails().getSellerBillingAgreementAttributes().getStoreName(), "SDK Sample Store Name");
+ Assert.assertEquals(res.getDetails().getBillingAddress(), null);
+ Assert.assertEquals(res.getDetails().getPlatformId(), null);
+ Assert.assertEquals(res.getDetails().getSellerNote(), "Testing PHP SDK Recurring Samples");
+ Assert.assertEquals(res.getDetails().getSubscriptionAmount().getAmount(), "25.00");
+ Assert.assertEquals(res.getDetails().getSubscriptionAmount().getCurrencyCode(), "GBP");
+ Assert.assertEquals(res.getRequestId(), "954d87bd-b48f-4eb2-b84b-a0200da333cf");
+ Assert.assertEquals(res.toXML(), rawResponse);
+ }
+
@Test
public void testSetBillingAgreementDetailsResponse() throws Exception {
final String rawResponse = loadTestFile("SetBillingAgreementDetailsResponse.xml");
@@ -554,6 +632,40 @@ public void testSetBillingAgreementDetailsResponse() throws Exception {
Assert.assertEquals(res.toXML(), rawResponse);
}
+ @Test
+ public void testSetBillingAgreementDetailsWithSCAResponse() throws Exception {
+ final String rawResponse = loadTestFile("SetBillingAgreementDetailsWithSCAResponse.xml");
+ final ResponseData response = new ResponseData(HttpURLConnection.HTTP_OK, rawResponse);
+ final SetBillingAgreementDetailsResponseData res = Parser.getSetBillingAgreementDetailsResponse(response);
+ Assert.assertEquals(res.getDetails().getAmazonBillingAgreementId(), "C02-5533845-8537141");
+ Assert.assertEquals(res.getDetails().getBillingAgreementStatus().getLastUpdatedTimestamp(), null);
+ Assert.assertEquals(res.getDetails().getBillingAgreementStatus().getState(), "Draft");
+ Assert.assertEquals(res.getDetails().getBillingAgreementStatus().getReasonCode(), null);
+ Assert.assertEquals(res.getDetails().getBillingAgreementStatus().getReasonDescription(), null);
+ Assert.assertEquals(res.getDetails().getDestination().getDestinationType(), "Physical");
+ Assert.assertEquals(res.getDetails().getDestination().getPhysicalDestination().getCity(), "Chicago");
+ Assert.assertEquals(res.getDetails().getDestination().getPhysicalDestination().getCountryCode(), "US");
+ Assert.assertEquals(res.getDetails().getDestination().getPhysicalDestination().getPostalCode(), "60602");
+ Assert.assertEquals(res.getDetails().getConstraints().getConstraint().get(0).getConstraintID(), "BuyerConsentNotSet");
+ Assert.assertEquals(res.getDetails().getConstraints().getConstraint().get(0).getDescription(), "The buyer has not given consent for this billing agreement.");
+ Assert.assertEquals(res.getDetails().getReleaseEnvironment().SANDBOX, Environment.SANDBOX);
+ final XMLGregorianCalendar xgc3 = DatatypeFactory.newInstance().newXMLGregorianCalendar("2019-08-20T22:03:09.297Z");
+ Assert.assertEquals(res.getDetails().getCreationTimestamp(), xgc3);
+ Assert.assertEquals(res.getDetails().getBillingAgreementLimits().getAmountLimitPerTimePeriod().getAmount(), "500");
+ Assert.assertEquals(res.getDetails().getBillingAgreementLimits().getAmountLimitPerTimePeriod().getCurrencyCode(), "GBP");
+ Assert.assertEquals(res.getDetails().getBillingAgreementLimits().getCurrentRemainingBalance().getAmount(), "500.00");
+ Assert.assertEquals(res.getDetails().getBillingAgreementLimits().getCurrentRemainingBalance().getCurrencyCode(), "GBP");
+ final XMLGregorianCalendar xgc2 = DatatypeFactory.newInstance().newXMLGregorianCalendar("2019-09-01T00:00:00Z");
+ Assert.assertEquals(res.getDetails().getBillingAgreementLimits().getTimePeriodEndDate(), xgc2);
+ final XMLGregorianCalendar xgc4 = DatatypeFactory.newInstance().newXMLGregorianCalendar("2019-08-01T00:00:00Z");
+ Assert.assertEquals(res.getDetails().getBillingAgreementLimits().getTimePeriodStartDate(), xgc4);
+ Assert.assertEquals(res.getDetails().getBillingAgreementType(), BillingAgreementType.MerchantInitiatedTransaction);
+ Assert.assertEquals(res.getDetails().getSubscriptionAmount().getAmount(), "25.00");
+ Assert.assertEquals(res.getDetails().getSubscriptionAmount().getCurrencyCode(), "GBP");
+ Assert.assertEquals(res.getRequestId(), "2dee6992-29f6-4d3e-bc86-2cf339241c58");
+ Assert.assertEquals(res.toXML(), rawResponse);
+ }
+
@Test
public void testConfirmBillingAgreementDetailsResponse() throws Exception {
final String rawResponse = loadTestFile("ConfirmBillingAgreementResponse.xml");
@@ -684,7 +796,7 @@ public void testGetRefundDetailsResponseMulticurrency() throws Exception {
final XMLGregorianCalendar xgc2 = DatatypeFactory.newInstance().newXMLGregorianCalendar("2017-06-28T18:14:34.752Z");
Assert.assertEquals(res.getDetails().getCreationTimestamp(), xgc2);
Assert.assertEquals(res.getDetails().getProviderCreditReversalSummaryList(), null);
- Assert.assertEquals(res.getDetails().getSoftDescriptor(), "AMZ*Matt's Test Stor");
+ Assert.assertEquals(res.getDetails().getSoftDescriptor(), "AMZ*Matt's Test Stor");
// The three new multi-currency specific fields
Assert.assertEquals(res.getDetails().getConvertedAmount().getAmount(), "0.03");
@@ -818,7 +930,21 @@ public void testErrorResponse() throws Exception {
Assert.assertEquals(e.getErrorType(), "Sender");
Assert.assertEquals(e.getRequestId(), "6d4699b8-1238-4c09-b539-176e2c2f5462");
Assert.assertEquals(e.getErrorMessage(), "OrderReference S01-5695290-1354077 is not in draft state and cannot be modified with the request submitted by you.");
+ }
+ }
+ @Test
+ public void testThrottledRequest() throws Exception {
+ final String rawResponse = loadTestFile("Throttled.xml");
+ final ResponseData response = new ResponseData(HttpURLConnection.HTTP_UNAVAILABLE, rawResponse);
+ try {
+ Parser.marshalXML(ErrorResponse.class, response);
+ Assert.fail();
+ } catch (AmazonServiceException e) {
+ Assert.assertEquals(e.getResponseXml(), rawResponse);
+ Assert.assertEquals(e.getStatusCode(), HttpURLConnection.HTTP_UNAVAILABLE);
+ Assert.assertEquals(e.getErrorCode(), "RequestThrottled");
+ Assert.assertEquals(e.getRequestId(), "d702fd8e-206f-4da4-95e0-1e7422474077");
}
}
@@ -865,7 +991,43 @@ public void testSetOrderAttributesResponse() throws Exception {
Assert.assertEquals(res.getOrderReferenceDetails().getReleaseEnvironment().value(), "LIVE");
Assert.assertEquals(res.getOrderReferenceDetails().getOrderReferenceStatus().getState(),"Draft");
Assert.assertEquals(res.getOrderReferenceDetails().getSellerOrderAttributes().getOrderItemCategories().getOrderItemCategory().size(),2);
+ }
+ @Test
+ public void testGetMerchantAccountStatusActiveResponse() throws Exception {
+ final String rawResponse = loadTestFile("GetMerchantAccountStatusActive.xml");
+ final ResponseData response = new ResponseData(HttpURLConnection.HTTP_OK, rawResponse);
+ final GetMerchantAccountStatusResponseData res = Parser.getMerchantAccountStatus(response);
+
+ Assert.assertEquals(res.getRequestId(), "4b84390f-748b-40a3-ab07-9395e3616310");
+ Assert.assertEquals(res.getAccountStatus(), AccountStatus.ACTIVE);
}
-}
+ @Test
+ public void testGetMerchantAccountStatusInactiveResponse() throws Exception {
+ final String rawResponse = loadTestFile("GetMerchantAccountStatusInactive.xml");
+ final ResponseData response = new ResponseData(HttpURLConnection.HTTP_OK, rawResponse);
+ final GetMerchantAccountStatusResponseData res = Parser.getMerchantAccountStatus(response);
+
+ Assert.assertEquals(res.getRequestId(), "0441027b-eaf7-443f-bd39-53075c3b8f4f");
+ Assert.assertEquals(res.getAccountStatus(), AccountStatus.INACTIVE);
+ }
+
+ @Test
+ public void testGetMerchantAccountStatusErrorResponse() throws Exception {
+ final String rawResponse = loadTestFile("GetMerchantAccountStatusError.xml");
+ final ResponseData response = new ResponseData(HttpURLConnection.HTTP_FORBIDDEN, rawResponse);
+ try {
+ Parser.marshalXML(ErrorResponse.class, response);
+ Assert.fail();
+ } catch (AmazonServiceException e) {
+ Assert.assertEquals(e.getResponseXml(), rawResponse);
+ Assert.assertEquals(e.getStatusCode(), HttpURLConnection.HTTP_FORBIDDEN);
+ Assert.assertEquals(e.getErrorCode(), "UnauthorizedSolutionProvider");
+ Assert.assertEquals(e.getErrorType(), "Sender");
+ Assert.assertEquals(e.getRequestId(), "b1c459b9-61c7-4f0b-b0b6-d6afcd314ef9");
+ Assert.assertEquals(e.getErrorMessage(), "The Solution Provider : A2J2RH3AOT7N6C is not authorized for getting the status of provided merchant : A3URCZVLDMDI45");
+ }
+ }
+
+}
diff --git a/tst/com/amazon/pay/response/xml/GetBillingAgreementDetailsWithSCAResponse.xml b/tst/com/amazon/pay/response/xml/GetBillingAgreementDetailsWithSCAResponse.xml
new file mode 100644
index 0000000..77c23dd
--- /dev/null
+++ b/tst/com/amazon/pay/response/xml/GetBillingAgreementDetailsWithSCAResponse.xml
@@ -0,0 +1,56 @@
+
+
+
+
+ C02-5533845-8537141
+
+ Draft
+
+ en-GB
+ false
+
+ Physical
+
+ IL
+ Chicago
+ US
+ 60602
+
+
+
+
+ BuyerConsentNotSet
+ The buyer has not given consent for this billing agreement.
+
+
+ MerchantInitiatedTransaction
+
+ SDK Sample Store Name
+ any custom information
+ 5678-example-order
+
+ Sandbox
+ Testing PHP SDK Recurring Samples
+
+ GBP
+ 25.00
+
+ 2019-08-20T22:03:09.297Z
+
+ 2019-08-01T00:00:00Z
+
+ GBP
+ 500.00
+
+
+ GBP
+ 500
+
+ 2019-09-01T00:00:00Z
+
+
+
+
+ 954d87bd-b48f-4eb2-b84b-a0200da333cf
+
+
diff --git a/tst/com/amazon/pay/response/xml/GetMerchantAccountStatusActive.xml b/tst/com/amazon/pay/response/xml/GetMerchantAccountStatusActive.xml
new file mode 100644
index 0000000..1a928f4
--- /dev/null
+++ b/tst/com/amazon/pay/response/xml/GetMerchantAccountStatusActive.xml
@@ -0,0 +1,9 @@
+
+
+ ACTIVE
+
+
+ 4b84390f-748b-40a3-ab07-9395e3616310
+
+
+
diff --git a/tst/com/amazon/pay/response/xml/GetMerchantAccountStatusError.xml b/tst/com/amazon/pay/response/xml/GetMerchantAccountStatusError.xml
new file mode 100644
index 0000000..4898f5f
--- /dev/null
+++ b/tst/com/amazon/pay/response/xml/GetMerchantAccountStatusError.xml
@@ -0,0 +1,9 @@
+
+
+ Sender
+ UnauthorizedSolutionProvider
+ The Solution Provider : A2J2RH3AOT7N6C is not authorized for getting the status of provided merchant : A3URCZVLDMDI45
+
+ b1c459b9-61c7-4f0b-b0b6-d6afcd314ef9
+
+
diff --git a/tst/com/amazon/pay/response/xml/GetMerchantAccountStatusInactive.xml b/tst/com/amazon/pay/response/xml/GetMerchantAccountStatusInactive.xml
new file mode 100644
index 0000000..82b8e8a
--- /dev/null
+++ b/tst/com/amazon/pay/response/xml/GetMerchantAccountStatusInactive.xml
@@ -0,0 +1,8 @@
+
+
+ INACTIVE
+
+
+ 0441027b-eaf7-443f-bd39-53075c3b8f4f
+
+
diff --git a/tst/com/amazon/pay/response/xml/GetOrderReferenceDetailsResponse.xml b/tst/com/amazon/pay/response/xml/GetOrderReferenceDetailsResponse.xml
index 48ee5e8..2f66739 100644
--- a/tst/com/amazon/pay/response/xml/GetOrderReferenceDetailsResponse.xml
+++ b/tst/com/amazon/pay/response/xml/GetOrderReferenceDetailsResponse.xml
@@ -8,11 +8,14 @@
Draft
+
+ {"AirlineMetaData" : {"version": 1.0, "airlineCode": "WN", "flightDate": "2018-03-24T20:29:19.22Z", "departureAirport": "CDG", "destinationAirport": "LUX", "bookedLastTime": -1, "classOfTravel": "F", "passengers": {"numberOfPassengers": 4, "numberOfChildren": 1, "numberOfInfants": 1 }}, "AccommodationMetaData": {"version": 1.0, "startDate": "2018-03-24T20:29:19.22Z", "endDate": "2018-03-24T20:29:19.22Z", "lengthOfStay": 5, "numberOfGuests": 4, "class": "Standard", "starRating": 5, "bookedLastTime": -1 }, "OrderMetaData": {"version": 1.0, "numberOfItems": 3, "type": "Digital" }, "BuyerMetaData": {"version" : 1.0, "isFirstTimeCustomer" : true, "numberOfPastPurchases" : 2, "numberOfDisputedPurchases" : 3, "hasOpenDispute" : true, "riskScore" : 0.75 }}
+
Physical
- New York
- NY
+ äöüßâêîôûàèùé
+ 宋 俊华 市区-徐汇区 广东省
10101-9876
US
@@ -29,4 +32,4 @@
5f20169b-7ab2-11df-bcef-d35615e2b044
-
\ No newline at end of file
+
diff --git a/tst/com/amazon/pay/response/xml/GetOrderReferenceDetailsScaResponse.xml b/tst/com/amazon/pay/response/xml/GetOrderReferenceDetailsScaResponse.xml
new file mode 100644
index 0000000..ee40b85
--- /dev/null
+++ b/tst/com/amazon/pay/response/xml/GetOrderReferenceDetailsScaResponse.xml
@@ -0,0 +1,62 @@
+
+
+
+
+ 2019-04-18T14:44:14.086Z
+ InvalidPaymentMethod
+ Suspended
+
+ en-GB
+
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx20=
+
+
+ Physical
+
+ IL
+ Chicago
+ 800-000-0000
+ US
+ 60602
+ Susie Smith
+ 10 Ditka Ave
+ Suite 2500
+
+
+ 2019-10-15T14:43:34.847Z
+
+ S02-7295856-8712939-A063411
+
+
+ SDK Sample Store Name
+ Any custom information
+ 123456-TestOrder-123456
+
+
+
+ PaymentPlanNotSet
+ The buyer has not been able to select a Payment method for the given Order Reference.
+
+
+
+ GBP
+ 19.95
+
+
+ REQUIRED
+
+
+ Sandbox Test
+ test+sandbox@amazon.com
+
+ Sandbox
+ The Seller Note
+ S02-7295856-8712939
+ 2019-04-18T14:43:34.847Z
+ false
+
+
+
+ df57b851-c556-46f0-a561-9e412d3b651d
+
+
diff --git a/tst/com/amazon/pay/response/xml/SanitizedData.xml b/tst/com/amazon/pay/response/xml/SanitizedData.xml
index d648b13..e44c19c 100644
--- a/tst/com/amazon/pay/response/xml/SanitizedData.xml
+++ b/tst/com/amazon/pay/response/xml/SanitizedData.xml
@@ -1,5 +1,4 @@
-
-
+
@@ -29,4 +28,4 @@
eab0140b-e59c-4875-859b-f5012944ba
-
\ No newline at end of file
+
diff --git a/tst/com/amazon/pay/response/xml/SanitizedDataBefore.xml b/tst/com/amazon/pay/response/xml/SanitizedDataBefore.xml
new file mode 100644
index 0000000..706465f
--- /dev/null
+++ b/tst/com/amazon/pay/response/xml/SanitizedDataBefore.xml
@@ -0,0 +1,37 @@
+
+
+
+
+
+ Draft
+
+
+ Physical
+
+ äöüßâêîôûàèùé
+ 宋 俊华 市区-徐汇区 广东省
+ 10101-9876
+ US
+
+
+ 2016-04-27T20:43:45.183Z
+ ANDRCTOTP9
+
+ myTestStore
+ myCustomInformation
+ test1234
+
+
+ USD
+ 500.00
+
+ Sandbox
+ This is a note that will get sanitized!
+ S01-9821095-0000200
+ 2015-10-30T20:43:45.183Z
+
+
+
+ eab0140b-e59c-4875-859b-f5012944ba
+
+
diff --git a/tst/com/amazon/pay/response/xml/SetBillingAgreementDetailsWithSCAResponse.xml b/tst/com/amazon/pay/response/xml/SetBillingAgreementDetailsWithSCAResponse.xml
new file mode 100644
index 0000000..f802c90
--- /dev/null
+++ b/tst/com/amazon/pay/response/xml/SetBillingAgreementDetailsWithSCAResponse.xml
@@ -0,0 +1,56 @@
+
+
+
+
+ C02-5533845-8537141
+
+ Draft
+
+ en-GB
+ false
+
+ Physical
+
+ IL
+ Chicago
+ US
+ 60602
+
+
+
+
+ BuyerConsentNotSet
+ The buyer has not given consent for this billing agreement.
+
+
+ MerchantInitiatedTransaction
+
+ SDK Sample Store Name
+ any custom information
+ 5678-example-order
+
+ Sandbox
+ Testing PHP SDK Recurring Samples
+
+ GBP
+ 25.00
+
+ 2019-08-20T22:03:09.297Z
+
+ 2019-08-01T00:00:00Z
+
+ GBP
+ 500.00
+
+
+ GBP
+ 500
+
+ 2019-09-01T00:00:00Z
+
+
+
+
+ 2dee6992-29f6-4d3e-bc86-2cf339241c58
+
+
\ No newline at end of file
diff --git a/tst/com/amazon/pay/response/xml/SetOrderAttributesScaResponse.xml b/tst/com/amazon/pay/response/xml/SetOrderAttributesScaResponse.xml
new file mode 100644
index 0000000..9cdf7b6
--- /dev/null
+++ b/tst/com/amazon/pay/response/xml/SetOrderAttributesScaResponse.xml
@@ -0,0 +1,49 @@
+
+
+
+
+ 2019-04-30T23:41:30.926Z
+ Open
+
+ en-GB
+
+ Physical
+
+ IL
+ Chicago
+ 800-000-0000
+ US
+ 60602
+ Susie Smith
+ 10 Ditka Ave
+ Suite 2500
+
+
+ 2019-10-27T23:24:14.907Z
+
+ SDK Sample Store Name
+ abcdef
+ abcdef
+
+
+ GBP
+ 10.00
+
+
+ REQUIRED
+
+
+ Sandbox Guillot
+ guillotb+sandbox@amazon.com
+
+ Sandbox
+ The Seller Note
+ S02-4946804-1132193
+ 2019-04-30T23:24:14.907Z
+ false
+
+
+
+ 68258c6f-9a7b-4cdf-b72b-9e0886f39d9b
+
+
diff --git a/tst/com/amazon/pay/response/xml/SetOrderReferenceDetailsResponse.xml b/tst/com/amazon/pay/response/xml/SetOrderReferenceDetailsResponse.xml
index 9cba5fb..15fb726 100644
--- a/tst/com/amazon/pay/response/xml/SetOrderReferenceDetailsResponse.xml
+++ b/tst/com/amazon/pay/response/xml/SetOrderReferenceDetailsResponse.xml
@@ -20,6 +20,7 @@
myTestStore
myCustomInformation
test1234
+ {"AirlineMetaData" : {"version": 1.0, "airlineCode": "WN", "flightDate": "2018-03-24T20:29:19.22Z", "departureAirport": "CDG", "destinationAirport": "LUX", "bookedLastTime": -1, "classOfTravel": "F", "passengers": {"numberOfPassengers": 4, "numberOfChildren": 1, "numberOfInfants": 1 }}, "AccommodationMetaData": {"version": 1.0, "startDate": "2018-03-24T20:29:19.22Z", "endDate": "2018-03-24T20:29:19.22Z", "lengthOfStay": 5, "numberOfGuests": 4, "class": "Standard", "starRating": 5, "bookedLastTime": -1 }, "OrderMetaData": {"version": 1.0, "numberOfItems": 3, "type": "Digital" }, "BuyerMetaData": {"version" : 1.0, "isFirstTimeCustomer" : true, "numberOfPastPurchases" : 2, "numberOfDisputedPurchases" : 3, "hasOpenDispute" : true, "riskScore" : 0.75 }}
USD
diff --git a/tst/com/amazon/pay/response/xml/Throttled.xml b/tst/com/amazon/pay/response/xml/Throttled.xml
new file mode 100644
index 0000000..7290034
--- /dev/null
+++ b/tst/com/amazon/pay/response/xml/Throttled.xml
@@ -0,0 +1,9 @@
+
+
+
+
+ RequestThrottled
+ Request is throttled
+
+ d702fd8e-206f-4da4-95e0-1e7422474077
+