|
1
|
|
|
<?php |
|
2
|
|
|
namespace BPCI\SumUp\Customer\Card; |
|
3
|
|
|
|
|
4
|
|
|
use BPCI\SumUp\ContextInterface; |
|
5
|
|
|
use BPCI\SumUp\Customer\CustomerInterface; |
|
6
|
|
|
use BPCI\SumUp\OAuth\AccessToken; |
|
7
|
|
|
use Psr\Http\Message\ResponseInterface; |
|
8
|
|
|
|
|
9
|
|
|
|
|
10
|
|
|
class CardClient implements CardClientInterface |
|
11
|
|
|
{ |
|
12
|
|
|
|
|
13
|
|
|
static function getScopes(): array { |
|
|
|
|
|
|
14
|
|
|
return [ |
|
15
|
|
|
'payment_instruments' |
|
16
|
|
|
]; |
|
17
|
|
|
} |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* Retieve a card from server and fill the $card Object with response. |
|
21
|
|
|
* |
|
22
|
|
|
* @param CardInterface $card |
|
23
|
|
|
* @param CustomerInterface $customer |
|
24
|
|
|
* @param ContextInterface $context |
|
25
|
|
|
* @param AccessToken $accessToken |
|
26
|
|
|
* @return CardInterface |
|
27
|
|
|
*/ |
|
28
|
|
|
public static function get( |
|
29
|
|
|
CardInterface $card, |
|
30
|
|
|
CustomerInterface $customer, |
|
31
|
|
|
ContextInterface $context, |
|
32
|
|
|
AccessToken $accessToken |
|
33
|
|
|
): CardInterface { |
|
34
|
|
|
// TODO: Implement get() method. |
|
35
|
|
|
} |
|
|
|
|
|
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* Delete an card from server. |
|
39
|
|
|
* |
|
40
|
|
|
* @param CardInterface $card |
|
41
|
|
|
* @param CustomerInterface $customer |
|
42
|
|
|
* @param ContextInterface $context |
|
43
|
|
|
* @param AccessToken $accessToken |
|
44
|
|
|
* @return void |
|
45
|
|
|
*/ |
|
46
|
|
|
public static function delete( |
|
47
|
|
|
CardInterface $card, |
|
48
|
|
|
CustomerInterface $customer, |
|
49
|
|
|
ContextInterface $context, |
|
50
|
|
|
AccessToken $accessToken |
|
51
|
|
|
): void { |
|
52
|
|
|
// TODO: Implement delete() method. |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* CheckoutClientInterface constructor. |
|
57
|
|
|
* @param ContextInterface $context |
|
58
|
|
|
*/ |
|
59
|
|
|
public function __construct(ContextInterface $context) |
|
60
|
|
|
{ |
|
61
|
|
|
parent::__construct($context); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* Return last response of client |
|
66
|
|
|
* @return ResponseInterface |
|
67
|
|
|
*/ |
|
68
|
|
|
function getLastResponse(): ResponseInterface |
|
|
|
|
|
|
69
|
|
|
{ |
|
70
|
|
|
// TODO: Implement getLastResponse() method. |
|
71
|
|
|
} |
|
|
|
|
|
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* return the context used to created the client. |
|
75
|
|
|
* @return ContextInterface |
|
76
|
|
|
*/ |
|
77
|
|
|
function getContext(): ContextInterface |
|
|
|
|
|
|
78
|
|
|
{ |
|
79
|
|
|
// TODO: Implement getContext() method. |
|
80
|
|
|
} |
|
|
|
|
|
|
81
|
|
|
|
|
82
|
|
|
/** |
|
83
|
|
|
* Create a new card resource and fill the $card Object with response. |
|
84
|
|
|
* |
|
85
|
|
|
* @param CardInterface $card |
|
86
|
|
|
* @param CustomerInterface $costumer |
|
87
|
|
|
* @param ContextInterface $context |
|
88
|
|
|
* @param AccessToken $accessToken |
|
89
|
|
|
* @return CardInterface |
|
90
|
|
|
*/ |
|
91
|
|
|
public static function create( |
|
92
|
|
|
CardInterface $card, |
|
93
|
|
|
CustomerInterface $costumer, |
|
94
|
|
|
ContextInterface $context, |
|
95
|
|
|
AccessToken $accessToken |
|
96
|
|
|
): CardInterface { |
|
97
|
|
|
// TODO: Implement create() method. |
|
98
|
|
|
} |
|
|
|
|
|
|
99
|
|
|
} |
|
100
|
|
|
|
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.