Passed
Pull Request — dev (#4)
by Mykyta
11:52 queued 07:39
created

getMerchantTransactionChannelByPaymentType()   B

Complexity

Conditions 6
Paths 6

Size

Total Lines 20
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 20
c 0
b 0
f 0
rs 8.8571
cc 6
eloc 12
nc 6
nop 1
1
<?php
2
3
/**
4
 * MIT License
5
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace SprykerEco\Zed\Heidelpay;
9
10
use Spryker\Zed\Kernel\AbstractBundleConfig;
11
use SprykerEco\Shared\Heidelpay\HeidelpayConfig as SharedHeidelpayConfig;
12
use SprykerEco\Shared\Heidelpay\HeidelpayConstants;
13
14
class HeidelpayConfig extends AbstractBundleConfig implements HeidelpayConfigInterface
15
{
16
    /**
17
     * @return string
18
     */
19
    public function getMerchantSecuritySender()
20
    {
21
        return $this->get(HeidelpayConstants::CONFIG_HEIDELPAY_SECURITY_SENDER);
22
    }
23
24
    /**
25
     * @return string
26
     */
27
    public function getMerchantUserLogin()
28
    {
29
        return $this->get(HeidelpayConstants::CONFIG_HEIDELPAY_USER_LOGIN);
30
    }
31
32
    /**
33
     * @return string
34
     */
35
    public function getMerchantUserPassword()
36
    {
37
        return $this->get(HeidelpayConstants::CONFIG_HEIDELPAY_USER_PASSWORD);
38
    }
39
40
    /**
41
     * @return bool
42
     */
43
    public function getMerchantSandboxMode()
44
    {
45
        return (bool)$this->get(HeidelpayConstants::CONFIG_HEIDELPAY_SANDBOX_REQUEST);
46
    }
47
48
    /**
49
     * @return string
50
     */
51
    public function getApplicationSecret()
52
    {
53
        return $this->get(HeidelpayConstants::CONFIG_HEIDELPAY_APPLICATION_SECRET);
54
    }
55
56
    /**
57
     * @return string
58
     */
59
    public function getAsyncLanguageCode()
60
    {
61
        return $this->get(HeidelpayConstants::CONFIG_HEIDELPAY_LANGUAGE_CODE);
62
    }
63
64
    /**
65
     * @return string
66
     */
67
    public function getZedResponseUrl()
68
    {
69
        return $this->get(HeidelpayConstants::CONFIG_HEIDELPAY_PAYMENT_RESPONSE_URL);
70
    }
71
72
    /**
73
     * @return string
74
     */
75
    public function getYvesCheckoutPaymentFailedUrl()
76
    {
77
        return $this->get(HeidelpayConstants::CONFIG_YVES_CHECKOUT_PAYMENT_FAILED_URL);
78
    }
79
80
    /**
81
     * @return string
82
     */
83
    public function getYvesUrlForAsyncIframeResponse()
84
    {
85
        return $this->get(HeidelpayConstants::CONFIG_YVES_CHECKOUT_ASYNC_RESPONSE_URL);
86
    }
87
88
    /**
89
     * @return string
90
     */
91
    public function getIdealAuthorizeUrl()
92
    {
93
        return $this->get(HeidelpayConstants::CONFIG_YVES_CHECKOUT_IDEAL_AUTHORIZE_URL);
94
    }
95
96
    /**
97
     * @return string
98
     */
99
    public function getCreditCardPaymentFrameOrigin()
100
    {
101
        return $this->get(HeidelpayConstants::CONFIG_YVES_URL);
102
    }
103
104
    /**
105
     * @return string
106
     */
107
    public function getCreditCardPaymentFrameCustomCssUrl()
108
    {
109
        return $this->get(HeidelpayConstants::CONFIG_YVES_CHECKOUT_PAYMENT_FRAME_CUSTOM_CSS_URL);
110
    }
111
112
    /**
113
     * @return string
114
     */
115
    public function getCreditCardPaymentFramePreventAsyncRedirect()
116
    {
117
        return $this->get(HeidelpayConstants::CONFIG_YVES_CHECKOUT_PAYMENT_FRAME_PREVENT_ASYNC_REDIRECT);
118
    }
119
120
    /**
121
     * @return string
122
     */
123
    public function getEncryptionKey()
124
    {
125
        return $this->get(HeidelpayConstants::CONFIG_ENCRYPTION_KEY);
126
    }
127
128
    /**
129
     * @param string $paymentType
130
     *
131
     * @return string
132
     */
133
    public function getMerchantTransactionChannelByPaymentType($paymentType)
134
    {
135
        switch ($paymentType) {
136
            case SharedHeidelpayConfig::PAYMENT_METHOD_SOFORT:
137
                return $this->get(HeidelpayConstants::CONFIG_HEIDELPAY_TRANSACTION_CHANNEL_SOFORT);
138
139
            case SharedHeidelpayConfig::PAYMENT_METHOD_CREDIT_CARD_SECURE:
140
                return $this->get(HeidelpayConstants::CONFIG_HEIDELPAY_TRANSACTION_CHANNEL_CC_3D_SECURE);
141
142
            case SharedHeidelpayConfig::PAYMENT_METHOD_IDEAL:
143
                return $this->get(HeidelpayConstants::CONFIG_HEIDELPAY_TRANSACTION_CHANNEL_IDEAL);
144
145
            case SharedHeidelpayConfig::PAYMENT_METHOD_PAYPAL_AUTHORIZE:
146
                return $this->get(HeidelpayConstants::CONFIG_HEIDELPAY_TRANSACTION_CHANNEL_PAYPAL);
147
148
            case SharedHeidelpayConfig::PAYMENT_METHOD_PAYPAL_DEBIT:
149
                return $this->get(HeidelpayConstants::CONFIG_HEIDELPAY_TRANSACTION_CHANNEL_PAYPAL);
150
        }
151
152
        return '';
153
    }
154
}
155