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 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
'date_added' => date('Y-m-d'),
'title' => $title,
'description' => $this->getText(),
'url' => 'https://docs.adyen.com/developers/plug-ins-and-partners/magento-2/' .
'set-up-the-plugin-in-magento#step3configuretheplugininmagento',
'url' => 'https://docs.adyen.com/developers/plugins/magento-2/' .
'set-up-adyen-customer-area#step1generateanapikey',
];
/*
......
......@@ -91,7 +91,7 @@ class CronMessage implements \Magento\Framework\Notification\MessageInterface
{
$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";
$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 .= __(
' and visit <a href="%1">Magento DevDocs</a> and <a href="%2">Adyen Docs</a> on how to configure Cron.',
$urlMagento,
......
......@@ -50,13 +50,11 @@ class TransactionAuthorization implements ClientInterface
\Magento\Framework\Model\Context $context,
\Magento\Framework\Encryption\EncryptorInterface $encryptor,
\Adyen\Payment\Helper\Data $adyenHelper,
\Adyen\Payment\Logger\AdyenLogger $adyenLogger,
\Adyen\Payment\Model\RecurringType $recurringType,
array $data = []
) {
$this->_encryptor = $encryptor;
$this->_adyenHelper = $adyenHelper;
$this->_adyenLogger = $adyenLogger;
$this->_recurringType = $recurringType;
$this->_appState = $context->getAppState();
......
......@@ -37,7 +37,6 @@ class TransactionCancel implements ClientInterface
* @param \Magento\Framework\Model\Context $context
* @param \Magento\Framework\Encryption\EncryptorInterface $encryptor
* @param \Adyen\Payment\Helper\Data $adyenHelper
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
* @param \Adyen\Payment\Model\RecurringType $recurringType
* @param array $data
*/
......@@ -45,13 +44,11 @@ class TransactionCancel implements ClientInterface
\Magento\Framework\Model\Context $context,
\Magento\Framework\Encryption\EncryptorInterface $encryptor,
\Adyen\Payment\Helper\Data $adyenHelper,
\Adyen\Payment\Logger\AdyenLogger $adyenLogger,
\Adyen\Payment\Model\RecurringType $recurringType,
array $data = []
) {
$this->_encryptor = $encryptor;
$this->_adyenHelper = $adyenHelper;
$this->_adyenLogger = $adyenLogger;
$this->_recurringType = $recurringType;
$this->_appState = $context->getAppState();
......
......@@ -55,7 +55,6 @@ class TransactionPayment implements ClientInterface
public function placeRequest(\Magento\Payment\Gateway\Http\TransferInterface $transferObject)
{
$request = $transferObject->getBody();
$client = $this->adyenHelper->initializeAdyenClient();
$service = new \Adyen\Service\Checkout($client);
......
......@@ -37,7 +37,6 @@ class TransactionRefund implements ClientInterface
* @param \Magento\Framework\Model\Context $context
* @param \Magento\Framework\Encryption\EncryptorInterface $encryptor
* @param \Adyen\Payment\Helper\Data $adyenHelper
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
* @param \Adyen\Payment\Model\RecurringType $recurringType
* @param array $data
*/
......@@ -45,13 +44,11 @@ class TransactionRefund implements ClientInterface
\Magento\Framework\Model\Context $context,
\Magento\Framework\Encryption\EncryptorInterface $encryptor,
\Adyen\Payment\Helper\Data $adyenHelper,
\Adyen\Payment\Logger\AdyenLogger $adyenLogger,
\Adyen\Payment\Model\RecurringType $recurringType,
array $data = []
) {
$this->_encryptor = $encryptor;
$this->_adyenHelper = $adyenHelper;
$this->_adyenLogger = $adyenLogger;
$this->_recurringType = $recurringType;
$this->_appState = $context->getAppState();
......
......@@ -58,7 +58,10 @@ class CancelResponseValidator extends AbstractValidator
$isValid = true;
$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');
$this->adyenLogger->error($errorMsg);
$errorMessages[] = $errorMsg;
......
......@@ -1343,6 +1343,10 @@ class Data extends AbstractHelper
public function initializeAdyenClient($storeId = null, $apiKey = null)
{
// initialize client
if ($storeId === null) {
$storeId = $this->storeManager->getStore()->getId();
}
if (empty($apiKey)) {
$apiKey = $this->getAPIKey($storeId);
}
......
......@@ -214,8 +214,14 @@ class Cron
*/
private $agreementResourceModel;
/**
* @var \Magento\Sales\Model\Order\Payment\Transaction\Builder
*/
private $transactionBuilder;
/**
* Cron constructor.
*
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
* @param ResourceModel\Notification\CollectionFactory $notificationFactory
......@@ -235,6 +241,7 @@ class Cron
* @param SearchCriteriaBuilder $searchCriteriaBuilder
* @param OrderRepository $orderRepository
* @param ResourceModel\Billing\Agreement $agreementResourceModel
* @param \Magento\Sales\Model\Order\Payment\Transaction\Builder $transactionBuilder
*/
public function __construct(
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
......@@ -255,7 +262,8 @@ class Cron
\Magento\Sales\Model\ResourceModel\Order\Status\CollectionFactory $orderStatusCollection,
SearchCriteriaBuilder $searchCriteriaBuilder,
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->_adyenLogger = $adyenLogger;
......@@ -276,6 +284,7 @@ class Cron
$this->searchCriteriaBuilder = $searchCriteriaBuilder;
$this->orderRepository = $orderRepository;
$this->agreementResourceModel = $agreementResourceModel;
$this->transactionBuilder = $transactionBuilder;
}
/**
......@@ -1235,6 +1244,16 @@ class Cron
// set transaction
$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
if (!$this->_isAutoCapture()) {
$this->_order->addStatusHistoryComment(__('Capture Mode set to Manual'));
......
......@@ -25,10 +25,10 @@ composer require adyen/module-payment
bin/magento module:enable Adyen_Payment
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
[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
......
......@@ -2,7 +2,7 @@
"name": "adyen/module-payment",
"description": "Official Magento2 Plugin to connect to Payment Service Provider Adyen.",
"type": "magento2-module",
"version": "4.0.1",
"version": "4.0.2",
"license": [
"OSL-3.0",
"AFL-3.0"
......
......@@ -28,7 +28,7 @@
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
<comment><![CDATA[
<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>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>
......
......@@ -30,7 +30,7 @@
<label>Merchant Account</label>
<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>
<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 id="demo_mode" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Test/Production Mode</label>
......
......@@ -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.0.1">
<module name="Adyen_Payment" setup_version="4.0.2">
<sequence>
<module name="Magento_Sales"/>
<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