node-paytmpg 5.3.0 → 5.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/codeql-analysis.yml +71 -71
- package/.github/workflows/nodejs.yml +24 -24
- package/.github/workflows/npm-publish.yml +23 -23
- package/Dockerfile +8 -8
- package/LICENSE +674 -674
- package/README.MD +245 -245
- package/app/controllers/adapters/open_money.js +515 -514
- package/app/controllers/checksum/checksum.js +154 -154
- package/app/controllers/checksum/crypt.js +98 -98
- package/app/controllers/checksum/server.js +132 -132
- package/app/controllers/np_user.controller.js +79 -79
- package/app/controllers/payment_controller.js +1067 -1067
- package/app/models/np_multidbplugin.js +101 -101
- package/app/models/np_transaction.model.js +16 -16
- package/app/models/np_user.model.js +11 -11
- package/app/routes/payment_route.js +73 -73
- package/app/views/home.hbs +21 -21
- package/app/views/init.hbs +92 -92
- package/app/views/layouts/index.hbs +57 -57
- package/app/views/result.hbs +49 -49
- package/app.yaml +18 -18
- package/example.js +51 -51
- package/index.js +23 -23
- package/package.json +42 -41
- package/public/css/style.css +268 -268
- package/public/js/index.js +282 -282
- package/public/layer_checkout.js +38 -38
- package/public/test.html +24 -24
package/public/js/index.js
CHANGED
|
@@ -1,283 +1,283 @@
|
|
|
1
|
-
/******/ (function(modules) { // webpackBootstrap
|
|
2
|
-
/******/ // The module cache
|
|
3
|
-
/******/ var installedModules = {};
|
|
4
|
-
|
|
5
|
-
/******/ // The require function
|
|
6
|
-
/******/ function __webpack_require__(moduleId) {
|
|
7
|
-
|
|
8
|
-
/******/ // Check if module is in cache
|
|
9
|
-
/******/ if(installedModules[moduleId])
|
|
10
|
-
/******/ return installedModules[moduleId].exports;
|
|
11
|
-
|
|
12
|
-
/******/ // Create a new module (and put it into the cache)
|
|
13
|
-
/******/ var module = installedModules[moduleId] = {
|
|
14
|
-
/******/ exports: {},
|
|
15
|
-
/******/ id: moduleId,
|
|
16
|
-
/******/ loaded: false
|
|
17
|
-
/******/ };
|
|
18
|
-
|
|
19
|
-
/******/ // Execute the module function
|
|
20
|
-
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
21
|
-
|
|
22
|
-
/******/ // Flag the module as loaded
|
|
23
|
-
/******/ module.loaded = true;
|
|
24
|
-
|
|
25
|
-
/******/ // Return the exports of the module
|
|
26
|
-
/******/ return module.exports;
|
|
27
|
-
/******/ }
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
/******/ // expose the modules object (__webpack_modules__)
|
|
31
|
-
/******/ __webpack_require__.m = modules;
|
|
32
|
-
|
|
33
|
-
/******/ // expose the module cache
|
|
34
|
-
/******/ __webpack_require__.c = installedModules;
|
|
35
|
-
|
|
36
|
-
/******/ // __webpack_public_path__
|
|
37
|
-
/******/ __webpack_require__.p = "/scripts/dist/";
|
|
38
|
-
|
|
39
|
-
/******/ // Load entry module and return exports
|
|
40
|
-
/******/ return __webpack_require__(0);
|
|
41
|
-
/******/ })
|
|
42
|
-
/************************************************************************/
|
|
43
|
-
/******/ ([
|
|
44
|
-
/* 0 */
|
|
45
|
-
/***/ function(module, exports, __webpack_require__) {
|
|
46
|
-
|
|
47
|
-
__webpack_require__(1);
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
/***/ },
|
|
51
|
-
/* 1 */
|
|
52
|
-
/***/ function(module, exports, __webpack_require__) {
|
|
53
|
-
|
|
54
|
-
'use strict';
|
|
55
|
-
|
|
56
|
-
var _creditCardType = __webpack_require__(2);
|
|
57
|
-
|
|
58
|
-
var _creditCardType2 = _interopRequireDefault(_creditCardType);
|
|
59
|
-
|
|
60
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
61
|
-
|
|
62
|
-
$(document).on('input change', '#input--cc input', function () {
|
|
63
|
-
var ccNum = $(this).val();
|
|
64
|
-
var ccType = (0, _creditCardType2.default)(ccNum);
|
|
65
|
-
|
|
66
|
-
if (!ccNum.length || typeof ccType === "undefined" || !ccType.length) {
|
|
67
|
-
$('#input--cc').removeClass().addClass('creditcard-icon');
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
var creditcardType = ccType[0].type;
|
|
72
|
-
|
|
73
|
-
var ccTypes = {
|
|
74
|
-
'american-express': 'AE',
|
|
75
|
-
'master-card': 'MC',
|
|
76
|
-
'visa': 'VI',
|
|
77
|
-
'discover': 'DI'
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
$('#input--cc').removeClass().addClass('creditcard-icon').addClass('creditcard-icon--' + creditcardType); //set creditcard icon
|
|
81
|
-
|
|
82
|
-
// select creditcard type
|
|
83
|
-
$(".creditcard-type > select").val(ccTypes[creditcardType]);
|
|
84
|
-
// set the creditcard type <select> to the value entered
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
/***/ },
|
|
88
|
-
/* 2 */
|
|
89
|
-
/***/ function(module, exports) {
|
|
90
|
-
|
|
91
|
-
'use strict';
|
|
92
|
-
|
|
93
|
-
var types = {};
|
|
94
|
-
var VISA = 'visa';
|
|
95
|
-
var MASTERCARD = 'master-card';
|
|
96
|
-
var AMERICAN_EXPRESS = 'american-express';
|
|
97
|
-
var DINERS_CLUB = 'diners-club';
|
|
98
|
-
var DISCOVER = 'discover';
|
|
99
|
-
var JCB = 'jcb';
|
|
100
|
-
var UNIONPAY = 'unionpay';
|
|
101
|
-
var MAESTRO = 'maestro';
|
|
102
|
-
var CVV = 'CVV';
|
|
103
|
-
var CID = 'CID';
|
|
104
|
-
var CVC = 'CVC';
|
|
105
|
-
var CVN = 'CVN';
|
|
106
|
-
var testOrder = [
|
|
107
|
-
VISA,
|
|
108
|
-
MASTERCARD,
|
|
109
|
-
AMERICAN_EXPRESS,
|
|
110
|
-
DINERS_CLUB,
|
|
111
|
-
DISCOVER,
|
|
112
|
-
JCB,
|
|
113
|
-
UNIONPAY,
|
|
114
|
-
MAESTRO
|
|
115
|
-
];
|
|
116
|
-
|
|
117
|
-
function clone(x) {
|
|
118
|
-
var prefixPattern, exactPattern, dupe;
|
|
119
|
-
|
|
120
|
-
if (!x) { return null; }
|
|
121
|
-
|
|
122
|
-
prefixPattern = x.prefixPattern.source;
|
|
123
|
-
exactPattern = x.exactPattern.source;
|
|
124
|
-
dupe = JSON.parse(JSON.stringify(x));
|
|
125
|
-
dupe.prefixPattern = prefixPattern;
|
|
126
|
-
dupe.exactPattern = exactPattern;
|
|
127
|
-
|
|
128
|
-
return dupe;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
types[VISA] = {
|
|
132
|
-
niceType: 'Visa',
|
|
133
|
-
type: VISA,
|
|
134
|
-
prefixPattern: /^4$/,
|
|
135
|
-
exactPattern: /^4\d*$/,
|
|
136
|
-
gaps: [4, 8, 12],
|
|
137
|
-
lengths: [16],
|
|
138
|
-
code: {
|
|
139
|
-
name: CVV,
|
|
140
|
-
size: 3
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
types[MASTERCARD] = {
|
|
145
|
-
niceType: 'MasterCard',
|
|
146
|
-
type: MASTERCARD,
|
|
147
|
-
prefixPattern: /^(5|5[1-5]|2|22|222|222[1-9]|2[3-6]|27[0-1]|2720)$/,
|
|
148
|
-
exactPattern: /^(5[1-5]|222[1-9]|2[3-6]|27[0-1]|2720)\d*$/,
|
|
149
|
-
gaps: [4, 8, 12],
|
|
150
|
-
lengths: [16],
|
|
151
|
-
code: {
|
|
152
|
-
name: CVC,
|
|
153
|
-
size: 3
|
|
154
|
-
}
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
types[AMERICAN_EXPRESS] = {
|
|
158
|
-
niceType: 'American Express',
|
|
159
|
-
type: AMERICAN_EXPRESS,
|
|
160
|
-
prefixPattern: /^(3|34|37)$/,
|
|
161
|
-
exactPattern: /^3[47]\d*$/,
|
|
162
|
-
isAmex: true,
|
|
163
|
-
gaps: [4, 10],
|
|
164
|
-
lengths: [15],
|
|
165
|
-
code: {
|
|
166
|
-
name: CID,
|
|
167
|
-
size: 4
|
|
168
|
-
}
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
types[DINERS_CLUB] = {
|
|
172
|
-
niceType: 'Diners Club',
|
|
173
|
-
type: DINERS_CLUB,
|
|
174
|
-
prefixPattern: /^(3|3[0689]|30[0-5])$/,
|
|
175
|
-
exactPattern: /^3(0[0-5]|[689])\d*$/,
|
|
176
|
-
gaps: [4, 10],
|
|
177
|
-
lengths: [14],
|
|
178
|
-
code: {
|
|
179
|
-
name: CVV,
|
|
180
|
-
size: 3
|
|
181
|
-
}
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
types[DISCOVER] = {
|
|
185
|
-
niceType: 'Discover',
|
|
186
|
-
type: DISCOVER,
|
|
187
|
-
prefixPattern: /^(6|60|601|6011|65|64|64[4-9])$/,
|
|
188
|
-
exactPattern: /^(6011|65|64[4-9])\d*$/,
|
|
189
|
-
gaps: [4, 8, 12],
|
|
190
|
-
lengths: [16, 19],
|
|
191
|
-
code: {
|
|
192
|
-
name: CID,
|
|
193
|
-
size: 3
|
|
194
|
-
}
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
types[JCB] = {
|
|
198
|
-
niceType: 'JCB',
|
|
199
|
-
type: JCB,
|
|
200
|
-
prefixPattern: /^(2|21|213|2131|1|18|180|1800|3|35)$/,
|
|
201
|
-
exactPattern: /^(2131|1800|35)\d*$/,
|
|
202
|
-
gaps: [4, 8, 12],
|
|
203
|
-
lengths: [16],
|
|
204
|
-
code: {
|
|
205
|
-
name: CVV,
|
|
206
|
-
size: 3
|
|
207
|
-
}
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
types[UNIONPAY] = {
|
|
211
|
-
niceType: 'UnionPay',
|
|
212
|
-
type: UNIONPAY,
|
|
213
|
-
prefixPattern: /^(6|62)$/,
|
|
214
|
-
exactPattern: /^62\d*$/,
|
|
215
|
-
gaps: [4, 8, 12],
|
|
216
|
-
lengths: [16, 17, 18, 19],
|
|
217
|
-
code: {
|
|
218
|
-
name: CVN,
|
|
219
|
-
size: 3
|
|
220
|
-
}
|
|
221
|
-
};
|
|
222
|
-
|
|
223
|
-
types[MAESTRO] = {
|
|
224
|
-
niceType: 'Maestro',
|
|
225
|
-
type: MAESTRO,
|
|
226
|
-
prefixPattern: /^(5|5[06-9]|6\d*)$/,
|
|
227
|
-
exactPattern: /^5[06-9]\d*$/,
|
|
228
|
-
gaps: [4, 8, 12],
|
|
229
|
-
lengths: [12, 13, 14, 15, 16, 17, 18, 19],
|
|
230
|
-
code: {
|
|
231
|
-
name: CVC,
|
|
232
|
-
size: 3
|
|
233
|
-
}
|
|
234
|
-
};
|
|
235
|
-
|
|
236
|
-
function creditCardType(cardNumber) {
|
|
237
|
-
var type, value, i;
|
|
238
|
-
var prefixResults = [];
|
|
239
|
-
var exactResults = [];
|
|
240
|
-
|
|
241
|
-
if (!(typeof cardNumber === 'string' || cardNumber instanceof String)) {
|
|
242
|
-
return [];
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
for (i = 0; i < testOrder.length; i++) {
|
|
246
|
-
type = testOrder[i];
|
|
247
|
-
value = types[type];
|
|
248
|
-
|
|
249
|
-
if (cardNumber.length === 0) {
|
|
250
|
-
prefixResults.push(clone(value));
|
|
251
|
-
continue;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
if (value.exactPattern.test(cardNumber)) {
|
|
255
|
-
exactResults.push(clone(value));
|
|
256
|
-
} else if (value.prefixPattern.test(cardNumber)) {
|
|
257
|
-
prefixResults.push(clone(value));
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
return exactResults.length ? exactResults : prefixResults;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
creditCardType.getTypeInfo = function (type) {
|
|
265
|
-
return clone(types[type]);
|
|
266
|
-
};
|
|
267
|
-
|
|
268
|
-
creditCardType.types = {
|
|
269
|
-
VISA: VISA,
|
|
270
|
-
MASTERCARD: MASTERCARD,
|
|
271
|
-
AMERICAN_EXPRESS: AMERICAN_EXPRESS,
|
|
272
|
-
DINERS_CLUB: DINERS_CLUB,
|
|
273
|
-
DISCOVER: DISCOVER,
|
|
274
|
-
JCB: JCB,
|
|
275
|
-
UNIONPAY: UNIONPAY,
|
|
276
|
-
MAESTRO: MAESTRO
|
|
277
|
-
};
|
|
278
|
-
|
|
279
|
-
module.exports = creditCardType;
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
/***/ }
|
|
1
|
+
/******/ (function(modules) { // webpackBootstrap
|
|
2
|
+
/******/ // The module cache
|
|
3
|
+
/******/ var installedModules = {};
|
|
4
|
+
|
|
5
|
+
/******/ // The require function
|
|
6
|
+
/******/ function __webpack_require__(moduleId) {
|
|
7
|
+
|
|
8
|
+
/******/ // Check if module is in cache
|
|
9
|
+
/******/ if(installedModules[moduleId])
|
|
10
|
+
/******/ return installedModules[moduleId].exports;
|
|
11
|
+
|
|
12
|
+
/******/ // Create a new module (and put it into the cache)
|
|
13
|
+
/******/ var module = installedModules[moduleId] = {
|
|
14
|
+
/******/ exports: {},
|
|
15
|
+
/******/ id: moduleId,
|
|
16
|
+
/******/ loaded: false
|
|
17
|
+
/******/ };
|
|
18
|
+
|
|
19
|
+
/******/ // Execute the module function
|
|
20
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
21
|
+
|
|
22
|
+
/******/ // Flag the module as loaded
|
|
23
|
+
/******/ module.loaded = true;
|
|
24
|
+
|
|
25
|
+
/******/ // Return the exports of the module
|
|
26
|
+
/******/ return module.exports;
|
|
27
|
+
/******/ }
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
/******/ // expose the modules object (__webpack_modules__)
|
|
31
|
+
/******/ __webpack_require__.m = modules;
|
|
32
|
+
|
|
33
|
+
/******/ // expose the module cache
|
|
34
|
+
/******/ __webpack_require__.c = installedModules;
|
|
35
|
+
|
|
36
|
+
/******/ // __webpack_public_path__
|
|
37
|
+
/******/ __webpack_require__.p = "/scripts/dist/";
|
|
38
|
+
|
|
39
|
+
/******/ // Load entry module and return exports
|
|
40
|
+
/******/ return __webpack_require__(0);
|
|
41
|
+
/******/ })
|
|
42
|
+
/************************************************************************/
|
|
43
|
+
/******/ ([
|
|
44
|
+
/* 0 */
|
|
45
|
+
/***/ function(module, exports, __webpack_require__) {
|
|
46
|
+
|
|
47
|
+
__webpack_require__(1);
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
/***/ },
|
|
51
|
+
/* 1 */
|
|
52
|
+
/***/ function(module, exports, __webpack_require__) {
|
|
53
|
+
|
|
54
|
+
'use strict';
|
|
55
|
+
|
|
56
|
+
var _creditCardType = __webpack_require__(2);
|
|
57
|
+
|
|
58
|
+
var _creditCardType2 = _interopRequireDefault(_creditCardType);
|
|
59
|
+
|
|
60
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
61
|
+
|
|
62
|
+
$(document).on('input change', '#input--cc input', function () {
|
|
63
|
+
var ccNum = $(this).val();
|
|
64
|
+
var ccType = (0, _creditCardType2.default)(ccNum);
|
|
65
|
+
|
|
66
|
+
if (!ccNum.length || typeof ccType === "undefined" || !ccType.length) {
|
|
67
|
+
$('#input--cc').removeClass().addClass('creditcard-icon');
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
var creditcardType = ccType[0].type;
|
|
72
|
+
|
|
73
|
+
var ccTypes = {
|
|
74
|
+
'american-express': 'AE',
|
|
75
|
+
'master-card': 'MC',
|
|
76
|
+
'visa': 'VI',
|
|
77
|
+
'discover': 'DI'
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
$('#input--cc').removeClass().addClass('creditcard-icon').addClass('creditcard-icon--' + creditcardType); //set creditcard icon
|
|
81
|
+
|
|
82
|
+
// select creditcard type
|
|
83
|
+
$(".creditcard-type > select").val(ccTypes[creditcardType]);
|
|
84
|
+
// set the creditcard type <select> to the value entered
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
/***/ },
|
|
88
|
+
/* 2 */
|
|
89
|
+
/***/ function(module, exports) {
|
|
90
|
+
|
|
91
|
+
'use strict';
|
|
92
|
+
|
|
93
|
+
var types = {};
|
|
94
|
+
var VISA = 'visa';
|
|
95
|
+
var MASTERCARD = 'master-card';
|
|
96
|
+
var AMERICAN_EXPRESS = 'american-express';
|
|
97
|
+
var DINERS_CLUB = 'diners-club';
|
|
98
|
+
var DISCOVER = 'discover';
|
|
99
|
+
var JCB = 'jcb';
|
|
100
|
+
var UNIONPAY = 'unionpay';
|
|
101
|
+
var MAESTRO = 'maestro';
|
|
102
|
+
var CVV = 'CVV';
|
|
103
|
+
var CID = 'CID';
|
|
104
|
+
var CVC = 'CVC';
|
|
105
|
+
var CVN = 'CVN';
|
|
106
|
+
var testOrder = [
|
|
107
|
+
VISA,
|
|
108
|
+
MASTERCARD,
|
|
109
|
+
AMERICAN_EXPRESS,
|
|
110
|
+
DINERS_CLUB,
|
|
111
|
+
DISCOVER,
|
|
112
|
+
JCB,
|
|
113
|
+
UNIONPAY,
|
|
114
|
+
MAESTRO
|
|
115
|
+
];
|
|
116
|
+
|
|
117
|
+
function clone(x) {
|
|
118
|
+
var prefixPattern, exactPattern, dupe;
|
|
119
|
+
|
|
120
|
+
if (!x) { return null; }
|
|
121
|
+
|
|
122
|
+
prefixPattern = x.prefixPattern.source;
|
|
123
|
+
exactPattern = x.exactPattern.source;
|
|
124
|
+
dupe = JSON.parse(JSON.stringify(x));
|
|
125
|
+
dupe.prefixPattern = prefixPattern;
|
|
126
|
+
dupe.exactPattern = exactPattern;
|
|
127
|
+
|
|
128
|
+
return dupe;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
types[VISA] = {
|
|
132
|
+
niceType: 'Visa',
|
|
133
|
+
type: VISA,
|
|
134
|
+
prefixPattern: /^4$/,
|
|
135
|
+
exactPattern: /^4\d*$/,
|
|
136
|
+
gaps: [4, 8, 12],
|
|
137
|
+
lengths: [16],
|
|
138
|
+
code: {
|
|
139
|
+
name: CVV,
|
|
140
|
+
size: 3
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
types[MASTERCARD] = {
|
|
145
|
+
niceType: 'MasterCard',
|
|
146
|
+
type: MASTERCARD,
|
|
147
|
+
prefixPattern: /^(5|5[1-5]|2|22|222|222[1-9]|2[3-6]|27[0-1]|2720)$/,
|
|
148
|
+
exactPattern: /^(5[1-5]|222[1-9]|2[3-6]|27[0-1]|2720)\d*$/,
|
|
149
|
+
gaps: [4, 8, 12],
|
|
150
|
+
lengths: [16],
|
|
151
|
+
code: {
|
|
152
|
+
name: CVC,
|
|
153
|
+
size: 3
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
types[AMERICAN_EXPRESS] = {
|
|
158
|
+
niceType: 'American Express',
|
|
159
|
+
type: AMERICAN_EXPRESS,
|
|
160
|
+
prefixPattern: /^(3|34|37)$/,
|
|
161
|
+
exactPattern: /^3[47]\d*$/,
|
|
162
|
+
isAmex: true,
|
|
163
|
+
gaps: [4, 10],
|
|
164
|
+
lengths: [15],
|
|
165
|
+
code: {
|
|
166
|
+
name: CID,
|
|
167
|
+
size: 4
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
types[DINERS_CLUB] = {
|
|
172
|
+
niceType: 'Diners Club',
|
|
173
|
+
type: DINERS_CLUB,
|
|
174
|
+
prefixPattern: /^(3|3[0689]|30[0-5])$/,
|
|
175
|
+
exactPattern: /^3(0[0-5]|[689])\d*$/,
|
|
176
|
+
gaps: [4, 10],
|
|
177
|
+
lengths: [14],
|
|
178
|
+
code: {
|
|
179
|
+
name: CVV,
|
|
180
|
+
size: 3
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
types[DISCOVER] = {
|
|
185
|
+
niceType: 'Discover',
|
|
186
|
+
type: DISCOVER,
|
|
187
|
+
prefixPattern: /^(6|60|601|6011|65|64|64[4-9])$/,
|
|
188
|
+
exactPattern: /^(6011|65|64[4-9])\d*$/,
|
|
189
|
+
gaps: [4, 8, 12],
|
|
190
|
+
lengths: [16, 19],
|
|
191
|
+
code: {
|
|
192
|
+
name: CID,
|
|
193
|
+
size: 3
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
types[JCB] = {
|
|
198
|
+
niceType: 'JCB',
|
|
199
|
+
type: JCB,
|
|
200
|
+
prefixPattern: /^(2|21|213|2131|1|18|180|1800|3|35)$/,
|
|
201
|
+
exactPattern: /^(2131|1800|35)\d*$/,
|
|
202
|
+
gaps: [4, 8, 12],
|
|
203
|
+
lengths: [16],
|
|
204
|
+
code: {
|
|
205
|
+
name: CVV,
|
|
206
|
+
size: 3
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
types[UNIONPAY] = {
|
|
211
|
+
niceType: 'UnionPay',
|
|
212
|
+
type: UNIONPAY,
|
|
213
|
+
prefixPattern: /^(6|62)$/,
|
|
214
|
+
exactPattern: /^62\d*$/,
|
|
215
|
+
gaps: [4, 8, 12],
|
|
216
|
+
lengths: [16, 17, 18, 19],
|
|
217
|
+
code: {
|
|
218
|
+
name: CVN,
|
|
219
|
+
size: 3
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
types[MAESTRO] = {
|
|
224
|
+
niceType: 'Maestro',
|
|
225
|
+
type: MAESTRO,
|
|
226
|
+
prefixPattern: /^(5|5[06-9]|6\d*)$/,
|
|
227
|
+
exactPattern: /^5[06-9]\d*$/,
|
|
228
|
+
gaps: [4, 8, 12],
|
|
229
|
+
lengths: [12, 13, 14, 15, 16, 17, 18, 19],
|
|
230
|
+
code: {
|
|
231
|
+
name: CVC,
|
|
232
|
+
size: 3
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
function creditCardType(cardNumber) {
|
|
237
|
+
var type, value, i;
|
|
238
|
+
var prefixResults = [];
|
|
239
|
+
var exactResults = [];
|
|
240
|
+
|
|
241
|
+
if (!(typeof cardNumber === 'string' || cardNumber instanceof String)) {
|
|
242
|
+
return [];
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
for (i = 0; i < testOrder.length; i++) {
|
|
246
|
+
type = testOrder[i];
|
|
247
|
+
value = types[type];
|
|
248
|
+
|
|
249
|
+
if (cardNumber.length === 0) {
|
|
250
|
+
prefixResults.push(clone(value));
|
|
251
|
+
continue;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
if (value.exactPattern.test(cardNumber)) {
|
|
255
|
+
exactResults.push(clone(value));
|
|
256
|
+
} else if (value.prefixPattern.test(cardNumber)) {
|
|
257
|
+
prefixResults.push(clone(value));
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
return exactResults.length ? exactResults : prefixResults;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
creditCardType.getTypeInfo = function (type) {
|
|
265
|
+
return clone(types[type]);
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
creditCardType.types = {
|
|
269
|
+
VISA: VISA,
|
|
270
|
+
MASTERCARD: MASTERCARD,
|
|
271
|
+
AMERICAN_EXPRESS: AMERICAN_EXPRESS,
|
|
272
|
+
DINERS_CLUB: DINERS_CLUB,
|
|
273
|
+
DISCOVER: DISCOVER,
|
|
274
|
+
JCB: JCB,
|
|
275
|
+
UNIONPAY: UNIONPAY,
|
|
276
|
+
MAESTRO: MAESTRO
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
module.exports = creditCardType;
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
/***/ }
|
|
283
283
|
/******/ ]);
|
package/public/layer_checkout.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
function triggerLayer() {
|
|
2
|
-
|
|
3
|
-
Layer.checkout(
|
|
4
|
-
{
|
|
5
|
-
token: layer_params.payment_token_id,
|
|
6
|
-
accesskey: layer_params.accesskey,
|
|
7
|
-
},
|
|
8
|
-
function (response) {
|
|
9
|
-
console.log(response)
|
|
10
|
-
if(response !== null || response.length > 0 ){
|
|
11
|
-
|
|
12
|
-
if(response.payment_id !== undefined){
|
|
13
|
-
|
|
14
|
-
document.getElementById('layer_payment_id').value = response.payment_id;
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
document.layer_payment_int_form.submit();
|
|
21
|
-
},
|
|
22
|
-
function (err) {
|
|
23
|
-
alert(err.message);
|
|
24
|
-
}
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
/*
|
|
28
|
-
var checkExist = setInterval(function() {
|
|
29
|
-
if (typeof Layer !== 'undefined') {
|
|
30
|
-
console.log('Layer Loaded...');
|
|
31
|
-
clearInterval(checkExist);
|
|
32
|
-
triggerLayer();
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
console.log('Layer undefined...');
|
|
36
|
-
}
|
|
37
|
-
}, 1000);
|
|
38
|
-
*/
|
|
1
|
+
function triggerLayer() {
|
|
2
|
+
|
|
3
|
+
Layer.checkout(
|
|
4
|
+
{
|
|
5
|
+
token: layer_params.payment_token_id,
|
|
6
|
+
accesskey: layer_params.accesskey,
|
|
7
|
+
},
|
|
8
|
+
function (response) {
|
|
9
|
+
console.log(response)
|
|
10
|
+
if(response !== null || response.length > 0 ){
|
|
11
|
+
|
|
12
|
+
if(response.payment_id !== undefined){
|
|
13
|
+
|
|
14
|
+
document.getElementById('layer_payment_id').value = response.payment_id;
|
|
15
|
+
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
document.layer_payment_int_form.submit();
|
|
21
|
+
},
|
|
22
|
+
function (err) {
|
|
23
|
+
alert(err.message);
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
/*
|
|
28
|
+
var checkExist = setInterval(function() {
|
|
29
|
+
if (typeof Layer !== 'undefined') {
|
|
30
|
+
console.log('Layer Loaded...');
|
|
31
|
+
clearInterval(checkExist);
|
|
32
|
+
triggerLayer();
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
console.log('Layer undefined...');
|
|
36
|
+
}
|
|
37
|
+
}, 1000);
|
|
38
|
+
*/
|