|
1
|
|
|
/** |
|
2
|
|
|
* |
|
3
|
|
|
* NOTICE OF LICENSE |
|
4
|
|
|
* |
|
5
|
|
|
* This source file is subject to the GNU General Public License (GPL 3) |
|
6
|
|
|
* that is bundled with this package in the file LICENSE.txt |
|
7
|
|
|
* |
|
8
|
|
|
* DISCLAIMER |
|
9
|
|
|
* |
|
10
|
|
|
* Do not edit or add to this file if you wish to upgrade Payone_Core to newer |
|
11
|
|
|
* versions in the future. If you wish to customize Payone_Core for your |
|
12
|
|
|
* needs please refer to http://www.payone.de for more information. |
|
13
|
|
|
* |
|
14
|
|
|
* @category Payone |
|
15
|
|
|
* @package js |
|
16
|
|
|
* @subpackage payone |
|
17
|
|
|
* @copyright Copyright (c) 2012 <[email protected]> - www.noovias.com |
|
18
|
|
|
* @author Matthias Walter <[email protected]> |
|
19
|
|
|
* @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3) |
|
20
|
|
|
* @link http://www.noovias.com |
|
21
|
|
|
*/ |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* PAYONE Service CreditCardCheck |
|
25
|
|
|
* |
|
26
|
|
|
* @param config |
|
27
|
|
|
* @constructor |
|
28
|
|
|
*/ |
|
29
|
|
|
PAYONE.Service.CreditCardCheck = function (handler, form, config) { |
|
|
|
|
|
|
30
|
|
|
this.handler = handler; |
|
31
|
|
|
this.form = form; |
|
32
|
|
|
this.config = config; |
|
33
|
|
|
this.origMethod = ''; |
|
34
|
|
|
this.iframes = false; |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* Enhances payment.save and runs Validate and CreditCardCheck for CreditCards |
|
38
|
|
|
* @todo rename this method? |
|
39
|
|
|
* @param origMethod |
|
40
|
|
|
*/ |
|
41
|
|
|
this.exec = function (origMethod) { |
|
42
|
|
|
var check = this.handler.haveToValidate(); |
|
43
|
|
|
|
|
44
|
|
|
if (check == 1) { |
|
45
|
|
|
this.handler.origMethod = origMethod; |
|
46
|
|
|
// Payone credit card payment method is available, and selected, initiate credit card check: |
|
47
|
|
|
if (this.validate(this.form)) { |
|
48
|
|
|
if(this.iframes == false) { |
|
49
|
|
|
this.creditcardcheck(); |
|
50
|
|
|
} else { |
|
51
|
|
|
this.creditcardcheckHosted(); |
|
52
|
|
|
} |
|
53
|
|
|
} |
|
54
|
|
|
} |
|
55
|
|
|
else { |
|
56
|
|
|
origMethod(); |
|
57
|
|
|
} |
|
58
|
|
|
}; |
|
59
|
|
|
|
|
60
|
|
|
this.initHosted = function (fieldconfig, type_id) { |
|
61
|
|
|
var configId = false; |
|
62
|
|
|
var elementCcType = $('payone_creditcard_cc_type_select'); |
|
63
|
|
|
var iFrameCvc = $("payone_creditcard_cc_cid_div"); |
|
64
|
|
|
if (elementCcType != undefined) { |
|
65
|
|
|
|
|
66
|
|
|
var ccTypeConfigKey = elementCcType.value; |
|
67
|
|
|
var ccTypeSplit = ccTypeConfigKey.split('_'); |
|
68
|
|
|
configId = ccTypeSplit[0]; |
|
69
|
|
|
var ccType = ccTypeSplit[1]; |
|
70
|
|
|
$("payone_creditcard_cc_type").setValue(ccType); |
|
71
|
|
|
|
|
72
|
|
|
if(elementCcType.length > 1 && $('payone_cc_check_validation_types').value.indexOf(ccType) != -1){ |
|
73
|
|
|
iFrameCvc.hide(); |
|
74
|
|
|
} |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
aConfig = this.getConfig(); |
|
|
|
|
|
|
78
|
|
|
request = aConfig.gateway[configId]; |
|
|
|
|
|
|
79
|
|
|
|
|
80
|
|
|
var iframes = new Payone.ClientApi.HostedIFrames(fieldconfig, request); |
|
|
|
|
|
|
81
|
|
|
iframes.setCardType(ccType); |
|
|
|
|
|
|
82
|
|
|
|
|
83
|
|
|
document.getElementById(type_id).onchange = function () { |
|
84
|
|
|
var elementCcType = $('payone_creditcard_cc_type_select'); |
|
85
|
|
|
|
|
86
|
|
|
if (elementCcType != undefined) { |
|
87
|
|
|
|
|
88
|
|
|
var ccTypeConfigKey = elementCcType.value; |
|
89
|
|
|
var ccTypeSplit = ccTypeConfigKey.split('_'); |
|
90
|
|
|
var ccType = ccTypeSplit[1]; |
|
91
|
|
|
var selectedValueIFrame = ccTypeConfigKey.substring(ccTypeConfigKey.indexOf("_") + 1); |
|
92
|
|
|
if($('payone_cc_check_validation_types').value.indexOf(selectedValueIFrame) != -1){ |
|
93
|
|
|
iFrameCvc.hide(); |
|
94
|
|
|
} else { |
|
95
|
|
|
iFrameCvc.show(); |
|
96
|
|
|
} |
|
97
|
|
|
iframes.setCardType(ccType); // on change: set new type of credit card to process |
|
98
|
|
|
} |
|
99
|
|
|
}; |
|
100
|
|
|
this.iframes = iframes; |
|
101
|
|
|
return iframes; |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
/** |
|
105
|
|
|
* Trigger CVC Code as configured |
|
106
|
|
|
* |
|
107
|
|
|
* @param element |
|
108
|
|
|
*/ |
|
109
|
|
|
this.displayCheckCvc = function (element) { |
|
110
|
|
|
config = $('payone_creditcard_config_cvc').value.evalJSON(); |
|
111
|
|
|
ccKey = element.value; |
|
|
|
|
|
|
112
|
|
|
|
|
113
|
|
|
var selectedValue = element.value.substring(element.value.indexOf("_") + 1); |
|
114
|
|
|
|
|
115
|
|
|
var cvcDiv = $("payone_creditcard_cc_cid_div"); |
|
116
|
|
|
if (cvcDiv != undefined && cvcDiv != null) { |
|
117
|
|
|
configCcKey = config[ccKey]; |
|
|
|
|
|
|
118
|
|
|
//check if selected creditcard is in hideCvcTypes |
|
119
|
|
|
if($('payone_cc_check_validation_types').value.indexOf(selectedValue) != -1){ |
|
120
|
|
|
cvcDiv.hide(); |
|
121
|
|
|
$('payone_cc_check_validation').value = 1; |
|
122
|
|
|
} else { |
|
123
|
|
|
cvcDiv.show(); |
|
124
|
|
|
|
|
125
|
|
|
} |
|
126
|
|
|
} |
|
127
|
|
|
}; |
|
128
|
|
|
|
|
129
|
|
|
/** |
|
130
|
|
|
* Validate the Form Data |
|
131
|
|
|
* |
|
132
|
|
|
* @param form Form Object |
|
133
|
|
|
* @return {*} |
|
134
|
|
|
*/ |
|
135
|
|
|
this.validate = function (form) { |
|
136
|
|
|
var elementCcType = $('payone_creditcard_cc_type_select'); |
|
137
|
|
|
if (elementCcType != undefined) { |
|
138
|
|
|
var ccTypeConfigKey = elementCcType.value; |
|
139
|
|
|
var ccTypeSplit = ccTypeConfigKey.split('_'); |
|
140
|
|
|
var configId = ccTypeSplit[0]; |
|
141
|
|
|
|
|
142
|
|
|
var ccType = ccTypeSplit[1]; |
|
143
|
|
|
$("payone_creditcard_config_id").setValue(configId); |
|
144
|
|
|
$("payone_creditcard_cc_type").setValue(ccType); |
|
145
|
|
|
} |
|
146
|
|
|
|
|
147
|
|
|
config = this.getConfig(); |
|
148
|
|
|
configValidation = config.validation; |
|
|
|
|
|
|
149
|
|
|
|
|
150
|
|
|
validation = new PAYONE.Validation.CreditCard(configValidation); |
|
|
|
|
|
|
151
|
|
|
return validation.validate(form); |
|
152
|
|
|
}; |
|
153
|
|
|
|
|
154
|
|
|
/** |
|
155
|
|
|
* Perform creditcard check via Payone Client API |
|
156
|
|
|
*/ |
|
157
|
|
|
this.creditcardcheck = function () { |
|
158
|
|
|
var configId = $("payone_creditcard_config_id").value; |
|
159
|
|
|
|
|
160
|
|
|
config = this.getConfig(); |
|
161
|
|
|
configGateway = config.gateway[configId]; |
|
|
|
|
|
|
162
|
|
|
|
|
163
|
|
|
var data = this.mapRequestCreditCardCheck(); |
|
164
|
|
|
|
|
165
|
|
|
var payoneGateway = new PAYONE.Gateway( |
|
|
|
|
|
|
166
|
|
|
configGateway, |
|
167
|
|
|
function (response) { |
|
168
|
|
|
return window.payone.handleResponseCreditcardCheck(response, false); |
|
169
|
|
|
} |
|
170
|
|
|
); |
|
171
|
|
|
payoneGateway.call(data); |
|
172
|
|
|
}; |
|
173
|
|
|
|
|
174
|
|
|
this.creditcardcheckHosted = function () { |
|
175
|
|
|
if (this.iframes.isComplete()) { |
|
176
|
|
|
$('payone_creditcard_hosted_error').hide(); |
|
177
|
|
|
$('payone_creditcard_cc_owner').value = $('firstname').value + ' ' + $('lastname').value; |
|
178
|
|
|
this.iframes.creditCardCheck('processPayoneResponseCCHosted'); |
|
179
|
|
|
} else { |
|
180
|
|
|
$('payone_creditcard_hosted_error').show(); |
|
181
|
|
|
} |
|
182
|
|
|
} |
|
183
|
|
|
|
|
184
|
|
|
/** |
|
185
|
|
|
* Collect PAYONE CreditCardCheck Request Parameters |
|
186
|
|
|
* |
|
187
|
|
|
* @return {*} |
|
188
|
|
|
*/ |
|
189
|
|
|
this.mapRequestCreditCardCheck = function () { |
|
190
|
|
|
data = { |
|
|
|
|
|
|
191
|
|
|
'cardexpiremonth':$('payone_creditcard_cc_expiration_month').value, |
|
192
|
|
|
'cardexpireyear':$('payone_creditcard_cc_expiration_year').value, |
|
193
|
|
|
'cardtype':$('payone_creditcard_cc_type').value |
|
194
|
|
|
}; |
|
195
|
|
|
if($('payone_pseudocardpan').value == '') { |
|
196
|
|
|
data.cardholder = $('payone_creditcard_cc_owner').value; |
|
197
|
|
|
data.cardpan = $('payone_creditcard_cc_number').value; |
|
198
|
|
|
} else { |
|
199
|
|
|
data.pseudocardpan = $('payone_pseudocardpan').value; |
|
200
|
|
|
} |
|
201
|
|
|
|
|
202
|
|
|
cid = $('payone_creditcard_cc_cid'); |
|
|
|
|
|
|
203
|
|
|
if (cid != undefined) { |
|
204
|
|
|
data.cardcvc2 = cid.value; |
|
205
|
|
|
} |
|
206
|
|
|
|
|
207
|
|
|
return data; |
|
208
|
|
|
}; |
|
209
|
|
|
|
|
210
|
|
|
/** |
|
211
|
|
|
* Handle response |
|
212
|
|
|
* |
|
213
|
|
|
* @param response |
|
214
|
|
|
* @return {Boolean} |
|
215
|
|
|
*/ |
|
216
|
|
|
this.handleResponseCreditcardCheck = function (response, blIsHostedIframe) { |
|
217
|
|
|
return this.handler.handleResponse(response, blIsHostedIframe); |
|
218
|
|
|
}; |
|
219
|
|
|
|
|
220
|
|
|
/** |
|
221
|
|
|
* Get Config (auto-initialize) |
|
222
|
|
|
* |
|
223
|
|
|
* @return {*} |
|
224
|
|
|
*/ |
|
225
|
|
|
this.getConfig = function () { |
|
226
|
|
|
if (this.config == '' || this.config == undefined) { |
|
227
|
|
|
configJson = $('payone_creditcard_config').value; |
|
|
|
|
|
|
228
|
|
|
this.config = configJson.evalJSON(); |
|
229
|
|
|
} |
|
230
|
|
|
|
|
231
|
|
|
return this.config; |
|
232
|
|
|
}; |
|
233
|
|
|
}; |
|
234
|
|
|
|
|
235
|
|
|
PAYONE.Handler.CreditCardCheck = {}; |
|
|
|
|
|
|
236
|
|
|
PAYONE.Handler.CreditCardCheck.OnepageCheckout = function () { |
|
237
|
|
|
this.origMethod = ''; |
|
238
|
|
|
|
|
239
|
|
|
this.haveToValidate = function () { |
|
240
|
|
|
var radio_p1_cc = $('p_method_payone_creditcard'); |
|
241
|
|
|
if (radio_p1_cc != undefined && radio_p1_cc != null && radio_p1_cc.checked) { |
|
242
|
|
|
if($('payone_cc_check_validation').value == 0) { |
|
243
|
|
|
return 0; |
|
244
|
|
|
} |
|
245
|
|
|
|
|
246
|
|
|
if (checkout.loadWaiting != false) { |
|
|
|
|
|
|
247
|
|
|
return 0; |
|
248
|
|
|
} |
|
249
|
|
|
|
|
250
|
|
|
if (payment.validate() != true) { |
|
|
|
|
|
|
251
|
|
|
return 0; |
|
252
|
|
|
} |
|
253
|
|
|
|
|
254
|
|
|
return 1; |
|
255
|
|
|
} |
|
256
|
|
|
|
|
257
|
|
|
return 0; |
|
258
|
|
|
}; |
|
259
|
|
|
|
|
260
|
|
|
this.handleResponse = function (response, blIsHostedIframe) { |
|
261
|
|
|
if (response.status != 'VALID') { |
|
262
|
|
|
// Failure |
|
263
|
|
|
if(typeof response.customermessage != 'undefined') { |
|
264
|
|
|
alert(response.customermessage); |
|
265
|
|
|
} else if(typeof response.errormessage != 'undefined') { |
|
266
|
|
|
alert(response.errormessage); |
|
267
|
|
|
} |
|
268
|
|
|
|
|
269
|
|
|
checkout.setLoadWaiting(false); |
|
|
|
|
|
|
270
|
|
|
return false; |
|
271
|
|
|
} |
|
272
|
|
|
|
|
273
|
|
|
// Success! |
|
274
|
|
|
var pseudocardpan = response.pseudocardpan; |
|
275
|
|
|
var truncatedcardpan = response.truncatedcardpan; |
|
276
|
|
|
|
|
277
|
|
|
if(blIsHostedIframe) { |
|
278
|
|
|
var cardexpiredate = response.cardexpiredate; |
|
279
|
|
|
$('payone_cardexpiredate').setValue(cardexpiredate); |
|
280
|
|
|
} |
|
281
|
|
|
|
|
282
|
|
|
$('payone_pseudocardpan').setValue(pseudocardpan); |
|
283
|
|
|
$('payone_truncatedcardpan').setValue(truncatedcardpan); |
|
284
|
|
|
$('payone_creditcard_cc_number').setValue(truncatedcardpan); |
|
285
|
|
|
|
|
286
|
|
|
cid = $('payone_creditcard_cc_cid'); |
|
|
|
|
|
|
287
|
|
|
if (cid != undefined) { |
|
288
|
|
|
$('payone_creditcard_cc_cid').setValue('') |
|
289
|
|
|
} |
|
290
|
|
|
|
|
291
|
|
|
checkout.setLoadWaiting('payment', false); |
|
292
|
|
|
|
|
293
|
|
|
// Post payment form to Magento: |
|
294
|
|
|
var request = new Ajax.Request( |
|
|
|
|
|
|
295
|
|
|
payment.saveUrl, |
|
|
|
|
|
|
296
|
|
|
{ |
|
297
|
|
|
method:'post', |
|
298
|
|
|
onComplete:payment.onComplete, |
|
299
|
|
|
onSuccess:payment.onSave, |
|
300
|
|
|
onFailure:checkout.ajaxFailure.bind(checkout), |
|
301
|
|
|
parameters:Form.serialize(payment.form) |
|
|
|
|
|
|
302
|
|
|
} |
|
303
|
|
|
); |
|
|
|
|
|
|
304
|
|
|
}; |
|
305
|
|
|
}; |
|
306
|
|
|
|
|
307
|
|
|
PAYONE.Handler.CreditCardCheck.Admin = function () { |
|
|
|
|
|
|
308
|
|
|
this.origMethod = ''; |
|
309
|
|
|
|
|
310
|
|
|
this.haveToValidate = function () { |
|
311
|
|
|
var radio_p1_cc = $('p_method_payone_creditcard'); |
|
312
|
|
|
|
|
313
|
|
|
if (radio_p1_cc != undefined && radio_p1_cc != null && radio_p1_cc.checked |
|
314
|
|
|
&& $('payone_pseudocardpan').value == '') { |
|
315
|
|
|
if($('payone_cc_check_validation').value == 0) { |
|
316
|
|
|
return 0; |
|
317
|
|
|
} |
|
318
|
|
|
|
|
319
|
|
|
return 1; |
|
320
|
|
|
} |
|
321
|
|
|
|
|
322
|
|
|
return 0; |
|
323
|
|
|
}; |
|
324
|
|
|
|
|
325
|
|
|
this.handleResponse = function (response, blIsHostedIframe) { |
|
326
|
|
|
if (response.status != 'VALID') { |
|
327
|
|
|
// Failure |
|
328
|
|
|
// Failure |
|
329
|
|
|
if(typeof response.customermessage != 'undefined') { |
|
330
|
|
|
alert(response.customermessage); |
|
331
|
|
|
} else if(typeof response.errormessage != 'undefined') { |
|
332
|
|
|
alert(response.errormessage); |
|
333
|
|
|
} |
|
334
|
|
|
|
|
335
|
|
|
return false; |
|
336
|
|
|
} |
|
337
|
|
|
|
|
338
|
|
|
// Success! |
|
339
|
|
|
var pseudocardpan = response.pseudocardpan; |
|
340
|
|
|
var truncatedcardpan = response.truncatedcardpan; |
|
341
|
|
|
|
|
342
|
|
|
if(blIsHostedIframe) { |
|
343
|
|
|
var cardexpiredate = response.cardexpiredate; |
|
344
|
|
|
$('payone_cardexpiredate').setValue(cardexpiredate); |
|
345
|
|
|
} |
|
346
|
|
|
|
|
347
|
|
|
$('payone_pseudocardpan').setValue(pseudocardpan); |
|
348
|
|
|
$('payone_truncatedcardpan').setValue(truncatedcardpan); |
|
349
|
|
|
$('payone_creditcard_cc_number').setValue(truncatedcardpan); |
|
350
|
|
|
|
|
351
|
|
|
cid = $('payone_creditcard_cc_cid'); |
|
|
|
|
|
|
352
|
|
|
if (cid != undefined) { |
|
353
|
|
|
$('payone_creditcard_cc_cid').setValue('') |
|
354
|
|
|
} |
|
355
|
|
|
|
|
356
|
|
|
// remove validation class cause CreditCard is validated |
|
357
|
|
|
// @todo when changing CardData it has to be added again or we exchange the form with labels and provide an edit button |
|
358
|
|
|
$('payone_creditcard_cc_number').removeClassName('validate-cc-number'); |
|
359
|
|
|
$('payone_creditcard_cc_number').removeClassName('validate-payone-cc-type'); |
|
360
|
|
|
this.origMethod(); |
|
|
|
|
|
|
361
|
|
|
}; |
|
362
|
|
|
}; |
|
363
|
|
|
|
|
364
|
|
|
PAYONE.Validation.CreditCard = function (config) { |
|
|
|
|
|
|
365
|
|
|
this.config = config; |
|
366
|
|
|
this.validationsCc = ''; |
|
367
|
|
|
this.validationsCcMagento = ''; |
|
368
|
|
|
|
|
369
|
|
|
this.validate = function (form) { |
|
370
|
|
|
this.initValidationType(); |
|
371
|
|
|
|
|
372
|
|
|
if($('payone_pseudocardpan').value == '') { |
|
373
|
|
|
Validation.add('validate-payone-cc-type', 'Credit card number does not match credit card type.', this.validateType, this); |
|
|
|
|
|
|
374
|
|
|
Validation.add('validate-payone-cc-validity-period', 'Credit card validity period is too short.', this.validateValidityPeriod, this); |
|
375
|
|
|
} |
|
376
|
|
|
|
|
377
|
|
|
var validator = new Validation(form); |
|
378
|
|
|
return validator.validate(); |
|
379
|
|
|
}; |
|
380
|
|
|
|
|
381
|
|
|
/** |
|
382
|
|
|
* Creditcard Validity Period Validation |
|
383
|
|
|
* |
|
384
|
|
|
* @param v |
|
385
|
|
|
* @param elm |
|
386
|
|
|
* @return {Boolean} |
|
387
|
|
|
*/ |
|
388
|
|
|
this.validateValidityPeriod = function (v, elm) { |
|
|
|
|
|
|
389
|
|
|
var year = $('payone_creditcard_cc_expiration_year').value; |
|
390
|
|
|
var validityCc = new Date(year, v, 1); // Start of next month |
|
391
|
|
|
|
|
392
|
|
|
return validityCc.getTime() > this.options.get('config').allowed_validity * 1000; // milliseconds vs. seconds |
|
393
|
|
|
}; |
|
394
|
|
|
|
|
395
|
|
|
/** |
|
396
|
|
|
* Creditcard Type Validation |
|
397
|
|
|
* |
|
398
|
|
|
* @param v |
|
399
|
|
|
* @param elm |
|
400
|
|
|
* @return {Boolean} |
|
401
|
|
|
*/ |
|
402
|
|
|
this.validateType = function (v, elm) { |
|
403
|
|
|
// remove credit card number delimiters such as "-" and space |
|
404
|
|
|
elm.value = removeDelimiters(elm.value); |
|
405
|
|
|
v = removeDelimiters(v); |
|
406
|
|
|
|
|
407
|
|
|
var ccTypeContainer = $(elm.id.substr(0, elm.id.indexOf('_cc_number')) + '_cc_type'); |
|
408
|
|
|
if (!ccTypeContainer) { |
|
409
|
|
|
return true; |
|
410
|
|
|
} |
|
411
|
|
|
|
|
412
|
|
|
var ccType = ccTypeContainer.value; |
|
413
|
|
|
var ccTypeValidator = this.options.get('validationsCc').get(ccType); |
|
414
|
|
|
|
|
415
|
|
|
if (typeof ccTypeValidator == 'undefined') { |
|
416
|
|
|
return false; |
|
417
|
|
|
} |
|
418
|
|
|
|
|
419
|
|
|
// Disabled checks: |
|
420
|
|
|
if (ccTypeValidator[0] == false) { |
|
421
|
|
|
return true; |
|
422
|
|
|
} |
|
423
|
|
|
|
|
424
|
|
|
// Validate credit card number according to type: |
|
425
|
|
|
var result = false; |
|
426
|
|
|
if (ccTypeValidator[0] && v.match(ccTypeValidator[0])) { |
|
427
|
|
|
result = true; |
|
428
|
|
|
} |
|
429
|
|
|
|
|
430
|
|
|
if (!result) { |
|
431
|
|
|
return false; |
|
432
|
|
|
} |
|
433
|
|
|
|
|
434
|
|
|
if (ccTypeContainer.hasClassName('validation-failed') && Validation.isOnChange) { |
|
|
|
|
|
|
435
|
|
|
Validation.validate(ccTypeContainer); |
|
436
|
|
|
} |
|
437
|
|
|
|
|
438
|
|
|
return true; |
|
439
|
|
|
}; |
|
440
|
|
|
|
|
441
|
|
|
this.initValidationType = function () { |
|
442
|
|
|
if (Validation.creditCardTypes) { |
|
|
|
|
|
|
443
|
|
|
this.validationsCcMagento = Validation.creditCardTypes; |
|
444
|
|
|
} |
|
445
|
|
|
else if (Validation.creditCartTypes) { |
|
446
|
|
|
// typo in certain Magento versions.. |
|
447
|
|
|
this.validationsCcMagento = Validation.creditCartTypes; |
|
448
|
|
|
} |
|
449
|
|
|
|
|
450
|
|
|
// validations for Payone credit card types |
|
451
|
|
|
this.validationsCc = $H( |
|
452
|
|
|
{ |
|
453
|
|
|
'O':[new RegExp('(^(5[0678])\\d{11,18}$)|(^(6[^0357])\\d{11,18}$)|(^(601)[^1]\\d{9,16}$)|(^(6011)\\d{9,11}$)|(^(6011)\\d{13,16}$)|(^(65)\\d{11,13}$)|(^(65)\\d{15,18}$)|(^(633)[^34](\\d{9,16}$))|(^(6333)[0-4](\\d{8,10}$))|(^(6333)[0-4](\\d{12}$))|(^(6333)[0-4](\\d{15}$))|(^(6333)[5-9](\\d{8,10}$))|(^(6333)[5-9](\\d{12}$))|(^(6333)[5-9](\\d{15}$))|(^(6334)[0-4](\\d{8,10}$))|(^(6334)[0-4](\\d{12}$))|(^(6334)[0-4](\\d{15}$))|(^(67)[^(59)](\\d{9,16}$))|(^(6759)](\\d{9,11}$))|(^(6759)](\\d{13}$))|(^(6759)](\\d{16}$))|(^(67)[^(67)](\\d{9,16}$))|(^(6767)](\\d{9,11}$))|(^(6767)](\\d{13}$))|(^(6767)](\\d{16}$))'), |
|
454
|
|
|
new RegExp('^[0-9]{3}$'), |
|
455
|
|
|
false], |
|
456
|
|
|
'V':this.validationsCcMagento.get('VI'), |
|
457
|
|
|
'A':this.validationsCcMagento.get('AE'), |
|
458
|
|
|
'M':this.validationsCcMagento.get('MC'), |
|
459
|
|
|
'J':this.validationsCcMagento.get('JCB'), |
|
460
|
|
|
'C':this.validationsCcMagento.get('DI'), |
|
461
|
|
|
'D':this.validationsCcMagento.get('OT'), |
|
462
|
|
|
'B':this.validationsCcMagento.get('OT'), |
|
463
|
|
|
'U':this.validationsCcMagento.get('OT') |
|
464
|
|
|
} |
|
465
|
|
|
); |
|
466
|
|
|
}; |
|
467
|
|
|
|
|
468
|
|
|
this.getConfig = function () { |
|
469
|
|
|
return this.config; |
|
470
|
|
|
}; |
|
471
|
|
|
}; |
|
472
|
|
|
|
|
473
|
|
|
function payoneChangedCreditCardInfo() |
|
474
|
|
|
{ |
|
475
|
|
|
$('payone_pseudocardpan').value = ''; |
|
476
|
|
|
$('payone_cc_check_validation').value = 1; |
|
477
|
|
|
$('payone_creditcard_cc_number').addClassName('validate-cc-number'); |
|
478
|
|
|
} |
|
479
|
|
|
|
|
480
|
|
|
function processPayoneResponseCCHosted(response) |
|
481
|
|
|
{ |
|
482
|
|
|
payone.handleResponseCreditcardCheck(response, true); |
|
|
|
|
|
|
483
|
|
|
} |
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.