ePages 7.23.0 - DE_EPAGES/AmazonPayments/API/Object/AmazonRestClient.pm

Package DE_EPAGES::AmazonPayments::API::Object::AmazonRestClient

Client for Amazon Payments

Base
DE_EPAGES::EPagesJ::API::Object::RestClient

Functions

authorize
cancelOrder
capture
check
closeAuthorization
closeOrder
confirmOrder
create
getAuthorizationDetails
getCaptureDetails
getOrderDetails
new
setOrderDetails

authorize

Request authorization to capture money for an order

Syntax
$Status = $Client->authorize($refId, $authRefId, $amount, $currency);
Input
$refId (string)
Order reference id
$authRefId (string)
User defined reference id, up to 32 characters
$amount (number)
The amount to request authorization for
$currency (string)
The currency id to use
Return
$AuthorizationDetails (object)
DE_EPAGES::AmazonPayments::API::DTO::AuthorizationDetails

cancelOrder

Cancels an order

Syntax
$Client->cancelOrder($orderRefId);
Input
$refId (string)
Amazon oder reference id

capture

Capture an order amount from Amazon

Syntax
$CaptureDetails = $Client->capture($authId);
Input
$authId (string)
The id of the open authorization
$captureRefId (string)
User-defined capture reference id, max. 32 characters
$amount (number)
Amount to capture
$currency (string)
Currency id to capture in
Return
$CaptureDetails (object)
DE_EPAGES::AmazonPayments::API::DTO::CaptureDetails

check

Performs a REST call to the EpagesJ payment/amazon/check resource to validate payment credentials

Syntax
$Status = $Client->check();
Return
$Status (string)
The check status returned by EPagesJ:
OK, UNKNOWN_MERCHANT_ID or UNAUTHORIZED_DEVELOPER

closeAuthorization

Closes an authorization. Call this when no more captures will be done against the authorization

Syntax
$Client->closeAuthorization($authId);
Input
$authId (string)
Amazon authorization id

closeOrder

Close an order

Syntax
$Client->closeOrder($orderRefId);
Input
$refId (string)
Amazon oder reference id

confirmOrder

Confirm the order and put it in Status ORDER_OPEN

Syntax
$Status = $Client->confirmOrder($refId);
Input
$refId (string)
Amazon order reference id
Return
Throws ConfirmOrderFailed if order could not be confirmed (e.g. client
needs to correct information first).
Throws ConfirmOrderInvalid if order could not be found or has expired.

create

Factory method for a AmazonRestClient object.

Syntax
$RestClient = DE_EPAGES::AmazonPayments::API::Object::AmazonRestClient->create($PaymentMethod, $hArgs);
Input
$PaymentMethod (DE_EPAGES::AmazonPayments::API::Object::PaymentMethodAmazonPayments)
This context object will be used for initializing
BaseURL and Resource parameters for the rest client.
$hArgs (ref.hash)
Additional arguments for constructor
  • BaseURL - the base url used for CreateUriTemplates - string
  • Region - the region identifier to use - string
  • hKeySet - used keys: AccessKeyId | access key | string

    SecretKey | secret key | string

    MerchantID | Amazon seller ID | string
    - ref.hash
  • refId - Order reference id (optional) - string
Return
$RestClient (DE_EPAGES::AmazonPayments::API::Object::AmazonRestClient)
Client object

getAuthorizationDetails

Request information about an Amazon capture authorization

Syntax
$Status = $Client->getAuthorizationDetails($authId);
Input
$authId (string)
Amazon authorization id
Return
$AuthorizationDetails (object)
DE_EPAGES::AmazonPayments::API::DTO::AuthorizationDetails

getCaptureDetails

Get detail information about a capture

Syntax
$CaptureDetails = $Client->getCaptureDetails($captureId);
Input
$captureId (string)
Amazon capture id
Return
$CaptureDetails (object)
DE_EPAGES::AmazonPayments::API::DTO::CaptureDetails

getOrderDetails

Get detailed information about an Amazon Order Reference

Syntax
$OrderReferenceInfo = $Client->getOrderDetails($refId);
Input
$refId (string)
Order reference id
Return
$OrderReferenceInfo (DE_EPAGES::AmazonPayments::API::DTO::OrderReferenceInfo)
Order reference information

new

Webservice client constructor

Syntax
DE_EPAGES::AmazonPayments::API::Object::AmazonRestClient->new( %args );
Input
%args (ref.hash)
Constructor arguments. Valid keys are:
  • OperationMode - operation mode of the Amazon Payments method (LIVE or SANDBOX) - string
  • Region - the region identifier to use - string
  • hKeySet - Set of credentials
    • AccessKeyId - the Amazon access key - string
    • SecrectKey - the secret key - string
    • MerchantID - the merchant id - string
    - ref.hash
  • refId - Amazon order reference id (optional) - string
Return
$Object (DE_EPAGES::AmazonPayments::API::Object::AmazonRestClient)
new object

setOrderDetails

Set details on an Amazon Order Reference

Syntax
$Status = $Client->setOrderDetails($refId, $hArgs);
Input
$refId (string)
Order reference id
$hArgs (ref.hash)
Detail values
  • orderTotal | The total value of the order
    • amount | The order amount | number
    • currency | The currency id used for the order | string
    | ref.hash
Return
$Status (string)
The new status of the order reference:
ORDER_DRAFT, ORDER_OPEN, ORDER_SUSPENDED, ORDER_CANCELED or ORDER_CLOSED