PHP Класс PayWithAmazon\Client

Наследование: implements paywithamazon\ClientInterface, implements Psr\Log\LoggerAwareInterface
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
$success Boolean variable to check if the API call was a success

Открытые методы

Метод Описание
__construct ( $config = null ) * Takes user configuration array from the user as input Takes JSON file path with configuration information as input Validates the user configuration array against existing config array
__get ( $name ) * Getter Gets the value for the key if the key exists in config
authorize ( $requestParameters = [] ) * Authorize API call - Reserves a specified amount against the payment method(s) stored in the order reference.
authorizeOnBillingAgreement ( $requestParameters = [] ) * AuthorizeOnBillingAgreement API call - Reserves a specified amount against the payment method(s) stored in the Billing Agreement.
cancelOrderReference ( $requestParameters = [] ) * CancelOrderReferenceDetails API call - Cancels a previously confirmed order reference.
capture ( $requestParameters = [] ) * Capture API call - Captures funds from an authorized payment instrument.
charge ( $requestParameters = [] ) * charge convenience method Performs the API calls 1. SetOrderReferenceDetails / SetBillingAgreementDetails 2. ConfirmOrderReference / ConfirmBillingAgreement 3. Authorize (with Capture) / AuthorizeOnBillingAgreeemnt (with Capture)
closeAuthorization ( $requestParameters = [] ) * CloseAuthorization API call - Closes an authorization.
closeBillingAgreement ( $requestParameters = [] ) * CloseBillingAgreement API Call - Returns details about the Billing Agreement object and its current state.
closeOrderReference ( $requestParameters = [] ) * CloseOrderReferenceDetails API call - Confirms that an order reference has been fulfilled (fully or partially) and that you do not expect to create any new authorizations on this order reference.
confirmBillingAgreement ( $requestParameters = [] ) * ConfirmBillingAgreement API Call - Confirms that the Billing Agreement is free of constraints and all required information has been set on the Billing Agreement.
confirmOrderReference ( $requestParameters = [] ) * ConfirmOrderReferenceDetails API call - Confirms that the order reference is free of constraints and all required information has been set on the order reference.
createOrderReferenceForId ( $requestParameters = [] ) * CreateOrderReferenceForId API Call - Creates an order reference for the given object
getAuthorizationDetails ( $requestParameters = [] ) * GetAuthorizationDetails API call - Returns the status of a particular authorization and the total amount captured on the authorization.
getBillingAgreementDetails ( $requestParameters = [] ) * GetBillingAgreementDetails API Call - Returns details about the Billing Agreement object and its current state.
getCaptureDetails ( $requestParameters = [] ) * GetCaptureDetails API call - Returns the status of a particular capture and the total amount refunded on the capture.
getOrderReferenceDetails ( $requestParameters = [] ) * GetOrderReferenceDetails API call - Returns details about the Order Reference object and its current state.
getParameters ( ) * Getter for parameters string Gets the value for the parameters string for unit testing
getProviderCreditDetails ( $requestParameters = [] ) * GetProviderCreditDetails API Call - Get the details of the Provider Credit.
getProviderCreditReversalDetails ( $requestParameters = [] ) * GetProviderCreditReversalDetails API Call - Get details of the Provider Credit Reversal.
getRefundDetails ( $requestParameters = [] ) * GetRefundDetails API call - Returns the status of a particular refund.
getServiceStatus ( $requestParameters = [] ) * GetServiceStatus API Call - Returns the operational status of the Off-Amazon Payments API section
getSignature ( $stringToSign, $secretKey ) * Computes RFC 2104-compliant HMAC signature
getUserInfo ( $accessToken ) * GetUserInfo convenience function - Returns user's profile information from Amazon using the access token returned by the Button widget.
refund ( $requestParameters = [] ) * Refund API call - Refunds a previously captured amount.
reverseProviderCredit ( $requestParameters = [] ) * ReverseProviderCredit API Call - Reverse the Provider Credit.
setBillingAgreementDetails ( $requestParameters = [] ) * SetBillingAgreementDetails API call - Sets Billing Agreement details such as a description of the agreement and other information about the seller.
setClientId ( $value ) * Setter for config['client_id'] Sets the value for config['client_id'] variable
setLogger ( Psr\Log\LoggerInterface $logger = null )
setMwsServiceUrl ( $url ) * Setter for $mwsServiceUrl Set the URL to which the post request has to be made for unit testing
setOrderReferenceDetails ( $requestParameters = [] ) * SetOrderReferenceDetails API call - Sets order reference details such as the order total and a description for the order.
setProxy ( $proxy ) * Setter for Proxy input $proxy [array]
setSandbox ( $value ) * Setter for sandbox Sets the Boolean value for config['sandbox'] variable
validateBillingAgreement ( $requestParameters = [] ) * ValidateBillignAgreement API Call - Validates the status of the Billing Agreement object and the payment method associated with it.

