Public Member Functions | |
setPaymentCode ($paymentCode) | |
getPayServiceUrl () | |
getConfigData ($key, $default=false) | |
checkSignParams ($params) | |
signParams ($params) | |
Public Attributes | |
const | PAYMENT_TYPE_AUTH = 'Authorization' |
const | USER_ACTION_COMMIT = 'commit' |
Protected Member Functions | |
_getSignatureForArray ($array, $secretKey) | |
_getSignatureForString ($string, $secretKey) | |
Protected Attributes | |
$paymentCode | |
Static Protected Attributes | |
static | $HMAC_SHA1_ALGORITHM = 'sha1' |
Definition at line 34 of file Abstract.php.
_getSignatureForArray | ( | $ | array, | |
$ | secretKey | |||
) | [protected] |
Return signature for array
array | $array | |
string | $secretKey |
Definition at line 135 of file Abstract.php.
00136 { 00137 uksort($array, 'strcasecmp'); 00138 $tmpString = ''; 00139 foreach ($array as $paramName => $paramValue) { 00140 $tmpString = $tmpString . $paramName . $paramValue; 00141 } 00142 return $this->_getSignatureForString($tmpString, $secretKey); 00143 }
_getSignatureForString | ( | $ | string, | |
$ | secretKey | |||
) | [protected] |
Return signature for string
string | $string | |
string | $secretKey |
Definition at line 152 of file Abstract.php.
00153 { 00154 $rawHmac = hash_hmac(self::$HMAC_SHA1_ALGORITHM, $string, $secretKey, true); 00155 return base64_encode($rawHmac); 00156 }
checkSignParams | ( | $ | params | ) |
Check signed params
array | $params |
Definition at line 103 of file Abstract.php.
00104 { 00105 if (is_array($params) && isset($params[$this->getRequestSignatureParamName()])) { 00106 $paramSignature = $params[$this->getRequestSignatureParamName()]; 00107 unset($params[$this->getRequestSignatureParamName()]); 00108 $generateSignature = $this->_getSignatureForArray($params, $this->getSecretKey()); 00109 return $paramSignature == $generateSignature; 00110 } 00111 00112 return false; 00113 }
getConfigData | ( | $ | key, | |
$ | default = false | |||
) |
Get value from the payment module config
string | $kay | |
string | $default |
Definition at line 85 of file Abstract.php.
00086 { 00087 if (!$this->hasData($key)) { 00088 $value = Mage::getStoreConfig('payment/' . $paymentCode . '/' . $key); 00089 if (is_null($value) || false===$value) { 00090 $value = $default; 00091 } 00092 $this->setData($key, $value); 00093 } 00094 return $this->getData($key); 00095 }
getPayServiceUrl | ( | ) |
Return payment url
Definition at line 70 of file Abstract.php.
00071 { 00072 if ($this->getSandboxFlag()) { 00073 return $this->getData('sandbox_pay_service_url'); 00074 } 00075 return $this->getData('pay_service_url'); 00076 }
setPaymentCode | ( | $ | paymentCode | ) |
Set payment module code
Definition at line 57 of file Abstract.php.
00058 { 00059 if(is_null($this->paymentCode)) { 00060 $this->paymentCode = $paymentCode; 00061 $this->setData(Mage::getStoreConfig('payment/' . $paymentCode)); 00062 } 00063 }
signParams | ( | $ | params | ) |
Add signature param to params array
array | $params |
Definition at line 121 of file Abstract.php.
00122 { 00123 $signature = $this->_getSignatureForArray($params, $this->getSecretKey()); 00124 $params[$this->getRequestSignatureParamName()] = $signature; 00125 return $params; 00126 }
$HMAC_SHA1_ALGORITHM = 'sha1' [static, protected] |
$paymentCode [protected] |
Reimplemented in Mage_AmazonPayments_Model_Api_Asp_Abstract.
Definition at line 50 of file Abstract.php.
const PAYMENT_TYPE_AUTH = 'Authorization' |
Definition at line 39 of file Abstract.php.
const USER_ACTION_COMMIT = 'commit' |
Definition at line 40 of file Abstract.php.