js/payone/core/creditcard.js   F
last analyzed

Complexity

Total Complexity 75
Complexity/F 2.88

Size

Lines of Code 436
Function Count 26

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 75
dl 0
loc 436
rs 3.8888
c 1
b 0
f 0
cc 0
nc 768
mnd 3
bc 68
fnc 26
bpm 2.6153
cpm 2.8846
noi 34

5 Functions

Rating   Name   Duplication   Size   Complexity  
A creditcard.js ➔ processPayoneResponseCCHosted 0 4 1
A creditcard.js ➔ payoneChangedCreditCardInfo 0 6 1
A PAYONE.Handler.CreditCardCheck.OnepageCheckout 0 70 1
A PAYONE.Handler.CreditCardCheck.Admin 0 56 1
B PAYONE.Validation.CreditCard 0 108 1

How to fix   Complexity   

Complexity

Complex classes like js/payone/core/creditcard.js often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

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
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
        if (elementCcType != undefined) {
64
            var ccTypeConfigKey = elementCcType.value;
65
            var ccTypeSplit = ccTypeConfigKey.split('_');
66
            configId = ccTypeSplit[0];
67
            var ccType = ccTypeSplit[1];
68
            $("payone_creditcard_cc_type").setValue(ccType);
69
        }
70
71
        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...
72
        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...
73
74
        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...
75
        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 63 is false. Are you sure the function setCardType handles undefined variables?
Loading history...
76
77
        document.getElementById(type_id).onchange = function () {
78
            var elementCcType = $('payone_creditcard_cc_type_select');
79
            if (elementCcType != undefined) {
80
                var ccTypeConfigKey = elementCcType.value;
81
                var ccTypeSplit = ccTypeConfigKey.split('_');
82
                var ccType = ccTypeSplit[1];
83
                iframes.setCardType(ccType); // on change: set new type of credit card to process
84
            }
85
        };
86
        this.iframes = iframes;
87
        return iframes;
88
    }
89
90
    /**
91
     * Trigger CVC Code as configured
92
     *
93
     * @param element
94
     */
95
    this.displayCheckCvc = function (element) {
96
        config = $('payone_creditcard_config_cvc').value.evalJSON();
97
        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...
98
        var cvcDiv = $("payone_creditcard_cc_cid_div");
99
        if (cvcDiv != undefined && cvcDiv != null) {
100
            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...
101
            if (configCcKey != undefined && (configCcKey == 'always' || (configCcKey == 'only_first' && $('payone_cc_check_validation').value == 1))) {
102
                cvcDiv.show();
103
                $('payone_cc_check_validation').value = 1;
104
            } else {
105
                cvcDiv.hide();
106
            }
107
        }
108
    };
109
110
    /**
111
     * Validate the Form Data
112
     *
113
     * @param form Form Object
114
     * @return {*}
115
     */
116
    this.validate = function (form) {
117
        var elementCcType = $('payone_creditcard_cc_type_select');
118
        if (elementCcType != undefined) {
119
            var ccTypeConfigKey = elementCcType.value;
120
            var ccTypeSplit = ccTypeConfigKey.split('_');
121
            var configId = ccTypeSplit[0];
122
123
            var ccType = ccTypeSplit[1];
124
            $("payone_creditcard_config_id").setValue(configId);
125
            $("payone_creditcard_cc_type").setValue(ccType);
126
        }
127
128
        config = this.getConfig();
129
        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...
130
131
        validation = new PAYONE.Validation.CreditCard(configValidation);
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...
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...
132
        return validation.validate(form);
133
    };
134
135
    /**
136
     * Perform creditcard check via Payone Client API
137
     */
138
    this.creditcardcheck = function () {
139
        var configId = $("payone_creditcard_config_id").value;
140
141
        config = this.getConfig();
142
        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...
143
144
        var data = this.mapRequestCreditCardCheck();
145
146
        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...
147
            configGateway,
148
            function (response) {
149
                return window.payone.handleResponseCreditcardCheck(response, false);
150
            }
151
        );
152
        payoneGateway.call(data);
153
    };
154
    
155
    this.creditcardcheckHosted = function () {
156
        if (this.iframes.isComplete()) {
157
            $('payone_creditcard_hosted_error').hide();
158
            $('payone_creditcard_cc_owner').value = $('firstname').value + ' ' + $('lastname').value;            
159
            this.iframes.creditCardCheck('processPayoneResponseCCHosted');
160
        } else {
161
            $('payone_creditcard_hosted_error').show();
162
        }
163
    }
164
165
    /**
166
     * Collect PAYONE CreditCardCheck Request Parameters
167
     *
168
     * @return {*}
169
     */