Приватные методы

Метод Описание
calculateSignatureAndParametersToString ( $parameters = [] ) * Create an Array of required parameters, sort them Calculate signature and invoke the POST to the MWS Service URL
calculateSignatureAndPost ( $parameters ) * calculateSignatureAndPost - convert the Parameters array to string and curl POST the parameters to MWS
calculateStringToSignV2 ( array $parameters ) * Calculate String to Sign for SignatureVersion 2
checkConfigKeys ( $config ) * Checks if the keys of the input configuration matches the keys in the config array if they match the values are taken else throws exception strict case match is not performed
checkIfBool ( $string ) * checkIfBool - checks if the input is a boolean
checkIfFileExists ( $config ) * checkIfFileExists - check if the JSON file exists in the path provided
constructUserAgentHeader ( ) * Create the User Agent Header sent with the POST request
createServiceUrl ( ) * Create MWS service URL and the Endpoint path
getErrorMessageForJsonError ( $jsonError ) * Convert a json error code to a descriptive error message
getFormattedTimestamp ( ) * Formats date as ISO 8601 timestamp
getParametersAsString ( array $parameters ) * Convert paremeters to Url encoded query string
getRegionUrls ( ) * Get the Region specific properties from the Regions class.
invokePost ( $parameters ) * invokePost takes the parameters and invokes the httpPost function to POST the parameters Exponential retries on error 500 and 503 The response from the POST is an XML which is converted to Array
logMessage ( $message ) * Helper function to log data within the Client
makeChargeCalls ( $chargeType, $setParameters, $confirmParameters, $authorizeParameters ) * makeChargeCalls - makes API calls based off the charge type (OrderReference or BillingAgreement)
pauseOnRetry ( $retries, $status ) * Exponential sleep on failed request
profileEndpointUrl ( ) * Based on the config['region'] and config['sandbox'] values get the user profile URL
quoteApplicationName ( $s ) * Collapse multiple whitespace characters into a single ' ' and backslash escape '\', and '/' characters from a string.
quoteApplicationVersion ( $s ) * Collapse multiple whitespace characters into a single ' ' and backslash escape '\', and '(' characters from a string.
sanitizeRequestData ( $input )
sanitizeResponseData ( $input )
setDefaultValues ( $parameters, $fieldMappings, $requestParameters ) * If merchant_id is not set via the requestParameters array then it's taken from the config array
setParametersAndPost ( $parameters, $fieldMappings, $requestParameters ) * setParametersAndPost - sets the parameters array with non empty values from the requestParameters array sent to API calls.
setProviderCreditDetails ( $parameters, $providerCreditInfo ) * setProviderCreditDetails - sets the provider credit details sent via the Capture or Authorize API calls
setProviderCreditReversalDetails ( $parameters, $providerCreditInfo ) * setProviderCreditReversalDetails - sets the reverse provider credit details sent via the Refund API call.
sign ( $data, $algorithm ) * Computes RFC 2104-compliant HMAC signature
signParameters ( array $parameters ) * Computes RFC 2104-compliant HMAC signature for request parameters Implements AWS Signature, as per following spec:
trimArray ( $array ) * Trim the input Array key values
urlEncode ( $value )

Описание методов

__construct() публичный Метод

* Takes user configuration array from the user as input Takes JSON file path with configuration information as input Validates the user configuration array against existing config array
public __construct ( $config = null )

__get() публичный Метод

* Getter Gets the value for the key if the key exists in config
public __get ( $name )

authorize() публичный Метод

* Authorize API call - Reserves a specified amount against the payment method(s) stored in the order reference.
См. также: http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_Authorize.html
public authorize ( $requestParameters = [] )

authorizeOnBillingAgreement() публичный Метод

* AuthorizeOnBillingAgreement API call - Reserves a specified amount against the payment method(s) stored in the Billing Agreement.
См. также: http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_AuthorizeOnBillingAgreement.html
public authorizeOnBillingAgreement ( $requestParameters = [] )

cancelOrderReference() публичный Метод

* CancelOrderReferenceDetails API call - Cancels a previously confirmed order reference.
См. также: http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_CancelOrderReference.html
public cancelOrderReference ( $requestParameters = [] )

capture() публичный Метод

* Capture API call - Captures funds from an authorized payment instrument.
См. также: http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_Capture.html
public capture ( $requestParameters = [] )

charge() публичный Метод

* charge convenience method Performs the API calls 1. SetOrderReferenceDetails / SetBillingAgreementDetails 2. ConfirmOrderReference / ConfirmBillingAgreement 3. Authorize (with Capture) / AuthorizeOnBillingAgreeemnt (with Capture)
public charge ( $requestParameters = [] )

closeAuthorization() публичный Метод

* CloseAuthorization API call - Closes an authorization.
См. также: http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_CloseOrderReference.html
public closeAuthorization ( $requestParameters = [] )

closeBillingAgreement() публичный Метод

* CloseBillingAgreement API Call - Returns details about the Billing Agreement object and its current state.
См. также: http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_CloseBillingAgreement.html
public closeBillingAgreement ( $requestParameters = [] )

closeOrderReference() публичный Метод

* CloseOrderReferenceDetails API call - Confirms that an order reference has been fulfilled (fully or partially) and that you do not expect to create any new authorizations on this order reference.
См. также: http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_CloseOrderReference.html
public closeOrderReference ( $requestParameters = [] )

confirmBillingAgreement() публичный Метод

* ConfirmBillingAgreement API Call - Confirms that the Billing Agreement is free of constraints and all required information has been set on the Billing Agreement.
См. также: http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_ConfirmBillingAgreement.html
public confirmBillingAgreement ( $requestParameters = [] )

confirmOrderReference() публичный Метод

* ConfirmOrderReferenceDetails API call - Confirms that the order reference is free of constraints and all required information has been set on the order reference.
См. также: http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_ConfirmOrderReference.html
public confirmOrderReference ( $requestParameters = [] )

createOrderReferenceForId() публичный Метод

* CreateOrderReferenceForId API Call - Creates an order reference for the given object
См. также: http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_CreateOrderReferenceForId.html
public createOrderReferenceForId ( $requestParameters = [] )

getAuthorizationDetails() публичный Метод

* GetAuthorizationDetails API call - Returns the status of a particular authorization and the total amount captured on the authorization.
См. также: http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_GetAuthorizationDetails.html
public getAuthorizationDetails ( $requestParameters = [] )

getBillingAgreementDetails() публичный Метод

* GetBillingAgreementDetails API Call - Returns details about the Billing Agreement object and its current state.
См. также: http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_GetBillingAgreementDetails.html
public getBillingAgreementDetails ( $requestParameters = [] )

getCaptureDetails() публичный Метод

* GetCaptureDetails API call - Returns the status of a particular capture and the total amount refunded on the capture.
См. также: http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_GetCaptureDetails.html
public getCaptureDetails ( $requestParameters = [] )

getOrderReferenceDetails() публичный Метод

* GetOrderReferenceDetails API call - Returns details about the Order Reference object and its current state.
См. также: http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_GetOrderReferenceDetails.html
public getOrderReferenceDetails ( $requestParameters = [] )

getParameters() публичный Метод

* Getter for parameters string Gets the value for the parameters string for unit testing
public getParameters ( )

getProviderCreditDetails() публичный Метод

* GetProviderCreditDetails API Call - Get the details of the Provider Credit.
public getProviderCreditDetails ( $requestParameters = [] )

getProviderCreditReversalDetails() публичный Метод

* GetProviderCreditReversalDetails API Call - Get details of the Provider Credit Reversal.
public getProviderCreditReversalDetails ( $requestParameters = [] )

getRefundDetails() публичный Метод

* GetRefundDetails API call - Returns the status of a particular refund.
См. также: http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_GetRefundDetails.html
public getRefundDetails ( $requestParameters = [] )

getServiceStatus() публичный Метод

* GetServiceStatus API Call - Returns the operational status of the Off-Amazon Payments API section
См. также: http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_GetServiceStatus.html The GetServiceStatus operation returns the operational status of the Off-Amazon Payments API section of Amazon Marketplace Web Service (Amazon MWS). Status values are GREEN, GREEN_I, YELLOW, and RED.
public getServiceStatus ( $requestParameters = [] )

getSignature() публичный статический Метод

* Computes RFC 2104-compliant HMAC signature
public static getSignature ( $stringToSign, $secretKey )

getUserInfo() публичный Метод

* GetUserInfo convenience function - Returns user's profile information from Amazon using the access token returned by the Button widget.
См. также: http://login.amazon.com/website Step 4
public getUserInfo ( $accessToken )
$accessToken [String]

refund() публичный Метод

* Refund API call - Refunds a previously captured amount.
См. также: http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_Refund.html
public refund ( $requestParameters = [] )

reverseProviderCredit() публичный Метод

* ReverseProviderCredit API Call - Reverse the Provider Credit.
public reverseProviderCredit ( $requestParameters = [] )

setBillingAgreementDetails() публичный Метод

* SetBillingAgreementDetails API call - Sets Billing Agreement details such as a description of the agreement and other information about the seller.
См. также: http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_SetBillingAgreementDetails.html
public setBillingAgreementDetails ( $requestParameters = [] )

setClientId() публичный Метод

* Setter for config['client_id'] Sets the value for config['client_id'] variable
public setClientId ( $value )

setLogger() публичный Метод

public setLogger ( Psr\Log\LoggerInterface $logger = null )
$logger Psr\Log\LoggerInterface

setMwsServiceUrl() публичный Метод

* Setter for $mwsServiceUrl Set the URL to which the post request has to be made for unit testing
public setMwsServiceUrl ( $url )

setOrderReferenceDetails() публичный Метод

* SetOrderReferenceDetails API call - Sets order reference details such as the order total and a description for the order.
См. также: http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_SetOrderReferenceDetails.html
public setOrderReferenceDetails ( $requestParameters = [] )

setProxy() публичный Метод

* Setter for Proxy input $proxy [array]
public setProxy ( $proxy )

setSandbox() публичный Метод

* Setter for sandbox Sets the Boolean value for config['sandbox'] variable
public setSandbox ( $value )

validateBillingAgreement() публичный Метод

* ValidateBillignAgreement API Call - Validates the status of the Billing Agreement object and the payment method associated with it.
См. также: http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_ValidateBillingAgreement.html
public validateBillingAgreement ( $requestParameters = [] )

Описание свойств

$success публичное свойство

Boolean variable to check if the API call was a success
public $success