-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathToolsDemo.php
81 lines (71 loc) · 3.4 KB
/
ToolsDemo.php
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
<?php
require __DIR__ . '/vendor/autoload.php';
error_reporting(E_ALL);
ini_set('display_errors', 1);
# ================================================ Neshan SERVICES ====================================================
# required classes
use Pod\Tools\Tools;
use Pod\Base\Service\BaseInfo;
use Pod\Base\Service\Exception\ValidationException;
use Pod\Base\Service\Exception\PodException;
#در صورتی که میخواهید از ApiToken برای استفاده از سرویس های نشان استفاده کنید مقدارش را در این قسمت وارد کنید.
const API_TOKEN = '{PUT API TOKEN}';
# در صورتی که میخواهید از AccessToken برای استفاده از سرویس های نشان استفاده کنید در اینجا میتوانید اکسس توکن را وارد کنید
#pay attention that access token will be expired each 15 minutes refresh this token with SSOService->refreshAccessToken
const ACCESS_TOKEN = '{PUT ACCESS TOKEN}';
# default tokenIssuer is 1 if you want to change it to zero set here
const TOKEN_ISSUER = 1; # 0 or 1 default is 1
# instantiates a Tools
$Tools = new Tools();
# ================================================ pay Bill ===============================================
function payBill()
{
echo '======================================== pay Bill =================================' .PHP_EOL;
global $Tools;
$param =
[
## ======================= *Required Parameters ==========================
'token' => '{Put Api_Token or Access_Token}', # Api_Token | AccessToken
'billId' => "{Put Bill Id}",
'paymentId' => "{Pur Payment Id}",
## ======================== Optional Parameters ==========================
'tokenIssuer' => TOKEN_ISSUER, # default is 1
'scVoucherHash' => ['{Put Service Call Voucher Hashes}'],
'scApiKey' => '{Put service call Api Key}',
];
try {
$result = $Tools->payBill($param);
print_r($result);
} catch (ValidationException $e) {
print_r($e->getResult());
print_r($e->getErrorsAsArray());
} catch (PodException $e) {
print_r($e->getResult());
}
}
# ============================================ payed Bill List ===========================================
function payedBillList()
{
echo '==================================== payed Bill List =================================' .PHP_EOL;
global $Tools;
$param =
[
## ========================== *Required Parameters ==========================
"token" => '{Put Api_Token | AccessToken }', # Api_Token | AccessToken
"lat" => '{Put Latitude}',
"lng" => '{Put Longitude}',
## ======================== Optional Parameters =============================
# "tokenIssuer" => TOKEN_ISSUER, # default is 1
'scVoucherHash' => ['{Put Service Call Voucher Hashes}'],
'scApiKey' => '{Put service call Api Key}',
];
try {
$result = $Tools->reverseGeo($param);
print_r($result);
} catch (ValidationException $e) {
print_r($e->getResult());
print_r($e->getErrorsAsArray());
} catch (PodException $e) {
print_r($e->getResult());
}
}