forked from tpay-com/tpay-php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MassPayment.php
105 lines (77 loc) · 1.97 KB
/
MassPayment.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?php
/*
* Created by tpay.com
*/
namespace tpayLibs\examples;
use tpayLibs\src\_class_tpay\MassPayments;
use tpayLibs\src\_class_tpay\Utilities\TException;
include_once 'config.php';
include_once 'loader.php';
class MassPaymentExample extends MassPayments
{
const TRID = 'TR-C4Y-HJVWYX';
public function __construct()
{
$this->merchantSecret = 'demo';
$this->merchantId = 1010;
$this->trApiKey = '75f86137a6635df826e3efe2e66f7c9a946fdde1';
$this->trApiPass = 'p@$$w0rd#@!';
parent::__construct();
}
public function listMassPayment()
{
/**
* Masspayment list packs
*/
$packId = false;
$from = '2016-01-01';
$to = '2017-01-01';
try {
$result = $this->massPaymentPacks($packId, $from, $to);
print_r($result);
} catch (TException $e) {
var_dump($e);
}
}
public function transferMassPayment()
{
/**
* Masspayment transfer
*/
$packId = '123123';
$transactionId = static::TRID;
try {
$result = $this->massPaymentTransfers($packId, $transactionId);
print_r($result);
} catch (TException $e) {
var_dump($e);
}
}
public function authorizeMassPayment()
{
/**
* Masspayment Authorizee
*/
$packId = '123123123';
try {
$result = $this->massPaymentAuthorize($packId);
print_r($result);
} catch (TException $e) {
var_dump($e);
}
}
public function createMassPayment()
{
/**
* Masspayment create
*/
$csv = file_get_contents('masspayment.csv');
try {
$result = $this->massPaymentCreate($csv);
print_r($result);
} catch (TException $e) {
var_dump($e);
}
}
}
(new MassPaymentExample())->listMassPayment();