-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExamples.php
More file actions
114 lines (95 loc) · 3.21 KB
/
Copy pathExamples.php
File metadata and controls
114 lines (95 loc) · 3.21 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<?php
require(__DIR__ . '/package/src/bootstrap.php');
use AddPay\Api;
addpay([
'client_id' => '',
'client_secret' => '',
'client_live' => false
]);
// --------------------------
// Get a List of Transaction
// --------------------------
$transactions = (Api::get('/transactions')->send())->body;
// --------------------------
// Get a Single Transaction
// --------------------------
$transaction = (Api::get('/transactions/<TRANSACTION_ID>')->send())->body;
// --------------------------
// Create a Transaction
// --------------------------
$transaction = (Api::post('/transactions')->body([
'reference' => 'Sample',
'description' => 'Sample Description',
'amount' => [
'value' => 1.50,
'currency_code' => 'ZAR'
]
])->send())->body;
// --------------------------
// Update a Transaction
// --------------------------
$transaction = (Api::put('/transactions/<TRANSACTION_ID>')->body([
'description' => 'Updated Sample Description',
])->send())->body;
// --------------------------
// Create a Contract
// --------------------------
$contract = (Api::post('/contracts/')->body([
'reference' => 'SampleContract',
'interval' => 'MONTH',
'action_day' => 31,
])->send())->body;
// --------------------------
// Update a Contract
// --------------------------
$contract = (Api::put('/contracts/<CONTRACT_ID>')->body([
'reference' => 'Updated'
])->send())->body;
// --------------------------
// Get a Contract
// --------------------------
$contract = (Api::get('/contracts/<CONTRACT_ID>')->send())->body;
// --------------------------
// Get a List of Contracts
// --------------------------
$contract = (Api::get('/contracts')->send())->body;
// --------------------------
// Create a Customer
// --------------------------
$customer = (Api::post('/customers')->body([
'firstname' => 'John',
'lastname' => 'Doe',
'email' => 'john@example.org',
'mobile' => '+27800123123'
])->send())->body;
// --------------------------
// Update a Customer
// --------------------------
$customer = (Api::put('/customers/<CUSTOMER_ID>')->body([
'firstname' => 'Peter',
'mobile' => '+27800123123'
])->send())->body;
// --------------------------
// Get a Customer
// --------------------------
$customer = (Api::get('/customers/<CUSTOMER_ID>')->send())->body;
// --------------------------
// Get a List of Customers
// --------------------------
$customer = (Api::get('/customers/<CUSTOMER_ID>')->send())->body;
// -------------------------------------
// Associate a Customer to a Transaction
// -------------------------------------
Api::put('/transactions/<TRANSACTION_ID>/customers/<CUSTOMER_ID>');
// -------------------------------------
// Dissociate a Customer from a Transaction
// -------------------------------------
Api::delete('/transactions/<TRANSACTION_ID>/customers/<CUSTOMER_ID>');
// -------------------------------------
// Associate a Transaction to a Contract
// -------------------------------------
Api::put('/contracts/<CONTRACT_ID>/transactions/<TRANSACTION_ID>');
// -------------------------------------
// Dissociate a Transaction from a Contract
// -------------------------------------
Api::delete('/contracts/<CONTRACT_ID>/transactions/<TRANSACTION_ID>');