lago-python-client 0.52.1__tar.gz → 0.55.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.
Files changed (118) hide show
  1. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/PKG-INFO +1 -1
  2. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/client.py +3 -3
  3. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/events/clients.py +1 -3
  4. {lago-python-client-0.52.1/lago_python_client/outstanding_invoices → lago-python-client-0.55.0/lago_python_client/invoice_collections}/clients.py +7 -7
  5. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/models/__init__.py +2 -1
  6. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/models/customer.py +1 -0
  7. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/models/event.py +4 -7
  8. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/models/fee.py +3 -2
  9. lago-python-client-0.52.1/lago_python_client/models/outstanding_invoice.py → lago-python-client-0.55.0/lago_python_client/models/invoice_collection.py +3 -3
  10. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/models/organization.py +4 -0
  11. lago-python-client-0.55.0/lago_python_client/models/wallet.py +67 -0
  12. lago-python-client-0.55.0/lago_python_client/version.py +1 -0
  13. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client.egg-info/PKG-INFO +1 -1
  14. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client.egg-info/SOURCES.txt +5 -5
  15. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/tests/test_customer_client.py +2 -0
  16. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/tests/test_event_client.py +5 -1
  17. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/tests/test_invoice_client.py +2 -1
  18. lago-python-client-0.55.0/tests/test_invoice_collection_client.py +29 -0
  19. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/tests/test_organization_client.py +2 -0
  20. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/tests/test_wallet_client.py +13 -2
  21. lago-python-client-0.52.1/lago_python_client/models/wallet.py +0 -34
  22. lago-python-client-0.52.1/lago_python_client/version.py +0 -1
  23. lago-python-client-0.52.1/tests/test_outstanding_invoices_client.py +0 -29
  24. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/LICENSE +0 -0
  25. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/README.md +0 -0
  26. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/__init__.py +0 -0
  27. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/add_ons/__init__.py +0 -0
  28. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/add_ons/clients.py +0 -0
  29. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/base_client.py +0 -0
  30. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/base_model.py +0 -0
  31. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/billable_metrics/__init__.py +0 -0
  32. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/billable_metrics/clients.py +0 -0
  33. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/coupons/__init__.py +0 -0
  34. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/coupons/clients.py +0 -0
  35. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/credit_notes/__init__.py +0 -0
  36. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/credit_notes/clients.py +0 -0
  37. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/customers/__init__.py +0 -0
  38. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/customers/clients.py +0 -0
  39. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/events/__init__.py +0 -0
  40. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/exceptions.py +0 -0
  41. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/fees/__init__.py +0 -0
  42. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/fees/clients.py +0 -0
  43. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/functools_ext.py +0 -0
  44. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/gross_revenues/__init__.py +0 -0
  45. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/gross_revenues/clients.py +0 -0
  46. {lago-python-client-0.52.1/lago_python_client/invoiced_usages → lago-python-client-0.55.0/lago_python_client/invoice_collections}/__init__.py +0 -0
  47. {lago-python-client-0.52.1/lago_python_client/invoices → lago-python-client-0.55.0/lago_python_client/invoiced_usages}/__init__.py +0 -0
  48. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/invoiced_usages/clients.py +0 -0
  49. {lago-python-client-0.52.1/lago_python_client/mrrs → lago-python-client-0.55.0/lago_python_client/invoices}/__init__.py +0 -0
  50. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/invoices/clients.py +0 -0
  51. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/mixins.py +0 -0
  52. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/models/add_on.py +0 -0
  53. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/models/applied_coupon.py +0 -0
  54. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/models/billable_metric.py +0 -0
  55. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/models/charge.py +0 -0
  56. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/models/coupon.py +0 -0
  57. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/models/credit.py +0 -0
  58. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/models/credit_note.py +0 -0
  59. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/models/customer_usage.py +0 -0
  60. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/models/gross_revenue.py +0 -0
  61. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/models/group.py +0 -0
  62. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/models/invoice.py +0 -0
  63. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/models/invoice_item.py +0 -0
  64. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/models/invoiced_usage.py +0 -0
  65. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/models/mrr.py +0 -0
  66. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/models/plan.py +0 -0
  67. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/models/subscription.py +0 -0
  68. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/models/tax.py +0 -0
  69. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/models/wallet_transaction.py +0 -0
  70. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/models/webhook_endpoint.py +0 -0
  71. {lago-python-client-0.52.1/lago_python_client/organizations → lago-python-client-0.55.0/lago_python_client/mrrs}/__init__.py +0 -0
  72. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/mrrs/clients.py +0 -0
  73. {lago-python-client-0.52.1/lago_python_client/outstanding_invoices → lago-python-client-0.55.0/lago_python_client/organizations}/__init__.py +0 -0
  74. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/organizations/clients.py +0 -0
  75. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/plans/__init__.py +0 -0
  76. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/plans/clients.py +0 -0
  77. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/py.typed +0 -0
  78. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/services/__init__.py +0 -0
  79. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/services/json.py +0 -0
  80. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/services/request.py +0 -0
  81. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/services/response.py +0 -0
  82. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/subscriptions/__init__.py +0 -0
  83. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/subscriptions/clients.py +0 -0
  84. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/taxes/__init__.py +0 -0
  85. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/taxes/clients.py +0 -0
  86. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/wallets/__init__.py +0 -0
  87. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/wallets/clients.py +0 -0
  88. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/webhook_endpoints/__init__.py +0 -0
  89. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/webhook_endpoints/clients.py +0 -0
  90. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/webhooks/__init__.py +0 -0
  91. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client/webhooks/clients.py +0 -0
  92. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client.egg-info/dependency_links.txt +0 -0
  93. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client.egg-info/requires.txt +0 -0
  94. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/lago_python_client.egg-info/top_level.txt +0 -0
  95. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/pyproject.toml +0 -0
  96. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/setup.cfg +0 -0
  97. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/tests/__init__.py +0 -0
  98. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/tests/test_add_on_client.py +0 -0
  99. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/tests/test_applied_coupon_client.py +0 -0
  100. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/tests/test_billable_metric_client.py +0 -0
  101. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/tests/test_client.py +0 -0
  102. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/tests/test_coupon_client.py +0 -0
  103. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/tests/test_credit_note_client.py +0 -0
  104. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/tests/test_fee_client.py +0 -0
  105. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/tests/test_functools_ext.py +0 -0
  106. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/tests/test_gross_revenue_client.py +0 -0
  107. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/tests/test_group_client.py +0 -0
  108. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/tests/test_invoiced_usage_client.py +0 -0
  109. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/tests/test_json_services.py +0 -0
  110. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/tests/test_mrr_client.py +0 -0
  111. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/tests/test_plan_client.py +0 -0
  112. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/tests/test_request_services.py +0 -0
  113. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/tests/test_response_services.py +0 -0
  114. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/tests/test_subscription_client.py +0 -0
  115. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/tests/test_tax_client.py +0 -0
  116. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/tests/test_wallet_transaction_client.py +0 -0
  117. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/tests/test_webhook_client.py +0 -0
  118. {lago-python-client-0.52.1 → lago-python-client-0.55.0}/tests/test_webhook_endpoint_client.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lago-python-client
3
- Version: 0.52.1
3
+ Version: 0.55.0
4
4
  Summary: Lago Python API Client
5
5
  Home-page: https://github.com/getlago/lago-python-client
6
6
  Author: Lovro Colic
@@ -13,7 +13,7 @@ from .invoices.clients import InvoiceClient
13
13
  from .invoiced_usages.clients import InvoicedUsageClient
14
14
  from .mrrs.clients import MrrClient
15
15
  from .organizations.clients import OrganizationClient
16
- from .outstanding_invoices.clients import OutstandingInvoiceClient
16
+ from .invoice_collections.clients import InvoiceCollectionClient
17
17
  from .plans.clients import PlanClient
18
18
  from .subscriptions.clients import SubscriptionClient
19
19
  from .taxes.clients import TaxClient
@@ -96,8 +96,8 @@ class Client:
96
96
  return OrganizationClient(self.base_api_url, self.api_key)
97
97
 
98
98
  @callable_cached_property
99
- def outstanding_invoices(self) -> OutstandingInvoiceClient:
100
- return OutstandingInvoiceClient(self.base_api_url, self.api_key)
99
+ def invoice_collections(self) -> InvoiceCollectionClient:
100
+ return InvoiceCollectionClient(self.base_api_url, self.api_key)
101
101
 
102
102
  @callable_cached_property
103
103
  def plans(self) -> PlanClient:
