1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Digikraaft\Paystack; |
4
|
|
|
|
5
|
|
|
class Customer extends ApiResource |
6
|
|
|
{ |
7
|
|
|
const OBJECT_NAME = 'customer'; |
8
|
|
|
|
9
|
|
|
use ApiOperations\All; |
10
|
|
|
use ApiOperations\Create; |
11
|
|
|
use ApiOperations\Fetch; |
12
|
|
|
use ApiOperations\Update; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* @param $customerCode |
16
|
|
|
* @return array|object |
17
|
|
|
* @throws Exceptions\InvalidArgumentException |
18
|
|
|
* @throws Exceptions\IsNullException |
19
|
|
|
* @link https://paystack.com/docs/api/#customer-validate |
20
|
|
|
*/ |
21
|
|
|
public static function validate($customerCode) |
|
|
|
|
22
|
|
|
{ |
23
|
|
|
$url = static::classUrl().'/{$customerCode}/identification'; |
24
|
|
|
|
25
|
|
|
return static::staticRequest('POST', $url); |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @param array $params containing the customer code of the customer to white/black list and |
30
|
|
|
* one can be one of the possible risk actions: |
31
|
|
|
* default or deny: |
32
|
|
|
* customer and risk_action |
33
|
|
|
* data = ['customer'=>'CUS_123456789','risk_action'=>'default'] |
34
|
|
|
* |
35
|
|
|
* @throws Exceptions\InvalidArgumentException|Exceptions\IsNullException |
36
|
|
|
* |
37
|
|
|
* @return array|object |
38
|
|
|
* |
39
|
|
|
* @link https://paystack.com/docs/api/#customer-whitelist-blacklist |
40
|
|
|
*/ |
41
|
|
|
public static function whiteOrBlackList($params) |
42
|
|
|
{ |
43
|
|
|
self::validateParams($params); |
44
|
|
|
$url = static::classUrl().'/set_risk_action'; |
45
|
|
|
|
46
|
|
|
return static::staticRequest('POST', $url, $params); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @param array $params Authorization code to be deactivated with authorization_code |
51
|
|
|
* as the array key. data = ['authorization_code'=>'aser12334556'] |
52
|
|
|
* |
53
|
|
|
* @throws Exceptions\InvalidArgumentException|Exceptions\IsNullException |
54
|
|
|
* |
55
|
|
|
* @return array|object |
56
|
|
|
* |
57
|
|
|
* @link https://paystack.com/docs/api/#customer-deactivate-authorization |
58
|
|
|
*/ |
59
|
|
|
public static function deactivateAuthorization($params) |
60
|
|
|
{ |
61
|
|
|
self::validateParams($params); |
62
|
|
|
$url = static::classUrl().'/deactivate_authorization'; |
63
|
|
|
|
64
|
|
|
return static::staticRequest('POST', $url, $params, 'arr'); |
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.