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

Merge pull request #191 from Adyen/develop

2.1.2 hotfix release
parents 81a7ce1e fbb6d058
...@@ -200,7 +200,7 @@ class Redirect extends \Magento\Payment\Block\Form ...@@ -200,7 +200,7 @@ class Redirect extends \Magento\Payment\Block\Form
$countryCode = trim($this->_adyenHelper->getAdyenHppConfigData('country_code')); $countryCode = trim($this->_adyenHelper->getAdyenHppConfigData('country_code'));
$countryCode = (!empty($countryCode)) ? $countryCode : false; $countryCode = (!empty($countryCode)) ? $countryCode : false;
// if directory lookup is enabled use the billingadress as countrycode // if directory lookup is enabled use the billingaddress as countrycode
if ($countryCode == false) { if ($countryCode == false) {
if ($this->_order->getBillingAddress() && if ($this->_order->getBillingAddress() &&
$this->_order->getBillingAddress()->getCountryId() != "") { $this->_order->getBillingAddress()->getCountryId() != "") {
......
...@@ -287,9 +287,12 @@ class Json extends \Magento\Framework\App\Action\Action ...@@ -287,9 +287,12 @@ class Json extends \Magento\Framework\App\Action\Action
$pspReference = trim($response['pspReference']); $pspReference = trim($response['pspReference']);
$eventCode = trim($response['eventCode']); $eventCode = trim($response['eventCode']);
$success = trim($response['success']); $success = trim($response['success']);
$originalReference = null;
if(isset($response['originalReference'])) {
$originalReference = trim($response['originalReference']);
}
$notification = $this->_objectManager->create('Adyen\Payment\Model\Notification'); $notification = $this->_objectManager->create('Adyen\Payment\Model\Notification');
return $notification->isDuplicate($pspReference, $eventCode, $success); return $notification->isDuplicate($pspReference, $eventCode, $success, $originalReference);
} }
/** /**
...@@ -297,22 +300,25 @@ class Json extends \Magento\Framework\App\Action\Action ...@@ -297,22 +300,25 @@ class Json extends \Magento\Framework\App\Action\Action
*/ */
protected function _fixCgiHttpAuthentication() protected function _fixCgiHttpAuthentication()
{ {
if (isset($_SERVER['REDIRECT_REMOTE_AUTHORIZATION']) && // do nothing if values are already there
if(!empty($_SERVER['PHP_AUTH_USER']) && !empty($_SERVER['PHP_AUTH_PW'])) {
return;
} elseif (isset($_SERVER['REDIRECT_REMOTE_AUTHORIZATION']) &&
$_SERVER['REDIRECT_REMOTE_AUTHORIZATION'] != '') { $_SERVER['REDIRECT_REMOTE_AUTHORIZATION'] != '') {
list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) =
explode(':', base64_decode($_SERVER['REDIRECT_REMOTE_AUTHORIZATION'])); explode(':', base64_decode($_SERVER['REDIRECT_REMOTE_AUTHORIZATION']),2);
} elseif (!empty($_SERVER['REDIRECT_HTTP_AUTHORIZATION'])) { } elseif (!empty($_SERVER['REDIRECT_HTTP_AUTHORIZATION'])) {
list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) =
explode(':', base64_decode(substr($_SERVER['REDIRECT_HTTP_AUTHORIZATION'], 6))); explode(':', base64_decode(substr($_SERVER['REDIRECT_HTTP_AUTHORIZATION'], 6)),2);
} elseif (!empty($_SERVER['HTTP_AUTHORIZATION'])) { } elseif (!empty($_SERVER['HTTP_AUTHORIZATION'])) {
list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) =
explode(':', base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6))); explode(':', base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6)),2);
} elseif (!empty($_SERVER['REMOTE_USER'])) { } elseif (!empty($_SERVER['REMOTE_USER'])) {
list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) =
explode(':', base64_decode(substr($_SERVER['REMOTE_USER'], 6))); explode(':', base64_decode(substr($_SERVER['REMOTE_USER'], 6)),2);
} elseif (!empty($_SERVER['REDIRECT_REMOTE_USER'])) { } elseif (!empty($_SERVER['REDIRECT_REMOTE_USER'])) {
list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) =
explode(':', base64_decode(substr($_SERVER['REDIRECT_REMOTE_USER'], 6))); explode(':', base64_decode(substr($_SERVER['REDIRECT_REMOTE_USER'], 6)),2);
} }
} }
......
...@@ -89,10 +89,11 @@ class Validate3d extends \Magento\Framework\App\Action\Action ...@@ -89,10 +89,11 @@ class Validate3d extends \Magento\Framework\App\Action\Action
if ($order->getPayment()) { if ($order->getPayment()) {
$active = $order->getPayment()->getAdditionalInformation('3dActive'); $active = $order->getPayment()->getAdditionalInformation('3dActive');
$success = $order->getPayment()->getAdditionalInformation('3dSuccess');
} }
// check if 3D secure is active. If not just go to success page // check if 3D secure is active. If not just go to success page
if ($active) { if ($active && $success != true) {
$this->_adyenLogger->addAdyenResult("3D secure is active"); $this->_adyenLogger->addAdyenResult("3D secure is active");
...@@ -131,6 +132,7 @@ class Validate3d extends \Magento\Framework\App\Action\Action ...@@ -131,6 +132,7 @@ class Validate3d extends \Magento\Framework\App\Action\Action
$order->addStatusHistoryComment(__('3D-secure validation was successful'))->save(); $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 // 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('3dActive', '');
$order->getPayment()->setAdditionalInformation('3dSuccess', true);
$this->_orderRepository->save($order); $this->_orderRepository->save($order);
$this->_redirect('checkout/onepage/success', ['_query' => ['utm_nooverride' => '1']]); $this->_redirect('checkout/onepage/success', ['_query' => ['utm_nooverride' => '1']]);
......
...@@ -770,6 +770,11 @@ class Data extends AbstractHelper ...@@ -770,6 +770,11 @@ class Data extends AbstractHelper
} }
} }
public function getRatePayId()
{
return $this->getAdyenHppConfigData("ratepay_id");
}
/** /**
* For Klarna And AfterPay use VatCategory High others use none * For Klarna And AfterPay use VatCategory High others use none
* *
......
This diff is collapsed.
...@@ -48,7 +48,7 @@ class Adapter extends Method\Adapter ...@@ -48,7 +48,7 @@ class Adapter extends Method\Adapter
* @param PaymentDataObjectFactory $paymentDataObjectFactory * @param PaymentDataObjectFactory $paymentDataObjectFactory
* @param string $code * @param string $code
* @param string $formBlockType * @param string $formBlockType
* @param CommandPoolInterface $infoBlockType * @param string $infoBlockType
* @param CommandPoolInterface|null $commandPool * @param CommandPoolInterface|null $commandPool
* @param ValidatorPoolInterface|null $validatorPool * @param ValidatorPoolInterface|null $validatorPool
* @param CommandManagerInterface|null $commandExecutor * @param CommandManagerInterface|null $commandExecutor
......
...@@ -84,11 +84,12 @@ class Notification extends \Magento\Framework\Model\AbstractModel ...@@ -84,11 +84,12 @@ class Notification extends \Magento\Framework\Model\AbstractModel
* @param $pspReference * @param $pspReference
* @param $eventCode * @param $eventCode
* @param $success * @param $success
* @param $originalReference
* @return bool (true if the notification is a duplicate) * @return bool (true if the notification is a duplicate)
*/ */
public function isDuplicate($pspReference, $eventCode, $success) public function isDuplicate($pspReference, $eventCode, $success, $originalReference)
{ {
$result = $this->getResource()->getNotification($pspReference, $eventCode, $success); $result = $this->getResource()->getNotification($pspReference, $eventCode, $success, $originalReference);
return (empty($result)) ? false : true; return (empty($result)) ? false : true;
} }
......
...@@ -40,15 +40,17 @@ class Notification extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb ...@@ -40,15 +40,17 @@ class Notification extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
* @param $pspReference * @param $pspReference
* @param $eventCode * @param $eventCode
* @param $success * @param $success
* @param $originalReference
* @return array * @return array
*/ */
public function getNotification($pspReference, $eventCode, $success) public function getNotification($pspReference, $eventCode, $success, $originalReference)
{ {
$select = $this->getConnection()->select() $select = $this->getConnection()->select()
->from(['notification' => $this->getTable('adyen_notification')]) ->from(['notification' => $this->getTable('adyen_notification')])
->where('notification.pspreference=?', $pspReference) ->where('notification.pspreference=?', $pspReference)
->where('notification.event_code=?', $eventCode) ->where('notification.event_code=?', $eventCode)
->where('notification.success=?', $success); ->where('notification.success=?', $success)
->where('notification.original_reference=?', $originalReference);
return $this->getConnection()->fetchAll($select); return $this->getConnection()->fetchAll($select);
} }
} }
\ No newline at end of file
...@@ -59,6 +59,10 @@ class AdyenHppConfigProvider implements ConfigProviderInterface ...@@ -59,6 +59,10 @@ class AdyenHppConfigProvider implements ConfigProviderInterface
*/ */
protected $_customerSession; protected $_customerSession;
/**
* @var \Magento\Checkout\Model\Session
*/
protected $_session;
/** /**
* AdyenHppConfigProvider constructor. * AdyenHppConfigProvider constructor.
...@@ -68,23 +72,26 @@ class AdyenHppConfigProvider implements ConfigProviderInterface ...@@ -68,23 +72,26 @@ class AdyenHppConfigProvider implements ConfigProviderInterface
* @param \Magento\Framework\App\RequestInterface $request * @param \Magento\Framework\App\RequestInterface $request
* @param \Magento\Framework\UrlInterface $urlBuilder * @param \Magento\Framework\UrlInterface $urlBuilder
* @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Customer\Model\Session $customerSession
* @param \Magento\Checkout\Model\Session $session
*/ */
public function __construct( public function __construct(
PaymentHelper $paymentHelper, PaymentHelper $paymentHelper,
\Adyen\Payment\Helper\Data $adyenHelper, \Adyen\Payment\Helper\Data $adyenHelper,
\Magento\Framework\App\RequestInterface $request, \Magento\Framework\App\RequestInterface $request,
\Magento\Framework\UrlInterface $urlBuilder, \Magento\Framework\UrlInterface $urlBuilder,
\Magento\Customer\Model\Session $customerSession \Magento\Customer\Model\Session $customerSession,
\Magento\Checkout\Model\Session $session
) { ) {
$this->_paymentHelper = $paymentHelper; $this->_paymentHelper = $paymentHelper;
$this->_adyenHelper = $adyenHelper; $this->_adyenHelper = $adyenHelper;
$this->_request = $request; $this->_request = $request;
$this->_urlBuilder = $urlBuilder; $this->_urlBuilder = $urlBuilder;
$this->_customerSession = $customerSession; $this->_customerSession = $customerSession;
$this->_session = $session;
} }
/** /**
* Set configuration for AdyenHPP payemnt method * Set configuration for AdyenHPP payment method
* *
* @return array * @return array
*/ */
...@@ -133,7 +140,8 @@ class AdyenHppConfigProvider implements ConfigProviderInterface ...@@ -133,7 +140,8 @@ class AdyenHppConfigProvider implements ConfigProviderInterface
$config['payment'] ['adyenHpp']['showTelephone'] = $this->_adyenHelper->getAdyenHppConfigDataFlag( $config['payment'] ['adyenHpp']['showTelephone'] = $this->_adyenHelper->getAdyenHppConfigDataFlag(
'show_telephone' 'show_telephone'
); );
$config['payment'] ['adyenHpp']['ratePayId'] = $this->_adyenHelper->getRatePayId();
$config['payment'] ['adyenHpp']['deviceIdentToken'] = md5($this->_session->getQuoteId().date('c'));
return $config; return $config;
......
...@@ -2,26 +2,13 @@ ...@@ -2,26 +2,13 @@
"name": "adyen/module-payment", "name": "adyen/module-payment",
"description": "Official Magento2 Plugin to connect to Payment Service Provider Adyen.", "description": "Official Magento2 Plugin to connect to Payment Service Provider Adyen.",
"type": "magento2-module", "type": "magento2-module",
"version": "2.1.1", "version": "2.1.2",
"license": [ "license": [
"OSL-3.0", "OSL-3.0",
"AFL-3.0" "AFL-3.0"
], ],
"require": { "require": {
"php": "~5.5.0|~5.6.0|~7.0.0", "php": "~5.5.0|~5.6.0|~7.0.0",
"magento/module-config": "100.1.*",
"magento/module-store": "100.1.*",
"magento/module-checkout": "100.1.*",
"magento/module-catalog": "101.0.*",
"magento/module-sales": "100.1.*",
"magento/module-customer": "100.1.*",
"magento/module-payment": "100.1.*",
"magento/module-quote": "100.1.*",
"magento/module-backend": "100.1.*",
"magento/module-directory": "100.1.*",
"magento/module-theme": "100.1.*",
"magento/module-paypal": "100.1.*",
"magento/framework": "100.1.*",
"adyen/php-api-library": "*" "adyen/php-api-library": "*"
}, },
"autoload": { "autoload": {
......
...@@ -79,6 +79,11 @@ ...@@ -79,6 +79,11 @@
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/adyen_hpp/ignore_second_address_field</config_path> <config_path>payment/adyen_hpp/ignore_second_address_field</config_path>
</field> </field>
<field id="ratepay_id" translate="label" type="text" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="1">
<label>RatePAY Device Ident SId</label>
<tooltip>Unique RatePAY Id provided by RatePAY integration consultant</tooltip>
<config_path>payment/adyen_hpp/ratepay_id</config_path>
</field>
</group> </group>
<group id="adyen_hpp_advanced_settings" translate="label" showInDefault="1" showInWebsite="1" sortOrder="200"> <group id="adyen_hpp_advanced_settings" translate="label" showInDefault="1" showInWebsite="1" sortOrder="200">
<label>Advanced Settings</label> <label>Advanced Settings</label>
......
...@@ -96,6 +96,7 @@ ...@@ -96,6 +96,7 @@
<payment_routine>single</payment_routine> <payment_routine>single</payment_routine>
<delivery_days>5</delivery_days> <delivery_days>5</delivery_days>
<allowspecific>0</allowspecific> <allowspecific>0</allowspecific>
<ratepay_id>oj9GsQ</ratepay_id>
<sort_order>3</sort_order> <sort_order>3</sort_order>
<payment_action>order</payment_action> <payment_action>order</payment_action>
<can_initialize>1</can_initialize> <can_initialize>1</can_initialize>
...@@ -191,5 +192,12 @@ ...@@ -191,5 +192,12 @@
<group>adyen</group> <group>adyen</group>
</adyen_boleto> </adyen_boleto>
</payment> </payment>
<dev>
<js>
<minify_exclude>
live.adyen.com/hpp/js/df
</minify_exclude>
</js>
</dev>
</default> </default>
</config> </config>
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/cron_groups.xsd">
<group id="adyen_payment">
<schedule_generate_every>1</schedule_generate_every>
<schedule_ahead_for>4</schedule_ahead_for>
<schedule_lifetime>2</schedule_lifetime>
<history_cleanup_every>10</history_cleanup_every>
<history_success_lifetime>60</history_success_lifetime>
<history_failure_lifetime>600</history_failure_lifetime>
<use_separate_process>1</use_separate_process>
</group>
</config>
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
*/ */
--> -->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/crontab.xsd"> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/crontab.xsd">
<group id="index"> <group id="adyen_payment">
<job name="adyen_payment_process_notification" instance="Adyen\Payment\Model\Cron" method="processNotification"> <job name="adyen_payment_process_notification" instance="Adyen\Payment\Model\Cron" method="processNotification">
<schedule>*/1 * * * *</schedule> <schedule>*/1 * * * *</schedule>
</job> </job>
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
--> -->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Adyen_Payment" setup_version="2.1.1"> <module name="Adyen_Payment" setup_version="2.1.2">
<sequence> <sequence>
<module name="Magento_Sales"/> <module name="Magento_Sales"/>
<module name="Magento_Quote"/> <module name="Magento_Quote"/>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
var config = { var config = {
paths: { paths: {
'adyen/encrypt' : 'Adyen_Payment/js/view/payment/adyen.encrypt.min', 'adyen/encrypt' : 'Adyen_Payment/js/view/payment/adyen.encrypt.min',
'adyen/df' : 'Adyen_Payment/js/view/payment/df.min' 'adyen/df' : 'https://live.adyen.com/hpp/js/df'
}, },
config: { config: {
mixins: { mixins: {
......
This diff is collapsed.
...@@ -63,6 +63,7 @@ define( ...@@ -63,6 +63,7 @@ define(
return this; return this;
}, },
initialize: function () { initialize: function () {
var self = this;
this._super(); this._super();
fullScreenLoader.startLoader(); fullScreenLoader.startLoader();
...@@ -73,7 +74,6 @@ define( ...@@ -73,7 +74,6 @@ define(
// retrieve payment methods // retrieve payment methods
var serviceUrl, var serviceUrl,
payload; payload;
if(customer.isLoggedIn()) { if(customer.isLoggedIn()) {
serviceUrl = urlBuilder.createUrl('/carts/mine/retrieve-adyen-payment-methods', {}); serviceUrl = urlBuilder.createUrl('/carts/mine/retrieve-adyen-payment-methods', {});
} else { } else {
...@@ -92,7 +92,23 @@ define( ...@@ -92,7 +92,23 @@ define(
).done( ).done(
function (response) { function (response) {
adyenPaymentService.setPaymentMethods(response); adyenPaymentService.setPaymentMethods(response);
if(JSON.stringify(response).indexOf("ratepay") > -1) {
var ratePayId = window.checkoutConfig.payment.adyenHpp.ratePayId;
window.di = {t: '', v: ratePayId, l: 'Checkout'};
function waitForDfValue() {
var dfValueRatePay = self.getRatePayDeviceIdentToken();
if (dfValueRatePay) {
window.di.t = dfValueRatePay.replace(':', '');
var scriptTag = document.createElement('script');
scriptTag.src = "//d.ratepay.com/" + ratePayId + "/di.js";
scriptTag.type = "text/javascript";
document.body.appendChild(scriptTag);
} else {
setTimeout(waitForDfValue, 200);
}
}
waitForDfValue();
}
// set device fingerprint value // set device fingerprint value
dfSet('dfValue', 0); dfSet('dfValue', 0);
// propagate this manually to knockoutjs otherwise it would not work // propagate this manually to knockoutjs otherwise it would not work
...@@ -107,7 +123,6 @@ define( ...@@ -107,7 +123,6 @@ define(
}, },
getAdyenHppPaymentMethods: function() { getAdyenHppPaymentMethods: function() {
var self = this; var self = this;
var paymentMethods = adyenPaymentService.getAvailablePaymentMethods(); var paymentMethods = adyenPaymentService.getAvailablePaymentMethods();
var paymentList = _.map(paymentMethods, function(value) { var paymentList = _.map(paymentMethods, function(value) {
...@@ -135,6 +150,9 @@ define( ...@@ -135,6 +150,9 @@ define(
result.isPaymentMethodOpenInvoiceMethod = function() { result.isPaymentMethodOpenInvoiceMethod = function() {
return value.isPaymentMethodOpenInvoiceMethod; return value.isPaymentMethodOpenInvoiceMethod;
} }
result.getRatePayDeviceIdentToken = function() {
return window.checkoutConfig.payment.adyenHpp.deviceIdentToken;
}
return result; return result;
}); });
return paymentList; return paymentList;
...@@ -176,6 +194,9 @@ define( ...@@ -176,6 +194,9 @@ define(
additionalData.gender = this.gender(); additionalData.gender = this.gender();
additionalData.dob = this.dob(); additionalData.dob = this.dob();
additionalData.telephone = this.telephone(); additionalData.telephone = this.telephone();
if(brandCode() == "ratepay"){
additionalData.df_value = this.getRatePayDeviceIdentToken();
}
} }
data.additional_data = additionalData; data.additional_data = additionalData;
...@@ -237,6 +258,9 @@ define( ...@@ -237,6 +258,9 @@ define(
}, },
validate: function () { validate: function () {
return true; return true;
},
getRatePayDeviceIdentToken: function(){
return window.checkoutConfig.payment.adyenHpp.deviceIdentToken;
} }
}); });
} }
......
...@@ -37,6 +37,7 @@ define( ...@@ -37,6 +37,7 @@ define(
], ],
function (ko, _, $, Component, placeOrderAction, $t, additionalValidators, selectPaymentMethodAction, quote, checkoutData) { function (ko, _, $, Component, placeOrderAction, $t, additionalValidators, selectPaymentMethodAction, quote, checkoutData) {
'use strict'; 'use strict';
var updatedExpiryDate = false;
var recurringDetailReference = ko.observable(null); var recurringDetailReference = ko.observable(null);
var paymentMethod = ko.observable(null); var paymentMethod = ko.observable(null);
return Component.extend({ return Component.extend({
...@@ -90,10 +91,7 @@ define( ...@@ -90,10 +91,7 @@ define(
// only use CSE and installments for cards // only use CSE and installments for cards
if (self.agreement_data.card) { if (self.agreement_data.card) {
var cse_key = this.getCSEKey();
var options = { enableValidations: false};
var cseInstance = adyen.encrypt.createEncryption(cse_key, options);
var generationtime = self.getGenerationTime(); var generationtime = self.getGenerationTime();
var cardData = { var cardData = {
...@@ -103,10 +101,17 @@ define( ...@@ -103,10 +101,17 @@ define(
generationtime : generationtime generationtime : generationtime
}; };
var encryptedData = cseInstance.encrypt(cardData); if(updatedExpiryDate || self.hasVerification()){
var options = { enableValidations: false};
var cse_key = this.getCSEKey();
var cseInstance = adyen.encrypt.createEncryption(cse_key, options);
var encryptedData = cseInstance.encrypt(cardData);
data.additional_data.encrypted_data = encryptedData;
}
// set payment method to adyen_hpp // set payment method to adyen_hpp
data.additional_data.encrypted_data = encryptedData;
data.additional_data.number_of_installments = self.installment; data.additional_data.number_of_installments = self.installment;
} }
...@@ -180,6 +185,9 @@ define( ...@@ -180,6 +185,9 @@ define(
getGenerationTime: function() { getGenerationTime: function() {
return window.checkoutConfig.payment.adyenCc.generationTime; return window.checkoutConfig.payment.adyenCc.generationTime;
}, },
hasVerification: function() {
return window.checkoutConfig.payment.adyenOneclick.hasCustomerInteraction;
},
validate: function () { validate: function () {
var code = self.item.method; var code = self.item.method;
...@@ -192,13 +200,13 @@ define( ...@@ -192,13 +200,13 @@ define(
// if oneclick or recurring is a card do validation on expiration date // if oneclick or recurring is a card do validation on expiration date
if(this.agreement_data.card) { if(this.agreement_data.card) {
// add extra validation because jqeury validation will not work on non name attributes // add extra validation because jquery validation will not work on non name attributes
var expiration = Boolean($(form + ' #' + codeValue + '_expiration').valid()); var expiration = Boolean($(form + ' #' + codeValue + '_expiration').valid());
var expiration_yr = Boolean($(form + ' #' + codeValue + '_expiration_yr').valid()); var expiration_yr = Boolean($(form + ' #' + codeValue + '_expiration_yr').valid());
// only check if recurring type is set to oneclick // only check if recurring type is set to oneclick
var cid = true; var cid = true;
if(self.hasVerification()) { if(this.hasVerification()) {
var cid = Boolean($(form + ' #' + codeValue + '_cc_cid').valid()); var cid = Boolean($(form + ' #' + codeValue + '_cc_cid').valid());
} }
} else { } else {
...@@ -214,6 +222,7 @@ define( ...@@ -214,6 +222,7 @@ define(
return true; return true;
}, },
selectExpiry: function() { selectExpiry: function() {
updatedExpiryDate = true;
var self = this; var self = this;
self.expiry(true); self.expiry(true);
return true; return true;
...@@ -224,6 +233,8 @@ define( ...@@ -224,6 +233,8 @@ define(
}, },
selectBillingAgreement: function() { selectBillingAgreement: function() {
var self = this; var self = this;
self.expiry(false);
updatedExpiryDate = false;
// set payment method data // set payment method data
var data = { var data = {
...@@ -256,9 +267,6 @@ define( ...@@ -256,9 +267,6 @@ define(
} }
return null; return null;
}), }),
hasVerification: function() {
return window.checkoutConfig.payment.adyenOneclick.hasCustomerInteraction;
},
getPlaceOrderUrl: function() { getPlaceOrderUrl: function() {
return window.checkoutConfig.payment.iframe.placeOrderUrl[this.getCode()]; return window.checkoutConfig.payment.iframe.placeOrderUrl[this.getCode()];
} }
......
...@@ -131,7 +131,7 @@ ...@@ -131,7 +131,7 @@
</div> </div>
<!-- ko if: ($parent.hasVerification())--> <!-- ko if: hasVerification()-->
<div class="field cvv required" data-bind="attr: {id: getCode() + '_' + value + '_cc_type_cvv_div'}"> <div class="field cvv required" data-bind="attr: {id: getCode() + '_' + value + '_cc_type_cvv_div'}">
<label data-bind="attr: {for: getCode() + '_' + value + '_cc_cid'}" class="label"> <label data-bind="attr: {for: getCode() + '_' + value + '_cc_cid'}" class="label">
<span><!-- ko text: $t('Card Verification Number')--><!-- /ko --></span> <span><!-- ko text: $t('Card Verification Number')--><!-- /ko --></span>
......
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