lago-python-client 1.36.0__tar.gz → 1.40.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 (171) hide show
  1. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/PKG-INFO +1 -1
  2. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/credit_notes/clients.py +53 -1
  3. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/models/__init__.py +10 -0
  4. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/models/credit_note.py +6 -1
  5. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/models/customer_usage.py +1 -1
  6. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/models/event.py +2 -2
  7. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/models/fee.py +1 -0
  8. lago_python_client-1.40.0/lago_python_client/models/fixed_charge.py +80 -0
  9. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/models/plan.py +14 -1
  10. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/models/wallet.py +4 -0
  11. lago_python_client-1.40.0/lago_python_client/plans/clients.py +83 -0
  12. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/services/request.py +1 -0
  13. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/subscriptions/clients.py +18 -1
  14. lago_python_client-1.40.0/lago_python_client/version.py +1 -0
  15. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/wallets/clients.py +60 -2
  16. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client.egg-info/PKG-INFO +1 -1
  17. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client.egg-info/SOURCES.txt +2 -0
  18. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/tests/test_credit_note_client.py +65 -0
  19. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/tests/test_event_client.py +24 -0
  20. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/tests/test_fee_client.py +21 -0
  21. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/tests/test_plan_client.py +122 -0
  22. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/tests/test_subscription_client.py +104 -0
  23. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/tests/test_wallet_client.py +68 -0
  24. lago_python_client-1.36.0/lago_python_client/plans/clients.py +0 -24
  25. lago_python_client-1.36.0/lago_python_client/version.py +0 -1
  26. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/LICENSE +0 -0
  27. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/README.md +0 -0
  28. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/__init__.py +0 -0
  29. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/activity_logs/__init__.py +0 -0
  30. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/activity_logs/clients.py +0 -0
  31. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/add_ons/__init__.py +0 -0
  32. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/add_ons/clients.py +0 -0
  33. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/api_logs/__init__.py +0 -0
  34. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/api_logs/clients.py +0 -0
  35. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/base_client.py +0 -0
  36. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/base_model.py +0 -0
  37. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/billable_metrics/__init__.py +0 -0
  38. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/billable_metrics/clients.py +0 -0
  39. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/billing_entities/__init__.py +0 -0
  40. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/billing_entities/clients.py +0 -0
  41. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/client.py +0 -0
  42. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/coupons/__init__.py +0 -0
  43. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/coupons/clients.py +0 -0
  44. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/credit_notes/__init__.py +0 -0
  45. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/customers/__init__.py +0 -0
  46. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/customers/applied_coupons_client.py +0 -0
  47. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/customers/clients.py +0 -0
  48. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/customers/credit_notes_client.py +0 -0
  49. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/customers/invoices_client.py +0 -0
  50. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/customers/payment_requests_client.py +0 -0
  51. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/customers/payments_client.py +0 -0
  52. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/customers/subscriptions_client.py +0 -0
  53. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/customers/wallets_client.py +0 -0
  54. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/events/__init__.py +0 -0
  55. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/events/clients.py +0 -0
  56. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/exceptions.py +0 -0
  57. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/fees/__init__.py +0 -0
  58. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/fees/clients.py +0 -0
  59. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/functools_ext.py +0 -0
  60. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/gross_revenues/__init__.py +0 -0
  61. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/gross_revenues/clients.py +0 -0
  62. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/invoice_collections/__init__.py +0 -0
  63. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/invoice_collections/clients.py +0 -0
  64. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/invoiced_usages/__init__.py +0 -0
  65. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/invoiced_usages/clients.py +0 -0
  66. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/invoices/__init__.py +0 -0
  67. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/invoices/clients.py +0 -0
  68. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/mixins.py +0 -0
  69. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/models/activity_log.py +0 -0
  70. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/models/add_on.py +0 -0
  71. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/models/api_log.py +0 -0
  72. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/models/applied_coupon.py +0 -0
  73. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/models/billable_metric.py +0 -0
  74. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/models/billing_entity.py +0 -0
  75. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/models/billing_period.py +0 -0
  76. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/models/charge.py +0 -0
  77. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/models/coupon.py +0 -0
  78. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/models/credit.py +0 -0
  79. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/models/customer.py +0 -0
  80. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/models/customer_projected_usage.py +0 -0
  81. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/models/error_detail.py +0 -0
  82. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/models/gross_revenue.py +0 -0
  83. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/models/invoice.py +0 -0
  84. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/models/invoice_collection.py +0 -0
  85. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/models/invoice_custom_section.py +0 -0
  86. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/models/invoice_item.py +0 -0
  87. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/models/invoiced_usage.py +0 -0
  88. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/models/lifetime_usage.py +0 -0
  89. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/models/minimum_commitment.py +0 -0
  90. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/models/mrr.py +0 -0
  91. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/models/organization.py +0 -0
  92. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/models/overdue_balance.py +0 -0
  93. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/models/payment.py +0 -0
  94. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/models/payment_receipt.py +0 -0
  95. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/models/payment_request.py +0 -0
  96. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/models/subscription.py +0 -0
  97. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/models/tax.py +0 -0
  98. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/models/usage.py +0 -0
  99. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/models/usage_threshold.py +0 -0
  100. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/models/wallet_transaction.py +0 -0
  101. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/models/webhook_endpoint.py +0 -0
  102. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/mrrs/__init__.py +0 -0
  103. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/mrrs/clients.py +0 -0
  104. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/organizations/__init__.py +0 -0
  105. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/organizations/clients.py +0 -0
  106. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/overdue_balances/__init__.py +0 -0
  107. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/overdue_balances/clients.py +0 -0
  108. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/payment_receipts/__init__.py +0 -0
  109. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/payment_receipts/clients.py +0 -0
  110. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/payment_requests/__init__.py +0 -0
  111. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/payment_requests/clients.py +0 -0
  112. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/payments/__init__.py +0 -0
  113. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/payments/clients.py +0 -0
  114. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/plans/__init__.py +0 -0
  115. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/py.typed +0 -0
  116. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/services/__init__.py +0 -0
  117. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/services/json.py +0 -0
  118. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/services/response.py +0 -0
  119. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/subscriptions/__init__.py +0 -0
  120. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/taxes/__init__.py +0 -0
  121. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/taxes/clients.py +0 -0
  122. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/usages/__init__.py +0 -0
  123. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/usages/clients.py +0 -0
  124. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/wallets/__init__.py +0 -0
  125. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/webhook_endpoints/__init__.py +0 -0
  126. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/webhook_endpoints/clients.py +0 -0
  127. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/webhooks/__init__.py +0 -0
  128. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client/webhooks/clients.py +0 -0
  129. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client.egg-info/dependency_links.txt +0 -0
  130. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client.egg-info/requires.txt +0 -0
  131. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/lago_python_client.egg-info/top_level.txt +0 -0
  132. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/pyproject.toml +0 -0
  133. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/setup.cfg +0 -0
  134. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/tests/__init__.py +0 -0
  135. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/tests/test_activity_logs_client.py +0 -0
  136. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/tests/test_add_on_client.py +0 -0
  137. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/tests/test_api_logs_client.py +0 -0
  138. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/tests/test_applied_coupon_client.py +0 -0
  139. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/tests/test_billable_metric_client.py +0 -0
  140. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/tests/test_billing_entity_client.py +0 -0
  141. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/tests/test_client.py +0 -0
  142. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/tests/test_coupon_client.py +0 -0
  143. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/tests/test_customer_applied_coupons_client.py +0 -0
  144. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/tests/test_customer_client.py +0 -0
  145. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/tests/test_customer_credit_notes_client.py +0 -0
  146. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/tests/test_customer_invoices_client.py +0 -0
  147. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/tests/test_customer_payment_requests_client.py +0 -0
  148. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/tests/test_customer_payments_client.py +0 -0
  149. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/tests/test_customer_sbscriptions_client.py +0 -0
  150. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/tests/test_customer_wallets_client.py +0 -0
  151. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/tests/test_functools_ext.py +0 -0
  152. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/tests/test_gross_revenue_client.py +0 -0
  153. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/tests/test_invoice_client.py +0 -0
  154. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/tests/test_invoice_collection_client.py +0 -0
  155. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/tests/test_invoiced_usage_client.py +0 -0
  156. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/tests/test_json_services.py +0 -0
  157. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/tests/test_mrr_client.py +0 -0
  158. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/tests/test_organization_client.py +0 -0
  159. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/tests/test_overdue_balance_client.py +0 -0
  160. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/tests/test_payment_client.py +0 -0
  161. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/tests/test_payment_receipt_client.py +0 -0
  162. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/tests/test_payment_request_client.py +0 -0
  163. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/tests/test_request_services.py +0 -0
  164. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/tests/test_response_services.py +0 -0
  165. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/tests/test_tax_client.py +0 -0
  166. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/tests/test_usage_client.py +0 -0
  167. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/tests/test_wallet_transaction_client.py +0 -0
  168. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/tests/test_webhook_client.py +0 -0
  169. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/tests/test_webhook_endpoint_client.py +0 -0
  170. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/tests/utils/__init__.py +0 -0
  171. {lago_python_client-1.36.0 → lago_python_client-1.40.0}/tests/utils/mixin.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lago-python-client
