js/payone/core/sepa_validation.js   A
last analyzed

Complexity

Total Complexity 9
Complexity/F 3

Size

Lines of Code 46
Function Count 3

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 9
dl 0
loc 46
rs 10
c 2
b 0
f 0
cc 0
nc 1
mnd 1
bc 9
fnc 3
bpm 3
cpm 3
noi 4

3 Functions

Rating   Name   Duplication   Size   Complexity  
A Validation.add(ꞌvalidate-sepa-bicꞌ) 0 12 3
A Validation.add(ꞌvalidate-sepa-ibanꞌ) 0 12 3
A Validation.add(ꞌvalidate-bank-codeꞌ) 0 12 3
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
var Translator = new Translate([]);
0 ignored issues
show
Bug introduced by
The variable Translate seems to be never declared. If this is a global, consider adding a /** global: Translate */ 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...
24
25
Validation.add(
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...
26
    'validate-bank-code', Translator.translate('Bank code must contain 8 digits'), function (value) {
27
    value = value.replace(/\s/g, '');
28
    if (value == '') {
29
        return true;
30
    }
31
32
    if (value.length != 8) {
33
        return false;
34
    }
35
36
    return true;
37
    }
38
);
39
40
Validation.add(
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...
41
    'validate-sepa-iban', Translator.translate('IBAN should contain only letters and digits'), function (value) {
42
    value = value.replace(/\s/g, '');
43
    if (value == '') {
44
        return true;
45
    }
46
47
    if (!/[a-zA-Z]{2}[A-Za-z0-9]{10,}$/.test(value)) {
48
        return false;
49
    }
50
51
    return true;
52
    }
53
);
54
55
Validation.add(
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...
56
    'validate-sepa-bic', Translator.translate('BIC can contain only 8-11 characters: digits and letters'), function (value) {
57
    value = value.replace(/\s/g, '');
58
    if (value == '') {
59
        return true;
60
    }
61
62
    if (!/[A-Za-z0-9]{8,11}$/.test(value)) {
63
        return false;
64
    }
65
66
    return true;
67
    }
68
);