Skip to content

Commit

Permalink
Amazon Pay API SDK PHP 2.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Sharath Kamlekar committed Mar 17, 2023
1 parent 5d5c6a4 commit 19186c9
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 89 deletions.
5 changes: 3 additions & 2 deletions Amazon/Pay/API/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
use phpseclib3\Crypt\RSA;

require_once 'ClientInterface.php';
require_once 'ReportingClientInterface.php';
require_once 'HttpCurl.php';

class Client implements ClientInterface
class Client implements ClientInterface, ReportingClientInterface
{
const SDK_VERSION = '2.6.0';
const SDK_VERSION = '2.6.1';
const HASH_ALGORITHM = 'sha256';
const API_VERSION = 'v2';

Expand Down
87 changes: 1 addition & 86 deletions Amazon/Pay/API/ClientInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,90 +257,5 @@ public function createSignature($http_request_method, $request_uri, $request_par
* @optional headers - [indexed array of string key-value pairs]
*/
public function apiCall($method, $urlFragment, $payload, $headers = null);


// ----------------------------------- Reporting v2 APIs -----------------------------------


/* Amazon Checkout v2 Reporting APIs - Get Reports
*
* Returns report details for the reports that match the filters that you specify.
*
* @optional queryParameters - [String in JSON format] or [array]
* @optional headers - [array] - optional x-amz-pay-authtoken
*/
public function getReports($queryParameters = null, $headers = null);


/* Amazon Checkout v2 Reporting APIs - Get Report By Id
*
* Returns report details for the given reportId.
*
* @param $reportId [String]
* @optional headers - [array] - optional x-amz-pay-authtoken
*/
public function getReportById($reportId, $headers = null);


/* Amazon Checkout v2 Reporting APIs - Get Report Document
*
* Returns the pre-signed S3 URL for the report. The report can be downloaded using this URL.
*
* @param $reportDocumentId [String]
* @optional headers - [array] - optional x-amz-pay-authtoken
*/
public function getReportDocument($reportDocumentId, $headers = null);


/* Amazon Checkout v2 Reporting APIs - Get Report Schedules
*
* Returns report schedule details that match the filters criteria specified.
*
* @optional reportTypes - [String]
* @optional headers - [array] - optional x-amz-pay-authtoken
*/
public function getReportSchedules($reportTypes = null, $headers = null);



/* Amazon Checkout v2 Reporting APIs - Get Report Schedules By Id
*
* Returns the report schedule details that match the given ID.
*
* @param $reportScheduleId [String]
* @optional headers - [array] - optional x-amz-pay-authtoken
*/
public function getReportScheduleById($reportScheduleId, $headers = null);


/* Amazon Checkout v2 Reporting APIs - Create Report
*
* Submits a request to generate a report based on the reportType and date range specified.
*
* @param $requestPayload [String in JSON format] or [array]
* @optional headers - [array] - optional x-amz-pay-authtoken
*/
public function createReport($requestPayload, $headers);


/* Amazon Checkout v2 Reporting APIs - Create Report Schedule
*
* Creates a report schedule for the given reportType. Only one schedule per report type allowed.
*
* @param $requestPayload [String in JSON format] or [array]
* @param headers - [array] - requires x-amz-pay-Idempotency-Key header; optional x-amz-pay-authtoken
*/
public function createReportSchedule($requestPayload, $headers);


/* Amazon Checkout v2 Reporting APIs - Cancel Report Schedule
*
* Cancels the report schedule with the given reportScheduleId.
*
* @param $reportScheduleId [String]
* @optional headers - [array] - optional x-amz-pay-authtoken
*/
public function cancelReportSchedule($reportScheduleId, $headers = null);



}
92 changes: 92 additions & 0 deletions Amazon/Pay/API/ReportingClientInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?php
namespace Amazon\Pay\API;

/* Interface class to showcase the public API methods for Amazon Pay */

interface ReportingClientInterface
{
// ----------------------------------- Reporting v2 APIs -----------------------------------


/* Amazon Checkout v2 Reporting APIs - Get Reports
*
* Returns report details for the reports that match the filters that you specify.
*
* @optional queryParameters - [multi-dimension array with key and values]
* @optional headers - [array] - optional x-amz-pay-authtoken
*/
public function getReports($queryParameters = null, $headers = null);


/* Amazon Checkout v2 Reporting APIs - Get Report By Id
*
* Returns report details for the given reportId.
*
* @param $reportId [String]
* @optional headers - [array] - optional x-amz-pay-authtoken
*/
public function getReportById($reportId, $headers = null);


/* Amazon Checkout v2 Reporting APIs - Get Report Document
*
* Returns the pre-signed S3 URL for the report. The report can be downloaded using this URL.
*
* @param $reportDocumentId [String]
* @optional headers - [array] - optional x-amz-pay-authtoken
*/
public function getReportDocument($reportDocumentId, $headers = null);


/* Amazon Checkout v2 Reporting APIs - Get Report Schedules
*
* Returns report schedule details that match the filters criteria specified.
*
* @optional reportTypes - [String]
* @optional headers - [array] - optional x-amz-pay-authtoken
*/
public function getReportSchedules($reportTypes = null, $headers = null);



/* Amazon Checkout v2 Reporting APIs - Get Report Schedules By Id
*
* Returns the report schedule details that match the given ID.
*
* @param $reportScheduleId [String]
* @optional headers - [array] - optional x-amz-pay-authtoken
*/
public function getReportScheduleById($reportScheduleId, $headers = null);


/* Amazon Checkout v2 Reporting APIs - Create Report
*
* Submits a request to generate a report based on the reportType and date range specified.
*
* @param $requestPayload [String in JSON format] or [array]
* @optional headers - [array] - optional x-amz-pay-authtoken
*/
public function createReport($requestPayload, $headers = null);


/* Amazon Checkout v2 Reporting APIs - Create Report Schedule
*
* Creates a report schedule for the given reportType. Only one schedule per report type allowed.
*
* @param $requestPayload [String in JSON format] or [array]
* @optional headers - [array] - optional x-amz-pay-authtoken
*/
public function createReportSchedule($requestPayload, $headers = null);


/* Amazon Checkout v2 Reporting APIs - Cancel Report Schedule
*
* Cancels the report schedule with the given reportScheduleId.
*
* @param $reportScheduleId [String]
* @optional headers - [array] - optional x-amz-pay-authtoken
*/
public function cancelReportSchedule($reportScheduleId, $headers = null);


}
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.1 - March 2023
* Corrected some minor changes in Reporting APIs
* Note: Please use 2.6.1 if you are implementing Reporting APIs and avoid 2.6.0

### Version 2.6.0 - March 2023
* Introducing new v2 Reporting APIs. Reports allow you to retrieve consolidated data about Amazon Pay transactions and settlements. In addition to managing and downloading reports using Seller Central, Amazon Pay offers APIs to manage and retrieve your reports.

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "amzn/amazon-pay-api-sdk-php",
"type": "library",
"description": "Amazon Pay API SDK (PHP)",
"version": "2.6.0",
"version": "2.6.1",
"keywords": [
"amazon",
"pay",
Expand Down

0 comments on commit 19186c9

Please sign in to comment.