Skip to content

Commit 5e7a038

Browse files
author
Simon
committed
improvements
1 parent ca5d665 commit 5e7a038

18 files changed

Lines changed: 212 additions & 180 deletions

src/Resource/Payment/Payment.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ public static function createFromStdClass(\stdClass $response): self
6666
*
6767
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
6868
* @SuppressWarnings(PHPMD.NPathComplexity)
69-
* phpcs:ignore Generic.Metrics.CyclomaticComplexity
69+
*
70+
* phpcs:disable Generic.Metrics.CyclomaticComplexity
7071
*/
7172
public static function createFromObject(object $obj): self
7273
{
@@ -118,6 +119,7 @@ public static function createFromObject(object $obj): self
118119
reference: $reference,
119120
);
120121
}
122+
// phpcs:enable Generic.Metrics.CyclomaticComplexity
121123

122124
public function toArray(): array
123125
{

tests/LegacyEndpointPayconiqApiClientTest.php

Lines changed: 35 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,13 @@ public function testRequestPaymentItShouldThrow(): void
100100
RequestOptions::JSON => $requestPayment->toArray(),
101101
],
102102
)
103-
->willThrowException(new ClientException(
104-
'some-message',
105-
$this->createMock(Request::class),
106-
$this->createMock(Response::class),
107-
));
103+
->willThrowException(
104+
new ClientException(
105+
'some-message',
106+
$this->createMock(Request::class),
107+
$this->createMock(Response::class),
108+
),
109+
);
108110

109111
$this->expectException(PayconiqApiException::class);
110112
$this->expectExceptionMessage('some-message');
@@ -154,11 +156,13 @@ public function testGetPaymentItShouldThrow(): void
154156
],
155157
],
156158
)
157-
->willThrowException(new ClientException(
158-
'some-message',
159-
$this->createMock(Request::class),
160-
$this->createMock(Response::class),
161-
));
159+
->willThrowException(
160+
new ClientException(
161+
'some-message',
162+
$this->createMock(Request::class),
163+
$this->createMock(Response::class),
164+
),
165+
);
162166

163167
$this->expectException(PayconiqApiException::class);
164168
$this->expectExceptionMessage('some-message');
@@ -197,11 +201,13 @@ public function testCancelPaymentItShouldThrow(): void
197201
],
198202
],
199203
)
200-
->willThrowException(new ClientException(
201-
'some-message',
202-
$this->createMock(Request::class),
203-
$this->createMock(Response::class),
204-
));
204+
->willThrowException(
205+
new ClientException(
206+
'some-message',
207+
$this->createMock(Request::class),
208+
$this->createMock(Response::class),
209+
),
210+
);
205211

206212
$this->expectException(PayconiqApiException::class);
207213
$this->expectExceptionMessage('some-message');
@@ -256,11 +262,13 @@ public function testSearchPaymentsItShouldThrow(): void
256262
RequestOptions::JSON => $searchPayments->toArray(),
257263
],
258264
)
259-
->willThrowException(new ClientException(
260-
'some-message',
261-
$this->createMock(Request::class),
262-
$this->createMock(Response::class),
263-
));
265+
->willThrowException(
266+
new ClientException(
267+
'some-message',
268+
$this->createMock(Request::class),
269+
$this->createMock(Response::class),
270+
),
271+
);
264272

265273
$this->expectException(PayconiqApiException::class);
266274
$this->expectExceptionMessage('some-message');
@@ -288,11 +296,13 @@ public function testRefundPaymentItShouldThrow(): void
288296
->with(
289297
'https://api.ext.payconiq.com/v3/payments/' . $paymentId . '/debtor/refundIban',
290298
)
291-
->willThrowException(new ClientException(
292-
'some-message',
293-
$this->createMock(Request::class),
294-
$this->createMock(Response::class),
295-
));
299+
->willThrowException(
300+
new ClientException(
301+
'some-message',
302+
$this->createMock(Request::class),
303+
$this->createMock(Response::class),
304+
),
305+
);
296306

297307
$this->expectException(PayconiqApiException::class);
298308
$this->expectExceptionMessage('some-message');

tests/LegacyEndpointPayconiqCallbackSignatureVerifierTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
use Jose\Component\Signature\JWSLoader;
1010
use Optios\Payconiq\Exception\PayconiqCallbackSignatureVerificationException;
1111
use Optios\Payconiq\MigrationHelper;
12-
use PHPUnit\Framework\TestCase;
1312
use Optios\Payconiq\PayconiqCallbackSignatureVerifier;
13+
use PHPUnit\Framework\TestCase;
1414
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
1515
use Symfony\Contracts\Cache\ItemInterface;
1616

@@ -138,7 +138,9 @@ public function testLoadAndVerifyJWSItShouldThrow(): void
138138

139139
$this->expectException(PayconiqCallbackSignatureVerificationException::class);
140140
//phpcs:disable
141-
$this->expectExceptionMessage('Something went wrong while loading and verifying the JWS. Error: Unable to load and verify the token.');
141+
$this->expectExceptionMessage(
142+
'Something went wrong while loading and verifying the JWS. Error: Unable to load and verify the token.',
143+
);
142144
//phpcs:enable
143145

144146
$this->payconiqCallbackSignatureVerifier->loadAndVerifyJWS('some-token');

tests/NewEndpointPayconiqApiClientTest.php

Lines changed: 39 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,13 @@ public function testRequestPaymentItShouldThrow(): void
105105
RequestOptions::JSON => $requestPayment->toArray(),
106106
],
107107
)
108-
->willThrowException(new ClientException(
109-
'some-message',
110-
$this->createMock(Request::class),
111-
$this->createMock(Response::class),
112-
));
108+
->willThrowException(
109+
new ClientException(
110+
'some-message',
111+
$this->createMock(Request::class),
112+
$this->createMock(Response::class),
113+
),
114+
);
113115

114116
$this->expectException(PayconiqApiException::class);
115117
$this->expectExceptionMessage('some-message');
@@ -159,11 +161,13 @@ public function testGetPaymentItShouldThrow(): void
159161
],
160162
],
161163
)
162-
->willThrowException(new ClientException(
163-
'some-message',
164-
$this->createMock(Request::class),
165-
$this->createMock(Response::class),
166-
));
164+
->willThrowException(
165+
new ClientException(
166+
'some-message',
167+
$this->createMock(Request::class),
168+
$this->createMock(Response::class),
169+
),
170+
);
167171

168172
$this->expectException(PayconiqApiException::class);
169173
$this->expectExceptionMessage('some-message');
@@ -202,11 +206,13 @@ public function testCancelPaymentItShouldThrow(): void
202206
],
203207
],
204208
)
205-
->willThrowException(new ClientException(
206-
'some-message',
207-
$this->createMock(Request::class),
208-
$this->createMock(Response::class),
209-
));
209+
->willThrowException(
210+
new ClientException(
211+
'some-message',
212+
$this->createMock(Request::class),
213+
$this->createMock(Response::class),
214+
),
215+
);
210216

