Commit 495edf80 authored by attilak's avatar attilak

Merge branch 'develop' into PW-2212

# Conflicts:
#	Gateway/Request/CheckoutDataBuilder.php
#	view/frontend/web/template/payment/hpp-form.html
parents b1b1603c 83a35dd9
**Magento version**: x.y.z
**Plugin version**: x.y.z
**Description**
<!--
- Please provide a description of the issue. In case of bug report, please provide the necessary steps to reproduce.
- For merchant specific requests, please use https://support.adyen.com
-->
\ No newline at end of file
blank_issues_enabled: false
contact_links:
- name: Adyen Support
url: https://support.adyen.com/hc/en-us/requests/new?ticket_form_id=360000705420
about: For other questions, contact our support team
...@@ -231,6 +231,8 @@ class Redirect extends \Magento\Framework\App\Action\Action ...@@ -231,6 +231,8 @@ class Redirect extends \Magento\Framework\App\Action\Action
*/ */
$order->addStatusHistoryComment(__('3D-secure validation was unsuccessful. This order will be cancelled when the related notification has been processed.'))->save(); $order->addStatusHistoryComment(__('3D-secure validation was unsuccessful. This order will be cancelled when the related notification has been processed.'))->save();
$this->messageManager->addErrorMessage("3D-secure validation was unsuccessful");
// reactivate the quote // reactivate the quote
$session = $this->_getCheckout(); $session = $this->_getCheckout();
......
...@@ -135,6 +135,19 @@ class CheckoutDataBuilder implements BuilderInterface ...@@ -135,6 +135,19 @@ class CheckoutDataBuilder implements BuilderInterface
$requestBody['deviceFingerprint'] = $payment->getAdditionalInformation("df_value"); $requestBody['deviceFingerprint'] = $payment->getAdditionalInformation("df_value");
} }
//Boleto data
if ($payment->getAdditionalInformation("social_security_number")) {
$requestBody['socialSecurityNumber'] = $payment->getAdditionalInformation("social_security_number");
}
if ($payment->getAdditionalInformation("firstname")) {
$requestBody['shopperName']['firstName'] = $payment->getAdditionalInformation("firstname");
}
if ($payment->getAdditionalInformation("lastname")) {
$requestBody['shopperName']['lastName'] = $payment->getAdditionalInformation("lastname");
}
if ($payment->getMethod() == \Adyen\Payment\Model\Ui\AdyenBoletoConfigProvider::CODE) { if ($payment->getMethod() == \Adyen\Payment\Model\Ui\AdyenBoletoConfigProvider::CODE) {
// TODO check if this is coming from the component now // TODO check if this is coming from the component now
/*$boletoTypes = $this->adyenHelper->getAdyenBoletoConfigData('boletotypes'); /*$boletoTypes = $this->adyenHelper->getAdyenBoletoConfigData('boletotypes');
......
...@@ -63,9 +63,8 @@ class GooglePayAuthorizationDataBuilder implements BuilderInterface ...@@ -63,9 +63,8 @@ class GooglePayAuthorizationDataBuilder implements BuilderInterface
$requestBody['paymentMethod']['type'] = 'paywithgoogle'; $requestBody['paymentMethod']['type'] = 'paywithgoogle';
// get payment data // get payment data
if ($token) { if ($token) {
$parsedToken = json_decode($token);
try { try {
$requestBody['paymentMethod']['paywithgoogle.token'] = $parsedToken; $requestBody['paymentMethod']['paywithgoogle.token'] = $token;
} catch (\Exception $exception) { } catch (\Exception $exception) {
$this->adyenLogger->addAdyenDebug("exception: " . $exception->getMessage()); $this->adyenLogger->addAdyenDebug("exception: " . $exception->getMessage());
} }
......
<?php
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Payment module (https://www.adyen.com/)
*
* Copyright (c) 2020 Adyen BV (https://www.adyen.com/)
* See LICENSE.txt for license details.
*
* Author: Adyen <magento@adyen.com>
*/
namespace Adyen\Payment\Helper;
use Magento\Framework\App\Config\ScopeConfigInterface;
class Config
{
const XML_PAYMENT_PREFIX = "payment";
const XML_ADYEN_ABSTRACT_PREFIX = "adyen_abstract";
const XML_NOTIFICATIONS_CAN_CANCEL_FIELD = "notifications_can_cancel";
/**
* @var Magento\Framework\App\Config\ScopeConfigInterface
*/
protected $scopeConfig;
/**
* Config constructor.
* @param Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
*/
public function __construct(
ScopeConfigInterface $scopeConfig
) {
$this->scopeConfig = $scopeConfig;
}
/**
* Retrieve flag for notifications_can_cancel
*
* @param int $storeId
* @return bool
*/
public function getNotificationsCanCancel($storeId = null)
{
return (bool)$this->getConfigData(
self::XML_NOTIFICATIONS_CAN_CANCEL_FIELD,
self::XML_ADYEN_ABSTRACT_PREFIX,
$storeId,
true
);
}
/**
* Retrieve information from payment configuration
*
* @param string $field
* @param string $xmlPrefix
* @param int $storeId
* @param bool|false $flag
* @return bool|mixed
*/
private function getConfigData($field, $xmlPrefix, $storeId, $flag = false)
{
$path = implode("/", [self::XML_PAYMENT_PREFIX, $xmlPrefix, $field]);
if (!$flag) {
return $this->scopeConfig->getValue($path, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId);
} else {
return $this->scopeConfig->isSetFlag($path, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId);
}
}
}
...@@ -86,11 +86,14 @@ class AdyenThreeDS2Process implements AdyenThreeDS2ProcessInterface ...@@ -86,11 +86,14 @@ class AdyenThreeDS2Process implements AdyenThreeDS2ProcessInterface
// Validate if order id is present // Validate if order id is present
if (empty($payload['orderId'])) { if (empty($payload['orderId'])) {
throw new \Magento\Framework\Exception\LocalizedException(__('3D secure 2.0 failed because of a missing order id')); $order = $this->getOrder();
} // In the next major release remove support for retrieving order from session and throw exception instead
//throw new \Magento\Framework\Exception\LocalizedException(__('3D secure 2.0 failed because of a missing order id'));
} else {
// Create order by order id // Create order by order id
$order = $this->orderFactory->create()->load($payload['orderId']); $order = $this->orderFactory->create()->load($payload['orderId']);
}
$payment = $order->getPayment(); $payment = $order->getPayment();
...@@ -147,4 +150,18 @@ class AdyenThreeDS2Process implements AdyenThreeDS2ProcessInterface ...@@ -147,4 +150,18 @@ class AdyenThreeDS2Process implements AdyenThreeDS2ProcessInterface
$response['result'] = $result['resultCode']; $response['result'] = $result['resultCode'];
return json_encode($response); return json_encode($response);
} }
/**
* Get order object
*
* @return \Magento\Sales\Model\Order
* @deprecated Will be removed in 7.0.0
*/
protected function getOrder()
{
$incrementId = $this->checkoutSession->getLastRealOrderId();
$order = $this->orderFactory->create()->loadByIncrementId($incrementId);
return $order;
}
} }
...@@ -235,6 +235,11 @@ class Cron ...@@ -235,6 +235,11 @@ class Cron
*/ */
private $timezone; private $timezone;
/**
* @var \Adyen\Payment\Helper\Config
*/
protected $configHelper;
/** /**
* Cron constructor. * Cron constructor.
* *
...@@ -282,7 +287,8 @@ class Cron ...@@ -282,7 +287,8 @@ class Cron
\Magento\Sales\Model\Order\Payment\Transaction\Builder $transactionBuilder, \Magento\Sales\Model\Order\Payment\Transaction\Builder $transactionBuilder,
\Magento\Framework\Serialize\SerializerInterface $serializer, \Magento\Framework\Serialize\SerializerInterface $serializer,
\Magento\Framework\Notification\NotifierInterface $notifierPool, \Magento\Framework\Notification\NotifierInterface $notifierPool,
\Magento\Framework\Stdlib\DateTime\TimezoneInterface $timezone \Magento\Framework\Stdlib\DateTime\TimezoneInterface $timezone,
\Adyen\Payment\Helper\Config $configHelper
) { ) {
$this->_scopeConfig = $scopeConfig; $this->_scopeConfig = $scopeConfig;
$this->_adyenLogger = $adyenLogger; $this->_adyenLogger = $adyenLogger;
...@@ -307,6 +313,7 @@ class Cron ...@@ -307,6 +313,7 @@ class Cron
$this->serializer = $serializer; $this->serializer = $serializer;
$this->notifierPool = $notifierPool; $this->notifierPool = $notifierPool;
$this->timezone = $timezone; $this->timezone = $timezone;
$this->configHelper = $configHelper;
} }
/** /**
...@@ -432,7 +439,9 @@ class Cron ...@@ -432,7 +439,9 @@ class Cron
$this->_eventCode == Notification::ORDER_CLOSED $this->_eventCode == Notification::ORDER_CLOSED
) { ) {
// Move the order from PAYMENT_REVIEW to NEW, so that can be cancelled // Move the order from PAYMENT_REVIEW to NEW, so that can be cancelled
if ($this->_order->getState() === \Magento\Sales\Model\Order::STATE_PAYMENT_REVIEW) { if ($this->_order->getState() === \Magento\Sales\Model\Order::STATE_PAYMENT_REVIEW &&
$this->configHelper->getNotificationsCanCancel($this->_order->getStoreId())
) {
$this->_order->setState(\Magento\Sales\Model\Order::STATE_NEW); $this->_order->setState(\Magento\Sales\Model\Order::STATE_NEW);
} }
$this->_holdCancelOrder(false); $this->_holdCancelOrder(false);
...@@ -829,6 +838,11 @@ class Cron ...@@ -829,6 +838,11 @@ class Cron
*/ */
protected function _holdCancelOrder($ignoreHasInvoice) protected function _holdCancelOrder($ignoreHasInvoice)
{ {
if (!$this->configHelper->getNotificationsCanCancel($this->_order->getStoreId())) {
$this->_adyenLogger->addAdyenNotificationCronjob('Order cannot be canceled based on the plugin configuration');
return;
}
$orderStatus = $this->_getConfigData( $orderStatus = $this->_getConfigData(
'payment_cancelled', 'payment_cancelled',
'adyen_abstract', 'adyen_abstract',
...@@ -992,7 +1006,7 @@ class Cron ...@@ -992,7 +1006,7 @@ class Cron
break; break;
} }
if (!$this->_order->canCancel()) { if (!$this->_order->canCancel() && $this->configHelper->getNotificationsCanCancel($this->_order->getStoreId())) {
// Move the order from PAYMENT_REVIEW to NEW, so that can be cancelled // Move the order from PAYMENT_REVIEW to NEW, so that can be cancelled
$this->_order->setState(\Magento\Sales\Model\Order::STATE_NEW); $this->_order->setState(\Magento\Sales\Model\Order::STATE_NEW);
} }
...@@ -1951,7 +1965,9 @@ class Cron ...@@ -1951,7 +1965,9 @@ class Cron
private function addNotificationErrorComment($errorMessage) private function addNotificationErrorComment($errorMessage)
{ {
$comment = __('The order failed to update: %1', $errorMessage); $comment = __('The order failed to update: %1', $errorMessage);
if ($this->_order) {
$this->_order->addStatusHistoryComment($comment); $this->_order->addStatusHistoryComment($comment);
$this->_order->save(); $this->_order->save();
} }
}
} }
...@@ -50,7 +50,7 @@ We have defined this: ...@@ -50,7 +50,7 @@ We have defined this:
``` ```
## Support ## Support
You can create issues on our Magento Repository. In case of specific problems with your account, please contact <a href="mailto:support@adyen.com">support@adyen.com</a>. If you have a feature request, or spotted a bug or a technical problem, create a GitHub issue. For other questions, contact our [support team](https://support.adyen.com/hc/en-us/requests/new?ticket_form_id=360000705420).
## API Library ## API Library
This module is using the Adyen APIs Library for PHP for all (API) connections to Adyen. This module is using the Adyen APIs Library for PHP for all (API) connections to Adyen.
......
...@@ -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": "6.0.0", "version": "6.1.0",
"license": [ "license": [
"OSL-3.0", "OSL-3.0",
"AFL-3.0" "AFL-3.0"
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
<enable_oneclick>1</enable_oneclick> <enable_oneclick>1</enable_oneclick>
<enable_recurring>0</enable_recurring> <enable_recurring>0</enable_recurring>
<group>adyen</group> <group>adyen</group>
<notifications_can_cancel>1</notifications_can_cancel>
</adyen_abstract> </adyen_abstract>
<adyen_cc> <adyen_cc>
<active>1</active> <active>1</active>
......
...@@ -1042,4 +1042,34 @@ ...@@ -1042,4 +1042,34 @@
<argument name="resourceModel" xsi:type="string">Adyen\Payment\Model\ResourceModel\Notification</argument> <argument name="resourceModel" xsi:type="string">Adyen\Payment\Model\ResourceModel\Notification</argument>
</arguments> </arguments>
</virtualType> </virtualType>
<!--Sensitive and system-specific configuration-->
<type name="Magento\Config\Model\Config\TypePool">
<arguments>
<argument name="environment" xsi:type="array">
<item name="payment/adyen_abstract/demo_mode" xsi:type="string">1</item>
<item name="payment/adyen_abstract/debug" xsi:type="string">1</item>
<item name="payment/adyen_apple_pay/full_path_location_pem_file_test" xsi:type="string">1</item>
<item name="payment/adyen_apple_pay/full_path_location_pem_file_live" xsi:type="string">1</item>
</argument>
<argument name="sensitive" xsi:type="array">
<item name="payment/adyen_abstract/merchant_account" xsi:type="string">1</item>
<item name="payment/adyen_abstract/api_key_test" xsi:type="string">1</item>
<item name="payment/adyen_abstract/api_key_live" xsi:type="string">1</item>
<item name="payment/adyen_abstract/notification_username" xsi:type="string">1</item>
<item name="payment/adyen_abstract/notification_password" xsi:type="string">1</item>
<item name="payment/adyen_abstract/live_endpoint_url_prefix" xsi:type="string">1</item>
<item name="payment/adyen_pos_cloud/pos_merchant_account" xsi:type="string">1</item>
<item name="payment/adyen_pos_cloud/api_key_test" xsi:type="string">1</item>
<item name="payment/adyen_pos_cloud/api_key_live" xsi:type="string">1</item>
<item name="payment/adyen_pos_cloud/pos_store_id" xsi:type="string">1</item>
<item name="payment/adyen_pay_by_mail/skin_code" xsi:type="string">1</item>
<item name="payment/adyen_pay_by_mail/hmac_test" xsi:type="string">1</item>
<item name="payment/adyen_pay_by_mail/hmac_live" xsi:type="string">1</item>
<item name="payment/adyen_apple_pay/merchant_identifier_test" xsi:type="string">1</item>
<item name="payment/adyen_apple_pay/merchant_identifier_live" xsi:type="string">1</item>
<item name="payment/adyen_google_pay/merchant_identifier" xsi:type="string">1</item>
</argument>
</arguments>
</type>
</config> </config>
...@@ -142,12 +142,13 @@ ...@@ -142,12 +142,13 @@
</div> </div>
</fieldset> </fieldset>
</form>
<div class="checkout-agreements-block"> <div class="checkout-agreements-block">
<!-- ko foreach: $parent.getRegion('before-place-order') --> <!-- ko foreach: $parent.getRegion('before-place-order') -->
<!-- ko template: getTemplate() --><!-- /ko --> <!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko--> <!--/ko-->
</div> </div>
<div class="actions-toolbar"> <div class="actions-toolbar">
<div class="primary"> <div class="primary">
<button class="action primary checkout" <button class="action primary checkout"
...@@ -163,6 +164,7 @@ ...@@ -163,6 +164,7 @@
</button> </button>
</div> </div>
</div> </div>
</form>
</div> </div>
</div> </div>
...@@ -114,7 +114,6 @@ ...@@ -114,7 +114,6 @@
<!-- /ko --> <!-- /ko -->
</fieldset> </fieldset>
</form>
<div class="checkout-agreements-block"> <div class="checkout-agreements-block">
<!-- ko foreach: $parent.getRegion('before-place-order') --> <!-- ko foreach: $parent.getRegion('before-place-order') -->
...@@ -122,7 +121,6 @@ ...@@ -122,7 +121,6 @@
<!--/ko--> <!--/ko-->
</div> </div>
<div class="actions-toolbar"> <div class="actions-toolbar">
<div class="primary"> <div class="primary">
<button class="action primary checkout" <button class="action primary checkout"
...@@ -135,6 +133,7 @@ ...@@ -135,6 +133,7 @@
</button> </button>
</div> </div>
</div> </div>
</form>
</div> </div>
</div> </div>
...@@ -55,13 +55,14 @@ ...@@ -55,13 +55,14 @@
<fieldset class="fieldset" data-bind='attr: {id: "payment_fieldset_" + $parent.getCode() + "_" + value}'> <fieldset class="fieldset" data-bind='attr: {id: "payment_fieldset_" + $parent.getCode() + "_" + value}'>
<div class="adyen-alternative-payment-container"></div> <div class="adyen-alternative-payment-container"></div>
</fieldset> </fieldset>
</form>
<div class="checkout-agreements-block"> <div class="checkout-agreements-block">
<!-- ko foreach: $parents[1].getRegion('before-place-order') --> <!-- ko foreach: $parents[1].getRegion('before-place-order') -->
<!-- ko template: getTemplate() --><!-- /ko --> <!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko--> <!--/ko-->
</div> </div>
<div> <div>
<span class="message message-error error hpp-message" data-bind="attr: {id: 'messages-' + value}"></span> <span class="message message-error error hpp-message" data-bind="attr: {id: 'messages-' + value}"></span>
</div> </div>
...@@ -70,12 +71,16 @@ ...@@ -70,12 +71,16 @@
<div class="primary"> <div class="primary">
<button class="action primary checkout" <button class="action primary checkout"
type="submit" type="submit"
data-bind="click: $parent.continueToAdyenBrandCode, enable: placeOrderAllowed() && (value == $parent.isBrandCodeChecked())" data-bind="
click: $parent.continueToAdyenBrandCode,
enable: placeOrderAllowed() && (value == $parent.isBrandCodeChecked()),
css: {disabled: !$parent.isPlaceOrderActionAllowed()}"
disabled> disabled>
<span data-bind="text: $t('Place Order')"></span> <span data-bind="text: $t('Place Order')"></span>
</button> </button>
</div> </div>
</div> </div>
</form>
</div> </div>
</div> </div>
<!--/ko--> <!--/ko-->
...@@ -81,12 +81,13 @@ ...@@ -81,12 +81,13 @@
</div> </div>
</fieldset> </fieldset>
</form>
<div class="checkout-agreements-block"> <div class="checkout-agreements-block">
<!-- ko foreach: $parents[1].getRegion('before-place-order') --> <!-- ko foreach: $parents[1].getRegion('before-place-order') -->
<!-- ko template: getTemplate() --><!-- /ko --> <!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko--> <!--/ko-->
</div> </div>
<div class="actions-toolbar"> <div class="actions-toolbar">
<div class="primary"> <div class="primary">
<button class="action primary checkout" <button class="action primary checkout"
...@@ -100,6 +101,7 @@ ...@@ -100,6 +101,7 @@
</button> </button>
</div> </div>
</div> </div>
</form>
</div> </div>
</div> </div>
<!--/ko--> <!--/ko-->
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