lago-python-client 1.33.3__tar.gz → 1.34.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.33.3 → lago_python_client-1.34.0}/PKG-INFO +1 -1
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/client.py +35 -0
- lago_python_client-1.34.0/lago_python_client/customers/applied_coupons_client.py +13 -0
- lago_python_client-1.34.0/lago_python_client/customers/credit_notes_client.py +13 -0
- lago_python_client-1.34.0/lago_python_client/customers/invoices_client.py +13 -0
- lago_python_client-1.34.0/lago_python_client/customers/payment_requests_client.py +13 -0
- lago_python_client-1.34.0/lago_python_client/customers/payments_client.py +13 -0
- lago_python_client-1.34.0/lago_python_client/customers/subscriptions_client.py +13 -0
- lago_python_client-1.34.0/lago_python_client/customers/wallets_client.py +13 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/mixins.py +32 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/models/customer_projected_usage.py +1 -1
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/models/customer_usage.py +1 -1
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/models/wallet.py +5 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/models/wallet_transaction.py +2 -0
- lago_python_client-1.34.0/lago_python_client/version.py +1 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client.egg-info/PKG-INFO +1 -1
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client.egg-info/SOURCES.txt +33 -1
- lago_python_client-1.34.0/tests/test_customer_applied_coupons_client.py +51 -0
- lago_python_client-1.34.0/tests/test_customer_credit_notes_client.py +51 -0
- lago_python_client-1.34.0/tests/test_customer_invoices_client.py +49 -0
- lago_python_client-1.34.0/tests/test_customer_payment_requests_client.py +51 -0
- lago_python_client-1.34.0/tests/test_customer_payments_client.py +49 -0
- lago_python_client-1.34.0/tests/test_customer_sbscriptions_client.py +51 -0
- lago_python_client-1.34.0/tests/test_customer_wallets_client.py +49 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/tests/test_wallet_client.py +34 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/tests/test_wallet_transaction_client.py +6 -1
- lago_python_client-1.34.0/tests/utils/__init__.py +0 -0
- lago_python_client-1.34.0/tests/utils/mixin.py +9 -0
- lago_python_client-1.33.3/lago_python_client/version.py +0 -1
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/LICENSE +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/README.md +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/__init__.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/activity_logs/__init__.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/activity_logs/clients.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/add_ons/__init__.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/add_ons/clients.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/api_logs/__init__.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/api_logs/clients.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/base_client.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/base_model.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/billable_metrics/__init__.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/billable_metrics/clients.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/billing_entities/__init__.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/billing_entities/clients.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/coupons/__init__.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/coupons/clients.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/credit_notes/__init__.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/credit_notes/clients.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/customers/__init__.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/customers/clients.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/events/__init__.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/events/clients.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/exceptions.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/fees/__init__.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/fees/clients.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/functools_ext.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/gross_revenues/__init__.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/gross_revenues/clients.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/invoice_collections/__init__.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/invoice_collections/clients.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/invoiced_usages/__init__.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/invoiced_usages/clients.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/invoices/__init__.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/invoices/clients.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/models/__init__.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/models/activity_log.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/models/add_on.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/models/api_log.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/models/applied_coupon.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/models/billable_metric.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/models/billing_entity.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/models/billing_period.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/models/charge.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/models/coupon.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/models/credit.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/models/credit_note.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/models/customer.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/models/error_detail.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/models/event.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/models/fee.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/models/gross_revenue.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/models/invoice.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/models/invoice_collection.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/models/invoice_custom_section.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/models/invoice_item.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/models/invoiced_usage.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/models/lifetime_usage.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/models/minimum_commitment.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/models/mrr.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/models/organization.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/models/overdue_balance.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/models/payment.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/models/payment_receipt.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/models/payment_request.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/models/plan.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/models/subscription.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/models/tax.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/models/usage.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/models/usage_threshold.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/models/webhook_endpoint.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/mrrs/__init__.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/mrrs/clients.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/organizations/__init__.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/organizations/clients.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/overdue_balances/__init__.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/overdue_balances/clients.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/payment_receipts/__init__.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/payment_receipts/clients.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/payment_requests/__init__.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/payment_requests/clients.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/payments/__init__.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/payments/clients.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/plans/__init__.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/plans/clients.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/py.typed +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/services/__init__.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/services/json.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/services/request.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/services/response.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/subscriptions/__init__.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/subscriptions/clients.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/taxes/__init__.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/taxes/clients.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/usages/__init__.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/usages/clients.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/wallets/__init__.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/wallets/clients.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/webhook_endpoints/__init__.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/webhook_endpoints/clients.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/webhooks/__init__.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client/webhooks/clients.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client.egg-info/dependency_links.txt +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client.egg-info/requires.txt +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client.egg-info/top_level.txt +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/pyproject.toml +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/setup.cfg +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/tests/__init__.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/tests/test_activity_logs_client.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/tests/test_add_on_client.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/tests/test_api_logs_client.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/tests/test_applied_coupon_client.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/tests/test_billable_metric_client.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/tests/test_billing_entity_client.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/tests/test_client.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/tests/test_coupon_client.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/tests/test_credit_note_client.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/tests/test_customer_client.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/tests/test_event_client.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/tests/test_fee_client.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/tests/test_functools_ext.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/tests/test_gross_revenue_client.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/tests/test_invoice_client.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/tests/test_invoice_collection_client.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/tests/test_invoiced_usage_client.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/tests/test_json_services.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/tests/test_mrr_client.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/tests/test_organization_client.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/tests/test_overdue_balance_client.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/tests/test_payment_client.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/tests/test_payment_receipt_client.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/tests/test_payment_request_client.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/tests/test_plan_client.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/tests/test_request_services.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/tests/test_response_services.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/tests/test_subscription_client.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/tests/test_tax_client.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/tests/test_usage_client.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/tests/test_webhook_client.py +0 -0
- {lago_python_client-1.33.3 → lago_python_client-1.34.0}/tests/test_webhook_endpoint_client.py +0 -0
|
@@ -6,6 +6,13 @@ from .billing_entities.clients import BillingEntityClient
|
|
|
6
6
|
from .coupons.clients import AppliedCouponClient, CouponClient
|
|
7
7
|
from .credit_notes.clients import CreditNoteClient
|
|
8
8
|
from .customers.clients import CustomerClient
|
|
9
|
+
from .customers.applied_coupons_client import CustomerAppliedCouponsClient
|
|
10
|
+
from .customers.credit_notes_client import CustomerCreditNotesClient
|
|
11
|
+
from .customers.invoices_client import CustomerInvoicesClient
|
|
12
|
+
from .customers.payments_client import CustomerPaymentsClient
|
|
13
|
+
from .customers.payment_requests_client import CustomerPaymentRequestsClient
|
|
14
|
+
from .customers.subscriptions_client import CustomerSubscriptionsClient
|
|
15
|
+
from .customers.wallets_client import CustomerWalletsClient
|
|
9
16
|
from .events.clients import EventClient
|
|
10
17
|
from .fees.clients import FeeClient
|
|
11
18
|
from .functools_ext import callable_cached_property
|
|
@@ -92,6 +99,34 @@ class Client:
|
|
|
92
99
|
def customers(self) -> CustomerClient:
|
|
93
100
|
return CustomerClient(self.base_api_url, self.api_key)
|
|
94
101
|
|
|
102
|
+
@callable_cached_property
|
|
103
|
+
def customer_applied_coupons(self) -> CustomerAppliedCouponsClient:
|
|
104
|
+
return CustomerAppliedCouponsClient(self.base_api_url, self.api_key)
|
|
105
|
+
|
|
106
|
+
@callable_cached_property
|
|
107
|
+
def customer_credit_notes(self) -> CustomerCreditNotesClient:
|
|
108
|
+
return CustomerCreditNotesClient(self.base_api_url, self.api_key)
|
|
109
|
+
|
|
110
|
+
@callable_cached_property
|
|
111
|
+
def customer_invoices(self) -> CustomerInvoicesClient:
|
|
112
|
+
return CustomerInvoicesClient(self.base_api_url, self.api_key)
|
|
113
|
+
|
|
114
|
+
@callable_cached_property
|
|
115
|
+
def customer_payments(self) -> CustomerPaymentsClient:
|
|
116
|
+
return CustomerPaymentsClient(self.base_api_url, self.api_key)
|
|
117
|
+
|
|
118
|
+
@callable_cached_property
|
|
119
|
+
def customer_payment_requests(self) -> CustomerPaymentRequestsClient:
|
|
120
|
+
return CustomerPaymentRequestsClient(self.base_api_url, self.api_key)
|
|
121
|
+
|
|
122
|
+
@callable_cached_property
|
|
123
|
+
def customer_subscriptions(self) -> CustomerSubscriptionsClient:
|
|
124
|
+
return CustomerSubscriptionsClient(self.base_api_url, self.api_key)
|
|
125
|
+
|
|
126
|
+
@callable_cached_property
|
|
127
|
+
def customer_wallets(self) -> CustomerWalletsClient:
|
|
128
|
+
return CustomerWalletsClient(self.base_api_url, self.api_key)
|
|
129
|
+
|
|
95
130
|
@callable_cached_property
|
|
96
131
|
def events(self) -> EventClient:
|
|
97
132
|
return EventClient(self.base_api_url, self.api_key, self.base_ingest_api_url)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from typing import ClassVar, Type
|
|
2
|
+
|
|
3
|
+
from ..base_client import BaseClient
|
|
4
|
+
from ..mixins import FindAllChildrenCommandMixin
|
|
5
|
+
from ..models.applied_coupon import AppliedCouponResponse
|
|
6
|
+
from ..client import CustomerClient
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class CustomerAppliedCouponsClient(FindAllChildrenCommandMixin, BaseClient):
|
|
10
|
+
PARENT_API_RESOURCE: ClassVar[str] = CustomerClient.API_RESOURCE
|
|
11
|
+
API_RESOURCE: ClassVar[str] = "applied_coupons"
|
|
12
|
+
RESPONSE_MODEL: ClassVar[Type[AppliedCouponResponse]] = AppliedCouponResponse
|
|
13
|
+
ROOT_NAME: ClassVar[str] = "applied_coupon"
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from typing import ClassVar, Type
|
|
2
|
+
|
|
3
|
+
from ..base_client import BaseClient
|
|
4
|
+
from ..mixins import FindAllChildrenCommandMixin
|
|
5
|
+
from ..models.credit_note import CreditNoteResponse
|
|
6
|
+
from ..client import CustomerClient
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class CustomerCreditNotesClient(FindAllChildrenCommandMixin, BaseClient):
|
|
10
|
+
PARENT_API_RESOURCE: ClassVar[str] = CustomerClient.API_RESOURCE
|
|
11
|
+
API_RESOURCE: ClassVar[str] = "credit_notes"
|
|
12
|
+
RESPONSE_MODEL: ClassVar[Type[CreditNoteResponse]] = CreditNoteResponse
|
|
13
|
+
ROOT_NAME: ClassVar[str] = "credit_note"
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from typing import ClassVar, Type
|
|
2
|
+
|
|
3
|
+
from ..base_client import BaseClient
|
|
4
|
+
from ..mixins import FindAllChildrenCommandMixin
|
|
5
|
+
from ..models.invoice import InvoiceResponse
|
|
6
|
+
from ..client import CustomerClient
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class CustomerInvoicesClient(FindAllChildrenCommandMixin, BaseClient):
|
|
10
|
+
PARENT_API_RESOURCE: ClassVar[str] = CustomerClient.API_RESOURCE
|
|
11
|
+
API_RESOURCE: ClassVar[str] = "invoices"
|
|
12
|
+
RESPONSE_MODEL: ClassVar[Type[InvoiceResponse]] = InvoiceResponse
|
|
13
|
+
ROOT_NAME: ClassVar[str] = "invoice"
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from typing import ClassVar, Type
|
|
2
|
+
|
|
3
|
+
from ..base_client import BaseClient
|
|
4
|
+
from ..mixins import FindAllChildrenCommandMixin
|
|
5
|
+
from ..models.payment_request import PaymentRequestResponse
|
|
6
|
+
from ..client import CustomerClient
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class CustomerPaymentRequestsClient(FindAllChildrenCommandMixin, BaseClient):
|
|
10
|
+
PARENT_API_RESOURCE: ClassVar[str] = CustomerClient.API_RESOURCE
|
|
11
|
+
API_RESOURCE: ClassVar[str] = "payment_requests"
|
|
12
|
+
RESPONSE_MODEL: ClassVar[Type[PaymentRequestResponse]] = PaymentRequestResponse
|
|
13
|
+
ROOT_NAME: ClassVar[str] = "payment_request"
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from typing import ClassVar, Type
|
|
2
|
+
|
|
3
|
+
from ..base_client import BaseClient
|
|
4
|
+
from ..mixins import FindAllChildrenCommandMixin
|
|
5
|
+
from ..models.payment import PaymentResponse
|
|
6
|
+
from ..client import CustomerClient
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class CustomerPaymentsClient(FindAllChildrenCommandMixin, BaseClient):
|
|
10
|
+
PARENT_API_RESOURCE: ClassVar[str] = CustomerClient.API_RESOURCE
|
|
11
|
+
API_RESOURCE: ClassVar[str] = "payments"
|
|
12
|
+
RESPONSE_MODEL: ClassVar[Type[PaymentResponse]] = PaymentResponse
|
|
13
|
+
ROOT_NAME: ClassVar[str] = "payment"
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from typing import ClassVar, Type
|
|
2
|
+
|
|
3
|
+
from ..base_client import BaseClient
|
|
4
|
+
from ..mixins import FindAllChildrenCommandMixin
|
|
5
|
+
from ..models.subscription import SubscriptionResponse
|
|
6
|
+
from ..client import CustomerClient
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class CustomerSubscriptionsClient(FindAllChildrenCommandMixin, BaseClient):
|
|
10
|
+
PARENT_API_RESOURCE: ClassVar[str] = CustomerClient.API_RESOURCE
|
|
11
|
+
API_RESOURCE: ClassVar[str] = "subscriptions"
|
|
12
|
+
RESPONSE_MODEL: ClassVar[Type[SubscriptionResponse]] = SubscriptionResponse
|
|
13
|
+
ROOT_NAME: ClassVar[str] = "subscription"
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from typing import ClassVar, Type
|
|
2
|
+
|
|
3
|
+
from ..base_client import BaseClient
|
|
4
|
+
from ..mixins import FindAllChildrenCommandMixin
|
|
5
|
+
from ..models.wallet import WalletResponse
|
|
6
|
+
from ..client import CustomerClient
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class CustomerWalletsClient(FindAllChildrenCommandMixin, BaseClient):
|
|
10
|
+
PARENT_API_RESOURCE: ClassVar[str] = CustomerClient.API_RESOURCE
|
|
11
|
+
API_RESOURCE: ClassVar[str] = "wallets"
|
|
12
|
+
RESPONSE_MODEL: ClassVar[Type[WalletResponse]] = WalletResponse
|
|
13
|
+
ROOT_NAME: ClassVar[str] = "wallet"
|
|
@@ -37,6 +37,8 @@ _M = TypeVar("_M", bound=BaseModel)
|
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
class _ClientMixin(Protocol[_PM]):
|
|
40
|
+
@property
|
|
41
|
+
def PARENT_API_RESOURCE(self) -> str: ...
|
|
40
42
|
@property
|
|
41
43
|
def API_RESOURCE(self) -> str: ...
|
|
42
44
|
@property
|
|
@@ -140,6 +142,36 @@ class FindAllCommandMixin(Generic[_M]):
|
|
|
140
142
|
)
|
|
141
143
|
|
|
142
144
|
|
|
145
|
+
class FindAllChildrenCommandMixin(Generic[_M]):
|
|
146
|
+
"""Client mixin with `find_all` command scoped to a parent resource."""
|
|
147
|
+
|
|
148
|
+
def find_all(
|
|
149
|
+
self: _ClientMixin[_M],
|
|
150
|
+
resource_id: str,
|
|
151
|
+
options: QueryPairs = {},
|
|
152
|
+
timetour: Optional[httpx.Timeout] = None,
|
|
153
|
+
) -> Mapping[str, Any]:
|
|
154
|
+
"""Execute `find_all` child command."""
|
|
155
|
+
# Send request and save response
|
|
156
|
+
api_response: Response = send_get_request(
|
|
157
|
+
url=make_url(
|
|
158
|
+
origin=self.base_url,
|
|
159
|
+
path_parts=(
|
|
160
|
+
self.PARENT_API_RESOURCE,
|
|
161
|
+
resource_id,
|
|
162
|
+
self.API_RESOURCE,
|
|
163
|
+
),
|
|
164
|
+
query_pairs=options,
|
|
165
|
+
),
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
return prepare_index_response(
|
|
169
|
+
api_resource=self.API_RESOURCE,
|
|
170
|
+
response_model=self.RESPONSE_MODEL,
|
|
171
|
+
data=get_response_data(response=api_response),
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
|
|
143
175
|
class FindCommandMixin(Generic[_M]):
|
|
144
176
|
"""Client mixin with `find` command."""
|
|
145
177
|
|
|
@@ -41,7 +41,7 @@ class ProjectedGroupedUsage(BaseModel):
|
|
|
41
41
|
events_count: int
|
|
42
42
|
units: str
|
|
43
43
|
projected_units: str
|
|
44
|
-
grouped_by: Dict[str, str]
|
|
44
|
+
grouped_by: Dict[str, Optional[str]]
|
|
45
45
|
filters: List[ProjectedChargeFilterUsage]
|
|
46
46
|
pricing_unit_details: Optional[PricingUnitDetails]
|
|
47
47
|
|
|
@@ -17,6 +17,7 @@ class RecurringTransactionRule(BaseModel):
|
|
|
17
17
|
expiration_at: Optional[str]
|
|
18
18
|
target_ongoing_balance: Optional[str]
|
|
19
19
|
transaction_metadata: Optional[List[Dict[str, str]]]
|
|
20
|
+
transaction_name: Optional[str]
|
|
20
21
|
|
|
21
22
|
|
|
22
23
|
class RecurringTransactionRuleResponse(BaseModel):
|
|
@@ -33,6 +34,7 @@ class RecurringTransactionRuleResponse(BaseModel):
|
|
|
33
34
|
target_ongoing_balance: Optional[str]
|
|
34
35
|
created_at: Optional[str]
|
|
35
36
|
transaction_metadata: Optional[List[Dict[str, str]]]
|
|
37
|
+
transaction_name: Optional[str]
|
|
36
38
|
|
|
37
39
|
|
|
38
40
|
class RecurringTransactionRuleList(BaseModel):
|
|
@@ -58,7 +60,9 @@ class Wallet(BaseModel):
|
|
|
58
60
|
currency: Optional[str]
|
|
59
61
|
recurring_transaction_rules: Optional[RecurringTransactionRuleList]
|
|
60
62
|
transaction_metadata: Optional[List[Dict[str, str]]]
|
|
63
|
+
transaction_name: Optional[str]
|
|
61
64
|
applies_to: Optional[AppliesTo]
|
|
65
|
+
invoice_requires_successful_payment: Optional[bool]
|
|
62
66
|
|
|
63
67
|
|
|
64
68
|
class WalletResponse(BaseResponseModel):
|
|
@@ -83,3 +87,4 @@ class WalletResponse(BaseResponseModel):
|
|
|
83
87
|
credits_ongoing_balance: str
|
|
84
88
|
credits_ongoing_usage_balance: str
|
|
85
89
|
applies_to: Optional[AppliesTo]
|
|
90
|
+
invoice_requires_successful_payment: Optional[bool]
|
|
@@ -10,6 +10,7 @@ class WalletTransaction(BaseModel):
|
|
|
10
10
|
paid_credits: Optional[str]
|
|
11
11
|
granted_credits: Optional[str]
|
|
12
12
|
voided_credits: Optional[str]
|
|
13
|
+
invoice_requires_successful_payment: Optional[bool]
|
|
13
14
|
metadata: Optional[List[Dict[str, str]]]
|
|
14
15
|
name: Optional[str]
|
|
15
16
|
|
|
@@ -28,3 +29,4 @@ class WalletTransactionResponse(BaseResponseModel):
|
|
|
28
29
|
created_at: str
|
|
29
30
|
metadata: Optional[List[Dict[str, str]]]
|
|
30
31
|
name: Optional[str]
|
|
32
|
+
invoice_requires_successful_payment: Optional[bool]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
LAGO_VERSION = "1.34.0"
|
{lago_python_client-1.33.3 → lago_python_client-1.34.0}/lago_python_client.egg-info/SOURCES.txt
RENAMED
|
@@ -26,7 +26,14 @@ setup.cfg
|
|
|
26
26
|
./lago_python_client/credit_notes/__init__.py
|
|
27
27
|
./lago_python_client/credit_notes/clients.py
|
|
28
28
|
./lago_python_client/customers/__init__.py
|
|
29
|
+
./lago_python_client/customers/applied_coupons_client.py
|
|
29
30
|
./lago_python_client/customers/clients.py
|
|
31
|
+
./lago_python_client/customers/credit_notes_client.py
|
|
32
|
+
./lago_python_client/customers/invoices_client.py
|
|
33
|
+
./lago_python_client/customers/payment_requests_client.py
|
|
34
|
+
./lago_python_client/customers/payments_client.py
|
|
35
|
+
./lago_python_client/customers/subscriptions_client.py
|
|
36
|
+
./lago_python_client/customers/wallets_client.py
|
|
30
37
|
./lago_python_client/events/__init__.py
|
|
31
38
|
./lago_python_client/events/clients.py
|
|
32
39
|
./lago_python_client/fees/__init__.py
|
|
@@ -119,7 +126,14 @@ setup.cfg
|
|
|
119
126
|
./tests/test_client.py
|
|
120
127
|
./tests/test_coupon_client.py
|
|
121
128
|
./tests/test_credit_note_client.py
|
|
129
|
+
./tests/test_customer_applied_coupons_client.py
|
|
122
130
|
./tests/test_customer_client.py
|
|
131
|
+
./tests/test_customer_credit_notes_client.py
|
|
132
|
+
./tests/test_customer_invoices_client.py
|
|
133
|
+
./tests/test_customer_payment_requests_client.py
|
|
134
|
+
./tests/test_customer_payments_client.py
|
|
135
|
+
./tests/test_customer_sbscriptions_client.py
|
|
136
|
+
./tests/test_customer_wallets_client.py
|
|
123
137
|
./tests/test_event_client.py
|
|
124
138
|
./tests/test_fee_client.py
|
|
125
139
|
./tests/test_functools_ext.py
|
|
@@ -144,6 +158,8 @@ setup.cfg
|
|
|
144
158
|
./tests/test_wallet_transaction_client.py
|
|
145
159
|
./tests/test_webhook_client.py
|
|
146
160
|
./tests/test_webhook_endpoint_client.py
|
|
161
|
+
./tests/utils/__init__.py
|
|
162
|
+
./tests/utils/mixin.py
|
|
147
163
|
lago_python_client/__init__.py
|
|
148
164
|
lago_python_client/base_client.py
|
|
149
165
|
lago_python_client/base_model.py
|
|
@@ -173,7 +189,14 @@ lago_python_client/coupons/clients.py
|
|
|
173
189
|
lago_python_client/credit_notes/__init__.py
|
|
174
190
|
lago_python_client/credit_notes/clients.py
|
|
175
191
|
lago_python_client/customers/__init__.py
|
|
192
|
+
lago_python_client/customers/applied_coupons_client.py
|
|
176
193
|
lago_python_client/customers/clients.py
|
|
194
|
+
lago_python_client/customers/credit_notes_client.py
|
|
195
|
+
lago_python_client/customers/invoices_client.py
|
|
196
|
+
lago_python_client/customers/payment_requests_client.py
|
|
197
|
+
lago_python_client/customers/payments_client.py
|
|
198
|
+
lago_python_client/customers/subscriptions_client.py
|
|
199
|
+
lago_python_client/customers/wallets_client.py
|
|
177
200
|
lago_python_client/events/__init__.py
|
|
178
201
|
lago_python_client/events/clients.py
|
|
179
202
|
lago_python_client/fees/__init__.py
|
|
@@ -266,7 +289,14 @@ tests/test_billing_entity_client.py
|
|
|
266
289
|
tests/test_client.py
|
|
267
290
|
tests/test_coupon_client.py
|
|
268
291
|
tests/test_credit_note_client.py
|
|
292
|
+
tests/test_customer_applied_coupons_client.py
|
|
269
293
|
tests/test_customer_client.py
|
|
294
|
+
tests/test_customer_credit_notes_client.py
|
|
295
|
+
tests/test_customer_invoices_client.py
|
|
296
|
+
tests/test_customer_payment_requests_client.py
|
|
297
|
+
tests/test_customer_payments_client.py
|
|
298
|
+
tests/test_customer_sbscriptions_client.py
|
|
299
|
+
tests/test_customer_wallets_client.py
|
|
270
300
|
tests/test_event_client.py
|
|
271
301
|
tests/test_fee_client.py
|
|
272
302
|
tests/test_functools_ext.py
|
|
@@ -290,4 +320,6 @@ tests/test_usage_client.py
|
|
|
290
320
|
tests/test_wallet_client.py
|
|
291
321
|
tests/test_wallet_transaction_client.py
|
|
292
322
|
tests/test_webhook_client.py
|
|
293
|
-
tests/test_webhook_endpoint_client.py
|
|
323
|
+
tests/test_webhook_endpoint_client.py
|
|
324
|
+
tests/utils/__init__.py
|
|
325
|
+
tests/utils/mixin.py
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
from pytest_httpx import HTTPXMock
|
|
3
|
+
|
|
4
|
+
from lago_python_client.client import Client
|
|
5
|
+
from lago_python_client.exceptions import LagoApiError
|
|
6
|
+
|
|
7
|
+
from .utils.mixin import mock_response
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def test_valid_find_all_customer_applied_coupons_request(httpx_mock: HTTPXMock):
|
|
11
|
+
client = Client(api_key="886fe239-927d-4072-ab72-6dd345e8dd0d")
|
|
12
|
+
|
|
13
|
+
httpx_mock.add_response(
|
|
14
|
+
method="GET",
|
|
15
|
+
url="https://api.getlago.com/api/v1/customers/external_customer_id/applied_coupons",
|
|
16
|
+
content=mock_response(mock="applied_coupon_index"),
|
|
17
|
+
)
|
|
18
|
+
response = client.customer_applied_coupons.find_all(resource_id="external_customer_id")
|
|
19
|
+
|
|
20
|
+
assert response["applied_coupons"][0].lago_id == "b7ab2926-1de8-4428-9bcd-779314ac129b"
|
|
21
|
+
assert response["meta"]["current_page"] == 1
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def test_valid_find_all_customer_applied_coupons_request_with_options(httpx_mock: HTTPXMock):
|
|
25
|
+
client = Client(api_key="886fe239-927d-4072-ab72-6dd345e8dd0d")
|
|
26
|
+
|
|
27
|
+
httpx_mock.add_response(
|
|
28
|
+
method="GET",
|
|
29
|
+
url="https://api.getlago.com/api/v1/customers/external_customer_id/applied_coupons?per_page=2&page=1",
|
|
30
|
+
content=mock_response(mock="applied_coupon_index"),
|
|
31
|
+
)
|
|
32
|
+
response = client.customer_applied_coupons.find_all(
|
|
33
|
+
resource_id="external_customer_id", options={"per_page": 2, "page": 1}
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
assert response["applied_coupons"][0].lago_id == "b7ab2926-1de8-4428-9bcd-779314ac129b"
|
|
37
|
+
assert response["meta"]["current_page"] == 1
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def test_invalid_find_all_applied_coupon_request(httpx_mock: HTTPXMock):
|
|
41
|
+
client = Client(api_key="invalid")
|
|
42
|
+
|
|
43
|
+
httpx_mock.add_response(
|
|
44
|
+
method="GET",
|
|
45
|
+
url="https://api.getlago.com/api/v1/customers/external_customer_id/applied_coupons",
|
|
46
|
+
status_code=404,
|
|
47
|
+
content=b"",
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
with pytest.raises(LagoApiError):
|
|
51
|
+
client.customer_applied_coupons.find_all(resource_id="external_customer_id")
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
from pytest_httpx import HTTPXMock
|
|
3
|
+
|
|
4
|
+
from lago_python_client.client import Client
|
|
5
|
+
from lago_python_client.exceptions import LagoApiError
|
|
6
|
+
|
|
7
|
+
from .utils.mixin import mock_response
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def test_valid_find_all_customer_credit_notes_request(httpx_mock: HTTPXMock):
|
|
11
|
+
client = Client(api_key="886fe239-927d-4072-ab72-6dd345e8dd0d")
|
|
12
|
+
|
|
13
|
+
httpx_mock.add_response(
|
|
14
|
+
method="GET",
|
|
15
|
+
url="https://api.getlago.com/api/v1/customers/external_customer_id/credit_notes",
|
|
16
|
+
content=mock_response(mock="credit_note_index"),
|
|
17
|
+
)
|
|
18
|
+
response = client.customer_credit_notes.find_all(resource_id="external_customer_id")
|
|
19
|
+
|
|
20
|
+
assert response["credit_notes"][0].lago_id == "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
|
|
21
|
+
assert response["meta"]["current_page"] == 1
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def test_valid_find_all_customer_credit_notes_request_with_options(httpx_mock: HTTPXMock):
|
|
25
|
+
client = Client(api_key="886fe239-927d-4072-ab72-6dd345e8dd0d")
|
|
26
|
+
|
|
27
|
+
httpx_mock.add_response(
|
|
28
|
+
method="GET",
|
|
29
|
+
url="https://api.getlago.com/api/v1/customers/external_customer_id/credit_notes?per_page=2&page=1",
|
|
30
|
+
content=mock_response(mock="credit_note_index"),
|
|
31
|
+
)
|
|
32
|
+
response = client.customer_credit_notes.find_all(
|
|
33
|
+
resource_id="external_customer_id", options={"per_page": 2, "page": 1}
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
assert response["credit_notes"][0].lago_id == "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
|
|
37
|
+
assert response["meta"]["current_page"] == 1
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def test_invalid_find_all_credit_notes_request(httpx_mock: HTTPXMock):
|
|
41
|
+
client = Client(api_key="invalid")
|
|
42
|
+
|
|
43
|
+
httpx_mock.add_response(
|
|
44
|
+
method="GET",
|
|
45
|
+
url="https://api.getlago.com/api/v1/customers/external_customer_id/credit_notes",
|
|
46
|
+
status_code=404,
|
|
47
|
+
content=b"",
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
with pytest.raises(LagoApiError):
|
|
51
|
+
client.customer_credit_notes.find_all(resource_id="external_customer_id")
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
from pytest_httpx import HTTPXMock
|
|
3
|
+
|
|
4
|
+
from lago_python_client.client import Client
|
|
5
|
+
from lago_python_client.exceptions import LagoApiError
|
|
6
|
+
|
|
7
|
+
from .utils.mixin import mock_response
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def test_valid_find_all_customer_invoices_request(httpx_mock: HTTPXMock):
|
|
11
|
+
client = Client(api_key="886fe239-927d-4072-ab72-6dd345e8dd0d")
|
|
12
|
+
|
|
13
|
+
httpx_mock.add_response(
|
|
14
|
+
method="GET",
|
|
15
|
+
url="https://api.getlago.com/api/v1/customers/external_customer_id/invoices",
|
|
16
|
+
content=mock_response(mock="invoice_index"),
|
|
17
|
+
)
|
|
18
|
+
response = client.customer_invoices.find_all(resource_id="external_customer_id")
|
|
19
|
+
|
|
20
|
+
assert response["invoices"][0].lago_id == "b7ab2926-1de8-4428-9bcd-779314ac1111"
|
|
21
|
+
assert response["meta"]["current_page"] == 1
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def test_valid_find_all_customer_invoices_request_with_options(httpx_mock: HTTPXMock):
|
|
25
|
+
client = Client(api_key="886fe239-927d-4072-ab72-6dd345e8dd0d")
|
|
26
|
+
|
|
27
|
+
httpx_mock.add_response(
|
|
28
|
+
method="GET",
|
|
29
|
+
url="https://api.getlago.com/api/v1/customers/external_customer_id/invoices?per_page=2&page=1",
|
|
30
|
+
content=mock_response(mock="invoice_index"),
|
|
31
|
+
)
|
|
32
|
+
response = client.customer_invoices.find_all(resource_id="external_customer_id", options={"per_page": 2, "page": 1})
|
|
33
|
+
|
|
34
|
+
assert response["invoices"][1].lago_id == "b7ab2926-1de8-4428-9bcd-779314ac1222"
|
|
35
|
+
assert response["meta"]["current_page"] == 1
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def test_invalid_find_all_invoice_request(httpx_mock: HTTPXMock):
|
|
39
|
+
client = Client(api_key="invalid")
|
|
40
|
+
|
|
41
|
+
httpx_mock.add_response(
|
|
42
|
+
method="GET",
|
|
43
|
+
url="https://api.getlago.com/api/v1/customers/external_customer_id/invoices",
|
|
44
|
+
status_code=404,
|
|
45
|
+
content=b"",
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
with pytest.raises(LagoApiError):
|
|
49
|
+
client.customer_invoices.find_all(resource_id="external_customer_id")
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
from pytest_httpx import HTTPXMock
|
|
3
|
+
|
|
4
|
+
from lago_python_client.client import Client
|
|
5
|
+
from lago_python_client.exceptions import LagoApiError
|
|
6
|
+
|
|
7
|
+
from .utils.mixin import mock_response
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def test_valid_find_all_customer_payment_requests_request(httpx_mock: HTTPXMock):
|
|
11
|
+
client = Client(api_key="886fe239-927d-4072-ab72-6dd345e8dd0d")
|
|
12
|
+
|
|
13
|
+
httpx_mock.add_response(
|
|
14
|
+
method="GET",
|
|
15
|
+
url="https://api.getlago.com/api/v1/customers/external_customer_id/payment_requests",
|
|
16
|
+
content=mock_response(mock="payment_request_index"),
|
|
17
|
+
)
|
|
18
|
+
response = client.customer_payment_requests.find_all(resource_id="external_customer_id")
|
|
19
|
+
|
|
20
|
+
assert response["payment_requests"][0].lago_id == "89b6b61e-4dbc-4307-ac96-4abcfa9e3e2d"
|
|
21
|
+
assert response["meta"]["current_page"] == 1
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def test_valid_find_all_customer_payment_requests_request_with_options(httpx_mock: HTTPXMock):
|
|
25
|
+
client = Client(api_key="886fe239-927d-4072-ab72-6dd345e8dd0d")
|
|
26
|
+
|
|
27
|
+
httpx_mock.add_response(
|
|
28
|
+
method="GET",
|
|
29
|
+
url="https://api.getlago.com/api/v1/customers/external_customer_id/payment_requests?per_page=2&page=1",
|
|
30
|
+
content=mock_response(mock="payment_request_index"),
|
|
31
|
+
)
|
|
32
|
+
response = client.customer_payment_requests.find_all(
|
|
33
|
+
resource_id="external_customer_id", options={"per_page": 2, "page": 1}
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
assert response["payment_requests"][0].lago_id == "89b6b61e-4dbc-4307-ac96-4abcfa9e3e2d"
|
|
37
|
+
assert response["meta"]["current_page"] == 1
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def test_invalid_find_all_payment_request_request(httpx_mock: HTTPXMock):
|
|
41
|
+
client = Client(api_key="invalid")
|
|
42
|
+
|
|
43
|
+
httpx_mock.add_response(
|
|
44
|
+
method="GET",
|
|
45
|
+
url="https://api.getlago.com/api/v1/customers/external_customer_id/payment_requests",
|
|
46
|
+
status_code=404,
|
|
47
|
+
content=b"",
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
with pytest.raises(LagoApiError):
|
|
51
|
+
client.customer_payment_requests.find_all(resource_id="external_customer_id")
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
from pytest_httpx import HTTPXMock
|
|
3
|
+
|
|
4
|
+
from lago_python_client.client import Client
|
|
5
|
+
from lago_python_client.exceptions import LagoApiError
|
|
6
|
+
|
|
7
|
+
from .utils.mixin import mock_response
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def test_valid_find_all_customer_payments_request(httpx_mock: HTTPXMock):
|
|
11
|
+
client = Client(api_key="886fe239-927d-4072-ab72-6dd345e8dd0d")
|
|
12
|
+
|
|
13
|
+
httpx_mock.add_response(
|
|
14
|
+
method="GET",
|
|
15
|
+
url="https://api.getlago.com/api/v1/customers/external_customer_id/payments",
|
|
16
|
+
content=mock_response(mock="payment_index"),
|
|
17
|
+
)
|
|
18
|
+
response = client.customer_payments.find_all(resource_id="external_customer_id")
|
|
19
|
+
|
|
20
|
+
assert response["payments"][0].lago_id == "8e5d5ec2-bdc7-4c43-a944-5ababae775d4"
|
|
21
|
+
assert response["meta"]["current_page"] == 1
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def test_valid_find_all_customer_payments_request_with_options(httpx_mock: HTTPXMock):
|
|
25
|
+
client = Client(api_key="886fe239-927d-4072-ab72-6dd345e8dd0d")
|
|
26
|
+
|
|
27
|
+
httpx_mock.add_response(
|
|
28
|
+
method="GET",
|
|
29
|
+
url="https://api.getlago.com/api/v1/customers/external_customer_id/payments?per_page=2&page=1",
|
|
30
|
+
content=mock_response(mock="payment_index"),
|
|
31
|
+
)
|
|
32
|
+
response = client.customer_payments.find_all(resource_id="external_customer_id", options={"per_page": 2, "page": 1})
|
|
33
|
+
|
|
34
|
+
assert response["payments"][0].lago_id == "8e5d5ec2-bdc7-4c43-a944-5ababae775d4"
|
|
35
|
+
assert response["meta"]["current_page"] == 1
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def test_invalid_find_all_payment_request(httpx_mock: HTTPXMock):
|
|
39
|
+
client = Client(api_key="invalid")
|
|
40
|
+
|
|
41
|
+
httpx_mock.add_response(
|
|
42
|
+
method="GET",
|
|
43
|
+
url="https://api.getlago.com/api/v1/customers/external_customer_id/payments",
|
|
44
|
+
status_code=404,
|
|
45
|
+
content=b"",
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
with pytest.raises(LagoApiError):
|
|
49
|
+
client.customer_payments.find_all(resource_id="external_customer_id")
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
from pytest_httpx import HTTPXMock
|
|
3
|
+
|
|
4
|
+
from lago_python_client.client import Client
|
|
5
|
+
from lago_python_client.exceptions import LagoApiError
|
|
6
|
+
|
|
7
|
+
from .utils.mixin import mock_response
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def test_valid_find_all_customer_subscriptions_request(httpx_mock: HTTPXMock):
|
|
11
|
+
client = Client(api_key="886fe239-927d-4072-ab72-6dd345e8dd0d")
|
|
12
|
+
|
|
13
|
+
httpx_mock.add_response(
|
|
14
|
+
method="GET",
|
|
15
|
+
url="https://api.getlago.com/api/v1/customers/external_customer_id/subscriptions",
|
|
16
|
+
content=mock_response(mock="subscription_index"),
|
|
17
|
+
)
|
|
18
|
+
response = client.customer_subscriptions.find_all(resource_id="external_customer_id")
|
|
19
|
+
|
|
20
|
+
assert response["subscriptions"][0].lago_id == "b7ab2926-1de8-4428-9bcd-779314ac129b"
|
|
21
|
+
assert response["meta"]["current_page"] == 1
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def test_valid_find_all_customer_subscriptions_request_with_options(httpx_mock: HTTPXMock):
|
|
25
|
+
client = Client(api_key="886fe239-927d-4072-ab72-6dd345e8dd0d")
|
|
26
|
+
|
|
27
|
+
httpx_mock.add_response(
|
|
28
|
+
method="GET",
|
|
29
|
+
url="https://api.getlago.com/api/v1/customers/external_customer_id/subscriptions?per_page=2&page=1",
|
|
30
|
+
content=mock_response(mock="subscription_index"),
|
|
31
|
+
)
|
|
32
|
+
response = client.customer_subscriptions.find_all(
|
|
33
|
+
resource_id="external_customer_id", options={"per_page": 2, "page": 1}
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
assert response["subscriptions"][0].lago_id == "b7ab2926-1de8-4428-9bcd-779314ac129b"
|
|
37
|
+
assert response["meta"]["current_page"] == 1
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def test_invalid_find_all_subscription_request(httpx_mock: HTTPXMock):
|
|
41
|
+
client = Client(api_key="invalid")
|
|
42
|
+
|
|
43
|
+
httpx_mock.add_response(
|
|
44
|
+
method="GET",
|
|
45
|
+
url="https://api.getlago.com/api/v1/customers/external_customer_id/subscriptions",
|
|
46
|
+
status_code=404,
|
|
47
|
+
content=b"",
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
with pytest.raises(LagoApiError):
|
|
51
|
+
client.customer_subscriptions.find_all(resource_id="external_customer_id")
|