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

PayoneClient::sendAddressCheckRequest()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
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\Client\Payone;
9
10
use Generated\Shared\Transfer\AddressCheckResponseTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...ssCheckResponseTransfer 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\ConsumerScoreResponseTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...erScoreResponseTransfer 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 Generated\Shared\Transfer\PayoneBankAccountCheckTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...ankAccountCheckTransfer 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 Generated\Shared\Transfer\PayoneCancelRedirectTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...eCancelRedirectTransfer 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...
14
use Generated\Shared\Transfer\PayoneGetFileTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\PayoneGetFileTransfer 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...
15
use Generated\Shared\Transfer\PayoneGetInvoiceTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\PayoneGetInvoiceTransfer 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...
16
use Generated\Shared\Transfer\PayoneGetPaymentDetailTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...etPaymentDetailTransfer 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...
17
use Generated\Shared\Transfer\PayoneInitPaypalExpressCheckoutRequestTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...CheckoutRequestTransfer 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...
18
use Generated\Shared\Transfer\PayoneManageMandateTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...neManageMandateTransfer 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...
19
use Generated\Shared\Transfer\PayonePersonalDataTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...onePersonalDataTransfer 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...
20
use Generated\Shared\Transfer\PayoneTransactionStatusUpdateTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...ionStatusUpdateTransfer 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...
21
use Generated\Shared\Transfer\QuoteTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\QuoteTransfer 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...
22
use Spryker\Client\Kernel\AbstractClient;
23
24
/**
25
 * @api
26
 *
27
 * @method \SprykerEco\Client\Payone\PayoneFactory getFactory()
28
 */
