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 331edac8 authored by Bas Maassen's avatar Bas Maassen Committed by GitHub

Merge pull request #224 from Adyen/PW-261

PW-261 Removed the detailed refusal reasons, added frontend CVC validation. 
parents c8bf0c44 d459a91b
......@@ -114,31 +114,7 @@ class GeneralResponseValidator extends AbstractValidator
}
break;
case "Refused":
if ($response['refusalReason']) {
$refusalReason = $response['refusalReason'];
switch($refusalReason) {
case "Transaction Not Permitted":
$errorMsg = __('The transaction is not permitted.');
break;
case "CVC Declined":
$errorMsg = __('Declined due to the Card Security Code(CVC) being incorrect. Please check your CVC code!');
break;
case "Restricted Card":
$errorMsg = __('The card is restricted.');
break;
case "803 PaymentDetail not found":
$errorMsg = __('The payment is REFUSED because the saved card is removed. Please try an other payment method.');
break;
case "Expiry month not set":
$errorMsg = __('The expiry month is not set. Please check your expiry month!');
break;
default:
$errorMsg = __('The payment is REFUSED.');
break;
}
} else {
$errorMsg = __('The payment is REFUSED.');
}
$errorMsg = __('The payment is REFUSED.');
// this will result the specific error
throw new \Magento\Framework\Exception\LocalizedException(__($errorMsg));
break;
......
......@@ -39,6 +39,8 @@ define(
function (_, $, Component, placeOrderAction, $t, additionalValidators, customer, creditCardData, quote, ko, installments, adyenEncrypt) {
'use strict';
var cvcLength = ko.observable(4);
return Component.extend({
defaults: {
template: 'Adyen_Payment/payment/cc-form',
......@@ -79,9 +81,11 @@ define(
// what card is this ??
var creditcardType = creditCardData.creditCard.type;
if(creditcardType) {
cvcLength(4);
if (creditcardType != "AE"){
cvcLength(3);
}
if (creditcardType in allInstallments) {
// get for the creditcard the installments
var installmentCreditcard = allInstallments[creditcardType];
......@@ -125,6 +129,9 @@ define(
}
};
},
getCvcLength: function() {
return cvcLength();
},
isActive: function() {
return true;
},
......
......@@ -178,13 +178,18 @@
class="input-text cvv"
data-encrypted-name="cvc"
value=""
data-bind="attr: {id: getCode() + '_cc_cid',
data-bind="attr: {
id: getCode() + '_cc_cid',
title: $t('Card Verification Number'),
'data-container': getCode() + '-cc-cvv',
'data-validate': JSON.stringify({'required-number':true, 'validate-card-cvv':'#' + getCode() + '_cc_type'})},
'data-validate': JSON.stringify({'required-number':true, 'validate-card-cvv':'#' + getCode() + '_cc_type'}),
maxLength : getCvcLength(),
oninput:'javascript: if (this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);'
},
enable: isActive($parents),
value: creditCardVerificationNumber"
data-validate="{required:true}"/>
value: creditCardVerificationNumber",
data-validate="{required:true}"
/>
<div class="field-tooltip toggle">
<span class="field-tooltip-action action-cvv"
tabindex="0"
......
......@@ -71,7 +71,7 @@
<!-- ko if: isPaymentMethodOpenInvoiceMethod() -->
<!-- ko if: showGender() -->
<div class="field gender_type type required">
<div class="field gender type required">
<label data-bind="attr: {for: getCode() + '_gender_type'}" class="label">
<span><!-- ko text: $t('Gender')--><!-- /ko --></span>
</label>
......@@ -91,7 +91,7 @@
<!--/ko-->
<!-- ko if: showDob() -->
<div class="field required">
<div class="field dob type required">
<label data-bind="attr: {for: getCode() + '_dob'}" class="label">
<span><!-- ko text: $t('Date of Birth')--><!-- /ko --></span>
</label>
......@@ -112,7 +112,7 @@
<!--/ko-->
<!-- ko if: showTelephone() -->
<div class="field required">
<div class="field telephone type required">
<label data-bind="attr: {for: getCode() + '_telephone'}" class="label">
<span><!-- ko text: $t('Telephone')--><!-- /ko --></span>
</label>
......@@ -120,20 +120,21 @@
<input type="number" class="input-text"
name="payment[telephone]"
data-bind="
attr: {
id: getCode() + '_telephone',
title: $t('Telephone'),
'data-container': getCode() + '-telephone',
'data-validate': JSON.stringify({'required-number':true })
},
value: telephone"
attr: {
id: getCode() + '_telephone',
title: $t('Telephone'),
'data-container': getCode() + '-telephone',
'data-validate': JSON.stringify({'required-number':true })
},
value: telephone"
data-validate="{required:true}"
/>
</div>
</div>
<!--/ko-->
<!-- ko if: showSsn() -->
<div class="field required">
<div class="field ssn type required">
<label data-bind="attr: {for: getCode() + '_ssn'}" class="label">
<span><!-- ko text: $t('Personal number (last digits)')--><!-- /ko --></span>
</label>
......@@ -149,6 +150,7 @@
maxlength : getSsnLength()
},
value: ssn"
data-validate="{required:true}"
/>
</div>
</div>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment