diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d3fdacd..5c5ec403 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# Version 1.13.3 + - Fix: Wrong credentials used on refund and capture (multi-store) + - Fix: issue [149](https://github.com/hipay/hipay-fullservice-sdk-magento1/issues/149) + - Fix: authentication indicator on hosted payment + # Version 1.13.2 - Fix: Save oneclick cards on 116 and 118 notification diff --git a/magento.sh b/magento.sh index e550f5dd..69a09b0e 100755 --- a/magento.sh +++ b/magento.sh @@ -99,9 +99,6 @@ elif [ "$1" = 'init' ]; then docker-compose -f docker-compose.dev.yml rm -fv sudo rm -Rf data/ log/ web/ - docker rm $(docker ps -a -q) - docker rmi $(docker images -q) - docker-compose -f docker-compose.dev.yml build --no-cache docker-compose -f docker-compose.dev.yml up else diff --git a/src/app/code/community/Allopass/Hipay/Model/Api/Api.php b/src/app/code/community/Allopass/Hipay/Model/Api/Api.php index e30c0322..2a4f3018 100755 --- a/src/app/code/community/Allopass/Hipay/Model/Api/Api.php +++ b/src/app/code/community/Allopass/Hipay/Model/Api/Api.php @@ -124,8 +124,8 @@ protected function createGatewayClient() { $proxy = $this->getProxyConfig(); - $sandbox = $this->isTestMode(); - $credentials = $this->getApiCredentials(); + $sandbox = $this->isTestMode($this->getStoreId()); + $credentials = $this->getApiCredentials($this->getStoreId()); $env = ($sandbox) ? Configuration::API_ENV_STAGE : Configuration::API_ENV_PRODUCTION; @@ -146,7 +146,7 @@ protected function createGatewayClient() protected function getApiCredentials($storeId = null) { if ($this->isMoto()) { - if ($this->isTestMode()) { + if ($this->isTestMode($storeId)) { if ($this->getConfig()->isApiCredentialsMotoEmpty(true, $storeId)) { return $this->getConfig()->getApiCredentialsTestMoto($storeId); } @@ -164,9 +164,9 @@ protected function getApiCredentials($storeId = null) } } - protected function isTestMode() + protected function isTestMode($storeId) { - return (bool)$this->_methodInstance->getConfigData('is_test_mode'); + return (bool)$this->_methodInstance->getConfigData('is_test_mode', $storeId); } protected function getConfig() @@ -182,14 +182,14 @@ protected function isMoto() protected function getProxyConfig() { $proxy = array(); - $proxyHost = Mage::getStoreConfig('hipay/hipay_api/proxy_host', Mage::app()->getStore()); + $proxyHost = Mage::getStoreConfig('hipay/hipay_api/proxy_host', $this->getStoreId()); // if host not empty, we use the proxy parameters if (!empty($proxyHost)) { $proxy = array( "host" => $proxyHost, - "port" => Mage::getStoreConfig('hipay/hipay_api/proxy_port', Mage::app()->getStore()), - "user" => Mage::getStoreConfig('hipay/hipay_api/proxy_user', Mage::app()->getStore()), - "password" => Mage::getStoreConfig('hipay/hipay_api/proxy_pass', Mage::app()->getStore()) + "port" => Mage::getStoreConfig('hipay/hipay_api/proxy_port', $this->getStoreId()), + "user" => Mage::getStoreConfig('hipay/hipay_api/proxy_user', $this->getStoreId()), + "password" => Mage::getStoreConfig('hipay/hipay_api/proxy_pass', $this->getStoreId()) ); } @@ -201,4 +201,8 @@ protected function logRequest($orderRequest) $serializer = new RequestSerializer($orderRequest); $this->_methodInstance->debugData($serializer->toArray()); } + + private function getStoreId(){ + return $this->_payment->getOrder()->getStoreId(); + } } diff --git a/src/app/code/community/Allopass/Hipay/Model/Api/Formatter/ApiFormatterAbstract.php b/src/app/code/community/Allopass/Hipay/Model/Api/Formatter/ApiFormatterAbstract.php index b011d5d4..9c98e082 100755 --- a/src/app/code/community/Allopass/Hipay/Model/Api/Formatter/ApiFormatterAbstract.php +++ b/src/app/code/community/Allopass/Hipay/Model/Api/Formatter/ApiFormatterAbstract.php @@ -22,8 +22,13 @@ abstract class Allopass_Hipay_Model_Api_Formatter_ApiFormatterAbstract implement protected $_cartFormatterClass = ''; + /** + * @var Mage_Payment_Model_Method_Abstract + */ protected $_paymentMethod; + protected $_payment; + protected $_amount; public function __construct($args) diff --git a/src/app/code/community/Allopass/Hipay/Model/Api/Formatter/Request/HostedPayment.php b/src/app/code/community/Allopass/Hipay/Model/Api/Formatter/Request/HostedPayment.php index c9a96e17..20701081 100755 --- a/src/app/code/community/Allopass/Hipay/Model/Api/Formatter/Request/HostedPayment.php +++ b/src/app/code/community/Allopass/Hipay/Model/Api/Formatter/Request/HostedPayment.php @@ -62,5 +62,9 @@ public function mapRequest(&$order) if ($this->_payment->getAdditionalInformation('create_oneclick')) { $order->multi_use = 1; } + + if (isset($this->_additionalParameters["authentication_indicator"])) { + $order->authentication_indicator = $this->_additionalParameters["authentication_indicator"]; + } } } diff --git a/src/app/code/community/Allopass/Hipay/Model/Api/Formatter/Request/OrderRequestAbstract.php b/src/app/code/community/Allopass/Hipay/Model/Api/Formatter/Request/OrderRequestAbstract.php index 6926eed8..14674d09 100755 --- a/src/app/code/community/Allopass/Hipay/Model/Api/Formatter/Request/OrderRequestAbstract.php +++ b/src/app/code/community/Allopass/Hipay/Model/Api/Formatter/Request/OrderRequestAbstract.php @@ -13,6 +13,7 @@ use HiPay\Fullservice\Enum\ThreeDSTwo\DeviceChannel; use HiPay\Fullservice\Enum\Transaction\ECI; + require_once(dirname(__FILE__) . '/../../../../Helper/Enum/CardPaymentProduct.php'); /** @@ -65,20 +66,21 @@ public function mapRequest(&$orderRequest) // If split payment exists, it means we are at least on the second payment of the split $_helper = Mage::helper('hipay'); - if($_helper->splitPaymentsExists($this->_payment->getOrder()->getId())) { + if ($_helper->splitPaymentsExists($this->_payment->getOrder()->getId())) { $orderRequest->device_channel = DeviceChannel::THREE_DS_REQUESTOR_INITIATED; } else { $orderRequest->device_channel = DeviceChannel::BROWSER; } } - Mage::dispatchEvent('hipay_order_before_request', array("OrderRequest" => &$orderRequest, "Cart" => $this->_payment->getOrder()->getAllItems())); + Mage::dispatchEvent( + 'hipay_order_before_request', + array("OrderRequest" => &$orderRequest, "Cart" => $this->_payment->getOrder()->getAllItems()) + ); $orderRequest->orderid = $this->_payment->getOrder()->getIncrementId(); - if ($this->_paymentMethod->getConfigData('payment_action') !== - Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE - ) { + if ($this->_paymentMethod->getConfigPaymentAction() !== Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE) { $orderRequest->operation = "Sale"; } else { $orderRequest->operation = "Authorization"; @@ -252,8 +254,8 @@ protected function getSplitPayment($taxAmount) } $spCollection = Mage::getModel('hipay/splitPayment') - ->getCollection() - ->addFieldToFilter('order_id', $this->_payment->getOrder()->getId()); + ->getCollection() + ->addFieldToFilter('order_id', $this->_payment->getOrder()->getId()); if (!$spCollection->count()) { return Mage::Helper('hipay')->splitPayment((int)$profile, $this->_amount, $taxAmount); diff --git a/src/app/code/community/Allopass/Hipay/Model/Method/HostedAbstract.php b/src/app/code/community/Allopass/Hipay/Model/Method/HostedAbstract.php index 04d292ae..9f668ee8 100755 --- a/src/app/code/community/Allopass/Hipay/Model/Method/HostedAbstract.php +++ b/src/app/code/community/Allopass/Hipay/Model/Method/HostedAbstract.php @@ -30,7 +30,7 @@ abstract class Allopass_Hipay_Model_Method_HostedAbstract extends Allopass_Hipay /** * Assign data to info model instance * - * @param mixed $data + * @param mixed $data * @return Mage_Payment_Model_Info */ public function assignData($data) @@ -64,6 +64,17 @@ public function place($payment, $amount) return $response->getForwardUrl(); } + protected function getAdditionalParameters($payment) + { + $authenticationIndicator = Mage::helper('hipay')->is3dSecure( + $this->getConfigData('use_3d_secure'), + $this->getConfigData('config_3ds_rules'), + $payment + ); + + return array("authentication_indicator" => $authenticationIndicator); + } + public function getPaymentProductList($payment) { return $this->getConfigData('cctypes'); diff --git a/src/app/code/community/Allopass/Hipay/Model/Method/HostedMoto.php b/src/app/code/community/Allopass/Hipay/Model/Method/HostedMoto.php index 769b7396..fa103572 100755 --- a/src/app/code/community/Allopass/Hipay/Model/Method/HostedMoto.php +++ b/src/app/code/community/Allopass/Hipay/Model/Method/HostedMoto.php @@ -35,6 +35,6 @@ public function place($payment, $amount) protected function getAdditionalParameters($payment) { - return array("isMoto" => true); + return array_merge(array("isMoto" => true), parent::getAdditionalParameters($payment)); } } diff --git a/src/app/code/community/Allopass/Hipay/etc/config.xml b/src/app/code/community/Allopass/Hipay/etc/config.xml index ba339012..816441e4 100755 --- a/src/app/code/community/Allopass/Hipay/etc/config.xml +++ b/src/app/code/community/Allopass/Hipay/etc/config.xml @@ -1,7 +1,7 @@ - 1.13.2 + 1.13.3 @@ -529,7 +529,7 @@ 118 hipay/checkout/pending 1 - + 0 1 0 @@ -562,7 +562,7 @@ canceled 118 1 - + 0 1 0 @@ -596,7 +596,7 @@ 118 hipay/checkout/pending 1 - + 0 1 0 @@ -657,7 +657,7 @@ 118 hipay/checkout/pending 0 - + 0 1 0 @@ -686,7 +686,7 @@ 118 hipay/checkout/pending 0 - + 0 1 0 @@ -715,7 +715,7 @@ 118 hipay/checkout/pending 0 - + 0 1 0 @@ -744,7 +744,7 @@ 118 hipay/checkout/pending 0 - + 0 1 0 @@ -773,7 +773,7 @@ 118 hipay/checkout/pending 0 - + 0 1 0 @@ -859,7 +859,7 @@ 118 hipay/checkout/pending 0 - + 0 1 0 @@ -888,7 +888,7 @@ 118 hipay/checkout/pending 0 - + 0 1 0 @@ -917,7 +917,7 @@ 118 hipay/checkout/pending 0 - + 0 1 0 @@ -1053,7 +1053,7 @@ 118 hipay/checkout/pending 1 - + 0 1 0 @@ -1084,7 +1084,7 @@ 118 hipay/checkout/pending 1 - + 0 1 0 @@ -1119,7 +1119,7 @@ 118 hipay/checkout/pending 1 - + 0 1 0 @@ -1154,7 +1154,7 @@ 118 hipay/checkout/pending 1 - + 0 1 0 @@ -1189,7 +1189,7 @@ 118 hipay/checkout/pending 1 - + 0 1 0 @@ -1224,7 +1224,7 @@ 118 hipay/checkout/pending 1 - + 0 1 0 @@ -1259,7 +1259,7 @@ 118 hipay/checkout/pending 1 - + 0 1 0 @@ -1294,7 +1294,7 @@ 118 hipay/checkout/pending 1 - + 0 1 0 @@ -1329,7 +1329,7 @@ 118 hipay/checkout/pending 1 - + 0 1 0 @@ -1364,7 +1364,7 @@ 118 hipay/checkout/pending 1 - + 0 1 0 @@ -1399,7 +1399,7 @@ 118 hipay/checkout/pending 1 - + 0 1 0 @@ -1434,7 +1434,7 @@ 118 hipay/checkout/pending 1 - + 0 1 0