We will be off from 27/1 (Monday) to 31/1 (Friday) (GMT +7) for our Tet Holiday (Lunar New Year) in our country

Commit 2b02743e authored by rikterbeek's avatar rikterbeek

added info blocks for HPP and Cc, fix title for adyen cc in frontend, added...

added info blocks for HPP and Cc, fix title for adyen cc in frontend, added support for 3D secure creditcard payments, fixes some notifications handler, pspreference set on additionalData by notification so info blocks can show link to pspreference on adyen side
parent 0a67b506
......@@ -11,9 +11,7 @@ class Cc extends \Magento\Payment\Block\Info
/**
* @var string
*/
protected $_template = 'Adyen_Payment::info/cc.phtml';
protected $_template = 'Adyen_Payment::info/adyen_cc.phtml';
/**
* @return string
......
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Adyen\Payment\Block\Info;
class Hpp extends \Magento\Payment\Block\Info
{
/**
* @var string
*/
protected $_template = 'Adyen_Payment::info/adyen_hpp.phtml';
/**
* @return string
*/
// public function toPdf()
// {
// $this->setTemplate('Magento_OfflinePayments::info/pdf/checkmo.phtml');
// return $this->toHtml();
// }
}
<?php
namespace Adyen\Payment\Block;
use Symfony\Component\Config\Definition\Exception\Exception;
class Validate3d extends \Magento\Payment\Block\Form
{
protected $_orderFactory;
/**
* @var \Magento\Checkout\Model\Session
*/
protected $_checkoutSession;
protected $_order;
/**
* Constructor
*
* @param \\Magento\Framework\View\Element\Template\Context $context
* @param array $data
*/
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;
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;
}
public function getIssuerUrl()
{
return $this->_order->getPayment()->getAdditionalInformation('issuerUrl');
}
public function getPaReq()
{
return $this->_order->getPayment()->getAdditionalInformation('paRequest');
}
public function getMd()
{
return $this->_order->getPayment()->getAdditionalInformation('md');
}
public function getTermUrl()
{
return $this->getUrl('adyen/process/validate3d');
}
}
\ No newline at end of file
......@@ -65,21 +65,8 @@ class Result extends \Magento\Framework\App\Action\Action
$session->restoreQuote();
$order = $this->_order;
$orderStatus = $this->_adyenHelper->getAdyenAbstractConfigData('payment_cancelled');
$order->setActionFlag($orderStatus, true);
switch ($orderStatus) {
case \Magento\Sales\Model\Order::STATE_HOLDED:
if ($order->canHold()) {
$order->hold()->save();
}
break;
default:
if($order->canCancel()) {
$order->cancel()->save();
}
break;
}
$this->_adyenHelper->cancelOrder($order);
if(isset($response['authResult']) && $response['authResult'] == \Adyen\Payment\Model\Notification::CANCELLED) {
$this->messageManager->addError(__('You have cancelled the order. Please try again'));
......@@ -161,7 +148,7 @@ class Result extends \Magento\Framework\App\Action\Action
$paymentMethod = isset($response['paymentMethod']) ? trim($response['paymentMethod']) : '';
$pspReference = isset($response['pspReference']) ? trim($response['pspReference']) : '';
$type = 'Adyen Result URL Notification(s):';
$type = 'Adyen Result URL response:';
$comment = __('%1 <br /> authResult: %2 <br /> pspReference: %3 <br /> paymentMethod: %4', $type, $authResult, $pspReference, $paymentMethod);
$history = $this->_orderHistoryFactory->create()
......@@ -173,6 +160,9 @@ class Result extends \Magento\Framework\App\Action\Action
$history->save();
// needed becuase then we need to save $order objects
$order->setAdyenResulturlEventCode($authResult);
switch ($authResult) {
......
<?php
namespace Adyen\Payment\Controller\Process;
class Validate3d extends \Magento\Framework\App\Action\Action
{
/**
* @var \Magento\Sales\Model\OrderFactory
*/
protected $_orderFactory;
protected $_order;
protected $_adyenLogger;
protected $_adyenHelper;
/**
* @param \Magento\Framework\App\Action\Context $context
* @param \Magento\Customer\Model\Session $customerSession
*/
public function __construct(
\Magento\Framework\App\Action\Context $context,
\Adyen\Payment\Logger\AdyenLogger $adyenLogger,
\Adyen\Payment\Helper\Data $adyenHelper
) {
parent::__construct($context);
$this->_adyenLogger = $adyenLogger;
$this->_adyenHelper = $adyenHelper;
}
public function execute()
{
$this->_adyenLogger->critical("IN Execute validate3d:");
// check if 3d is active
$order = $this->_getOrder();
$active = $order->getPayment()->getAdditionalInformation('3dActive');
$md = $order->getPayment()->getAdditionalInformation('md');
// check if 3D secure is active. If not just go to success page
if($active) {
// check if it is already processed
if ($this->getRequest()->isPost()) {
$requestMD = $this->getRequest()->getPost('MD');
$requestPaRes = $this->getRequest()->getPost('PaRes');
if ($requestMD == $md) {
$order->getPayment()->setAdditionalInformation('paResponse', $requestPaRes);
try {
$result = $order->getPayment()->getMethodInstance()->authorise3d($order->getPayment());
} catch (Exception $e) {
$result = 'Refused';
}
// check if authorise3d was successful
if ($result == 'Authorised') {
$order->addStatusHistoryComment(__('3D-secure validation was successful'))->save();
$this->_redirect('checkout/onepage/success');
}
else {
$order->addStatusHistoryComment(__('3D-secure validation was unsuccessful.'))->save();
$this->_adyenHelper->cancelOrder($order);
}
}
} else {
$order->addStatusHistoryComment(__('Customer was redirected to bank for 3D-secure validation.'))->save();
$this->_view->loadLayout();
$this->_view->getLayout()->initMessages();
$this->_view->renderLayout();
}
} else {
$this->_redirect('checkout/onepage/success/');
}
}
/**
* 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');
}
}
\ No newline at end of file
......@@ -207,6 +207,25 @@ class Data extends AbstractHelper
return $this->_encryptor->decrypt(trim($this->getAdyenAbstractConfigData('notification_password')));
}
public function cancelOrder($order)
{
$orderStatus = $this->getAdyenAbstractConfigData('payment_cancelled');
$order->setActionFlag($orderStatus, true);
switch ($orderStatus) {
case \Magento\Sales\Model\Order::STATE_HOLDED:
if ($order->canHold()) {
$order->hold()->save();
}
break;
default:
if($order->canCancel()) {
$order->cancel()->save();
}
break;
}
}
/**
* Retrieve information from payment configuration
......
......@@ -68,6 +68,23 @@ class AdyenCcConfigProvider extends CcGenericConfigProvider
$config['payment'] ['adyenCc']['cseEnabled'] = $cseEnabled;
$config['payment']['adyenCc']['generationTime'] = date("c");
foreach ($this->methodCodes as $code) {
if ($this->methods[$code]->isAvailable()) {
$config['payment']['adyenCc']['redirectUrl'][$code] = $this->getMethodRedirectUrl($code);
}
}
return $config;
}
/**
* Return redirect URL for method
*
* @param string $code
* @return mixed
*/
protected function getMethodRedirectUrl($code)
{
return $this->methods[$code]->getCheckoutRedirectUrl();
}
}
\ No newline at end of file
......@@ -67,9 +67,13 @@ class PaymentRequest extends \Magento\Framework\Object
"paymentRequest.shopperIP" => $shopperIp,
"paymentRequest.shopperEmail" => $customerEmail,
"paymentRequest.shopperReference" => $order->getIncrementId(),
"paymentRequest.fraudOffset" => "0"
"paymentRequest.fraudOffset" => "0",
"paymentRequest.browserInfo.userAgent" => $_SERVER['HTTP_USER_AGENT'],
"paymentRequest.browserInfo.acceptHeader" => $_SERVER['HTTP_ACCEPT']
);
$billingAddress = $order->getBillingAddress();
if($billingAddress)
......@@ -122,14 +126,22 @@ class PaymentRequest extends \Magento\Framework\Object
}
protected function _apiRequest($request) {
protected function _apiRequest($request)
{
// TODO make differents between test and live
$webserviceUsername = $this->getConfigData("ws_username_test");
$webservicePassword = $this->decryptPassword($this->getConfigData("webservice_password")); // DECODE!!
// Use test or live credentials depends on demo mode
if($this->_adyenHelper->isDemoMode()) {
$webserviceUsername = $this->getConfigData("ws_username_test");
$webservicePassword = $this->decryptPassword($this->getConfigData("ws_password_test"));
$url = "https://pal-test.adyen.com/pal/adapter/httppost";
} else {
$webserviceUsername = $this->getConfigData("ws_username_live");
$webservicePassword = $this->decryptPassword($this->getConfigData("ws_password_live"));
$url = "https://pal-live.adyen.com/pal/adapter/httppost";
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://pal-test.adyen.com/pal/adapter/httppost");
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC );
curl_setopt($ch, CURLOPT_USERPWD, $webserviceUsername.":".$webservicePassword);
......@@ -148,10 +160,6 @@ class PaymentRequest extends \Magento\Framework\Object
throw new \Magento\Framework\Exception\LocalizedException(__('HTTP Status code' . $results));
}
// throw new \Magento\Framework\Exception\LocalizedException(__('HTTP Status code' . print_r($results, true)));
parse_str($results, $results);
$this->_logger->critical("result is" . print_r($results,true));
......@@ -161,6 +169,28 @@ class PaymentRequest extends \Magento\Framework\Object
return $results;
}
public function authorise3d($payment)
{
$order = $payment->getOrder();
$merchantAccount = $this->getConfigData("merchant_account");
$shopperIp = $order->getRemoteIp();
$md = $payment->getAdditionalInformation('md');
$paResponse = $payment->getAdditionalInformation('paResponse');
$request = array(
"action" => "Payment.authorise3d",
"paymentRequest3d.merchantAccount" => $merchantAccount,
"paymentRequest3d.browserInfo.userAgent" => $_SERVER['HTTP_USER_AGENT'],
"paymentRequest3d.browserInfo.acceptHeader" => $_SERVER['HTTP_ACCEPT'],
"paymentRequest3d.md" => $md,
"paymentRequest3d.paResponse" => $paResponse,
"paymentRequest3d.shopperIP" => $shopperIp
);
return $this->_apiRequest($request);
}
/**
* Decrypt password
*
......
......@@ -137,6 +137,9 @@ class Cron
// $previousAdyenEventCode = $this->order->getAdyenNotificationEventCode();
$previousAdyenEventCode = $this->_order->getData('adyen_notification_event_code');
// set pspReference on payment object
$this->_order->getPayment()->setAdditionalInformation('pspReference', $this->_pspReference);
// check if success is true of false
if (strcmp($this->_success, 'false') == 0 || strcmp($this->_success, '0') == 0) {
......@@ -146,7 +149,7 @@ class Cron
// if payment is API check, check if API result pspreference is the same as reference
if($this->_eventCode == Adyen_Payment_Model_Event::ADYEN_EVENT_AUTHORISATION && $this->_getPaymentMethodType() == 'api') {
if($this->_pspReference == $this->_order->getPayment()->getAdyenPspReference()) {
if($this->_pspReference == $this->_order->getPayment()->getAdditionalInformation('pspReference')) {
// don't cancel the order if previous state is authorisation with success=true
if($previousAdyenEventCode != "AUTHORISATION : TRUE") {
$this->_holdCancelOrder(false);
......
......@@ -35,6 +35,8 @@ class Cc extends \Magento\Payment\Model\Method\Cc
* @var string
*/
protected $_formBlockType = 'Adyen\Payment\Block\Form\Cc';
protected $_infoBlockType = 'Adyen\Payment\Block\Info\Cc';
//
// /**
// * @var string
......@@ -45,6 +47,14 @@ class Cc extends \Magento\Payment\Model\Method\Cc
protected $_adyenLogger;
/**
* @var \Magento\Checkout\Model\Session
*/
protected $_checkoutSession;
protected $_urlBuilder;
/**
* @param \Magento\Framework\Model\Context $context
* @param \Magento\Framework\Registry $registry
......@@ -62,6 +72,8 @@ class Cc extends \Magento\Payment\Model\Method\Cc
public function __construct(
\Adyen\Payment\Model\Api\PaymentRequest $paymentRequest,
\Adyen\Payment\Logger\AdyenLogger $adyenLogger,
\Magento\Checkout\Model\Session $checkoutSession,
\Magento\Framework\UrlInterface $urlBuilder,
\Magento\Framework\Model\Context $context,
\Magento\Framework\Registry $registry,
\Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory,
......@@ -91,6 +103,8 @@ class Cc extends \Magento\Payment\Model\Method\Cc
);
$this->_paymentRequest = $paymentRequest;
$this->_adyenLogger = $adyenLogger;
$this->_checkoutSession = $checkoutSession;
$this->_urlBuilder = $urlBuilder;
}
protected $_paymentMethodType = 'api';
......@@ -98,20 +112,6 @@ class Cc extends \Magento\Payment\Model\Method\Cc
return $this->_paymentMethodType;
}
public function isActive($storeId = null)
{
return true;
}
public function isAvailable($quote = null)
{
$this->_logger->critical("CC IS AVAILABLE!! IS TRUE");
// $this->_adyenLogger->critical("TESTTT");
return true;
}
/**
* Assign data to info model instance
*
......@@ -123,16 +123,8 @@ class Cc extends \Magento\Payment\Model\Method\Cc
parent::assignData($data);
$infoInstance = $this->getInfoInstance();
$this->_logger->critical("Assign data!!:" . print_r($data, true));
// throw new \Magento\Framework\Exception\LocalizedException(__('The authorize action is not available.' . print_r($data, true)));
//// print_r($data);die();
// $this->_logger->critical("TEST in validate FUNTION !!:");
$infoInstance->setAdditionalInformation('encrypted_data', $data['encrypted_data']);
$this->_logger->critical("encrypted dat:" . $data['encrypted_data']);
......@@ -141,12 +133,6 @@ class Cc extends \Magento\Payment\Model\Method\Cc
return $this;
}
public function validate()
{
$this->_logger->critical("TEST in validate FUNTION !!:");
return true;
}
public function authorize(\Magento\Payment\Model\InfoInterface $payment, $amount)
{
$this->_logger->critical("TEST in authorize FUNTION !!:");
......@@ -155,6 +141,9 @@ class Cc extends \Magento\Payment\Model\Method\Cc
throw new \Magento\Framework\Exception\LocalizedException(__('The authorize action is not available.'));
}
// do not let magento set status to processing
$payment->setLastTransId($this->getTransactionId())->setIsTransactionPending(true);
// DO authorisation
$this->_processRequest($payment, $amount, "authorise");
......@@ -213,10 +202,27 @@ class Cc extends \Magento\Payment\Model\Method\Cc
protected function _processResponse(\Magento\Payment\Model\InfoInterface $payment, $response)
{
$payment->setAdditionalInformation('3dActive', false);
switch ($response['paymentResult_resultCode']) {
case "Authorised":
//$this->_addStatusHistory($payment, $responseCode, $pspReference, $this->_getConfigData('order_status'));
$this->_addStatusHistory($payment, $response['paymentResult_resultCode'], $response['paymentResult_pspReference']);
$payment->setAdditionalInformation('pspReference', $response['paymentResult_pspReference']);
break;
case "RedirectShopper":
$payment->setAdditionalInformation('3dActive', true);
$IssuerUrl = $response['paymentResult_issuerUrl'];
$PaReq = $response['paymentResult_paRequest'];
$MD = $response['paymentResult_md'];
$payment->setAdditionalInformation('issuerUrl', $response['paymentResult_issuerUrl']);
$payment->setAdditionalInformation('paRequest', $response['paymentResult_paRequest']);
$payment->setAdditionalInformation('md', $response['paymentResult_md']);
$result = $this->getResponse();
break;
case "Refused":
// paymentResult_refusalReason
......@@ -253,20 +259,40 @@ class Cc extends \Magento\Payment\Model\Method\Cc
}
break;
}
}
protected function _addStatusHistory($payment, $responseCode, $pspReference)
{
if($response['paymentResult_resultCode'] == 'Refused') {
}
$type = 'Adyen Result URL response:';
$comment = __('%1 <br /> authResult: %2 <br /> pspReference: %3 <br /> paymentMethod: %4', $type, $responseCode, $pspReference, "");
$payment->getOrder()->setAdyenResulturlEventCode($responseCode);
$payment->getOrder()->addStatusHistoryComment($comment);
return $this;
}
// print_R($response);die();
/*
* Called by validate3d controller when cc payment has 3D secure
*/
public function authorise3d($payment)
{
$response = $this->_paymentRequest->authorise3d($payment);
$responseCode = $response['paymentResult_resultCode'];
return $responseCode;
}
// does not seem to work.
public function hasVerification() {
return true;
/**
* Checkout redirect URL getter for onepage checkout (hardcode)
*
* @see \Magento\Checkout\Controller\Onepage::savePaymentAction()
* @see \Magento\Quote\Model\Quote\Payment::getCheckoutRedirectUrl()
* @return string
*/
public function getCheckoutRedirectUrl()
{
$this->_logger->critical("CHECKOUT URL" . $this->_urlBuilder->getUrl('adyen/process/validate3d/'));
return $this->_urlBuilder->getUrl('adyen/process/validate3d/');
}
}
\ No newline at end of file
......@@ -28,6 +28,9 @@ class Hpp extends \Magento\Payment\Model\Method\AbstractMethod implements Gatewa
*/
const GUEST_ID = 'customer_';
// protected $_formBlockType = 'Adyen\Payment\Block\Form\Hpp';
protected $_infoBlockType = 'Adyen\Payment\Block\Info\Hpp';
/**
* Payment Method feature
......@@ -46,6 +49,13 @@ class Hpp extends \Magento\Payment\Model\Method\AbstractMethod implements Gatewa
*/
protected $storeManager;
protected $_urlBuilder;
/**
* @var ResolverInterface
*/
protected $resolver;
/**
* @param \Magento\Framework\Model\Context $context
......@@ -64,6 +74,7 @@ class Hpp extends \Magento\Payment\Model\Method\AbstractMethod implements Gatewa
\Magento\Framework\UrlInterface $urlBuilder,
\Adyen\Payment\Helper\Data $adyenHelper,
\Magento\Store\Model\StoreManagerInterface $storeManager,
\Magento\Framework\Locale\ResolverInterface $resolver,
\Magento\Framework\Model\Context $context,
\Magento\Framework\Registry $registry,
\Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory,
......@@ -90,6 +101,7 @@ class Hpp extends \Magento\Payment\Model\Method\AbstractMethod implements Gatewa
$this->_urlBuilder = $urlBuilder;
$this->_adyenHelper = $adyenHelper;
$this->storeManager = $storeManager;
$this->resolver = $resolver;
}
protected $_paymentMethodType = 'hpp';
......@@ -229,14 +241,13 @@ class Hpp extends \Magento\Payment\Model\Method\AbstractMethod implements Gatewa
$customerId = $order->getCustomerId();
$shopperIP = $order->getRemoteIp();
$browserInfo = $_SERVER['HTTP_USER_AGENT'];
$deliveryDays = 5;
// $shopperLocale = trim($this->_getConfigData('shopperlocale'));
// $shopperLocale = (!empty($shopperLocale)) ? $shopperLocale : Mage::app()->getLocale()->getLocaleCode();
// $countryCode = trim($this->_getConfigData('countryCode'));
// $countryCode = (!empty($countryCode)) ? $countryCode : false;
$deliveryDays = $this->getConfigData('delivery_days');
$shopperLocale = trim($this->getConfigData('shopper_locale'));
$shopperLocale = (!empty($shopperLocale)) ? $shopperLocale : $this->resolver->getLocale();
$countryCode = trim($this->getConfigData('country_code'));
$countryCode = (!empty($countryCode)) ? $countryCode : false;
$countryCode = false;
// if directory lookup is enabled use the billingadress as countrycode
if ($countryCode == false) {
if ($order->getBillingAddress() && $order->getBillingAddress()->getCountryId() != "") {
......
......@@ -29,11 +29,11 @@
<frontend_class>validate-number</frontend_class>
<config_path>payment/adyen_cc/sort_order</config_path>
</field>
<field id="cse_enabled" translate="label" type="select" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enable CSE</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/adyen_cc/cse_enabled</config_path>
</field>
<!--<field id="cse_enabled" translate="label" type="select" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1">-->
<!--<label>Enable CSE</label>-->
<!--<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>-->
<!--<config_path>payment/adyen_cc/cse_enabled</config_path>-->
<!--</field>-->
<field id="cse_publickey_test" translate="label" type="textarea" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enter CSE Public Key of Test Adyen Web Service User</label>
<depends><field id="cse_enabled">1</field></depends>
......
......@@ -46,37 +46,54 @@
<backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model>
<config_path>payment/adyen_hpp/hmac_live</config_path>
</field>
<field id="payment_selection_on_adyen" translate="label" type="select" sortOrder="70" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Payment method selection in Adyen</label>
<tooltip>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.</tooltip>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/adyen_hpp/payment_selection_on_adyen</config_path>
</field>
<field id="payment_routine" translate="label" type="select" sortOrder="80" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Payment Flow Selection</label>
<tooltip>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.</tooltip>
<source_model>Adyen\Payment\Model\Config\Source\PaymentRoutine</source_model>
<depends><field id="payment_selection_on_adyen">1</field></depends>
<config_path>payment/adyen_hpp/payment_routine</config_path>
</field>
<group id="adyen_hpp_advanced_settings" translate="label" showInDefault="1" showInWebsite="1" sortOrder="200">
<label>Advanced Settings</label>
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
<field id="payment_selection_on_adyen" translate="label" type="select" sortOrder="70" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Payment method selection in Adyen</label>
<tooltip>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.</tooltip>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/adyen_hpp/payment_selection_on_adyen</config_path>
</field>
<field id="payment_routine" translate="label" type="select" sortOrder="80" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Payment Flow Selection</label>
<tooltip>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.</tooltip>
<source_model>Adyen\Payment\Model\Config\Source\PaymentRoutine</source_model>
<depends><field id="payment_selection_on_adyen">1</field></depends>
<config_path>payment/adyen_hpp/payment_routine</config_path>
</field>
<field id="delivery_days" translate="label" type="text" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Days to Delivery</label>
<tooltip>How many days to be added to the current date for delivery. ONLY whole numbers allowed.</tooltip>
<frontend_class>validate-number</frontend_class>
<config_path>payment/adyen_hpp/delivery_days</config_path>
</field>
<field id="shopper_locale" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Language locale (optional)</label>
<tooltip>This will override the default shopper locale of the Magento store (e.g. nl_NL). Leave empty to let Magento decide.</tooltip>
<config_path>payment/adyen_hpp/shopper_locale</config_path>
</field>
<field id="country_code" translate="label" type="text" sortOrder="110" showInDefault="1" showInWebsite="1" showInStore="1">
<label>ISO Country Code (optional)</label>
<tooltip>This will override the shopper billing address country when determining what payment methods to display.</tooltip>
<config_path>payment/adyen_hpp/country_code</config_path>
</field>
</group>
<group id="adyen_cc_country_specific" translate="label" showInDefault="1" showInWebsite="1" sortOrder="210">
<group id="adyen_hpp_country_specific" translate="label" showInDefault="1" showInWebsite="1" sortOrder="210">
<label>Country Specific Settings</label>
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
<field id="allowspecific" translate="label" type="allowspecific" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Payment from Applicable Countries</label>
<source_model>Magento\Payment\Model\Config\Source\Allspecificcountries</source_model>
<config_path>payment/adyen_cc/allowspecific</config_path>
<config_path>payment/adyen_hpp/allowspecific</config_path>
</field>
<field id="specificcountry" translate="label" type="multiselect" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Payment from Specific Countries</label>
<source_model>Magento\Directory\Model\Config\Source\Country</source_model>
<can_be_empty>1</can_be_empty>
<config_path>payment/adyen_cc/specificcountry</config_path>
<config_path>payment/adyen_hpp/specificcountry</config_path>
</field>
</group>
......
......@@ -33,10 +33,10 @@
<title>Adyen HPP</title>
<payment_selection_on_adyen>1</payment_selection_on_adyen>
<payment_routine>single</payment_routine>
<recurring_type>ONECLICK</recurring_type>
<delivery_days>5</delivery_days>
<allowspecific>0</allowspecific>
<sort_order>10</sort_order>
<place_order_url>authorizenet/directpost_payment/place</place_order_url>
<place_order_url>adyen/process/redirect</place_order_url>
<order_place_redirect_url>adyen/process/redirect</order_place_redirect_url>
<payment_action>Authorization</payment_action>
<group>adyen</group>
......
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
// @codingStandardsIgnoreFile
?>
<?php
/**
* @see \Magento\Payment\Block\Info
*/
?>
<?php echo $block->escapeHtml($block->getMethod()->getTitle()) ?>
<?php $_info = $this->getInfo(); ?>
<?php if ($_pspReference = $block->getPspReference()):?>
<div><?php echo __('Adyen PSP Reference: <a href="https://ca-test.adyen.com/ca/ca/accounts/showTx.shtml?pspReference=%1&txType=Payment" target="__blank">%1</a>', $block->escapeHtml($_info->getAdditionalInformation('pspReference')), $block->escapeHtml($_info->getAdditionalInformation('pspReference'))) ?>
</div>
<?php endif;?>
<?php if ($_specificInfo = $block->getSpecificInformation()):?>
<table class="data-table admin__table-secondary">
<?php foreach ($_specificInfo as $_label => $_value):?>
<tr>
<th><?php echo $block->escapeHtml($_label)?>:</th>
<td><?php echo nl2br(implode("\n", $block->getValueAsArray($_value, true)))?></td>
</tr>
<?php endforeach; ?>
</table>
<?php endif;?>
<?php echo $block->getChildHtml()?>
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
// @codingStandardsIgnoreFile
?>
<?php
/**
* @see \Magento\Payment\Block\Info
*/
?>
<?php echo $block->escapeHtml($block->getMethod()->getTitle()) ?>
<?php $_info = $this->getInfo(); ?>
<?php if ($_pspReference = $block->getPspReference()):?>
<div><?php echo __('Adyen PSP Reference: <a href="https://ca-test.adyen.com/ca/ca/accounts/showTx.shtml?pspReference=%1&txType=Payment" target="__blank">%1</a>', $block->escapeHtml($_info->getAdditionalInformation('pspReference')), $block->escapeHtml($_info->getAdditionalInformation('pspReference'))) ?>
</div>
<?php endif;?>
<?php if ($_specificInfo = $block->getSpecificInformation()):?>
<table class="data-table admin__table-secondary">
<?php foreach ($_specificInfo as $_label => $_value):?>
<tr>
<th><?php echo $block->escapeHtml($_label)?>:</th>
<td><?php echo nl2br(implode("\n", $block->getValueAsArray($_value, true)))?></td>
</tr>
<?php endforeach; ?>
</table>
<?php endif;?>
<?php echo $block->getChildHtml()?>
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/layout_generic.xsd">
<container name="root">
<block class="Adyen\Payment\Block\Validate3d" name="adyen-form-validate3d" template="3dform.phtml" cacheable="false"/>
</container>
</layout>
\ No newline at end of file
<body onload="document.getElementById('3dform').submit();">
<form method="POST" action="<?php echo $block->getIssuerUrl(); ?>" id="3dform">
<input type="hidden" name="PaReq" value="<?php echo $block->getPaReq(); ?>" />
<input type="hidden" name="MD" value="<?php echo $block->getMd() ?>" />
<input type="hidden" name="TermUrl" value="<?php echo $block->getTermUrl(); ?>" />
<noscript>
<br>
<br>
<div style="text-align: center">
<h1>Processing your 3-D Secure Transaction</h1>
<p>Please click continue to continue the processing of your 3-D Secure transaction.</p>
<input type="submit" class="button" value="continue"/>
</div>
</noscript>
</form>
</body>
\ No newline at end of file
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
define(
[
'Magento_Checkout/js/model/quote',
'Magento_Checkout/js/model/url-builder',
'mage/storage',
'mage/url',
'Magento_Checkout/js/model/error-processor',
'Magento_Customer/js/model/customer'
],
function (quote, urlBuilder, storage, url, errorProcessor, customer) {
'use strict';
return function (paymentData, redirectOnSuccess) {
var serviceUrl,
payload;
redirectOnSuccess = redirectOnSuccess === false ? false : true;
/** Checkout for guest and registered customer. */
if (!customer.isLoggedIn()) {
serviceUrl = urlBuilder.createUrl('/guest-carts/:quoteId/payment-information', {
quoteId: quote.getQuoteId()
});
payload = {
cartId: quote.getQuoteId(),
email: quote.guestEmail,
paymentMethod: paymentData,
billingAddress: quote.billingAddress()
};
} else {
serviceUrl = urlBuilder.createUrl('/carts/mine/payment-information', {});
payload = {
cartId: quote.getQuoteId(),
paymentMethod: paymentData,
billingAddress: quote.billingAddress()
};
}
return storage.post(
serviceUrl, JSON.stringify(payload)
).done(
function () {
if (redirectOnSuccess) {
window.location.replace(url.build(window.checkoutConfig.payment.adyenCc.redirectUrl[quote.paymentMethod().method]));
}
}
).fail(
function (response) {
errorProcessor.process(response);
}
);
};
}
);
......@@ -10,7 +10,7 @@ define(
'jquery',
'Magento_Payment/js/view/payment/cc-form',
'Magento_Checkout/js/action/set-payment-information',
'Magento_Checkout/js/action/place-order',
'Adyen_Payment/js/action/place-order',
'mage/translate',
'Adyen_Payment/js/view/payment/adyen-encrypt'
],
......@@ -139,9 +139,6 @@ define(
// });
//}
},
getTitle: function() {
return 'Adyen cc';
},
getControllerName: function() {
return window.checkoutConfig.payment.iframe.controllerName[this.getCode()];
},
......
......@@ -70,7 +70,7 @@
<span><!-- ko text: $t('Credit Card Number')--><!-- /ko --></span>
</label>
<div class="control">
<input type="number" name="payment[cc_number]" class="input-text" value=""
<input type="number" class="input-text" value=""
data-encrypted-name="number"
data-bind="attr: {
autocomplete: off,
......@@ -89,7 +89,6 @@
</label>
<div class="control">
<input type="text"
name="payment[cc_owner]"
class="input-text"
value=""
data-encrypted-name="holderName"
......@@ -106,8 +105,7 @@
<div class="fields group group-2">
<div class="field no-label month">
<div class="control">
<select name="payment[cc_exp_month]"
class="select select-month"
<select class="select select-month"
data-encrypted-name="expiryMonth"
data-bind="attr: {id: getCode() + '_expiration', 'data-container': getCode() + '-cc-month', 'data-validate': JSON.stringify({required:true, 'validate-cc-exp':'#' + getCode() + '_expiration_yr'})},
enable: isActive($parents),
......@@ -121,8 +119,7 @@
</div>
<div class="field no-label year">
<div class="control">
<select name="payment[cc_exp_year]"
class="select select-year"
<select class="select select-year"
data-encrypted-name="expiryYear"
data-bind="attr: {id: getCode() + '_expiration_yr', 'data-container': getCode() + '-cc-year', 'data-validate': JSON.stringify({required:true})},
enable: isActive($parents),
......@@ -147,7 +144,6 @@
autocomplete="off"
class="input-text cvv"
data-encrypted-name="cvc"
name="payment[cc_cid]"
value=""
data-bind="attr: {id: getCode() + '_cc_cid',
title: $t('Card Verification Number'),
......@@ -182,7 +178,7 @@
<span><!-- ko text: $t('Issue Number')--><!-- /ko --></span>
</label>
<div class="control">
<input type="number" name="payment[cc_ss_issue]"
<input type="number"
value=""
class="input-text cvv"
data-bind="attr: {id: getCode() + '_cc_issue', title: $t('Issue Number'), 'data-container': getCode() + '-cc-issue', 'data-validate': JSON.stringify({'validate-cc-ukss':true})}, enable: isActive($parents)"/>
......@@ -197,8 +193,7 @@
<div class="fields group group-2">
<div class="field no-label month">
<div class="control">
<select name="payment[cc_ss_start_month]"
class="select select-month"
<select class="select select-month"
data-bind="attr: {id: getCode() + '_start_month', 'data-container': getCode() + '-cc-start-month', 'data-validate': JSON.stringify({'validate-cc-ukss':true})},
enable: isActive($parents),
options: getCcMonthsValues(),
......@@ -211,8 +206,7 @@
</div>
<div class="field no-label year">
<div class="control">
<select name="payment[cc_ss_start_year]"
class="select select-year"
<select class="select select-year"
data-bind="attr: {id: getCode() + '_start_year', 'data-container': getCode() + '-cc-start-year',
'data-validate': JSON.stringify({'validate-cc-ukss':true})},
enable: isActive($parents),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment