Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Naoray committed Dec 23, 2024
1 parent 6360e9d commit 7e6b6a6
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 17 deletions.
21 changes: 12 additions & 9 deletions examples/client-links/create-client-link.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,16 @@
*
* See: https://docs.mollie.com/reference/v2/client-links-api/create-client-link
*/
$response = $mollie->send(new CreateClientLinkRequest(new CreateClientLinkPayload(
new Owner('[email protected]', 'foo', 'bar', 'nl_NL'),
'Foo Company',
new OwnerAddress('NL', 'Keizersgracht 313', '1016 EE', 'Amsterdam'),
'30204462',
'NL123456789B01',
)));
$response = $mollie
->send(
new CreateClientLinkRequest(new CreateClientLinkPayload(
new Owner('[email protected]', 'foo', 'bar', 'nl_NL'),
'Foo Company',
new OwnerAddress('NL', 'Keizersgracht 313', '1016 EE', 'Amsterdam'),
'30204462',
'NL123456789B01',
))
);

$clientLink = $response->toResource();

Expand All @@ -53,7 +56,7 @@
* Send the customer off to finalize the organization creation.
* This request should always be a GET, thus we enforce 303 http response code
*/
header('Location: '.$redirectUrl, true, 303);
header('Location: ' . $redirectUrl, true, 303);
} catch (\Mollie\Api\Exceptions\ApiException $e) {
echo 'API call failed: '.htmlspecialchars($e->getMessage());
echo 'API call failed: ' . htmlspecialchars($e->getMessage());
}
2 changes: 1 addition & 1 deletion src/EndpointCollection/PaymentEndpointCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class PaymentEndpointCollection extends EndpointCollection
*
* Will throw a ApiException if the payment id is invalid or the resource cannot be found.
*
*
* @param array|GetPaymentQuery $query
* @throws ApiException
*/
public function get(string $id, $query = [], bool $testmode = false): Payment
Expand Down
3 changes: 2 additions & 1 deletion tests/Http/Requests/GetPaginatedPaymentsRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Mollie\Api\Http\Requests\DynamicGetRequest;
use Mollie\Api\Http\Requests\GetPaginatedPaymentsRequest;
use Mollie\Api\Http\Response;
use Mollie\Api\MollieApiClient;
use Mollie\Api\Resources\LazyCollection;
use Mollie\Api\Resources\Payment;
use Mollie\Api\Resources\PaymentCollection;
Expand Down Expand Up @@ -42,7 +43,7 @@ public function it_can_get_paginated_payments()
/** @test */
public function it_can_iterate_over_payments()
{
$client = new MockMollieClient([
$client = MollieApiClient::fake([
GetPaginatedPaymentsRequest::class => MockResponse::ok('payment-list'),
DynamicGetRequest::class => new SequenceMockResponse(
MockResponse::ok('payment-list'),
Expand Down
9 changes: 3 additions & 6 deletions tests/Http/Requests/GetPaymentRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Tests\Http\Requests;

use Mollie\Api\Fake\MockMollieClient;
use Mollie\Api\Fake\MockResponse;
use Mollie\Api\Http\Requests\GetPaymentRequest;
use Mollie\Api\MollieApiClient;
use Mollie\Api\Resources\Payment;
use PHPUnit\Framework\TestCase;

Expand All @@ -13,15 +13,12 @@ class GetPaymentRequestTest extends TestCase
/** @test */
public function it_can_get_payment()
{
$client = new MockMollieClient([
$client = MollieApiClient::fake([
GetPaymentRequest::class => MockResponse::ok('payment'),
]);

$paymentId = 'tr_WDqYK6vllg';
$request = new GetPaymentRequest($paymentId);

/** @var Payment */
$payment = $client->send($request);
$payment = $client->send(new GetPaymentRequest('tr_WDqYK6vllg'));

$this->assertTrue($payment->getResponse()->successful());
$this->assertInstanceOf(Payment::class, $payment);
Expand Down

0 comments on commit 7e6b6a6

Please sign in to comment.