Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lago_python_client/invoices/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from ..base_client import BaseClient
from ..mixins import (
CreateCommandMixin,
DestroyCommandMixin,
FindAllCommandMixin,
FindCommandMixin,
UpdateCommandMixin,
Expand All @@ -24,6 +25,7 @@ class InvoiceClient(
FindAllCommandMixin[InvoiceResponse],
UpdateCommandMixin[InvoiceResponse],
CreateCommandMixin[InvoiceResponse],
DestroyCommandMixin[InvoiceResponse],
BaseClient,
):
API_RESOURCE: ClassVar[str] = "invoices"
Expand Down
26 changes: 26 additions & 0 deletions tests/test_invoice_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,32 @@ def test_valid_void_invoice_request(httpx_mock: HTTPXMock):
assert response.lago_id == "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"


def test_valid_destroy_invoice_request(httpx_mock: HTTPXMock):
client = Client(api_key="886fe239-927d-4072-ab72-6dd345e8dd0d")

httpx_mock.add_response(
method="DELETE",
url="https://api.getlago.com/api/v1/invoices/5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
content=mock_response(),
)
response = client.invoices.destroy("5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba")

assert response.lago_id == "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"


def test_invalid_destroy_invoice_request(httpx_mock: HTTPXMock):
client = Client(api_key="886fe239-927d-4072-ab72-6dd345e8dd0d")

httpx_mock.add_response(
method="DELETE",
url="https://api.getlago.com/api/v1/invoices/5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
status_code=422,
content=b"",
)
with pytest.raises(LagoApiError):
client.invoices.destroy("5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba")


def test_valid_retry_payment_invoice_request(httpx_mock: HTTPXMock):
client = Client(api_key="886fe239-927d-4072-ab72-6dd345e8dd0d")

Expand Down
Loading