3
- Version: 1.36.0
3
+ Version: 1.40.0
4
4
  Summary: Lago Python API Client
5
5
  Home-page: https://github.com/getlago/lago-python-client
6
6
  Author: Lovro Colic
@@ -1,4 +1,4 @@
1
- from typing import ClassVar, Optional, Type
1
+ from typing import ClassVar, Dict, Optional, Type
2
2
 
3
3
  from ..base_client import BaseClient
4
4
  from ..mixins import (
@@ -16,6 +16,8 @@ from ..services.json import to_json
16
16
  from ..services.request import (
17
17
  make_headers,
18
18
  make_url,
19
+ send_delete_request,
20
+ send_patch_request,
19
21
  send_post_request,
20
22
  send_put_request,
21
23
  )
@@ -84,3 +86,53 @@ class CreditNoteClient(
84
86
  response_model=CreditNoteEstimatedResponse,
85
87
  data=get_response_data(response=api_response, key=self.ESTIMATE_API_RESOURCE),
86
88
  )
89
+
90
+ def replace_metadata(
91
+ self, resource_id: str, metadata: Dict[str, Optional[str]]
92
+ ) -> Optional[Dict[str, Optional[str]]]:
93
+ api_response: Response = send_post_request(
94
+ url=make_url(
95
+ origin=self.base_url,
96
+ path_parts=(self.API_RESOURCE, resource_id, "metadata"),
97
+ ),
98
+ content=to_json({"metadata": metadata}),
99
+ headers=make_headers(api_key=self.api_key),
100
+ )
101
+
102
+ return get_response_data(response=api_response, key="metadata")
103
+
104
+ def merge_metadata(
105
+ self, resource_id: str, metadata: Dict[str, Optional[str]]
106
+ ) -> Optional[Dict[str, Optional[str]]]:
107
+ api_response: Response = send_patch_request(
108
+ url=make_url(
109
+ origin=self.base_url,
110
+ path_parts=(self.API_RESOURCE, resource_id, "metadata"),
111
+ ),
112
+ content=to_json({"metadata": metadata}),
113
+ headers=make_headers(api_key=self.api_key),
114
+ )
115
+
116
+ return get_response_data(response=api_response, key="metadata")
117
+
118
+ def delete_all_metadata(self, resource_id: str) -> Optional[Dict[str, Optional[str]]]:
119
+ api_response: Response = send_delete_request(
120
+ url=make_url(
121
+ origin=self.base_url,
122
+ path_parts=(self.API_RESOURCE, resource_id, "metadata"),
123
+ ),
124
+ headers=make_headers(api_key=self.api_key),
125
+ )
126
+
127
+ return get_response_data(response=api_response, key="metadata")
128
+
129
+ def delete_metadata_key(self, resource_id: str, key: str) -> Optional[Dict[str, Optional[str]]]:
130
+ api_response: Response = send_delete_request(
131
+ url=make_url(
132
+ origin=self.base_url,
133
+ path_parts=(self.API_RESOURCE, resource_id, "metadata", key),
134
+ ),
135
+ headers=make_headers(api_key=self.api_key),
136
+ )
137
+
138
+ return get_response_data(response=api_response, key="metadata")
@@ -27,6 +27,16 @@ from .charge import (
27
27
  ChargeFilter as ChargeFilter,
28
28
  )
29
29
  from .coupon import Coupon as Coupon, CouponsList as CouponsList, LimitationConfiguration as LimitationConfiguration
30
+ from .fixed_charge import (
31
+ FixedCharge as FixedCharge,
32
+ FixedCharges as FixedCharges,
33
+ FixedChargeResponse as FixedChargeResponse,
34
+ FixedChargesResponse as FixedChargesResponse,
35
+ FixedChargeProperties as FixedChargeProperties,
36
+ FixedChargeGraduatedRange as FixedChargeGraduatedRange,
37
+ FixedChargeOverrides as FixedChargeOverrides,
38
+ FixedChargesOverrides as FixedChargesOverrides,
39
+ )
30
40
  from .credit import CreditResponse as CreditResponse, CreditsResponse as CreditsResponse
31
41
  from .credit_note import (
32
42
  Item as Item,
@@ -1,4 +1,4 @@
1
- from typing import List, Optional
1
+ from typing import Dict, List, Optional
2
2
 
3
3
  from lago_python_client.base_model import BaseModel
4
4
 
@@ -49,6 +49,7 @@ class CreditNoteResponse(BaseResponseModel):
49
49
  credit_amount_cents: int
50
50
  balance_amount_cents: int
51
51
  refund_amount_cents: int
52
+ offset_amount_cents: int
52
53
  taxes_amount_cents: str
53
54
  taxes_rate: float
54
55
  sub_total_excluding_taxes_amount_cents: int
@@ -58,6 +59,7 @@ class CreditNoteResponse(BaseResponseModel):
58
59
  updated_at: Optional[str]
59
60
  items: Optional[ItemsResponse]
60
61
  applied_taxes: Optional[CreditNoteAppliedTaxes]
62
+ metadata: Optional[Dict[str, Optional[str]]]
61
63
 
62
64
 
63
65
  class Item(BaseModel):
@@ -72,10 +74,12 @@ class Items(BaseModel):
72
74
  class CreditNote(BaseModel):
73
75
  reason: Optional[str]
74
76
  items: Optional[Items]
77
+ metadata: Optional[Dict[str, Optional[str]]]
75
78
 
76
79
 
77
80
  class CreditNoteUpdate(BaseModel):
78
81
  refund_status: Optional[str]
82
+ metadata: Optional[Dict[str, Optional[str]]]
79
83
 
80
84
 
81
85
  class EstimatedItemResponse(BaseResponseModel):
@@ -108,6 +112,7 @@ class CreditNoteEstimatedResponse(BaseResponseModel):
108
112
  currency: str
109
113
  max_creditable_amount_cents: int
110
114
  max_refundable_amount_cents: int
115
+ max_offsettable_amount_cents: int
111
116
  taxes_amount_cents: str
112
117
  taxes_rate: float
113
118
  sub_total_excluding_taxes_amount_cents: int
@@ -20,7 +20,7 @@ class PricingUnitDetails(BaseModel):
20
20
 
21
21
  class ChargeFilterUsage(BaseModel):
22
22
  invoice_display_name: Optional[str]
23
- values: Dict[str, List[str]]
23
+ values: Optional[Dict[str, List[str]]]
24
24
  total_aggregated_units: str
25
25
  units: str
26
26
  amount_cents: int
@@ -19,7 +19,7 @@ class BatchEvent(BaseModel):
19
19
 
20
20
 
21
21
  class EventResponse(BaseResponseModel):
22
- lago_id: str
22
+ lago_id: Optional[str]
23
23
  transaction_id: str
24
24
  lago_customer_id: Optional[str]
25
25
  lago_subscription_id: Optional[str]
@@ -28,7 +28,7 @@ class EventResponse(BaseResponseModel):
28
28
  timestamp: str
29
29
  precise_total_amount_cents: Optional[str]
30
30
  properties: Optional[Dict[str, Any]]
31
- created_at: str
31
+ created_at: Optional[str]
32
32
 
33
33
 
34
34
  class BatchEventResponse(BaseResponseModel):
@@ -41,6 +41,7 @@ class FeeResponse(BaseResponseModel):
41
41
  lago_id: Optional[str]
42
42
  lago_charge_id: Optional[str]
43
43
  lago_charge_filter_id: Optional[str]
44
+ lago_fixed_charge_id: Optional[str]
44
45
  lago_invoice_id: Optional[str]
45
46
  lago_true_up_fee_id: Optional[str]
46
47
  lago_true_up_parent_fee_id: Optional[str]
@@ -0,0 +1,80 @@
1
+ from typing import List, Optional
2
+
3
+ from lago_python_client.base_model import BaseModel
4
+
5
+ from .tax import TaxesResponse
6
+ from ..base_model import BaseResponseModel
7
+
8
+
9
+ class FixedChargeGraduatedRange(BaseModel):
10
+ from_value: Optional[int]
11
+ to_value: Optional[int]
12
+ flat_amount: Optional[str]
13
+ per_unit_amount: Optional[str]
14
+
15
+
16
+ class FixedChargeGraduatedRanges(BaseModel):
17
+ __root__: List[FixedChargeGraduatedRange]
18
+
19
+
20
+ class FixedChargeProperties(BaseModel):
21
+ amount: Optional[str]
22
+ graduated_ranges: Optional[List[FixedChargeGraduatedRange]]
23
+ volume_ranges: Optional[List[FixedChargeGraduatedRange]]
24
+
25
+
26
+ class FixedCharge(BaseModel):
27
+ id: Optional[str]
28
+ add_on_id: Optional[str]
29
+ charge_model: Optional[str]
30
+ code: Optional[str]
31
+ invoice_display_name: Optional[str]
32
+ units: Optional[float]
33
+ pay_in_advance: Optional[bool]
34
+ prorated: Optional[bool]
35
+ properties: Optional[FixedChargeProperties]
36
+ tax_codes: Optional[List[str]]
37
+ apply_units_immediately: Optional[bool]
38
+
39
+
40
+ class FixedCharges(BaseModel):
41
+ __root__: List[FixedCharge]
42
+
43
+
44
+ class FixedChargePropertiesResponse(BaseResponseModel):
45
+ amount: Optional[str]
46
+ graduated_ranges: Optional[List[FixedChargeGraduatedRange]]
47
+ volume_ranges: Optional[List[FixedChargeGraduatedRange]]
48
+
49
+
50
+ class FixedChargeResponse(BaseResponseModel):
51
+ lago_id: str
52
+ lago_add_on_id: str
53
+ invoice_display_name: str
54
+ add_on_code: str
55
+ created_at: str
56
+ code: Optional[str]
57
+ charge_model: str
58
+ pay_in_advance: bool
59
+ prorated: bool
60
+ properties: Optional[FixedChargePropertiesResponse]
61
+ units: Optional[float]
62
+ lago_parent_id: Optional[str]
63
+ taxes: Optional[TaxesResponse]
64
+
65
+
66
+ class FixedChargesResponse(BaseResponseModel):
67
+ __root__: List[FixedChargeResponse]
68
+
69
+
70
+ class FixedChargeOverrides(BaseModel):
71
+ id: Optional[str]
72
+ invoice_display_name: Optional[str]
73
+ units: Optional[float]
74
+ apply_units_immediately: Optional[bool]
75
+ properties: Optional[FixedChargeProperties]
76
+ tax_codes: Optional[List[str]]
77
+
78
+
79
+ class FixedChargesOverrides(BaseModel):
80
+ __root__: List[FixedChargeOverrides]
@@ -1,8 +1,13 @@
1
- from typing import List, Optional
1
+ from typing import Dict, List, Optional
2
2
 
3
3
  from lago_python_client.base_model import BaseModel
4
4
 
5
5
  from .charge import Charges, ChargesResponse, ChargesOverrides
6
+ from .fixed_charge import (
7
+ FixedCharges,
8
+ FixedChargesResponse,
9
+ FixedChargesOverrides,
10
+ )
6
11
  from .usage_threshold import (
7
12
  UsageThresholds,
8
13
  UsageThresholdsResponse,
@@ -28,11 +33,14 @@ class Plan(BaseModel):
28
33
  trial_period: Optional[float]
29
34
  pay_in_advance: Optional[bool]
30
35
  bill_charges_monthly: Optional[bool]
36
+ bill_fixed_charges_monthly: Optional[bool]
31
37
  charges: Optional[Charges]
38
+ fixed_charges: Optional[FixedCharges]
32
39
  minimum_commitment: Optional[MinimumCommitment]
33
40
  usage_thresholds: Optional[UsageThresholds]
34
41
  tax_codes: Optional[List[str]]
35
42
  cascade_updates: Optional[bool]
43
+ metadata: Optional[Dict[str, Optional[str]]]
36
44
 
37
45
 
38
46
  class PlanResponse(BaseResponseModel):
@@ -48,10 +56,13 @@ class PlanResponse(BaseResponseModel):
48
56
  trial_period: Optional[float]
49
57
  pay_in_advance: Optional[bool]
50
58
  bill_charges_monthly: Optional[bool]
59
+ bill_fixed_charges_monthly: Optional[bool]
51
60
  charges: Optional[ChargesResponse]
61
+ fixed_charges: Optional[FixedChargesResponse]
52
62
  minimum_commitment: Optional[MinimumCommitmentResponse]
53
63
  usage_thresholds: Optional[UsageThresholdsResponse]
54
64
  taxes: Optional[TaxesResponse]
65
+ metadata: Optional[Dict[str, Optional[str]]]
55
66
 
56
67
 
57
68
  class PlanOverrides(BaseModel):
@@ -62,6 +73,8 @@ class PlanOverrides(BaseModel):
62
73
  amount_currency: Optional[str]
63
74
  trial_period: Optional[float]
64
75
  charges: Optional[ChargesOverrides]
76
+ fixed_charges: Optional[FixedChargesOverrides]
65
77
  minimum_commitment: Optional[MinimumCommitmentOverrides]
66
78
  usage_thresholds: Optional[UsageThresholdsOverrides]
67
79
  tax_codes: Optional[List[str]]
80
+ metadata: Optional[Dict[str, Optional[str]]]
@@ -56,6 +56,7 @@ class Wallet(BaseModel):
56
56
  external_customer_id: Optional[str]
57
57
  rate_amount: Optional[str]
58
58
  name: Optional[str]
59
+ priority: Optional[int]
59
60
  paid_credits: Optional[str]
60
61
  granted_credits: Optional[str]
61
62
  expiration_at: Optional[str]
@@ -68,6 +69,7 @@ class Wallet(BaseModel):
68
69
  paid_top_up_max_amount_cents: Optional[int]
69
70
  paid_top_up_min_amount_cents: Optional[int]
70
71
  ignore_paid_top_up_limits_on_creation: Optional[bool]
72
+ metadata: Optional[Dict[str, Optional[str]]]
71
73
 
72
74
 
73
75
  class WalletResponse(BaseResponseModel):
@@ -77,6 +79,7 @@ class WalletResponse(BaseResponseModel):
77
79
  status: str
78
80
  currency: str
79
81
  name: Optional[str]
82
+ priority: Optional[int]
80
83
  rate_amount: str
81
84
  credits_balance: str
82
85
  balance_cents: int
@@ -95,3 +98,4 @@ class WalletResponse(BaseResponseModel):
95
98
  invoice_requires_successful_payment: Optional[bool]
96
99
  paid_top_up_max_amount_cents: Optional[int]
97
100
  paid_top_up_min_amount_cents: Optional[int]
101
+ metadata: Optional[Dict[str, Optional[str]]]
@@ -0,0 +1,83 @@
1
+ from typing import ClassVar, Dict, Optional, Type
2
+
3
+ from ..base_client import BaseClient
4
+ from ..mixins import (
5
+ CreateCommandMixin,
6
+ DestroyCommandMixin,
7
+ FindAllCommandMixin,
8
+ FindCommandMixin,
9
+ UpdateCommandMixin,
10
+ )
11
+ from ..models.plan import PlanResponse
12
+ from ..services.json import to_json
13
+ from ..services.request import (
14
+ make_headers,
15
+ make_url,
16
+ send_delete_request,
17
+ send_patch_request,
18
+ send_post_request,
19
+ )
20
+ from ..services.response import get_response_data, Response
21
+
22
+
23
+ class PlanClient(
24
+ CreateCommandMixin[PlanResponse],
25
+ DestroyCommandMixin[PlanResponse],
26
+ FindAllCommandMixin[PlanResponse],
27
+ FindCommandMixin[PlanResponse],
28
+ UpdateCommandMixin[PlanResponse],
29
+ BaseClient,
30
+ ):
31
+ API_RESOURCE: ClassVar[str] = "plans"
32
+ RESPONSE_MODEL: ClassVar[Type[PlanResponse]] = PlanResponse
33
+ ROOT_NAME: ClassVar[str] = "plan"
34
+
35
+ def replace_metadata(
36
+ self, resource_id: str, metadata: Dict[str, Optional[str]]
37
+ ) -> Optional[Dict[str, Optional[str]]]:
38
+ api_response: Response = send_post_request(
39
+ url=make_url(
40
+ origin=self.base_url,
41
+ path_parts=(self.API_RESOURCE, resource_id, "metadata"),
42
+ ),
43
+ content=to_json({"metadata": metadata}),
44
+ headers=make_headers(api_key=self.api_key),
45
+ )
46
+
47
+ return get_response_data(response=api_response, key="metadata")
48
+
49
+ def merge_metadata(
50
+ self, resource_id: str, metadata: Dict[str, Optional[str]]
51
+ ) -> Optional[Dict[str, Optional[str]]]:
52
+ api_response: Response = send_patch_request(
53
+ url=make_url(
54
+ origin=self.base_url,
55
+ path_parts=(self.API_RESOURCE, resource_id, "metadata"),
56
+ ),
57
+ content=to_json({"metadata": metadata}),
58
+ headers=make_headers(api_key=self.api_key),
59
+ )
60
+
61
+ return get_response_data(response=api_response, key="metadata")
62
+
63
+ def delete_all_metadata(self, resource_id: str) -> Optional[Dict[str, Optional[str]]]:
64
+ api_response: Response = send_delete_request(
65
+ url=make_url(
66
+ origin=self.base_url,
67
+ path_parts=(self.API_RESOURCE, resource_id, "metadata"),
68
+ ),
69
+ headers=make_headers(api_key=self.api_key),
70
+ )
71
+
72
+ return get_response_data(response=api_response, key="metadata")
73
+
74
+ def delete_metadata_key(self, resource_id: str, key: str) -> Optional[Dict[str, Optional[str]]]:
75
+ api_response: Response = send_delete_request(
76
+ url=make_url(
77
+ origin=self.base_url,
78
+ path_parts=(self.API_RESOURCE, resource_id, "metadata", key),
79
+ ),
80
+ headers=make_headers(api_key=self.api_key),
81
+ )
82
+
83
+ return get_response_data(response=api_response, key="metadata")
@@ -54,4 +54,5 @@ def make_headers(*, api_key: str) -> Mapping[str, str]:
54
54
  send_get_request = httpx.get
55
55
  send_post_request = httpx.post
56
56
  send_put_request = httpx.put
57
+ send_patch_request = httpx.patch
57
58
  send_delete_request = httpx.delete
@@ -1,4 +1,4 @@
1
- from typing import ClassVar, Type
1
+ from typing import Any, ClassVar, Mapping, Type
2
2
 
3
3
  from ..base_client import BaseClient
4
4
  from ..mixins import (
@@ -8,6 +8,7 @@ from ..mixins import (
8
8
  FindCommandMixin,
9
9
  UpdateCommandMixin,
10
10
  )
11
+ from ..models.fixed_charge import FixedChargeResponse
11
12
  from ..models.lifetime_usage import LifetimeUsageResponse
12
13
  from ..models.subscription import SubscriptionResponse
13
14
  from ..services.request import (
@@ -19,6 +20,7 @@ from ..services.request import (
19
20
  from ..services.response import (
20
21
  Response,
21
22
  get_response_data,
23
+ prepare_index_response,
22
24
  prepare_object_response,
23
25
  )
24
26
  from ..services.json import to_json
@@ -68,3 +70,18 @@ class SubscriptionClient(
68
70
  response_model=LifetimeUsageResponse,
69
71
  data=get_response_data(response=api_response, key="lifetime_usage"),
70
72
  )
73
+
74
+ def find_all_fixed_charges(self, external_id: str) -> Mapping[str, Any]:
75
+ api_response: Response = send_get_request(
76
+ url=make_url(
77
+ origin=self.base_url,
78
+ path_parts=(self.API_RESOURCE, external_id, "fixed_charges"),
79
+ ),
80
+ headers=make_headers(api_key=self.api_key),
81
+ )
82
+
83
+ return prepare_index_response(
84
+ api_resource="fixed_charges",
85
+ response_model=FixedChargeResponse,
86
+ data=get_response_data(response=api_response),
87
+ )
@@ -0,0 +1 @@
1
+ LAGO_VERSION = "1.40.0"
@@ -1,5 +1,5 @@
1
1
  import sys
2
- from typing import Any, ClassVar, Type
2
+ from typing import Any, ClassVar, Dict, Optional, Type
3
3
 
4
4
  from lago_python_client.base_model import BaseModel
5
5
 
@@ -14,7 +14,15 @@ from ..mixins import (
14
14
  from ..models.wallet import WalletResponse
15
15
  from ..models.wallet_transaction import WalletTransactionResponse
16
16
  from ..services.json import to_json
17
- from ..services.request import make_headers, make_url, send_get_request, send_post_request, QueryPairs
17
+ from ..services.request import (
18
+ make_headers,
19
+ make_url,
20
+ send_delete_request,
21
+ send_get_request,
22
+ send_patch_request,
23
+ send_post_request,
24
+ QueryPairs,
25
+ )
18
26
  from ..services.response import (
19
27
  get_response_data,
20
28
  prepare_object_list_response,
@@ -40,6 +48,56 @@ class WalletClient(
40
48
  RESPONSE_MODEL: ClassVar[Type[WalletResponse]] = WalletResponse
41
49
  ROOT_NAME: ClassVar[str] = "wallet"
42
50
 
51
+ def replace_metadata(
52
+ self, resource_id: str, metadata: Dict[str, Optional[str]]
53
+ ) -> Optional[Dict[str, Optional[str]]]:
54
+ api_response: Response = send_post_request(
55
+ url=make_url(
56
+ origin=self.base_url,
57
+ path_parts=(self.API_RESOURCE, resource_id, "metadata"),
58
+ ),
59
+ content=to_json({"metadata": metadata}),
60
+ headers=make_headers(api_key=self.api_key),
61
+ )
62
+
63
+ return get_response_data(response=api_response, key="metadata")
64
+
65
+ def merge_metadata(
66
+ self, resource_id: str, metadata: Dict[str, Optional[str]]
67
+ ) -> Optional[Dict[str, Optional[str]]]:
68
+ api_response: Response = send_patch_request(
69
+ url=make_url(
70
+ origin=self.base_url,
71
+ path_parts=(self.API_RESOURCE, resource_id, "metadata"),
72
+ ),
73
+ content=to_json({"metadata": metadata}),
74
+ headers=make_headers(api_key=self.api_key),
75
+ )
76
+
77
+ return get_response_data(response=api_response, key="metadata")
78
+
79
+ def delete_all_metadata(self, resource_id: str) -> Optional[Dict[str, Optional[str]]]:
80
+ api_response: Response = send_delete_request(
81
+ url=make_url(
82
+ origin=self.base_url,
83
+ path_parts=(self.API_RESOURCE, resource_id, "metadata"),
84
+ ),
85
+ headers=make_headers(api_key=self.api_key),
86
+ )
87
+
88
+ return get_response_data(response=api_response, key="metadata")
89
+
90
+ def delete_metadata_key(self, resource_id: str, key: str) -> Optional[Dict[str, Optional[str]]]:
91
+ api_response: Response = send_delete_request(
92
+ url=make_url(
93
+ origin=self.base_url,
94
+ path_parts=(self.API_RESOURCE, resource_id, "metadata", key),
95
+ ),
96
+ headers=make_headers(api_key=self.api_key),
97
+ )
98
+
99
+ return get_response_data(response=api_response, key="metadata")
100
+
43
101
 
44
102
  class WalletTransactionClient(BaseClient):
45
103
  API_RESOURCE: ClassVar[str] = "wallet_transactions"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lago-python-client
3
- Version: 1.36.0
3
+ Version: 1.40.0
4
4
  Summary: Lago Python API Client
5
5
  Home-page: https://github.com/getlago/lago-python-client
6
6
  Author: Lovro Colic
@@ -64,6 +64,7 @@ setup.cfg
64
64
  ./lago_python_client/models/error_detail.py
65
65
  ./lago_python_client/models/event.py
66
66
  ./lago_python_client/models/fee.py
67
+ ./lago_python_client/models/fixed_charge.py
67
68
  ./lago_python_client/models/gross_revenue.py
68
69
  ./lago_python_client/models/invoice.py
69
70
  ./lago_python_client/models/invoice_collection.py
@@ -227,6 +228,7 @@ lago_python_client/models/customer_usage.py
227
228
  lago_python_client/models/error_detail.py
228
229
  lago_python_client/models/event.py
229
230
  lago_python_client/models/fee.py
231
+ lago_python_client/models/fixed_charge.py
230
232
  lago_python_client/models/gross_revenue.py
231
233
  lago_python_client/models/invoice.py
232
234
  lago_python_client/models/invoice_collection.py
@@ -192,3 +192,68 @@ def test_valid_estimate_credit_note_request(httpx_mock: HTTPXMock):
192
192
  response = client.credit_notes.estimate(estimate_credit_note())
193
193
 
194
194
  assert response.lago_invoice_id == "1a901a90-1a90-1a90-1a90-1a901a901a90"
195
+
196
+
197
+ def mock_metadata_response():
198
+ return b'{"metadata": {"foo": "bar", "baz": null}}'
199
+
200
+
201
+ def mock_null_metadata_response():
202
+ return b'{"metadata": null}'
203
+
204
+
205
+ def test_valid_replace_metadata_request(httpx_mock: HTTPXMock):
206
+ client = Client(api_key="886fe239-927d-4072-ab72-6dd345e8dd0d")
207
+ credit_note_id = "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
208
+
209
+ httpx_mock.add_response(
210
+ method="POST",
211
+ url="https://api.getlago.com/api/v1/credit_notes/" + credit_note_id + "/metadata",
212
+ content=mock_metadata_response(),
213
+ )
214
+ response = client.credit_notes.replace_metadata(credit_note_id, {"foo": "bar", "baz": None})
215
+
216
+ assert response == {"foo": "bar", "baz": None}
217
+
218
+
219
+ def test_valid_merge_metadata_request(httpx_mock: HTTPXMock):
220
+ client = Client(api_key="886fe239-927d-4072-ab72-6dd345e8dd0d")
221
+ credit_note_id = "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
222
+
223
+ httpx_mock.add_response(
224
+ method="PATCH",
225
+ url="https://api.getlago.com/api/v1/credit_notes/" + credit_note_id + "/metadata",
226
+ content=mock_metadata_response(),
227
+ )
228
+ response = client.credit_notes.merge_metadata(credit_note_id, {"foo": "qux"})
229
+
230
+ assert response == {"foo": "bar", "baz": None}
231
+
232
+
233
+ def test_valid_delete_all_metadata_request(httpx_mock: HTTPXMock):
234
+ client = Client(api_key="886fe239-927d-4072-ab72-6dd345e8dd0d")
235
+ credit_note_id = "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
236
+
237
+ httpx_mock.add_response(
238
+ method="DELETE",
239
+ url="https://api.getlago.com/api/v1/credit_notes/" + credit_note_id + "/metadata",
240
+ content=mock_null_metadata_response(),
241
+ )
242
+ response = client.credit_notes.delete_all_metadata(credit_note_id)
243
+
244
+ assert response is None
245
+
246
+
247
+ def test_valid_delete_metadata_key_request(httpx_mock: HTTPXMock):
248
+ client = Client(api_key="886fe239-927d-4072-ab72-6dd345e8dd0d")
249
+ credit_note_id = "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
250
+ key = "foo"
251
+
252
+ httpx_mock.add_response(
253
+ method="DELETE",
254
+ url="https://api.getlago.com/api/v1/credit_notes/" + credit_note_id + "/metadata/" + key,
255
+ content=b'{"metadata": {"baz": "qux"}}',
256
+ )
257
+ response = client.credit_notes.delete_metadata_key(credit_note_id, key)
258
+
259
+ assert response == {"baz": "qux"}
@@ -45,6 +45,14 @@ def mock_response():
45
45
  return event_response.read()
46
46
 
47
47
 
48
+ def mock_response_without_ids():
49
+ this_dir = os.path.dirname(os.path.abspath(__file__))
50
+ data_path = os.path.join(this_dir, "fixtures/event_without_ids.json")
51
+
52
+ with open(data_path, "rb") as event_response:
53
+ return event_response.read()
54
+
55
+
48
56
  def mock_unprocessable_entity_response():
49
57
  this_dir = os.path.dirname(os.path.abspath(__file__))
50
58
  data_path = os.path.join(this_dir, "fixtures/event_unprocessable_entity.json")
@@ -135,6 +143,22 @@ def test_valid_find_event_request(httpx_mock: HTTPXMock):
135
143
  assert response.lago_id == event_id
136
144
 
137
145
 
146
+ def test_valid_find_event_without_optional_fields(httpx_mock: HTTPXMock):
147
+ client = Client(api_key="886fe239-927d-4072-ab72-6dd345e8dd0d")
148
+ transaction_id = "1a2d9c8d-5875-4688-9854-5ccfd414bc5e"
149
+
150
+ httpx_mock.add_response(
151
+ method="GET",
152
+ url="https://api.getlago.com/api/v1/events/" + transaction_id,
153
+ content=mock_response_without_ids(),
154
+ )
155
+ response = client.events.find(transaction_id)
156
+
157
+ assert response.lago_id is None
158
+ assert response.created_at is None
159
+ assert response.transaction_id == transaction_id
160
+
161
+
138
162
  def test_invalid_find_events_request(httpx_mock: HTTPXMock):
139
163
  client = Client(api_key="invalid")
140
164
  event_id = "INVALID_EVENT"