From e92a8bf10afcfc1e61c933525c0ec138ecbc7221 Mon Sep 17 00:00:00 2001 From: Michael Ishola Date: Wed, 25 May 2022 01:02:27 +0100 Subject: [PATCH] created `ControlPanel` APIs (#29) --- readme.md | 10 +++++- .../Controllers/ControlPanelController.php | 15 ++++++++ src/Support/ControlPanel.php | 34 +++++++++++++++++++ src/routes.php | 5 +++ 4 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 src/Http/Controllers/ControlPanelController.php create mode 100644 src/Support/ControlPanel.php diff --git a/readme.md b/readme.md index 6245a11..ddf9131 100644 --- a/readme.md +++ b/readme.md @@ -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** diff --git a/src/Http/Controllers/ControlPanelController.php b/src/Http/Controllers/ControlPanelController.php new file mode 100644 index 0000000..24cef25 --- /dev/null +++ b/src/Http/Controllers/ControlPanelController.php @@ -0,0 +1,15 @@ +all()) + : ControlPanel::$method(request()->all()); + } +} diff --git a/src/Support/ControlPanel.php b/src/Support/ControlPanel.php new file mode 100644 index 0000000..ec9a11c --- /dev/null +++ b/src/Support/ControlPanel.php @@ -0,0 +1,34 @@ + '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 = [ @@ -156,6 +160,7 @@ 'transfer' => TransferController::class, 'control' => TransferControlController::class, 'bulkcharge' => BulkChargeController::class, + 'controlpanel' => ControlPanelController::class, ]; collect($routes)->map(function ($route, $index) use ($controls) {