Test Failed
Push — master ( b0844f...f87cd0 )
by
unknown
03:20
created

MangoPayConstants::isPersonTypeOk()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
/**
3
 * Created by Graham Owens ([email protected])
4
 * Company: PartFire Ltd (www.partfire.co.uk)
5
 * Console: Discovery
6
 *
7
 * User:    gra
8
 * Date:    31/12/16
9
 * Time:    00:53
10
 * Project: PartFire MangoPay Bundle
11
 * File:    MangoPayConstants.php
12
 *
13
 **/
14
15
namespace PartFire\MangoPayBundle;
16
17
18
class MangoPayConstants
19
{
20
    const       NATURAL_PERSON_TYPE                 = 'NATURAL';
21
    const       LEAGAL_PERSON_TYPE                  = 'LEGAL';
22
23
    //  https://docs.mangopay.com/endpoints/v2.01/users#e259_create-a-legal-user
24
25
    //  May also help https://www.gov.uk/business-legal-structures/overview
26
27
    const       LEAGAL_PERSON_TYPE_SOLETRADER       = 'SOLETRADER';
28
    const       LEAGAL_PERSON_TYPE_ORGANISATION     = 'ORGANIZATION';
29
    const       LEAGAL_PERSON_TYPE_BUSINESS         = 'BUSINESS';
30
31
    //  https://docs.mangopay.com/endpoints/v2.01/users#e253_the-user-object
32
33
    const       KYC_LEVEL_LIGHT                     = 'LIGHT';
34
    const       KYC_LEVEL_REGULAR                   = 'REGULAR';
35
36
    // https://docs.mangopay.com/endpoints/v2/users#e254_the-natural-user-object
37
38
    public static function getIncomeRangeFromId(int $id) : string
39
    {
40
        switch ($id) {
41
            case 1:
42
                $range = "incomes <18K€";
43
                break;
44
            case 2:
45
                $range = "incomes between 18 and 30K€";
46
                break;
47
            case 3:
48
                $range = "incomes between 30 and 50K€";
49
                break;
50
            case 4:
51
                $range = "incomes between 50 and 80K€";
52
                break;
53
            case 5:
54
                $range = "incomes between 80 and 120K€";
55
                break;
56
            case 6:
57
                $range = "incomes>120K€";
58
                break;
59
            default:
60
                $range = "Unknown range";
61
        }
62
63
        return $range;
64
    }
65
66
    public static function isPersonTypeOk($personType)
67
    {
68
        return in_array($personType, self::getPersonTypeArray());
69
    }
70
71
    public static function getPersonTypeArray()
72
    {
73
        return [
74
            self::NATURAL_PERSON_TYPE,
75
            self::LEAGAL_PERSON_TYPE
76
        ];
77
    }
78
}