@@ -29,9 +29,7 @@ class EventClient(CreateCommandMixin[EventResponse], FindCommandMixin[EventRespo
29
29
  origin=self.base_url,
30
30
  path_parts=(self.API_RESOURCE, 'batch'),
31
31
  ),
32
- content=to_json({
33
- self.ROOT_NAME: input_object.dict(),
34
- }),
32
+ content=to_json(input_object.dict()),
35
33
  headers=make_headers(api_key=self.api_key),
36
34
  )
37
35
  verify_response(api_response)
@@ -3,7 +3,7 @@ from typing import Any, ClassVar, Type, Union
3
3
 
4
4
  from ..base_client import BaseClient
5
5
  from ..mixins import FindAllCommandMixin
6
- from ..models.outstanding_invoice import OutstandingInvoiceResponse
6
+ from ..models.invoice_collection import InvoiceCollectionResponse
7
7
  from ..services.request import make_headers, make_url, send_get_request
8
8
  from ..services.response import get_response_data, prepare_index_response, Response
9
9
 
@@ -13,19 +13,19 @@ else:
13
13
  from typing import Mapping
14
14
 
15
15
 
16
- class OutstandingInvoiceClient(
17
- FindAllCommandMixin[OutstandingInvoiceResponse],
16
+ class InvoiceCollectionClient(
17
+ FindAllCommandMixin[InvoiceCollectionResponse],
18
18
  BaseClient,
19
19
  ):
20
- API_RESOURCE: ClassVar[str] = 'outstanding_invoices'
21
- RESPONSE_MODEL: ClassVar[Type[OutstandingInvoiceResponse]] = OutstandingInvoiceResponse
22
- ROOT_NAME: ClassVar[str] = 'outstanding_invoice'
20
+ API_RESOURCE: ClassVar[str] = 'invoice_collections'
21
+ RESPONSE_MODEL: ClassVar[Type[InvoiceCollectionResponse]] = InvoiceCollectionResponse
22
+ ROOT_NAME: ClassVar[str] = 'invoice_collection'
23
23
 
24
24
  def find_all(self, options: Mapping[str, Union[int, str]] = {}) -> Mapping[str, Any]:
25
25
  api_response: Response = send_get_request(
26
26
  url=make_url(
27
27
  origin=self.base_url,
28
- path_parts=('analytics', self.API_RESOURCE),
28
+ path_parts=('analytics', 'invoice_collection'),
29
29
  query_pairs=options,
30
30
  ),
31
31
  headers=make_headers(api_key=self.api_key),
@@ -17,6 +17,7 @@ from .invoice_item import InvoiceItemResponse
17
17
  from .subscription import Subscription
18
18
  from .customer_usage import Metric, ChargeObject, ChargeUsage, CustomerUsageResponse
19
19
  from .tax import Tax, Taxes, TaxResponse, TaxesResponse
20
- from .wallet import Wallet
20
+ from .wallet import Wallet, RecurringTransactionRule, RecurringTransactionRuleList, \
21
+ RecurringTransactionRuleResponse, RecurringTransactionRuleResponseList
21
22
  from .wallet_transaction import WalletTransaction
22
23
  from .webhook_endpoint import WebhookEndpoint
@@ -10,6 +10,7 @@ from .tax import TaxesResponse
10
10
  class CustomerBillingConfiguration(BaseModel):
11
11
  invoice_grace_period: Optional[int]
12
12
  payment_provider: Optional[str]
13
+ payment_provider_code: Optional[str]
13
14
  provider_customer_id: Optional[str]
14
15
  sync: Optional[bool]
15
16
  sync_with_provider: Optional[bool]
@@ -15,13 +15,7 @@ class Event(BaseModel):
15
15
 
16
16
 
17
17
  class BatchEvent(BaseModel):
18
- transaction_id: str
19
- external_customer_id: Optional[str]
20
- external_subscription_ids: List[str]
21
- code: str
22
- timestamp: Optional[Union[int, str]]
23
- properties: Optional[Dict[str, Any]]
24
-
18
+ events: List[Event]
25
19
 
26
20
  class EventResponse(BaseResponseModel):
27
21
  lago_id: str
@@ -34,3 +28,6 @@ class EventResponse(BaseResponseModel):
34
28
  timestamp: str
35
29
  properties: Optional[Dict[str, Any]]
36
30
  created_at: str
31
+
32
+ class BatchEventResponse(BaseResponseModel):
33
+ events: List[EventResponse]
@@ -1,4 +1,4 @@
1
- from typing import List, Optional
1
+ from typing import Any, Dict, List, Optional
2
2
 
3
3
  from .invoice_item import InvoiceItemResponse
4
4
  from ..base_model import BaseModel, BaseResponseModel
@@ -38,7 +38,7 @@ class FeeResponse(BaseResponseModel):
38
38
  taxes_rate: Optional[float]
39
39
  total_amount_cents: Optional[int]
40
40
  unit_amount_cents: Optional[int] # deprecated
41
- precise_unit_amount: Optional[float]
41
+ precise_unit_amount: Optional[str]
42
42
  total_amount_currency: Optional[str]
43
43
  units: Optional[float]
44
44
  events_count: Optional[int]
@@ -53,6 +53,7 @@ class FeeResponse(BaseResponseModel):
53
53
  refunded_at: Optional[str]
54
54
  from_date: Optional[str]
55
55
  to_date: Optional[str]
56
+ amount_details: Optional[Dict[str, Any]]
56
57
 
57
58
  item: Optional[InvoiceItemResponse]
58
59
  applied_taxes: Optional[FeeAppliedTaxes]
@@ -3,7 +3,7 @@ from typing import List, Optional
3
3
  from ..base_model import BaseModel, BaseResponseModel
4
4
 
5
5
 
6
- class OutstandingInvoiceResponse(BaseResponseModel):
6
+ class InvoiceCollectionResponse(BaseResponseModel):
7
7
  amount_cents: int
8
8
  currency: Optional[str]
9
9
  month: str
@@ -11,5 +11,5 @@ class OutstandingInvoiceResponse(BaseResponseModel):
11
11
  payment_status: Optional[str]
12
12
 
13
13
 
14
- class OutstandingInvoicesResponse(BaseResponseModel):
15
- __root__: List[OutstandingInvoiceResponse]
14
+ class InvoiceCollectionsResponse(BaseResponseModel):
15
+ __root__: List[InvoiceCollectionResponse]
@@ -25,6 +25,8 @@ class Organization(BaseModel):
25
25
  city: Optional[str]
26
26
  legal_name: Optional[str]
27
27
  legal_number: Optional[str]
28
+ document_numbering: Optional[str]
29
+ document_number_prefix: Optional[str]
28
30
  net_payment_term: Optional[int]
29
31
  tax_identification_number: Optional[str]
30
32
  timezone: Optional[str]
@@ -47,6 +49,8 @@ class OrganizationResponse(BaseResponseModel):
47
49
  legal_name: Optional[str]
48
50
  legal_number: Optional[str]
49
51
  net_payment_term: Optional[int]
52
+ document_numbering: Optional[str]
53
+ document_number_prefix: Optional[str]
50
54
  tax_identification_number: Optional[str]
51
55
  timezone: Optional[str]
52
56
  email_settings: Optional[List[str]]
@@ -0,0 +1,67 @@
1
+ from typing import List, Optional
2
+
3
+ from pydantic import BaseModel
4
+
5
+ from ..base_model import BaseResponseModel
6
+
7
+
8
+ class RecurringTransactionRule(BaseModel):
9
+ lago_id: Optional[str]
10
+ rule_type: Optional[str]
11
+ interval: Optional[str]
12
+ threshold_credits: Optional[str]
13
+ paid_credits: Optional[str]
14
+ granted_credits: Optional[str]
15
+
16
+
17
+ class RecurringTransactionRuleResponse(BaseModel):
18
+ lago_id: Optional[str]
19
+ rule_type: Optional[str]
20
+ interval: Optional[str]
21
+ threshold_credits: Optional[str]
22
+ paid_credits: Optional[str]
23
+ granted_credits: Optional[str]
24
+ created_at: Optional[str]
25
+
26
+
27
+ class RecurringTransactionRuleList(BaseModel):
28
+ __root__: List[RecurringTransactionRule]
29
+
30
+
31
+ class RecurringTransactionRuleResponseList(BaseModel):
32
+ __root__: List[RecurringTransactionRuleResponse]
33
+
34
+
35
+ class Wallet(BaseModel):
36
+ external_customer_id: Optional[str]
37
+ rate_amount: Optional[str]
38
+ name: Optional[str]
39
+ paid_credits: Optional[str]
40
+ granted_credits: Optional[str]
41
+ expiration_at: Optional[str]
42
+ currency: Optional[str]
43
+ recurring_transaction_rules: Optional[RecurringTransactionRuleList]
44
+
45
+
46
+ class WalletResponse(BaseResponseModel):
47
+ lago_id: str
48
+ lago_customer_id: str
49
+ external_customer_id: str
50
+ status: str
51
+ currency: str
52
+ name: Optional[str]
53
+ rate_amount: str
54
+ credits_balance: str
55
+ balance_cents: int
56
+ consumed_credits: str
57
+ created_at: str
58
+ expiration_at: Optional[str]
59
+ last_balance_sync_at: Optional[str]
60
+ last_consumed_credit_at: Optional[str]
61
+ terminated_at: Optional[str]
62
+ recurring_transaction_rules: Optional[RecurringTransactionRuleResponseList]
63
+ ongoing_balance_cents: int
64
+ ongoing_usage_balance_cents: int
65
+ credits_ongoing_balance: str
66
+ credits_ongoing_usage_balance: str
67
+ balance: str # NOTE(legacy)
@@ -0,0 +1 @@
1
+ LAGO_VERSION = '0.55.0'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lago-python-client
3
- Version: 0.52.1
3
+ Version: 0.55.0
4
4
  Summary: Lago Python API Client
5
5
  Home-page: https://github.com/getlago/lago-python-client
6
6
  Author: Lovro Colic
@@ -27,6 +27,8 @@ setup.cfg
27
27
  ./lago_python_client/fees/clients.py
28
28
  ./lago_python_client/gross_revenues/__init__.py
29
29
  ./lago_python_client/gross_revenues/clients.py
30
+ ./lago_python_client/invoice_collections/__init__.py
31
+ ./lago_python_client/invoice_collections/clients.py
30
32
  ./lago_python_client/invoiced_usages/__init__.py
31
33
  ./lago_python_client/invoiced_usages/clients.py
32
34
  ./lago_python_client/invoices/__init__.py
@@ -46,11 +48,11 @@ setup.cfg
46
48
  ./lago_python_client/models/gross_revenue.py
47
49
  ./lago_python_client/models/group.py
48
50
  ./lago_python_client/models/invoice.py
51
+ ./lago_python_client/models/invoice_collection.py
49
52
  ./lago_python_client/models/invoice_item.py
50
53
  ./lago_python_client/models/invoiced_usage.py
51
54
  ./lago_python_client/models/mrr.py
52
55
  ./lago_python_client/models/organization.py
53
- ./lago_python_client/models/outstanding_invoice.py
54
56
  ./lago_python_client/models/plan.py
55
57
  ./lago_python_client/models/subscription.py
56
58
  ./lago_python_client/models/tax.py
@@ -61,8 +63,6 @@ setup.cfg
61
63
  ./lago_python_client/mrrs/clients.py
62
64
  ./lago_python_client/organizations/__init__.py
63
65
  ./lago_python_client/organizations/clients.py
64
- ./lago_python_client/outstanding_invoices/__init__.py
65
- ./lago_python_client/outstanding_invoices/clients.py
66
66
  ./lago_python_client/plans/__init__.py
67
67
  ./lago_python_client/plans/clients.py
68
68
  ./lago_python_client/services/__init__.py
@@ -93,11 +93,11 @@ setup.cfg
93
93
  ./tests/test_gross_revenue_client.py
94
94
  ./tests/test_group_client.py
95
95
  ./tests/test_invoice_client.py
96
+ ./tests/test_invoice_collection_client.py
96
97
  ./tests/test_invoiced_usage_client.py
97
98
  ./tests/test_json_services.py
98
99
  ./tests/test_mrr_client.py
99
100
  ./tests/test_organization_client.py
100
- ./tests/test_outstanding_invoices_client.py
101
101
  ./tests/test_plan_client.py
102
102
  ./tests/test_request_services.py
103
103
  ./tests/test_response_services.py
@@ -125,11 +125,11 @@ tests/test_functools_ext.py
125
125
  tests/test_gross_revenue_client.py
126
126
  tests/test_group_client.py
127
127
  tests/test_invoice_client.py
128
+ tests/test_invoice_collection_client.py
128
129
  tests/test_invoiced_usage_client.py
129
130
  tests/test_json_services.py
130
131
  tests/test_mrr_client.py
131
132
  tests/test_organization_client.py
132
- tests/test_outstanding_invoices_client.py
133
133
  tests/test_plan_client.py
134
134
  tests/test_request_services.py
135
135
  tests/test_response_services.py
@@ -25,6 +25,7 @@ def create_customer():
25
25
  billing_configuration=CustomerBillingConfiguration(
26
26
  invoice_grace_period=3,
27
27
  payment_provider='stripe',
28
+ payment_provider_code='stripe-eu-1',
28
29
  provider_customer_id='cus_12345',
29
30
  sync_with_provider=True,
30
31
  document_locale="fr",
@@ -56,6 +57,7 @@ def test_valid_create_customers_request(httpx_mock: HTTPXMock):
56
57
  assert response.net_payment_term == None
57
58
  assert response.billing_configuration.invoice_grace_period == 3
58
59
  assert response.billing_configuration.payment_provider == 'stripe'
60
+ assert response.billing_configuration.payment_provider_code == 'stripe-eu-1'
59
61
  assert response.billing_configuration.provider_customer_id == 'cus_12345'
60
62
  assert response.billing_configuration.sync_with_provider == True
61
63
  assert response.billing_configuration.document_locale == "fr"
@@ -17,7 +17,11 @@ def create_event_with_string_timestamp():
17
17
 
18
18
 
19
19
  def create_batch_event():
20
- return BatchEvent(external_subscription_ids=['88u02857-a71e-4ea2-bcf9-57d8885990ba'], code='123', transaction_id='123')
20
+ return BatchEvent(
21
+ events=[
22
+ Event(external_customer_id='5eb02857-a71e-4ea2-bcf9-57d8885990ba', code='123', transaction_id='123'),
23
+ ],
24
+ )
21
25
 
22
26
 
23
27
  def mock_response():
@@ -53,8 +53,9 @@ def test_valid_create_invoice_request(httpx_mock: HTTPXMock):
53
53
  assert response.lago_id == '5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba'
54
54
  assert response.invoice_type == 'one_off'
55
55
  assert response.fees.__root__[0].invoice_display_name == 'fee_invoice_display_name'
56
- assert response.fees.__root__[0].precise_unit_amount == 9.52
56
+ assert response.fees.__root__[0].precise_unit_amount == '9.52'
57
57
  assert response.fees.__root__[0].item.invoice_display_name == 'one_off_invoice_display_name'
58
+ assert response.fees.__root__[0].amount_details == {}
58
59
 
59
60
 
60
61
  def test_invalid_create_invoice_request(httpx_mock: HTTPXMock):
@@ -0,0 +1,29 @@
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.invoice_collection import InvoiceCollectionResponse
9
+
10
+
11
+ def mock_collection_response():
12
+ current_dir = os.path.dirname(os.path.abspath(__file__))
13
+ data_path = os.path.join(current_dir, 'fixtures/invoice_collection_index.json')
14
+
15
+ with open(data_path, 'rb') as invoice_collections_response:
16
+ return invoice_collections_response.read()
17
+
18
+
19
+ def test_valid_find_all_invoice_collections_request(httpx_mock: HTTPXMock):
20
+ client = Client(api_key='886fe239-927d-4072-ab72-6dd345e8dd0d')
21
+
22
+ httpx_mock.add_response(method='GET', url='https://api.getlago.com/api/v1/analytics/invoice_collection', content=mock_collection_response())
23
+ response = client.invoice_collections.find_all()
24
+
25
+ assert response['invoice_collections'][0].currency == 'EUR'
26
+ assert response['invoice_collections'][0].amount_cents == 100
27
+ assert response['invoice_collections'][0].month == '2023-11-01T00:00:00.000Z'
28
+ assert response['invoice_collections'][0].invoices_count == 10
29
+ assert response['invoice_collections'][0].payment_status == 'pending'
@@ -15,6 +15,7 @@ def organization_object():
15
15
  tax_identification_number='EU123456789',
16
16
  net_payment_term=0,
17
17
  default_currency='EUR',
18
+ document_number_prefix='ORG-1234',
18
19
  billing_configuration=OrganizationBillingConfiguration(
19
20
  invoice_footer='footer',
20
21
  invoice_grace_period=3,
@@ -40,6 +41,7 @@ def test_valid_update_organization_request(httpx_mock: HTTPXMock):
40
41
 
41
42
  assert response.name == 'Hooli'
42
43
  assert response.tax_identification_number == 'EU123456789'
44
+ assert response.document_number_prefix == 'ORG-1234'
43
45
  assert response.net_payment_term == 0
44
46
 
45
47
 
@@ -5,16 +5,24 @@ from pytest_httpx import HTTPXMock
5
5
 
6
6
  from lago_python_client.client import Client
7
7
  from lago_python_client.exceptions import LagoApiError
8
- from lago_python_client.models import Wallet
8
+ from lago_python_client.models import Wallet, RecurringTransactionRule, RecurringTransactionRuleList
9
9
 
10
10
 
11
11
  def wallet_object():
12
+ rule = RecurringTransactionRule(
13
+ rule_type='interval',
14
+ interval='monthly',
15
+ paid_credits='105.0',
16
+ granted_credits='105.0',
17
+ )
18
+ rules_list = RecurringTransactionRuleList(__root__=[rule])
12
19
  return Wallet(
13
20
  name='name',
14
21
  external_customer_id='12345',
15
22
  rate_amount='1',
16
23
  paid_credits='10',
17
- granted_credits='10'
24
+ granted_credits='10',
25
+ recurring_transaction_rules=rules_list
18
26
  )
19
27
 
20
28
 
@@ -41,6 +49,9 @@ def test_valid_create_wallet_request(httpx_mock: HTTPXMock):
41
49
  response = client.wallets.create(wallet_object())
42
50
 
43
51
  assert response.lago_id == 'b7ab2926-1de8-4428-9bcd-779314ac129b'
52
+ assert response.recurring_transaction_rules.__root__[0].lago_id == '12345'
53
+ assert response.recurring_transaction_rules.__root__[0].rule_type == 'interval'
54
+ assert response.recurring_transaction_rules.__root__[0].interval == 'monthly'
44
55
 
45
56
 
46
57
  def test_invalid_create_wallet_request(httpx_mock: HTTPXMock):
@@ -1,34 +0,0 @@
1
- from typing import Optional
2
-
3
- from pydantic import BaseModel
4
-
5
- from ..base_model import BaseResponseModel
6
-
7
-
8
- class Wallet(BaseModel):
9
- external_customer_id: Optional[str]
10
- rate_amount: Optional[str]
11
- name: Optional[str]
12
- paid_credits: Optional[str]
13
- granted_credits: Optional[str]
14
- expiration_at: Optional[str]
15
- currency: Optional[str]
16
-
17
-
18
- class WalletResponse(BaseResponseModel):
19
- lago_id: str
20
- lago_customer_id: str
21
- external_customer_id: str
22
- status: str
23
- currency: str
24
- name: Optional[str]
25
- rate_amount: str
26
- credits_balance: str
27
- balance_cents: int
28
- consumed_credits: str
29
- created_at: str
30
- expiration_at: Optional[str]
31
- last_balance_sync_at: Optional[str]
32
- last_consumed_credit_at: Optional[str]
33
- terminated_at: Optional[str]
34
- balance: str # NOTE(legacy)
@@ -1 +0,0 @@
1
- LAGO_VERSION = '0.52.1'
@@ -1,29 +0,0 @@
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.outstanding_invoice import OutstandingInvoiceResponse
9
-
10
-
11
- def mock_collection_response():
12
- current_dir = os.path.dirname(os.path.abspath(__file__))
13
- data_path = os.path.join(current_dir, 'fixtures/outstanding_invoice_index.json')
14
-
15
- with open(data_path, 'rb') as outstanding_invoices_response:
16
- return outstanding_invoices_response.read()
17
-
18
-
19
- def test_valid_find_all_outstanding_invoices_request(httpx_mock: HTTPXMock):
20
- client = Client(api_key='886fe239-927d-4072-ab72-6dd345e8dd0d')
21
-
22
- httpx_mock.add_response(method='GET', url='https://api.getlago.com/api/v1/analytics/outstanding_invoices', content=mock_collection_response())
23
- response = client.outstanding_invoices.find_all()
24
-
25
- assert response['outstanding_invoices'][0].currency == 'EUR'
26
- assert response['outstanding_invoices'][0].amount_cents == 100
27
- assert response['outstanding_invoices'][0].month == '2023-11-01T00:00:00.000Z'
28
- assert response['outstanding_invoices'][0].invoices_count == 10
29
- assert response['outstanding_invoices'][0].payment_status == 'pending'