Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
sandervanhooft committed Oct 23, 2023
1 parent da23822 commit a9e44b3
Showing 1 changed file with 88 additions and 0 deletions.
88 changes: 88 additions & 0 deletions tests/Mollie/API/Endpoints/SettlementChargebackEndpointTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<?php
declare(strict_types=1);

namespace Tests\Mollie\API\Endpoints;

use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\Response;
use Mollie\Api\Resources\Chargeback;
use Mollie\Api\Resources\ChargebackCollection;
use Mollie\Api\Resources\Settlement;

class SettlementChargebackEndpointTest extends BaseEndpointTest

Check failure on line 12 in tests/Mollie/API/Endpoints/SettlementChargebackEndpointTest.php

View workflow job for this annotation

GitHub Actions / PHP - 7.3

Class Tests\Mollie\Api\Endpoints\BaseEndpointTest referenced with incorrect case: Tests\Mollie\API\Endpoints\BaseEndpointTest.

Check failure on line 12 in tests/Mollie/API/Endpoints/SettlementChargebackEndpointTest.php

View workflow job for this annotation

GitHub Actions / PHP - 7.4

Class Tests\Mollie\Api\Endpoints\BaseEndpointTest referenced with incorrect case: Tests\Mollie\API\Endpoints\BaseEndpointTest.

Check failure on line 12 in tests/Mollie/API/Endpoints/SettlementChargebackEndpointTest.php

View workflow job for this annotation

GitHub Actions / PHP - 8

Class Tests\Mollie\Api\Endpoints\BaseEndpointTest referenced with incorrect case: Tests\Mollie\API\Endpoints\BaseEndpointTest.

Check failure on line 12 in tests/Mollie/API/Endpoints/SettlementChargebackEndpointTest.php

View workflow job for this annotation

GitHub Actions / PHP - 8.1

Class Tests\Mollie\Api\Endpoints\BaseEndpointTest referenced with incorrect case: Tests\Mollie\API\Endpoints\BaseEndpointTest.

Check failure on line 12 in tests/Mollie/API/Endpoints/SettlementChargebackEndpointTest.php

View workflow job for this annotation

GitHub Actions / PHP - 8.2

Class Tests\Mollie\Api\Endpoints\BaseEndpointTest referenced with incorrect case: Tests\Mollie\API\Endpoints\BaseEndpointTest.
{
public function testListSettlementChargebacks()
{
$this->mockApiCall(
new Request(
'GET',
'/v2/settlements/stl_jDk30akdN/chargebacks?limit=5&foo=bar'
),
new Response(
200,
[],
'{
"count": 1,
"_embedded": {
"chargebacks": [
{
"resource": "chargeback",
"id": "chb_n9z0tp",
"amount": {
"value": "43.38",
"currency": "USD"
},
"settlementAmount": {
"value": "-37.14",
"currency": "EUR"
},
"createdAt": "2018-03-14T17:00:52.0Z",
"reversedAt": null,
"paymentId": "tr_WDqYK6vllg",
"settlementId": "stl_jDk30akdN",
"_links": {
"self": {
"href": "https://api.mollie.com/v2/payments/tr_WDqYK6vllg/chargebacks/chb_n9z0tp",
"type": "application/hal+json"
},
"payment": {
"href": "https://api.mollie.com/v2/payments/tr_WDqYK6vllg",
"type": "application/hal+json"
},
"settlement": {
"href": "https://api.mollie.com/v2/settlements/stl_jDk30akdN",
"type": "application/hal+json"
}
}
}
]
},
"_links": {
"documentation": {
"href": "https://docs.mollie.com/reference/v2/settlements-api/list-settlement-chargebacks",
"type": "text/html"
},
"self": {
"href": "https://api.mollie.com/v2/settlements/stl_jDk30akdN/chargebacks",
"type": "application/hal+json"
},
"previous": null,
"next": null
}
}'
)
);

$settlement = new Settlement($this->apiClient);
$settlement->id = 'stl_jDk30akdN';

$chargebacks = $settlement->chargebacks(5, ['foo' => 'bar']);

$this->assertInstanceOf(ChargebackCollection::class, $chargebacks);
$this->assertCount(1, $chargebacks);

$chargeback = $chargebacks[0];
$this->assertInstanceOf(Chargeback::class, $chargeback);
$this->assertEquals("chb_n9z0tp", $chargeback->id);
}
}

0 comments on commit a9e44b3

Please sign in to comment.