29
class PayoneClient extends AbstractClient implements PayoneClientInterface
30
{
31
    /**
32
     * Prepares credit card check request to bring standard parameters and hash to front-end.
33
     *
34
     * @api
35
     *
36
     * @return \SprykerEco\Client\Payone\ClientApi\Request\CreditCardCheckContainer
37
     */
38
    public function getCreditCardCheckRequest()
39
    {
40
        $defaults = [];
41
        return $this->getFactory()->createCreditCardCheckCall($defaults)->mapCreditCardCheckData();
42
    }
43
44
    /**
45
     * Processes and saves transaction status update received from Payone.
46
     *
47
     * @api
48
     *
49
     * @param \Generated\Shared\Transfer\PayoneTransactionStatusUpdateTransfer $statusUpdateTransfer
50
     *
51
     * @return \Generated\Shared\Transfer\PayoneTransactionStatusUpdateTransfer
52
     */
53
    public function updateStatus(PayoneTransactionStatusUpdateTransfer $statusUpdateTransfer)
54
    {
55
        return $this->getFactory()->createZedStub()->updateStatus($statusUpdateTransfer);
56
    }
57
58
    /**
59
     * Performs GetFile request to Payone API for PDF file download.
60
     *
61
     * @api
62
     *
63
     * @param \Generated\Shared\Transfer\PayoneGetFileTransfer $getFileTransfer
64
     *
65
     * @return \Generated\Shared\Transfer\PayoneGetFileTransfer
66
     */
67
    public function getFile(PayoneGetFileTransfer $getFileTransfer)
68
    {
69
        return $this->getFactory()->createZedStub()->getFile($getFileTransfer);
70
    }
71
72
    /**
73
     * Verifies url HMAC signature and fires 'cancel redirect' event.
74
     *
75
     * @api
76
     *
77
     * @param \Generated\Shared\Transfer\PayoneCancelRedirectTransfer $cancelRedirectTransfer
78
     *
79
     * @return \Generated\Shared\Transfer\PayoneCancelRedirectTransfer
80
     */
81
    public function cancelRedirect(PayoneCancelRedirectTransfer $cancelRedirectTransfer)
82
    {
83
        return $this->getFactory()->createZedStub()->cancelRedirect($cancelRedirectTransfer);
84
    }
85
86
    /**
87
     * Specification:
88
     * - Performs BankAccountCheck request to Payone API.
89
     *
90
     * @api
91
     *
92
     * @param \Generated\Shared\Transfer\PayonePaymentDirectDebitTransfer $bankAccountCheckTransfer
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...mentDirectDebitTransfer 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...
93
     *
94
     * @return \Generated\Shared\Transfer\PayoneBankAccountCheckTransfer
95
     */
96
    public function bankAccountCheck(PayoneBankAccountCheckTransfer $bankAccountCheckTransfer)
97
    {
98
        return $this->getFactory()->createZedStub()->bankAccountCheck($bankAccountCheckTransfer);
99
    }
100
101
    /**
102
     * Performs ManageMandate request to Payone API.
103
     *
104
     * @api
105
     *
106
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
107
     *
108
     * @return \Generated\Shared\Transfer\PayoneManageMandateTransfer
109
     */
110
    public function manageMandate(QuoteTransfer $quoteTransfer)
111
    {
112
        $manageMandateTransfer = new PayoneManageMandateTransfer();
113
        $manageMandateTransfer->setBankCountry($quoteTransfer->getPayment()->getPayoneDirectDebit()->getBankcountry());
114
        $manageMandateTransfer->setBankAccount($quoteTransfer->getPayment()->getPayoneDirectDebit()->getBankaccount());
115
        $manageMandateTransfer->setBankCode($quoteTransfer->getPayment()->getPayoneDirectDebit()->getBankcode());
116
        $manageMandateTransfer->setIban($quoteTransfer->getPayment()->getPayoneDirectDebit()->getIban());
117
        $manageMandateTransfer->setBic($quoteTransfer->getPayment()->getPayoneDirectDebit()->getBic());
118
        $personalData = new PayonePersonalDataTransfer();
119
        $customer = $quoteTransfer->getCustomer();
120
        $billingAddress = $quoteTransfer->getBillingAddress();
121
        $personalData->setCustomerId($customer->getIdCustomer());
122
        $personalData->setLastName($billingAddress->getLastName());
123
        $personalData->setFirstName($billingAddress->getFirstName());
124
        $personalData->setCompany($billingAddress->getCompany());
125
        $personalData->setCountry($billingAddress->getIso2Code());
126
        $personalData->setCity($billingAddress->getCity());
127
        $personalData->setStreet($billingAddress->getAddress1());
128
        $personalData->setZip($billingAddress->getZipCode());
129
        $personalData->setEmail($billingAddress->getEmail());
130
        $manageMandateTransfer->setPersonalData($personalData);
131
132
        return $this->getFactory()->createZedStub()->manageMandate($manageMandateTransfer);
133
    }
134
135
    /**
136
     * Fetches payment details for given order.
137
     *
138
     * @api
139
     *
140
     * @param \Generated\Shared\Transfer\PayoneGetPaymentDetailTransfer $getPaymentDetailTransfer
141
     *
142
     * @return \Generated\Shared\Transfer\PayoneGetPaymentDetailTransfer
143
     */
144
    public function getPaymentDetail(PayoneGetPaymentDetailTransfer $getPaymentDetailTransfer)
145
    {
146
        return $this->getFactory()->createZedStub()->getPaymentDetail($getPaymentDetailTransfer);
147
    }
148
149
    /**
150
     * Performs GetInvoice request to Payone API for PDF file download.
151
     *
152
     * @api
153
     *
154
     * @param \Generated\Shared\Transfer\PayoneGetInvoiceTransfer $getInvoiceTransfer
155
     *
156
     * @return \Generated\Shared\Transfer\PayoneGetInvoiceTransfer
157
     */
158
    public function getInvoice(PayoneGetInvoiceTransfer $getInvoiceTransfer)
159
    {
160
        return $this->getFactory()->createZedStub()->getInvoice($getInvoiceTransfer);
161
    }
162
163
    /**
164
     * Send genericpayment request to payone with action "setexpresscheckout"
165
     * to start express checkout on paypal side and also to get workorderid.
166
     *
167
     * @api
168
     *
169
     * @param \Generated\Shared\Transfer\PayoneInitPaypalExpressCheckoutRequestTransfer $requestTransfer
170
     *
171
     * @return \Generated\Shared\Transfer\PayonePaypalExpressCheckoutGenericPaymentResponseTransfer
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...PaymentResponseTransfer 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...
172
     */
173
    public function initPaypalExpressCheckout(PayoneInitPaypalExpressCheckoutRequestTransfer $requestTransfer)
174
    {
175
        return $this->getFactory()->createZedStub()->initPaypalExpressCheckout($requestTransfer);
176
    }
177
178
    /**
179
     * Send genericpayment request to payone with action "getexpresscheckoutdetails"
180
     * in order to get customer data like email and shipping data.
181
     *
182
     * @api
183
     *
184
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
185
     *
186
     * @return \Generated\Shared\Transfer\PayonePaypalExpressCheckoutGenericPaymentResponseTransfer
187
     */
188
    public function getPaypalExpressCheckoutDetails(QuoteTransfer $quoteTransfer)
189
    {
190
        return $this->getFactory()->createZedStub()->getPaypalExpressCheckoutDetails($quoteTransfer);
191
    }
192
193
    /**
194
     * {@inheritdoc}
195
     *
196
     * @api
197
     *
198
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
199
     *
200
     * @return \Generated\Shared\Transfer\AddressCheckResponseTransfer
201
     */
202
    public function sendAddressCheckRequest(QuoteTransfer $quoteTransfer): AddressCheckResponseTransfer
203
    {
204
        return $this->getFactory()->createZedStub()->sendAddressCheckRequest($quoteTransfer);
205
    }
206
207
    /**
208
     * {@inheritdoc}
209
     *
210
     * @api
211
     *
212
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
213
     *
214
     * @return \Generated\Shared\Transfer\ConsumerScoreResponseTransfer
215
     */
216
    public function sendConsumerScoreRequest(QuoteTransfer $quoteTransfer): ConsumerScoreResponseTransfer
217
    {
218
        return $this->getFactory()->createZedStub()->sendConsumerScoreRequest($quoteTransfer);
219
    }
220
}
221