forked from payuru/php-payu4
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathexample.php
More file actions
84 lines (81 loc) · 2.98 KB
/
example.php
File metadata and controls
84 lines (81 loc) · 2.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
/**
* Примеры интеграции API платёжной системы Ypmn
* Документация:
* https://ypmn.ru/ru/documentation/
* Начните знакомство с кодом с текущего файла
* и класса PaymentInterface
*/
use Ypmn\PaymentException;
use Ypmn\Std;
if(!empty($_GET['function'])){
try {
switch ($_GET['function']) {
case 'start':
include './src/Examples/'.$_GET['function'] . '.php';
break;
case 'authorize':
case 'capture':
case 'token_payment':
case 'status':
case 'refund':
case 'payout':
case 'simpleGetPaymentLink':
case 'getPaymentLink':
case 'getPaymentLinkMarketplace':
case 'getPaymentLinkMarketplaceWithReceipts':
case 'getToken':
case 'paymentByToken':
case 'paymentCapture':
case 'paymentGetStatus':
case 'payoutCreate':
case 'payoutGetBalance':
case 'paymentWebhook':
case 'paymentRefund':
case 'paymentRefundMarketplace':
case 'getSession':
case 'oneTimeTokenPayment':
case 'returnPage':
case 'secureFields':
case 'getReportGeneral':
case 'getReportChart':
case 'getReportOrder':
case 'getReportOrderDetails':
case 'getFasterPayment':
case 'getPaymentLinkWithReceipt':
case 'getBindingFasterPayment':
case 'paymentByFasterBinding':
case 'paymentByBindingPays':
case 'getBindingPays':
case 'qstCreateOrg':
case 'qstCreateIp':
case 'qstStatus':
case 'qstPrint':
case 'SOMGetPaymentLink':
case 'qstList':
case 'webhookProcessing':
case 'payQrCode':
require './src/Examples/start.php';
@include './src/Examples/'.$_GET['function'] . '__prepend.php';
require './src/Examples/'.$_GET['function'] . '.php';
break;
default:
throw new PaymentException('Метод не поддерживается');
}
} catch (PaymentException $e) {
//TODO: добавить проверки и выброс исключений
//TODO: добавить в исключения ссылки на документацию
echo $e->getHtmlMessage();
}
} else {
echo Std::alert([
'type' => 'success',
'text' => '
Добро пожаловать на тестовый сервер с примерами для интеграции
с помощью SDK от <a href="http://ypmn.ru/?from=SDK_PHP">НКО «Твои Платежи»</a>.
<br>
<br>
Выберите пример из меню.
'
]);
}