1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* MIT License |
5
|
|
|
* For full license information, please view the LICENSE file that was distributed with this source code. |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
namespace SprykerEco\Zed\AfterPay\Business\Api\Adapter; |
9
|
|
|
|
10
|
|
|
use Spryker\Zed\Kernel\Business\AbstractBusinessFactory; |
11
|
|
|
use SprykerEco\Zed\AfterPay\AfterPayDependencyProvider; |
12
|
|
|
use SprykerEco\Zed\AfterPay\Business\Api\Adapter\ApiCall\ApiStatusCall; |
13
|
|
|
use SprykerEco\Zed\AfterPay\Business\Api\Adapter\ApiCall\ApiStatusCallInterface; |
14
|
|
|
use SprykerEco\Zed\AfterPay\Business\Api\Adapter\ApiCall\ApiVersionCall; |
15
|
|
|
use SprykerEco\Zed\AfterPay\Business\Api\Adapter\ApiCall\ApiVersionCallInterface; |
16
|
|
|
use SprykerEco\Zed\AfterPay\Business\Api\Adapter\ApiCall\AuthorizePaymentCall; |
17
|
|
|
use SprykerEco\Zed\AfterPay\Business\Api\Adapter\ApiCall\AuthorizePaymentCallInterface; |
18
|
|
|
use SprykerEco\Zed\AfterPay\Business\Api\Adapter\ApiCall\AvailablePaymentMethodsCall; |
19
|
|
|
use SprykerEco\Zed\AfterPay\Business\Api\Adapter\ApiCall\AvailablePaymentMethodsCallInterface; |
20
|
|
|
use SprykerEco\Zed\AfterPay\Business\Api\Adapter\ApiCall\CancelCall; |
21
|
|
|
use SprykerEco\Zed\AfterPay\Business\Api\Adapter\ApiCall\CancelCallInterface; |
22
|
|
|
use SprykerEco\Zed\AfterPay\Business\Api\Adapter\ApiCall\CaptureCall; |
23
|
|
|
use SprykerEco\Zed\AfterPay\Business\Api\Adapter\ApiCall\CaptureCallInterface; |
24
|
|
|
use SprykerEco\Zed\AfterPay\Business\Api\Adapter\ApiCall\LookupCustomerCall; |
25
|
|
|
use SprykerEco\Zed\AfterPay\Business\Api\Adapter\ApiCall\LookupCustomerCallInterface; |
26
|
|
|
use SprykerEco\Zed\AfterPay\Business\Api\Adapter\ApiCall\LookupInstallmentPlansCall; |
27
|
|
|
use SprykerEco\Zed\AfterPay\Business\Api\Adapter\ApiCall\LookupInstallmentPlansCallInterface; |
28
|
|
|
use SprykerEco\Zed\AfterPay\Business\Api\Adapter\ApiCall\RefundCall; |
29
|
|
|
use SprykerEco\Zed\AfterPay\Business\Api\Adapter\ApiCall\RefundCallInterface; |
30
|
|
|
use SprykerEco\Zed\AfterPay\Business\Api\Adapter\ApiCall\ValidateBankAccountCall; |
31
|
|
|
use SprykerEco\Zed\AfterPay\Business\Api\Adapter\ApiCall\ValidateBankAccountCallInterface; |
32
|
|
|
use SprykerEco\Zed\AfterPay\Business\Api\Adapter\ApiCall\ValidateCustomerCall; |
33
|
|
|
use SprykerEco\Zed\AfterPay\Business\Api\Adapter\ApiCall\ValidateCustomerCallInterface; |
34
|
|
|
use SprykerEco\Zed\AfterPay\Business\Api\Adapter\Client\ClientInterface; |
35
|
|
|
use SprykerEco\Zed\AfterPay\Business\Api\Adapter\Client\Http\Guzzle; |
36
|
|
|
use SprykerEco\Zed\AfterPay\Business\Api\Adapter\Converter\TransferToCamelCaseArrayConverter; |
37
|
|
|
use SprykerEco\Zed\AfterPay\Business\Api\Adapter\Converter\TransferToCamelCaseArrayConverterInterface; |
38
|
|
|
use SprykerEco\Zed\AfterPay\Dependency\Facade\AfterPayToMoneyFacadeInterface; |
39
|
|
|
use SprykerEco\Zed\AfterPay\Dependency\Service\AfterPayToUtilEncodingServiceInterface; |
40
|
|
|
use SprykerEco\Zed\AfterPay\Dependency\Service\AfterPayToUtilTextServiceInterface; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @method \SprykerEco\Zed\AfterPay\AfterPayConfig getConfig() |
44
|
|
|
*/ |
45
|
|
|
class AdapterFactory extends AbstractBusinessFactory implements AdapterFactoryInterface |
46
|
|
|
{ |
47
|
|
|
/** |
48
|
|
|
* @return \SprykerEco\Zed\AfterPay\Business\Api\Adapter\ApiCall\AvailablePaymentMethodsCallInterface |
49
|
|
|
*/ |
50
|
|
|
public function createAvailablePaymentMethodsCall(): AvailablePaymentMethodsCallInterface |
51
|
|
|
{ |
52
|
|
|
return new AvailablePaymentMethodsCall( |
53
|
|
|
$this->createHttpClient(), |
54
|
|
|
$this->createTransferToCamelCaseArrayConverter(), |
55
|
|
|
$this->getUtilEncodingService(), |
56
|
|
|
$this->getConfig() |
57
|
|
|
); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @return \SprykerEco\Zed\AfterPay\Business\Api\Adapter\ApiCall\AuthorizePaymentCallInterface |
62
|
|
|
*/ |
63
|
|
|
public function createAuthorizePaymentCall(): AuthorizePaymentCallInterface |
64
|
|
|
{ |
65
|
|
|
return new AuthorizePaymentCall( |
66
|
|
|
$this->createHttpClient(), |
67
|
|
|
$this->createTransferToCamelCaseArrayConverter(), |
68
|
|
|
$this->getUtilEncodingService(), |
69
|
|
|
$this->getConfig() |
70
|
|
|
); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* @return \SprykerEco\Zed\AfterPay\Business\Api\Adapter\ApiCall\ValidateCustomerCallInterface |
75
|
|
|
*/ |
76
|
|
|
public function createValidateCustomerCall(): ValidateCustomerCallInterface |
77
|
|
|
{ |
78
|
|
|
return new ValidateCustomerCall( |
79
|
|
|
$this->createHttpClient(), |
80
|
|
|
$this->createTransferToCamelCaseArrayConverter(), |
81
|
|
|
$this->getUtilEncodingService(), |
82
|
|
|
$this->getUtilTextService(), |
83
|
|
|
$this->getConfig() |
84
|
|
|
); |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* @return \SprykerEco\Zed\AfterPay\Business\Api\Adapter\ApiCall\ValidateBankAccountCallInterface |
89
|
|
|
*/ |
90
|
|
|
public function createValidateBankAccountCall(): ValidateBankAccountCallInterface |
91
|
|
|
{ |
92
|
|
|
return new ValidateBankAccountCall( |
93
|
|
|
$this->createHttpClient(), |
94
|
|
|
$this->createTransferToCamelCaseArrayConverter(), |
95
|
|
|
$this->getUtilEncodingService(), |
96
|
|
|
$this->getConfig() |
97
|
|
|
); |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* @return \SprykerEco\Zed\AfterPay\Business\Api\Adapter\ApiCall\LookupCustomerCallInterface |
102
|
|
|
*/ |
103
|
|
|
public function createLookupCustomerCall(): LookupCustomerCallInterface |
104
|
|
|
{ |
105
|
|
|
return new LookupCustomerCall( |
106
|
|
|
$this->createHttpClient(), |
107
|
|
|
$this->createTransferToCamelCaseArrayConverter(), |
108
|
|
|
$this->getUtilEncodingService(), |
109
|
|
|
$this->getConfig() |
110
|
|
|
); |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* @return \SprykerEco\Zed\AfterPay\Business\Api\Adapter\ApiCall\LookupInstallmentPlansCallInterface |
115
|
|
|
*/ |
116
|
|
|
public function createLookupInstallmentPlansCall(): LookupInstallmentPlansCallInterface |
117
|
|
|
{ |
118
|
|
|
return new LookupInstallmentPlansCall( |
119
|
|
|
$this->createHttpClient(), |
120
|
|
|
$this->createTransferToCamelCaseArrayConverter(), |
121
|
|
|
$this->getUtilEncodingService(), |
122
|
|
|
$this->getMoneyFacade(), |
123
|
|
|
$this->getConfig() |
124
|
|
|
); |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
/** |
128
|
|
|
* @return \SprykerEco\Zed\AfterPay\Business\Api\Adapter\ApiCall\CaptureCallInterface |
129
|
|
|
*/ |
130
|
|
|
public function createCaptureCall(): CaptureCallInterface |
131
|
|
|
{ |
132
|
|
|
return new CaptureCall( |
133
|
|
|
$this->createHttpClient(), |
134
|
|
|
$this->createTransferToCamelCaseArrayConverter(), |
135
|
|
|
$this->getUtilEncodingService(), |
136
|
|
|
$this->getMoneyFacade(), |
137
|
|
|
$this->getConfig() |
138
|
|
|
); |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
/** |
142
|
|
|
* @return \SprykerEco\Zed\AfterPay\Business\Api\Adapter\ApiCall\CancelCallInterface |
143
|
|
|
*/ |
144
|
|
|
public function createCancelCall(): CancelCallInterface |
145
|
|
|
{ |
146
|
|
|
return new CancelCall( |
147
|
|
|
$this->createHttpClient(), |
148
|
|
|
$this->createTransferToCamelCaseArrayConverter(), |
149
|
|
|
$this->getUtilEncodingService(), |
150
|
|
|
$this->getMoneyFacade(), |
151
|
|
|
$this->getConfig() |
152
|
|
|
); |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* @return \SprykerEco\Zed\AfterPay\Business\Api\Adapter\ApiCall\RefundCallInterface |
157
|
|
|
*/ |
158
|
|
|
public function createRefundCall(): RefundCallInterface |
159
|
|
|
{ |
160
|
|
|
return new RefundCall( |
161
|
|
|
$this->createHttpClient(), |
162
|
|
|
$this->createTransferToCamelCaseArrayConverter(), |
163
|
|
|
$this->getUtilEncodingService(), |
164
|
|
|
$this->getMoneyFacade(), |
165
|
|
|
$this->getConfig() |
166
|
|
|
); |
167
|
|
|
} |
168
|
|
|
|
169
|
|
|
/** |
170
|
|
|
* @return \SprykerEco\Zed\AfterPay\Business\Api\Adapter\ApiCall\ApiVersionCallInterface |
171
|
|
|
*/ |
172
|
|
|
public function createApiVersionCall(): ApiVersionCallInterface |
173
|
|
|
{ |
174
|
|
|
return new ApiVersionCall( |
175
|
|
|
$this->createHttpClient(), |
176
|
|
|
$this->getConfig(), |
177
|
|
|
$this->getUtilEncodingService() |
178
|
|
|
); |
179
|
|
|
} |
180
|
|
|
|
181
|
|
|
/** |
182
|
|
|
* @return \SprykerEco\Zed\AfterPay\Business\Api\Adapter\ApiCall\ApiStatusCallInterface |
183
|
|
|
*/ |
184
|
|
|
public function createGetApiStatusCall(): ApiStatusCallInterface |
185
|
|
|
{ |
186
|
|
|
return new ApiStatusCall( |
187
|
|
|
$this->createHttpClient(), |
188
|
|
|
$this->getConfig() |
189
|
|
|
); |
190
|
|
|
} |
191
|
|
|
|
192
|
|
|
/** |
193
|
|
|
* @return \SprykerEco\Zed\AfterPay\Business\Api\Adapter\Client\ClientInterface |
194
|
|
|
*/ |
195
|
|
|
public function createHttpClient(): ClientInterface |
196
|
|
|
{ |
197
|
|
|
return new Guzzle( |
198
|
|
|
$this->getUtilEncodingService(), |
199
|
|
|
$this->getConfig() |
200
|
|
|
); |
201
|
|
|
} |
202
|
|
|
|
203
|
|
|
/** |
204
|
|
|
* @return \SprykerEco\Zed\AfterPay\Business\Api\Adapter\Converter\TransferToCamelCaseArrayConverterInterface |
205
|
|
|
*/ |
206
|
|
|
public function createTransferToCamelCaseArrayConverter(): TransferToCamelCaseArrayConverterInterface |
207
|
|
|
{ |
208
|
|
|
return new TransferToCamelCaseArrayConverter($this->getUtilTextService()); |
209
|
|
|
} |
210
|
|
|
|
211
|
|
|
/** |
212
|
|
|
* @return \SprykerEco\Zed\AfterPay\Dependency\Service\AfterPayToUtilEncodingServiceInterface |
213
|
|
|
*/ |
214
|
|
|
public function getUtilEncodingService(): AfterPayToUtilEncodingServiceInterface |
215
|
|
|
{ |
216
|
|
|
return $this->getProvidedDependency(AfterPayDependencyProvider::SERVICE_UTIL_ENCODING); |
217
|
|
|
} |
218
|
|
|
|
219
|
|
|
/** |
220
|
|
|
* @return \SprykerEco\Zed\AfterPay\Dependency\Facade\AfterPayToMoneyFacadeInterface |
221
|
|
|
*/ |
222
|
|
|
public function getMoneyFacade(): AfterPayToMoneyFacadeInterface |
223
|
|
|
{ |
224
|
|
|
return $this->getProvidedDependency(AfterPayDependencyProvider::FACADE_MONEY); |
225
|
|
|
} |
226
|
|
|
|
227
|
|
|
/** |
228
|
|
|
* @return \SprykerEco\Zed\AfterPay\Dependency\Service\AfterPayToUtilTextServiceInterface |
229
|
|
|
*/ |
230
|
|
|
public function getUtilTextService(): AfterPayToUtilTextServiceInterface |
231
|
|
|
{ |
232
|
|
|
return $this->getProvidedDependency(AfterPayDependencyProvider::SERVICE_UTIL_TEXT); |
233
|
|
|
} |
234
|
|
|
} |
235
|
|
|
|