@@ -7,8 +7,8 @@ discard block |
||
7 | 7 | class InvalidCheckoutException extends \RuntimeException |
8 | 8 | { |
9 | 9 | public function __construct(CheckoutInterface $checkout, $code = 10, Throwable $previous = null) |
10 | - { |
|
11 | - $message = sprintf(<<<MSG |
|
10 | + { |
|
11 | + $message = sprintf(<<<MSG |
|
12 | 12 | Something is wrong with this checkout: |
13 | 13 | checkout_reference: %s |
14 | 14 | amount: %s |
@@ -19,6 +19,6 @@ discard block |
||
19 | 19 | $checkout->getAmount(), |
20 | 20 | $checkout->getPayToEmail() |
21 | 21 | ); |
22 | - parent::__construct($message, $code, $previous); |
|
23 | - } |
|
22 | + parent::__construct($message, $code, $previous); |
|
23 | + } |
|
24 | 24 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * |
59 | 59 | * @return string |
60 | 60 | */ |
61 | - public function getToken():? string |
|
61 | + public function getToken(): ? string |
|
62 | 62 | { |
63 | 63 | return $this->token; |
64 | 64 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * |
83 | 83 | * @return bool |
84 | 84 | */ |
85 | - public function getActive():? bool |
|
85 | + public function getActive(): ? bool |
|
86 | 86 | { |
87 | 87 | return $this->active; |
88 | 88 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | * |
107 | 107 | * @return string |
108 | 108 | */ |
109 | - public function getType():? string |
|
109 | + public function getType(): ? string |
|
110 | 110 | { |
111 | 111 | return $this->type; |
112 | 112 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | * |
131 | 131 | * @return string |
132 | 132 | */ |
133 | - public function getLast4Digits():? string |
|
133 | + public function getLast4Digits(): ? string |
|
134 | 134 | { |
135 | 135 | return $this->last4Digits; |
136 | 136 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | * |
155 | 155 | * @return string |
156 | 156 | */ |
157 | - public function getCardType():? string |
|
157 | + public function getCardType(): ? string |
|
158 | 158 | { |
159 | 159 | return $this->cardSchema; |
160 | 160 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | * @see http://docs.sumup.com/rest-api/checkouts-api/#customers-payment-instruments-post |
184 | 184 | * @return array |
185 | 185 | */ |
186 | - public function getCard():? array |
|
186 | + public function getCard(): ? array |
|
187 | 187 | { |
188 | 188 | return [ |
189 | 189 | 'last_4_digits' => $this->getLast4Digits(), |
@@ -22,7 +22,7 @@ |
||
22 | 22 | * @param PaymentInstrumentInterface $card |
23 | 23 | * @return bool |
24 | 24 | */ |
25 | - public function disable(PaymentInstrumentInterface $card):? bool; |
|
25 | + public function disable(PaymentInstrumentInterface $card): ? bool; |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * @param CustomerInterface $customer |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | /** |
14 | 14 | * @return null|string |
15 | 15 | */ |
16 | - function getToken():? string; |
|
16 | + function getToken(): ? string; |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * @param null|string $token |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | /** |
36 | 36 | * @return null|string |
37 | 37 | */ |
38 | - function getType():? string; |
|
38 | + function getType(): ? string; |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * @param null|string $type |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | /** |
47 | 47 | * @return array|null |
48 | 48 | */ |
49 | - function getCard():? array; |
|
49 | + function getCard(): ? array; |
|
50 | 50 | |
51 | 51 | /** |
52 | 52 | * @param array|null $data |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | /** |
58 | 58 | * @return null|string |
59 | 59 | */ |
60 | - function getLast4Digits():? string; |
|
60 | + function getLast4Digits(): ? string; |
|
61 | 61 | |
62 | 62 | /** |
63 | 63 | * @param null|string $digits |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | /** |
69 | 69 | * @return null|string |
70 | 70 | */ |
71 | - function getCardType():? string; |
|
71 | + function getCardType(): ? string; |
|
72 | 72 | |
73 | 73 | /** |
74 | 74 | * @param null|string $schema |
@@ -35,10 +35,10 @@ discard block |
||
35 | 35 | ]; |
36 | 36 | } |
37 | 37 | |
38 | - /** |
|
38 | + /** |
|
39 | 39 | * Retrieve a paymentInstrument from server and fill the $paymentInstrument Object with response. |
40 | - * |
|
41 | - */ |
|
40 | + * |
|
41 | + */ |
|
42 | 42 | public function get(): array |
43 | 43 | { |
44 | 44 | $response = []; |
@@ -50,49 +50,49 @@ discard block |
||
50 | 50 | }; |
51 | 51 | |
52 | 52 | return $response; |
53 | - } |
|
53 | + } |
|
54 | 54 | |
55 | - /** |
|
55 | + /** |
|
56 | 56 | * Delete an paymentInstrument from server. |
57 | - * |
|
57 | + * |
|
58 | 58 | * @param PaymentInstrumentInterface $paymentInstrument |
59 | 59 | * @return bool |
60 | - */ |
|
60 | + */ |
|
61 | 61 | public function disable(PaymentInstrumentInterface $paymentInstrument):?bool |
62 | 62 | { |
63 | 63 | $uri = self::getEndPoint().'/'.$paymentInstrument->getToken(); |
64 | 64 | |
65 | 65 | return $this->request('delete', $paymentInstrument, $uri); |
66 | - } |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * CheckoutClientInterface constructor. |
|
70 | - * @param ContextInterface $context |
|
68 | + /** |
|
69 | + * CheckoutClientInterface constructor. |
|
70 | + * @param ContextInterface $context |
|
71 | 71 | * @param array $options |
72 | 72 | */ |
73 | 73 | public function __construct(ContextInterface $context, ?array $options = []) |
74 | - { |
|
74 | + { |
|
75 | 75 | $this->context = $context; |
76 | 76 | $this->options = $options; |
77 | - } |
|
78 | - |
|
79 | - /** |
|
80 | - * Return last response of client |
|
81 | - * @return ResponseInterface |
|
82 | - */ |
|
83 | - function getLastResponse(): ResponseInterface |
|
84 | - { |
|
77 | + } |
|
78 | + |
|
79 | + /** |
|
80 | + * Return last response of client |
|
81 | + * @return ResponseInterface |
|
82 | + */ |
|
83 | + function getLastResponse(): ResponseInterface |
|
84 | + { |
|
85 | 85 | return $this->lastResponse; |
86 | - } |
|
87 | - |
|
88 | - /** |
|
89 | - * return the context used to created the client. |
|
90 | - * @return ContextInterface |
|
91 | - */ |
|
92 | - function getContext(): ContextInterface |
|
93 | - { |
|
86 | + } |
|
87 | + |
|
88 | + /** |
|
89 | + * return the context used to created the client. |
|
90 | + * @return ContextInterface |
|
91 | + */ |
|
92 | + function getContext(): ContextInterface |
|
93 | + { |
|
94 | 94 | return $this->context; |
95 | - } |
|
95 | + } |
|
96 | 96 | |
97 | 97 | /** |
98 | 98 | * @param PaymentInstrumentInterface $object |
@@ -167,5 +167,5 @@ discard block |
||
167 | 167 | public function getCustomer(): CustomerInterface |
168 | 168 | { |
169 | 169 | return $this->customer; |
170 | - } |
|
170 | + } |
|
171 | 171 | } |
@@ -58,9 +58,9 @@ discard block |
||
58 | 58 | * @param PaymentInstrumentInterface $paymentInstrument |
59 | 59 | * @return bool |
60 | 60 | */ |
61 | - public function disable(PaymentInstrumentInterface $paymentInstrument):?bool |
|
61 | + public function disable(PaymentInstrumentInterface $paymentInstrument): ?bool |
|
62 | 62 | { |
63 | - $uri = self::getEndPoint().'/'.$paymentInstrument->getToken(); |
|
63 | + $uri = self::getEndPoint() . '/' . $paymentInstrument->getToken(); |
|
64 | 64 | |
65 | 65 | return $this->request('delete', $paymentInstrument, $uri); |
66 | 66 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | */ |
129 | 129 | function getEndPoint(): string |
130 | 130 | { |
131 | - return 'customers/'.$this->customer->getCustomerId().'/payment-instruments'; |
|
131 | + return 'customers/' . $this->customer->getCustomerId() . '/payment-instruments'; |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | /** |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | /** |
146 | 146 | * @return AccessToken |
147 | 147 | */ |
148 | - function getToken():? AccessToken |
|
148 | + function getToken(): ? AccessToken |
|
149 | 149 | { |
150 | 150 | return $this->token; |
151 | 151 | } |
@@ -4,132 +4,132 @@ |
||
4 | 4 | |
5 | 5 | class Customer implements CustomerInterface |
6 | 6 | { |
7 | - /** |
|
8 | - * Customer SumUp ID |
|
9 | - * |
|
10 | - * @var string |
|
11 | - */ |
|
12 | - protected $customerId; |
|
13 | - |
|
14 | - /** |
|
15 | - * Customer Name |
|
16 | - * |
|
17 | - * @var string |
|
18 | - */ |
|
19 | - protected $name; |
|
20 | - |
|
21 | - /** |
|
22 | - * Customer phone |
|
23 | - * |
|
24 | - * @var string |
|
25 | - */ |
|
26 | - protected $phone; |
|
27 | - |
|
28 | - /** |
|
29 | - * Cusomter address |
|
30 | - * |
|
31 | - * @var AddressInterface |
|
32 | - */ |
|
33 | - protected $address; |
|
34 | - |
|
35 | - function __construct(?array $data = []) |
|
36 | - { |
|
37 | - $this->setCustomerId($data['customer_id']??null); |
|
38 | - $personal_details = $data['personal_details']??$data; |
|
39 | - $this->setName($personal_details['name']??null); |
|
40 | - $this->setPhone($personal_details['phone']??null); |
|
41 | - $this->setAddress(new Address($personal_details['address']??null)); |
|
42 | - } |
|
43 | - |
|
44 | - /** |
|
45 | - * Get customer SumUp ID |
|
46 | - * |
|
47 | - * @return string |
|
48 | - */ |
|
49 | - public function getCustomerId(): ?string |
|
50 | - { |
|
51 | - return $this->customerId; |
|
52 | - } |
|
53 | - |
|
54 | - /** |
|
55 | - * Set customer SumUp ID |
|
56 | - * |
|
57 | - * @param string $customerId Customer SumUp ID |
|
58 | - * @return CustomerInterface |
|
59 | - */ |
|
60 | - public function setCustomerId(?string $customerId): CustomerInterface |
|
61 | - { |
|
62 | - $this->customerId = $customerId; |
|
63 | - |
|
64 | - return $this; |
|
65 | - } |
|
66 | - |
|
67 | - /** |
|
68 | - * Get customer Name |
|
69 | - * |
|
70 | - * @return string |
|
71 | - */ |
|
72 | - public function getName(): ?string |
|
73 | - { |
|
74 | - return $this->name; |
|
75 | - } |
|
76 | - |
|
77 | - /** |
|
78 | - * Set customer Name |
|
79 | - * |
|
7 | + /** |
|
8 | + * Customer SumUp ID |
|
9 | + * |
|
10 | + * @var string |
|
11 | + */ |
|
12 | + protected $customerId; |
|
13 | + |
|
14 | + /** |
|
15 | + * Customer Name |
|
16 | + * |
|
17 | + * @var string |
|
18 | + */ |
|
19 | + protected $name; |
|
20 | + |
|
21 | + /** |
|
22 | + * Customer phone |
|
23 | + * |
|
24 | + * @var string |
|
25 | + */ |
|
26 | + protected $phone; |
|
27 | + |
|
28 | + /** |
|
29 | + * Cusomter address |
|
30 | + * |
|
31 | + * @var AddressInterface |
|
32 | + */ |
|
33 | + protected $address; |
|
34 | + |
|
35 | + function __construct(?array $data = []) |
|
36 | + { |
|
37 | + $this->setCustomerId($data['customer_id']??null); |
|
38 | + $personal_details = $data['personal_details']??$data; |
|
39 | + $this->setName($personal_details['name']??null); |
|
40 | + $this->setPhone($personal_details['phone']??null); |
|
41 | + $this->setAddress(new Address($personal_details['address']??null)); |
|
42 | + } |
|
43 | + |
|
44 | + /** |
|
45 | + * Get customer SumUp ID |
|
46 | + * |
|
47 | + * @return string |
|
48 | + */ |
|
49 | + public function getCustomerId(): ?string |
|
50 | + { |
|
51 | + return $this->customerId; |
|
52 | + } |
|
53 | + |
|
54 | + /** |
|
55 | + * Set customer SumUp ID |
|
56 | + * |
|
57 | + * @param string $customerId Customer SumUp ID |
|
58 | + * @return CustomerInterface |
|
59 | + */ |
|
60 | + public function setCustomerId(?string $customerId): CustomerInterface |
|
61 | + { |
|
62 | + $this->customerId = $customerId; |
|
63 | + |
|
64 | + return $this; |
|
65 | + } |
|
66 | + |
|
67 | + /** |
|
68 | + * Get customer Name |
|
69 | + * |
|
70 | + * @return string |
|
71 | + */ |
|
72 | + public function getName(): ?string |
|
73 | + { |
|
74 | + return $this->name; |
|
75 | + } |
|
76 | + |
|
77 | + /** |
|
78 | + * Set customer Name |
|
79 | + * |
|
80 | 80 | * @param string $name Customer Name |
81 | 81 | * @return Customer|CustomerInterface |
82 | - */ |
|
83 | - public function setName(?string $name): CustomerInterface |
|
84 | - { |
|
85 | - $this->name = $name; |
|
86 | - |
|
87 | - return $this; |
|
88 | - } |
|
89 | - |
|
90 | - /** |
|
91 | - * Get customer phone |
|
92 | - * |
|
93 | - * @return string |
|
94 | - */ |
|
95 | - public function getPhone(): ?string |
|
96 | - { |
|
97 | - return $this->phone; |
|
98 | - } |
|
99 | - |
|
100 | - /** |
|
101 | - * Set customer phone |
|
102 | - * |
|
82 | + */ |
|
83 | + public function setName(?string $name): CustomerInterface |
|
84 | + { |
|
85 | + $this->name = $name; |
|
86 | + |
|
87 | + return $this; |
|
88 | + } |
|
89 | + |
|
90 | + /** |
|
91 | + * Get customer phone |
|
92 | + * |
|
93 | + * @return string |
|
94 | + */ |
|
95 | + public function getPhone(): ?string |
|
96 | + { |
|
97 | + return $this->phone; |
|
98 | + } |
|
99 | + |
|
100 | + /** |
|
101 | + * Set customer phone |
|
102 | + * |
|
103 | 103 | * @param string $phone Customer phone |
104 | 104 | * @return Customer|CustomerInterface |
105 | - */ |
|
106 | - public function setPhone(?string $phone): CustomerInterface |
|
107 | - { |
|
108 | - $this->phone = $phone; |
|
109 | - |
|
110 | - return $this; |
|
111 | - } |
|
112 | - |
|
113 | - /** |
|
114 | - * Get cusomter address |
|
115 | - * |
|
116 | - * @return AddressInterface |
|
117 | - */ |
|
118 | - public function getAddress(): AddressInterface |
|
119 | - { |
|
120 | - return $this->address; |
|
121 | - } |
|
122 | - |
|
123 | - /** |
|
124 | - * Set cusomter address |
|
125 | - * |
|
126 | - * @param AddressInterface $address |
|
127 | - * @return Customer|CustomerInterface |
|
128 | - */ |
|
129 | - public function setAddress(AddressInterface $address): CustomerInterface |
|
130 | - { |
|
131 | - $this->address = $address; |
|
132 | - return $this; |
|
133 | - } |
|
105 | + */ |
|
106 | + public function setPhone(?string $phone): CustomerInterface |
|
107 | + { |
|
108 | + $this->phone = $phone; |
|
109 | + |
|
110 | + return $this; |
|
111 | + } |
|
112 | + |
|
113 | + /** |
|
114 | + * Get cusomter address |
|
115 | + * |
|
116 | + * @return AddressInterface |
|
117 | + */ |
|
118 | + public function getAddress(): AddressInterface |
|
119 | + { |
|
120 | + return $this->address; |
|
121 | + } |
|
122 | + |
|
123 | + /** |
|
124 | + * Set cusomter address |
|
125 | + * |
|
126 | + * @param AddressInterface $address |
|
127 | + * @return Customer|CustomerInterface |
|
128 | + */ |
|
129 | + public function setAddress(AddressInterface $address): CustomerInterface |
|
130 | + { |
|
131 | + $this->address = $address; |
|
132 | + return $this; |
|
133 | + } |
|
134 | 134 | |
135 | 135 | } |
@@ -179,7 +179,7 @@ |
||
179 | 179 | /** |
180 | 180 | * @return AccessToken |
181 | 181 | */ |
182 | - function getToken():? AccessToken |
|
182 | + function getToken(): ? AccessToken |
|
183 | 183 | { |
184 | 184 | return $this->token; |
185 | 185 | } |
@@ -24,15 +24,15 @@ discard block |
||
24 | 24 | protected $options = []; |
25 | 25 | |
26 | 26 | /** |
27 | - * CheckoutClientInterface constructor. |
|
28 | - * @param ContextInterface $context |
|
27 | + * CheckoutClientInterface constructor. |
|
28 | + * @param ContextInterface $context |
|
29 | 29 | * @param array $options |
30 | 30 | */ |
31 | 31 | public function __construct(ContextInterface $context, ?array $options = []) |
32 | - { |
|
33 | - $this->context = $context; |
|
32 | + { |
|
33 | + $this->context = $context; |
|
34 | 34 | $this->options = $options; |
35 | - } |
|
35 | + } |
|
36 | 36 | |
37 | 37 | /** |
38 | 38 | * @inheritDoc |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | } |
75 | 75 | |
76 | 76 | public function setContext(ContextInterface $context): CustomerClientInterface |
77 | - { |
|
78 | - $this->context = $context; |
|
79 | - } |
|
77 | + { |
|
78 | + $this->context = $context; |
|
79 | + } |
|
80 | 80 | |
81 | 81 | /** |
82 | 82 | * @inheritDoc |
@@ -88,18 +88,18 @@ discard block |
||
88 | 88 | ]; |
89 | 89 | } |
90 | 90 | |
91 | - function getLastResponse(): ResponseInterface |
|
92 | - { |
|
93 | - return $this->lastResponse; |
|
94 | - } |
|
91 | + function getLastResponse(): ResponseInterface |
|
92 | + { |
|
93 | + return $this->lastResponse; |
|
94 | + } |
|
95 | 95 | |
96 | 96 | |
97 | - /** |
|
98 | - * return the context used to created the client. |
|
99 | - * @return ContextInterface |
|
100 | - */ |
|
101 | - function getContext(): ContextInterface |
|
102 | - { |
|
97 | + /** |
|
98 | + * return the context used to created the client. |
|
99 | + * @return ContextInterface |
|
100 | + */ |
|
101 | + function getContext(): ContextInterface |
|
102 | + { |
|
103 | 103 | return $this->context; |
104 | 104 | } |
105 | 105 | |
@@ -182,5 +182,5 @@ discard block |
||
182 | 182 | function getToken():? AccessToken |
183 | 183 | { |
184 | 184 | return $this->token; |
185 | - } |
|
185 | + } |
|
186 | 186 | } |
@@ -12,7 +12,7 @@ |
||
12 | 12 | * @param CustomerInterface $customer |
13 | 13 | * @return CustomerInterface |
14 | 14 | */ |
15 | - function create(CustomerInterface $customer):? CustomerInterface; |
|
15 | + function create(CustomerInterface $customer): ? CustomerInterface; |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * @param CustomerInterface $customer |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | |
7 | 7 | interface CheckoutClientInterface extends SumUpClientInterface |
8 | 8 | { |
9 | - /** |
|
9 | + /** |
|
10 | 10 | * Create a checkout |
11 | 11 | * |
12 | 12 | * @param CheckoutInterface $checkout |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | /** |
28 | 28 | * @param CheckoutInterface $checkout |
29 | 29 | * @return string |
30 | - */ |
|
30 | + */ |
|
31 | 31 | static function getCompleteUrl(CheckoutInterface $checkout): string; |
32 | 32 | |
33 | 33 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | * @return CheckoutInterface |
14 | 14 | * @see http://docs.sumup.com/rest-api/checkouts-api/#checkouts-create-checkout-post |
15 | 15 | */ |
16 | - public function create(CheckoutInterface $checkout):? CheckoutInterface; |
|
16 | + public function create(CheckoutInterface $checkout): ? CheckoutInterface; |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Complete a checkout |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * @return CheckoutInterface |
23 | 23 | * @see http://docs.sumup.com/rest-api/checkouts-api/#checkouts-complete-checkout-put |
24 | 24 | */ |
25 | - public function complete(CheckoutInterface $checkout):? CheckoutInterface; |
|
25 | + public function complete(CheckoutInterface $checkout): ? CheckoutInterface; |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * @param CheckoutInterface $checkout |