We will work on Apr 26th (Saturday) and will be off from Apr 30th (Wednesday) until May 2nd (Friday) for public holiday 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,13 +214,18 @@ class Result extends \Magento\Framework\App\Action\Action ...@@ -214,13 +214,18 @@ class Result extends \Magento\Framework\App\Action\Action
{ {
$result = false; $result = false;
$this->_adyenLogger->addAdyenResult('Updating the order');
if (!empty($response['authResult'])) { if (!empty($response['authResult'])) {
$authResult = $response['authResult']; $authResult = $response['authResult'];
} elseif (!empty($response['resultCode'])) { } elseif (!empty($response['resultCode'])) {
$authResult = $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']) : ''; $paymentMethod = isset($response['paymentMethod']) ? trim($response['paymentMethod']) : '';
$pspReference = isset($response['pspReference']) ? trim($response['pspReference']) : ''; $pspReference = isset($response['pspReference']) ? trim($response['pspReference']) : '';
......
...@@ -38,19 +38,27 @@ class VaultDetailsHandler implements HandlerInterface ...@@ -38,19 +38,27 @@ class VaultDetailsHandler implements HandlerInterface
/** /**
* @var \Adyen\Payment\Logger\AdyenLogger * @var \Adyen\Payment\Logger\AdyenLogger
*/ */
private $_adyenLogger; private $adyenLogger;
/**
* @var \Adyen\Payment\Helper\Data
*/
private $adyenHelper;
/** /**
* VaultDetailsHandler constructor. * VaultDetailsHandler constructor.
* *
* @param PaymentTokenFactoryInterface $paymentTokenFactory * @param PaymentTokenFactoryInterface $paymentTokenFactory
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger * @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
* @param \Adyen\Payment\Helper\Data $adyenHelper
*/ */
public function __construct( public function __construct(
PaymentTokenFactoryInterface $paymentTokenFactory, 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; $this->paymentTokenFactory = $paymentTokenFactory;
} }
...@@ -61,15 +69,17 @@ class VaultDetailsHandler implements HandlerInterface ...@@ -61,15 +69,17 @@ class VaultDetailsHandler implements HandlerInterface
{ {
$payment = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($handlingSubject); $payment = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($handlingSubject);
/** @var OrderPaymentInterface $payment */ /** @var \Adyen\Payment\Api\Data\OrderPaymentInterface $payment */
$payment = $payment->getPayment(); $payment = $payment->getPayment();
// add vault payment token entity to extension attributes if ($this->adyenHelper->isCreditCardVaultEnabled($payment->getOrder()->getStoreId())) {
$paymentToken = $this->getVaultPaymentToken($response); // add vault payment token entity to extension attributes
$paymentToken = $this->getVaultPaymentToken($response);
if (null !== $paymentToken) { if (null !== $paymentToken) {
$extensionAttributes = $this->getExtensionAttributes($payment); $extensionAttributes = $this->getExtensionAttributes($payment);
$extensionAttributes->setVaultPaymentToken($paymentToken); $extensionAttributes->setVaultPaymentToken($paymentToken);
}
} }
} }
...@@ -88,7 +98,7 @@ class VaultDetailsHandler implements HandlerInterface ...@@ -88,7 +98,7 @@ class VaultDetailsHandler implements HandlerInterface
if (empty($additionalData['recurring.recurringDetailReference'])) { if (empty($additionalData['recurring.recurringDetailReference'])) {
$this->_adyenLogger->error( $this->adyenLogger->error(
'Missing Token in Result please enable in ' . 'Missing Token in Result please enable in ' .
'Settings -> API URLs and Response menu in the Adyen Customer Area Recurring details setting' 'Settings -> API URLs and Response menu in the Adyen Customer Area Recurring details setting'
); );
...@@ -98,7 +108,7 @@ class VaultDetailsHandler implements HandlerInterface ...@@ -98,7 +108,7 @@ class VaultDetailsHandler implements HandlerInterface
if (empty($additionalData['cardSummary'])) { if (empty($additionalData['cardSummary'])) {
$this->_adyenLogger->error( $this->adyenLogger->error(
'Missing cardSummary in Result please login to the adyen portal ' . 'Missing cardSummary in Result please login to the adyen portal ' .
'and go to Settings -> API URLs and Response and enable the Card summary property' 'and go to Settings -> API URLs and Response and enable the Card summary property'
); );
...@@ -107,7 +117,7 @@ class VaultDetailsHandler implements HandlerInterface ...@@ -107,7 +117,7 @@ class VaultDetailsHandler implements HandlerInterface
$cardSummary = $additionalData['cardSummary']; $cardSummary = $additionalData['cardSummary'];
if (empty($additionalData['expiryDate'])) { if (empty($additionalData['expiryDate'])) {
$this->_adyenLogger->error( $this->adyenLogger->error(
'Missing expiryDate in Result please login to the adyen portal and go to ' . 'Missing expiryDate in Result please login to the adyen portal and go to ' .
'Settings -> API URLs and Response and enable the Expiry date property' 'Settings -> API URLs and Response and enable the Expiry date property'
); );
...@@ -116,7 +126,7 @@ class VaultDetailsHandler implements HandlerInterface ...@@ -116,7 +126,7 @@ class VaultDetailsHandler implements HandlerInterface
$expirationDate = $additionalData['expiryDate']; $expirationDate = $additionalData['expiryDate'];
if (empty($additionalData['paymentMethod'])) { if (empty($additionalData['paymentMethod'])) {
$this->_adyenLogger->error( $this->adyenLogger->error(
'Missing paymentMethod in Result please login to the adyen portal and go to ' . 'Missing paymentMethod in Result please login to the adyen portal and go to ' .
'Settings -> API URLs and Response and enable the Variant property' 'Settings -> API URLs and Response and enable the Variant property'
); );
...@@ -141,7 +151,7 @@ class VaultDetailsHandler implements HandlerInterface ...@@ -141,7 +151,7 @@ class VaultDetailsHandler implements HandlerInterface
$paymentToken->setTokenDetails(json_encode($details)); $paymentToken->setTokenDetails(json_encode($details));
} catch (\Exception $e) { } 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 ...@@ -1595,7 +1595,6 @@ class Data extends AbstractHelper
// check if BA exists // check if BA exists
if (!($billingAgreement && $billingAgreement->getAgreementId() > 0 && $billingAgreement->isValid())) { if (!($billingAgreement && $billingAgreement->getAgreementId() > 0 && $billingAgreement->isValid())) {
// create new BA // create new BA
$this->adyenLogger->addAdyenDebug("Creating new Billing Agreement");
$billingAgreement = $this->billingAgreementFactory->create(); $billingAgreement = $this->billingAgreementFactory->create();
$billingAgreement->setStoreId($order->getStoreId()); $billingAgreement->setStoreId($order->getStoreId());
$billingAgreement->importOrderPayment($order->getPayment()); $billingAgreement->importOrderPayment($order->getPayment());
...@@ -1615,7 +1614,9 @@ class Data extends AbstractHelper ...@@ -1615,7 +1614,9 @@ class Data extends AbstractHelper
$storeOneClick = $order->getPayment()->getAdditionalInformation('store_cc'); $storeOneClick = $order->getPayment()->getAdditionalInformation('store_cc');
$billingAgreement->setCcBillingAgreement($additionalData, $storeOneClick, $order->getStoreId()); $billingAgreement->setCcBillingAgreement($additionalData, $storeOneClick, $order->getStoreId());
if ($billingAgreement->isValid()) { $billingAgreementErrors = $billingAgreement->getErrors();
if ($billingAgreement->isValid() && empty($billingAgreementErrors)) {
if (!$this->agreementResourceModel->getOrderRelation($billingAgreement->getAgreementId(), if (!$this->agreementResourceModel->getOrderRelation($billingAgreement->getAgreementId(),
$order->getId())) { $order->getId())) {
...@@ -1627,7 +1628,7 @@ class Data extends AbstractHelper ...@@ -1627,7 +1628,7 @@ class Data extends AbstractHelper
$order->addRelatedObject($billingAgreement); $order->addRelatedObject($billingAgreement);
} else { } else {
$message = __('Failed to create billing agreement for this order. Reason(s): ') . join(', ', $message = __('Failed to create billing agreement for this order. Reason(s): ') . join(', ',
$billingAgreement->getErrors()); $billingAgreementErrors);
throw new \Exception($message); throw new \Exception($message);
} }
...@@ -1799,7 +1800,7 @@ class Data extends AbstractHelper ...@@ -1799,7 +1800,7 @@ class Data extends AbstractHelper
$localeCode = $this->config->getValue( $localeCode = $this->config->getValue(
\Magento\Directory\Helper\Data::XML_PATH_DEFAULT_LOCALE, \Magento\Directory\Helper\Data::XML_PATH_DEFAULT_LOCALE,
\Magento\Store\Model\ScopeInterface::SCOPE_STORES, \Magento\Store\Model\ScopeInterface::SCOPE_STORES,
$store->getCode() $this->storeManager->getStore($storeId)->getCode()
); );
return $localeCode; return $localeCode;
......
...@@ -179,36 +179,41 @@ class Agreement extends \Magento\Paypal\Model\Billing\Agreement ...@@ -179,36 +179,41 @@ class Agreement extends \Magento\Paypal\Model\Billing\Agreement
->setMethodCode('adyen_oneclick') ->setMethodCode('adyen_oneclick')
->setReferenceId($contractDetail['recurring.recurringDetailReference']); ->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 // 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();
if (isset($ccTypes[$ccType])) { $ccType = $contractDetail['paymentMethod'];
$ccType = $ccTypes[$ccType]['name']; $ccTypes = $this->adyenHelper->getCcTypesAltData();
}
if ($contractDetail['cardHolderName']) { if (isset($ccTypes[$ccType])) {
$label = __( $ccType = $ccTypes[$ccType]['name'];
'%1, %2, **** %3', }
$ccType,
$contractDetail['cardHolderName'],
$contractDetail['cardSummary']
);
} else {
$label = __(
'%1, **** %2',
$ccType,
$contractDetail['cardSummary']
);
}
$this->setAgreementLabel($label); if ($contractDetail['cardHolderName']) {
$label = __(
'%1, %2, **** %3',
$ccType,
$contractDetail['cardHolderName'],
$contractDetail['cardSummary']
);
} else {
$label = __(
'%1, **** %2',
$ccType,
$contractDetail['cardSummary']
);
} }
$this->setAgreementLabel($label);
$expiryDate = explode('/', $contractDetail['expiryDate']); $expiryDate = explode('/', $contractDetail['expiryDate']);
if (!empty($contractDetail['pos_payment'])) { if (!empty($contractDetail['pos_payment'])) {
......
...@@ -12,7 +12,7 @@ Inside Adyen toggle the following settings on inside the API and Responses secti ...@@ -12,7 +12,7 @@ Inside Adyen toggle the following settings on inside the API and Responses secti
* Variant * Variant
## Requirements ## Requirements
This plugin supports Magento2 version 2.2 and higher. This plugin supports Magento2 version 2.2.8 and higher.
## Collaboration ## Collaboration
We commit all our new features directly into our GitHub repository. We commit all our new features directly into our GitHub repository.
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"name": "adyen/module-payment", "name": "adyen/module-payment",
"description": "Official Magento2 Plugin to connect to Payment Service Provider Adyen.", "description": "Official Magento2 Plugin to connect to Payment Service Provider Adyen.",
"type": "magento2-module", "type": "magento2-module",
"version": "4.2.0", "version": "4.2.1",
"license": [ "license": [
"OSL-3.0", "OSL-3.0",
"AFL-3.0" "AFL-3.0"
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
], ],
"require": { "require": {
"adyen/php-api-library": ">=2.0.0", "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.*" "magento/module-vault": "101.*"
}, },
"autoload": { "autoload": {
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
--> -->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <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> <sequence>
<module name="Magento_Sales"/> <module name="Magento_Sales"/>
<module name="Magento_Quote"/> <module name="Magento_Quote"/>
......
...@@ -91,6 +91,13 @@ $_isDemoMode = $block->isDemoMode(); ...@@ -91,6 +91,13 @@ $_isDemoMode = $block->isDemoMode();
</tr> </tr>
<?php endif; ?> <?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'])) : ?> <?php if (!empty($banktranferData['bankTransfer.accountCode'])) : ?>
<tr> <tr>
<th><?php echo $block->escapeHtml(__('Bankaccount')); ?></th> <th><?php echo $block->escapeHtml(__('Bankaccount')); ?></th>
......
...@@ -71,6 +71,13 @@ ...@@ -71,6 +71,13 @@
</tr> </tr>
<?php endif; ?> <?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'])) : ?> <?php if (!empty($banktranferData['bankTransfer.accountCode'])) : ?>
<tr> <tr>
<th><?php echo $block->escapeHtml(__('Bankaccount')); ?></th> <th><?php echo $block->escapeHtml(__('Bankaccount')); ?></th>
......
...@@ -58,6 +58,11 @@ $_info = $this->getInfo(); ...@@ -58,6 +58,11 @@ $_info = $this->getInfo();
<dd><?php echo $banktranferData['bankTransfer.bankName'] ?></dd> <dd><?php echo $banktranferData['bankTransfer.bankName'] ?></dd>
<?php endif; ?> <?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'])) : ?> <?php if (!empty($banktranferData['bankTransfer.accountCode'])) : ?>
<dt><?php echo $block->escapeHtml(__('Bankaccount')); ?></dt> <dt><?php echo $block->escapeHtml(__('Bankaccount')); ?></dt>
<dd><?php echo $banktranferData['bankTransfer.accountCode'] ?></dd> <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