We will be off from 27/1 (Monday) to 31/1 (Friday) (GMT +7) for our Tet Holiday (Lunar New Year) in our country

Commit 31da74f6 authored by cyattilakiss's avatar cyattilakiss Committed by GitHub

Merge pull request #459 from Adyen/develop

Release 4.2.1
parents 6f6a2efe 14062302
......@@ -214,14 +214,19 @@ class Result extends \Magento\Framework\App\Action\Action
{
$result = false;
$this->_adyenLogger->addAdyenResult('Updating the order');
if (!empty($response['authResult'])) {
$authResult = $response['authResult'];
} elseif (!empty($response['resultCode'])) {
$authResult = $response['resultCode'];
} else {
// In case the result is unknown we log the request and don't update the history
$this->_adyenLogger->addError("Unexpected result query parameter. Response: " . json_encode($response));
return $result;
}
$this->_adyenLogger->addAdyenResult('Updating the order');
$paymentMethod = isset($response['paymentMethod']) ? trim($response['paymentMethod']) : '';
$pspReference = isset($response['pspReference']) ? trim($response['pspReference']) : '';
......
......@@ -38,19 +38,27 @@ class VaultDetailsHandler implements HandlerInterface
/**
* @var \Adyen\Payment\Logger\AdyenLogger
*/
private $_adyenLogger;
private $adyenLogger;
/**
* @var \Adyen\Payment\Helper\Data
*/
private $adyenHelper;
/**
* VaultDetailsHandler constructor.
*
* @param PaymentTokenFactoryInterface $paymentTokenFactory
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
* @param \Adyen\Payment\Helper\Data $adyenHelper
*/
public function __construct(
PaymentTokenFactoryInterface $paymentTokenFactory,
\Adyen\Payment\Logger\AdyenLogger $adyenLogger
\Adyen\Payment\Logger\AdyenLogger $adyenLogger,
\Adyen\Payment\Helper\Data $adyenHelper
) {
$this->_adyenLogger = $adyenLogger;
$this->adyenLogger = $adyenLogger;
$this->adyenHelper = $adyenHelper;
$this->paymentTokenFactory = $paymentTokenFactory;
}
......@@ -61,9 +69,10 @@ class VaultDetailsHandler implements HandlerInterface
{
$payment = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($handlingSubject);
/** @var OrderPaymentInterface $payment */
/** @var \Adyen\Payment\Api\Data\OrderPaymentInterface $payment */
$payment = $payment->getPayment();
if ($this->adyenHelper->isCreditCardVaultEnabled($payment->getOrder()->getStoreId())) {
// add vault payment token entity to extension attributes
$paymentToken = $this->getVaultPaymentToken($response);
......@@ -72,6 +81,7 @@ class VaultDetailsHandler implements HandlerInterface
$extensionAttributes->setVaultPaymentToken($paymentToken);
}
}
}
/**
* Get vault payment token entity
......@@ -88,7 +98,7 @@ class VaultDetailsHandler implements HandlerInterface
if (empty($additionalData['recurring.recurringDetailReference'])) {
$this->_adyenLogger->error(
$this->adyenLogger->error(
'Missing Token in Result please enable in ' .
'Settings -> API URLs and Response menu in the Adyen Customer Area Recurring details setting'
);
......@@ -98,7 +108,7 @@ class VaultDetailsHandler implements HandlerInterface
if (empty($additionalData['cardSummary'])) {
$this->_adyenLogger->error(
$this->adyenLogger->error(
'Missing cardSummary in Result please login to the adyen portal ' .
'and go to Settings -> API URLs and Response and enable the Card summary property'
);
......@@ -107,7 +117,7 @@ class VaultDetailsHandler implements HandlerInterface
$cardSummary = $additionalData['cardSummary'];
if (empty($additionalData['expiryDate'])) {
$this->_adyenLogger->error(
$this->adyenLogger->error(
'Missing expiryDate in Result please login to the adyen portal and go to ' .
'Settings -> API URLs and Response and enable the Expiry date property'
);
......@@ -116,7 +126,7 @@ class VaultDetailsHandler implements HandlerInterface
$expirationDate = $additionalData['expiryDate'];
if (empty($additionalData['paymentMethod'])) {
$this->_adyenLogger->error(
$this->adyenLogger->error(
'Missing paymentMethod in Result please login to the adyen portal and go to ' .
'Settings -> API URLs and Response and enable the Variant property'
);
......@@ -141,7 +151,7 @@ class VaultDetailsHandler implements HandlerInterface
$paymentToken->setTokenDetails(json_encode($details));
} catch (\Exception $e) {
$this->_adyenLogger->error(print_r($e, true));
$this->adyenLogger->error(print_r($e, true));
}
}
......
......@@ -1595,7 +1595,6 @@ class Data extends AbstractHelper
// check if BA exists
if (!($billingAgreement && $billingAgreement->getAgreementId() > 0 && $billingAgreement->isValid())) {
// create new BA
$this->adyenLogger->addAdyenDebug("Creating new Billing Agreement");
$billingAgreement = $this->billingAgreementFactory->create();
$billingAgreement->setStoreId($order->getStoreId());
$billingAgreement->importOrderPayment($order->getPayment());
......@@ -1615,7 +1614,9 @@ class Data extends AbstractHelper
$storeOneClick = $order->getPayment()->getAdditionalInformation('store_cc');
$billingAgreement->setCcBillingAgreement($additionalData, $storeOneClick, $order->getStoreId());
if ($billingAgreement->isValid()) {
$billingAgreementErrors = $billingAgreement->getErrors();
if ($billingAgreement->isValid() && empty($billingAgreementErrors)) {
if (!$this->agreementResourceModel->getOrderRelation($billingAgreement->getAgreementId(),
$order->getId())) {
......@@ -1627,7 +1628,7 @@ class Data extends AbstractHelper
$order->addRelatedObject($billingAgreement);
} else {
$message = __('Failed to create billing agreement for this order. Reason(s): ') . join(', ',
$billingAgreement->getErrors());
$billingAgreementErrors);
throw new \Exception($message);
}
......@@ -1799,7 +1800,7 @@ class Data extends AbstractHelper
$localeCode = $this->config->getValue(
\Magento\Directory\Helper\Data::XML_PATH_DEFAULT_LOCALE,
\Magento\Store\Model\ScopeInterface::SCOPE_STORES,
$store->getCode()
$this->storeManager->getStore($storeId)->getCode()
);
return $localeCode;
......
......@@ -179,12 +179,17 @@ class Agreement extends \Magento\Paypal\Model\Billing\Agreement
->setMethodCode('adyen_oneclick')
->setReferenceId($contractDetail['recurring.recurringDetailReference']);
if (!isset($contractDetail['cardBin']) ||
!isset($contractDetail['cardHolderName']) ||
!isset($contractDetail['cardSummary']) ||
!isset($contractDetail['expiryDate']) ||
!isset($contractDetail['paymentMethod'])
) {
$this->_errors[] = __('"In the Additional data in API response section, select: Card summary, Expiry Date, Cardholder name, Recurring details and Variant to create billing agreements immediately after the payment is authorized."');
return $this;
}
// Billing agreement is CC
if (isset($contractDetail['cardBin']) &&
isset($contractDetail['cardHolderName']) &&
isset($contractDetail['cardSummary']) &&
isset($contractDetail['expiryDate']) &&
isset($contractDetail['paymentMethod'])) {
$ccType = $contractDetail['paymentMethod'];
$ccTypes = $this->adyenHelper->getCcTypesAltData();
......@@ -208,7 +213,7 @@ class Agreement extends \Magento\Paypal\Model\Billing\Agreement
}
$this->setAgreementLabel($label);
}
$expiryDate = explode('/', $contractDetail['expiryDate']);
if (!empty($contractDetail['pos_payment'])) {
......
......@@ -12,7 +12,7 @@ Inside Adyen toggle the following settings on inside the API and Responses secti
* Variant
## Requirements
This plugin supports Magento2 version 2.2 and higher.
This plugin supports Magento2 version 2.2.8 and higher.
## Collaboration
We commit all our new features directly into our GitHub repository.
......
......@@ -2,7 +2,7 @@
"name": "adyen/module-payment",
"description": "Official Magento2 Plugin to connect to Payment Service Provider Adyen.",
"type": "magento2-module",
"version": "4.2.0",
"version": "4.2.1",
"license": [
"OSL-3.0",
"AFL-3.0"
......@@ -15,7 +15,7 @@
],
"require": {
"adyen/php-api-library": ">=2.0.0",
"magento/framework": ">=101.0.0",
"magento/framework": ">=101.0.8 <102 || >=102.0.1",
"magento/module-vault": "101.*"
},
"autoload": {
......
......@@ -24,7 +24,7 @@
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Adyen_Payment" setup_version="4.2.0">
<module name="Adyen_Payment" setup_version="4.2.1">
<sequence>
<module name="Magento_Sales"/>
<module name="Magento_Quote"/>
......
......@@ -91,6 +91,13 @@ $_isDemoMode = $block->isDemoMode();
</tr>
<?php endif; ?>
<?php if (!empty($banktranferData['bankTransfer.iban'])) : ?>
<tr>
<th><?php echo $block->escapeHtml(__('IBAN')); ?></th>
<td><?php echo $banktranferData['bankTransfer.iban'] ?></td>
</tr>
<?php endif; ?>
<?php if (!empty($banktranferData['bankTransfer.accountCode'])) : ?>
<tr>
<th><?php echo $block->escapeHtml(__('Bankaccount')); ?></th>
......
......@@ -71,6 +71,13 @@
</tr>
<?php endif; ?>
<?php if (!empty($banktranferData['bankTransfer.iban'])) : ?>
<tr>
<th><?php echo $block->escapeHtml(__('IBAN')); ?></th>
<td><?php echo $banktranferData['bankTransfer.iban'] ?></td>
</tr>
<?php endif; ?>
<?php if (!empty($banktranferData['bankTransfer.accountCode'])) : ?>
<tr>
<th><?php echo $block->escapeHtml(__('Bankaccount')); ?></th>
......
......@@ -58,6 +58,11 @@ $_info = $this->getInfo();
<dd><?php echo $banktranferData['bankTransfer.bankName'] ?></dd>
<?php endif; ?>
<?php if (!empty($banktranferData['bankTransfer.iban'])) : ?>
<dt><?php echo $block->escapeHtml(__('IBAN')); ?></dt>
<dd><?php echo $banktranferData['bankTransfer.iban'] ?></dd>
<?php endif; ?>
<?php if (!empty($banktranferData['bankTransfer.accountCode'])) : ?>
<dt><?php echo $block->escapeHtml(__('Bankaccount')); ?></dt>
<dd><?php echo $banktranferData['bankTransfer.accountCode'] ?></dd>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment