From d67b7aa1d39f541ae6ee31516239f97e4d6d128c Mon Sep 17 00:00:00 2001 From: pmaryska Date: Tue, 3 Sep 2024 14:12:37 +0200 Subject: [PATCH] Added history of refunds --- gopay/payments.py | 6 ++++++ pyproject.toml | 2 +- tests/test_api_payment.py | 8 ++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/gopay/payments.py b/gopay/payments.py index d5b4afd..1597d32 100644 --- a/gopay/payments.py +++ b/gopay/payments.py @@ -134,6 +134,12 @@ def refund_payment_eet(self, payment_id: int | str, payment_data: dict) -> Respo payment_data, ) + def get_history_of_refunds(self, payment_id: int | str) -> Response: + """ + https://doc.gopay.com/#history-of-refunds + """ + return self.gopay.call("GET", f"/payments/payment/{payment_id}/refunds") + def get_eet_receipt_by_payment_id(self, payment_id: int | str) -> Response: return self.gopay.call("GET", f"/payments/payment/{payment_id}/eet-receipts") diff --git a/pyproject.toml b/pyproject.toml index 46c082e..14c7425 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,7 +14,7 @@ name = "gopay" packages = [{include = "gopay"}] readme = "README.md" repository = "https://github.com/gopaycommunity/gopay-python-api" -version = "2.0.2" +version = "2.0.3" [tool.poetry.dependencies] deprecated = "^1.2.14" diff --git a/tests/test_api_payment.py b/tests/test_api_payment.py index 76e4a79..7fd1060 100644 --- a/tests/test_api_payment.py +++ b/tests/test_api_payment.py @@ -36,3 +36,11 @@ def test_payment_status(self, payments: Payments): assert "errors" not in response_body assert response_body["id"] == payment_id assert response_body["state"] == "REFUNDED" + + def test_history_refunds(self, payments: Payments): + response = payments.get_history_of_refunds(3178283550) + assert response.success + response_body = response.json + logging.info(response_body) + + assert "errors" not in response_body \ No newline at end of file