Completed
Pull Request — master (#172)
by
unknown
04:31
created

creditcard.js ➔ updateCcLogo   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 8
rs 9.4285
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) {
0 ignored issues
show
Bug introduced by
The variable PAYONE seems to be never declared. If this is a global, consider adding a /** global: PAYONE */ comment.

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.

Loading history...
30
    this.handler = handler;
31
    this.form = form;
32
    this.config = config;
33
    this.origMethod = '';
34
    this.iframes = false;
35
    this.ccTypeAutoRecognition = 0;
36
    this.configActivatedCcTypes = '';
37
    this.supportedCardTypes = null;
38
39
    /**
40
     * Enhances payment.save and runs Validate and CreditCardCheck for CreditCards
41
     * @todo rename this method?
42
     * @param origMethod
43
     */
44
    this.exec = function (origMethod) {
45
        var check = this.handler.haveToValidate();
46
47
        if (check == 1) {
48
            this.handler.origMethod = origMethod;
49
            // Payone credit card payment method is available, and selected, initiate credit card check:
50
            if (this.validate(this.form)) {
51
                if(this.iframes == false) {
52
                    this.creditcardcheck();
53
                } else {
54
                    this.creditcardcheckHosted();
55
                }
56
            }
57
        }
58
        else {
59
            origMethod();
60
        }
61
    };
62
    
63
    this.initHosted = function (fieldconfig, type_id) {
64
        var configId = false;
65
        var elementCcType = $('payone_creditcard_cc_type_select');
66
        var iFrameCvc = $("payone_creditcard_cc_cid_div");
67
        if (elementCcType != undefined) {
68
69
            var ccTypeConfigKey = elementCcType.value;
70
            var ccTypeSplit = ccTypeConfigKey.split('_');
71
            configId = ccTypeSplit[0];
72
            var ccType = ccTypeSplit[1];
73
            $("payone_creditcard_cc_type").setValue(ccType);
74
75
            if(elementCcType.length > 1 && $('payone_cc_check_validation_types').value.indexOf(ccType) != -1){
76
                iFrameCvc.hide();
77
             }
78
            updateCcLogo(ccType);
79
        }
80
81
        aConfig = this.getConfig();
0 ignored issues
show
Bug introduced by
The variable aConfig seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.aConfig.
Loading history...
82
        request = aConfig.gateway[configId];
0 ignored issues
show
Bug introduced by
The variable request seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.request.
Loading history...
83
84
        var iframes = new Payone.ClientApi.HostedIFrames(fieldconfig, request);
0 ignored issues
show
Bug introduced by
The variable Payone seems to be never declared. If this is a global, consider adding a /** global: Payone */ comment.

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.

Loading history...
85
        iframes.setCardType(ccType);
0 ignored issues
show
Bug introduced by
The variable ccType does not seem to be initialized in case elementCcType != undefined on line 67 is false. Are you sure the function setCardType handles undefined variables?
Loading history...
86
87
        document.getElementById(type_id).onchange = function () {
88
            var elementCcType = $('payone_creditcard_cc_type_select');
89
90
            if (elementCcType != undefined) {
91
92
                var ccTypeConfigKey = elementCcType.value;
93
                var ccTypeSplit = ccTypeConfigKey.split('_');
94
                var ccType = ccTypeSplit[1];
95
                var selectedValueIFrame = ccTypeConfigKey.substring(ccTypeConfigKey.indexOf("_") + 1);
96
                if($('payone_cc_check_validation_types').value.indexOf(selectedValueIFrame) != -1){
97
                    iFrameCvc.hide();
98
                } else {
99
                    iFrameCvc.show();
100
                }
101
                iframes.setCardType(ccType); // on change: set new type of credit card to process
102
                updateCcLogo(ccType);
103
            }
104
        };
105
        this.iframes = iframes;
106
        return iframes;
107
    };
108
109
    /**
110
     * Trigger CVC Code as configured
111
     *
112
     * @param element
113
     */
114
    this.displayCheckCvc = function (element) {
115
        config = $('payone_creditcard_config_cvc').value.evalJSON();
116
        ccKey = element.value;
0 ignored issues
show
Bug introduced by
The variable ccKey seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.ccKey.
Loading history...
117
118
        var selectedValue = element.value.substring(element.value.indexOf("_") + 1);
119
120
        var cvcDiv = $("payone_creditcard_cc_cid_div");
121
        if (cvcDiv != undefined && cvcDiv != null) {
122
            configCcKey = config[ccKey];
0 ignored issues
show
Bug introduced by
The variable configCcKey seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.configCcKey.
Loading history...
123
            //check if selected creditcard is in hideCvcTypes
124
            if($('payone_cc_check_validation_types').value.indexOf(selectedValue) != -1){
125
                cvcDiv.hide();
126
                $('payone_cc_check_validation').value = 1;
127
            } else {
128
                cvcDiv.show();
129
130
            }
131
        }
132
    };
133
134
    /**
135
     * Validate the Form Data
136
     *
137
     * @param form Form Object
138
     * @return {*}
139
     */
140
    this.validate = function (form) {
141
        var elementCcType = $('payone_creditcard_cc_type_select');
142
        if (elementCcType != undefined) {
143
            var ccTypeConfigKey = elementCcType.value;
144
            var ccTypeSplit = ccTypeConfigKey.split('_');
145
            var configId = ccTypeSplit[0];
146
147
            var ccType = ccTypeSplit[1];
148
            $("payone_creditcard_config_id").setValue(configId);
149
            $("payone_creditcard_cc_type").setValue(ccType);
150
        }
151
152
        config = this.getConfig();
153
        configValidation = config.validation;
0 ignored issues
show
Bug introduced by
The variable configValidation seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.configValidation.
Loading history...
154
155
        validation = new PAYONE.Validation.CreditCard(configValidation);
0 ignored issues
show
Bug introduced by
The variable validation seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.validation.
Loading history...
Bug introduced by
The variable PAYONE seems to be never declared. If this is a global, consider adding a /** global: PAYONE */ comment.

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.

Loading history...
156
        return validation.validate(form);
157
    };
158
159
    /**
160
     * Perform creditcard check via Payone Client API
161
     */
162
    this.creditcardcheck = function () {
163
        var configId = $("payone_creditcard_config_id").value;
164
165
        config = this.getConfig();
166
        configGateway = config.gateway[configId];
0 ignored issues
show
Bug introduced by
The variable configGateway seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.configGateway.
Loading history...
167
168
        var data = this.mapRequestCreditCardCheck();
169
170
        var payoneGateway = new PAYONE.Gateway(
0 ignored issues
show
Bug introduced by
The variable PAYONE seems to be never declared. If this is a global, consider adding a /** global: PAYONE */ comment.

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.

Loading history...
171
            configGateway,
172
            function (response) {
173
                return window.payone.handleResponseCreditcardCheck(response, false);
174
            }
175
        );
176
        payoneGateway.call(data);
177
    };
178
    
179
    this.creditcardcheckHosted = function () {
180
        if (this.iframes.isComplete()) {
181
            $('payone_creditcard_hosted_error').hide();
182
            $('payone_creditcard_cc_owner').value = $('firstname').value + ' ' + $('lastname').value;            
183
            this.iframes.creditCardCheck('processPayoneResponseCCHosted');
184
        } else {
185
            $('payone_creditcard_hosted_error').show();
186
        }
187
    }
188
189
    /**
190
     * Collect PAYONE CreditCardCheck Request Parameters
191
     *
192
     * @return {*}
193
     */
194
    this.mapRequestCreditCardCheck = function () {
195
        data = {
0 ignored issues
show
Bug introduced by
The variable data seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.data.
Loading history...
196
            'cardexpiremonth':$('payone_creditcard_cc_expiration_month').value,
197
            'cardexpireyear':$('payone_creditcard_cc_expiration_year').value,
198
            'cardtype':$('payone_creditcard_cc_type').value
199
        };
200
        if($('payone_pseudocardpan').value == '') {
201
            data.cardholder = $('payone_creditcard_cc_owner').value;
202
            data.cardpan = $('payone_creditcard_cc_number').value;
203
        } else {
204
            data.pseudocardpan = $('payone_pseudocardpan').value;
205
        }
206
207
        cid = $('payone_creditcard_cc_cid');
0 ignored issues
show
Bug introduced by
The variable cid seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.cid.
Loading history...
208
        if (cid != undefined) {
209
            data.cardcvc2 = cid.value;
210
        }
211
212
        return data;
213
    };
214
215
    /**
216
     * Handle response
217
     *
218
     * @param response
219
     * @return {Boolean}
220
     */
221
    this.handleResponseCreditcardCheck = function (response, blIsHostedIframe) {
222
        return this.handler.handleResponse(response, blIsHostedIframe);
223
    };
224
225
    /**
226
     * Get Config (auto-initialize)
227
     *
228
     * @return {*}
229
     */
230
    this.getConfig = function () {
231
        if (this.config == '' || this.config == undefined) {
232
            configJson = $('payone_creditcard_config').value;
0 ignored issues
show
Bug introduced by
The variable configJson seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.configJson.
Loading history...
233
            this.config = configJson.evalJSON();
234
        }
235
236
        return this.config;
237
    };
238
239
    this.getSupportedCardTypes = function () {
240
        if (this.supportedCardTypes === null) {
241
            this.supportedCardTypes = this.configActivatedCcTypes.split(',');
242
        }
243
244
        return this.supportedCardTypes;
245
    };
246
};
247
248
PAYONE.Handler.CreditCardCheck = {};
0 ignored issues
show
Bug introduced by
The variable PAYONE seems to be never declared. If this is a global, consider adding a /** global: PAYONE */ comment.

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.