211217
$this->expectException(PayconiqApiException::class);
212218
$this->expectExceptionMessage('some-message');
@@ -231,7 +237,10 @@ public function testSearchPayments(): void
231237
],
232238
)
233239
->willReturnCallback(function ($uri, array $options) {
234-
$this->assertEquals('https://merchant.api.preprod.bancontact.net/v3/payments/search?page=0&size=100', $uri);
240+
$this->assertEquals(
241+
'https://merchant.api.preprod.bancontact.net/v3/payments/search?page=0&size=100',
242+
$uri,
243+
);
235244
$this->assertMatchesJsonSnapshot($options);
236245

237246
return new Response(200, [], json_encode([
@@ -261,11 +270,13 @@ public function testSearchPaymentsItShouldThrow(): void
261270
RequestOptions::JSON => $searchPayments->toArray(),
262271
],
263272
)
264-
->willThrowException(new ClientException(
265-
'some-message',
266-
$this->createMock(Request::class),
267-
$this->createMock(Response::class),
268-
));
273+
->willThrowException(
274+
new ClientException(
275+
'some-message',
276+
$this->createMock(Request::class),
277+
$this->createMock(Response::class),
278+
),
279+
);
269280

270281
$this->expectException(PayconiqApiException::class);
271282
$this->expectExceptionMessage('some-message');
@@ -293,11 +304,13 @@ public function testRefundPaymentItShouldThrow(): void
293304
->with(
294305
'https://merchant.api.preprod.bancontact.net/v3/payments/' . $paymentId . '/debtor/refundIban',
295306
)
296-
->willThrowException(new ClientException(
297-
'some-message',
298-
$this->createMock(Request::class),
299-
$this->createMock(Response::class),
300-
));
307+
->willThrowException(
308+
new ClientException(
309+
'some-message',
310+
$this->createMock(Request::class),
311+
$this->createMock(Response::class),
312+
),
313+
);
301314

302315
$this->expectException(PayconiqApiException::class);
303316
$this->expectExceptionMessage('some-message');

tests/NewEndpointPayconiqCallbackSignatureVerifierTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
use Jose\Component\Signature\JWSLoader;
1010
use Optios\Payconiq\Exception\PayconiqCallbackSignatureVerificationException;
1111
use Optios\Payconiq\MigrationHelper;
12-
use PHPUnit\Framework\TestCase;
1312
use Optios\Payconiq\PayconiqCallbackSignatureVerifier;
13+
use PHPUnit\Framework\TestCase;
1414
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
1515
use Symfony\Contracts\Cache\ItemInterface;
1616

@@ -143,7 +143,9 @@ public function testLoadAndVerifyJWSItShouldThrow(): void
143143

144144
$this->expectException(PayconiqCallbackSignatureVerificationException::class);
145145
//phpcs:disable
146-
$this->expectExceptionMessage('Something went wrong while loading and verifying the JWS. Error: Unable to load and verify the token.');
146+
$this->expectExceptionMessage(
147+
'Something went wrong while loading and verifying the JWS. Error: Unable to load and verify the token.',
148+
);
147149
//phpcs:enable
148150

149151
$this->payconiqCallbackSignatureVerifier->loadAndVerifyJWS('some-token');
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
2-
"amount": 1,
3-
"currency": "EUR",
4-
"callbackUrl": "some-uri",
5-
"reference": "ref",
6-
"description": "description",
7-
"bulkId": "bulk-id",
8-
"posId": "posId",
9-
"shopId": "shop-id",
10-
"shopName": "shop-name",
11-
"returnUrl": "some-uri"
2+
"amount": 1,
3+
"currency": "EUR",
4+
"callbackUrl": "some-uri",
5+
"reference": "ref",
6+
"description": "description",
7+
"bulkId": "bulk-id",
8+
"posId": "posId",
9+
"shopId": "shop-id",
10+
"shopName": "shop-name",
11+
"returnUrl": "some-uri"
1212
}
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
2-
"from": "2022-01-25T00:00:00.000Z",
3-
"to": "2022-01-26T00:00:00.000Z",
4-
"paymentStatuses": [
5-
"EXPIRED",
6-
"CANCELLED"
7-
],
8-
"reference": "ref"
2+
"from": "2022-01-25T00:00:00.000Z",
3+
"to": "2022-01-26T00:00:00.000Z",
4+
"paymentStatuses": [
5+
"EXPIRED",
6+
"CANCELLED"
7+
],
8+
"reference": "ref"
99
}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"profileId": "profile-id",
3-
"merchantId": "merchant-id",
4-
"name": "name",
5-
"iban": "iban",
6-
"callbackUrl": null
2+
"profileId": "profile-id",
3+
"merchantId": "merchant-id",
4+
"name": "name",
5+
"iban": "iban",
6+
"callbackUrl": null
77
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"name": null,
3-
"iban": null
2+
"name": null,
3+
"iban": null
44
}
Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
{
2-
"paymentId": "payment-id",
3-
"createdAt": "2022-01-25T00:00:00+00:00",
4-
"status": "SUCCEEDED",
5-
"reference": null,
6-
"amount": 10,
7-
"currency": "EUR",
8-
"creditor": {
9-
"callbackUrl": null,
10-
"profileId": "profile-id",
11-
"merchantId": "merchant-id",
12-
"name": "name",
13-
"iban": "iban"
14-
},
15-
"debtor": {
16-
"name": null,
17-
"iban": null
18-
},
19-
"expiresAt": null,
20-
"transferAmount": null,
21-
"tippingAmount": null,
22-
"totalAmount": null,
23-
"description": null,
24-
"bulkId": null,
25-
"selfLink": null,
26-
"deepLink": null,
27-
"qrLink": null,
28-
"refundLink": null,
29-
"checkoutLink": null
2+
"paymentId": "payment-id",
3+
"createdAt": "2022-01-25T00:00:00+00:00",
4+
"status": "SUCCEEDED",
5+
"reference": null,
6+
"amount": 10,
7+
"currency": "EUR",
8+
"creditor": {
9+
"callbackUrl": null,
10+
"profileId": "profile-id",
11+
"merchantId": "merchant-id",
12+
"name": "name",
13+
"iban": "iban"
14+
},
15+
"debtor": {
16+
"name": null,
17+
"iban": null
18+
},
19+
"expiresAt": null,
20+
"transferAmount": null,
21+
"tippingAmount": null,
22+
"totalAmount": null,
23+
"description": null,
24+
"bulkId": null,
25+
"selfLink": null,
26+
"deepLink": null,
27+
"qrLink": null,
28+
"refundLink": null,
29+
"checkoutLink": null
3030
}

0 commit comments

Comments
 (0)