PaymentMethod   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 74
Duplicated Lines 0 %

Importance

Changes 4
Bugs 0 Features 0
Metric Value
wmc 4
eloc 36
c 4
b 0
f 0
dl 0
loc 74
rs 10

4 Methods

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