Skip to content

Commit

Permalink
Update SDK to use XMLInputFactory.newInstance()
Browse files Browse the repository at this point in the history
  • Loading branch information
tarishah committed Mar 20, 2017
1 parent d42cd58 commit 306aeed
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 16 deletions.
7 changes: 6 additions & 1 deletion dist/CHANGES.txt → CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Version 3.0.1 - March 2017
- Updated XMLInputFactory.newFactory() to XMLInputFactory.newInstance() to support both IBM JDK and Oracle JDK.
- Updated README file as per the changes listed - https://github.com/amzn/amazon-pay-sdk-java/pull/13
- Updated thread sleep wait time constants to take milliseconds.

Version 3.0.0 - March 2017
- Pay with Amazon has become Amazon Pay.
We've changed our name, but you can still rely on us as a trusted and familiar payment solution. It's simpler, modern and universal?enabling us to create more connected experiences across diverse settings and devices.
We've changed our name, but you can still rely on us as a trusted and familiar payment solution. It's simpler, modern and universalenabling us to create more connected experiences across diverse settings and devices.
https://pages.payments.amazon.com/Amazon_Pay_Rebrand_Landing_Page_US.html
- User-Agent header modified to adhere to standards

Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

### Requirements

* Amazon Pay - [Register here](https://payments.amazon.com/signup)
* Amazon Pay - [Register here](https://pay.amazon.com/signup)
* Java 1.6 or higher *(including JCE Java Cryptography Extension)*
* Apache Commons Logging 1.2 *(or JCL-over-SLF4J drop in replacement)*
* Apache Commons Codec 1.10
Expand Down Expand Up @@ -159,7 +159,7 @@ client.closeOrderReference("AMAZON_ORDER_REFERENCE_ID");

```

### Subscriptions/Recurring Payments API Flow
### Subscriptions/Recurring Payments API Flow

```java
String merchantId = "YOUR_MERCHANT_ID";
Expand Down Expand Up @@ -327,10 +327,10 @@ user.getUserId();
Below are the steps to turn on the logging feature for your project.

- Select a logging framework to use for your project.
- Set the Logger instance 'log' in PaymentsLogUtil to the value of the logging framework.
- Set the Logger instance 'log' in PayLogUtil to the value of the logging framework.

```java
private static Logger log = Logger.getLogger(PaymentsLogUtil.class);
private static Logger log = Logger.getLogger(PayLogUtil.class);
```
- logMessage is called from 3 different places
* NotificationFactory.java that logs Headers and Notification Body
Expand Down Expand Up @@ -401,4 +401,4 @@ if (paymentDescriptor != null) {
log.info("Instrument Name = " + paymentDescriptor.getName());
log.info("Instrument Tail = " + paymentDescriptor.getAccountNumberTail());
log.info("Use Amazon Balance First = " + paymentDescriptor.isUseAmazonBalanceFirst());
}
}
Binary file not shown.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>com.amazon.pay</groupId>
<artifactId>amazon-pay</artifactId>
<packaging>jar</packaging>
<version>3.0.0</version>
<version>3.0.1</version>
<dependencies>
<dependency>
<groupId>com.sun.xml.bind</groupId>
Expand Down Expand Up @@ -67,4 +67,4 @@
</plugin>
</plugins>
</build>
</project>
</project>
2 changes: 1 addition & 1 deletion src/com/amazon/pay/impl/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public static ResponseData httpSendRequest(String method, String url, String url

userAgent.append("Java/" + JAVA_VERSION + "; " + OS_NAME + "/" + OS_VERSION + ")");
headerMap.put("User-Agent", userAgent.toString());

if (config.getProxyHost() != null) {
Properties systemSettings = System.getProperties();
systemSettings.put("proxySet", "true");
Expand Down
2 changes: 1 addition & 1 deletion src/com/amazon/pay/impl/ipn/NotificationFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ private static Notification getNotification(String payLoad) {
// XML parsing/unmarshalling issues, consider uncommenting the next line:
// unmarshaller.setEventHandler(new javax.xml.bind.helpers.DefaultValidationEventHandler());

XMLInputFactory xmlInputFactory = XMLInputFactory.newFactory();
XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance();
xmlInputFactory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false);
xmlInputFactory.setProperty(XMLInputFactory.SUPPORT_DTD, false);
XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(reader);
Expand Down
2 changes: 1 addition & 1 deletion src/com/amazon/pay/response/parser/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public static <T> T marshalXML(Class<T> clazz, ResponseData rawResponse) throws
// XML parsing/unmarshalling issues, consider uncommenting the next line:
// unmarshaller.setEventHandler(new javax.xml.bind.helpers.DefaultValidationEventHandler());

XMLInputFactory xmlInputFactory = XMLInputFactory.newFactory();
XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance();
xmlInputFactory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false);
xmlInputFactory.setProperty(XMLInputFactory.SUPPORT_DTD, false);
XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(reader);
Expand Down
10 changes: 5 additions & 5 deletions src/com/amazon/pay/types/ServiceConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,13 @@ public class ServiceConstants {
public static final String VALIDATE_BILLING_AGREEMENT_DETAILS = "ValidateBillingAgreement";

// SDK version
public static final String APPLICATION_LIBRARY_VERSION = "3.0.0";
public static final String APPLICATION_LIBRARY_VERSION = "3.0.1";
public static final String GITHUB_SDK_NAME = "amazon-pay-sdk-java";

// Exponential backoff wait times (seconds) for retry operations
public static final int FIRST_RETRY_WAIT_TIME = 1;
public static final int SECOND_RETRY_WAIT_TIME = 4;
public static final int THIRD_RETRY_WAIT_TIME = 10;
// Exponential backoff wait times (milliseconds) for retry operations
public static final int FIRST_RETRY_WAIT_TIME = 1000;
public static final int SECOND_RETRY_WAIT_TIME = 4000;
public static final int THIRD_RETRY_WAIT_TIME = 10000;

static {
Map<Region, String> mwsEndpointMappingsMap = new HashMap<Region,String>();
Expand Down
1 change: 1 addition & 0 deletions tst/.gitkeep
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Feel free to delete this file as soon as actual Java code is added to this directory.

0 comments on commit 306aeed

Please sign in to comment.