diff --git a/Block/Checkout/Success.php b/Block/Checkout/Success.php index 12b83799d..ab047bbc9 100644 --- a/Block/Checkout/Success.php +++ b/Block/Checkout/Success.php @@ -76,9 +76,8 @@ protected function _toHtml() 'boleto_pdf_url' => $this->getBoletoPdfUrl() ] ); - return parent::_toHtml(); } - return ''; + return parent::_toHtml(); } /** @@ -105,6 +104,42 @@ public function getBoletoPdfUrl() return null; } + /** + * Get Banktransfer additional data + * + * @return array|string[] + */ + public function getBankTransferData() + { + $result = []; + if (!empty($this->getOrder()->getPayment()) && + !empty($this->getOrder()->getPayment()->getAdditionalInformation('bankTransfer.owner')) + ) { + $result = $this->getOrder()->getPayment()->getAdditionalInformation(); + } + + return $result; + } + + /** + * Get multibanco additional data + * + * @return array|string[] + */ + public function getMultibancoData() + { + $result = []; + if (!empty($this->getOrder()->getPayment()) && + !empty($this->getOrder()->getPayment()->getAdditionalInformation('comprafacil.entity')) + ) { + $result = $this->getOrder()->getPayment()->getAdditionalInformation(); + } + + return $result; + } + + + /** * @return \Magento\Sales\Model\Order */ diff --git a/Block/Form/Sepa.php b/Block/Form/Sepa.php deleted file mode 100644 index 143774f14..000000000 --- a/Block/Form/Sepa.php +++ /dev/null @@ -1,62 +0,0 @@ - - */ - -namespace Adyen\Payment\Block\Form; - -class Sepa extends \Magento\Payment\Block\Form -{ - - /** - * @var string - */ - protected $_template = 'Adyen_Payment::form/sepa.phtml'; - - /** - * @var \Adyen\Payment\Helper\Data - */ - protected $_adyenHelper; - - /** - * Sepa constructor. - * - * @param \Magento\Framework\View\Element\Template\Context $context - * @param \Adyen\Payment\Helper\Data $adyenHelper - * @param array $data - */ - public function __construct( - \Magento\Framework\View\Element\Template\Context $context, - \Adyen\Payment\Helper\Data $adyenHelper, - array $data = [] - ) { - parent::__construct($context, $data); - $this->_adyenHelper = $adyenHelper; - } - - /** - * @return mixed - */ - public function getCountries() - { - return $this->_adyenHelper->getSepaCountries(); - } -} diff --git a/Block/Info/Hpp.php b/Block/Info/Hpp.php index d969c3e01..a02151dac 100755 --- a/Block/Info/Hpp.php +++ b/Block/Info/Hpp.php @@ -31,13 +31,48 @@ class Hpp extends AbstractInfo protected $_template = 'Adyen_Payment::info/adyen_hpp.phtml'; /** - * Check if Payment method selection is configured on Adyen or Magento + * Get all Banktransfer related data * + * @return array + * @throws \Magento\Framework\Exception\LocalizedException + */ + public function getBankTransferData() + { + $result = []; + if (!empty($this->getInfo()->getOrder()->getPayment()) && + !empty($this->getInfo()->getOrder()->getPayment()->getAdditionalInformation('bankTransfer.owner')) + ) { + $result = $this->getInfo()->getOrder()->getPayment()->getAdditionalInformation(); + } + + return $result; + } + + /** + * Get all multibanco related data + * + * @return array + * @throws \Magento\Framework\Exception\LocalizedException + */ + public function getMultibancoData() + { + $result = []; + if (!empty($this->getInfo()->getOrder()->getPayment()) && + !empty($this->getInfo()->getOrder()->getPayment()->getAdditionalInformation('comprafacil.entity')) + ) { + $result = $this->getInfo()->getOrder()->getPayment()->getAdditionalInformation(); + } + + return $result; + } + + /** * @return mixed + * @throws \Magento\Framework\Exception\LocalizedException */ - public function isPaymentSelectionOnAdyen() + public function getOrder() { - return $this->_adyenHelper->getAdyenHppConfigDataFlag('payment_selection_on_adyen'); + return $this->getInfo()->getOrder(); } /** diff --git a/Block/Info/Sepa.php b/Block/Info/Sepa.php deleted file mode 100644 index 234bed535..000000000 --- a/Block/Info/Sepa.php +++ /dev/null @@ -1,32 +0,0 @@ - - */ - -namespace Adyen\Payment\Block\Info; - -class Sepa extends AbstractInfo -{ - /** - * @var string - */ - protected $_template = 'Adyen_Payment::info/adyen_sepa.phtml'; -} diff --git a/Block/Redirect/Redirect.php b/Block/Redirect/Redirect.php index 919343779..c85f93046 100755 --- a/Block/Redirect/Redirect.php +++ b/Block/Redirect/Redirect.php @@ -23,6 +23,7 @@ namespace Adyen\Payment\Block\Redirect; +use Adyen\AdyenException; use Symfony\Component\Config\Definition\Exception\Exception; class Redirect extends \Magento\Payment\Block\Form @@ -63,17 +64,29 @@ class Redirect extends \Magento\Payment\Block\Form */ protected $_taxConfig; + /** + * @var \Magento\Tax\Model\Calculation + */ protected $_taxCalculation; - /** - * Redirect 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 - */ + /** + * Request object + */ + protected $_request; + + /** + * Redirect 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 \Magento\Framework\Locale\ResolverInterface $resolver + * @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger + * @param \Magento\Tax\Model\Config $taxConfig + * @param \Magento\Tax\Model\Calculation $taxCalculation + */ public function __construct( \Magento\Framework\View\Element\Template\Context $context, array $data = [], @@ -93,14 +106,61 @@ public function __construct( $this->_resolver = $resolver; $this->_adyenLogger = $adyenLogger; - if (!$this->_order) { - $incrementId = $this->_getCheckout()->getLastRealOrderId(); - $this->_order = $this->_orderFactory->create()->loadByIncrementId($incrementId); - } + $this->_getOrder(); $this->_taxConfig = $taxConfig; $this->_taxCalculation = $taxCalculation; + $this->_request = $context->getRequest(); } + /** + * Returns if the payment should follow the old HPP or the new Checkout flow + * - hpp will submit a form with all the additional information that the API requests\ + * - checkout will redirect to a url without form submission + * + * @return bool + * @throws \Exception + */ + public function isCheckoutAPM() { + try { + if ($paymentObject = $this->_order->getPayment()) { + if ($paymentObject->getAdditionalInformation('CheckoutAPM')) { + return true; + } + } + } catch (Exception $e) { + // do nothing for now + throw($e); + } + + return false; + } + + /** + * @return mixed|string[] + * @throws AdyenException + */ + public function getRedirectMethod() + { + if ($redirectMethod = $this->getPayment()->getAdditionalInformation('redirectMethod')) { + return $redirectMethod; + } + + throw new AdyenException("No redirect method is provided."); + } + /** + * Retrieves redirect url for the flow of checkout API + * + * @return string[] + * @throws AdyenException + */ + public function getRedirectUrl() + { + if ($redirectUrl = $this->getPayment()->getAdditionalInformation('redirectUrl')) { + return $redirectUrl; + } + + throw new AdyenException("No redirect url is provided."); + } /** * @return $this @@ -118,43 +178,26 @@ public function getFormUrl() $url = ""; try { if ($this->_order->getPayment()) { - $paymentRoutine = $this->_adyenHelper->getAdyenHppConfigData('payment_routine'); switch ($this->_adyenHelper->isDemoMode()) { case true: - if ($paymentRoutine == 'single' && $this->getPaymentMethodSelectionOnAdyen()) { - $url = 'https://test.adyen.com/hpp/pay.shtml'; + if ($this->_adyenHelper->doesPaymentMethodSkipDetails( + $this->_order->getPayment()->getAdditionalInformation('brand_code') + ) + ) { + $url = "https://test.adyen.com/hpp/skipDetails.shtml"; } else { - if ($this->getPaymentMethodSelectionOnAdyen()) { - $url = 'https://test.adyen.com/hpp/select.shtml'; - } else { - if ($this->_adyenHelper->doesPaymentMethodSkipDetails( - $this->_order->getPayment()->getAdditionalInformation('brand_code') - ) - ) { - $url = "https://test.adyen.com/hpp/skipDetails.shtml"; - } else { - $url = "https://test.adyen.com/hpp/details.shtml"; - } - } + $url = "https://test.adyen.com/hpp/details.shtml"; } break; default: - if ($paymentRoutine == 'single' && $this->getPaymentMethodSelectionOnAdyen()) { - $url = 'https://live.adyen.com/hpp/pay.shtml'; + if ($this->_adyenHelper->doesPaymentMethodSkipDetails( + $this->_order->getPayment()->getAdditionalInformation('brand_code') + ) + ) { + $url = "https://live.adyen.com/hpp/skipDetails.shtml"; } else { - if ($this->getPaymentMethodSelectionOnAdyen()) { - $url = 'https://live.adyen.com/hpp/select.shtml'; - } else { - if ($this->_adyenHelper->doesPaymentMethodSkipDetails( - $this->_order->getPayment()->getAdditionalInformation('brand_code') - ) - ) { - $url = "https://live.adyen.com/hpp/skipDetails.shtml"; - } else { - $url = "https://live.adyen.com/hpp/details.shtml"; - } - } + $url = "https://live.adyen.com/hpp/details.shtml"; } break; } @@ -167,152 +210,13 @@ public function getFormUrl() return $url; } - /** - * @return mixed - */ - public function getPaymentMethodSelectionOnAdyen() - { - return $this->_adyenHelper->getAdyenHppConfigDataFlag('payment_selection_on_adyen'); - } - - /** - * @return array - */ - public function getFormFields() - { - $formFields = []; - try { - if ($this->_order->getPayment()) { - $realOrderId = $this->_order->getRealOrderId(); - $orderCurrencyCode = $this->_order->getOrderCurrencyCode(); - $skinCode = trim($this->_adyenHelper->getAdyenHppConfigData('skin_code')); - $amount = $this->_adyenHelper->formatAmount( - $this->_order->getGrandTotal(), - $orderCurrencyCode - ); - $merchantAccount = trim($this->_adyenHelper->getAdyenAbstractConfigData('merchant_account', $this->_order->getStoreId())); - $shopperEmail = $this->_order->getCustomerEmail(); - $customerId = $this->_order->getCustomerId(); - $shopperIP = $this->_order->getRemoteIp(); - $browserInfo = $_SERVER['HTTP_USER_AGENT']; - $deliveryDays = $this->_adyenHelper->getAdyenHppConfigData('delivery_days'); - $shopperLocale = trim($this->_adyenHelper->getAdyenHppConfigData('shopper_locale')); - $shopperLocale = (!empty($shopperLocale)) ? $shopperLocale : $this->_resolver->getLocale(); - $countryCode = trim($this->_adyenHelper->getAdyenHppConfigData('country_code')); - $countryCode = (!empty($countryCode)) ? $countryCode : false; - - // if directory lookup is enabled use the billingaddress as countrycode - if ($countryCode == false) { - if ($this->_order->getBillingAddress() && - $this->_order->getBillingAddress()->getCountryId() != "" - ) { - $countryCode = $this->_order->getBillingAddress()->getCountryId(); - } - } - - $formFields = []; - - $formFields['merchantAccount'] = $merchantAccount; - $formFields['merchantReference'] = $realOrderId; - $formFields['paymentAmount'] = (int)$amount; - $formFields['currencyCode'] = $orderCurrencyCode; - $formFields['shipBeforeDate'] = date( - "Y-m-d", - mktime(date("H"), date("i"), date("s"), date("m"), date("j") + $deliveryDays, date("Y")) - ); - $formFields['skinCode'] = $skinCode; - $formFields['shopperLocale'] = $shopperLocale; - $formFields['countryCode'] = $countryCode; - $formFields['shopperIP'] = $shopperIP; - $formFields['browserInfo'] = $browserInfo; - $formFields['sessionValidity'] = date( - DATE_ATOM, - mktime(date("H") + 1, date("i"), date("s"), date("m"), date("j"), date("Y")) - ); - $formFields['shopperEmail'] = $shopperEmail; - // recurring - $recurringType = $this->_adyenHelper->getRecurringTypeFromOneclickRecurringSetting(); - $brandCode = $this->_order->getPayment()->getAdditionalInformation( - \Adyen\Payment\Observer\AdyenHppDataAssignObserver::BRAND_CODE - ); - - // Paypal does not allow ONECLICK,RECURRING only RECURRING - if ($brandCode == "paypal" && $recurringType == 'ONECLICK,RECURRING') { - $recurringType = "RECURRING"; - } - - if ($customerId > 0) { - $formFields['recurringContract'] = $recurringType; - $formFields['shopperReference'] = $customerId; - } else { - // required for openinvoice payment methods use unique id - $uniqueReference = "guest_" . $realOrderId . "_" . $this->_order->getStoreId(); - $formFields['shopperReference'] = $uniqueReference; - } - - //blocked methods - $formFields['blockedMethods'] = ""; - - $baseUrl = $this->_storeManager->getStore($this->getStore()) - ->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_LINK); - - $formFields['resURL'] = $baseUrl . 'adyen/process/result'; - - if ($brandCode) { - $formFields['brandCode'] = $brandCode; - } - - $issuerId = $this->_order->getPayment()->getAdditionalInformation("issuer_id"); - if ($issuerId) { - $formFields['issuerId'] = $issuerId; - } - - $formFields = $this->setBillingAddressData($formFields); - $formFields = $this->setShippingAddressData($formFields); - $formFields = $this->setOpenInvoiceData($formFields); - - $formFields['shopper.gender'] = $this->getGenderText($this->_order->getCustomerGender()); - $dob = $this->_order->getCustomerDob(); - if ($dob) { - $formFields['shopper.dateOfBirthDayOfMonth'] = trim($this->_getDate($dob, 'd')); - $formFields['shopper.dateOfBirthMonth'] = trim($this->_getDate($dob, 'm')); - $formFields['shopper.dateOfBirthYear'] = trim($this->_getDate($dob, 'Y')); - } - - // For klarna acceptPrivacyPolicy to skip HPP page - if ($brandCode == "klarna") { - $ssn = $this->_order->getPayment()->getAdditionalInformation('ssn'); - if (!empty($ssn)) { - $formFields['shopper.socialSecurityNumber'] = $ssn; - } - // // needed for DE and AT - $formFields['klarna.acceptPrivacyPolicy'] = 'true'; - } - - // OpenInvoice don't allow to edit billing and delivery items - - if ($this->_adyenHelper->isPaymentMethodOpenInvoiceMethod($brandCode)) { - // don't allow editable shipping/delivery address - $formFields['billingAddressType'] = "1"; - $formFields['deliveryAddressType'] = "1"; - } - - if ($this->_order->getPayment()->getAdditionalInformation("df_value") != "") { - $formFields['dfValue'] = $this->_order->getPayment()->getAdditionalInformation("df_value"); - } - - // Sign request using secret key - $hmacKey = $this->_adyenHelper->getHmac(); - $merchantSig = \Adyen\Util\Util::calculateSha256Signature($hmacKey, $formFields); - $formFields['merchantSig'] = $merchantSig; - - $this->_adyenLogger->addAdyenDebug(print_r($formFields, true)); - } - } catch (Exception $e) { - // do nothing for now - } - return $formFields; - } + /** + * @return mixed + */ + private function getBrandCode() + { + return $this->getPayment()->getAdditionalInformation('brand_code'); + } /** * Set Billing Address data @@ -322,6 +226,7 @@ public function getFormFields() protected function setBillingAddressData($formFields) { $billingAddress = $this->_order->getBillingAddress(); + if ($billingAddress) { $formFields['shopper.firstName'] = trim($billingAddress->getFirstname()); $middleName = trim($billingAddress->getMiddlename()); @@ -355,19 +260,19 @@ protected function setBillingAddressData($formFields) } if (trim($billingAddress->getPostcode()) == "") { - $formFields['billingAddress.postalCode'] = "NA"; + $formFields['billingAddress.postalCode'] = ""; } else { $formFields['billingAddress.postalCode'] = trim($billingAddress->getPostcode()); } if (trim($billingAddress->getRegionCode()) == "") { - $formFields['billingAddress.stateOrProvince'] = "NA"; + $formFields['billingAddress.stateOrProvince'] = ""; } else { $formFields['billingAddress.stateOrProvince'] = trim($billingAddress->getRegionCode()); } if (trim($billingAddress->getCountryId()) == "") { - $formFields['billingAddress.country'] = "NA"; + $formFields['billingAddress.country'] = "ZZ"; } else { $formFields['billingAddress.country'] = trim($billingAddress->getCountryId()); } @@ -401,7 +306,6 @@ protected function setShippingAddressData($formFields) $formFields['deliveryAddress.street'] = implode(" ", $shippingAddress->getStreet()); } - if (trim($shippingAddress->getCity()) == "") { $formFields['deliveryAddress.city'] = "NA"; } else { @@ -409,19 +313,19 @@ protected function setShippingAddressData($formFields) } if (trim($shippingAddress->getPostcode()) == "") { - $formFields['deliveryAddress.postalCode'] = "NA"; + $formFields['deliveryAddress.postalCode'] = ""; } else { $formFields['deliveryAddress.postalCode'] = trim($shippingAddress->getPostcode()); } if (trim($shippingAddress->getRegionCode()) == "") { - $formFields['deliveryAddress.stateOrProvince'] = "NA"; + $formFields['deliveryAddress.stateOrProvince'] = ""; } else { $formFields['deliveryAddress.stateOrProvince'] = trim($shippingAddress->getRegionCode()); } if (trim($shippingAddress->getCountryId()) == "") { - $formFields['deliveryAddress.country'] = "NA"; + $formFields['deliveryAddress.country'] = "ZZ"; } else { $formFields['deliveryAddress.country'] = trim($shippingAddress->getCountryId()); } @@ -479,7 +383,7 @@ protected function setOpenInvoiceData($formFields) $itemVatPercentage, $numberOfItems, $this->_order->getPayment(), - "discount" + "totalDiscount" ); } @@ -518,21 +422,6 @@ protected function getGenderText($genderId) return $result; } - /** - * @param null $date - * @param string $format - * @return mixed - */ - protected function _getDate($date = null, $format = 'Y-m-d H:i:s') - { - if (strlen($date) < 0) { - $date = date('d-m-Y H:i:s'); - } - $timeStamp = new \DateTime($date); - return $timeStamp->format($format); - } - - /** * The character escape function is called from the array_map function in _signRequestParams * @@ -553,4 +442,82 @@ protected function _getCheckout() { return $this->_checkoutSession; } + + /** + * Retrieve request object + * + * @return \Magento\Framework\App\RequestInterface + */ + protected function _getRequest() + { + return $this->_request; + } + + /** + * Get order object + * + * @return \Magento\Sales\Model\Order + */ + protected function _getOrder() + { + if (!$this->_order) { + $incrementId = $this->_getCheckout()->getLastRealOrderId(); + $this->_order = $this->_orderFactory->create()->loadByIncrementId($incrementId); + } + return $this->_order; + } + + /** + * @return mixed + */ + public function getPaReq() + { + if ($paReq = $this->getPayment()->getAdditionalInformation('paRequest')) { + return $paReq; + } + + throw new AdyenException("No paRequest is provided."); + } + + /** + * @return string[] + * @throws AdyenException + */ + public function getMd() + { + if ($md = $this->getPayment()->getAdditionalInformation('md')) { + return $md; + } + + throw new AdyenException("No MD is provided."); + } + + /** + * @return string + */ + public function getTermUrl() + { + return $this->getUrl('adyen/process/redirect', + ['_secure' => $this->_getRequest()->isSecure()]); + } + + /** + * Retrieve payment object if available + * + * @return \Magento\Framework\DataObject|\Magento\Sales\Api\Data\OrderPaymentInterface|mixed|null + * @throws AdyenException + */ + private function getPayment() { + try { + $paymentObject = $this->_order->getPayment(); + if (!empty($paymentObject)) { + return $paymentObject; + } + } catch (Exception $e) { + // do nothing for now + throw($e); + } + + throw new AdyenException("No payment object is found."); + } } diff --git a/Block/Redirect/Validate3d.php b/Block/Redirect/Validate3d.php deleted file mode 100755 index 739c80976..000000000 --- a/Block/Redirect/Validate3d.php +++ /dev/null @@ -1,138 +0,0 @@ - - */ - -namespace Adyen\Payment\Block\Redirect; - -class Validate3d extends \Magento\Payment\Block\Form -{ - - /** - * @var \Magento\Sales\Model\OrderFactory - */ - protected $_orderFactory; - - /** - * @var \Magento\Checkout\Model\Session - */ - protected $_checkoutSession; - - /** - * @var \Magento\Checkout\Model\Order - */ - protected $_order; - - /** - * @var \Magento\Framework\App\RequestInterface - */ - protected $_request; - - /** - * Validate3d constructor. - * - * @param \Magento\Framework\View\Element\Template\Context $context - * @param array $data - * @param \Magento\Sales\Model\OrderFactory $orderFactory - * @param \Magento\Checkout\Model\Session $checkoutSession - */ - public function __construct( - \Magento\Framework\View\Element\Template\Context $context, - array $data = [], - \Magento\Sales\Model\OrderFactory $orderFactory, - \Magento\Checkout\Model\Session $checkoutSession - ) { - $this->_orderFactory = $orderFactory; - $this->_checkoutSession = $checkoutSession; - $this->_request = $context->getRequest(); - parent::__construct($context, $data); - $this->_getOrder(); - } - - /** - * Get order object - * - * @return \Magento\Sales\Model\Order - */ - protected function _getOrder() - { - if (!$this->_order) { - $incrementId = $this->_getCheckout()->getLastRealOrderId(); - $this->_order = $this->_orderFactory->create()->loadByIncrementId($incrementId); - } - return $this->_order; - } - - /** - * Get frontend checkout session object - * - * @return \Magento\Checkout\Model\Session - */ - protected function _getCheckout() - { - return $this->_checkoutSession; - } - - /** - * @return mixed - */ - public function getIssuerUrl() - { - return $this->_order->getPayment()->getAdditionalInformation('issuerUrl'); - } - - /** - * @return mixed - */ - public function getPaReq() - { - return $this->_order->getPayment()->getAdditionalInformation('paRequest'); - } - - /** - * @return mixed - */ - public function getMd() - { - return $this->_order->getPayment()->getAdditionalInformation('md'); - } - - /** - * @return string - */ - public function getTermUrl() - { - return $this->getUrl( - 'adyen/process/validate3d', - ['_secure' => $this->_getRequest()->isSecure()] - ); - } - - /** - * Retrieve request object - * - * @return \Magento\Framework\App\RequestInterface - */ - protected function _getRequest() - { - return $this->_request; - } -} diff --git a/Controller/Process/Json.php b/Controller/Process/Json.php index 44e3675e9..9f7de6158 100755 --- a/Controller/Process/Json.php +++ b/Controller/Process/Json.php @@ -24,7 +24,7 @@ namespace Adyen\Payment\Controller\Process; use Symfony\Component\Config\Definition\Exception\Exception; -use Magento\Framework\App\Request\Http as HttpRequest; +use Magento\Framework\App\Request\Http as Http; /** * Class Json @@ -73,7 +73,7 @@ public function __construct( // Fix for Magento2.3 adding isAjax to the request params if(interface_exists("\Magento\Framework\App\CsrfAwareActionInterface")) { $request = $this->getRequest(); - if ($request instanceof HttpRequest && $request->isPost()) { + if ($request instanceof Http && $request->isPost()) { $request->setParam('isAjax', true); } } diff --git a/Controller/Process/Redirect.php b/Controller/Process/Redirect.php index b9ff48dd4..e2f2c453e 100755 --- a/Controller/Process/Redirect.php +++ b/Controller/Process/Redirect.php @@ -22,6 +22,13 @@ */ namespace Adyen\Payment\Controller\Process; +use Magento\Framework\App\Request\Http as Http; +use Magento\Vault\Api\Data\PaymentTokenInterface; +use Magento\Vault\Api\Data\PaymentTokenFactoryInterface; +use Magento\Sales\Api\Data\OrderPaymentExtensionInterface; +use Magento\Sales\Api\Data\OrderPaymentExtensionInterfaceFactory; +use Magento\Sales\Model\ResourceModel\Order\Payment as OrderPaymentResource; +use Magento\Payment\Model\InfoInterface; class Redirect extends \Magento\Framework\App\Action\Action { @@ -46,71 +53,303 @@ class Redirect extends \Magento\Framework\App\Action\Action */ protected $_orderFactory; - /** - * @param \Magento\Framework\App\Action\Context $context - */ - public function __construct( - \Magento\Framework\App\Action\Context $context - ) { - parent::__construct($context); - } + /** + * @var \Adyen\Payment\Logger\AdyenLogger + */ + protected $_adyenLogger; + + /** + * @var \Adyen\Payment\Helper\Data + */ + protected $_adyenHelper; + + /** + * @var \Adyen\Payment\Model\Api\PaymentRequest + */ + protected $_paymentRequest; + + /** + * @var \Magento\Sales\Api\OrderRepositoryInterface + */ + protected $_orderRepository; /** - * Return checkout session object - * - * @return \Magento\Checkout\Model\Session + * @var PaymentTokenFactoryInterface */ - protected function _getCheckoutSession() - { - return $this->_checkoutSession; - } - + private $paymentTokenFactory; /** - * Set redirect + * @var OrderPaymentExtensionInterfaceFactory */ - public function execute() - { - $this->_view->loadLayout(); - $this->_view->getLayout()->initMessages(); - $this->_view->renderLayout(); - } - + private $paymentExtensionFactory; /** - * Get order object - * - * @return \Magento\Sales\Model\Order + * @var OrderPaymentResource */ - 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); + private $orderPaymentResource; + + /** + * Redirect constructor. + * + * @param \Magento\Framework\App\Action\Context $context + * @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger + * @param \Adyen\Payment\Helper\Data $adyenHelper + * @param \Adyen\Payment\Model\Api\PaymentRequest $paymentRequest + * @param \Magento\Sales\Api\OrderRepositoryInterface $orderRepository + */ + public function __construct( + \Magento\Framework\App\Action\Context $context, + \Adyen\Payment\Logger\AdyenLogger $adyenLogger, + \Adyen\Payment\Helper\Data $adyenHelper, + \Adyen\Payment\Model\Api\PaymentRequest $paymentRequest, + \Magento\Sales\Api\OrderRepositoryInterface $orderRepository, + PaymentTokenFactoryInterface $paymentTokenFactory, + OrderPaymentExtensionInterfaceFactory $paymentExtensionFactory, + OrderPaymentResource $orderPaymentResource + ) { + parent::__construct($context); + $this->_adyenLogger = $adyenLogger; + $this->_adyenHelper = $adyenHelper; + $this->_paymentRequest = $paymentRequest; + $this->_orderRepository = $orderRepository; + $this->paymentTokenFactory = $paymentTokenFactory; + $this->paymentExtensionFactory = $paymentExtensionFactory; + $this->orderPaymentResource = $orderPaymentResource; + if (interface_exists("\Magento\Framework\App\CsrfAwareActionInterface")) { + $request = $this->getRequest(); + if ($request instanceof Http && $request->isPost()) { + $request->setParam('isAjax', true); + } } - return $this->_order; } - /** - * @return \Magento\Checkout\Model\Session - */ - protected function _getCheckout() - { - return $this->_objectManager->get('Magento\Checkout\Model\Session'); - } + /** + * Validate 3D secure payment + */ + public function execute() + { + $active = null; + + // check if 3d is active + $order = $this->_getOrder(); + + if ($order->getPayment()) { + $active = $order->getPayment()->getAdditionalInformation('3dActive'); + $success = $order->getPayment()->getAdditionalInformation('3dSuccess'); + $checkoutAPM = $order->getPayment()->getAdditionalInformation('checkoutAPM'); + } + + // check if 3D secure is active. If not just go to success page + if ($active && $success != true) { + + $this->_adyenLogger->addAdyenResult("3D secure is active"); + + // check if it is already processed + if ($this->getRequest()->isPost()) { + + $this->_adyenLogger->addAdyenResult("Process 3D secure payment"); + $requestMD = $this->getRequest()->getPost('MD'); + $requestPaRes = $this->getRequest()->getPost('PaRes'); + $md = $order->getPayment()->getAdditionalInformation('md'); + + if ($requestMD == $md) { + + $order->getPayment()->setAdditionalInformation('paResponse', $requestPaRes); + + try { + $result = $this->_authorise3d($order->getPayment()); + $responseCode = $result['resultCode']; + } catch (\Exception $e) { + $this->_adyenLogger->addAdyenResult("Process 3D secure payment was refused"); + $responseCode = 'Refused'; + } + + $this->_adyenLogger->addAdyenResult("Process 3D secure payment result is: " . $responseCode); + + // check if authorise3d was successful + if ($responseCode == 'Authorised') { + $order->addStatusHistoryComment(__('3D-secure validation was successful'))->save(); + // set back to false so when pressed back button on the success page it will reactivate 3D secure + $order->getPayment()->setAdditionalInformation('3dActive', ''); + $order->getPayment()->setAdditionalInformation('3dSuccess', true); + + if (!$this->_adyenHelper->isCreditCardVaultEnabled() && + !empty($result['additionalData']['recurring.recurringDetailReference'])) { + $this->_adyenHelper->createAdyenBillingAgreement($order, $result['additionalData']); + } elseif (!empty($result['additionalData']['recurring.recurringDetailReference']) + ) { + try { + $additionalData = $result['additionalData']; + $token = $additionalData['recurring.recurringDetailReference']; + $expirationDate = $additionalData['expiryDate']; + $cardType = $additionalData['paymentMethod']; + $cardSummary = $additionalData['cardSummary']; + /** @var PaymentTokenInterface $paymentToken */ + $paymentToken = $this->paymentTokenFactory->create( + PaymentTokenFactoryInterface::TOKEN_TYPE_CREDIT_CARD + ); + $paymentToken->setGatewayToken($token); + $paymentToken->setExpiresAt($this->getExpirationDate($expirationDate)); + $details = [ + 'type' => $cardType, + 'maskedCC' => $cardSummary, + 'expirationDate' => $expirationDate + ]; + $paymentToken->setTokenDetails(json_encode($details)); + $extensionAttributes = $this->getExtensionAttributes($order->getPayment()); + $extensionAttributes->setVaultPaymentToken($paymentToken); + $orderPayment = $order->getPayment()->setExtensionAttributes($extensionAttributes); + $add = unserialize($orderPayment->getAdditionalData()); + $add['force_save'] = true; + $orderPayment->setAdditionalData(serialize($add)); + $this->orderPaymentResource->save($orderPayment); + } catch (\Exception $e) { + $this->_adyenLogger->error((string)$e->getMessage()); + } + } + + $this->_orderRepository->save($order); + + $this->_redirect('checkout/onepage/success', ['_query' => ['utm_nooverride' => '1']]); + } else { + $order->addStatusHistoryComment(__('3D-secure validation was unsuccessful.'))->save(); + + // Move the order from PAYMENT_REVIEW to NEW, so that can be cancelled + $order->setState(\Magento\Sales\Model\Order::STATE_NEW); + $this->_adyenHelper->cancelOrder($order); + $this->messageManager->addErrorMessage("3D-secure validation was unsuccessful"); + + // reactivate the quote + $session = $this->_getCheckout(); + + // restore the quote + $session->restoreQuote(); + + $this->_redirect($this->_adyenHelper->getAdyenAbstractConfigData('return_path')); + } + } + } else { + $this->_adyenLogger->addAdyenResult("Customer was redirected to bank for 3D-secure validation."); + $order->addStatusHistoryComment( + __('Customer was redirected to bank for 3D-secure validation. Once the shopper authenticated, the order status will be updated accordingly. +
Make sure that your notifications are being processed! +
If the order is stuck on this status, the shopper abandoned the session. The payment can be seen as unsuccessful. +
The order can be automatically cancelled based on the OFFER_CLOSED notification. Please contact Adyen Support to enable this.'))->save(); + $this->_view->loadLayout(); + $this->_view->getLayout()->initMessages(); + $this->_view->renderLayout(); + } + + } elseif (!empty($checkoutAPM)) { + $this->_view->loadLayout(); + $this->_view->getLayout()->initMessages(); + $this->_view->renderLayout(); + } else { + $this->_redirect('checkout/onepage/success', ['_query' => ['utm_nooverride' => '1']]); + } + } + + /** + * Return checkout session object + * + * @return \Magento\Checkout\Model\Session + */ + protected function _getCheckoutSession() + { + return $this->_checkoutSession; + } + + /** + * 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'); + } + + /** + * Called by redirect controller when cc payment has 3D secure + * + * @param $payment + * @return mixed + * @throws \Exception + */ + protected function _authorise3d($payment) + { + try { + $response = $this->_paymentRequest->authorise3d($payment); + } catch(\Exception $e) { + throw $e; + } + + return $response; + } /** - * @return mixed + * @param $expirationDate + * @return string */ - protected function _getQuote() + private function getExpirationDate($expirationDate) { - return $this->_objectManager->get('Magento\Quote\Model\Quote'); + $expirationDate = explode('/', $expirationDate); + //add leading zero to month + $month = sprintf("%02d", $expirationDate[0]); + $expDate = new \DateTime( + $expirationDate[1] + . '-' + . $month + . '-' + . '01' + . ' ' + . '00:00:00', + new \DateTimeZone('UTC') + ); + // add one month + $expDate->add(new \DateInterval('P1M')); + return $expDate->format('Y-m-d 00:00:00'); } /** - * @return mixed + * Get payment extension attributes + * @param InfoInterface $payment + * @return OrderPaymentExtensionInterface */ - protected function _getQuoteManagement() + private function getExtensionAttributes(InfoInterface $payment) { - return $this->_objectManager->get('\Magento\Quote\Model\QuoteManagement'); + $extensionAttributes = $payment->getExtensionAttributes(); + if (null === $extensionAttributes) { + $extensionAttributes = $this->paymentExtensionFactory->create(); + $payment->setExtensionAttributes($extensionAttributes); + } + return $extensionAttributes; } } diff --git a/Controller/Process/Result.php b/Controller/Process/Result.php index b70dbe15f..707459d22 100755 --- a/Controller/Process/Result.php +++ b/Controller/Process/Result.php @@ -57,6 +57,11 @@ class Result extends \Magento\Framework\App\Action\Action */ protected $_adyenLogger; + /** + * @var \Magento\Store\Model\StoreManagerInterface + */ + protected $storeManager; + /** * Result constructor. * @@ -66,6 +71,7 @@ class Result extends \Magento\Framework\App\Action\Action * @param \Magento\Sales\Model\Order\Status\HistoryFactory $orderHistoryFactory * @param \Magento\Checkout\Model\Session $session * @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger + * @param \Magento\Store\Model\StoreManagerInterface $storeManager */ public function __construct( \Magento\Framework\App\Action\Context $context, @@ -73,13 +79,15 @@ public function __construct( \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Sales\Model\Order\Status\HistoryFactory $orderHistoryFactory, \Magento\Checkout\Model\Session $session, - \Adyen\Payment\Logger\AdyenLogger $adyenLogger + \Adyen\Payment\Logger\AdyenLogger $adyenLogger, + \Magento\Store\Model\StoreManagerInterface $storeManager ) { $this->_adyenHelper = $adyenHelper; $this->_orderFactory = $orderFactory; $this->_orderHistoryFactory = $orderHistoryFactory; $this->_session = $session; $this->_adyenLogger = $adyenLogger; + $this->storeManager = $storeManager; parent::__construct($context); } @@ -152,11 +160,18 @@ protected function validateResponse($response) ); } - // authenticate result url - $authStatus = $this->_authenticate($response); - if (!$authStatus) { - throw new \Magento\Framework\Exception\LocalizedException(__('ResultUrl authentification failure')); - } + // If the merchant signature is present, authenticate the result url + if (!empty($response['merchantSig'])) { + // authenticate result url + $authStatus = $this->_authenticate($response); + if (!$authStatus) { + throw new \Magento\Framework\Exception\LocalizedException(__('ResultUrl authentification failure')); + } + // Otherwise validate the pazload and get back the response that can be used to finish the order + } else { + // send the payload verification payment\details request to validate the response + $response = $this->validatePayloadAndReturnResponse($response); + } $incrementId = $response['merchantReference']; @@ -202,7 +217,12 @@ protected function _validateUpdateOrder($order, $response) $this->_adyenLogger->addAdyenResult('Updating the order'); - $authResult = $response['authResult']; + if (!empty($response['authResult'])) { + $authResult = $response['authResult']; + } elseif (!empty($response['resultCode'])) { + $authResult = $response['resultCode']; + } + $paymentMethod = isset($response['paymentMethod']) ? trim($response['paymentMethod']) : ''; $pspReference = isset($response['pspReference']) ? trim($response['pspReference']) : ''; @@ -215,15 +235,18 @@ protected function _validateUpdateOrder($order, $response) $paymentMethod ); - // needed because then we need to save $order objects $order->setAdyenResulturlEventCode($authResult); - switch ($authResult) { + switch (strtoupper($authResult)) { case Notification::AUTHORISED: $result = true; $this->_adyenLogger->addAdyenResult('Do nothing wait for the notification'); break; + case Notification::RECEIVED: + $result = true; + $this->_adyenLogger->addAdyenResult('Do nothing wait for the notification'); + break; case Notification::PENDING: // do nothing wait for the notification $result = true; @@ -279,31 +302,33 @@ protected function _validateUpdateOrder($order, $response) protected function _authenticate($response) { - $merchantSigNotification = $response['merchantSig']; + $merchantSigNotification = $response['merchantSig']; - // do it like this because $_GET is converting dot to underscore - $queryString = $_SERVER['QUERY_STRING']; - $result = []; - $pairs = explode("&", $queryString); + // do it like this because $_GET is converting dot to underscore + $queryString = $_SERVER['QUERY_STRING']; + $result = []; + $pairs = explode("&", $queryString); - foreach ($pairs as $pair) { - $nv = explode("=", $pair); - $name = urldecode($nv[0]); - $value = urldecode($nv[1]); - $result[$name] = $value; - } + foreach ($pairs as $pair) { + $nv = explode("=", $pair); + $name = urldecode($nv[0]); + $value = urldecode($nv[1]); + $result[$name] = $value; + } - // do not include the merchantSig in the merchantSig calculation - unset($result['merchantSig']); + // do not include the merchantSig in the merchantSig calculation + unset($result['merchantSig']); - // Sign request using secret key - $hmacKey = $this->_adyenHelper->getHmac(); - $merchantSig = \Adyen\Util\Util::calculateSha256Signature($hmacKey, $result); + // Sign request using secret key + $hmacKey = $this->_adyenHelper->getHmac(); + $merchantSig = \Adyen\Util\Util::calculateSha256Signature($hmacKey, $result); + + if (strcmp($merchantSig, $merchantSigNotification) === 0) { + return true; + } + + return false; - if (strcmp($merchantSig, $merchantSigNotification) === 0) { - return true; - } - return false; } /** @@ -330,4 +355,31 @@ protected function _getOrder($incrementId) } return $this->_order; } -} + + /** + * Validates the payload from checkout /payments hpp and returns the api response + * + * @param $response + * @return mixed + * @throws \Adyen\AdyenException + */ + protected function validatePayloadAndReturnResponse($response) + { + $client = $this->_adyenHelper->initializeAdyenClient($this->storeManager->getStore()->getId()); + $service = $this->_adyenHelper->createAdyenCheckoutService($client); + + $request = array( + "details" => array( + "payload" => $response["payload"] + ) + ); + + try { + $response = $service->paymentsDetails($request); + } catch(\Adyen\AdyenException $e) { + $response['error'] = $e->getMessage(); + } + + return $response; + } +} \ No newline at end of file diff --git a/Controller/Process/Validate3d.php b/Controller/Process/Validate3d.php index 40ddaaf03..e69de29bb 100755 --- a/Controller/Process/Validate3d.php +++ b/Controller/Process/Validate3d.php @@ -1,320 +0,0 @@ - - */ - -namespace Adyen\Payment\Controller\Process; - -use Magento\Framework\App\Request\Http as HttpRequest; -use Magento\Payment\Model\InfoInterface; -use Magento\Vault\Api\Data\PaymentTokenInterface; -use Magento\Vault\Api\Data\PaymentTokenFactoryInterface; -use Magento\Sales\Api\Data\OrderPaymentExtensionInterface; -use Magento\Sales\Api\Data\OrderPaymentExtensionInterfaceFactory; -use Magento\Sales\Model\ResourceModel\Order\Payment as OrderPaymentResource; - -class Validate3d extends \Magento\Framework\App\Action\Action -{ - /** - * @var \Magento\Sales\Model\OrderFactory - */ - protected $_orderFactory; - - /** - * @var \Magento\Sales\Model\Order - */ - protected $_order; - - /** - * @var \Adyen\Payment\Logger\AdyenLogger - */ - protected $_adyenLogger; - - /** - * @var \Adyen\Payment\Helper\Data - */ - protected $_adyenHelper; - - /** - * @var \Adyen\Payment\Model\Api\PaymentRequest - */ - protected $_paymentRequest; - - /** - * @var \Magento\Sales\Api\OrderRepositoryInterface - */ - protected $_orderRepository; - - /** - * @var PaymentTokenFactoryInterface - */ - private $paymentTokenFactory; - /** - * @var OrderPaymentExtensionInterfaceFactory - */ - private $paymentExtensionFactory; - /** - * @var OrderPaymentResource - */ - private $orderPaymentResource; - - /** - * Validate3d constructor. - * - * @param \Magento\Framework\App\Action\Context $context - * @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger - * @param \Adyen\Payment\Helper\Data $adyenHelper - * @param \Adyen\Payment\Model\Api\PaymentRequest $paymentRequest - * @param \Magento\Sales\Api\OrderRepositoryInterface $orderRepository - * @param PaymentTokenFactoryInterface $paymentTokenFactory - * @param OrderPaymentExtensionInterfaceFactory $paymentExtensionFactory - * @param OrderPaymentResource $orderPaymentResource - */ - public function __construct( - \Magento\Framework\App\Action\Context $context, - \Adyen\Payment\Logger\AdyenLogger $adyenLogger, - \Adyen\Payment\Helper\Data $adyenHelper, - \Adyen\Payment\Model\Api\PaymentRequest $paymentRequest, - \Magento\Sales\Api\OrderRepositoryInterface $orderRepository, - PaymentTokenFactoryInterface $paymentTokenFactory, - OrderPaymentExtensionInterfaceFactory $paymentExtensionFactory, - OrderPaymentResource $orderPaymentResource - ) { - parent::__construct($context); - $this->_adyenLogger = $adyenLogger; - $this->_adyenHelper = $adyenHelper; - $this->_paymentRequest = $paymentRequest; - $this->_orderRepository = $orderRepository; - $this->paymentTokenFactory = $paymentTokenFactory; - $this->paymentExtensionFactory = $paymentExtensionFactory; - $this->orderPaymentResource = $orderPaymentResource; - // Fix for Magento2.3 adding isAjax to the request params - if (interface_exists("\Magento\Framework\App\CsrfAwareActionInterface")) { - $request = $this->getRequest(); - if ($request instanceof HttpRequest && $request->isPost()) { - $request->setParam('isAjax', true); - } - } - } - - /** - * Validate 3D secure payment - */ - public function execute() - { - $active = null; - - // check if 3d is active - $order = $this->_getOrder(); - - if ($order->getPayment()) { - $active = $order->getPayment()->getAdditionalInformation('3dActive'); - $success = $order->getPayment()->getAdditionalInformation('3dSuccess'); - } - - // check if 3D secure is active. If not just go to success page - if ($active && $success != true) { - $this->_adyenLogger->addAdyenResult("3D secure is active"); - - // check if it is already processed - if ($this->getRequest()->isPost()) { - $this->_adyenLogger->addAdyenResult("Process 3D secure payment"); - $requestMD = $this->getRequest()->getPost('MD'); - $requestPaRes = $this->getRequest()->getPost('PaRes'); - $md = $order->getPayment()->getAdditionalInformation('md'); - - if ($requestMD == $md) { - $order->getPayment()->setAdditionalInformation('paResponse', $requestPaRes); - - try { - $result = $this->_authorise3d($order->getPayment()); - $responseCode = $result['resultCode']; - } catch (\Exception $e) { - $this->_adyenLogger->addAdyenResult("Process 3D secure payment was refused with reason: " . $e->getMessage()); - $responseCode = 'Refused'; - } - - $this->_adyenLogger->addAdyenResult("Process 3D secure payment result is: " . $responseCode); - - // check if authorise3d was successful - if ($responseCode == 'Authorised') { - $order->addStatusHistoryComment(__('3D-secure validation was successful'))->save(); - - /** - * set back to false so when pressed back - * button on the success page it will reactivate 3D secure - */ - $order->getPayment()->setAdditionalInformation('3dActive', ''); - $order->getPayment()->setAdditionalInformation('3dSuccess', true); - - - if (!empty($result['additionalData']) && !$this->_adyenHelper->isCreditCardVaultEnabled()) { - $this->_adyenHelper->createAdyenBillingAgreement($order, $result['additionalData']); - } elseif (!empty($result['additionalData']) && - !empty($result['additionalData']['recurring.recurringDetailReference']) - ) { - try { - $additionalData = $result['additionalData']; - $token = $additionalData['recurring.recurringDetailReference']; - $expirationDate = $additionalData['expiryDate']; - $cardType = $additionalData['paymentMethod']; - $cardSummary = $additionalData['cardSummary']; - /** @var PaymentTokenInterface $paymentToken */ - $paymentToken = $this->paymentTokenFactory->create( - PaymentTokenFactoryInterface::TOKEN_TYPE_CREDIT_CARD - ); - $paymentToken->setGatewayToken($token); - $paymentToken->setExpiresAt($this->getExpirationDate($expirationDate)); - $details = [ - 'type' => $cardType, - 'maskedCC' => $cardSummary, - 'expirationDate' => $expirationDate - ]; - $paymentToken->setTokenDetails(json_encode($details)); - $extensionAttributes = $this->getExtensionAttributes($order->getPayment()); - $extensionAttributes->setVaultPaymentToken($paymentToken); - $orderPayment = $order->getPayment()->setExtensionAttributes($extensionAttributes); - $add = unserialize($orderPayment->getAdditionalData()); - $add['force_save'] = true; - $orderPayment->setAdditionalData(serialize($add)); - $this->orderPaymentResource->save($orderPayment); - } catch (\Exception $e) { - $this->_adyenLogger->error((string)$e->getMessage()); - } - } - - $this->_orderRepository->save($order); - - - $this->_redirect('checkout/onepage/success', ['_query' => ['utm_nooverride' => '1']]); - } else { - $order->addStatusHistoryComment(__('3D-secure validation was unsuccessful.'))->save(); - - // Move the order from PAYMENT_REVIEW to NEW, so that can be cancelled - $order->setState(\Magento\Sales\Model\Order::STATE_NEW); - $this->_adyenHelper->cancelOrder($order); - $this->messageManager->addErrorMessage("3D-secure validation was unsuccessful"); - - // reactivate the quote - $session = $this->_getCheckout(); - - // restore the quote - $session->restoreQuote(); - - $this->_redirect($this->_adyenHelper->getAdyenAbstractConfigData('return_path')); - } - } - } else { - $this->_adyenLogger->addAdyenResult("Customer was redirected to bank for 3D-secure validation."); - $order->addStatusHistoryComment( - __('Customer was redirected to bank for 3D-secure validation. Once the shopper authenticated, the order status will be updated accordingly. -
Make sure that your notifications are being processed! -
If the order is stuck on this status, the shopper abandoned the session. The payment can be seen as unsuccessful. -
The order can be automatically cancelled based on the OFFER_CLOSED notification. Please contact Adyen Support to enable this.') - )->save(); - $this->_view->loadLayout(); - $this->_view->getLayout()->initMessages(); - $this->_view->renderLayout(); - } - } else { - $this->_redirect('checkout/onepage/success', ['_query' => ['utm_nooverride' => '1']]); - } - } - - /** - * Called by validate3d controller when cc payment has 3D secure - * - * @param $payment - * @return mixed - * @throws \Exception - */ - protected function _authorise3d($payment) - { - try { - $response = $this->_paymentRequest->authorise3d($payment); - } catch (\Exception $e) { - throw $e; - } - return $response; - } - - /** - * 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'); - } - - /** - * Get payment extension attributes - * @param InfoInterface $payment - * @return OrderPaymentExtensionInterface - */ - private function getExtensionAttributes(InfoInterface $payment) - { - $extensionAttributes = $payment->getExtensionAttributes(); - if (null === $extensionAttributes) { - $extensionAttributes = $this->paymentExtensionFactory->create(); - $payment->setExtensionAttributes($extensionAttributes); - } - return $extensionAttributes; - } - - /** - * @param $expirationDate - * @return string - */ - private function getExpirationDate($expirationDate) - { - $expirationDate = explode('/', $expirationDate); - //add leading zero to month - $month = sprintf("%02d", $expirationDate[0]); - $expDate = new \DateTime( - $expirationDate[1] - . '-' - . $month - . '-' - . '01' - . ' ' - . '00:00:00', - new \DateTimeZone('UTC') - ); - // add one month - $expDate->add(new \DateInterval('P1M')); - return $expDate->format('Y-m-d 00:00:00'); - } -} diff --git a/Gateway/Command/HppCommand.php b/Gateway/Command/HppCommand.php deleted file mode 100644 index 1e8d75af1..000000000 --- a/Gateway/Command/HppCommand.php +++ /dev/null @@ -1,83 +0,0 @@ - - */ - -namespace Adyen\Payment\Gateway\Command; - -use Magento\Payment\Gateway\Command; -use Magento\Payment\Gateway\CommandInterface; - -class HppCommand implements CommandInterface -{ - - /** - * @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 - * @return $this - */ - public function execute(array $commandSubject) - { - $payment =\Magento\Payment\Gateway\Helper\SubjectReader::readPayment($commandSubject); - $stateObject = \Magento\Payment\Gateway\Helper\SubjectReader::readStateObject($commandSubject); - - // do not send email - $payment = $payment->getPayment(); - $order = $payment->getOrder(); - $order->setCanSendNewEmailFlag(false); - - - // update customer based on additionalFields - if ($payment->getAdditionalInformation("gender")) { - $order->setCustomerGender(\Adyen\Payment\Model\Gender::getMagentoGenderFromAdyenGender( - $payment->getAdditionalInformation("gender") - )); - } - - if ($payment->getAdditionalInformation("dob")) { - $order->setCustomerDob($payment->getAdditionalInformation("dob")); - } - - if ($payment->getAdditionalInformation("telephone")) { - $order->getBillingAddress()->setTelephone($payment->getAdditionalInformation("telephone")); - } - - // update status and state - $stateObject->setState(\Magento\Sales\Model\Order::STATE_NEW); - $stateObject->setStatus($this->_adyenHelper->getAdyenAbstractConfigData('order_status')); - $stateObject->setIsNotified(false); - - return $this; - } -} diff --git a/Gateway/Request/AddressDataBuilder.php b/Gateway/Request/AddressDataBuilder.php index 51151110e..65040baf2 100644 --- a/Gateway/Request/AddressDataBuilder.php +++ b/Gateway/Request/AddressDataBuilder.php @@ -40,7 +40,9 @@ class AddressDataBuilder implements BuilderInterface * * @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; } @@ -56,12 +58,14 @@ public function build(array $buildSubject) /** @var \Magento\Payment\Gateway\Data\PaymentDataObject $paymentDataObject */ $paymentDataObject = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($buildSubject); $order = $paymentDataObject->getOrder(); + $billingAddress = $order->getBillingAddress(); $result = []; - $billingAddress = $order->getBillingAddress(); if ($billingAddress) { - $requestBilling = ["street" => "N/A", + + $requestBilling = [ + "street" => "N/A", "postalCode" => '', "city" => "N/A", "houseNumberOrName" => '', @@ -69,9 +73,12 @@ public function build(array $buildSubject) "country" => "ZZ" ]; - if ($billingAddress->getStreetLine1()) { - $requestBilling["street"] = $billingAddress->getStreetLine1(); - } + $address = $this->adyenHelper->getStreetFromString($billingAddress->getStreetLine1()); + + if ($address) { + $requestBilling["street"] = $address["name"]; + $requestBilling["houseNumberOrName"] = $address["house_number"]; + } if ($billingAddress->getPostcode()) { $requestBilling["postalCode"] = $billingAddress->getPostcode(); @@ -93,16 +100,31 @@ public function build(array $buildSubject) } $shippingAddress = $order->getShippingAddress(); + if ($shippingAddress) { - // filter housenumber from streetLine1 - $requestDelivery = ["street" => $shippingAddress->getStreetLine1(), - "postalCode" => $shippingAddress->getPostcode(), - "city" => $shippingAddress->getCity(), - "houseNumberOrName" => '', - "stateOrProvince" => $shippingAddress->getRegionCode(), - "country" => $shippingAddress->getCountryId() - ]; + $address = $this->adyenHelper->getStreetFromString($shippingAddress->getStreetLine1()); + + if ($address) { + $requestDelivery["street"] = $address["name"]; + $requestDelivery["houseNumberOrName"] = $address["house_number"]; + } + + if ($shippingAddress->getPostcode()) { + $requestDelivery["postalCode"] = $shippingAddress->getPostcode(); + } + + if ($shippingAddress->getCity()) { + $requestDelivery["city"] = $shippingAddress->getCity(); + } + + if ($shippingAddress->getRegionCode()) { + $requestDelivery["stateOrProvince"] = $shippingAddress->getRegionCode(); + } + + if ($shippingAddress->getCountryId()) { + $requestDelivery["country"] = $shippingAddress->getCountryId(); + } $result['deliveryAddress'] = $requestDelivery; } diff --git a/Gateway/Request/ApplePayAuthorizationDataBuilder.php b/Gateway/Request/ApplePayAuthorizationDataBuilder.php index 49a78c1a1..e0134ecc0 100644 --- a/Gateway/Request/ApplePayAuthorizationDataBuilder.php +++ b/Gateway/Request/ApplePayAuthorizationDataBuilder.php @@ -60,13 +60,15 @@ public function build(array $buildSubject) $payment = $paymentDataObject->getPayment(); $token = $payment->getAdditionalInformation('token'); + $request['paymentMethod']['type'] = 'applepay'; + // get payment data if ($token) { $parsedToken = json_decode($token); $paymentData = $parsedToken->token->paymentData; try { $paymentData = base64_encode(json_encode($paymentData)); - $request['additionalData']['payment.token'] = $paymentData; + $request['paymentMethod']['applepay.token'] = $paymentData; } catch (\Exception $exception) { $this->_adyenLogger->addAdyenDebug("exception: " . $exception->getMessage()); } diff --git a/Gateway/Request/BoletoAuthorizationDataBuilder.php b/Gateway/Request/BoletoAuthorizationDataBuilder.php deleted file mode 100644 index 44773122c..000000000 --- a/Gateway/Request/BoletoAuthorizationDataBuilder.php +++ /dev/null @@ -1,98 +0,0 @@ - - */ - -namespace Adyen\Payment\Gateway\Request; - -use Magento\Payment\Gateway\Request\BuilderInterface; - -class BoletoAuthorizationDataBuilder implements BuilderInterface -{ - - /** - * @var \Adyen\Payment\Helper\Data - */ - private $adyenHelper; - - /** - * CaptureDataBuilder constructor. - * - * @param \Adyen\Payment\Helper\Data $adyenHelper - */ - public function __construct( - \Adyen\Payment\Helper\Data $adyenHelper - ) { - $this->adyenHelper = $adyenHelper; - } - - /** - * @param array $buildSubject - * @return mixed - */ - public function build(array $buildSubject) - { - /** @var \Magento\Payment\Gateway\Data\PaymentDataObject $paymentDataObject */ - /** @var \Magento\Payment\Gateway\Data\PaymentDataObject $paymentDataObject */ - $paymentDataObject = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($buildSubject); - $payment = $paymentDataObject->getPayment(); - $order = $paymentDataObject->getOrder(); - $storeId = $order->getStoreId(); - - $request = []; - - $request['socialSecurityNumber'] = $payment->getAdditionalInformation("social_security_number"); - - $boletoTypes = $this->adyenHelper->getAdyenBoletoConfigData('boletotypes'); - $boletoTypes = explode(',', $boletoTypes); - - if (count($boletoTypes) == 1) { - $request['selectedBrand'] = $boletoTypes[0]; - } else { - $request['selectedBrand'] = $payment->getAdditionalInformation("boleto_type"); - } - - $shopperName = [ - 'firstName' => $payment->getAdditionalInformation("firstname"), - 'lastName' => $payment->getAdditionalInformation("lastname"), - ]; - $request['shopperName'] = $shopperName; - - - $deliveryDays = (int)$this->adyenHelper->getAdyenBoletoConfigData("delivery_days", $storeId); - $deliveryDays = (!empty($deliveryDays)) ? $deliveryDays : 5; - $deliveryDate = date( - "Y-m-d\TH:i:s ", - mktime( - date("H"), - date("i"), - date("s"), - date("m"), - date("j") + $deliveryDays, - date("Y") - ) - ); - - $request['deliveryDate'] = $deliveryDate; - - return $request; - } -} diff --git a/Gateway/Request/CheckoutDataBuilder.php b/Gateway/Request/CheckoutDataBuilder.php new file mode 100644 index 000000000..c0d92bcee --- /dev/null +++ b/Gateway/Request/CheckoutDataBuilder.php @@ -0,0 +1,287 @@ + + */ + +namespace Adyen\Payment\Gateway\Request; + +use Magento\Payment\Gateway\Request\BuilderInterface; +use Adyen\Payment\Observer\AdyenHppDataAssignObserver; +use Adyen\Payment\Observer\AdyenBoletoDataAssignObserver; + +class CheckoutDataBuilder implements BuilderInterface +{ + /** + * @var \Adyen\Payment\Helper\Data + */ + private $adyenHelper; + + /** + * @var \Magento\Store\Model\StoreManagerInterface + */ + private $storeManager; + + /** + * @var \Magento\Checkout\Model\Session + */ + private $checkoutSession; + + /** + * @var \Magento\Quote\Model\Quote + */ + private $quote; + + /** + * @var \Magento\Tax\Model\Config + */ + protected $taxConfig; + + /** + * CheckoutDataBuilder constructor. + * @param \Adyen\Payment\Helper\Data $adyenHelper + * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @param \Magento\Checkout\Model\Session $checkoutSession + * @param \Magento\Tax\Model\Config $taxConfig + */ + public function __construct( + \Adyen\Payment\Helper\Data $adyenHelper, + \Magento\Store\Model\StoreManagerInterface $storeManager, + \Magento\Checkout\Model\Session $checkoutSession, + \Magento\Tax\Model\Config $taxConfig + ) + { + $this->adyenHelper = $adyenHelper; + $this->storeManager = $storeManager; + $this->checkoutSession = $checkoutSession; + $this->quote = $checkoutSession->getQuote(); + $this->taxConfig = $taxConfig; + } + + /** + * @param array $buildSubject + * @return mixed + */ + public function build(array $buildSubject) + { + /** @var \Magento\Payment\Gateway\Data\PaymentDataObject $paymentDataObject */ + $paymentDataObject =\Magento\Payment\Gateway\Helper\SubjectReader::readPayment($buildSubject); + $payment = $paymentDataObject->getPayment(); + $order = $payment->getOrder(); + $storeId = $order->getStoreId(); + $request = []; + + // do not send email + $order->setCanSendNewEmailFlag(false); + + $request['paymentMethod']['type'] = $payment->getAdditionalInformation(AdyenHppDataAssignObserver::BRAND_CODE); + + // Additional data for payment methods with issuer list + if ($payment->getAdditionalInformation(AdyenHppDataAssignObserver::ISSUER_ID)) { + $request['paymentMethod']['issuer'] = $payment->getAdditionalInformation(AdyenHppDataAssignObserver::ISSUER_ID); + } + + $request['returnUrl'] = $this->storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_LINK) . 'adyen/process/result'; + + // Additional data for ACH + if ($payment->getAdditionalInformation("bankAccountNumber")) { + $request['bankAccount']['bankAccountNumber'] = $payment->getAdditionalInformation("bankAccountNumber"); + } + + if ($payment->getAdditionalInformation("bankLocationId")) { + $request['bankAccount']['bankLocationId'] = $payment->getAdditionalInformation("bankLocationId"); + } + + if ($payment->getAdditionalInformation("bankAccountOwnerName")) { + $request['bankAccount']['ownerName'] = $payment->getAdditionalInformation("bankAccountOwnerName"); + } + + // Additional data for open invoice payment + if ($payment->getAdditionalInformation("gender")) { + $order->setCustomerGender(\Adyen\Payment\Model\Gender::getMagentoGenderFromAdyenGender( + $payment->getAdditionalInformation("gender")) + ); + $request['paymentMethod']['personalDetails']['gender'] = $payment->getAdditionalInformation("gender"); + } + + if ($payment->getAdditionalInformation("dob")) { + $order->setCustomerDob($payment->getAdditionalInformation("dob")); + + $request['paymentMethod']['personalDetails']['dateOfBirth']= $this->adyenHelper->formatDate($payment->getAdditionalInformation("dob"), 'Y-m-d') ; + } + + if ($payment->getAdditionalInformation("telephone")) { + $order->getBillingAddress()->setTelephone($payment->getAdditionalInformation("telephone")); + $request['paymentMethod']['personalDetails']['telephoneNumber']= $payment->getAdditionalInformation("telephone"); + } + + if ($payment->getAdditionalInformation("ssn")) { + $request['paymentMethod']['personalDetails']['socialSecurityNumber']= $payment->getAdditionalInformation("ssn"); + } + + // Additional data for sepa direct debit + if ($payment->getAdditionalInformation("ownerName")) { + $request['paymentMethod']['sepa.ownerName'] = $payment->getAdditionalInformation("ownerName"); + } + + if ($payment->getAdditionalInformation("ibanNumber")) { + $request['paymentMethod']['sepa.ibanNumber'] = $payment->getAdditionalInformation("ibanNumber"); + } + + if ($this->adyenHelper->isPaymentMethodOpenInvoiceMethod( + $payment->getAdditionalInformation(AdyenHppDataAssignObserver::BRAND_CODE) + ) || $this->adyenHelper->isPaymentMethodAfterpayTouchMethod( + $payment->getAdditionalInformation(AdyenHppDataAssignObserver::BRAND_CODE) + ) || $this->adyenHelper->isPaymentMethodOneyMethod( + $payment->getAdditionalInformation(AdyenHppDataAssignObserver::BRAND_CODE) + ) + ) { + $openInvoiceFields = $this->getOpenInvoiceData($order); + $request = array_merge($request, $openInvoiceFields); + } + + //Boleto data + if ($payment->getAdditionalInformation("social_security_number")) { + $request['socialSecurityNumber'] = $payment->getAdditionalInformation("social_security_number"); + } + + if ($payment->getAdditionalInformation("firstname")) { + $request['shopperName']['firstName'] = $payment->getAdditionalInformation("firstname"); + } + + if ($payment->getAdditionalInformation("lastName")) { + $request['shopperName']['lastName'] = $payment->getAdditionalInformation("lastName"); + } + + if ($payment->getMethod() == \Adyen\Payment\Model\Ui\AdyenBoletoConfigProvider::CODE) { + $boletoTypes = $this->adyenHelper->getAdyenBoletoConfigData('boletotypes'); + $boletoTypes = explode(',', $boletoTypes); + + if (count($boletoTypes) == 1) { + $request['selectedBrand'] = $boletoTypes[0]; + $request['paymentMethod']['type'] = $boletoTypes[0]; + } else { + $request['selectedBrand'] = $payment->getAdditionalInformation("boleto_type"); + $request['paymentMethod']['type'] = $payment->getAdditionalInformation("boleto_type"); + } + + $deliveryDays = (int)$this->adyenHelper->getAdyenBoletoConfigData("delivery_days", $storeId); + $deliveryDays = (!empty($deliveryDays)) ? $deliveryDays : 5; + $deliveryDate = date( + "Y-m-d\TH:i:s ", + mktime( + date("H"), + date("i"), + date("s"), + date("m"), + date("j") + $deliveryDays, + date("Y") + ) + ); + + $request['deliveryDate'] = $deliveryDate; + + $order->setCanSendNewEmailFlag(true); + } + return $request; + } + + /** + * @param $formFields + * @return mixed + */ + protected function getOpenInvoiceData($order) + { + $formFields = [ + 'lineItems' => [] + ]; + + $currency = $this->quote->getCurrency(); + + $discountAmount = 0; + + foreach ($this->quote->getAllVisibleItems() as $item) { + + $numberOfItems = (int)$item->getQtyOrdered(); + + // Summarize the discount amount item by item + $discountAmount += $item->getDiscountAmount(); + + $priceExcludingTax = $item->getPriceInclTax() - $item->getTaxAmount(); + $formattedPriceExcludingTax = $this->adyenHelper->formatAmount($priceExcludingTax, $currency); + + $formattedTaxAmount = $this->adyenHelper->formatAmount($item->getTaxAmount(), $currency); + + $formFields['lineItems'][] = [ + 'id' => $item->getId(), + 'itemId' => $item->getId(), + 'amountExcludingTax' => $formattedPriceExcludingTax, + 'taxAmount' => $formattedTaxAmount, + 'description' => $item->getName(), + 'quantity' => $item->getQty(), + 'taxCategory' => $item->getProduct()->getAttributeText('tax_class_id'), + 'taxPercentage' => $item->getTaxPercent() + ]; + } + + // Discount cost + if ($discountAmount != 0) { + + $description = __('Total Discount'); + $itemAmount = $this->adyenHelper->formatAmount($discountAmount, $currency); + $itemVatAmount = "0"; + $itemVatPercentage = "0"; + $numberOfItems = 1; + + $formFields['lineItems'][] = [ + 'itemId' => 'totalDiscount', + 'amountExcludingTax' => $itemAmount, + 'taxAmount' => $itemVatAmount, + 'description' => $description, + 'quantity' => $numberOfItems, + 'taxCategory' => 'None', + 'taxPercentage' => $itemVatPercentage + ]; + } + + // Shipping cost + if ($this->quote->getShippingAddress()->getShippingAmount() > 0 || $this->quote->getShippingAddress()->getShippingTaxAmount() > 0) { + + $priceExcludingTax = $this->quote->getShippingAddress()->getShippingAmount() - $this->quote->getShippingAddress()->getShippingTaxAmount(); + + $formattedTaxAmount = $this->adyenHelper->formatAmount($this->quote->getShippingAddress()->getShippingTaxAmount(), $currency); + + $formattedPriceExcludingTax = $this->adyenHelper->formatAmount($priceExcludingTax, $currency); + + $taxClassId = $this->taxConfig->getShippingTaxClass($this->storeManager->getStore()->getId()); + + $formFields['lineItems'][] = [ + 'itemId' => 'shippingCost', + 'amountExcludingTax' => $formattedPriceExcludingTax, + 'taxAmount' => $formattedTaxAmount, + 'description' => $order->getShippingDescription(), + 'quantity' => 1, + 'taxPercentage' => $this->quote->getShippingAddress()->getShippingTaxAmount() + ]; + } + + return $formFields; + } +} diff --git a/Gateway/Request/CustomerDataBuilder.php b/Gateway/Request/CustomerDataBuilder.php index 5aed3ba0c..449ba539b 100644 --- a/Gateway/Request/CustomerDataBuilder.php +++ b/Gateway/Request/CustomerDataBuilder.php @@ -23,14 +23,31 @@ namespace Adyen\Payment\Gateway\Request; use Magento\Payment\Gateway\Request\BuilderInterface; +use Adyen\Payment\Observer\AdyenHppDataAssignObserver; /** * Class CustomerDataBuilder */ class CustomerDataBuilder implements BuilderInterface { + /** + * @var \Adyen\Payment\Helper\Data + */ + private $adyenHelper; - /** + /** + * CustomerDataBuilder constructor. + * + * @param \Adyen\Payment\Helper\Data $adyenHelper + */ + public function __construct( + \Adyen\Payment\Helper\Data $adyenHelper + ) + { + $this->adyenHelper = $adyenHelper; + } + + /** * Add shopper data into request * * @param array $buildSubject @@ -43,6 +60,7 @@ public function build(array $buildSubject) /** @var \Magento\Payment\Gateway\Data\PaymentDataObject $paymentDataObject */ $paymentDataObject = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($buildSubject); $order = $paymentDataObject->getOrder(); + $payment = $paymentDataObject->getPayment(); $customerId = $order->getCustomerId(); if ($customerId > 0) { @@ -52,14 +70,46 @@ public function build(array $buildSubject) $billingAddress = $order->getBillingAddress(); if (!empty($billingAddress)) { - $customerEmail = $billingAddress->getEmail(); - if ($customerEmail) { - $result['shopperEmail'] = $customerEmail; + if ($this->adyenHelper->isPaymentMethodOpenInvoiceMethod( + $payment->getAdditionalInformation(AdyenHppDataAssignObserver::BRAND_CODE) + ) && !$this->adyenHelper->isPaymentMethodAfterpayTouchMethod( + $payment->getAdditionalInformation(AdyenHppDataAssignObserver::BRAND_CODE) + )) { + if ($customerEmail = $billingAddress->getEmail()) { + $result['paymentMethod']['personalDetails']['shopperEmail'] = $customerEmail; + } + + if ($customerTelephone = trim($billingAddress->getTelephone())) { + $result['paymentMethod']['personalDetails']['telephoneNumber'] = $customerTelephone; + } + + if ($firstName = $billingAddress->getFirstname()) { + $result['paymentMethod']['personalDetails']['firstName'] = $firstName; + } + + if ($lastName = $billingAddress->getLastname()) { + $result['paymentMethod']['personalDetails']['lastName'] = $lastName; + } + } else { + if ($customerEmail = $billingAddress->getEmail()) { + $result['shopperEmail'] = $customerEmail; + } + + if ($customerTelephone = trim($billingAddress->getTelephone())) { + $result['telephoneNumber'] = $customerTelephone; + } + + if ($firstName = $billingAddress->getFirstname()) { + $result['shopperName']['firstName'] = $firstName; + } + + if ($lastName = $billingAddress->getLastname()) { + $result['shopperName']['lastName'] = $lastName; + } } - $customerTelephone = trim($billingAddress->getTelephone()); - if ($customerTelephone) { - $result['telephoneNumber'] = $customerTelephone; + if ($countryId = $billingAddress->getCountryId()) { + $result['countryCode'] = $countryId; } } diff --git a/Gateway/Request/SepaAuthorizationDataBuilder.php b/Gateway/Request/SepaAuthorizationDataBuilder.php deleted file mode 100644 index 42caa5bf2..000000000 --- a/Gateway/Request/SepaAuthorizationDataBuilder.php +++ /dev/null @@ -1,49 +0,0 @@ - - */ - -namespace Adyen\Payment\Gateway\Request; - -use Magento\Payment\Gateway\Request\BuilderInterface; - -class SepaAuthorizationDataBuilder implements BuilderInterface -{ - /** - * @param array $buildSubject - * @return mixed - */ - public function build(array $buildSubject) - { - /** @var \Magento\Payment\Gateway\Data\PaymentDataObject $paymentDataObject */ - $paymentDataObject = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($buildSubject); - $payment = $paymentDataObject->getPayment(); - $request = []; - - // add bankDetails into request - $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; - } -} diff --git a/Gateway/Response/CheckoutPaymentsDetailsHandler.php b/Gateway/Response/CheckoutPaymentsDetailsHandler.php index 3d20c0ca6..d34dd3855 100644 --- a/Gateway/Response/CheckoutPaymentsDetailsHandler.php +++ b/Gateway/Response/CheckoutPaymentsDetailsHandler.php @@ -33,6 +33,7 @@ class CheckoutPaymentsDetailsHandler implements HandlerInterface */ protected $adyenHelper; + public function __construct( \Adyen\Payment\Helper\Data $adyenHelper ) { @@ -40,6 +41,8 @@ public function __construct( } /** + * This is being used for all checkout methods (adyen hpp payment method) + * * @param array $handlingSubject * @param array $response */ @@ -69,7 +72,6 @@ public function handle(array $handlingSubject, array $response) !$this->adyenHelper->isCreditCardVaultEnabled() ) { $order = $payment->getOrder(); - $this->adyenHelper->createAdyenBillingAgreement($order, $response['additionalData']); } diff --git a/Gateway/Validator/CheckoutResponseValidator.php b/Gateway/Validator/CheckoutResponseValidator.php index c11eb0e34..8687f8568 100644 --- a/Gateway/Validator/CheckoutResponseValidator.php +++ b/Gateway/Validator/CheckoutResponseValidator.php @@ -27,107 +27,167 @@ 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); - } + /** + * @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": + case "Received": + // For banktransfers store all bankTransfer details + if (!empty($response['additionalData']['bankTransfer.owner'])) { + foreach ($response['additionalData'] as $key => $value) { + if (strpos($key, 'bankTransfer') === 0) { + $payment->setAdditionalInformation($key, $value); + } + } + } elseif (!empty($response['additionalData']['comprafacil.entity'])) { + foreach ($response['additionalData'] as $key => $value) { + if (strpos($key, 'comprafacil') === 0) { + $payment->setAdditionalInformation($key, $value); + } + } + } + + $payment->setAdditionalInformation('pspReference', $response['pspReference']); + break; + case "PresentToShopper": + $payment->setAdditionalInformation('pspReference', $response['pspReference']); + // set additionalData + if (isset($response['outputDetails']) && is_array($response['outputDetails'])) { + + $outputDetails = $response['outputDetails']; + if (isset($outputDetails['boletobancario.dueDate'])) { + $payment->setAdditionalInformation( + 'dueDate', + $outputDetails['boletobancario.dueDate'] + ); + } + + if (isset($outputDetails['boletobancario.expirationDate'])) { + $payment->setAdditionalInformation( + 'expirationDate', + $outputDetails['boletobancario.expirationDate'] + ); + } + + if (isset($outputDetails['boletobancario.url'])) { + $payment->setAdditionalInformation( + 'url', + $outputDetails['boletobancario.url'] + ); + } + } + break; + case "RedirectShopper": + + $redirectUrl = null; + $paymentData = null; + + if (!empty($response['redirect']['url'])) { + $redirectUrl = $response['redirect']['url']; + } + + if (!empty($response['redirect']['method'])) { + $redirectMethod = $response['redirect']['method']; + } + + if (!empty($response['paymentData'])) { + $paymentData = $response['paymentData']; + } + + // If the redirect data is there then the payment is a card payment with 3d secure + if (isset($response['redirect']['data']['PaReq']) && isset($response['redirect']['data']['MD'])) { + + $paReq = null; + $md = null; + + $payment->setAdditionalInformation('3dActive', true); + + if (!empty($response['redirect']['data']['PaReq'])) { + $paReq = $response['redirect']['data']['PaReq']; + } + + if (!empty($response['redirect']['data']['MD'])) { + $md = $response['redirect']['data']['MD']; + } + + if ($paReq && $md && $redirectUrl && $paymentData && $redirectMethod) { + $payment->setAdditionalInformation('redirectUrl', $redirectUrl); + $payment->setAdditionalInformation('redirectMethod', $redirectMethod); + $payment->setAdditionalInformation('paRequest', $paReq); + $payment->setAdditionalInformation('md', $md); + $payment->setAdditionalInformation('paymentData', $paymentData); + } else { + $isValid = false; + $errorMsg = __('3D secure is not valid.'); + $this->adyenLogger->error($errorMsg); + $errorMessages[] = $errorMsg; + } + // otherwise it is an alternative payment method which only requires the redirect url to be present + } else { + // Flag to show we are in the checkoutAPM flow + $payment->setAdditionalInformation('checkoutAPM', true); + + if ($redirectUrl && $paymentData && $redirectMethod) { + $payment->setAdditionalInformation('redirectUrl', $redirectUrl); + $payment->setAdditionalInformation('redirectMethod', $redirectMethod); + $payment->setAdditionalInformation('paymentData', $paymentData); + } else { + $isValid = false; + $errorMsg = __('Payment method 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); + } } diff --git a/Gateway/Validator/GeneralResponseValidator.php b/Gateway/Validator/GeneralResponseValidator.php index 33ff06eb5..36ea3d9d2 100644 --- a/Gateway/Validator/GeneralResponseValidator.php +++ b/Gateway/Validator/GeneralResponseValidator.php @@ -97,12 +97,12 @@ public function validate(array $validationSubject) $payment->setAdditionalInformation('3dActive', true); $payment->setAdditionalInformation('pspReference', $response['pspReference']); - $issuerUrl = $response['issuerUrl']; + $redirectUrl = $response['issuerUrl']; $paReq = $response['paRequest']; $md = $response['md']; - if (!empty($paReq) && !empty($md) && !empty($issuerUrl)) { - $payment->setAdditionalInformation('issuerUrl', $response['issuerUrl']); + if (!empty($paReq) && !empty($md) && !empty($redirectUrl)) { + $payment->setAdditionalInformation('redirectUrl', $redirectUrl); $payment->setAdditionalInformation('paRequest', $response['paRequest']); $payment->setAdditionalInformation('md', $response['md']); } else { diff --git a/Gateway/Validator/SepaValidator.php b/Gateway/Validator/SepaValidator.php deleted file mode 100644 index dff86938e..000000000 --- a/Gateway/Validator/SepaValidator.php +++ /dev/null @@ -1,112 +0,0 @@ - - */ - -namespace Adyen\Payment\Gateway\Validator; - -use Magento\Payment\Gateway\Validator\AbstractValidator; -use Magento\Payment\Gateway\Validator\ResultInterfaceFactory; - -/** - * Class SepaValidator - * @package Adyen\Payment\Gateway\Validator - */ -class SepaValidator extends AbstractValidator -{ - /** - * @param array $validationSubject - * @return \Magento\Payment\Gateway\Validator\ResultInterface - */ - public function validate(array $validationSubject) - { - $isValid = true; - $fails = []; - $payment = $validationSubject['payment']; - $iban = $payment->getAdditionalInformation('iban'); - - if (empty($iban) || !$this->validateIban($iban)) { - $isValid = false; - $fails[] = __('Invalid Iban number.'); - } - - return $this->createResult($isValid, $fails); - } - - /** - * @param $iban - * @return bool - */ - public function validateIban($iban) - { - $iban = strtolower(str_replace(' ', '', $iban)); - - $countries = ['al'=>28,'ad'=>24,'at'=>20,'az'=>28,'bh'=>22,'be'=>16,'ba'=>20,'br'=>29,'bg'=>22,'cr'=>21, - 'hr'=>21,'cy'=>28,'cz'=>24,'dk'=>18,'do'=>28,'ee'=>20,'fo'=>18,'fi'=>18,'fr'=>27,'ge'=>22, - 'de'=>22,'gi'=>23,'gr'=>27,'gl'=>18,'gt'=>28,'hu'=>28,'is'=>26,'ie'=>22,'il'=>23,'it'=>27, - 'jo'=>30,'kz'=>20,'kw'=>30,'lv'=>21,'lb'=>28,'li'=>21,'lt'=>20,'lu'=>20,'mk'=>19,'mt'=>31, - 'mr'=>27,'mu'=>30,'mc'=>27,'md'=>24, 'me'=>22,'nl'=>18,'no'=>15,'pk'=>24,'ps'=>29,'pl'=>28, - 'pt'=>25,'qa'=>29,'ro'=>24, 'sm'=>27,'sa'=>24,'rs'=>22,'sk'=>24,'si'=>19,'es'=>24,'se'=>24, - 'ch'=>21,'tn'=>24,'tr'=>26,'ae'=>23,'gb'=>22,'vg'=>24]; - - $chars = ['a'=>10,'b'=>11,'c'=>12,'d'=>13,'e'=>14,'f'=>15,'g'=>16,'h'=>17,'i'=>18,'j'=>19,'k'=>20,'l'=>21, - 'm'=>22,'n'=>23,'o'=>24,'p'=>25,'q'=>26,'r'=>27,'s'=>28,'t'=>29,'u'=>30,'v'=>31,'w'=>32,'x'=>33, - 'y'=>34,'z'=>35]; - - - if (isset($countries[substr($iban, 0, 2)]) && - strlen($iban) == $countries[substr($iban, 0, 2)]) { - $movedChar = substr($iban, 4).substr($iban, 0, 4); - $movedCharArray = str_split($movedChar); - $newString = ""; - - foreach ($movedCharArray as $key => $value) { - if (!is_numeric($movedCharArray[$key])) { - $movedCharArray[$key] = $chars[$movedCharArray[$key]]; - } - $newString .= $movedCharArray[$key]; - } - - if (function_exists("bcmod")) { - return bcmod($newString, '97') == 1; - } - - /** - * if server does not support bcmoc then do this manually: - * http://au2.php.net/manual/en/function.bcmod.php#38474 - */ - $x = $newString; - $y = "97"; - $take = 5; - $mod = ""; - - do { - $a = (int)$mod . substr($x, 0, $take); - $x = substr($x, $take); - $mod = $a % $y; - } while (strlen($x)); - - return (int)$mod == 1; - } else { - return false; - } - } -} diff --git a/Helper/Data.php b/Helper/Data.php index 5993d98a7..e2db382e2 100755 --- a/Helper/Data.php +++ b/Helper/Data.php @@ -35,8 +35,8 @@ class Data extends AbstractHelper 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'; + const CHECKOUT_COMPONENT_JS_LIVE = 'https://checkoutshopper-live.adyen.com/checkoutshopper/sdk/2.1.0/adyen.js'; + const CHECKOUT_COMPONENT_JS_TEST = 'https://checkoutshopper-test.adyen.com/checkoutshopper/sdk/2.1.0/adyen.js'; /** * @var \Magento\Framework\Encryption\EncryptorInterface @@ -202,7 +202,7 @@ public function getModes() } /** - * eturn recurring types for configuration setting + * return recurring types for configuration setting * @return array */ public function getCaptureModes() @@ -350,6 +350,20 @@ public function getStreet($address) return (['name' => trim($streetName), 'house_number' => $streetNr]); } + /** + * Street format + * @param string $streetLine + * @return array + */ + public function getStreetFromString($streetLine) + { + $street = self::formatStreet(array($streetLine)); + $streetName = $street['0']; + unset($street['0']); + $streetNr = implode(' ', $street); + return (['name' => trim($streetName), 'house_number' => $streetNr]); + } + /** * Fix this one string street + number * @example street + number @@ -769,65 +783,6 @@ public function getConfigData($field, $paymentMethodCode, $storeId, $flag = fals } } - - /** - * @return array - */ - public function getSepaCountries() - { - $sepaCountriesAllowed = [ - "AT", - "BE", - "BG", - "CH", - "CY", - "CZ", - "DE", - "DK", - "EE", - "ES", - "FI", - "FR", - "GB", - "GF", - "GI", - "GP", - "GR", - "HR", - "HU", - "IE", - "IS", - "IT", - "LI", - "LT", - "LU", - "LV", - "MC", - "MQ", - "MT", - "NL", - "NO", - "PL", - "PT", - "RE", - "RO", - "SE", - "SI", - "SK" - ]; - - $countryList = $this->_country->toOptionArray(); - $sepaCountries = []; - - foreach ($countryList as $key => $country) { - $value = $country['value']; - if (in_array($value, $sepaCountriesAllowed)) { - $sepaCountries[$value] = $country['label']; - } - } - return $sepaCountries; - } - /** * Get adyen magento module's name sent to Adyen * @@ -851,10 +806,6 @@ public function getModuleVersion() public function getBoletoTypes() { return [ - [ - 'value' => 'boletobancario_hsbc', - 'label' => __('boletobancario_hsbc'), - ], [ 'value' => 'boletobancario_itau', 'label' => __('boletobancario_itau'), @@ -864,13 +815,9 @@ public function getBoletoTypes() 'label' => __('boletobancario_santander'), ], [ - 'value' => 'boletobancario_bradesco', - 'label' => __('boletobancario_bradesco'), - ], - [ - 'value' => 'boletobancario_bancodobrasil', - 'label' => __('boletobancario_bancodobrasil'), - ], + 'value' => 'primeiropay_boleto', + 'label' => __('primeiropay_boleto'), + ] ]; } @@ -983,17 +930,29 @@ public function isPerStoreBillingAgreement($storeId) */ public function isPaymentMethodOpenInvoiceMethod($paymentMethod) { - if (strpos($paymentMethod, 'afterpay') !== false) { - return true; - } elseif (strpos($paymentMethod, 'klarna') !== false) { - return true; - } elseif (strpos($paymentMethod, 'ratepay') !== false) { + if (strpos($paymentMethod, 'afterpay') !== false || + strpos($paymentMethod, 'klarna') !== false || + strpos($paymentMethod, 'ratepay') !== false + ) { return true; } return false; } + /** + * @param $paymentMethod + * @return bool + */ + public function isPaymentMethodAfterpayTouchMethod($paymentMethod) + { + if (strpos($paymentMethod, 'afterpaytouch') !== false) { + return true; + } + + return false; + } + /** * @param $paymentMethod * @return bool @@ -1039,6 +998,40 @@ public function doesPaymentMethodSkipDetails($paymentMethod) /** * @return mixed */ + /** + * @param $paymentMethod + * @return bool + */ + public function isPaymentMethodBcmcMobileQRMethod($paymentMethod) + { + if (strpos($paymentMethod, 'bcmc_mobile_QR') !== false) { + return true; + } + + return false; + } + + /** + * The payment method for wechat should be only wechatweb until we support the others too. + * + * @param $paymentMethod + * @return bool + */ + public function isPaymentMethodWechatpayExceptWeb($paymentMethod) + { + if (strpos($paymentMethod, 'wechatpay') !== false) { + if (strpos($paymentMethod, 'wechatpayWeb') !== false) { + return false; + } + + return true; + } + + return false; + } + + + public function getRatePayId() { return $this->getAdyenHppConfigData("ratepay_id"); @@ -1060,6 +1053,18 @@ public function isVatCategoryHigh($paymentMethod) return false; } + /** + * @param $paymentMethod + * @return bool + */ + public function isPaymentMethodBoletoMethod($paymentMethod) + { + if (strpos($paymentMethod, 'boleto') !== false) { + return true; + } + return false; + } + /** * @return bool */ @@ -1223,7 +1228,7 @@ public function createOpenInvoiceLineShipping( $itemVatPercentage, $numberOfItems, $payment, - "shipping" + "shippingCost" ); } @@ -1663,4 +1668,37 @@ public function isSeparateHouseNumberRequired($country) return in_array(strtolower($country), $countryList); } + + /** + * @param $client + * @return \Adyen\Service\Checkout + */ + public function createAdyenCheckoutService($client) + { + return new \Adyen\Service\Checkout($client); + } + + /** + * @param $client + * @return \Adyen\Service\Recurring + * @throws \Adyen\AdyenException + */ + public function createAdyenRecurringService($client) + { + return new \Adyen\Service\Recurring($client); + } + + /** + * @param string $date + * @param string $format + * @return mixed + */ + public function formatDate($date = null, $format = 'Y-m-d H:i:s') + { + if (strlen($date) < 0) { + $date = date('d-m-Y H:i:s'); + } + $timeStamp = new \DateTime($date); + return $timeStamp->format($format); + } } diff --git a/Helper/PaymentMethods.php b/Helper/PaymentMethods.php index 199998c08..f117a1e83 100644 --- a/Helper/PaymentMethods.php +++ b/Helper/PaymentMethods.php @@ -33,68 +33,62 @@ class PaymentMethods extends AbstractHelper /** * @var \Magento\Quote\Api\CartRepositoryInterface */ - protected $_quoteRepository; - - /** - * @var \Magento\Quote\Model\QuoteIdMaskFactory - */ - protected $_quoteIdMaskFactory; + protected $quoteRepository; /** * @var \Magento\Framework\App\Config\ScopeConfigInterface $config */ - protected $_config; + protected $config; /** * @var \Adyen\Payment\Helper\Data */ - protected $_adyenHelper; + protected $adyenHelper; /** * @var \Magento\Checkout\Model\Session */ - protected $_session; + protected $session; /** * @var \Magento\Framework\Locale\ResolverInterface */ - protected $_localeResolver; + protected $localeResolver; /** * @var \Adyen\Payment\Logger\AdyenLogger */ - protected $_adyenLogger; + protected $adyenLogger; /** * @var Repository */ - protected $_assetRepo; + protected $assetRepo; /** * @var RequestInterface */ - protected $_request; + protected $request; /** * @var \Magento\Framework\View\Asset\Source */ - protected $_assetSource; + protected $assetSource; /** * @var \Magento\Framework\View\DesignInterface */ - protected $_design; + protected $design; /** * @var \Magento\Framework\View\Design\Theme\ThemeProviderInterface */ - protected $_themeProvider; + protected $themeProvider; /** * PaymentMethods constructor. * * @param \Magento\Quote\Api\CartRepositoryInterface $quoteRepository - * @param \Magento\Quote\Model\QuoteIdMaskFactory $quoteIdMaskFactory * @param \Magento\Framework\App\Config\ScopeConfigInterface $config * @param Data $adyenHelper * @param \Magento\Checkout\Model\Session $session @@ -108,7 +102,6 @@ class PaymentMethods extends AbstractHelper */ public function __construct( \Magento\Quote\Api\CartRepositoryInterface $quoteRepository, - \Magento\Quote\Model\QuoteIdMaskFactory $quoteIdMaskFactory, \Magento\Framework\App\Config\ScopeConfigInterface $config, \Adyen\Payment\Helper\Data $adyenHelper, \Magento\Checkout\Model\Session $session, @@ -120,18 +113,17 @@ public function __construct( \Magento\Framework\View\DesignInterface $design, \Magento\Framework\View\Design\Theme\ThemeProviderInterface $themeProvider ) { - $this->_quoteRepository = $quoteRepository; - $this->_quoteIdMaskFactory = $quoteIdMaskFactory; - $this->_config = $config; - $this->_adyenHelper = $adyenHelper; - $this->_session = $session; - $this->_localeResolver = $localeResolver; - $this->_adyenLogger = $adyenLogger; - $this->_assetRepo = $assetRepo; - $this->_request = $request; - $this->_assetSource = $assetSource; - $this->_design = $design; - $this->_themeProvider = $themeProvider; + $this->quoteRepository = $quoteRepository; + $this->config = $config; + $this->adyenHelper = $adyenHelper; + $this->session = $session; + $this->localeResolver = $localeResolver; + $this->adyenLogger = $adyenLogger; + $this->assetRepo = $assetRepo; + $this->request = $request; + $this->assetSource = $assetSource; + $this->design = $design; + $this->themeProvider = $themeProvider; } /** @@ -140,9 +132,10 @@ public function __construct( public function getPaymentMethods($quoteId, $country = null) { // get quote from quoteId - $quote = $this->_quoteRepository->getActive($quoteId); + $quote = $this->quoteRepository->getActive($quoteId); $store = $quote->getStore(); - $paymentMethods = $this->_addHppMethodsToConfig($store, $country); + + $paymentMethods = $this->addHppMethodsToConfig($store, $country); return $paymentMethods; } @@ -150,30 +143,27 @@ public function getPaymentMethods($quoteId, $country = null) * @param $store * @return array */ - protected function _addHppMethodsToConfig($store, $country) + protected function addHppMethodsToConfig($store, $country) { $paymentMethods = []; - $ccEnabled = $this->_config->getValue( + $ccEnabled = $this->config->getValue( 'payment/' . \Adyen\Payment\Model\Ui\AdyenCcConfigProvider::CODE . '/active', \Magento\Store\Model\ScopeInterface::SCOPE_STORES, $store->getCode() ); - $ccTypes = array_keys($this->_adyenHelper->getCcTypesAltData()); - $sepaEnabled = $this->_config->getValue( - 'payment/' . \Adyen\Payment\Model\Ui\AdyenSepaConfigProvider::CODE . '/active', - \Magento\Store\Model\ScopeInterface::SCOPE_STORES, - $store->getCode() - ); + $ccTypes = array_keys($this->adyenHelper->getCcTypesAltData()); - foreach ($this->_fetchHppMethods($store, $country) as $methodCode => $methodData) { + foreach ($this->fetchAlternativeMethods($store, $country) as $methodCode => $methodData) { /* - * skip payment methods if it is a creditcard that is enabled in adyen_cc - * or if payment is sepadirectdebit and SEPA api is enabled + * skip payment methods if it is a creditcard that is enabled in adyen_cc or a boleto method or wechat but + * not wechatpay */ - if ($ccEnabled && in_array($methodCode, $ccTypes)) { - continue; - } elseif ($methodCode == 'sepadirectdebit' && $sepaEnabled) { + if (($ccEnabled && in_array($methodCode, $ccTypes)) || + $this->adyenHelper->isPaymentMethodBoletoMethod($methodCode) || + $this->adyenHelper->isPaymentMethodBcmcMobileQRMethod($methodCode) || + $this->adyenHelper->isPaymentMethodWechatpayExceptWeb($methodCode) + ) { continue; } @@ -188,54 +178,63 @@ protected function _addHppMethodsToConfig($store, $country) * @param $country * @return array */ - protected function _fetchHppMethods($store, $country) + protected function fetchAlternativeMethods($store, $country) { - $skinCode = $this->_adyenHelper->getAdyenHppConfigData('skin_code'); - $merchantAccount = $this->_adyenHelper->getAdyenAbstractConfigData('merchant_account', $store->getId()); + $merchantAccount = $this->adyenHelper->getAdyenAbstractConfigData('merchant_account'); - if (!$skinCode || !$merchantAccount) { + if (!$merchantAccount) { return []; } $adyFields = [ - "paymentAmount" => (int)$this->_adyenHelper->formatAmount( - $this->_getCurrentPaymentAmount(), - $this->_getCurrentCurrencyCode($store) - ), - "currencyCode" => $this->_getCurrentCurrencyCode($store), - "merchantReference" => "Get Payment methods", - "skinCode" => $skinCode, + "channel" => "Web", "merchantAccount" => $merchantAccount, - "sessionValidity" => date( - DATE_ATOM, - mktime(date("H") + 1, date("i"), date("s"), date("m"), date("j"), date("Y")) - ), - "countryCode" => $this->_getCurrentCountryCode($store, $country), - "shopperLocale" => $this->_getCurrentLocaleCode($store) + "countryCode" => $this->getCurrentCountryCode($store, $country), + "amount" => [ + "currency" => $this->getCurrentCurrencyCode($store), + "value" => (int)$this->adyenHelper->formatAmount( + $this->getCurrentPaymentAmount(), + $this->getCurrentCurrencyCode($store) + ), + ], + "shopperReference" => $this->getCurrentShopperReference(), + "shopperLocale" => $this->getCurrentLocaleCode($store) ]; - $responseData = $this->_getDirectoryLookupResponse($adyFields, $store); + $billingAddress = $this->getQuote()->getBillingAddress(); + + if (!empty($billingAddress)) { + if ($customerTelephone = trim($billingAddress->getTelephone())) { + $adyFields['telephoneNumber'] = $customerTelephone; + } + } + + $responseData = $this->getPaymentMethodsResponse($adyFields, $store); $paymentMethods = []; if (isset($responseData['paymentMethods'])) { foreach ($responseData['paymentMethods'] as $paymentMethod) { - $paymentMethodCode = $paymentMethod['brandCode']; - $paymentMethod = $this->_fieldMapPaymentMethod($paymentMethod); + if ($paymentMethod['type'] == "scheme") { + continue; + } + + $paymentMethodCode = $paymentMethod['type']; + $paymentMethod = $this->fieldMapPaymentMethod($paymentMethod); // check if payment method is an openinvoice method $paymentMethod['isPaymentMethodOpenInvoiceMethod'] = - $this->_adyenHelper->isPaymentMethodOpenInvoiceMethod($paymentMethodCode); + $this->adyenHelper->isPaymentMethodOpenInvoiceMethod($paymentMethodCode); // add icon location in result - if ($this->_adyenHelper->showLogos()) { + if ($this->adyenHelper->showLogos()) { // Fix for MAGETWO-70402 https://github.com/magento/magento2/pull/7686 // Explicitly setting theme $themeCode = "Magento/blank"; - $themeId = $this->_design->getConfigurationDesignTheme(\Magento\Framework\App\Area::AREA_FRONTEND); + $themeId = $this->design->getConfigurationDesignTheme(\Magento\Framework\App\Area::AREA_FRONTEND); if (!empty($themeId)) { - $theme = $this->_themeProvider->getThemeById($themeId); + $theme = $this->themeProvider->getThemeById($themeId); if ($theme && !empty($theme->getCode())) { $themeCode = $theme->getCode(); } @@ -244,14 +243,14 @@ protected function _fetchHppMethods($store, $country) $params = []; $params = array_merge([ 'area' => \Magento\Framework\App\Area::AREA_FRONTEND, - '_secure' => $this->_request->isSecure(), + '_secure' => $this->request->isSecure(), 'theme' => $themeCode ], $params); - $asset = $this->_assetRepo->createAsset('Adyen_Payment::images/logos/' . + $asset = $this->assetRepo->createAsset('Adyen_Payment::images/logos/' . $paymentMethodCode . '.png', $params); - $placeholder = $this->_assetSource->findSource($asset); + $placeholder = $this->assetSource->findSource($asset); $icon = null; if ($placeholder) { @@ -274,9 +273,9 @@ protected function _fetchHppMethods($store, $country) /** * @return bool|int */ - protected function _getCurrentPaymentAmount() + protected function getCurrentPaymentAmount() { - if (($grandTotal = $this->_getQuote()->getGrandTotal()) > 0) { + if (($grandTotal = $this->getQuote()->getGrandTotal()) > 0) { return $grandTotal; } return 10; @@ -287,19 +286,19 @@ protected function _getCurrentPaymentAmount() * @param $store * @return mixed */ - protected function _getCurrentCurrencyCode($store) + protected function getCurrentCurrencyCode($store) { - return $this->_getQuote()->getQuoteCurrencyCode() ?: $store->getBaseCurrencyCode(); + return $this->getQuote()->getQuoteCurrencyCode() ?: $store->getBaseCurrencyCode(); } /** * @param $store * @return int|mixed|string */ - protected function _getCurrentCountryCode($store, $country) + protected function getCurrentCountryCode($store, $country) { // if fixed countryCode is setup in config use this - $countryCode = $this->_adyenHelper->getAdyenHppConfigData('country_code', $store->getId()); + $countryCode = $this->adyenHelper->getAdyenHppConfigData('country_code', $store->getId()); if ($countryCode != "") { return $countryCode; @@ -309,11 +308,11 @@ protected function _getCurrentCountryCode($store, $country) return $country; } - if ($country = $this->_getQuote()->getBillingAddress()->getCountry()) { + if ($country = $this->getQuote()->getBillingAddress()->getCountry()) { return $country; } - $defaultCountry = $this->_config->getValue( + $defaultCountry = $this->config->getValue( \Magento\Tax\Model\Config::CONFIG_XML_PATH_DEFAULT_COUNTRY, \Magento\Store\Model\ScopeInterface::SCOPE_STORES, $store->getCode() @@ -330,20 +329,20 @@ protected function _getCurrentCountryCode($store, $country) * @param $store * @return mixed|string */ - protected function _getCurrentLocaleCode($store) + protected function getCurrentLocaleCode($store) { - $localeCode = $this->_adyenHelper->getAdyenAbstractConfigData('shopper_locale', $store->getId()); + $localeCode = $this->adyenHelper->getAdyenAbstractConfigData('shopper_locale', $store->getId()); if ($localeCode != "") { return $localeCode; } - $locale = $this->_localeResolver->getLocale(); + $locale = $this->localeResolver->getLocale(); if ($locale) { return $locale; } // should have the value if not fall back to default - $localeCode = $this->_config->getValue( + $localeCode = $this->config->getValue( \Magento\Directory\Helper\Data::XML_PATH_DEFAULT_LOCALE, \Magento\Store\Model\ScopeInterface::SCOPE_STORES, $store->getCode() @@ -355,7 +354,7 @@ protected function _getCurrentLocaleCode($store) /** * @var array */ - protected $_fieldMapPaymentMethod = [ + protected $fieldMapPaymentMethod = [ 'name' => 'title' ]; @@ -363,9 +362,9 @@ protected function _getCurrentLocaleCode($store) * @param $paymentMethod * @return mixed */ - protected function _fieldMapPaymentMethod($paymentMethod) + protected function fieldMapPaymentMethod($paymentMethod) { - foreach ($this->_fieldMapPaymentMethod as $field => $newField) { + foreach ($this->fieldMapPaymentMethod as $field => $newField) { if (isset($paymentMethod[$field])) { $paymentMethod[$newField] = $paymentMethod[$field]; unset($paymentMethod[$field]); @@ -380,41 +379,20 @@ protected function _fieldMapPaymentMethod($paymentMethod) * @return array * @throws \Adyen\AdyenException */ - protected function _getDirectoryLookupResponse($requestParams, $store) + protected function getPaymentMethodsResponse($requestParams, $store) { - $cacheKey = $this->_getCacheKeyForRequest($requestParams, $store); // initialize the adyen client - $client = new \Adyen\Client(); - - if ($this->_adyenHelper->isDemoMode()) { - $client->setEnvironment(\Adyen\Environment::TEST); - } else { - $client->setEnvironment(\Adyen\Environment::LIVE); - } - - // connect to magento log - $client->setLogger($this->_adyenLogger); - - $hmacKey = $this->_adyenHelper->getHmac(); - - // create and add signature - try { - $requestParams["merchantSig"] = \Adyen\Util\Util::calculateSha256Signature($hmacKey, $requestParams); - } catch (\Adyen\AdyenException $e) { - $this->_adyenLogger->error($e->getMessage()); - // return empty result - return []; - } + $client = $this->adyenHelper->initializeAdyenClient($this->getQuote()->getStoreId()); // initialize service - $service = new \Adyen\Service\DirectoryLookup($client); + $service = $this->adyenHelper->createAdyenCheckoutService($client); try { - $responseData = $service->directoryLookup($requestParams); + $responseData = $service->paymentMethods($requestParams); } catch (\Adyen\AdyenException $e) { - $this->_adyenLogger->error( - "The Directory Lookup response is empty check your Adyen configuration in Magento." + $this->adyenLogger->error( + "The Payment methods response is empty check your Adyen configuration in Magento." ); // return empty result return []; @@ -424,40 +402,18 @@ protected function _getDirectoryLookupResponse($requestParams, $store) } /** - * @var array - */ - protected $_cacheParams = [ - 'currencyCode', - 'merchantReference', - 'skinCode', - 'merchantAccount', - 'countryCode', - 'shopperLocale', - ]; - - /** - * @param $requestParams - * @param $store - * @return string + * @return \Magento\Quote\Model\Quote */ - protected function _getCacheKeyForRequest($requestParams, $store) + protected function getQuote() { - $cacheParams = []; - $cacheParams['store'] = $store->getId(); - foreach ($this->_cacheParams as $paramKey) { - if (isset($requestParams[$paramKey])) { - $cacheParams[$paramKey] = $requestParams[$paramKey]; - } - } - - return md5(implode('|', $cacheParams)); + return $this->session->getQuote(); } /** - * @return \Magento\Quote\Model\Quote + * @return int */ - protected function _getQuote() + protected function getCurrentShopperReference() { - return $this->_session->getQuote(); + return $this->getQuote()->getCustomerId(); } -} +} \ No newline at end of file diff --git a/Model/Api/PaymentRequest.php b/Model/Api/PaymentRequest.php index 918b3103a..776ab4744 100755 --- a/Model/Api/PaymentRequest.php +++ b/Model/Api/PaymentRequest.php @@ -103,6 +103,10 @@ public function authorise3d($payment) $paResponse = $payment->getAdditionalInformation('paResponse'); $paymentData = $payment->getAdditionalInformation('paymentData'); + $payment->unsAdditionalInformation('paymentData'); + $payment->unsAdditionalInformation('paRequest'); + $payment->unsAdditionalInformation('md'); + $request = [ "paymentData" => $paymentData, "details" => [ @@ -113,7 +117,7 @@ public function authorise3d($payment) try { $client = $this->_adyenHelper->initializeAdyenClient($storeId); - $service = new \Adyen\Service\Checkout($client); + $service = $this->_adyenHelper->createAdyenCheckoutService($client); $result = $service->paymentsDetails($request); } catch (\Adyen\AdyenException $e) { throw new \Magento\Framework\Exception\LocalizedException(__('3D secure failed')); @@ -187,8 +191,8 @@ public function listRecurringContractByType($shopperReference, $storeId, $recurr ]; // call lib - $client = $this->createClient($storeId); - $service = new \Adyen\Service\Recurring($client); + $client = $this->_adyenHelper->initializeAdyenClient($storeId); + $service = $this->_adyenHelper->createAdyenRecurringService($client); $result = $service->listRecurringDetails($request); return $result; @@ -214,8 +218,8 @@ public function disableRecurringContract($recurringDetailReference, $shopperRefe ]; // call lib - $client = $this->createClient($storeId); - $service = new \Adyen\Service\Recurring($client); + $client = $this->_adyenHelper->initializeAdyenClient($storeId); + $service = $this->_adyenHelper->createAdyenRecurringService($client); try { $result = $service->disable($request); diff --git a/Model/Config/Source/PaymentRoutine.php b/Model/Config/Source/PaymentRoutine.php deleted file mode 100755 index 63a97ec2b..000000000 --- a/Model/Config/Source/PaymentRoutine.php +++ /dev/null @@ -1,56 +0,0 @@ - - */ - -namespace Adyen\Payment\Model\Config\Source; - -class PaymentRoutine implements \Magento\Framework\Option\ArrayInterface -{ - - /** - * @var \Adyen\Payment\Helper\Data - */ - protected $_adyenHelper; - - /** - * @param \Magento\Sales\Model\Order\Config $orderConfig - * @param \Adyen\Payment\Helper\Data $adyenHelper - */ - public function __construct( - \Adyen\Payment\Helper\Data $adyenHelper - ) { - $this->_adyenHelper = $adyenHelper; - } - - /** - * @return array - */ - public function toOptionArray() - { - $recurringTypes = $this->_adyenHelper->getPaymentRoutines(); - - foreach ($recurringTypes as $code => $label) { - $options[] = ['value' => $code, 'label' => $label]; - } - return $options; - } -} diff --git a/Model/Cron.php b/Model/Cron.php index c286f4eb0..59ff8fd1d 100755 --- a/Model/Cron.php +++ b/Model/Cron.php @@ -1344,9 +1344,7 @@ protected function _isAutoCapture() * if you are using authcap the payment method is manual. * There will be a capture send to indicate if payment is successful */ - if (($_paymentCode == "adyen_sepa" || $this->_paymentMethod == "sepadirectdebit") && - $sepaFlow == "authcap" - ) { + if ($this->_paymentMethod == "sepadirectdebit" && $sepaFlow == "authcap") { $this->_adyenLogger->addAdyenNotificationCronjob( 'Manual Capture is applied for sepa because it is in authcap flow' ); @@ -1354,9 +1352,7 @@ protected function _isAutoCapture() } // payment method ideal, cash adyen_boleto has direct capture - if (($_paymentCode == "adyen_sepa" || - $this->_paymentMethod == "sepadirectdebit") && $sepaFlow != "authcap" - ) { + if ($this->_paymentMethod == "sepadirectdebit" && $sepaFlow != "authcap") { $this->_adyenLogger->addAdyenNotificationCronjob( 'This payment method does not allow manual capture.(2) paymentCode:' . $_paymentCode . ' paymentMethod:' . $this->_paymentMethod . ' sepaFLow:' . $sepaFlow diff --git a/Model/Notification.php b/Model/Notification.php index 3c2cbf4b1..9159f8b66 100755 --- a/Model/Notification.php +++ b/Model/Notification.php @@ -31,6 +31,7 @@ class Notification extends \Magento\Framework\Model\AbstractModel implements Not const AUTHORISATION = 'AUTHORISATION'; const PENDING = 'PENDING'; const AUTHORISED = 'AUTHORISED'; + const RECEIVED = 'RECEIVED'; const CANCELLED = 'CANCELLED'; const REFUSED = 'REFUSED'; const ERROR = 'ERROR'; diff --git a/Model/Ui/AdyenCcConfigProvider.php b/Model/Ui/AdyenCcConfigProvider.php index e05980e22..7cbf54d1d 100755 --- a/Model/Ui/AdyenCcConfigProvider.php +++ b/Model/Ui/AdyenCcConfigProvider.php @@ -111,9 +111,7 @@ public function getConfig() 'vaultCode' => self::CC_VAULT_CODE, 'isActive' => true, 'redirectUrl' => $this->_urlBuilder->getUrl( - 'adyen/process/validate3d/', - ['_secure' => $this->_getRequest()->isSecure()] - ) + 'adyen/process/redirect/', ['_secure' => $this->_getRequest()->isSecure()]) ] ] ]; diff --git a/Model/Ui/AdyenHppConfigProvider.php b/Model/Ui/AdyenHppConfigProvider.php index 9e7fcf389..316c19985 100755 --- a/Model/Ui/AdyenHppConfigProvider.php +++ b/Model/Ui/AdyenHppConfigProvider.php @@ -143,15 +143,6 @@ public function getConfig() // gender types $config['payment'] ['adyenHpp']['genderTypes'] = \Adyen\Payment\Model\Gender::getGenderTypes(); - $paymentMethodSelectionOnAdyen = - $this->adyenHelper->getAdyenHppConfigDataFlag('payment_selection_on_adyen'); - - $config['payment'] ['adyenHpp']['isPaymentMethodSelectionOnAdyen'] = $paymentMethodSelectionOnAdyen; - $config['payment'] ['adyenHpp']['showGender'] = $this->adyenHelper->getAdyenHppConfigDataFlag('show_gender'); - $config['payment'] ['adyenHpp']['showDob'] = $this->adyenHelper->getAdyenHppConfigDataFlag('show_dob'); - $config['payment'] ['adyenHpp']['showTelephone'] = $this->adyenHelper->getAdyenHppConfigDataFlag( - 'show_telephone' - ); $config['payment'] ['adyenHpp']['ratePayId'] = $this->adyenHelper->getRatePayId(); $config['payment'] ['adyenHpp']['deviceIdentToken'] = md5($this->session->getQuoteId() . date('c')); $config['payment'] ['adyenHpp']['nordicCountries'] = ['SE', 'NO', 'DK', 'FI']; diff --git a/Model/Ui/AdyenOneclickConfigProvider.php b/Model/Ui/AdyenOneclickConfigProvider.php index 828daffa0..7f6c8d8a1 100644 --- a/Model/Ui/AdyenOneclickConfigProvider.php +++ b/Model/Ui/AdyenOneclickConfigProvider.php @@ -114,9 +114,7 @@ public function getConfig() self::CODE => [ 'isActive' => true, 'redirectUrl' => $this->_urlBuilder->getUrl( - 'adyen/process/validate3d/', - ['_secure' => $this->_getRequest()->isSecure()] - ) + 'adyen/process/redirect/', ['_secure' => $this->_getRequest()->isSecure()]) ] ] ]; diff --git a/Model/Ui/AdyenSepaConfigProvider.php b/Model/Ui/AdyenSepaConfigProvider.php deleted file mode 100755 index 344e8e64a..000000000 --- a/Model/Ui/AdyenSepaConfigProvider.php +++ /dev/null @@ -1,109 +0,0 @@ - - */ - -namespace Adyen\Payment\Model\Ui; - -use Magento\Checkout\Model\ConfigProviderInterface; -use Magento\Payment\Helper\Data as PaymentHelper; - -class AdyenSepaConfigProvider implements ConfigProviderInterface -{ - - const CODE = 'adyen_sepa'; - - /** - * @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; - - /** - * AdyenSepaConfigProvider constructor. - * - * @param PaymentHelper $paymentHelper - * @param \Adyen\Payment\Helper\Data $adyenHelper - * @param \Magento\Framework\App\RequestInterface $request - * @param \Magento\Framework\UrlInterface $urlBuilder - */ - public function __construct( - PaymentHelper $paymentHelper, - \Adyen\Payment\Helper\Data $adyenHelper, - \Magento\Framework\App\RequestInterface $request, - \Magento\Framework\UrlInterface $urlBuilder - ) { - $this->_paymentHelper = $paymentHelper; - $this->_adyenHelper = $adyenHelper; - $this->_request = $request; - $this->_urlBuilder = $urlBuilder; - } - - /** - * @return array - */ - public function getConfig() - { - - // set to active - $config = [ - 'payment' => [ - self::CODE => [ - 'isActive' => true, - 'redirectUrl' => $this->_urlBuilder->getUrl( - 'checkout/onepage/success/', - ['_secure' => $this->_getRequest()->isSecure()] - ) - ] - ] - ]; - - $config['payment']['adyenSepa']['countries'] = $this->_adyenHelper->getSepaCountries(); - - return $config; - } - - /** - * Retrieve request object - * - * @return \Magento\Framework\App\RequestInterface - */ - protected function _getRequest() - { - return $this->_request; - } -} diff --git a/Observer/AdyenHppDataAssignObserver.php b/Observer/AdyenHppDataAssignObserver.php index c99590ae7..9250240b9 100644 --- a/Observer/AdyenHppDataAssignObserver.php +++ b/Observer/AdyenHppDataAssignObserver.php @@ -38,6 +38,11 @@ class AdyenHppDataAssignObserver extends AbstractDataAssignObserver const TELEPHONE = 'telephone'; const DF_VALUE = 'df_value'; const SSN = 'ssn'; + const OWNER_NAME = 'ownerName'; + const BANK_ACCOUNT_OWNER_NAME = 'bankAccountOwnerName'; + const IBAN_NUMBER = 'ibanNumber'; + const BANK_ACCOUNT_NUMBER = 'bankAccountNumber'; + const BANK_LOCATIONID = 'bankLocationId'; /** @@ -50,7 +55,12 @@ class AdyenHppDataAssignObserver extends AbstractDataAssignObserver self::DOB, self::TELEPHONE, self::DF_VALUE, - self::SSN + self::SSN, + self::OWNER_NAME, + self::BANK_ACCOUNT_OWNER_NAME, + self::IBAN_NUMBER, + self::BANK_ACCOUNT_NUMBER, + self::BANK_LOCATIONID ]; /** diff --git a/Observer/AdyenSepaDataAssignObserver.php b/Observer/AdyenSepaDataAssignObserver.php deleted file mode 100644 index ee4e326e2..000000000 --- a/Observer/AdyenSepaDataAssignObserver.php +++ /dev/null @@ -1,75 +0,0 @@ - - */ -namespace Adyen\Payment\Observer; - -use Magento\Framework\Event\Observer; -use Magento\Payment\Observer\AbstractDataAssignObserver; -use Magento\Quote\Api\Data\PaymentInterface; - -/** - * Class DataAssignObserver - */ -class AdyenSepaDataAssignObserver extends AbstractDataAssignObserver -{ - const ACCOUNT_NAME = 'account_name'; - const IBAN = 'iban'; - const COUNTRY = 'country'; - const ACCEPTSEPA = 'accept_sepa'; - - /** - * @var array - */ - protected $additionalInformationList = [ - self::ACCOUNT_NAME, - self::IBAN, - self::COUNTRY, - self::ACCEPTSEPA - ]; - - /** - * @param Observer $observer - * @return void - */ - public function execute(Observer $observer) - { - $data = $this->readDataArgument($observer); - - $additionalData = $data->getData(PaymentInterface::KEY_ADDITIONAL_DATA); - if (!is_array($additionalData)) { - return; - } - - $paymentInfo = $this->readPaymentModelArgument($observer); - - $paymentInfo->setCcType('sepa'); - - foreach ($this->additionalInformationList as $additionalInformationKey) { - if (isset($additionalData[$additionalInformationKey])) { - $paymentInfo->setAdditionalInformation( - $additionalInformationKey, - $additionalData[$additionalInformationKey] - ); - } - } - } -} diff --git a/composer.json b/composer.json index cd438403a..be58b8703 100755 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "adyen/module-payment", "description": "Official Magento2 Plugin to connect to Payment Service Provider Adyen.", "type": "magento2-module", - "version": "4.0.3", + "version": "4.1.0", "license": [ "OSL-3.0", "AFL-3.0" @@ -14,7 +14,7 @@ } ], "require": { - "adyen/php-api-library": ">=1.5.3", + "adyen/php-api-library": ">=2.0.0", "magento/framework": ">=101.0.0", "magento/module-vault": "101.*" }, diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml index 7f511991d..9676cc671 100755 --- a/etc/adminhtml/system.xml +++ b/etc/adminhtml/system.xml @@ -42,7 +42,6 @@ - diff --git a/etc/adminhtml/system/adyen_hpp.xml b/etc/adminhtml/system/adyen_hpp.xml index 4ced40429..189e55461 100755 --- a/etc/adminhtml/system/adyen_hpp.xml +++ b/etc/adminhtml/system/adyen_hpp.xml @@ -24,7 +24,7 @@ --> - + Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Payment adyen-method-adyen-cc Process alternative payments methods @@ -38,47 +38,9 @@ validate-number payment/adyen_hpp/sort_order - - - Copy and paste the skin code of the skin you want to use from Test Customer Area => Skins. - payment/adyen_hpp/skin_code - - - - Copy and paste the HMAC key of the skin you want to use from Test Customer Area => Skins. => click on [skin code] => Edit => HMAC for Test platform. - Magento\Config\Model\Config\Backend\Encrypted - payment/adyen_hpp/hmac_test - - - - Copy and paste the HMAC key of the skin you want to use from Test Customer Area => Skins. => click on [skin code] => Edit => HMAC for Live platform. - Magento\Config\Model\Config\Backend\Encrypted - payment/adyen_hpp/hmac_live - Magento\Config\Block\System\Config\Form\Fieldset - - - Magento\Config\Model\Config\Source\Yesno - payment/adyen_hpp/show_gender - - - - Magento\Config\Model\Config\Source\Yesno - payment/adyen_hpp/show_dob - - - - Magento\Config\Model\Config\Source\Yesno - payment/adyen_hpp/show_telephone - - - - If you do not want to send the second line address field to Klarna set this setting to 'Yes' - Magento\Config\Model\Config\Source\Yesno - payment/adyen_hpp/ignore_second_address_field - Unique RatePAY Id provided by RatePAY integration consultant @@ -92,25 +54,6 @@ payment/adyen_hpp/title - - - How many days to be added to the current date for delivery. ONLY whole numbers allowed. - validate-number - payment/adyen_hpp/delivery_days - - - - If you set this to 'Yes', payment methods in the checkout won't be displayed and you will be redirected to the Adyen HPP to make the selection. - Magento\Config\Model\Config\Source\Yesno - payment/adyen_hpp/payment_selection_on_adyen - - - - Adyen provides you with 2 types of payment routines. The Single-Page flow is dynamic and contains card validation and animations powered by JavaScript. The Multi-Page flow is static, but performs better on older browsers. - Adyen\Payment\Model\Config\Source\PaymentRoutine - 1 - payment/adyen_hpp/payment_routine - This will override the default shopper locale of the Magento store (e.g. nl_NL). Leave empty to let Magento decide. diff --git a/etc/adminhtml/system/adyen_pay_by_mail.xml b/etc/adminhtml/system/adyen_pay_by_mail.xml index 7895bc8cb..9be61c9d6 100644 --- a/etc/adminhtml/system/adyen_pay_by_mail.xml +++ b/etc/adminhtml/system/adyen_pay_by_mail.xml @@ -49,18 +49,18 @@ - The skin code you want to use leave this empty if you want to use the same as Adyen HPP settings + The skin code you want to use payment/adyen_pay_by_mail/skin_code - Should match with the HMAC test key in the Adyen Customer Area. Fill this in if you are using a different skin then defined in Adyen HPP + Should match with the HMAC test key in the Adyen Customer Area. Magento\Config\Model\Config\Backend\Encrypted payment/adyen_pay_by_mail/hmac_test - Should match with the HMAC live key in the Adyen Customer Area. Fill this in if you are using a different skin then defined in Adyen HPP + Should match with the HMAC live key in the Adyen Customer Area. Magento\Config\Model\Config\Backend\Encrypted payment/adyen_pay_by_mail/hmac_live diff --git a/etc/adminhtml/system/adyen_sepa.xml b/etc/adminhtml/system/adyen_sepa.xml deleted file mode 100644 index 304ed3f71..000000000 --- a/etc/adminhtml/system/adyen_sepa.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Payment - adyen-method-adyen-cc - Process SEPA transactions - - - Magento\Config\Model\Config\Source\Yesno - payment/adyen_sepa/active - - - - payment/adyen_sepa/title - - - - validate-number - payment/adyen_sepa/sort_order - - - - - Magento\Config\Block\System\Config\Form\Fieldset - - - Magento\Payment\Model\Config\Source\Allspecificcountries - payment/adyen_sepa/allowspecific - - - - Magento\Directory\Model\Config\Source\Country - 1 - payment/adyen_sepa/specificcountry - - - - \ No newline at end of file diff --git a/etc/config.xml b/etc/config.xml index 2b860ef1a..9ca13a32b 100755 --- a/etc/config.xml +++ b/etc/config.xml @@ -83,7 +83,6 @@ authorize 1 0 - authorize 1 1 1 @@ -101,14 +100,11 @@ 0 AdyenPaymentHppFacade pending - Adyen HPP - 0 - single - 5 + Alternative payment methods 0 oj9GsQ 3 - order + authorize 1 1 1 @@ -121,25 +117,6 @@ 1 adyen - - 0 - AdyenPaymentSepaFacade - Sepa Direct Debit - 0 - 4 - authorize - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - adyen - 0 AdyenPaymentPosCloudFacade diff --git a/etc/di.xml b/etc/di.xml index 7bcfcb448..10deeb79f 100755 --- a/etc/di.xml +++ b/etc/di.xml @@ -73,16 +73,6 @@ AdyenPaymentHppCommandPool - - - Adyen\Payment\Model\Ui\AdyenSepaConfigProvider::CODE - Adyen\Payment\Block\Form\Sepa - Adyen\Payment\Block\Info\Sepa - AdyenPaymentSepaValueHandlerPool - AdyenPaymentSepaValidatorPool - AdyenPaymentSepaCommandPool - - Adyen\Payment\Model\Ui\AdyenBoletoConfigProvider::CODE @@ -190,19 +180,6 @@ - - - - AdyenPaymentSepaConfigValueHandler - - - - - - AdyenPaymentSepaConfig - - - @@ -236,8 +213,7 @@ - + AdyenPaymentPayByMailConfig @@ -259,8 +235,7 @@ - Adyen\Payment\Model\Ui\AdyenGenericConfigProvider::CODE - + Adyen\Payment\Model\Ui\AdyenGenericConfigProvider::CODE @@ -277,8 +252,7 @@ - Adyen\Payment\Model\Ui\AdyenOneclickConfigProvider::CODE - + Adyen\Payment\Model\Ui\AdyenOneclickConfigProvider::CODE @@ -286,33 +260,24 @@ Adyen\Payment\Model\Ui\AdyenHppConfigProvider::CODE - - - Adyen\Payment\Model\Ui\AdyenSepaConfigProvider::CODE - - - Adyen\Payment\Model\Ui\AdyenBoletoConfigProvider::CODE - + Adyen\Payment\Model\Ui\AdyenBoletoConfigProvider::CODE - Adyen\Payment\Model\Ui\AdyenPosCloudConfigProvider::CODE - + Adyen\Payment\Model\Ui\AdyenPosCloudConfigProvider::CODE - Adyen\Payment\Model\Ui\AdyenPayByMailConfigProvider::CODE - + Adyen\Payment\Model\Ui\AdyenPayByMailConfigProvider::CODE - Adyen\Payment\Model\Ui\AdyenApplePayConfigProvider::CODE - + Adyen\Payment\Model\Ui\AdyenApplePayConfigProvider::CODE @@ -371,19 +336,7 @@ - Adyen\Payment\Gateway\Command\HppCommand - AdyenPaymentCaptureCommand - AdyenPaymentCancelCommand - AdyenPaymentRefundCommand - AdyenPaymentCancelCommand - - - - - - - - AdyenPaymentSepaAuthorizeCommand + AdyenPaymentHppAuthorizeCommand AdyenPaymentCaptureCommand AdyenPaymentCancelCommand AdyenPaymentRefundCommand @@ -461,13 +414,13 @@ - + - AdyenPaymentSepaAuthorizeRequest + AdyenPaymentHppAuthorizeRequest Adyen\Payment\Gateway\Http\TransferFactory Adyen\Payment\Gateway\Http\Client\TransactionPayment CheckoutResponseValidator - AdyenPaymentSepaResponseHandlerComposite + AdyenPaymentCcResponseHandlerComposite @@ -475,9 +428,8 @@ AdyenPaymentBoletoAuthorizeRequest Adyen\Payment\Gateway\Http\TransferFactory - Adyen\Payment\Gateway\Http\Client\TransactionAuthorization - - GeneralResponseValidator + Adyen\Payment\Gateway\Http\Client\TransactionPayment + CheckoutResponseValidator AdyenPaymentBoletoResponseHandlerComposite @@ -486,8 +438,7 @@ AdyenPaymentPosCloudAuthorizeRequest Adyen\Payment\Gateway\Http\TransferFactory - Adyen\Payment\Gateway\Http\Client\TransactionPosCloudSync - + Adyen\Payment\Gateway\Http\Client\TransactionPosCloudSync PosCloudResponseValidator AdyenPaymentPosCloudResponseHandlerComposite @@ -497,9 +448,8 @@ AdyenPaymentApplePayAuthorizeRequest Adyen\Payment\Gateway\Http\TransferFactory - Adyen\Payment\Gateway\Http\Client\TransactionAuthorization - - GeneralResponseValidator + Adyen\Payment\Gateway\Http\Client\TransactionPayment + CheckoutResponseValidator AdyenPaymentResponseHandlerComposite @@ -510,8 +460,7 @@ AdyenPaymentCaptureRequest Adyen\Payment\Gateway\Http\TransferFactory Adyen\Payment\Gateway\Http\Client\TransactionCapture - Adyen\Payment\Gateway\Validator\CaptureResponseValidator - + Adyen\Payment\Gateway\Validator\CaptureResponseValidator AdyenPaymentCaptureResponseHandlerComposite @@ -521,8 +470,7 @@ AdyenPaymentRefundRequest Adyen\Payment\Gateway\Http\TransferFactory Adyen\Payment\Gateway\Http\Client\TransactionRefund - Adyen\Payment\Gateway\Validator\RefundResponseValidator - + Adyen\Payment\Gateway\Validator\RefundResponseValidator AdyenPaymentRefundResponseHandlerComposite @@ -531,8 +479,7 @@ AdyenPaymentCancelRequest Adyen\Payment\Gateway\Http\TransferFactory Adyen\Payment\Gateway\Http\Client\TransactionCancel - Adyen\Payment\Gateway\Validator\CancelResponseValidator - + Adyen\Payment\Gateway\Validator\CancelResponseValidator AdyenPaymentCancelResponseHandlerComposite @@ -542,9 +489,7 @@ - - Adyen\Payment\Gateway\Request\MerchantAccountDataBuilder - + Adyen\Payment\Gateway\Request\MerchantAccountDataBuilder Adyen\Payment\Gateway\Request\CustomerDataBuilder Adyen\Payment\Gateway\Request\CustomerIpDataBuilder Adyen\Payment\Gateway\Request\AddressDataBuilder @@ -591,35 +536,30 @@ - - Adyen\Payment\Gateway\Request\MerchantAccountDataBuilder - + Adyen\Payment\Gateway\Request\MerchantAccountDataBuilder Adyen\Payment\Gateway\Request\CustomerDataBuilder Adyen\Payment\Gateway\Request\CustomerIpDataBuilder Adyen\Payment\Gateway\Request\AddressDataBuilder Adyen\Payment\Gateway\Request\PaymentDataBuilder Adyen\Payment\Gateway\Request\BrowserInfoDataBuilder Adyen\Payment\Gateway\Request\RecurringDataBuilder - Adyen\Payment\Gateway\Request\OneclickAuthorizationDataBuilder - + Adyen\Payment\Gateway\Request\CcAuthorizationDataBuilder + Adyen\Payment\Gateway\Request\OneclickAuthorizationDataBuilder - + - - Adyen\Payment\Gateway\Request\MerchantAccountDataBuilder - + Adyen\Payment\Gateway\Request\MerchantAccountDataBuilder Adyen\Payment\Gateway\Request\CustomerDataBuilder Adyen\Payment\Gateway\Request\CustomerIpDataBuilder Adyen\Payment\Gateway\Request\AddressDataBuilder Adyen\Payment\Gateway\Request\PaymentDataBuilder Adyen\Payment\Gateway\Request\BrowserInfoDataBuilder Adyen\Payment\Gateway\Request\RecurringDataBuilder - Adyen\Payment\Gateway\Request\SepaAuthorizationDataBuilder - + Adyen\Payment\Gateway\Request\CheckoutDataBuilder @@ -627,18 +567,15 @@ - - Adyen\Payment\Gateway\Request\MerchantAccountDataBuilder - + Adyen\Payment\Gateway\Request\MerchantAccountDataBuilder Adyen\Payment\Gateway\Request\CustomerDataBuilder Adyen\Payment\Gateway\Request\CustomerIpDataBuilder Adyen\Payment\Gateway\Request\AddressDataBuilder Adyen\Payment\Gateway\Request\PaymentDataBuilder Adyen\Payment\Gateway\Request\BrowserInfoDataBuilder Adyen\Payment\Gateway\Request\RecurringDataBuilder - - Adyen\Payment\Gateway\Request\BoletoAuthorizationDataBuilder - + Adyen\Payment\Gateway\Request\CheckoutDataBuilder + @@ -654,17 +591,13 @@ - - Adyen\Payment\Gateway\Request\MerchantAccountDataBuilder - + Adyen\Payment\Gateway\Request\MerchantAccountDataBuilder Adyen\Payment\Gateway\Request\CustomerDataBuilder Adyen\Payment\Gateway\Request\CustomerIpDataBuilder Adyen\Payment\Gateway\Request\AddressDataBuilder Adyen\Payment\Gateway\Request\PaymentDataBuilder Adyen\Payment\Gateway\Request\BrowserInfoDataBuilder - - Adyen\Payment\Gateway\Request\ApplePayAuthorizationDataBuilder - + Adyen\Payment\Gateway\Request\ApplePayAuthorizationDataBuilder @@ -673,9 +606,7 @@ - - Adyen\Payment\Gateway\Request\MerchantAccountDataBuilder - + Adyen\Payment\Gateway\Request\MerchantAccountDataBuilder Adyen\Payment\Gateway\Request\CaptureDataBuilder @@ -693,9 +624,7 @@ - - Adyen\Payment\Gateway\Request\MerchantAccountDataBuilder - + Adyen\Payment\Gateway\Request\MerchantAccountDataBuilder Adyen\Payment\Gateway\Request\CancelDataBuilder @@ -705,72 +634,42 @@ - - Adyen\Payment\Gateway\Response\CheckoutPaymentsDetailsHandler - + Adyen\Payment\Gateway\Response\CheckoutPaymentsDetailsHandler Adyen\Payment\Gateway\Response\VaultDetailsHandler - - Adyen\Payment\Gateway\Response\CheckoutPaymentCommentHistoryHandler - - - - - - - - - Adyen\Payment\Gateway\Response\PaymentAuthorisationDetailsHandler - - - Adyen\Payment\Gateway\Response\PaymentCommentHistoryHandler - + Adyen\Payment\Gateway\Response\CheckoutPaymentCommentHistoryHandler - - Adyen\Payment\Gateway\Response\PaymentAuthorisationDetailsHandler - - - Adyen\Payment\Gateway\Response\PaymentCommentHistoryHandler - + Adyen\Payment\Gateway\Response\CheckoutPaymentsDetailsHandler + Adyen\Payment\Gateway\Response\CheckoutPaymentCommentHistoryHandler - + - Adyen\Payment\Gateway\Response\PaymentPosCloudHandler - + Adyen\Payment\Gateway\Response\PaymentPosCloudHandler - - Adyen\Payment\Gateway\Response\PaymentAuthorisationDetailsHandler - - - Adyen\Payment\Gateway\Response\PaymentCommentHistoryHandler - + Adyen\Payment\Gateway\Response\PaymentAuthorisationDetailsHandler + Adyen\Payment\Gateway\Response\PaymentCommentHistoryHandler - + - Adyen\Payment\Gateway\Response\PaymentCaptureDetailsHandler - - - Adyen\Payment\Gateway\Response\PaymentCommentHistoryHandler - + Adyen\Payment\Gateway\Response\PaymentCaptureDetailsHandler + Adyen\Payment\Gateway\Response\PaymentCommentHistoryHandler @@ -778,9 +677,7 @@ Adyen\Payment\Gateway\Response\PaymentRefundDetailsHandler - - Adyen\Payment\Gateway\Response\PaymentCommentHistoryRefundHandler - + Adyen\Payment\Gateway\Response\PaymentCommentHistoryRefundHandler @@ -788,9 +685,7 @@ Adyen\Payment\Gateway\Response\PaymentCancelDetailsHandler - - Adyen\Payment\Gateway\Response\PaymentCommentHistoryHandler - + Adyen\Payment\Gateway\Response\PaymentCommentHistoryHandler @@ -837,20 +732,6 @@ - - - - Adyen\Payment\Gateway\Validator\SepaValidator - AdyenSepaCountryValidator - - - - - - AdyenPaymentSepaConfig - - - @@ -931,7 +812,7 @@ - + Magento\Framework\Filesystem\Driver\File @@ -965,7 +846,7 @@ AdyenLoggerTest - + Adyen\Payment\Logger\Handler\AdyenDebug Adyen\Payment\Logger\Handler\AdyenNotification Adyen\Payment\Logger\Handler\AdyenResult diff --git a/etc/events.xml b/etc/events.xml index 00bcf0313..546a30643 100644 --- a/etc/events.xml +++ b/etc/events.xml @@ -32,9 +32,6 @@ - - - diff --git a/etc/frontend/di.xml b/etc/frontend/di.xml index 82375f81b..492645e88 100755 --- a/etc/frontend/di.xml +++ b/etc/frontend/di.xml @@ -27,28 +27,13 @@ - - Adyen\Payment\Model\Ui\AdyenGenericConfigProvider - - Adyen\Payment\Model\Ui\AdyenCcConfigProvider - - - Adyen\Payment\Model\Ui\AdyenOneclickConfigProvider - - Adyen\Payment\Model\Ui\AdyenHppConfigProvider - - - Adyen\Payment\Model\Ui\AdyenSepaConfigProvider - - - Adyen\Payment\Model\Ui\AdyenBoletoConfigProvider - - - Adyen\Payment\Model\Ui\AdyenPosCloudConfigProvider - - - Adyen\Payment\Model\Ui\AdyenApplePayConfigProvider - + Adyen\Payment\Model\Ui\AdyenGenericConfigProvider + Adyen\Payment\Model\Ui\AdyenCcConfigProvider + Adyen\Payment\Model\Ui\AdyenOneclickConfigProvider + Adyen\Payment\Model\Ui\AdyenHppConfigProvider + Adyen\Payment\Model\Ui\AdyenBoletoConfigProvider + Adyen\Payment\Model\Ui\AdyenPosCloudConfigProvider + Adyen\Payment\Model\Ui\AdyenApplePayConfigProvider diff --git a/etc/module.xml b/etc/module.xml index b8f9d4652..4a3a902f0 100755 --- a/etc/module.xml +++ b/etc/module.xml @@ -24,7 +24,7 @@ --> - + diff --git a/view/adminhtml/templates/form/sepa.phtml b/view/adminhtml/templates/form/sepa.phtml deleted file mode 100644 index ec3adcde3..000000000 --- a/view/adminhtml/templates/form/sepa.phtml +++ /dev/null @@ -1,95 +0,0 @@ - - */ - -// @codingStandardsIgnoreFile -/** - * @var \Magento\Payment\Block\Adminhtml\Transparent\Form $block - */ -$code = $block->escapeHtml($block->getMethodCode()); -$currentCountry = $block->getInfoData('country'); -?> - - diff --git a/view/adminhtml/templates/info/adyen_boleto.phtml b/view/adminhtml/templates/info/adyen_boleto.phtml index 30a61bfcb..06d9ad971 100644 --- a/view/adminhtml/templates/info/adyen_boleto.phtml +++ b/view/adminhtml/templates/info/adyen_boleto.phtml @@ -39,9 +39,9 @@ $_isDemoMode = $block->isDemoMode(); getAdditionalInformation('pspReference')):?>
- %1', $block->escapeHtml($_pspReference), $block->escapeHtml($_pspReference)) ?> + %1', $block->escapeHtml($_pspReference), $block->escapeHtml($_pspReference)) ?> - %1', $block->escapeHtml($_pspReference), $block->escapeHtml($_pspReference)) ?> + %1', $block->escapeHtml($_pspReference), $block->escapeHtml($_pspReference)) ?>
diff --git a/view/adminhtml/templates/info/adyen_cc.phtml b/view/adminhtml/templates/info/adyen_cc.phtml index 42834779e..469d8732f 100755 --- a/view/adminhtml/templates/info/adyen_cc.phtml +++ b/view/adminhtml/templates/info/adyen_cc.phtml @@ -39,9 +39,9 @@ $_isDemoMode = $block->isDemoMode(); getAdditionalInformation('pspReference')):?>
- %1', $block->escapeHtml($_pspReference), $block->escapeHtml($_pspReference)) ?> + %1', $block->escapeHtml($_pspReference), $block->escapeHtml($_pspReference)) ?> - %1', $block->escapeHtml($_pspReference), $block->escapeHtml($_pspReference)) ?> + %1', $block->escapeHtml($_pspReference), $block->escapeHtml($_pspReference)) ?>
diff --git a/view/adminhtml/templates/info/adyen_hpp.phtml b/view/adminhtml/templates/info/adyen_hpp.phtml index 873359b39..ffe42f363 100755 --- a/view/adminhtml/templates/info/adyen_hpp.phtml +++ b/view/adminhtml/templates/info/adyen_hpp.phtml @@ -35,27 +35,120 @@ $_info = $this->getInfo(); $_isDemoMode = $block->isDemoMode(); ?> -getAdditionalInformation('pspReference')):?> +getAdditionalInformation('pspReference')): ?>
- - %1', $block->escapeHtml($_pspReference), $block->escapeHtml($_pspReference)) ?> + + %1', + $block->escapeHtml($_pspReference), $block->escapeHtml($_pspReference)) ?> - %1', $block->escapeHtml($_pspReference), $block->escapeHtml($_pspReference)) ?> + %1', + $block->escapeHtml($_pspReference), $block->escapeHtml($_pspReference)) ?>
- + -getAdditionalInformation('brand_code')):?> +getAdditionalInformation('brand_code')): ?>
- + + + +getBankTransferData())) : ?> + + getBankTransferData(); + $order = $block->getOrder(); + ?> + +
+ + + getGrandTotal())) : ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
escapeHtml(__('Amount')); ?>formatPrice($order->getGrandTotal()); ?>
escapeHtml(__('With reference')); ?>
escapeHtml(__('Beneficiary Name')); ?>
escapeHtml(__('Bank')); ?>
escapeHtml(__('Bankaccount')); ?>
+
+getMultibancoData())) : ?> + + getMultibancoData(); + ?> + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
escapeHtml(__('Entity')); ?>
escapeHtml(__('Reference')); ?>
escapeHtml(__('Amount')); ?>
escapeHtml(__('Deadline')); ?>escapeHtml(__('Days')); ?>
+
+ -getAdditionalInformation('adyen_total_fraud_score') != ""): ?> +getAdditionalInformation('adyen_total_fraud_score') != ""): ?> getAdditionalInformation('adyen_total_fraud_score')) ?>
-getSplitPayments()): ?> +getSplitPayments()): ?> @@ -74,20 +167,20 @@ $_isDemoMode = $block->isDemoMode();
PspReference
-getSpecificInformation()):?> +getSpecificInformation()): ?> - $_value):?> + $_value): ?> - - + +
escapeHtml($_label)?>:getValueAsArray($_value, true)))?>escapeHtml($_label) ?>:getValueAsArray($_value, true))) ?>
- + -getAdditionalInformation('adyen_ratepay_descriptor')):?> +getAdditionalInformation('adyen_ratepay_descriptor')): ?>
- + -getChildHtml()?> +getChildHtml() ?> diff --git a/view/adminhtml/templates/info/adyen_pay_by_mail.phtml b/view/adminhtml/templates/info/adyen_pay_by_mail.phtml index 2e3b2ea41..9897463d4 100644 --- a/view/adminhtml/templates/info/adyen_pay_by_mail.phtml +++ b/view/adminhtml/templates/info/adyen_pay_by_mail.phtml @@ -43,9 +43,9 @@ $_isDemoMode = $block->isDemoMode(); getAdditionalInformation('pspReference')):?>
- %1', $block->escapeHtml($_pspReference), $block->escapeHtml($_pspReference)) ?> + %1', $block->escapeHtml($_pspReference), $block->escapeHtml($_pspReference)) ?> - %1', $block->escapeHtml($_pspReference), $block->escapeHtml($_pspReference)) ?> + %1', $block->escapeHtml($_pspReference), $block->escapeHtml($_pspReference)) ?>
diff --git a/view/adminhtml/templates/info/adyen_pos_cloud.phtml b/view/adminhtml/templates/info/adyen_pos_cloud.phtml index fd6521ebb..eb2700d0d 100644 --- a/view/adminhtml/templates/info/adyen_pos_cloud.phtml +++ b/view/adminhtml/templates/info/adyen_pos_cloud.phtml @@ -38,9 +38,9 @@ $_isDemoMode = $block->isDemoMode(); getAdditionalInformation('pspReference')):?>
- %1', $block->escapeHtml($_pspReference), $block->escapeHtml($_pspReference)) ?> + %1', $block->escapeHtml($_pspReference), $block->escapeHtml($_pspReference)) ?> - %1', $block->escapeHtml($_pspReference), $block->escapeHtml($_pspReference)) ?> + %1', $block->escapeHtml($_pspReference), $block->escapeHtml($_pspReference)) ?>
diff --git a/view/adminhtml/templates/info/adyen_sepa.phtml b/view/adminhtml/templates/info/adyen_sepa.phtml deleted file mode 100644 index 337d47f8a..000000000 --- a/view/adminhtml/templates/info/adyen_sepa.phtml +++ /dev/null @@ -1,69 +0,0 @@ - - */ - -// @codingStandardsIgnoreFile - -?> - -escapeHtml($block->getMethod()->getTitle()) ?> - -getInfo(); -$_isDemoMode = $block->isDemoMode(); -?> - -getAdditionalInformation('pspReference')):?> -
- - %1', $block->escapeHtml($_pspReference), $block->escapeHtml($_pspReference)) ?> - - %1', $block->escapeHtml($_pspReference), $block->escapeHtml($_pspReference)) ?> - -
- - -getAdditionalInformation('brand_code')):?> -
-
- - -getAdditionalInformation('adyen_total_fraud_score') != ""): ?> - getAdditionalInformation('adyen_total_fraud_score')) ?>
- - -getSpecificInformation()):?> - - $_value):?> - - - - - -
escapeHtml($_label)?>:getValueAsArray($_value, true)))?>
- - -getChildHtml()?> \ No newline at end of file diff --git a/view/adminhtml/web/css/order_create_styles.css b/view/adminhtml/web/css/order_create_styles.css index a54890758..117550031 100644 --- a/view/adminhtml/web/css/order_create_styles.css +++ b/view/adminhtml/web/css/order_create_styles.css @@ -66,840 +66,845 @@ 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); +/* Checkout component Adyen styling start */ +.adyen-checkout__spinner__wrapper{ + align-items:center; + display:flex; + height:100%; + justify-content:center +} +.adyen-checkout__spinner__wrapper--inline{ + display:inline-block; + height:auto; + margin-right:8px +} +.adyen-checkout__spinner{ + -webkit-animation:rotateSpinner 2s infinite linear; + animation:rotateSpinner 2s infinite linear; + border:2px solid #00a3ff; + border-radius:50%; + border-top-color:transparent; + height:43px; + width:43px +} +.adyen-checkout__spinner--large{ + height:43px; + width:43px +} +.adyen-checkout__spinner--small{ + height:16px; + width:16px +} +.adyen-checkout__spinner--medium{ + height:28px; + width:28px +} +@-webkit-keyframes rotateSpinner{ + 0%{ + -webkit-transform:rotate(0deg); + transform:rotate(0deg) } - 100% { - transform: rotate(360deg); + to{ + -webkit-transform:rotate(1turn); + transform:rotate(1turn) } } - -.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); +@keyframes rotateSpinner{ + 0%{ + -webkit-transform:rotate(0deg); + transform:rotate(0deg) } - 100% { - -webkit-transform: scale3d(1, 1, 1); - transform: scale3d(1, 1, 1); + to{ + -webkit-transform:rotate(1turn); + transform:rotate(1turn) } } -.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__pay-button{ + background:#001b2b; + border:0; + border-radius:3px; + box-shadow:0 3px 4px rgba(0,15,45,.2); + color:#fff; + cursor:pointer; + font-size:1em; + font-weight:700; + height:48px; + padding:15px; + transition:background .3s ease-out; + width:100% +} +.adyen-checkout__pay-button:disabled{ + -moz-user-select:all; + -ms-user-select:all; + -webkit-user-select:all; + background:#e6e9eb; + box-shadow:none; + cursor:not-allowed; + user-select:all +} +.adyen-checkout__pay-button--loading{ + -moz-user-select:none; + -ms-user-select:none; + -webkit-user-select:none; + background:#4c5f6b; + box-shadow:none; + outline:0; + pointer-events:none; + user-select:none +} +.adyen-checkout__pay-button .adyen-checkout__spinner{ + border-color:transparent #fff #fff; + border-width:3px +} +.adyen-checkout__pay-button__content{ + align-items:center; + display:flex; + justify-content:center +} +.adyen-checkout__payment-method{ + background:#fff; + border:1px solid #edf0f3; + cursor:pointer; + margin-top:-1px; + position:relative; + transition:opacity .3s ease-out; + width:100% +} +.adyen-checkout__payment-method:focus{ + outline:0 +} +.adyen-checkout__payment-method--selected+.adyen-checkout__payment-method,.adyen-checkout__payment-method:first-child{ + border-top-left-radius:3px; + border-top-right-radius:3px; + margin-top:0 +} +.adyen-checkout__payment-method--next-selected{ + border-bottom-left-radius:3px; + border-bottom-right-radius:3px +} +.adyen-checkout__payment-method--loading{ + opacity:.2 +} +.adyen-checkout__payment-method--selected.adyen-checkout__payment-method--loading{ + opacity:.9 +} +.adyen-checkout__payment-method--disabling{ + opacity:.5 +} +.adyen-checkout__payment-method__header{ + align-items:center; + color:#00202e; + display:flex; + font-size:16px; + font-weight:400; + padding:16px; + position:relative; + transition:background .1s ease-out; + width:100% +} +.adyen-checkout__payment-method__surcharge{ + color:#687282; + margin-left:5px +} +.adyen-checkout__payment-method--selected{ + background:#f7f8f9; + border:1px solid #d4d9db; + border-radius:3px; + cursor:default; + margin:8px 0; + transition:margin .15s cubic-bezier(.4,0,.2,1) 0ms,opacity .3s ease-out +} +.adyen-checkout__payment-method--selected .adyen-checkout__payment-method__header{ + font-weight:500 +} +.adyen-checkout__payment-method__details{ + padding:0 16px 16px +} +.adyen-checkout__payment-method__details__content{ + padding:6px 0 24px +} +.adyen-checkout__payment-method__image__wrapper{ + height:26px; + position:relative +} +.adyen-checkout__payment-method__image__wrapper:after{ + border:1px solid rgba(0,27,43,.17); + border-radius:3px; + content:""; + height:100%; + left:0; + position:absolute; + top:0; + width:100% +} +.adyen-checkout__payment-method__image{ + border-radius:3px +} +.adyen-checkout__payment-method__disable_oneclick{ + background-color:transparent; + border:none; + color:#687282; + cursor:pointer; + display:block; + font-size:13px; + padding:0; + position:absolute; + right:70px; + text-decoration:underline +} +.adyen-checkout__payment-method__disable_oneclick:focus{ + color:#00a3ff; + outline:0 +} +.adyen-checkout__payment-method__disable-confirmation{ + align-items:center; + background:#e6e9eb; + color:#001b2b; + display:flex; + font-size:15px; + justify-content:space-between; + margin-bottom:10px; + padding:8px 16px +} +.adyen-checkout__payment-method__disable-confirmation__buttons{ + display:flex +} +.adyen-checkout__payment-method__disable-confirmation__button{ + border:1px solid transparent; + border-radius:3px; + cursor:pointer; + font-size:13px; + line-height:15px; + margin:0 0 0 8px; + padding:8px +} +.adyen-checkout__payment-method__disable-confirmation__button--remove{ + background:#d10244; + border-color:#d10244; + color:#fff +} +.adyen-checkout__payment-method__disable-confirmation__button--cancel{ + background:transparent; + border-color:#001b2b; + color:#001b2b +} +.adyen-checkout__payment-method__radio{ + background-color:#fff; + border:1px solid #b9c4c9; + border-radius:50%; + box-shadow:inset 0 1px 3px rgba(0,27,43,.15); + height:18px; + position:absolute; + right:20px; + transition:border-color .3s ease-out; + width:18px +} +.adyen-checkout__payment-method__radio:after{ + -webkit-transform:translateY(-50%) scale(0); + background-color:#fff; + border-radius:50%; + box-shadow:0 1px 1px rgba(0,15,45,.25); + content:""; + display:block; + height:6px; + left:0; + margin:0 auto; + position:absolute; + right:0; + top:50%; + transform:translateY(-50%) scale(0); + transition:-webkit-transform .3s ease-out; + transition:transform .3s ease-out; + transition:transform .3s ease-out,-webkit-transform .3s ease-out; + width:6px +} +.adyen-checkout__payment-method__radio:hover{ + border-color:#00a3ff; + cursor:pointer +} +.adyen-checkout__payment-method__radio--selected{ + background-color:#00a3ff; + border:0 solid transparent; + box-shadow:inset 0 1px 2px rgba(0,0,0,.26); + transition:all .3s ease-out +} +.adyen-checkout__payment-method__radio--selected:after{ + -webkit-transform:translateY(-50%) scale(1); + transform:translateY(-50%) scale(1) +} +.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__helper-text,.adyen-checkout__label__text{ + color:#001b2b; + display:block; + font-size:13px; + font-weight:400; + line-height:13px; + padding-bottom:8px +} +.adyen-checkout__helper-text{ + color:#687282 +} +.adyen-checkout__label__text{ + transition:color .2s ease-out +} +.adyen-checkout__label--focused .adyen-checkout__label__text{ + color:#07b +} +.adyen-checkout__error-text,.adyen-checkout__label__text--error{ + align-items:center; + color:#d0021b; + display:flex; + font-size:12px; + font-weight:400; + margin-top:4px +} +.adyen-checkout__icon svg{ + fill:currentColor +} +.adyen-checkout__open-invoice .adyen-checkout__input--wrapper--socialSecurityNumber+.adyen-checkout__error-text{ + max-width:380px +} +.adyen-checkout__radio_group+.adyen-checkout-input__inline-validation{ + display:none +} +.adyen-checkout__radio_group__input{ + opacity:0; + position:absolute +} +.adyen-checkout__radio_group__label{ + display:block; + font-size:13px; + font-weight:400; + line-height:16px; + margin-bottom:8px; + padding-bottom:0; + padding-left:24px; + position:relative +} +.adyen-checkout__radio_group__label:before{ + background-color:#fff; + border:1px solid #b9c4c9; + border-radius:50%; + content:""; + height:16px; + left:0; + position:absolute; + top:0; + transition:border-color .3s ease-out; + width:16px +} +.adyen-checkout__radio_group__label:after{ + -webkit-transform:scale(0); + background-color:#fff; + border-radius:50%; + box-shadow:0 1px 1px rgba(0,15,45,.25); + content:""; + display:block; + height:6px; + left:5px; + margin:0 auto; + position:absolute; + top:5px; + transform:scale(0); + transition:-webkit-transform .3s ease-out; + transition:transform .3s ease-out; + transition:transform .3s ease-out,-webkit-transform .3s ease-out; + width:6px +} +.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:0 solid transparent; + box-shadow:inset 0 1px 2px rgba(0,0,0,.26); + transition:all .3s ease-out +} +.adyen-checkout__radio_group__input:checked+.adyen-checkout__radio_group__label:after{ + -webkit-transform:scale(1); + transform:scale(1) +} +.adyen-checkout__radio_group__label.adyen-checkout__radio_group__label--invalid:before{ + border:1px solid #d10244 +} +.adyen-checkout__checkbox{ + display:block +} +.adyen-checkout__checkbox>input[type=checkbox]{ + opacity:0; + pointer-events:none; + position:absolute +} +.adyen-checkout__checkbox__label{ + -moz-user-select:none; + -ms-user-select:none; + -webkit-user-select:none; + color:#001b2b; + cursor:pointer; + display:inline-block; + font-size:13px; + font-weight:400; + line-height:16px; + padding-left:24px; + position:relative; + user-select:none +} +.adyen-checkout__checkbox__input+span:before{ + -webkit-transform:rotate(37deg); + -webkit-transform-origin:100% 100%; + border-color:transparent #fff #fff transparent; + border-radius:0 2px 1px 2px; + border-style:solid; + border-width:1px 2px 2px 1px; + content:""; + height:11px; + left:1px; + opacity:0; + position:absolute; + top:2px; + transform:rotate(37deg); + transform-origin:100% 100%; + transition:opacity .2s ease-out; + width:6px; + z-index:1 +} +.adyen-checkout__checkbox__input:checked+.adyen-checkout__checkbox__label:before{ + opacity:1 +} +.adyen-checkout__checkbox__input+.adyen-checkout__checkbox__label:after{ + background-color:#fff; + border:1px solid #b9c4c9; + border-radius:3px; + content:""; + height:16px; + left:0; + position:absolute; + top:0; + transition:background .15s ease-out,border .05s ease-out,box-shadow .1s ease-out; + width:16px; + z-index:0 +} +.adyen-checkout__checkbox__input:checked+.adyen-checkout__checkbox__label:after{ + background-color:#00a3ff; + border:1px solid #00a3ff +} +.adyen-checkout__checkbox__input:focus+span:after{ + border:1px solid #00a3ff; + box-shadow:0 0 0 2px #91d7ff +} +.adyen-checkout__checkbox__input.adyen-checkout__checkbox__input--invalid+.adyen-checkout__checkbox__label:after{ + border:1px solid #d10244 +} +.adyen-checkout__dropdown{ + font-size:16px; + max-width:100%; + width:200px +} +.adyen-checkout__dropdown--small{ + width:130px +} +.adyen-checkout__dropdown--large{ + width:300px +} +.adyen-checkout__dropdown__button{ + background:#fff; + border:1px solid #b9c4c9; + border-radius:3px; + font-size:16px; + height:40px; + line-height:20px; + outline:0; + padding:9px 20px 9px 8px; + transition:border .2s ease-out,box-shadow .2s ease-out; + width:100% +} +.adyen-checkout__dropdown__button__icon{ + margin-right:8px; + max-height:20px; + max-width:32px +} +.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__button--readonly,.adyen-checkout__dropdown__button--readonly.adyen-checkout__dropdown__button--active{ + background:#e6e9eb; + color:#001b2b; + cursor:not-allowed +} +.adyen-checkout__dropdown__button--invalid{ + border-color:#d10244 +} +.adyen-checkout__dropdown__button__text{ + overflow:hidden; + text-overflow:ellipsis; + white-space:nowrap +} +.adyen-checkout__dropdown__list{ + border-radius:3px; + box-shadow:0 2px 7px rgba(0,15,45,.3); + margin-top:2px; + z-index:2 +} +.adyen-checkout__dropdown__list.adyen-checkout__dropdown__list--active{ + -webkit-animation:expand .1s ease-out; + animation:expand .1s ease-out +} +.adyen-checkout__dropdown__element{ + -ms-hyphens:auto; + -webkit-hyphens:auto; + border:1px solid transparent; + border-bottom-color:#e6e9eb; + cursor:pointer; + hyphens:auto; + line-height:20px; + outline:0; + padding:8px; + transition:background .2s ease-out,border-color .2s ease-out; + word-break:break-word +} +.adyen-checkout__dropdown__element:last-child{ + border-bottom:0 +} +.adyen-checkout__dropdown__element:active,.adyen-checkout__dropdown__element:focus,.adyen-checkout__dropdown__element:hover{ + background:#f0f2f4 +} +.adyen-checkout__dropdown__element:active,.adyen-checkout__dropdown__element:focus{ + border-bottom-color:#00a3ff; + border-top-color:#00a3ff +} +.adyen-checkout__dropdown__element__icon{ + margin-right:8px; + max-height:20px; + max-width:32px +} +@-webkit-keyframes expand{ + 0%{ + -webkit-transform:scaleY(0); + transform:scaleY(0) + } + to{ + -webkit-transform:scaleX(1); + transform:scaleX(1) + } } - -.adyen-checkout__payment-methods-list--loading { - user-select: none; - pointer-events: none; +@keyframes expand{ + 0%{ + -webkit-transform:scaleY(0); + transform:scaleY(0) + } + to{ + -webkit-transform:scaleX(1); + transform:scaleX(1) + } } -/* Forms */ - -.adyen-checkout__link { - color: #687282; - font-size: 13px; - text-decoration: underline; -} +.adyen-checkout__dropdown+.adyen-checkout-input__inline-validation{ + right:32px +} +.adyen-checkout__select-list{ + margin:0; + padding:0 +} +.adyen-checkout__select-list__item{ + background:#fff; + border-top:1px solid #b9c4c9; + cursor:pointer; + display:inline-block; + font-size:16px; + line-height:20px; + outline:0; + padding:9px; + width:100% +} +.adyen-checkout__select-list__item:first-child{ + border-top:0 +} +.adyen-checkout__select-list__item:active,.adyen-checkout__select-list__item:focus,.adyen-checkout__select-list__item:hover{ + background:rgba(145,215,255,.5) +} +.adyen-checkout__select-list__item--selected{ + background:rgba(145,215,255,.5); + font-weight:700 +} +.adyen-checkout__input{ + background:#fff; + border:1px solid #b9c4c9; + border-radius:3px; + color:#001b2b; + display:block; + font-family:inherit; + font-size:16px; + height:40px; + outline:none; + padding:5px 8px; + position:relative; + transition:border .2s ease-out,box-shadow .2s ease-out; + width:200px +} +.adyen-checkout__input:required{ + box-shadow:none +} +.adyen-checkout__input--wrapper{ + display:inline-block; + position:relative +} +.adyen-checkout__input--wrapper--block{ + display:block +} +.adyen-checkout-input__inline-validation{ + -webkit-transform:translateY(-50%); + height:16px; + position:absolute; + right:14px; + top:50%; + transform:translateY(-50%); + width:16px +} +.adyen-checkout-input__inline-validation--valid{ + color:#039450 +} +.adyen-checkout-input__inline-validation--invalid{ + color:#d10244 +} +.adyen-checkout__input.adyen-checkout__input--small{ + width:130px +} +.adyen-checkout__input.adyen-checkout__input--large{ + width:300px +} +.adyen-checkout__input.adyen-checkout__input--invalid{ + border-color:#d10244 +} +.adyen-checkout__input.adyen-checkout__input--valid{ + border-bottom-color:#04ba65 +} +.adyen-checkout__input--error{ + border-color:#d0021b +} +.adyen-checkout__input::-webkit-input-placeholder{ + color:#90a2bd; + font-weight:200 +} +.adyen-checkout__input::-ms-input-placeholder{ + color:#90a2bd; + font-weight:200 +} +.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; + border-color:transparent; + color:#687282; + cursor:default +} +.adyen-checkout__fieldset{ + color:#687282; + display:block; + padding-bottom:30px; + width:100% +} +.adyen-checkout__fieldset__title{ + color:#687282; + display:block; + font-size:11px; + font-weight:700; + letter-spacing:1px; + margin:0; + padding:0 0 20px; + text-transform:uppercase +} +.adyen-checkout__fieldset--readonly{ + color:#001b2b; + font-size:13px; + line-height:19px; + margin:0 +} +.adyen-checkout__open-invoice .adyen-checkout__checkbox--consent-checkbox{ + max-width:540px +} +.adyen-checkout__open-invoice .adyen-checkout__checkbox+.adyen-checkout__open-invoice .adyen-checkout__fieldset{ + padding-top:30px +} +.adyen-checkout__open-invoice .adyen-checkout__checkbox{ + margin:0 0 20px +} +.adyen-checkout__applepay__button{ + height:40px; + width:240px +} +.adyen-checkout__card-input__form{ + transition:opacity .25s ease-out +} +.adyen-checkout__card__exp-cvc{ + display:flex +} +.adyen-checkout__card__cardNumber{ + max-width:400px +} +.adyen-checkout__card__cardNumber__input{ + padding:5px 8px 5px 57px +} +.adyen-checkout__card__exp-date__input--oneclick{ + font-weight:400; + height:40px; + line-height:40px +} +.adyen-checkout__card__exp-cvc .adyen-checkout__field{ + margin-bottom:0; + margin-right:24px +} +.adyen-checkout__card-input .adyen-checkout__store-details{ + margin-top:16px +} +.adyen-checkout__giropay__results{ + background:#fff; + border:1px solid #b9c4c9; + 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; + font-weight:200; + padding:0 0 0 2px +} +.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__phone-input{ + display:flex +} +.adyen-checkout__phone-input__prefix{ + margin-right:.5em +} +.adyen-checkout__phone-input .adyen-checkout__field{ + margin-bottom:0 +} +.adyen-checkout__iban-input__number{ + padding:5px 36px 5px 8px; + text-transform:uppercase +} +.adyen-checkout__wechatpay{ + background:#fff; + border:1px solid #dde1e3; + border-radius:3px; + min-height:443px; + padding:40px; + text-align:center +} +.adyen-checkout__wechatpay__brand-logo{ + height:20px; + width:109px +} +.adyen-checkout__wechatpay__subtitle{ + margin-top:32px +} +.adyen-checkout__wechatpay__payment_amount,.adyen-checkout__wechatpay__subtitle{ + color:#001b2b; + font-size:16px; + line-height:19px +} +.adyen-checkout__wechatpay__progress{ + background:#d4d9db; + border-radius:25px; + height:4px; + margin:32px auto 12px; + padding-right:3%; + width:152px +} +.adyen-checkout__wechatpay__progress>span{ + background:#00a3ff; + border-radius:25px; + display:block; + height:100% +} +.adyen-checkout__wechatpay__countdown{ + color:#687282; + font-size:13px +} +.adyen-checkout__wechatpay .adyen-checkout__spinner__wrapper{ + margin:60px 0 +} +.adyen-checkout__alert{ + align-items:flex-start; + background-color:#00a3ff; + 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 * :before,.adyen-checkout__sdk :after{ + box-sizing:border-box +} +.adyen-checkout__payment-methods-list{ + border-radius:3px +} +.adyen-checkout__payment-methods-list--loading{ + -moz-user-select:none; + -ms-user-select:none; + -webkit-user-select:none; + pointer-events:none; + user-select:none +} +.adyen-checkout__link{ + color:#687282; + font-size:13px; + text-decoration:underline +} + +/* Checkout component Adyen styling end */ diff --git a/view/base/web/images/logos/ach.png b/view/base/web/images/logos/ach.png new file mode 100644 index 000000000..0fe08e8c0 Binary files /dev/null and b/view/base/web/images/logos/ach.png differ diff --git a/view/base/web/images/logos/billdesk_online.png b/view/base/web/images/logos/billdesk_online.png new file mode 100644 index 000000000..452bc17c4 Binary files /dev/null and b/view/base/web/images/logos/billdesk_online.png differ diff --git a/view/base/web/images/logos/billdesk_upi.png b/view/base/web/images/logos/billdesk_upi.png new file mode 100644 index 000000000..31ca93eab Binary files /dev/null and b/view/base/web/images/logos/billdesk_upi.png differ diff --git a/view/base/web/images/logos/billdesk_wallet.png b/view/base/web/images/logos/billdesk_wallet.png new file mode 100644 index 000000000..a572a8fa8 Binary files /dev/null and b/view/base/web/images/logos/billdesk_wallet.png differ diff --git a/view/base/web/images/logos/cc_border.png b/view/base/web/images/logos/cc_border.png new file mode 100644 index 000000000..e8f178f09 Binary files /dev/null and b/view/base/web/images/logos/cc_border.png differ diff --git a/view/base/web/images/logos/doku_alfamart.png b/view/base/web/images/logos/doku_alfamart.png new file mode 100644 index 000000000..334672500 Binary files /dev/null and b/view/base/web/images/logos/doku_alfamart.png differ diff --git a/view/base/web/images/logos/doku_bca_va.png b/view/base/web/images/logos/doku_bca_va.png new file mode 100644 index 000000000..e7fc3f586 Binary files /dev/null and b/view/base/web/images/logos/doku_bca_va.png differ diff --git a/view/base/web/images/logos/doku_cimb_va.png b/view/base/web/images/logos/doku_cimb_va.png new file mode 100644 index 000000000..ba1ef4c46 Binary files /dev/null and b/view/base/web/images/logos/doku_cimb_va.png differ diff --git a/view/base/web/images/logos/doku_danamon_va.png b/view/base/web/images/logos/doku_danamon_va.png new file mode 100644 index 000000000..4790af9ff Binary files /dev/null and b/view/base/web/images/logos/doku_danamon_va.png differ diff --git a/view/base/web/images/logos/doku_indomaret.png b/view/base/web/images/logos/doku_indomaret.png new file mode 100644 index 000000000..bc0b0fa10 Binary files /dev/null and b/view/base/web/images/logos/doku_indomaret.png differ diff --git a/view/base/web/images/logos/doku_permata_lite_atm.png b/view/base/web/images/logos/doku_permata_lite_atm.png new file mode 100644 index 000000000..916a8d6c7 Binary files /dev/null and b/view/base/web/images/logos/doku_permata_lite_atm.png differ diff --git a/view/base/web/images/logos/doku_sinarmas_va.png b/view/base/web/images/logos/doku_sinarmas_va.png new file mode 100644 index 000000000..c2563ee79 Binary files /dev/null and b/view/base/web/images/logos/doku_sinarmas_va.png differ diff --git a/view/base/web/images/logos/doku_wallet.png b/view/base/web/images/logos/doku_wallet.png new file mode 100644 index 000000000..b6159e5f4 Binary files /dev/null and b/view/base/web/images/logos/doku_wallet.png differ diff --git a/view/base/web/images/logos/dragonpay_credits.png b/view/base/web/images/logos/dragonpay_credits.png new file mode 100644 index 000000000..62aa3c054 Binary files /dev/null and b/view/base/web/images/logos/dragonpay_credits.png differ diff --git a/view/base/web/images/logos/dragonpay_ebanking.png b/view/base/web/images/logos/dragonpay_ebanking.png new file mode 100644 index 000000000..62aa3c054 Binary files /dev/null and b/view/base/web/images/logos/dragonpay_ebanking.png differ diff --git a/view/base/web/images/logos/dragonpay_gcash.png b/view/base/web/images/logos/dragonpay_gcash.png new file mode 100644 index 000000000..63f9ef553 Binary files /dev/null and b/view/base/web/images/logos/dragonpay_gcash.png differ diff --git a/view/base/web/images/logos/dragonpay_otc_banking.png b/view/base/web/images/logos/dragonpay_otc_banking.png new file mode 100644 index 000000000..62aa3c054 Binary files /dev/null and b/view/base/web/images/logos/dragonpay_otc_banking.png differ diff --git a/view/base/web/images/logos/dragonpay_otc_non_banking.png b/view/base/web/images/logos/dragonpay_otc_non_banking.png new file mode 100644 index 000000000..62aa3c054 Binary files /dev/null and b/view/base/web/images/logos/dragonpay_otc_non_banking.png differ diff --git a/view/base/web/images/logos/dragonpay_otc_philippines.png b/view/base/web/images/logos/dragonpay_otc_philippines.png new file mode 100644 index 000000000..367bdec9b Binary files /dev/null and b/view/base/web/images/logos/dragonpay_otc_philippines.png differ diff --git a/view/base/web/images/logos/econtext_online.png b/view/base/web/images/logos/econtext_online.png new file mode 100644 index 000000000..c9e0bb3c2 Binary files /dev/null and b/view/base/web/images/logos/econtext_online.png differ diff --git a/view/base/web/images/logos/facilypay_3x.png b/view/base/web/images/logos/facilypay_3x.png new file mode 100644 index 000000000..21ade9efb Binary files /dev/null and b/view/base/web/images/logos/facilypay_3x.png differ diff --git a/view/base/web/images/logos/facilypay_4x.png b/view/base/web/images/logos/facilypay_4x.png new file mode 100644 index 000000000..21ade9efb Binary files /dev/null and b/view/base/web/images/logos/facilypay_4x.png differ diff --git a/view/base/web/images/logos/inicisIniPay_creditcard.png b/view/base/web/images/logos/inicisIniPay_creditcard.png new file mode 100644 index 000000000..b88779280 Binary files /dev/null and b/view/base/web/images/logos/inicisIniPay_creditcard.png differ diff --git a/view/base/web/images/logos/inicisMobile_creditcard.png b/view/base/web/images/logos/inicisMobile_creditcard.png new file mode 100644 index 000000000..b88779280 Binary files /dev/null and b/view/base/web/images/logos/inicisMobile_creditcard.png differ diff --git a/view/base/web/images/logos/inicis_creditcard.png b/view/base/web/images/logos/inicis_creditcard.png new file mode 100644 index 000000000..65853e555 Binary files /dev/null and b/view/base/web/images/logos/inicis_creditcard.png differ diff --git a/view/base/web/images/logos/ipay.png b/view/base/web/images/logos/ipay.png new file mode 100644 index 000000000..19c2dcc70 Binary files /dev/null and b/view/base/web/images/logos/ipay.png differ diff --git a/view/base/web/images/logos/molpay_cash.png b/view/base/web/images/logos/molpay_cash.png new file mode 100644 index 000000000..c3ee925a6 Binary files /dev/null and b/view/base/web/images/logos/molpay_cash.png differ diff --git a/view/base/web/images/logos/molpay_ebanking_MY.png b/view/base/web/images/logos/molpay_ebanking_MY.png new file mode 100644 index 000000000..c9e0bb3c2 Binary files /dev/null and b/view/base/web/images/logos/molpay_ebanking_MY.png differ diff --git a/view/base/web/images/logos/molpay_ebanking_TH.png b/view/base/web/images/logos/molpay_ebanking_TH.png new file mode 100644 index 000000000..c9e0bb3c2 Binary files /dev/null and b/view/base/web/images/logos/molpay_ebanking_TH.png differ diff --git a/view/base/web/images/logos/molpay_ebanking_VN.png b/view/base/web/images/logos/molpay_ebanking_VN.png new file mode 100644 index 000000000..c9e0bb3c2 Binary files /dev/null and b/view/base/web/images/logos/molpay_ebanking_VN.png differ diff --git a/view/base/web/images/logos/molpay_ebanking_fpx_MY.png b/view/base/web/images/logos/molpay_ebanking_fpx_MY.png new file mode 100644 index 000000000..c9e0bb3c2 Binary files /dev/null and b/view/base/web/images/logos/molpay_ebanking_fpx_MY.png differ diff --git a/view/base/web/images/logos/molpay_epay.png b/view/base/web/images/logos/molpay_epay.png new file mode 100644 index 000000000..c3583acca Binary files /dev/null and b/view/base/web/images/logos/molpay_epay.png differ diff --git a/view/base/web/images/logos/molpay_esapay.png b/view/base/web/images/logos/molpay_esapay.png new file mode 100644 index 000000000..151a52205 Binary files /dev/null and b/view/base/web/images/logos/molpay_esapay.png differ diff --git a/view/base/web/images/logos/molpay_rhb.png b/view/base/web/images/logos/molpay_rhb.png new file mode 100644 index 000000000..c1b1f5ec8 Binary files /dev/null and b/view/base/web/images/logos/molpay_rhb.png differ diff --git a/view/base/web/images/logos/molpay_wallet.png b/view/base/web/images/logos/molpay_wallet.png new file mode 100644 index 000000000..74064f8a6 Binary files /dev/null and b/view/base/web/images/logos/molpay_wallet.png differ diff --git a/view/base/web/images/logos/momo_wallet.png b/view/base/web/images/logos/momo_wallet.png new file mode 100644 index 000000000..c4a849779 Binary files /dev/null and b/view/base/web/images/logos/momo_wallet.png differ diff --git a/view/base/web/images/logos/neteller.png b/view/base/web/images/logos/neteller.png new file mode 100644 index 000000000..c89987e3a Binary files /dev/null and b/view/base/web/images/logos/neteller.png differ diff --git a/view/base/web/images/logos/paytm.png b/view/base/web/images/logos/paytm.png new file mode 100644 index 000000000..a49e51400 Binary files /dev/null and b/view/base/web/images/logos/paytm.png differ diff --git a/view/base/web/images/logos/ratepay.png b/view/base/web/images/logos/ratepay.png new file mode 100644 index 000000000..9edc5017a Binary files /dev/null and b/view/base/web/images/logos/ratepay.png differ diff --git a/view/base/web/images/logos/yandex_alfaclick.png b/view/base/web/images/logos/yandex_alfaclick.png new file mode 100644 index 000000000..9e39ba5c8 Binary files /dev/null and b/view/base/web/images/logos/yandex_alfaclick.png differ diff --git a/view/base/web/images/logos/yandex_cash.png b/view/base/web/images/logos/yandex_cash.png new file mode 100644 index 000000000..c65fd0935 Binary files /dev/null and b/view/base/web/images/logos/yandex_cash.png differ diff --git a/view/base/web/images/logos/yandex_money.png b/view/base/web/images/logos/yandex_money.png new file mode 100644 index 000000000..9d3558d9e Binary files /dev/null and b/view/base/web/images/logos/yandex_money.png differ diff --git a/view/base/web/images/logos/yandex_promsvyazbank.png b/view/base/web/images/logos/yandex_promsvyazbank.png new file mode 100644 index 000000000..a418e3cfc Binary files /dev/null and b/view/base/web/images/logos/yandex_promsvyazbank.png differ diff --git a/view/base/web/images/logos/yandex_sberbank.png b/view/base/web/images/logos/yandex_sberbank.png new file mode 100644 index 000000000..e3c60d7e9 Binary files /dev/null and b/view/base/web/images/logos/yandex_sberbank.png differ diff --git a/view/base/web/images/logos/yandex_webmoney.png b/view/base/web/images/logos/yandex_webmoney.png new file mode 100644 index 000000000..80004e027 Binary files /dev/null and b/view/base/web/images/logos/yandex_webmoney.png differ diff --git a/view/frontend/layout/adyen_process_redirect.xml b/view/frontend/layout/adyen_process_redirect.xml index 872919f7c..2dc6049b7 100755 --- a/view/frontend/layout/adyen_process_redirect.xml +++ b/view/frontend/layout/adyen_process_redirect.xml @@ -24,6 +24,6 @@ --> - + \ No newline at end of file diff --git a/view/frontend/layout/adyen_process_validate3d.xml b/view/frontend/layout/adyen_process_validate3d.xml deleted file mode 100755 index 64d750bcf..000000000 --- a/view/frontend/layout/adyen_process_validate3d.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/view/frontend/layout/checkout_index_index.xml b/view/frontend/layout/checkout_index_index.xml index b5be3a978..9e556212d 100755 --- a/view/frontend/layout/checkout_index_index.xml +++ b/view/frontend/layout/checkout_index_index.xml @@ -55,9 +55,6 @@ true - - true - true diff --git a/view/frontend/layout/checkout_onepage_success.xml b/view/frontend/layout/checkout_onepage_success.xml index ca8dfdbb8..7f16ed133 100644 --- a/view/frontend/layout/checkout_onepage_success.xml +++ b/view/frontend/layout/checkout_onepage_success.xml @@ -25,7 +25,7 @@ - + diff --git a/view/frontend/templates/checkout/success.phtml b/view/frontend/templates/checkout/success.phtml index 7043b6fc2..25bf0de25 100644 --- a/view/frontend/templates/checkout/success.phtml +++ b/view/frontend/templates/checkout/success.phtml @@ -25,11 +25,100 @@ * @var \Adyen\Payment\Block\Checkout\Success $block */ ?> -isBoletoPayment()) :?> -

- escapeHtml(__('Boleto PDF: ')); ?> - - escapeHtml(__('Click here to download the Boleto PDF')); ?> - -

+isBoletoPayment()) : ?> +

