cbox_billing 0.1.0

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 (736) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +215 -0
  3. data/cbox_billing.gemspec +26 -0
  4. data/lib/cbox_billing/api/accounting_api.rb +1893 -0
  5. data/lib/cbox_billing/api/affiliates_api.rb +2009 -0
  6. data/lib/cbox_billing/api/agreements_api.rb +552 -0
  7. data/lib/cbox_billing/api/bank_reconciliation_api.rb +505 -0
  8. data/lib/cbox_billing/api/catalog_api.rb +361 -0
  9. data/lib/cbox_billing/api/checkout_portal_api.rb +696 -0
  10. data/lib/cbox_billing/api/coupons_api.rb +538 -0
  11. data/lib/cbox_billing/api/credit_notes_api.rb +403 -0
  12. data/lib/cbox_billing/api/disputes_api.rb +540 -0
  13. data/lib/cbox_billing/api/dunning_api.rb +902 -0
  14. data/lib/cbox_billing/api/enforcement_api.rb +746 -0
  15. data/lib/cbox_billing/api/environments_api.rb +343 -0
  16. data/lib/cbox_billing/api/invoices_api.rb +1662 -0
  17. data/lib/cbox_billing/api/licence_data_api.rb +619 -0
  18. data/lib/cbox_billing/api/licenses_api.rb +293 -0
  19. data/lib/cbox_billing/api/management_api.rb +253 -0
  20. data/lib/cbox_billing/api/meters_api.rb +538 -0
  21. data/lib/cbox_billing/api/orders_and_delivery_api.rb +1745 -0
  22. data/lib/cbox_billing/api/organizations_api.rb +1110 -0
  23. data/lib/cbox_billing/api/payment_gateways_api.rb +227 -0
  24. data/lib/cbox_billing/api/payment_intents_api.rb +376 -0
  25. data/lib/cbox_billing/api/payment_methods_api.rb +96 -0
  26. data/lib/cbox_billing/api/plans_api.rb +654 -0
  27. data/lib/cbox_billing/api/product_access_api.rb +2033 -0
  28. data/lib/cbox_billing/api/quotes_api.rb +1062 -0
  29. data/lib/cbox_billing/api/seats_api.rb +938 -0
  30. data/lib/cbox_billing/api/service_connections_api.rb +245 -0
  31. data/lib/cbox_billing/api/subscriptions_api.rb +4697 -0
  32. data/lib/cbox_billing/api/tax_returns_api.rb +453 -0
  33. data/lib/cbox_billing/api/test_mode_api.rb +96 -0
  34. data/lib/cbox_billing/api/usage_api.rb +1116 -0
  35. data/lib/cbox_billing/api/webhook_endpoints_api.rb +835 -0
  36. data/lib/cbox_billing/api_client.rb +441 -0
  37. data/lib/cbox_billing/api_error.rb +58 -0
  38. data/lib/cbox_billing/api_model_base.rb +88 -0
  39. data/lib/cbox_billing/client.rb +49 -0
  40. data/lib/cbox_billing/configuration.rb +408 -0
  41. data/lib/cbox_billing/enforcement/client.rb +665 -0
  42. data/lib/cbox_billing/enforcement/errors.rb +48 -0
  43. data/lib/cbox_billing/enforcement/stores.rb +129 -0
  44. data/lib/cbox_billing/enforcement/transport.rb +79 -0
  45. data/lib/cbox_billing/enforcement/types.rb +63 -0
  46. data/lib/cbox_billing/enforcement.rb +9 -0
  47. data/lib/cbox_billing/errors.rb +110 -0
  48. data/lib/cbox_billing/idempotency.rb +16 -0
  49. data/lib/cbox_billing/models/accept_agreement201_response.rb +177 -0
  50. data/lib/cbox_billing/models/accept_agreement_request.rb +294 -0
  51. data/lib/cbox_billing/models/accept_agreement_request_user.rb +202 -0
  52. data/lib/cbox_billing/models/access_balance.rb +276 -0
  53. data/lib/cbox_billing/models/access_balance_request.rb +309 -0
  54. data/lib/cbox_billing/models/access_batch.rb +321 -0
  55. data/lib/cbox_billing/models/access_batch_filters.rb +183 -0
  56. data/lib/cbox_billing/models/access_cancel_request.rb +207 -0
  57. data/lib/cbox_billing/models/access_commit_request.rb +207 -0
  58. data/lib/cbox_billing/models/access_entry.rb +383 -0
  59. data/lib/cbox_billing/models/access_grant.rb +287 -0
  60. data/lib/cbox_billing/models/access_grant_request.rb +310 -0
  61. data/lib/cbox_billing/models/access_invitation.rb +404 -0
  62. data/lib/cbox_billing/models/access_invite_request.rb +337 -0
  63. data/lib/cbox_billing/models/access_join_request.rb +369 -0
  64. data/lib/cbox_billing/models/access_program.rb +511 -0
  65. data/lib/cbox_billing/models/access_program_input.rb +433 -0
  66. data/lib/cbox_billing/models/access_redeem_request.rb +335 -0
  67. data/lib/cbox_billing/models/access_redemption.rb +394 -0
  68. data/lib/cbox_billing/models/access_report.rb +250 -0
  69. data/lib/cbox_billing/models/access_report_balances.rb +252 -0
  70. data/lib/cbox_billing/models/access_report_batches.rb +252 -0
  71. data/lib/cbox_billing/models/access_report_entries.rb +252 -0
  72. data/lib/cbox_billing/models/access_report_grants.rb +252 -0
  73. data/lib/cbox_billing/models/access_report_invitations.rb +252 -0
  74. data/lib/cbox_billing/models/access_report_redemptions.rb +252 -0
  75. data/lib/cbox_billing/models/access_restore_grant_request.rb +207 -0
  76. data/lib/cbox_billing/models/access_retry_delivery_request.rb +207 -0
  77. data/lib/cbox_billing/models/access_revoke_grant_request.rb +207 -0
  78. data/lib/cbox_billing/models/access_revoke_invitation200_response.rb +195 -0
  79. data/lib/cbox_billing/models/access_revoke_invitation_request.rb +207 -0
  80. data/lib/cbox_billing/models/access_select200_response.rb +356 -0
  81. data/lib/cbox_billing/models/access_select_request.rb +323 -0
  82. data/lib/cbox_billing/models/account_credit.rb +258 -0
  83. data/lib/cbox_billing/models/account_credit_movements_inner.rb +255 -0
  84. data/lib/cbox_billing/models/account_entitlement.rb +240 -0
  85. data/lib/cbox_billing/models/accounting_connection.rb +336 -0
  86. data/lib/cbox_billing/models/accounting_connection_company.rb +170 -0
  87. data/lib/cbox_billing/models/accounting_contact_conflict.rb +308 -0
  88. data/lib/cbox_billing/models/accounting_contact_import.rb +397 -0
  89. data/lib/cbox_billing/models/accounting_contact_import_counts.rb +308 -0
  90. data/lib/cbox_billing/models/accounting_contact_import_row.rb +363 -0
  91. data/lib/cbox_billing/models/accounting_contact_import_row_candidates_inner.rb +227 -0
  92. data/lib/cbox_billing/models/accounting_contact_sync.rb +351 -0
  93. data/lib/cbox_billing/models/accounting_contact_sync_failure.rb +266 -0
  94. data/lib/cbox_billing/models/accounting_customer_document.rb +318 -0
  95. data/lib/cbox_billing/models/accounting_customer_link.rb +354 -0
  96. data/lib/cbox_billing/models/accounting_customer_link_company.rb +180 -0
  97. data/lib/cbox_billing/models/accounting_customer_link_contact.rb +292 -0
  98. data/lib/cbox_billing/models/accounting_customer_link_contact_sync.rb +291 -0
  99. data/lib/cbox_billing/models/accounting_customer_link_contact_sync_conflicts_inner.rb +237 -0
  100. data/lib/cbox_billing/models/accounting_customer_link_several_contacts_inner.rb +227 -0
  101. data/lib/cbox_billing/models/accounting_customer_link_shared_with_inner.rb +203 -0
  102. data/lib/cbox_billing/models/accounting_invoice.rb +532 -0
  103. data/lib/cbox_billing/models/accounting_invoice_contact.rb +189 -0
  104. data/lib/cbox_billing/models/accounting_sync.rb +356 -0
  105. data/lib/cbox_billing/models/accounting_vendor_contact.rb +307 -0
  106. data/lib/cbox_billing/models/accounting_vendor_link.rb +216 -0
  107. data/lib/cbox_billing/models/activation_bundle.rb +293 -0
  108. data/lib/cbox_billing/models/add_dispute_evidence_file201_response.rb +177 -0
  109. data/lib/cbox_billing/models/add_dispute_evidence_file422_response.rb +104 -0
  110. data/lib/cbox_billing/models/add_dispute_evidence_file_request.rb +261 -0
  111. data/lib/cbox_billing/models/add_invoice_item201_response.rb +177 -0
  112. data/lib/cbox_billing/models/add_invoice_item202_response.rb +228 -0
  113. data/lib/cbox_billing/models/add_invoice_item_request.rb +248 -0
  114. data/lib/cbox_billing/models/add_on.rb +305 -0
  115. data/lib/cbox_billing/models/add_on_preview.rb +170 -0
  116. data/lib/cbox_billing/models/add_on_request.rb +434 -0
  117. data/lib/cbox_billing/models/add_on_result.rb +203 -0
  118. data/lib/cbox_billing/models/add_product_file_request1.rb +233 -0
  119. data/lib/cbox_billing/models/add_subscription_phase201_response.rb +177 -0
  120. data/lib/cbox_billing/models/adjust_affiliate_balance_request.rb +257 -0
  121. data/lib/cbox_billing/models/admit_service_organization200_response.rb +169 -0
  122. data/lib/cbox_billing/models/affiliate.rb +505 -0
  123. data/lib/cbox_billing/models/affiliate_commission.rb +520 -0
  124. data/lib/cbox_billing/models/affiliate_detail.rb +523 -0
  125. data/lib/cbox_billing/models/affiliate_payout.rb +443 -0
  126. data/lib/cbox_billing/models/affiliate_payout_run.rb +446 -0
  127. data/lib/cbox_billing/models/affiliate_payout_run_list.rb +229 -0
  128. data/lib/cbox_billing/models/affiliate_payout_settings.rb +356 -0
  129. data/lib/cbox_billing/models/affiliate_portal_link.rb +203 -0
  130. data/lib/cbox_billing/models/affiliate_program.rb +556 -0
  131. data/lib/cbox_billing/models/affiliate_program_commission.rb +269 -0
  132. data/lib/cbox_billing/models/affiliate_rate_plan.rb +273 -0
  133. data/lib/cbox_billing/models/affiliate_rate_plan_phases_inner.rb +316 -0
  134. data/lib/cbox_billing/models/affiliate_rate_rule.rb +233 -0
  135. data/lib/cbox_billing/models/affiliate_referral.rb +325 -0
  136. data/lib/cbox_billing/models/agreement_block.rb +337 -0
  137. data/lib/cbox_billing/models/agreement_error.rb +227 -0
  138. data/lib/cbox_billing/models/agreement_status.rb +453 -0
  139. data/lib/cbox_billing/models/agreement_status_requires_inner.rb +202 -0
  140. data/lib/cbox_billing/models/align_renewals_request.rb +264 -0
  141. data/lib/cbox_billing/models/allowance_window.rb +269 -0
  142. data/lib/cbox_billing/models/appendix.rb +293 -0
  143. data/lib/cbox_billing/models/appendix_column.rb +257 -0
  144. data/lib/cbox_billing/models/apply_catalog409_response.rb +369 -0
  145. data/lib/cbox_billing/models/apply_subscription_coupon200_response.rb +177 -0
  146. data/lib/cbox_billing/models/apply_subscription_coupon_request.rb +197 -0
  147. data/lib/cbox_billing/models/archive_affiliate_program_request.rb +162 -0
  148. data/lib/cbox_billing/models/auto_top_up.rb +462 -0
  149. data/lib/cbox_billing/models/auto_top_up_attempts_inner.rb +290 -0
  150. data/lib/cbox_billing/models/auto_top_up_limits.rb +230 -0
  151. data/lib/cbox_billing/models/bank_csv_mapping.rb +467 -0
  152. data/lib/cbox_billing/models/bank_import_result.rb +285 -0
  153. data/lib/cbox_billing/models/bank_line.rb +486 -0
  154. data/lib/cbox_billing/models/bank_line_detail.rb +233 -0
  155. data/lib/cbox_billing/models/bank_line_detail_payments_inner.rb +280 -0
  156. data/lib/cbox_billing/models/bank_line_detail_suggestions_inner.rb +267 -0
  157. data/lib/cbox_billing/models/bank_statement.rb +412 -0
  158. data/lib/cbox_billing/models/bank_statement_import.rb +258 -0
  159. data/lib/cbox_billing/models/billing_parent.rb +219 -0
  160. data/lib/cbox_billing/models/billing_policy.rb +299 -0
  161. data/lib/cbox_billing/models/billing_policy_policy.rb +228 -0
  162. data/lib/cbox_billing/models/billing_policy_request.rb +323 -0
  163. data/lib/cbox_billing/models/bundle_benefit.rb +597 -0
  164. data/lib/cbox_billing/models/bundle_benefit_tiers_inner.rb +230 -0
  165. data/lib/cbox_billing/models/bundle_consequence.rb +450 -0
  166. data/lib/cbox_billing/models/bundle_offer.rb +508 -0
  167. data/lib/cbox_billing/models/bundle_offer_plan.rb +398 -0
  168. data/lib/cbox_billing/models/bundle_offer_products_to_add_inner.rb +169 -0
  169. data/lib/cbox_billing/models/bundle_offer_saves.rb +226 -0
  170. data/lib/cbox_billing/models/cancel_preview.rb +264 -0
  171. data/lib/cbox_billing/models/cancel_request.rb +256 -0
  172. data/lib/cbox_billing/models/cancel_subscription200_response.rb +652 -0
  173. data/lib/cbox_billing/models/catalog_changes.rb +286 -0
  174. data/lib/cbox_billing/models/catalog_changes_changes_inner.rb +264 -0
  175. data/lib/cbox_billing/models/catalog_changes_diff_inner.rb +303 -0
  176. data/lib/cbox_billing/models/catalog_changes_diff_inner_fields_inner.rb +180 -0
  177. data/lib/cbox_billing/models/catalog_changes_diff_inner_fields_inner_from.rb +105 -0
  178. data/lib/cbox_billing/models/catalog_changes_impact.rb +215 -0
  179. data/lib/cbox_billing/models/catalog_changes_impact_bundle_repriced_inner.rb +224 -0
  180. data/lib/cbox_billing/models/catalog_changes_impact_sample_inner.rb +169 -0
  181. data/lib/cbox_billing/models/catalog_changes_summary.rb +178 -0
  182. data/lib/cbox_billing/models/catalog_manifest.rb +215 -0
  183. data/lib/cbox_billing/models/catalog_manifest_bundles_inner.rb +344 -0
  184. data/lib/cbox_billing/models/catalog_manifest_bundles_inner_applies_to.rb +199 -0
  185. data/lib/cbox_billing/models/catalog_manifest_bundles_inner_copy_value.rb +263 -0
  186. data/lib/cbox_billing/models/catalog_manifest_bundles_inner_discount.rb +286 -0
  187. data/lib/cbox_billing/models/catalog_manifest_bundles_inner_requires.rb +254 -0
  188. data/lib/cbox_billing/models/catalog_manifest_existing.rb +242 -0
  189. data/lib/cbox_billing/models/catalog_manifest_products_inner.rb +246 -0
  190. data/lib/cbox_billing/models/catalog_manifest_products_inner_features_inner.rb +269 -0
  191. data/lib/cbox_billing/models/catalog_manifest_products_inner_meters_inner.rb +410 -0
  192. data/lib/cbox_billing/models/catalog_manifest_products_inner_plans_inner.rb +258 -0
  193. data/lib/cbox_billing/models/catalog_manifest_products_inner_plans_inner_meters_value.rb +356 -0
  194. data/lib/cbox_billing/models/catalog_manifest_products_inner_plans_inner_meters_value_price_value.rb +471 -0
  195. data/lib/cbox_billing/models/catalog_manifest_products_inner_plans_inner_meters_value_price_value_matrix_inner.rb +274 -0
  196. data/lib/cbox_billing/models/catalog_manifest_products_inner_plans_inner_meters_value_price_value_rates_inner.rb +216 -0
  197. data/lib/cbox_billing/models/change_subscription_dates200_response.rb +187 -0
  198. data/lib/cbox_billing/models/change_subscription_dates_request.rb +325 -0
  199. data/lib/cbox_billing/models/charged_invoice.rb +322 -0
  200. data/lib/cbox_billing/models/check_service_admission200_response.rb +178 -0
  201. data/lib/cbox_billing/models/checkout_session_request.rb +354 -0
  202. data/lib/cbox_billing/models/checkout_session_request_items_inner.rb +217 -0
  203. data/lib/cbox_billing/models/choose_accounting_contact_import_row200_response.rb +177 -0
  204. data/lib/cbox_billing/models/clear_subscription_end_date200_response.rb +162 -0
  205. data/lib/cbox_billing/models/commit_request.rb +214 -0
  206. data/lib/cbox_billing/models/commit_request_actuals_inner.rb +212 -0
  207. data/lib/cbox_billing/models/commitment.rb +499 -0
  208. data/lib/cbox_billing/models/commitment_ramp_step.rb +221 -0
  209. data/lib/cbox_billing/models/commitment_refusal.rb +239 -0
  210. data/lib/cbox_billing/models/commitment_request.rb +409 -0
  211. data/lib/cbox_billing/models/commitment_response.rb +203 -0
  212. data/lib/cbox_billing/models/commitment_term.rb +227 -0
  213. data/lib/cbox_billing/models/confirm_accounting_contact_import200_response.rb +177 -0
  214. data/lib/cbox_billing/models/confirm_accounting_contact_import_request.rb +190 -0
  215. data/lib/cbox_billing/models/connect_engage_service200_response.rb +212 -0
  216. data/lib/cbox_billing/models/connect_engage_service_request.rb +267 -0
  217. data/lib/cbox_billing/models/contract_cap_discount.rb +284 -0
  218. data/lib/cbox_billing/models/contract_price_cap.rb +332 -0
  219. data/lib/cbox_billing/models/contract_price_cap_basis.rb +216 -0
  220. data/lib/cbox_billing/models/coupon.rb +307 -0
  221. data/lib/cbox_billing/models/coupon_definition.rb +520 -0
  222. data/lib/cbox_billing/models/coupon_definition_detail.rb +555 -0
  223. data/lib/cbox_billing/models/coupon_definition_detail_all_of_redemptions.rb +216 -0
  224. data/lib/cbox_billing/models/coupon_definition_list.rb +226 -0
  225. data/lib/cbox_billing/models/coupon_deleted.rb +227 -0
  226. data/lib/cbox_billing/models/coupon_request.rb +537 -0
  227. data/lib/cbox_billing/models/create_affiliate_payout_request.rb +247 -0
  228. data/lib/cbox_billing/models/create_affiliate_program_request.rb +423 -0
  229. data/lib/cbox_billing/models/create_affiliate_program_request_commission.rb +348 -0
  230. data/lib/cbox_billing/models/create_affiliate_referral_request.rb +178 -0
  231. data/lib/cbox_billing/models/create_affiliate_request.rb +415 -0
  232. data/lib/cbox_billing/models/create_credit_purchase422_response.rb +104 -0
  233. data/lib/cbox_billing/models/create_customers_from_accounting_contact_import200_response.rb +207 -0
  234. data/lib/cbox_billing/models/create_customers_from_accounting_contact_import200_response_created_inner.rb +204 -0
  235. data/lib/cbox_billing/models/create_customers_from_accounting_contact_import200_response_refused_inner.rb +204 -0
  236. data/lib/cbox_billing/models/create_customers_from_accounting_contact_import_request.rb +197 -0
  237. data/lib/cbox_billing/models/create_download_grant_request.rb +248 -0
  238. data/lib/cbox_billing/models/create_download_links200_response.rb +205 -0
  239. data/lib/cbox_billing/models/create_download_links200_response_data_inner.rb +227 -0
  240. data/lib/cbox_billing/models/create_download_links_request.rb +190 -0
  241. data/lib/cbox_billing/models/create_environment_request.rb +270 -0
  242. data/lib/cbox_billing/models/create_license_key_request.rb +273 -0
  243. data/lib/cbox_billing/models/create_order_request.rb +420 -0
  244. data/lib/cbox_billing/models/create_order_request_lines_inner.rb +262 -0
  245. data/lib/cbox_billing/models/create_private_plan_request.rb +318 -0
  246. data/lib/cbox_billing/models/create_spend_alert_request.rb +295 -0
  247. data/lib/cbox_billing/models/created_access_invitation.rb +464 -0
  248. data/lib/cbox_billing/models/created_environment.rb +214 -0
  249. data/lib/cbox_billing/models/credit_adjustment_applied.rb +247 -0
  250. data/lib/cbox_billing/models/credit_adjustment_pending.rb +228 -0
  251. data/lib/cbox_billing/models/credit_adjustment_request.rb +375 -0
  252. data/lib/cbox_billing/models/credit_delta.rb +229 -0
  253. data/lib/cbox_billing/models/credit_movement.rb +364 -0
  254. data/lib/cbox_billing/models/credit_movement_list.rb +226 -0
  255. data/lib/cbox_billing/models/credit_note.rb +455 -0
  256. data/lib/cbox_billing/models/credit_note_detail.rb +517 -0
  257. data/lib/cbox_billing/models/credit_note_detail_all_of_lines.rb +294 -0
  258. data/lib/cbox_billing/models/credit_note_list.rb +226 -0
  259. data/lib/cbox_billing/models/credit_pool.rb +567 -0
  260. data/lib/cbox_billing/models/credit_pool_expiries_inner.rb +241 -0
  261. data/lib/cbox_billing/models/credit_pool_label.rb +204 -0
  262. data/lib/cbox_billing/models/credit_pool_list.rb +205 -0
  263. data/lib/cbox_billing/models/credit_pool_pay_as_you_go.rb +218 -0
  264. data/lib/cbox_billing/models/credit_pool_period.rb +175 -0
  265. data/lib/cbox_billing/models/credit_pool_scope.rb +207 -0
  266. data/lib/cbox_billing/models/credit_pool_scope_conditions_inner.rb +256 -0
  267. data/lib/cbox_billing/models/credit_purchase.rb +306 -0
  268. data/lib/cbox_billing/models/credit_purchase_credit.rb +203 -0
  269. data/lib/cbox_billing/models/customer_contract.rb +227 -0
  270. data/lib/cbox_billing/models/customer_overage_cap_row.rb +345 -0
  271. data/lib/cbox_billing/models/customer_overage_cap_row_customer.rb +202 -0
  272. data/lib/cbox_billing/models/date_change_preview.rb +370 -0
  273. data/lib/cbox_billing/models/date_change_request.rb +272 -0
  274. data/lib/cbox_billing/models/delete_entitlement_override200_response.rb +204 -0
  275. data/lib/cbox_billing/models/delete_overage_cap200_response.rb +203 -0
  276. data/lib/cbox_billing/models/delete_spend_alert200_response.rb +203 -0
  277. data/lib/cbox_billing/models/delete_webhook_endpoint200_response.rb +239 -0
  278. data/lib/cbox_billing/models/delivery.rb +339 -0
  279. data/lib/cbox_billing/models/destroy_environment200_response.rb +178 -0
  280. data/lib/cbox_billing/models/detach_payment_method422_response.rb +253 -0
  281. data/lib/cbox_billing/models/detach_payment_method422_response_errors.rb +162 -0
  282. data/lib/cbox_billing/models/directory_registration.rb +244 -0
  283. data/lib/cbox_billing/models/directory_service.rb +472 -0
  284. data/lib/cbox_billing/models/disable_license_key_request.rb +161 -0
  285. data/lib/cbox_billing/models/dispute.rb +471 -0
  286. data/lib/cbox_billing/models/dispute_detail.rb +229 -0
  287. data/lib/cbox_billing/models/dispute_detail_evidence.rb +205 -0
  288. data/lib/cbox_billing/models/dispute_detail_evidence_text.rb +200 -0
  289. data/lib/cbox_billing/models/dispute_detail_pack.rb +193 -0
  290. data/lib/cbox_billing/models/dispute_detail_pack_sections_inner.rb +269 -0
  291. data/lib/cbox_billing/models/dispute_evidence.rb +312 -0
  292. data/lib/cbox_billing/models/dispute_evidence_file.rb +357 -0
  293. data/lib/cbox_billing/models/dispute_evidence_slot.rb +43 -0
  294. data/lib/cbox_billing/models/dispute_refusal.rb +256 -0
  295. data/lib/cbox_billing/models/dispute_status.rb +46 -0
  296. data/lib/cbox_billing/models/download_grant.rb +401 -0
  297. data/lib/cbox_billing/models/dunning_hold.rb +344 -0
  298. data/lib/cbox_billing/models/dunning_state.rb +217 -0
  299. data/lib/cbox_billing/models/dunning_state_invoice.rb +281 -0
  300. data/lib/cbox_billing/models/dunning_state_retry.rb +232 -0
  301. data/lib/cbox_billing/models/e_invoice_refusal.rb +229 -0
  302. data/lib/cbox_billing/models/effective_billing_policy.rb +298 -0
  303. data/lib/cbox_billing/models/effective_entitlement.rb +271 -0
  304. data/lib/cbox_billing/models/effective_usage_threshold.rb +280 -0
  305. data/lib/cbox_billing/models/entitlement.rb +366 -0
  306. data/lib/cbox_billing/models/entitlement_override.rb +557 -0
  307. data/lib/cbox_billing/models/entitlement_override_input.rb +353 -0
  308. data/lib/cbox_billing/models/entitlement_override_result.rb +591 -0
  309. data/lib/cbox_billing/models/entitlement_terms.rb +293 -0
  310. data/lib/cbox_billing/models/entitlements_response.rb +200 -0
  311. data/lib/cbox_billing/models/environment.rb +379 -0
  312. data/lib/cbox_billing/models/error_body.rb +242 -0
  313. data/lib/cbox_billing/models/export_catalog200_response.rb +232 -0
  314. data/lib/cbox_billing/models/extend_invoice_due_date_request.rb +213 -0
  315. data/lib/cbox_billing/models/feature.rb +277 -0
  316. data/lib/cbox_billing/models/feature_check.rb +310 -0
  317. data/lib/cbox_billing/models/feature_set.rb +179 -0
  318. data/lib/cbox_billing/models/feature_value.rb +105 -0
  319. data/lib/cbox_billing/models/first_period.rb +461 -0
  320. data/lib/cbox_billing/models/gateway_intent.rb +254 -0
  321. data/lib/cbox_billing/models/get_accounting_connection200_response.rb +163 -0
  322. data/lib/cbox_billing/models/get_accounting_contact200_response.rb +227 -0
  323. data/lib/cbox_billing/models/get_accounting_contact_sync200_response.rb +229 -0
  324. data/lib/cbox_billing/models/get_accounting_invoice_sync200_response.rb +293 -0
  325. data/lib/cbox_billing/models/get_accounting_invoice_sync200_response_settings.rb +241 -0
  326. data/lib/cbox_billing/models/get_accounting_invoice_sync200_response_sync.rb +318 -0
  327. data/lib/cbox_billing/models/get_accounting_organization200_response.rb +231 -0
  328. data/lib/cbox_billing/models/get_bank_statement200_response.rb +205 -0
  329. data/lib/cbox_billing/models/get_customer_statement200_response.rb +339 -0
  330. data/lib/cbox_billing/models/get_customer_statement200_response_account_credit.rb +169 -0
  331. data/lib/cbox_billing/models/get_customer_statement200_response_activity_inner.rb +334 -0
  332. data/lib/cbox_billing/models/get_customer_statement200_response_balances_inner.rb +229 -0
  333. data/lib/cbox_billing/models/get_customer_statement200_response_subscriptions_inner.rb +281 -0
  334. data/lib/cbox_billing/models/get_customer_statement200_response_subscriptions_inner_next.rb +200 -0
  335. data/lib/cbox_billing/models/get_latest_accounting_contact_import200_response.rb +163 -0
  336. data/lib/cbox_billing/models/get_product_delivery200_response.rb +217 -0
  337. data/lib/cbox_billing/models/get_resource_limits200_response.rb +257 -0
  338. data/lib/cbox_billing/models/get_service_admission_policy200_response.rb +160 -0
  339. data/lib/cbox_billing/models/get_service_registrations200_response.rb +179 -0
  340. data/lib/cbox_billing/models/get_service_registrations200_response_data_inner.rb +190 -0
  341. data/lib/cbox_billing/models/get_service_registrations_request.rb +284 -0
  342. data/lib/cbox_billing/models/grandfathered_subscriber.rb +356 -0
  343. data/lib/cbox_billing/models/grandfathered_subscriber_contract_cap.rb +230 -0
  344. data/lib/cbox_billing/models/guest_waitlist_input.rb +271 -0
  345. data/lib/cbox_billing/models/hold_invoice_dunning_request.rb +249 -0
  346. data/lib/cbox_billing/models/hold_invoice_for_review200_response.rb +177 -0
  347. data/lib/cbox_billing/models/hosted_session.rb +204 -0
  348. data/lib/cbox_billing/models/import_bank_statement201_response.rb +203 -0
  349. data/lib/cbox_billing/models/inline_object.rb +227 -0
  350. data/lib/cbox_billing/models/inline_object1.rb +255 -0
  351. data/lib/cbox_billing/models/inline_object2.rb +255 -0
  352. data/lib/cbox_billing/models/invoice.rb +523 -0
  353. data/lib/cbox_billing/models/invoice_balance.rb +281 -0
  354. data/lib/cbox_billing/models/invoice_detail.rb +655 -0
  355. data/lib/cbox_billing/models/invoice_draft.rb +452 -0
  356. data/lib/cbox_billing/models/invoice_draft_lines_inner.rb +199 -0
  357. data/lib/cbox_billing/models/invoice_item.rb +354 -0
  358. data/lib/cbox_billing/models/invoice_line.rb +295 -0
  359. data/lib/cbox_billing/models/invoice_list.rb +226 -0
  360. data/lib/cbox_billing/models/invoice_payment.rb +292 -0
  361. data/lib/cbox_billing/models/invoice_payment_result.rb +203 -0
  362. data/lib/cbox_billing/models/join_service_waitlist200_response.rb +163 -0
  363. data/lib/cbox_billing/models/join_service_waitlist_as_guest200_response.rb +194 -0
  364. data/lib/cbox_billing/models/join_service_waitlist_request.rb +378 -0
  365. data/lib/cbox_billing/models/keep_accounting_contact200_response.rb +231 -0
  366. data/lib/cbox_billing/models/keep_accounting_contact_request.rb +186 -0
  367. data/lib/cbox_billing/models/lease.rb +266 -0
  368. data/lib/cbox_billing/models/lease_request.rb +341 -0
  369. data/lib/cbox_billing/models/leave_feature_waitlist200_response.rb +201 -0
  370. data/lib/cbox_billing/models/leave_feature_waitlist_request.rb +249 -0
  371. data/lib/cbox_billing/models/licence_period_document.rb +408 -0
  372. data/lib/cbox_billing/models/licence_period_document_usage_measures_inner.rb +170 -0
  373. data/lib/cbox_billing/models/licence_period_list.rb +230 -0
  374. data/lib/cbox_billing/models/licence_period_summary.rb +344 -0
  375. data/lib/cbox_billing/models/licence_reportable.rb +204 -0
  376. data/lib/cbox_billing/models/licence_row_list.rb +244 -0
  377. data/lib/cbox_billing/models/licence_seat_count.rb +355 -0
  378. data/lib/cbox_billing/models/licence_seat_ledger_entry.rb +578 -0
  379. data/lib/cbox_billing/models/licence_seat_ledger_list.rb +217 -0
  380. data/lib/cbox_billing/models/licence_seat_snapshot_list.rb +243 -0
  381. data/lib/cbox_billing/models/license.rb +407 -0
  382. data/lib/cbox_billing/models/license_issue_request.rb +232 -0
  383. data/lib/cbox_billing/models/license_key.rb +503 -0
  384. data/lib/cbox_billing/models/license_key_detail.rb +537 -0
  385. data/lib/cbox_billing/models/license_key_detail_all_of_instances.rb +277 -0
  386. data/lib/cbox_billing/models/license_renew_request.rb +160 -0
  387. data/lib/cbox_billing/models/license_revoke_request.rb +160 -0
  388. data/lib/cbox_billing/models/license_revoke_result.rb +227 -0
  389. data/lib/cbox_billing/models/limit_increase_decision.rb +368 -0
  390. data/lib/cbox_billing/models/limit_increase_input.rb +300 -0
  391. data/lib/cbox_billing/models/limit_increase_request.rb +516 -0
  392. data/lib/cbox_billing/models/link_accounting_contact200_response.rb +177 -0
  393. data/lib/cbox_billing/models/link_accounting_contact_request.rb +187 -0
  394. data/lib/cbox_billing/models/list_access_programs200_response.rb +252 -0
  395. data/lib/cbox_billing/models/list_accounting_contact_duplicates200_response.rb +205 -0
  396. data/lib/cbox_billing/models/list_accounting_contact_duplicates200_response_duplicates_inner.rb +205 -0
  397. data/lib/cbox_billing/models/list_accounting_contact_duplicates200_response_duplicates_inner_organizations_inner.rb +203 -0
  398. data/lib/cbox_billing/models/list_accounting_contact_import_rows200_response.rb +192 -0
  399. data/lib/cbox_billing/models/list_accounting_contact_sync_failures200_response.rb +217 -0
  400. data/lib/cbox_billing/models/list_accounting_contacts200_response.rb +282 -0
  401. data/lib/cbox_billing/models/list_accounting_organization_invoices200_response.rb +191 -0
  402. data/lib/cbox_billing/models/list_accounting_syncs200_response.rb +179 -0
  403. data/lib/cbox_billing/models/list_affiliate_commissions200_response.rb +226 -0
  404. data/lib/cbox_billing/models/list_affiliate_payout_runs200_response.rb +226 -0
  405. data/lib/cbox_billing/models/list_affiliate_payouts200_response.rb +226 -0
  406. data/lib/cbox_billing/models/list_affiliate_programs200_response.rb +226 -0
  407. data/lib/cbox_billing/models/list_affiliates200_response.rb +226 -0
  408. data/lib/cbox_billing/models/list_agreements200_response.rb +179 -0
  409. data/lib/cbox_billing/models/list_all_invoices400_response.rb +177 -0
  410. data/lib/cbox_billing/models/list_bank_lines200_response.rb +215 -0
  411. data/lib/cbox_billing/models/list_bank_statements200_response.rb +215 -0
  412. data/lib/cbox_billing/models/list_connected_financial_events200_response.rb +292 -0
  413. data/lib/cbox_billing/models/list_connected_production_environments200_response.rb +205 -0
  414. data/lib/cbox_billing/models/list_connected_production_environments200_response_data_inner.rb +203 -0
  415. data/lib/cbox_billing/models/list_customer_dunning_holds200_response.rb +179 -0
  416. data/lib/cbox_billing/models/list_disputes200_response.rb +217 -0
  417. data/lib/cbox_billing/models/list_download_grants200_response.rb +226 -0
  418. data/lib/cbox_billing/models/list_entitlement_overrides200_response.rb +207 -0
  419. data/lib/cbox_billing/models/list_environments200_response.rb +162 -0
  420. data/lib/cbox_billing/models/list_financial_events200_response.rb +240 -0
  421. data/lib/cbox_billing/models/list_financial_events200_response_data_inner.rb +342 -0
  422. data/lib/cbox_billing/models/list_financial_events200_response_data_inner_data.rb +408 -0
  423. data/lib/cbox_billing/models/list_grandfathered_subscribers200_response.rb +244 -0
  424. data/lib/cbox_billing/models/list_invoice_drafts200_response.rb +215 -0
  425. data/lib/cbox_billing/models/list_invoice_items200_response.rb +179 -0
  426. data/lib/cbox_billing/models/list_invoice_payments200_response.rb +205 -0
  427. data/lib/cbox_billing/models/list_license_keys200_response.rb +226 -0
  428. data/lib/cbox_billing/models/list_limit_increase_requests200_response.rb +231 -0
  429. data/lib/cbox_billing/models/list_one_off_products200_response.rb +179 -0
  430. data/lib/cbox_billing/models/list_orders200_response.rb +226 -0
  431. data/lib/cbox_billing/models/list_organization_purchases200_response.rb +205 -0
  432. data/lib/cbox_billing/models/list_organization_subscriptions200_response.rb +179 -0
  433. data/lib/cbox_billing/models/list_overage_caps200_response.rb +179 -0
  434. data/lib/cbox_billing/models/list_plan_moves200_response.rb +179 -0
  435. data/lib/cbox_billing/models/list_private_plans200_response.rb +179 -0
  436. data/lib/cbox_billing/models/list_product_files200_response.rb +179 -0
  437. data/lib/cbox_billing/models/list_scheduled_catalog_changes200_response.rb +179 -0
  438. data/lib/cbox_billing/models/list_service_directory200_response.rb +249 -0
  439. data/lib/cbox_billing/models/list_signed_agreements200_response.rb +226 -0
  440. data/lib/cbox_billing/models/list_spend_alerts200_response.rb +218 -0
  441. data/lib/cbox_billing/models/list_spend_alerts200_response_spend.rb +222 -0
  442. data/lib/cbox_billing/models/list_subscription_date_moves200_response.rb +179 -0
  443. data/lib/cbox_billing/models/list_subscription_schedule200_response.rb +179 -0
  444. data/lib/cbox_billing/models/list_tax_return_lines200_response.rb +215 -0
  445. data/lib/cbox_billing/models/list_tax_returns200_response.rb +215 -0
  446. data/lib/cbox_billing/models/list_unmatched_accounting_invoices200_response.rb +192 -0
  447. data/lib/cbox_billing/models/lock_subscription_price_request.rb +162 -0
  448. data/lib/cbox_billing/models/mark_affiliate_payout_paid_request.rb +176 -0
  449. data/lib/cbox_billing/models/mark_invoice_paid_request.rb +176 -0
  450. data/lib/cbox_billing/models/match_bank_line_request.rb +197 -0
  451. data/lib/cbox_billing/models/match_bank_line_request_allocations_inner.rb +221 -0
  452. data/lib/cbox_billing/models/meter.rb +524 -0
  453. data/lib/cbox_billing/models/meter_detail.rb +587 -0
  454. data/lib/cbox_billing/models/meter_detail_all_of_entitlements.rb +260 -0
  455. data/lib/cbox_billing/models/meter_list.rb +226 -0
  456. data/lib/cbox_billing/models/meter_request.rb +463 -0
  457. data/lib/cbox_billing/models/meter_request_resets.rb +237 -0
  458. data/lib/cbox_billing/models/meter_resets.rb +279 -0
  459. data/lib/cbox_billing/models/meter_staged.rb +309 -0
  460. data/lib/cbox_billing/models/meter_staged_changeset.rb +265 -0
  461. data/lib/cbox_billing/models/money.rb +222 -0
  462. data/lib/cbox_billing/models/money_amount.rb +203 -0
  463. data/lib/cbox_billing/models/move_affiliate_referral_request.rb +213 -0
  464. data/lib/cbox_billing/models/move_affiliate_request.rb +188 -0
  465. data/lib/cbox_billing/models/negotiated_price.rb +277 -0
  466. data/lib/cbox_billing/models/new_auto_top_up.rb +277 -0
  467. data/lib/cbox_billing/models/new_credit_purchase.rb +271 -0
  468. data/lib/cbox_billing/models/new_invoice.rb +264 -0
  469. data/lib/cbox_billing/models/new_invoice_line.rb +295 -0
  470. data/lib/cbox_billing/models/ok.rb +201 -0
  471. data/lib/cbox_billing/models/one_off_product.rb +359 -0
  472. data/lib/cbox_billing/models/one_off_purchase.rb +396 -0
  473. data/lib/cbox_billing/models/one_off_purchase_items_inner.rb +255 -0
  474. data/lib/cbox_billing/models/one_off_quote.rb +527 -0
  475. data/lib/cbox_billing/models/one_off_quote_organization.rb +177 -0
  476. data/lib/cbox_billing/models/one_off_quote_request.rb +324 -0
  477. data/lib/cbox_billing/models/order.rb +573 -0
  478. data/lib/cbox_billing/models/order_items_inner.rb +311 -0
  479. data/lib/cbox_billing/models/organization.rb +545 -0
  480. data/lib/cbox_billing/models/organization_accounting_contact.rb +255 -0
  481. data/lib/cbox_billing/models/organization_bundles.rb +310 -0
  482. data/lib/cbox_billing/models/organization_bundles_active_inner.rb +242 -0
  483. data/lib/cbox_billing/models/organization_response.rb +177 -0
  484. data/lib/cbox_billing/models/organization_upsert_request.rb +666 -0
  485. data/lib/cbox_billing/models/overage_cap.rb +105 -0
  486. data/lib/cbox_billing/models/overage_cap_binding.rb +263 -0
  487. data/lib/cbox_billing/models/overage_cap_one_of.rb +186 -0
  488. data/lib/cbox_billing/models/overage_cap_one_of1.rb +231 -0
  489. data/lib/cbox_billing/models/overage_cap_state.rb +380 -0
  490. data/lib/cbox_billing/models/page.rb +192 -0
  491. data/lib/cbox_billing/models/payment_gateway_failover.rb +233 -0
  492. data/lib/cbox_billing/models/payment_gateway_failover_failovers_inner.rb +348 -0
  493. data/lib/cbox_billing/models/payment_gateway_failover_failovers_inner_hops_inner.rb +190 -0
  494. data/lib/cbox_billing/models/payment_gateway_failover_gateways_inner.rb +230 -0
  495. data/lib/cbox_billing/models/payment_gateway_failover_gateways_inner_circuit.rb +288 -0
  496. data/lib/cbox_billing/models/payment_gateway_failover_routing.rb +235 -0
  497. data/lib/cbox_billing/models/payment_intent_request.rb +254 -0
  498. data/lib/cbox_billing/models/payment_mandate.rb +253 -0
  499. data/lib/cbox_billing/models/payment_method.rb +374 -0
  500. data/lib/cbox_billing/models/payment_method_id_request.rb +177 -0
  501. data/lib/cbox_billing/models/payment_method_list.rb +226 -0
  502. data/lib/cbox_billing/models/payment_method_set.rb +180 -0
  503. data/lib/cbox_billing/models/payment_terms.rb +281 -0
  504. data/lib/cbox_billing/models/payment_terms_request.rb +235 -0
  505. data/lib/cbox_billing/models/pending_approval.rb +229 -0
  506. data/lib/cbox_billing/models/pending_price_change.rb +257 -0
  507. data/lib/cbox_billing/models/per_value_entitlements.rb +206 -0
  508. data/lib/cbox_billing/models/per_value_entitlements_values_value.rb +263 -0
  509. data/lib/cbox_billing/models/plan.rb +425 -0
  510. data/lib/cbox_billing/models/plan_change_input.rb +224 -0
  511. data/lib/cbox_billing/models/plan_change_preview.rb +478 -0
  512. data/lib/cbox_billing/models/plan_change_preview_seat_types_inner.rb +356 -0
  513. data/lib/cbox_billing/models/plan_change_price_options.rb +280 -0
  514. data/lib/cbox_billing/models/plan_change_price_options_keep_negotiated.rb +230 -0
  515. data/lib/cbox_billing/models/plan_change_request.rb +256 -0
  516. data/lib/cbox_billing/models/plan_change_result.rb +543 -0
  517. data/lib/cbox_billing/models/plan_features_value.rb +105 -0
  518. data/lib/cbox_billing/models/plan_list.rb +253 -0
  519. data/lib/cbox_billing/models/plan_meter_entitlement.rb +250 -0
  520. data/lib/cbox_billing/models/plan_move.rb +386 -0
  521. data/lib/cbox_billing/models/plan_move_subscribers.rb +188 -0
  522. data/lib/cbox_billing/models/plan_price.rb +256 -0
  523. data/lib/cbox_billing/models/plan_prices_inner.rb +241 -0
  524. data/lib/cbox_billing/models/plane_invoice_list.rb +226 -0
  525. data/lib/cbox_billing/models/plane_invoice_list_all_of_data.rb +557 -0
  526. data/lib/cbox_billing/models/portal_session_request.rb +309 -0
  527. data/lib/cbox_billing/models/prepare_tax_return200_response.rb +177 -0
  528. data/lib/cbox_billing/models/prepare_tax_return_request.rb +237 -0
  529. data/lib/cbox_billing/models/preview_renewal_alignment_request.rb +201 -0
  530. data/lib/cbox_billing/models/preview_service_invitation200_response.rb +161 -0
  531. data/lib/cbox_billing/models/preview_service_invitation200_response_invitation.rb +189 -0
  532. data/lib/cbox_billing/models/preview_service_invitation_request.rb +186 -0
  533. data/lib/cbox_billing/models/preview_subscription_cancel_request.rb +216 -0
  534. data/lib/cbox_billing/models/preview_subscription_coupon200_response.rb +205 -0
  535. data/lib/cbox_billing/models/preview_subscription_coupon_request.rb +186 -0
  536. data/lib/cbox_billing/models/price_lock.rb +215 -0
  537. data/lib/cbox_billing/models/price_lock_state.rb +190 -0
  538. data/lib/cbox_billing/models/price_tax.rb +348 -0
  539. data/lib/cbox_billing/models/private_plan.rb +380 -0
  540. data/lib/cbox_billing/models/product_definition_manifest.rb +269 -0
  541. data/lib/cbox_billing/models/product_definition_manifest_features_inner.rb +333 -0
  542. data/lib/cbox_billing/models/product_definition_manifest_meters_inner.rb +434 -0
  543. data/lib/cbox_billing/models/product_file.rb +420 -0
  544. data/lib/cbox_billing/models/proration_line.rb +203 -0
  545. data/lib/cbox_billing/models/quantity_preview.rb +321 -0
  546. data/lib/cbox_billing/models/quantity_request.rb +196 -0
  547. data/lib/cbox_billing/models/quote.rb +700 -0
  548. data/lib/cbox_billing/models/quote_all_of_acceptance.rb +206 -0
  549. data/lib/cbox_billing/models/quote_all_of_approval.rb +201 -0
  550. data/lib/cbox_billing/models/quote_all_of_grants.rb +205 -0
  551. data/lib/cbox_billing/models/quote_all_of_lines.rb +284 -0
  552. data/lib/cbox_billing/models/quote_all_of_terms.rb +285 -0
  553. data/lib/cbox_billing/models/quote_all_of_terms_ramp.rb +169 -0
  554. data/lib/cbox_billing/models/quote_all_of_totals.rb +255 -0
  555. data/lib/cbox_billing/models/quote_all_of_totals_lines.rb +223 -0
  556. data/lib/cbox_billing/models/quote_line_grants.rb +212 -0
  557. data/lib/cbox_billing/models/quote_line_grants_features_inner.rb +204 -0
  558. data/lib/cbox_billing/models/quote_line_grants_meters_inner.rb +260 -0
  559. data/lib/cbox_billing/models/quote_line_request.rb +368 -0
  560. data/lib/cbox_billing/models/quote_list.rb +226 -0
  561. data/lib/cbox_billing/models/quote_request.rb +650 -0
  562. data/lib/cbox_billing/models/quote_request_ramp_inner.rb +221 -0
  563. data/lib/cbox_billing/models/quote_signer.rb +434 -0
  564. data/lib/cbox_billing/models/quote_signer_request.rb +247 -0
  565. data/lib/cbox_billing/models/quote_signer_signature.rb +296 -0
  566. data/lib/cbox_billing/models/quote_signing.rb +384 -0
  567. data/lib/cbox_billing/models/quote_signing_request.rb +278 -0
  568. data/lib/cbox_billing/models/quote_signing_signed_document.rb +240 -0
  569. data/lib/cbox_billing/models/quote_summary.rb +440 -0
  570. data/lib/cbox_billing/models/rate_limit_error_body.rb +177 -0
  571. data/lib/cbox_billing/models/reconcile_id_signals_inclusion200_response.rb +211 -0
  572. data/lib/cbox_billing/models/reconcile_id_signals_inclusion_request.rb +162 -0
  573. data/lib/cbox_billing/models/record_invoice_payment_request.rb +223 -0
  574. data/lib/cbox_billing/models/recurring_price.rb +230 -0
  575. data/lib/cbox_billing/models/refund.rb +493 -0
  576. data/lib/cbox_billing/models/refund_list.rb +179 -0
  577. data/lib/cbox_billing/models/refund_order_request.rb +223 -0
  578. data/lib/cbox_billing/models/refund_request.rb +227 -0
  579. data/lib/cbox_billing/models/refund_result.rb +239 -0
  580. data/lib/cbox_billing/models/refusal.rb +205 -0
  581. data/lib/cbox_billing/models/release_invoice_from_review200_response.rb +205 -0
  582. data/lib/cbox_billing/models/remove_billing_parent_request.rb +186 -0
  583. data/lib/cbox_billing/models/remove_subscription_coupon200_response.rb +177 -0
  584. data/lib/cbox_billing/models/remove_subscription_coupon_request.rb +177 -0
  585. data/lib/cbox_billing/models/reserve_outcome.rb +251 -0
  586. data/lib/cbox_billing/models/reserve_request.rb +225 -0
  587. data/lib/cbox_billing/models/reserve_request_meters_inner.rb +212 -0
  588. data/lib/cbox_billing/models/reset_environment200_response.rb +187 -0
  589. data/lib/cbox_billing/models/reset_environment_request.rb +162 -0
  590. data/lib/cbox_billing/models/reset_period.rb +247 -0
  591. data/lib/cbox_billing/models/resource_limit.rb +392 -0
  592. data/lib/cbox_billing/models/retry_accounting_sync202_response.rb +177 -0
  593. data/lib/cbox_billing/models/retry_invoice_dunning_request.rb +176 -0
  594. data/lib/cbox_billing/models/reverse_invoice_payment_request.rb +186 -0
  595. data/lib/cbox_billing/models/revoke_limit_increase_request.rb +195 -0
  596. data/lib/cbox_billing/models/schedule_phase.rb +486 -0
  597. data/lib/cbox_billing/models/schedule_phase_request.rb +396 -0
  598. data/lib/cbox_billing/models/schedule_plan_move_request.rb +231 -0
  599. data/lib/cbox_billing/models/scheduled_catalog_change.rb +331 -0
  600. data/lib/cbox_billing/models/scheduled_catalog_change_existing.rb +215 -0
  601. data/lib/cbox_billing/models/seat_breakdown.rb +404 -0
  602. data/lib/cbox_billing/models/seat_entitlement.rb +267 -0
  603. data/lib/cbox_billing/models/seat_ledger_entry.rb +440 -0
  604. data/lib/cbox_billing/models/seat_ledger_page.rb +205 -0
  605. data/lib/cbox_billing/models/seat_ledger_page_meta.rb +255 -0
  606. data/lib/cbox_billing/models/seat_reassign_request.rb +187 -0
  607. data/lib/cbox_billing/models/seat_subject_request.rb +178 -0
  608. data/lib/cbox_billing/models/seat_type_change.rb +384 -0
  609. data/lib/cbox_billing/models/seat_type_entitlement.rb +269 -0
  610. data/lib/cbox_billing/models/seat_type_quantity_request.rb +205 -0
  611. data/lib/cbox_billing/models/seat_type_response.rb +177 -0
  612. data/lib/cbox_billing/models/seat_type_state.rb +565 -0
  613. data/lib/cbox_billing/models/seat_type_state_holders_inner.rb +189 -0
  614. data/lib/cbox_billing/models/seats_set_request.rb +186 -0
  615. data/lib/cbox_billing/models/service_admission_identity.rb +237 -0
  616. data/lib/cbox_billing/models/service_admission_input.rb +388 -0
  617. data/lib/cbox_billing/models/set_backup_card_consent200_response.rb +189 -0
  618. data/lib/cbox_billing/models/set_backup_card_consent_request.rb +177 -0
  619. data/lib/cbox_billing/models/set_billing_parent409_response.rb +227 -0
  620. data/lib/cbox_billing/models/set_billing_parent_request.rb +212 -0
  621. data/lib/cbox_billing/models/set_customer_contract_request.rb +197 -0
  622. data/lib/cbox_billing/models/set_invoice_consolidation_request.rb +177 -0
  623. data/lib/cbox_billing/models/set_overage_cap422_response.rb +227 -0
  624. data/lib/cbox_billing/models/set_product_delivery_request.rb +342 -0
  625. data/lib/cbox_billing/models/set_subscription_purchase_order200_response.rb +189 -0
  626. data/lib/cbox_billing/models/set_subscription_purchase_order_request.rb +176 -0
  627. data/lib/cbox_billing/models/setup_intent.rb +302 -0
  628. data/lib/cbox_billing/models/setup_intent_request.rb +177 -0
  629. data/lib/cbox_billing/models/show_environment200_response.rb +160 -0
  630. data/lib/cbox_billing/models/signals_source200_response.rb +214 -0
  631. data/lib/cbox_billing/models/signals_source200_response_meta.rb +471 -0
  632. data/lib/cbox_billing/models/signals_source_erasures200_response.rb +214 -0
  633. data/lib/cbox_billing/models/signals_source_erasures200_response_meta.rb +329 -0
  634. data/lib/cbox_billing/models/signed_agreement.rb +498 -0
  635. data/lib/cbox_billing/models/signed_agreement_document.rb +252 -0
  636. data/lib/cbox_billing/models/skip_accounting_contact_import_rows200_response.rb +177 -0
  637. data/lib/cbox_billing/models/skip_accounting_contact_import_rows_request.rb +188 -0
  638. data/lib/cbox_billing/models/skip_invoice_dunning_step_request.rb +186 -0
  639. data/lib/cbox_billing/models/spend_alert.rb +395 -0
  640. data/lib/cbox_billing/models/start_accounting_contact_import202_response.rb +177 -0
  641. data/lib/cbox_billing/models/stop_invoice_dunning_request.rb +247 -0
  642. data/lib/cbox_billing/models/submit_dispute_evidence_request.rb +178 -0
  643. data/lib/cbox_billing/models/subscribe_request.rb +373 -0
  644. data/lib/cbox_billing/models/subscribe_result.rb +215 -0
  645. data/lib/cbox_billing/models/subscription.rb +617 -0
  646. data/lib/cbox_billing/models/subscription_bundle.rb +200 -0
  647. data/lib/cbox_billing/models/subscription_change.rb +505 -0
  648. data/lib/cbox_billing/models/subscription_change_list.rb +226 -0
  649. data/lib/cbox_billing/models/subscription_contract.rb +188 -0
  650. data/lib/cbox_billing/models/subscription_contract_term.rb +385 -0
  651. data/lib/cbox_billing/models/subscription_date_move.rb +295 -0
  652. data/lib/cbox_billing/models/subscription_discount.rb +315 -0
  653. data/lib/cbox_billing/models/subscription_pending_change.rb +171 -0
  654. data/lib/cbox_billing/models/subscription_standing.rb +230 -0
  655. data/lib/cbox_billing/models/subscription_terms.rb +459 -0
  656. data/lib/cbox_billing/models/subscription_terms_price.rb +178 -0
  657. data/lib/cbox_billing/models/sync_product_definitions200_response.rb +179 -0
  658. data/lib/cbox_billing/models/sync_product_definitions200_response_data_inner.rb +335 -0
  659. data/lib/cbox_billing/models/tax_return.rb +663 -0
  660. data/lib/cbox_billing/models/tax_return_boxes_inner.rb +307 -0
  661. data/lib/cbox_billing/models/tax_return_corrections_inner.rb +178 -0
  662. data/lib/cbox_billing/models/tax_return_issues_inner.rb +227 -0
  663. data/lib/cbox_billing/models/tax_return_line.rb +550 -0
  664. data/lib/cbox_billing/models/tax_return_line_document.rb +214 -0
  665. data/lib/cbox_billing/models/tax_return_line_fx.rb +212 -0
  666. data/lib/cbox_billing/models/tax_return_member_states_inner.rb +250 -0
  667. data/lib/cbox_billing/models/tax_return_not_from_billing_inner.rb +229 -0
  668. data/lib/cbox_billing/models/test_clock_advance_request.rb +178 -0
  669. data/lib/cbox_billing/models/test_clock_advance_result.rb +334 -0
  670. data/lib/cbox_billing/models/test_clock_advance_result_clock.rb +230 -0
  671. data/lib/cbox_billing/models/upcoming_invoice.rb +440 -0
  672. data/lib/cbox_billing/models/upcoming_invoice_first_period.rb +251 -0
  673. data/lib/cbox_billing/models/upcoming_invoice_interim.rb +245 -0
  674. data/lib/cbox_billing/models/upcoming_invoice_interim_invoices_inner.rb +286 -0
  675. data/lib/cbox_billing/models/upcoming_invoice_interim_reconciliation.rb +270 -0
  676. data/lib/cbox_billing/models/upcoming_invoice_interim_reconciliation_credit_notes_inner.rb +282 -0
  677. data/lib/cbox_billing/models/upcoming_invoice_lines_inner.rb +282 -0
  678. data/lib/cbox_billing/models/update_affiliate_program_request.rb +398 -0
  679. data/lib/cbox_billing/models/update_affiliate_request.rb +321 -0
  680. data/lib/cbox_billing/models/update_dispute_evidence_request.rb +177 -0
  681. data/lib/cbox_billing/models/update_dispute_evidence_request_evidence.rb +251 -0
  682. data/lib/cbox_billing/models/update_entitlement_override_request.rb +309 -0
  683. data/lib/cbox_billing/models/update_invoice_draft_request.rb +214 -0
  684. data/lib/cbox_billing/models/update_invoice_draft_request_lines_inner.rb +224 -0
  685. data/lib/cbox_billing/models/update_license_key_request.rb +186 -0
  686. data/lib/cbox_billing/models/update_payment_gateway_routing_request.rb +234 -0
  687. data/lib/cbox_billing/models/update_product_file_request.rb +208 -0
  688. data/lib/cbox_billing/models/update_spend_alert_request.rb +296 -0
  689. data/lib/cbox_billing/models/upgrade_offer.rb +189 -0
  690. data/lib/cbox_billing/models/usage_correction.rb +471 -0
  691. data/lib/cbox_billing/models/usage_correction_actor.rb +211 -0
  692. data/lib/cbox_billing/models/usage_correction_adjustment.rb +411 -0
  693. data/lib/cbox_billing/models/usage_correction_list.rb +226 -0
  694. data/lib/cbox_billing/models/usage_correction_list_all_of_data.rb +506 -0
  695. data/lib/cbox_billing/models/usage_corrections_request.rb +246 -0
  696. data/lib/cbox_billing/models/usage_corrections_request_corrections_inner.rb +413 -0
  697. data/lib/cbox_billing/models/usage_corrections_result.rb +395 -0
  698. data/lib/cbox_billing/models/usage_corrections_result_rejected_inner.rb +262 -0
  699. data/lib/cbox_billing/models/usage_event_values.rb +252 -0
  700. data/lib/cbox_billing/models/usage_events_request.rb +234 -0
  701. data/lib/cbox_billing/models/usage_events_request_events_inner.rb +385 -0
  702. data/lib/cbox_billing/models/usage_events_request_events_inner_dimensions_value.rb +104 -0
  703. data/lib/cbox_billing/models/usage_events_result.rb +301 -0
  704. data/lib/cbox_billing/models/usage_events_result_rejected_inner.rb +263 -0
  705. data/lib/cbox_billing/models/usage_ingest_request.rb +225 -0
  706. data/lib/cbox_billing/models/usage_ingest_request_entries_inner.rb +290 -0
  707. data/lib/cbox_billing/models/usage_ingest_result.rb +374 -0
  708. data/lib/cbox_billing/models/usage_ingest_result_unsupported_meters_inner.rb +203 -0
  709. data/lib/cbox_billing/models/usage_price.rb +258 -0
  710. data/lib/cbox_billing/models/usage_summary.rb +205 -0
  711. data/lib/cbox_billing/models/usage_summary_meters_value.rb +289 -0
  712. data/lib/cbox_billing/models/usage_summary_meters_value_breakdown_inner.rb +205 -0
  713. data/lib/cbox_billing/models/usage_summary_period.rb +247 -0
  714. data/lib/cbox_billing/models/usage_threshold.rb +275 -0
  715. data/lib/cbox_billing/models/usage_threshold_level.rb +217 -0
  716. data/lib/cbox_billing/models/usage_threshold_request.rb +248 -0
  717. data/lib/cbox_billing/models/usage_threshold_subscriptions_inner.rb +201 -0
  718. data/lib/cbox_billing/models/validation_error_body.rb +206 -0
  719. data/lib/cbox_billing/models/value_rule.rb +291 -0
  720. data/lib/cbox_billing/models/value_rules.rb +235 -0
  721. data/lib/cbox_billing/models/waitlist_answer.rb +105 -0
  722. data/lib/cbox_billing/models/waitlist_question.rb +411 -0
  723. data/lib/cbox_billing/models/webhook_delivery.rb +435 -0
  724. data/lib/cbox_billing/models/webhook_delivery_list.rb +226 -0
  725. data/lib/cbox_billing/models/webhook_endpoint.rb +347 -0
  726. data/lib/cbox_billing/models/webhook_endpoint_list.rb +226 -0
  727. data/lib/cbox_billing/models/webhook_endpoint_request.rb +270 -0
  728. data/lib/cbox_billing/models/webhook_endpoint_with_secret.rb +367 -0
  729. data/lib/cbox_billing/models/withdraw_agreement_request.rb +220 -0
  730. data/lib/cbox_billing/models/withdraw_agreement_request_user.rb +177 -0
  731. data/lib/cbox_billing/pagination.rb +28 -0
  732. data/lib/cbox_billing/retry.rb +96 -0
  733. data/lib/cbox_billing/version.rb +15 -0
  734. data/lib/cbox_billing/webhook.rb +77 -0
  735. data/lib/cbox_billing.rb +765 -0
  736. metadata +824 -0
