lago-python-client 1.19.0__tar.gz → 1.22.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.22.0}/PKG-INFO +1 -1
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/client.py +5 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/customers/clients.py +9 -5
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/invoices/clients.py +17 -1
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/models/__init__.py +3 -1
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/models/coupon.py +4 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/models/invoice.py +13 -2
- lago_python_client-1.22.0/lago_python_client/models/payment.py +26 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/models/subscription.py +4 -0
- lago_python_client-1.22.0/lago_python_client/payments/clients.py +16 -0
- lago_python_client-1.22.0/lago_python_client/version.py +1 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client.egg-info/PKG-INFO +1 -1
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client.egg-info/SOURCES.txt +8 -0
- lago_python_client-1.22.0/tests/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/tests/test_customer_client.py +17 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/tests/test_invoice_client.py +23 -0
- lago_python_client-1.22.0/tests/test_payment_client.py +108 -0
- lago_python_client-1.19.0/lago_python_client/version.py +0 -1
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/LICENSE +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/README.md +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/add_ons/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/add_ons/clients.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/base_client.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/base_model.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/billable_metrics/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/billable_metrics/clients.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/coupons/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/coupons/clients.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/credit_notes/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/credit_notes/clients.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/customers/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/events/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/events/clients.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/exceptions.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/fees/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/fees/clients.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/functools_ext.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/gross_revenues/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/gross_revenues/clients.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/invoice_collections/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/invoice_collections/clients.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/invoiced_usages/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/invoiced_usages/clients.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/invoices/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/mixins.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/models/add_on.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/models/applied_coupon.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/models/billable_metric.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/models/billing_period.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/models/charge.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/models/credit.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/models/credit_note.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/models/customer.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/models/customer_usage.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/models/error_detail.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/models/event.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/models/fee.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/models/gross_revenue.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/models/invoice_collection.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/models/invoice_item.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/models/invoiced_usage.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/models/lifetime_usage.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/models/minimum_commitment.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/models/mrr.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/models/organization.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/models/overdue_balance.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/models/payment_request.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/models/plan.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/models/tax.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/models/usage_threshold.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/models/wallet.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/models/wallet_transaction.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/models/webhook_endpoint.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/mrrs/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/mrrs/clients.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/organizations/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/organizations/clients.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/overdue_balances/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/overdue_balances/clients.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/payment_requests/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/payment_requests/clients.py +0 -0
- {lago_python_client-1.19.0/lago_python_client/plans → lago_python_client-1.22.0/lago_python_client/payments}/__init__.py +0 -0
- {lago_python_client-1.19.0/lago_python_client/services → lago_python_client-1.22.0/lago_python_client/plans}/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/plans/clients.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/py.typed +0 -0
- {lago_python_client-1.19.0/lago_python_client/subscriptions → lago_python_client-1.22.0/lago_python_client/services}/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/services/json.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/services/request.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/services/response.py +0 -0
- {lago_python_client-1.19.0/lago_python_client/taxes → lago_python_client-1.22.0/lago_python_client/subscriptions}/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/subscriptions/clients.py +0 -0
- {lago_python_client-1.19.0/lago_python_client/wallets → lago_python_client-1.22.0/lago_python_client/taxes}/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/taxes/clients.py +0 -0
- {lago_python_client-1.19.0/lago_python_client/webhook_endpoints → lago_python_client-1.22.0/lago_python_client/wallets}/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/wallets/clients.py +0 -0
- {lago_python_client-1.19.0/lago_python_client/webhooks → lago_python_client-1.22.0/lago_python_client/webhook_endpoints}/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/webhook_endpoints/clients.py +0 -0
- {lago_python_client-1.19.0/tests → lago_python_client-1.22.0/lago_python_client/webhooks}/__init__.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/webhooks/clients.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client.egg-info/dependency_links.txt +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client.egg-info/requires.txt +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client.egg-info/top_level.txt +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/pyproject.toml +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/setup.cfg +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/tests/test_add_on_client.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/tests/test_applied_coupon_client.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/tests/test_billable_metric_client.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/tests/test_client.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/tests/test_coupon_client.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/tests/test_credit_note_client.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/tests/test_event_client.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/tests/test_fee_client.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/tests/test_functools_ext.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/tests/test_gross_revenue_client.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/tests/test_invoice_collection_client.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/tests/test_invoiced_usage_client.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/tests/test_json_services.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/tests/test_mrr_client.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/tests/test_organization_client.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/tests/test_overdue_balance_client.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/tests/test_payment_request_client.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/tests/test_plan_client.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/tests/test_request_services.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/tests/test_response_services.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/tests/test_subscription_client.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/tests/test_tax_client.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/tests/test_wallet_client.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/tests/test_wallet_transaction_client.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/tests/test_webhook_client.py +0 -0
- {lago_python_client-1.19.0 → lago_python_client-1.22.0}/tests/test_webhook_endpoint_client.py +0 -0
|
@@ -15,6 +15,7 @@ from .mrrs.clients import MrrClient
|
|
|
15
15
|
from .organizations.clients import OrganizationClient
|
|
16
16
|
from .overdue_balances.clients import OverdueBalanceClient
|
|
17
17
|
from .payment_requests.clients import PaymentRequestClient
|
|
18
|
+
from .payments.clients import PaymentClient
|
|
18
19
|
from .invoice_collections.clients import InvoiceCollectionClient
|
|
19
20
|
from .plans.clients import PlanClient
|
|
20
21
|
from .subscriptions.clients import SubscriptionClient
|
|
@@ -118,6 +119,10 @@ class Client:
|
|
|
118
119
|
def payment_requests(self) -> PaymentRequestClient:
|
|
119
120
|
return PaymentRequestClient(self.base_api_url, self.api_key)
|
|
120
121
|
|
|
122
|
+
@callable_cached_property
|
|
123
|
+
def payments(self) -> PaymentClient:
|
|
124
|
+
return PaymentClient(self.base_api_url, self.api_key)
|
|
125
|
+
|
|
121
126
|
@callable_cached_property
|
|
122
127
|
def invoice_collections(self) -> InvoiceCollectionClient:
|
|
123
128
|
return InvoiceCollectionClient(self.base_api_url, self.api_key)
|
{lago_python_client-1.19.0 → lago_python_client-1.22.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.22.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.22.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
|
)
|
|
@@ -90,4 +91,5 @@ from .usage_threshold import (
|
|
|
90
91
|
UsageThresholdsResponse as UsageThresholdsResponse,
|
|
91
92
|
)
|
|
92
93
|
from .payment_request import PaymentRequest as PaymentRequest
|
|
94
|
+
from .payment import Payment as Payment
|
|
93
95
|
from .lifetime_usage import LifetimeUsageResponse as LifetimeUsageResponse
|
{lago_python_client-1.19.0 → lago_python_client-1.22.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]
|
|
@@ -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]
|
{lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/models/subscription.py
RENAMED
|
@@ -16,6 +16,10 @@ class Subscription(BaseModel):
|
|
|
16
16
|
plan_overrides: Optional[PlanOverrides]
|
|
17
17
|
|
|
18
18
|
|
|
19
|
+
class Subscriptions(BaseModel):
|
|
20
|
+
external_ids: Optional[List[str]]
|
|
21
|
+
|
|
22
|
+
|
|
19
23
|
class SubscriptionResponse(BaseResponseModel):
|
|
20
24
|
lago_id: str
|
|
21
25
|
lago_customer_id: Optional[str]
|
|
@@ -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.22.0"
|
{lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client.egg-info/SOURCES.txt
RENAMED
|
@@ -57,6 +57,7 @@ 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
|
|
60
61
|
./lago_python_client/models/payment_request.py
|
|
61
62
|
./lago_python_client/models/plan.py
|
|
62
63
|
./lago_python_client/models/subscription.py
|
|
@@ -73,6 +74,8 @@ setup.cfg
|
|
|
73
74
|
./lago_python_client/overdue_balances/clients.py
|
|
74
75
|
./lago_python_client/payment_requests/__init__.py
|
|
75
76
|
./lago_python_client/payment_requests/clients.py
|
|
77
|
+
./lago_python_client/payments/__init__.py
|
|
78
|
+
./lago_python_client/payments/clients.py
|
|
76
79
|
./lago_python_client/plans/__init__.py
|
|
77
80
|
./lago_python_client/plans/clients.py
|
|
78
81
|
./lago_python_client/services/__init__.py
|
|
@@ -108,6 +111,7 @@ setup.cfg
|
|
|
108
111
|
./tests/test_mrr_client.py
|
|
109
112
|
./tests/test_organization_client.py
|
|
110
113
|
./tests/test_overdue_balance_client.py
|
|
114
|
+
./tests/test_payment_client.py
|
|
111
115
|
./tests/test_payment_request_client.py
|
|
112
116
|
./tests/test_plan_client.py
|
|
113
117
|
./tests/test_request_services.py
|
|
@@ -178,6 +182,7 @@ lago_python_client/models/minimum_commitment.py
|
|
|
178
182
|
lago_python_client/models/mrr.py
|
|
179
183
|
lago_python_client/models/organization.py
|
|
180
184
|
lago_python_client/models/overdue_balance.py
|
|
185
|
+
lago_python_client/models/payment.py
|
|
181
186
|
lago_python_client/models/payment_request.py
|
|
182
187
|
lago_python_client/models/plan.py
|
|
183
188
|
lago_python_client/models/subscription.py
|
|
@@ -194,6 +199,8 @@ lago_python_client/overdue_balances/__init__.py
|
|
|
194
199
|
lago_python_client/overdue_balances/clients.py
|
|
195
200
|
lago_python_client/payment_requests/__init__.py
|
|
196
201
|
lago_python_client/payment_requests/clients.py
|
|
202
|
+
lago_python_client/payments/__init__.py
|
|
203
|
+
lago_python_client/payments/clients.py
|
|
197
204
|
lago_python_client/plans/__init__.py
|
|
198
205
|
lago_python_client/plans/clients.py
|
|
199
206
|
lago_python_client/services/__init__.py
|
|
@@ -229,6 +236,7 @@ tests/test_json_services.py
|
|
|
229
236
|
tests/test_mrr_client.py
|
|
230
237
|
tests/test_organization_client.py
|
|
231
238
|
tests/test_overdue_balance_client.py
|
|
239
|
+
tests/test_payment_client.py
|
|
232
240
|
tests/test_payment_request_client.py
|
|
233
241
|
tests/test_plan_client.py
|
|
234
242
|
tests/test_request_services.py
|
|
File without changes
|
|
@@ -129,6 +129,23 @@ def test_valid_current_usage(httpx_mock: HTTPXMock):
|
|
|
129
129
|
assert response.charges_usage[0].filters[0].values["country"] == ["france"]
|
|
130
130
|
|
|
131
131
|
|
|
132
|
+
def test_valid_current_usage_without_taxes(httpx_mock: HTTPXMock):
|
|
133
|
+
client = Client(api_key="886fe239-927d-4072-ab72-6dd345e8dd0d")
|
|
134
|
+
|
|
135
|
+
httpx_mock.add_response(
|
|
136
|
+
method="GET",
|
|
137
|
+
url="https://api.getlago.com/api/v1/customers/external_customer_id/current_usage?external_subscription_id=123&apply_taxes=false",
|
|
138
|
+
content=mock_response("customer_usage"),
|
|
139
|
+
)
|
|
140
|
+
response = client.customers.current_usage("external_customer_id", "123", "false")
|
|
141
|
+
|
|
142
|
+
assert response.from_datetime == "2022-07-01T00:00:00Z"
|
|
143
|
+
assert len(response.charges_usage) == 1
|
|
144
|
+
assert response.charges_usage[0].units == 1.0
|
|
145
|
+
assert len(response.charges_usage[0].filters) == 1
|
|
146
|
+
assert response.charges_usage[0].filters[0].values["country"] == ["france"]
|
|
147
|
+
|
|
148
|
+
|
|
132
149
|
def test_invalid_current_usage(httpx_mock: HTTPXMock):
|
|
133
150
|
client = Client(api_key="886fe239-927d-4072-ab72-6dd345e8dd0d")
|
|
134
151
|
|
|
@@ -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())
|
|
@@ -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.22.0}/lago_python_client/add_ons/__init__.py
RENAMED
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.22.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.22.0}/lago_python_client/coupons/__init__.py
RENAMED
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/coupons/clients.py
RENAMED
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/credit_notes/__init__.py
RENAMED
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/credit_notes/clients.py
RENAMED
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/customers/__init__.py
RENAMED
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/events/__init__.py
RENAMED
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.22.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.22.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.22.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.22.0}/lago_python_client/models/applied_coupon.py
RENAMED
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/models/billable_metric.py
RENAMED
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.22.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.22.0}/lago_python_client/models/credit_note.py
RENAMED
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/models/customer.py
RENAMED
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/models/customer_usage.py
RENAMED
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/models/error_detail.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.22.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.22.0}/lago_python_client/models/invoice_item.py
RENAMED
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/models/invoiced_usage.py
RENAMED
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.22.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.22.0}/lago_python_client/models/organization.py
RENAMED
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/models/overdue_balance.py
RENAMED
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.22.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.22.0}/lago_python_client/models/usage_threshold.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.22.0}/lago_python_client/organizations/__init__.py
RENAMED
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.22.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
|
{lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/services/request.py
RENAMED
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/services/response.py
RENAMED
|
File without changes
|
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/subscriptions/clients.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/wallets/clients.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client/webhooks/clients.py
RENAMED
|
File without changes
|
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.22.0}/lago_python_client.egg-info/requires.txt
RENAMED
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.22.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.22.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.22.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.22.0}/tests/test_overdue_balance_client.py
RENAMED
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.22.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
|
{lago_python_client-1.19.0 → lago_python_client-1.22.0}/tests/test_wallet_transaction_client.py
RENAMED
|
File without changes
|
|
File without changes
|
{lago_python_client-1.19.0 → lago_python_client-1.22.0}/tests/test_webhook_endpoint_client.py
RENAMED
|
File without changes
|