diff --git a/.gitignore b/.gitignore index 8c74676..b593aa0 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,7 @@ php.ini.sample /app/Mage.php /app/.htaccess /app/code/core/* +/app/code/community/Phoenix/* /app/design/install /app/design/adminhtml/default/default/layout/admin.xml /app/design/adminhtml/default/default/layout/adminnotification.xml diff --git a/app/code/local/Litle/CreditCard/Model/PaymentLogic.php b/app/code/local/Litle/CreditCard/Model/PaymentLogic.php index 7d413b4..0cd487f 100644 --- a/app/code/local/Litle/CreditCard/Model/PaymentLogic.php +++ b/app/code/local/Litle/CreditCard/Model/PaymentLogic.php @@ -178,9 +178,8 @@ public function getTokenInfo($payment) return $retArray; } - public function creditCardOrPaypageOrToken($payment) + public function creditCardOrPaypageOrToken($payment, $info) { - $info = $this->getInfoInstance(); $vaultIndex = $info->getAdditionalInformation('cc_vaulted'); $payment_hash = array(); if ($vaultIndex > 0) { @@ -686,7 +685,7 @@ public function authorize(Varien_Object $payment, $amount) $info->setAdditionalInformation('orderSource', 'ecommerce'); } - $hash_in = generateAuthorizationHash(); + $hash_in = $this->generateAuthorizationHash($orderId, $amountToPass, $info, $payment); $litleRequest = new LitleOnlineRequest(); $litleResponse = $litleRequest->authorizationRequest($hash_in); @@ -705,6 +704,7 @@ public function authorize(Varien_Object $payment, $amount) function generateAuthorizationHash($orderId, $amountToPass, $info, $payment) { $hash = array( 'orderId' => $orderId, + 'id' => $orderId, 'amount' => $amountToPass, 'orderSource' => $info->getAdditionalInformation('orderSource'), 'billToAddress' => $this->getBillToAddress($payment), @@ -715,8 +715,8 @@ function generateAuthorizationHash($orderId, $amountToPass, $info, $payment) { Mage::app()->getStore() ->getBaseUrl()) ); - - $payment_hash = $this->creditCardOrPaypageOrToken($payment); + + $payment_hash = $this->creditCardOrPaypageOrToken($payment, $info); $hash_temp = array_merge($hash, $payment_hash); $merchantData = $this->merchantData($payment); $hash_in = array_merge($hash_temp, $merchantData); @@ -770,7 +770,7 @@ public function capture(Varien_Object $payment, $amount) 'shipToAddress' => $this->getAddressInfo($payment), 'enhancedData' => $this->getEnhancedData($payment) ); - $payment_hash = $this->creditCardOrPaypageOrToken($payment); + $payment_hash = $this->creditCardOrPaypageOrToken($payment, $info); $hash = array_merge($hash_temp, $payment_hash); } $merchantData = $this->merchantData($payment); diff --git a/test/unit/PaymentLogicTest.php b/test/unit/PaymentLogicTest.php new file mode 100644 index 0000000..5752412 --- /dev/null +++ b/test/unit/PaymentLogicTest.php @@ -0,0 +1,48 @@ +setBillingAddress($billingAddress); + $payment->setOrder($order); + $litle = new Litle_CreditCard_Model_PaymentLogic(); + $mock = $this->getMock('Mage_Payment_Model_Info'); + $hash = $litle->generateAuthorizationHash('123','100', $mock, $payment); + $this->assertEquals('123', $hash['id']); + } +}