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 17482425 authored by Rik ter Beek's avatar Rik ter Beek Committed by GitHub

Merge pull request #375 from Adyen/develop

Release 3.0.0
parents 1545004a 3185f2bf
<?php
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Payment Module
*
* Copyright (c) 2018 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*
* Author: Adyen <magento@adyen.com>
*/
namespace Adyen\Payment\AdminMessage;
class APIKeyMessage implements \Magento\Framework\Notification\MessageInterface
{
/**
* @var \Adyen\Payment\Helper\Data
*/
protected $adyenHelper;
/**
* @var \Magento\AdminNotification\Model\InboxFactory
*/
protected $inboxFactory;
/**
* @var \Magento\Store\Model\StoreManagerInterface
*/
protected $storeManagerInterface;
/**
* @var \Magento\Backend\Model\Auth\Session
*/
protected $authSession;
const MESSAGE_IDENTITY = 'Adyen API Key Control message';
/**
* APIKeyMessage constructor.
*
* @param \Adyen\Payment\Helper\Data $adyenHelper
* @param \Magento\AdminNotification\Model\InboxFactory $inboxFactory
* @param \Magento\Store\Model\StoreManagerInterface $storeManagerInterface
* @param \Magento\Backend\Model\Auth\Session $authSession
*/
public function __construct(
\Adyen\Payment\Helper\Data $adyenHelper,
\Magento\AdminNotification\Model\InboxFactory $inboxFactory,
\Magento\Store\Model\StoreManagerInterface $storeManagerInterface,
\Magento\Backend\Model\Auth\Session $authSession
) {
$this->adyenHelper = $adyenHelper;
$this->inboxFactory = $inboxFactory;
$this->storeManagerInterface = $storeManagerInterface;
$this->authSession = $authSession;
}
/**
* Retrieve unique system message identity
*
* @return string
*/
public function getIdentity()
{
return self::MESSAGE_IDENTITY;
}
/**
* Check whether the system message should be shown
*
* @return bool
*/
public function isDisplayed()
{
// Only execute the query the first time you access the Admin page
if ($this->authSession->isFirstPageAfterLogin() &&
!empty($this->adyenHelper->getWsUsername()) &&
empty($this->adyenHelper->getAPIKey())
) {
try {
$title = 'Adyen extension requires the API KEY!';
$messageData[] = [
'severity' => $this->getSeverity(),
'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',
];
/*
* The parse function checks if the $versionData message exists in the inbox,
* otherwise it will create it and add it to the inbox.
*/
$this->inboxFactory->create()->parse($messageData);
return true;
} catch (\Exception $e) {
return false;
}
}
return false;
}
/**
* Retrieve system message text
*
* @return string
* @throws \Magento\Framework\Exception\NoSuchEntityException
*/
public function getText()
{
return 'Please provide API-KEY for the webservice user ' .
$this->adyenHelper->getWsUsername() . ' for default/store ' .
$this->storeManagerInterface->getStore()->getName();
}
/**
* Retrieve system message severity
*
* @return int
*/
public function getSeverity()
{
return self::SEVERITY_CRITICAL;
}
}
...@@ -30,27 +30,20 @@ class Cc extends \Magento\Payment\Block\Form\Cc ...@@ -30,27 +30,20 @@ class Cc extends \Magento\Payment\Block\Form\Cc
*/ */
protected $_template = 'Adyen_Payment::form/cc.phtml'; protected $_template = 'Adyen_Payment::form/cc.phtml';
/**
* Payment config model
*
* @var \Magento\Payment\Model\Config
*/
protected $_paymentConfig;
/** /**
* @var \Adyen\Payment\Helper\Data * @var \Adyen\Payment\Helper\Data
*/ */
protected $_adyenHelper; protected $adyenHelper;
/** /**
* @var \Magento\Framework\App\State * @var \Magento\Framework\App\State
*/ */
protected $_appState; protected $appState;
/** /**
* @var \Magento\Checkout\Model\Session * @var \Magento\Checkout\Model\Session
*/ */
protected $_checkoutSession; protected $checkoutSession;
/** /**
* Cc constructor. * Cc constructor.
...@@ -69,27 +62,35 @@ class Cc extends \Magento\Payment\Block\Form\Cc ...@@ -69,27 +62,35 @@ class Cc extends \Magento\Payment\Block\Form\Cc
array $data = [] array $data = []
) { ) {
parent::__construct($context, $paymentConfig); parent::__construct($context, $paymentConfig);
$this->_adyenHelper = $adyenHelper; $this->adyenHelper = $adyenHelper;
$this->_appState = $context->getAppState(); $this->appState = $context->getAppState();
$this->_checkoutSession = $checkoutSession; $this->checkoutSession = $checkoutSession;
} }
/**
* @return string
*/
public function getCheckoutCardComponentJs()
{
return $this->adyenHelper->getCheckoutCardComponentJs($this->checkoutSession->getQuote()->getStore()->getId());
}
/** /**
* @return mixed * @return string
* @throws \Magento\Framework\Exception\LocalizedException * @throws \Adyen\AdyenException
*/ */
public function getLibrarySource() public function getCheckoutOriginKeys()
{ {
// get storeId for admin return $this->adyenHelper->getOriginKeyForBaseUrl();
if (!$this->_appState->getAreaCode() === \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) { }
$storeId = $this->_storeManager->getStore()->getId();
} else {
$storeId = null;
}
return $this->_adyenHelper->getLibrarySource($storeId); /**
} * @return string
*/
public function getCheckoutContextUrl()
{
return $this->adyenHelper->getCheckoutContextUrl($this->checkoutSession->getQuote()->getStore()->getId());
}
/** /**
* Retrieve has verification configuration * Retrieve has verification configuration
...@@ -99,14 +100,45 @@ class Cc extends \Magento\Payment\Block\Form\Cc ...@@ -99,14 +100,45 @@ class Cc extends \Magento\Payment\Block\Form\Cc
public function hasVerification() public function hasVerification()
{ {
// if backend order and moto payments is turned on don't show cvc // if backend order and moto payments is turned on don't show cvc
if ($this->_appState->getAreaCode() === \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) { if ($this->appState->getAreaCode() === \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) {
$this->getCheckoutSession(); $this->getCheckoutSession();
$store = $this->_checkoutSession->getQuote()->getStore(); $store = $this->checkoutSession->getQuote()->getStore();
$enableMoto = $this->_adyenHelper->getAdyenCcConfigDataFlag('enable_moto', $store->getId()); $enableMoto = $this->adyenHelper->getAdyenCcConfigDataFlag('enable_moto', $store->getId());
if ($enableMoto) { if ($enableMoto) {
return false; return false;
} }
} }
return true; return true;
} }
/**
* @return string
*/
public function getLocale()
{
return $this->adyenHelper->getStoreLocale($this->checkoutSession->getQuote()->getStore()->getId());
}
/**
* Retrieve availables credit card type codes by alt code
*
* @return array
*/
public function getCcAvailableTypesByAlt()
{
$types = [];
$ccTypes = $this->adyenHelper->getAdyenCcTypes();
$availableTypes = $this->adyenHelper->getAdyenCcConfigData('cctypes');
if ($availableTypes) {
$availableTypes = explode(',', $availableTypes);
foreach (array_keys($ccTypes) as $code) {
if (in_array($code, $availableTypes)) {
$types[$ccTypes[$code]['code_alt']] = $code;
}
}
}
return $types;
}
} }
...@@ -68,7 +68,7 @@ class Oneclick extends \Adyen\Payment\Block\Form\Cc ...@@ -68,7 +68,7 @@ class Oneclick extends \Adyen\Payment\Block\Form\Cc
// For backend only allow recurring payments // For backend only allow recurring payments
$recurringType = \Adyen\Payment\Model\RecurringType::RECURRING; $recurringType = \Adyen\Payment\Model\RecurringType::RECURRING;
$cards = $this->_adyenHelper->getOneClickPaymentMethods($customerId, $storeId, $grandTotal, $recurringType); $cards = $this->adyenHelper->getOneClickPaymentMethods($customerId, $storeId, $grandTotal, $recurringType);
return $cards; return $cards;
} }
......
This diff is collapsed.
...@@ -235,9 +235,7 @@ class Redirect extends \Magento\Payment\Block\Form ...@@ -235,9 +235,7 @@ class Redirect extends \Magento\Payment\Block\Form
); );
$formFields['shopperEmail'] = $shopperEmail; $formFields['shopperEmail'] = $shopperEmail;
// recurring // recurring
$recurringType = trim($this->_adyenHelper->getAdyenAbstractConfigData( $recurringType = $this->_adyenHelper->getRecurringTypeFromOneclickRecurringSetting();
'recurring_type'
));
$brandCode = $this->_order->getPayment()->getAdditionalInformation( $brandCode = $this->_order->getPayment()->getAdditionalInformation(
\Adyen\Payment\Observer\AdyenHppDataAssignObserver::BRAND_CODE \Adyen\Payment\Observer\AdyenHppDataAssignObserver::BRAND_CODE
); );
......
<?php
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Payment module (https://www.adyen.com/)
*
* Copyright (c) 2015 Adyen BV (https://www.adyen.com/)
* See LICENSE.txt for license details.
*
* Author: Adyen <magento@adyen.com>
*/
namespace Adyen\Payment\Controller\Process;
class RedirectPos extends \Magento\Framework\App\Action\Action
{
/**
* @var \Magento\Quote\Model\Quote
*/
protected $_quote = false;
/**
* @var \Magento\Checkout\Model\Session
*/
protected $_checkoutSession;
/**
* @var \Magento\Sales\Model\Order
*/
protected $_order;
/**
* @var \Magento\Sales\Model\OrderFactory
*/
protected $_orderFactory;
/**
* @param \Magento\Framework\App\Action\Context $context
*/
public function __construct(
\Magento\Framework\App\Action\Context $context
) {
parent::__construct($context);
}
/**
* Return checkout session object
*
* @return \Magento\Checkout\Model\Session
*/
protected function _getCheckoutSession()
{
return $this->_checkoutSession;
}
public function execute()
{
$this->_view->loadLayout();
$this->_view->getLayout()->initMessages();
$this->_view->renderLayout();
}
/**
* Get order object
*
* @return \Magento\Sales\Model\Order
*/
protected function _getOrder()
{
if (!$this->_order) {
$incrementId = $this->_getCheckout()->getLastRealOrderId();
$this->_orderFactory = $this->_objectManager->get('Magento\Sales\Model\OrderFactory');
$this->_order = $this->_orderFactory->create()->loadByIncrementId($incrementId);
}
return $this->_order;
}
/**
* @return \Magento\Checkout\Model\Session
*/
protected function _getCheckout()
{
return $this->_objectManager->get('Magento\Checkout\Model\Session');
}
/**
* @return mixed
*/
protected function _getQuote()
{
return $this->_objectManager->get('Magento\Quote\Model\Quote');
}
/**
* @return mixed
*/
protected function _getQuoteManagement()
{
return $this->_objectManager->get('\Magento\Quote\Model\QuoteManagement');
}
}
...@@ -183,7 +183,7 @@ class PayByMailCommand implements CommandInterface ...@@ -183,7 +183,7 @@ class PayByMailCommand implements CommandInterface
$formFields['shopperEmail'] = $shopperEmail; $formFields['shopperEmail'] = $shopperEmail;
// recurring // recurring
$recurringType = trim($this->_adyenHelper->getAdyenAbstractConfigData('recurring_type', $storeId)); $recurringType = $this->_adyenHelper->getRecurringTypeFromOneclickRecurringSetting($storeId);
$sessionValidity = $this->_adyenHelper->getAdyenPayByMailConfigData('session_validity', $storeId); $sessionValidity = $this->_adyenHelper->getAdyenPayByMailConfigData('session_validity', $storeId);
......
...@@ -20,14 +20,15 @@ ...@@ -20,14 +20,15 @@
* *
* Author: Adyen <magento@adyen.com> * Author: Adyen <magento@adyen.com>
*/ */
namespace Adyen\Payment\Gateway\Request;
use Magento\Payment\Gateway\Request\BuilderInterface; namespace Adyen\Payment\Gateway\Http\Client;
use Magento\Payment\Gateway\Http\ClientInterface;
/** /**
* Payment Data Builder * Class TransactionSale
*/ */
class Authorize3DSecureDataBuilder implements BuilderInterface class TransactionPayment implements ClientInterface
{ {
/** /**
...@@ -35,30 +36,36 @@ class Authorize3DSecureDataBuilder implements BuilderInterface ...@@ -35,30 +36,36 @@ class Authorize3DSecureDataBuilder implements BuilderInterface
*/ */
private $adyenHelper; private $adyenHelper;
/** /**
* PaymentDataBuilder constructor. * TransactionPayment constructor.
*
* @param \Adyen\Payment\Helper\Data $adyenHelper * @param \Adyen\Payment\Helper\Data $adyenHelper
*/ */
public function __construct(\Adyen\Payment\Helper\Data $adyenHelper) public function __construct(
{ \Adyen\Payment\Helper\Data $adyenHelper
) {
$this->adyenHelper = $adyenHelper; $this->adyenHelper = $adyenHelper;
} }
/** /**
* @param array $buildSubject * @param \Magento\Payment\Gateway\Http\TransferInterface $transferObject
* @return array * @return mixed
* @throws ClientException
*/ */
public function build(array $buildSubject) public function placeRequest(\Magento\Payment\Gateway\Http\TransferInterface $transferObject)
{ {
/** @var \Magento\Payment\Gateway\Data\PaymentDataObject $paymentDataObject */ $request = $transferObject->getBody();
$paymentDataObject = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($buildSubject);
$payment = $paymentDataObject->getPayment(); $client = $this->adyenHelper->initializeAdyenClient();
$md = $payment->getAdditionalInformation('md');
$paResponse = $payment->getAdditionalInformation('paResponse'); $service = new \Adyen\Service\Checkout($client);
return [
"md" => $md, try {
"paResponse" => $paResponse, $response = $service->payments($request);
]; } catch (\Adyen\AdyenException $e) {
$response['error'] = $e->getMessage();
}
return $response;
} }
} }
...@@ -65,13 +65,38 @@ class CcAuthorizationDataBuilder implements BuilderInterface ...@@ -65,13 +65,38 @@ class CcAuthorizationDataBuilder implements BuilderInterface
$storeId = $order->getStoreId(); $storeId = $order->getStoreId();
$request = []; $request = [];
// If ccType is set use this. For bcmc you need bcmc otherwise it will fail
$request['paymentMethod']['type'] = "scheme";
if ($variant = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::VARIANT)) {
$request['paymentMethod']['type'] = $variant;
}
$request['additionalData']['card.encrypted.json'] = if ($cardNumber = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::ENCRYPTED_CREDIT_CARD_NUMBER)) {
$payment->getAdditionalInformation(AdyenCcDataAssignObserver::ENCRYPTED_DATA); $request['paymentMethod']['encryptedCardNumber'] = $cardNumber;
}
// Remove from additional data if ($expiryMonth = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::ENCRYPTED_EXPIRY_MONTH)) {
$payment->unsAdditionalInformation(AdyenCcDataAssignObserver::ENCRYPTED_DATA); $request['paymentMethod']['encryptedExpiryMonth'] = $expiryMonth;
}
if ($expiryYear = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::ENCRYPTED_EXPIRY_YEAR)) {
$request['paymentMethod']['encryptedExpiryYear'] = $expiryYear;
}
if ($holderName = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::HOLDER_NAME)) {
$request['paymentMethod']['holderName'] = $holderName;
}
if ($securityCode = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::ENCRYPTED_SECURITY_CODE)) {
$request['paymentMethod']['encryptedSecurityCode'] = $securityCode;
}
// Remove from additional data
$payment->unsAdditionalInformation(AdyenCcDataAssignObserver::ENCRYPTED_CREDIT_CARD_NUMBER);
$payment->unsAdditionalInformation(AdyenCcDataAssignObserver::ENCRYPTED_EXPIRY_MONTH);
$payment->unsAdditionalInformation(AdyenCcDataAssignObserver::ENCRYPTED_EXPIRY_YEAR);
$payment->unsAdditionalInformation(AdyenCcDataAssignObserver::ENCRYPTED_SECURITY_CODE);
$payment->unsAdditionalInformation(AdyenCcDataAssignObserver::HOLDER_NAME);
/** /**
* if MOTO for backend is enabled use MOTO as shopper interaction type * if MOTO for backend is enabled use MOTO as shopper interaction type
...@@ -83,10 +108,10 @@ class CcAuthorizationDataBuilder implements BuilderInterface ...@@ -83,10 +108,10 @@ class CcAuthorizationDataBuilder implements BuilderInterface
$request['shopperInteraction'] = "Moto"; $request['shopperInteraction'] = "Moto";
} }
// if installments is set add it into the request // if installments is set add it into the request
if ($payment->getAdditionalInformation('number_of_installments') && if ($payment->getAdditionalInformation(AdyenCcDataAssignObserver::NUMBER_OF_INSTALLMENTS) &&
$payment->getAdditionalInformation('number_of_installments') > 0 $payment->getAdditionalInformation(AdyenCcDataAssignObserver::NUMBER_OF_INSTALLMENTS) > 0
) { ) {
$request['installments']['value'] = $payment->getAdditionalInformation('number_of_installments'); $request['installments']['value'] = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::NUMBER_OF_INSTALLMENTS);
} }
return $request; return $request;
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
namespace Adyen\Payment\Gateway\Request; namespace Adyen\Payment\Gateway\Request;
use Adyen\Payment\Observer\AdyenOneclickDataAssignObserver;
use Magento\Payment\Gateway\Request\BuilderInterface; use Magento\Payment\Gateway\Request\BuilderInterface;
class OneclickAuthorizationDataBuilder implements BuilderInterface class OneclickAuthorizationDataBuilder implements BuilderInterface
...@@ -53,7 +54,6 @@ class OneclickAuthorizationDataBuilder implements BuilderInterface ...@@ -53,7 +54,6 @@ class OneclickAuthorizationDataBuilder implements BuilderInterface
/** @var \Magento\Payment\Gateway\Data\PaymentDataObject $paymentDataObject */ /** @var \Magento\Payment\Gateway\Data\PaymentDataObject $paymentDataObject */
$paymentDataObject = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($buildSubject); $paymentDataObject = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($buildSubject);
$payment = $paymentDataObject->getPayment(); $payment = $paymentDataObject->getPayment();
$recurringDetailReference = $payment->getAdditionalInformation("recurring_detail_reference");
if ($payment->getAdditionalInformation('customer_interaction')) { if ($payment->getAdditionalInformation('customer_interaction')) {
$shopperInteraction = "Ecommerce"; $shopperInteraction = "Ecommerce";
...@@ -61,8 +61,8 @@ class OneclickAuthorizationDataBuilder implements BuilderInterface ...@@ -61,8 +61,8 @@ class OneclickAuthorizationDataBuilder implements BuilderInterface
$shopperInteraction = "ContAuth"; $shopperInteraction = "ContAuth";
} }
$request['selectedRecurringDetailReference'] = $recurringDetailReference;
$request['shopperInteraction'] = $shopperInteraction; $request['shopperInteraction'] = $shopperInteraction;
$request['paymentMethod']['recurringDetailReference'] = $payment->getAdditionalInformation(AdyenOneclickDataAssignObserver::RECURRING_DETAIL_REFERENCE);
// if it is a sepadirectdebit set selectedBrand to sepadirectdebit in the case of oneclick // if it is a sepadirectdebit set selectedBrand to sepadirectdebit in the case of oneclick
if ($payment->getCcType() == "sepadirectdebit") { if ($payment->getCcType() == "sepadirectdebit") {
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
* *
* Author: Adyen <magento@adyen.com> * Author: Adyen <magento@adyen.com>
*/ */
namespace Adyen\Payment\Gateway\Request; namespace Adyen\Payment\Gateway\Request;
use Magento\Payment\Gateway\Request\BuilderInterface; use Magento\Payment\Gateway\Request\BuilderInterface;
...@@ -50,9 +51,11 @@ class RecurringDataBuilder implements BuilderInterface ...@@ -50,9 +51,11 @@ class RecurringDataBuilder implements BuilderInterface
$this->appState = $context->getAppState(); $this->appState = $context->getAppState();
} }
/** /**
* @param array $buildSubject * @param array $buildSubject
* @return array * @return array
* @throws \Magento\Framework\Exception\LocalizedException
*/ */
public function build(array $buildSubject) public function build(array $buildSubject)
{ {
...@@ -61,45 +64,29 @@ class RecurringDataBuilder implements BuilderInterface ...@@ -61,45 +64,29 @@ class RecurringDataBuilder implements BuilderInterface
/** @var \Magento\Payment\Gateway\Data\PaymentDataObject $paymentDataObject */ /** @var \Magento\Payment\Gateway\Data\PaymentDataObject $paymentDataObject */
$paymentDataObject = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($buildSubject); $paymentDataObject = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($buildSubject);
$payment = $paymentDataObject->getPayment(); $payment = $paymentDataObject->getPayment();
// Needs to change when oneclick,cc using facade impl.
$paymentMethodCode = $payment->getMethodInstance()->getCode();
$customerId = $payment->getOrder()->getCustomerId();
$storeId = null; $storeId = null;
if ($this->appState->getAreaCode() === \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) { if ($this->appState->getAreaCode() === \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) {
$storeId = $payment->getOrder()->getStoreId(); $storeId = $payment->getOrder()->getStoreId();
} }
$recurringType = $this->adyenHelper->getAdyenAbstractConfigData('recurring_type', $storeId);
$enableOneclick = $this->adyenHelper->getAdyenAbstractConfigData('enable_oneclick', $storeId);
// set the recurring type $enableRecurring = $this->adyenHelper->getAdyenAbstractConfigData('enable_recurring', $storeId);
$recurringContractType = null;
if ($recurringType) { if ($enableOneclick) {
if ($paymentMethodCode == \Adyen\Payment\Model\Ui\AdyenOneclickConfigProvider::CODE) { $result['enableOneClick'] = true;
/* } else {
* For ONECLICK look at the recurringPaymentType that the merchant $result['enableOneClick'] = false;
* has selected in Adyen ONECLICK settings }
*/
if ($payment->getAdditionalInformation('customer_interaction')) { if ($enableRecurring) {
$recurringContractType = \Adyen\Payment\Model\RecurringType::ONECLICK; $result['enableRecurring'] = true;
} else { } else {
$recurringContractType = \Adyen\Payment\Model\RecurringType::RECURRING; $result['enableRecurring'] = false;
}
} elseif ($paymentMethodCode == \Adyen\Payment\Model\Ui\AdyenCcConfigProvider::CODE) {
if ($payment->getAdditionalInformation("store_cc") == "" &&
($recurringType == "ONECLICK,RECURRING" || $recurringType == "RECURRING")) {
$recurringContractType = \Adyen\Payment\Model\RecurringType::RECURRING;
} elseif ($payment->getAdditionalInformation("store_cc") == "1") {
$recurringContractType = $recurringType;
}
} else {
$recurringContractType = $recurringType;
}
} }
// only when recurringContractType is set and when a customer is loggedIn if ($payment->getAdditionalInformation('store_cc') === '1') {
if ($recurringContractType && $customerId > 0) { $result['paymentMethod']['storeDetails'] = true;
$recurring = ['contract' => $recurringContractType];
$result['recurring'] = $recurring;
} }
return $result; return $result;
......
...@@ -38,17 +38,11 @@ class SepaAuthorizationDataBuilder implements BuilderInterface ...@@ -38,17 +38,11 @@ class SepaAuthorizationDataBuilder implements BuilderInterface
$payment = $paymentDataObject->getPayment(); $payment = $paymentDataObject->getPayment();
$request = []; $request = [];
// set brand to sepa // add bankDetails into request
$request['selectedBrand'] = "sepadirectdebit"; $request['paymentMethod']['type'] = "sepadirectdebit";
$request['paymentMethod']['sepa.ibanNumber'] = $payment->getAdditionalInformation("iban");
// add bankDetails into request $request['paymentMethod']['sepa.ownerName'] = $payment->getAdditionalInformation("account_name");
$bankAccount = [ $request['paymentMethod']['countryCode'] = $payment->getAdditionalInformation("country");
'iban' => $payment->getAdditionalInformation("iban"),
'ownerName' => $payment->getAdditionalInformation("account_name"),
'countryCode' => $payment->getAdditionalInformation("country")
];
$request['bankAccount'] = $bankAccount;
return $request; return $request;
} }
......
...@@ -21,46 +21,55 @@ ...@@ -21,46 +21,55 @@
* Author: Adyen <magento@adyen.com> * Author: Adyen <magento@adyen.com>
*/ */
namespace Adyen\Payment\Gateway\Command; namespace Adyen\Payment\Gateway\Response;
use Magento\Payment\Gateway\Command; use Magento\Payment\Gateway\Response\HandlerInterface;
use Magento\Payment\Gateway\CommandInterface;
class PosCommand implements CommandInterface class CheckoutPaymentCommentHistoryHandler implements HandlerInterface
{ {
/** /**
* @var \Adyen\Payment\Helper\Data * @param array $handlingSubject
*/ * @param array $response
protected $_adyenHelper;
/**
* HppCommand constructor.
*
* @param \Adyen\Payment\Helper\Data $adyenHelper
*/
public function __construct(\Adyen\Payment\Helper\Data $adyenHelper)
{
$this->_adyenHelper = $adyenHelper;
}
/**
* @param array $commandSubject
* @return $this * @return $this
*/ */
public function execute(array $commandSubject) public function handle(array $handlingSubject, array $response)
{ {
$payment =\Magento\Payment\Gateway\Helper\SubjectReader::readPayment($commandSubject); $payment = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($handlingSubject);
$stateObject = \Magento\Payment\Gateway\Helper\SubjectReader::readStateObject($commandSubject);
// do not send email /** @var OrderPaymentInterface $payment */
$payment = $payment->getPayment(); $payment = $payment->getPayment();
$payment->getOrder()->setCanSendNewEmailFlag(false);
// update status and state $comment = __("Adyen Result response:");
$stateObject->setState(\Magento\Sales\Model\Order::STATE_NEW);
$stateObject->setStatus($this->_adyenHelper->getAdyenAbstractConfigData('order_status')); if (isset($response['resultCode'])) {
$stateObject->setIsNotified(false); $responseCode = $response['resultCode'];
} else {
// try to get response from response key (used for modifications
if (isset($response['response'])) {
$responseCode = $response['response'];
} else {
$responseCode = "";
}
}
if (isset($response['pspReference'])) {
$pspReference = $response['pspReference'];
} else {
$pspReference = "";
}
if ($responseCode) {
$comment .= '<br /> ' . __('authResult:') . ' ' . $responseCode;
$payment->getOrder()->setAdyenResulturlEventCode($responseCode);
}
if ($pspReference) {
$comment .= '<br /> ' . __('pspReference:') . ' ' . $pspReference;
}
$payment->getOrder()->addStatusHistoryComment($comment);
return $this; return $this;
} }
} }
...@@ -21,87 +21,59 @@ ...@@ -21,87 +21,59 @@
* Author: Adyen <magento@adyen.com> * Author: Adyen <magento@adyen.com>
*/ */
namespace Adyen\Payment\Model\Ui; namespace Adyen\Payment\Gateway\Response;
use Magento\Checkout\Model\ConfigProviderInterface; use Magento\Payment\Gateway\Response\HandlerInterface;
use Magento\Payment\Helper\Data as PaymentHelper;
use Magento\Directory\Helper\Data;
class AdyenPosConfigProvider implements ConfigProviderInterface class CheckoutPaymentsDetailsHandler implements HandlerInterface
{ {
const CODE = 'adyen_pos';
/**
* @var PaymentHelper
*/
protected $_paymentHelper;
/** /**
* @var \Adyen\Payment\Helper\Data * @var \Adyen\Payment\Helper\Data
*/ */
protected $_adyenHelper; protected $adyenHelper;
/**
* Request object
*
* @var \Magento\Framework\App\RequestInterface
*/
protected $_request;
/**
* @var \Magento\Framework\UrlInterface
*/
protected $_urlBuilder;
/**
* AdyenHppConfigProvider constructor.
*
* @param PaymentHelper $paymentHelper
* @param \Adyen\Payment\Helper\Data $adyenHelper
*/
public function __construct( public function __construct(
PaymentHelper $paymentHelper, \Adyen\Payment\Helper\Data $adyenHelper
\Adyen\Payment\Helper\Data $adyenHelper,
\Magento\Framework\App\RequestInterface $request,
\Magento\Framework\UrlInterface $urlBuilder
) { ) {
$this->_paymentHelper = $paymentHelper; $this->adyenHelper = $adyenHelper;
$this->_adyenHelper = $adyenHelper;
$this->_request = $request;
$this->_urlBuilder = $urlBuilder;
} }
/** /**
* Set configuration for AdyenHPP payemnt method * @param array $handlingSubject
* * @param array $response
* @return array
*/ */
public function getConfig() public function handle(array $handlingSubject, array $response)
{ {
// set to active $payment = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($handlingSubject);
$config = [
'payment' => [
self::CODE => [
'isActive' => true,
'redirectUrl' => $this->_urlBuilder->getUrl(
'adyen/process/redirectPos',
['_secure' => $this->_getRequest()->isSecure()]
)
]
]
];
return $config; /** @var OrderPaymentInterface $payment */
} $payment = $payment->getPayment();
/** // set transaction not to processing by default wait for notification
* Retrieve request object $payment->setIsTransactionPending(true);
*
* @return \Magento\Framework\App\RequestInterface // no not send order confirmation mail
*/ $payment->getOrder()->setCanSendNewEmailFlag(false);
protected function _getRequest()
{ if (!empty($response['pspReference'])) {
return $this->_request; // set pspReference as transactionId
$payment->setCcTransId($response['pspReference']);
$payment->setLastTransId($response['pspReference']);
// set transaction
$payment->setTransactionId($response['pspReference']);
}
if (!empty($response['additionalData']['recurring.recurringDetailReference'])
) {
$order = $payment->getOrder();
$this->adyenHelper->createAdyenBillingAgreement($order, $response['additionalData']);
}
// do not close transaction so you can do a cancel() and void
$payment->setIsTransactionClosed(false);
$payment->setShouldCloseParentTransaction(false);
} }
} }
...@@ -40,7 +40,7 @@ class PaymentPosCloudHandler implements HandlerInterface ...@@ -40,7 +40,7 @@ class PaymentPosCloudHandler implements HandlerInterface
private $adyenLogger; private $adyenLogger;
/** /**
* PaymentDataBuilder constructor. * PaymentPosCloudHandler constructor.
* *
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger * @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
* @param \Adyen\Payment\Helper\Data $adyenHelper * @param \Adyen\Payment\Helper\Data $adyenHelper
...@@ -74,6 +74,41 @@ class PaymentPosCloudHandler implements HandlerInterface ...@@ -74,6 +74,41 @@ class PaymentPosCloudHandler implements HandlerInterface
// do not send order confirmation mail // do not send order confirmation mail
$payment->getOrder()->setCanSendNewEmailFlag(false); $payment->getOrder()->setCanSendNewEmailFlag(false);
if (!empty($paymentResponse['Response']['AdditionalResponse'])
) {
$pairs = explode('&', $paymentResponse['Response']['AdditionalResponse']);
foreach ($pairs as $pair) {
$nv = explode('=', $pair);
if ($nv[0] == 'recurring.recurringDetailReference') {
$recurringDetailReference = $nv[1];
break;
}
}
if (!empty($recurringDetailReference) &&
!empty($paymentResponse['PaymentResult']['PaymentInstrumentData']['CardData'])
) {
$maskedPan = $paymentResponse['PaymentResult']['PaymentInstrumentData']['CardData']['MaskedPan'];
$expiryDate = $paymentResponse['PaymentResult']['PaymentInstrumentData']['CardData']['SensitiveCardData']['ExpiryDate']; // 1225
$expiryDate = substr($expiryDate, 0, 2) . '/' . substr($expiryDate, 2, 2);
$brand = $paymentResponse['PaymentResult']['PaymentInstrumentData']['CardData']['PaymentBrand'];
// create additionalData so we can use the helper
$additionalData = [];
$additionalData['recurring.recurringDetailReference'] = $recurringDetailReference;
$additionalData['cardBin'] = $recurringDetailReference;
$additionalData['cardHolderName'] = '';
$additionalData['cardSummary'] = substr($maskedPan, -4);
$additionalData['expiryDate'] = $expiryDate;
$additionalData['paymentMethod'] = $brand;
$additionalData['recurring.recurringDetailReference'] = $recurringDetailReference;
$additionalData['pos_payment'] = true;
$this->adyenHelper->createAdyenBillingAgreement($payment->getOrder(), $additionalData);
}
}
// set transaction(status) // set transaction(status)
if (!empty($paymentResponse['PaymentResult']['PaymentAcquirerData']['AcquirerTransactionID']['TransactionID'])) { if (!empty($paymentResponse['PaymentResult']['PaymentAcquirerData']['AcquirerTransactionID']['TransactionID'])) {
$pspReference = $paymentResponse['PaymentResult']['PaymentAcquirerData']['AcquirerTransactionID']['TransactionID']; $pspReference = $paymentResponse['PaymentResult']['PaymentAcquirerData']['AcquirerTransactionID']['TransactionID'];
......
<?php
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Payment module (https://www.adyen.com/)
*
* Copyright (c) 2015 Adyen BV (https://www.adyen.com/)
* See LICENSE.txt for license details.
*
* Author: Adyen <magento@adyen.com>
*/
namespace Adyen\Payment\Gateway\Validator;
use Magento\Payment\Gateway\Validator\AbstractValidator;
class CheckoutResponseValidator extends AbstractValidator
{
/**
* @var \Adyen\Payment\Logger\AdyenLogger
*/
private $adyenLogger;
/**
* GeneralResponseValidator constructor.
*
* @param \Magento\Payment\Gateway\Validator\ResultInterfaceFactory $resultFactory
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
*/
public function __construct(
\Magento\Payment\Gateway\Validator\ResultInterfaceFactory $resultFactory,
\Adyen\Payment\Logger\AdyenLogger $adyenLogger
) {
$this->adyenLogger = $adyenLogger;
parent::__construct($resultFactory);
}
/**
* @param array $validationSubject
* @return \Magento\Payment\Gateway\Validator\ResultInterface
*/
public function validate(array $validationSubject)
{
$response = \Magento\Payment\Gateway\Helper\SubjectReader::readResponse($validationSubject);
$paymentDataObjectInterface = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($validationSubject);
$payment = $paymentDataObjectInterface->getPayment();
$payment->setAdditionalInformation('3dActive', false);
$isValid = true;
$errorMessages = [];
// validate result
if (isset($response['resultCode'])) {
switch ($response['resultCode']) {
case "Authorised":
$payment->setAdditionalInformation('pspReference', $response['pspReference']);
break;
case "Received":
$payment->setAdditionalInformation('pspReference', $response['pspReference']);
// set additionalData
if (isset($response['additionalData']) && is_array($response['additionalData'])) {
$additionalData = $response['additionalData'];
if (isset($additionalData['boletobancario.dueDate'])) {
$payment->setAdditionalInformation(
'dueDate',
$additionalData['boletobancario.dueDate']
);
}
if (isset($additionalData['boletobancario.expirationDate'])) {
$payment->setAdditionalInformation(
'expirationDate',
$additionalData['boletobancario.expirationDate']
);
}
if (isset($additionalData['boletobancario.url'])) {
$payment->setAdditionalInformation(
'url',
$additionalData['boletobancario.url']
);
}
}
break;
case "RedirectShopper":
$payment->setAdditionalInformation('3dActive', true);
if (!empty($response['redirect']['data']['PaReq']) &&
!empty($response['redirect']['data']['MD']) &&
!empty($response['redirect']['url']) &&
!empty($response['paymentData'])
) {
$payment->setAdditionalInformation('issuerUrl', $response['redirect']['url']);
$payment->setAdditionalInformation('paRequest', $response['redirect']['data']['PaReq']);
$payment->setAdditionalInformation('md', $response['redirect']['data']['MD']);
$payment->setAdditionalInformation('paymentData', $response['paymentData']);
} else {
$isValid = false;
$errorMsg = __('3D secure is not valid.');
$this->adyenLogger->error($errorMsg);;
$errorMessages[] = $errorMsg;
}
break;
case "Refused":
$errorMsg = __('The payment is REFUSED.');
// this will result the specific error
throw new \Magento\Framework\Exception\LocalizedException(__($errorMsg));
break;
default:
$errorMsg = __('Error with payment method please select different payment method.');
throw new \Magento\Framework\Exception\LocalizedException(__($errorMsg));
break;
}
} else {
$errorMsg = __('Error with payment method please select different payment method.');
throw new \Magento\Framework\Exception\LocalizedException(__($errorMsg));
}
return $this->createResult($isValid, $errorMessages);
}
}
This diff is collapsed.
...@@ -27,6 +27,7 @@ namespace Adyen\Payment\Model; ...@@ -27,6 +27,7 @@ namespace Adyen\Payment\Model;
use Adyen\Payment\Api\AdyenInitiateTerminalApiInterface; use Adyen\Payment\Api\AdyenInitiateTerminalApiInterface;
use Adyen\Payment\Model\Ui\AdyenPosCloudConfigProvider; use Adyen\Payment\Model\Ui\AdyenPosCloudConfigProvider;
use Adyen\Util\Util; use Adyen\Util\Util;
use Magento\Quote\Model\Quote;
class AdyenInitiateTerminalApi implements AdyenInitiateTerminalApiInterface class AdyenInitiateTerminalApi implements AdyenInitiateTerminalApiInterface
{ {
...@@ -105,7 +106,6 @@ class AdyenInitiateTerminalApi implements AdyenInitiateTerminalApiInterface ...@@ -105,7 +106,6 @@ class AdyenInitiateTerminalApi implements AdyenInitiateTerminalApiInterface
$serviceID = date("dHis"); $serviceID = date("dHis");
$initiateDate = date("U"); $initiateDate = date("U");
$timeStamper = date("Y-m-d") . "T" . date("H:i:s+00:00"); $timeStamper = date("Y-m-d") . "T" . date("H:i:s+00:00");
$customerId = $quote->getCustomerId();
$request = [ $request = [
'SaleToPOIRequest' => 'SaleToPOIRequest' =>
...@@ -147,6 +147,8 @@ class AdyenInitiateTerminalApi implements AdyenInitiateTerminalApiInterface ...@@ -147,6 +147,8 @@ class AdyenInitiateTerminalApi implements AdyenInitiateTerminalApiInterface
], ],
]; ];
$customerId = $this->getCustomerId($quote);
// If customer exists add it into the request to store request // If customer exists add it into the request to store request
if (!empty($customerId)) { if (!empty($customerId)) {
$shopperEmail = $quote->getCustomerEmail(); $shopperEmail = $quote->getCustomerEmail();
...@@ -195,4 +197,16 @@ class AdyenInitiateTerminalApi implements AdyenInitiateTerminalApiInterface ...@@ -195,4 +197,16 @@ class AdyenInitiateTerminalApi implements AdyenInitiateTerminalApiInterface
$quote->save(); $quote->save();
return $response; return $response;
} }
/**
* This getter makes it possible to overwrite the customer id from other plugins
* Use this function to get the customer id so we can keep using this plugin in the UCD
*
* @param Quote $quote
* @return mixed
*/
public function getCustomerId(Quote $quote)
{
return $quote->getCustomerId();
}
} }
...@@ -98,29 +98,29 @@ class PaymentRequest extends DataObject ...@@ -98,29 +98,29 @@ class PaymentRequest extends DataObject
{ {
$order = $payment->getOrder(); $order = $payment->getOrder();
$storeId = $order->getStoreId(); $storeId = $order->getStoreId();
$merchantAccount = $this->_adyenHelper->getAdyenAbstractConfigData("merchant_account", $storeId);
$shopperIp = $order->getRemoteIp();
$md = $payment->getAdditionalInformation('md'); $md = $payment->getAdditionalInformation('md');
$paResponse = $payment->getAdditionalInformation('paResponse'); $paResponse = $payment->getAdditionalInformation('paResponse');
$paymentData = $payment->getAdditionalInformation('paymentData');
$browserInfo = ['userAgent' => $_SERVER['HTTP_USER_AGENT'], 'acceptHeader' => $_SERVER['HTTP_ACCEPT']];
$request = [ $request = [
"merchantAccount" => $merchantAccount, "paymentData" => $paymentData,
"browserInfo" => $browserInfo, "details" => [
"md" => $md, "MD" => $md,
"paResponse" => $paResponse, "PaRes" => $paResponse
"shopperIP" => $shopperIp ]
]; ];
try { try {
$client = $this->createClient($storeId); $client = $this->_adyenHelper->initializeAdyenClient($storeId);
$service = new \Adyen\Service\Payment($client); $service = new \Adyen\Service\Checkout($client);
$result = $service->authorise3D($request); $result = $service->paymentsDetails($request);
} catch (\Adyen\AdyenException $e) { } catch(\Adyen\AdyenException $e) {
throw new \Magento\Framework\Exception\LocalizedException(__('3D secure failed')); throw new \Magento\Framework\Exception\LocalizedException(__('3D secure failed'));
} }
$this->_adyenHelper->createAdyenBillingAgreement($order, $result['additionalData']);
return $result; return $result;
} }
......
...@@ -29,7 +29,7 @@ class Agreement extends \Magento\Paypal\Model\Billing\Agreement ...@@ -29,7 +29,7 @@ class Agreement extends \Magento\Paypal\Model\Billing\Agreement
/** /**
* @var \Adyen\Payment\Helper\Data * @var \Adyen\Payment\Helper\Data
*/ */
private $_adyenHelper; private $adyenHelper;
/** /**
* Agreement constructor. * Agreement constructor.
...@@ -66,7 +66,7 @@ class Agreement extends \Magento\Paypal\Model\Billing\Agreement ...@@ -66,7 +66,7 @@ class Agreement extends \Magento\Paypal\Model\Billing\Agreement
$data $data
); );
$this->_adyenHelper = $adyenHelper; $this->adyenHelper = $adyenHelper;
} }
/** /**
...@@ -80,6 +80,8 @@ class Agreement extends \Magento\Paypal\Model\Billing\Agreement ...@@ -80,6 +80,8 @@ class Agreement extends \Magento\Paypal\Model\Billing\Agreement
} }
/** /**
* for async store of billing agreement through the recurring_contract notification
*
* @param $data * @param $data
* @return $this * @return $this
*/ */
...@@ -90,7 +92,7 @@ class Agreement extends \Magento\Paypal\Model\Billing\Agreement ...@@ -90,7 +92,7 @@ class Agreement extends \Magento\Paypal\Model\Billing\Agreement
->setReferenceId($data['recurringDetailReference']) ->setReferenceId($data['recurringDetailReference'])
->setCreatedAt($data['creationDate']); ->setCreatedAt($data['creationDate']);
$creationDate = str_replace(' ', '-', $data['creationDate']); $creationDate = str_replace(' ', '-', $data['creationDate']);
$this->setCreatedAt($creationDate); $this->setCreatedAt($creationDate);
//Billing agreement SEPA //Billing agreement SEPA
...@@ -105,7 +107,7 @@ class Agreement extends \Magento\Paypal\Model\Billing\Agreement ...@@ -105,7 +107,7 @@ class Agreement extends \Magento\Paypal\Model\Billing\Agreement
// Billing agreement is CC // Billing agreement is CC
if (isset($data['card']['number'])) { if (isset($data['card']['number'])) {
$ccType = $data['variant']; $ccType = $data['variant'];
$ccTypes = $this->_adyenHelper->getCcTypesAltData(); $ccTypes = $this->adyenHelper->getCcTypesAltData();
if (isset($ccTypes[$ccType])) { if (isset($ccTypes[$ccType])) {
$ccType = $ccTypes[$ccType]['name']; $ccType = $ccTypes[$ccType]['name'];
...@@ -123,7 +125,7 @@ class Agreement extends \Magento\Paypal\Model\Billing\Agreement ...@@ -123,7 +125,7 @@ class Agreement extends \Magento\Paypal\Model\Billing\Agreement
} }
if ($data['variant'] == 'paypal') { if ($data['variant'] == 'paypal') {
$email = ""; $email = '';
if (isset($data['tokenDetails']['tokenData']['EmailId'])) { if (isset($data['tokenDetails']['tokenData']['EmailId'])) {
$email = $data['tokenDetails']['tokenData']['EmailId']; $email = $data['tokenDetails']['tokenData']['EmailId'];
...@@ -150,9 +152,7 @@ class Agreement extends \Magento\Paypal\Model\Billing\Agreement ...@@ -150,9 +152,7 @@ class Agreement extends \Magento\Paypal\Model\Billing\Agreement
public function setAgreementData($data) public function setAgreementData($data)
{ {
if (is_array($data)) { if (is_array($data)) {
unset($data['creationDate']); unset($data['creationDate'], $data['recurringDetailReference'], $data['payment_method']);
unset($data['recurringDetailReference']);
unset($data['payment_method']);
} }
$this->setData('agreement_data', json_encode($data)); $this->setData('agreement_data', json_encode($data));
...@@ -166,4 +166,92 @@ class Agreement extends \Magento\Paypal\Model\Billing\Agreement ...@@ -166,4 +166,92 @@ class Agreement extends \Magento\Paypal\Model\Billing\Agreement
{ {
return json_decode($this->getData('agreement_data'), true); return json_decode($this->getData('agreement_data'), true);
} }
/**
* For sync result to store billing agreement
*
* @param $contractDetail
* @return $this
*/
public function setCcBillingAgreement($contractDetail, $storeOneClick)
{
$this
->setMethodCode('adyen_oneclick')
->setReferenceId($contractDetail['recurring.recurringDetailReference']);
// 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 = $ccTypes[$ccType]['name'];
}
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']);
if (!empty($contractDetail['pos_payment'])) {
$recurringType = $this->adyenHelper->getAdyenPosCloudConfigData('recurring_type');
} else {
$recurringType = $this->adyenHelper->getRecurringTypeFromOneclickRecurringSetting();
// for bcmc and maestro recurring is not allowed so don't set this
if ($recurringType === \Adyen\Payment\Model\RecurringType::ONECLICK_RECURRING &&
($contractDetail['paymentMethod'] === "bcmc" || $contractDetail['paymentMethod'] === "maestro")
) {
$recurringType = \Adyen\Payment\Model\RecurringType::ONECLICK;
}
// if shopper decides to not store the card don't save it as oneclick
if (!$storeOneClick &&
$recurringType === \Adyen\Payment\Model\RecurringType::ONECLICK_RECURRING
) {
$recurringType = \Adyen\Payment\Model\RecurringType::RECURRING;
}
}
$agreementData = [
'card' => [
'holderName' => $contractDetail['cardHolderName'],
'number' => $contractDetail['cardSummary'],
'expiryMonth' => $expiryDate[0],
'expiryYear' => $expiryDate[1]
],
'variant' => $contractDetail['paymentMethod'],
'contractTypes' => explode(',', $recurringType)
];
if (!empty($contractDetail['pos_payment'])) {
$agreementData['posPayment'] = true;
}
$this->setAgreementData($agreementData);
return $this;
}
public function getErrors() {
return $this->_errors;
}
} }
...@@ -56,7 +56,7 @@ class CcType extends \Magento\Payment\Model\Source\Cctype ...@@ -56,7 +56,7 @@ class CcType extends \Magento\Payment\Model\Source\Cctype
*/ */
public function getAllowedTypes() public function getAllowedTypes()
{ {
return ['VI', 'MC', 'AE', 'DI', 'JCB', 'UN', 'MI', 'DN']; return ['VI', 'MC', 'AE', 'DI', 'JCB', 'UN', 'MI', 'DN', 'BCMC', 'HIPERCARD','ELO','AURA'];
} }
/** /**
......
...@@ -209,9 +209,13 @@ class Cron ...@@ -209,9 +209,13 @@ class Cron
*/ */
private $orderRepository; private $orderRepository;
/**
* @var ResourceModel\Billing\Agreement
*/
private $agreementResourceModel;
/** /**
* 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
...@@ -230,6 +234,7 @@ class Cron ...@@ -230,6 +234,7 @@ class Cron
* @param \Magento\Sales\Model\ResourceModel\Order\Status\CollectionFactory $orderStatusCollection * @param \Magento\Sales\Model\ResourceModel\Order\Status\CollectionFactory $orderStatusCollection
* @param SearchCriteriaBuilder $searchCriteriaBuilder * @param SearchCriteriaBuilder $searchCriteriaBuilder
* @param OrderRepository $orderRepository * @param OrderRepository $orderRepository
* @param ResourceModel\Billing\Agreement $agreementResourceModel
*/ */
public function __construct( public function __construct(
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
...@@ -249,7 +254,8 @@ class Cron ...@@ -249,7 +254,8 @@ class Cron
AreaList $areaList, AreaList $areaList,
\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
) { ) {
$this->_scopeConfig = $scopeConfig; $this->_scopeConfig = $scopeConfig;
$this->_adyenLogger = $adyenLogger; $this->_adyenLogger = $adyenLogger;
...@@ -269,6 +275,7 @@ class Cron ...@@ -269,6 +275,7 @@ class Cron
$this->_orderStatusCollection = $orderStatusCollection; $this->_orderStatusCollection = $orderStatusCollection;
$this->searchCriteriaBuilder = $searchCriteriaBuilder; $this->searchCriteriaBuilder = $searchCriteriaBuilder;
$this->orderRepository = $orderRepository; $this->orderRepository = $orderRepository;
$this->agreementResourceModel = $agreementResourceModel;
} }
/** /**
...@@ -409,8 +416,13 @@ class Cron ...@@ -409,8 +416,13 @@ class Cron
$this->_processNotification(); $this->_processNotification();
} }
$this->_order->save(); try {
// set done to true // set done to true
$this->_order->save();
} catch (\Exception $e) {
$this->_adyenLogger->addAdyenNotificationCronjob($e->getMessage());
}
$this->_updateNotification($notification, false, true); $this->_updateNotification($notification, false, true);
$this->_adyenLogger->addAdyenNotificationCronjob( $this->_adyenLogger->addAdyenNotificationCronjob(
sprintf("Notification %s is processed", $notification->getEntityId()) sprintf("Notification %s is processed", $notification->getEntityId())
...@@ -649,7 +661,6 @@ class Cron ...@@ -649,7 +661,6 @@ class Cron
if ($this->_eventCode == Notification::AUTHORISATION if ($this->_eventCode == Notification::AUTHORISATION
|| $this->_eventCode == Notification::HANDLED_EXTERNALLY || $this->_eventCode == Notification::HANDLED_EXTERNALLY
|| ($this->_eventCode == Notification::CAPTURE && $_paymentCode == "adyen_pos")
) { ) {
/* /*
* if current notification is authorisation : false and * if current notification is authorisation : false and
...@@ -847,10 +858,7 @@ class Cron ...@@ -847,10 +858,7 @@ class Cron
break; break;
case Notification::HANDLED_EXTERNALLY: case Notification::HANDLED_EXTERNALLY:
case Notification::AUTHORISATION: case Notification::AUTHORISATION:
// for POS don't do anything on the AUTHORIZATION $this->_authorizePayment();
if ($_paymentCode != "adyen_pos") {
$this->_authorizePayment();
}
break; break;
case Notification::MANUAL_REVIEW_REJECT: case Notification::MANUAL_REVIEW_REJECT:
// don't do anything it will send a CANCEL_OR_REFUND notification when this payment is captured // don't do anything it will send a CANCEL_OR_REFUND notification when this payment is captured
...@@ -865,33 +873,28 @@ class Cron ...@@ -865,33 +873,28 @@ class Cron
} }
break; break;
case Notification::CAPTURE: case Notification::CAPTURE:
if ($_paymentCode != "adyen_pos") { /*
* ignore capture if you are on auto capture
* this could be called if manual review is enabled and you have a capture delay
*/
if (!$this->_isAutoCapture()) {
$this->_setPaymentAuthorized(false, true);
/* /*
* ignore capture if you are on auto capture * Add invoice in the adyen_invoice table
* this could be called if manual review is enabled and you have a capture delay
*/ */
if (!$this->_isAutoCapture()) { $invoiceCollection = $this->_order->getInvoiceCollection();
$this->_setPaymentAuthorized(false, true); foreach ($invoiceCollection as $invoice) {
if ($invoice->getTransactionId() == $this->_pspReference) {
/* $this->_adyenInvoiceFactory->create()
* Add invoice in the adyen_invoice table ->setInvoiceId($invoice->getEntityId())
*/ ->setPspreference($this->_pspReference)
$invoiceCollection = $this->_order->getInvoiceCollection(); ->setOriginalReference($this->_originalReference)
foreach ($invoiceCollection as $invoice) { ->setAcquirerReference($this->_acquirerReference)
if ($invoice->getTransactionId() == $this->_pspReference) { ->save();
$this->_adyenInvoiceFactory->create() $this->_adyenLogger->addAdyenNotificationCronjob('Created invoice entry in the Adyen table');
->setInvoiceId($invoice->getEntityId())
->setPspreference($this->_pspReference)
->setOriginalReference($this->_originalReference)
->setAcquirerReference($this->_acquirerReference)
->save();
$this->_adyenLogger->addAdyenNotificationCronjob('Created invoice entry in the Adyen table');
}
} }
} }
} else {
// FOR POS authorize the payment on the CAPTURE notification
$this->_authorizePayment();
} }
break; break;
case Notification::OFFER_CLOSED: case Notification::OFFER_CLOSED:
...@@ -1028,11 +1031,16 @@ class Cron ...@@ -1028,11 +1031,16 @@ class Cron
// Populate billing agreement data // Populate billing agreement data
$billingAgreement->parseRecurringContractData($contractDetail); $billingAgreement->parseRecurringContractData($contractDetail);
if ($billingAgreement->isValid()) { if ($billingAgreement->isValid()) {
// save into sales_billing_agreement_order
$billingAgreement->addOrderRelation($this->_order);
// add to order to save agreement if (!$this->agreementResourceModel->getOrderRelation($billingAgreement->getAgreementId(),
$this->_order->addRelatedObject($billingAgreement); $this->_order->getId())) {
// save into sales_billing_agreement_order
$billingAgreement->addOrderRelation($this->_order);
// add to order to save agreement
$this->_order->addRelatedObject($billingAgreement);
}
} else { } else {
$message = __('Failed to create billing agreement for this order.'); $message = __('Failed to create billing agreement for this order.');
throw new \Exception($message); throw new \Exception($message);
...@@ -1147,10 +1155,8 @@ class Cron ...@@ -1147,10 +1155,8 @@ class Cron
} }
} }
if (($this->_paymentMethod == "c_cash" && if ($this->_paymentMethod == "c_cash" &&
$this->_getConfigData('create_shipment', 'adyen_cash', $this->_order->getStoreId())) || $this->_getConfigData('create_shipment', 'adyen_cash', $this->_order->getStoreId())
($this->_getConfigData('create_shipment', 'adyen_pos', $this->_order->getStoreId()) &&
$_paymentCode == "adyen_pos")
) { ) {
$this->_createShipment(); $this->_createShipment();
} }
...@@ -1321,9 +1327,9 @@ class Cron ...@@ -1321,9 +1327,9 @@ class Cron
return false; return false;
} }
// payment method ideal, cash adyen_boleto or adyen_pos has direct capture // payment method ideal, cash adyen_boleto has direct capture
if ($_paymentCode == "adyen_pos" || (($_paymentCode == "adyen_sepa" || if (($_paymentCode == "adyen_sepa" ||
$this->_paymentMethod == "sepadirectdebit") && $sepaFlow != "authcap") $this->_paymentMethod == "sepadirectdebit") && $sepaFlow != "authcap"
) { ) {
$this->_adyenLogger->addAdyenNotificationCronjob( $this->_adyenLogger->addAdyenNotificationCronjob(
'This payment method does not allow manual capture.(2) paymentCode:' . 'This payment method does not allow manual capture.(2) paymentCode:' .
...@@ -1333,7 +1339,8 @@ class Cron ...@@ -1333,7 +1339,8 @@ class Cron
} }
if ($_paymentCode == "adyen_pos_cloud") { if ($_paymentCode == "adyen_pos_cloud") {
$captureModePos = $this->_adyenHelper->getAdyenPosCloudConfigData('capture_mode_pos', $this->_order->getStoreId()); $captureModePos = $this->_adyenHelper->getAdyenPosCloudConfigData('capture_mode_pos',
$this->_order->getStoreId());
if (strcmp($captureModePos, 'auto') === 0) { if (strcmp($captureModePos, 'auto') === 0) {
$this->_adyenLogger->addAdyenNotificationCronjob( $this->_adyenLogger->addAdyenNotificationCronjob(
'This payment method is POS Cloud and configured to be working as auto capture ' 'This payment method is POS Cloud and configured to be working as auto capture '
......
...@@ -28,5 +28,14 @@ namespace Adyen\Payment\Model\ResourceModel\Billing; ...@@ -28,5 +28,14 @@ namespace Adyen\Payment\Model\ResourceModel\Billing;
*/ */
class Agreement extends \Magento\Paypal\Model\ResourceModel\Billing\Agreement class Agreement extends \Magento\Paypal\Model\ResourceModel\Billing\Agreement
{ {
public function getOrderRelation($agreementId, $orderId)
{
$select = $this->getConnection()->select()
->from(['billingagreement_order' => $this->getTable('paypal_billing_agreement_order')])
->where('billingagreement_order.agreement_id=?', $agreementId)
->where('billingagreement_order.order_id=?', $orderId);
return $this->getConnection()->fetchAll($select);
}
} }
...@@ -24,9 +24,6 @@ ...@@ -24,9 +24,6 @@
namespace Adyen\Payment\Model\Ui; namespace Adyen\Payment\Model\Ui;
use Magento\Checkout\Model\ConfigProviderInterface; use Magento\Checkout\Model\ConfigProviderInterface;
use Magento\Payment\Helper\Data as PaymentHelper;
use Magento\Framework\View\Asset\Source as Source;
use \Magento\Payment\Gateway\Config\Config as Config;
class AdyenCcConfigProvider implements ConfigProviderInterface class AdyenCcConfigProvider implements ConfigProviderInterface
{ {
...@@ -65,24 +62,30 @@ class AdyenCcConfigProvider implements ConfigProviderInterface ...@@ -65,24 +62,30 @@ class AdyenCcConfigProvider implements ConfigProviderInterface
*/ */
private $ccConfig; private $ccConfig;
/**
* @var \Magento\Store\Model\StoreManagerInterface
*/
private $storeManager;
/**
* AdyenCcConfigProvider constructor. /**
* * AdyenCcConfigProvider constructor.
* @param PaymentHelper $paymentHelper *
* @param \Adyen\Payment\Helper\Data $adyenHelper * @param \Magento\Payment\Helper\Data $paymentHelper
* @param \Magento\Framework\App\RequestInterface $request * @param \Adyen\Payment\Helper\Data $adyenHelper
* @param \Magento\Framework\UrlInterface $urlBuilder * @param \Magento\Framework\App\RequestInterface $request
* @param Source $assetSource * @param \Magento\Framework\UrlInterface $urlBuilder
* @param \Magento\Payment\Model\CcConfig $ccConfig * @param \Magento\Framework\View\Asset\Source $assetSource
* @param Config $config * @param \Magento\Store\Model\StoreManagerInterface $storeManager
*/ * @param \Magento\Payment\Model\CcConfig $ccConfig
*/
public function __construct( public function __construct(
PaymentHelper $paymentHelper, \Magento\Payment\Helper\Data $paymentHelper,
\Adyen\Payment\Helper\Data $adyenHelper, \Adyen\Payment\Helper\Data $adyenHelper,
\Magento\Framework\App\RequestInterface $request, \Magento\Framework\App\RequestInterface $request,
\Magento\Framework\UrlInterface $urlBuilder, \Magento\Framework\UrlInterface $urlBuilder,
Source $assetSource, \Magento\Framework\View\Asset\Source $assetSource,
\Magento\Store\Model\StoreManagerInterface $storeManager,
\Magento\Payment\Model\CcConfig $ccConfig \Magento\Payment\Model\CcConfig $ccConfig
) { ) {
$this->_paymentHelper = $paymentHelper; $this->_paymentHelper = $paymentHelper;
...@@ -91,6 +94,7 @@ class AdyenCcConfigProvider implements ConfigProviderInterface ...@@ -91,6 +94,7 @@ class AdyenCcConfigProvider implements ConfigProviderInterface
$this->_urlBuilder = $urlBuilder; $this->_urlBuilder = $urlBuilder;
$this->_assetSource = $assetSource; $this->_assetSource = $assetSource;
$this->ccConfig = $ccConfig; $this->ccConfig = $ccConfig;
$this->storeManager = $storeManager;
} }
/** /**
...@@ -117,6 +121,7 @@ class AdyenCcConfigProvider implements ConfigProviderInterface ...@@ -117,6 +121,7 @@ class AdyenCcConfigProvider implements ConfigProviderInterface
'payment' => [ 'payment' => [
'ccform' => [ 'ccform' => [
'availableTypes' => [$methodCode => $this->getCcAvailableTypes($methodCode)], 'availableTypes' => [$methodCode => $this->getCcAvailableTypes($methodCode)],
'availableTypesByAlt' => [$methodCode => $this->getCcAvailableTypesByAlt($methodCode)],
'months' => [$methodCode => $this->getCcMonths()], 'months' => [$methodCode => $this->getCcMonths()],
'years' => [$methodCode => $this->getCcYears()], 'years' => [$methodCode => $this->getCcYears()],
'hasVerification' => [$methodCode => $this->hasVerification($methodCode)], 'hasVerification' => [$methodCode => $this->hasVerification($methodCode)],
...@@ -125,17 +130,23 @@ class AdyenCcConfigProvider implements ConfigProviderInterface ...@@ -125,17 +130,23 @@ class AdyenCcConfigProvider implements ConfigProviderInterface
] ]
]); ]);
$recurringType = $this->_adyenHelper->getAdyenAbstractConfigData('recurring_type'); $enableOneclick = $this->_adyenHelper->getAdyenAbstractConfigData('enable_oneclick');
$canCreateBillingAgreement = false; $canCreateBillingAgreement = false;
if ($recurringType == "ONECLICK" || $recurringType == "ONECLICK,RECURRING") { if ($enableOneclick) {
$canCreateBillingAgreement = true; $canCreateBillingAgreement = true;
} }
$config['payment'] ['adyenCc']['librarySource'] = $this->_adyenHelper->getLibrarySource(); $config['payment']['adyenCc']['methodCode'] = self::CODE;
$config['payment']['adyenCc']['generationTime'] = date("c");
$config['payment']['adyenCc']['locale'] = $this->_adyenHelper->getStoreLocale($this->storeManager->getStore()->getId());
$config['payment']['adyenCc']['canCreateBillingAgreement'] = $canCreateBillingAgreement; $config['payment']['adyenCc']['canCreateBillingAgreement'] = $canCreateBillingAgreement;
$config['payment']['adyenCc']['icons'] = $this->getIcons(); $config['payment']['adyenCc']['icons'] = $this->getIcons();
$config['payment']['adyenCc']['originKey'] = $this->_adyenHelper->getOriginKeyForBaseUrl();
$config['payment']['adyenCc']['checkoutUrl'] = $this->_adyenHelper->getCheckoutContextUrl($this->storeManager->getStore()->getId());
// has installments by default false // has installments by default false
$config['payment']['adyenCc']['hasInstallments'] = false; $config['payment']['adyenCc']['hasInstallments'] = false;
...@@ -176,6 +187,29 @@ class AdyenCcConfigProvider implements ConfigProviderInterface ...@@ -176,6 +187,29 @@ class AdyenCcConfigProvider implements ConfigProviderInterface
return $types; return $types;
} }
/**
* Retrieve availables credit card type codes by alt code
*
* @param string $methodCode
* @return array
*/
protected function getCcAvailableTypesByAlt($methodCode)
{
$types = [];
$ccTypes = $this->_adyenHelper->getAdyenCcTypes();
$availableTypes = $this->_adyenHelper->getAdyenCcConfigData('cctypes');
if ($availableTypes) {
$availableTypes = explode(',', $availableTypes);
foreach (array_keys($ccTypes) as $code) {
if (in_array($code, $availableTypes)) {
$types[$ccTypes[$code]['code_alt']] = $code;
}
}
}
return $types;
}
/** /**
* Get icons for available payment methods * Get icons for available payment methods
* *
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
* *
* Author: Adyen <magento@adyen.com> * Author: Adyen <magento@adyen.com>
*/ */
namespace Adyen\Payment\Model\Ui; namespace Adyen\Payment\Model\Ui;
use Magento\Checkout\Model\ConfigProviderInterface; use Magento\Checkout\Model\ConfigProviderInterface;
...@@ -33,15 +34,24 @@ class AdyenGenericConfigProvider implements ConfigProviderInterface ...@@ -33,15 +34,24 @@ class AdyenGenericConfigProvider implements ConfigProviderInterface
*/ */
protected $_adyenHelper; protected $_adyenHelper;
/**
* @var \Magento\Store\Model\StoreManagerInterface
*/
protected $storeManager;
/** /**
* AdyenGenericConfigProvider constructor. * AdyenGenericConfigProvider constructor.
* *
* @param \Adyen\Payment\Helper\Data $adyenHelper * @param \Adyen\Payment\Helper\Data $adyenHelper
*/ */
public function __construct(\Adyen\Payment\Helper\Data $adyenHelper) public function __construct(
{ \Adyen\Payment\Helper\Data $adyenHelper,
\Magento\Store\Model\StoreManagerInterface $storeManager
) {
$this->_adyenHelper = $adyenHelper; $this->_adyenHelper = $adyenHelper;
$this->storeManager = $storeManager;
} }
/** /**
* Define foreach payment methods the RedirectUrl * Define foreach payment methods the RedirectUrl
* *
...@@ -58,8 +68,12 @@ class AdyenGenericConfigProvider implements ConfigProviderInterface ...@@ -58,8 +68,12 @@ class AdyenGenericConfigProvider implements ConfigProviderInterface
} else { } else {
$config['payment']['adyen']['showLogo'] = false; $config['payment']['adyen']['showLogo'] = false;
} }
$config['payment']['checkoutCardComponentSource'] = $this->_adyenHelper->getCheckoutCardComponentJs($this->storeManager->getStore()->getId());
return $config; return $config;
} }
/** /**
* Return redirect URL for method * Return redirect URL for method
* *
......
...@@ -72,16 +72,17 @@ class AdyenOneclickConfigProvider implements ConfigProviderInterface ...@@ -72,16 +72,17 @@ class AdyenOneclickConfigProvider implements ConfigProviderInterface
*/ */
private $ccConfig; private $ccConfig;
/** /**
* AdyenOneclickConfigProvider constructor. * AdyenOneclickConfigProvider constructor.
* *
* @param \Adyen\Payment\Helper\Data $adyenHelper * @param \Adyen\Payment\Helper\Data $adyenHelper
* @param \Magento\Framework\App\RequestInterface $request * @param \Magento\Framework\App\RequestInterface $request
* @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Customer\Model\Session $customerSession
* @param \Magento\Checkout\Model\Session $session * @param \Magento\Checkout\Model\Session $session
* @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Store\Model\StoreManagerInterface $storeManager
* @param \Magento\Framework\UrlInterface $urlBuilder * @param \Magento\Framework\UrlInterface $urlBuilder
*/ * @param \Magento\Payment\Model\CcConfig $ccConfig
*/
public function __construct( public function __construct(
\Adyen\Payment\Helper\Data $adyenHelper, \Adyen\Payment\Helper\Data $adyenHelper,
\Magento\Framework\App\RequestInterface $request, \Magento\Framework\App\RequestInterface $request,
...@@ -132,14 +133,17 @@ class AdyenOneclickConfigProvider implements ConfigProviderInterface ...@@ -132,14 +133,17 @@ class AdyenOneclickConfigProvider implements ConfigProviderInterface
] ]
]); ]);
$recurringType = $this->_adyenHelper->getAdyenAbstractConfigData('recurring_type'); $config['payment']['adyenOneclick']['methodCode'] = self::CODE;
$config['payment']['adyenOneclick']['originKey'] = $this->_adyenHelper->getOriginKeyForBaseUrl();
$config['payment']['adyenOneclick']['checkoutUrl'] = $this->_adyenHelper->getCheckoutContextUrl($this->_storeManager->getStore()->getId());
$config['payment']['adyenOneclick']['locale'] = $this->_adyenHelper->getStoreLocale($this->_storeManager->getStore()->getId());
$enableOneclick = $this->_adyenHelper->getAdyenAbstractConfigData('enable_oneclick');
$canCreateBillingAgreement = false; $canCreateBillingAgreement = false;
if ($recurringType == "ONECLICK" || $recurringType == "ONECLICK,RECURRING") { if ($enableOneclick) {
$canCreateBillingAgreement = true; $canCreateBillingAgreement = true;
} }
$config['payment'] ['adyenOneclick']['librarySource'] = $this->_adyenHelper->getLibrarySource();
$config['payment']['adyenOneclick']['generationTime'] = date("c");
$config['payment']['adyenOneclick']['canCreateBillingAgreement'] = $canCreateBillingAgreement; $config['payment']['adyenOneclick']['canCreateBillingAgreement'] = $canCreateBillingAgreement;
$recurringContractType = $this->_getRecurringContractType(); $recurringContractType = $this->_getRecurringContractType();
...@@ -174,6 +178,7 @@ class AdyenOneclickConfigProvider implements ConfigProviderInterface ...@@ -174,6 +178,7 @@ class AdyenOneclickConfigProvider implements ConfigProviderInterface
$recurringType $recurringType
); );
} }
return $billingAgreements; return $billingAgreements;
} }
......
...@@ -32,18 +32,28 @@ use Magento\Quote\Api\Data\PaymentInterface; ...@@ -32,18 +32,28 @@ use Magento\Quote\Api\Data\PaymentInterface;
class AdyenCcDataAssignObserver extends AbstractDataAssignObserver class AdyenCcDataAssignObserver extends AbstractDataAssignObserver
{ {
const CC_TYPE = 'cc_type'; const CC_TYPE = 'cc_type';
const ENCRYPTED_DATA = 'encrypted_data';
const NUMBER_OF_INSTALLMENTS = 'number_of_installments'; const NUMBER_OF_INSTALLMENTS = 'number_of_installments';
const STORE_CC = 'store_cc'; const STORE_CC = 'store_cc';
const ENCRYPTED_CREDIT_CARD_NUMBER = 'number';
const ENCRYPTED_SECURITY_CODE = 'cvc';
const ENCRYPTED_EXPIRY_MONTH = 'expiryMonth';
const ENCRYPTED_EXPIRY_YEAR = 'expiryYear';
const HOLDER_NAME = 'holderName';
const VARIANT = 'variant';
/** /**
* @var array * @var array
*/ */
protected $additionalInformationList = [ protected $additionalInformationList = [
self::CC_TYPE, self::CC_TYPE,
self::ENCRYPTED_DATA,
self::NUMBER_OF_INSTALLMENTS, self::NUMBER_OF_INSTALLMENTS,
self::STORE_CC self::STORE_CC,
self::ENCRYPTED_CREDIT_CARD_NUMBER,
self::ENCRYPTED_SECURITY_CODE,
self::ENCRYPTED_EXPIRY_MONTH,
self::ENCRYPTED_EXPIRY_YEAR,
self::HOLDER_NAME,
self::VARIANT
]; ];
/** /**
......
...@@ -32,16 +32,18 @@ use Magento\Quote\Api\Data\PaymentInterface; ...@@ -32,16 +32,18 @@ use Magento\Quote\Api\Data\PaymentInterface;
class AdyenOneclickDataAssignObserver extends AbstractDataAssignObserver class AdyenOneclickDataAssignObserver extends AbstractDataAssignObserver
{ {
const RECURRING_DETAIL_REFERENCE = 'recurring_detail_reference'; const RECURRING_DETAIL_REFERENCE = 'recurring_detail_reference';
const ENCRYPTED_DATA = 'encrypted_data'; const ENCRYPTED_SECURITY_CODE = 'cvc';
const NUMBER_OF_INSTALLMENTS = 'number_of_installments'; const NUMBER_OF_INSTALLMENTS = 'number_of_installments';
const VARIANT = 'variant';
/** /**
* @var array * @var array
*/ */
protected $additionalInformationList = [ protected $additionalInformationList = [
self::RECURRING_DETAIL_REFERENCE, self::RECURRING_DETAIL_REFERENCE,
self::ENCRYPTED_DATA, self::ENCRYPTED_SECURITY_CODE,
self::NUMBER_OF_INSTALLMENTS self::NUMBER_OF_INSTALLMENTS,
self::VARIANT
]; ];
/** /**
......
<?php
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Payment module (https://www.adyen.com/)
*
* Copyright (c) 2015 Adyen BV (https://www.adyen.com/)
* See LICENSE.txt for license details.
*
* Author: Adyen <magento@adyen.com>
*/
namespace Adyen\Payment\Setup;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Framework\Setup\UpgradeDataInterface;
use Magento\Framework\App\Config\Storage\WriterInterface;
use Magento\Framework\App\Config\ReinitableConfigInterface;
/**
* Class UpgradeData
* @package Adyen\Payment\Setup
*/
class UpgradeData implements UpgradeDataInterface
{
/**
* @var WriterInterface
*/
private $configWriter;
/**
* @var ReinitableConfigInterface
*/
private $reinitableConfig;
public function __construct(
WriterInterface $configWriter,
ReinitableConfigInterface $reinitableConfig
) {
$this->configWriter = $configWriter;
$this->reinitableConfig = $reinitableConfig;
}
/**
* @param ModuleDataSetupInterface $setup
* @param ModuleContextInterface $context
*/
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
$setup->startSetup();
if (version_compare($context->getVersion(), '2.4.4', '<')) {
$this->updateSchemaVersion244($setup);
}
$setup->endSetup();
}
/**
* Upgrade to 2.4.4 used for release 3.0.0
* We use new configuration options to define if you want to store the payment for oneclick or
* recurring or a combination of those in a more friendly way and make it easier to integrate with our checkout API
*
* @param ModuleDataSetupInterface $setup
*/
public function updateSchemaVersion244(ModuleDataSetupInterface $setup)
{
// convert billing agreement select box to oneclick recurring settings
$pathEnableOneclick = "payment/adyen_abstract/enable_oneclick";
$pathEnableRecurring = "payment/adyen_abstract/enable_recurring";
$configDataTable = $setup->getTable('core_config_data');
$connection = $setup->getConnection();
$select = $connection->select()
->from($configDataTable)
->where(
'path = ?',
'payment/adyen_abstract/recurring_type'
);
$configRecurringTypeValues = $connection->fetchAll($select);
foreach ($configRecurringTypeValues as $configRecurringTypeValue) {
$scope = $configRecurringTypeValue['scope'];
$scopeId = $configRecurringTypeValue['scope_id'];
switch ($configRecurringTypeValue['value']) {
case \Adyen\Payment\Model\RecurringType::ONECLICK:
$this->configWriter->save(
$pathEnableOneclick,
'1',
$scope,
$scopeId
);
$this->configWriter->save(
$pathEnableRecurring,
'0',
$scope,
$scopeId
);
break;
case \Adyen\Payment\Model\RecurringType::ONECLICK_RECURRING:
$this->configWriter->save(
$pathEnableOneclick,
'1',
$scope,
$scopeId
);
$this->configWriter->save(
$pathEnableRecurring,
'1',
$scope,
$scopeId
);
break;
case \Adyen\Payment\Model\RecurringType::RECURRING:
$this->configWriter->save(
$pathEnableOneclick,
'0',
$scope,
$scopeId
);
$this->configWriter->save(
$pathEnableRecurring,
'1',
$scope,
$scopeId
);
break;
case \Adyen\Payment\Model\RecurringType::NONE:
$this->configWriter->save(
$pathEnableOneclick,
'0',
$scope,
$scopeId
);
$this->configWriter->save(
$pathEnableRecurring,
'0',
$scope,
$scopeId
);
break;
}
}
// re-initialize otherwise it will cause errors
$this->reinitableConfig->reinit();
}
}
\ No newline at end of file
...@@ -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": "2.4.3", "version": "3.0.0",
"license": [ "license": [
"OSL-3.0", "OSL-3.0",
"AFL-3.0" "AFL-3.0"
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
<argument name="messages" xsi:type="array"> <argument name="messages" xsi:type="array">
<item name="AdyenCronMessage" xsi:type="string">Adyen\Payment\AdminMessage\CronMessage</item> <item name="AdyenCronMessage" xsi:type="string">Adyen\Payment\AdminMessage\CronMessage</item>
<item name="AdyenVersionMessage" xsi:type="string">Adyen\Payment\AdminMessage\VersionMessage</item> <item name="AdyenVersionMessage" xsi:type="string">Adyen\Payment\AdminMessage\VersionMessage</item>
<item name="AdyenAPIKeyMessage" xsi:type="string">Adyen\Payment\AdminMessage\APIKeyMessage</item>
</argument> </argument>
</arguments> </arguments>
</type> </type>
......
...@@ -43,7 +43,6 @@ ...@@ -43,7 +43,6 @@
<include path="Adyen_Payment::system/adyen_oneclick.xml"/> <include path="Adyen_Payment::system/adyen_oneclick.xml"/>
<include path="Adyen_Payment::system/adyen_hpp.xml"/> <include path="Adyen_Payment::system/adyen_hpp.xml"/>
<include path="Adyen_Payment::system/adyen_sepa.xml"/> <include path="Adyen_Payment::system/adyen_sepa.xml"/>
<include path="Adyen_Payment::system/adyen_pos.xml"/>
<include path="Adyen_Payment::system/adyen_pos_cloud.xml"/> <include path="Adyen_Payment::system/adyen_pos_cloud.xml"/>
<include path="Adyen_Payment::system/adyen_pay_by_mail.xml"/> <include path="Adyen_Payment::system/adyen_pay_by_mail.xml"/>
<include path="Adyen_Payment::system/adyen_boleto.xml"/> <include path="Adyen_Payment::system/adyen_boleto.xml"/>
......
...@@ -22,33 +22,30 @@ ...@@ -22,33 +22,30 @@
* Author: Adyen <magento@adyen.com> * Author: Adyen <magento@adyen.com>
*/ */
--> -->
<include xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_include.xsd"> <include xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<group id="adyen_billing_agreements" translate="label" type="text" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="1"> xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_include.xsd">
<group id="adyen_billing_agreements" translate="label" type="text" sortOrder="50" showInDefault="1"
showInWebsite="1" showInStore="1">
<label><![CDATA[Advanced: Billing Agreements]]></label> <label><![CDATA[Advanced: Billing Agreements]]></label>
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model> <frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
<comment> <field id="enable_oneclick" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1"
<![CDATA[ showInStore="1">
<p> <label>Enable OneClick</label>
<strong>ONECLICK</strong>: The shopper opts in to storing their card details for future use. <tooltip>The shopper opts in to storing their card details for future use. The shopper is present for the
The shopper is present for the subsequent transaction, for cards the security code (CVC/CVV) is required. subsequent transaction, for cards the security code (CVC/CVV) is required.
</p> </tooltip>
<p> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<strong>RECURRING*</strong>: Payment details are stored for future use. For cards, the security <config_path>payment/adyen_abstract/enable_oneclick</config_path>
code (CVC/CVV) is not required for subsequent payments. </field>
</p>
<p>
<strong>ONECLICK, RECURRING*</strong>: Payment details are stored for future use. This allows the use of
the stored payment details regardless of whether the shopper is on your site or not.
</p>
<p>* keep in mind you need the recurring permission enabled. You can contact magento@adyen.com to enable this for your account.
]]>
</comment>
<field id="recurring_type" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"> <field id="enable_recurring" translate="label" type="select" sortOrder="30" showInDefault="1" showInWebsite="1"
<label>Agreement Type</label> showInStore="1">
<tooltip>When enabled, users can save their Credit Cards and their SEPA authorizations. ONECLICK will require the input of the CVC for subsequent payments, while RECURRING does not.</tooltip> <label>Enable Recurring</label>
<source_model>Adyen\Payment\Model\Config\Source\RecurringType</source_model> <tooltip>Payment details are stored for future use. For cards, the security
<config_path>payment/adyen_abstract/recurring_type</config_path> code (CVC/CVV) is not required for subsequent payments.
</tooltip>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/adyen_abstract/enable_recurring</config_path>
</field> </field>
</group> </group>
</include> </include>
\ No newline at end of file
...@@ -47,16 +47,6 @@ ...@@ -47,16 +47,6 @@
<source_model>Adyen\Payment\Model\Config\Source\CcType</source_model> <source_model>Adyen\Payment\Model\Config\Source\CcType</source_model>
<config_path>payment/adyen_cc/cctypes</config_path> <config_path>payment/adyen_cc/cctypes</config_path>
</field> </field>
<field id="cse_library_token_test" translate="label" type="text" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Library token of Test Adyen Web Service User</label>
<tooltip>Copy this from the Test Adyen Customer Area => Settings => Users => System => [web service user]=> Library token.</tooltip>
<config_path>payment/adyen_cc/cse_library_token_test</config_path>
</field>
<field id="cse_library_token_live" translate="label" type="text" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Library token of Live Adyen Web Service User</label>
<tooltip>Copy this from the Live Adyen Customer Area => Settings => Users => System => [web service user]=> Library token.</tooltip>
<config_path>payment/adyen_cc/cse_library_token_live</config_path>
</field>
<group id="adyen_cc_advanced_settings" translate="label" showInDefault="1" showInWebsite="1" showInStore="1" sortOrder="150"> <group id="adyen_cc_advanced_settings" translate="label" showInDefault="1" showInWebsite="1" showInStore="1" sortOrder="150">
<label>Advanced Settings</label> <label>Advanced Settings</label>
......
...@@ -49,5 +49,14 @@ ...@@ -49,5 +49,14 @@
<source_model>Adyen\Payment\Model\Config\Source\RecurringPaymentType</source_model> <source_model>Adyen\Payment\Model\Config\Source\RecurringPaymentType</source_model>
<config_path>payment/adyen_oneclick/recurring_payment_type</config_path> <config_path>payment/adyen_oneclick/recurring_payment_type</config_path>
</field> </field>
<group id="adyen_oneclick_advanced_settings" translate="label" showInDefault="1" showInWebsite="1" showInStore="1" sortOrder="200">
<label>Advanced Settings</label>
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
<field id="title" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Share billing agreements between stores</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/adyen_oneclick/share_billing_agreement</config_path>
</field>
</group>
</group> </group>
</include> </include>
<?xml version="1.0"?>
<!--
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Payment module (https://www.adyen.com/)
*
* Copyright (c) 2015 Adyen BV (https://www.adyen.com/)
* See LICENSE.txt for license details.
*
* Author: Adyen <magento@adyen.com>
*/
-->
<include xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_include.xsd">
<group id="adyen_pos" translate="label" type="text" sortOrder="300" showInDefault="1" showInWebsite="1" showInStore="1">
<label><![CDATA[Point of Sale (POS) integration]]></label>
<frontend_model>Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Payment</frontend_model>
<fieldset_css>adyen-method-adyen-cc</fieldset_css>
<comment>Process Point of Sales transactions</comment>
<field id="active" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enabled</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/adyen_pos/active</config_path>
</field>
<field id="title" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Title</label>
<config_path>payment/adyen_pos/title</config_path>
</field>
<field id="sort_order" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Sort Order</label>
<frontend_class>validate-number</frontend_class>
<config_path>payment/adyen_pos/sort_order</config_path>
</field>
<field id="recurring_type" translate="label" type="select" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Agreement Type</label>
<tooltip>You can set different value for POS because you have to have the permission of the customer</tooltip>
<source_model>Adyen\Payment\Model\Config\Source\RecurringType</source_model>
<config_path>payment/adyen_pos/recurring_type</config_path>
</field>
<group id="adyen_pos_advanced_settings" translate="label" showInDefault="1" showInWebsite="1" showInStore="1" sortOrder="200">
<label>Advanced Settings</label>
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
<field id="add_receipt_order_lines" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Add orderlines to receipt</label>
<tooltip>If you have the Adyen App configured to print to an external printer the orderlines can be printed on to the receipt if you turn this option on.</tooltip>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/adyen_pos/add_receipt_order_lines</config_path>
</field>
</group>
<group id="adyen_pos_country_specific" translate="label" showInDefault="1" showInWebsite="1" sortOrder="210">
<label>Country Specific Settings</label>
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
<field id="allowspecific" translate="label" type="allowspecific" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Payment from Applicable Countries</label>
<source_model>Magento\Payment\Model\Config\Source\Allspecificcountries</source_model>
<config_path>payment/adyen_pos/allowspecific</config_path>
</field>
<field id="specificcountry" translate="label" type="multiselect" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Payment from Specific Countries</label>
<source_model>Magento\Directory\Model\Config\Source\Country</source_model>
<can_be_empty>1</can_be_empty>
<config_path>payment/adyen_pos/specificcountry</config_path>
</field>
</group>
</group>
</include>
\ No newline at end of file
...@@ -75,6 +75,7 @@ ...@@ -75,6 +75,7 @@
<tooltip>You can set different value for POS because you have to have the permission of the customer</tooltip> <tooltip>You can set different value for POS because you have to have the permission of the customer</tooltip>
<source_model>Adyen\Payment\Model\Config\Source\RecurringType</source_model> <source_model>Adyen\Payment\Model\Config\Source\RecurringType</source_model>
<config_path>payment/adyen_pos_cloud/recurring_type</config_path> <config_path>payment/adyen_pos_cloud/recurring_type</config_path>
<comment>If you want to store the credentials for ONECLICK or RECURRING or combination of these two you need to contact support@adyen.com and ask if they can enable to store cards on company level. Changing this setting without doing this will lead to failed payments!</comment>
</field> </field>
<group id="adyen_pos_country_specific" translate="label" showInDefault="1" showInWebsite="1" sortOrder="210"> <group id="adyen_pos_country_specific" translate="label" showInDefault="1" showInWebsite="1" sortOrder="210">
<label>Country Specific Settings</label> <label>Country Specific Settings</label>
......
...@@ -49,28 +49,25 @@ ...@@ -49,28 +49,25 @@
<config_path>payment/adyen_abstract/notification_password</config_path> <config_path>payment/adyen_abstract/notification_password</config_path>
<tooltip>Set a password of your choice and copy it over to Adyen Customer Area => Settings => Server Communication => Standard Notification => Password.</tooltip> <tooltip>Set a password of your choice and copy it over to Adyen Customer Area => Settings => Server Communication => Standard Notification => Password.</tooltip>
</field> </field>
<field id="ws_username_test" translate="label" type="text" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0"> <field id="api_key_test" translate="label" type="obscure" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Webservice username for Test</label> <label>API key for Test</label>
<tooltip>Find this in your Test Adyen Customer Area => Settings => Users => System. Normally this will be ws@Company.YourCompanyAccount. Copy and Paste the exact ws user name here.</tooltip> <tooltip>If you don't know your Api-Key, log in to your Test Customer Area. Navigate to Settings > Users > System, and click on your webservice user, normally this will be ws@Company.YourCompanyAccount. Under Checkout token is your API Key.</tooltip>
<config_path>payment/adyen_abstract/ws_username_test</config_path>
</field>
<field id="ws_password_test" translate="label" type="obscure" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Webservice Password for Test</label>
<tooltip>Find this in your Test Adyen Customer Area => Settings => Users => System. Click on your web service user and generate a new password. Copy and Paste the exact password here.</tooltip>
<backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model> <backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model>
<config_path>payment/adyen_abstract/ws_password_test</config_path> <config_path>payment/adyen_abstract/api_key_test</config_path>
</field>
<field id="ws_username_live" translate="label" type="text" sortOrder="70" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Webservice username for Live</label>
<tooltip>This is only applicable if you have a Live account. Find this in your Live Adyen Customer Area => Settings => Users => System. Normally this will be ws@Company.YourCompanyAccount. Copy and Paste the exact ws user name here.</tooltip>
<config_path>payment/adyen_abstract/ws_username_live</config_path>
</field> </field>
<field id="ws_password_live" translate="label" type="obscure" sortOrder="80" showInDefault="1" showInWebsite="1" showInStore="0"> <field id="api_key_live" translate="label" type="obscure" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Webservice Password for Live</label> <label>API key for Live</label>
<tooltip>This is only applicable if you have a Live account. Find this in your Live Adyen Customer Area => Settings => Users => System. Click on your web service user and generate a new password. Copy and Paste the exact password here.</tooltip> <tooltip>If you don't know your Api-Key, log in to your Live Customer Area. Navigate to Settings > Users > System, and click on your webservice user, normally this will be ws@Company.YourCompanyAccount. Under Checkout token is your API Key.</tooltip>
<backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model> <backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model>
<config_path>payment/adyen_abstract/ws_password_live</config_path> <config_path>payment/adyen_abstract/api_key_live</config_path>
</field>
<field id="live_endpoint_url_prefix" translate="label" type="text" sortOrder="70" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Live endpoint prefix</label>
<tooltip><![CDATA[e.g. if your live endpoint is: <br/> <i>https://1234a567bcd89ef0-MagentoCompany-checkout-live.adyenpayments.com</i> <br/> please type: <strong>1234a567bcd89ef0-MagentoCompany</strong> in this field.]]></tooltip>
<comment><![CDATA[Provide the unique live url prefix: <strong>[random]-[company name]</strong> from the "API URLs and Response" menu in the Adyen Customer Area. For more information, please check <a href="https://docs.adyen.com/developers/development-resources/live-endpoints#checkoutendpoints"> our documentation</a>.]]></comment>
<config_path>payment/adyen_abstract/live_endpoint_url_prefix</config_path>
</field> </field>
<field id="capture_mode" translate="label" type="select" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="1"> <field id="capture_mode" translate="label" type="select" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Capture Delay</label> <label>Capture Delay</label>
<tooltip>Immediate is the default. Set to manual if you want to perform the capture of funds manually later (only affects credit cards and a few alternative payment methods). You need to change this setting as well in Adyen Customer Area => Settings => Merchant Settings => Capture Delay. If you have selected a capture delay of a couple of days in Adyen keep it here on immediate</tooltip> <tooltip>Immediate is the default. Set to manual if you want to perform the capture of funds manually later (only affects credit cards and a few alternative payment methods). You need to change this setting as well in Adyen Customer Area => Settings => Merchant Settings => Capture Delay. If you have selected a capture delay of a couple of days in Adyen keep it here on immediate</tooltip>
...@@ -107,4 +104,4 @@ ...@@ -107,4 +104,4 @@
<config_path>payment/adyen_abstract/debug</config_path> <config_path>payment/adyen_abstract/debug</config_path>
</field> </field>
</group> </group>
</include> </include>
\ No newline at end of file
...@@ -61,5 +61,21 @@ ...@@ -61,5 +61,21 @@
<label>UnionPay</label> <label>UnionPay</label>
<code_alt>cup</code_alt> <code_alt>cup</code_alt>
</type> </type>
<type id="BCMC" order="80">
<label>Bancontact</label>
<code_alt>bcmc</code_alt>
</type>
<type id="HIPERCARD" order="80">
<label>Hipercard</label>
<code_alt>hipercard</code_alt>
</type>
<type id="ELO" order="80">
<label>Elo</label>
<code_alt>elo</code_alt>
</type>
<type id="AURA" order="80">
<label>Aura</label>
<code_alt>aura</code_alt>
</type>
</adyen_credit_cards> </adyen_credit_cards>
</payment> </payment>
...@@ -28,20 +28,21 @@ ...@@ -28,20 +28,21 @@
<adyen_abstract> <adyen_abstract>
<active>0</active> <active>0</active>
<model>AdyenPaymentGenericFacade</model> <model>AdyenPaymentGenericFacade</model>
<recurring_type>ONECLICK</recurring_type>
<order_status>pending</order_status> <order_status>pending</order_status>
<demo_mode>0</demo_mode> <demo_mode>1</demo_mode>
<debug>1</debug> <debug>1</debug>
<title_renderer>title_image</title_renderer> <title_renderer>title_image</title_renderer>
<sepa_flow>sale</sepa_flow> <sepa_flow>sale</sepa_flow>
<split_payments_refund_strategy>1</split_payments_refund_strategy> <split_payments_refund_strategy>1</split_payments_refund_strategy>
<return_path>checkout/cart</return_path> <return_path>checkout/cart</return_path>
<enable_oneclick>1</enable_oneclick>
<enable_recurring>0</enable_recurring>
<group>adyen</group> <group>adyen</group>
</adyen_abstract> </adyen_abstract>
<adyen_cc> <adyen_cc>
<active>1</active> <active>1</active>
<model>AdyenPaymentCcFacade</model> <model>AdyenPaymentCcFacade</model>
<title>Adyen CreditCard</title> <title>Credit Card</title>
<allowspecific>0</allowspecific> <allowspecific>0</allowspecific>
<sort_order>2</sort_order> <sort_order>2</sort_order>
<cctypes>AE,VI,MC,DI</cctypes> <cctypes>AE,VI,MC,DI</cctypes>
...@@ -129,26 +130,6 @@ ...@@ -129,26 +130,6 @@
<can_cancel>1</can_cancel> <can_cancel>1</can_cancel>
<group>adyen</group> <group>adyen</group>
</adyen_sepa> </adyen_sepa>
<adyen_pos>
<active>0</active>
<model>AdyenPaymentPosFacade</model>
<order_status>pending</order_status>
<title>Adyen POS</title>
<allowspecific>0</allowspecific>
<sort_order>5</sort_order>
<payment_action>order</payment_action>
<can_initialize>1</can_initialize>
<is_gateway>1</is_gateway>
<can_use_checkout>1</can_use_checkout>
<can_capture>1</can_capture>
<can_capture_partial>1</can_capture_partial>
<can_use_internal>0</can_use_internal>
<can_refund_partial_per_invoice>1</can_refund_partial_per_invoice>
<can_refund>1</can_refund>
<can_void>1</can_void>
<can_cancel>1</can_cancel>
<group>adyen</group>
</adyen_pos>
<adyen_pos_cloud> <adyen_pos_cloud>
<active>0</active> <active>0</active>
<model>AdyenPaymentPosCloudFacade</model> <model>AdyenPaymentPosCloudFacade</model>
...@@ -169,7 +150,7 @@ ...@@ -169,7 +150,7 @@
<can_cancel>1</can_cancel> <can_cancel>1</can_cancel>
<pos_timeout>30</pos_timeout> <pos_timeout>30</pos_timeout>
<total_timeout>120</total_timeout> <total_timeout>120</total_timeout>
<recurring_type>ONECLICK</recurring_type> <recurring_type>NONE</recurring_type>
<group>adyen</group> <group>adyen</group>
</adyen_pos_cloud> </adyen_pos_cloud>
<adyen_pay_by_mail> <adyen_pay_by_mail>
......
This diff is collapsed.
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
<item name="adyen_hpp_config_provider" xsi:type="object">Adyen\Payment\Model\Ui\AdyenHppConfigProvider</item> <item name="adyen_hpp_config_provider" xsi:type="object">Adyen\Payment\Model\Ui\AdyenHppConfigProvider</item>
<item name="adyen_sepa_config_provider" xsi:type="object">Adyen\Payment\Model\Ui\AdyenSepaConfigProvider</item> <item name="adyen_sepa_config_provider" xsi:type="object">Adyen\Payment\Model\Ui\AdyenSepaConfigProvider</item>
<item name="adyen_boleto_config_provider" xsi:type="object">Adyen\Payment\Model\Ui\AdyenBoletoConfigProvider</item> <item name="adyen_boleto_config_provider" xsi:type="object">Adyen\Payment\Model\Ui\AdyenBoletoConfigProvider</item>
<item name="adyen_pos_config_provider" xsi:type="object">Adyen\Payment\Model\Ui\AdyenPosConfigProvider</item>
<item name="adyen_pos_cloud_config_provider" xsi:type="object">Adyen\Payment\Model\Ui\AdyenPosCloudConfigProvider</item> <item name="adyen_pos_cloud_config_provider" xsi:type="object">Adyen\Payment\Model\Ui\AdyenPosCloudConfigProvider</item>
<item name="adyen_apple_pay_config_provider" xsi:type="object">Adyen\Payment\Model\Ui\AdyenApplePayConfigProvider</item> <item name="adyen_apple_pay_config_provider" xsi:type="object">Adyen\Payment\Model\Ui\AdyenApplePayConfigProvider</item>
</argument> </argument>
......
...@@ -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="2.4.3"> <module name="Adyen_Payment" setup_version="3.0.0">
<sequence> <sequence>
<module name="Magento_Sales"/> <module name="Magento_Sales"/>
<module name="Magento_Quote"/> <module name="Magento_Quote"/>
......
...@@ -51,4 +51,5 @@ ...@@ -51,4 +51,5 @@
"Failed to disable this contract","Failed to disable this contract" "Failed to disable this contract","Failed to disable this contract"
"You will be redirected to the Adyen App", "You will be redirected to the Adyen App" "You will be redirected to the Adyen App", "You will be redirected to the Adyen App"
"Continue to Adyen App", "Continue to Adyen App" "Continue to Adyen App", "Continue to Adyen App"
"Do not use Installments", "Do not use Installments" "Do not use Installments", "Do not use Installments"
\ No newline at end of file "(Please provide a card with the type from the list above)", "(Please provide a card with the type from the list above)"
\ No newline at end of file
...@@ -52,3 +52,4 @@ ...@@ -52,3 +52,4 @@
"You will be redirected to the Adyen App", "U wordt doorgestuurd naar de Adyen-app" "You will be redirected to the Adyen App", "U wordt doorgestuurd naar de Adyen-app"
"Continue to Adyen App", "Doorgaan naar Adyen-app" "Continue to Adyen App", "Doorgaan naar Adyen-app"
"Do not use Installments", "Gebruik geen wederkerende betalingen" "Do not use Installments", "Gebruik geen wederkerende betalingen"
"(Please provide a card with the type from the list above)", "(Please provide a card with the type from the list above)"
<?php <?xml version="1.0"?>
<!--
/** /**
* ###### * ######
* ###### * ######
...@@ -20,13 +21,9 @@ ...@@ -20,13 +21,9 @@
* *
* Author: Adyen <magento@adyen.com> * Author: Adyen <magento@adyen.com>
*/ */
-->
namespace Adyen\Payment\Block\Info; <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
class Pos extends AbstractInfo <css src="Adyen_Payment::css/order_create_styles.css"/>
{ </head>
/** </page>
* @var string
*/
protected $_template = 'Adyen_Payment::info/adyen_pos.phtml';
}
This diff is collapsed.
<?php
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Payment module (https://www.adyen.com/)
*
* Copyright (c) 2015 Adyen BV (https://www.adyen.com/)
* See LICENSE.txt for license details.
*
* Author: Adyen <magento@adyen.com>
*/
// @codingStandardsIgnoreFile
?>
<?php
/**
* @see \Magento\Payment\Block\Info
*/
?>
<?php echo $block->escapeHtml($block->getMethod()->getTitle()) ?>
<?php
$_info = $this->getInfo();
$_isDemoMode = $block->isDemoMode();
?>
<?php if ($_pspReference = $_info->getAdditionalInformation('pspReference')):?>
<div>
<?php if($_isDemoMode): ?>
<?php echo __('Adyen PSP Reference: <a href="https://ca-test.adyen.com/ca/ca/accounts/showTx.shtml?pspReference=%1&txType=Payment" target="__blank">%1</a>', $block->escapeHtml($_pspReference), $block->escapeHtml($_pspReference)) ?>
<?php else: ?>
<?php echo __('Adyen PSP Reference: <a href="https://ca-live.adyen.com/ca/ca/accounts/showTx.shtml?pspReference=%1&txType=Payment" target="__blank">%1</a>', $block->escapeHtml($_pspReference), $block->escapeHtml($_pspReference)) ?>
<?php endif; ?>
</div>
<?php endif;?>
<?php if($_info->getAdditionalInformation('adyen_total_fraud_score') != ""): ?>
<?php echo __('Total fraud score: %1', $_info->getAdditionalInformation('adyen_total_fraud_score')) ?><br/>
<?php endif; ?>
<?php if ($_specificInfo = $block->getSpecificInformation()):?>
<table class="data-table admin__table-secondary">
<?php foreach ($_specificInfo as $_label => $_value):?>
<tr>
<th><?php echo $block->escapeHtml($_label)?>:</th>
<td><?php echo nl2br(implode("\n", $block->getValueAsArray($_value, true)))?></td>
</tr>
<?php endforeach; ?>
</table>
<?php endif;?>
<?php echo $block->getChildHtml()?>
This diff is collapsed.
<?xml version="1.0"?>
<!--
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Payment module (https://www.adyen.com/)
*
* Copyright (c) 2015 Adyen BV (https://www.adyen.com/)
* See LICENSE.txt for license details.
*
* Author: Adyen <magento@adyen.com>
*/
-->
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd">
<container name="root">
<block class="Adyen\Payment\Block\Redirect\Pos" name="adyen-pos-redirect-form" template="redirect/pos/form.phtml" cacheable="false"/>
</container>
</layout>
\ No newline at end of file
...@@ -64,9 +64,6 @@ ...@@ -64,9 +64,6 @@
<item name="adyen_apple_pay" xsi:type="array"> <item name="adyen_apple_pay" xsi:type="array">
<item name="isBillingAddressRequired" xsi:type="boolean">true</item> <item name="isBillingAddressRequired" xsi:type="boolean">true</item>
</item> </item>
<item name="adyen_pos" xsi:type="array">
<item name="isBillingAddressRequired" xsi:type="boolean">true</item>
</item>
<item name="adyen_pos_cloud" xsi:type="array"> <item name="adyen_pos_cloud" xsi:type="array">
<item name="isBillingAddressRequired" xsi:type="boolean">true</item> <item name="isBillingAddressRequired" xsi:type="boolean">true</item>
</item> </item>
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
$_info = $this->getInfo(); $_info = $this->getInfo();
?> ?>
<dl class="payment-method adyen_pos"> <dl class="payment-method adyen_paybymail">
<dt class="title"><?php echo $block->escapeHtml($block->getMethod()->getTitle()) ?></dt> <dt class="title"><?php echo $block->escapeHtml($block->getMethod()->getTitle()) ?></dt>
<dt><a target="_blank" href="<?php echo $this->getMethod()->getInfoInstance()->getAdditionalInformation('payment_url'); ?>"><?php echo __("Click here to pay for your purchase"); ?></a></dt> <dt><a target="_blank" href="<?php echo $this->getMethod()->getInfoInstance()->getAdditionalInformation('payment_url'); ?>"><?php echo __("Click here to pay for your purchase"); ?></a></dt>
</dl> </dl>
<?php
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Payment module (https://www.adyen.com/)
*
* Copyright (c) 2015 Adyen BV (https://www.adyen.com/)
* See LICENSE.txt for license details.
*
* Author: Adyen <magento@adyen.com>
*/
// @codingStandardsIgnoreFile
?>
<?php
$_info = $this->getInfo();
?>
<dl class="payment-method adyen_pos">
<?php echo $this->escapeHtml($this->getMethod()->getTitle()) ?><br/>
<dt class="title"><?php echo $block->escapeHtml($block->getMethod()->getTitle()) ?></dt>
</dl>
<?php
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Payment module (https://www.adyen.com/)
*
* Copyright (c) 2015 Adyen BV (https://www.adyen.com/)
* See LICENSE.txt for license details.
*
* Author: Adyen <magento@adyen.com>
*/
?>
<html>
<head>
</head>
<body>
<a id="adyen-pos-launchlink" href="<?php echo $block->getLaunchLink(); ?>">Continue</a>
<script>
document.getElementById('adyen-pos-launchlink').click();
</script>
</body>
</html>
This diff is collapsed.
...@@ -48,10 +48,6 @@ define( ...@@ -48,10 +48,6 @@ define(
type: 'adyen_sepa', type: 'adyen_sepa',
component: 'Adyen_Payment/js/view/payment/method-renderer/adyen-sepa-method' component: 'Adyen_Payment/js/view/payment/method-renderer/adyen-sepa-method'
}, },
{
type: 'adyen_pos',
component: 'Adyen_Payment/js/view/payment/method-renderer/adyen-pos-method'
},
{ {
type: 'adyen_boleto', type: 'adyen_boleto',
component: 'Adyen_Payment/js/view/payment/method-renderer/adyen-boleto-method' component: 'Adyen_Payment/js/view/payment/method-renderer/adyen-boleto-method'
...@@ -66,6 +62,21 @@ define( ...@@ -66,6 +62,21 @@ define(
} }
); );
/** Add view logic here if needed */ /** Add view logic here if needed */
return Component.extend({}); return Component.extend({
initialize: function () {
var self = this;
this._super();
// include checkout card component javascript
var checkoutCardComponentScriptTag = document.createElement('script');
checkoutCardComponentScriptTag.id = "AdyenCheckoutCardComponentScript";
checkoutCardComponentScriptTag.src = self.getCheckoutCardComponentSource();
checkoutCardComponentScriptTag.type = "text/javascript";
document.body.appendChild(checkoutCardComponentScriptTag);
},
getCheckoutCardComponentSource: function() {
return window.checkoutConfig.payment.checkoutCardComponentSource;
},
});
} }
); );
\ No newline at end of file
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Payment module (https://www.adyen.com/)
*
* Copyright (c) 2015 Adyen BV (https://www.adyen.com/)
* See LICENSE.txt for license details.
*
* Author: Adyen <magento@adyen.com>
*/
define(
[
'jquery',
'Magento_Checkout/js/view/payment/default',
'Magento_Checkout/js/model/payment/additional-validators',
'Magento_Checkout/js/model/full-screen-loader',
'Magento_Checkout/js/action/place-order',
'Magento_Checkout/js/model/quote'
],
function ($, Component, additionalValidators, fullScreenLoader, placeOrderAction, quote) {
'use strict';
return Component.extend({
defaults: {
template: 'Adyen_Payment/payment/pos-form'
},
initObservable: function () {
this._super()
.observe([]);
return this;
},
/** Redirect to adyen */
continueToAdyen: function () {
var self = this;
if (this.validate() && additionalValidators.validate()) {
//update payment method information if additional data was changed
this.isPlaceOrderActionAllowed(false);
fullScreenLoader.startLoader();
$.when(
placeOrderAction(this.getData(), this.messageContainer)
).fail(
function () {
self.isPlaceOrderActionAllowed(true);
}
).done(
function () {
self.afterPlaceOrder();
$.mage.redirect(
window.checkoutConfig.payment[quote.paymentMethod().method].redirectUrl
);
}
);
}
return false;
},
showLogo: function () {
return window.checkoutConfig.payment.adyen.showLogo;
},
validate: function () {
return true;
}
});
}
);
<!--
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Payment module (https://www.adyen.com/)
*
* Copyright (c) 2015 Adyen BV (https://www.adyen.com/)
* See LICENSE.txt for license details.
*
* Author: Adyen <magento@adyen.com>
*/
-->
<div class="payment-method" data-bind="css: {'_active': (getCode() == isChecked())}">
<div class="payment-method-title field choice">
<input type="radio"
name="payment[method]"
class="radio"
data-bind="attr: {'id': getCode()}, value: getCode(), checked: isChecked, click: selectPaymentMethod, visible: isRadioButtonVisible()"/>
<label data-bind="attr: {'for': getCode()}" class="label">
<!-- ko if: showLogo() -->
<div data-bind="attr: { 'class': 'adyen-sprite ' + getCode() }"></div>
<!--/ko-->
<span data-bind="text: getTitle()"></span>
</label>
</div>
<div class="payment-method-content">
<div class="payment-method-billing-address">
<!-- ko foreach: $parent.getRegion(getBillingAddressFormName()) -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
</div>
<!-- ko foreach: getRegion('messages') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
<fieldset class="fieldset" data-bind='attr: {id: "payment_form_" + getCode()}'>
<div class="payment-method-note">
<!-- ko text: $t('You will be redirected to the Adyen App.') --><!-- /ko -->
</div>
</fieldset>
<div class="checkout-agreements-block">
<!-- ko foreach: $parent.getRegion('before-place-order') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
</div>
<div class="actions-toolbar">
<div class="primary">
<button class="action primary checkout"
type="submit"
data-bind="click: continueToAdyen, enable: (getCode() == isChecked())"
disabled>
<span data-bind="text: $t('Continue to Adyen App')"></span>
</button>
</div>
</div>
</div>
</div>
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