Skip to content

Commit 999dd6f

Browse files
committed
update Elo pattern
1 parent 64044c6 commit 999dd6f

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

src/index.jsx

+23-6
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ class ReactCreditCards extends React.Component {
2323
cvcLength: [3],
2424
luhn: true,
2525
};
26+
27+
this.elo = {
28+
type: 'elo',
29+
pattern: /^(4011(78|79)|43(1274|8935)|45(1416|7393|763(1|2))|50(4175|6699|67[0-7][0-9]|9000)|627780|63(6297|6368)|650(03([^4])|04([0-9])|05(0|1)|4(0[5-9]|3[0-9]|8[5-9]|9[0-9])|5([0-2][0-9]|3[0-8])|9([2-6][0-9]|7[0-8])|541|700|720|901)|651652|655000|655021)/,
30+
format: /(\d{1,4})/g,
31+
length: [16],
32+
cvcLength: [3],
33+
luhn: true,
34+
};
2635
}
2736

2837
static propTypes = {
@@ -97,15 +106,23 @@ class ReactCreditCards extends React.Component {
97106
newCardArray.push(this.hipercard);
98107
}
99108

100-
Payment.getCardArray().forEach(d => {
101-
if (acceptedCards.includes(d.type)) {
102-
newCardArray.push(d);
103-
}
104-
});
109+
if (acceptedCards.includes('elo')) {
110+
newCardArray.push(this.elo);
111+
}
112+
113+
Payment.getCardArray()
114+
.filter(d => d.type !== 'elo')
115+
.forEach(d => {
116+
console.log(d);
117+
if (acceptedCards.includes(d.type)) {
118+
newCardArray.push(d);
119+
}
120+
});
105121
}
106122
else {
107123
newCardArray.push(this.hipercard);
108-
newCardArray = newCardArray.concat(Payment.getCardArray());
124+
newCardArray.push(this.elo);
125+
newCardArray = newCardArray.concat(Payment.getCardArray().filter(d => d.type !== 'elo'));
109126
}
110127

111128
Payment.setCardArray(newCardArray);

0 commit comments

Comments
 (0)