PHP 클래스 PayWithAmazon\Client

상속: implements paywithamazon\ClientInterface, implements Psr\Log\LoggerAwareInterface
파일 보기 프로젝트 열기: amzn/login-and-pay-with-amazon-sdk-php

공개 프로퍼티들

프로퍼티 타입 설명
$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