Skip to content

Commit 6209f41

Browse files
author
Nikita Chubukov
committed
MAGETWO-91784: On Payment screen up and down arrow key allow to add -ve numbers
- Trim the first dash in "Credit Card Number" field
1 parent 752dae4 commit 6209f41

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

app/code/Magento/Payment/view/base/web/js/model/credit-card-validation/credit-card-number-validator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ define([
3636
return resultWrapper(null, false, false);
3737
}
3838

39-
value = value.replace(/\-|\s/g, '');
39+
value = value.replace(/|\s/g, '');
4040

4141
if (!/^\d*$/.test(value)) {
4242
return resultWrapper(null, false, false);

app/code/Magento/Payment/view/base/web/js/model/credit-card-validation/validator.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@
2323
}(function ($, cvvValidator, creditCardNumberValidator, yearValidator, monthValidator, creditCardData) {
2424
'use strict';
2525

26+
$('.payment-method-content input[type="number"]').on('keyup', function() {
27+
if ($(this).val() < 0) {
28+
$(this).val($(this).val().replace(/^-/, ''));
29+
}
30+
});
31+
2632
$.each({
2733
'validate-card-type': [
2834
function (number, item, allowedTypes) {

0 commit comments

Comments
 (0)