Passed
Push — master ( 6c42be...776013 )
by Igor
02:03
created

PaymentMethod   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 26
dl 0
loc 64
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A shouldHideOnReject() 0 3 1
A getShouldHideOnRejectMethods() 0 5 1
A getShouldHideOnDifferentAddressMethods() 0 6 1
A shouldHideOnDifferentAddress() 0 3 1
1
<?php
2
/**
3
 * PHP version 5.4 and 7
4
 *
5
 * @package   Payever\Payments
6
 * @author    Hennadii.Shymanskyi <[email protected]>
7
 * @copyright 2017-2019 payever GmbH
8
 * @license   MIT <https://opensource.org/licenses/MIT>
9
 */
10
11
namespace Payever\ExternalIntegration\Payments\Enum;
12
13
use Payever\ExternalIntegration\Core\Base\EnumerableConstants;
14
15
/**
16
 * List of available for external integration payever payment methods
17
 *
18
 * PHP version 5.4 and 7
19
 *
20
 * @package   Payever\Payments
21
 * @author    Hennadii.Shymanskyi <[email protected]>
22
 * @copyright 2017-2019 payever GmbH
23
 * @license   MIT <https://opensource.org/licenses/MIT>
24
 */
25
class PaymentMethod extends EnumerableConstants
26
{
27
    const METHOD_SANTANDER_DE_FACTORING = 'santander_factoring_de';
28
    const METHOD_SANTANDER_DE_INVOICE = 'santander_invoice_de';
29
    const METHOD_SANTANDER_NO_INVOICE = 'santander_invoice_no';
30
    const METHOD_SANTANDER_DE_INSTALLMENT = 'santander_installment';
31
    const METHOD_SANTANDER_DE_CCP_INSTALLMENT = 'santander_ccp_installment';
32
    const METHOD_SANTANDER_NO_INSTALLMENT = 'santander_installment_no';
33
    const METHOD_SANTANDER_DK_INSTALLMENT = 'santander_installment_dk';
34
    const METHOD_SANTANDER_SE_INSTALLMENT = 'santander_installment_se';
35
36
    const METHOD_SOFORT = 'sofort';
37
    const METHOD_PAYMILL_CREDIT_CARD = 'paymill_creditcard';
38
    const METHOD_PAYMILL_DIRECT_DEBIT = 'paymill_directdebit';
39
    const METHOD_PAYPAL = 'paypal';
40
    const METHOD_STRIPE_CREDIT_CARD = 'stripe';
41
    const METHOD_STRIPE_DIRECT_DEBIT = 'stripe_directdebit';
42
    const METHOD_PAYEX_FAKTURA = 'payex_faktura';
43
    const METHOD_PAYEX_CREDIT_CARD = 'payex_creditcard';
44
45
    /**
46
     * Whether payment method must be hidden when shipping address differs from billing one
47
     *
48
     * @param string $method
49
     *
50
     * @return bool
51
     */
52
    public static function shouldHideOnDifferentAddress($method)
53
    {
54
        return in_array($method, static::getShouldHideOnDifferentAddressMethods());
55
    }
56
57
    /**
58
     * Whether payment method must be hidden after first unsuccessful payment attempt
59
     *
60
     * @param string $method
61
     *
62
     * @return bool
63
     */
64
    public static function shouldHideOnReject($method)
65
    {
66
        return in_array($method, static::getShouldHideOnRejectMethods());
67
    }
68
69
    /**
70
     * @return array
71
     */
72
    public static function getShouldHideOnDifferentAddressMethods()
73
    {
74
        return array(
75
            static::METHOD_SANTANDER_DE_FACTORING,
76
            static::METHOD_SANTANDER_DE_INVOICE,
77
            static::METHOD_PAYEX_FAKTURA,
78
        );
79
    }
80
81
    /**
82
     * @return array
83
     */
84
    public static function getShouldHideOnRejectMethods()
85
    {
86
        return array(
87
            static::METHOD_SANTANDER_DE_FACTORING,
88
            static::METHOD_SANTANDER_DE_INVOICE,
89
        );
90
    }
91
}
92