-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Chore: Update deactivate authorization
- Loading branch information
1 parent
6fd60b2
commit c04ba17
Showing
13 changed files
with
253 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
const sh = `#!/bin/sh | ||
url="https://api.paystack.co/customer/authorization/deactivate" | ||
authorization="Authorization: Bearer YOUR_SECRET_KEY" | ||
content_type="Content-Type: application/json" | ||
data='{ | ||
"authorization_code": "AUTH_xxxIjkZVj5" | ||
}' | ||
curl "$url" -H "$authorization" -H "$content_type" -d "$data" -X POST` | ||
|
||
const js = `const https = require('https') | ||
const params = JSON.stringify({ | ||
"authorization_code": "AUTH_xxxIjkZVj5" | ||
}) | ||
const options = { | ||
hostname: 'api.paystack.co', | ||
port: 443, | ||
path: '/customer/authorization/deactivate', | ||
method: 'POST', | ||
headers: { | ||
Authorization: 'Bearer SECRET_KEY', | ||
'Content-Type': 'application/json' | ||
} | ||
} | ||
const req = https.request(options, res => { | ||
let data = '' | ||
res.on('data', (chunk) => { | ||
data += chunk | ||
}); | ||
res.on('end', () => { | ||
console.log(JSON.parse(data)) | ||
}) | ||
}).on('error', error => { | ||
console.error(error) | ||
}) | ||
req.write(params) | ||
req.end()` | ||
|
||
const php = `<?php | ||
$url = "https://api.paystack.co/customer/authorization/deactivate"; | ||
$fields = [ | ||
"authorization_code" => "AUTH_xxxIjkZVj5" | ||
]; | ||
$fields_string = http_build_query($fields); | ||
//open connection | ||
$ch = curl_init(); | ||
//set the url, number of POST vars, POST data | ||
curl_setopt($ch,CURLOPT_URL, $url); | ||
curl_setopt($ch,CURLOPT_POST, true); | ||
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string); | ||
curl_setopt($ch, CURLOPT_HTTPHEADER, array( | ||
"Authorization: Bearer SECRET_KEY", | ||
"Cache-Control: no-cache", | ||
)); | ||
//So that curl_exec returns the contents of the cURL; rather than echoing it | ||
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true); | ||
//execute post | ||
$result = curl_exec($ch); | ||
echo $result; | ||
?>` | ||
|
||
export {sh, js, php} |
File renamed without changes.
79 changes: 79 additions & 0 deletions
79
dist/doc/payments/direct-debit/deactivate-authorization.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
const sh = `#!/bin/sh | ||
curl https://api.paystack.co/customer/authorization/deactivate | ||
-H "Authorization: Bearer YOUR_SECRET_KEY" | ||
-H "Content-Type: application/json" | ||
-d '{ | ||
"authorization_code": "AUTH_xxxIjkZVj5" | ||
}' | ||
-X POST` | ||
|
||
const js = `const https = require('https') | ||
const params = JSON.stringify({ | ||
"authorization_code": "AUTH_xxxIjkZVj5" | ||
}) | ||
const options = { | ||
hostname: 'api.paystack.co', | ||
port: 443, | ||
path: '/customer/authorization/deactivate', | ||
method: 'POST', | ||
headers: { | ||
Authorization: 'Bearer SECRET_KEY', | ||
'Content-Type': 'application/json' | ||
} | ||
} | ||
const req = https.request(options, res => { | ||
let data = '' | ||
res.on('data', (chunk) => { | ||
data += chunk | ||
}); | ||
res.on('end', () => { | ||
console.log(JSON.parse(data)) | ||
}) | ||
}).on('error', error => { | ||
console.error(error) | ||
}) | ||
req.write(params) | ||
req.end()` | ||
|
||
const php = `<?php | ||
$url = "https://api.paystack.co/customer/authorization/deactivate"; | ||
$fields = [ | ||
'authorization_code' => "AUTH_xxxIjkZVj5" | ||
]; | ||
$fields_string = http_build_query($fields); | ||
//open connection | ||
$ch = curl_init(); | ||
//set the url, number of POST vars, POST data | ||
curl_setopt($ch,CURLOPT_URL, $url); | ||
curl_setopt($ch,CURLOPT_POST, true); | ||
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string); | ||
curl_setopt($ch, CURLOPT_HTTPHEADER, array( | ||
"Authorization: Bearer SECRET_KEY", | ||
"Cache-Control: no-cache", | ||
)); | ||
//So that curl_exec returns the contents of the cURL; rather than echoing it | ||
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true); | ||
//execute post | ||
$result = curl_exec($ch); | ||
echo $result; | ||
?>` | ||
|
||
const json = `{ | ||
"status": true, | ||
"message": "Authorization has been deactivated" | ||
} | ||
` | ||
|
||
export {sh, js, php, json} |
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
...stomers/deactivate_authorization/index.js → ...stomers/deactivate-authorization/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...tomers/deactivate_authorization/index.php → ...tomers/deactivate-authorization/index.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...stomers/deactivate_authorization/index.sh → ...stomers/deactivate-authorization/index.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
#!/bin/sh | ||
url="https://api.paystack.co/customer/deactivate_authorization" | ||
url="https://api.paystack.co/customer/authorization/deactivate" | ||
authorization="Authorization: Bearer YOUR_SECRET_KEY" | ||
content_type="Content-Type: application/json" | ||
data='{ | ||
"authorization_code": "AUTH_72btv547" | ||
"authorization_code": "AUTH_xxxIjkZVj5" | ||
}' | ||
|
||
curl "$url" -H "$authorization" -H "$content_type" -d "$data" -X POST |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"200": { | ||
"description": "200 Ok", | ||
"data": { | ||
"status": true, | ||
"message": "Authorization has been deactivated" | ||
} | ||
}, | ||
"404": { | ||
"description": "404 Not Found", | ||
"data": { | ||
"status": false, | ||
"message": "Authorization code not found." | ||
} | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
src/doc/payments/direct-debit/deactivate-authorization/config.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
languages: | ||
- sh | ||
- js | ||
- php | ||
- json |
33 changes: 33 additions & 0 deletions
33
src/doc/payments/direct-debit/deactivate-authorization/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
const https = require('https') | ||
|
||
const params = JSON.stringify({ | ||
"authorization_code": "AUTH_xxxIjkZVj5" | ||
}) | ||
|
||
const options = { | ||
hostname: 'api.paystack.co', | ||
port: 443, | ||
path: '/customer/authorization/deactivate', | ||
method: 'POST', | ||
headers: { | ||
Authorization: 'Bearer SECRET_KEY', | ||
'Content-Type': 'application/json' | ||
} | ||
} | ||
|
||
const req = https.request(options, res => { | ||
let data = '' | ||
|
||
res.on('data', (chunk) => { | ||
data += chunk | ||
}); | ||
|
||
res.on('end', () => { | ||
console.log(JSON.parse(data)) | ||
}) | ||
}).on('error', error => { | ||
console.error(error) | ||
}) | ||
|
||
req.write(params) | ||
req.end() |
4 changes: 4 additions & 0 deletions
4
src/doc/payments/direct-debit/deactivate-authorization/index.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"status": true, | ||
"message": "Authorization has been deactivated" | ||
} |
28 changes: 28 additions & 0 deletions
28
src/doc/payments/direct-debit/deactivate-authorization/index.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
$url = "https://api.paystack.co/customer/authorization/deactivate"; | ||
|
||
$fields = [ | ||
'authorization_code' => "AUTH_xxxIjkZVj5" | ||
]; | ||
|
||
$fields_string = http_build_query($fields); | ||
|
||
//open connection | ||
$ch = curl_init(); | ||
|
||
//set the url, number of POST vars, POST data | ||
curl_setopt($ch,CURLOPT_URL, $url); | ||
curl_setopt($ch,CURLOPT_POST, true); | ||
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string); | ||
curl_setopt($ch, CURLOPT_HTTPHEADER, array( | ||
"Authorization: Bearer SECRET_KEY", | ||
"Cache-Control: no-cache", | ||
)); | ||
|
||
//So that curl_exec returns the contents of the cURL; rather than echoing it | ||
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true); | ||
|
||
//execute post | ||
$result = curl_exec($ch); | ||
echo $result; | ||
?> |
8 changes: 8 additions & 0 deletions
8
src/doc/payments/direct-debit/deactivate-authorization/index.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/sh | ||
curl https://api.paystack.co/customer/authorization/deactivate | ||
-H "Authorization: Bearer YOUR_SECRET_KEY" | ||
-H "Content-Type: application/json" | ||
-d '{ | ||
"authorization_code": "AUTH_xxxIjkZVj5" | ||
}' | ||
-X POST |