Skip to content

Commit

Permalink
Merge branch 'release/1.13.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
hipaybot committed Mar 4, 2021
2 parents bd9a675 + fa208f0 commit dd04938
Show file tree
Hide file tree
Showing 49 changed files with 2,430 additions and 1,273 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,14 @@
# Changelog

## 1.13.0

- **Add** iDeal Hosted Fields payment method
- **Add** Hosted Page v2 option on HostedPage parameters
- **Add** missing fields for Hosted payment methods
- **Fix**: placeOrder button blocking due to other active payment methods [#132](https://github.com/hipay/hipay-fullservice-sdk-magento2/issues/132)
- **Fix**: deprecated method from a Magento dependency
- **Fix**: payment product problem with _hipay_hostedsplit_ payment method

## 1.12.2

- **Fix**: Corrected too high logging levels on some errors
Expand Down
5 changes: 2 additions & 3 deletions Controller/Notify/Index.php
Expand Up @@ -78,12 +78,11 @@ public function execute()
['params' => ['response' => $params]]
);
$notify->processTransaction();
} catch(WebApiException $e){
$this->_logger->warn($e);
} catch (WebApiException $e) {
$this->_logger->warning($e);

$this->getResponse()->setStatusHeader($e->getHttpCode());
$this->getResponse()->setBody($e->getMessage())->sendResponse();

} catch (\Exception $e) {
$this->_logger->critical($e);

Expand Down
53 changes: 51 additions & 2 deletions Model/Config.php
Expand Up @@ -19,6 +19,7 @@
use HiPay\FullserviceMagento\Model\Config\AbstractConfig;
use HiPay\FullserviceMagento\Model\Method\ApplePay;
use HiPay\FullserviceMagento\Model\System\Config\Source\Environments;
use HiPay\FullserviceMagento\Model\System\Config\Source\HostedpageVersion;
use HiPay\FullserviceMagento\Model\System\Config\Source\PaymentActions;
use HiPay\FullserviceMagento\Model\System\Config\Source\PaymentProduct;
use HiPay\FullserviceMagento\Model\System\Config\Source\Templates;
Expand Down Expand Up @@ -146,6 +147,8 @@ public function __construct(
$apiUsername = $this->getApiUsername();
$apiPassword = $this->getApiPassword();

$hostedpagev2 = $this->getHostedpageVersion() === HostedpageVersion::V2 ? true : false;

try {
$env = $this->getApiEnv();
if ($env == null) {
Expand All @@ -158,7 +161,8 @@ public function __construct(
'apiEnv' => $env,
'apiHTTPHeaderAccept' => 'application/json',
'proxy' => $this->getProxy(),
'timeout' => 30
'timeout' => 30,
'hostedPageV2' => $hostedpagev2
]
);
} catch (\Exception $e) {
Expand Down Expand Up @@ -621,7 +625,7 @@ public function getEanAttribute()
*/
public function isDeliveryMethodRequired($product_code)
{
return in_array($product_code, ['3xcb', '3xcb-no-fees', '4xcb-no-fees', '4xcb']);
return in_array($product_code, ['3xcb', '3xcb-no-fees', '4xcb-no-fees', '4xcb', 'credit-long']);
}

/**
Expand Down Expand Up @@ -653,16 +657,31 @@ public function getApiEndpoint()
return $this->_configSDK !== null ? $this->_configSDK->getApiEndpoint() : '';
}

public function getApiEndpointV2()
{
return $this->_configSDK !== null ? $this->_configSDK->getApiEndpointV2() : '';
}

public function getApiEndpointProd()
{
return $this->_configSDK !== null ? $this->_configSDK->getApiEndpointProd() : '';
}

public function getApiEndpointV2Prod()
{
return $this->_configSDK !== null ? $this->_configSDK->getApiEndpointV2Prod() : '';
}

public function getApiEndpointStage()
{
return $this->_configSDK !== null ? $this->_configSDK->getApiEndpointStage() : '';
}

public function getApiEndpointV2Stage()
{
return $this->_configSDK !== null ? $this->_configSDK->getApiEndpointV2Stage() : '';
}

public function getSecureVaultEndpointProd()
{
return $this->_configSDK !== null ? $this->_configSDK->getSecureVaultEndpointProd() : '';
Expand Down Expand Up @@ -876,4 +895,34 @@ public function setOverridePaymentProductSorting($overridePaymentProductSorting)
$this->_configSDK->setOverridePaymentProductSorting($overridePaymentProductSorting);
}
}

/**
* Returns hostedpage v2 parameter
*
* @return bool
*/
public function isHostedPageV2()
{
if ($this->_configSDK !== null) {
return $this->_configSDK->isHostedPageV2();
}
}

/**
* Sets hostedpage v2 parameter
*
* @param bool $hostedPageV2
*/
public function setHostedPageV2($hostedPageV2)
{
if ($this->_configSDK !== null) {
$this->_configSDK->setHostedPageV2($hostedPageV2);
}
}

public function getHostedpageVersion()
{
$key = 'hostedpage_version';
return $this->getGeneraleValue($key, 'hipay_hostedpage');
}
}
1 change: 1 addition & 0 deletions Model/Config/AbstractConfig.php
Expand Up @@ -247,6 +247,7 @@ protected function _prepareValue($key, $value)
protected function _mapGeneralFieldset($fieldName, $group = 'hipay_credentials')
{
switch ($fieldName) {
case 'hostedpage_version':
case 'api_username':
case 'api_password':
case 'secret_passphrase':
Expand Down
82 changes: 1 addition & 81 deletions Model/Method/ApplePay.php
Expand Up @@ -25,7 +25,7 @@
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache 2.0 Licence
* @link https://github.com/hipay/hipay-fullservice-sdk-magento2
*/
class ApplePay extends FullserviceMethod
class ApplePay extends LocalHostedFields
{

const HIPAY_METHOD_CODE = 'hipay_applepay';
Expand All @@ -35,20 +35,6 @@ class ApplePay extends FullserviceMethod
*/
protected $_code = self::HIPAY_METHOD_CODE;

/**
* Payment Method feature
*
* @var bool
*/
protected $_canUseInternal = false;

/**
* Payment Method feature
*
* @var bool
*/
protected $_isInitializeNeeded = true;

/**
* Is active
*
Expand All @@ -59,70 +45,4 @@ public function isActive($storeId = null)
{
return (bool) (int) $this->getConfigData('active', $storeId) && $this->_hipayConfig->hasCredentials(false, true);
}

/**
* Instantiate state and set it to state object
*
* @param string $paymentAction
* @param \Magento\Framework\DataObject $stateObject
* @return void
*/
public function initialize($paymentAction, $stateObject)
{

$payment = $this->getInfoInstance();
$order = $payment->getOrder();
$order->setCanSendNewEmailFlag(false);
$payment->setAmountAuthorized($order->getTotalDue());
$payment->setBaseAmountAuthorized($order->getBaseTotalDue());

$this->processAction($paymentAction, $payment);

$stateObject->setIsNotified(false);
}

/**
* Perform actions based on passed action name
*
* @param string $action
* @param Magento\Payment\Model\InfoInterface $payment
* @return void
*/
protected function processAction($action, $payment)
{
$totalDue = $payment->getOrder()->getTotalDue();
$baseTotalDue = $payment->getOrder()->getBaseTotalDue();

switch ($action) {
case \HiPay\FullserviceMagento\Model\System\Config\Source\PaymentActions::PAYMENT_ACTION_AUTH:
$this->authorize($payment, $baseTotalDue);
// base amount will be set inside
$payment->setAmountAuthorized($totalDue);
break;
case \HiPay\FullserviceMagento\Model\System\Config\Source\PaymentActions::PAYMENT_ACTION_SALE:
$payment->setAmountAuthorized($totalDue);
$payment->setBaseAmountAuthorized($baseTotalDue);
$this->capture($payment, $payment->getOrder()->getBaseGrandTotal());
break;
default:
break;
}
}

/**
* Authorize payment abstract method
*
* @param \Magento\Payment\Model\InfoInterface $payment
* @param float $amount
* @return $this
* @throws LocalizedException
* @api
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function authorize(\Magento\Payment\Model\InfoInterface $payment, $amount)
{
parent::authorize($payment, $amount);
$this->place($payment);
return $this;
}
}
50 changes: 50 additions & 0 deletions Model/Method/Facilypay/CreditLong.php
@@ -0,0 +1,50 @@
<?php
/**
* HiPay Fullservice Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Apache 2.0 Licence
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* http://www.apache.org/licenses/LICENSE-2.0
*
* @copyright Copyright (c) 2016 - HiPay
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache 2.0 Licence
*
*/
namespace HiPay\FullserviceMagento\Model\Method\Facilypay;

use HiPay\FullserviceMagento\Model\Method\Facilypay\AbstractFacilypay;

/**
* Credit Long payment method
*
* @package HiPay\FullserviceMagento
* @author Kassim Belghait <kassim@sirateck.com>
* @copyright Copyright (c) 2016 - HiPay
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache 2.0 Licence
* @link https://github.com/hipay/hipay-fullservice-sdk-magento2
*/
class CreditLong extends AbstractFacilypay
{

const HIPAY_METHOD_CODE = 'hipay_creditlong';

/**
* @var string
*/
protected static $_technicalCode = 'credit-long';

/**
* @var string
*/
protected $_code = self::HIPAY_METHOD_CODE;

/**
* Payment Method feature
*
* @var bool
*/
protected $_canUseInternal = false;
}
4 changes: 1 addition & 3 deletions Model/Method/IDeal.php
Expand Up @@ -16,10 +16,8 @@

namespace HiPay\FullserviceMagento\Model\Method;



/**
* Giropay Model payment method
* iDEAL Model payment method
*
* @package HiPay\FullserviceMagento
* @author Kassim Belghait <kassim@sirateck.com>
Expand Down
47 changes: 47 additions & 0 deletions Model/Method/IDealHostedFields.php
@@ -0,0 +1,47 @@
<?php
/**
* HiPay Fullservice Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Apache 2.0 Licence
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* http://www.apache.org/licenses/LICENSE-2.0
*
* @copyright Copyright (c) 2016 - HiPay
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache 2.0 Licence
*
*/

namespace HiPay\FullserviceMagento\Model\Method;

/**
* iDEAL Hosted Fields Model payment method
*
* @package HiPay\FullserviceMagento
* @author Kassim Belghait <kassim@sirateck.com>
* @copyright Copyright (c) 2016 - HiPay
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache 2.0 Licence
* @link https://github.com/hipay/hipay-fullservice-sdk-magento2
*/
class IDealHostedFields extends LocalHostedFields
{

const HIPAY_METHOD_CODE = 'hipay_ideal_hosted_fields';

/**
* @var string
*/
protected static $_technicalCode = 'ideal';

/**
* @var string
*/
protected $_code = self::HIPAY_METHOD_CODE;

/**
* @var string[] keys to import in payment additionnal informations
*/
protected $_additionalInformationKeys = ['issuer_bank_id', 'browser_info', 'cc_type'];
}

0 comments on commit dd04938

Please sign in to comment.