Skip to content

Commit e92a8bf

Browse files
authored
created ControlPanel APIs (#29)
1 parent 0016171 commit e92a8bf

File tree

4 files changed

+63
-1
lines changed

4 files changed

+63
-1
lines changed

readme.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,15 @@ BulkCharge::pauseChargesBatch($bulkcharge, $params);
315315
BulkCharge::resumeChargesBatch($bulkcharge, $params);
316316
```
317317

318-
### Control Panel **TODO**
318+
### Control Panel
319+
```php
320+
use Myckhel\Paystack\Support\ControlPanel;
321+
322+
ControlPanel::fetchPaymentSessionTimeout($params);
323+
324+
ControlPanel::updatePaymentSessionTimeout($params);
325+
```
326+
319327
### Charge **TODO**
320328
### Disputes **TODO**
321329
### Refunds **TODO**
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
namespace Myckhel\Paystack\Http\Controllers;
4+
5+
use Myckhel\Paystack\Support\ControlPanel;
6+
7+
class ControlPanelController extends Controller
8+
{
9+
function __call($method, $args)
10+
{
11+
return $args
12+
? ControlPanel::$method($args[0], request()->all())
13+
: ControlPanel::$method(request()->all());
14+
}
15+
}

src/Support/ControlPanel.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
namespace Myckhel\Paystack\Support;
4+
5+
use Myckhel\Paystack\Traits\Request;
6+
7+
/**
8+
* The Control Panel API allows you manage some settings on your integration
9+
*
10+
*/
11+
class ControlPanel
12+
{
13+
use Request;
14+
15+
/**
16+
* Fetch the payment session timeout on your integration
17+
*
18+
* @return \Illuminate\Http\Response
19+
*/
20+
static function fetchPaymentSessionTimeout($params = [])
21+
{
22+
return self::get("/integration/payment_session_timeout", $params);
23+
}
24+
25+
/**
26+
* Update the payment session timeout on your integration
27+
*
28+
* @return \Illuminate\Http\Response
29+
*/
30+
static function updatePaymentSessionTimeout($params = [])
31+
{
32+
return self::put("/integration/payment_session_timeout", $params);
33+
}
34+
}

src/routes.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
use Illuminate\Support\Facades\Route;
44
use Myckhel\Paystack\Http\Controllers\ApplePayController;
55
use Myckhel\Paystack\Http\Controllers\BulkChargeController;
6+
use Myckhel\Paystack\Http\Controllers\ControlPanelController;
67
use Myckhel\Paystack\Http\Controllers\CustomerController;
78
use Myckhel\Paystack\Http\Controllers\DedicatedVirtualAccountController;
89
use Myckhel\Paystack\Http\Controllers\TransactionController;
@@ -136,6 +137,9 @@
136137
'get,bulkcharge/{bulkcharge}/charges' => 'bulkcharge,fetchChargesBatch',
137138
'get,bulkcharge/pause/{bulkcharge}' => 'bulkcharge,pauseChargesBatch',
138139
'get,bulkcharge/resume/{bulkcharge}' => 'bulkcharge,resumeChargesBatch',
140+
// control panel
141+
'get,integration/payment_session_timeout' => 'controlpanel,fetchPaymentSessionTimeout',
142+
'put,integration/payment_session_timeout' => 'controlpanel,updatePaymentSessionTimeout',
139143
];
140144

141145
$controls = [
@@ -156,6 +160,7 @@
156160
'transfer' => TransferController::class,
157161
'control' => TransferControlController::class,
158162
'bulkcharge' => BulkChargeController::class,
163+
'controlpanel' => ControlPanelController::class,
159164
];
160165

161166
collect($routes)->map(function ($route, $index) use ($controls) {

0 commit comments

Comments
 (0)