Skip to content

Commit

Permalink
Merge pull request #63 from gopaycommunity/feature/refunds
Browse files Browse the repository at this point in the history
Added history of refunds
  • Loading branch information
pmaryska authored Sep 3, 2024
2 parents 9e9ad09 + 2a284d7 commit 2845fe5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Payments.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ public function deleteCard($cardId)
return $this->delete("/payments/cards/{$cardId}");
}

public function getHistoryRefunds($id)
{
return $this->get("/payments/payment/{$id}/refunds");
}

public function getPaymentInstruments($goid, $currency)
{
return $this->get("/eshops/eshop/{$goid}/payment-instruments/{$currency}");
Expand Down
18 changes: 18 additions & 0 deletions tests/integration/RefundTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace GoPay;

use PHPUnit\Framework\TestCase;
use function PHPUnit\Framework\assertArrayNotHasKey;
use function PHPUnit\Framework\assertNotEmpty;
use function PHPUnit\Framework\assertArrayHasKey;
use function PHPUnit\Framework\assertEquals;
Expand Down Expand Up @@ -41,4 +42,21 @@ public function testRefundPayment()

echo print_r($response->json, true);
}

public function testHistoryOfRefunds()
{
{
$cardId = 3178283550;

$response = $this->gopay->getHistoryRefunds($cardId);
$responseBody = $response->json;

echo print_r($responseBody, true);

assertNotEmpty($responseBody);
assertArrayNotHasKey('errors', $responseBody);

echo print_r($responseBody, true);
}
}
}

0 comments on commit 2845fe5

Please sign in to comment.