Skip to content

Commit

Permalink
Added history of refunds
Browse files Browse the repository at this point in the history
  • Loading branch information
pmaryska committed Sep 3, 2024
1 parent 7ac11c1 commit d67b7aa
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
6 changes: 6 additions & 0 deletions gopay/payments.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 8 additions & 0 deletions tests/test_api_payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit d67b7aa

Please sign in to comment.