Public Member Functions | |
getPayUrl () | |
getPayParams ($referenceId, $amountValue, $currencyCode, $abandonUrl, $returnUrl, $ipnUrl) | |
processNotification ($requestParams) | |
cancel ($transactionId) | |
capture ($transactionId, $amount, $currencyCode) | |
refund ($transactionId, $amount, $currencyCode, $referenceId) | |
Protected Member Functions | |
_getFps () | |
_getIpnRequest () | |
Protected Attributes | |
$_collectShippingAddress = 0 | |
$_ipnRequest = 'amazonpayments/api_asp_ipn_request' | |
$_fpsModel = 'amazonpayments/api_asp_fps' |
Definition at line 34 of file Asp.php.
_getFps | ( | ) | [protected] |
Get singleton with AmazonPayments ASP API FPS Model
Definition at line 56 of file Asp.php.
00057 { 00058 return Mage::getSingleton($this->_fpsModel)->setStoreId($this->getStoreId()); 00059 }
_getIpnRequest | ( | ) | [protected] |
Get singleton with AmazonPayments ASP IPN notification request Model
Definition at line 66 of file Asp.php.
00067 { 00068 return Mage::getSingleton($this->_ipnRequest); 00069 }
cancel | ( | $ | transactionId | ) |
cancel payment through FPS api
string | $transactionId |
Definition at line 156 of file Asp.php.
00157 { 00158 $fps = $this->_getFps(); 00159 00160 $request = $fps->getRequest(Mage_AmazonPayments_Model_Api_Asp_Fps::ACTION_CODE_CANCEL) 00161 ->setTransactionId($transactionId) 00162 ->setDescription($this->_getConfig('cancel_description')); 00163 00164 $response = $fps->process($request); 00165 return $response; 00166 }
capture | ( | $ | transactionId, | |
$ | amount, | |||
$ | currencyCode | |||
) |
capture payment through FPS api
string | $transactionId | |
string | $amount | |
string | $currencyCode |
Definition at line 176 of file Asp.php.
00177 { 00178 $fps = $this->_getFps(); 00179 $amount = $this->_getAmount() 00180 ->setValue($amount) 00181 ->setCurrencyCode($currencyCode); 00182 00183 $request = $fps->getRequest(Mage_AmazonPayments_Model_Api_Asp_Fps::ACTION_CODE_SETTLE) 00184 ->setTransactionId($transactionId) 00185 ->setAmount($amount); 00186 00187 $response = $fps->process($request); 00188 return $response; 00189 }
getPayParams | ( | $ | referenceId, | |
$ | amountValue, | |||
$ | currencyCode, | |||
$ | abandonUrl, | |||
$ | returnUrl, | |||
$ | ipnUrl | |||
) |
Return Amazon Simple Pay payment params
string | $referenceId | |
string | $amountValue | |
string | $currencyCode | |
string | $abandonUrl | |
string | $returnUrl | |
string | $ipnUrl |
Definition at line 96 of file Asp.php.
00097 { 00098 $amount = Mage::getSingleton('amazonpayments/api_asp_amount') 00099 ->setValue($amountValue) 00100 ->setCurrencyCode($currencyCode); 00101 00102 $requestParams = array(); 00103 $requestParams['referenceId'] = $referenceId; 00104 $requestParams['amount'] = $amount->toString(); 00105 $requestParams['description'] = $this->_getConfig('pay_description'); 00106 00107 $requestParams['accessKey'] = $this->_getConfig('access_key'); 00108 $requestParams['processImmediate'] = $this->_getConfig('pay_process_immediate'); 00109 $requestParams['immediateReturn'] = $this->_getConfig('pay_immediate_return'); 00110 $requestParams['collectShippingAddress'] = $this->_collectShippingAddress; 00111 $requestParams['abandonUrl'] = $abandonUrl; 00112 $requestParams['returnUrl'] = $returnUrl; 00113 $requestParams['ipnUrl'] = $ipnUrl; 00114 00115 $signature = $this->_getSignatureForArray($requestParams, $this->_getConfig('secret_key')); 00116 $requestParams['signature'] = $signature; 00117 00118 return $requestParams; 00119 }
getPayUrl | ( | ) |
Return Amazon Simple Pay payment url
Definition at line 77 of file Asp.php.
00078 { 00079 if ($this->_isSandbox()) { 00080 return $this->_getConfig('pay_service_url_sandbox'); 00081 } 00082 return $this->_getConfig('pay_service_url'); 00083 }
processNotification | ( | $ | requestParams | ) |
process notification request
array | $requestParams |
Definition at line 127 of file Asp.php.
00128 { 00129 $requestSignature = false; 00130 00131 if (isset($requestParams['signature'])) { 00132 $requestSignature = $requestParams['signature']; 00133 unset($requestParams['signature']); 00134 } 00135 00136 $originalSignature = $this->_getSignatureForArray($requestParams, $this->_getConfig('secret_key')); 00137 if ($requestSignature != $originalSignature) { 00138 Mage::throwException(Mage::helper('amazonpayments')->__('Request signed an incorrect or missing signature')); 00139 } 00140 00141 $ipnRequest = $this->_getIpnRequest(); 00142 00143 if(!$ipnRequest->init($requestParams)) { 00144 Mage::throwException(Mage::helper('amazonpayments')->__('Request is not a valid IPN request')); 00145 } 00146 00147 return $ipnRequest; 00148 }
refund | ( | $ | transactionId, | |
$ | amount, | |||
$ | currencyCode, | |||
$ | referenceId | |||
) |
capture payment through FPS api
string | $transactionId | |
string | $amount | |
string | $currencyCode | |
string | $referenceId |
Definition at line 200 of file Asp.php.
00201 { 00202 $fps = $this->_getFps(); 00203 00204 $amount = $this->_getAmount() 00205 ->setValue($amount) 00206 ->setCurrencyCode($currencyCode); 00207 00208 $request = $fps->getRequest(Mage_AmazonPayments_Model_Api_Asp_Fps::ACTION_CODE_REFUND) 00209 ->setTransactionId($transactionId) 00210 ->setReferenceId($referenceId) 00211 ->setAmount($amount) 00212 ->setDescription($this->_getConfig('refund_description')); 00213 00214 $response = $fps->process($request); 00215 return $response; 00216 }
$_collectShippingAddress = 0 [protected] |
$_fpsModel = 'amazonpayments/api_asp_fps' [protected] |
$_ipnRequest = 'amazonpayments/api_asp_ipn_request' [protected] |