Passed
Pull Request — master (#28)
by Volodymyr
05:26
created

PayoneConfig::getYScoreAvailablePaymentMethods()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 5
rs 10
c 0
b 0
f 0
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\Payone;
9
10
use Generated\Shared\Transfer\PayonePaymentTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\PayonePaymentTransfer was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use Generated\Shared\Transfer\PayoneStandardParameterTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...andardParameterTransfer was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
use Orm\Zed\Sales\Persistence\SpySalesOrder;
0 ignored issues
show
Bug introduced by
The type Orm\Zed\Sales\Persistence\SpySalesOrder was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
use Spryker\Shared\Kernel\Store;
14
use Spryker\Zed\Kernel\AbstractBundleConfig;
15
use Spryker\Zed\Oms\Business\Util\ReadOnlyArrayObject;
16
use SprykerEco\Shared\Payone\PayoneConstants;
17
18
class PayoneConfig extends AbstractBundleConfig
19
{
20
    public const PROVIDER_NAME = 'Payone';
21
    public const PAYMENT_METHOD_CREDIT_CARD = 'payoneCreditCard';
22
    public const PAYMENT_METHOD_E_WALLET = 'payoneEWallet';
23
    public const PAYMENT_METHOD_DIRECT_DEBIT = 'payoneDirectDebit';
24
    public const PAYMENT_METHOD_ONLINE_TRANSFER = 'payoneOnlineTransfer';
25
    public const PAYMENT_METHOD_EPS_ONLINE_TRANSFER = 'payoneEpsOnlineTransfer';
26
    public const PAYMENT_METHOD_INSTANT_ONLINE_TRANSFER = 'payoneInstantOnlineTransfer';
27
    public const PAYMENT_METHOD_GIROPAY_ONLINE_TRANSFER = 'payoneGiropayOnlineTransfer';
28
    public const PAYMENT_METHOD_IDEAL_ONLINE_TRANSFER = 'payoneIdealOnlineTransfer';
29
    public const PAYMENT_METHOD_POSTFINANCE_EFINANCE_ONLINE_TRANSFER = 'payonePostfinanceEfinanceOnlineTransfer';
30
    public const PAYMENT_METHOD_POSTFINANCE_CARD_ONLINE_TRANSFER = 'payonePostfinanceCardOnlineTransfer';
31
    public const PAYMENT_METHOD_PRZELEWY24_ONLINE_TRANSFER = 'payonePrzelewy24OnlineTransfer';
32
    public const PAYMENT_METHOD_BANCONTACT_ONLINE_TRANSFER = 'payoneBancontactOnlineTransfer';
33
    public const PAYMENT_METHOD_PRE_PAYMENT = 'payonePrePayment';
34
    public const PAYMENT_METHOD_INVOICE = 'payoneInvoice';
35
    public const PAYMENT_METHOD_SECURITY_INVOICE = 'payoneSecurityInvoice';
36
    public const PAYMENT_METHOD_PAYPAL_EXPRESS_CHECKOUT = PayoneConstants::PAYMENT_METHOD_PAYPAL_EXPRESS_CHECKOUT_STATE_MACHINE;
37
38
    /**
39
     * Fetches API request mode from config (could be 'live' or 'test').
40
     *
41
     * @return string
42
     */
43
    public function getMode()
44
    {
45
        $settings = $this->get(PayoneConstants::PAYONE);
46
47
        return $settings[PayoneConstants::PAYONE_MODE];
48
    }
49
50
    /**
51
     * Fetches default value for sequencenumber request parameter.
52
     *
53
     * @return string
54
     */
55
    public function getEmptySequenceNumber()
56
    {
57
        $settings = $this->get(PayoneConstants::PAYONE);
58
59
        return $settings[PayoneConstants::PAYONE_EMPTY_SEQUENCE_NUMBER];
60
    }
61
62
    /**
63
     * Fetches parameters that are common for all requests to Payone API.
64
     *
65
     * @return \Generated\Shared\Transfer\PayoneStandardParameterTransfer
66
     */
67
    public function getRequestStandardParameter()
68
    {
69
        $settings = $this->get(PayoneConstants::PAYONE);
70
        $standardParameter = new PayoneStandardParameterTransfer();
71
72
        $standardParameter->setEncoding($settings[PayoneConstants::PAYONE_CREDENTIALS_ENCODING]);
73
        $standardParameter->setMid($settings[PayoneConstants::PAYONE_CREDENTIALS_MID]);
74
        $standardParameter->setAid($settings[PayoneConstants::PAYONE_CREDENTIALS_AID]);
75
        $standardParameter->setPortalId($settings[PayoneConstants::PAYONE_CREDENTIALS_PORTAL_ID]);
76
        $standardParameter->setKey($settings[PayoneConstants::PAYONE_CREDENTIALS_KEY]);
77
        $standardParameter->setPaymentGatewayUrl($settings[PayoneConstants::PAYONE_PAYMENT_GATEWAY_URL]);
78
79
        $standardParameter->setCurrency(Store::getInstance()->getCurrencyIsoCode());
80
        $standardParameter->setLanguage(Store::getInstance()->getCurrentLanguage());
81
82
        $standardParameter->setRedirectSuccessUrl($settings[PayoneConstants::PAYONE_REDIRECT_SUCCESS_URL]);
83
        $standardParameter->setRedirectBackUrl($settings[PayoneConstants::PAYONE_REDIRECT_BACK_URL]);
84
        $standardParameter->setRedirectErrorUrl($settings[PayoneConstants::PAYONE_REDIRECT_ERROR_URL]);
85
86
        return $standardParameter;
87
    }
88
89
    /**
90
     * Fetches reference string to identify Payone payment.
91
     *
92
     * @param \Generated\Shared\Transfer\PayonePaymentTransfer $paymentTransfer
93
     * @param \Orm\Zed\Sales\Persistence\SpySalesOrder $orderEntity
94
     *
95
     * @return string
96
     */
97
    public function generatePayoneReference(PayonePaymentTransfer $paymentTransfer, SpySalesOrder $orderEntity)
0 ignored issues
show
Unused Code introduced by
The parameter $paymentTransfer is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

97
    public function generatePayoneReference(/** @scrutinizer ignore-unused */ PayonePaymentTransfer $paymentTransfer, SpySalesOrder $orderEntity)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
98
    {
99
        return $orderEntity->getOrderReference();
100
    }
101
102
    /**
103
     * Fetches text for account statements.
104
     *
105
     * @param array $orderItems
106
     * @param \Orm\Zed\Sales\Persistence\SpySalesOrder $orderEntity
107
     * @param \Spryker\Zed\Oms\Business\Util\ReadOnlyArrayObject $data
108
     *
109
     * @return string
110
     */
111
    public function getNarrativeText(array $orderItems, SpySalesOrder $orderEntity, ReadOnlyArrayObject $data)
0 ignored issues
show
Unused Code introduced by
The parameter $data is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

111
    public function getNarrativeText(array $orderItems, SpySalesOrder $orderEntity, /** @scrutinizer ignore-unused */ ReadOnlyArrayObject $data)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $orderItems is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

111
    public function getNarrativeText(/** @scrutinizer ignore-unused */ array $orderItems, SpySalesOrder $orderEntity, ReadOnlyArrayObject $data)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
112
    {
113
        return $orderEntity->getOrderReference();
114
    }
115
116
    /**
117
     * @return string
118
     */
119
    protected function getYvesBaseUrl()
120
    {
121
        return $this->get(PayoneConstants::HOST_YVES);
122
    }
123
124
    /**
125
     * Returns path to glossary translations file.
126
     *
127
     * @return string
128
     */
129
    public function getTranslationFilePath()
130
    {
131
        return __DIR__ . DIRECTORY_SEPARATOR . PayoneConstants::GLOSSARY_FILE_PATH;
132
    }
133
134
    /**
135
     * @return string
136
     */
137
    public function getBusinessRelation(): string
138
    {
139
        $settings = $this->get(PayoneConstants::PAYONE);
140
141
        return $settings[PayoneConstants::PAYONE_BUSINESS_RELATION];
142
    }
143
144
    /**
145
     * @return string[]
146
     */
147
    public function getGScoreAvailablePaymentMethods(): array
148
    {
149
        $settings = $this->get(PayoneConstants::PAYONE);
150
151
        return $settings[PayoneConstants::PAYONE_GREEN_SCORE_AVAILABLE_PAYMENT_METHODS];
152
    }
153
154
    /**
155
     * @return string[]
156
     */
157
    public function getYScoreAvailablePaymentMethods(): array
158
    {
159
        $settings = $this->get(PayoneConstants::PAYONE);
160
161
        return $settings[PayoneConstants::PAYONE_YELLOW_SCORE_AVAILABLE_PAYMENT_METHODS];
162
    }
163
164
    /**
165
     * @return string[]
166
     */
167
    public function getRScoreAvailablePaymentMethods(): array
168
    {
169
        $settings = $this->get(PayoneConstants::PAYONE);
170
171
        return $settings[PayoneConstants::PAYONE_RED_SCORE_AVAILABLE_PAYMENT_METHODS];
172
    }
173
174
    /**
175
     * @return string[]
176
     */
177
    public function getUScoreAvailablePaymentMethods(): array
178
    {
179
        $settings = $this->get(PayoneConstants::PAYONE);
180
181
        return $settings[PayoneConstants::PAYONE_UNKNOWN_SCORE_AVAILABLE_PAYMENT_METHODS];
182
    }
183
184
    /**
185
     * @return string
186
     */
187
    public function getAddressCheckType(): string
188
    {
189
        $settings = $this->get(PayoneConstants::PAYONE);
190
191
        return $settings[PayoneConstants::PAYONE_ADDRESS_CHECK_TYPE];
192
    }
193
194
    /**
195
     * @return string
196
     */
197
    public function getConsumerScoreType(): string
198
    {
199
        $settings = $this->get(PayoneConstants::PAYONE);
200
201
        return $settings[PayoneConstants::PAYONE_CONSUMER_SCORE_TYPE];
202
    }
203
}
204