|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Apache OSL-2 |
|
5
|
|
|
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file. |
|
6
|
|
|
*/ |
|
7
|
|
|
|
|
8
|
|
|
namespace SprykerEco\Shared\AmazonPay; |
|
9
|
|
|
|
|
10
|
|
|
use Spryker\Shared\Kernel\AbstractBundleConfig; |
|
11
|
|
|
use Spryker\Shared\Kernel\Store; |
|
12
|
|
|
|
|
13
|
|
|
class AmazonPayConfig extends AbstractBundleConfig implements AmazonPayConfigInterface |
|
14
|
|
|
{ |
|
15
|
|
|
public const WIDGET_BUTTON_TYPE_FULL = 'PwA'; |
|
16
|
|
|
public const WIDGET_BUTTON_TYPE_SHORT = 'Pay'; |
|
17
|
|
|
public const WIDGET_BUTTON_TYPE_SQUARE = 'A'; |
|
18
|
|
|
public const WIDGET_BUTTON_COLOR_GOLD = 'Gold'; |
|
19
|
|
|
public const WIDGET_BUTTON_COLOR_LIGHT_GRAY = 'LightGray'; |
|
20
|
|
|
public const WIDGET_BUTTON_COLOR_DARK_GRAY = 'DarkGray'; |
|
21
|
|
|
public const WIDGET_BUTTON_SIZE_SMALL = 'small'; |
|
22
|
|
|
public const WIDGET_BUTTON_SIZE_MEDIUM = 'medium'; |
|
23
|
|
|
public const WIDGET_BUTTON_SIZE_LARGE = 'large'; |
|
24
|
|
|
public const WIDGET_BUTTON_SIZE_XLARGE = 'x-large'; |
|
25
|
|
|
public const PROVIDER_NAME = 'Amazon Pay'; |
|
26
|
|
|
|
|
27
|
|
|
public const OMS_STATUS_AUTH_OPEN = 'auth open'; |
|
28
|
|
|
public const OMS_STATUS_AUTH_OPEN_WITHOUT_CANCEL = 'auth open without cancel'; |
|
29
|
|
|
public const OMS_STATUS_CAPTURE_COMPLETED = 'capture completed'; |
|
30
|
|
|
public const OMS_STATUS_CAPTURE_PENDING = 'capture pending'; |
|
31
|
|
|
public const OMS_STATUS_CANCELLED = 'cancelled'; |
|
32
|
|
|
|
|
33
|
|
|
public const OMS_STATUS_REFUND_PENDING = 'refund pending'; |
|
34
|
|
|
public const OMS_STATUS_REFUND_COMPLETED = 'refund completed'; |
|
35
|
|
|
public const OMS_STATUS_REFUND_DECLINED = 'refund declined'; |
|
36
|
|
|
public const OMS_STATUS_REFUND_WAITING_FOR_STATUS = 'waiting for refund status'; |
|
37
|
|
|
|
|
38
|
|
|
public const OMS_EVENT_UPDATE_AUTH_STATUS = 'update authorization status'; |
|
39
|
|
|
public const OMS_EVENT_CANCEL = 'cancel'; |
|
40
|
|
|
public const OMS_EVENT_UPDATE_CAPTURE_STATUS = 'update capture status'; |
|
41
|
|
|
public const OMS_EVENT_UPDATE_REFUND_STATUS = 'update refund status'; |
|
42
|
|
|
public const OMS_EVENT_CAPTURE = 'capture'; |
|
43
|
|
|
public const OMS_EVENT_UPDATE_SUSPENDED_ORDER = 'update suspended order'; |
|
44
|
|
|
|
|
45
|
|
|
public const OMS_FLAG_NOT_AUTH = 'not auth'; |
|
46
|
|
|
public const OMS_FLAG_NOT_CAPTURED = 'not captured'; |
|
47
|
|
|
|
|
48
|
|
|
public const STATUS_DECLINED = 'STATUS_DECLINED';//setIsDeclined |
|
49
|
|
|
public const STATUS_CANCELLED = 'STATUS_CANCELLED';//setIsCancelled |
|
50
|
|
|
public const STATUS_CLOSED = 'STATUS_CLOSED';//setIsClosed |
|
51
|
|
|
public const STATUS_SUSPENDED = 'STATUS_SUSPENDED'; |
|
52
|
|
|
public const STATUS_PENDING = 'STATUS_PENDING';//setIsPending |
|
53
|
|
|
public const STATUS_OPEN = 'STATUS_OPEN';//setIsOpen |
|
54
|
|
|
public const STATUS_COMPLETED = 'STATUS_COMPLETED';//setIsCompleted |
|
55
|
|
|
public const STATUS_EXPIRED = 'STATUS_EXPIRED';//setIsReauthorizable |
|
56
|
|
|
public const STATUS_PAYMENT_METHOD_INVALID = 'STATUS_CODE_PAYMENT_METHOD_INVALID';//setIsPaymentMethodInvalid |
|
57
|
|
|
public const STATUS_AMAZON_CLOSED = 'STATUS_CODE_AMAZON_CLOSED';//setIsClosedByAmazon |
|
58
|
|
|
public const STATUS_TRANSACTION_TIMED_OUT = 'STATUS_CODE_TRANSACTION_TIMED_OUT';//setIsTransactionTimedOut |
|
59
|
|
|
public const STATUS_PAYMENT_METHOD_CHANGED = 'STATUS_PAYMENT_METHOD_CHANGED';//setIsTransactionTimedOut |
|
60
|
|
|
|
|
61
|
|
|
public const IPN_REQUEST_TYPE_PAYMENT_AUTHORIZE = 'PaymentAuthorize'; |
|
62
|
|
|
public const IPN_REQUEST_TYPE_PAYMENT_CAPTURE = 'PaymentCapture'; |
|
63
|
|
|
public const IPN_REQUEST_TYPE_PAYMENT_REFUND = 'PaymentRefund'; |
|
64
|
|
|
public const IPN_REQUEST_TYPE_ORDER_REFERENCE_NOTIFICATION = 'OrderReferenceNotification'; |
|
65
|
|
|
|
|
66
|
|
|
public const PREFIX_AMAZONPAY_PAYMENT_ERROR = 'amazonpay.payment.error.'; |
|
67
|
|
|
|
|
68
|
|
|
public const DISPLAY_MODE_READONLY = 'Read'; |
|
69
|
|
|
|
|
70
|
|
|
public const REASON_CODE_EXPIRED_UNUSED = 'ExpiredUnused'; |
|
71
|
|
|
public const REASON_CODE_SELLER_CLOSED = 'SellerClosed'; |
|
72
|
|
|
public const REASON_CODE_PAYMENT_METHOD_INVALID = 'InvalidPaymentMethod'; |
|
73
|
|
|
public const REASON_CODE_AMAZON_CLOSED = 'AmazonClosed'; |
|
74
|
|
|
public const REASON_CODE_TRANSACTION_TIMED_OUT = 'TransactionTimedOut'; |
|
75
|
|
|
|
|
76
|
|
|
/** |
|
77
|
|
|
* @return string |
|
78
|
|
|
*/ |
|
79
|
|
|
public function getClientId() |
|
80
|
|
|
{ |
|
81
|
|
|
return $this->get(AmazonPayConstants::CLIENT_ID); |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
/** |
|
85
|
|
|
* @return string |
|
86
|
|
|
*/ |
|
87
|
|
|
public function getAccessKeyId() |
|
88
|
|
|
{ |
|
89
|
|
|
return $this->get(AmazonPayConstants::ACCESS_KEY_ID); |
|
90
|
|
|
} |
|
91
|
|
|
|
|
92
|
|
|
/** |
|
93
|
|
|
* @return string |
|
94
|
|
|
*/ |
|
95
|
|
|
public function getSellerId() |
|
96
|
|
|
{ |
|
97
|
|
|
return $this->get(AmazonPayConstants::SELLER_ID); |
|
98
|
|
|
} |
|
99
|
|
|
|
|
100
|
|
|
/** |
|
101
|
|
|
* @return string |
|
102
|
|
|
*/ |
|
103
|
|
|
public function getSecretAccessKey() |
|
104
|
|
|
{ |
|
105
|
|
|
return $this->get(AmazonPayConstants::SECRET_ACCESS_KEY); |
|
106
|
|
|
} |
|
107
|
|
|
|
|
108
|
|
|
/** |
|
109
|
|
|
* @return string |
|
110
|
|
|
*/ |
|
111
|
|
|
public function getClientSecret() |
|
112
|
|
|
{ |
|
113
|
|
|
return $this->get(AmazonPayConstants::CLIENT_SECRET); |
|
114
|
|
|
} |
|
115
|
|
|
|
|
116
|
|
|
/** |
|
117
|
|
|
* @return string |
|
118
|
|
|
*/ |
|
119
|
|
|
public function getRegion() |
|
120
|
|
|
{ |
|
121
|
|
|
return $this->get(AmazonPayConstants::REGION); |
|
122
|
|
|
} |
|
123
|
|
|
|
|
124
|
|
|
/** |
|
125
|
|
|
* @return string |
|
126
|
|
|
*/ |
|
127
|
|
|
public function getCurrencyIsoCode() |
|
128
|
|
|
{ |
|
129
|
|
|
return Store::getInstance()->getCurrencyIsoCode(); |
|
130
|
|
|
} |
|
131
|
|
|
|
|
132
|
|
|
/** |
|
133
|
|
|
* @return bool |
|
134
|
|
|
*/ |
|
135
|
|
|
public function isSandbox() |
|
136
|
|
|
{ |
|
137
|
|
|
return (bool)$this->get(AmazonPayConstants::SANDBOX, true); |
|
138
|
|
|
} |
|
139
|
|
|
|
|
140
|
|
|
/** |
|
141
|
|
|
* @return string |
|
142
|
|
|
*/ |
|
143
|
|
|
public function getErrorReportLevel() |
|
144
|
|
|
{ |
|
145
|
|
|
return $this->get(AmazonPayConstants::ERROR_REPORT_LEVEL); |
|
146
|
|
|
} |
|
147
|
|
|
|
|
148
|
|
|
/** |
|
149
|
|
|
* @return bool |
|
150
|
|
|
*/ |
|
151
|
|
|
public function getCaptureNow() |
|
152
|
|
|
{ |
|
153
|
|
|
return (bool)$this->get(AmazonPayConstants::CAPTURE_NOW, false); |
|
154
|
|
|
} |
|
155
|
|
|
|
|
156
|
|
|
/** |
|
157
|
|
|
* @return int |
|
158
|
|
|
*/ |
|
159
|
|
|
public function getAuthTransactionTimeout() |
|
160
|
|
|
{ |
|
161
|
|
|
return (int)$this->get(AmazonPayConstants::AUTH_TRANSACTION_TIMEOUT, 0); |
|
162
|
|
|
} |
|
163
|
|
|
|
|
164
|
|
|
/** |
|
165
|
|
|
* @return string |
|
166
|
|
|
*/ |
|
167
|
|
|
public function getWidgetScriptPath() |
|
168
|
|
|
{ |
|
169
|
|
|
return $this->get(AmazonPayConstants::WIDGET_SCRIPT_PATH); |
|
170
|
|
|
} |
|
171
|
|
|
|
|
172
|
|
|
/** |
|
173
|
|
|
* @return string |
|
174
|
|
|
*/ |
|
175
|
|
|
public function getWidgetScriptPathSandbox() |
|
176
|
|
|
{ |
|
177
|
|
|
return $this->get(AmazonPayConstants::WIDGET_SCRIPT_PATH_SANDBOX); |
|
178
|
|
|
} |
|
179
|
|
|
|
|
180
|
|
|
/** |
|
181
|
|
|
* @return bool |
|
182
|
|
|
*/ |
|
183
|
|
|
public function getPopupLogin() |
|
184
|
|
|
{ |
|
185
|
|
|
return (bool)$this->get(AmazonPayConstants::WIDGET_POPUP_LOGIN, false); |
|
186
|
|
|
} |
|
187
|
|
|
|
|
188
|
|
|
/** |
|
189
|
|
|
* @return string |
|
190
|
|
|
*/ |
|
191
|
|
|
public function getButtonSize() |
|
192
|
|
|
{ |
|
193
|
|
|
return $this->get(AmazonPayConstants::WIDGET_BUTTON_SIZE); |
|
194
|
|
|
} |
|
195
|
|
|
|
|
196
|
|
|
/** |
|
197
|
|
|
* @return string |
|
198
|
|
|
*/ |
|
199
|
|
|
public function getButtonColor() |
|
200
|
|
|
{ |
|
201
|
|
|
return $this->get(AmazonPayConstants::WIDGET_BUTTON_COLOR); |
|
202
|
|
|
} |
|
203
|
|
|
|
|
204
|
|
|
/** |
|
205
|
|
|
* @return string |
|
206
|
|
|
*/ |
|
207
|
|
|
public function getButtonType() |
|
208
|
|
|
{ |
|
209
|
|
|
return $this->get(AmazonPayConstants::WIDGET_BUTTON_TYPE); |
|
210
|
|
|
} |
|
211
|
|
|
|
|
212
|
|
|
/** |
|
213
|
|
|
* @return string |
|
214
|
|
|
*/ |
|
215
|
|
|
public function getPaymentRejectRoute() |
|
216
|
|
|
{ |
|
217
|
|
|
return $this->get(AmazonPayConstants::PAYMENT_REJECT_ROUTE); |
|
218
|
|
|
} |
|
219
|
|
|
|
|
220
|
|
|
/** |
|
221
|
|
|
* @return bool |
|
222
|
|
|
*/ |
|
223
|
|
|
public function getEnableIsolateLevelRead() |
|
224
|
|
|
{ |
|
225
|
|
|
return (bool)$this->get(AmazonPayConstants::ENABLE_ISOLATE_LEVEL_READ, false); |
|
226
|
|
|
} |
|
227
|
|
|
|
|
228
|
|
|
/** |
|
229
|
|
|
* @return string |
|
230
|
|
|
*/ |
|
231
|
|
|
public function getSuccessPaymentUrl(): string |
|
232
|
|
|
{ |
|
233
|
|
|
return $this->get(AmazonPayConstants::SUCCESS_PAYMENT_URL); |
|
234
|
|
|
} |
|
235
|
|
|
|
|
236
|
|
|
/** |
|
237
|
|
|
* @return string |
|
238
|
|
|
*/ |
|
239
|
|
|
public function getFailurePaymentUrl(): string |
|
240
|
|
|
{ |
|
241
|
|
|
return $this->get(AmazonPayConstants::FAILURE_PAYMENT_URL); |
|
242
|
|
|
} |
|
243
|
|
|
} |
|
244
|
|
|
|