Skip to content

Commit

Permalink
Amazon Pay API SDK (Java) 2.6.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhishek Kumar committed Aug 6, 2024
1 parent 2bffa2e commit e61dec9
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### Version 2.6.3 - August 2024
* Introducing the getDisbursements API.
* The `getDisbursements` API enables you to retrieve disbursement details based on a specified date range for settlement dates.

### Version 2.6.2 - January 2024
* Setting UTF-8 as default encoding format during Signature generation.
* Introducing new API called finalizeCheckoutSession which validates critical attributes in merchantMetadata then processes payment. Use this API to process payments for JavaScript-based integrations.
Expand Down
28 changes: 26 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ To use the SDK in a Maven project, add a <dependency> reference in your pom.xml
<dependency>
<groupId>software.amazon.pay</groupId>
<artifactId>amazon-pay-api-sdk-java</artifactId>
<version>2.6.2</version>
<version>2.6.3</version>
</dependency>
</dependencies>
```

To use the SDK in a Gradle project, add the following line to your build.gradle file::

```
implementation 'software.amazon.pay:amazon-pay-api-sdk-java:2.6.2'
implementation 'software.amazon.pay:amazon-pay-api-sdk-java:2.6.3'
```

For legacy projects, you can just grab the binary [jar file](https://github.com/amzn/amazon-pay-api-sdk-java/releases) from the GitHub Releases page.
Expand Down Expand Up @@ -937,6 +937,30 @@ try {
}
```
## Amazon Checkout v2 Reporting APIs - getDisbursements API
```java
final Map<String, List<String>> queryParameters = getDisbursementsQueryParameters();
final Map<String, String> header = Collections.singletonMap("x-amz-pay-idempotency-key", UUID.randomUUID().toString().replace("-", ""));
try {
final AmazonPayResponse response = webstoreClient.getDisbursements(queryParameters, header);
} catch (AmazonPayClientException e) {
e.printStackTrace();
}
private static Map<String, List<String>> getDisbursementsQueryParameters() {
final Map<String, List<String>> queryParameters = new HashMap<>();
queryParameters.put("startTime", Collections.singletonList("20240715T000000Z"));
queryParameters.put("endTime", Collections.singletonList("20240801T235959Z"));
queryParameters.put("pageSize", Collections.singletonList("5"));
queryParameters.put("nextToken", Collections.singletonList(""));
return queryParameters;
}
```
## AmazonPay Single Page Checkout APIs
### Making a finalizeCheckoutSession request
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<groupId>software.amazon.pay</groupId>
<artifactId>amazon-pay-api-sdk-java</artifactId>
<packaging>jar</packaging>
<version>2.6.2</version>
<version>2.6.3</version>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.json/json -->
<dependency>
Expand Down
3 changes: 2 additions & 1 deletion src/com/amazon/pay/api/ServiceConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class ServiceConstants {
public static final Map<Region, String> endpointMappings;
public static final Map<String, Integer> serviceErrors;

public static final String APPLICATION_LIBRARY_VERSION = "2.6.2";
public static final String APPLICATION_LIBRARY_VERSION = "2.6.3";
public static final String GITHUB_SDK_NAME = "amazon-pay-api-sdk-java";
public static final String AMAZON_PAY_API_VERSION = "v2";

Expand Down Expand Up @@ -65,6 +65,7 @@ public class ServiceConstants {
public static final String REPORTS = AMAZON_PAY_API_VERSION + "/reports";
public static final String REPORT_DOCUMENT = AMAZON_PAY_API_VERSION + "/report-documents";
public static final String REPORT_SCHEDULES = AMAZON_PAY_API_VERSION + "/report-schedules";
public static final String DISBURSEMENTS = AMAZON_PAY_API_VERSION + "/disbursements";

// Merchant Onboarding & Account Management APIs Constants
public static final String ACCOUNT_MANAGEMENT = AMAZON_PAY_API_VERSION + "/merchantAccounts";
Expand Down
14 changes: 14 additions & 0 deletions src/com/amazon/pay/api/WebstoreClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,20 @@ public AmazonPayResponse cancelReportSchedule(final String reportScheduleId) thr
return cancelReportSchedule(reportScheduleId, null);
}

/**
* The getDisbursements operation is used to receive disbursement details based on a date range of the settlement date specified in the request.
*
* @param queryParameters Query Parameters to be provided while calling API (e.g., startTime, endTime, pageSize, etc.)
* @param header Map&lt;String, String&gt; containing key-value pair of headers (e.g., keys such as x-amz-pay-idempotency-key, x-amz-pay-date)
* @return The response from the getDisbursements API, as returned by Amazon Pay.
* @throws AmazonPayClientException When an error response is returned by Amazon Pay due to bad request or other issue.
*/
public AmazonPayResponse getDisbursements(final Map<String, List<String>> queryParameters, final Map<String, String> header) throws AmazonPayClientException {
final URI getDisbursementsURI = Util.getServiceURI(payConfiguration, ServiceConstants.DISBURSEMENTS);
final URI getDisbursementsFinalURI = getDisbursementsURI.resolve(getDisbursementsURI.getPath() + "/?" + convertQueryParamters(queryParameters));
return callAPI(getDisbursementsFinalURI, "GET", queryParameters, "", header);
}

/**
* The finalizeCheckoutSession operation enables Pay to validate payment critical attributes and also update book-keeping attributes present in merchantMetadata
*
Expand Down

0 comments on commit e61dec9

Please sign in to comment.