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 ecd01eb1 authored by Alessio Zampatti's avatar Alessio Zampatti Committed by GitHub

Merge pull request #430 from Adyen/develop

Release 4.0.2
parents 7bfbafa1 0dbcbcaf
...@@ -99,8 +99,8 @@ class APIKeyMessage implements \Magento\Framework\Notification\MessageInterface ...@@ -99,8 +99,8 @@ class APIKeyMessage implements \Magento\Framework\Notification\MessageInterface
'date_added' => date('Y-m-d'), 'date_added' => date('Y-m-d'),
'title' => $title, 'title' => $title,
'description' => $this->getText(), 'description' => $this->getText(),
'url' => 'https://docs.adyen.com/developers/plug-ins-and-partners/magento-2/' . 'url' => 'https://docs.adyen.com/developers/plugins/magento-2/' .
'set-up-the-plugin-in-magento#step3configuretheplugininmagento', 'set-up-adyen-customer-area#step1generateanapikey',
]; ];
/* /*
......
...@@ -91,7 +91,7 @@ class CronMessage implements \Magento\Framework\Notification\MessageInterface ...@@ -91,7 +91,7 @@ class CronMessage implements \Magento\Framework\Notification\MessageInterface
{ {
$message = __('You have ' . $this->_cronCheck . ' unprocessed notification(s). Please check your Cron'); $message = __('You have ' . $this->_cronCheck . ' unprocessed notification(s). Please check your Cron');
$urlMagento = "http://devdocs.magento.com/guides/v2.0/config-guide/cli/config-cli-subcommands-cron.html"; $urlMagento = "http://devdocs.magento.com/guides/v2.0/config-guide/cli/config-cli-subcommands-cron.html";
$urlAdyen = "https://docs.adyen.com/developers/plug-ins-and-partners/magento/magento-2/configuring-the-adyen-plug-in"; $urlAdyen = "https://docs.adyen.com/developers/plugins/magento-2/set-up-the-plugin-in-magento#step2runcron";
$message .= __( $message .= __(
' and visit <a href="%1">Magento DevDocs</a> and <a href="%2">Adyen Docs</a> on how to configure Cron.', ' and visit <a href="%1">Magento DevDocs</a> and <a href="%2">Adyen Docs</a> on how to configure Cron.',
$urlMagento, $urlMagento,
......
...@@ -50,13 +50,11 @@ class TransactionAuthorization implements ClientInterface ...@@ -50,13 +50,11 @@ class TransactionAuthorization implements ClientInterface
\Magento\Framework\Model\Context $context, \Magento\Framework\Model\Context $context,
\Magento\Framework\Encryption\EncryptorInterface $encryptor, \Magento\Framework\Encryption\EncryptorInterface $encryptor,
\Adyen\Payment\Helper\Data $adyenHelper, \Adyen\Payment\Helper\Data $adyenHelper,
\Adyen\Payment\Logger\AdyenLogger $adyenLogger,
\Adyen\Payment\Model\RecurringType $recurringType, \Adyen\Payment\Model\RecurringType $recurringType,
array $data = [] array $data = []
) { ) {
$this->_encryptor = $encryptor; $this->_encryptor = $encryptor;
$this->_adyenHelper = $adyenHelper; $this->_adyenHelper = $adyenHelper;
$this->_adyenLogger = $adyenLogger;
$this->_recurringType = $recurringType; $this->_recurringType = $recurringType;
$this->_appState = $context->getAppState(); $this->_appState = $context->getAppState();
......
...@@ -37,7 +37,6 @@ class TransactionCancel implements ClientInterface ...@@ -37,7 +37,6 @@ class TransactionCancel implements ClientInterface
* @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Model\Context $context
* @param \Magento\Framework\Encryption\EncryptorInterface $encryptor * @param \Magento\Framework\Encryption\EncryptorInterface $encryptor
* @param \Adyen\Payment\Helper\Data $adyenHelper * @param \Adyen\Payment\Helper\Data $adyenHelper
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
* @param \Adyen\Payment\Model\RecurringType $recurringType * @param \Adyen\Payment\Model\RecurringType $recurringType
* @param array $data * @param array $data
*/ */
...@@ -45,13 +44,11 @@ class TransactionCancel implements ClientInterface ...@@ -45,13 +44,11 @@ class TransactionCancel implements ClientInterface
\Magento\Framework\Model\Context $context, \Magento\Framework\Model\Context $context,
\Magento\Framework\Encryption\EncryptorInterface $encryptor, \Magento\Framework\Encryption\EncryptorInterface $encryptor,
\Adyen\Payment\Helper\Data $adyenHelper, \Adyen\Payment\Helper\Data $adyenHelper,
\Adyen\Payment\Logger\AdyenLogger $adyenLogger,
\Adyen\Payment\Model\RecurringType $recurringType, \Adyen\Payment\Model\RecurringType $recurringType,
array $data = [] array $data = []
) { ) {
$this->_encryptor = $encryptor; $this->_encryptor = $encryptor;
$this->_adyenHelper = $adyenHelper; $this->_adyenHelper = $adyenHelper;
$this->_adyenLogger = $adyenLogger;
$this->_recurringType = $recurringType; $this->_recurringType = $recurringType;
$this->_appState = $context->getAppState(); $this->_appState = $context->getAppState();
......
...@@ -55,7 +55,6 @@ class TransactionPayment implements ClientInterface ...@@ -55,7 +55,6 @@ class TransactionPayment implements ClientInterface
public function placeRequest(\Magento\Payment\Gateway\Http\TransferInterface $transferObject) public function placeRequest(\Magento\Payment\Gateway\Http\TransferInterface $transferObject)
{ {
$request = $transferObject->getBody(); $request = $transferObject->getBody();
$client = $this->adyenHelper->initializeAdyenClient(); $client = $this->adyenHelper->initializeAdyenClient();
$service = new \Adyen\Service\Checkout($client); $service = new \Adyen\Service\Checkout($client);
......
...@@ -37,7 +37,6 @@ class TransactionRefund implements ClientInterface ...@@ -37,7 +37,6 @@ class TransactionRefund implements ClientInterface
* @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Model\Context $context
* @param \Magento\Framework\Encryption\EncryptorInterface $encryptor * @param \Magento\Framework\Encryption\EncryptorInterface $encryptor
* @param \Adyen\Payment\Helper\Data $adyenHelper * @param \Adyen\Payment\Helper\Data $adyenHelper
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
* @param \Adyen\Payment\Model\RecurringType $recurringType * @param \Adyen\Payment\Model\RecurringType $recurringType
* @param array $data * @param array $data
*/ */
...@@ -45,13 +44,11 @@ class TransactionRefund implements ClientInterface ...@@ -45,13 +44,11 @@ class TransactionRefund implements ClientInterface
\Magento\Framework\Model\Context $context, \Magento\Framework\Model\Context $context,
\Magento\Framework\Encryption\EncryptorInterface $encryptor, \Magento\Framework\Encryption\EncryptorInterface $encryptor,
\Adyen\Payment\Helper\Data $adyenHelper, \Adyen\Payment\Helper\Data $adyenHelper,
\Adyen\Payment\Logger\AdyenLogger $adyenLogger,
\Adyen\Payment\Model\RecurringType $recurringType, \Adyen\Payment\Model\RecurringType $recurringType,
array $data = [] array $data = []
) { ) {
$this->_encryptor = $encryptor; $this->_encryptor = $encryptor;
$this->_adyenHelper = $adyenHelper; $this->_adyenHelper = $adyenHelper;
$this->_adyenLogger = $adyenLogger;
$this->_recurringType = $recurringType; $this->_recurringType = $recurringType;
$this->_appState = $context->getAppState(); $this->_appState = $context->getAppState();
......
...@@ -58,7 +58,10 @@ class CancelResponseValidator extends AbstractValidator ...@@ -58,7 +58,10 @@ class CancelResponseValidator extends AbstractValidator
$isValid = true; $isValid = true;
$errorMessages = []; $errorMessages = [];
if ($response['response'] != '[cancelOrRefund-received]') { // The available response codes that the API can return in case of successfull cancellation
$expectedResponses = ['[cancelOrRefund-received]', '[cancel-received]'];
if (!in_array($response['response'], $expectedResponses)) {
$errorMsg = __('Error with cancellation'); $errorMsg = __('Error with cancellation');
$this->adyenLogger->error($errorMsg); $this->adyenLogger->error($errorMsg);
$errorMessages[] = $errorMsg; $errorMessages[] = $errorMsg;
......
...@@ -1343,6 +1343,10 @@ class Data extends AbstractHelper ...@@ -1343,6 +1343,10 @@ class Data extends AbstractHelper
public function initializeAdyenClient($storeId = null, $apiKey = null) public function initializeAdyenClient($storeId = null, $apiKey = null)
{ {
// initialize client // initialize client
if ($storeId === null) {
$storeId = $this->storeManager->getStore()->getId();
}
if (empty($apiKey)) { if (empty($apiKey)) {
$apiKey = $this->getAPIKey($storeId); $apiKey = $this->getAPIKey($storeId);
} }
......
...@@ -214,8 +214,14 @@ class Cron ...@@ -214,8 +214,14 @@ class Cron
*/ */
private $agreementResourceModel; private $agreementResourceModel;
/**
* @var \Magento\Sales\Model\Order\Payment\Transaction\Builder
*/
private $transactionBuilder;
/** /**
* Cron constructor. * Cron constructor.
*
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger * @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
* @param ResourceModel\Notification\CollectionFactory $notificationFactory * @param ResourceModel\Notification\CollectionFactory $notificationFactory
...@@ -235,6 +241,7 @@ class Cron ...@@ -235,6 +241,7 @@ class Cron
* @param SearchCriteriaBuilder $searchCriteriaBuilder * @param SearchCriteriaBuilder $searchCriteriaBuilder
* @param OrderRepository $orderRepository * @param OrderRepository $orderRepository
* @param ResourceModel\Billing\Agreement $agreementResourceModel * @param ResourceModel\Billing\Agreement $agreementResourceModel
* @param \Magento\Sales\Model\Order\Payment\Transaction\Builder $transactionBuilder
*/ */
public function __construct( public function __construct(
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
...@@ -255,7 +262,8 @@ class Cron ...@@ -255,7 +262,8 @@ class Cron
\Magento\Sales\Model\ResourceModel\Order\Status\CollectionFactory $orderStatusCollection, \Magento\Sales\Model\ResourceModel\Order\Status\CollectionFactory $orderStatusCollection,
SearchCriteriaBuilder $searchCriteriaBuilder, SearchCriteriaBuilder $searchCriteriaBuilder,
OrderRepository $orderRepository, OrderRepository $orderRepository,
\Adyen\Payment\Model\ResourceModel\Billing\Agreement $agreementResourceModel \Adyen\Payment\Model\ResourceModel\Billing\Agreement $agreementResourceModel,
\Magento\Sales\Model\Order\Payment\Transaction\Builder $transactionBuilder
) { ) {
$this->_scopeConfig = $scopeConfig; $this->_scopeConfig = $scopeConfig;
$this->_adyenLogger = $adyenLogger; $this->_adyenLogger = $adyenLogger;
...@@ -276,6 +284,7 @@ class Cron ...@@ -276,6 +284,7 @@ class Cron
$this->searchCriteriaBuilder = $searchCriteriaBuilder; $this->searchCriteriaBuilder = $searchCriteriaBuilder;
$this->orderRepository = $orderRepository; $this->orderRepository = $orderRepository;
$this->agreementResourceModel = $agreementResourceModel; $this->agreementResourceModel = $agreementResourceModel;
$this->transactionBuilder = $transactionBuilder;
} }
/** /**
...@@ -1235,6 +1244,16 @@ class Cron ...@@ -1235,6 +1244,16 @@ class Cron
// set transaction // set transaction
$paymentObj->setTransactionId($this->_pspReference); $paymentObj->setTransactionId($this->_pspReference);
// Prepare transaction
$transaction = $this->transactionBuilder->setPayment($paymentObj)
->setOrder($this->_order)
->setTransactionId($this->_pspReference)
->build(\Magento\Sales\Api\Data\TransactionInterface::TYPE_AUTH);
$transaction->setIsClosed(false);
$transaction->save();
//capture mode //capture mode
if (!$this->_isAutoCapture()) { if (!$this->_isAutoCapture()) {
$this->_order->addStatusHistoryComment(__('Capture Mode set to Manual')); $this->_order->addStatusHistoryComment(__('Capture Mode set to Manual'));
......
...@@ -25,10 +25,10 @@ composer require adyen/module-payment ...@@ -25,10 +25,10 @@ composer require adyen/module-payment
bin/magento module:enable Adyen_Payment bin/magento module:enable Adyen_Payment
bin/magento setup:upgrade bin/magento setup:upgrade
``` ```
For more information see our [installation section](https://docs.adyen.com/developers/plug-ins-and-partners/magento-2/set-up-the-plugin-in-magento#step1installtheplugin) For more information see our [installation section](https://docs.adyen.com/developers/plugins/magento-2/set-up-the-plugin-in-magento?redirect#step1installtheplugin)
## Documentation ## Documentation
[Magento 2 documentation](https://docs.adyen.com/developers/plug-ins-and-partners/magento-2) [Magento 2 documentation](https://docs.adyen.com/developers/plugins/magento-2)
## Setup Cron ## Setup Cron
......
...@@ -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.0.1", "version": "4.0.2",
"license": [ "license": [
"OSL-3.0", "OSL-3.0",
"AFL-3.0" "AFL-3.0"
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model> <frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
<comment><![CDATA[ <comment><![CDATA[
<ul class="adyen-list"> <ul class="adyen-list">
<li><a target="_blank" href="https://docs.adyen.com/manuals/magento/magento2-integration">Manual for setting up the module</a></li> <li><a target="_blank" href="https://docs.adyen.com/developers/plugins/magento-2">Manual for setting up the module</a></li>
<li><a target="_blank" href="https://www.adyen.com/home/payment-services/plug-ins/magento#form"><strong>Sign</strong> up for a test account</a></li> <li><a target="_blank" href="https://www.adyen.com/home/payment-services/plug-ins/magento#form"><strong>Sign</strong> up for a test account</a></li>
<li>The latest version of the <a target="_blank" href="https://github.com/adyen/adyen-magento2/releases">Adyen Magento module is also available through GitHub</a>.</li> <li>The latest version of the <a target="_blank" href="https://github.com/adyen/adyen-magento2/releases">Adyen Magento module is also available through GitHub</a>.</li>
</ul> </ul>
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
<label>Merchant Account</label> <label>Merchant Account</label>
<config_path>payment/adyen_abstract/merchant_account</config_path> <config_path>payment/adyen_abstract/merchant_account</config_path>
<tooltip><![CDATA[The merchant account identifier you want to process the (transaction) request with. Find this at the top of the screen in the Adyen Customer Area, where you will see [YourCompanyAccount] > [YourMerchantAccount] . Please note that the merchant account is different from the company account; a company account can have one or more merchant accounts.]]></tooltip> <tooltip><![CDATA[The merchant account identifier you want to process the (transaction) request with. Find this at the top of the screen in the Adyen Customer Area, where you will see [YourCompanyAccount] > [YourMerchantAccount] . Please note that the merchant account is different from the company account; a company account can have one or more merchant accounts.]]></tooltip>
<comment><![CDATA[<a target="_blank" href="https://docs.adyen.com/manuals/magento/magento2-integration/settings-in-the-customer-area">Click here for explanation.</a>]]></comment> <comment><![CDATA[<a target="_blank" href="https://docs.adyen.com/developers/plugins/magento-2/set-up-the-plugin-in-magento#step3configuretheplugininmagento">Click here for explanation.</a>]]></comment>
</field> </field>
<field id="demo_mode" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1"> <field id="demo_mode" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Test/Production Mode</label> <label>Test/Production Mode</label>
......
...@@ -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.0.1"> <module name="Adyen_Payment" setup_version="4.0.2">
<sequence> <sequence>
<module name="Magento_Sales"/> <module name="Magento_Sales"/>
<module name="Magento_Quote"/> <module name="Magento_Quote"/>
......
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