lago-python-client 1.19.0__tar.gz → 1.26.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/PKG-INFO +3 -2
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/client.py +10 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/customers/clients.py +9 -5
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/invoices/clients.py +17 -1
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/__init__.py +7 -1
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/coupon.py +4 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/customer.py +2 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/fee.py +1 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/invoice.py +14 -2
- lago_python_client-1.26.0/lago_python_client/models/payment.py +26 -0
- lago_python_client-1.26.0/lago_python_client/models/payment_receipt.py +15 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/subscription.py +6 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/wallet.py +3 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/wallet_transaction.py +1 -0
- lago_python_client-1.26.0/lago_python_client/payment_receipts/clients.py +15 -0
- lago_python_client-1.26.0/lago_python_client/payments/clients.py +16 -0
- lago_python_client-1.26.0/lago_python_client/version.py +1 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/wallets/clients.py +12 -0
- lago_python_client-1.26.0/lago_python_client/webhooks/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client.egg-info/PKG-INFO +3 -2
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client.egg-info/SOURCES.txt +16 -0
- lago_python_client-1.26.0/tests/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/tests/test_customer_client.py +19 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/tests/test_invoice_client.py +23 -0
- lago_python_client-1.26.0/tests/test_payment_client.py +108 -0
- lago_python_client-1.26.0/tests/test_payment_receipt_client.py +65 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/tests/test_wallet_transaction_client.py +25 -0
- lago_python_client-1.19.0/lago_python_client/version.py +0 -1
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/LICENSE +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/README.md +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/add_ons/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/add_ons/clients.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/base_client.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/base_model.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/billable_metrics/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/billable_metrics/clients.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/coupons/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/coupons/clients.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/credit_notes/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/credit_notes/clients.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/customers/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/events/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/events/clients.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/exceptions.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/fees/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/fees/clients.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/functools_ext.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/gross_revenues/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/gross_revenues/clients.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/invoice_collections/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/invoice_collections/clients.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/invoiced_usages/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/invoiced_usages/clients.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/invoices/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/mixins.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/add_on.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/applied_coupon.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/billable_metric.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/billing_period.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/charge.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/credit.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/credit_note.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/customer_usage.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/error_detail.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/event.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/gross_revenue.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/invoice_collection.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/invoice_item.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/invoiced_usage.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/lifetime_usage.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/minimum_commitment.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/mrr.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/organization.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/overdue_balance.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/payment_request.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/plan.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/tax.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/usage_threshold.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/webhook_endpoint.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/mrrs/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/mrrs/clients.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/organizations/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/organizations/clients.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/overdue_balances/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/overdue_balances/clients.py +0 -0
- {lago_python_client-1.19.0/lago_python_client/payment_requests → lago_python_client-1.26.0/lago_python_client/payment_receipts}/__init__.py +0 -0
- {lago_python_client-1.19.0/lago_python_client/plans → lago_python_client-1.26.0/lago_python_client/payment_requests}/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/payment_requests/clients.py +0 -0
- {lago_python_client-1.19.0/lago_python_client/services → lago_python_client-1.26.0/lago_python_client/payments}/__init__.py +0 -0
- {lago_python_client-1.19.0/lago_python_client/subscriptions → lago_python_client-1.26.0/lago_python_client/plans}/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/plans/clients.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/py.typed +0 -0
- {lago_python_client-1.19.0/lago_python_client/taxes → lago_python_client-1.26.0/lago_python_client/services}/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/services/json.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/services/request.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/services/response.py +0 -0
- {lago_python_client-1.19.0/lago_python_client/wallets → lago_python_client-1.26.0/lago_python_client/subscriptions}/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/subscriptions/clients.py +0 -0
- {lago_python_client-1.19.0/lago_python_client/webhook_endpoints → lago_python_client-1.26.0/lago_python_client/taxes}/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/taxes/clients.py +0 -0
- {lago_python_client-1.19.0/lago_python_client/webhooks → lago_python_client-1.26.0/lago_python_client/wallets}/__init__.py +0 -0
- {lago_python_client-1.19.0/tests → lago_python_client-1.26.0/lago_python_client/webhook_endpoints}/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/webhook_endpoints/clients.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/webhooks/clients.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client.egg-info/dependency_links.txt +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client.egg-info/requires.txt +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client.egg-info/top_level.txt +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/pyproject.toml +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/setup.cfg +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/tests/test_add_on_client.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/tests/test_applied_coupon_client.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/tests/test_billable_metric_client.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/tests/test_client.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/tests/test_coupon_client.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/tests/test_credit_note_client.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/tests/test_event_client.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/tests/test_fee_client.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/tests/test_functools_ext.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/tests/test_gross_revenue_client.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/tests/test_invoice_collection_client.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/tests/test_invoiced_usage_client.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/tests/test_json_services.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/tests/test_mrr_client.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/tests/test_organization_client.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/tests/test_overdue_balance_client.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/tests/test_payment_request_client.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/tests/test_plan_client.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/tests/test_request_services.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/tests/test_response_services.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/tests/test_subscription_client.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/tests/test_tax_client.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/tests/test_wallet_client.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/tests/test_webhook_client.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.26.0}/tests/test_webhook_endpoint_client.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: lago-python-client
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.26.0
|
|
4
4
|
Summary: Lago Python API Client
|
|
5
5
|
Home-page: https://github.com/getlago/lago-python-client
|
|
6
6
|
Author: Lovro Colic
|
|
@@ -29,6 +29,7 @@ Provides-Extra: test
|
|
|
29
29
|
Requires-Dist: mypy==0.971; extra == "test"
|
|
30
30
|
Requires-Dist: pytest; extra == "test"
|
|
31
31
|
Requires-Dist: pytest_httpx; extra == "test"
|
|
32
|
+
Dynamic: license-file
|
|
32
33
|
|
|
33
34
|
# Lago Python Client
|
|
34
35
|
|
|
@@ -14,7 +14,9 @@ from .invoiced_usages.clients import InvoicedUsageClient
|
|
|
14
14
|
from .mrrs.clients import MrrClient
|
|
15
15
|
from .organizations.clients import OrganizationClient
|
|
16
16
|
from .overdue_balances.clients import OverdueBalanceClient
|
|
17
|
+
from .payment_receipts.clients import PaymentReceiptClient
|
|
17
18
|
from .payment_requests.clients import PaymentRequestClient
|
|
19
|
+
from .payments.clients import PaymentClient
|
|
18
20
|
from .invoice_collections.clients import InvoiceCollectionClient
|
|
19
21
|
from .plans.clients import PlanClient
|
|
20
22
|
from .subscriptions.clients import SubscriptionClient
|
|
@@ -114,10 +116,18 @@ class Client:
|
|
|
114
116
|
def overdue_balances(self) -> OverdueBalanceClient:
|
|
115
117
|
return OverdueBalanceClient(self.base_api_url, self.api_key)
|
|
116
118
|
|
|
119
|
+
@callable_cached_property
|
|
120
|
+
def payment_receipts(self) -> PaymentReceiptClient:
|
|
121
|
+
return PaymentReceiptClient(self.base_api_url, self.api_key)
|
|
122
|
+
|
|
117
123
|
@callable_cached_property
|
|
118
124
|
def payment_requests(self) -> PaymentRequestClient:
|
|
119
125
|
return PaymentRequestClient(self.base_api_url, self.api_key)
|
|
120
126
|
|
|
127
|
+
@callable_cached_property
|
|
128
|
+
def payments(self) -> PaymentClient:
|
|
129
|
+
return PaymentClient(self.base_api_url, self.api_key)
|
|
130
|
+
|
|
121
131
|
@callable_cached_property
|
|
122
132
|
def invoice_collections(self) -> InvoiceCollectionClient:
|
|
123
133
|
return InvoiceCollectionClient(self.base_api_url, self.api_key)
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/customers/clients.py
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import sys
|
|
2
|
-
from typing import Any, Mapping, ClassVar, Type
|
|
2
|
+
from typing import Any, Mapping, ClassVar, Type, Optional
|
|
3
3
|
|
|
4
4
|
from ..base_client import BaseClient
|
|
5
5
|
from ..mixins import (
|
|
@@ -35,14 +35,18 @@ class CustomerClient(
|
|
|
35
35
|
RESPONSE_MODEL: ClassVar[Type[CustomerResponse]] = CustomerResponse
|
|
36
36
|
ROOT_NAME: ClassVar[str] = "customer"
|
|
37
37
|
|
|
38
|
-
def current_usage(
|
|
38
|
+
def current_usage(
|
|
39
|
+
self, resource_id: str, external_subscription_id: str, apply_taxes: Optional[str] = None
|
|
40
|
+
) -> CustomerUsageResponse:
|
|
41
|
+
query_params = {"external_subscription_id": external_subscription_id}
|
|
42
|
+
if apply_taxes is not None:
|
|
43
|
+
query_params["apply_taxes"] = apply_taxes
|
|
44
|
+
|
|
39
45
|
api_response: Response = send_get_request(
|
|
40
46
|
url=make_url(
|
|
41
47
|
origin=self.base_url,
|
|
42
48
|
path_parts=(self.API_RESOURCE, resource_id, "current_usage"),
|
|
43
|
-
query_pairs=
|
|
44
|
-
"external_subscription_id": external_subscription_id,
|
|
45
|
-
},
|
|
49
|
+
query_pairs=query_params,
|
|
46
50
|
),
|
|
47
51
|
headers=make_headers(api_key=self.api_key),
|
|
48
52
|
)
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/invoices/clients.py
RENAMED
|
@@ -7,7 +7,8 @@ from ..mixins import (
|
|
|
7
7
|
UpdateCommandMixin,
|
|
8
8
|
CreateCommandMixin,
|
|
9
9
|
)
|
|
10
|
-
from ..models.invoice import InvoiceResponse
|
|
10
|
+
from ..models.invoice import InvoicePreview, InvoiceResponse
|
|
11
|
+
from ..services.json import to_json
|
|
11
12
|
from ..services.request import (
|
|
12
13
|
make_headers,
|
|
13
14
|
make_url,
|
|
@@ -131,3 +132,18 @@ class InvoiceClient(
|
|
|
131
132
|
|
|
132
133
|
response_data = get_response_data(response=api_response, key="invoice_payment_details")
|
|
133
134
|
return response_data.get("payment_url", "") if isinstance(response_data, Mapping) else ""
|
|
135
|
+
|
|
136
|
+
def preview(self, input_object: InvoicePreview) -> InvoiceResponse:
|
|
137
|
+
api_response: Response = send_post_request(
|
|
138
|
+
url=make_url(
|
|
139
|
+
origin=self.base_url,
|
|
140
|
+
path_parts=(self.API_RESOURCE, "preview"),
|
|
141
|
+
),
|
|
142
|
+
content=to_json(input_object.dict()),
|
|
143
|
+
headers=make_headers(api_key=self.api_key),
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
return prepare_object_response(
|
|
147
|
+
response_model=InvoiceResponse,
|
|
148
|
+
data=get_response_data(response=api_response, key=self.ROOT_NAME),
|
|
149
|
+
)
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/__init__.py
RENAMED
|
@@ -18,7 +18,7 @@ from .charge import (
|
|
|
18
18
|
ChargeFilters as ChargeFilters,
|
|
19
19
|
ChargeFilter as ChargeFilter,
|
|
20
20
|
)
|
|
21
|
-
from .coupon import Coupon as Coupon, LimitationConfiguration as LimitationConfiguration
|
|
21
|
+
from .coupon import Coupon as Coupon, CouponsList as CouponsList, LimitationConfiguration as LimitationConfiguration
|
|
22
22
|
from .credit import CreditResponse as CreditResponse, CreditsResponse as CreditsResponse
|
|
23
23
|
from .credit_note import (
|
|
24
24
|
Item as Item,
|
|
@@ -54,6 +54,7 @@ from .invoice import (
|
|
|
54
54
|
InvoiceMetadata as InvoiceMetadata,
|
|
55
55
|
InvoiceMetadataList as InvoiceMetadataList,
|
|
56
56
|
OneOffInvoice as OneOffInvoice,
|
|
57
|
+
InvoicePreview as InvoicePreview,
|
|
57
58
|
InvoiceFeesList as InvoiceFeesList,
|
|
58
59
|
InvoiceFee as InvoiceFee,
|
|
59
60
|
)
|
|
@@ -89,5 +90,10 @@ from .usage_threshold import (
|
|
|
89
90
|
UsageThresholds as UsageThresholds,
|
|
90
91
|
UsageThresholdsResponse as UsageThresholdsResponse,
|
|
91
92
|
)
|
|
93
|
+
from .payment_receipt import (
|
|
94
|
+
PaymentReceiptResponse as PaymentReceiptResponse,
|
|
95
|
+
PaymentReceiptsResponse as PaymentReceiptsResponse,
|
|
96
|
+
)
|
|
92
97
|
from .payment_request import PaymentRequest as PaymentRequest
|
|
98
|
+
from .payment import Payment as Payment
|
|
93
99
|
from .lifetime_usage import LifetimeUsageResponse as LifetimeUsageResponse
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/customer.py
RENAMED
|
@@ -120,6 +120,7 @@ class Customer(BaseModel):
|
|
|
120
120
|
tax_codes: Optional[List[str]]
|
|
121
121
|
skip_invoice_custom_sections: Optional[bool]
|
|
122
122
|
invoice_custom_section_codes: Optional[List[str]]
|
|
123
|
+
billing_entity_code: Optional[str]
|
|
123
124
|
|
|
124
125
|
|
|
125
126
|
class CustomerResponse(BaseResponseModel):
|
|
@@ -156,3 +157,4 @@ class CustomerResponse(BaseResponseModel):
|
|
|
156
157
|
taxes: Optional[TaxesResponse]
|
|
157
158
|
skip_invoice_custom_sections: Optional[bool]
|
|
158
159
|
applicable_invoice_custom_sections: Optional[InvoiceCustomSectionsResponseList]
|
|
160
|
+
billing_entity_code: Optional[str]
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/invoice.py
RENAMED
|
@@ -3,10 +3,11 @@ from typing import List, Optional
|
|
|
3
3
|
from lago_python_client.base_model import BaseModel
|
|
4
4
|
|
|
5
5
|
from .billing_period import BillingPeriodsResponse
|
|
6
|
+
from .coupon import CouponsList
|
|
6
7
|
from .credit import CreditsResponse
|
|
7
|
-
from .customer import CustomerResponse
|
|
8
|
+
from .customer import Customer, CustomerResponse
|
|
8
9
|
from .fee import FeesResponse
|
|
9
|
-
from .subscription import SubscriptionsResponse
|
|
10
|
+
from .subscription import Subscriptions, SubscriptionsResponse
|
|
10
11
|
from .error_detail import ErrorDetailsResponse
|
|
11
12
|
from ..base_model import BaseResponseModel
|
|
12
13
|
from .usage_threshold import UsageThreshold
|
|
@@ -52,6 +53,15 @@ class OneOffInvoice(BaseModel):
|
|
|
52
53
|
error_details: Optional[ErrorDetailsResponse]
|
|
53
54
|
|
|
54
55
|
|
|
56
|
+
class InvoicePreview(BaseModel):
|
|
57
|
+
plan_code: Optional[str]
|
|
58
|
+
billing_time: Optional[str]
|
|
59
|
+
subscription_at: Optional[str]
|
|
60
|
+
coupons: Optional[CouponsList]
|
|
61
|
+
customer: Optional[Customer]
|
|
62
|
+
subscriptions: Optional[Subscriptions]
|
|
63
|
+
|
|
64
|
+
|
|
55
65
|
class InvoiceAppliedTax(BaseResponseModel):
|
|
56
66
|
lago_id: Optional[str]
|
|
57
67
|
lago_invoice_id: Optional[str]
|
|
@@ -115,6 +125,7 @@ class InvoiceResponse(BaseResponseModel):
|
|
|
115
125
|
sub_total_excluding_taxes_amount_cents: int
|
|
116
126
|
sub_total_including_taxes_amount_cents: int
|
|
117
127
|
total_amount_cents: int
|
|
128
|
+
total_due_amount_cents: int
|
|
118
129
|
prepaid_credit_amount_cents: int
|
|
119
130
|
|
|
120
131
|
file_url: Optional[str]
|
|
@@ -128,3 +139,4 @@ class InvoiceResponse(BaseResponseModel):
|
|
|
128
139
|
applied_invoice_custom_sections: Optional[InvoiceAppliedInvoiceCustomSections]
|
|
129
140
|
applied_usage_thresholds: Optional[InvoiceAppliedUsageThresholds]
|
|
130
141
|
error_details: Optional[ErrorDetailsResponse]
|
|
142
|
+
billing_entity_code: Optional[str]
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from typing import List, Optional
|
|
2
|
+
|
|
3
|
+
from ..base_model import BaseModel, BaseResponseModel
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Payment(BaseModel):
|
|
7
|
+
invoice_id: str
|
|
8
|
+
amount_cents: int
|
|
9
|
+
reference: str
|
|
10
|
+
paid_at: Optional[str]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class PaymentResponse(BaseResponseModel):
|
|
14
|
+
lago_id: str
|
|
15
|
+
invoice_ids: List[str]
|
|
16
|
+
amount_cents: int
|
|
17
|
+
amount_currency: str
|
|
18
|
+
payment_status: str
|
|
19
|
+
type: str
|
|
20
|
+
reference: str
|
|
21
|
+
external_payment_id: Optional[str]
|
|
22
|
+
created_at: str
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class PaymentsResponse(BaseResponseModel):
|
|
26
|
+
__root__: List[PaymentResponse]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from typing import List
|
|
2
|
+
|
|
3
|
+
from ..base_model import BaseResponseModel
|
|
4
|
+
from .payment import PaymentResponse
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class PaymentReceiptResponse(BaseResponseModel):
|
|
8
|
+
lago_id: str
|
|
9
|
+
number: str
|
|
10
|
+
payment: PaymentResponse
|
|
11
|
+
created_at: str
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class PaymentReceiptsResponse(BaseResponseModel):
|
|
15
|
+
__root__: List[PaymentReceiptResponse]
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/subscription.py
RENAMED
|
@@ -16,6 +16,12 @@ class Subscription(BaseModel):
|
|
|
16
16
|
plan_overrides: Optional[PlanOverrides]
|
|
17
17
|
|
|
18
18
|
|
|
19
|
+
class Subscriptions(BaseModel):
|
|
20
|
+
external_ids: Optional[List[str]]
|
|
21
|
+
plan_code: Optional[str]
|
|
22
|
+
terminated_at: Optional[str]
|
|
23
|
+
|
|
24
|
+
|
|
19
25
|
class SubscriptionResponse(BaseResponseModel):
|
|
20
26
|
lago_id: str
|
|
21
27
|
lago_customer_id: Optional[str]
|
|
@@ -14,6 +14,7 @@ class RecurringTransactionRule(BaseModel):
|
|
|
14
14
|
paid_credits: Optional[str]
|
|
15
15
|
granted_credits: Optional[str]
|
|
16
16
|
started_at: Optional[str]
|
|
17
|
+
expiration_at: Optional[str]
|
|
17
18
|
target_ongoing_balance: Optional[str]
|
|
18
19
|
transaction_metadata: Optional[List[Dict[str, str]]]
|
|
19
20
|
|
|
@@ -27,6 +28,8 @@ class RecurringTransactionRuleResponse(BaseModel):
|
|
|
27
28
|
paid_credits: Optional[str]
|
|
28
29
|
granted_credits: Optional[str]
|
|
29
30
|
started_at: Optional[str]
|
|
31
|
+
expiration_at: Optional[str]
|
|
32
|
+
status: Optional[str]
|
|
30
33
|
target_ongoing_balance: Optional[str]
|
|
31
34
|
created_at: Optional[str]
|
|
32
35
|
transaction_metadata: Optional[List[Dict[str, str]]]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from typing import ClassVar, Type
|
|
2
|
+
|
|
3
|
+
from ..base_client import BaseClient
|
|
4
|
+
from ..mixins import FindAllCommandMixin, FindCommandMixin
|
|
5
|
+
from ..models.payment_receipt import PaymentReceiptResponse
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class PaymentReceiptClient(
|
|
9
|
+
FindAllCommandMixin[PaymentReceiptResponse],
|
|
10
|
+
FindCommandMixin[PaymentReceiptResponse],
|
|
11
|
+
BaseClient,
|
|
12
|
+
):
|
|
13
|
+
API_RESOURCE: ClassVar[str] = "payment_receipts"
|
|
14
|
+
RESPONSE_MODEL: ClassVar[Type[PaymentReceiptResponse]] = PaymentReceiptResponse
|
|
15
|
+
ROOT_NAME: ClassVar[str] = "payment_receipt"
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from typing import ClassVar, Type
|
|
2
|
+
|
|
3
|
+
from ..base_client import BaseClient
|
|
4
|
+
from ..mixins import CreateCommandMixin, FindAllCommandMixin, FindCommandMixin
|
|
5
|
+
from ..models.payment import PaymentResponse
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class PaymentClient(
|
|
9
|
+
CreateCommandMixin[PaymentResponse],
|
|
10
|
+
FindAllCommandMixin[PaymentResponse],
|
|
11
|
+
FindCommandMixin[PaymentResponse],
|
|
12
|
+
BaseClient,
|
|
13
|
+
):
|
|
14
|
+
API_RESOURCE: ClassVar[str] = "payments"
|
|
15
|
+
RESPONSE_MODEL: ClassVar[Type[PaymentResponse]] = PaymentResponse
|
|
16
|
+
ROOT_NAME: ClassVar[str] = "payment"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
LAGO_VERSION = "1.26.0"
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/wallets/clients.py
RENAMED
|
@@ -77,3 +77,15 @@ class WalletTransactionClient(BaseClient):
|
|
|
77
77
|
response_model=self.RESPONSE_MODEL,
|
|
78
78
|
data=get_response_data(response=api_response),
|
|
79
79
|
)
|
|
80
|
+
|
|
81
|
+
def payment_url(self, resource_id: str) -> str:
|
|
82
|
+
api_response: Response = send_post_request(
|
|
83
|
+
url=make_url(
|
|
84
|
+
origin=self.base_url,
|
|
85
|
+
path_parts=(self.API_RESOURCE, resource_id, "payment_url"),
|
|
86
|
+
),
|
|
87
|
+
headers=make_headers(api_key=self.api_key),
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
response_data = get_response_data(response=api_response, key="wallet_transaction_payment_details")
|
|
91
|
+
return response_data.get("payment_url", "") if isinstance(response_data, Mapping) else ""
|
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client.egg-info/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: lago-python-client
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.26.0
|
|
4
4
|
Summary: Lago Python API Client
|
|
5
5
|
Home-page: https://github.com/getlago/lago-python-client
|
|
6
6
|
Author: Lovro Colic
|
|
@@ -29,6 +29,7 @@ Provides-Extra: test
|
|
|
29
29
|
Requires-Dist: mypy==0.971; extra == "test"
|
|
30
30
|
Requires-Dist: pytest; extra == "test"
|
|
31
31
|
Requires-Dist: pytest_httpx; extra == "test"
|
|
32
|
+
Dynamic: license-file
|
|
32
33
|
|
|
33
34
|
# Lago Python Client
|
|
34
35
|
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client.egg-info/SOURCES.txt
RENAMED
|
@@ -57,6 +57,8 @@ setup.cfg
|
|
|
57
57
|
./lago_python_client/models/mrr.py
|
|
58
58
|
./lago_python_client/models/organization.py
|
|
59
59
|
./lago_python_client/models/overdue_balance.py
|
|
60
|
+
./lago_python_client/models/payment.py
|
|
61
|
+
./lago_python_client/models/payment_receipt.py
|
|
60
62
|
./lago_python_client/models/payment_request.py
|
|
61
63
|
./lago_python_client/models/plan.py
|
|
62
64
|
./lago_python_client/models/subscription.py
|
|
@@ -71,8 +73,12 @@ setup.cfg
|
|
|
71
73
|
./lago_python_client/organizations/clients.py
|
|
72
74
|
./lago_python_client/overdue_balances/__init__.py
|
|
73
75
|
./lago_python_client/overdue_balances/clients.py
|
|
76
|
+
./lago_python_client/payment_receipts/__init__.py
|
|
77
|
+
./lago_python_client/payment_receipts/clients.py
|
|
74
78
|
./lago_python_client/payment_requests/__init__.py
|
|
75
79
|
./lago_python_client/payment_requests/clients.py
|
|
80
|
+
./lago_python_client/payments/__init__.py
|
|
81
|
+
./lago_python_client/payments/clients.py
|
|
76
82
|
./lago_python_client/plans/__init__.py
|
|
77
83
|
./lago_python_client/plans/clients.py
|
|
78
84
|
./lago_python_client/services/__init__.py
|
|
@@ -108,6 +114,8 @@ setup.cfg
|
|
|
108
114
|
./tests/test_mrr_client.py
|
|
109
115
|
./tests/test_organization_client.py
|
|
110
116
|
./tests/test_overdue_balance_client.py
|
|
117
|
+
./tests/test_payment_client.py
|
|
118
|
+
./tests/test_payment_receipt_client.py
|
|
111
119
|
./tests/test_payment_request_client.py
|
|
112
120
|
./tests/test_plan_client.py
|
|
113
121
|
./tests/test_request_services.py
|
|
@@ -178,6 +186,8 @@ lago_python_client/models/minimum_commitment.py
|
|
|
178
186
|
lago_python_client/models/mrr.py
|
|
179
187
|
lago_python_client/models/organization.py
|
|
180
188
|
lago_python_client/models/overdue_balance.py
|
|
189
|
+
lago_python_client/models/payment.py
|
|
190
|
+
lago_python_client/models/payment_receipt.py
|
|
181
191
|
lago_python_client/models/payment_request.py
|
|
182
192
|
lago_python_client/models/plan.py
|
|
183
193
|
lago_python_client/models/subscription.py
|
|
@@ -192,8 +202,12 @@ lago_python_client/organizations/__init__.py
|
|
|
192
202
|
lago_python_client/organizations/clients.py
|
|
193
203
|
lago_python_client/overdue_balances/__init__.py
|
|
194
204
|
lago_python_client/overdue_balances/clients.py
|
|
205
|
+
lago_python_client/payment_receipts/__init__.py
|
|
206
|
+
lago_python_client/payment_receipts/clients.py
|
|
195
207
|
lago_python_client/payment_requests/__init__.py
|
|
196
208
|
lago_python_client/payment_requests/clients.py
|
|
209
|
+
lago_python_client/payments/__init__.py
|
|
210
|
+
lago_python_client/payments/clients.py
|
|
197
211
|
lago_python_client/plans/__init__.py
|
|
198
212
|
lago_python_client/plans/clients.py
|
|
199
213
|
lago_python_client/services/__init__.py
|
|
@@ -229,6 +243,8 @@ tests/test_json_services.py
|
|
|
229
243
|
tests/test_mrr_client.py
|
|
230
244
|
tests/test_organization_client.py
|
|
231
245
|
tests/test_overdue_balance_client.py
|
|
246
|
+
tests/test_payment_client.py
|
|
247
|
+
tests/test_payment_receipt_client.py
|
|
232
248
|
tests/test_payment_request_client.py
|
|
233
249
|
tests/test_plan_client.py
|
|
234
250
|
tests/test_request_services.py
|
|
File without changes
|
|
@@ -30,6 +30,7 @@ def create_customer():
|
|
|
30
30
|
|
|
31
31
|
return Customer(
|
|
32
32
|
external_id="5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
|
|
33
|
+
billing_entity_code="test-company",
|
|
33
34
|
name="Gavin Belson",
|
|
34
35
|
currency="EUR",
|
|
35
36
|
tax_identification_number="EU123456789",
|
|
@@ -74,6 +75,7 @@ def test_valid_create_customers_request(httpx_mock: HTTPXMock):
|
|
|
74
75
|
response = client.customers.create(create_customer())
|
|
75
76
|
|
|
76
77
|
assert response.external_id == "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
|
|
78
|
+
assert response.billing_entity_code == "test-company"
|
|
77
79
|
assert response.name == "Gavin Belson"
|
|
78
80
|
assert response.email == "dinesh@piedpiper.test"
|
|
79
81
|
assert response.currency == "EUR"
|
|
@@ -129,6 +131,23 @@ def test_valid_current_usage(httpx_mock: HTTPXMock):
|
|
|
129
131
|
assert response.charges_usage[0].filters[0].values["country"] == ["france"]
|
|
130
132
|
|
|
131
133
|
|
|
134
|
+
def test_valid_current_usage_without_taxes(httpx_mock: HTTPXMock):
|
|
135
|
+
client = Client(api_key="886fe239-927d-4072-ab72-6dd345e8dd0d")
|
|
136
|
+
|
|
137
|
+
httpx_mock.add_response(
|
|
138
|
+
method="GET",
|
|
139
|
+
url="https://api.getlago.com/api/v1/customers/external_customer_id/current_usage?external_subscription_id=123&apply_taxes=false",
|
|
140
|
+
content=mock_response("customer_usage"),
|
|
141
|
+
)
|
|
142
|
+
response = client.customers.current_usage("external_customer_id", "123", "false")
|
|
143
|
+
|
|
144
|
+
assert response.from_datetime == "2022-07-01T00:00:00Z"
|
|
145
|
+
assert len(response.charges_usage) == 1
|
|
146
|
+
assert response.charges_usage[0].units == 1.0
|
|
147
|
+
assert len(response.charges_usage[0].filters) == 1
|
|
148
|
+
assert response.charges_usage[0].filters[0].values["country"] == ["france"]
|
|
149
|
+
|
|
150
|
+
|
|
132
151
|
def test_invalid_current_usage(httpx_mock: HTTPXMock):
|
|
133
152
|
client = Client(api_key="886fe239-927d-4072-ab72-6dd345e8dd0d")
|
|
134
153
|
|
|
@@ -6,7 +6,9 @@ from pytest_httpx import HTTPXMock
|
|
|
6
6
|
from lago_python_client.client import Client
|
|
7
7
|
from lago_python_client.exceptions import LagoApiError
|
|
8
8
|
from lago_python_client.models import (
|
|
9
|
+
Customer,
|
|
9
10
|
Invoice,
|
|
11
|
+
InvoicePreview,
|
|
10
12
|
InvoiceMetadata,
|
|
11
13
|
InvoiceMetadataList,
|
|
12
14
|
OneOffInvoice,
|
|
@@ -29,6 +31,12 @@ def one_off_invoice_object():
|
|
|
29
31
|
return OneOffInvoice(customer_external_id="external", currency="EUR", fees=fees_list)
|
|
30
32
|
|
|
31
33
|
|
|
34
|
+
def invoice_preview():
|
|
35
|
+
customer = Customer(name="John Doe", external_id="test1")
|
|
36
|
+
|
|
37
|
+
return InvoicePreview(customer=customer, plan_code="test", billing_time="anniversary", subscription_at="2025-01-24")
|
|
38
|
+
|
|
39
|
+
|
|
32
40
|
def mock_response(mock="invoice"):
|
|
33
41
|
this_dir = os.path.dirname(os.path.abspath(__file__))
|
|
34
42
|
my_data_path = os.path.join(this_dir, "fixtures/" + mock + ".json")
|
|
@@ -268,3 +276,18 @@ def test_valid_payment_url_request(httpx_mock: HTTPXMock):
|
|
|
268
276
|
response = client.invoices.payment_url("5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba")
|
|
269
277
|
|
|
270
278
|
assert response == "https://checkout.stripe.com/c/pay/cs_test_a1cuqFkXvH"
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
def test_valid_preview_request(httpx_mock: HTTPXMock):
|
|
282
|
+
client = Client(api_key="886fe239-927d-4072-ab72-6dd345e8dd0d")
|
|
283
|
+
|
|
284
|
+
httpx_mock.add_response(
|
|
285
|
+
method="POST",
|
|
286
|
+
url="https://api.getlago.com/api/v1/invoices/preview",
|
|
287
|
+
content=mock_response(),
|
|
288
|
+
)
|
|
289
|
+
response = client.invoices.preview(invoice_preview())
|
|
290
|
+
|
|
291
|
+
assert response.lago_id == "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
|
|
292
|
+
assert response.status == "finalized"
|
|
293
|
+
assert response.payment_status == "failed"
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
from pytest_httpx import HTTPXMock
|
|
5
|
+
|
|
6
|
+
from lago_python_client.client import Client
|
|
7
|
+
from lago_python_client.exceptions import LagoApiError
|
|
8
|
+
from lago_python_client.models import Payment
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def payment_object():
|
|
12
|
+
return Payment(
|
|
13
|
+
amount_cents=100,
|
|
14
|
+
reference="ref1",
|
|
15
|
+
invoice_id="f8e194df-5d90-4382-b146-c881d2c67f28",
|
|
16
|
+
paid_at="2025-01-01T13:00:00Z",
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def mock_response():
|
|
21
|
+
this_dir = os.path.dirname(os.path.abspath(__file__))
|
|
22
|
+
data_path = os.path.join(this_dir, "fixtures/payment.json")
|
|
23
|
+
|
|
24
|
+
with open(data_path, "rb") as payment_response:
|
|
25
|
+
return payment_response.read()
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def mock_collection_response():
|
|
29
|
+
current_dir = os.path.dirname(os.path.abspath(__file__))
|
|
30
|
+
data_path = os.path.join(current_dir, "fixtures/payment_index.json")
|
|
31
|
+
|
|
32
|
+
with open(data_path, "rb") as payments_response:
|
|
33
|
+
return payments_response.read()
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def test_valid_find_all_payments_request(httpx_mock: HTTPXMock):
|
|
37
|
+
client = Client(api_key="886fe239-927d-4072-ab72-6dd345e8dd0d")
|
|
38
|
+
|
|
39
|
+
httpx_mock.add_response(
|
|
40
|
+
method="GET",
|
|
41
|
+
url="https://api.getlago.com/api/v1/payments",
|
|
42
|
+
content=mock_collection_response(),
|
|
43
|
+
)
|
|
44
|
+
response = client.payments.find_all()
|
|
45
|
+
|
|
46
|
+
assert response["payments"][0].lago_id == "8e5d5ec2-bdc7-4c43-a944-5ababae775d4"
|
|
47
|
+
assert response["meta"]["current_page"] == 1
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def test_valid_find_all_payments_request_with_options(httpx_mock: HTTPXMock):
|
|
51
|
+
client = Client(api_key="886fe239-927d-4072-ab72-6dd345e8dd0d")
|
|
52
|
+
|
|
53
|
+
httpx_mock.add_response(
|
|
54
|
+
method="GET",
|
|
55
|
+
url="https://api.getlago.com/api/v1/payments?per_page=2&page=1",
|
|
56
|
+
content=mock_collection_response(),
|
|
57
|
+
)
|
|
58
|
+
response = client.payments.find_all({"per_page": 2, "page": 1})
|
|
59
|
+
|
|
60
|
+
assert response["payments"][0].lago_id == "8e5d5ec2-bdc7-4c43-a944-5ababae775d4"
|
|
61
|
+
assert response["meta"]["current_page"] == 1
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def test_invalid_find_all_payment_request(httpx_mock: HTTPXMock):
|
|
65
|
+
client = Client(api_key="invalid")
|
|
66
|
+
|
|
67
|
+
httpx_mock.add_response(
|
|
68
|
+
method="GET",
|
|
69
|
+
url="https://api.getlago.com/api/v1/payments",
|
|
70
|
+
status_code=404,
|
|
71
|
+
content=b"",
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
with pytest.raises(LagoApiError):
|
|
75
|
+
client.payments.find_all()
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def test_valid_create_payment_request(httpx_mock: HTTPXMock):
|
|
79
|
+
client = Client(api_key="886fe239-927d-4072-ab72-6dd345e8dd0d")
|
|
80
|
+
|
|
81
|
+
httpx_mock.add_response(
|
|
82
|
+
method="POST",
|
|
83
|
+
url="https://api.getlago.com/api/v1/payments",
|
|
84
|
+
content=mock_response(),
|
|
85
|
+
)
|
|
86
|
+
response = client.payments.create(payment_object())
|
|
87
|
+
|
|
88
|
+
assert response is not None
|
|
89
|
+
assert response.lago_id == "8e5d5ec2-bdc7-4c43-a944-5ababae775d4"
|
|
90
|
+
assert response.amount_cents == 100
|
|
91
|
+
assert response.amount_currency == "USD"
|
|
92
|
+
assert response.payment_status == "succeeded"
|
|
93
|
+
assert len(response.invoice_ids) == 1
|
|
94
|
+
assert response.invoice_ids[0] == "f8e194df-5d90-4382-b146-c881d2c67f28"
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def test_invalid_create_payment_request(httpx_mock: HTTPXMock):
|
|
98
|
+
client = Client(api_key="invalid")
|
|
99
|
+
|
|
100
|
+
httpx_mock.add_response(
|
|
101
|
+
method="POST",
|
|
102
|
+
url="https://api.getlago.com/api/v1/payments",
|
|
103
|
+
status_code=401,
|
|
104
|
+
content=b"",
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
with pytest.raises(LagoApiError):
|
|
108
|
+
client.payments.create(payment_object())
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
from pytest_httpx import HTTPXMock
|
|
5
|
+
|
|
6
|
+
from lago_python_client.client import Client
|
|
7
|
+
from lago_python_client.exceptions import LagoApiError
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def mock_response():
|
|
11
|
+
this_dir = os.path.dirname(os.path.abspath(__file__))
|
|
12
|
+
data_path = os.path.join(this_dir, "fixtures/payment_receipt.json")
|
|
13
|
+
|
|
14
|
+
with open(data_path, "rb") as payment_receipt_response:
|
|
15
|
+
return payment_receipt_response.read()
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def mock_collection_response():
|
|
19
|
+
current_dir = os.path.dirname(os.path.abspath(__file__))
|
|
20
|
+
data_path = os.path.join(current_dir, "fixtures/payment_receipt_index.json")
|
|
21
|
+
|
|
22
|
+
with open(data_path, "rb") as payment_receipts_response:
|
|
23
|
+
return payment_receipts_response.read()
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def test_valid_find_all_payment_receipts_request(httpx_mock: HTTPXMock):
|
|
27
|
+
client = Client(api_key="886fe239-927d-4072-ab72-6dd345e8dd0d")
|
|
28
|
+
|
|
29
|
+
httpx_mock.add_response(
|
|
30
|
+
method="GET",
|
|
31
|
+
url="https://api.getlago.com/api/v1/payment_receipts",
|
|
32
|
+
content=mock_collection_response(),
|
|
33
|
+
)
|
|
34
|
+
response = client.payment_receipts.find_all()
|
|
35
|
+
|
|
36
|
+
assert response["payment_receipts"][0].lago_id == "89b6b61e-4dbc-4307-ac96-4abcfa9e3e2d"
|
|
37
|
+
assert response["meta"]["current_page"] == 1
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def test_valid_find_all_payment_receipts_request_with_options(httpx_mock: HTTPXMock):
|
|
41
|
+
client = Client(api_key="886fe239-927d-4072-ab72-6dd345e8dd0d")
|
|
42
|
+
|
|
43
|
+
httpx_mock.add_response(
|
|
44
|
+
method="GET",
|
|
45
|
+
url="https://api.getlago.com/api/v1/payment_receipts?per_page=2&page=1",
|
|
46
|
+
content=mock_collection_response(),
|
|
47
|
+
)
|
|
48
|
+
response = client.payment_receipts.find_all({"per_page": 2, "page": 1})
|
|
49
|
+
|
|
50
|
+
assert response["payment_receipts"][0].lago_id == "89b6b61e-4dbc-4307-ac96-4abcfa9e3e2d"
|
|
51
|
+
assert response["meta"]["current_page"] == 1
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def test_invalid_find_all_payment_receipts_request(httpx_mock: HTTPXMock):
|
|
55
|
+
client = Client(api_key="invalid")
|
|
56
|
+
|
|
57
|
+
httpx_mock.add_response(
|
|
58
|
+
method="GET",
|
|
59
|
+
url="https://api.getlago.com/api/v1/payment_receipts",
|
|
60
|
+
status_code=404,
|
|
61
|
+
content=b"",
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
with pytest.raises(LagoApiError):
|
|
65
|
+
client.payment_receipts.find_all()
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/tests/test_wallet_transaction_client.py
RENAMED
|
@@ -28,6 +28,14 @@ def mock_collection_response():
|
|
|
28
28
|
return wallet_transaction_index_response.read()
|
|
29
29
|
|
|
30
30
|
|
|
31
|
+
def mock_payment_url_response():
|
|
32
|
+
this_dir = os.path.dirname(os.path.abspath(__file__))
|
|
33
|
+
data_path = os.path.join(this_dir, "fixtures/wallet_transaction_payment_url.json")
|
|
34
|
+
|
|
35
|
+
with open(data_path, "rb") as payment_url_response:
|
|
36
|
+
return payment_url_response.read()
|
|
37
|
+
|
|
38
|
+
|
|
31
39
|
def test_valid_create_wallet_transaction_request(httpx_mock: HTTPXMock):
|
|
32
40
|
client = Client(api_key="886fe239-927d-4072-ab72-6dd345e8dd0d")
|
|
33
41
|
|
|
@@ -40,6 +48,10 @@ def test_valid_create_wallet_transaction_request(httpx_mock: HTTPXMock):
|
|
|
40
48
|
|
|
41
49
|
assert response["wallet_transactions"][0].lago_id == "b7ab2926-1de8-4428-9bcd-779314ac1111"
|
|
42
50
|
assert response["wallet_transactions"][1].lago_id == "b7ab2926-1de8-4428-9bcd-779314ac1222"
|
|
51
|
+
assert response["wallet_transactions"][2].lago_id == "b7ab2926-1de8-4428-9bcd-779314ac1333"
|
|
52
|
+
assert response["wallet_transactions"][0].status == "settled"
|
|
53
|
+
assert response["wallet_transactions"][2].status == "failed"
|
|
54
|
+
assert response["wallet_transactions"][2].failed_at == "2022-04-29T08:59:51Z"
|
|
43
55
|
|
|
44
56
|
|
|
45
57
|
def test_invalid_create_wallet_transaction_request(httpx_mock: HTTPXMock):
|
|
@@ -68,3 +80,16 @@ def test_valid_find_all_wallet_transactions_request(httpx_mock: HTTPXMock):
|
|
|
68
80
|
|
|
69
81
|
assert response["wallet_transactions"][0].lago_id == "b7ab2926-1de8-4428-9bcd-779314ac1111"
|
|
70
82
|
assert response["meta"]["current_page"] == 1
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def test_valid_payment_url_request(httpx_mock: HTTPXMock):
|
|
86
|
+
client = Client(api_key="886fe239-927d-4072-ab72-6dd345e8dd0d")
|
|
87
|
+
|
|
88
|
+
httpx_mock.add_response(
|
|
89
|
+
method="POST",
|
|
90
|
+
url="https://api.getlago.com/api/v1/wallet_transactions/5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba/payment_url",
|
|
91
|
+
content=mock_payment_url_response(),
|
|
92
|
+
)
|
|
93
|
+
response = client.wallet_transactions.payment_url("5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba")
|
|
94
|
+
|
|
95
|
+
assert response == "https://checkout.stripe.com/c/pay/cs_test_a1cuqFkXvH"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
LAGO_VERSION = "1.19.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/add_ons/__init__.py
RENAMED
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/add_ons/clients.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/coupons/__init__.py
RENAMED
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/coupons/clients.py
RENAMED
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/credit_notes/__init__.py
RENAMED
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/credit_notes/clients.py
RENAMED
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/customers/__init__.py
RENAMED
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/events/__init__.py
RENAMED
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/events/clients.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/gross_revenues/clients.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/invoices/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/applied_coupon.py
RENAMED
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/billable_metric.py
RENAMED
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/billing_period.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/credit_note.py
RENAMED
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/customer_usage.py
RENAMED
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/error_detail.py
RENAMED
|
File without changes
|
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/gross_revenue.py
RENAMED
|
File without changes
|
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/invoice_item.py
RENAMED
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/invoiced_usage.py
RENAMED
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/lifetime_usage.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/organization.py
RENAMED
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/overdue_balance.py
RENAMED
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/payment_request.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/models/usage_threshold.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/organizations/__init__.py
RENAMED
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/organizations/clients.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/services/request.py
RENAMED
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/services/response.py
RENAMED
|
File without changes
|
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/subscriptions/clients.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client/webhooks/clients.py
RENAMED
|
File without changes
|
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client.egg-info/requires.txt
RENAMED
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/lago_python_client.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/tests/test_billable_metric_client.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/tests/test_invoice_collection_client.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/tests/test_overdue_balance_client.py
RENAMED
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/tests/test_payment_request_client.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.26.0}/tests/test_webhook_endpoint_client.py
RENAMED
|
File without changes
|