170
    this.mapRequestCreditCardCheck = function () {
171
        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...
172
            'cardexpiremonth':$('payone_creditcard_cc_expiration_month').value,
173
            'cardexpireyear':$('payone_creditcard_cc_expiration_year').value,
174
            'cardtype':$('payone_creditcard_cc_type').value
175
        };
176
        if($('payone_pseudocardpan').value == '') {
177
            data.cardholder = $('payone_creditcard_cc_owner').value;
178
            data.cardpan = $('payone_creditcard_cc_number').value;
179
        } else {
180
            data.pseudocardpan = $('payone_pseudocardpan').value;
181
        }
182
183
        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...
184
        if (cid != undefined) {
185
            data.cardcvc2 = cid.value;
186
        }
187
188
        return data;
189
    };
190
191
    /**
192
     * Handle response
193
     *
194
     * @param response
195
     * @return {Boolean}
196
     */
197
    this.handleResponseCreditcardCheck = function (response, blIsHostedIframe) {
198
        return this.handler.handleResponse(response, blIsHostedIframe);
199
    };
200
201
    /**
202
     * Get Config (auto-initialize)
203
     *
204
     * @return {*}
205
     */
206
    this.getConfig = function () {
207
        if (this.config == '' || this.config == undefined) {
208
            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...
209
            this.config = configJson.evalJSON();
210
        }
211
212
        return this.config;
213
    };
214
};
215
216
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...
217
PAYONE.Handler.CreditCardCheck.OnepageCheckout = function () {
218
    this.origMethod = '';
219
220
    this.haveToValidate = function () {
221
        var radio_p1_cc = $('p_method_payone_creditcard');
222
        if (radio_p1_cc != undefined && radio_p1_cc != null && radio_p1_cc.checked) {
223
            if($('payone_cc_check_validation').value == 0) {
224
                return 0;
225
            }
226
227
            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...
228
                return 0;
229
            }
230
231
            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...
232
                return 0;
233
            }
234
235
            return 1;
236
        }
237
238
        return 0;
239
    };
240
241
    this.handleResponse = function (response, blIsHostedIframe) {
242
        if (response.status != 'VALID') {
243
            // Failure
244
            if(typeof response.customermessage != 'undefined') {
245
                alert(response.customermessage);
246
            } else if(typeof response.errormessage != 'undefined') {
247
                alert(response.errormessage);
248
            }
249
250
            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...
251
            return false;
252
        }
253
254
        // Success!
255
        var pseudocardpan = response.pseudocardpan;
256
        var truncatedcardpan = response.truncatedcardpan;
257
        
258
        if(blIsHostedIframe) {
259
            var cardexpiredate = response.cardexpiredate;
260
            $('payone_cardexpiredate').setValue(cardexpiredate);
261
        }
262
263
        $('payone_pseudocardpan').setValue(pseudocardpan);
264
        $('payone_truncatedcardpan').setValue(truncatedcardpan);
265
        $('payone_creditcard_cc_number').setValue(truncatedcardpan);
266
267
        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...
268
        if (cid != undefined) {
269
            $('payone_creditcard_cc_cid').setValue('')
270
        }
271
272
        checkout.setLoadWaiting('payment', false);
273
274
        // Post payment form to Magento:
275
        var request = new Ajax.Request(
0 ignored issues
show
Unused Code introduced by
The variable request seems to be never used. Consider removing it.
Loading history...
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...
276
            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...
277
            {
278
                method:'post',
279
                onComplete:payment.onComplete,
280
                onSuccess:payment.onSave,
281
                onFailure:checkout.ajaxFailure.bind(checkout),
282
                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...
283
            }
284
        );
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...
285
    };
286
};
287
288
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...
289
    this.origMethod = '';
290
291
    this.haveToValidate = function () {
292
        var radio_p1_cc = $('p_method_payone_creditcard');
293
294
        if (radio_p1_cc != undefined && radio_p1_cc != null && radio_p1_cc.checked
295
            && $('payone_pseudocardpan').value == '') {
296
            if($('payone_cc_check_validation').value == 0) {
297
                return 0;
298
            }
299
300
            return 1;
301
        }
302
303
        return 0;
304
    };