+ escapeHtml(__('Boleto PDF: ')); ?> + + escapeHtml(__('Click here to download the Boleto PDF')); ?> + +

+ +getBankTransferData())) : ?> + getBankTransferData(); + $order = $block->getOrder(); + ?> +

escapeHtml(__('Pay using Bank transfer')); ?>

+

escapeHtml(__('Please transfer the amount using the reference below to the following bank account')); ?>

+ + + getGrandTotal())) : ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
escapeHtml(__('Amount')); ?>formatPrice($order->getGrandTotal()); ?>
escapeHtml(__('With reference')); ?>
escapeHtml(__('Beneficiary Name')); ?>
escapeHtml(__('Bank')); ?>
escapeHtml(__('Bankaccount')); ?>
+ + +getMultibancoData())) : ?> + getMultibancoData(); + ?> +

escapeHtml(__('Pay using Multibanco')); ?>

+

escapeHtml(__('Please pay with the provided Multibanco reference and entity before payment deadline in order to complete our payment')); ?>

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
escapeHtml(__('Entity')); ?>
escapeHtml(__('Reference')); ?>
escapeHtml(__('Amount')); ?>
escapeHtml(__('Payment deadline')); ?> escapeHtml(__('Days')); ?>
+ + + \ No newline at end of file diff --git a/view/frontend/templates/info/adyen_hpp.phtml b/view/frontend/templates/info/adyen_hpp.phtml index 24a953db9..2c3caab46 100644 --- a/view/frontend/templates/info/adyen_hpp.phtml +++ b/view/frontend/templates/info/adyen_hpp.phtml @@ -28,20 +28,72 @@ $_info = $this->getInfo(); ?> -isPaymentSelectionOnAdyen();?> -
+ getBankTransferData())) : ?> + getBankTransferData(); + $order = $block->getOrder(); + ?> - -
escapeHtml($block->getMethod()->getTitle()) ?>
- +
escapeHtml(__('Pay using Bank transfer')); ?>
+
escapeHtml(__('Please transfer the amount using the reference below to the following bank account')); ?>
- getAdditionalInformation('method_title')):?> -
- getAdditionalInformation('brand_code')):?> -
- + getGrandTotal())) : ?> +
escapeHtml(__('Amount')); ?>
+
formatPrice($order->getGrandTotal()); ?>
+ + + +
escapeHtml(__('With reference')); ?>
+
+ + + +
escapeHtml(__('Beneficiary Name')); ?>
+
+ + + +
escapeHtml(__('Bank')); ?>
+
+ - + +
escapeHtml(__('Bankaccount')); ?>
+
+ + getMultibancoData())) : ?> + getMultibancoData(); + ?> +
escapeHtml(__('Pay using Multibanco')); ?>
+
escapeHtml(__('Please pay with the provided Multibanco reference and entity before payment deadline in order to complete our payment')); ?>
+ + +
escapeHtml(__('Entity')); ?>
+
+ + + +
escapeHtml(__('Reference')); ?>
+
+ + + +
escapeHtml(__('Amount')); ?>
+
+ + + +
escapeHtml(__('Deadline')); ?>
+
escapeHtml(__('Days')); ?>
+ + + getAdditionalInformation('method_title')): ?> +
+ getAdditionalInformation('brand_code')): ?> +
+ +
diff --git a/view/frontend/templates/info/adyen_sepa.phtml b/view/frontend/templates/info/adyen_sepa.phtml deleted file mode 100644 index 522eadb9a..000000000 --- a/view/frontend/templates/info/adyen_sepa.phtml +++ /dev/null @@ -1,34 +0,0 @@ - - */ - -// @codingStandardsIgnoreFile - -?> -getInfo(); -?> - -
- escapeHtml($this->getMethod()->getTitle()) ?>
-
escapeHtml($block->getMethod()->getTitle()) ?>
-
diff --git a/view/frontend/templates/redirect/hpp/form.phtml b/view/frontend/templates/redirect/hpp/form.phtml deleted file mode 100755 index 045a6902d..000000000 --- a/view/frontend/templates/redirect/hpp/form.phtml +++ /dev/null @@ -1,44 +0,0 @@ - - */ -?> - - - - - - -
- - getFormFields() as $field => $value) { - echo ''; - } - ?> -
- - - - diff --git a/view/frontend/templates/redirect/cc/3dform.phtml b/view/frontend/templates/redirect/redirect.phtml old mode 100755 new mode 100644 similarity index 53% rename from view/frontend/templates/redirect/cc/3dform.phtml rename to view/frontend/templates/redirect/redirect.phtml index e1c0b67f1..0c6f4b307 --- a/view/frontend/templates/redirect/cc/3dform.phtml +++ b/view/frontend/templates/redirect/redirect.phtml @@ -21,19 +21,28 @@ * Author: Adyen */ ?> - -
- - - - -
- \ No newline at end of file + +getRedirectMethod() == "GET") { ?> + + + + + +
+ + + + +
+ + \ No newline at end of file diff --git a/view/frontend/web/css/styles.css b/view/frontend/web/css/styles.css index 7306c84d0..da95958ec 100644 --- a/view/frontend/web/css/styles.css +++ b/view/frontend/web/css/styles.css @@ -71,7 +71,7 @@ } .checkout-payment-method .payment-method-title label div.adyen-sprite.adyen_cc { - background-position: 0 -272px; + background:url(../images/logos/cc_border.png) no-repeat; } .checkout-payment-method .payment-method-title label div.adyen-sprite.adyen_pos { @@ -82,10 +82,6 @@ background-position: 0 -1819px; } -.checkout-payment-method .payment-method-title label div.adyen-sprite.adyen_sepa { - background-position: 0 -1910px; -} - .checkout-payment-method .payment-method-title label div.adyen-sprite.adyen_hpp { background-position: 0 -272px; } @@ -164,858 +160,878 @@ 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; -} +/* + Custom style for ideal component + */ -.adyen-checkout__field { - display: block; - margin-bottom: 16px; +#iDealContainer .adyen-checkout__dropdown__button{ + padding: 0 0 0 8px; + max-width: 290px; } -.adyen-checkout__field--error input { - border-color: #d81b4a; - color: #d81b4a; +#iDealContainer .adyen-checkout__dropdown--large{ + margin-left: 21px; } -.adyen-checkout__field:last-child { +#iDealContainer .adyen-checkout__dropdown__element{ 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; -} +/* General styling for checkout */ -.adyen-checkout__helper-text { - color: #687282; +.payment-method-content .field input, .payment-method-content .field select{ + max-width: 168px; } -.adyen-checkout__label__text { - transition: color 0.2s ease-out; -} - -.adyen-checkout__label--focused .adyen-checkout__label__text { - color: #0077bb; +.adyen-checkout__link adyen-checkout__link--more-information{ + margin-bottom: 10px; } -.adyen-checkout__error-text, -.adyen-checkout__label__text--error { - color: #d81b4a; - font-weight: normal; +.message.error.hpp-message{ 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; +/* Checkout component Adyen styling start */ +.adyen-checkout__spinner__wrapper{ + align-items:center; + display:flex; + height:100%; + justify-content:center } - -.adyen-checkout__checkbox > input[type='checkbox'] { - position: absolute; - opacity: 0; - pointer-events: none; +.adyen-checkout__spinner__wrapper--inline{ + display:inline-block; + height:auto; + margin-right:8px } - -.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__spinner{ + -webkit-animation:rotateSpinner 2s infinite linear; + animation:rotateSpinner 2s infinite linear; + border:2px solid #00a3ff; + border-radius:50%; + border-top-color:transparent; + height:43px; + width:43px } - -.adyen-checkout__dropdown__element:last-child { - border-bottom: 0; +.adyen-checkout__spinner--large{ + height:43px; + width:43px } - -.adyen-checkout__dropdown__element:hover, -.adyen-checkout__dropdown__element:focus, -.adyen-checkout__dropdown__element:active { - background: #f0f2f4; +.adyen-checkout__spinner--small{ + height:16px; + width:16px } - -.adyen-checkout__dropdown__element:active, -.adyen-checkout__dropdown__element:focus { - border-top-color: #00a3ff; - border-bottom-color: #00a3ff; +.adyen-checkout__spinner--medium{ + height:28px; + width:28px } - -.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); +@-webkit-keyframes rotateSpinner{ + 0%{ + -webkit-transform:rotate(0deg); + transform:rotate(0deg) } - 100% { - -webkit-transform: scale3d(1, 1, 1); - transform: scale3d(1, 1, 1); + to{ + -webkit-transform:rotate(1turn); + transform:rotate(1turn) } } - -.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; +@keyframes rotateSpinner{ + 0%{ + -webkit-transform:rotate(0deg); + transform:rotate(0deg) + } + to{ + -webkit-transform:rotate(1turn); + transform:rotate(1turn) + } } - -/* - Custom style for ideal component - */ - -#iDealContainer .adyen-checkout__dropdown__button{ - padding: 0 0 0 8px; - max-width: 290px; +.adyen-checkout__pay-button{ + background:#001b2b; + border:0; + border-radius:3px; + box-shadow:0 3px 4px rgba(0,15,45,.2); + color:#fff; + cursor:pointer; + font-size:1em; + font-weight:700; + height:48px; + padding:15px; + transition:background .3s ease-out; + width:100% +} +.adyen-checkout__pay-button:disabled{ + -moz-user-select:all; + -ms-user-select:all; + -webkit-user-select:all; + background:#e6e9eb; + box-shadow:none; + cursor:not-allowed; + user-select:all +} +.adyen-checkout__pay-button--loading{ + -moz-user-select:none; + -ms-user-select:none; + -webkit-user-select:none; + background:#4c5f6b; + box-shadow:none; + outline:0; + pointer-events:none; + user-select:none +} +.adyen-checkout__pay-button .adyen-checkout__spinner{ + border-color:transparent #fff #fff; + border-width:3px +} +.adyen-checkout__pay-button__content{ + align-items:center; + display:flex; + justify-content:center +} +.adyen-checkout__payment-method{ + background:#fff; + border:1px solid #edf0f3; + cursor:pointer; + margin-top:-1px; + position:relative; + transition:opacity .3s ease-out; + width:100% +} +.adyen-checkout__payment-method:focus{ + outline:0 +} +.adyen-checkout__payment-method--selected+.adyen-checkout__payment-method,.adyen-checkout__payment-method:first-child{ + border-top-left-radius:3px; + border-top-right-radius:3px; + margin-top:0 +} +.adyen-checkout__payment-method--next-selected{ + border-bottom-left-radius:3px; + border-bottom-right-radius:3px +} +.adyen-checkout__payment-method--loading{ + opacity:.2 +} +.adyen-checkout__payment-method--selected.adyen-checkout__payment-method--loading{ + opacity:.9 +} +.adyen-checkout__payment-method--disabling{ + opacity:.5 +} +.adyen-checkout__payment-method__header{ + align-items:center; + color:#00202e; + display:flex; + font-size:16px; + font-weight:400; + padding:16px; + position:relative; + transition:background .1s ease-out; + width:100% +} +.adyen-checkout__payment-method__surcharge{ + color:#687282; + margin-left:5px +} +.adyen-checkout__payment-method--selected{ + background:#f7f8f9; + border:1px solid #d4d9db; + border-radius:3px; + cursor:default; + margin:8px 0; + transition:margin .15s cubic-bezier(.4,0,.2,1) 0ms,opacity .3s ease-out +} +.adyen-checkout__payment-method--selected .adyen-checkout__payment-method__header{ + font-weight:500 +} +.adyen-checkout__payment-method__details{ + padding:0 16px 16px +} +.adyen-checkout__payment-method__details__content{ + padding:6px 0 24px +} +.adyen-checkout__payment-method__image__wrapper{ + height:26px; + position:relative +} +.adyen-checkout__payment-method__image__wrapper:after{ + border:1px solid rgba(0,27,43,.17); + border-radius:3px; + content:""; + height:100%; + left:0; + position:absolute; + top:0; + width:100% +} +.adyen-checkout__payment-method__image{ + border-radius:3px +} +.adyen-checkout__payment-method__disable_oneclick{ + background-color:transparent; + border:none; + color:#687282; + cursor:pointer; + display:block; + font-size:13px; + padding:0; + position:absolute; + right:70px; + text-decoration:underline +} +.adyen-checkout__payment-method__disable_oneclick:focus{ + color:#00a3ff; + outline:0 +} +.adyen-checkout__payment-method__disable-confirmation{ + align-items:center; + background:#e6e9eb; + color:#001b2b; + display:flex; + font-size:15px; + justify-content:space-between; + margin-bottom:10px; + padding:8px 16px +} +.adyen-checkout__payment-method__disable-confirmation__buttons{ + display:flex +} +.adyen-checkout__payment-method__disable-confirmation__button{ + border:1px solid transparent; + border-radius:3px; + cursor:pointer; + font-size:13px; + line-height:15px; + margin:0 0 0 8px; + padding:8px +} +.adyen-checkout__payment-method__disable-confirmation__button--remove{ + background:#d10244; + border-color:#d10244; + color:#fff +} +.adyen-checkout__payment-method__disable-confirmation__button--cancel{ + background:transparent; + border-color:#001b2b; + color:#001b2b +} +.adyen-checkout__payment-method__radio{ + background-color:#fff; + border:1px solid #b9c4c9; + border-radius:50%; + box-shadow:inset 0 1px 3px rgba(0,27,43,.15); + height:18px; + position:absolute; + right:20px; + transition:border-color .3s ease-out; + width:18px +} +.adyen-checkout__payment-method__radio:after{ + -webkit-transform:translateY(-50%) scale(0); + background-color:#fff; + border-radius:50%; + box-shadow:0 1px 1px rgba(0,15,45,.25); + content:""; + display:block; + height:6px; + left:0; + margin:0 auto; + position:absolute; + right:0; + top:50%; + transform:translateY(-50%) scale(0); + transition:-webkit-transform .3s ease-out; + transition:transform .3s ease-out; + transition:transform .3s ease-out,-webkit-transform .3s ease-out; + width:6px +} +.adyen-checkout__payment-method__radio:hover{ + border-color:#00a3ff; + cursor:pointer +} +.adyen-checkout__payment-method__radio--selected{ + background-color:#00a3ff; + border:0 solid transparent; + box-shadow:inset 0 1px 2px rgba(0,0,0,.26); + transition:all .3s ease-out +} +.adyen-checkout__payment-method__radio--selected:after{ + -webkit-transform:translateY(-50%) scale(1); + transform:translateY(-50%) scale(1) +} +.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__helper-text,.adyen-checkout__label__text{ + color:#001b2b; + display:block; + font-size:13px; + font-weight:400; + line-height:13px; + padding-bottom:8px +} +.adyen-checkout__helper-text{ + color:#687282 +} +.adyen-checkout__label__text{ + transition:color .2s ease-out +} +.adyen-checkout__label--focused .adyen-checkout__label__text{ + color:#07b +} +.adyen-checkout__error-text,.adyen-checkout__label__text--error{ + align-items:center; + color:#d0021b; + display:flex; + font-size:12px; + font-weight:400; + margin-top:4px +} +.adyen-checkout__icon svg{ + fill:currentColor +} +.adyen-checkout__open-invoice .adyen-checkout__input--wrapper--socialSecurityNumber+.adyen-checkout__error-text{ + max-width:380px +} +.adyen-checkout__radio_group+.adyen-checkout-input__inline-validation{ + display:none +} +.adyen-checkout__radio_group__input{ + opacity:0; + position:absolute +} +.adyen-checkout__radio_group__label{ + display:block; + font-size:13px; + font-weight:400; + line-height:16px; + margin-bottom:8px; + padding-bottom:0; + padding-left:24px; + position:relative +} +.adyen-checkout__radio_group__label:before{ + background-color:#fff; + border:1px solid #b9c4c9; + border-radius:50%; + content:""; + height:16px; + left:0; + position:absolute; + top:0; + transition:border-color .3s ease-out; + width:16px +} +.adyen-checkout__radio_group__label:after{ + -webkit-transform:scale(0); + background-color:#fff; + border-radius:50%; + box-shadow:0 1px 1px rgba(0,15,45,.25); + content:""; + display:block; + height:6px; + left:5px; + margin:0 auto; + position:absolute; + top:5px; + transform:scale(0); + transition:-webkit-transform .3s ease-out; + transition:transform .3s ease-out; + transition:transform .3s ease-out,-webkit-transform .3s ease-out; + width:6px +} +.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:0 solid transparent; + box-shadow:inset 0 1px 2px rgba(0,0,0,.26); + transition:all .3s ease-out +} +.adyen-checkout__radio_group__input:checked+.adyen-checkout__radio_group__label:after{ + -webkit-transform:scale(1); + transform:scale(1) +} +.adyen-checkout__radio_group__label.adyen-checkout__radio_group__label--invalid:before{ + border:1px solid #d10244 +} +.adyen-checkout__checkbox{ + display:block +} +.adyen-checkout__checkbox>input[type=checkbox]{ + opacity:0; + pointer-events:none; + position:absolute +} +.adyen-checkout__checkbox__label{ + -moz-user-select:none; + -ms-user-select:none; + -webkit-user-select:none; + color:#001b2b; + cursor:pointer; + display:inline-block; + font-size:13px; + font-weight:400; + line-height:16px; + padding-left:24px; + position:relative; + user-select:none +} +.adyen-checkout__checkbox__input+span:before{ + -webkit-transform:rotate(37deg); + -webkit-transform-origin:100% 100%; + border-color:transparent #fff #fff transparent; + border-radius:0 2px 1px 2px; + border-style:solid; + border-width:1px 2px 2px 1px; + content:""; + height:11px; + left:1px; + opacity:0; + position:absolute; + top:2px; + transform:rotate(37deg); + transform-origin:100% 100%; + transition:opacity .2s ease-out; + width:6px; + z-index:1 +} +.adyen-checkout__checkbox__input:checked+.adyen-checkout__checkbox__label:before{ + opacity:1 +} +.adyen-checkout__checkbox__input+.adyen-checkout__checkbox__label:after{ + background-color:#fff; + border:1px solid #b9c4c9; + border-radius:3px; + content:""; + height:16px; + left:0; + position:absolute; + top:0; + transition:background .15s ease-out,border .05s ease-out,box-shadow .1s ease-out; + width:16px; + z-index:0 +} +.adyen-checkout__checkbox__input:checked+.adyen-checkout__checkbox__label:after{ + background-color:#00a3ff; + border:1px solid #00a3ff +} +.adyen-checkout__checkbox__input:focus+span:after{ + border:1px solid #00a3ff; + box-shadow:0 0 0 2px #91d7ff +} +.adyen-checkout__checkbox__input.adyen-checkout__checkbox__input--invalid+.adyen-checkout__checkbox__label:after{ + border:1px solid #d10244 +} +.adyen-checkout__dropdown{ + font-size:16px; + max-width:100%; + width:200px +} +.adyen-checkout__dropdown--small{ + width:130px +} +.adyen-checkout__dropdown--large{ + width:300px +} +.adyen-checkout__dropdown__button{ + background:#fff; + border:1px solid #b9c4c9; + border-radius:3px; + font-size:16px; + height:40px; + line-height:20px; + outline:0; + padding:9px 20px 9px 8px; + transition:border .2s ease-out,box-shadow .2s ease-out; + width:100% +} +.adyen-checkout__dropdown__button__icon{ + margin-right:8px; + max-height:20px; + max-width:32px +} +.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__button--readonly,.adyen-checkout__dropdown__button--readonly.adyen-checkout__dropdown__button--active{ + background:#e6e9eb; + color:#001b2b; + cursor:not-allowed +} +.adyen-checkout__dropdown__button--invalid{ + border-color:#d10244 +} +.adyen-checkout__dropdown__button__text{ + overflow:hidden; + text-overflow:ellipsis; + white-space:nowrap +} +.adyen-checkout__dropdown__list{ + border-radius:3px; + box-shadow:0 2px 7px rgba(0,15,45,.3); + margin-top:2px; + z-index:2 +} +.adyen-checkout__dropdown__list.adyen-checkout__dropdown__list--active{ + -webkit-animation:expand .1s ease-out; + animation:expand .1s ease-out +} +.adyen-checkout__dropdown__element{ + -ms-hyphens:auto; + -webkit-hyphens:auto; + border:1px solid transparent; + border-bottom-color:#e6e9eb; + cursor:pointer; + hyphens:auto; + line-height:20px; + outline:0; + padding:8px; + transition:background .2s ease-out,border-color .2s ease-out; + word-break:break-word +} +.adyen-checkout__dropdown__element:last-child{ + border-bottom:0 +} +.adyen-checkout__dropdown__element:active,.adyen-checkout__dropdown__element:focus,.adyen-checkout__dropdown__element:hover{ + background:#f0f2f4 +} +.adyen-checkout__dropdown__element:active,.adyen-checkout__dropdown__element:focus{ + border-bottom-color:#00a3ff; + border-top-color:#00a3ff +} +.adyen-checkout__dropdown__element__icon{ + margin-right:8px; + max-height:20px; + max-width:32px +} +@-webkit-keyframes expand{ + 0%{ + -webkit-transform:scaleY(0); + transform:scaleY(0) + } + to{ + -webkit-transform:scaleX(1); + transform:scaleX(1) + } } - -#iDealContainer .adyen-checkout__dropdown__element{ - margin-bottom: 0; +@keyframes expand{ + 0%{ + -webkit-transform:scaleY(0); + transform:scaleY(0) + } + to{ + -webkit-transform:scaleX(1); + transform:scaleX(1) + } } -.message.error.hpp-message{ - margin-top: 10px; - display: none; -} \ No newline at end of file +.adyen-checkout__dropdown+.adyen-checkout-input__inline-validation{ + right:32px +} +.adyen-checkout__select-list{ + margin:0; + padding:0 +} +.adyen-checkout__select-list__item{ + background:#fff; + border-top:1px solid #b9c4c9; + cursor:pointer; + display:inline-block; + font-size:16px; + line-height:20px; + outline:0; + padding:9px; + width:100% +} +.adyen-checkout__select-list__item:first-child{ + border-top:0 +} +.adyen-checkout__select-list__item:active,.adyen-checkout__select-list__item:focus,.adyen-checkout__select-list__item:hover{ + background:rgba(145,215,255,.5) +} +.adyen-checkout__select-list__item--selected{ + background:rgba(145,215,255,.5); + font-weight:700 +} +.adyen-checkout__input{ + background:#fff; + border:1px solid #b9c4c9; + border-radius:3px; + color:#001b2b; + display:block; + font-family:inherit; + font-size:16px; + height:40px; + outline:none; + padding:5px 8px; + position:relative; + transition:border .2s ease-out,box-shadow .2s ease-out; + width:200px +} +.adyen-checkout__input:required{ + box-shadow:none +} +.adyen-checkout__input--wrapper{ + display:inline-block; + position:relative +} +.adyen-checkout__input--wrapper--block{ + display:block +} +.adyen-checkout-input__inline-validation{ + -webkit-transform:translateY(-50%); + height:16px; + position:absolute; + right:14px; + top:50%; + transform:translateY(-50%); + width:16px +} +.adyen-checkout-input__inline-validation--valid{ + color:#039450 +} +.adyen-checkout-input__inline-validation--invalid{ + color:#d10244 +} +.adyen-checkout__input.adyen-checkout__input--small{ + width:130px +} +.adyen-checkout__input.adyen-checkout__input--large{ + width:300px +} +.adyen-checkout__input.adyen-checkout__input--invalid{ + border-color:#d10244 +} +.adyen-checkout__input.adyen-checkout__input--valid{ + border-bottom-color:#04ba65 +} +.adyen-checkout__input--error{ + border-color:#d0021b +} +.adyen-checkout__input::-webkit-input-placeholder{ + color:#90a2bd; + font-weight:200 +} +.adyen-checkout__input::-ms-input-placeholder{ + color:#90a2bd; + font-weight:200 +} +.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; + border-color:transparent; + color:#687282; + cursor:default +} +.adyen-checkout__fieldset{ + color:#687282; + display:block; + padding-bottom:30px; + width:100% +} +.adyen-checkout__fieldset__title{ + color:#687282; + display:block; + font-size:11px; + font-weight:700; + letter-spacing:1px; + margin:0; + padding:0 0 20px; + text-transform:uppercase +} +.adyen-checkout__fieldset--readonly{ + color:#001b2b; + font-size:13px; + line-height:19px; + margin:0 +} +.adyen-checkout__open-invoice .adyen-checkout__checkbox--consent-checkbox{ + max-width:540px +} +.adyen-checkout__open-invoice .adyen-checkout__checkbox+.adyen-checkout__open-invoice .adyen-checkout__fieldset{ + padding-top:30px +} +.adyen-checkout__open-invoice .adyen-checkout__checkbox{ + margin:0 0 20px +} +.adyen-checkout__applepay__button{ + height:40px; + width:240px +} +.adyen-checkout__card-input__form{ + transition:opacity .25s ease-out +} +.adyen-checkout__card__exp-cvc{ + display:flex +} +.adyen-checkout__card__cardNumber{ + max-width:400px +} +.adyen-checkout__card__cardNumber__input{ + padding:5px 8px 5px 57px +} +.adyen-checkout__card__exp-date__input--oneclick{ + font-weight:400; + height:40px; + line-height:40px +} +.adyen-checkout__card__exp-cvc .adyen-checkout__field{ + margin-bottom:0; + margin-right:24px +} +.adyen-checkout__card-input .adyen-checkout__store-details{ + margin-top:16px +} +.adyen-checkout__giropay__results{ + background:#fff; + border:1px solid #b9c4c9; + 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; + font-weight:200; + padding:0 0 0 2px +} +.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__phone-input{ + display:flex +} +.adyen-checkout__phone-input__prefix{ + margin-right:.5em +} +.adyen-checkout__phone-input .adyen-checkout__field{ + margin-bottom:0 +} +.adyen-checkout__iban-input__number{ + padding:5px 36px 5px 8px; + text-transform:uppercase +} +.adyen-checkout__wechatpay{ + background:#fff; + border:1px solid #dde1e3; + border-radius:3px; + min-height:443px; + padding:40px; + text-align:center +} +.adyen-checkout__wechatpay__brand-logo{ + height:20px; + width:109px +} +.adyen-checkout__wechatpay__subtitle{ + margin-top:32px +} +.adyen-checkout__wechatpay__payment_amount,.adyen-checkout__wechatpay__subtitle{ + color:#001b2b; + font-size:16px; + line-height:19px +} +.adyen-checkout__wechatpay__progress{ + background:#d4d9db; + border-radius:25px; + height:4px; + margin:32px auto 12px; + padding-right:3%; + width:152px +} +.adyen-checkout__wechatpay__progress>span{ + background:#00a3ff; + border-radius:25px; + display:block; + height:100% +} +.adyen-checkout__wechatpay__countdown{ + color:#687282; + font-size:13px +} +.adyen-checkout__wechatpay .adyen-checkout__spinner__wrapper{ + margin:60px 0 +} +.adyen-checkout__alert{ + align-items:flex-start; + background-color:#00a3ff; + 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 * :before,.adyen-checkout__sdk :after{ + box-sizing:border-box +} +.adyen-checkout__payment-methods-list{ + border-radius:3px +} +.adyen-checkout__payment-methods-list--loading{ + -moz-user-select:none; + -ms-user-select:none; + -webkit-user-select:none; + pointer-events:none; + user-select:none +} +.adyen-checkout__link{ + color:#687282; + font-size:13px; + text-decoration:underline +} + +/* Checkout component Adyen styling end */ diff --git a/view/frontend/web/js/view/payment/adyen-methods.js b/view/frontend/web/js/view/payment/adyen-methods.js index 5da008846..947c73ff2 100755 --- a/view/frontend/web/js/view/payment/adyen-methods.js +++ b/view/frontend/web/js/view/payment/adyen-methods.js @@ -44,10 +44,6 @@ define( type: 'adyen_hpp', component: 'Adyen_Payment/js/view/payment/method-renderer/adyen-hpp-method' }, - { - type: 'adyen_sepa', - component: 'Adyen_Payment/js/view/payment/method-renderer/adyen-sepa-method' - }, { type: 'adyen_boleto', component: 'Adyen_Payment/js/view/payment/method-renderer/adyen-boleto-method' diff --git a/view/frontend/web/js/view/payment/method-renderer/adyen-boleto-method.js b/view/frontend/web/js/view/payment/method-renderer/adyen-boleto-method.js index d6016e803..e5d94c552 100644 --- a/view/frontend/web/js/view/payment/method-renderer/adyen-boleto-method.js +++ b/view/frontend/web/js/view/payment/method-renderer/adyen-boleto-method.js @@ -29,12 +29,18 @@ define( function (_, $, quote, Component) { 'use strict'; var billingAddress = quote.billingAddress(); + var firstname = ''; + var lastname = ''; + if (!!billingAddress) { + firstname = billingAddress.firstname; + lastname = billingAddress.lastname; + } return Component.extend({ self: this, defaults: { template: 'Adyen_Payment/payment/boleto-form', - firstname: billingAddress.firstname, - lastname: billingAddress.lastname + firstname: self.firstname, + lastname: self.lastname }, initObservable: function () { this._super() diff --git a/view/frontend/web/js/view/payment/method-renderer/adyen-cc-method.js b/view/frontend/web/js/view/payment/method-renderer/adyen-cc-method.js index 8b751ac03..314678756 100755 --- a/view/frontend/web/js/view/payment/method-renderer/adyen-cc-method.js +++ b/view/frontend/web/js/view/payment/method-renderer/adyen-cc-method.js @@ -89,7 +89,6 @@ define( return; } - installments.setInstallments(0); // installments enabled ?? @@ -108,17 +107,25 @@ define( holderNameRequired: true, groupTypes: self.getAvailableCardTypeAltCodes(), - onChange: function (state) { - // isValid is not present on start - if (typeof state.isValid !== 'undefined' && state.isValid === false) { + onChange: function (state, component) { + if (!!state.isValid && !component.state.errors.encryptedSecurityCode) { + 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); + } else { self.creditCardDetailsValid(false); self.placeOrderAllowed(false); } - + }, + onBrand: function (state) { // 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) { @@ -154,7 +161,6 @@ define( } } - // 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"); @@ -164,21 +170,8 @@ define( } } else { self.creditCardType("") + installments.setInstallments(0); } - }, - 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); - }, - onError: function () { - self.creditCardDetailsValid(false); - self.placeOrderAllowed(false); } }); diff --git a/view/frontend/web/js/view/payment/method-renderer/adyen-hpp-method.js b/view/frontend/web/js/view/payment/method-renderer/adyen-hpp-method.js index c7b4626af..3591236a2 100755 --- a/view/frontend/web/js/view/payment/method-renderer/adyen-hpp-method.js +++ b/view/frontend/web/js/view/payment/method-renderer/adyen-hpp-method.js @@ -41,8 +41,13 @@ define( 'use strict'; var brandCode = ko.observable(null); var paymentMethod = ko.observable(null); - var dfValue = ko.observable(null); var messageComponents; + /** + * Shareble adyen checkout component + * @type {AdyenCheckout} + */ + var checkoutComponent; + return Component.extend({ self: this, defaults: { @@ -53,11 +58,15 @@ define( this._super() .observe([ 'brandCode', - 'issuerId', + 'issuer', 'gender', 'dob', 'telephone', - 'dfValue' + 'ownerName', + 'ibanNumber', + 'ssn', + 'bankAccountNumber', + 'bankLocationId' ]); return this; },initialize: function () { @@ -67,6 +76,14 @@ define( fullScreenLoader.startLoader(); + /** + * Create sherable checkout component + * @type {AdyenCheckout} + */ + self.checkoutComponent = new AdyenCheckout({ + locale: self.getLocale() + }); + // reset variable: adyenPaymentService.setPaymentMethods(); @@ -90,19 +107,6 @@ define( serviceUrl, JSON.stringify(payload) ).done( function (response) { - function waitForDfSet() { - // Wait for dfSet function to be loaded from df.js script - if (typeof dfSet == "undefined") { - setTimeout(waitForDfSet, 500); - return; - } - - // set device fingerprint value - dfSet('dfValue', 0); - // propagate this manually to knockoutjs otherwise it would not work - dfValue($('#dfValue').val()); - } - adyenPaymentService.setPaymentMethods(response); if (JSON.stringify(response).indexOf("ratepay") > -1) { var ratePayId = window.checkoutConfig.payment.adyenHpp.ratePayId; @@ -121,23 +125,16 @@ define( document.body.appendChild(ratepayScriptTag); } - // Load Adyen df.js script - var dfScriptTag = document.createElement('script'); - dfScriptTag.src = "//live.adyen.com/hpp/js/df.js?v=20171130"; - dfScriptTag.type = "text/javascript"; - document.body.appendChild(dfScriptTag); - waitForDfSet(); - // create component needs to be in initialize method var messageComponents = {}; _.map(response, function (value) { var messageContainer = new Messages(); - var name = 'messages-' + value.brandCode; + var name = 'messages-' + self.getBrandCodeFromPaymentMethod(value); var messagesComponent = { parent: self.name, - name: 'messages-' + value.brandCode, - displayArea: 'messages-' + value.brandCode, + name: 'messages-' + self.getBrandCodeFromPaymentMethod(value), + displayArea: 'messages-' + self.getBrandCodeFromPaymentMethod(value), component: 'Magento_Ui/js/view/messages', config: { messageContainer: messageContainer @@ -161,7 +158,16 @@ define( var paymentList = _.map(paymentMethods, function (value) { var result = {}; - result.value = value.brandCode; + + /** + * Returns the payment method's brand code (in checkout api it is the type) + * @returns {*} + */ + result.getBrandCode = function() { + return self.getBrandCodeFromPaymentMethod(value); + }; + + result.value = result.getBrandCode(); result.name = value; result.method = self.item.method; /** @@ -174,13 +180,20 @@ define( return self.item.method; }; result.validate = function () { - return self.validate(value.brandCode); + return self.validate(result.getBrandCode()); }; result.placeRedirectOrder = function placeRedirectOrder(data) { return self.placeRedirectOrder(data); }; - result.isPlaceOrderActionAllowed = function(bool) { - return self.isPlaceOrderActionAllowed(bool); + /** + * Set and get if the place order action is allowed + * Sets the placeOrderAllowed observable and the original isPlaceOrderActionAllowed as well + * @param bool + * @returns {*} + */ + result.isPlaceOrderAllowed = function(bool) { + self.isPlaceOrderActionAllowed(bool); + return result.placeOrderAllowed(bool); }; /** @@ -196,48 +209,152 @@ define( result.afterPlaceOrder = function() { return self.afterPlaceOrder(); }; + /** + * Checks if payment method is open invoice + * @returns {*|isPaymentMethodOpenInvoiceMethod} + */ result.isPaymentMethodOpenInvoiceMethod = function () { return value.isPaymentMethodOpenInvoiceMethod; }; + /** + * Checks if payment method is open invoice but not in the list below + * [klarna, afterpay] + * @returns {boolean} + */ + result.isPaymentMethodOtherOpenInvoiceMethod = function () { + if ( + !result.isPaymentMethodAfterPay() && + !result.isPaymentMethodKlarna() && + !result.isPaymentMethodAfterPayTouch() && + value.isPaymentMethodOpenInvoiceMethod + ) { + return true; + } + + return false; + }; + /** + * Checks if payment method is klarna + * @returns {boolean} + */ + result.isPaymentMethodKlarna = function () { + if (result.getBrandCode() === "klarna") { + return true; + } + + return false; + }; + /** + * Checks if payment method is after pay + * @returns {boolean} + */ + result.isPaymentMethodAfterPay = function () { + if (result.getBrandCode() === "afterpay_default") { + return true; + } + + return false; + }; + /** + * Checks if payment method is after pay touch + * @returns {boolean} + */ + result.isPaymentMethodAfterPayTouch = function () { + if (result.getBrandCode() === "afterpaytouch") { + return true; + } + + return false; + }; + /** + * Get personal number (SSN) length based on the buyer's country + * @returns {number} + */ result.getSsnLength = function () { if (quote.billingAddress().countryId == "NO") { - //5 digits for Norway - return 5; + //14 digits for Norway Ã…Ã…Ã…Ã…MMDD-XXXXX + return 14; } else { - //4 digits for other Nordic countries - return 4; + //13 digits for other Nordic countries Ã…Ã…Ã…Ã…MMDD-XXXX + return 13; } }; - result.isIssuerListAvailable = function () { - if (value.hasOwnProperty("issuers") && value.issuers.length > 0) { + /** + * Get max length for the Bank account number + */ + result.getBankAccountNumberMaxLength = function () { + return 17; + }; + /** + * Checks if the payment method has issuers property available + * @returns {boolean} + */ + result.hasIssuersProperty = function () { + if ( + typeof value.details !== 'undefined' && + typeof value.details[0].items !== 'undefined' && + value.details[0].key == 'issuer' + ) { return true; } return false; }; - // Can be removed after checkout api feature branch goes live since the issuerId key is changed to - // id there and just use the value.issuers in the component - result.getIssuerListForComponent = function() { - if (result.isIssuerListAvailable()) { - return _.map(value.issuers, function (issuer, key) { - return { - "id": issuer.issuerId, - "name": issuer.name - }; - }); + /** + * Checks if the payment method has issuer(s) available + * @returns {boolean} + */ + result.hasIssuersAvailable = function () { + if (result.hasIssuersProperty() && value.details[0].items.length > 0) { + return true; + } + + return false; + }; + /** + * Returns the issuers for a payment method + * @returns {*} + */ + result.getIssuers = function() { + if (result.hasIssuersAvailable()) { + return value.details[0].items; } return []; }; + /** + * Checks if payment method is iDeal + * @returns {boolean} + */ result.isIdeal = function () { - if (value.brandCode.indexOf("ideal") >= 0) { + if (result.getBrandCode().indexOf("ideal") >= 0) { return true; } return false; }; + /** + * Checks if payment method is ACH + * @returns {boolean} + */ + result.isAch = function () { + if (result.getBrandCode().indexOf("ach") == 0) { + return true; + } + + return false; + }; + /** + * Checks if payment method is sepa direct debit + */ + result.isSepaDirectDebit = function () { + if (result.getBrandCode().indexOf("sepadirectdebit") >= 0) { + return true; + } + return false; + }; /** * Renders the secure fields, * creates the ideal component, @@ -246,39 +363,108 @@ define( result.renderIdealComponent = function () { result.isPlaceOrderAllowed(false); - var secureFieldsNode = document.getElementById('iDealContainer'); + var idealNode = document.getElementById('iDealContainer'); - var checkout = new AdyenCheckout({ - locale: self.getLocale() + var ideal = self.checkoutComponent.create('ideal', { + items: result.getIssuers(), + onChange: function (state) { + if (!!state.isValid) { + result.issuer(state.data.issuer); + result.isPlaceOrderAllowed(true); + + } else { + result.isPlaceOrderAllowed(false); + } + } }); - var ideal = checkout.create('ideal', { - items: result.getIssuerListForComponent(), + ideal.mount(idealNode); + }; + + /** + * Creates the sepa direct debit component, + * sets up the callbacks for sepa components + */ + result.renderSepaDirectDebitComponent = function () { + result.isPlaceOrderAllowed(false); + + var sepaDirectDebitNode = document.getElementById('sepaDirectDebitContainer'); + + var sepaDirectDebit = self.checkoutComponent.create('sepadirectdebit', { + countryCode: self.getLocale(), onChange: function (state) { - // isValid is not present on start - if (typeof state.isValid !== 'undefined' && state.isValid === false) { + if (!!state.isValid) { + result.ownerName(state.data["sepa.ownerName"]); + result.ibanNumber(state.data["sepa.ibanNumber"]); + result.isPlaceOrderAllowed(true); + } else { result.isPlaceOrderAllowed(false); } - }, - onValid: function (state) { - result.issuerId(state.data.issuer); - result.isPlaceOrderAllowed(true); - }, - onError: function (state) { - result.isPlaceOrderAllowed(false); } }); - ideal.mount(secureFieldsNode); + sepaDirectDebit.mount(sepaDirectDebitNode); + }; + + /** + * Creates the klarna component, + * sets up the callbacks for klarna components + */ + result.renderKlarnaComponent = function () { + + var klarnaNode = document.getElementById('klarnaContainer'); + + var klarna = self.checkoutComponent.create('klarna', { + countryCode: self.getLocale(), + details: self.filterOutOpenInvoiceComponentDetails(value.details), + visibility: { + personalDetails: "editable" + }, + onChange: function (state) { + if (!!state.isValid) { + result.dob(state.data.personalDetails.dateOfBirth); + result.telephone(state.data.personalDetails.telephoneNumber); + result.gender(state.data.personalDetails.gender); + result.isPlaceOrderAllowed(true); + } else { + result.isPlaceOrderAllowed(false); + } + } + }).mount(klarnaNode); + }; + + /** + * Creates the afterpay component, + * sets up the callbacks for klarna components + */ + result.renderAfterPayComponent = function () { + + var afterPay = self.checkoutComponent.create('afterpay', { + countryCode: self.getLocale(), + details: self.filterOutOpenInvoiceComponentDetails(value.details), + visibility: { + personalDetails: "editable" + }, + onChange: function (state) { + if (!!state.isValid) { + result.dob(state.data.personalDetails.dateOfBirth); + result.telephone(state.data.personalDetails.telephoneNumber); + result.gender(state.data.personalDetails.gender); + result.isPlaceOrderAllowed(true); + } else { + result.isPlaceOrderAllowed(false); + } + } + }).mount(document.getElementById('afterPayContainer')); }; - if (value.hasOwnProperty("issuers")) { - if (value.issuers.length == 0) { + if (result.hasIssuersProperty()) { + if (!result.hasIssuersAvailable()) { return false; } - result.issuerIds = value.issuers; - result.issuerId = ko.observable(null); + result.issuerIds = result.getIssuers(); + result.issuer = ko.observable(null); } else if (value.isPaymentMethodOpenInvoiceMethod) { result.telephone = ko.observable(quote.shippingAddress().telephone); result.gender = ko.observable(window.checkoutConfig.payment.adyenHpp.gender); @@ -289,17 +475,8 @@ define( result.getRatePayDeviceIdentToken = function () { return window.checkoutConfig.payment.adyenHpp.deviceIdentToken; }; - result.showGender = function () { - return window.checkoutConfig.payment.adyenHpp.showGender; - }; - result.showDob = function () { - return window.checkoutConfig.payment.adyenHpp.showDob; - }; - result.showTelephone = function () { - return window.checkoutConfig.payment.adyenHpp.showTelephone; - }; result.showSsn = function () { - if (value.brandCode.indexOf("klarna") >= 0) { + if (result.getBrandCode().indexOf("klarna") >= 0) { var ba = quote.billingAddress(); if (ba != null) { var nordicCountriesList = window.checkoutConfig.payment.adyenHpp.nordicCountries; @@ -310,6 +487,13 @@ define( } return false; }; + } else if (result.isSepaDirectDebit()) { + result.ownerName = ko.observable(null); + result.ibanNumber = ko.observable(null); + } else if (result.isAch()) { + result.ownerName = ko.observable(null); + result.bankAccountNumber = ko.observable(null); + result.bankLocationId = ko.observable(null); } return result; @@ -343,12 +527,10 @@ define( var additionalData = {}; additionalData.brand_code = self.value; - additionalData.df_value = dfValue(); - if (self.isIssuerListAvailable()) { - additionalData.issuer_id = this.issuerId(); - } - else if (self.isPaymentMethodOpenInvoiceMethod()) { + if (self.hasIssuersAvailable()) { + additionalData.issuer_id = this.issuer(); + } else if (self.isPaymentMethodOpenInvoiceMethod()) { additionalData.gender = this.gender(); additionalData.dob = this.dob(); additionalData.telephone = this.telephone(); @@ -356,6 +538,13 @@ define( if (brandCode() == "ratepay") { additionalData.df_value = this.getRatePayDeviceIdentToken(); } + } else if (self.isSepaDirectDebit()) { + additionalData.ownerName = this.ownerName(); + additionalData.ibanNumber = this.ibanNumber(); + } else if (self.isAch()) { + additionalData.bankAccountOwnerName = this.ownerName(); + additionalData.bankAccountNumber = this.bankAccountNumber(); + additionalData.bankLocationId = this.bankLocationId(); } data.additional_data = additionalData; @@ -415,6 +604,7 @@ define( $("#messages-" + brandCode()).slideUp(); }, 10000); self.isPlaceOrderActionAllowed(true); + fullScreenLoader.stopLoader(); } ).done( function () { @@ -436,9 +626,6 @@ define( } return null; }), - isPaymentMethodSelectionOnAdyen: function () { - return window.checkoutConfig.payment.adyenHpp.isPaymentMethodSelectionOnAdyen; - }, isIconEnabled: function () { return window.checkoutConfig.payment.adyen.showLogo; }, @@ -452,11 +639,63 @@ define( return true; }, + /** + * Returns the payment method's brand code using the payment method from the response object + * (in checkout api it is the type) + * @returns {*} + */ + getBrandCodeFromPaymentMethod: function (paymentMethod) { + if (typeof paymentMethod.type !== 'undefined') { + return paymentMethod.type; + } + + return ''; + }, getRatePayDeviceIdentToken: function () { return window.checkoutConfig.payment.adyenHpp.deviceIdentToken; }, getLocale: function () { return window.checkoutConfig.payment.adyenHpp.locale; + }, + /** + * In the open invoice components we need to validate only the personal details and only the + * dateOfBirth, telephoneNumber and gender if it's set in the admin + * @param details + * @returns {Array} + */ + filterOutOpenInvoiceComponentDetails: function (details) { + var self = this; + var filteredDetails = _.map(details, function (parentDetail) { + if (parentDetail.key == "personalDetails") { + var detailObject = _.map(parentDetail.details, function (detail) { + if (detail.key == 'dateOfBirth' || + detail.key == 'telephoneNumber' || + detail.key == 'gender') { + return detail; + } + }); + + if (!!detailObject) { + return { + "key": parentDetail.key, + "type": parentDetail.type, + "details": self.filterUndefinedItemsInArray(detailObject) + }; + } + } + }); + + return self.filterUndefinedItemsInArray(filteredDetails); + }, + /** + * Helper function to filter out the undefined items from an array + * @param arr + * @returns {*} + */ + filterUndefinedItemsInArray: function(arr) { + return arr.filter(function(item){ + return typeof item !== 'undefined'; + }); } }); } diff --git a/view/frontend/web/js/view/payment/method-renderer/adyen-oneclick-method.js b/view/frontend/web/js/view/payment/method-renderer/adyen-oneclick-method.js index d64760399..8b1baf3da 100755 --- a/view/frontend/web/js/view/payment/method-renderer/adyen-oneclick-method.js +++ b/view/frontend/web/js/view/payment/method-renderer/adyen-oneclick-method.js @@ -100,6 +100,13 @@ define( getAdyenBillingAgreements: function () { var self = this; + // shareable adyen checkout component + var checkout = new AdyenCheckout({ + locale: self.getLocale(), + originKey: self.getOriginKey(), + loadingContext: self.getLoadingContext() + }); + // convert to list so you can iterate var paymentList = _.map(window.checkoutConfig.payment.adyenOneclick.billingAgreements, function (value) { @@ -211,17 +218,10 @@ define( } 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") { + if (self.agreement_data.variant == "maestro") { // for maestro cvc is optional self.placeOrderAllowed(true); } @@ -231,19 +231,9 @@ define( 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" - } - ], + details: self.getOneclickDetails(), storedDetails: { "card": { "expiryMonth": self.agreement_data.card.expiryMonth, @@ -252,8 +242,11 @@ define( "number": self.agreement_data.card.number } }, - onChange: function (state) { + onChange: function (state, component) { if (state.isValid) { + self.placeOrderAllowed(true); + isValid(true); + if (typeof state.data !== 'undefined' && typeof state.data.encryptedSecurityCode !== 'undefined' ) { @@ -261,26 +254,20 @@ define( } } else { self.encryptedCreditCardVerificationNumber = ''; - // onChange is called on the startup so make sure maestro has always optional cvc field + if (self.agreement_data.variant != "maestro") { self.placeOrderAllowed(false); isValid(false); } } - }, - onValid: function (state) { - if (state.isValid) { - self.placeOrderAllowed(true); - isValid(true); - } else { + + // When we move to the component v2.2 it should be removed + if (self.agreement_data.variant == "maestro" && + component.state.errors.encryptedSecurityCode + ) { + self.placeOrderAllowed(false); isValid(false); } - return; - }, - onError: function (data) { - self.placeOrderAllowed(false); - isValid(false); - return; } }) .mount(oneClickCardNode); @@ -288,6 +275,27 @@ define( window.adyencheckout = oneClickCard; }, + /** + * We use the billingAgreements to save the oneClick stored payments but we don't store the + * details object that we get from the paymentMethods call. This function is a fix for BCMC. + * When we render the stored payments dynamically from the paymentMethods call response it + * should be removed + * @returns {*} + */ + getOneclickDetails: function() { + var self = this; + + if (self.agreement_data.variant === 'bcmc') { + return []; + } else { + return [ + { + "key": "cardDetails.cvc", + "type": "cvc" + } + ]; + } + }, /** * Builds the payment details part of the payment information reqeust * @@ -328,15 +336,6 @@ define( 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() }, @@ -346,6 +345,9 @@ define( getMessageContainer: function () { return messageContainer; }, + getOriginKey:function () { + return self.getOriginKey(); + }, isPlaceOrderActionAllowed: function () { return self.isPlaceOrderActionAllowed(); // needed for placeOrder method }, @@ -434,6 +436,15 @@ define( }, hasVerification: function () { return window.checkoutConfig.payment.adyenOneclick.hasCustomerInteraction; + }, + getLocale: function () { + return window.checkoutConfig.payment.adyenOneclick.locale; + }, + getOriginKey: function () { + return window.checkoutConfig.payment.adyenOneclick.originKey; + }, + getLoadingContext: function () { + return window.checkoutConfig.payment.adyenOneclick.checkoutUrl; } }); } diff --git a/view/frontend/web/js/view/payment/method-renderer/adyen-sepa-method.js b/view/frontend/web/js/view/payment/method-renderer/adyen-sepa-method.js deleted file mode 100644 index 2d01a84e6..000000000 --- a/view/frontend/web/js/view/payment/method-renderer/adyen-sepa-method.js +++ /dev/null @@ -1,110 +0,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 - */ -define( - [ - 'underscore', - 'jquery', - 'Magento_Checkout/js/model/quote', - 'Magento_Payment/js/view/payment/cc-form' - ], - function (_, $, quote, Component) { - 'use strict'; - var billingAddress = quote.billingAddress(); - return Component.extend({ - self: this, - defaults: { - template: 'Adyen_Payment/payment/sepa-form', - country: billingAddress.countryId - }, - initObservable: function () { - this._super() - .observe([ - 'accountName', - 'iban', - 'country', - 'setAcceptSepa' - ]); - return this; - }, - /** - * @returns {Boolean} - */ - isShowLegend: function () { - return true; - }, - setPlaceOrderHandler: function (handler) { - this.placeOrderHandler = handler; - }, - setValidateHandler: function (handler) { - this.validateHandler = handler; - }, - getCode: function () { - return 'adyen_sepa'; - }, - getData: function () { - return { - 'method': this.item.method, - 'additional_data': { - 'account_name': this.accountName(), - 'iban': this.iban(), - 'country': this.country(), - 'accept_sepa': this.setAcceptSepa() - } - }; - }, - isActive: function () { - return true; - }, - getControllerName: function () { - return window.checkoutConfig.payment.iframe.controllerName[this.getCode()]; - }, - getPlaceOrderUrl: function () { - return window.checkoutConfig.payment.iframe.placeOrderUrl[this.getCode()]; - }, - context: function () { - return this; - }, - validate: function () { - var form = 'form[data-role=adyen-sepa-form]'; - - var validate = $(form).validation() && $(form).validation('isValid'); - - if (!validate) { - return false; - } - - return true; - }, - showLogo: function () { - return window.checkoutConfig.payment.adyen.showLogo; - }, - getCountries: function () { - return _.map(window.checkoutConfig.payment.adyenSepa.countries, function (value, key) { - return { - 'key': key, - 'value': value - } - }); - } - }); - } -); diff --git a/view/frontend/web/template/payment/boleto-form.html b/view/frontend/web/template/payment/boleto-form.html index 126960bbb..a319dac09 100755 --- a/view/frontend/web/template/payment/boleto-form.html +++ b/view/frontend/web/template/payment/boleto-form.html @@ -141,13 +141,6 @@ - - - - - - -
diff --git a/view/frontend/web/template/payment/hpp-form.html b/view/frontend/web/template/payment/hpp-form.html index f2b1f4afe..44e1e11eb 100755 --- a/view/frontend/web/template/payment/hpp-form.html +++ b/view/frontend/web/template/payment/hpp-form.html @@ -22,129 +22,182 @@ */ --> - - -
-
- - -