From fccf7fbe98690d26f3709045205f2a48834f6cb5 Mon Sep 17 00:00:00 2001 From: myckhel Date: Sat, 21 May 2022 00:31:57 +0100 Subject: [PATCH] create `Settlement` APIs --- readme.md | 12 +++++-- src/Http/Controllers/SettlementController.php | 15 ++++++++ src/Support/Settlement.php | 35 +++++++++++++++++++ src/routes.php | 5 +++ 4 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 src/Http/Controllers/SettlementController.php create mode 100644 src/Support/Settlement.php diff --git a/readme.md b/readme.md index 1f6b432..d5c396c 100644 --- a/readme.md +++ b/readme.md @@ -238,7 +238,15 @@ Invoice::finalize($code, $params); Invoice::archive($code, $params); ``` -### Settlements **TODO** +### Settlements +```php +use Myckhel\Paystack\Support\Settlement; + +Settlement::list($params); + +Settlement::transactions($settlement, $params); +``` + ### Transfer Recipients **TODO** ### Transfers **TODO** ### Transfers Control **TODO** @@ -249,8 +257,6 @@ Invoice::archive($code, $params); ### Refunds **TODO** ### Verification **TODO** ### Miscellaneous **TODO** -```php -``` ### Using WebHook route Laravel paystack provides you a predefined endpoint that listens to and validates incoming paystack's webhook events. diff --git a/src/Http/Controllers/SettlementController.php b/src/Http/Controllers/SettlementController.php new file mode 100644 index 0000000..b592f90 --- /dev/null +++ b/src/Http/Controllers/SettlementController.php @@ -0,0 +1,15 @@ +all()) + : Settlement::$method(request()->all()); + } +} diff --git a/src/Support/Settlement.php b/src/Support/Settlement.php new file mode 100644 index 0000000..a19dbc7 --- /dev/null +++ b/src/Support/Settlement.php @@ -0,0 +1,35 @@ + 'invoice,totals', 'post,paymentrequest/finalize/{invoice_code}' => 'invoice,finalize', 'post,paymentrequest/archive/{invoice_code}' => 'invoice,archive', + // settlements + 'get,settlement' => 'settlement,list', + 'get,settlement/{settlement}/transactions' => 'settlement,transactions', ]; $controls = [ @@ -115,6 +119,7 @@ 'product' => ProductController::class, 'page' => PageController::class, 'invoice' => InvoiceController::class, + 'settlement' => SettlementController::class, ]; collect($routes)->map(function ($route, $index) use ($controls) {