PHP Class PayWithAmazon\IpnHandler

Inheritance: implements paywithamazon\IpnHandlerInterface, implements Psr\Log\LoggerAwareInterface
Datei anzeigen Open project: amzn/login-and-pay-with-amazon-sdk-php

Public Methods

Method Description
__construct ( $headers, $body, $ipnConfig = null )
__get ( $name ) * Getter function Returns the value for the key if the key exists in ipnConfig
__set ( $name, $value ) * Setter function Sets the value for the key if the key exists in ipnConfig
returnMessage ( ) * returnMessage() - JSON decode the raw [Message] portion of the IPN
setLogger ( Psr\Log\LoggerInterface $logger = null )
toArray ( ) * toArray() - Converts IPN [Message] field to associative array
toJson ( ) * toJson() - Converts IPN [Message] field to JSON
verifySignatureIsCorrectFromCertificate ( $signature ) * Verify that the signature is correct for the given data and public key

Private Methods

Method Description
checkConfigKeys ( $ipnConfig )
checkForCorrectMessageType ( ) * checkForCorrectMessageType()
constructAndVerifySignature ( ) * Verify that the signature is correct for the given data and public key
getCertificate ( $certificatePath ) * getCertificate($certificatePath)
getErrorMessageForJsonError ( $json_error ) * Convert a json error code to a descriptive error message
getField ( $fieldName ) * Extract the field if present, return null if not defined
getMandatoryField ( $fieldName ) * Extract the mandatory field from the message and return the contents
getMessage ( )
getRemainingIpnFields ( ) * getRemainingIpnFields() Gets the remaining fields of the IPN to be later appended to the return message
logMessage ( $message ) * Helper function to log data within the Client
sanitizeResponseData ( $input )
simpleXmlObject ( ) * addRemainingFields() - Add remaining fields to the datatype
trimArray ( $array ) * Trim the input Array key values
validateHeaders ( )
validateUrl ( $url ) * Ensures that the URL of the certificate is one belonging to AWS.

Method Details

__construct() public method

public __construct ( $headers, $body, $ipnConfig = null )

__get() public method

* Getter function Returns the value for the key if the key exists in ipnConfig
public __get ( $name )

__set() public method

* Setter function Sets the value for the key if the key exists in ipnConfig
public __set ( $name, $value )

returnMessage() public method

* returnMessage() - JSON decode the raw [Message] portion of the IPN
public returnMessage ( )

setLogger() public method

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

toArray() public method

* toArray() - Converts IPN [Message] field to associative array
public toArray ( )

toJson() public method

Has child elements ['NotificationData'] [XML] - API call XML notification data
public toJson ( )

verifySignatureIsCorrectFromCertificate() public method

* Verify that the signature is correct for the given data and public key
public verifySignatureIsCorrectFromCertificate ( $signature )
$signature decoded signature to compare against