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

Merge pull request #371 from Adyen/feature/secure-fields-integration

Feature/secure fields integration
parents df964c35 a0694726
<?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
*/
protected $_template = 'Adyen_Payment::form/cc.phtml';
/**
* Payment config model
*
* @var \Magento\Payment\Model\Config
*/
protected $_paymentConfig;
/**
* @var \Adyen\Payment\Helper\Data
*/
protected $_adyenHelper;
protected $adyenHelper;
/**
* @var \Magento\Framework\App\State
*/
protected $_appState;
protected $appState;
/**
* @var \Magento\Checkout\Model\Session
*/
protected $_checkoutSession;
protected $checkoutSession;
/**
* Cc constructor.
......@@ -69,26 +62,34 @@ class Cc extends \Magento\Payment\Block\Form\Cc
array $data = []
) {
parent::__construct($context, $paymentConfig);
$this->_adyenHelper = $adyenHelper;
$this->_appState = $context->getAppState();
$this->_checkoutSession = $checkoutSession;
$this->adyenHelper = $adyenHelper;
$this->appState = $context->getAppState();
$this->checkoutSession = $checkoutSession;
}
/**
* @return string
*/
public function getCheckoutCardComponentJs()
{
return $this->adyenHelper->getCheckoutCardComponentJs($this->checkoutSession->getQuote()->getStore()->getId());
}
/**
* @return mixed
* @throws \Magento\Framework\Exception\LocalizedException
* @return string
* @throws \Adyen\AdyenException
*/
public function getLibrarySource()
public function getCheckoutOriginKeys()
{
// get storeId for admin
if (!$this->_appState->getAreaCode() === \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) {
$storeId = $this->_storeManager->getStore()->getId();
} else {
$storeId = null;
return $this->adyenHelper->getOriginKeyForBaseUrl();
}
return $this->_adyenHelper->getLibrarySource($storeId);
/**
* @return string
*/
public function getCheckoutContextUrl()
{
return $this->adyenHelper->getCheckoutContextUrl($this->checkoutSession->getQuote()->getStore()->getId());
}
/**
......@@ -99,14 +100,45 @@ class Cc extends \Magento\Payment\Block\Form\Cc
public function hasVerification()
{
// 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();
$store = $this->_checkoutSession->getQuote()->getStore();
$enableMoto = $this->_adyenHelper->getAdyenCcConfigDataFlag('enable_moto', $store->getId());
$store = $this->checkoutSession->getQuote()->getStore();
$enableMoto = $this->adyenHelper->getAdyenCcConfigDataFlag('enable_moto', $store->getId());
if ($enableMoto) {
return false;
}
}
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
// For backend only allow recurring payments
$recurringType = \Adyen\Payment\Model\RecurringType::RECURRING;
$cards = $this->_adyenHelper->getOneClickPaymentMethods($customerId, $storeId, $grandTotal, $recurringType);
$cards = $this->adyenHelper->getOneClickPaymentMethods($customerId, $storeId, $grandTotal, $recurringType);
return $cards;
}
......
<?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\Block\Redirect;
use Symfony\Component\Config\Definition\Exception\Exception;
class Pos extends \Magento\Payment\Block\Form
{
protected $_orderFactory;
/**
* @var \Magento\Checkout\Model\Session
*/
protected $_checkoutSession;
/**
* @var \Magento\Checkout\Model\Order
*/
protected $_order;
/**
* @var \Adyen\Payment\Helper\Data
*/
protected $_adyenHelper;
/**
* @var \Adyen\Payment\Logger\AdyenLogger
*/
protected $_adyenLogger;
/**
* Currency factory
*
* @var \Magento\Directory\Model\CurrencyFactory
*/
protected $_currencyFactory;
/**
* Pos constructor.
*
* @param \Magento\Framework\View\Element\Template\Context $context
* @param array $data
* @param \Magento\Sales\Model\OrderFactory $orderFactory
* @param \Magento\Checkout\Model\Session $checkoutSession
* @param \Adyen\Payment\Helper\Data $adyenHelper
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
*/
public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
array $data = [],
\Magento\Sales\Model\OrderFactory $orderFactory,
\Magento\Checkout\Model\Session $checkoutSession,
\Adyen\Payment\Helper\Data $adyenHelper,
\Adyen\Payment\Logger\AdyenLogger $adyenLogger,
\Magento\Directory\Model\CurrencyFactory $currencyFactory
) {
$this->_orderFactory = $orderFactory;
$this->_checkoutSession = $checkoutSession;
parent::__construct($context, $data);
$this->_request = $context->getRequest();
$this->_adyenHelper = $adyenHelper;
$this->_adyenLogger = $adyenLogger;
$this->_currencyFactory = $currencyFactory;
if (!$this->_order) {
$incrementId = $this->_getCheckout()->getLastRealOrderId();
$this->_order = $this->_orderFactory->create()->loadByIncrementId($incrementId);
}
}
/**
* @return $this
*/
public function _prepareLayout()
{
return parent::_prepareLayout();
}
/**
* @return string
*/
public function getLaunchLink()
{
$launchlink = "";
try {
if ($this->_order->getPayment()) {
$realOrderId = $this->_order->getRealOrderId();
$orderCurrencyCode = $this->_order->getOrderCurrencyCode();
$amount = $this->_adyenHelper->formatAmount(
$this->_order->getGrandTotal(),
$orderCurrencyCode
);
$shopperEmail = $this->_order->getCustomerEmail();
$customerId = $this->_order->getCustomerId();
$callbackUrl = $this->_urlBuilder->getUrl(
'adyen/process/resultpos',
['_secure' => $this->_getRequest()->isSecure()]
);
$addReceiptOrderLines = $this->_adyenHelper->getAdyenPosConfigData("add_receipt_order_lines");
$recurringContract = $this->_adyenHelper->getAdyenPosConfigData('recurring_type');
$currencyCode = $orderCurrencyCode;
$paymentAmount = $amount;
$merchantReference = $realOrderId;
$recurringParams = "";
if ($this->_order->getPayment()->getAdditionalInformation("store_cc") != ""
&& $customerId > 0
) {
$recurringParams = "&recurringContract=" . urlencode($recurringContract) . "&shopperReference=" .
urlencode($customerId) . "&shopperEmail=" . urlencode($shopperEmail);
}
$receiptOrderLines = "";
if ($addReceiptOrderLines) {
$orderLines = base64_encode($this->_getReceiptOrderLines($this->_order));
$receiptOrderLines = "&receiptOrderLines=" . urlencode($orderLines);
}
// extra parameters so that you alway's return these paramters from the application
$extraParamaters = urlencode("/?originalCustomCurrency=".$currencyCode."&originalCustomAmount=".
$paymentAmount. "&originalCustomMerchantReference=".
$merchantReference . "&originalCustomSessionId=".session_id());
// Cash you can trigger by adding transactionType=CASH
$launchlink = "adyen://payment?sessionId=".session_id() .
"&amount=".$paymentAmount."&currency=".$currencyCode."&merchantReference=".$merchantReference .
$recurringParams . $receiptOrderLines . "&callback=".$callbackUrl . $extraParamaters;
// cash not working see ticket
// https://youtrack.is.adyen.com/issue/IOS-130#comment=102-20285
// . "&transactionType=CASH";
$this->_adyenLogger->addAdyenDebug(print_r($launchlink, true));
}
} catch (Exception $e) {
// do nothing for now
throw($e);
}
return $launchlink;
}
/**
* @param \Magento\Sales\Model\Order $order
* @return string
*/
protected function _getReceiptOrderLines(\Magento\Sales\Model\Order $order)
{
$myReceiptOrderLines = "";
$currency = $order->getOrderCurrencyCode();
$formattedAmountValue = $this->_currencyFactory->create()->format(
$order->getGrandTotal(),
['display'=>\Magento\Framework\Currency::NO_SYMBOL],
false
);
$taxAmount = $order->getTaxAmount();
$formattedTaxAmount = $this->_currencyFactory->create()->format(
$taxAmount,
['display'=>\Magento\Framework\Currency::NO_SYMBOL],
false
);
$myReceiptOrderLines .= "---||C\n".
"====== YOUR ORDER DETAILS ======||CB\n".
"---||C\n".
" No. Description |Piece Subtotal|\n";
foreach ($order->getItemsCollection() as $item) {
//skip dummies
if ($item->isDummy()) {
continue;
};
$singlePriceFormat = $this->_currencyFactory->create()->format(
$item->getPriceInclTax(),
['display'=>\Magento\Framework\Currency::NO_SYMBOL],
false
);
$itemAmount = $item->getPriceInclTax() * (int) $item->getQtyOrdered();
$itemAmountFormat = $this->_currencyFactory->create()->format(
$itemAmount,
['display'=>\Magento\Framework\Currency::NO_SYMBOL],
false
);
$myReceiptOrderLines .= " " . (int) $item->getQtyOrdered() . " " . trim(substr($item->getName(), 0, 25)) .
"| " . $currency . " " . $singlePriceFormat . " " . $currency . " " . $itemAmountFormat . "|\n";
}
//discount cost
if ($order->getDiscountAmount() > 0 || $order->getDiscountAmount() < 0) {
$discountAmountFormat = $this->_currencyFactory->create()->format(
$order->getDiscountAmount(),
['display'=>\Magento\Framework\Currency::NO_SYMBOL],
false
);
$myReceiptOrderLines .= " " . 1 . " " . $this->__('Total Discount') . "| " .
$currency . " " . $discountAmountFormat ."|\n";
}
//shipping cost
if ($order->getShippingAmount() > 0 || $order->getShippingTaxAmount() > 0) {
$shippingAmountFormat = $this->_currencyFactory->create()->format(
$order->getShippingAmount(),
['display'=>\Magento\Framework\Currency::NO_SYMBOL],
false
);
$myReceiptOrderLines .= " " . 1 . " " . $order->getShippingDescription() . "| " .
$currency . " " . $shippingAmountFormat ."|\n";
}
if ($order->getPaymentFeeAmount() > 0) {
$paymentFeeAmount = $this->_currencyFactory->create()->format(
$order->getPaymentFeeAmount(),
['display'=>\Magento\Framework\Currency::NO_SYMBOL],
false
);
$myReceiptOrderLines .= " " . 1 . " " . $this->__('Payment Fee') . "| " .
$currency . " " . $paymentFeeAmount ."|\n";
}
$myReceiptOrderLines .= "|--------|\n".
"|Order Total: ".$currency." ".$formattedAmountValue."|B\n".
"|Tax: ".$currency." ".$formattedTaxAmount."|B\n".
"||C\n";
/*
* New header for card details section!
* Default location is After Header so simply add to Order Details as separator
*/
$myReceiptOrderLines .= "---||C\n".
"====== YOUR PAYMENT DETAILS ======||CB\n".
"---||C\n";
return $myReceiptOrderLines;
}
/**
* Get frontend checkout session object
*
* @return \Magento\Checkout\Model\Session
*/
protected function _getCheckout()
{
return $this->_checkoutSession;
}
/**
* Retrieve request object
*
* @return \Magento\Framework\App\RequestInterface
*/
protected function _getRequest()
{
return $this->_request;
}
}
......@@ -235,9 +235,7 @@ class Redirect extends \Magento\Payment\Block\Form
);
$formFields['shopperEmail'] = $shopperEmail;
// recurring
$recurringType = trim($this->_adyenHelper->getAdyenAbstractConfigData(
'recurring_type'
));
$recurringType = $this->_adyenHelper->getRecurringTypeFromOneclickRecurringSetting();
$brandCode = $this->_order->getPayment()->getAdditionalInformation(
\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
$formFields['shopperEmail'] = $shopperEmail;
// recurring
$recurringType = trim($this->_adyenHelper->getAdyenAbstractConfigData('recurring_type', $storeId));
$recurringType = $this->_adyenHelper->getRecurringTypeFromOneclickRecurringSetting($storeId);
$sessionValidity = $this->_adyenHelper->getAdyenPayByMailConfigData('session_validity', $storeId);
......
......@@ -20,14 +20,15 @@
*
* 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
*/
private $adyenHelper;
/**
* PaymentDataBuilder constructor.
*
* TransactionPayment constructor.
* @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;
}
/**
* @param array $buildSubject
* @return array
* @param \Magento\Payment\Gateway\Http\TransferInterface $transferObject
* @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 */
$paymentDataObject = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($buildSubject);
$payment = $paymentDataObject->getPayment();
$md = $payment->getAdditionalInformation('md');
$paResponse = $payment->getAdditionalInformation('paResponse');
return [
"md" => $md,
"paResponse" => $paResponse,
];
$request = $transferObject->getBody();
$client = $this->adyenHelper->initializeAdyenClient();
$service = new \Adyen\Service\Checkout($client);
try {
$response = $service->payments($request);
} catch (\Adyen\AdyenException $e) {
$response['error'] = $e->getMessage();
}
return $response;
}
}
......@@ -65,13 +65,38 @@ class CcAuthorizationDataBuilder implements BuilderInterface
$storeId = $order->getStoreId();
$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'] =
$payment->getAdditionalInformation(AdyenCcDataAssignObserver::ENCRYPTED_DATA);
if ($cardNumber = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::ENCRYPTED_CREDIT_CARD_NUMBER)) {
$request['paymentMethod']['encryptedCardNumber'] = $cardNumber;
}
// Remove from additional data
$payment->unsAdditionalInformation(AdyenCcDataAssignObserver::ENCRYPTED_DATA);
if ($expiryMonth = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::ENCRYPTED_EXPIRY_MONTH)) {
$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
......@@ -83,10 +108,10 @@ class CcAuthorizationDataBuilder implements BuilderInterface
$request['shopperInteraction'] = "Moto";
}
// if installments is set add it into the request
if ($payment->getAdditionalInformation('number_of_installments') &&
$payment->getAdditionalInformation('number_of_installments') > 0
if ($payment->getAdditionalInformation(AdyenCcDataAssignObserver::NUMBER_OF_INSTALLMENTS) &&
$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;
......
......@@ -23,6 +23,7 @@
namespace Adyen\Payment\Gateway\Request;
use Adyen\Payment\Observer\AdyenOneclickDataAssignObserver;
use Magento\Payment\Gateway\Request\BuilderInterface;
class OneclickAuthorizationDataBuilder implements BuilderInterface
......@@ -53,7 +54,6 @@ class OneclickAuthorizationDataBuilder implements BuilderInterface
/** @var \Magento\Payment\Gateway\Data\PaymentDataObject $paymentDataObject */
$paymentDataObject = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($buildSubject);
$payment = $paymentDataObject->getPayment();
$recurringDetailReference = $payment->getAdditionalInformation("recurring_detail_reference");
if ($payment->getAdditionalInformation('customer_interaction')) {
$shopperInteraction = "Ecommerce";
......@@ -61,8 +61,8 @@ class OneclickAuthorizationDataBuilder implements BuilderInterface
$shopperInteraction = "ContAuth";
}
$request['selectedRecurringDetailReference'] = $recurringDetailReference;
$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 ($payment->getCcType() == "sepadirectdebit") {
......
......@@ -20,6 +20,7 @@
*
* Author: Adyen <magento@adyen.com>
*/
namespace Adyen\Payment\Gateway\Request;
use Magento\Payment\Gateway\Request\BuilderInterface;
......@@ -50,9 +51,11 @@ class RecurringDataBuilder implements BuilderInterface
$this->appState = $context->getAppState();
}
/**
* @param array $buildSubject
* @return array
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function build(array $buildSubject)
{
......@@ -61,45 +64,29 @@ class RecurringDataBuilder implements BuilderInterface
/** @var \Magento\Payment\Gateway\Data\PaymentDataObject $paymentDataObject */
$paymentDataObject = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($buildSubject);
$payment = $paymentDataObject->getPayment();
// Needs to change when oneclick,cc using facade impl.
$paymentMethodCode = $payment->getMethodInstance()->getCode();
$customerId = $payment->getOrder()->getCustomerId();
$storeId = null;
if ($this->appState->getAreaCode() === \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) {
$storeId = $payment->getOrder()->getStoreId();
}
$recurringType = $this->adyenHelper->getAdyenAbstractConfigData('recurring_type', $storeId);
// set the recurring type
$recurringContractType = null;
if ($recurringType) {
if ($paymentMethodCode == \Adyen\Payment\Model\Ui\AdyenOneclickConfigProvider::CODE) {
/*
* For ONECLICK look at the recurringPaymentType that the merchant
* has selected in Adyen ONECLICK settings
*/
if ($payment->getAdditionalInformation('customer_interaction')) {
$recurringContractType = \Adyen\Payment\Model\RecurringType::ONECLICK;
$enableOneclick = $this->adyenHelper->getAdyenAbstractConfigData('enable_oneclick', $storeId);
$enableRecurring = $this->adyenHelper->getAdyenAbstractConfigData('enable_recurring', $storeId);
if ($enableOneclick) {
$result['enableOneClick'] = true;
} else {
$recurringContractType = \Adyen\Payment\Model\RecurringType::RECURRING;
}
} 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;
$result['enableOneClick'] = false;
}
if ($enableRecurring) {
$result['enableRecurring'] = true;
} else {
$recurringContractType = $recurringType;
}
$result['enableRecurring'] = false;
}
// only when recurringContractType is set and when a customer is loggedIn
if ($recurringContractType && $customerId > 0) {
$recurring = ['contract' => $recurringContractType];
$result['recurring'] = $recurring;
if ($payment->getAdditionalInformation('store_cc') === '1') {
$result['paymentMethod']['storeDetails'] = true;
}
return $result;
......
......@@ -38,17 +38,11 @@ class SepaAuthorizationDataBuilder implements BuilderInterface
$payment = $paymentDataObject->getPayment();
$request = [];
// set brand to sepa
$request['selectedBrand'] = "sepadirectdebit";
// add bankDetails into request
$bankAccount = [
'iban' => $payment->getAdditionalInformation("iban"),
'ownerName' => $payment->getAdditionalInformation("account_name"),
'countryCode' => $payment->getAdditionalInformation("country")
];
$request['bankAccount'] = $bankAccount;
$request['paymentMethod']['type'] = "sepadirectdebit";
$request['paymentMethod']['sepa.ibanNumber'] = $payment->getAdditionalInformation("iban");
$request['paymentMethod']['sepa.ownerName'] = $payment->getAdditionalInformation("account_name");
$request['paymentMethod']['countryCode'] = $payment->getAdditionalInformation("country");
return $request;
}
......
......@@ -21,45 +21,54 @@
* Author: Adyen <magento@adyen.com>
*/
namespace Adyen\Payment\Gateway\Command;
namespace Adyen\Payment\Gateway\Response;
use Magento\Payment\Gateway\Command;
use Magento\Payment\Gateway\CommandInterface;
use Magento\Payment\Gateway\Response\HandlerInterface;
class PosCommand implements CommandInterface
class CheckoutPaymentCommentHistoryHandler implements HandlerInterface
{
/**
* @var \Adyen\Payment\Helper\Data
*/
protected $_adyenHelper;
/**
* HppCommand constructor.
*
* @param \Adyen\Payment\Helper\Data $adyenHelper
*/
public function __construct(\Adyen\Payment\Helper\Data $adyenHelper)
{
$this->_adyenHelper = $adyenHelper;
}
/**
* @param array $commandSubject
* @param array $handlingSubject
* @param array $response
* @return $this
*/
public function execute(array $commandSubject)
public function handle(array $handlingSubject, array $response)
{
$payment =\Magento\Payment\Gateway\Helper\SubjectReader::readPayment($commandSubject);
$stateObject = \Magento\Payment\Gateway\Helper\SubjectReader::readStateObject($commandSubject);
$payment = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($handlingSubject);
// do not send email
/** @var OrderPaymentInterface $payment */
$payment = $payment->getPayment();
$payment->getOrder()->setCanSendNewEmailFlag(false);
// update status and state
$stateObject->setState(\Magento\Sales\Model\Order::STATE_NEW);
$stateObject->setStatus($this->_adyenHelper->getAdyenAbstractConfigData('order_status'));
$stateObject->setIsNotified(false);
$comment = __("Adyen Result response:");
if (isset($response['resultCode'])) {
$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;
}
......
......@@ -21,87 +21,59 @@
* Author: Adyen <magento@adyen.com>
*/
namespace Adyen\Payment\Model\Ui;
namespace Adyen\Payment\Gateway\Response;
use Magento\Checkout\Model\ConfigProviderInterface;
use Magento\Payment\Helper\Data as PaymentHelper;
use Magento\Directory\Helper\Data;
use Magento\Payment\Gateway\Response\HandlerInterface;
class AdyenPosConfigProvider implements ConfigProviderInterface
class CheckoutPaymentsDetailsHandler implements HandlerInterface
{
const CODE = 'adyen_pos';
/**
* @var PaymentHelper
*/
protected $_paymentHelper;
/**
* @var \Adyen\Payment\Helper\Data
*/
protected $_adyenHelper;
/**
* Request object
*
* @var \Magento\Framework\App\RequestInterface
*/
protected $_request;
/**
* @var \Magento\Framework\UrlInterface
*/
protected $_urlBuilder;
protected $adyenHelper;
/**
* AdyenHppConfigProvider constructor.
*
* @param PaymentHelper $paymentHelper
* @param \Adyen\Payment\Helper\Data $adyenHelper
*/
public function __construct(
PaymentHelper $paymentHelper,
\Adyen\Payment\Helper\Data $adyenHelper,
\Magento\Framework\App\RequestInterface $request,
\Magento\Framework\UrlInterface $urlBuilder
\Adyen\Payment\Helper\Data $adyenHelper
) {
$this->_paymentHelper = $paymentHelper;
$this->_adyenHelper = $adyenHelper;
$this->_request = $request;
$this->_urlBuilder = $urlBuilder;
$this->adyenHelper = $adyenHelper;
}
/**
* Set configuration for AdyenHPP payemnt method
*
* @return array
* @param array $handlingSubject
* @param array $response
*/
public function getConfig()
public function handle(array $handlingSubject, array $response)
{
// set to active
$config = [
'payment' => [
self::CODE => [
'isActive' => true,
'redirectUrl' => $this->_urlBuilder->getUrl(
'adyen/process/redirectPos',
['_secure' => $this->_getRequest()->isSecure()]
)
]
]
];
$payment = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($handlingSubject);
/** @var OrderPaymentInterface $payment */
$payment = $payment->getPayment();
// set transaction not to processing by default wait for notification
$payment->setIsTransactionPending(true);
// no not send order confirmation mail
$payment->getOrder()->setCanSendNewEmailFlag(false);
return $config;
if (!empty($response['pspReference'])) {
// set pspReference as transactionId
$payment->setCcTransId($response['pspReference']);
$payment->setLastTransId($response['pspReference']);
// set transaction
$payment->setTransactionId($response['pspReference']);
}
/**
* Retrieve request object
*
* @return \Magento\Framework\App\RequestInterface
*/
protected function _getRequest()
{
return $this->_request;
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
private $adyenLogger;
/**
* PaymentDataBuilder constructor.
* PaymentPosCloudHandler constructor.
*
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
* @param \Adyen\Payment\Helper\Data $adyenHelper
......@@ -74,6 +74,41 @@ class PaymentPosCloudHandler implements HandlerInterface
// do not send order confirmation mail
$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)
if (!empty($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);
}
}
......@@ -33,6 +33,10 @@ class Data extends AbstractHelper
const MODULE_NAME = 'adyen-magento2';
const TEST = 'test';
const LIVE = 'live';
const CHECKOUT_CONTEXT_URL_LIVE = 'https://checkoutshopper-live.adyen.com/checkoutshopper/';
const CHECKOUT_CONTEXT_URL_TEST = 'https://checkoutshopper-test.adyen.com/checkoutshopper/';
const CHECKOUT_COMPONENT_JS_LIVE = 'https://checkoutshopper-live.adyen.com/checkoutshopper/sdk/2.0.0/adyen.js';
const CHECKOUT_COMPONENT_JS_TEST = 'https://checkoutshopper-test.adyen.com/checkoutshopper/sdk/2.0.0/adyen.js';
/**
* @var \Magento\Framework\Encryption\EncryptorInterface
......@@ -60,7 +64,7 @@ class Data extends AbstractHelper
protected $_billingAgreementCollectionFactory;
/**
* @var Repository
* @var \Magento\Framework\View\Asset\Repository
*/
protected $_assetRepo;
......@@ -94,9 +98,28 @@ class Data extends AbstractHelper
*/
protected $adyenLogger;
/**
* @var \Magento\Store\Model\StoreManagerInterface
*/
protected $storeManager;
/**
* @var \Magento\Framework\App\CacheInterface
*/
protected $cache;
/**
* @var \Adyen\Payment\Model\Billing\AgreementFactory
*/
protected $billingAgreementFactory;
/**
* @var ResourceModel\Billing\Agreement
*/
private $agreementResourceModel;
/**
* Data constructor.
*
* @param \Magento\Framework\App\Helper\Context $context
* @param \Magento\Framework\Encryption\EncryptorInterface $encryptor
* @param \Magento\Framework\Config\DataInterface $dataStorage
......@@ -105,8 +128,15 @@ class Data extends AbstractHelper
* @param \Adyen\Payment\Model\ResourceModel\Billing\Agreement\CollectionFactory $billingAgreementCollectionFactory
* @param \Magento\Framework\View\Asset\Repository $assetRepo
* @param \Magento\Framework\View\Asset\Source $assetSource
* @param \Adyen\Payment\Model\ResourceModel\Notification\CollectionFactory $notificationFactory
* @param \Magento\Tax\Model\Config $taxConfig
* @param \Magento\Tax\Model\Calculation $taxCalculation
* @param \Magento\Framework\App\ProductMetadataInterface $productMetadata
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
* @param \Magento\Framework\App\CacheInterface $cache
* @param \Adyen\Payment\Model\Billing\AgreementFactory $billingAgreementFactory
* @param \Adyen\Payment\Model\ResourceModel\Billing\Agreement $agreementResourceModel
*/
public function __construct(
\Magento\Framework\App\Helper\Context $context,
......@@ -121,7 +151,11 @@ class Data extends AbstractHelper
\Magento\Tax\Model\Config $taxConfig,
\Magento\Tax\Model\Calculation $taxCalculation,
\Magento\Framework\App\ProductMetadataInterface $productMetadata,
\Adyen\Payment\Logger\AdyenLogger $adyenLogger
\Adyen\Payment\Logger\AdyenLogger $adyenLogger,
\Magento\Store\Model\StoreManagerInterface $storeManager,
\Magento\Framework\App\CacheInterface $cache,
\Adyen\Payment\Model\Billing\AgreementFactory $billingAgreementFactory,
\Adyen\Payment\Model\ResourceModel\Billing\Agreement $agreementResourceModel
) {
parent::__construct($context);
$this->_encryptor = $encryptor;
......@@ -136,6 +170,10 @@ class Data extends AbstractHelper
$this->_taxCalculation = $taxCalculation;
$this->productMetadata = $productMetadata;
$this->adyenLogger = $adyenLogger;
$this->storeManager = $storeManager;
$this->cache = $cache;
$this->billingAgreementFactory = $billingAgreementFactory;
$this->agreementResourceModel = $agreementResourceModel;
}
/**
......@@ -315,8 +353,8 @@ class Data extends AbstractHelper
/**
* Fix this one string street + number
* @example street + number
* @param type $street
* @return type $street
* @param array $street
* @return array $street
*/
public static function formatStreet($street)
{
......@@ -422,28 +460,6 @@ class Data extends AbstractHelper
return $this->getConfigData($field, 'adyen_oneclick', $storeId, true);
}
/**
* @desc Gives back adyen_pos configuration values
* @param $field
* @param int|null $storeId
* @return mixed
*/
public function getAdyenPosConfigData($field, $storeId = null)
{
return $this->getConfigData($field, 'adyen_pos', $storeId);
}
/**
* @desc Gives back adyen_pos configuration values as flag
* @param $field
* @param int|null $storeId
* @return mixed
*/
public function getAdyenPosConfigDataFlag($field, $storeId = null)
{
return $this->getConfigData($field, 'adyen_pos', $storeId, true);
}
/**
* @param $field
* @param int|null $storeId
......@@ -579,6 +595,8 @@ class Data extends AbstractHelper
/**
* @desc Check if configuration is set to demo mode
*
* @param int|null $storeId
* @return mixed
*/
public function isDemoMode($storeId = null)
......@@ -595,8 +613,28 @@ class Data extends AbstractHelper
return $this->_encryptor->decrypt(trim($this->getAdyenAbstractConfigData('notification_password')));
}
/**
* @desc Retrieve the API key
*
* @param int|null $storeId
* @return string
*/
public function getAPIKey($storeId = null)
{
if ($this->isDemoMode($storeId)) {
$apiKey = $this->_encryptor->decrypt(trim($this->getAdyenAbstractConfigData('api_key_test',
$storeId)));
} else {
$apiKey = $this->_encryptor->decrypt(trim($this->getAdyenAbstractConfigData('api_key_live',
$storeId)));
}
return $apiKey;
}
/**
* @desc Retrieve the webserver username
*
* @param int|null $storeId
* @return string
*/
public function getWsUsername($storeId = null)
......@@ -610,23 +648,15 @@ class Data extends AbstractHelper
}
/**
* @desc Retrieve the webserver password
* @desc Retrieve the Live endpoint prefix key
*
* @param int|null $storeId
* @return string
*/
public function getWsPassword($storeId = null)
public function getLiveEndpointPrefix($storeId = null)
{
if ($this->isDemoMode($storeId)) {
$wsPassword = $this->_encryptor->decrypt(trim($this->getAdyenAbstractConfigData(
'ws_password_test',
$storeId
)));
} else {
$wsPassword = $this->_encryptor->decrypt(trim($this->getAdyenAbstractConfigData(
'ws_password_live',
$storeId
)));
}
return $wsPassword;
$prefix = trim($this->getAdyenAbstractConfigData('live_endpoint_url_prefix', $storeId));
return $prefix;
}
/**
......@@ -828,7 +858,9 @@ class Data extends AbstractHelper
$baCollection = $this->_billingAgreementCollectionFactory->create();
$baCollection->addFieldToFilter('customer_id', $customerId);
if ($this->isPerStoreBillingAgreement($storeId)) {
$baCollection->addFieldToFilter('store_id', $storeId);
}
$baCollection->addFieldToFilter('method_code', 'adyen_oneclick');
$baCollection->addActiveFilter();
......@@ -911,6 +943,9 @@ class Data extends AbstractHelper
return $billingAgreements;
}
public function isPerStoreBillingAgreement($storeId) {
return !$this->getAdyenOneclickConfigDataFlag('share_billing_agreement', $storeId);
}
/**
* @param $paymentMethod
......@@ -1021,37 +1056,6 @@ class Data extends AbstractHelper
$notifications = $this->_notificationFactory->create();
$notifications->unprocessedNotificationsFilter();
return $notifications->getSize();
;
}
/**
* @param $storeId
* @return mixed
*/
public function getLibraryToken($storeId = null)
{
if ($this->isDemoMode($storeId)) {
$libraryToken = $this->getAdyenCcConfigData('cse_library_token_test', $storeId);
} else {
$libraryToken = $this->getAdyenCcConfigData('cse_library_token_live', $storeId);
}
return $libraryToken;
}
/**
* Returns the hosted location of the client side encryption file
*
* @param null $storeId
* @return string
*/
public function getLibrarySource($storeId = null)
{
$environment = self::LIVE;
if ($this->isDemoMode($storeId)) {
$environment = self::TEST;
}
return "https://" . $environment . ".adyen.com/hpp/cse/js/" . $this->getLibraryToken($storeId) . ".shtml";
}
/**
......@@ -1309,16 +1313,11 @@ class Data extends AbstractHelper
public function initializeAdyenClient($storeId = null, $apiKey = null)
{
// initialize client
$client = new \Adyen\Client();
if ($apiKey) {
$client->setXApiKey($apiKey);
} else {
$client->setUsername($this->getWsUsername($storeId));
$client->setPassword($this->getWsPassword($storeId));
}
$apiKey = $this->getAPIKey($storeId);
$client = $this->createAdyenClient();
$client->setApplicationName("Magento 2 plugin");
$client->setXApiKey($apiKey);
$client->setAdyenPaymentSource($this->getModuleName(), $this->getModuleVersion());
......@@ -1327,7 +1326,7 @@ class Data extends AbstractHelper
if ($this->isDemoMode($storeId)) {
$client->setEnvironment(\Adyen\Environment::TEST);
} else {
$client->setEnvironment(\Adyen\Environment::LIVE);
$client->setEnvironment(\Adyen\Environment::LIVE, $this->getLiveEndpointPrefix($storeId));
}
$client->setLogger($this->adyenLogger);
......@@ -1336,7 +1335,7 @@ class Data extends AbstractHelper
}
/**
* @param \Adyen\Clien $client
* @param \Adyen\Client $client
* @return \Adyen\Service\PosPayment
* @throws \Adyen\AdyenException
*/
......@@ -1344,4 +1343,200 @@ class Data extends AbstractHelper
{
return new \Adyen\Service\PosPayment($client);
}
/**
* @return \Adyen\Client
* @throws \Adyen\AdyenException
*/
private function createAdyenClient()
{
return new \Adyen\Client();
}
/**
* Retrieve origin keys for platform's base url
*
* @return string
* @throws \Adyen\AdyenException
*/
public function getOriginKeyForBaseUrl()
{
$baseUrl = $this->storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_WEB);
$parsed = parse_url($baseUrl);
$domain = $parsed['scheme'] . "://" . $parsed['host'];
$storeId = $this->storeManager->getStore()->getId();
$cacheKey = 'Adyen_origin_key_for_' . $domain . '_' . $storeId;
if (!$originKey = $this->cache->load($cacheKey)) {
if ($originKey = $this->getOriginKeyForUrl($domain, $storeId)) {
$this->cache->save($originKey, $cacheKey, array(), 60 * 60 * 24);
}
}
return $originKey;
}
/**
* Get origin key for a specific url using the adyen api library client
*
* @param $url
* @param int|null $storeId
* @return string
* @throws \Adyen\AdyenException
*/
private function getOriginKeyForUrl($url, $storeId = null)
{
$params = array(
"originDomains" => array(
$url
)
);
$client = $this->initializeAdyenClient($storeId);
try {
$service = $this->createAdyenCheckoutUtilityService($client);
$response = $service->originKeys($params);
}
catch(\Exception $e){
$this->adyenLogger->error($e->getMessage());
}
$originKey = "";
if (!empty($response['originKeys'][$url])) {
$originKey = $response['originKeys'][$url];
}
return $originKey;
}
/**
* @param int|null $storeId
* @return string
*/
public function getCheckoutContextUrl($storeId = null)
{
if ($this->isDemoMode($storeId)) {
return self::CHECKOUT_CONTEXT_URL_TEST;
}
return self::CHECKOUT_CONTEXT_URL_LIVE;
}
/**
* @param \Adyen\Client $client
* @return \Adyen\Service\CheckoutUtility
* @throws \Adyen\AdyenException
*/
private function createAdyenCheckoutUtilityService($client)
{
return new \Adyen\Service\CheckoutUtility($client);
}
/**
* @param int|null $storeId
* @return string
*/
public function getCheckoutCardComponentJs($storeId = null)
{
if ($this->isDemoMode($storeId)) {
return self::CHECKOUT_COMPONENT_JS_TEST;
}
return self::CHECKOUT_COMPONENT_JS_LIVE;
}
/**
* @param $order
* @param $additionalData
*/
public function createAdyenBillingAgreement($order, $additionalData)
{
if (!empty($additionalData['recurring.recurringDetailReference'])) {
$listRecurringContracts = null;
try {
// Get or create billing agreement
/** @var \Adyen\Payment\Model\Billing\Agreement $billingAgreement */
$billingAgreement = $this->billingAgreementFactory->create();
$billingAgreement->load($additionalData['recurring.recurringDetailReference'], 'reference_id');
// check if BA exists
if (!($billingAgreement && $billingAgreement->getAgreementId() > 0 && $billingAgreement->isValid())) {
// create new BA
$this->adyenLogger->addAdyenDebug("Creating new Billing Agreement");
$billingAgreement = $this->billingAgreementFactory->create();
$billingAgreement->setStoreId($order->getStoreId());
$billingAgreement->importOrderPayment($order->getPayment());
if ($billingAgreement->getCustomerId() === null) {
$billingAgreement->setCustomerId($this->getCustomerId($order));
}
$message = __('Created billing agreement #%1.',
$additionalData['recurring.recurringDetailReference']);
} else {
$billingAgreement->setIsObjectChanged(true);
$message = __('Updated billing agreement #%1.',
$additionalData['recurring.recurringDetailReference']);
}
// Populate billing agreement data
$storeOneClick = $order->getPayment()->getAdditionalInformation('store_cc');
$billingAgreement->setCcBillingAgreement($additionalData, $storeOneClick);
if ($billingAgreement->isValid()) {
if (!$this->agreementResourceModel->getOrderRelation($billingAgreement->getAgreementId(),
$order->getId())) {
// save into sales_billing_agreement_order
$billingAgreement->addOrderRelation($order);
}
// add to order to save agreement
$order->addRelatedObject($billingAgreement);
} else {
$message = __('Failed to create billing agreement for this order. Reason(s): ') . join(', ', $billingAgreement->getErrors());
throw new \Exception($message);
}
} catch (\Exception $exception) {
$message = $exception->getMessage();
$this->adyenLogger->error("exception: " . $message);
}
$comment = $order->addStatusHistoryComment($message);
$order->addRelatedObject($comment);
}
}
/**
* Method can be used by interceptors to provide the customer ID in a different way.
* @param \Magento\Sales\Model\Order $order
* @return int|null
*/
public function getCustomerId(\Magento\Sales\Model\Order $order) {
return $order->getCustomerId();
}
/**
* For backwards compatibility get the recurringType used for HPP + current billing agreements
*
* @param null $storeId
* @return null|string
*/
public function getRecurringTypeFromOneclickRecurringSetting($storeId = null)
{
$enableOneclick = $this->getAdyenAbstractConfigData('enable_oneclick', $storeId);
$enableRecurring = $this->getAdyenAbstractConfigData('enable_recurring', $storeId);
if ($enableOneclick && $enableRecurring) {
return \Adyen\Payment\Model\RecurringType::ONECLICK_RECURRING;
} elseif ($enableOneclick && !$enableRecurring) {
return \Adyen\Payment\Model\RecurringType::ONECLICK;
} elseif (!$enableOneclick && $enableRecurring) {
return \Adyen\Payment\Model\RecurringType::RECURRING;
} else {
return \Adyen\Payment\Model\RecurringType::NONE;
}
}
}
......@@ -98,29 +98,29 @@ class PaymentRequest extends DataObject
{
$order = $payment->getOrder();
$storeId = $order->getStoreId();
$merchantAccount = $this->_adyenHelper->getAdyenAbstractConfigData("merchant_account", $storeId);
$shopperIp = $order->getRemoteIp();
$md = $payment->getAdditionalInformation('md');
$paResponse = $payment->getAdditionalInformation('paResponse');
$paymentData = $payment->getAdditionalInformation('paymentData');
$browserInfo = ['userAgent' => $_SERVER['HTTP_USER_AGENT'], 'acceptHeader' => $_SERVER['HTTP_ACCEPT']];
$request = [
"merchantAccount" => $merchantAccount,
"browserInfo" => $browserInfo,
"md" => $md,
"paResponse" => $paResponse,
"shopperIP" => $shopperIp
"paymentData" => $paymentData,
"details" => [
"MD" => $md,
"PaRes" => $paResponse
]
];
try {
$client = $this->createClient($storeId);
$service = new \Adyen\Service\Payment($client);
$result = $service->authorise3D($request);
} catch (\Adyen\AdyenException $e) {
$client = $this->_adyenHelper->initializeAdyenClient($storeId);
$service = new \Adyen\Service\Checkout($client);
$result = $service->paymentsDetails($request);
} catch(\Adyen\AdyenException $e) {
throw new \Magento\Framework\Exception\LocalizedException(__('3D secure failed'));
}
$this->_adyenHelper->createAdyenBillingAgreement($order, $result['additionalData']);
return $result;
}
......
......@@ -29,7 +29,7 @@ class Agreement extends \Magento\Paypal\Model\Billing\Agreement
/**
* @var \Adyen\Payment\Helper\Data
*/
private $_adyenHelper;
private $adyenHelper;
/**
* Agreement constructor.
......@@ -66,7 +66,7 @@ class Agreement extends \Magento\Paypal\Model\Billing\Agreement
$data
);
$this->_adyenHelper = $adyenHelper;
$this->adyenHelper = $adyenHelper;
}
/**
......@@ -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
* @return $this
*/
......@@ -105,7 +107,7 @@ class Agreement extends \Magento\Paypal\Model\Billing\Agreement
// Billing agreement is CC
if (isset($data['card']['number'])) {
$ccType = $data['variant'];
$ccTypes = $this->_adyenHelper->getCcTypesAltData();
$ccTypes = $this->adyenHelper->getCcTypesAltData();
if (isset($ccTypes[$ccType])) {
$ccType = $ccTypes[$ccType]['name'];
......@@ -123,7 +125,7 @@ class Agreement extends \Magento\Paypal\Model\Billing\Agreement
}
if ($data['variant'] == 'paypal') {
$email = "";
$email = '';
if (isset($data['tokenDetails']['tokenData']['EmailId'])) {
$email = $data['tokenDetails']['tokenData']['EmailId'];
......@@ -150,9 +152,7 @@ class Agreement extends \Magento\Paypal\Model\Billing\Agreement
public function setAgreementData($data)
{
if (is_array($data)) {
unset($data['creationDate']);
unset($data['recurringDetailReference']);
unset($data['payment_method']);
unset($data['creationDate'], $data['recurringDetailReference'], $data['payment_method']);
}
$this->setData('agreement_data', json_encode($data));
......@@ -166,4 +166,92 @@ class Agreement extends \Magento\Paypal\Model\Billing\Agreement
{
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
*/
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
*/
private $orderRepository;
/**
* @var ResourceModel\Billing\Agreement
*/
private $agreementResourceModel;
/**
* Cron constructor.
*
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
* @param ResourceModel\Notification\CollectionFactory $notificationFactory
......@@ -230,6 +234,7 @@ class Cron
* @param \Magento\Sales\Model\ResourceModel\Order\Status\CollectionFactory $orderStatusCollection
* @param SearchCriteriaBuilder $searchCriteriaBuilder
* @param OrderRepository $orderRepository
* @param ResourceModel\Billing\Agreement $agreementResourceModel
*/
public function __construct(
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
......@@ -249,7 +254,8 @@ class Cron
AreaList $areaList,
\Magento\Sales\Model\ResourceModel\Order\Status\CollectionFactory $orderStatusCollection,
SearchCriteriaBuilder $searchCriteriaBuilder,
OrderRepository $orderRepository
OrderRepository $orderRepository,
\Adyen\Payment\Model\ResourceModel\Billing\Agreement $agreementResourceModel
) {
$this->_scopeConfig = $scopeConfig;
$this->_adyenLogger = $adyenLogger;
......@@ -269,6 +275,7 @@ class Cron
$this->_orderStatusCollection = $orderStatusCollection;
$this->searchCriteriaBuilder = $searchCriteriaBuilder;
$this->orderRepository = $orderRepository;
$this->agreementResourceModel = $agreementResourceModel;
}
/**
......@@ -409,8 +416,13 @@ class Cron
$this->_processNotification();
}
$this->_order->save();
try {
// set done to true
$this->_order->save();
} catch (\Exception $e) {
$this->_adyenLogger->addAdyenNotificationCronjob($e->getMessage());
}
$this->_updateNotification($notification, false, true);
$this->_adyenLogger->addAdyenNotificationCronjob(
sprintf("Notification %s is processed", $notification->getEntityId())
......@@ -649,7 +661,6 @@ class Cron
if ($this->_eventCode == Notification::AUTHORISATION
|| $this->_eventCode == Notification::HANDLED_EXTERNALLY
|| ($this->_eventCode == Notification::CAPTURE && $_paymentCode == "adyen_pos")
) {
/*
* if current notification is authorisation : false and
......@@ -847,10 +858,7 @@ class Cron
break;
case Notification::HANDLED_EXTERNALLY:
case Notification::AUTHORISATION:
// for POS don't do anything on the AUTHORIZATION
if ($_paymentCode != "adyen_pos") {
$this->_authorizePayment();
}
break;
case Notification::MANUAL_REVIEW_REJECT:
// don't do anything it will send a CANCEL_OR_REFUND notification when this payment is captured
......@@ -865,7 +873,6 @@ class Cron
}
break;
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
......@@ -889,10 +896,6 @@ class Cron
}
}
}
} else {
// FOR POS authorize the payment on the CAPTURE notification
$this->_authorizePayment();
}
break;
case Notification::OFFER_CLOSED:
if (!$this->_order->canCancel()) {
......@@ -1028,11 +1031,16 @@ class Cron
// Populate billing agreement data
$billingAgreement->parseRecurringContractData($contractDetail);
if ($billingAgreement->isValid()) {
if (!$this->agreementResourceModel->getOrderRelation($billingAgreement->getAgreementId(),
$this->_order->getId())) {
// save into sales_billing_agreement_order
$billingAgreement->addOrderRelation($this->_order);
// add to order to save agreement
$this->_order->addRelatedObject($billingAgreement);
}
} else {
$message = __('Failed to create billing agreement for this order.');
throw new \Exception($message);
......@@ -1147,10 +1155,8 @@ class Cron
}
}
if (($this->_paymentMethod == "c_cash" &&
$this->_getConfigData('create_shipment', 'adyen_cash', $this->_order->getStoreId())) ||
($this->_getConfigData('create_shipment', 'adyen_pos', $this->_order->getStoreId()) &&
$_paymentCode == "adyen_pos")
if ($this->_paymentMethod == "c_cash" &&
$this->_getConfigData('create_shipment', 'adyen_cash', $this->_order->getStoreId())
) {
$this->_createShipment();
}
......@@ -1321,9 +1327,9 @@ class Cron
return false;
}
// payment method ideal, cash adyen_boleto or adyen_pos has direct capture
if ($_paymentCode == "adyen_pos" || (($_paymentCode == "adyen_sepa" ||
$this->_paymentMethod == "sepadirectdebit") && $sepaFlow != "authcap")
// payment method ideal, cash adyen_boleto has direct capture
if (($_paymentCode == "adyen_sepa" ||
$this->_paymentMethod == "sepadirectdebit") && $sepaFlow != "authcap"
) {
$this->_adyenLogger->addAdyenNotificationCronjob(
'This payment method does not allow manual capture.(2) paymentCode:' .
......@@ -1333,7 +1339,8 @@ class Cron
}
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) {
$this->_adyenLogger->addAdyenNotificationCronjob(
'This payment method is POS Cloud and configured to be working as auto capture '
......
......@@ -29,4 +29,13 @@ namespace Adyen\Payment\Model\ResourceModel\Billing;
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 @@
namespace Adyen\Payment\Model\Ui;
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
{
......@@ -65,24 +62,30 @@ class AdyenCcConfigProvider implements ConfigProviderInterface
*/
private $ccConfig;
/**
* @var \Magento\Store\Model\StoreManagerInterface
*/
private $storeManager;
/**
* AdyenCcConfigProvider constructor.
*
* @param PaymentHelper $paymentHelper
* @param \Magento\Payment\Helper\Data $paymentHelper
* @param \Adyen\Payment\Helper\Data $adyenHelper
* @param \Magento\Framework\App\RequestInterface $request
* @param \Magento\Framework\UrlInterface $urlBuilder
* @param Source $assetSource
* @param \Magento\Framework\View\Asset\Source $assetSource
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
* @param \Magento\Payment\Model\CcConfig $ccConfig
* @param Config $config
*/
public function __construct(
PaymentHelper $paymentHelper,
\Magento\Payment\Helper\Data $paymentHelper,
\Adyen\Payment\Helper\Data $adyenHelper,
\Magento\Framework\App\RequestInterface $request,
\Magento\Framework\UrlInterface $urlBuilder,
Source $assetSource,
\Magento\Framework\View\Asset\Source $assetSource,
\Magento\Store\Model\StoreManagerInterface $storeManager,
\Magento\Payment\Model\CcConfig $ccConfig
) {
$this->_paymentHelper = $paymentHelper;
......@@ -91,6 +94,7 @@ class AdyenCcConfigProvider implements ConfigProviderInterface
$this->_urlBuilder = $urlBuilder;
$this->_assetSource = $assetSource;
$this->ccConfig = $ccConfig;
$this->storeManager = $storeManager;
}
/**
......@@ -117,6 +121,7 @@ class AdyenCcConfigProvider implements ConfigProviderInterface
'payment' => [
'ccform' => [
'availableTypes' => [$methodCode => $this->getCcAvailableTypes($methodCode)],
'availableTypesByAlt' => [$methodCode => $this->getCcAvailableTypesByAlt($methodCode)],
'months' => [$methodCode => $this->getCcMonths()],
'years' => [$methodCode => $this->getCcYears()],
'hasVerification' => [$methodCode => $this->hasVerification($methodCode)],
......@@ -125,17 +130,23 @@ class AdyenCcConfigProvider implements ConfigProviderInterface
]
]);
$recurringType = $this->_adyenHelper->getAdyenAbstractConfigData('recurring_type');
$enableOneclick = $this->_adyenHelper->getAdyenAbstractConfigData('enable_oneclick');
$canCreateBillingAgreement = false;
if ($recurringType == "ONECLICK" || $recurringType == "ONECLICK,RECURRING") {
if ($enableOneclick) {
$canCreateBillingAgreement = true;
}
$config['payment'] ['adyenCc']['librarySource'] = $this->_adyenHelper->getLibrarySource();
$config['payment']['adyenCc']['generationTime'] = date("c");
$config['payment']['adyenCc']['methodCode'] = self::CODE;
$config['payment']['adyenCc']['locale'] = $this->_adyenHelper->getStoreLocale($this->storeManager->getStore()->getId());
$config['payment']['adyenCc']['canCreateBillingAgreement'] = $canCreateBillingAgreement;
$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
$config['payment']['adyenCc']['hasInstallments'] = false;
......@@ -176,6 +187,29 @@ class AdyenCcConfigProvider implements ConfigProviderInterface
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
*
......
......@@ -20,6 +20,7 @@
*
* Author: Adyen <magento@adyen.com>
*/
namespace Adyen\Payment\Model\Ui;
use Magento\Checkout\Model\ConfigProviderInterface;
......@@ -33,15 +34,24 @@ class AdyenGenericConfigProvider implements ConfigProviderInterface
*/
protected $_adyenHelper;
/**
* @var \Magento\Store\Model\StoreManagerInterface
*/
protected $storeManager;
/**
* AdyenGenericConfigProvider constructor.
*
* @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->storeManager = $storeManager;
}
/**
* Define foreach payment methods the RedirectUrl
*
......@@ -58,8 +68,12 @@ class AdyenGenericConfigProvider implements ConfigProviderInterface
} else {
$config['payment']['adyen']['showLogo'] = false;
}
$config['payment']['checkoutCardComponentSource'] = $this->_adyenHelper->getCheckoutCardComponentJs($this->storeManager->getStore()->getId());
return $config;
}
/**
* Return redirect URL for method
*
......
......@@ -81,6 +81,7 @@ class AdyenOneclickConfigProvider implements ConfigProviderInterface
* @param \Magento\Checkout\Model\Session $session
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
* @param \Magento\Framework\UrlInterface $urlBuilder
* @param \Magento\Payment\Model\CcConfig $ccConfig
*/
public function __construct(
\Adyen\Payment\Helper\Data $adyenHelper,
......@@ -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;
if ($recurringType == "ONECLICK" || $recurringType == "ONECLICK,RECURRING") {
if ($enableOneclick) {
$canCreateBillingAgreement = true;
}
$config['payment'] ['adyenOneclick']['librarySource'] = $this->_adyenHelper->getLibrarySource();
$config['payment']['adyenOneclick']['generationTime'] = date("c");
$config['payment']['adyenOneclick']['canCreateBillingAgreement'] = $canCreateBillingAgreement;
$recurringContractType = $this->_getRecurringContractType();
......@@ -174,6 +178,7 @@ class AdyenOneclickConfigProvider implements ConfigProviderInterface
$recurringType
);
}
return $billingAgreements;
}
......
......@@ -32,18 +32,28 @@ use Magento\Quote\Api\Data\PaymentInterface;
class AdyenCcDataAssignObserver extends AbstractDataAssignObserver
{
const CC_TYPE = 'cc_type';
const ENCRYPTED_DATA = 'encrypted_data';
const NUMBER_OF_INSTALLMENTS = 'number_of_installments';
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
*/
protected $additionalInformationList = [
self::CC_TYPE,
self::ENCRYPTED_DATA,
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;
class AdyenOneclickDataAssignObserver extends AbstractDataAssignObserver
{
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 VARIANT = 'variant';
/**
* @var array
*/
protected $additionalInformationList = [
self::RECURRING_DETAIL_REFERENCE,
self::ENCRYPTED_DATA,
self::NUMBER_OF_INSTALLMENTS
self::ENCRYPTED_SECURITY_CODE,
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 @@
"name": "adyen/module-payment",
"description": "Official Magento2 Plugin to connect to Payment Service Provider Adyen.",
"type": "magento2-module",
"version": "2.4.3",
"version": "3.0.0",
"license": [
"OSL-3.0",
"AFL-3.0"
......
......@@ -5,6 +5,7 @@
<argument name="messages" xsi:type="array">
<item name="AdyenCronMessage" xsi:type="string">Adyen\Payment\AdminMessage\CronMessage</item>
<item name="AdyenVersionMessage" xsi:type="string">Adyen\Payment\AdminMessage\VersionMessage</item>
<item name="AdyenAPIKeyMessage" xsi:type="string">Adyen\Payment\AdminMessage\APIKeyMessage</item>
</argument>
</arguments>
</type>
......
......@@ -43,7 +43,6 @@
<include path="Adyen_Payment::system/adyen_oneclick.xml"/>
<include path="Adyen_Payment::system/adyen_hpp.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_pay_by_mail.xml"/>
<include path="Adyen_Payment::system/adyen_boleto.xml"/>
......
......@@ -22,33 +22,30 @@
* 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_billing_agreements" translate="label" type="text" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="1">
<include xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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>
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
<comment>
<![CDATA[
<p>
<strong>ONECLICK</strong>: The shopper opts in to storing their card details for future use.
The shopper is present for the subsequent transaction, for cards the security code (CVC/CVV) is required.
</p>
<p>
<strong>RECURRING*</strong>: Payment details are stored for future use. For cards, the security
code (CVC/CVV) is not required for subsequent payments.
</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="enable_oneclick" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Enable OneClick</label>
<tooltip>The shopper opts in to storing their card details for future use. The shopper is present for the
subsequent transaction, for cards the security code (CVC/CVV) is required.
</tooltip>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/adyen_abstract/enable_oneclick</config_path>
</field>
<field id="recurring_type" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Agreement Type</label>
<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>
<source_model>Adyen\Payment\Model\Config\Source\RecurringType</source_model>
<config_path>payment/adyen_abstract/recurring_type</config_path>
<field id="enable_recurring" translate="label" type="select" sortOrder="30" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Enable Recurring</label>
<tooltip>Payment details are stored for future use. For cards, the security
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>
</group>
</include>
\ No newline at end of file
......@@ -47,16 +47,6 @@
<source_model>Adyen\Payment\Model\Config\Source\CcType</source_model>
<config_path>payment/adyen_cc/cctypes</config_path>
</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">
<label>Advanced Settings</label>
......
......@@ -49,5 +49,14 @@
<source_model>Adyen\Payment\Model\Config\Source\RecurringPaymentType</source_model>
<config_path>payment/adyen_oneclick/recurring_payment_type</config_path>
</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>
</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 @@
<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_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>
<group id="adyen_pos_country_specific" translate="label" showInDefault="1" showInWebsite="1" sortOrder="210">
<label>Country Specific Settings</label>
......
......@@ -49,28 +49,25 @@
<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>
</field>
<field id="ws_username_test" translate="label" type="text" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Webservice username 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>
<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>
<field id="api_key_test" translate="label" type="obscure" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0">
<label>API key for Test</label>
<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>
<backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model>
<config_path>payment/adyen_abstract/ws_password_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>
<config_path>payment/adyen_abstract/api_key_test</config_path>
</field>
<field id="ws_password_live" translate="label" type="obscure" sortOrder="80" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Webservice Password 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>
<field id="api_key_live" translate="label" type="obscure" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="0">
<label>API key for Live</label>
<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>
<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 id="capture_mode" translate="label" type="select" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="1">
<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>
......
......@@ -61,5 +61,21 @@
<label>UnionPay</label>
<code_alt>cup</code_alt>
</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>
</payment>
......@@ -28,20 +28,21 @@
<adyen_abstract>
<active>0</active>
<model>AdyenPaymentGenericFacade</model>
<recurring_type>ONECLICK</recurring_type>
<order_status>pending</order_status>
<demo_mode>0</demo_mode>
<demo_mode>1</demo_mode>
<debug>1</debug>
<title_renderer>title_image</title_renderer>
<sepa_flow>sale</sepa_flow>
<split_payments_refund_strategy>1</split_payments_refund_strategy>
<return_path>checkout/cart</return_path>
<enable_oneclick>1</enable_oneclick>
<enable_recurring>0</enable_recurring>
<group>adyen</group>
</adyen_abstract>
<adyen_cc>
<active>1</active>
<model>AdyenPaymentCcFacade</model>
<title>Adyen CreditCard</title>
<title>Credit Card</title>
<allowspecific>0</allowspecific>
<sort_order>2</sort_order>
<cctypes>AE,VI,MC,DI</cctypes>
......@@ -129,26 +130,6 @@
<can_cancel>1</can_cancel>
<group>adyen</group>
</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>
<active>0</active>
<model>AdyenPaymentPosCloudFacade</model>
......@@ -169,7 +150,7 @@
<can_cancel>1</can_cancel>
<pos_timeout>30</pos_timeout>
<total_timeout>120</total_timeout>
<recurring_type>ONECLICK</recurring_type>
<recurring_type>NONE</recurring_type>
<group>adyen</group>
</adyen_pos_cloud>
<adyen_pay_by_mail>
......
......@@ -84,16 +84,6 @@
<argument name="commandPool" xsi:type="object">AdyenPaymentBoletoCommandPool</argument>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentPosFacade" type="Magento\Payment\Model\Method\Adapter">
<arguments>
<argument name="code" xsi:type="const">Adyen\Payment\Model\Ui\AdyenPosConfigProvider::CODE</argument>
<argument name="formBlockType" xsi:type="string">Adyen\Payment\Block\Form\Pos</argument>
<argument name="infoBlockType" xsi:type="string">Adyen\Payment\Block\Info\Pos</argument>
<argument name="valueHandlerPool" xsi:type="object">AdyenPaymentPosValueHandlerPool</argument>
<argument name="validatorPool" xsi:type="object">AdyenPaymentPosValidatorPool</argument>
<argument name="commandPool" xsi:type="object">AdyenPaymentPosCommandPool</argument>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentPosCloudFacade" type="Magento\Payment\Model\Method\Adapter">
<arguments>
<argument name="code" xsi:type="const">Adyen\Payment\Model\Ui\AdyenPosCloudConfigProvider::CODE</argument>
......@@ -205,13 +195,6 @@
</arguments>
</virtualType>
<virtualType name="AdyenPaymentPosValueHandlerPool" type="Magento\Payment\Gateway\Config\ValueHandlerPool">
<arguments>
<argument name="handlers" xsi:type="array">
<item name="default" xsi:type="string">AdyenPaymentPosConfigValueHandler</item>
</argument>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentPosCloudValueHandlerPool" type="Magento\Payment\Gateway\Config\ValueHandlerPool">
<arguments>
<argument name="handlers" xsi:type="array">
......@@ -219,11 +202,6 @@
</argument>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentPosConfigValueHandler" type="Magento\Payment\Gateway\Config\ConfigValueHandler">
<arguments>
<argument name="configInterface" xsi:type="object">AdyenPaymentPosConfig</argument>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentPosCloudConfigValueHandler" type="Magento\Payment\Gateway\Config\ConfigValueHandler">
<arguments>
<argument name="configInterface" xsi:type="object">AdyenPaymentPosCloudConfig</argument>
......@@ -288,11 +266,6 @@
<argument name="methodCode" xsi:type="const">Adyen\Payment\Model\Ui\AdyenBoletoConfigProvider::CODE</argument>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentPosConfig" type="Magento\Payment\Gateway\Config\Config">
<arguments>
<argument name="methodCode" xsi:type="const">Adyen\Payment\Model\Ui\AdyenPosConfigProvider::CODE</argument>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentPosCloudConfig" type="Magento\Payment\Gateway\Config\Config">
<arguments>
<argument name="methodCode" xsi:type="const">Adyen\Payment\Model\Ui\AdyenPosCloudConfigProvider::CODE</argument>
......@@ -315,7 +288,6 @@
<arguments>
<argument name="commands" xsi:type="array">
<item name="authorize" xsi:type="string">AdyenPaymentCcAuthorizeCommand</item>
<item name="authorize_3d" xsi:type="string">AdyenPaymentAuthorize3DCommand</item>
<item name="capture" xsi:type="string">AdyenPaymentCaptureCommand</item>
<item name="void" xsi:type="string">AdyenPaymentCancelCommand</item>
<item name="refund" xsi:type="string">AdyenPaymentRefundCommand</item>
......@@ -328,7 +300,6 @@
<arguments>
<argument name="commands" xsi:type="array">
<item name="authorize" xsi:type="string">AdyenPaymentOneclickAuthorizeCommand</item>
<item name="authorize_3d" xsi:type="string">AdyenPaymentAuthorize3DCommand</item>
<item name="capture" xsi:type="string">AdyenPaymentCaptureCommand</item>
<item name="void" xsi:type="string">AdyenPaymentCancelCommand</item>
<item name="refund" xsi:type="string">AdyenPaymentRefundCommand</item>
......@@ -373,18 +344,6 @@
</arguments>
</virtualType>
<virtualType name="AdyenPaymentPosCommandPool" type="Magento\Payment\Gateway\Command\CommandPool">
<arguments>
<argument name="commands" xsi:type="array">
<item name="initialize" xsi:type="string">Adyen\Payment\Gateway\Command\PosCommand</item>
<item name="capture" xsi:type="string">AdyenPaymentCaptureCommand</item>
<item name="void" xsi:type="string">AdyenPaymentCancelCommand</item>
<item name="refund" xsi:type="string">AdyenPaymentRefundCommand</item>
<item name="cancel" xsi:type="string">AdyenPaymentCancelCommand</item>
</argument>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentPosCloudCommandPool" type="Magento\Payment\Gateway\Command\CommandPool">
<arguments>
<argument name="commands" xsi:type="array">
......@@ -426,17 +385,8 @@
<arguments>
<argument name="requestBuilder" xsi:type="object">AdyenPaymentCcAuthorizeRequest</argument>
<argument name="transferFactory" xsi:type="object">Adyen\Payment\Gateway\Http\TransferFactory</argument>
<argument name="client" xsi:type="object">Adyen\Payment\Gateway\Http\Client\TransactionAuthorization</argument>
<argument name="validator" xsi:type="object">GeneralResponseValidator</argument>
<argument name="handler" xsi:type="object">AdyenPaymentCcResponseHandlerComposite</argument>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentAuthorize3DCommand" type="Magento\Payment\Gateway\Command\GatewayCommand">
<arguments>
<argument name="requestBuilder" xsi:type="object">AdyenPaymentAuthorize3DRequest</argument>
<argument name="transferFactory" xsi:type="object">Adyen\Payment\Gateway\Http\TransferFactory</argument>
<argument name="client" xsi:type="object">Adyen\Payment\Gateway\Http\Client\TransactionAuthorization</argument>
<argument name="validator" xsi:type="object">GeneralResponseValidator</argument>
<argument name="client" xsi:type="object">Adyen\Payment\Gateway\Http\Client\TransactionPayment</argument>
<argument name="validator" xsi:type="object">CheckoutResponseValidator</argument>
<argument name="handler" xsi:type="object">AdyenPaymentCcResponseHandlerComposite</argument>
</arguments>
</virtualType>
......@@ -445,8 +395,8 @@
<arguments>
<argument name="requestBuilder" xsi:type="object">AdyenPaymentOneclickAuthorizeRequest</argument>
<argument name="transferFactory" xsi:type="object">Adyen\Payment\Gateway\Http\TransferFactory</argument>
<argument name="client" xsi:type="object">Adyen\Payment\Gateway\Http\Client\TransactionAuthorization</argument>
<argument name="validator" xsi:type="object">GeneralResponseValidator</argument>
<argument name="client" xsi:type="object">Adyen\Payment\Gateway\Http\Client\TransactionPayment</argument>
<argument name="validator" xsi:type="object">CheckoutResponseValidator</argument>
<argument name="handler" xsi:type="object">AdyenPaymentCcResponseHandlerComposite</argument>
</arguments>
</virtualType>
......@@ -455,8 +405,8 @@
<arguments>
<argument name="requestBuilder" xsi:type="object">AdyenPaymentSepaAuthorizeRequest</argument>
<argument name="transferFactory" xsi:type="object">Adyen\Payment\Gateway\Http\TransferFactory</argument>
<argument name="client" xsi:type="object">Adyen\Payment\Gateway\Http\Client\TransactionAuthorization</argument>
<argument name="validator" xsi:type="object">GeneralResponseValidator</argument>
<argument name="client" xsi:type="object">Adyen\Payment\Gateway\Http\Client\TransactionPayment</argument>
<argument name="validator" xsi:type="object">CheckoutResponseValidator</argument>
<argument name="handler" xsi:type="object">AdyenPaymentSepaResponseHandlerComposite</argument>
</arguments>
</virtualType>
......@@ -538,18 +488,6 @@
</arguments>
</virtualType>
<virtualType name="AdyenPaymentAuthorize3DRequest" type="Magento\Payment\Gateway\Request\BuilderComposite">
<arguments>
<argument name="builders" xsi:type="array">
<item name="merchantaccount" xsi:type="string">Adyen\Payment\Gateway\Request\MerchantAccountDataBuilder</item>
<item name="browserinfo" xsi:type="string">Adyen\Payment\Gateway\Request\BrowserInfoDataBuilder</item>
<item name="customerip" xsi:type="string">Adyen\Payment\Gateway\Request\CustomerIpDataBuilder</item>
<item name="3dsecure" xsi:type="string">Adyen\Payment\Gateway\Request\Authorize3DSecureDataBuilder</item>
</argument>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentOneclickAuthorizeRequest" type="Magento\Payment\Gateway\Request\BuilderComposite">
<arguments>
<argument name="builders" xsi:type="array">
......@@ -650,8 +588,8 @@
<virtualType name="AdyenPaymentCcResponseHandlerComposite" type="Magento\Payment\Gateway\Response\HandlerChain">
<arguments>
<argument name="handlers" xsi:type="array">
<item name="payment_details" xsi:type="string">Adyen\Payment\Gateway\Response\PaymentAuthorisationDetailsHandler</item>
<item name="payment_comments" xsi:type="string">Adyen\Payment\Gateway\Response\PaymentCommentHistoryHandler</item>
<item name="payment_details" xsi:type="string">Adyen\Payment\Gateway\Response\CheckoutPaymentsDetailsHandler</item>
<item name="payment_comments" xsi:type="string">Adyen\Payment\Gateway\Response\CheckoutPaymentCommentHistoryHandler</item>
</argument>
</arguments>
</virtualType>
......@@ -782,13 +720,6 @@
</arguments>
</virtualType>
<virtualType name="AdyenPaymentPosValidatorPool" type="Magento\Payment\Gateway\Validator\ValidatorPool">
<arguments>
<argument name="validators" xsi:type="array">
<item name="country" xsi:type="string">AdyenPosCountryValidator</item>
</argument>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentPosCloudValidatorPool" type="Magento\Payment\Gateway\Validator\ValidatorPool">
<arguments>
<argument name="validators" xsi:type="array">
......@@ -796,11 +727,6 @@
</argument>
</arguments>
</virtualType>
<virtualType name="AdyenPosCountryValidator" type="Magento\Payment\Gateway\Validator\CountryValidator">
<arguments>
<argument name="config" xsi:type="object">AdyenPaymentPosConfig</argument>
</arguments>
</virtualType>
<virtualType name="AdyenPosCloudCountryValidator" type="Magento\Payment\Gateway\Validator\CountryValidator">
<arguments>
<argument name="config" xsi:type="object">AdyenPaymentPosCloudConfig</argument>
......@@ -841,6 +767,20 @@
</arguments>
</virtualType>
<!--Checkout Response validator-->
<virtualType name="CheckoutResponseValidator" type="Adyen\Payment\Gateway\Validator\CheckoutResponseValidator">
<arguments>
<argument name="loggerInterface" xsi:type="object">Adyen\Payment\Logger\AdyenLogger</argument>
</arguments>
</virtualType>
<!--Checkout Response validator-->
<virtualType name="CheckoutResponseValidator" type="Adyen\Payment\Gateway\Validator\CheckoutResponseValidator">
<arguments>
<argument name="loggerInterface" xsi:type="object">Adyen\Payment\Logger\AdyenLogger</argument>
</arguments>
</virtualType>
<virtualType name="PosCloudResponseValidator" type="Adyen\Payment\Gateway\Validator\PosCloudResponseValidator">
<arguments>
<argument name="loggerInterface" xsi:type="object">Adyen\Payment\Logger\AdyenLogger</argument>
......
......@@ -33,7 +33,6 @@
<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_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_apple_pay_config_provider" xsi:type="object">Adyen\Payment\Model\Ui\AdyenApplePayConfigProvider</item>
</argument>
......
......@@ -24,7 +24,7 @@
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Adyen_Payment" setup_version="2.4.3">
<module name="Adyen_Payment" setup_version="3.0.0">
<sequence>
<module name="Magento_Sales"/>
<module name="Magento_Quote"/>
......
......@@ -52,3 +52,4 @@
"You will be redirected to the Adyen App", "You will be redirected to the Adyen App"
"Continue to Adyen App", "Continue to Adyen App"
"Do not use Installments", "Do not use Installments"
"(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 @@
"You will be redirected to the Adyen App", "U wordt doorgestuurd naar de Adyen-app"
"Continue to Adyen App", "Doorgaan naar Adyen-app"
"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 @@
*
* Author: Adyen <magento@adyen.com>
*/
namespace Adyen\Payment\Block\Info;
class Pos extends AbstractInfo
{
/**
* @var string
*/
protected $_template = 'Adyen_Payment::info/adyen_pos.phtml';
}
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<css src="Adyen_Payment::css/order_create_styles.css"/>
</head>
</page>
......@@ -32,109 +32,35 @@ $ccExpYear = $block->getInfoData('cc_exp_year');
?>
<fieldset class="admin__fieldset payment-method" id="payment_form_<?php /* @noEscape */
echo $code; ?>"
style="display:none">
<div class="field admin__field _required">
<label class="admin__field-label" for="<?php /* @noEscape */
echo $code; ?>" style="display:none">
<span id="noApiKey" class="message message-error error" style="visibility: hidden"><?php echo $block->escapeHtml(__('Please configure an API Key and a live endpoint prefix(if in Production Mode) in your Adyen Required Settings'));?></span>
<div class="field admin__field">
<label for="<?php /* @noEscape */
echo $code; ?>_cc_owner">
<span><?php echo $block->escapeHtml(__('Name on Card')); ?></span>
</label>
<div class="admin__field-control">
<div>
<input type="text" id="<?php /* @noEscape */
echo $code; ?>_cc_owner" data-encrypted-name="holderName"
echo $code; ?>_cc_owner" name="payment[holderName]"
title="<?php echo $block->escapeHtml(__('Name on Card')); ?>" class="admin__control-text"
value="<?php /* @noEscape */
echo $block->getInfoData('cc_owner'); ?>"/>
echo $block->getInfoData('cc_owner'); ?>"
placeholder="<?php echo $block->escapeHtml(__('Name on Card')); ?>"/>
</div>
</div>
<div class="field-type admin__field _required">
<label class="admin__field-label" for="<?php /* @noEscape */
echo $code; ?>_cc_type">
<span><?php echo $block->escapeHtml(__('Credit Card Type')); ?></span>
</label>
<div class="admin__field-control">
<select id="<?php /* @noEscape */
echo $code; ?>_cc_type" name="payment[cc_type]"
class="required-entry validate-cc-type-select admin__control-select">
<option value=""></option>
<?php foreach ($block->getCcAvailableTypes() as $typeCode => $typeName): ?>
<option value="<?php echo $block->escapeHtml($typeCode); ?>"
<?php if ($typeCode == $ccType): ?>selected="selected"<?php endif ?>>
<?php echo $block->escapeHtml($typeName); ?>
</option>
<?php endforeach ?>
</select>
</div>
</div>
<div class="field-number admin__field _required">
<label class="admin__field-label" for="<?php /* @noEscape */
echo $code; ?>_cc_number">
<span><?php echo $block->escapeHtml(__('Credit Card Number')); ?></span>
</label>
<div class="admin__field-control">
<input type="text" id="<?php /* @noEscape */
echo $code; ?>_cc_number" data-encrypted-name="number"
title="<?php echo $block->escapeHtml(__('Credit Card Number')); ?>"
class="admin__control-text validate-cc-number"
value="<?php /* @noEscape */
echo $block->getInfoData('cc_number'); ?>"/>
</div>
</div>
<div class="field-date admin__field _required">
<label class="admin__field-label" for="<?php /* @noEscape */
echo $code; ?>_expiration">
<span><?php echo $block->escapeHtml(__('Expiration Date')); ?></span>
</label>
<div class="admin__field-control">
<select id="<?php /* @noEscape */
echo $code ?>_expiration" data-encrypted-name="expiryMonth"
class="admin__control-select admin__control-select-month validate-cc-exp required-entry">
<?php foreach ($block->getCcMonths() as $k => $v): ?>
<option value="<?php echo $block->escapeHtml($k); ?>"
<?php if ($k == $ccExpMonth): ?>selected="selected"<?php endif ?>>
<?php echo $block->escapeHtml($v); ?>
</option>
<?php endforeach; ?>
</select>
<select id="<?php /* @noEscape */
echo $code ?>_expiration_yr" data-encrypted-name="expiryYear"
class="admin__control-select admin__control-select-year required-entry">
<?php foreach ($block->getCcYears() as $k => $v): ?>
<option value="<?php /* @noEscape */
echo $k ? $block->escapeHtml($k) : '' ?>"
<?php if ($k == $ccExpYear): ?>selected="selected"<?php endif ?>>
<?php echo $block->escapeHtml($v); ?>
</option>
<?php endforeach ?>
</select>
<input type="hidden" id="<?php echo $code ?>_encrypted_form_expiry_generationtime"
value="<?php echo date("c"); ?>" data-encrypted-name="generationtime"/>
</div>
</div>
<?php if ($block->hasVerification()): ?>
<div class="field-number required admin__field _required">
<label class="admin__field-label" for="<?php /* @noEscape */
echo $code; ?>_cc_cid">
<span><?php echo $block->escapeHtml(__('Card Verification Number')); ?></span>
</label>
<div class="admin__field-control">
<input type="text" title="<?php echo $block->escapeHtml(__('Card Verification Number')); ?>"
class="required-entry validate-cc-cvn admin__control-cvn admin__control-text"
id="<?php /* @noEscape */
echo $code; ?>_cc_cid"
data-encrypted-name="cvc" value="<?php /* @noEscape */
echo $block->getInfoData('cc_cid') ?>"/>
</div>
</div>
<?php endif; ?>
<div id="cardContainer-<?php /* @noEscape */
echo $code; ?>"></div>
<input id="<?php /* @noEscape */
echo $code; ?>-number" type="hidden" name="payment[number]">
<input id="<?php /* @noEscape */
echo $code; ?>-cvc" type="hidden" name="payment[cvc]">
<input id="<?php /* @noEscape */
echo $code; ?>-expiryMonth" type="hidden" name="payment[expiryMonth]">
<input id="<?php /* @noEscape */
echo $code; ?>-expiryYear" type="hidden" name="payment[expiryYear]">
<input id="<?php /* @noEscape */
echo $code; ?>-cc_type" type="hidden" name="payment[cc_type]">
<script>
require(
......@@ -144,58 +70,84 @@ echo $code; ?>"
"Magento_Sales/order/create/form"
],
function () {
//<![CDATA[
var dfScriptTag = document.createElement('script');
dfScriptTag.src = "<?php echo $block->getLibrarySource(); ?>";
dfScriptTag.type = "text/javascript";
document.body.appendChild(dfScriptTag);
var ccTypes = <?php echo json_encode($block->getCcAvailableTypesByAlt()); ?>;
var element = $('payment_form_<?php echo $code ?>');
var cse_form = $(element).closest('form');
var cse_options = {
name: 'payment[encrypted_data]'
};
//<![CDATA[
var cse = function () {
// Append checkout card components script
var scriptTag = document.createElement('script');
scriptTag.src = "<?php echo $block->getCheckoutCardComponentJs(); ?>";
scriptTag.type = "text/javascript";
document.body.appendChild(scriptTag);
if (order.paymentMethod && order.paymentMethod == '<?php echo $code ?>') {
try {
// Get cc type by adyen cc type
var getCcCodeByAltCode = function (altCode) {
// do not validate because it could be that CVC field does not exists (because MOTO this is not needed)
cse_options.enableValidations = false;
if (ccTypes.hasOwnProperty(altCode)) {
return ccTypes[altCode];
}
var cseForm = adyen.createEncryptedForm(cse_form, cse_options);
// encrypt data directly because submit button is not always on the page
var test = cseForm.encrypt();
cseForm.createEncryptedField(test);
} catch (e) {
var encryptionFailed = true;
return "";
}
var encryptedForm = document.getElementById(cse_options.name);
if (encryptionFailed || !encryptedForm || encryptedForm.value.length == 0) {
alert("Warning: Adyen Client Side Encryption cannot succeed.");
/*
* Initialize secure fields and set up the onChange callback to
* - fill the input fields with the encrypted data
* - show the heklper text when necessary
*/
var secureFieldsInitialize = function () {
if (!"<?php echo $block->getCheckoutOriginKeys(); ?>") {
document.getElementById('noApiKey').style="visibility: visible; display:inline-block";
return;
}
var cardNode = document.getElementById("cardContainer-<?php /* @noEscape */ echo $code; ?>");
var checkout = new AdyenCheckout({
locale: "<?php echo $block->getLocale(); ?>"
});
var hideCVC = "<?php echo !$block->hasVerification(); ?>";
var card = checkout.create('card', {
originKey: "<?php echo $block->getCheckoutOriginKeys(); ?>",
loadingContext: "<?php echo $block->getCheckoutContextUrl(); ?>",
type: 'card',
groupTypes: ccTypes,
hideCVC: hideCVC,
onChange: function (state) {
// When the state is valid update the input fields
if (state.isValid) {
// Here we enable the button if the component is now valid
jQuery("#<?php /* @noEscape */ echo $code; ?>-number").val(state.data.encryptedCardNumber);
jQuery("#<?php /* @noEscape */ echo $code; ?>-expiryMonth").val(state.data.encryptedExpiryMonth);
jQuery("#<?php /* @noEscape */ echo $code; ?>-expiryYear").val(state.data.encryptedExpiryYear);
jQuery("#<?php /* @noEscape */ echo $code; ?>-cvc").val(state.data.encryptedSecurityCode);
jQuery("#<?php /* @noEscape */ echo $code; ?>-cc_type").val(getCcCodeByAltCode(state.brand));
}
},
onError: function () {
}
var cse_initialize = function () {
order.submit = order.submit.wrap(function (originalSaveMethod) {
cse.call(this);
originalSaveMethod();
});
card.mount(cardNode);
}
if (document.readyState === "complete") {
cse_initialize();
// Load card components and force wait until the external script is loaded
if (scriptTag.readyState) {
scriptTag.onreadystatechange = function () {
if (script.readyState == "loaded" ||
script.readyState == "complete") {
script.onreadystatechange = null;
secureFieldsInitialize();
}
};
}
else {
Event.observe(window, 'load', cse_initialize);
scriptTag.onload = function () {
secureFieldsInitialize();
};
}
//]]>
});
</script>
</fieldset>
<?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()?>
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* 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>
*/
#payment_form_adyen_cc {
padding-left: 30px;
}
.adyen-checkout-card__form .adyen-checkout__input iframe{
max-height: 40px;
}
#payment_form_adyen_cc .admin__field{
margin-bottom: 10px;
}
#payment_form_adyen_cc .helper-text{
font-size: 11px;
color: rgb(144, 162, 189);
font-weight: 100;
}
#payment_form_adyen_cc #adyen_cc_cc_owner {
width: 225px;
border: none;
padding: 0;
color: rgb(0, 27, 43);
font-size: 16px;
font-weight: 400;
margin-top: 10px;
}
#payment_form_adyen_cc #adyen_cc_cc_owner .input-text:focus {
border: none;
box-shadow: none;
}
#payment_form_adyen_cc #adyen_cc_cc_owner::placeholder,
#payment_form_adyen_cc #adyen_cc_cc_owner:placeholder-shown
{
color: rgb(144, 162, 189);
font-weight: 200;
}
#payment_form_adyen_cc .cc-type-VI {
margin: 10px;
display: inline-block;
font-weight: bold;
}
/* Checkout card components style */
.adyen-checkout__payment-method {
position: relative;
background: white;
border: 1px solid #edf0f3;
cursor: pointer;
margin-top: -1px;
width: 100%;
transition: opacity 0.3s ease-out;
/* transition: margin 100ms cubic-bezier(0.4, 0, 0.2, 1) 0ms; */
}
.adyen-checkout__payment-method:focus {
outline: 0;
}
.adyen-checkout__payment-method:first-child,
.adyen-checkout__payment-method--selected + .adyen-checkout__payment-method {
margin-top: 0;
border-top-left-radius: 3px;
border-top-right-radius: 3px;
}
.adyen-checkout__payment-method--next-selected {
border-bottom-left-radius: 3px;
border-bottom-right-radius: 3px;
}
.adyen-checkout__payment-method--loading {
opacity: 0.2;
}
.adyen-checkout__payment-method--selected.adyen-checkout__payment-method--loading {
opacity: 0.9;
}
.adyen-checkout__payment-method--loading .adyen-checkout__spinner__wrapper {
position: absolute;
right: 0;
left: 0;
z-index: 1;
}
.adyen-checkout__payment-method__header {
display: flex;
align-items: center;
font-weight: 400;
font-size: 16px;
color: #00202e;
padding: 16px;
position: relative;
transition: background 0.1s ease-out;
width: 100%;
}
.adyen-checkout__payment-method__surcharge {
color: #687282;
margin-left: 5px;
}
.adyen-checkout__payment-method--selected {
transition: margin 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
background: #f7f8f9;
border: 1px solid #d4d9db;
margin: 8px 0;
border-radius: 3px;
cursor: default;
}
.adyen-checkout__payment-method--selected .adyen-checkout__payment-method__header {
font-weight: 500;
}
.adyen-checkout__payment-method__details__content {
padding: 6px 16px 24px;
}
.adyen-checkout__payment-method__image__wrapper {
height: 26px;
position: relative;
}
.adyen-checkout__payment-method__image__wrapper:after {
content: '';
position: absolute;
top: 0;
width: 100%;
height: 100%;
left: 0;
border-radius: 3px;
border: 1px solid rgba(0, 27, 43, 0.17);
}
.adyen-checkout__payment-method__image {
border-radius: 3px;
}
.adyen-checkout__payment-method__disable_oneclick {
background-color: transparent;
color: #687282;
cursor: pointer;
border: none;
display: block;
font-size: 13px;
padding: 0;
position: absolute;
right: 70px;
text-decoration: underline;
}
/* Payment Method Radio Button */
.adyen-checkout__payment-method__radio {
position: absolute;
background-color: #fff;
border: 1px solid #b9c4c9;
border-radius: 50%;
height: 18px;
width: 18px;
right: 20px;
transition: border-color 0.3s ease-out;
box-shadow: inset 0 1px 3px rgba(0, 27, 43, 0.15);
}
.adyen-checkout__payment-method__radio:after {
content: '';
display: block;
position: absolute;
margin: 0 auto;
left: 0;
right: 0;
top: 50%;
height: 6px;
width: 6px;
background-color: #fff;
border-radius: 50%;
transform: translateY(-50%) scale(0);
transition: transform 0.3s ease-out;
box-shadow: 0 1px 1px rgba(0, 15, 45, 0.25);
}
.adyen-checkout__payment-method__radio:hover {
border-color: #00a3ff;
cursor: pointer;
}
.adyen-checkout__payment-method__radio--selected {
background-color: #00a3ff;
border: 0px solid transparent;
transition: all 0.3s ease-out;
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.26);
}
.adyen-checkout__payment-method__radio--selected:after {
transform: translateY(-50%) scale(1);
}
/* /Payment Method Radio Button */
.adyen-checkout__spinner__wrapper {
height: 100%;
display: flex;
justify-content: center;
align-items: center;
}
.adyen-checkout__spinner__wrapper--inline {
height: auto;
display: inline-block;
margin-right: 8px;
}
.adyen-checkout__spinner {
border: 2px solid #00a3ff;
border-radius: 50%;
height: 43px;
width: 43px;
border-top-color: transparent;
animation: rotateSpinner 2s infinite linear;
}
.adyen-checkout__spinner--large {
height: 43px;
width: 43px;
}
.adyen-checkout__spinner--small {
height: 16px;
width: 16px;
}
.adyen-checkout__spinner--medium {
height: 28px;
width: 28px;
}
@keyframes rotateSpinner {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
.adyen-checkout__pay-button {
width: 100%;
padding: 16px;
border: 0;
border-radius: 3px;
background: #001b2b;
color: #fff;
font-weight: 700;
font-size: 1em;
transition: background 0.3s ease-out;
cursor: pointer;
box-shadow: 0 3px 4px rgba(0, 15, 45, 0.2);
}
.adyen-checkout__pay-button:disabled {
background: #e6e9eb;
box-shadow: none;
}
.adyen-checkout__pay-button--loading {
background: #4c5f6b;
box-shadow: none;
outline: 0;
user-select: none;
pointer-events: none;
}
.adyen-checkout__pay-button .adyen-checkout__spinner {
border-color: #fff;
border-width: 3px;
border-top-color: transparent;
}
.adyen-checkout__field {
display: block;
margin-bottom: 16px;
}
.adyen-checkout__field--error input {
border-color: #d81b4a;
color: #d81b4a;
}
.adyen-checkout__field:last-child {
margin-bottom: 0;
}
.adyen-checkout__label__text,
.adyen-checkout__helper-text {
color: #001b2b;
display: block;
font-size: 13px;
font-weight: normal;
line-height: 13px;
padding-bottom: 8px;
}
.adyen-checkout__helper-text {
color: #687282;
}
.adyen-checkout__label__text {
transition: color 0.2s ease-out;
}
.adyen-checkout__label--focused .adyen-checkout__label__text {
color: #0077bb;
}
.adyen-checkout__error-text,
.adyen-checkout__label__text--error {
color: #d81b4a;
font-weight: normal;
margin-top: 10px;
}
.adyen-checkout__radio_group__input {
display: none;
}
.adyen-checkout__radio_group__label {
padding-left: 24px;
position: relative;
display: block;
margin-bottom: 8px;
font-size: 13px;
font-weight: normal;
line-height: 16px;
}
.adyen-checkout__radio_group__label:before {
content: '';
position: absolute;
background-color: #fff;
border: 1px solid #b9c4c9;
border-radius: 50%;
height: 16px;
width: 16px;
left: 0;
top: 0;
transition: border-color 0.3s ease-out;
}
.adyen-checkout__radio_group__label:after {
content: '';
display: block;
position: absolute;
margin: 0 auto;
left: 5px;
top: 5px;
height: 6px;
width: 6px;
background-color: #fff;
border-radius: 50%;
transform: scale(0);
transition: transform 0.3s ease-out;
box-shadow: 0 1px 1px rgba(0, 15, 45, 0.25);
}
.adyen-checkout__radio_group__label:hover {
border-color: #00a3ff;
cursor: pointer;
}
.adyen-checkout__radio_group__input:checked + .adyen-checkout__radio_group__label:before,
.adyen-checkout__radio_group__label--selected {
background-color: #00a3ff;
border: 0px solid transparent;
transition: all 0.3s ease-out;
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.26);
}
.adyen-checkout__radio_group__input:checked + .adyen-checkout__radio_group__label:after {
transform: scale(1);
}
.adyen-checkout__checkbox {
display: block;
}
.adyen-checkout__checkbox > input[type='checkbox'] {
position: absolute;
opacity: 0;
pointer-events: none;
}
.adyen-checkout__checkbox__label {
position: relative;
padding-left: 24px;
cursor: pointer;
display: inline-block;
line-height: 16px;
font-size: 1rem;
color: #001b2b;
font-size: 13px;
font-weight: normal;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
/* Check */
.adyen-checkout__checkbox__input + span:before {
content: '';
position: absolute;
top: 2px;
left: 1px;
width: 6px;
height: 11px;
border-top: 1px solid transparent;
border-left: 1px solid transparent;
border-right: 2px solid #fff;
border-bottom: 2px solid #fff;
-webkit-transform: rotateZ(37deg);
transform: rotateZ(37deg);
-webkit-transform-origin: 100% 100%;
transform-origin: 100% 100%;
z-index: 1;
border-radius: 0px 2px 1px 2px;
opacity: 0;
transition: opacity 0.2s ease-out;
}
.adyen-checkout__checkbox__input:checked + span:before {
opacity: 1;
}
/* Box */
.adyen-checkout__checkbox__input + span:after {
content: '';
position: absolute;
top: 0;
left: 0;
width: 16px;
height: 16px;
border-radius: 3px;
background-color: #fff;
border: 1px solid #b9c4c9;
z-index: 0;
transition: background 0.15s ease-out, border 0.05s ease-out, box-shadow 0.1s ease-out;
}
.adyen-checkout__checkbox__input:checked + span:after {
border: 1px solid #00a3ff;
background-color: #00a3ff;
}
.adyen-checkout__checkbox__input:focus + span:after {
border: 1px solid #00a3ff;
box-shadow: 0 0 0 2px #91d7ff;
}
.adyen-checkout__dropdown {
width: 100%;
max-width: 200px;
font-size: 16px;
}
.adyen-checkout__dropdown--small {
max-width: 130px;
width: 100%;
}
.adyen-checkout__dropdown--large {
max-width: 300px;
width: 100%;
}
.adyen-checkout__dropdown__button {
padding: 9px 20px 9px 8px;
border: 1px solid #b9c4c9;
background: #fff;
border-radius: 3px;
outline: 0;
width: 100%;
font-size: 16px;
height: 40px;
line-height: 20px;
transition: border 0.2s ease-out, box-shadow 0.2s ease-out;
}
.adyen-checkout__dropdown__button__icon {
margin-right: 8px;
max-width: 32px;
max-height: 20px;
}
.adyen-checkout__dropdown__button--active,
.adyen-checkout__dropdown__button:active,
.adyen-checkout__dropdown__button:focus {
border-color: #00a3ff;
box-shadow: 0 0 0 2px #91d7ff;
}
.adyen-checkout__dropdown__list {
z-index: 2;
border-radius: 3px;
margin-top: 2px;
box-shadow: 0px 2px 7px rgba(0, 15, 45, 0.3);
}
.adyen-checkout__dropdown__list.adyen-checkout__dropdown__list--active {
animation: expand 100ms ease-out;
}
.adyen-checkout__dropdown__element {
padding: 8px;
line-height: 20px;
border: 1px solid transparent;
border-bottom: 1px solid #e6e9eb;
word-break: break-word;
hyphens: auto;
cursor: pointer;
outline: 0;
transition: background 0.2s ease-out, border-color 0.2s ease-out;
}
.adyen-checkout__dropdown__element:last-child {
border-bottom: 0;
}
.adyen-checkout__dropdown__element:hover,
.adyen-checkout__dropdown__element:focus,
.adyen-checkout__dropdown__element:active {
background: #f0f2f4;
}
.adyen-checkout__dropdown__element:active,
.adyen-checkout__dropdown__element:focus {
border-top-color: #00a3ff;
border-bottom-color: #00a3ff;
}
.adyen-checkout__dropdown__element__icon {
margin-right: 8px;
max-width: 32px;
max-height: 20px;
}
@keyframes expand {
0% {
-webkit-transform: scale3d(1, 0, 1);
transform: scale3d(1, 0, 1);
}
100% {
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1);
}
}
.adyen-checkout__select-list {
margin: 0;
padding: 0;
}
.adyen-checkout__select-list__item {
display: inline-block;
padding: 9px;
border-top: 1px solid #b9c4c9;
background: #fff;
outline: 0;
width: 100%;
font-size: 16px;
cursor: pointer;
line-height: 20px;
}
.adyen-checkout__select-list__item:first-child {
border-top: 0;
}
.adyen-checkout__select-list__item:hover,
.adyen-checkout__select-list__item:focus,
.adyen-checkout__select-list__item:active {
background: rgba(145, 215, 255, 0.5);
}
.adyen-checkout__select-list__item--selected {
background: rgba(145, 215, 255, 0.5);
font-weight: bold;
}
.adyen-checkout__input {
color: #001b2b;
font-size: 16px;
font-family: inherit;
display: block;
height: 40px;
background: white;
border: 1px solid #b9c4c9;
border-radius: 3px;
padding: 5px 8px;
position: relative;
outline: none;
width: 200px;
transition: border 0.2s ease-out, box-shadow 0.2s ease-out;
}
.adyen-checkout__input.adyen-checkout__input--small {
width: 130px;
}
.adyen-checkout__input.adyen-checkout__input--large {
width: 300px;
}
.adyen-checkout__input--error {
border-color: #d0021b;
}
.adyen-checkout__input::placeholder {
color: #90a2bd;
font-weight: 200;
}
.adyen-checkout__input:active,
.adyen-checkout__input--active,
.adyen-checkout__input:focus {
border: 1px solid #00a3ff;
box-shadow: 0 0 0 2px #91d7ff;
}
.adyen-checkout__input[readonly] {
background-color: #e6e9eb;
color: #687282;
cursor: default;
border-color: transparent;
}
.open-invoice__field {
margin-bottom: 15px;
}
.open-invoice__field select {
background: #ffffff;
border: 1px solid #d8d8d8;
box-shadow: none;
font-size: 0.93333333333em;
height: 40px;
margin-top: 4px;
max-width: 420px;
width: 100%;
padding: 5px 8px;
display: block;
}
.open-invoice__field input[type='text'],
.open-invoice__field input[type='date'] {
display: block;
height: 35px;
width: 100%;
max-width: 420px;
}
.adyen-checkout__fieldset {
display: block;
padding-bottom: 30px;
color: #687282;
width: 100%;
}
.adyen-checkout__fieldset--readonly {
}
.adyen-checkout__fieldset--readonly p {
color: #001b2b;
font-size: 13px;
line-height: 19px;
margin: 0;
}
.adyen-checkout__fieldset--deliveryAddress {
padding-top: 30px;
}
.adyen-checkout__fieldset__title {
display: block;
font-size: 11px;
font-weight: bold;
letter-spacing: 1px;
text-transform: uppercase;
padding: 0 0 20px;
margin: 0;
color: #687282;
}
.adyen-checkout__link__klarna--more-information {
clear: both;
display: block;
padding: 10px 0 25px;
}
.adyen-checkout__applepay__button {
width: 240px;
height: 40px;
}
.adyen-checkout__card__exp-cvc {
display: flex;
}
.adyen-checkout__card__cardNumber {
max-width: 400px;
}
.adyen-checkout__card__exp-date__input--oneclick {
line-height: 40px;
height: 40px;
font-weight: 400;
}
.adyen-checkout__card__exp-cvc .adyen-checkout__field {
margin-right: 24px;
margin-bottom: 0;
}
.adyen-checkout__card__form {
margin-bottom: 16px;
}
.adyen-checkout__giropay__results {
background: #fff;
border: 1px solid #b9c4c9;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
max-height: 140px;
min-height: 100px;
overflow-y: scroll;
width: 100%;
}
.adyen-checkout__giropay__no-results {
color: #687282;
display: block;
font-size: 13px;
padding: 0 0 0 2px;
}
.adyen-checkout__giropay__placeholder {
color: #90a2bd;
display: block;
padding: 0 0 0 2px;
font-weight: 200;
}
.adyen-checkout__giropay__loading {
display: block;
min-height: 100px;
}
.adyen-checkout__giropay__loading .adyen-checkout__spinner__wrapper {
display: inline-block;
vertical-align: middle;
}
.adyen-checkout__giropay__loading-text {
color: #687282;
font-size: 13px;
line-height: 16px;
vertical-align: middle;
}
.adyen-checkout__giropay__error {
color: #d0021b;
font-size: 13px;
}
.adyen-checkout__iban-input__number {
text-transform: uppercase;
}
.adyen-checkout__wechatpay {
background: #fff;
padding: 40px;
text-align: center;
border: 1px solid rgb(221, 225, 227);
border-radius: 3px;
min-height: 443px;
}
.adyen-checkout__wechatpay__brand-logo {
height: 20px;
width: 109px;
}
.adyen-checkout__wechatpay__subtitle {
margin-top: 32px;
}
.adyen-checkout__wechatpay__subtitle,
.adyen-checkout__wechatpay__payment_amount {
color: #001b2b;
font-size: 16px;
line-height: 19px;
}
.adyen-checkout__wechatpay__progress {
height: 4px;
background: #d4d9db;
border-radius: 25px;
margin: 32px auto 12px auto;
width: 152px;
padding-right: 3%;
}
.adyen-checkout__wechatpay__progress > span {
display: block;
height: 100%;
border-radius: 25px;
background: #00a3ff;
}
.adyen-checkout__wechatpay__countdown {
color: #687282;
font-size: 13px;
}
.adyen-checkout__wechatpay .adyen-checkout__spinner__wrapper {
margin: 60px 0;
}
.adyen-checkout__alert {
background-color: #00a3ff;
align-items: flex-start;
border-radius: 3px;
color: #fff;
display: flex;
justify-content: space-between;
line-height: 1;
margin: 0;
padding: 12px;
}
.adyen-checkout__alert--error {
background-color: #d81b4a;
}
.adyen-checkout__alert--success {
background-color: #0abf53;
}
.adyen-checkout__alert--info {
background-color: #00a3ff;
}
.adyen-checkout__sdk,
.adyen-checkout__sdk *,
.adyen-checkout__sdk *:after,
.adyen-checkout__sdk * :before {
box-sizing: border-box;
}
.adyen-checkout__payment-methods-list {
border-radius: 3px;
}
.adyen-checkout__payment-methods-list--loading {
user-select: none;
pointer-events: none;
}
/* Forms */
.adyen-checkout__link {
color: #687282;
font-size: 13px;
text-decoration: underline;
}
<?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 @@
<item name="adyen_apple_pay" xsi:type="array">
<item name="isBillingAddressRequired" xsi:type="boolean">true</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="isBillingAddressRequired" xsi:type="boolean">true</item>
</item>
......
......@@ -28,7 +28,7 @@
$_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><a target="_blank" href="<?php echo $this->getMethod()->getInfoInstance()->getAdditionalInformation('payment_url'); ?>"><?php echo __("Click here to pay for your purchase"); ?></a></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>
*/
// @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>
......@@ -20,10 +20,35 @@
* Author: Adyen <magento@adyen.com>
*/
.hidden {
display: none;
}
.checkout-payment-method .ccard .changable-card-expiry { display:none; }
.checkout-payment-method .ccard .changable-card-expiry._active { display:block; }
.checkout-payment-method .ccard .expire-update._disable { display:none; }
.checkout-payment-method .ccard .holdername .input-text { width: 225px; }
.checkout-payment-method .ccard .holdername .input-text {
width: 225px;
border: none;
padding: 0;
color: rgb(0, 27, 43);
font-size: 16px;
font-weight: 400;
}
.checkout-payment-method .ccard .holdername .input-text:focus {
border: none;
box-shadow: none;
}
.checkout-payment-method .ccard .holdername .input-text::placeholder,
.checkout-payment-method .ccard .holdername .input-text:placeholder-shown
{
color: rgb(144, 162, 189);
font-weight: 200;
}
.checkout-payment-method .payment-method-title, .checkout-payment-method .payment-method-title label {
display: -webkit-flex;
......@@ -139,6 +164,862 @@
min-height: 42px; /* override magento min-height */
}
/* Checkout card components style */
.adyen-checkout__payment-method {
position: relative;
background: white;
border: 1px solid #edf0f3;
cursor: pointer;
margin-top: -1px;
width: 100%;
transition: opacity 0.3s ease-out;
/* transition: margin 100ms cubic-bezier(0.4, 0, 0.2, 1) 0ms; */
}
.adyen-checkout__payment-method:focus {
outline: 0;
}
.adyen-checkout__payment-method:first-child,
.adyen-checkout__payment-method--selected + .adyen-checkout__payment-method {
margin-top: 0;
border-top-left-radius: 3px;
border-top-right-radius: 3px;
}
.adyen-checkout__payment-method--next-selected {
border-bottom-left-radius: 3px;
border-bottom-right-radius: 3px;
}
.adyen-checkout__payment-method--loading {
opacity: 0.2;
}
.adyen-checkout__payment-method--selected.adyen-checkout__payment-method--loading {
opacity: 0.9;
}
.adyen-checkout__payment-method--loading .adyen-checkout__spinner__wrapper {
position: absolute;
right: 0;
left: 0;
z-index: 1;
}
.adyen-checkout__payment-method__header {
display: flex;
align-items: center;
font-weight: 400;
font-size: 16px;
color: #00202e;
padding: 16px;
position: relative;
transition: background 0.1s ease-out;
width: 100%;
}
.adyen-checkout__payment-method__surcharge {
color: #687282;
margin-left: 5px;
}
.adyen-checkout__payment-method--selected {
transition: margin 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
background: #f7f8f9;
border: 1px solid #d4d9db;
margin: 8px 0;
border-radius: 3px;
cursor: default;
}
.adyen-checkout__payment-method--selected .adyen-checkout__payment-method__header {
font-weight: 500;
}
.adyen-checkout__payment-method__details__content {
padding: 6px 16px 24px;
}
.adyen-checkout__payment-method__image__wrapper {
height: 26px;
position: relative;
}
.adyen-checkout__payment-method__image__wrapper:after {
content: '';
position: absolute;
top: 0;
width: 100%;
height: 100%;
left: 0;
border-radius: 3px;
border: 1px solid rgba(0, 27, 43, 0.17);
}
.adyen-checkout__payment-method__image {
border-radius: 3px;
}
.adyen-checkout__payment-method__disable_oneclick {
background-color: transparent;
color: #687282;
cursor: pointer;
border: none;
display: block;
font-size: 13px;
padding: 0;
position: absolute;
right: 70px;
text-decoration: underline;
}
/* Payment Method Radio Button */
.adyen-checkout__payment-method__radio {
position: absolute;
background-color: #fff;
border: 1px solid #b9c4c9;
border-radius: 50%;
height: 18px;
width: 18px;
right: 20px;
transition: border-color 0.3s ease-out;
box-shadow: inset 0 1px 3px rgba(0, 27, 43, 0.15);
}
.adyen-checkout__payment-method__radio:after {
content: '';
display: block;
position: absolute;
margin: 0 auto;
left: 0;
right: 0;
top: 50%;
height: 6px;
width: 6px;
background-color: #fff;
border-radius: 50%;
transform: translateY(-50%) scale(0);
transition: transform 0.3s ease-out;
box-shadow: 0 1px 1px rgba(0, 15, 45, 0.25);
}
.adyen-checkout__payment-method__radio:hover {
border-color: #00a3ff;
cursor: pointer;
}
.adyen-checkout__payment-method__radio--selected {
background-color: #00a3ff;
border: 0px solid transparent;
transition: all 0.3s ease-out;
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.26);
}
.adyen-checkout__payment-method__radio--selected:after {
transform: translateY(-50%) scale(1);
}
/* /Payment Method Radio Button */
.adyen-checkout__spinner__wrapper {
height: 100%;
display: flex;
justify-content: center;
align-items: center;
}
.adyen-checkout__spinner__wrapper--inline {
height: auto;
display: inline-block;
margin-right: 8px;
}
.adyen-checkout__spinner {
border: 2px solid #00a3ff;
border-radius: 50%;
height: 43px;
width: 43px;
border-top-color: transparent;
animation: rotateSpinner 2s infinite linear;
}
.adyen-checkout__spinner--large {
height: 43px;
width: 43px;
}
.adyen-checkout__spinner--small {
height: 16px;
width: 16px;
}
.adyen-checkout__spinner--medium {
height: 28px;
width: 28px;
}
@keyframes rotateSpinner {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
.adyen-checkout__pay-button {
width: 100%;
padding: 16px;
border: 0;
border-radius: 3px;
background: #001b2b;
color: #fff;
font-weight: 700;
font-size: 1em;
transition: background 0.3s ease-out;
cursor: pointer;
box-shadow: 0 3px 4px rgba(0, 15, 45, 0.2);
}
.adyen-checkout__pay-button:disabled {
background: #e6e9eb;
box-shadow: none;
}
.adyen-checkout__pay-button--loading {
background: #4c5f6b;
box-shadow: none;
outline: 0;
user-select: none;
pointer-events: none;
}
.adyen-checkout__pay-button .adyen-checkout__spinner {
border-color: #fff;
border-width: 3px;
border-top-color: transparent;
}
.adyen-checkout__field {
display: block;
margin-bottom: 16px;
}
.adyen-checkout__field--error input {
border-color: #d81b4a;
color: #d81b4a;
}
.adyen-checkout__field:last-child {
margin-bottom: 0;
}
.adyen-checkout__label__text,
.adyen-checkout__helper-text {
color: #001b2b;
display: block;
font-size: 13px;
font-weight: normal;
line-height: 13px;
padding-bottom: 8px;
}
.adyen-checkout__helper-text {
color: #687282;
}
.adyen-checkout__label__text {
transition: color 0.2s ease-out;
}
.adyen-checkout__label--focused .adyen-checkout__label__text {
color: #0077bb;
}
.adyen-checkout__error-text,
.adyen-checkout__label__text--error {
color: #d81b4a;
font-weight: normal;
margin-top: 10px;
}
.adyen-checkout__radio_group__input {
display: none;
}
.adyen-checkout__radio_group__label {
padding-left: 24px;
position: relative;
display: block;
margin-bottom: 8px;
font-size: 13px;
font-weight: normal;
line-height: 16px;
}
.adyen-checkout__radio_group__label:before {
content: '';
position: absolute;
background-color: #fff;
border: 1px solid #b9c4c9;
border-radius: 50%;
height: 16px;
width: 16px;
left: 0;
top: 0;
transition: border-color 0.3s ease-out;
}
.adyen-checkout__radio_group__label:after {
content: '';
display: block;
position: absolute;
margin: 0 auto;
left: 5px;
top: 5px;
height: 6px;
width: 6px;
background-color: #fff;
border-radius: 50%;
transform: scale(0);
transition: transform 0.3s ease-out;
box-shadow: 0 1px 1px rgba(0, 15, 45, 0.25);
}
.adyen-checkout__radio_group__label:hover {
border-color: #00a3ff;
cursor: pointer;
}
.adyen-checkout__radio_group__input:checked + .adyen-checkout__radio_group__label:before,
.adyen-checkout__radio_group__label--selected {
background-color: #00a3ff;
border: 0px solid transparent;
transition: all 0.3s ease-out;
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.26);
}
.adyen-checkout__radio_group__input:checked + .adyen-checkout__radio_group__label:after {
transform: scale(1);
}
.adyen-checkout__checkbox {
display: block;
}
.adyen-checkout__checkbox > input[type='checkbox'] {
position: absolute;
opacity: 0;
pointer-events: none;
}
.adyen-checkout__checkbox__label {
position: relative;
padding-left: 24px;
cursor: pointer;
display: inline-block;
line-height: 16px;
font-size: 1rem;
color: #001b2b;
font-size: 13px;
font-weight: normal;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
/* Check */
.adyen-checkout__checkbox__input + span:before {
content: '';
position: absolute;
top: 2px;
left: 1px;
width: 6px;
height: 11px;
border-top: 1px solid transparent;
border-left: 1px solid transparent;
border-right: 2px solid #fff;
border-bottom: 2px solid #fff;
-webkit-transform: rotateZ(37deg);
transform: rotateZ(37deg);
-webkit-transform-origin: 100% 100%;
transform-origin: 100% 100%;
z-index: 1;
border-radius: 0px 2px 1px 2px;
opacity: 0;
transition: opacity 0.2s ease-out;
}
.adyen-checkout__checkbox__input:checked + span:before {
opacity: 1;
}
/* Box */
.adyen-checkout__checkbox__input + span:after {
content: '';
position: absolute;
top: 0;
left: 0;
width: 16px;
height: 16px;
border-radius: 3px;
background-color: #fff;
border: 1px solid #b9c4c9;
z-index: 0;
transition: background 0.15s ease-out, border 0.05s ease-out, box-shadow 0.1s ease-out;
}
.adyen-checkout__checkbox__input:checked + span:after {
border: 1px solid #00a3ff;
background-color: #00a3ff;
}
.adyen-checkout__checkbox__input:focus + span:after {
border: 1px solid #00a3ff;
box-shadow: 0 0 0 2px #91d7ff;
}
.adyen-checkout__dropdown {
width: 100%;
max-width: 200px;
font-size: 16px;
}
.adyen-checkout__dropdown--small {
max-width: 130px;
width: 100%;
}
.adyen-checkout__dropdown--large {
max-width: 300px;
width: 100%;
}
.adyen-checkout__dropdown__button {
padding: 9px 20px 9px 8px;
border: 1px solid #b9c4c9;
background: #fff;
border-radius: 3px;
outline: 0;
width: 100%;
font-size: 16px;
height: 40px;
line-height: 20px;
transition: border 0.2s ease-out, box-shadow 0.2s ease-out;
}
.adyen-checkout__dropdown__button__icon {
margin-right: 8px;
max-width: 32px;
max-height: 20px;
}
.adyen-checkout__dropdown__button--active,
.adyen-checkout__dropdown__button:active,
.adyen-checkout__dropdown__button:focus {
border-color: #00a3ff;
box-shadow: 0 0 0 2px #91d7ff;
}
.adyen-checkout__dropdown__list {
z-index: 2;
border-radius: 3px;
margin-top: 2px;
box-shadow: 0px 2px 7px rgba(0, 15, 45, 0.3);
}
.adyen-checkout__dropdown__list.adyen-checkout__dropdown__list--active {
animation: expand 100ms ease-out;
}
.adyen-checkout__dropdown__element {
padding: 8px;
line-height: 20px;
border: 1px solid transparent;
border-bottom: 1px solid #e6e9eb;
word-break: break-word;
hyphens: auto;
cursor: pointer;
outline: 0;
transition: background 0.2s ease-out, border-color 0.2s ease-out;
}
.adyen-checkout__dropdown__element:last-child {
border-bottom: 0;
}
.adyen-checkout__dropdown__element:hover,
.adyen-checkout__dropdown__element:focus,
.adyen-checkout__dropdown__element:active {
background: #f0f2f4;
}
.adyen-checkout__dropdown__element:active,
.adyen-checkout__dropdown__element:focus {
border-top-color: #00a3ff;
border-bottom-color: #00a3ff;
}
.adyen-checkout__dropdown__element__icon {
margin-right: 8px;
max-width: 32px;
max-height: 20px;
}
@keyframes expand {
0% {
-webkit-transform: scale3d(1, 0, 1);
transform: scale3d(1, 0, 1);
}
100% {
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1);
}
}
.adyen-checkout__select-list {
margin: 0;
padding: 0;
}
.adyen-checkout__select-list__item {
display: inline-block;
padding: 9px;
border-top: 1px solid #b9c4c9;
background: #fff;
outline: 0;
width: 100%;
font-size: 16px;
cursor: pointer;
line-height: 20px;
}
.adyen-checkout__select-list__item:first-child {
border-top: 0;
}
.adyen-checkout__select-list__item:hover,
.adyen-checkout__select-list__item:focus,
.adyen-checkout__select-list__item:active {
background: rgba(145, 215, 255, 0.5);
}
.adyen-checkout__select-list__item--selected {
background: rgba(145, 215, 255, 0.5);
font-weight: bold;
}
.adyen-checkout__input {
color: #001b2b;
font-size: 16px;
font-family: inherit;
display: block;
height: 40px;
background: white;
border: 1px solid #b9c4c9;
border-radius: 3px;
padding: 5px 8px;
position: relative;
outline: none;
width: 200px;
transition: border 0.2s ease-out, box-shadow 0.2s ease-out;
}
.adyen-checkout__input.adyen-checkout__input--small {
width: 130px;
}
.adyen-checkout__input.adyen-checkout__input--large {
width: 300px;
}
.adyen-checkout__input--error {
border-color: #d0021b;
}
.adyen-checkout__input::placeholder {
color: #90a2bd;
font-weight: 200;
}
.adyen-checkout__input:active,
.adyen-checkout__input--active,
.adyen-checkout__input:focus {
border: 1px solid #00a3ff;
box-shadow: 0 0 0 2px #91d7ff;
}
.adyen-checkout__input[readonly] {
background-color: #e6e9eb;
color: #687282;
cursor: default;
border-color: transparent;
}
.open-invoice__field {
margin-bottom: 15px;
}
.open-invoice__field select {
background: #ffffff;
border: 1px solid #d8d8d8;
box-shadow: none;
font-size: 0.93333333333em;
height: 40px;
margin-top: 4px;
max-width: 420px;
width: 100%;
padding: 5px 8px;
display: block;
}
.open-invoice__field input[type='text'],
.open-invoice__field input[type='date'] {
display: block;
height: 35px;
width: 100%;
max-width: 420px;
}
.adyen-checkout__fieldset {
display: block;
padding-bottom: 30px;
color: #687282;
width: 100%;
}
.adyen-checkout__fieldset--readonly {
}
.adyen-checkout__fieldset--readonly p {
color: #001b2b;
font-size: 13px;
line-height: 19px;
margin: 0;
}
.adyen-checkout__fieldset--deliveryAddress {
padding-top: 30px;
}
.adyen-checkout__fieldset__title {
display: block;
font-size: 11px;
font-weight: bold;
letter-spacing: 1px;
text-transform: uppercase;
padding: 0 0 20px;
margin: 0;
color: #687282;
}
.adyen-checkout__link__klarna--more-information {
clear: both;
display: block;
padding: 10px 0 25px;
}
.adyen-checkout__applepay__button {
width: 240px;
height: 40px;
}
.adyen-checkout__card__exp-cvc {
display: flex;
}
.adyen-checkout__card__cardNumber {
max-width: 400px;
}
.adyen-checkout__card__exp-date__input--oneclick {
line-height: 40px;
height: 40px;
font-weight: 400;
}
.adyen-checkout__card__exp-cvc .adyen-checkout__field {
margin-right: 24px;
margin-bottom: 0;
}
.adyen-checkout__card__form {
margin-bottom: 16px;
}
.adyen-checkout__giropay__results {
background: #fff;
border: 1px solid #b9c4c9;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
max-height: 140px;
min-height: 100px;
overflow-y: scroll;
width: 100%;
}
.adyen-checkout__giropay__no-results {
color: #687282;
display: block;
font-size: 13px;
padding: 0 0 0 2px;
}
.adyen-checkout__giropay__placeholder {
color: #90a2bd;
display: block;
padding: 0 0 0 2px;
font-weight: 200;
}
.adyen-checkout__giropay__loading {
display: block;
min-height: 100px;
}
.adyen-checkout__giropay__loading .adyen-checkout__spinner__wrapper {
display: inline-block;
vertical-align: middle;
}
.adyen-checkout__giropay__loading-text {
color: #687282;
font-size: 13px;
line-height: 16px;
vertical-align: middle;
}
.adyen-checkout__giropay__error {
color: #d0021b;
font-size: 13px;
}
.adyen-checkout__iban-input__number {
text-transform: uppercase;
}
.adyen-checkout__wechatpay {
background: #fff;
padding: 40px;
text-align: center;
border: 1px solid rgb(221, 225, 227);
border-radius: 3px;
min-height: 443px;
}
.adyen-checkout__wechatpay__brand-logo {
height: 20px;
width: 109px;
}
.adyen-checkout__wechatpay__subtitle {
margin-top: 32px;
}
.adyen-checkout__wechatpay__subtitle,
.adyen-checkout__wechatpay__payment_amount {
color: #001b2b;
font-size: 16px;
line-height: 19px;
}
.adyen-checkout__wechatpay__progress {
height: 4px;
background: #d4d9db;
border-radius: 25px;
margin: 32px auto 12px auto;
width: 152px;
padding-right: 3%;
}
.adyen-checkout__wechatpay__progress > span {
display: block;
height: 100%;
border-radius: 25px;
background: #00a3ff;
}
.adyen-checkout__wechatpay__countdown {
color: #687282;
font-size: 13px;
}
.adyen-checkout__wechatpay .adyen-checkout__spinner__wrapper {
margin: 60px 0;
}
.adyen-checkout__alert {
background-color: #00a3ff;
align-items: flex-start;
border-radius: 3px;
color: #fff;
display: flex;
justify-content: space-between;
line-height: 1;
margin: 0;
padding: 12px;
}
.adyen-checkout__alert--error {
background-color: #d81b4a;
}
.adyen-checkout__alert--success {
background-color: #0abf53;
}
.adyen-checkout__alert--info {
background-color: #00a3ff;
}
.adyen-checkout__sdk,
.adyen-checkout__sdk *,
.adyen-checkout__sdk *:after,
.adyen-checkout__sdk * :before {
box-sizing: border-box;
}
.adyen-checkout__payment-methods-list {
border-radius: 3px;
}
.adyen-checkout__payment-methods-list--loading {
user-select: none;
pointer-events: none;
}
/* Forms */
.adyen-checkout__link {
color: #687282;
font-size: 13px;
text-decoration: underline;
}
/*.adyen-checkout__card__form .adyen-checkout__input {*/
/*max-height: 40px;*/
/*}*/
/*.adyen-checkout__card__form .adyen-checkout__input img{*/
/*display: none;*/
/*}*/
/*#adyen-cc-form .fieldset > .field > .label, .fieldset > .fields > .field > .label {*/
/*font-weight: 400;*/
/*}*/
/*#adyen-cc-form .fieldset > .holdername.field{*/
/*margin-bottom: 10px;*/
/*}*/
/*#adyen-cc-form .helper-text{*/
/*font-size: 11px;*/
/*color: rgb(144, 162, 189);*/
/*font-weight: 100;*/
/*}*/
\ No newline at end of file
......@@ -48,10 +48,6 @@ define(
type: 'adyen_sepa',
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',
component: 'Adyen_Payment/js/view/payment/method-renderer/adyen-boleto-method'
......@@ -66,6 +62,21 @@ define(
}
);
/** 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
......@@ -34,68 +34,84 @@ define(
function ($, ko, Component, customer, creditCardData, additionalValidators, quote, installments, url) {
'use strict';
var cvcLength = ko.observable(4);
return Component.extend({
defaults: {
template: 'Adyen_Payment/payment/cc-form',
creditCardOwner: '',
encryptedData: '',
setStoreCc: true,
installment: ''
setStoreCc: false,
installment: '',
creditCardDetailsValid: false
},
initObservable: function () {
this._super()
.observe([
'creditCardType',
'creditCardExpYear',
'creditCardExpMonth',
'creditCardNumber',
'creditCardVerificationNumber',
'creditCardSsStartMonth',
'creditCardSsStartYear',
'selectedCardType',
'creditCardOwner',
'encryptedData',
'generationtime',
'creditCardNumber',
'securityCode',
'expiryMonth',
'expiryYear',
'setStoreCc',
'installment'
'installment',
'creditCardDetailsValid',
'variant',
'placeOrderAllowed'
]);
return this;
},
getInstallments: installments.getInstallments(),
initialize: function () {
/**
* Renders the secure fields,
* creates the card component,
* sets up the callbacks for card components and
* set up the installments
*/
renderSecureFields: function () {
var self = this;
this._super();
installments.setInstallments(0);
self.placeOrderAllowed(false);
if (!self.getOriginKey()) {
return;
}
// include dynamic cse javascript
var dfScriptTag = document.createElement('script');
dfScriptTag.src = this.getLibrarySource();
dfScriptTag.type = "text/javascript";
document.body.appendChild(dfScriptTag);
//Set credit card number to credit card data object
this.creditCardNumber.subscribe(function (value) {
installments.setInstallments(0);
// installments enabled ??
var allInstallments = self.getAllInstallments();
var cardNode = document.getElementById('cardContainer');
// what card is this ??
if (creditCardData.creditCard) {
var creditcardType = creditCardData.creditCard.type;
var checkout = new AdyenCheckout({
locale: self.getLocale()
});
cvcLength(4);
if (creditcardType != "AE") {
cvcLength(3);
var card = checkout.create('card', {
originKey: self.getOriginKey(),
loadingContext: self.getLoadingContext(),
type: 'card',
hasHolderName: true,
holderNameRequired: true,
groupTypes: self.getAvailableCardTypeAltCodes(),
onChange: function (state) {
// isValid is not present on start
if (typeof state.isValid !== 'undefined' && state.isValid === false) {
self.creditCardDetailsValid(false);
self.placeOrderAllowed(false);
}
if (creditcardType in allInstallments) {
// Define the card type
// translate adyen card type to magento card type
var creditCardType = self.getCcCodeByAltCode(state.brand);
if (creditCardType) {
// If the credit card type is already set, check if it changed or not
if (!self.creditCardType() || self.creditCardType() && self.creditCardType() != creditCardType) {
if (creditCardType in allInstallments) {
// get for the creditcard the installments
var installmentCreditcard = allInstallments[creditcardType];
var installmentCreditcard = allInstallments[creditCardType];
var grandTotal = quote.totals().grand_total;
var numberOfInstallments = [];
......@@ -123,46 +139,73 @@ define(
installments.setInstallments(0);
}
}
});
},
setPlaceOrderHandler: function (handler) {
this.placeOrderHandler = handler;
// Color the image of the credit card
// for BCMC as this is not a core payment method inside magento use maestro as brand detection
if (creditCardType == "BCMC") {
self.creditCardType("MI");
} else {
self.creditCardType(creditCardType);
}
} else {
self.creditCardType("")
}
},
setValidateHandler: function (handler) {
this.validateHandler = handler;
onValid: function (state) {
self.variant(state.brand);
self.creditCardNumber(state.data.encryptedCardNumber);
self.expiryMonth(state.data.encryptedExpiryMonth);
self.expiryYear(state.data.encryptedExpiryYear);
self.securityCode(state.data.encryptedSecurityCode);
self.creditCardOwner(state.data.holderName);
self.creditCardDetailsValid(true);
self.placeOrderAllowed(true);
},
getCode: function () {
return 'adyen_cc';
onError: function (state) {
self.creditCardDetailsValid(false);
self.placeOrderAllowed(false);
}
});
card.mount(cardNode);
},
/**
* Builds the payment details part of the payment information reqeust
*
* @returns {{method: *, additional_data: {cc_type: *, number: *, cvc, expiryMonth: *, expiryYear: *, holderName: *, store_cc: *, number_of_installments: *}}}
*/
getData: function () {
return {
'method': this.item.method,
additional_data: {
'card_brand': this.variant(),
'cc_type': this.creditCardType(),
'encrypted_data': this.encryptedData(),
'generationtime': this.generationtime(),
'number': this.creditCardNumber(),
'cvc': this.securityCode(),
'expiryMonth': this.expiryMonth(),
'expiryYear': this.expiryYear(),
'holderName': this.creditCardOwner(),
'store_cc': this.setStoreCc(),
'number_of_installments': this.installment()
}
};
},
getCvcLength: function () {
return cvcLength();
},
isActive: function () {
return true;
},
/**
* Returns state of place order button
* @returns {boolean}
*/
isButtonActive: function() {
return this.isActive() && this.getCode() == this.isChecked() && this.isPlaceOrderActionAllowed();
isButtonActive: function () {
return this.isActive() && this.getCode() == this.isChecked() && this.isPlaceOrderActionAllowed() && this.placeOrderAllowed();
},
/**
* Custom place order function
*
* @override
*
* @param data
* @param event
* @returns {boolean}
*/
placeOrder: function (data, event) {
var self = this;
......@@ -171,22 +214,6 @@ define(
event.preventDefault();
}
var options = {};
var cseInstance = adyen.createEncryption(options);
var generationtime = this.getGenerationTime();
var cardData = {
number: this.creditCardNumber(),
cvc: this.creditCardVerificationNumber(),
holderName: this.creditCardOwner(),
expiryMonth: this.creditCardExpMonth(),
expiryYear: this.creditCardExpYear(),
generationtime: generationtime
};
var data = cseInstance.encrypt(cardData);
this.encryptedData(data);
if (this.validate() && additionalValidators.validate()) {
this.isPlaceOrderActionAllowed(false);
......@@ -211,57 +238,106 @@ define(
return false;
},
getControllerName: function () {
return window.checkoutConfig.payment.iframe.controllerName[this.getCode()];
/**
* Validates the payment date when clicking the pay button
*
* @returns {boolean}
*/
validate: function () {
var self = this;
var form = 'form[data-role=adyen-cc-form]';
var validate = $(form).validation() && $(form).validation('isValid');
if (!validate) {
return false;
}
return true;
},
getPlaceOrderUrl: function () {
return window.checkoutConfig.payment.iframe.placeOrderUrl[this.getCode()];
/**
* Validates if the typed in card holder is valid
* - length validation, can not be empty
*
* @returns {boolean}
*/
isCardOwnerValid: function () {
if (this.creditCardOwner().length == 0) {
return false;
}
return true;
},
context: function () {
return this;
/**
* The card component send the card details validity in a callback which is saved in the
* creditCardDetailsValid observable
*
* @returns {*}
*/
isCreditCardDetailsValid: function () {
return this.creditCardDetailsValid();
},
/**
* Translates the card type alt code (used in Adyen) to card type code (used in Magento) if it's available
*
* @param altCode
* @returns {*}
*/
getCcCodeByAltCode: function (altCode) {
var ccTypes = window.checkoutConfig.payment.ccform.availableTypesByAlt[this.getCode()];
if (ccTypes.hasOwnProperty(altCode)) {
return ccTypes[altCode];
}
isCseEnabled: function () {
return window.checkoutConfig.payment.adyenCc.cseEnabled;
return "";
},
getCSEKey: function () {
return window.checkoutConfig.payment.adyenCc.cseKey;
/**
* Get available card types translated to the Adyen card type codes
* (The card type alt code is the Adyen card type code)
*
* @returns {string[]}
*/
getAvailableCardTypeAltCodes: function () {
var ccTypes = window.checkoutConfig.payment.ccform.availableTypesByAlt[this.getCode()];
return Object.keys(ccTypes);
},
getLibrarySource: function () {
return window.checkoutConfig.payment.adyenCc.librarySource;
/**
* Return Payment method code
*
* @returns {*}
*/
getCode: function () {
return window.checkoutConfig.payment.adyenCc.methodCode;
},
getOriginKey: function () {
return window.checkoutConfig.payment.adyenCc.originKey;
},
getLoadingContext: function () {
return window.checkoutConfig.payment.adyenCc.checkoutUrl;
},
getGenerationTime: function () {
return window.checkoutConfig.payment.adyenCc.generationTime;
getLocale: function () {
return window.checkoutConfig.payment.adyenCc.locale;
},
isActive: function () {
return true;
},
getControllerName: function () {
return window.checkoutConfig.payment.iframe.controllerName[this.getCode()];
},
getPlaceOrderUrl: function () {
return window.checkoutConfig.payment.iframe.placeOrderUrl[this.getCode()];
},
canCreateBillingAgreement: function () {
if (customer.isLoggedIn()) {
return window.checkoutConfig.payment.adyenCc.canCreateBillingAgreement;
}
return false;
},
isShowLegend: function () {
return true;
},
validate: function () {
var form = 'form[data-role=adyen-cc-form]';
var validate = $(form).validation() && $(form).validation('isValid');
// add extra validation because jquery validation will not work on non name attributes
var ccNumber = Boolean($(form + ' #creditCardNumber').valid());
var owner = Boolean($(form + ' #creditCardHolderName').valid());
var expiration = Boolean($(form + ' #adyen_cc_expiration').valid());
var expiration_yr = Boolean($(form + ' #adyen_cc_expiration_yr').valid());
var cid = Boolean($(form + ' #adyen_cc_cc_cid').valid());
if (!validate || !ccNumber || !owner || !expiration || !expiration_yr || !cid) {
return false;
}
return true;
},
showLogo: function () {
return window.checkoutConfig.payment.adyen.showLogo;
},
......@@ -275,9 +351,16 @@ define(
},
getAllInstallments: function () {
return window.checkoutConfig.payment.adyenCc.installments;
},
setPlaceOrderHandler: function (handler) {
this.placeOrderHandler = handler;
},
setValidateHandler: function (handler) {
this.validateHandler = handler;
},
context: function () {
return this;
}
});
}
);
......@@ -36,19 +36,21 @@ define(
'mage/url'
],
function (ko, _, $, Component, selectPaymentMethodAction, additionalValidators, quote, checkoutData, redirectOnSuccessAction, layout, Messages, placeOrderAction, url) {
'use strict';
var updatedExpiryDate = false;
var messageComponents;
var recurringDetailReference = ko.observable(null);
var variant = ko.observable(null);
var paymentMethod = ko.observable(null);
var encryptedData = ko.observable(null);
var numberOfInstallments = ko.observable(null);
var messageComponents;
var isValid = ko.observable(false);
return Component.extend({
defaults: {
template: 'Adyen_Payment/payment/oneclick-form',
recurringDetailReference: '',
encryptedData: '',
variant: '',
numberOfInstallments: ''
},
......@@ -58,7 +60,6 @@ define(
'recurringDetailReference',
'creditCardType',
'creditCardVerificationNumber',
'encryptedData',
'variant',
'numberOfInstallments'
]);
......@@ -90,39 +91,20 @@ define(
});
this.messageComponents = messageComponents;
},
placeOrderHandler: null,
validateHandler: null,
setPlaceOrderHandler: function (handler) {
this.placeOrderHandler = handler;
},
setValidateHandler: function (handler) {
this.validateHandler = handler;
},
getCode: function () {
return 'adyen_oneclick';
},
isActive: function () {
return true;
},
getControllerName: function () {
return window.checkoutConfig.payment.iframe.controllerName[this.getCode()];
},
context: function () {
return this;
},
canCreateBillingAgreement: function () {
return window.checkoutConfig.payment.adyenCc.canCreateBillingAgreement;
},
isShowLegend: function () {
return true;
},
/**
* List all Adyen billing agreements
* Set up installments
*
* @returns {Array}
*/
getAdyenBillingAgreements: function () {
var self = this;
// convert to list so you can iterate
var paymentList = _.map(window.checkoutConfig.payment.adyenOneclick.billingAgreements, function (value) {
var creditCardExpMonth, creditCardExpYear = false;
if (value.agreement_data.card) {
creditCardExpMonth = value.agreement_data.card.expiryMonth;
creditCardExpYear = value.agreement_data.card.expiryYear;
......@@ -130,10 +112,10 @@ define(
// pre-define installments if they are set
var i, installments = [];
var grandTotal = quote.totals().grand_total;
var dividedString = "";
var dividedAmount = 0;
if (value.number_of_installments) {
for (i = 0; i < value.number_of_installments.length; i++) {
dividedAmount = (grandTotal / value.number_of_installments[i]).toFixed(quote.getPriceFormat().precision);
......@@ -148,28 +130,32 @@ define(
var messageContainer = self.messageComponents['messages-' + value.reference_id];
// for recurring enable the placeOrder button at all times
var placeOrderAllowed = true;
if (self.hasVerification()) {
placeOrderAllowed = false;
} else {
// for recurring cards there is no validation needed
isValid(true);
}
return {
'expiry': ko.observable(false),
'label': value.agreement_label,
'value': value.reference_id,
'agreement_data': value.agreement_data,
'logo': value.logo,
'installment': '',
'number_of_installments': value.number_of_installments,
getInstallments: ko.observableArray(installments),
'method': self.item.method,
getCode: function () {
return self.item.method;
},
creditCardVerificationNumber: '',
creditCardExpMonth: ko.observable(creditCardExpMonth),
creditCardExpYear: ko.observable(creditCardExpYear),
'encryptedCreditCardVerificationNumber': '',
'creditCardExpMonth': ko.observable(creditCardExpMonth),
'creditCardExpYear': ko.observable(creditCardExpYear),
'getInstallments': ko.observableArray(installments),
'placeOrderAllowed': ko.observable(placeOrderAllowed),
getGenerationTime: function () {
return window.checkoutConfig.payment.adyenCc.generationTime;
},
hasVerification: function () {
return window.checkoutConfig.payment.adyenOneclick.hasCustomerInteraction;
isButtonActive: function () {
return self.isActive() && this.getCode() == self.isChecked() && self.isBillingAgreementChecked() && this.placeOrderAllowed();
},
/**
* @override
......@@ -181,32 +167,10 @@ define(
event.preventDefault();
}
var data = {
"method": self.method,
"additional_data": {
variant: self.agreement_data.variant,
recurring_detail_reference: self.value
}
}
// only use CSE and installments for cards
// only use installments for cards
if (self.agreement_data.card) {
var generationtime = self.getGenerationTime();
var cardData = {
cvc: self.creditCardVerificationNumber,
expiryMonth: self.creditCardExpMonth(),
expiryYear: self.creditCardExpYear(),
generationtime: generationtime
};
if (updatedExpiryDate || self.hasVerification()) {
if (self.hasVerification()) {
var options = {enableValidations: false};
var cseInstance = adyen.createEncryption(options);
var encryptedDataResult = cseInstance.encrypt(cardData);
encryptedData(encryptedDataResult)
}
// set payment method to adyen_hpp
......@@ -234,28 +198,113 @@ define(
}
return false;
},
/**
* Renders the secure CVC field,
* creates the card component,
* sets up the callbacks for card components
*/
renderSecureCVC: function () {
var self = this;
if (!self.getOriginKey()) {
return;
}
var oneClickCardNode = document.getElementById('cvcContainer-' + self.value);
var checkout = new AdyenCheckout({
locale: self.getLocale()
});
// this should be fixed in new version of checkout card component
var hideCVC = false;
if (this.hasVerification()) {
if (self.agreement_data.variant == "bcmc") {
hideCVC = true;
self.placeOrderAllowed(true);
} else if (self.agreement_data.variant == "maestro") {
// for maestro cvc is optional
self.placeOrderAllowed(true);
}
} else {
hideCVC = true;
}
var oneClickCard = checkout
.create('card', {
originKey: self.getOriginKey(),
loadingContext: self.getLoadingContext(),
type: self.agreement_data.variant,
oneClick: true,
hideCVC: hideCVC,
// Specific for oneClick cards
details: [
{
"key": "cardDetails.cvc",
"type": "cvc"
}
],
storedDetails: {
"card": {
"expiryMonth": self.agreement_data.card.expiryMonth,
"expiryYear": self.agreement_data.card.expiryYear,
"holderName": self.agreement_data.card.holderName,
"number": self.agreement_data.card.number
}
},
onChange: function (state) {
if (state.isValid) {
if (typeof state.data !== 'undefined' &&
typeof state.data.encryptedSecurityCode !== 'undefined'
) {
self.encryptedCreditCardVerificationNumber = state.data.encryptedSecurityCode;
}
} else {
self.encryptedCreditCardVerificationNumber = '';
self.placeOrderAllowed(false);
isValid(false);
}
},
onValid: function (state) {
if (state.isValid) {
self.placeOrderAllowed(true);
isValid(true);
} else {
isValid(false);
}
return;
},
onError: function (data) {
self.placeOrderAllowed(false);
isValid(false);
return;
}
})
.mount(oneClickCardNode);
window.adyencheckout = oneClickCard;
},
/**
* Builds the payment details part of the payment information reqeust
*
* @returns {{method: *, additional_data: {variant: *, recurring_detail_reference: *, number_of_installments: *, cvc: (string|*), expiryMonth: *, expiryYear: *}}}
*/
getData: function () {
var self = this;
return {
"method": self.item.method,
"additional_data": {
"method": self.method,
additional_data: {
variant: variant(),
recurring_detail_reference: recurringDetailReference(),
number_of_installments: numberOfInstallments(),
encrypted_data: encryptedData()
cvc: self.encryptedCreditCardVerificationNumber,
expiryMonth: self.creditCardExpMonth(),
expiryYear: self.creditCardExpYear()
}
};
},
isPlaceOrderActionAllowed: function () {
return self.isPlaceOrderActionAllowed(); // needed for placeOrder method
},
afterPlaceOrder: function () {
return self.afterPlaceOrder(); // needed for placeOrder method
},
getPlaceOrderDeferredObject: function () {
return $.when(
placeOrderAction(this.getData(), this.getMessageContainer())
);
},
validate: function () {
var code = self.item.method;
......@@ -266,34 +315,27 @@ define(
var validate = $(form).validation() && $(form).validation('isValid');
// if oneclick or recurring is a card do validation on expiration date
if (this.agreement_data.card) {
// add extra validation because jquery validation will not work on non name attributes
var expiration = Boolean($(form + ' #' + codeValue + '_expiration').valid());
var expiration_yr = Boolean($(form + ' #' + codeValue + '_expiration_yr').valid());
// only check if recurring type is set to oneclick
var cid = true;
if (this.hasVerification()) {
var cid = Boolean($(form + ' #' + codeValue + '_cc_cid').valid());
}
} else {
var expiration = true;
var expiration_yr = true;
var cid = true;
}
if (!validate || !expiration || !expiration_yr || !cid) {
// bcmc does not have any cvc
if (!validate || (isValid() == false && variant() != "bcmc" && variant() != "maestro")) {
return false;
}
return true;
},
selectExpiry: function () {
updatedExpiryDate = true;
var self = this;
self.expiry(true);
return true;
getCode: function () {
return self.item.method;
},
getLocale: function () {
return window.checkoutConfig.payment.adyenOneclick.locale;
},
getOriginKey: function () {
return window.checkoutConfig.payment.adyenOneclick.originKey;
},
getLoadingContext: function () {
return window.checkoutConfig.payment.adyenOneclick.checkoutUrl;
},
hasVerification: function () {
return self.hasVerification()
},
getMessageName: function () {
return 'messages-' + value.reference_id;
......@@ -301,14 +343,29 @@ define(
getMessageContainer: function () {
return messageContainer;
},
isPlaceOrderActionAllowed: function () {
return self.isPlaceOrderActionAllowed(); // needed for placeOrder method
},
afterPlaceOrder: function () {
return self.afterPlaceOrder(); // needed for placeOrder method
},
getPlaceOrderDeferredObject: function () {
return $.when(
placeOrderAction(this.getData(), this.getMessageContainer())
);
},
}
});
return paymentList;
},
/**
* Select a billing agreement (stored one click payment method) from the list
*
* @returns {boolean}
*/
selectBillingAgreement: function () {
var self = this;
self.expiry(false);
updatedExpiryDate = false;
// set payment method data
var data = {
......@@ -340,13 +397,41 @@ define(
if (quote.paymentMethod().method == paymentMethod()) {
return recurringDetailReference();
}
return null;
}),
placeOrderHandler: null,
validateHandler: null,
setPlaceOrderHandler: function (handler) {
this.placeOrderHandler = handler;
},
setValidateHandler: function (handler) {
this.validateHandler = handler;
},
getPlaceOrderUrl: function () {
return window.checkoutConfig.payment.iframe.placeOrderUrl[this.getCode()];
},
getCode: function () {
return window.checkoutConfig.payment.adyenOneclick.methodCode;
},
isActive: function () {
return true;
},
getControllerName: function () {
return window.checkoutConfig.payment.iframe.controllerName[this.getCode()];
},
context: function () {
return this;
},
canCreateBillingAgreement: function () {
return window.checkoutConfig.payment.adyenCc.canCreateBillingAgreement;
},
isShowLegend: function () {
return true;
},
hasVerification: function () {
return window.checkoutConfig.payment.adyenOneclick.hasCustomerInteraction;
}
});
}
);
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* 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;
}
});
}
);
......@@ -39,6 +39,10 @@
<div class="payment-method-content">
<!-- ko ifnot: (getOriginKey()) -->
<span class="message message-error error"><!-- ko text: $t('Please configure an API Key and a live endpoint prefix(if in Production Mode) in your Adyen Required Settings')--><!-- /ko --></span>
<!--/ko-->
<div class="payment-method-billing-address">
<!-- ko foreach: $parent.getRegion(getBillingAddressFormName()) -->
<!-- ko template: getTemplate() --><!-- /ko -->
......@@ -68,149 +72,9 @@
<br/>
<!-- /ko -->
<div class="field type required">
<label data-bind="attr: {for: getCode() + '_cc_type'}" class="label">
<span><!-- ko text: $t('Credit Card Type')--><!-- /ko --></span>
</label>
<div class="control">
<ul class="credit-card-types">
<!-- ko foreach: {data: getCcAvailableTypesValues(), as: 'item'} -->
<li class="item" data-bind="css: {_active: $parent.selectedCardType() == item.value} ">
<!--ko if: $parent.getIcons(item.value) -->
<img data-bind="attr: {
'src': $parent.getIcons(item.value).url,
'alt': item.type,
'width': $parent.getIcons(item.value).width,
'height': $parent.getIcons(item.value).height
}">
<!--/ko-->
</li>
<!--/ko-->
</ul>
<input type="hidden"
name="payment[cc_type]"
class="input-text"
value=""
data-bind="attr: {id: getCode() + '_cc_type', 'data-container': getCode() + '-cc-type'},
value: creditCardType
">
</div>
</div>
<div class="field number required">
<label data-bind="attr: {for: 'creditCardNumber'}" class="label">
<span><!-- ko text: $t('Credit Card Number')--><!-- /ko --></span>
</label>
<div class="control">
<input type="tel" class="input-text" value=""
data-encrypted-name="number"
data-bind="attr: {
autocomplete: off,
id: 'creditCardNumber',
title: $t('Credit Card Number'),
'data-container': getCode() + '-cc-number',
'data-validate': JSON.stringify({'required-number':true, 'validate-card-type':getCcAvailableTypesValues(), 'validate-card-number':'#' + getCode() + '_cc_type', 'validate-cc-type':'#' + getCode() + '_cc_type'})},
enable: isActive($parents),
value: creditCardNumber,
valueUpdate: 'keyup' "/>
</div>
<div class="field number cardContainerField">
<div afterRender="renderSecureFields()" data-bind="attr: { id: 'cardContainer'}"></div>
</div>
<div class="field holdername type required">
<label data-bind="attr: {for: 'creditCardHolderName'}" class="label">
<span><!-- ko text: $t('Credit Card Owner')--><!-- /ko --></span>
</label>
<div class="control">
<input type="text"
class="input-text required-entry"
data-encrypted-name="holderName"
value=""
data-bind="attr: {
id: 'creditCardHolderName',
title: $t('Credit Card Owner'),
'data-container': getCode() + '-cc-owner'
},
enable: isActive($parents),
value: creditCardOwner,
valueUpdate: 'keyup' "
data-validate="{required:true}"
/>
</div>
</div>
<div class="field date required" data-bind="attr: {id: getCode() + '_cc_type_exp_div'}">
<label data-bind="attr: {for: 'cardExpirationMonth'}" class="label">
<span><!-- ko text: $t('Expiration Date')--><!-- /ko --></span>
</label>
<div class="control">
<div class="fields group group-2">
<div class="field no-label month">
<div class="control">
<select class="select select-month"
data-encrypted-name="expiryMonth"
data-bind="attr: {id: getCode() + '_expiration', 'data-container': getCode() + '-cc-month', 'data-validate': JSON.stringify({required:true, 'validate-cc-exp':'#' + getCode() + '_expiration_yr'})},
enable: isActive($parents),
options: getCcMonthsValues(),
optionsValue: 'value',
optionsText: 'month',
optionsCaption: $t('Month'),
value: creditCardExpMonth"
data-validate="{required:true}">
</select>
</div>
</div>
<div class="field no-label year">
<div class="control">
<select class="select select-year"
data-encrypted-name="expiryYear"
data-bind="attr: {id: getCode() + '_expiration_yr', 'data-container': getCode() + '-cc-year', 'data-validate': JSON.stringify({required:true})},
enable: isActive($parents),
options: getCcYearsValues(),
optionsValue: 'value',
optionsText: 'year',
optionsCaption: $t('Year'),
value: creditCardExpYear"
data-validate="{required:true}">
</select>
</div>
</div>
</div>
</div>
</div>
<!-- ko if: (hasVerification())-->
<div class="field cvv required" data-bind="attr: {id: getCode() + '_cc_type_cvv_div'}">
<label data-bind="attr: {for: getCode() + '_cc_cid'}" class="label">
<span><!-- ko text: $t('Card Verification Number')--><!-- /ko --></span>
</label>
<div class="control _with-tooltip">
<input type="number"
autocomplete="off"
class="input-text cvv"
data-encrypted-name="cvc"
value=""
data-bind="attr: {
id: getCode() + '_cc_cid',
title: $t('Card Verification Number'),
'data-container': getCode() + '-cc-cvv',
'data-validate': JSON.stringify({'required-number':true, 'validate-card-cvv':'#' + getCode() + '_cc_type'}),
maxLength : getCvcLength(),
oninput:'javascript: if (this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);'
},
enable: isActive($parents),
value: creditCardVerificationNumber" ,
data-validate="{required:true}"
/>
<div class="field-tooltip toggle">
<span class="field-tooltip-action action-cvv"
tabindex="0"
data-toggle="dropdown"
data-bind="attr: {title: $t('What is this?')}, mageInit: {'dropdown':{'activeClass': '_active'}}">
<span><!-- ko text: $t('What is this?')--><!-- /ko --></span>
</span>
<div class="field-tooltip-content"
data-target="dropdown"
data-bind="html: getCvvImageHtml()"></div>
</div>
</div>
</div>
<!-- /ko -->
<!-- ko if: (hasInstallments())-->
......@@ -257,15 +121,6 @@
<!-- /ko -->
<input type="hidden"
name="payment[generationtime]"
class="input-text"
value=""
data-encrypted-name="generationtime"
data-bind="attr: {id: getCode() + '_generationtime', 'data-container': getCode() + '-generationtime'},
value: getGenerationTime()"
/>
</fieldset>
</form>
......
......@@ -21,13 +21,8 @@
* Author: Adyen <magento@adyen.com>
*/
-->
<!-- ko foreach: getAdyenBillingAgreements() -->
<div class="payment-method" data-bind="css: {'_active': (value == $parent.isBillingAgreementChecked())}">
<div class="payment-method-title field choice">
<input type="radio"
name="payment[method]"
......@@ -35,9 +30,7 @@
data-bind="attr: {'id': value}, value: value, checked: $parent.isBillingAgreementChecked, click: $parent.selectBillingAgreement"/>
<label data-bind="attr: {'for': value}" class="label">
<!-- ko if: logo -->
<img data-bind="attr: {
'class': getCode(),
'src': logo.url,
......@@ -52,6 +45,10 @@
</div>
<div class="payment-method-content">
<!-- ko ifnot: (getOriginKey()) -->
<span class="message message-error error"><!-- ko text: $t('Please configure an API Key and a live endpoint prefix(if in Production Mode) in your Adyen Required Settings')--><!-- /ko --></span>
<!--/ko-->
<!-- ko foreach: $parent.getRegion(getMessageName()) -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
......@@ -62,8 +59,6 @@
<!--/ko-->
</div>
<form class="form" action="#" method="post" data-bind="
attr: {'id': 'adyen_oneclick_' + value, 'data-role': 'adyen_oneclick_' + value },
mageInit: {
......@@ -73,10 +68,10 @@
'orderSaveUrl':$parent.getPlaceOrderUrl(),
}, 'validation':[]}">
<fieldset data-bind="attr: {class: 'fieldset payment items ccard ' + getCode(), id: 'payment_form_' + $parent.getCode() + '_' + value}">
<fieldset
data-bind="attr: {class: 'fieldset payment items ccard ' + getCode(), id: 'payment_form_' + $parent.getCode() + '_' + value}">
<!-- ko if: agreement_data.card -->
<div class="field number">
<label class="label">
<span><!-- ko text: $t('Credit Card Number')--><!-- /ko --></span>
......@@ -86,95 +81,10 @@
</div>
</div>
<div class="field number expire-update" data-bind="css: {'_disable': (true == expiry())}">
<label class="label">
<span><!-- ko text: $t('Expiration Date')--><!-- /ko --></span>
</label>
<div class="control">
<span data-bind="text: agreement_data.card.expiryMonth + '/' + agreement_data.card.expiryYear"></span>
<a class="" data-bind="click: selectExpiry"
><!-- ko text: $t('Update') --><!-- /ko --></a>
</div>
</div>
<div class="field date required changable-card-expiry" data-bind="attr: {id: getCode() + '_' + value + '_cc_type_exp_div'}, css: {'_active': (true == expiry())}">
<label data-bind="attr: {for: getCode() + '_' + value + '_expiration'}" class="label">
<span><!-- ko text: $t('Expiration Date')--><!-- /ko --></span>
</label>
<div class="control">
<div class="fields group group-2">
<div class="field no-label month">
<div class="control">
<select class="select select-month"
data-encrypted-name="expiryMonth"
data-bind="attr: {id: getCode() + '_' + value + '_expiration', 'data-container': getCode() + '-' + value + '-cc-month', 'data-validate': JSON.stringify({required:true, 'validate-cc-exp':'#' + getCode() + '_expiration_yr'})},
enable: $parent.isActive($parents),
options: $parent.getCcMonthsValues(),
optionsValue: 'value',
optionsText: 'month',
optionsCaption: $t('Month'),
value: creditCardExpMonth"
data-validate="{required:true}">
</select>
</div>
</div>
<div class="field no-label year">
<div class="control">
<select class="select select-year"
data-encrypted-name="expiryYear"
data-bind="attr: {id: getCode() + '_' + value + '_expiration_yr', 'data-container': getCode() + '-' + value + '-cc-year', 'data-validate': JSON.stringify({required:true})},
enable: $parent.isActive($parents),
options: $parent.getCcYearsValues(),
optionsValue: 'value',
optionsText: 'year',
optionsCaption: $t('Year'),
value: creditCardExpYear"
data-validate="{required:true}">
</select>
</div>
</div>
</div>
</div>
</div>
<!-- ko if: hasVerification()-->
<div class="field cvv required" data-bind="attr: {id: getCode() + '_' + value + '_cc_type_cvv_div'}">
<label data-bind="attr: {for: getCode() + '_' + value + '_cc_cid'}" class="label">
<span><!-- ko text: $t('Card Verification Number')--><!-- /ko --></span>
</label>
<div class="control _with-tooltip">
<input type="number"
autocomplete="off"
class="input-text cvv"
data-encrypted-name="cvc"
value=""
data-bind="attr: {id: getCode() + '_' + value + '_cc_cid',
title: $t('Card Verification Number'),
'data-container': getCode() + '-' + value + '-cc-cvv',
'data-validate': JSON.stringify({'required-number':true})},
enable: $parent.isActive($parents),
value: creditCardVerificationNumber"
data-validate="{required:true}"/>
<div class="field-tooltip toggle">
<span class="field-tooltip-action action-cvv"
tabindex="0"
data-toggle="dropdown"
data-bind="attr: {title: $t('What is this?')}, mageInit: {'dropdown':{'activeClass': '_active'}}">
<span><!-- ko text: $t('What is this?')--><!-- /ko --></span>
</span>
<div class="field-tooltip-content"
data-target="dropdown"
data-bind="html: $parent.getCvvImageHtml()"></div>
</div>
</div>
</div>
<!-- /ko -->
<div afterRender="renderSecureCVC()" data-bind="attr: { id: 'cvcContainer-' + value}"></div>
<!--/ko-->
<!-- ko if: agreement_data.bank -->
<div class="field number">
<label class="label">
<span><!-- ko text: $t('Bank account holder name')--><!-- /ko --></span>
......@@ -201,12 +111,11 @@
<span data-bind="text: agreement_data.bank.countryCode"></span>
</div>
</div>
<!--/ko-->
<!-- ko if: number_of_installments.length > 0 -->
<div class="field required" data-bind="attr: {id: getCode() + '_installments_div'}, visible: getInstallments().length > 0">
<div class="field required"
data-bind="attr: {id: getCode() + '_installments_div'}, visible: getInstallments().length > 0">
<label data-bind="attr: {for: getCode() + '_installments'}" class="label">
<span><!-- ko text: $t('Installments')--><!-- /ko --></span>
</label>
......@@ -224,12 +133,9 @@
</select>
</div>
</div>
<!-- /ko -->
</fieldset>
</form>
<div class="checkout-agreements-block">
<!-- ko foreach: $parents[1].getRegion('before-place-order') -->
<!-- ko template: getTemplate() --><!-- /ko -->
......@@ -242,15 +148,12 @@
data-bind="
click: placeOrder,
attr: {title: $t('Place Order')},
enable: (value == $parent.isBillingAgreementChecked())
"
enable: isButtonActive()"
disabled>
<span data-bind="text: $t('Place Order')"></span>
</button>
</div>
</div>
</form>
</div>
</div>
<!--/ko-->
\ 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>
*/
-->
<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