Skip to content

Commit f3f7af5

Browse files
Merge pull request #93 from tolu-paystack/feat/add-virtual-terminal
Feat/add virtual terminal
2 parents 97db985 + 1711b62 commit f3f7af5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+2232
-90
lines changed

dist/api/customers/deactivate_authorization/requests.js

Lines changed: 0 additions & 74 deletions
This file was deleted.

dist/api/customers/deactivate_authorization/response.json

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
const sh = `#!/bin/sh
2+
url="https://api.paystack.co/virtual_terminal/:code/split_code"
3+
authorization="Authorization: Bearer SECRET_KEY"
4+
content_type="Content-Type: application/json"
5+
data='{
6+
"split_code": "SPL_98WF13Zu8w5"
7+
}'
8+
9+
curl "$url" -H "$authorization" -H "$content_type" -X PUT -d "$data"`
10+
11+
const js = `const https = require('https')
12+
13+
const params = JSON.stringify({
14+
"split_code": "SPL_98WF13Zu8w5"
15+
})
16+
17+
const options = {
18+
hostname: 'api.paystack.co',
19+
port: 443,
20+
path: '/virtual_terminal/:code/split_code',
21+
method: 'PUT',
22+
headers: {
23+
Authorization: 'Bearer SECRET_KEY',
24+
'Content-Type': 'application/json',
25+
}
26+
}
27+
28+
const req = https.request(options, res => {
29+
let data = ''
30+
31+
res.on('data', (chunk) => {
32+
data += chunk
33+
})
34+
35+
res.on('end', () => {
36+
console.log(JSON.parse(data))
37+
})
38+
})
39+
40+
req.on('error', error => {
41+
console.error(error)
42+
})
43+
44+
req.write(params)
45+
req.end()`
46+
47+
const php = `<?php
48+
$curl = curl_init();
49+
50+
$data = array(
51+
"split_code" => "SPL_98WF13Zu8w5"
52+
);
53+
54+
curl_setopt_array($curl, array(
55+
CURLOPT_URL => "https://api.paystack.co/virtual_terminal/:code/split",
56+
CURLOPT_RETURNTRANSFER => true,
57+
CURLOPT_CUSTOMREQUEST => "PUT",
58+
CURLOPT_POSTFIELDS => json_encode($data),
59+
CURLOPT_HTTPHEADER => array(
60+
"Authorization: Bearer SECRET_KEY",
61+
"Content-Type: application/json",
62+
"Cache-Control: no-cache"
63+
),
64+
));
65+
66+
$response = curl_exec($curl);
67+
$err = curl_error($curl);
68+
curl_close($curl);
69+
70+
if ($err) {
71+
echo "cURL Error #:" . $err;
72+
} else {
73+
echo $response;
74+
}
75+
?>`
76+
77+
export {sh, js, php}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"200": {
3+
"description": "200 Ok",
4+
"data": {
5+
"status": true,
6+
"message": "Split code assigned",
7+
"data": {
8+
"id": 3025782,
9+
"name": "Dynamic Split at 1729681745076",
10+
"type": "flat",
11+
"currency": "ZAR",
12+
"integration": 530700,
13+
"domain": "test",
14+
"split_code": "SPL_HBaFCbbiyI",
15+
"active": true,
16+
"bearer_type": "subaccount",
17+
"bearer_subaccount": 854043,
18+
"createdAt": "2024-10-23T11:09:05.000Z",
19+
"updatedAt": "2024-10-23T11:09:05.000Z",
20+
"is_dynamic": true,
21+
"subaccounts": [
22+
{
23+
"subaccount": {
24+
"id": 523210,
25+
"subaccount_code": "ACCT_r56edei4okmllle",
26+
"business_name": "ABC Ventures",
27+
"description": "ABC Ventures",
28+
"primary_contact_name": null,
29+
"primary_contact_email": null,
30+
"primary_contact_phone": null,
31+
"metadata": null,
32+
"settlement_bank": "African Bank Limited",
33+
"currency": "ZAR",
34+
"account_number": "00000000000"
35+
},
36+
"share": 1600
37+
},
38+
{
39+
"subaccount": {
40+
"id": 854043,
41+
"subaccount_code": "ACCT_n8m5vz2itt8y0f1",
42+
"business_name": "Best Logistics",
43+
"description": "Best Logistics",
44+
"primary_contact_name": null,
45+
"primary_contact_email": null,
46+
"primary_contact_phone": null,
47+
"metadata": null,
48+
"settlement_bank": "Capitec Bank Limited",
49+
"currency": "ZAR",
50+
"account_number": "1051366984"
51+
},
52+
"share": 98400
53+
}
54+
],
55+
"total_subaccounts": 2
56+
}
57+
}
58+
}
59+
}
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
const sh = `#!/bin/sh
2+
url="https://api.paystack.co/virtual_terminal/:code/destination/assign"
3+
authorization="Authorization: Bearer SECRET_KEY"
4+
content_type="Content-Type: application/json"
5+
data='{
6+
"destinations": [
7+
{
8+
"target": "+2341234567890",
9+
"name": "Another one"
10+
}
11+
]
12+
}'
13+
14+
curl "$url" -H "$authorization" -H "$content_type" -X POST -d "$data"`
15+
16+
const js = `const https = require('https')
17+
18+
const params = JSON.stringify({
19+
"destinations": [
20+
{
21+
"target": "+2341234567890",
22+
"name": "Another one"
23+
}
24+
]
25+
})
26+
27+
const options = {
28+
hostname: 'api.paystack.co',
29+
port: 443,
30+
path: '/virtual_terminal/:code/destination/assign',
31+
method: 'POST',
32+
headers: {
33+
Authorization: 'Bearer SECRET_KEY',
34+
'Content-Type': 'application/json',
35+
}
36+
}
37+
38+
const req = https.request(options, res => {
39+
let data = ''
40+
41+
res.on('data', (chunk) => {
42+
data += chunk
43+
})
44+
45+
res.on('end', () => {
46+
console.log(JSON.parse(data))
47+
})
48+
})
49+
50+
req.on('error', error => {
51+
console.error(error)
52+
})
53+
54+
req.write(params)
55+
req.end()`
56+
57+
const php = `<?php
58+
$curl = curl_init();
59+
60+
$data = array(
61+
"destination" => "example_destination"
62+
);
63+
64+
curl_setopt_array($curl, array(
65+
CURLOPT_URL => "https://api.paystack.co/virtual_terminal/:code/destination/assign",
66+
CURLOPT_RETURNTRANSFER => true,
67+
CURLOPT_CUSTOMREQUEST => "POST",
68+
CURLOPT_POSTFIELDS => json_encode($data),
69+
CURLOPT_HTTPHEADER => array(
70+
"Authorization: Bearer SECRET_KEY",
71+
"Content-Type: application/json",
72+
"Cache-Control: no-cache"
73+
),
74+
));
75+
76+
$response = curl_exec($curl);
77+
$err = curl_error($curl);
78+
curl_close($curl);
79+
80+
if ($err) {
81+
echo "cURL Error #:" . $err;
82+
} else {
83+
echo $response;
84+
}
85+
?>`
86+
87+
export {sh, js, php}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"200": {
3+
"description": "200 Ok",
4+
"data": {
5+
"status": true,
6+
"message": "Destinations assigned successfully",
7+
"data": [
8+
{
9+
"integration": 530700,
10+
"target": "2341234567890",
11+
"name": "Another one",
12+
"type": "whatsapp",
13+
"id": 27934,
14+
"createdAt": "2025-02-04T13:26:35.278Z",
15+
"updatedAt": "2025-02-04T13:26:35.278Z"
16+
}
17+
]
18+
}
19+
}
20+
}

0 commit comments

Comments
 (0)