Skip to content

Commit

Permalink
created ControlPanel APIs (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
myckhel authored May 25, 2022
1 parent 0016171 commit e92a8bf
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 1 deletion.
10 changes: 9 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,15 @@ BulkCharge::pauseChargesBatch($bulkcharge, $params);
BulkCharge::resumeChargesBatch($bulkcharge, $params);
```

### Control Panel **TODO**
### Control Panel
```php
use Myckhel\Paystack\Support\ControlPanel;

ControlPanel::fetchPaymentSessionTimeout($params);

ControlPanel::updatePaymentSessionTimeout($params);
```

### Charge **TODO**
### Disputes **TODO**
### Refunds **TODO**
Expand Down
15 changes: 15 additions & 0 deletions src/Http/Controllers/ControlPanelController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace Myckhel\Paystack\Http\Controllers;

use Myckhel\Paystack\Support\ControlPanel;

class ControlPanelController extends Controller
{
function __call($method, $args)
{
return $args
? ControlPanel::$method($args[0], request()->all())
: ControlPanel::$method(request()->all());
}
}
34 changes: 34 additions & 0 deletions src/Support/ControlPanel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

namespace Myckhel\Paystack\Support;

use Myckhel\Paystack\Traits\Request;

/**
* The Control Panel API allows you manage some settings on your integration
*
*/
class ControlPanel
{
use Request;

/**
* Fetch the payment session timeout on your integration
*
* @return \Illuminate\Http\Response
*/
static function fetchPaymentSessionTimeout($params = [])
{
return self::get("/integration/payment_session_timeout", $params);
}

/**
* Update the payment session timeout on your integration
*
* @return \Illuminate\Http\Response
*/
static function updatePaymentSessionTimeout($params = [])
{
return self::put("/integration/payment_session_timeout", $params);
}
}
5 changes: 5 additions & 0 deletions src/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use Illuminate\Support\Facades\Route;
use Myckhel\Paystack\Http\Controllers\ApplePayController;
use Myckhel\Paystack\Http\Controllers\BulkChargeController;
use Myckhel\Paystack\Http\Controllers\ControlPanelController;
use Myckhel\Paystack\Http\Controllers\CustomerController;
use Myckhel\Paystack\Http\Controllers\DedicatedVirtualAccountController;
use Myckhel\Paystack\Http\Controllers\TransactionController;
Expand Down Expand Up @@ -136,6 +137,9 @@
'get,bulkcharge/{bulkcharge}/charges' => 'bulkcharge,fetchChargesBatch',
'get,bulkcharge/pause/{bulkcharge}' => 'bulkcharge,pauseChargesBatch',
'get,bulkcharge/resume/{bulkcharge}' => 'bulkcharge,resumeChargesBatch',
// control panel
'get,integration/payment_session_timeout' => 'controlpanel,fetchPaymentSessionTimeout',
'put,integration/payment_session_timeout' => 'controlpanel,updatePaymentSessionTimeout',
];

$controls = [
Expand All @@ -156,6 +160,7 @@
'transfer' => TransferController::class,
'control' => TransferControlController::class,
'bulkcharge' => BulkChargeController::class,
'controlpanel' => ControlPanelController::class,
];

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

0 comments on commit e92a8bf

Please sign in to comment.