Skip to content
This repository has been archived by the owner on Jun 30, 2023. It is now read-only.

Commit

Permalink
Merge branch 'hotfix/1.13.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
etiennelandais committed Oct 25, 2019
2 parents 7c338e7 + 03798c5 commit 6f52710
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 45 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
3 changes: 0 additions & 3 deletions magento.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 13 additions & 9 deletions src/app/code/community/Allopass/Hipay/Model/Api/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
}
Expand All @@ -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()
Expand All @@ -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())
);
}

Expand All @@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"];
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use HiPay\Fullservice\Enum\ThreeDSTwo\DeviceChannel;
use HiPay\Fullservice\Enum\Transaction\ECI;

require_once(dirname(__FILE__) . '/../../../../Helper/Enum/CardPaymentProduct.php');

/**
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
Loading

0 comments on commit 6f52710

Please sign in to comment.