1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Iamolayemi\Paystack\Endpoints; |
4
|
|
|
|
5
|
|
|
class DedicatedAccount extends Endpoint |
6
|
|
|
{ |
7
|
|
|
protected const ENDPOINT = '/dedicated_account'; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Create a Dedicated NUBAN and assign to a customer. |
11
|
|
|
* |
12
|
|
|
* @param array<string, mixed> $payload |
13
|
|
|
* |
14
|
|
|
* @link https://paystack.com/docs/api/#dedicated-nuban-create |
15
|
|
|
*/ |
16
|
|
|
public function create(array $payload): self |
17
|
|
|
{ |
18
|
|
|
$this->post($this->url(self::ENDPOINT), $payload); |
19
|
|
|
|
20
|
|
|
return $this; |
21
|
|
|
} |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* List dedicated accounts available on your integration. |
25
|
|
|
* |
26
|
|
|
* @param array<string, mixed> $query |
27
|
|
|
* |
28
|
|
|
* @link |
29
|
|
|
*/ |
30
|
|
|
public function list(array $query = []): self |
31
|
|
|
{ |
32
|
|
|
$this->get($this->url(self::ENDPOINT), $query); |
33
|
|
|
|
34
|
|
|
return $this; |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Get details of a dedicated account on your integration. |
39
|
|
|
* |
40
|
|
|
* @link https://paystack.com/docs/api/#dedicated-nuban-fetch |
41
|
|
|
*/ |
42
|
|
|
public function fetch(string $account_id): self |
43
|
|
|
{ |
44
|
|
|
$this->get($this->url(self::ENDPOINT).'/'.$account_id); |
45
|
|
|
|
46
|
|
|
return $this; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Get details of a dedicated account on your integration. |
51
|
|
|
* |
52
|
|
|
* @link https://paystack.com/docs/api/#dedicated-nuban-deactivate |
53
|
|
|
*/ |
54
|
|
|
public function deactivate(string $account_id): self |
55
|
|
|
{ |
56
|
|
|
$this->delete($this->url(self::ENDPOINT).'/'.$account_id); |
57
|
|
|
|
58
|
|
|
return $this; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Split a dedicated account transaction with one or more accounts. |
63
|
|
|
* |
64
|
|
|
* @param array<string, mixed> $payload |
65
|
|
|
* |
66
|
|
|
* @link https://paystack.com/docs/api/#dedicated-nuban-add-split |
67
|
|
|
*/ |
68
|
|
|
public function addSplit(array $payload): self |
69
|
|
|
{ |
70
|
|
|
$this->post($this->url(self::ENDPOINT).'/split', $payload); |
71
|
|
|
|
72
|
|
|
return $this; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* Remove split payment for a dedicated account. |
77
|
|
|
* |
78
|
|
|
* @param array<string, mixed> $payload |
79
|
|
|
* |
80
|
|
|
* @link https://paystack.com/docs/api/#dedicated-nuban-remove-split |
81
|
|
|
*/ |
82
|
|
|
public function removeSplit(array $payload): self |
83
|
|
|
{ |
84
|
|
|
$this->delete($this->url(self::ENDPOINT).'/split', $payload); |
85
|
|
|
|
86
|
|
|
return $this; |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* Get available bank providers for Dedicated NUBAN. |
91
|
|
|
* |
92
|
|
|
* @link https://paystack.com/docs/api/#dedicated-nuban-providers |
93
|
|
|
*/ |
94
|
|
|
public function providers(): self |
95
|
|
|
{ |
96
|
|
|
$this->get($this->url(self::ENDPOINT).'/available_providers'); |
97
|
|
|
|
98
|
|
|
return $this; |
99
|
|
|
} |
100
|
|
|
} |
101
|
|
|
|