1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Created by Gorlum 21.08.2019 11:53 |
4
|
|
|
*/ |
5
|
|
|
|
6
|
|
|
namespace Payment; |
7
|
|
|
|
8
|
|
|
use SN; |
9
|
|
|
use sn_module_payment; |
10
|
|
|
|
11
|
|
|
class PaymentMethods { |
12
|
|
|
const P_CURRENCY = 'currency'; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* @var array $payment_methods |
16
|
|
|
*/ |
17
|
|
|
public static $payment_methods = [ |
18
|
|
|
PAYMENT_METHOD_BANK_CARD => [ |
19
|
|
|
/* |
20
|
|
|
PAYMENT_METHOD_id => [ |
21
|
|
|
'currency' => 'WMR', // Currency code 3 letter |
22
|
|
|
'image' => 'design/images/payments/emoney/webmoney.png', // Optional - image location from root. Setting image disables buttoning and name printing |
23
|
|
|
'name' => true, // Optional. Forces method name printing with 'image' set |
24
|
|
|
'button' => true, // Optional. Forces method buttoning with 'image' set |
25
|
|
|
], |
26
|
|
|
*/ |
27
|
|
|
PAYMENT_METHOD_BANK_CARD_STANDARD => [ |
28
|
|
|
self::P_CURRENCY => 'RUB', |
29
|
|
|
'image' => 'design/images/payments/card/generic.png', |
30
|
|
|
'button' => true, |
31
|
|
|
], |
32
|
|
|
PAYMENT_METHOD_BANK_CARD_LIQPAY => [ |
33
|
|
|
self::P_CURRENCY => 'UAH', |
34
|
|
|
'image' => 'design/images/payments/card/liqpay.png', |
35
|
|
|
'button' => true, |
36
|
|
|
], |
37
|
|
|
PAYMENT_METHOD_BANK_CARD_EASYPAY => [ |
38
|
|
|
self::P_CURRENCY => 'UAH', |
39
|
|
|
'image' => 'design/images/payments/card/easypay.png', |
40
|
|
|
'button' => true, |
41
|
|
|
], |
42
|
|
|
PAYMENT_METHOD_BANK_CARD_AMERICAN_EXPRESS => [ |
43
|
|
|
self::P_CURRENCY => 'USD', |
44
|
|
|
'image' => 'design/images/payments/card/american_express.png', |
45
|
|
|
'button' => true, |
46
|
|
|
], |
47
|
|
|
PAYMENT_METHOD_BANK_CARD_JCB => [ |
48
|
|
|
self::P_CURRENCY => 'USD', |
49
|
|
|
'image' => 'design/images/payments/card/jcb.png', |
50
|
|
|
'button' => true, |
51
|
|
|
], |
52
|
|
|
PAYMENT_METHOD_BANK_CARD_UNIONPAY => [ |
53
|
|
|
self::P_CURRENCY => 'USD', |
54
|
|
|
'image' => 'design/images/payments/card/unionpay.png', |
55
|
|
|
'button' => true, |
56
|
|
|
], |
57
|
|
|
], |
58
|
|
|
|
59
|
|
|
PAYMENT_METHOD_EMONEY => [ |
60
|
|
|
PAYMENT_METHOD_EMONEY_YANDEX => [ |
61
|
|
|
self::P_CURRENCY => 'RUB', |
62
|
|
|
'image' => 'design/images/payments/emoney/yandexmoney.png', |
63
|
|
|
'button' => true, |
64
|
|
|
], |
65
|
|
|
PAYMENT_METHOD_EMONEY_QIWI => [ |
66
|
|
|
self::P_CURRENCY => 'RUB', |
67
|
|
|
'image' => 'design/images/payments/emoney/qiwi.png', |
68
|
|
|
'button' => true, |
69
|
|
|
], |
70
|
|
|
PAYMENT_METHOD_EMONEY_PAYPAL => [ |
71
|
|
|
self::P_CURRENCY => 'RUB', |
72
|
|
|
'image' => 'design/images/payments/emoney/paypal.png', |
73
|
|
|
'button' => true, |
74
|
|
|
], |
75
|
|
|
PAYMENT_METHOD_EMONEY_WEBMONEY_WMR => [ |
76
|
|
|
// 'currency' => 'WMR', |
77
|
|
|
self::P_CURRENCY => 'RUB', |
78
|
|
|
'image' => 'design/images/payments/emoney/webmoney_wmr.gif', |
79
|
|
|
'button' => true, |
80
|
|
|
], |
81
|
|
|
PAYMENT_METHOD_EMONEY_WEBMONEY_WMZ => [ |
82
|
|
|
// 'currency' => 'WMZ', |
83
|
|
|
self::P_CURRENCY => 'RUB', |
84
|
|
|
'image' => 'design/images/payments/emoney/webmoney_wmz.gif', |
85
|
|
|
'button' => true, |
86
|
|
|
], |
87
|
|
|
PAYMENT_METHOD_EMONEY_WEBMONEY_WMU => [ |
88
|
|
|
// 'currency' => 'WMU', |
89
|
|
|
self::P_CURRENCY => 'RUB', |
90
|
|
|
'image' => 'design/images/payments/emoney/webmoney_wmu.gif', |
91
|
|
|
'button' => true, |
92
|
|
|
], |
93
|
|
|
PAYMENT_METHOD_EMONEY_WEBMONEY_WME => [ |
94
|
|
|
// 'currency' => 'WME', |
95
|
|
|
self::P_CURRENCY => 'RUB', |
96
|
|
|
'image' => 'design/images/payments/emoney/webmoney_wme.gif', |
97
|
|
|
'button' => true, |
98
|
|
|
], |
99
|
|
|
PAYMENT_METHOD_EMONEY_WEBMONEY_WMB => [ |
100
|
|
|
// 'currency' => 'WMB', |
101
|
|
|
self::P_CURRENCY => 'RUB', |
102
|
|
|
'image' => 'design/images/payments/emoney/webmoney_wmb.gif', |
103
|
|
|
'button' => true, |
104
|
|
|
], |
105
|
|
|
PAYMENT_METHOD_EMONEY_TELEMONEY => [ |
106
|
|
|
self::P_CURRENCY => 'RUB', |
107
|
|
|
'image' => 'design/images/payments/emoney/telemoney.gif', |
108
|
|
|
'button' => true, |
109
|
|
|
], |
110
|
|
|
PAYMENT_METHOD_EMONEY_ELECSNET => [ |
111
|
|
|
self::P_CURRENCY => 'RUB', |
112
|
|
|
'image' => 'design/images/payments/emoney/elecsnet.png', |
113
|
|
|
'button' => true, |
114
|
|
|
], |
115
|
|
|
PAYMENT_METHOD_EMONEY_EASYPAY => [ |
116
|
|
|
self::P_CURRENCY => 'RUB', |
117
|
|
|
'image' => 'design/images/payments/emoney/easypay.png', |
118
|
|
|
'button' => true, |
119
|
|
|
], |
120
|
|
|
PAYMENT_METHOD_EMONEY_RUR_W1R => [ |
121
|
|
|
self::P_CURRENCY => 'RUB', |
122
|
|
|
'image' => 'design/images/payments/emoney/walletone.png', |
123
|
|
|
'button' => true, |
124
|
|
|
], |
125
|
|
|
PAYMENT_METHOD_EMONEY_MAILRU => [ |
126
|
|
|
self::P_CURRENCY => 'RUB', |
127
|
|
|
'image' => 'design/images/payments/emoney/mailru.gif', |
128
|
|
|
], |
129
|
|
|
], |
130
|
|
|
|
131
|
|
|
PAYMENT_METHOD_MOBILE => [ |
132
|
|
|
PAYMENT_METHOD_MOBILE_SMS => [ |
133
|
|
|
self::P_CURRENCY => 'RUB', |
134
|
|
|
'image' => 'design/images/payments/mobile/sms.png', |
135
|
|
|
'name' => true, |
136
|
|
|
'button' => true, |
137
|
|
|
], |
138
|
|
|
PAYMENT_METHOD_MOBILE_PAYPAL_ZONG => [ |
139
|
|
|
self::P_CURRENCY => 'USD', |
140
|
|
|
'image' => 'design/images/payments/mobile/paypal_zong.png', |
141
|
|
|
'name' => true, |
142
|
|
|
'button' => true, |
143
|
|
|
], |
144
|
|
|
|
145
|
|
|
|
146
|
|
|
PAYMENT_METHOD_MOBILE_MEGAPHONE => [ |
147
|
|
|
self::P_CURRENCY => 'RUB', |
148
|
|
|
'image' => 'design/images/payments/mobile/megafon.png', |
149
|
|
|
'button' => true, |
150
|
|
|
], |
151
|
|
|
PAYMENT_METHOD_MOBILE_MTS => [ |
152
|
|
|
self::P_CURRENCY => 'RUB', |
153
|
|
|
'image' => 'design/images/payments/mobile/mts.png', |
154
|
|
|
'button' => true, |
155
|
|
|
], |
156
|
|
|
PAYMENT_METHOD_MOBILE_BEELINE => [ |
157
|
|
|
self::P_CURRENCY => 'RUB', |
158
|
|
|
// 'image' => 'design/images/payments/mobile/mts.png', |
159
|
|
|
'name' => true, |
160
|
|
|
// 'button' => true, |
161
|
|
|
], |
162
|
|
|
PAYMENT_METHOD_MOBILE_KYIVSTAR => [ |
163
|
|
|
self::P_CURRENCY => 'UAH', |
164
|
|
|
'image' => 'design/images/payments/mobile/kyivstar.png', |
165
|
|
|
'button' => true, |
166
|
|
|
], |
167
|
|
|
], |
168
|
|
|
|
169
|
|
|
PAYMENT_METHOD_BANK_INTERNET => [ |
170
|
|
|
PAYMENT_METHOD_BANK_INTERNET_PRIVAT24 => [ |
171
|
|
|
self::P_CURRENCY => 'UAH', |
172
|
|
|
'image' => 'design/images/payments/bank_internet/privat24.png', |
173
|
|
|
'button' => true, |
174
|
|
|
], |
175
|
|
|
PAYMENT_METHOD_BANK_INTERNET_BANK24 => [ |
176
|
|
|
self::P_CURRENCY => 'UAH', |
177
|
|
|
'image' => 'design/images/payments/bank_internet/bank24.png', |
178
|
|
|
'button' => true, |
179
|
|
|
], |
180
|
|
|
PAYMENT_METHOD_BANK_INTERNET_ALFA_BANK => [ |
181
|
|
|
self::P_CURRENCY => 'RUB', |
182
|
|
|
'image' => 'design/images/payments/bank_internet/alfa_bank.png', |
183
|
|
|
'button' => true, |
184
|
|
|
], |
185
|
|
|
PAYMENT_METHOD_BANK_INTERNET_SBERBANK => [ |
186
|
|
|
self::P_CURRENCY => 'RUB', |
187
|
|
|
'image' => 'design/images/payments/bank_internet/sberbank.png', |
188
|
|
|
'button' => true, |
189
|
|
|
], |
190
|
|
|
PAYMENT_METHOD_BANK_INTERNET_PROSMVYAZBANK => [ |
191
|
|
|
self::P_CURRENCY => 'RUB', |
192
|
|
|
'image' => 'design/images/payments/bank_internet/prosmvyazbank.png', |
193
|
|
|
'button' => true, |
194
|
|
|
], |
195
|
|
|
PAYMENT_METHOD_BANK_INTERNET_HANDY_BANK => [ |
196
|
|
|
self::P_CURRENCY => 'RUB', |
197
|
|
|
'image' => 'design/images/payments/bank_internet/handy_bank.png', |
198
|
|
|
'button' => true, |
199
|
|
|
], |
200
|
|
|
PAYMENT_METHOD_BANK_INTERNET_RUSSKIY_STANDART => [ |
201
|
|
|
self::P_CURRENCY => 'RUB', |
202
|
|
|
'image' => 'design/images/payments/bank_internet/russkiy_standart.gif', |
203
|
|
|
], |
204
|
|
|
PAYMENT_METHOD_BANK_INTERNET_VTB24 => [ |
205
|
|
|
self::P_CURRENCY => 'RUB', |
206
|
|
|
'image' => 'design/images/payments/bank_internet/vtb24.gif', |
207
|
|
|
], |
208
|
|
|
PAYMENT_METHOD_BANK_INTERNET_OCEAN_BANK => [ |
209
|
|
|
self::P_CURRENCY => 'RUB', |
210
|
|
|
'image' => 'design/images/payments/bank_internet/ocean_bank.gif', |
211
|
|
|
], |
212
|
|
|
PAYMENT_METHOD_BANK_INTERNET_007 => [ |
213
|
|
|
self::P_CURRENCY => 'RUB', |
214
|
|
|
], |
215
|
|
|
PAYMENT_METHOD_BANK_INTERNET_008 => [ |
216
|
|
|
self::P_CURRENCY => 'RUB', |
217
|
|
|
], |
218
|
|
|
PAYMENT_METHOD_BANK_INTERNET_009 => [ |
219
|
|
|
self::P_CURRENCY => 'RUB', |
220
|
|
|
], |
221
|
|
|
PAYMENT_METHOD_BANK_INTERNET_010 => [ |
222
|
|
|
self::P_CURRENCY => 'RUB', |
223
|
|
|
], |
224
|
|
|
PAYMENT_METHOD_BANK_INTERNET_011 => [ |
225
|
|
|
self::P_CURRENCY => 'RUB', |
226
|
|
|
], |
227
|
|
|
PAYMENT_METHOD_BANK_INTERNET_012 => [ |
228
|
|
|
self::P_CURRENCY => 'RUB', |
229
|
|
|
], |
230
|
|
|
PAYMENT_METHOD_BANK_INTERNET_013 => [ |
231
|
|
|
self::P_CURRENCY => 'RUB', |
232
|
|
|
], |
233
|
|
|
PAYMENT_METHOD_BANK_INTERNET_014 => [ |
234
|
|
|
self::P_CURRENCY => 'RUB', |
235
|
|
|
], |
236
|
|
|
PAYMENT_METHOD_BANK_INTERNET_015 => [ |
237
|
|
|
self::P_CURRENCY => 'RUB', |
238
|
|
|
], |
239
|
|
|
PAYMENT_METHOD_BANK_INTERNET_016 => [ |
240
|
|
|
self::P_CURRENCY => 'RUB', |
241
|
|
|
], |
242
|
|
|
PAYMENT_METHOD_BANK_INTERNET_017 => [ |
243
|
|
|
self::P_CURRENCY => 'RUB', |
244
|
|
|
], |
245
|
|
|
PAYMENT_METHOD_BANK_INTERNET_018 => [ |
246
|
|
|
self::P_CURRENCY => 'RUB', |
247
|
|
|
], |
248
|
|
|
PAYMENT_METHOD_BANK_INTERNET_019 => [ |
249
|
|
|
self::P_CURRENCY => 'RUB', |
250
|
|
|
], |
251
|
|
|
PAYMENT_METHOD_BANK_INTERNET_020 => [ |
252
|
|
|
self::P_CURRENCY => 'RUB', |
253
|
|
|
], |
254
|
|
|
PAYMENT_METHOD_BANK_INTERNET_021 => [ |
255
|
|
|
self::P_CURRENCY => 'RUB', |
256
|
|
|
], |
257
|
|
|
], |
258
|
|
|
|
259
|
|
|
PAYMENT_METHOD_BANK_TRANSFER => [], |
260
|
|
|
|
261
|
|
|
PAYMENT_METHOD_TERMINAL => [ |
262
|
|
|
PAYMENT_METHOD_TERMINAL_UKRAINE => [ |
263
|
|
|
self::P_CURRENCY => 'UAH', |
264
|
|
|
'image' => 'design/images/payments/terminal/ukraine.png', |
265
|
|
|
'button' => true, |
266
|
|
|
'name' => true, |
267
|
|
|
], |
268
|
|
|
PAYMENT_METHOD_TERMINAL_IBOX => [ |
269
|
|
|
self::P_CURRENCY => 'UAH', |
270
|
|
|
'image' => 'design/images/payments/terminal/ibox.png', |
271
|
|
|
'button' => true, |
272
|
|
|
], |
273
|
|
|
PAYMENT_METHOD_TERMINAL_EASYPAY => [ |
274
|
|
|
self::P_CURRENCY => 'UAH', |
275
|
|
|
'image' => 'design/images/payments/terminal/easypay.png', |
276
|
|
|
'button' => true, |
277
|
|
|
], |
278
|
|
|
PAYMENT_METHOD_TERMINAL_RUSSIA => [ |
279
|
|
|
self::P_CURRENCY => 'RUB', |
280
|
|
|
'image' => 'design/images/payments/terminal/russia.png', |
281
|
|
|
'button' => true, |
282
|
|
|
'name' => true, |
283
|
|
|
], |
284
|
|
|
PAYMENT_METHOD_TERMINAL_QIWI => [ |
285
|
|
|
self::P_CURRENCY => 'RUB', |
286
|
|
|
'image' => 'design/images/payments/terminal/qiwi.png', |
287
|
|
|
'button' => true, |
288
|
|
|
], |
289
|
|
|
PAYMENT_METHOD_TERMINAL_ELECSNET => [ |
290
|
|
|
self::P_CURRENCY => 'RUB', |
291
|
|
|
'image' => 'design/images/payments/terminal/elecsnet.png', |
292
|
|
|
'button' => true, |
293
|
|
|
], |
294
|
|
|
PAYMENT_METHOD_TERMINAL_TELEPAY => [ |
295
|
|
|
self::P_CURRENCY => 'RUB', |
296
|
|
|
'image' => 'design/images/payments/terminal/telepay.png', |
297
|
|
|
'button' => true, |
298
|
|
|
], |
299
|
|
|
PAYMENT_METHOD_TERMINAL_ELEMENT => [ |
300
|
|
|
self::P_CURRENCY => 'RUB', |
301
|
|
|
'image' => 'design/images/payments/terminal/element.gif', |
302
|
|
|
], |
303
|
|
|
PAYMENT_METHOD_TERMINAL_KASSIRANET => [ |
304
|
|
|
self::P_CURRENCY => 'RUB', |
305
|
|
|
'image' => 'design/images/payments/terminal/kassira_net.gif', |
306
|
|
|
'button' => true, |
307
|
|
|
], |
308
|
|
|
], |
309
|
|
|
|
310
|
|
|
PAYMENT_METHOD_OTHER => [ |
311
|
|
|
PAYMENT_METHOD_OTHER_EVROSET => [ |
312
|
|
|
self::P_CURRENCY => 'RUB', |
313
|
|
|
'image' => 'design/images/payments/other/evroset.gif', |
314
|
|
|
], |
315
|
|
|
PAYMENT_METHOD_OTHER_SVYAZNOY => [ |
316
|
|
|
self::P_CURRENCY => 'RUB', |
317
|
|
|
'image' => 'design/images/payments/other/svyaznoy.gif', |
318
|
|
|
], |
319
|
|
|
PAYMENT_METHOD_OTHER_ROBOKASSA_MOBILE => [ |
320
|
|
|
self::P_CURRENCY => 'RUB', |
321
|
|
|
'image' => 'design/images/payments/other/robokassa_mobile.gif', |
322
|
|
|
'name' => true, |
323
|
|
|
], |
324
|
|
|
], |
325
|
|
|
|
326
|
|
|
PAYMENT_METHOD_GENERIC => [], |
327
|
|
|
]; |
328
|
|
|
|
329
|
|
|
// /** |
330
|
|
|
// * Ordered list of payment types |
331
|
|
|
// * |
332
|
|
|
// * @var int[] $paymentTypes |
333
|
|
|
// */ |
334
|
|
|
// protected static $paymentTypes = [ |
335
|
|
|
// PAYMENT_METHOD_BANK_CARD => PAYMENT_METHOD_BANK_CARD, |
336
|
|
|
// PAYMENT_METHOD_EMONEY => PAYMENT_METHOD_EMONEY, |
337
|
|
|
// PAYMENT_METHOD_MOBILE => PAYMENT_METHOD_MOBILE, |
338
|
|
|
// PAYMENT_METHOD_BANK_INTERNET => PAYMENT_METHOD_BANK_INTERNET, |
339
|
|
|
// PAYMENT_METHOD_BANK_TRANSFER => PAYMENT_METHOD_BANK_TRANSFER, |
340
|
|
|
// PAYMENT_METHOD_TERMINAL => PAYMENT_METHOD_TERMINAL, |
341
|
|
|
// PAYMENT_METHOD_OTHER => PAYMENT_METHOD_OTHER, |
342
|
|
|
// PAYMENT_METHOD_GENERIC => PAYMENT_METHOD_GENERIC, |
343
|
|
|
// ]; |
344
|
|
|
|
345
|
|
|
protected static $methodsActive = null; |
346
|
|
|
|
347
|
|
|
/** |
348
|
|
|
* Add payment method to repository |
349
|
|
|
* |
350
|
|
|
* @param int $type Provider type |
351
|
|
|
* @param int $id Provider ID |
352
|
|
|
* @param array $data Info about method [ |
353
|
|
|
* 'currency' => (str)currencyId3Letters, |
354
|
|
|
* 'image' => (str)$pathToImage, |
355
|
|
|
* 'name' => (bool)$showName, |
356
|
|
|
* 'button' => (bool)$showButton, |
357
|
|
|
* ] |
358
|
|
|
*/ |
359
|
|
|
public static function addPaymentProvider($type, $id, array $data) { |
360
|
|
|
PaymentMethods::$payment_methods[$type][$id] = $data; |
361
|
|
|
} |
362
|
|
|
|
363
|
|
|
/** |
364
|
|
|
* @return array |
365
|
|
|
*/ |
366
|
|
|
public static function renderPaymentMethodList() { |
367
|
|
|
// Доступные платежные методы |
368
|
|
|
$paymentMethodList = []; |
369
|
|
|
|
370
|
|
|
foreach (PaymentMethods::$payment_methods as $payment_type_id => $payment_methods_of_type) { |
371
|
|
|
if (empty($payment_methods_of_type)) { |
372
|
|
|
continue; |
373
|
|
|
} |
374
|
|
|
|
375
|
|
|
foreach ($payment_methods_of_type as $payment_method_id => $methodDetails) { |
376
|
|
|
if (!self::getActiveMethods()->getModuleCount($payment_method_id)) { |
377
|
|
|
continue; |
378
|
|
|
} |
379
|
|
|
|
380
|
|
|
$paymentMethodList[$payment_type_id]['.']['method'][$payment_method_id] = [ |
381
|
|
|
'ID' => $payment_method_id, |
382
|
|
|
'NAME' => SN::$lang['pay_methods'][$payment_method_id], |
383
|
|
|
'IMAGE' => !empty($methodDetails['image']) ? $methodDetails['image'] : '', |
384
|
|
|
'NAME_FORCE' => !empty($methodDetails['name']), |
385
|
|
|
'BUTTON' => !empty($methodDetails['button']), |
386
|
|
|
]; |
387
|
|
|
foreach (self::getActiveMethods()->getModulesOnMethod($payment_method_id) as $payment_module_name => $payment_module) { |
388
|
|
|
$paymentMethodList[$payment_type_id]['.']['method'][$payment_method_id]['.']['module'][] = [ |
389
|
|
|
'MODULE' => $payment_module_name, |
390
|
|
|
]; |
391
|
|
|
} |
392
|
|
|
} |
393
|
|
|
|
394
|
|
|
if (!empty($paymentMethodList[$payment_type_id]['.'])) { |
395
|
|
|
$paymentMethodList[$payment_type_id] = array_merge( |
396
|
|
|
$paymentMethodList[$payment_type_id], |
397
|
|
|
[ |
398
|
|
|
'ID' => $payment_type_id, |
399
|
|
|
'NAME' => SN::$lang['pay_methods'][$payment_type_id], |
400
|
|
|
] |
401
|
|
|
); |
402
|
|
|
} |
403
|
|
|
} |
404
|
|
|
|
405
|
|
|
return $paymentMethodList; |
406
|
|
|
} |
407
|
|
|
|
408
|
|
|
/** |
409
|
|
|
* @param $paymentMethodId |
410
|
|
|
* @param $player_currency |
411
|
|
|
* @param $request |
412
|
|
|
* |
413
|
|
|
* @return array |
414
|
|
|
*/ |
415
|
|
|
public static function renderModulesForMethod($paymentMethodId, $player_currency, $request) { |
416
|
|
|
$block = []; |
417
|
|
|
foreach (self::getActiveMethods()->getModulesOnMethod($paymentMethodId) as $module_name => $module) { |
418
|
|
|
/** |
419
|
|
|
* @var sn_module_payment $module |
420
|
|
|
*/ |
421
|
|
|
$aPrice = $module->getPrice($paymentMethodId, $player_currency, $request['metamatter']); |
422
|
|
|
|
423
|
|
|
$row = [ |
424
|
|
|
'ID' => $module_name, |
425
|
|
|
'NAME' => SN::$lang["module_{$module_name}_name"], |
426
|
|
|
'DESCRIPTION' => SN::$lang["module_{$module_name}_description"], |
427
|
|
|
]; |
428
|
|
|
|
429
|
|
|
if (is_array($aPrice) && !empty($aPrice)) { |
430
|
|
|
$row['COST'] = $aPrice[$module::FIELD_SUM]; |
431
|
|
|
$row['CURRENCY'] = $aPrice[$module::FIELD_CURRENCY]; |
432
|
|
|
} |
433
|
|
|
|
434
|
|
|
$block[] = $row; |
435
|
|
|
} |
436
|
|
|
|
437
|
|
|
return $block; |
438
|
|
|
} |
439
|
|
|
|
440
|
|
|
/** |
441
|
|
|
* @param $moduleName |
442
|
|
|
* @param $paymentMethodId |
443
|
|
|
* |
444
|
|
|
* @return string |
445
|
|
|
*/ |
446
|
|
|
public static function getCurrencyFromMethod($moduleName, $paymentMethodId) { |
447
|
|
|
$result = ''; |
448
|
|
|
|
449
|
|
|
/** |
450
|
|
|
* @var sn_module_payment[] $modules |
451
|
|
|
*/ |
452
|
|
|
$modules = self::getActiveMethods()->getModulesOnMethod($paymentMethodId); |
453
|
|
|
if ($moduleName |
454
|
|
|
&& $paymentMethodId |
455
|
|
|
&& is_object($modules[$moduleName]) |
456
|
|
|
&& $modules[$moduleName] instanceof sn_module_payment |
457
|
|
|
) { |
458
|
|
|
$result = $modules[$moduleName]->getMethodCurrency($paymentMethodId); |
459
|
|
|
} |
460
|
|
|
|
461
|
|
|
return $result; |
462
|
|
|
} |
463
|
|
|
|
464
|
|
|
|
465
|
|
|
/** |
466
|
|
|
* @param $paymentMethodId |
467
|
|
|
* |
468
|
|
|
* @return string |
469
|
|
|
* TODO REDO |
470
|
|
|
*/ |
471
|
|
|
public static function getDefaultCurrency($paymentMethodId) { |
472
|
|
|
$result = ''; |
473
|
|
|
|
474
|
|
|
foreach (self::$payment_methods as $paymentTypeId => $methodList) { |
475
|
|
|
foreach ($methodList as $methodId => $details) { |
476
|
|
|
if ($methodId == $paymentMethodId) { |
477
|
|
|
$result = !empty($details[self::P_CURRENCY]) ? $details[self::P_CURRENCY] : ''; |
478
|
|
|
} |
479
|
|
|
} |
480
|
|
|
} |
481
|
|
|
|
482
|
|
|
return $result; |
483
|
|
|
} |
484
|
|
|
|
485
|
|
|
|
486
|
|
|
public static function getActiveMethods() { |
487
|
|
|
if (empty(self::$methodsActive)) { |
488
|
|
|
self::$methodsActive = new PaymentsMethodsActive(); |
489
|
|
|
} |
490
|
|
|
|
491
|
|
|
return self::$methodsActive; |
492
|
|
|
} |
493
|
|
|
|
494
|
|
|
} |
495
|
|
|
|