@@ -0,0 +1,1662 @@
1
+ =begin
2
+ #Cbox Billing API
3
+
4
+ #The HTTP API of Cbox Billing. Reference: https://github.com/cboxdk/cbox-billing/tree/main/docs/api
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.26.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module CboxBilling
16
+ class InvoicesApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Issue a manual invoice
23
+ # Issue a manual invoice to the organization, exactly as the console's \"new invoice\" does: number drawn, PDF rendered, the customer emailed, the `invoice.issued` webhook sent and the accounting sync run. Needs an operator (plane or environment) token with `invoices:write`; an organization-scoped token, or one bound to a product, is `403` (the latter `{ error: product_bound_token, message }`). A sandbox environment issues the invoice with its test seller and never reaches a gateway or an accounting system. `Idempotency-Key` is **required**: without it the answer is `400 { error: idempotency_key_required, message }`. A replay with the same key returns the original `201`, including its original `pdf_url`, which expires 15 minutes after the invoice was first issued: call `GET /invoices/{org}/{number}` for a fresh one. The same key with a different body is `409`. Every line is validated and a bad one is refused, never dropped. `quantity` is a decimal string, positive, with at most three decimals (`\"0\"` is `422`). `422` bodies are Laravel's `{message, errors}` shape with paths such as `lines.0.quantity`, `appendix.rows.3.2` or `metadata.foo`. A buyer without a full billing address is `422 { error: billing_address_required, message, missing }`. The operator's seller entity lacking an address or registration is `409 seller_incomplete`; no resolvable tax place is `409 tax_pending`. The appendix is part of the PDF the customer reads. It is not sent to an accounting system, and Billing never interprets a cell.
24
+ # @param org [String] The organization id (the merchant platform's own tenant key).
25
+ # @param idempotency_key [String] An opaque, caller-generated key (at most 100 characters). Required: a missing key is `400 idempotency_key_required`. A retry with the same key replays the first response; reusing it with a different body is `409`.
26
+ # @param new_invoice [NewInvoice]
27
+ # @param [Hash] opts the optional parameters
28
+ # @return [InvoiceDetail]
29
+ def create_invoice(org, idempotency_key, new_invoice, opts = {})
30
+ data, _status_code, _headers = create_invoice_with_http_info(org, idempotency_key, new_invoice, opts)
31
+ data
32
+ end
33
+
34
+ # Issue a manual invoice
35
+ # Issue a manual invoice to the organization, exactly as the console's \"new invoice\" does: number drawn, PDF rendered, the customer emailed, the `invoice.issued` webhook sent and the accounting sync run. Needs an operator (plane or environment) token with `invoices:write`; an organization-scoped token, or one bound to a product, is `403` (the latter `{ error: product_bound_token, message }`). A sandbox environment issues the invoice with its test seller and never reaches a gateway or an accounting system. `Idempotency-Key` is **required**: without it the answer is `400 { error: idempotency_key_required, message }`. A replay with the same key returns the original `201`, including its original `pdf_url`, which expires 15 minutes after the invoice was first issued: call `GET /invoices/{org}/{number}` for a fresh one. The same key with a different body is `409`. Every line is validated and a bad one is refused, never dropped. `quantity` is a decimal string, positive, with at most three decimals (`\"0\"` is `422`). `422` bodies are Laravel's `{message, errors}` shape with paths such as `lines.0.quantity`, `appendix.rows.3.2` or `metadata.foo`. A buyer without a full billing address is `422 { error: billing_address_required, message, missing }`. The operator's seller entity lacking an address or registration is `409 seller_incomplete`; no resolvable tax place is `409 tax_pending`. The appendix is part of the PDF the customer reads. It is not sent to an accounting system, and Billing never interprets a cell.
36
+ # @param org [String] The organization id (the merchant platform's own tenant key).
37
+ # @param idempotency_key [String] An opaque, caller-generated key (at most 100 characters). Required: a missing key is `400 idempotency_key_required`. A retry with the same key replays the first response; reusing it with a different body is `409`.
38
+ # @param new_invoice [NewInvoice]
39
+ # @param [Hash] opts the optional parameters
40
+ # @return [Array<(InvoiceDetail, Integer, Hash)>] InvoiceDetail data, response status code and response headers
41
+ def create_invoice_with_http_info(org, idempotency_key, new_invoice, opts = {})
42
+ if @api_client.config.debugging
43
+ @api_client.config.logger.debug 'Calling API: InvoicesApi.create_invoice ...'
44
+ end
45
+ # verify the required parameter 'org' is set
46
+ if @api_client.config.client_side_validation && org.nil?
47
+ fail ArgumentError, "Missing the required parameter 'org' when calling InvoicesApi.create_invoice"
48
+ end
49
+ # verify the required parameter 'idempotency_key' is set
50
+ if @api_client.config.client_side_validation && idempotency_key.nil?
51
+ fail ArgumentError, "Missing the required parameter 'idempotency_key' when calling InvoicesApi.create_invoice"
52
+ end
53
+ if @api_client.config.client_side_validation && idempotency_key.to_s.length > 100
54
+ fail ArgumentError, 'invalid value for "idempotency_key" when calling InvoicesApi.create_invoice, the character length must be smaller than or equal to 100.'
55
+ end
56
+
57
+ # verify the required parameter 'new_invoice' is set
58
+ if @api_client.config.client_side_validation && new_invoice.nil?
59
+ fail ArgumentError, "Missing the required parameter 'new_invoice' when calling InvoicesApi.create_invoice"
60
+ end
61
+ # resource path
62
+ local_var_path = '/invoices/{org}'.sub('{org}', CGI.escape(org.to_s))
63
+
64
+ # query parameters
65
+ query_params = opts[:query_params] || {}
66
+
67
+ # header parameters
68
+ header_params = opts[:header_params] || {}
69
+ # HTTP header 'Accept' (if needed)
70
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
71
+ # HTTP header 'Content-Type'
72
+ content_type = @api_client.select_header_content_type(['application/json'])
73
+ if !content_type.nil?
74
+ header_params['Content-Type'] = content_type
75
+ end
76
+ header_params[:'Idempotency-Key'] = idempotency_key
77
+
78
+ # form parameters
79
+ form_params = opts[:form_params] || {}
80
+
81
+ # http body (model)
82
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(new_invoice)
83
+
84
+ # return_type
85
+ return_type = opts[:debug_return_type] || 'InvoiceDetail'
86
+
87
+ # auth_names
88
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
89
+
90
+ new_options = opts.merge(
91
+ :operation => :"InvoicesApi.create_invoice",
92
+ :header_params => header_params,
93
+ :query_params => query_params,
94
+ :form_params => form_params,
95
+ :body => post_body,
96
+ :auth_names => auth_names,
97
+ :return_type => return_type
98
+ )
99
+
100
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
101
+ if @api_client.config.debugging
102
+ @api_client.config.logger.debug "API called: InvoicesApi#create_invoice\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
103
+ end
104
+ return data, status_code, headers
105
+ end
106
+
107
+ # The customer's statement
108
+ # What the customer pays per subscription, what they owe now, and the invoices, payments and credit notes in the period (the last twelve months by default, five years at most). Balances are always as of now. A product-bound token sees that product's share. Amounts on `activity` are signed: money in and credit notes are negative.
109
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
110
+ # @param [Hash] opts the optional parameters
111
+ # @option opts [String] :product The product key whose subscription to address (INT-2). A product-bound token is always confined to its own product; naming another is a &#x60;404&#x60;. An unbound token without it addresses the organization&#39;s newest serving subscription for the reference.
112
+ # @option opts [String] :reference What inside the organization the subscription is for — a Cbox Sites website id (decision D6). Exact: omitted means the organization-level subscription. Usage and allowances for a reference count under the subject &#x60;org#reference&#x60;. Also accepted in the JSON body of a &#x60;POST&#x60;.
113
+ # @option opts [Date] :from
114
+ # @option opts [Date] :to
115
+ # @return [GetCustomerStatement200Response]
116
+ def get_customer_statement(org, opts = {})
117
+ data, _status_code, _headers = get_customer_statement_with_http_info(org, opts)
118
+ data
119
+ end
120
+
121
+ # The customer&#39;s statement
122
+ # What the customer pays per subscription, what they owe now, and the invoices, payments and credit notes in the period (the last twelve months by default, five years at most). Balances are always as of now. A product-bound token sees that product&#39;s share. Amounts on &#x60;activity&#x60; are signed: money in and credit notes are negative.
123
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
124
+ # @param [Hash] opts the optional parameters
125
+ # @option opts [String] :product The product key whose subscription to address (INT-2). A product-bound token is always confined to its own product; naming another is a &#x60;404&#x60;. An unbound token without it addresses the organization&#39;s newest serving subscription for the reference.
126
+ # @option opts [String] :reference What inside the organization the subscription is for — a Cbox Sites website id (decision D6). Exact: omitted means the organization-level subscription. Usage and allowances for a reference count under the subject &#x60;org#reference&#x60;. Also accepted in the JSON body of a &#x60;POST&#x60;.
127
+ # @option opts [Date] :from
128
+ # @option opts [Date] :to
129
+ # @return [Array<(GetCustomerStatement200Response, Integer, Hash)>] GetCustomerStatement200Response data, response status code and response headers
130
+ def get_customer_statement_with_http_info(org, opts = {})
131
+ if @api_client.config.debugging
132
+ @api_client.config.logger.debug 'Calling API: InvoicesApi.get_customer_statement ...'
133
+ end
134
+ # verify the required parameter 'org' is set
135
+ if @api_client.config.client_side_validation && org.nil?
136
+ fail ArgumentError, "Missing the required parameter 'org' when calling InvoicesApi.get_customer_statement"
137
+ end
138
+ pattern = Regexp.new(/^[A-Za-z0-9._:-]{1,191}$/)
139
+ if @api_client.config.client_side_validation && !opts[:'reference'].nil? && opts[:'reference'] !~ pattern
140
+ fail ArgumentError, "invalid value for 'opts[:\"reference\"]' when calling InvoicesApi.get_customer_statement, must conform to the pattern #{pattern}."
141
+ end
142
+
143
+ # resource path
144
+ local_var_path = '/organizations/{org}/statement'.sub('{org}', CGI.escape(org.to_s))
145
+
146
+ # query parameters
147
+ query_params = opts[:query_params] || {}
148
+ query_params[:'product'] = opts[:'product'] if !opts[:'product'].nil?
149
+ query_params[:'reference'] = opts[:'reference'] if !opts[:'reference'].nil?
150
+ query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?
151
+ query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?
152
+
153
+ # header parameters
154
+ header_params = opts[:header_params] || {}
155
+ # HTTP header 'Accept' (if needed)
156
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
157
+
158
+ # form parameters
159
+ form_params = opts[:form_params] || {}
160
+
161
+ # http body (model)
162
+ post_body = opts[:debug_body]
163
+
164
+ # return_type
165
+ return_type = opts[:debug_return_type] || 'GetCustomerStatement200Response'
166
+
167
+ # auth_names
168
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
169
+
170
+ new_options = opts.merge(
171
+ :operation => :"InvoicesApi.get_customer_statement",
172
+ :header_params => header_params,
173
+ :query_params => query_params,
174
+ :form_params => form_params,
175
+ :body => post_body,
176
+ :auth_names => auth_names,
177
+ :return_type => return_type
178
+ )
179
+
180
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
181
+ if @api_client.config.debugging
182
+ @api_client.config.logger.debug "API called: InvoicesApi#get_customer_statement\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
183
+ end
184
+ return data, status_code, headers
185
+ end
186
+
187
+ # One invoice, with its lines, appendix and metadata
188
+ # One invoice by number, in the same shape `POST /invoices/{org}` answers with. `pdf_url` is signed and valid for 15 minutes from this response.
189
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
190
+ # @param number [String] The invoice number.
191
+ # @param [Hash] opts the optional parameters
192
+ # @return [InvoiceDetail]
193
+ def get_invoice(org, number, opts = {})
194
+ data, _status_code, _headers = get_invoice_with_http_info(org, number, opts)
195
+ data
196
+ end
197
+
198
+ # One invoice, with its lines, appendix and metadata
199
+ # One invoice by number, in the same shape &#x60;POST /invoices/{org}&#x60; answers with. &#x60;pdf_url&#x60; is signed and valid for 15 minutes from this response.
200
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
201
+ # @param number [String] The invoice number.
202
+ # @param [Hash] opts the optional parameters
203
+ # @return [Array<(InvoiceDetail, Integer, Hash)>] InvoiceDetail data, response status code and response headers
204
+ def get_invoice_with_http_info(org, number, opts = {})
205
+ if @api_client.config.debugging
206
+ @api_client.config.logger.debug 'Calling API: InvoicesApi.get_invoice ...'
207
+ end
208
+ # verify the required parameter 'org' is set
209
+ if @api_client.config.client_side_validation && org.nil?
210
+ fail ArgumentError, "Missing the required parameter 'org' when calling InvoicesApi.get_invoice"
211
+ end
212
+ # verify the required parameter 'number' is set
213
+ if @api_client.config.client_side_validation && number.nil?
214
+ fail ArgumentError, "Missing the required parameter 'number' when calling InvoicesApi.get_invoice"
215
+ end
216
+ pattern = Regexp.new(/^[A-Za-z0-9._-]+$/)
217
+ if @api_client.config.client_side_validation && number !~ pattern
218
+ fail ArgumentError, "invalid value for 'number' when calling InvoicesApi.get_invoice, must conform to the pattern #{pattern}."
219
+ end
220
+
221
+ # resource path
222
+ local_var_path = '/invoices/{org}/{number}'.sub('{org}', CGI.escape(org.to_s)).sub('{number}', CGI.escape(number.to_s))
223
+
224
+ # query parameters
225
+ query_params = opts[:query_params] || {}
226
+
227
+ # header parameters
228
+ header_params = opts[:header_params] || {}
229
+ # HTTP header 'Accept' (if needed)
230
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
231
+
232
+ # form parameters
233
+ form_params = opts[:form_params] || {}
234
+
235
+ # http body (model)
236
+ post_body = opts[:debug_body]
237
+
238
+ # return_type
239
+ return_type = opts[:debug_return_type] || 'InvoiceDetail'
240
+
241
+ # auth_names
242
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
243
+
244
+ new_options = opts.merge(
245
+ :operation => :"InvoicesApi.get_invoice",
246
+ :header_params => header_params,
247
+ :query_params => query_params,
248
+ :form_params => form_params,
249
+ :body => post_body,
250
+ :auth_names => auth_names,
251
+ :return_type => return_type
252
+ )
253
+
254
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
255
+ if @api_client.config.debugging
256
+ @api_client.config.logger.debug "API called: InvoicesApi#get_invoice\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
257
+ end
258
+ return data, status_code, headers
259
+ end
260
+
261
+ # Download an invoice as an e-invoice (Peppol BIS 3.0 or OIOUBL 2.1)
262
+ # The issued invoice as XML: `peppol` is Peppol BIS Billing 3.0 (UBL 2.1, the EN 16931 core plus the Peppol rules), `oioubl` is OIOUBL 2.1 (the Danish public-sector format carried by NemHandel). Without `format`, the customer's preferred format (`einvoice_format` on the organization), else Peppol. A negative-total invoice is written as a credit note. The document is written from what was issued: the seller and buyer frozen at issue, the issued lines and the VAT Cbox Tax charged, and the VAT in DKK on a foreign-currency invoice. Writing it never changes the invoice, and nothing is sent anywhere. The buyer is addressed by the e-invoice endpoint frozen at issue, else its EAN, else its CVR or VAT number; Peppol falls back to the buyer's e-mail (scheme `EM`). `422 einvoice_unavailable` says why a document cannot be written in a format: no buyer address that format can carry, or (OIOUBL) VAT at two standard rates.
263
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
264
+ # @param number [String] The invoice number.
265
+ # @param [Hash] opts the optional parameters
266
+ # @option opts [String] :format &#x60;peppol&#x60; (Peppol BIS Billing 3.0, UBL 2.1) or &#x60;oioubl&#x60; (OIOUBL 2.1). Without it, the customer&#39;s &#x60;einvoice_format&#x60;, else &#x60;peppol&#x60;.
267
+ # @return [String]
268
+ def get_invoice_e_invoice(org, number, opts = {})
269
+ data, _status_code, _headers = get_invoice_e_invoice_with_http_info(org, number, opts)
270
+ data
271
+ end
272
+
273
+ # Download an invoice as an e-invoice (Peppol BIS 3.0 or OIOUBL 2.1)
274
+ # The issued invoice as XML: &#x60;peppol&#x60; is Peppol BIS Billing 3.0 (UBL 2.1, the EN 16931 core plus the Peppol rules), &#x60;oioubl&#x60; is OIOUBL 2.1 (the Danish public-sector format carried by NemHandel). Without &#x60;format&#x60;, the customer&#39;s preferred format (&#x60;einvoice_format&#x60; on the organization), else Peppol. A negative-total invoice is written as a credit note. The document is written from what was issued: the seller and buyer frozen at issue, the issued lines and the VAT Cbox Tax charged, and the VAT in DKK on a foreign-currency invoice. Writing it never changes the invoice, and nothing is sent anywhere. The buyer is addressed by the e-invoice endpoint frozen at issue, else its EAN, else its CVR or VAT number; Peppol falls back to the buyer&#39;s e-mail (scheme &#x60;EM&#x60;). &#x60;422 einvoice_unavailable&#x60; says why a document cannot be written in a format: no buyer address that format can carry, or (OIOUBL) VAT at two standard rates.
275
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
276
+ # @param number [String] The invoice number.
277
+ # @param [Hash] opts the optional parameters
278
+ # @option opts [String] :format &#x60;peppol&#x60; (Peppol BIS Billing 3.0, UBL 2.1) or &#x60;oioubl&#x60; (OIOUBL 2.1). Without it, the customer&#39;s &#x60;einvoice_format&#x60;, else &#x60;peppol&#x60;.
279
+ # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
280
+ def get_invoice_e_invoice_with_http_info(org, number, opts = {})
281
+ if @api_client.config.debugging
282
+ @api_client.config.logger.debug 'Calling API: InvoicesApi.get_invoice_e_invoice ...'
283
+ end
284
+ # verify the required parameter 'org' is set
285
+ if @api_client.config.client_side_validation && org.nil?
286
+ fail ArgumentError, "Missing the required parameter 'org' when calling InvoicesApi.get_invoice_e_invoice"
287
+ end
288
+ # verify the required parameter 'number' is set
289
+ if @api_client.config.client_side_validation && number.nil?
290
+ fail ArgumentError, "Missing the required parameter 'number' when calling InvoicesApi.get_invoice_e_invoice"
291
+ end
292
+ pattern = Regexp.new(/^[A-Za-z0-9._-]+$/)
293
+ if @api_client.config.client_side_validation && number !~ pattern
294
+ fail ArgumentError, "invalid value for 'number' when calling InvoicesApi.get_invoice_e_invoice, must conform to the pattern #{pattern}."
295
+ end
296
+
297
+ allowable_values = ["peppol", "oioubl"]
298
+ if @api_client.config.client_side_validation && opts[:'format'] && !allowable_values.include?(opts[:'format'])
299
+ fail ArgumentError, "invalid value for \"format\", must be one of #{allowable_values}"
300
+ end
301
+ # resource path
302
+ local_var_path = '/invoices/{org}/{number}/einvoice'.sub('{org}', CGI.escape(org.to_s)).sub('{number}', CGI.escape(number.to_s))
303
+
304
+ # query parameters
305
+ query_params = opts[:query_params] || {}
306
+ query_params[:'format'] = opts[:'format'] if !opts[:'format'].nil?
307
+
308
+ # header parameters
309
+ header_params = opts[:header_params] || {}
310
+ # HTTP header 'Accept' (if needed)
311
+ header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json']) unless header_params['Accept']
312
+
313
+ # form parameters
314
+ form_params = opts[:form_params] || {}
315
+
316
+ # http body (model)
317
+ post_body = opts[:debug_body]
318
+
319
+ # return_type
320
+ return_type = opts[:debug_return_type] || 'String'
321
+
322
+ # auth_names
323
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
324
+
325
+ new_options = opts.merge(
326
+ :operation => :"InvoicesApi.get_invoice_e_invoice",
327
+ :header_params => header_params,
328
+ :query_params => query_params,
329
+ :form_params => form_params,
330
+ :body => post_body,
331
+ :auth_names => auth_names,
332
+ :return_type => return_type
333
+ )
334
+
335
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
336
+ if @api_client.config.debugging
337
+ @api_client.config.logger.debug "API called: InvoicesApi#get_invoice_e_invoice\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
338
+ end
339
+ return data, status_code, headers
340
+ end
341
+
342
+ # Download an invoice's PDF
343
+ # Answers `302` to a signed download URL valid for 15 minutes, which serves the stored issued document (`application/pdf`). Follow the redirect without the bearer token.
344
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
345
+ # @param number [String] The invoice number.
346
+ # @param [Hash] opts the optional parameters
347
+ # @return [File]
348
+ def get_invoice_pdf(org, number, opts = {})
349
+ data, _status_code, _headers = get_invoice_pdf_with_http_info(org, number, opts)
350
+ data
351
+ end
352
+
353
+ # Download an invoice&#39;s PDF
354
+ # Answers &#x60;302&#x60; to a signed download URL valid for 15 minutes, which serves the stored issued document (&#x60;application/pdf&#x60;). Follow the redirect without the bearer token.
355
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
356
+ # @param number [String] The invoice number.
357
+ # @param [Hash] opts the optional parameters
358
+ # @return [Array<(File, Integer, Hash)>] File data, response status code and response headers
359
+ def get_invoice_pdf_with_http_info(org, number, opts = {})
360
+ if @api_client.config.debugging
361
+ @api_client.config.logger.debug 'Calling API: InvoicesApi.get_invoice_pdf ...'
362
+ end
363
+ # verify the required parameter 'org' is set
364
+ if @api_client.config.client_side_validation && org.nil?
365
+ fail ArgumentError, "Missing the required parameter 'org' when calling InvoicesApi.get_invoice_pdf"
366
+ end
367
+ # verify the required parameter 'number' is set
368
+ if @api_client.config.client_side_validation && number.nil?
369
+ fail ArgumentError, "Missing the required parameter 'number' when calling InvoicesApi.get_invoice_pdf"
370
+ end
371
+ pattern = Regexp.new(/^[A-Za-z0-9._-]+$/)
372
+ if @api_client.config.client_side_validation && number !~ pattern
373
+ fail ArgumentError, "invalid value for 'number' when calling InvoicesApi.get_invoice_pdf, must conform to the pattern #{pattern}."
374
+ end
375
+
376
+ # resource path
377
+ local_var_path = '/invoices/{org}/{number}/pdf'.sub('{org}', CGI.escape(org.to_s)).sub('{number}', CGI.escape(number.to_s))
378
+
379
+ # query parameters
380
+ query_params = opts[:query_params] || {}
381
+
382
+ # header parameters
383
+ header_params = opts[:header_params] || {}
384
+ # HTTP header 'Accept' (if needed)
385
+ header_params['Accept'] = @api_client.select_header_accept(['application/pdf', 'application/json']) unless header_params['Accept']
386
+
387
+ # form parameters
388
+ form_params = opts[:form_params] || {}
389
+
390
+ # http body (model)
391
+ post_body = opts[:debug_body]
392
+
393
+ # return_type
394
+ return_type = opts[:debug_return_type] || 'File'
395
+
396
+ # auth_names
397
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
398
+
399
+ new_options = opts.merge(
400
+ :operation => :"InvoicesApi.get_invoice_pdf",
401
+ :header_params => header_params,
402
+ :query_params => query_params,
403
+ :form_params => form_params,
404
+ :body => post_body,
405
+ :auth_names => auth_names,
406
+ :return_type => return_type
407
+ )
408
+
409
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
410
+ if @api_client.config.debugging
411
+ @api_client.config.logger.debug "API called: InvoicesApi#get_invoice_pdf\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
412
+ end
413
+ return data, status_code, headers
414
+ end
415
+
416
+ # One refund of an invoice
417
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
418
+ # @param number [String] The invoice number.
419
+ # @param refund [String] The refund id, as &#x60;POST …/refunds&#x60; or the list returns it.
420
+ # @param [Hash] opts the optional parameters
421
+ # @return [Refund]
422
+ def get_invoice_refund(org, number, refund, opts = {})
423
+ data, _status_code, _headers = get_invoice_refund_with_http_info(org, number, refund, opts)
424
+ data
425
+ end
426
+
427
+ # One refund of an invoice
428
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
429
+ # @param number [String] The invoice number.
430
+ # @param refund [String] The refund id, as &#x60;POST …/refunds&#x60; or the list returns it.
431
+ # @param [Hash] opts the optional parameters
432
+ # @return [Array<(Refund, Integer, Hash)>] Refund data, response status code and response headers
433
+ def get_invoice_refund_with_http_info(org, number, refund, opts = {})
434
+ if @api_client.config.debugging
435
+ @api_client.config.logger.debug 'Calling API: InvoicesApi.get_invoice_refund ...'
436
+ end
437
+ # verify the required parameter 'org' is set
438
+ if @api_client.config.client_side_validation && org.nil?
439
+ fail ArgumentError, "Missing the required parameter 'org' when calling InvoicesApi.get_invoice_refund"
440
+ end
441
+ # verify the required parameter 'number' is set
442
+ if @api_client.config.client_side_validation && number.nil?
443
+ fail ArgumentError, "Missing the required parameter 'number' when calling InvoicesApi.get_invoice_refund"
444
+ end
445
+ pattern = Regexp.new(/^[A-Za-z0-9._-]+$/)
446
+ if @api_client.config.client_side_validation && number !~ pattern
447
+ fail ArgumentError, "invalid value for 'number' when calling InvoicesApi.get_invoice_refund, must conform to the pattern #{pattern}."
448
+ end
449
+
450
+ # verify the required parameter 'refund' is set
451
+ if @api_client.config.client_side_validation && refund.nil?
452
+ fail ArgumentError, "Missing the required parameter 'refund' when calling InvoicesApi.get_invoice_refund"
453
+ end
454
+ pattern = Regexp.new(/^[A-Za-z0-9:._-]+$/)
455
+ if @api_client.config.client_side_validation && refund !~ pattern
456
+ fail ArgumentError, "invalid value for 'refund' when calling InvoicesApi.get_invoice_refund, must conform to the pattern #{pattern}."
457
+ end
458
+
459
+ # resource path
460
+ local_var_path = '/invoices/{org}/{number}/refunds/{refund}'.sub('{org}', CGI.escape(org.to_s)).sub('{number}', CGI.escape(number.to_s)).sub('{refund}', CGI.escape(refund.to_s))
461
+
462
+ # query parameters
463
+ query_params = opts[:query_params] || {}
464
+
465
+ # header parameters
466
+ header_params = opts[:header_params] || {}
467
+ # HTTP header 'Accept' (if needed)
468
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
469
+
470
+ # form parameters
471
+ form_params = opts[:form_params] || {}
472
+
473
+ # http body (model)
474
+ post_body = opts[:debug_body]
475
+
476
+ # return_type
477
+ return_type = opts[:debug_return_type] || 'Refund'
478
+
479
+ # auth_names
480
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
481
+
482
+ new_options = opts.merge(
483
+ :operation => :"InvoicesApi.get_invoice_refund",
484
+ :header_params => header_params,
485
+ :query_params => query_params,
486
+ :form_params => form_params,
487
+ :body => post_body,
488
+ :auth_names => auth_names,
489
+ :return_type => return_type
490
+ )
491
+
492
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
493
+ if @api_client.config.debugging
494
+ @api_client.config.logger.debug "API called: InvoicesApi#get_invoice_refund\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
495
+ end
496
+ return data, status_code, headers
497
+ end
498
+
499
+ # How an organization's invoices are collected
500
+ # What an invoice issued now would carry. `*_inherited` says the value comes from the environment.
501
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
502
+ # @param [Hash] opts the optional parameters
503
+ # @return [PaymentTerms]
504
+ def get_payment_terms(org, opts = {})
505
+ data, _status_code, _headers = get_payment_terms_with_http_info(org, opts)
506
+ data
507
+ end
508
+
509
+ # How an organization&#39;s invoices are collected
510
+ # What an invoice issued now would carry. &#x60;*_inherited&#x60; says the value comes from the environment.
511
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
512
+ # @param [Hash] opts the optional parameters
513
+ # @return [Array<(PaymentTerms, Integer, Hash)>] PaymentTerms data, response status code and response headers
514
+ def get_payment_terms_with_http_info(org, opts = {})
515
+ if @api_client.config.debugging
516
+ @api_client.config.logger.debug 'Calling API: InvoicesApi.get_payment_terms ...'
517
+ end
518
+ # verify the required parameter 'org' is set
519
+ if @api_client.config.client_side_validation && org.nil?
520
+ fail ArgumentError, "Missing the required parameter 'org' when calling InvoicesApi.get_payment_terms"
521
+ end
522
+ # resource path
523
+ local_var_path = '/organizations/{org}/payment-terms'.sub('{org}', CGI.escape(org.to_s))
524
+
525
+ # query parameters
526
+ query_params = opts[:query_params] || {}
527
+
528
+ # header parameters
529
+ header_params = opts[:header_params] || {}
530
+ # HTTP header 'Accept' (if needed)
531
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
532
+
533
+ # form parameters
534
+ form_params = opts[:form_params] || {}
535
+
536
+ # http body (model)
537
+ post_body = opts[:debug_body]
538
+
539
+ # return_type
540
+ return_type = opts[:debug_return_type] || 'PaymentTerms'
541
+
542
+ # auth_names
543
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
544
+
545
+ new_options = opts.merge(
546
+ :operation => :"InvoicesApi.get_payment_terms",
547
+ :header_params => header_params,
548
+ :query_params => query_params,
549
+ :form_params => form_params,
550
+ :body => post_body,
551
+ :auth_names => auth_names,
552
+ :return_type => return_type
553
+ )
554
+
555
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
556
+ if @api_client.config.debugging
557
+ @api_client.config.logger.debug "API called: InvoicesApi#get_payment_terms\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
558
+ end
559
+ return data, status_code, headers
560
+ end
561
+
562
+ # Issue a draft now
563
+ # Taxes the lines for good, draws the legal number, sends the invoice and collects it. The answer's `id` is then the invoice number. 409 `cannot_issue_yet` while the subscription is held or the customer's details are missing.
564
+ # @param id [String] The draft&#39;s public id (&#x60;inv_…&#x60;) or its &#x60;draft_…&#x60; number.
565
+ # @param [Hash] opts the optional parameters
566
+ # @return [InvoiceDraft]
567
+ def issue_invoice_draft(id, opts = {})
568
+ data, _status_code, _headers = issue_invoice_draft_with_http_info(id, opts)
569
+ data
570
+ end
571
+
572
+ # Issue a draft now
573
+ # Taxes the lines for good, draws the legal number, sends the invoice and collects it. The answer&#39;s &#x60;id&#x60; is then the invoice number. 409 &#x60;cannot_issue_yet&#x60; while the subscription is held or the customer&#39;s details are missing.
574
+ # @param id [String] The draft&#39;s public id (&#x60;inv_…&#x60;) or its &#x60;draft_…&#x60; number.
575
+ # @param [Hash] opts the optional parameters
576
+ # @return [Array<(InvoiceDraft, Integer, Hash)>] InvoiceDraft data, response status code and response headers
577
+ def issue_invoice_draft_with_http_info(id, opts = {})
578
+ if @api_client.config.debugging
579
+ @api_client.config.logger.debug 'Calling API: InvoicesApi.issue_invoice_draft ...'
580
+ end
581
+ # verify the required parameter 'id' is set
582
+ if @api_client.config.client_side_validation && id.nil?
583
+ fail ArgumentError, "Missing the required parameter 'id' when calling InvoicesApi.issue_invoice_draft"
584
+ end
585
+ pattern = Regexp.new(/^(draft_[0-9A-Za-z]+|inv_[0-9A-Za-z]+)$/)
586
+ if @api_client.config.client_side_validation && id !~ pattern
587
+ fail ArgumentError, "invalid value for 'id' when calling InvoicesApi.issue_invoice_draft, must conform to the pattern #{pattern}."
588
+ end
589
+
590
+ # resource path
591
+ local_var_path = '/invoice-drafts/{id}/issue'.sub('{id}', CGI.escape(id.to_s))
592
+
593
+ # query parameters
594
+ query_params = opts[:query_params] || {}
595
+
596
+ # header parameters
597
+ header_params = opts[:header_params] || {}
598
+ # HTTP header 'Accept' (if needed)
599
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
600
+
601
+ # form parameters
602
+ form_params = opts[:form_params] || {}
603
+
604
+ # http body (model)
605
+ post_body = opts[:debug_body]
606
+
607
+ # return_type
608
+ return_type = opts[:debug_return_type] || 'InvoiceDraft'
609
+
610
+ # auth_names
611
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
612
+
613
+ new_options = opts.merge(
614
+ :operation => :"InvoicesApi.issue_invoice_draft",
615
+ :header_params => header_params,
616
+ :query_params => query_params,
617
+ :form_params => form_params,
618
+ :body => post_body,
619
+ :auth_names => auth_names,
620
+ :return_type => return_type
621
+ )
622
+
623
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
624
+ if @api_client.config.debugging
625
+ @api_client.config.logger.debug "API called: InvoicesApi#issue_invoice_draft\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
626
+ end
627
+ return data, status_code, headers
628
+ end
629
+
630
+ # Every invoice in the token's environment (newest first)
631
+ # Every issued invoice in the token's environment, newest first, as one cursor page. Filter by `organization`, `status` and the issue date (`issued_from` / `issued_to`, inclusive, UTC). Each row is the `GET /invoices/{org}` row plus its `organization`. Needs an operator (environment) token; an organization-scoped token is `403` (use `GET /invoices/{org}`). A token bound to a product sees its product's subscription invoices only. Another environment's or tenant's invoices are never listed.
632
+ # @param [Hash] opts the optional parameters
633
+ # @option opts [String] :organization Only this organization&#39;s invoices.
634
+ # @option opts [String] :status Only invoices in this status.
635
+ # @option opts [Date] :issued_from Only invoices issued on or after this date (UTC).
636
+ # @option opts [Date] :issued_to Only invoices issued on or before this date (UTC). Not before &#x60;issued_from&#x60;.
637
+ # @option opts [String] :cursor The opaque &#x60;next_cursor&#x60; from a previous page. Treat it as a black box — echo it back verbatim to fetch the following page. Omit it for the first page. A malformed cursor is a &#x60;400&#x60;.
638
+ # @option opts [Integer] :limit Maximum items per page (1–100). Defaults to 20. (default to 20)
639
+ # @return [PlaneInvoiceList]
640
+ def list_all_invoices(opts = {})
641
+ data, _status_code, _headers = list_all_invoices_with_http_info(opts)
642
+ data
643
+ end
644
+
645
+ # Every invoice in the token&#39;s environment (newest first)
646
+ # Every issued invoice in the token&#39;s environment, newest first, as one cursor page. Filter by &#x60;organization&#x60;, &#x60;status&#x60; and the issue date (&#x60;issued_from&#x60; / &#x60;issued_to&#x60;, inclusive, UTC). Each row is the &#x60;GET /invoices/{org}&#x60; row plus its &#x60;organization&#x60;. Needs an operator (environment) token; an organization-scoped token is &#x60;403&#x60; (use &#x60;GET /invoices/{org}&#x60;). A token bound to a product sees its product&#39;s subscription invoices only. Another environment&#39;s or tenant&#39;s invoices are never listed.
647
+ # @param [Hash] opts the optional parameters
648
+ # @option opts [String] :organization Only this organization&#39;s invoices.
649
+ # @option opts [String] :status Only invoices in this status.
650
+ # @option opts [Date] :issued_from Only invoices issued on or after this date (UTC).
651
+ # @option opts [Date] :issued_to Only invoices issued on or before this date (UTC). Not before &#x60;issued_from&#x60;.
652
+ # @option opts [String] :cursor The opaque &#x60;next_cursor&#x60; from a previous page. Treat it as a black box — echo it back verbatim to fetch the following page. Omit it for the first page. A malformed cursor is a &#x60;400&#x60;.
653
+ # @option opts [Integer] :limit Maximum items per page (1–100). Defaults to 20. (default to 20)
654
+ # @return [Array<(PlaneInvoiceList, Integer, Hash)>] PlaneInvoiceList data, response status code and response headers
655
+ def list_all_invoices_with_http_info(opts = {})
656
+ if @api_client.config.debugging
657
+ @api_client.config.logger.debug 'Calling API: InvoicesApi.list_all_invoices ...'
658
+ end
659
+ allowable_values = ["draft", "open", "paid", "void", "uncollectible", "refunded"]
660
+ if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])
661
+ fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}"
662
+ end
663
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
664
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling InvoicesApi.list_all_invoices, must be smaller than or equal to 100.'
665
+ end
666
+
667
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
668
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling InvoicesApi.list_all_invoices, must be greater than or equal to 1.'
669
+ end
670
+
671
+ # resource path
672
+ local_var_path = '/invoices'
673
+
674
+ # query parameters
675
+ query_params = opts[:query_params] || {}
676
+ query_params[:'organization'] = opts[:'organization'] if !opts[:'organization'].nil?
677
+ query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
678
+ query_params[:'issued_from'] = opts[:'issued_from'] if !opts[:'issued_from'].nil?
679
+ query_params[:'issued_to'] = opts[:'issued_to'] if !opts[:'issued_to'].nil?
680
+ query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
681
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
682
+
683
+ # header parameters
684
+ header_params = opts[:header_params] || {}
685
+ # HTTP header 'Accept' (if needed)
686
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
687
+
688
+ # form parameters
689
+ form_params = opts[:form_params] || {}
690
+
691
+ # http body (model)
692
+ post_body = opts[:debug_body]
693
+
694
+ # return_type
695
+ return_type = opts[:debug_return_type] || 'PlaneInvoiceList'
696
+
697
+ # auth_names
698
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
699
+
700
+ new_options = opts.merge(
701
+ :operation => :"InvoicesApi.list_all_invoices",
702
+ :header_params => header_params,
703
+ :query_params => query_params,
704
+ :form_params => form_params,
705
+ :body => post_body,
706
+ :auth_names => auth_names,
707
+ :return_type => return_type
708
+ )
709
+
710
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
711
+ if @api_client.config.debugging
712
+ @api_client.config.logger.debug "API called: InvoicesApi#list_all_invoices\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
713
+ end
714
+ return data, status_code, headers
715
+ end
716
+
717
+ # The drafts waiting for review
718
+ # Oldest first. Takes an operator token; a customer never sees a draft.
719
+ # @param [Hash] opts the optional parameters
720
+ # @option opts [Integer] :limit
721
+ # @option opts [String] :cursor
722
+ # @return [ListInvoiceDrafts200Response]
723
+ def list_invoice_drafts(opts = {})
724
+ data, _status_code, _headers = list_invoice_drafts_with_http_info(opts)
725
+ data
726
+ end
727
+
728
+ # The drafts waiting for review
729
+ # Oldest first. Takes an operator token; a customer never sees a draft.
730
+ # @param [Hash] opts the optional parameters
731
+ # @option opts [Integer] :limit
732
+ # @option opts [String] :cursor
733
+ # @return [Array<(ListInvoiceDrafts200Response, Integer, Hash)>] ListInvoiceDrafts200Response data, response status code and response headers
734
+ def list_invoice_drafts_with_http_info(opts = {})
735
+ if @api_client.config.debugging
736
+ @api_client.config.logger.debug 'Calling API: InvoicesApi.list_invoice_drafts ...'
737
+ end
738
+ # resource path
739
+ local_var_path = '/invoice-drafts'
740
+
741
+ # query parameters
742
+ query_params = opts[:query_params] || {}
743
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
744
+ query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
745
+
746
+ # header parameters
747
+ header_params = opts[:header_params] || {}
748
+ # HTTP header 'Accept' (if needed)
749
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
750
+
751
+ # form parameters
752
+ form_params = opts[:form_params] || {}
753
+
754
+ # http body (model)
755
+ post_body = opts[:debug_body]
756
+
757
+ # return_type
758
+ return_type = opts[:debug_return_type] || 'ListInvoiceDrafts200Response'
759
+
760
+ # auth_names
761
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
762
+
763
+ new_options = opts.merge(
764
+ :operation => :"InvoicesApi.list_invoice_drafts",
765
+ :header_params => header_params,
766
+ :query_params => query_params,
767
+ :form_params => form_params,
768
+ :body => post_body,
769
+ :auth_names => auth_names,
770
+ :return_type => return_type
771
+ )
772
+
773
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
774
+ if @api_client.config.debugging
775
+ @api_client.config.logger.debug "API called: InvoicesApi#list_invoice_drafts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
776
+ end
777
+ return data, status_code, headers
778
+ end
779
+
780
+ # The payments recorded against an invoice
781
+ # Reversed payments stay in the list with `reversed_at`.
782
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
783
+ # @param number [String] The invoice number.
784
+ # @param [Hash] opts the optional parameters
785
+ # @return [ListInvoicePayments200Response]
786
+ def list_invoice_payments(org, number, opts = {})
787
+ data, _status_code, _headers = list_invoice_payments_with_http_info(org, number, opts)
788
+ data
789
+ end
790
+
791
+ # The payments recorded against an invoice
792
+ # Reversed payments stay in the list with &#x60;reversed_at&#x60;.
793
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
794
+ # @param number [String] The invoice number.
795
+ # @param [Hash] opts the optional parameters
796
+ # @return [Array<(ListInvoicePayments200Response, Integer, Hash)>] ListInvoicePayments200Response data, response status code and response headers
797
+ def list_invoice_payments_with_http_info(org, number, opts = {})
798
+ if @api_client.config.debugging
799
+ @api_client.config.logger.debug 'Calling API: InvoicesApi.list_invoice_payments ...'
800
+ end
801
+ # verify the required parameter 'org' is set
802
+ if @api_client.config.client_side_validation && org.nil?
803
+ fail ArgumentError, "Missing the required parameter 'org' when calling InvoicesApi.list_invoice_payments"
804
+ end
805
+ # verify the required parameter 'number' is set
806
+ if @api_client.config.client_side_validation && number.nil?
807
+ fail ArgumentError, "Missing the required parameter 'number' when calling InvoicesApi.list_invoice_payments"
808
+ end
809
+ # resource path
810
+ local_var_path = '/invoices/{org}/{number}/payments'.sub('{org}', CGI.escape(org.to_s)).sub('{number}', CGI.escape(number.to_s))
811
+
812
+ # query parameters
813
+ query_params = opts[:query_params] || {}
814
+
815
+ # header parameters
816
+ header_params = opts[:header_params] || {}
817
+ # HTTP header 'Accept' (if needed)
818
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
819
+
820
+ # form parameters
821
+ form_params = opts[:form_params] || {}
822
+
823
+ # http body (model)
824
+ post_body = opts[:debug_body]
825
+
826
+ # return_type
827
+ return_type = opts[:debug_return_type] || 'ListInvoicePayments200Response'
828
+
829
+ # auth_names
830
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
831
+
832
+ new_options = opts.merge(
833
+ :operation => :"InvoicesApi.list_invoice_payments",
834
+ :header_params => header_params,
835
+ :query_params => query_params,
836
+ :form_params => form_params,
837
+ :body => post_body,
838
+ :auth_names => auth_names,
839
+ :return_type => return_type
840
+ )
841
+
842
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
843
+ if @api_client.config.debugging
844
+ @api_client.config.logger.debug "API called: InvoicesApi#list_invoice_payments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
845
+ end
846
+ return data, status_code, headers
847
+ end
848
+
849
+ # The refunds recorded against an invoice
850
+ # Every refund recorded against the invoice, newest first: `completed` (a credit note was issued), `pending` (the payment provider has not answered yet; the recovery sweep finishes it) or `failed` (refused, nothing was refunded). A refund held for approval is not here until a person approves it. An organization's own token may read its invoices' refunds.
851
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
852
+ # @param number [String] The invoice number.
853
+ # @param [Hash] opts the optional parameters
854
+ # @return [RefundList]
855
+ def list_invoice_refunds(org, number, opts = {})
856
+ data, _status_code, _headers = list_invoice_refunds_with_http_info(org, number, opts)
857
+ data
858
+ end
859
+
860
+ # The refunds recorded against an invoice
861
+ # Every refund recorded against the invoice, newest first: &#x60;completed&#x60; (a credit note was issued), &#x60;pending&#x60; (the payment provider has not answered yet; the recovery sweep finishes it) or &#x60;failed&#x60; (refused, nothing was refunded). A refund held for approval is not here until a person approves it. An organization&#39;s own token may read its invoices&#39; refunds.
862
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
863
+ # @param number [String] The invoice number.
864
+ # @param [Hash] opts the optional parameters
865
+ # @return [Array<(RefundList, Integer, Hash)>] RefundList data, response status code and response headers
866
+ def list_invoice_refunds_with_http_info(org, number, opts = {})
867
+ if @api_client.config.debugging
868
+ @api_client.config.logger.debug 'Calling API: InvoicesApi.list_invoice_refunds ...'
869
+ end
870
+ # verify the required parameter 'org' is set
871
+ if @api_client.config.client_side_validation && org.nil?
872
+ fail ArgumentError, "Missing the required parameter 'org' when calling InvoicesApi.list_invoice_refunds"
873
+ end
874
+ # verify the required parameter 'number' is set
875
+ if @api_client.config.client_side_validation && number.nil?
876
+ fail ArgumentError, "Missing the required parameter 'number' when calling InvoicesApi.list_invoice_refunds"
877
+ end
878
+ pattern = Regexp.new(/^[A-Za-z0-9._-]+$/)
879
+ if @api_client.config.client_side_validation && number !~ pattern
880
+ fail ArgumentError, "invalid value for 'number' when calling InvoicesApi.list_invoice_refunds, must conform to the pattern #{pattern}."
881
+ end
882
+
883
+ # resource path
884
+ local_var_path = '/invoices/{org}/{number}/refunds'.sub('{org}', CGI.escape(org.to_s)).sub('{number}', CGI.escape(number.to_s))
885
+
886
+ # query parameters
887
+ query_params = opts[:query_params] || {}
888
+
889
+ # header parameters
890
+ header_params = opts[:header_params] || {}
891
+ # HTTP header 'Accept' (if needed)
892
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
893
+
894
+ # form parameters
895
+ form_params = opts[:form_params] || {}
896
+
897
+ # http body (model)
898
+ post_body = opts[:debug_body]
899
+
900
+ # return_type
901
+ return_type = opts[:debug_return_type] || 'RefundList'
902
+
903
+ # auth_names
904
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
905
+
906
+ new_options = opts.merge(
907
+ :operation => :"InvoicesApi.list_invoice_refunds",
908
+ :header_params => header_params,
909
+ :query_params => query_params,
910
+ :form_params => form_params,
911
+ :body => post_body,
912
+ :auth_names => auth_names,
913
+ :return_type => return_type
914
+ )
915
+
916
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
917
+ if @api_client.config.debugging
918
+ @api_client.config.logger.debug "API called: InvoicesApi#list_invoice_refunds\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
919
+ end
920
+ return data, status_code, headers
921
+ end
922
+
923
+ # An organization's issued invoices (newest first)
924
+ # The organization's issued invoices as one cursor page, newest first, filtered by `status` and the issue date (`issued_from` / `issued_to`, inclusive, UTC). A bad filter is `422`.
925
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
926
+ # @param [Hash] opts the optional parameters
927
+ # @option opts [String] :product The product key whose subscription to address (INT-2). A product-bound token is always confined to its own product; naming another is a &#x60;404&#x60;. An unbound token without it addresses the organization&#39;s newest serving subscription for the reference.
928
+ # @option opts [String] :reference What inside the organization the subscription is for — a Cbox Sites website id (decision D6). Exact: omitted means the organization-level subscription. Usage and allowances for a reference count under the subject &#x60;org#reference&#x60;. Also accepted in the JSON body of a &#x60;POST&#x60;.
929
+ # @option opts [String] :status Only invoices in this status.
930
+ # @option opts [Date] :issued_from Only invoices issued on or after this date (UTC).
931
+ # @option opts [Date] :issued_to Only invoices issued on or before this date (UTC). Not before &#x60;issued_from&#x60;.
932
+ # @option opts [String] :cursor The opaque &#x60;next_cursor&#x60; from a previous page. Treat it as a black box — echo it back verbatim to fetch the following page. Omit it for the first page. A malformed cursor is a &#x60;400&#x60;.
933
+ # @option opts [Integer] :limit Maximum items per page (1–100). Defaults to 20. (default to 20)
934
+ # @return [InvoiceList]
935
+ def list_invoices(org, opts = {})
936
+ data, _status_code, _headers = list_invoices_with_http_info(org, opts)
937
+ data
938
+ end
939
+
940
+ # An organization&#39;s issued invoices (newest first)
941
+ # The organization&#39;s issued invoices as one cursor page, newest first, filtered by &#x60;status&#x60; and the issue date (&#x60;issued_from&#x60; / &#x60;issued_to&#x60;, inclusive, UTC). A bad filter is &#x60;422&#x60;.
942
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
943
+ # @param [Hash] opts the optional parameters
944
+ # @option opts [String] :product The product key whose subscription to address (INT-2). A product-bound token is always confined to its own product; naming another is a &#x60;404&#x60;. An unbound token without it addresses the organization&#39;s newest serving subscription for the reference.
945
+ # @option opts [String] :reference What inside the organization the subscription is for — a Cbox Sites website id (decision D6). Exact: omitted means the organization-level subscription. Usage and allowances for a reference count under the subject &#x60;org#reference&#x60;. Also accepted in the JSON body of a &#x60;POST&#x60;.
946
+ # @option opts [String] :status Only invoices in this status.
947
+ # @option opts [Date] :issued_from Only invoices issued on or after this date (UTC).
948
+ # @option opts [Date] :issued_to Only invoices issued on or before this date (UTC). Not before &#x60;issued_from&#x60;.
949
+ # @option opts [String] :cursor The opaque &#x60;next_cursor&#x60; from a previous page. Treat it as a black box — echo it back verbatim to fetch the following page. Omit it for the first page. A malformed cursor is a &#x60;400&#x60;.
950
+ # @option opts [Integer] :limit Maximum items per page (1–100). Defaults to 20. (default to 20)
951
+ # @return [Array<(InvoiceList, Integer, Hash)>] InvoiceList data, response status code and response headers
952
+ def list_invoices_with_http_info(org, opts = {})
953
+ if @api_client.config.debugging
954
+ @api_client.config.logger.debug 'Calling API: InvoicesApi.list_invoices ...'
955
+ end
956
+ # verify the required parameter 'org' is set
957
+ if @api_client.config.client_side_validation && org.nil?
958
+ fail ArgumentError, "Missing the required parameter 'org' when calling InvoicesApi.list_invoices"
959
+ end
960
+ pattern = Regexp.new(/^[A-Za-z0-9._:-]{1,191}$/)
961
+ if @api_client.config.client_side_validation && !opts[:'reference'].nil? && opts[:'reference'] !~ pattern
962
+ fail ArgumentError, "invalid value for 'opts[:\"reference\"]' when calling InvoicesApi.list_invoices, must conform to the pattern #{pattern}."
963
+ end
964
+
965
+ allowable_values = ["draft", "open", "paid", "void", "uncollectible", "refunded"]
966
+ if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])
967
+ fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}"
968
+ end
969
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
970
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling InvoicesApi.list_invoices, must be smaller than or equal to 100.'
971
+ end
972
+
973
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
974
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling InvoicesApi.list_invoices, must be greater than or equal to 1.'
975
+ end
976
+
977
+ # resource path
978
+ local_var_path = '/invoices/{org}'.sub('{org}', CGI.escape(org.to_s))
979
+
980
+ # query parameters
981
+ query_params = opts[:query_params] || {}
982
+ query_params[:'product'] = opts[:'product'] if !opts[:'product'].nil?
983
+ query_params[:'reference'] = opts[:'reference'] if !opts[:'reference'].nil?
984
+ query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
985
+ query_params[:'issued_from'] = opts[:'issued_from'] if !opts[:'issued_from'].nil?
986
+ query_params[:'issued_to'] = opts[:'issued_to'] if !opts[:'issued_to'].nil?
987
+ query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
988
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
989
+
990
+ # header parameters
991
+ header_params = opts[:header_params] || {}
992
+ # HTTP header 'Accept' (if needed)
993
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
994
+
995
+ # form parameters
996
+ form_params = opts[:form_params] || {}
997
+
998
+ # http body (model)
999
+ post_body = opts[:debug_body]
1000
+
1001
+ # return_type
1002
+ return_type = opts[:debug_return_type] || 'InvoiceList'
1003
+
1004
+ # auth_names
1005
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
1006
+
1007
+ new_options = opts.merge(
1008
+ :operation => :"InvoicesApi.list_invoices",
1009
+ :header_params => header_params,
1010
+ :query_params => query_params,
1011
+ :form_params => form_params,
1012
+ :body => post_body,
1013
+ :auth_names => auth_names,
1014
+ :return_type => return_type
1015
+ )
1016
+
1017
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
1018
+ if @api_client.config.debugging
1019
+ @api_client.config.logger.debug "API called: InvoicesApi#list_invoices\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1020
+ end
1021
+ return data, status_code, headers
1022
+ end
1023
+
1024
+ # The organization's one-off purchases
1025
+ # The one-off products the organization bought through a checkout, newest first (up to 100), each with the invoice that carries it. A product-scoped token reads only purchases of its own product.
1026
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
1027
+ # @param [Hash] opts the optional parameters
1028
+ # @return [ListOrganizationPurchases200Response]
1029
+ def list_organization_purchases(org, opts = {})
1030
+ data, _status_code, _headers = list_organization_purchases_with_http_info(org, opts)
1031
+ data
1032
+ end
1033
+
1034
+ # The organization&#39;s one-off purchases
1035
+ # The one-off products the organization bought through a checkout, newest first (up to 100), each with the invoice that carries it. A product-scoped token reads only purchases of its own product.
1036
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
1037
+ # @param [Hash] opts the optional parameters
1038
+ # @return [Array<(ListOrganizationPurchases200Response, Integer, Hash)>] ListOrganizationPurchases200Response data, response status code and response headers
1039
+ def list_organization_purchases_with_http_info(org, opts = {})
1040
+ if @api_client.config.debugging
1041
+ @api_client.config.logger.debug 'Calling API: InvoicesApi.list_organization_purchases ...'
1042
+ end
1043
+ # verify the required parameter 'org' is set
1044
+ if @api_client.config.client_side_validation && org.nil?
1045
+ fail ArgumentError, "Missing the required parameter 'org' when calling InvoicesApi.list_organization_purchases"
1046
+ end
1047
+ # resource path
1048
+ local_var_path = '/organizations/{org}/purchases'.sub('{org}', CGI.escape(org.to_s))
1049
+
1050
+ # query parameters
1051
+ query_params = opts[:query_params] || {}
1052
+
1053
+ # header parameters
1054
+ header_params = opts[:header_params] || {}
1055
+ # HTTP header 'Accept' (if needed)
1056
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
1057
+
1058
+ # form parameters
1059
+ form_params = opts[:form_params] || {}
1060
+
1061
+ # http body (model)
1062
+ post_body = opts[:debug_body]
1063
+
1064
+ # return_type
1065
+ return_type = opts[:debug_return_type] || 'ListOrganizationPurchases200Response'
1066
+
1067
+ # auth_names
1068
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
1069
+
1070
+ new_options = opts.merge(
1071
+ :operation => :"InvoicesApi.list_organization_purchases",
1072
+ :header_params => header_params,
1073
+ :query_params => query_params,
1074
+ :form_params => form_params,
1075
+ :body => post_body,
1076
+ :auth_names => auth_names,
1077
+ :return_type => return_type
1078
+ )
1079
+
1080
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
1081
+ if @api_client.config.debugging
1082
+ @api_client.config.logger.debug "API called: InvoicesApi#list_organization_purchases\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1083
+ end
1084
+ return data, status_code, headers
1085
+ end
1086
+
1087
+ # Record money received against an open invoice (operator)
1088
+ # Several payments are allowed and none may pass what remains. The one that clears the invoice closes it. Honours `Idempotency-Key` (at most 100 characters, per token): a retry records once.
1089
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
1090
+ # @param number [String] The invoice number.
1091
+ # @param record_invoice_payment_request [RecordInvoicePaymentRequest]
1092
+ # @param [Hash] opts the optional parameters
1093
+ # @option opts [String] :idempotency_key An opaque, caller-generated key giving this write exactly-once semantics. A retry with the same key replays the first response instead of re-running the effect; reusing it with a different body is &#x60;409&#x60;.
1094
+ # @return [InvoicePaymentResult]
1095
+ def record_invoice_payment(org, number, record_invoice_payment_request, opts = {})
1096
+ data, _status_code, _headers = record_invoice_payment_with_http_info(org, number, record_invoice_payment_request, opts)
1097
+ data
1098
+ end
1099
+
1100
+ # Record money received against an open invoice (operator)
1101
+ # Several payments are allowed and none may pass what remains. The one that clears the invoice closes it. Honours &#x60;Idempotency-Key&#x60; (at most 100 characters, per token): a retry records once.
1102
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
1103
+ # @param number [String] The invoice number.
1104
+ # @param record_invoice_payment_request [RecordInvoicePaymentRequest]
1105
+ # @param [Hash] opts the optional parameters
1106
+ # @option opts [String] :idempotency_key An opaque, caller-generated key giving this write exactly-once semantics. A retry with the same key replays the first response instead of re-running the effect; reusing it with a different body is &#x60;409&#x60;.
1107
+ # @return [Array<(InvoicePaymentResult, Integer, Hash)>] InvoicePaymentResult data, response status code and response headers
1108
+ def record_invoice_payment_with_http_info(org, number, record_invoice_payment_request, opts = {})
1109
+ if @api_client.config.debugging
1110
+ @api_client.config.logger.debug 'Calling API: InvoicesApi.record_invoice_payment ...'
1111
+ end
1112
+ # verify the required parameter 'org' is set
1113
+ if @api_client.config.client_side_validation && org.nil?
1114
+ fail ArgumentError, "Missing the required parameter 'org' when calling InvoicesApi.record_invoice_payment"
1115
+ end
1116
+ # verify the required parameter 'number' is set
1117
+ if @api_client.config.client_side_validation && number.nil?
1118
+ fail ArgumentError, "Missing the required parameter 'number' when calling InvoicesApi.record_invoice_payment"
1119
+ end
1120
+ # verify the required parameter 'record_invoice_payment_request' is set
1121
+ if @api_client.config.client_side_validation && record_invoice_payment_request.nil?
1122
+ fail ArgumentError, "Missing the required parameter 'record_invoice_payment_request' when calling InvoicesApi.record_invoice_payment"
1123
+ end
1124
+ # resource path
1125
+ local_var_path = '/invoices/{org}/{number}/payments'.sub('{org}', CGI.escape(org.to_s)).sub('{number}', CGI.escape(number.to_s))
1126
+
1127
+ # query parameters
1128
+ query_params = opts[:query_params] || {}
1129
+
1130
+ # header parameters
1131
+ header_params = opts[:header_params] || {}
1132
+ # HTTP header 'Accept' (if needed)
1133
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
1134
+ # HTTP header 'Content-Type'
1135
+ content_type = @api_client.select_header_content_type(['application/json'])
1136
+ if !content_type.nil?
1137
+ header_params['Content-Type'] = content_type
1138
+ end
1139
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
1140
+
1141
+ # form parameters
1142
+ form_params = opts[:form_params] || {}
1143
+
1144
+ # http body (model)
1145
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(record_invoice_payment_request)
1146
+
1147
+ # return_type
1148
+ return_type = opts[:debug_return_type] || 'InvoicePaymentResult'
1149
+
1150
+ # auth_names
1151
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
1152
+
1153
+ new_options = opts.merge(
1154
+ :operation => :"InvoicesApi.record_invoice_payment",
1155
+ :header_params => header_params,
1156
+ :query_params => query_params,
1157
+ :form_params => form_params,
1158
+ :body => post_body,
1159
+ :auth_names => auth_names,
1160
+ :return_type => return_type
1161
+ )
1162
+
1163
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
1164
+ if @api_client.config.debugging
1165
+ @api_client.config.logger.debug "API called: InvoicesApi#record_invoice_payment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1166
+ end
1167
+ return data, status_code, headers
1168
+ end
1169
+
1170
+ # Refund a paid invoice, in full or in part
1171
+ # Refunds a paid invoice exactly as the console's refund form does, through the same approval policy. The invoice itself is never edited. The refund is issued as a credit note and the money goes back through the payment provider that took it. - Without `amount_minor` the refund is the whole cash share (what account credit paid stays paid). With it, `amount_minor` is the **net** amount to refund, in minor units of the invoice's currency. Tax is worked out on top, as on the credit note. - When the environment's approval policy for `invoice.refund` covers the amount, the refund is **held** for a person to approve in the console: `202 { status: pending_approval, approval }`. Nothing is refunded and no credit note is issued until then. The request is recorded with this token as its maker, and a token can never approve one. - Otherwise it runs now: `201 { status: refunded, refund, credit_note }`. Refusals: an invoice that is not paid is `409 invoice_refused`. More than is left to refund, or a refund the payment provider declined, is `409 refund_refused`, and nothing is refunded. Needs an operator token with the `invoices:refund` scope (`invoices:write` is not enough, as in the console). `Idempotency-Key` is **required**. A retry with the same key replays the first answer and never refunds twice. The same key from another token is its own refund.
1172
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
1173
+ # @param number [String] The invoice number.
1174
+ # @param idempotency_key [String] An opaque, caller-generated key (at most 100 characters). Required: a missing key is &#x60;400 idempotency_key_required&#x60;. A retry with the same key replays the first response; reusing it with a different body is &#x60;409&#x60;.
1175
+ # @param refund_request [RefundRequest]
1176
+ # @param [Hash] opts the optional parameters
1177
+ # @return [RefundResult]
1178
+ def refund_invoice(org, number, idempotency_key, refund_request, opts = {})
1179
+ data, _status_code, _headers = refund_invoice_with_http_info(org, number, idempotency_key, refund_request, opts)
1180
+ data
1181
+ end
1182
+
1183
+ # Refund a paid invoice, in full or in part
1184
+ # Refunds a paid invoice exactly as the console&#39;s refund form does, through the same approval policy. The invoice itself is never edited. The refund is issued as a credit note and the money goes back through the payment provider that took it. - Without &#x60;amount_minor&#x60; the refund is the whole cash share (what account credit paid stays paid). With it, &#x60;amount_minor&#x60; is the **net** amount to refund, in minor units of the invoice&#39;s currency. Tax is worked out on top, as on the credit note. - When the environment&#39;s approval policy for &#x60;invoice.refund&#x60; covers the amount, the refund is **held** for a person to approve in the console: &#x60;202 { status: pending_approval, approval }&#x60;. Nothing is refunded and no credit note is issued until then. The request is recorded with this token as its maker, and a token can never approve one. - Otherwise it runs now: &#x60;201 { status: refunded, refund, credit_note }&#x60;. Refusals: an invoice that is not paid is &#x60;409 invoice_refused&#x60;. More than is left to refund, or a refund the payment provider declined, is &#x60;409 refund_refused&#x60;, and nothing is refunded. Needs an operator token with the &#x60;invoices:refund&#x60; scope (&#x60;invoices:write&#x60; is not enough, as in the console). &#x60;Idempotency-Key&#x60; is **required**. A retry with the same key replays the first answer and never refunds twice. The same key from another token is its own refund.
1185
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
1186
+ # @param number [String] The invoice number.
1187
+ # @param idempotency_key [String] An opaque, caller-generated key (at most 100 characters). Required: a missing key is &#x60;400 idempotency_key_required&#x60;. A retry with the same key replays the first response; reusing it with a different body is &#x60;409&#x60;.
1188
+ # @param refund_request [RefundRequest]
1189
+ # @param [Hash] opts the optional parameters
1190
+ # @return [Array<(RefundResult, Integer, Hash)>] RefundResult data, response status code and response headers
1191
+ def refund_invoice_with_http_info(org, number, idempotency_key, refund_request, opts = {})
1192
+ if @api_client.config.debugging
1193
+ @api_client.config.logger.debug 'Calling API: InvoicesApi.refund_invoice ...'
1194
+ end
1195
+ # verify the required parameter 'org' is set
1196
+ if @api_client.config.client_side_validation && org.nil?
1197
+ fail ArgumentError, "Missing the required parameter 'org' when calling InvoicesApi.refund_invoice"
1198
+ end
1199
+ # verify the required parameter 'number' is set
1200
+ if @api_client.config.client_side_validation && number.nil?
1201
+ fail ArgumentError, "Missing the required parameter 'number' when calling InvoicesApi.refund_invoice"
1202
+ end
1203
+ pattern = Regexp.new(/^[A-Za-z0-9._-]+$/)
1204
+ if @api_client.config.client_side_validation && number !~ pattern
1205
+ fail ArgumentError, "invalid value for 'number' when calling InvoicesApi.refund_invoice, must conform to the pattern #{pattern}."
1206
+ end
1207
+
1208
+ # verify the required parameter 'idempotency_key' is set
1209
+ if @api_client.config.client_side_validation && idempotency_key.nil?
1210
+ fail ArgumentError, "Missing the required parameter 'idempotency_key' when calling InvoicesApi.refund_invoice"
1211
+ end
1212
+ if @api_client.config.client_side_validation && idempotency_key.to_s.length > 100
1213
+ fail ArgumentError, 'invalid value for "idempotency_key" when calling InvoicesApi.refund_invoice, the character length must be smaller than or equal to 100.'
1214
+ end
1215
+
1216
+ # verify the required parameter 'refund_request' is set
1217
+ if @api_client.config.client_side_validation && refund_request.nil?
1218
+ fail ArgumentError, "Missing the required parameter 'refund_request' when calling InvoicesApi.refund_invoice"
1219
+ end
1220
+ # resource path
1221
+ local_var_path = '/invoices/{org}/{number}/refunds'.sub('{org}', CGI.escape(org.to_s)).sub('{number}', CGI.escape(number.to_s))
1222
+
1223
+ # query parameters
1224
+ query_params = opts[:query_params] || {}
1225
+
1226
+ # header parameters
1227
+ header_params = opts[:header_params] || {}
1228
+ # HTTP header 'Accept' (if needed)
1229
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
1230
+ # HTTP header 'Content-Type'
1231
+ content_type = @api_client.select_header_content_type(['application/json'])
1232
+ if !content_type.nil?
1233
+ header_params['Content-Type'] = content_type
1234
+ end
1235
+ header_params[:'Idempotency-Key'] = idempotency_key
1236
+
1237
+ # form parameters
1238
+ form_params = opts[:form_params] || {}
1239
+
1240
+ # http body (model)
1241
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(refund_request)
1242
+
1243
+ # return_type
1244
+ return_type = opts[:debug_return_type] || 'RefundResult'
1245
+
1246
+ # auth_names
1247
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
1248
+
1249
+ new_options = opts.merge(
1250
+ :operation => :"InvoicesApi.refund_invoice",
1251
+ :header_params => header_params,
1252
+ :query_params => query_params,
1253
+ :form_params => form_params,
1254
+ :body => post_body,
1255
+ :auth_names => auth_names,
1256
+ :return_type => return_type
1257
+ )
1258
+
1259
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
1260
+ if @api_client.config.debugging
1261
+ @api_client.config.logger.debug "API called: InvoicesApi#refund_invoice\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1262
+ end
1263
+ return data, status_code, headers
1264
+ end
1265
+
1266
+ # Reverse a payment recorded by mistake (operator)
1267
+ # The record stays, the ledger gets the opposite posting, and an invoice the payment had closed reopens. Refused once a credit note stands on the invoice.
1268
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
1269
+ # @param number [String] The invoice number.
1270
+ # @param payment [String] The payment&#39;s public id (&#x60;pay_…&#x60;).
1271
+ # @param reverse_invoice_payment_request [ReverseInvoicePaymentRequest]
1272
+ # @param [Hash] opts the optional parameters
1273
+ # @option opts [String] :idempotency_key An opaque, caller-generated key giving this write exactly-once semantics. A retry with the same key replays the first response instead of re-running the effect; reusing it with a different body is &#x60;409&#x60;.
1274
+ # @return [InvoicePaymentResult]
1275
+ def reverse_invoice_payment(org, number, payment, reverse_invoice_payment_request, opts = {})
1276
+ data, _status_code, _headers = reverse_invoice_payment_with_http_info(org, number, payment, reverse_invoice_payment_request, opts)
1277
+ data
1278
+ end
1279
+
1280
+ # Reverse a payment recorded by mistake (operator)
1281
+ # The record stays, the ledger gets the opposite posting, and an invoice the payment had closed reopens. Refused once a credit note stands on the invoice.
1282
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
1283
+ # @param number [String] The invoice number.
1284
+ # @param payment [String] The payment&#39;s public id (&#x60;pay_…&#x60;).
1285
+ # @param reverse_invoice_payment_request [ReverseInvoicePaymentRequest]
1286
+ # @param [Hash] opts the optional parameters
1287
+ # @option opts [String] :idempotency_key An opaque, caller-generated key giving this write exactly-once semantics. A retry with the same key replays the first response instead of re-running the effect; reusing it with a different body is &#x60;409&#x60;.
1288
+ # @return [Array<(InvoicePaymentResult, Integer, Hash)>] InvoicePaymentResult data, response status code and response headers
1289
+ def reverse_invoice_payment_with_http_info(org, number, payment, reverse_invoice_payment_request, opts = {})
1290
+ if @api_client.config.debugging
1291
+ @api_client.config.logger.debug 'Calling API: InvoicesApi.reverse_invoice_payment ...'
1292
+ end
1293
+ # verify the required parameter 'org' is set
1294
+ if @api_client.config.client_side_validation && org.nil?
1295
+ fail ArgumentError, "Missing the required parameter 'org' when calling InvoicesApi.reverse_invoice_payment"
1296
+ end
1297
+ # verify the required parameter 'number' is set
1298
+ if @api_client.config.client_side_validation && number.nil?
1299
+ fail ArgumentError, "Missing the required parameter 'number' when calling InvoicesApi.reverse_invoice_payment"
1300
+ end
1301
+ # verify the required parameter 'payment' is set
1302
+ if @api_client.config.client_side_validation && payment.nil?
1303
+ fail ArgumentError, "Missing the required parameter 'payment' when calling InvoicesApi.reverse_invoice_payment"
1304
+ end
1305
+ # verify the required parameter 'reverse_invoice_payment_request' is set
1306
+ if @api_client.config.client_side_validation && reverse_invoice_payment_request.nil?
1307
+ fail ArgumentError, "Missing the required parameter 'reverse_invoice_payment_request' when calling InvoicesApi.reverse_invoice_payment"
1308
+ end
1309
+ # resource path
1310
+ local_var_path = '/invoices/{org}/{number}/payments/{payment}/reverse'.sub('{org}', CGI.escape(org.to_s)).sub('{number}', CGI.escape(number.to_s)).sub('{payment}', CGI.escape(payment.to_s))
1311
+
1312
+ # query parameters
1313
+ query_params = opts[:query_params] || {}
1314
+
1315
+ # header parameters
1316
+ header_params = opts[:header_params] || {}
1317
+ # HTTP header 'Accept' (if needed)
1318
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
1319
+ # HTTP header 'Content-Type'
1320
+ content_type = @api_client.select_header_content_type(['application/json'])
1321
+ if !content_type.nil?
1322
+ header_params['Content-Type'] = content_type
1323
+ end
1324
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
1325
+
1326
+ # form parameters
1327
+ form_params = opts[:form_params] || {}
1328
+
1329
+ # http body (model)
1330
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(reverse_invoice_payment_request)
1331
+
1332
+ # return_type
1333
+ return_type = opts[:debug_return_type] || 'InvoicePaymentResult'
1334
+
1335
+ # auth_names
1336
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
1337
+
1338
+ new_options = opts.merge(
1339
+ :operation => :"InvoicesApi.reverse_invoice_payment",
1340
+ :header_params => header_params,
1341
+ :query_params => query_params,
1342
+ :form_params => form_params,
1343
+ :body => post_body,
1344
+ :auth_names => auth_names,
1345
+ :return_type => return_type
1346
+ )
1347
+
1348
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
1349
+ if @api_client.config.debugging
1350
+ @api_client.config.logger.debug "API called: InvoicesApi#reverse_invoice_payment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1351
+ end
1352
+ return data, status_code, headers
1353
+ end
1354
+
1355
+ # One invoice per period for this customer
1356
+ # On, subscriptions of this customer on the same product that share a period also share one invoice: one number, one tax calculation, one charge. A subscription on another period keeps its own. Off by default, and issued invoices are not touched. A new customer starts with the environment's default (`GET /billing-policy`); the response says who set it. Turning it on where the environment does not offer it is a 409. Subscriptions only share an invoice when they renew on the same day: `renewal_dates_aligned` says whether they do, and `/organizations/{org}/align-renewals` aligns them. Takes an operator token.
1357
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
1358
+ # @param set_invoice_consolidation_request [SetInvoiceConsolidationRequest]
1359
+ # @param [Hash] opts the optional parameters
1360
+ # @return [Object]
1361
+ def set_invoice_consolidation(org, set_invoice_consolidation_request, opts = {})
1362
+ data, _status_code, _headers = set_invoice_consolidation_with_http_info(org, set_invoice_consolidation_request, opts)
1363
+ data
1364
+ end
1365
+
1366
+ # One invoice per period for this customer
1367
+ # On, subscriptions of this customer on the same product that share a period also share one invoice: one number, one tax calculation, one charge. A subscription on another period keeps its own. Off by default, and issued invoices are not touched. A new customer starts with the environment&#39;s default (&#x60;GET /billing-policy&#x60;); the response says who set it. Turning it on where the environment does not offer it is a 409. Subscriptions only share an invoice when they renew on the same day: &#x60;renewal_dates_aligned&#x60; says whether they do, and &#x60;/organizations/{org}/align-renewals&#x60; aligns them. Takes an operator token.
1368
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
1369
+ # @param set_invoice_consolidation_request [SetInvoiceConsolidationRequest]
1370
+ # @param [Hash] opts the optional parameters
1371
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
1372
+ def set_invoice_consolidation_with_http_info(org, set_invoice_consolidation_request, opts = {})
1373
+ if @api_client.config.debugging
1374
+ @api_client.config.logger.debug 'Calling API: InvoicesApi.set_invoice_consolidation ...'
1375
+ end
1376
+ # verify the required parameter 'org' is set
1377
+ if @api_client.config.client_side_validation && org.nil?
1378
+ fail ArgumentError, "Missing the required parameter 'org' when calling InvoicesApi.set_invoice_consolidation"
1379
+ end
1380
+ # verify the required parameter 'set_invoice_consolidation_request' is set
1381
+ if @api_client.config.client_side_validation && set_invoice_consolidation_request.nil?
1382
+ fail ArgumentError, "Missing the required parameter 'set_invoice_consolidation_request' when calling InvoicesApi.set_invoice_consolidation"
1383
+ end
1384
+ # resource path
1385
+ local_var_path = '/organizations/{org}/invoice-consolidation'.sub('{org}', CGI.escape(org.to_s))
1386
+
1387
+ # query parameters
1388
+ query_params = opts[:query_params] || {}
1389
+
1390
+ # header parameters
1391
+ header_params = opts[:header_params] || {}
1392
+ # HTTP header 'Accept' (if needed)
1393
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
1394
+ # HTTP header 'Content-Type'
1395
+ content_type = @api_client.select_header_content_type(['application/json'])
1396
+ if !content_type.nil?
1397
+ header_params['Content-Type'] = content_type
1398
+ end
1399
+
1400
+ # form parameters
1401
+ form_params = opts[:form_params] || {}
1402
+
1403
+ # http body (model)
1404
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(set_invoice_consolidation_request)
1405
+
1406
+ # return_type
1407
+ return_type = opts[:debug_return_type] || 'Object'
1408
+
1409
+ # auth_names
1410
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
1411
+
1412
+ new_options = opts.merge(
1413
+ :operation => :"InvoicesApi.set_invoice_consolidation",
1414
+ :header_params => header_params,
1415
+ :query_params => query_params,
1416
+ :form_params => form_params,
1417
+ :body => post_body,
1418
+ :auth_names => auth_names,
1419
+ :return_type => return_type
1420
+ )
1421
+
1422
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
1423
+ if @api_client.config.debugging
1424
+ @api_client.config.logger.debug "API called: InvoicesApi#set_invoice_consolidation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1425
+ end
1426
+ return data, status_code, headers
1427
+ end
1428
+
1429
+ # Set an organization's collection method and net days (operator)
1430
+ # Applies to invoices issued from now on; an issued invoice keeps what it was stamped with. `null` follows the environment again. An invoice on `invoice` is paid by bank transfer and never reaches the gateway. Takes an operator token.
1431
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
1432
+ # @param payment_terms_request [PaymentTermsRequest]
1433
+ # @param [Hash] opts the optional parameters
1434
+ # @option opts [String] :idempotency_key An opaque, caller-generated key giving this write exactly-once semantics. A retry with the same key replays the first response instead of re-running the effect; reusing it with a different body is &#x60;409&#x60;.
1435
+ # @return [PaymentTerms]
1436
+ def set_payment_terms(org, payment_terms_request, opts = {})
1437
+ data, _status_code, _headers = set_payment_terms_with_http_info(org, payment_terms_request, opts)
1438
+ data
1439
+ end
1440
+
1441
+ # Set an organization&#39;s collection method and net days (operator)
1442
+ # Applies to invoices issued from now on; an issued invoice keeps what it was stamped with. &#x60;null&#x60; follows the environment again. An invoice on &#x60;invoice&#x60; is paid by bank transfer and never reaches the gateway. Takes an operator token.
1443
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
1444
+ # @param payment_terms_request [PaymentTermsRequest]
1445
+ # @param [Hash] opts the optional parameters
1446
+ # @option opts [String] :idempotency_key An opaque, caller-generated key giving this write exactly-once semantics. A retry with the same key replays the first response instead of re-running the effect; reusing it with a different body is &#x60;409&#x60;.
1447
+ # @return [Array<(PaymentTerms, Integer, Hash)>] PaymentTerms data, response status code and response headers
1448
+ def set_payment_terms_with_http_info(org, payment_terms_request, opts = {})
1449
+ if @api_client.config.debugging
1450
+ @api_client.config.logger.debug 'Calling API: InvoicesApi.set_payment_terms ...'
1451
+ end
1452
+ # verify the required parameter 'org' is set
1453
+ if @api_client.config.client_side_validation && org.nil?
1454
+ fail ArgumentError, "Missing the required parameter 'org' when calling InvoicesApi.set_payment_terms"
1455
+ end
1456
+ # verify the required parameter 'payment_terms_request' is set
1457
+ if @api_client.config.client_side_validation && payment_terms_request.nil?
1458
+ fail ArgumentError, "Missing the required parameter 'payment_terms_request' when calling InvoicesApi.set_payment_terms"
1459
+ end
1460
+ # resource path
1461
+ local_var_path = '/organizations/{org}/payment-terms'.sub('{org}', CGI.escape(org.to_s))
1462
+
1463
+ # query parameters
1464
+ query_params = opts[:query_params] || {}
1465
+
1466
+ # header parameters
1467
+ header_params = opts[:header_params] || {}
1468
+ # HTTP header 'Accept' (if needed)
1469
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
1470
+ # HTTP header 'Content-Type'
1471
+ content_type = @api_client.select_header_content_type(['application/json'])
1472
+ if !content_type.nil?
1473
+ header_params['Content-Type'] = content_type
1474
+ end
1475
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
1476
+
1477
+ # form parameters
1478
+ form_params = opts[:form_params] || {}
1479
+
1480
+ # http body (model)
1481
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(payment_terms_request)
1482
+
1483
+ # return_type
1484
+ return_type = opts[:debug_return_type] || 'PaymentTerms'
1485
+
1486
+ # auth_names
1487
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
1488
+
1489
+ new_options = opts.merge(
1490
+ :operation => :"InvoicesApi.set_payment_terms",
1491
+ :header_params => header_params,
1492
+ :query_params => query_params,
1493
+ :form_params => form_params,
1494
+ :body => post_body,
1495
+ :auth_names => auth_names,
1496
+ :return_type => return_type
1497
+ )
1498
+
1499
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
1500
+ if @api_client.config.debugging
1501
+ @api_client.config.logger.debug "API called: InvoicesApi#set_payment_terms\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1502
+ end
1503
+ return data, status_code, headers
1504
+ end
1505
+
1506
+ # Replace a draft's lines
1507
+ # The lines are taxed again through Cbox Tax. 409 with `error` one of `not_a_draft`, `no_lines`, `below_zero`. 422 when the customer cannot be taxed yet, the same answer as a subscribe.
1508
+ # @param id [String] The draft&#39;s public id (&#x60;inv_…&#x60;) or its &#x60;draft_…&#x60; number.
1509
+ # @param update_invoice_draft_request [UpdateInvoiceDraftRequest]
1510
+ # @param [Hash] opts the optional parameters
1511
+ # @return [InvoiceDraft]
1512
+ def update_invoice_draft(id, update_invoice_draft_request, opts = {})
1513
+ data, _status_code, _headers = update_invoice_draft_with_http_info(id, update_invoice_draft_request, opts)
1514
+ data
1515
+ end
1516
+
1517
+ # Replace a draft&#39;s lines
1518
+ # The lines are taxed again through Cbox Tax. 409 with &#x60;error&#x60; one of &#x60;not_a_draft&#x60;, &#x60;no_lines&#x60;, &#x60;below_zero&#x60;. 422 when the customer cannot be taxed yet, the same answer as a subscribe.
1519
+ # @param id [String] The draft&#39;s public id (&#x60;inv_…&#x60;) or its &#x60;draft_…&#x60; number.
1520
+ # @param update_invoice_draft_request [UpdateInvoiceDraftRequest]
1521
+ # @param [Hash] opts the optional parameters
1522
+ # @return [Array<(InvoiceDraft, Integer, Hash)>] InvoiceDraft data, response status code and response headers
1523
+ def update_invoice_draft_with_http_info(id, update_invoice_draft_request, opts = {})
1524
+ if @api_client.config.debugging
1525
+ @api_client.config.logger.debug 'Calling API: InvoicesApi.update_invoice_draft ...'
1526
+ end
1527
+ # verify the required parameter 'id' is set
1528
+ if @api_client.config.client_side_validation && id.nil?
1529
+ fail ArgumentError, "Missing the required parameter 'id' when calling InvoicesApi.update_invoice_draft"
1530
+ end
1531
+ pattern = Regexp.new(/^(draft_[0-9A-Za-z]+|inv_[0-9A-Za-z]+)$/)
1532
+ if @api_client.config.client_side_validation && id !~ pattern
1533
+ fail ArgumentError, "invalid value for 'id' when calling InvoicesApi.update_invoice_draft, must conform to the pattern #{pattern}."
1534
+ end
1535
+
1536
+ # verify the required parameter 'update_invoice_draft_request' is set
1537
+ if @api_client.config.client_side_validation && update_invoice_draft_request.nil?
1538
+ fail ArgumentError, "Missing the required parameter 'update_invoice_draft_request' when calling InvoicesApi.update_invoice_draft"
1539
+ end
1540
+ # resource path
1541
+ local_var_path = '/invoice-drafts/{id}'.sub('{id}', CGI.escape(id.to_s))
1542
+
1543
+ # query parameters
1544
+ query_params = opts[:query_params] || {}
1545
+
1546
+ # header parameters
1547
+ header_params = opts[:header_params] || {}
1548
+ # HTTP header 'Accept' (if needed)
1549
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
1550
+ # HTTP header 'Content-Type'
1551
+ content_type = @api_client.select_header_content_type(['application/json'])
1552
+ if !content_type.nil?
1553
+ header_params['Content-Type'] = content_type
1554
+ end
1555
+
1556
+ # form parameters
1557
+ form_params = opts[:form_params] || {}
1558
+
1559
+ # http body (model)
1560
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(update_invoice_draft_request)
1561
+
1562
+ # return_type
1563
+ return_type = opts[:debug_return_type] || 'InvoiceDraft'
1564
+
1565
+ # auth_names
1566
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
1567
+
1568
+ new_options = opts.merge(
1569
+ :operation => :"InvoicesApi.update_invoice_draft",
1570
+ :header_params => header_params,
1571
+ :query_params => query_params,
1572
+ :form_params => form_params,
1573
+ :body => post_body,
1574
+ :auth_names => auth_names,
1575
+ :return_type => return_type
1576
+ )
1577
+
1578
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
1579
+ if @api_client.config.debugging
1580
+ @api_client.config.logger.debug "API called: InvoicesApi#update_invoice_draft\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1581
+ end
1582
+ return data, status_code, headers
1583
+ end
1584
+
1585
+ # Void an open invoice
1586
+ # Voids the invoice exactly as the console's Void does. An issued invoice is never edited: it is reversed by a full credit note (see `GET /organizations/{org}/credit-notes`), any account credit it drew goes back to the balance, and its dunning stops. Only an open or uncollectible invoice with nothing paid on it can be voided. A paid one is refunded instead (`POST /invoices/{org}/{number}/refunds`). Anything else is `409 { error: invoice_refused, message }`. Needs an operator token with `invoices:write`. Send an `Idempotency-Key` so a retry replays the first answer instead of meeting `409 invoice_refused` (already void).
1587
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
1588
+ # @param number [String] The invoice number.
1589
+ # @param [Hash] opts the optional parameters
1590
+ # @option opts [String] :idempotency_key An opaque, caller-generated key giving this write exactly-once semantics. A retry with the same key replays the first response instead of re-running the effect; reusing it with a different body is &#x60;409&#x60;.
1591
+ # @return [InvoiceDetail]
1592
+ def void_invoice(org, number, opts = {})
1593
+ data, _status_code, _headers = void_invoice_with_http_info(org, number, opts)
1594
+ data
1595
+ end
1596
+
1597
+ # Void an open invoice
1598
+ # Voids the invoice exactly as the console&#39;s Void does. An issued invoice is never edited: it is reversed by a full credit note (see &#x60;GET /organizations/{org}/credit-notes&#x60;), any account credit it drew goes back to the balance, and its dunning stops. Only an open or uncollectible invoice with nothing paid on it can be voided. A paid one is refunded instead (&#x60;POST /invoices/{org}/{number}/refunds&#x60;). Anything else is &#x60;409 { error: invoice_refused, message }&#x60;. Needs an operator token with &#x60;invoices:write&#x60;. Send an &#x60;Idempotency-Key&#x60; so a retry replays the first answer instead of meeting &#x60;409 invoice_refused&#x60; (already void).
1599
+ # @param org [String] The organization id (the merchant platform&#39;s own tenant key).
1600
+ # @param number [String] The invoice number.
1601
+ # @param [Hash] opts the optional parameters
1602
+ # @option opts [String] :idempotency_key An opaque, caller-generated key giving this write exactly-once semantics. A retry with the same key replays the first response instead of re-running the effect; reusing it with a different body is &#x60;409&#x60;.
1603
+ # @return [Array<(InvoiceDetail, Integer, Hash)>] InvoiceDetail data, response status code and response headers
1604
+ def void_invoice_with_http_info(org, number, opts = {})
1605
+ if @api_client.config.debugging
1606
+ @api_client.config.logger.debug 'Calling API: InvoicesApi.void_invoice ...'
1607
+ end
1608
+ # verify the required parameter 'org' is set
1609
+ if @api_client.config.client_side_validation && org.nil?
1610
+ fail ArgumentError, "Missing the required parameter 'org' when calling InvoicesApi.void_invoice"
1611
+ end
1612
+ # verify the required parameter 'number' is set
1613
+ if @api_client.config.client_side_validation && number.nil?
1614
+ fail ArgumentError, "Missing the required parameter 'number' when calling InvoicesApi.void_invoice"
1615
+ end
1616
+ pattern = Regexp.new(/^[A-Za-z0-9._-]+$/)
1617
+ if @api_client.config.client_side_validation && number !~ pattern
1618
+ fail ArgumentError, "invalid value for 'number' when calling InvoicesApi.void_invoice, must conform to the pattern #{pattern}."
1619
+ end
1620
+
1621
+ # resource path
1622
+ local_var_path = '/invoices/{org}/{number}/void'.sub('{org}', CGI.escape(org.to_s)).sub('{number}', CGI.escape(number.to_s))
1623
+
1624
+ # query parameters
1625
+ query_params = opts[:query_params] || {}
1626
+
1627
+ # header parameters
1628
+ header_params = opts[:header_params] || {}
1629
+ # HTTP header 'Accept' (if needed)
1630
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
1631
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
1632
+
1633
+ # form parameters
1634
+ form_params = opts[:form_params] || {}
1635
+
1636
+ # http body (model)
1637
+ post_body = opts[:debug_body]
1638
+
1639
+ # return_type
1640
+ return_type = opts[:debug_return_type] || 'InvoiceDetail'
1641
+
1642
+ # auth_names
1643
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
1644
+
1645
+ new_options = opts.merge(
1646
+ :operation => :"InvoicesApi.void_invoice",
1647
+ :header_params => header_params,
1648
+ :query_params => query_params,
1649
+ :form_params => form_params,
1650
+ :body => post_body,
1651
+ :auth_names => auth_names,
1652
+ :return_type => return_type
1653
+ )
1654
+
1655
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
1656
+ if @api_client.config.debugging
1657
+ @api_client.config.logger.debug "API called: InvoicesApi#void_invoice\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1658
+ end
1659
+ return data, status_code, headers
1660
+ end
1661
+ end
1662
+ end