Loading history...
249
PAYONE.Handler.CreditCardCheck.OnepageCheckout = function () {
250
    this.origMethod = '';
251
252
    this.haveToValidate = function () {
253
        var radio_p1_cc = $('p_method_payone_creditcard');
254
        if (radio_p1_cc != undefined && radio_p1_cc != null && radio_p1_cc.checked) {
255
            if($('payone_cc_check_validation').value == 0) {
256
                return 0;
257
            }
258
259
            if (checkout.loadWaiting != false) {
0 ignored issues
show
Bug introduced by
The variable checkout seems to be never declared. If this is a global, consider adding a /** global: checkout */ comment.

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.

Loading history...
260
                return 0;
261
            }
262
263
            if (payment.validate() != true) {
0 ignored issues
show
Bug introduced by
The variable payment seems to be never declared. If this is a global, consider adding a /** global: payment */ comment.

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.

Loading history...
264
                return 0;
265
            }
266
267
            return 1;
268
        }
269
270
        return 0;
271
    };
272
273
    this.handleResponse = function (response, blIsHostedIframe) {
274
        if (response.status != 'VALID') {
275
            // Failure
276
            if(typeof response.customermessage != 'undefined') {
277
                alert(response.customermessage);
278
            } else if(typeof response.errormessage != 'undefined') {
279
                alert(response.errormessage);
280
            }
281
282
            checkout.setLoadWaiting(false);
0 ignored issues
show
Bug introduced by
The variable checkout seems to be never declared. If this is a global, consider adding a /** global: checkout */ comment.

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.

Loading history...
283
            return false;
284
        }
285
286
        // Success!
287
        var pseudocardpan = response.pseudocardpan;
288
        var truncatedcardpan = response.truncatedcardpan;
289
        
290
        if(blIsHostedIframe) {
291
            var cardexpiredate = response.cardexpiredate;
292
            $('payone_cardexpiredate').setValue(cardexpiredate);
293
        }
294
295
        $('payone_pseudocardpan').setValue(pseudocardpan);
296
        $('payone_truncatedcardpan').setValue(truncatedcardpan);
297
        $('payone_creditcard_cc_number').setValue(truncatedcardpan);
298
299
        cid = $('payone_creditcard_cc_cid');
0 ignored issues
show
Bug introduced by
The variable cid seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.cid.
Loading history...
300
        if (cid != undefined) {
301
            $('payone_creditcard_cc_cid').setValue('')
302
        }
303
304
        checkout.setLoadWaiting('payment', false);
305
306
        // Post payment form to Magento:
307
        var request = new Ajax.Request(
0 ignored issues
show
Bug introduced by
The variable Ajax seems to be never declared. If this is a global, consider adding a /** global: Ajax */ comment.

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.

Loading history...
Unused Code introduced by
The variable request seems to be never used. Consider removing it.
Loading history...
308
            payment.saveUrl,
0 ignored issues
show
Bug introduced by
The variable payment seems to be never declared. If this is a global, consider adding a /** global: payment */ comment.

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.

Loading history...
309
            {
310
                method:'post',
311
                onComplete:payment.onComplete,
312
                onSuccess:payment.onSave,
313
                onFailure:checkout.ajaxFailure.bind(checkout),
314
                parameters:Form.serialize(payment.form)
0 ignored issues
show
Bug introduced by
The variable Form seems to be never declared. If this is a global, consider adding a /** global: Form */ comment.

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.

Loading history...
315
            }
316
        );
0 ignored issues
show
Best Practice introduced by
There is no return statement in this branch, but you do return something in other branches. Did you maybe miss it? If you do not want to return anything, consider adding return undefined; explicitly.
Loading history...
317
    };
318
};
319
320
PAYONE.Handler.CreditCardCheck.Admin = function () {
0 ignored issues
show
Bug introduced by
The variable PAYONE seems to be never declared. If this is a global, consider adding a /** global: PAYONE */ comment.

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.

Loading history...
321
    this.origMethod = '';
322
323
    this.haveToValidate = function () {
324
        var radio_p1_cc = $('p_method_payone_creditcard');
325
326
        if (radio_p1_cc != undefined && radio_p1_cc != null && radio_p1_cc.checked
327
            && $('payone_pseudocardpan').value == '') {
328
            if($('payone_cc_check_validation').value == 0) {
329
                return 0;
330
            }
331
332
            return 1;
333
        }
334
335
        return 0;
336
    };
337
338
    this.handleResponse = function (response, blIsHostedIframe) {
339
        if (response.status != 'VALID') {
340
            // Failure
341
            // Failure
342
            if(typeof response.customermessage != 'undefined') {
343
                alert(response.customermessage);
344
            } else if(typeof response.errormessage != 'undefined') {
345
                alert(response.errormessage);
346
            }
347
348
            return false;
349
        }
350
351
        // Success!
352
        var pseudocardpan = response.pseudocardpan;
353
        var truncatedcardpan = response.truncatedcardpan;
354
355
        if(blIsHostedIframe) {
356
            var cardexpiredate = response.cardexpiredate;
357
            $('payone_cardexpiredate').setValue(cardexpiredate);
358
        }
359
360
        $('payone_pseudocardpan').setValue(pseudocardpan);
361
        $('payone_truncatedcardpan').setValue(truncatedcardpan);
362
        $('payone_creditcard_cc_number').setValue(truncatedcardpan);
363
364
        cid = $('payone_creditcard_cc_cid');
0 ignored issues
show
Bug introduced by
The variable cid seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.cid.
Loading history...
365
        if (cid != undefined) {
366
            $('payone_creditcard_cc_cid').setValue('')
367
        }
368
369
        // remove validation class cause CreditCard is validated
370
        // @todo when changing CardData it has to be added again or we exchange the form with labels and provide an edit button
371
        $('payone_creditcard_cc_number').removeClassName('validate-cc-number');
372
        $('payone_creditcard_cc_number').removeClassName('validate-payone-cc-type');
373
        this.origMethod();
0 ignored issues
show
Best Practice introduced by
There is no return statement in this branch, but you do return something in other branches. Did you maybe miss it? If you do not want to return anything, consider adding return undefined; explicitly.
Loading history...
374
    };
375
};
376
377
PAYONE.Validation.CreditCard = function (config) {
0 ignored issues
show
Bug introduced by
The variable PAYONE seems to be never declared. If this is a global, consider adding a /** global: PAYONE */ comment.

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.

Loading history...
378
    this.config = config;
379
    this.validationsCc = '';
380
    this.validationsCcMagento = '';
381
382
    this.validate = function (form) {
383
        this.initValidationType();
384
        
385
        if($('payone_pseudocardpan').value == '') {
386
            Validation.add('validate-payone-cc-type', 'Credit card number does not match credit card type.', this.validateType, this);
0 ignored issues
show
Bug introduced by
The variable Validation seems to be never declared. If this is a global, consider adding a /** global: Validation */ comment.

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.

Loading history...
387
            Validation.add('validate-payone-cc-validity-period', 'Credit card validity period is too short.', this.validateValidityPeriod, this);
388
        }
389
390
        var validator = new Validation(form);
391
        return validator.validate();
392
    };
393
394
    /**
395
     * Creditcard Validity Period Validation
396
     *
397
     * @param v
398
     * @param elm
399
     * @return {Boolean}
400
     */
401
    this.validateValidityPeriod = function (v, elm) {
0 ignored issues
show
Unused Code introduced by
The parameter elm is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
402
        var year = $('payone_creditcard_cc_expiration_year').value;
403
        var validityCc = new Date(year, v, 1); // Start of next month
404
405
        return validityCc.getTime() > this.options.get('config').allowed_validity * 1000; // milliseconds vs. seconds
406
    };
407
408
    /**
409
     * Creditcard Type Validation
410
     *
411
     * @param v
412
     * @param elm
413
     * @return {Boolean}
414
     */
415
    this.validateType = function (v, elm) {
416
        // remove credit card number delimiters such as "-" and space
417
        elm.value = removeDelimiters(elm.value);
418
        v = removeDelimiters(v);
419
420
        var ccTypeContainer = $(elm.id.substr(0, elm.id.indexOf('_cc_number')) + '_cc_type');
421
        if (!ccTypeContainer) {
422
            return true;
423
        }
424
425
        var ccType = ccTypeContainer.value;
426
        var ccTypeValidator = this.options.get('validationsCc').get(ccType);
427
428
        if (typeof ccTypeValidator == 'undefined') {
429
            return false;
430
        }
431
432
        // Disabled checks:
433
        if (ccTypeValidator[0] == false) {
434
            return true;
435
        }
436
437
        // Validate credit card number according to type:
438
        var result = false;
439
        if (ccTypeValidator[0] && v.match(ccTypeValidator[0])) {
440
            result = true;
441
        }
442
443
        if (!result) {
444
            return false;
445
        }
446
447
        if (ccTypeContainer.hasClassName('validation-failed') && Validation.isOnChange) {
0 ignored issues
show
Bug introduced by
The variable Validation seems to be never declared. If this is a global, consider adding a /** global: Validation */ comment.

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.

Loading history...
448
            Validation.validate(ccTypeContainer);
449
        }
450
451
        return true;
452
    };
453
454
    this.initValidationType = function () {
455
        if (Validation.creditCardTypes) {
0 ignored issues
show
Bug introduced by
The variable Validation seems to be never declared. If this is a global, consider adding a /** global: Validation */ comment.

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.

Loading history...
456
            this.validationsCcMagento = Validation.creditCardTypes;
457
        }
458
        else if (Validation.creditCartTypes) {
459
            // typo in certain Magento versions..
460
            this.validationsCcMagento = Validation.creditCartTypes;
461
        }
462
463
        // validations for Payone credit card types
464
        this.validationsCc = $H(
465
            {
466
            '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}$))'),
467
                new RegExp('^[0-9]{3}$'),
468
                false],
469
            'V':this.validationsCcMagento.get('VI'),
470
            'A':this.validationsCcMagento.get('AE'),
471
            'M':this.validationsCcMagento.get('MC'),
472
            'J':this.validationsCcMagento.get('JCB'),
473
            'C':this.validationsCcMagento.get('DI'),
474
            'D':this.validationsCcMagento.get('OT'),
475
            'B':this.validationsCcMagento.get('OT'),
476
            'U':this.validationsCcMagento.get('OT')
477
            }
478
        );
479
    };
480
481
    this.getConfig = function () {
482
        return this.config;
483
    };
484
};
485
486
function payoneChangedCreditCardInfo() 
487
{
488
    $('payone_pseudocardpan').value = '';
489
    $('payone_cc_check_validation').value = 1;
490
    $('payone_creditcard_cc_number').addClassName('validate-cc-number');
491
}
492
493
function processPayoneResponseCCHosted(response) 
494
{
495
    payone.handleResponseCreditcardCheck(response, true);
0 ignored issues
show
Bug introduced by
The variable payone seems to be never declared. If this is a global, consider adding a /** global: payone */ comment.

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.

Loading history...
496
}
497
498
function updateCcLogo(detectedCardtype)
499
{
500
    var url = 'https://cdn.pay1.de/cc/' + detectedCardtype.toLowerCase() + '/s/default.png';
501
    var image = $('payone_creditcard_cc_type_logo').children[0];
502
    image.style.display = 'none';
503
    image.src = url;
504
    image.style.display = 'inline';
505
};
506