Skip to content

Commit 6d2e0c9

Browse files
committed
build changes
1 parent 20b3fc1 commit 6d2e0c9

File tree

24 files changed

+1199
-0
lines changed

24 files changed

+1199
-0
lines changed
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+
}
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
const sh = `#!/bin/sh
2+
url="https://api.paystack.co/virtual_terminal"
3+
authorization="Authorization: Bearer SECRET_KEY"
4+
content_type="Content-Type: application/json"
5+
data='{
6+
"name": "Sample Terminal",
7+
"destinations": [
8+
{
9+
"target": "+27639022319",
10+
"name": "Phone Destination"
11+
}
12+
]
13+
}'
14+
15+
curl "$url" \
16+
-H "$authorization" \
17+
-H "$content_type" \
18+
-X POST \
19+
-d "$data"
20+
21+
`
22+
23+
const js = `const https = require("https");
24+
25+
const params = JSON.stringify({
26+
name: "Sample Terminal",
27+
destinations: [
28+
{
29+
target: "+27639022319",
30+
name: "Phone Destination",
31+
},
32+
],
33+
});
34+
35+
const options = {
36+
hostname: "api.paystack.co",
37+
port: 443,
38+
path: "/virtual_terminal",
39+
method: "POST",
40+
headers: {
41+
Authorization: "Bearer SECRET_KEY",
42+
"Content-Type": "application/json",
43+
},
44+
};
45+
46+
const req = https.request(options, (res) => {
47+
let data = "";
48+
49+
res.on("data", (chunk) => {
50+
data += chunk;
51+
});
52+
53+
res.on("end", () => {
54+
console.log(JSON.parse(data));
55+
});
56+
});
57+
58+
req.on("error", (error) => {
59+
console.error(error);
60+
});
61+
62+
req.write(params);
63+
req.end();
64+
`
65+
66+
const php = `<?php
67+
$curl = curl_init();
68+
69+
$data = array(
70+
"name" => "Sample Terminal",
71+
"destinations" => array(
72+
array(
73+
"target" => "+27639022319",
74+
"name" => "Phone Destination"
75+
)
76+
)
77+
);
78+
79+
curl_setopt_array($curl, array(
80+
CURLOPT_URL => "https://api.paystack.co/virtual_terminal",
81+
CURLOPT_RETURNTRANSFER => true,
82+
CURLOPT_CUSTOMREQUEST => "POST",
83+
CURLOPT_POSTFIELDS => json_encode($data),
84+
CURLOPT_HTTPHEADER => array(
85+
"Authorization: Bearer SECRET_KEY",
86+
"Content-Type: application/json",
87+
"Cache-Control: no-cache"
88+
),
89+
));
90+
91+
$response = curl_exec($curl);
92+
$err = curl_error($curl);
93+
curl_close($curl);
94+
95+
if ($err) {
96+
echo "cURL Error #:" . $err;
97+
} else {
98+
echo $response;
99+
}
100+
?>
101+
`
102+
103+
export {sh, js, php}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"200": {
3+
"status": true,
4+
"message": "Virtual Terminal created",
5+
"data": {
6+
"id": 27691,
7+
"name": "Sample Terminal",
8+
"integration": 530700,
9+
"domain": "test",
10+
"code": "VT_LJK5892Z",
11+
"paymentMethods": [],
12+
"active": true,
13+
"metadata": null,
14+
"destinations": [
15+
{
16+
"target": "+27639022319",
17+
"type": "whatsapp",
18+
"name": "Phone Destination"
19+
}
20+
],
21+
"currency": "ZAR"
22+
}
23+
}
24+
25+
}

0 commit comments

Comments
 (0)