305
306
    this.handleResponse = function (response, blIsHostedIframe) {
307
        if (response.status != 'VALID') {
308
            // Failure
309
            // Failure
310
            if(typeof response.customermessage != 'undefined') {
311
                alert(response.customermessage);
312
            } else if(typeof response.errormessage != 'undefined') {
313
                alert(response.errormessage);
314
            }
315
316
            return false;
317
        }
318
319
        // Success!
320
        var pseudocardpan = response.pseudocardpan;
321
        var truncatedcardpan = response.truncatedcardpan;
322
323
        if(blIsHostedIframe) {
324
            var cardexpiredate = response.cardexpiredate;
325
            $('payone_cardexpiredate').setValue(cardexpiredate);
326
        }
327
328
        $('payone_pseudocardpan').setValue(pseudocardpan);
329
        $('payone_truncatedcardpan').setValue(truncatedcardpan);
330
        $('payone_creditcard_cc_number').setValue(truncatedcardpan);
331
332
        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...
333
        if (cid != undefined) {
334
            $('payone_creditcard_cc_cid').setValue('')
335
        }
336
337
        // remove validation class cause CreditCard is validated
338
        // @todo when changing CardData it has to be added again or we exchange the form with labels and provide an edit button
339
        $('payone_creditcard_cc_number').removeClassName('validate-cc-number');
340
        $('payone_creditcard_cc_number').removeClassName('validate-payone-cc-type');
341
        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...
342
    };
343
};
344
345
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...
346
    this.config = config;
347
    this.validationsCc = '';
348
    this.validationsCcMagento = '';
349
350
    this.validate = function (form) {
351
        this.initValidationType();
352
        
353
        if($('payone_pseudocardpan').value == '') {
354
            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...
355
            Validation.add('validate-payone-cc-validity-period', 'Credit card validity period is too short.', this.validateValidityPeriod, this);
356
        }
357
358
        var validator = new Validation(form);
359
        return validator.validate();
360
    };
361
362
    /**
363
     * Creditcard Validity Period Validation
364
     *
365
     * @param v
366
     * @param elm
367
     * @return {Boolean}
368
     */
369
    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...
370
        var year = $('payone_creditcard_cc_expiration_year').value;
371
        var validityCc = new Date(year, v, 1); // Start of next month
372
373
        return validityCc.getTime() > this.options.get('config').allowed_validity * 1000; // milliseconds vs. seconds
374
    };
375
376
    /**
377
     * Creditcard Type Validation
378
     *
379
     * @param v
380
     * @param elm
381
     * @return {Boolean}
382
     */
383
    this.validateType = function (v, elm) {
384
        // remove credit card number delimiters such as "-" and space
385
        elm.value = removeDelimiters(elm.value);
386
        v = removeDelimiters(v);
387
388
        var ccTypeContainer = $(elm.id.substr(0, elm.id.indexOf('_cc_number')) + '_cc_type');
389
        if (!ccTypeContainer) {
390
            return true;
391
        }
392
393
        var ccType = ccTypeContainer.value;
394
        var ccTypeValidator = this.options.get('validationsCc').get(ccType);
395
396
        if (typeof ccTypeValidator == 'undefined') {
397
            return false;
398
        }
399
400
        // Disabled checks:
401
        if (ccTypeValidator[0] == false) {
402
            return true;
403
        }
404
405
        // Validate credit card number according to type:
406
        var result = false;
407
        if (ccTypeValidator[0] && v.match(ccTypeValidator[0])) {
408
            result = true;
409
        }
410
411
        if (!result) {
412
            return false;
413
        }
414
415
        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...
416
            Validation.validate(ccTypeContainer);
417
        }
418
419
        return true;
420
    };
421
422
    this.initValidationType = function () {
423
        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...
424
            this.validationsCcMagento = Validation.creditCardTypes;
425
        }
426
        else if (Validation.creditCartTypes) {
427
            // typo in certain Magento versions..
428
            this.validationsCcMagento = Validation.creditCartTypes;
429
        }
430
431
        // validations for Payone credit card types
432
        this.validationsCc = $H(
433
            {
434
            '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}$))'),
435
                new RegExp('^[0-9]{3}$'),
436
                false],
437
            'V':this.validationsCcMagento.get('VI'),
438
            'A':this.validationsCcMagento.get('AE'),
439
            'M':this.validationsCcMagento.get('MC'),
440
            'J':this.validationsCcMagento.get('JCB'),
441
            'C':this.validationsCcMagento.get('DI'),
442
            'D':this.validationsCcMagento.get('OT'),
443
            'B':this.validationsCcMagento.get('OT'),
444
            'U':this.validationsCcMagento.get('OT')
445
            }
446
        );
447
    };
448
449
    this.getConfig = function () {
450
        return this.config;
451
    };
452
};
453
454
function payoneChangedCreditCardInfo() 
455
{
456
    $('payone_pseudocardpan').value = '';
457
    $('payone_cc_check_validation').value = 1;
458
    $('payone_creditcard_cc_number').addClassName('validate-cc-number');
459
}
460
461
function processPayoneResponseCCHosted(response) 
462
{
463
    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...
464
}