File tree 1 file changed +23
-6
lines changed
1 file changed +23
-6
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,15 @@ class ReactCreditCards extends React.Component {
23
23
cvcLength : [ 3 ] ,
24
24
luhn : true ,
25
25
} ;
26
+
27
+ this . elo = {
28
+ type : 'elo' ,
29
+ pattern : / ^ ( 4 0 1 1 ( 7 8 | 7 9 ) | 4 3 ( 1 2 7 4 | 8 9 3 5 ) | 4 5 ( 1 4 1 6 | 7 3 9 3 | 7 6 3 ( 1 | 2 ) ) | 5 0 ( 4 1 7 5 | 6 6 9 9 | 6 7 [ 0 - 7 ] [ 0 - 9 ] | 9 0 0 0 ) | 6 2 7 7 8 0 | 6 3 ( 6 2 9 7 | 6 3 6 8 ) | 6 5 0 ( 0 3 ( [ ^ 4 ] ) | 0 4 ( [ 0 - 9 ] ) | 0 5 ( 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 ] ) | 5 4 1 | 7 0 0 | 7 2 0 | 9 0 1 ) | 6 5 1 6 5 2 | 6 5 5 0 0 0 | 6 5 5 0 2 1 ) / ,
30
+ format : / ( \d { 1 , 4 } ) / g,
31
+ length : [ 16 ] ,
32
+ cvcLength : [ 3 ] ,
33
+ luhn : true ,
34
+ } ;
26
35
}
27
36
28
37
static propTypes = {
@@ -97,15 +106,23 @@ class ReactCreditCards extends React.Component {
97
106
newCardArray . push ( this . hipercard ) ;
98
107
}
99
108
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
+ } ) ;
105
121
}
106
122
else {
107
123
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' ) ) ;
109
126
}
110
127
111
128
Payment . setCardArray ( newCardArray ) ;
You can’t perform that action at this time.
0 commit comments