Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**
Expand All @@ -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.
Expand Down
15 changes: 15 additions & 0 deletions src/Http/Controllers/SettlementController.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\Settlement;

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

namespace Myckhel\Paystack\Support;

use Myckhel\Paystack\Traits\Request;

/**
* The Settlements API allows you gain insights
* into payouts made by Paystack to your bank account
*
*/
class Settlement
{
use Request;

/**
* Fetch settlements made to your settlement accounts.
*
* @return \Illuminate\Http\Response
*/
static function list($params = [])
{
return self::get("/settlement", $params);
}

/**
* Get the transactions that make up a particular settlement
*
* @return \Illuminate\Http\Response
*/
static function transactions($settlement, $params = [])
{
return self::get("/settlement/$settlement/transactions", $params);
}
}
5 changes: 5 additions & 0 deletions src/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Myckhel\Paystack\Http\Controllers\PageController;
use Myckhel\Paystack\Http\Controllers\PlanController;
use Myckhel\Paystack\Http\Controllers\ProductController;
use Myckhel\Paystack\Http\Controllers\SettlementController;
use Myckhel\Paystack\Http\Controllers\SubAccountController;
use Myckhel\Paystack\Http\Controllers\SplitController;
use Myckhel\Paystack\Http\Controllers\SubscriptionController;
Expand Down Expand Up @@ -100,6 +101,9 @@
'get,paymentrequest/totals' => '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 = [
Expand All @@ -115,6 +119,7 @@
'product' => ProductController::class,
'page' => PageController::class,
'invoice' => InvoiceController::class,
'settlement' => SettlementController::class,
];

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