Skip to content

Commit

Permalink
Merge pull request #75 from paytrail/fixRequestSettlementsUrlParameters
Browse files Browse the repository at this point in the history
Fix requestSettlements url parameters
  • Loading branch information
VuorelaJ-P authored Apr 19, 2023
2 parents ed22be2 + 713c86a commit 1b1c293
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,12 @@ public function requestSettlements(SettlementRequest $settlementRequest)

$uri = '/settlements';

$query = http_build_query($settlementRequest->jsonSerialize());

if (!empty($query)) {
$uri .= '?' . $query;
}

return $this->get(
$uri,
function ($decoded) {
Expand Down
6 changes: 6 additions & 0 deletions tests/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,12 @@ public function testRequestSettlementsWithInvalidDateThrowsException()
}

public function testRequestSettlementsReturnsValidResponse()
{
$settlementRequest = (new SettlementRequest());
$this->client->requestSettlements($settlementRequest);
}

public function testGetSettlementsReturnsValidResponse()
{
$settlementRequest = new SettlementRequest();
$settlementResponse = $this->client->requestSettlements($settlementRequest);
Expand Down

0 comments on commit 1b1c293

Please sign in to comment.