orb-billing 0.1.0.pre.alpha.33
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.
- checksums.yaml +7 -0
- data/README.md +169 -0
- data/lib/orb/client.rb +129 -0
- data/lib/orb/errors.rb +317 -0
- data/lib/orb/models/alert.rb +225 -0
- data/lib/orb/models/alert_create_for_customer_params.rb +77 -0
- data/lib/orb/models/alert_create_for_external_customer_params.rb +77 -0
- data/lib/orb/models/alert_create_for_subscription_params.rb +74 -0
- data/lib/orb/models/alert_disable_params.rb +26 -0
- data/lib/orb/models/alert_enable_params.rb +26 -0
- data/lib/orb/models/alert_list_params.rb +97 -0
- data/lib/orb/models/alert_retrieve_params.rb +19 -0
- data/lib/orb/models/alert_update_params.rb +46 -0
- data/lib/orb/models/amount_discount.rb +53 -0
- data/lib/orb/models/billable_metric.rb +76 -0
- data/lib/orb/models/billing_cycle_relative_date.rb +18 -0
- data/lib/orb/models/coupon.rb +86 -0
- data/lib/orb/models/coupon_archive_params.rb +19 -0
- data/lib/orb/models/coupon_create_params.rb +102 -0
- data/lib/orb/models/coupon_fetch_params.rb +19 -0
- data/lib/orb/models/coupon_list_params.rb +53 -0
- data/lib/orb/models/coupons/subscription_list_params.rb +40 -0
- data/lib/orb/models/credit_note.rb +522 -0
- data/lib/orb/models/credit_note_create_params.rb +77 -0
- data/lib/orb/models/credit_note_fetch_params.rb +19 -0
- data/lib/orb/models/credit_note_list_params.rb +73 -0
- data/lib/orb/models/customer.rb +872 -0
- data/lib/orb/models/customer_create_params.rb +843 -0
- data/lib/orb/models/customer_delete_params.rb +19 -0
- data/lib/orb/models/customer_fetch_by_external_id_params.rb +19 -0
- data/lib/orb/models/customer_fetch_params.rb +19 -0
- data/lib/orb/models/customer_list_params.rb +73 -0
- data/lib/orb/models/customer_sync_payment_methods_from_gateway_by_external_customer_id_params.rb +19 -0
- data/lib/orb/models/customer_sync_payment_methods_from_gateway_params.rb +19 -0
- data/lib/orb/models/customer_update_by_external_id_params.rb +848 -0
- data/lib/orb/models/customer_update_params.rb +838 -0
- data/lib/orb/models/customers/balance_transaction_create_params.rb +53 -0
- data/lib/orb/models/customers/balance_transaction_create_response.rb +167 -0
- data/lib/orb/models/customers/balance_transaction_list_params.rb +75 -0
- data/lib/orb/models/customers/balance_transaction_list_response.rb +167 -0
- data/lib/orb/models/customers/cost_list_by_external_id_params.rb +69 -0
- data/lib/orb/models/customers/cost_list_by_external_id_response.rb +106 -0
- data/lib/orb/models/customers/cost_list_params.rb +69 -0
- data/lib/orb/models/customers/cost_list_response.rb +106 -0
- data/lib/orb/models/customers/credit_list_by_external_id_params.rb +59 -0
- data/lib/orb/models/customers/credit_list_by_external_id_response.rb +72 -0
- data/lib/orb/models/customers/credit_list_params.rb +59 -0
- data/lib/orb/models/customers/credit_list_response.rb +72 -0
- data/lib/orb/models/customers/credits/ledger_create_entry_by_external_id_params.rb +215 -0
- data/lib/orb/models/customers/credits/ledger_create_entry_by_external_id_response.rb +1311 -0
- data/lib/orb/models/customers/credits/ledger_create_entry_params.rb +214 -0
- data/lib/orb/models/customers/credits/ledger_create_entry_response.rb +1310 -0
- data/lib/orb/models/customers/credits/ledger_list_by_external_id_params.rb +141 -0
- data/lib/orb/models/customers/credits/ledger_list_by_external_id_response.rb +1310 -0
- data/lib/orb/models/customers/credits/ledger_list_params.rb +141 -0
- data/lib/orb/models/customers/credits/ledger_list_response.rb +1306 -0
- data/lib/orb/models/customers/credits/top_up_create_by_external_id_params.rb +159 -0
- data/lib/orb/models/customers/credits/top_up_create_by_external_id_response.rb +154 -0
- data/lib/orb/models/customers/credits/top_up_create_params.rb +158 -0
- data/lib/orb/models/customers/credits/top_up_create_response.rb +153 -0
- data/lib/orb/models/customers/credits/top_up_delete_by_external_id_params.rb +29 -0
- data/lib/orb/models/customers/credits/top_up_delete_params.rb +29 -0
- data/lib/orb/models/customers/credits/top_up_list_by_external_id_params.rb +42 -0
- data/lib/orb/models/customers/credits/top_up_list_by_external_id_response.rb +154 -0
- data/lib/orb/models/customers/credits/top_up_list_params.rb +42 -0
- data/lib/orb/models/customers/credits/top_up_list_response.rb +153 -0
- data/lib/orb/models/dimensional_price_group.rb +64 -0
- data/lib/orb/models/dimensional_price_group_create_params.rb +63 -0
- data/lib/orb/models/dimensional_price_group_list_params.rb +38 -0
- data/lib/orb/models/dimensional_price_group_retrieve_params.rb +19 -0
- data/lib/orb/models/dimensional_price_groups/external_dimensional_price_group_id_retrieve_params.rb +21 -0
- data/lib/orb/models/dimensional_price_groups.rb +25 -0
- data/lib/orb/models/discount.rb +23 -0
- data/lib/orb/models/evaluate_price_group.rb +48 -0
- data/lib/orb/models/event_deprecate_params.rb +19 -0
- data/lib/orb/models/event_deprecate_response.rb +21 -0
- data/lib/orb/models/event_ingest_params.rb +100 -0
- data/lib/orb/models/event_ingest_response.rb +77 -0
- data/lib/orb/models/event_search_params.rb +45 -0
- data/lib/orb/models/event_search_response.rb +87 -0
- data/lib/orb/models/event_update_params.rb +58 -0
- data/lib/orb/models/event_update_response.rb +21 -0
- data/lib/orb/models/events/backfill_close_params.rb +21 -0
- data/lib/orb/models/events/backfill_close_response.rb +131 -0
- data/lib/orb/models/events/backfill_create_params.rb +97 -0
- data/lib/orb/models/events/backfill_create_response.rb +131 -0
- data/lib/orb/models/events/backfill_fetch_params.rb +21 -0
- data/lib/orb/models/events/backfill_fetch_response.rb +131 -0
- data/lib/orb/models/events/backfill_list_params.rb +40 -0
- data/lib/orb/models/events/backfill_list_response.rb +131 -0
- data/lib/orb/models/events/backfill_revert_params.rb +21 -0
- data/lib/orb/models/events/backfill_revert_response.rb +131 -0
- data/lib/orb/models/events/event_volumes.rb +54 -0
- data/lib/orb/models/events/volume_list_params.rb +64 -0
- data/lib/orb/models/invoice.rb +2218 -0
- data/lib/orb/models/invoice_create_params.rb +200 -0
- data/lib/orb/models/invoice_fetch_params.rb +19 -0
- data/lib/orb/models/invoice_fetch_upcoming_params.rb +25 -0
- data/lib/orb/models/invoice_fetch_upcoming_response.rb +2226 -0
- data/lib/orb/models/invoice_issue_params.rb +34 -0
- data/lib/orb/models/invoice_level_discount.rb +21 -0
- data/lib/orb/models/invoice_line_item_create_params.rb +62 -0
- data/lib/orb/models/invoice_line_item_create_response.rb +929 -0
- data/lib/orb/models/invoice_list_params.rb +197 -0
- data/lib/orb/models/invoice_mark_paid_params.rb +40 -0
- data/lib/orb/models/invoice_pay_params.rb +19 -0
- data/lib/orb/models/invoice_update_params.rb +28 -0
- data/lib/orb/models/invoice_void_params.rb +19 -0
- data/lib/orb/models/item.rb +82 -0
- data/lib/orb/models/item_create_params.rb +26 -0
- data/lib/orb/models/item_fetch_params.rb +19 -0
- data/lib/orb/models/item_list_params.rb +38 -0
- data/lib/orb/models/item_update_params.rb +73 -0
- data/lib/orb/models/metric_create_params.rb +56 -0
- data/lib/orb/models/metric_fetch_params.rb +19 -0
- data/lib/orb/models/metric_list_params.rb +73 -0
- data/lib/orb/models/metric_update_params.rb +28 -0
- data/lib/orb/models/pagination_metadata.rb +25 -0
- data/lib/orb/models/percentage_discount.rb +54 -0
- data/lib/orb/models/plan.rb +894 -0
- data/lib/orb/models/plan_create_params.rb +6702 -0
- data/lib/orb/models/plan_fetch_params.rb +19 -0
- data/lib/orb/models/plan_list_params.rb +100 -0
- data/lib/orb/models/plan_update_params.rb +37 -0
- data/lib/orb/models/plans/external_plan_id_fetch_params.rb +21 -0
- data/lib/orb/models/plans/external_plan_id_update_params.rb +39 -0
- data/lib/orb/models/price.rb +12229 -0
- data/lib/orb/models/price_create_params.rb +808 -0
- data/lib/orb/models/price_evaluate_params.rb +80 -0
- data/lib/orb/models/price_evaluate_response.rb +20 -0
- data/lib/orb/models/price_fetch_params.rb +19 -0
- data/lib/orb/models/price_list_params.rb +38 -0
- data/lib/orb/models/price_update_params.rb +28 -0
- data/lib/orb/models/prices/external_price_id_fetch_params.rb +21 -0
- data/lib/orb/models/prices/external_price_id_update_params.rb +30 -0
- data/lib/orb/models/subscription.rb +1233 -0
- data/lib/orb/models/subscription_cancel_params.rb +58 -0
- data/lib/orb/models/subscription_cancel_response.rb +1217 -0
- data/lib/orb/models/subscription_create_params.rb +15065 -0
- data/lib/orb/models/subscription_create_response.rb +1217 -0
- data/lib/orb/models/subscription_fetch_costs_params.rb +67 -0
- data/lib/orb/models/subscription_fetch_costs_response.rb +104 -0
- data/lib/orb/models/subscription_fetch_params.rb +19 -0
- data/lib/orb/models/subscription_fetch_schedule_params.rb +73 -0
- data/lib/orb/models/subscription_fetch_schedule_response.rb +68 -0
- data/lib/orb/models/subscription_fetch_usage_params.rb +135 -0
- data/lib/orb/models/subscription_list_params.rb +108 -0
- data/lib/orb/models/subscription_price_intervals_params.rb +8358 -0
- data/lib/orb/models/subscription_price_intervals_response.rb +1224 -0
- data/lib/orb/models/subscription_schedule_plan_change_params.rb +15088 -0
- data/lib/orb/models/subscription_schedule_plan_change_response.rb +1224 -0
- data/lib/orb/models/subscription_trigger_phase_params.rb +36 -0
- data/lib/orb/models/subscription_trigger_phase_response.rb +1224 -0
- data/lib/orb/models/subscription_unschedule_cancellation_params.rb +19 -0
- data/lib/orb/models/subscription_unschedule_cancellation_response.rb +1224 -0
- data/lib/orb/models/subscription_unschedule_fixed_fee_quantity_updates_params.rb +26 -0
- data/lib/orb/models/subscription_unschedule_fixed_fee_quantity_updates_response.rb +1228 -0
- data/lib/orb/models/subscription_unschedule_pending_plan_changes_params.rb +19 -0
- data/lib/orb/models/subscription_unschedule_pending_plan_changes_response.rb +1224 -0
- data/lib/orb/models/subscription_update_fixed_fee_quantity_params.rb +90 -0
- data/lib/orb/models/subscription_update_fixed_fee_quantity_response.rb +1224 -0
- data/lib/orb/models/subscription_update_params.rb +74 -0
- data/lib/orb/models/subscription_update_trial_params.rb +59 -0
- data/lib/orb/models/subscription_update_trial_response.rb +1222 -0
- data/lib/orb/models/subscription_usage.rb +258 -0
- data/lib/orb/models/subscriptions.rb +25 -0
- data/lib/orb/models/top_level_ping_params.rb +19 -0
- data/lib/orb/models/top_level_ping_response.rb +20 -0
- data/lib/orb/models/trial_discount.rb +69 -0
- data/lib/orb/models/usage_discount.rb +54 -0
- data/lib/orb/page.rb +114 -0
- data/lib/orb/request_options.rb +75 -0
- data/lib/orb/resources/alerts.rb +239 -0
- data/lib/orb/resources/coupons/subscriptions.rb +43 -0
- data/lib/orb/resources/coupons.rb +115 -0
- data/lib/orb/resources/credit_notes.rb +87 -0
- data/lib/orb/resources/customers/balance_transactions.rb +96 -0
- data/lib/orb/resources/customers/costs.rb +298 -0
- data/lib/orb/resources/customers/credits/ledger.rb +527 -0
- data/lib/orb/resources/customers/credits/top_ups.rb +192 -0
- data/lib/orb/resources/customers/credits.rb +88 -0
- data/lib/orb/resources/customers.rb +321 -0
- data/lib/orb/resources/dimensional_price_groups/external_dimensional_price_group_id.rb +38 -0
- data/lib/orb/resources/dimensional_price_groups.rb +93 -0
- data/lib/orb/resources/events/backfills.rb +174 -0
- data/lib/orb/resources/events/volume.rb +52 -0
- data/lib/orb/resources/events.rb +415 -0
- data/lib/orb/resources/invoice_line_items.rb +41 -0
- data/lib/orb/resources/invoices.rb +266 -0
- data/lib/orb/resources/items.rb +95 -0
- data/lib/orb/resources/metrics.rb +114 -0
- data/lib/orb/resources/plans/external_plan_id.rb +76 -0
- data/lib/orb/resources/plans.rb +133 -0
- data/lib/orb/resources/prices/external_price_id.rb +61 -0
- data/lib/orb/resources/prices.rb +197 -0
- data/lib/orb/resources/subscriptions.rb +1278 -0
- data/lib/orb/resources/top_level.rb +37 -0
- data/lib/orb/transport/base_client.rb +459 -0
- data/lib/orb/transport/pooled_net_requester.rb +182 -0
- data/lib/orb/type/array_of.rb +112 -0
- data/lib/orb/type/base_model.rb +367 -0
- data/lib/orb/type/base_page.rb +61 -0
- data/lib/orb/type/boolean_model.rb +52 -0
- data/lib/orb/type/converter.rb +217 -0
- data/lib/orb/type/enum.rb +101 -0
- data/lib/orb/type/hash_of.rb +132 -0
- data/lib/orb/type/request_parameters.rb +38 -0
- data/lib/orb/type/union.rb +225 -0
- data/lib/orb/type/unknown.rb +56 -0
- data/lib/orb/type.rb +23 -0
- data/lib/orb/util.rb +722 -0
- data/lib/orb/version.rb +5 -0
- data/lib/orb.rb +247 -0
- data/manifest.yaml +15 -0
- data/rbi/lib/orb/client.rbi +90 -0
- data/rbi/lib/orb/errors.rbi +246 -0
- data/rbi/lib/orb/models/alert.rbi +239 -0
- data/rbi/lib/orb/models/alert_create_for_customer_params.rbi +86 -0
- data/rbi/lib/orb/models/alert_create_for_external_customer_params.rbi +88 -0
- data/rbi/lib/orb/models/alert_create_for_subscription_params.rbi +83 -0
- data/rbi/lib/orb/models/alert_disable_params.rbi +28 -0
- data/rbi/lib/orb/models/alert_enable_params.rbi +28 -0
- data/rbi/lib/orb/models/alert_list_params.rbi +95 -0
- data/rbi/lib/orb/models/alert_retrieve_params.rbi +20 -0
- data/rbi/lib/orb/models/alert_update_params.rbi +51 -0
- data/rbi/lib/orb/models/amount_discount.rbi +62 -0
- data/rbi/lib/orb/models/billable_metric.rbi +83 -0
- data/rbi/lib/orb/models/billing_cycle_relative_date.rbi +19 -0
- data/rbi/lib/orb/models/coupon.rbi +90 -0
- data/rbi/lib/orb/models/coupon_archive_params.rbi +20 -0
- data/rbi/lib/orb/models/coupon_create_params.rbi +120 -0
- data/rbi/lib/orb/models/coupon_fetch_params.rbi +20 -0
- data/rbi/lib/orb/models/coupon_list_params.rbi +59 -0
- data/rbi/lib/orb/models/coupons/subscription_list_params.rbi +41 -0
- data/rbi/lib/orb/models/credit_note.rbi +546 -0
- data/rbi/lib/orb/models/credit_note_create_params.rbi +84 -0
- data/rbi/lib/orb/models/credit_note_fetch_params.rbi +20 -0
- data/rbi/lib/orb/models/credit_note_list_params.rbi +74 -0
- data/rbi/lib/orb/models/customer.rbi +941 -0
- data/rbi/lib/orb/models/customer_create_params.rbi +923 -0
- data/rbi/lib/orb/models/customer_delete_params.rbi +20 -0
- data/rbi/lib/orb/models/customer_fetch_by_external_id_params.rbi +20 -0
- data/rbi/lib/orb/models/customer_fetch_params.rbi +20 -0
- data/rbi/lib/orb/models/customer_list_params.rbi +74 -0
- data/rbi/lib/orb/models/customer_sync_payment_methods_from_gateway_by_external_customer_id_params.rbi +20 -0
- data/rbi/lib/orb/models/customer_sync_payment_methods_from_gateway_params.rbi +20 -0
- data/rbi/lib/orb/models/customer_update_by_external_id_params.rbi +945 -0
- data/rbi/lib/orb/models/customer_update_params.rbi +919 -0
- data/rbi/lib/orb/models/customers/balance_transaction_create_params.rbi +64 -0
- data/rbi/lib/orb/models/customers/balance_transaction_create_response.rbi +199 -0
- data/rbi/lib/orb/models/customers/balance_transaction_list_params.rbi +76 -0
- data/rbi/lib/orb/models/customers/balance_transaction_list_response.rbi +191 -0
- data/rbi/lib/orb/models/customers/cost_list_by_external_id_params.rbi +86 -0
- data/rbi/lib/orb/models/customers/cost_list_by_external_id_response.rbi +214 -0
- data/rbi/lib/orb/models/customers/cost_list_params.rbi +84 -0
- data/rbi/lib/orb/models/customers/cost_list_response.rbi +212 -0
- data/rbi/lib/orb/models/customers/credit_list_by_external_id_params.rbi +64 -0
- data/rbi/lib/orb/models/customers/credit_list_by_external_id_response.rbi +87 -0
- data/rbi/lib/orb/models/customers/credit_list_params.rbi +64 -0
- data/rbi/lib/orb/models/customers/credit_list_response.rbi +86 -0
- data/rbi/lib/orb/models/customers/credits/ledger_create_entry_by_external_id_params.rbi +270 -0
- data/rbi/lib/orb/models/customers/credits/ledger_create_entry_by_external_id_response.rbi +1670 -0
- data/rbi/lib/orb/models/customers/credits/ledger_create_entry_params.rbi +238 -0
- data/rbi/lib/orb/models/customers/credits/ledger_create_entry_response.rbi +1626 -0
- data/rbi/lib/orb/models/customers/credits/ledger_list_by_external_id_params.rbi +181 -0
- data/rbi/lib/orb/models/customers/credits/ledger_list_by_external_id_response.rbi +1654 -0
- data/rbi/lib/orb/models/customers/credits/ledger_list_params.rbi +144 -0
- data/rbi/lib/orb/models/customers/credits/ledger_list_response.rbi +1588 -0
- data/rbi/lib/orb/models/customers/credits/top_up_create_by_external_id_params.rbi +196 -0
- data/rbi/lib/orb/models/customers/credits/top_up_create_by_external_id_response.rbi +198 -0
- data/rbi/lib/orb/models/customers/credits/top_up_create_params.rbi +176 -0
- data/rbi/lib/orb/models/customers/credits/top_up_create_response.rbi +175 -0
- data/rbi/lib/orb/models/customers/credits/top_up_delete_by_external_id_params.rbi +31 -0
- data/rbi/lib/orb/models/customers/credits/top_up_delete_params.rbi +28 -0
- data/rbi/lib/orb/models/customers/credits/top_up_list_by_external_id_params.rbi +49 -0
- data/rbi/lib/orb/models/customers/credits/top_up_list_by_external_id_response.rbi +188 -0
- data/rbi/lib/orb/models/customers/credits/top_up_list_params.rbi +49 -0
- data/rbi/lib/orb/models/customers/credits/top_up_list_response.rbi +168 -0
- data/rbi/lib/orb/models/dimensional_price_group.rbi +75 -0
- data/rbi/lib/orb/models/dimensional_price_group_create_params.rbi +66 -0
- data/rbi/lib/orb/models/dimensional_price_group_list_params.rbi +39 -0
- data/rbi/lib/orb/models/dimensional_price_group_retrieve_params.rbi +20 -0
- data/rbi/lib/orb/models/dimensional_price_groups/external_dimensional_price_group_id_retrieve_params.rbi +22 -0
- data/rbi/lib/orb/models/dimensional_price_groups.rbi +35 -0
- data/rbi/lib/orb/models/discount.rbi +18 -0
- data/rbi/lib/orb/models/evaluate_price_group.rbi +45 -0
- data/rbi/lib/orb/models/event_deprecate_params.rbi +20 -0
- data/rbi/lib/orb/models/event_deprecate_response.rbi +19 -0
- data/rbi/lib/orb/models/event_ingest_params.rbi +120 -0
- data/rbi/lib/orb/models/event_ingest_response.rbi +79 -0
- data/rbi/lib/orb/models/event_search_params.rbi +53 -0
- data/rbi/lib/orb/models/event_search_response.rbi +100 -0
- data/rbi/lib/orb/models/event_update_params.rbi +71 -0
- data/rbi/lib/orb/models/event_update_response.rbi +19 -0
- data/rbi/lib/orb/models/events/backfill_close_params.rbi +22 -0
- data/rbi/lib/orb/models/events/backfill_close_response.rbi +127 -0
- data/rbi/lib/orb/models/events/backfill_create_params.rbi +97 -0
- data/rbi/lib/orb/models/events/backfill_create_response.rbi +128 -0
- data/rbi/lib/orb/models/events/backfill_fetch_params.rbi +22 -0
- data/rbi/lib/orb/models/events/backfill_fetch_response.rbi +127 -0
- data/rbi/lib/orb/models/events/backfill_list_params.rbi +41 -0
- data/rbi/lib/orb/models/events/backfill_list_response.rbi +127 -0
- data/rbi/lib/orb/models/events/backfill_revert_params.rbi +22 -0
- data/rbi/lib/orb/models/events/backfill_revert_response.rbi +128 -0
- data/rbi/lib/orb/models/events/event_volumes.rbi +47 -0
- data/rbi/lib/orb/models/events/volume_list_params.rbi +69 -0
- data/rbi/lib/orb/models/invoice.rbi +2466 -0
- data/rbi/lib/orb/models/invoice_create_params.rbi +230 -0
- data/rbi/lib/orb/models/invoice_fetch_params.rbi +20 -0
- data/rbi/lib/orb/models/invoice_fetch_upcoming_params.rbi +24 -0
- data/rbi/lib/orb/models/invoice_fetch_upcoming_response.rbi +2646 -0
- data/rbi/lib/orb/models/invoice_issue_params.rbi +32 -0
- data/rbi/lib/orb/models/invoice_level_discount.rbi +16 -0
- data/rbi/lib/orb/models/invoice_line_item_create_params.rbi +67 -0
- data/rbi/lib/orb/models/invoice_line_item_create_response.rbi +1164 -0
- data/rbi/lib/orb/models/invoice_list_params.rbi +187 -0
- data/rbi/lib/orb/models/invoice_mark_paid_params.rbi +48 -0
- data/rbi/lib/orb/models/invoice_pay_params.rbi +20 -0
- data/rbi/lib/orb/models/invoice_update_params.rbi +36 -0
- data/rbi/lib/orb/models/invoice_void_params.rbi +20 -0
- data/rbi/lib/orb/models/item.rbi +101 -0
- data/rbi/lib/orb/models/item_create_params.rbi +25 -0
- data/rbi/lib/orb/models/item_fetch_params.rbi +20 -0
- data/rbi/lib/orb/models/item_list_params.rbi +39 -0
- data/rbi/lib/orb/models/item_update_params.rbi +113 -0
- data/rbi/lib/orb/models/metric_create_params.rbi +62 -0
- data/rbi/lib/orb/models/metric_fetch_params.rbi +20 -0
- data/rbi/lib/orb/models/metric_list_params.rbi +74 -0
- data/rbi/lib/orb/models/metric_update_params.rbi +36 -0
- data/rbi/lib/orb/models/pagination_metadata.rbi +21 -0
- data/rbi/lib/orb/models/percentage_discount.rbi +63 -0
- data/rbi/lib/orb/models/plan.rbi +1071 -0
- data/rbi/lib/orb/models/plan_create_params.rbi +10069 -0
- data/rbi/lib/orb/models/plan_fetch_params.rbi +20 -0
- data/rbi/lib/orb/models/plan_list_params.rbi +100 -0
- data/rbi/lib/orb/models/plan_update_params.rbi +46 -0
- data/rbi/lib/orb/models/plans/external_plan_id_fetch_params.rbi +22 -0
- data/rbi/lib/orb/models/plans/external_plan_id_update_params.rbi +48 -0
- data/rbi/lib/orb/models/price.rbi +15341 -0
- data/rbi/lib/orb/models/price_create_params.rbi +885 -0
- data/rbi/lib/orb/models/price_evaluate_params.rbi +81 -0
- data/rbi/lib/orb/models/price_evaluate_response.rbi +21 -0
- data/rbi/lib/orb/models/price_fetch_params.rbi +20 -0
- data/rbi/lib/orb/models/price_list_params.rbi +39 -0
- data/rbi/lib/orb/models/price_update_params.rbi +36 -0
- data/rbi/lib/orb/models/prices/external_price_id_fetch_params.rbi +22 -0
- data/rbi/lib/orb/models/prices/external_price_id_update_params.rbi +38 -0
- data/rbi/lib/orb/models/subscription.rbi +1381 -0
- data/rbi/lib/orb/models/subscription_cancel_params.rbi +75 -0
- data/rbi/lib/orb/models/subscription_cancel_response.rbi +1374 -0
- data/rbi/lib/orb/models/subscription_create_params.rbi +23422 -0
- data/rbi/lib/orb/models/subscription_create_response.rbi +1374 -0
- data/rbi/lib/orb/models/subscription_fetch_costs_params.rbi +82 -0
- data/rbi/lib/orb/models/subscription_fetch_costs_response.rbi +210 -0
- data/rbi/lib/orb/models/subscription_fetch_params.rbi +20 -0
- data/rbi/lib/orb/models/subscription_fetch_schedule_params.rbi +74 -0
- data/rbi/lib/orb/models/subscription_fetch_schedule_response.rbi +81 -0
- data/rbi/lib/orb/models/subscription_fetch_usage_params.rbi +137 -0
- data/rbi/lib/orb/models/subscription_list_params.rbi +108 -0
- data/rbi/lib/orb/models/subscription_price_intervals_params.rbi +12991 -0
- data/rbi/lib/orb/models/subscription_price_intervals_response.rbi +1387 -0
- data/rbi/lib/orb/models/subscription_schedule_plan_change_params.rbi +23589 -0
- data/rbi/lib/orb/models/subscription_schedule_plan_change_response.rbi +1390 -0
- data/rbi/lib/orb/models/subscription_trigger_phase_params.rbi +45 -0
- data/rbi/lib/orb/models/subscription_trigger_phase_response.rbi +1381 -0
- data/rbi/lib/orb/models/subscription_unschedule_cancellation_params.rbi +20 -0
- data/rbi/lib/orb/models/subscription_unschedule_cancellation_response.rbi +1400 -0
- data/rbi/lib/orb/models/subscription_unschedule_fixed_fee_quantity_updates_params.rbi +25 -0
- data/rbi/lib/orb/models/subscription_unschedule_fixed_fee_quantity_updates_response.rbi +1451 -0
- data/rbi/lib/orb/models/subscription_unschedule_pending_plan_changes_params.rbi +20 -0
- data/rbi/lib/orb/models/subscription_unschedule_pending_plan_changes_response.rbi +1410 -0
- data/rbi/lib/orb/models/subscription_update_fixed_fee_quantity_params.rbi +104 -0
- data/rbi/lib/orb/models/subscription_update_fixed_fee_quantity_response.rbi +1400 -0
- data/rbi/lib/orb/models/subscription_update_params.rbi +77 -0
- data/rbi/lib/orb/models/subscription_update_trial_params.rbi +63 -0
- data/rbi/lib/orb/models/subscription_update_trial_response.rbi +1378 -0
- data/rbi/lib/orb/models/subscription_usage.rbi +323 -0
- data/rbi/lib/orb/models/subscriptions.rbi +33 -0
- data/rbi/lib/orb/models/top_level_ping_params.rbi +20 -0
- data/rbi/lib/orb/models/top_level_ping_response.rbi +18 -0
- data/rbi/lib/orb/models/trial_discount.rbi +73 -0
- data/rbi/lib/orb/models/usage_discount.rbi +62 -0
- data/rbi/lib/orb/page.rbi +35 -0
- data/rbi/lib/orb/request_options.rbi +48 -0
- data/rbi/lib/orb/resources/alerts.rbi +216 -0
- data/rbi/lib/orb/resources/coupons/subscriptions.rbi +38 -0
- data/rbi/lib/orb/resources/coupons.rbi +96 -0
- data/rbi/lib/orb/resources/credit_notes.rbi +74 -0
- data/rbi/lib/orb/resources/customers/balance_transactions.rbi +92 -0
- data/rbi/lib/orb/resources/customers/costs.rbi +304 -0
- data/rbi/lib/orb/resources/customers/credits/ledger.rbi +645 -0
- data/rbi/lib/orb/resources/customers/credits/top_ups.rbi +180 -0
- data/rbi/lib/orb/resources/customers/credits.rbi +88 -0
- data/rbi/lib/orb/resources/customers.rbi +714 -0
- data/rbi/lib/orb/resources/dimensional_price_groups/external_dimensional_price_group_id.rbi +25 -0
- data/rbi/lib/orb/resources/dimensional_price_groups.rbi +78 -0
- data/rbi/lib/orb/resources/events/backfills.rbi +161 -0
- data/rbi/lib/orb/resources/events/volume.rbi +57 -0
- data/rbi/lib/orb/resources/events.rbi +408 -0
- data/rbi/lib/orb/resources/invoice_line_items.rbi +44 -0
- data/rbi/lib/orb/resources/invoices.rbi +262 -0
- data/rbi/lib/orb/resources/items.rbi +65 -0
- data/rbi/lib/orb/resources/metrics.rbi +102 -0
- data/rbi/lib/orb/resources/plans/external_plan_id.rbi +67 -0
- data/rbi/lib/orb/resources/plans.rbi +170 -0
- data/rbi/lib/orb/resources/prices/external_price_id.rbi +110 -0
- data/rbi/lib/orb/resources/prices.rbi +371 -0
- data/rbi/lib/orb/resources/subscriptions.rbi +1469 -0
- data/rbi/lib/orb/resources/top_level.rbi +25 -0
- data/rbi/lib/orb/transport/base_client.rbi +205 -0
- data/rbi/lib/orb/transport/pooled_net_requester.rbi +64 -0
- data/rbi/lib/orb/type/array_of.rbi +82 -0
- data/rbi/lib/orb/type/base_model.rbi +197 -0
- data/rbi/lib/orb/type/base_page.rbi +38 -0
- data/rbi/lib/orb/type/boolean_model.rbi +41 -0
- data/rbi/lib/orb/type/converter.rbi +95 -0
- data/rbi/lib/orb/type/enum.rbi +58 -0
- data/rbi/lib/orb/type/hash_of.rbi +86 -0
- data/rbi/lib/orb/type/request_parameters.rbi +20 -0
- data/rbi/lib/orb/type/union.rbi +66 -0
- data/rbi/lib/orb/type/unknown.rbi +37 -0
- data/rbi/lib/orb/type.rbi +23 -0
- data/rbi/lib/orb/util.rbi +278 -0
- data/rbi/lib/orb/version.rbi +5 -0
- data/sig/orb/client.rbs +53 -0
- data/sig/orb/errors.rbs +201 -0
- data/sig/orb/models/alert.rbs +142 -0
- data/sig/orb/models/alert_create_for_customer_params.rbs +56 -0
- data/sig/orb/models/alert_create_for_external_customer_params.rbs +56 -0
- data/sig/orb/models/alert_create_for_subscription_params.rbs +52 -0
- data/sig/orb/models/alert_disable_params.rbs +20 -0
- data/sig/orb/models/alert_enable_params.rbs +20 -0
- data/sig/orb/models/alert_list_params.rbs +57 -0
- data/sig/orb/models/alert_retrieve_params.rbs +14 -0
- data/sig/orb/models/alert_update_params.rbs +31 -0
- data/sig/orb/models/amount_discount.rbs +40 -0
- data/sig/orb/models/billable_metric.rbs +50 -0
- data/sig/orb/models/billing_cycle_relative_date.rbs +14 -0
- data/sig/orb/models/coupon.rbs +51 -0
- data/sig/orb/models/coupon_archive_params.rbs +14 -0
- data/sig/orb/models/coupon_create_params.rbs +77 -0
- data/sig/orb/models/coupon_fetch_params.rbs +14 -0
- data/sig/orb/models/coupon_list_params.rbs +37 -0
- data/sig/orb/models/coupons/subscription_list_params.rbs +27 -0
- data/sig/orb/models/credit_note.rbs +345 -0
- data/sig/orb/models/credit_note_create_params.rbs +57 -0
- data/sig/orb/models/credit_note_fetch_params.rbs +14 -0
- data/sig/orb/models/credit_note_list_params.rbs +45 -0
- data/sig/orb/models/customer.rbs +628 -0
- data/sig/orb/models/customer_create_params.rbs +624 -0
- data/sig/orb/models/customer_delete_params.rbs +14 -0
- data/sig/orb/models/customer_fetch_by_external_id_params.rbs +14 -0
- data/sig/orb/models/customer_fetch_params.rbs +14 -0
- data/sig/orb/models/customer_list_params.rbs +45 -0
- data/sig/orb/models/customer_sync_payment_methods_from_gateway_by_external_customer_id_params.rbs +15 -0
- data/sig/orb/models/customer_sync_payment_methods_from_gateway_params.rbs +15 -0
- data/sig/orb/models/customer_update_by_external_id_params.rbs +620 -0
- data/sig/orb/models/customer_update_params.rbs +620 -0
- data/sig/orb/models/customers/balance_transaction_create_params.rbs +44 -0
- data/sig/orb/models/customers/balance_transaction_create_response.rbs +114 -0
- data/sig/orb/models/customers/balance_transaction_list_params.rbs +47 -0
- data/sig/orb/models/customers/balance_transaction_list_response.rbs +114 -0
- data/sig/orb/models/customers/cost_list_by_external_id_params.rbs +48 -0
- data/sig/orb/models/customers/cost_list_by_external_id_response.rbs +82 -0
- data/sig/orb/models/customers/cost_list_params.rbs +48 -0
- data/sig/orb/models/customers/cost_list_response.rbs +80 -0
- data/sig/orb/models/customers/credit_list_by_external_id_params.rbs +41 -0
- data/sig/orb/models/customers/credit_list_by_external_id_response.rbs +55 -0
- data/sig/orb/models/customers/credit_list_params.rbs +41 -0
- data/sig/orb/models/customers/credit_list_response.rbs +55 -0
- data/sig/orb/models/customers/credits/ledger_create_entry_by_external_id_params.rbs +120 -0
- data/sig/orb/models/customers/credits/ledger_create_entry_by_external_id_response.rbs +814 -0
- data/sig/orb/models/customers/credits/ledger_create_entry_params.rbs +120 -0
- data/sig/orb/models/customers/credits/ledger_create_entry_response.rbs +814 -0
- data/sig/orb/models/customers/credits/ledger_list_by_external_id_params.rbs +99 -0
- data/sig/orb/models/customers/credits/ledger_list_by_external_id_response.rbs +814 -0
- data/sig/orb/models/customers/credits/ledger_list_params.rbs +99 -0
- data/sig/orb/models/customers/credits/ledger_list_response.rbs +814 -0
- data/sig/orb/models/customers/credits/top_up_create_by_external_id_params.rbs +95 -0
- data/sig/orb/models/customers/credits/top_up_create_by_external_id_response.rbs +90 -0
- data/sig/orb/models/customers/credits/top_up_create_params.rbs +95 -0
- data/sig/orb/models/customers/credits/top_up_create_response.rbs +90 -0
- data/sig/orb/models/customers/credits/top_up_delete_by_external_id_params.rbs +24 -0
- data/sig/orb/models/customers/credits/top_up_delete_params.rbs +24 -0
- data/sig/orb/models/customers/credits/top_up_list_by_external_id_params.rbs +29 -0
- data/sig/orb/models/customers/credits/top_up_list_by_external_id_response.rbs +90 -0
- data/sig/orb/models/customers/credits/top_up_list_params.rbs +29 -0
- data/sig/orb/models/customers/credits/top_up_list_response.rbs +90 -0
- data/sig/orb/models/dimensional_price_group.rbs +38 -0
- data/sig/orb/models/dimensional_price_group_create_params.rbs +39 -0
- data/sig/orb/models/dimensional_price_group_list_params.rbs +25 -0
- data/sig/orb/models/dimensional_price_group_retrieve_params.rbs +15 -0
- data/sig/orb/models/dimensional_price_groups/external_dimensional_price_group_id_retrieve_params.rbs +17 -0
- data/sig/orb/models/dimensional_price_groups.rbs +22 -0
- data/sig/orb/models/discount.rbs +15 -0
- data/sig/orb/models/evaluate_price_group.rbs +34 -0
- data/sig/orb/models/event_deprecate_params.rbs +14 -0
- data/sig/orb/models/event_deprecate_response.rbs +13 -0
- data/sig/orb/models/event_ingest_params.rbs +68 -0
- data/sig/orb/models/event_ingest_response.rbs +53 -0
- data/sig/orb/models/event_search_params.rbs +31 -0
- data/sig/orb/models/event_search_response.rbs +55 -0
- data/sig/orb/models/event_update_params.rbs +39 -0
- data/sig/orb/models/event_update_response.rbs +13 -0
- data/sig/orb/models/events/backfill_close_params.rbs +16 -0
- data/sig/orb/models/events/backfill_close_response.rbs +73 -0
- data/sig/orb/models/events/backfill_create_params.rbs +51 -0
- data/sig/orb/models/events/backfill_create_response.rbs +73 -0
- data/sig/orb/models/events/backfill_fetch_params.rbs +16 -0
- data/sig/orb/models/events/backfill_fetch_response.rbs +73 -0
- data/sig/orb/models/events/backfill_list_params.rbs +27 -0
- data/sig/orb/models/events/backfill_list_response.rbs +73 -0
- data/sig/orb/models/events/backfill_revert_params.rbs +16 -0
- data/sig/orb/models/events/backfill_revert_response.rbs +73 -0
- data/sig/orb/models/events/event_volumes.rbs +39 -0
- data/sig/orb/models/events/volume_list_params.rbs +41 -0
- data/sig/orb/models/invoice.rbs +1430 -0
- data/sig/orb/models/invoice_create_params.rbs +120 -0
- data/sig/orb/models/invoice_fetch_params.rbs +14 -0
- data/sig/orb/models/invoice_fetch_upcoming_params.rbs +20 -0
- data/sig/orb/models/invoice_fetch_upcoming_response.rbs +1430 -0
- data/sig/orb/models/invoice_issue_params.rbs +21 -0
- data/sig/orb/models/invoice_level_discount.rbs +14 -0
- data/sig/orb/models/invoice_line_item_create_params.rbs +43 -0
- data/sig/orb/models/invoice_line_item_create_response.rbs +546 -0
- data/sig/orb/models/invoice_list_params.rbs +122 -0
- data/sig/orb/models/invoice_mark_paid_params.rbs +27 -0
- data/sig/orb/models/invoice_pay_params.rbs +14 -0
- data/sig/orb/models/invoice_update_params.rbs +20 -0
- data/sig/orb/models/invoice_void_params.rbs +14 -0
- data/sig/orb/models/item.rbs +72 -0
- data/sig/orb/models/item_create_params.rbs +19 -0
- data/sig/orb/models/item_fetch_params.rbs +14 -0
- data/sig/orb/models/item_list_params.rbs +25 -0
- data/sig/orb/models/item_update_params.rbs +69 -0
- data/sig/orb/models/metric_create_params.rbs +39 -0
- data/sig/orb/models/metric_fetch_params.rbs +14 -0
- data/sig/orb/models/metric_list_params.rbs +45 -0
- data/sig/orb/models/metric_update_params.rbs +20 -0
- data/sig/orb/models/pagination_metadata.rbs +15 -0
- data/sig/orb/models/percentage_discount.rbs +40 -0
- data/sig/orb/models/plan.rbs +529 -0
- data/sig/orb/models/plan_create_params.rbs +3991 -0
- data/sig/orb/models/plan_fetch_params.rbs +14 -0
- data/sig/orb/models/plan_list_params.rbs +65 -0
- data/sig/orb/models/plan_update_params.rbs +24 -0
- data/sig/orb/models/plans/external_plan_id_fetch_params.rbs +16 -0
- data/sig/orb/models/plans/external_plan_id_update_params.rbs +26 -0
- data/sig/orb/models/price.rbs +8108 -0
- data/sig/orb/models/price_create_params.rbs +520 -0
- data/sig/orb/models/price_evaluate_params.rbs +45 -0
- data/sig/orb/models/price_evaluate_response.rbs +14 -0
- data/sig/orb/models/price_fetch_params.rbs +14 -0
- data/sig/orb/models/price_list_params.rbs +25 -0
- data/sig/orb/models/price_update_params.rbs +20 -0
- data/sig/orb/models/prices/external_price_id_fetch_params.rbs +16 -0
- data/sig/orb/models/prices/external_price_id_update_params.rbs +22 -0
- data/sig/orb/models/subscription.rbs +687 -0
- data/sig/orb/models/subscription_cancel_params.rbs +44 -0
- data/sig/orb/models/subscription_cancel_response.rbs +687 -0
- data/sig/orb/models/subscription_create_params.rbs +9141 -0
- data/sig/orb/models/subscription_create_response.rbs +687 -0
- data/sig/orb/models/subscription_fetch_costs_params.rbs +46 -0
- data/sig/orb/models/subscription_fetch_costs_response.rbs +78 -0
- data/sig/orb/models/subscription_fetch_params.rbs +14 -0
- data/sig/orb/models/subscription_fetch_schedule_params.rbs +45 -0
- data/sig/orb/models/subscription_fetch_schedule_response.rbs +48 -0
- data/sig/orb/models/subscription_fetch_usage_params.rbs +80 -0
- data/sig/orb/models/subscription_list_params.rbs +69 -0
- data/sig/orb/models/subscription_price_intervals_params.rbs +5117 -0
- data/sig/orb/models/subscription_price_intervals_response.rbs +687 -0
- data/sig/orb/models/subscription_schedule_plan_change_params.rbs +9133 -0
- data/sig/orb/models/subscription_schedule_plan_change_response.rbs +687 -0
- data/sig/orb/models/subscription_trigger_phase_params.rbs +24 -0
- data/sig/orb/models/subscription_trigger_phase_response.rbs +687 -0
- data/sig/orb/models/subscription_unschedule_cancellation_params.rbs +15 -0
- data/sig/orb/models/subscription_unschedule_cancellation_response.rbs +687 -0
- data/sig/orb/models/subscription_unschedule_fixed_fee_quantity_updates_params.rbs +20 -0
- data/sig/orb/models/subscription_unschedule_fixed_fee_quantity_updates_response.rbs +687 -0
- data/sig/orb/models/subscription_unschedule_pending_plan_changes_params.rbs +15 -0
- data/sig/orb/models/subscription_unschedule_pending_plan_changes_response.rbs +687 -0
- data/sig/orb/models/subscription_update_fixed_fee_quantity_params.rbs +55 -0
- data/sig/orb/models/subscription_update_fixed_fee_quantity_response.rbs +687 -0
- data/sig/orb/models/subscription_update_params.rbs +39 -0
- data/sig/orb/models/subscription_update_trial_params.rbs +39 -0
- data/sig/orb/models/subscription_update_trial_response.rbs +687 -0
- data/sig/orb/models/subscription_usage.rbs +196 -0
- data/sig/orb/models/subscriptions.rbs +22 -0
- data/sig/orb/models/top_level_ping_params.rbs +14 -0
- data/sig/orb/models/top_level_ping_response.rbs +13 -0
- data/sig/orb/models/trial_discount.rbs +44 -0
- data/sig/orb/models/usage_discount.rbs +40 -0
- data/sig/orb/page.rbs +22 -0
- data/sig/orb/request_options.rbs +32 -0
- data/sig/orb/resources/alerts.rbs +67 -0
- data/sig/orb/resources/coupons/subscriptions.rbs +16 -0
- data/sig/orb/resources/coupons.rbs +35 -0
- data/sig/orb/resources/credit_notes.rbs +29 -0
- data/sig/orb/resources/customers/balance_transactions.rbs +28 -0
- data/sig/orb/resources/customers/costs.rbs +27 -0
- data/sig/orb/resources/customers/credits/ledger.rbs +75 -0
- data/sig/orb/resources/customers/credits/top_ups.rbs +63 -0
- data/sig/orb/resources/customers/credits.rbs +31 -0
- data/sig/orb/resources/customers.rbs +114 -0
- data/sig/orb/resources/dimensional_price_groups/external_dimensional_price_group_id.rbs +14 -0
- data/sig/orb/resources/dimensional_price_groups.rbs +29 -0
- data/sig/orb/resources/events/backfills.rbs +41 -0
- data/sig/orb/resources/events/volume.rbs +17 -0
- data/sig/orb/resources/events.rbs +40 -0
- data/sig/orb/resources/invoice_line_items.rbs +17 -0
- data/sig/orb/resources/invoices.rbs +84 -0
- data/sig/orb/resources/items.rbs +30 -0
- data/sig/orb/resources/metrics.rbs +37 -0
- data/sig/orb/resources/plans/external_plan_id.rbs +21 -0
- data/sig/orb/resources/plans.rbs +44 -0
- data/sig/orb/resources/prices/external_price_id.rbs +20 -0
- data/sig/orb/resources/prices.rbs +83 -0
- data/sig/orb/resources/subscriptions.rbs +194 -0
- data/sig/orb/resources/top_level.rbs +11 -0
- data/sig/orb/transport/base_client.rbs +110 -0
- data/sig/orb/transport/pooled_net_requester.rbs +39 -0
- data/sig/orb/type/array_of.rbs +36 -0
- data/sig/orb/type/base_model.rbs +77 -0
- data/sig/orb/type/base_page.rbs +22 -0
- data/sig/orb/type/boolean_model.rbs +18 -0
- data/sig/orb/type/converter.rbs +36 -0
- data/sig/orb/type/enum.rbs +22 -0
- data/sig/orb/type/hash_of.rbs +36 -0
- data/sig/orb/type/request_parameters.rbs +13 -0
- data/sig/orb/type/union.rbs +37 -0
- data/sig/orb/type/unknown.rbs +15 -0
- data/sig/orb/type.rbs +22 -0
- data/sig/orb/util.rbs +132 -0
- data/sig/orb/version.rbs +3 -0
- metadata +692 -0
@@ -0,0 +1,645 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Orb
|
4
|
+
module Resources
|
5
|
+
class Customers
|
6
|
+
class Credits
|
7
|
+
class Ledger
|
8
|
+
# The credits ledger provides _auditing_ functionality over Orb's credits system
|
9
|
+
# with a list of actions that have taken place to modify a customer's credit
|
10
|
+
# balance. This [paginated endpoint](/api-reference/pagination) lists these
|
11
|
+
# entries, starting from the most recent ledger entry.
|
12
|
+
#
|
13
|
+
# More details on using Orb's real-time credit feature are
|
14
|
+
# [here](/product-catalog/prepurchase).
|
15
|
+
#
|
16
|
+
# There are four major types of modifications to credit balance, detailed below.
|
17
|
+
#
|
18
|
+
# ## Increment
|
19
|
+
#
|
20
|
+
# Credits (which optionally expire on a future date) can be added via the API
|
21
|
+
# ([Add Ledger Entry](create-ledger-entry)). The ledger entry for such an action
|
22
|
+
# will always contain the total eligible starting and ending balance for the
|
23
|
+
# customer at the time the entry was added to the ledger.
|
24
|
+
#
|
25
|
+
# ## Decrement
|
26
|
+
#
|
27
|
+
# Deductions can occur as a result of an API call to create a ledger entry (see
|
28
|
+
# [Add Ledger Entry](create-ledger-entry)), or automatically as a result of
|
29
|
+
# incurring usage. Both ledger entries present the `decrement` entry type.
|
30
|
+
#
|
31
|
+
# As usage for a customer is reported into Orb, credits may be deducted according
|
32
|
+
# to the customer's plan configuration. An automated deduction of this type will
|
33
|
+
# result in a ledger entry, also with a starting and ending balance. In order to
|
34
|
+
# provide better tracing capabilities for automatic deductions, Orb always
|
35
|
+
# associates each automatic deduction with the `event_id` at the time of
|
36
|
+
# ingestion, used to pinpoint _why_ credit deduction took place and to ensure that
|
37
|
+
# credits are never deducted without an associated usage event.
|
38
|
+
#
|
39
|
+
# By default, Orb uses an algorithm that automatically deducts from the _soonest
|
40
|
+
# expiring credit block_ first in order to ensure that all credits are utilized
|
41
|
+
# appropriately. As an example, if trial credits with an expiration date of 2
|
42
|
+
# weeks from now are present for a customer, they will be used before any
|
43
|
+
# deductions take place from a non-expiring credit block.
|
44
|
+
#
|
45
|
+
# If there are multiple blocks with the same expiration date, Orb will deduct from
|
46
|
+
# the block with the _lower cost basis_ first (e.g. trial credits with a $0 cost
|
47
|
+
# basis before paid credits with a $5.00 cost basis).
|
48
|
+
#
|
49
|
+
# It's also possible for a single usage event's deduction to _span_ credit blocks.
|
50
|
+
# In this case, Orb will deduct from the next block, ending at the credit block
|
51
|
+
# which consists of unexpiring credits. Each of these deductions will lead to a
|
52
|
+
# _separate_ ledger entry, one per credit block that is deducted from. By default,
|
53
|
+
# the customer's total credit balance in Orb can be negative as a result of a
|
54
|
+
# decrement.
|
55
|
+
#
|
56
|
+
# ## Expiration change
|
57
|
+
#
|
58
|
+
# The expiry of credits can be changed as a result of the API (See
|
59
|
+
# [Add Ledger Entry](create-ledger-entry)). This will create a ledger entry that
|
60
|
+
# specifies the balance as well as the initial and target expiry dates.
|
61
|
+
#
|
62
|
+
# Note that for this entry type, `starting_balance` will equal `ending_balance`,
|
63
|
+
# and the `amount` represents the balance transferred. The credit block linked to
|
64
|
+
# the ledger entry is the source credit block from which there was an expiration
|
65
|
+
# change
|
66
|
+
#
|
67
|
+
# ## Credits expiry
|
68
|
+
#
|
69
|
+
# When a set of credits expire on pre-set expiration date, the customer's balance
|
70
|
+
# automatically reflects this change and adds an entry to the ledger indicating
|
71
|
+
# this event. Note that credit expiry should always happen close to a date
|
72
|
+
# boundary in the customer's timezone.
|
73
|
+
#
|
74
|
+
# ## Void initiated
|
75
|
+
#
|
76
|
+
# Credit blocks can be voided via the API. The `amount` on this entry corresponds
|
77
|
+
# to the number of credits that were remaining in the block at time of void.
|
78
|
+
# `void_reason` will be populated if the void is created with a reason.
|
79
|
+
#
|
80
|
+
# ## Void
|
81
|
+
#
|
82
|
+
# When a set of credits is voided, the customer's balance automatically reflects
|
83
|
+
# this change and adds an entry to the ledger indicating this event.
|
84
|
+
#
|
85
|
+
# ## Amendment
|
86
|
+
#
|
87
|
+
# When credits are added to a customer's balance as a result of a correction, this
|
88
|
+
# entry will be added to the ledger to indicate the adjustment of credits.
|
89
|
+
sig do
|
90
|
+
params(
|
91
|
+
customer_id: String,
|
92
|
+
created_at_gt: T.nilable(Time),
|
93
|
+
created_at_gte: T.nilable(Time),
|
94
|
+
created_at_lt: T.nilable(Time),
|
95
|
+
created_at_lte: T.nilable(Time),
|
96
|
+
currency: T.nilable(String),
|
97
|
+
cursor: T.nilable(String),
|
98
|
+
entry_status: T.nilable(Orb::Models::Customers::Credits::LedgerListParams::EntryStatus::OrSymbol),
|
99
|
+
entry_type: T.nilable(Orb::Models::Customers::Credits::LedgerListParams::EntryType::OrSymbol),
|
100
|
+
limit: Integer,
|
101
|
+
minimum_amount: T.nilable(String),
|
102
|
+
request_options: T.nilable(T.any(Orb::RequestOptions, Orb::Util::AnyHash))
|
103
|
+
)
|
104
|
+
.returns(
|
105
|
+
Orb::Page[
|
106
|
+
T.any(
|
107
|
+
Orb::Models::Customers::Credits::LedgerListResponse::IncrementLedgerEntry,
|
108
|
+
Orb::Models::Customers::Credits::LedgerListResponse::DecrementLedgerEntry,
|
109
|
+
Orb::Models::Customers::Credits::LedgerListResponse::ExpirationChangeLedgerEntry,
|
110
|
+
Orb::Models::Customers::Credits::LedgerListResponse::CreditBlockExpiryLedgerEntry,
|
111
|
+
Orb::Models::Customers::Credits::LedgerListResponse::VoidLedgerEntry,
|
112
|
+
Orb::Models::Customers::Credits::LedgerListResponse::VoidInitiatedLedgerEntry,
|
113
|
+
Orb::Models::Customers::Credits::LedgerListResponse::AmendmentLedgerEntry
|
114
|
+
)
|
115
|
+
]
|
116
|
+
)
|
117
|
+
end
|
118
|
+
def list(
|
119
|
+
customer_id,
|
120
|
+
created_at_gt: nil,
|
121
|
+
created_at_gte: nil,
|
122
|
+
created_at_lt: nil,
|
123
|
+
created_at_lte: nil,
|
124
|
+
# The ledger currency or custom pricing unit to use.
|
125
|
+
currency: nil,
|
126
|
+
# Cursor for pagination. This can be populated by the `next_cursor` value returned
|
127
|
+
# from the initial request.
|
128
|
+
cursor: nil,
|
129
|
+
entry_status: nil,
|
130
|
+
entry_type: nil,
|
131
|
+
# The number of items to fetch. Defaults to 20.
|
132
|
+
limit: nil,
|
133
|
+
minimum_amount: nil,
|
134
|
+
request_options: {}
|
135
|
+
)
|
136
|
+
end
|
137
|
+
|
138
|
+
# This endpoint allows you to create a new ledger entry for a specified customer's
|
139
|
+
# balance. This can be used to increment balance, deduct credits, and change the
|
140
|
+
# expiry date of existing credits.
|
141
|
+
#
|
142
|
+
# ## Effects of adding a ledger entry
|
143
|
+
#
|
144
|
+
# 1. After calling this endpoint, [Fetch Credit Balance](fetch-customer-credits)
|
145
|
+
# will return a credit block that represents the changes (i.e. balance changes
|
146
|
+
# or transfers).
|
147
|
+
# 2. A ledger entry will be added to the credits ledger for this customer, and
|
148
|
+
# therefore returned in the
|
149
|
+
# [View Credits Ledger](fetch-customer-credits-ledger) response as well as
|
150
|
+
# serialized in the response to this request. In the case of deductions without
|
151
|
+
# a specified block, multiple ledger entries may be created if the deduction
|
152
|
+
# spans credit blocks.
|
153
|
+
# 3. If `invoice_settings` is specified, an invoice will be created that reflects
|
154
|
+
# the cost of the credits (based on `amount` and `per_unit_cost_basis`).
|
155
|
+
#
|
156
|
+
# ## Adding credits
|
157
|
+
#
|
158
|
+
# Adding credits is done by creating an entry of type `increment`. This requires
|
159
|
+
# the caller to specify a number of credits as well as an optional expiry date in
|
160
|
+
# `YYYY-MM-DD` format. Orb also recommends specifying a description to assist with
|
161
|
+
# auditing. When adding credits, the caller can also specify a cost basis
|
162
|
+
# per-credit, to indicate how much in USD a customer paid for a single credit in a
|
163
|
+
# block. This can later be used for revenue recognition.
|
164
|
+
#
|
165
|
+
# The following snippet illustrates a sample request body to increment credits
|
166
|
+
# which will expire in January of 2022.
|
167
|
+
#
|
168
|
+
# ```json
|
169
|
+
# {
|
170
|
+
# "entry_type": "increment",
|
171
|
+
# "amount": 100,
|
172
|
+
# "expiry_date": "2022-12-28",
|
173
|
+
# "per_unit_cost_basis": "0.20",
|
174
|
+
# "description": "Purchased 100 credits"
|
175
|
+
# }
|
176
|
+
# ```
|
177
|
+
#
|
178
|
+
# Note that by default, Orb will always first increment any _negative_ balance in
|
179
|
+
# existing blocks before adding the remaining amount to the desired credit block.
|
180
|
+
#
|
181
|
+
# ### Invoicing for credits
|
182
|
+
#
|
183
|
+
# By default, Orb manipulates the credit ledger but does not charge for credits.
|
184
|
+
# However, if you pass `invoice_settings` in the body of this request, Orb will
|
185
|
+
# also generate a one-off invoice for the customer for the credits pre-purchase.
|
186
|
+
# Note that you _must_ provide the `per_unit_cost_basis`, since the total charges
|
187
|
+
# on the invoice are calculated by multiplying the cost basis with the number of
|
188
|
+
# credit units added.
|
189
|
+
#
|
190
|
+
# ## Deducting Credits
|
191
|
+
#
|
192
|
+
# Orb allows you to deduct credits from a customer by creating an entry of type
|
193
|
+
# `decrement`. Orb matches the algorithm for automatic deductions for determining
|
194
|
+
# which credit blocks to decrement from. In the case that the deduction leads to
|
195
|
+
# multiple ledger entries, the response from this endpoint will be the final
|
196
|
+
# deduction. Orb also optionally allows specifying a description to assist with
|
197
|
+
# auditing.
|
198
|
+
#
|
199
|
+
# The following snippet illustrates a sample request body to decrement credits.
|
200
|
+
#
|
201
|
+
# ```json
|
202
|
+
# {
|
203
|
+
# "entry_type": "decrement",
|
204
|
+
# "amount": 20,
|
205
|
+
# "description": "Removing excess credits"
|
206
|
+
# }
|
207
|
+
# ```
|
208
|
+
#
|
209
|
+
# ## Changing credits expiry
|
210
|
+
#
|
211
|
+
# If you'd like to change when existing credits expire, you should create a ledger
|
212
|
+
# entry of type `expiration_change`. For this entry, the required parameter
|
213
|
+
# `expiry_date` identifies the _originating_ block, and the required parameter
|
214
|
+
# `target_expiry_date` identifies when the transferred credits should now expire.
|
215
|
+
# A new credit block will be created with expiry date `target_expiry_date`, with
|
216
|
+
# the same cost basis data as the original credit block, if present.
|
217
|
+
#
|
218
|
+
# Note that the balance of the block with the given `expiry_date` must be at least
|
219
|
+
# equal to the desired transfer amount determined by the `amount` parameter.
|
220
|
+
#
|
221
|
+
# The following snippet illustrates a sample request body to extend the expiration
|
222
|
+
# date of credits by one year:
|
223
|
+
#
|
224
|
+
# ```json
|
225
|
+
# {
|
226
|
+
# "entry_type": "expiration_change",
|
227
|
+
# "amount": 10,
|
228
|
+
# "expiry_date": "2022-12-28",
|
229
|
+
# "block_id": "UiUhFWeLHPrBY4Ad",
|
230
|
+
# "target_expiry_date": "2023-12-28",
|
231
|
+
# "description": "Extending credit validity"
|
232
|
+
# }
|
233
|
+
# ```
|
234
|
+
#
|
235
|
+
# ## Voiding credits
|
236
|
+
#
|
237
|
+
# If you'd like to void a credit block, create a ledger entry of type `void`. For
|
238
|
+
# this entry, `block_id` is required to identify the block, and `amount` indicates
|
239
|
+
# how many credits to void, up to the block's initial balance. Pass in a
|
240
|
+
# `void_reason` of `refund` if the void is due to a refund.
|
241
|
+
#
|
242
|
+
# ## Amendment
|
243
|
+
#
|
244
|
+
# If you'd like to undo a decrement on a credit block, create a ledger entry of
|
245
|
+
# type `amendment`. For this entry, `block_id` is required to identify the block
|
246
|
+
# that was originally decremented from, and `amount` indicates how many credits to
|
247
|
+
# return to the customer, up to the block's initial balance.
|
248
|
+
sig do
|
249
|
+
params(
|
250
|
+
customer_id: String,
|
251
|
+
amount: Float,
|
252
|
+
entry_type: Orb::Models::Customers::Credits::LedgerCreateEntryParams::EntryType::OrSymbol,
|
253
|
+
expiry_date: T.nilable(Time),
|
254
|
+
target_expiry_date: Date,
|
255
|
+
block_id: String,
|
256
|
+
currency: T.nilable(String),
|
257
|
+
description: T.nilable(String),
|
258
|
+
effective_date: T.nilable(Time),
|
259
|
+
invoice_settings: T.nilable(
|
260
|
+
T.any(Orb::Models::Customers::Credits::LedgerCreateEntryParams::InvoiceSettings, Orb::Util::AnyHash)
|
261
|
+
),
|
262
|
+
metadata: T.nilable(T::Hash[Symbol, T.nilable(String)]),
|
263
|
+
per_unit_cost_basis: T.nilable(String),
|
264
|
+
void_reason: T.nilable(Orb::Models::Customers::Credits::LedgerCreateEntryParams::VoidReason::OrSymbol),
|
265
|
+
request_options: T.nilable(T.any(Orb::RequestOptions, Orb::Util::AnyHash))
|
266
|
+
)
|
267
|
+
.returns(
|
268
|
+
T.any(
|
269
|
+
Orb::Models::Customers::Credits::LedgerCreateEntryResponse::IncrementLedgerEntry,
|
270
|
+
Orb::Models::Customers::Credits::LedgerCreateEntryResponse::DecrementLedgerEntry,
|
271
|
+
Orb::Models::Customers::Credits::LedgerCreateEntryResponse::ExpirationChangeLedgerEntry,
|
272
|
+
Orb::Models::Customers::Credits::LedgerCreateEntryResponse::CreditBlockExpiryLedgerEntry,
|
273
|
+
Orb::Models::Customers::Credits::LedgerCreateEntryResponse::VoidLedgerEntry,
|
274
|
+
Orb::Models::Customers::Credits::LedgerCreateEntryResponse::VoidInitiatedLedgerEntry,
|
275
|
+
Orb::Models::Customers::Credits::LedgerCreateEntryResponse::AmendmentLedgerEntry
|
276
|
+
)
|
277
|
+
)
|
278
|
+
end
|
279
|
+
def create_entry(
|
280
|
+
customer_id,
|
281
|
+
# The number of credits to effect. Note that this is required for increment,
|
282
|
+
# decrement or void operations.
|
283
|
+
amount:,
|
284
|
+
entry_type:,
|
285
|
+
# An ISO 8601 format date that identifies the origination credit block to expire
|
286
|
+
expiry_date:,
|
287
|
+
# A future date (specified in YYYY-MM-DD format) used for expiration change,
|
288
|
+
# denoting when credits transferred (as part of a partial block expiration) should
|
289
|
+
# expire.
|
290
|
+
target_expiry_date:,
|
291
|
+
# The ID of the block to reverse a decrement from.
|
292
|
+
block_id:,
|
293
|
+
# The currency or custom pricing unit to use for this ledger entry. If this is a
|
294
|
+
# real-world currency, it must match the customer's invoicing currency.
|
295
|
+
currency: nil,
|
296
|
+
# Optional metadata that can be specified when adding ledger results via the API.
|
297
|
+
# For example, this can be used to note an increment refers to trial credits, or
|
298
|
+
# for noting corrections as a result of an incident, etc.
|
299
|
+
description: nil,
|
300
|
+
# An ISO 8601 format date that denotes when this credit balance should become
|
301
|
+
# available for use.
|
302
|
+
effective_date: nil,
|
303
|
+
# Passing `invoice_settings` automatically generates an invoice for the newly
|
304
|
+
# added credits. If `invoice_settings` is passed, you must specify
|
305
|
+
# per_unit_cost_basis, as the calculation of the invoice total is done on that
|
306
|
+
# basis.
|
307
|
+
invoice_settings: nil,
|
308
|
+
# User-specified key/value pairs for the resource. Individual keys can be removed
|
309
|
+
# by setting the value to `null`, and the entire metadata mapping can be cleared
|
310
|
+
# by setting `metadata` to `null`.
|
311
|
+
metadata: nil,
|
312
|
+
# Can only be specified when entry_type=increment. How much, in the customer's
|
313
|
+
# currency, a customer paid for a single credit in this block
|
314
|
+
per_unit_cost_basis: nil,
|
315
|
+
# Can only be specified when `entry_type=void`. The reason for the void.
|
316
|
+
void_reason: nil,
|
317
|
+
request_options: {}
|
318
|
+
)
|
319
|
+
end
|
320
|
+
|
321
|
+
# This endpoint allows you to create a new ledger entry for a specified customer's
|
322
|
+
# balance. This can be used to increment balance, deduct credits, and change the
|
323
|
+
# expiry date of existing credits.
|
324
|
+
#
|
325
|
+
# ## Effects of adding a ledger entry
|
326
|
+
#
|
327
|
+
# 1. After calling this endpoint, [Fetch Credit Balance](fetch-customer-credits)
|
328
|
+
# will return a credit block that represents the changes (i.e. balance changes
|
329
|
+
# or transfers).
|
330
|
+
# 2. A ledger entry will be added to the credits ledger for this customer, and
|
331
|
+
# therefore returned in the
|
332
|
+
# [View Credits Ledger](fetch-customer-credits-ledger) response as well as
|
333
|
+
# serialized in the response to this request. In the case of deductions without
|
334
|
+
# a specified block, multiple ledger entries may be created if the deduction
|
335
|
+
# spans credit blocks.
|
336
|
+
# 3. If `invoice_settings` is specified, an invoice will be created that reflects
|
337
|
+
# the cost of the credits (based on `amount` and `per_unit_cost_basis`).
|
338
|
+
#
|
339
|
+
# ## Adding credits
|
340
|
+
#
|
341
|
+
# Adding credits is done by creating an entry of type `increment`. This requires
|
342
|
+
# the caller to specify a number of credits as well as an optional expiry date in
|
343
|
+
# `YYYY-MM-DD` format. Orb also recommends specifying a description to assist with
|
344
|
+
# auditing. When adding credits, the caller can also specify a cost basis
|
345
|
+
# per-credit, to indicate how much in USD a customer paid for a single credit in a
|
346
|
+
# block. This can later be used for revenue recognition.
|
347
|
+
#
|
348
|
+
# The following snippet illustrates a sample request body to increment credits
|
349
|
+
# which will expire in January of 2022.
|
350
|
+
#
|
351
|
+
# ```json
|
352
|
+
# {
|
353
|
+
# "entry_type": "increment",
|
354
|
+
# "amount": 100,
|
355
|
+
# "expiry_date": "2022-12-28",
|
356
|
+
# "per_unit_cost_basis": "0.20",
|
357
|
+
# "description": "Purchased 100 credits"
|
358
|
+
# }
|
359
|
+
# ```
|
360
|
+
#
|
361
|
+
# Note that by default, Orb will always first increment any _negative_ balance in
|
362
|
+
# existing blocks before adding the remaining amount to the desired credit block.
|
363
|
+
#
|
364
|
+
# ### Invoicing for credits
|
365
|
+
#
|
366
|
+
# By default, Orb manipulates the credit ledger but does not charge for credits.
|
367
|
+
# However, if you pass `invoice_settings` in the body of this request, Orb will
|
368
|
+
# also generate a one-off invoice for the customer for the credits pre-purchase.
|
369
|
+
# Note that you _must_ provide the `per_unit_cost_basis`, since the total charges
|
370
|
+
# on the invoice are calculated by multiplying the cost basis with the number of
|
371
|
+
# credit units added.
|
372
|
+
#
|
373
|
+
# ## Deducting Credits
|
374
|
+
#
|
375
|
+
# Orb allows you to deduct credits from a customer by creating an entry of type
|
376
|
+
# `decrement`. Orb matches the algorithm for automatic deductions for determining
|
377
|
+
# which credit blocks to decrement from. In the case that the deduction leads to
|
378
|
+
# multiple ledger entries, the response from this endpoint will be the final
|
379
|
+
# deduction. Orb also optionally allows specifying a description to assist with
|
380
|
+
# auditing.
|
381
|
+
#
|
382
|
+
# The following snippet illustrates a sample request body to decrement credits.
|
383
|
+
#
|
384
|
+
# ```json
|
385
|
+
# {
|
386
|
+
# "entry_type": "decrement",
|
387
|
+
# "amount": 20,
|
388
|
+
# "description": "Removing excess credits"
|
389
|
+
# }
|
390
|
+
# ```
|
391
|
+
#
|
392
|
+
# ## Changing credits expiry
|
393
|
+
#
|
394
|
+
# If you'd like to change when existing credits expire, you should create a ledger
|
395
|
+
# entry of type `expiration_change`. For this entry, the required parameter
|
396
|
+
# `expiry_date` identifies the _originating_ block, and the required parameter
|
397
|
+
# `target_expiry_date` identifies when the transferred credits should now expire.
|
398
|
+
# A new credit block will be created with expiry date `target_expiry_date`, with
|
399
|
+
# the same cost basis data as the original credit block, if present.
|
400
|
+
#
|
401
|
+
# Note that the balance of the block with the given `expiry_date` must be at least
|
402
|
+
# equal to the desired transfer amount determined by the `amount` parameter.
|
403
|
+
#
|
404
|
+
# The following snippet illustrates a sample request body to extend the expiration
|
405
|
+
# date of credits by one year:
|
406
|
+
#
|
407
|
+
# ```json
|
408
|
+
# {
|
409
|
+
# "entry_type": "expiration_change",
|
410
|
+
# "amount": 10,
|
411
|
+
# "expiry_date": "2022-12-28",
|
412
|
+
# "block_id": "UiUhFWeLHPrBY4Ad",
|
413
|
+
# "target_expiry_date": "2023-12-28",
|
414
|
+
# "description": "Extending credit validity"
|
415
|
+
# }
|
416
|
+
# ```
|
417
|
+
#
|
418
|
+
# ## Voiding credits
|
419
|
+
#
|
420
|
+
# If you'd like to void a credit block, create a ledger entry of type `void`. For
|
421
|
+
# this entry, `block_id` is required to identify the block, and `amount` indicates
|
422
|
+
# how many credits to void, up to the block's initial balance. Pass in a
|
423
|
+
# `void_reason` of `refund` if the void is due to a refund.
|
424
|
+
#
|
425
|
+
# ## Amendment
|
426
|
+
#
|
427
|
+
# If you'd like to undo a decrement on a credit block, create a ledger entry of
|
428
|
+
# type `amendment`. For this entry, `block_id` is required to identify the block
|
429
|
+
# that was originally decremented from, and `amount` indicates how many credits to
|
430
|
+
# return to the customer, up to the block's initial balance.
|
431
|
+
sig do
|
432
|
+
params(
|
433
|
+
external_customer_id: String,
|
434
|
+
amount: Float,
|
435
|
+
entry_type: Orb::Models::Customers::Credits::LedgerCreateEntryByExternalIDParams::EntryType::OrSymbol,
|
436
|
+
expiry_date: T.nilable(Time),
|
437
|
+
target_expiry_date: Date,
|
438
|
+
block_id: String,
|
439
|
+
currency: T.nilable(String),
|
440
|
+
description: T.nilable(String),
|
441
|
+
effective_date: T.nilable(Time),
|
442
|
+
invoice_settings: T.nilable(
|
443
|
+
T.any(
|
444
|
+
Orb::Models::Customers::Credits::LedgerCreateEntryByExternalIDParams::InvoiceSettings,
|
445
|
+
Orb::Util::AnyHash
|
446
|
+
)
|
447
|
+
),
|
448
|
+
metadata: T.nilable(T::Hash[Symbol, T.nilable(String)]),
|
449
|
+
per_unit_cost_basis: T.nilable(String),
|
450
|
+
void_reason: T.nilable(Orb::Models::Customers::Credits::LedgerCreateEntryByExternalIDParams::VoidReason::OrSymbol),
|
451
|
+
request_options: T.nilable(T.any(Orb::RequestOptions, Orb::Util::AnyHash))
|
452
|
+
)
|
453
|
+
.returns(
|
454
|
+
T.any(
|
455
|
+
Orb::Models::Customers::Credits::LedgerCreateEntryByExternalIDResponse::IncrementLedgerEntry,
|
456
|
+
Orb::Models::Customers::Credits::LedgerCreateEntryByExternalIDResponse::DecrementLedgerEntry,
|
457
|
+
Orb::Models::Customers::Credits::LedgerCreateEntryByExternalIDResponse::ExpirationChangeLedgerEntry,
|
458
|
+
Orb::Models::Customers::Credits::LedgerCreateEntryByExternalIDResponse::CreditBlockExpiryLedgerEntry,
|
459
|
+
Orb::Models::Customers::Credits::LedgerCreateEntryByExternalIDResponse::VoidLedgerEntry,
|
460
|
+
Orb::Models::Customers::Credits::LedgerCreateEntryByExternalIDResponse::VoidInitiatedLedgerEntry,
|
461
|
+
Orb::Models::Customers::Credits::LedgerCreateEntryByExternalIDResponse::AmendmentLedgerEntry
|
462
|
+
)
|
463
|
+
)
|
464
|
+
end
|
465
|
+
def create_entry_by_external_id(
|
466
|
+
external_customer_id,
|
467
|
+
# The number of credits to effect. Note that this is required for increment,
|
468
|
+
# decrement or void operations.
|
469
|
+
amount:,
|
470
|
+
entry_type:,
|
471
|
+
# An ISO 8601 format date that identifies the origination credit block to expire
|
472
|
+
expiry_date:,
|
473
|
+
# A future date (specified in YYYY-MM-DD format) used for expiration change,
|
474
|
+
# denoting when credits transferred (as part of a partial block expiration) should
|
475
|
+
# expire.
|
476
|
+
target_expiry_date:,
|
477
|
+
# The ID of the block to reverse a decrement from.
|
478
|
+
block_id:,
|
479
|
+
# The currency or custom pricing unit to use for this ledger entry. If this is a
|
480
|
+
# real-world currency, it must match the customer's invoicing currency.
|
481
|
+
currency: nil,
|
482
|
+
# Optional metadata that can be specified when adding ledger results via the API.
|
483
|
+
# For example, this can be used to note an increment refers to trial credits, or
|
484
|
+
# for noting corrections as a result of an incident, etc.
|
485
|
+
description: nil,
|
486
|
+
# An ISO 8601 format date that denotes when this credit balance should become
|
487
|
+
# available for use.
|
488
|
+
effective_date: nil,
|
489
|
+
# Passing `invoice_settings` automatically generates an invoice for the newly
|
490
|
+
# added credits. If `invoice_settings` is passed, you must specify
|
491
|
+
# per_unit_cost_basis, as the calculation of the invoice total is done on that
|
492
|
+
# basis.
|
493
|
+
invoice_settings: nil,
|
494
|
+
# User-specified key/value pairs for the resource. Individual keys can be removed
|
495
|
+
# by setting the value to `null`, and the entire metadata mapping can be cleared
|
496
|
+
# by setting `metadata` to `null`.
|
497
|
+
metadata: nil,
|
498
|
+
# Can only be specified when entry_type=increment. How much, in the customer's
|
499
|
+
# currency, a customer paid for a single credit in this block
|
500
|
+
per_unit_cost_basis: nil,
|
501
|
+
# Can only be specified when `entry_type=void`. The reason for the void.
|
502
|
+
void_reason: nil,
|
503
|
+
request_options: {}
|
504
|
+
)
|
505
|
+
end
|
506
|
+
|
507
|
+
# The credits ledger provides _auditing_ functionality over Orb's credits system
|
508
|
+
# with a list of actions that have taken place to modify a customer's credit
|
509
|
+
# balance. This [paginated endpoint](/api-reference/pagination) lists these
|
510
|
+
# entries, starting from the most recent ledger entry.
|
511
|
+
#
|
512
|
+
# More details on using Orb's real-time credit feature are
|
513
|
+
# [here](/product-catalog/prepurchase).
|
514
|
+
#
|
515
|
+
# There are four major types of modifications to credit balance, detailed below.
|
516
|
+
#
|
517
|
+
# ## Increment
|
518
|
+
#
|
519
|
+
# Credits (which optionally expire on a future date) can be added via the API
|
520
|
+
# ([Add Ledger Entry](create-ledger-entry)). The ledger entry for such an action
|
521
|
+
# will always contain the total eligible starting and ending balance for the
|
522
|
+
# customer at the time the entry was added to the ledger.
|
523
|
+
#
|
524
|
+
# ## Decrement
|
525
|
+
#
|
526
|
+
# Deductions can occur as a result of an API call to create a ledger entry (see
|
527
|
+
# [Add Ledger Entry](create-ledger-entry)), or automatically as a result of
|
528
|
+
# incurring usage. Both ledger entries present the `decrement` entry type.
|
529
|
+
#
|
530
|
+
# As usage for a customer is reported into Orb, credits may be deducted according
|
531
|
+
# to the customer's plan configuration. An automated deduction of this type will
|
532
|
+
# result in a ledger entry, also with a starting and ending balance. In order to
|
533
|
+
# provide better tracing capabilities for automatic deductions, Orb always
|
534
|
+
# associates each automatic deduction with the `event_id` at the time of
|
535
|
+
# ingestion, used to pinpoint _why_ credit deduction took place and to ensure that
|
536
|
+
# credits are never deducted without an associated usage event.
|
537
|
+
#
|
538
|
+
# By default, Orb uses an algorithm that automatically deducts from the _soonest
|
539
|
+
# expiring credit block_ first in order to ensure that all credits are utilized
|
540
|
+
# appropriately. As an example, if trial credits with an expiration date of 2
|
541
|
+
# weeks from now are present for a customer, they will be used before any
|
542
|
+
# deductions take place from a non-expiring credit block.
|
543
|
+
#
|
544
|
+
# If there are multiple blocks with the same expiration date, Orb will deduct from
|
545
|
+
# the block with the _lower cost basis_ first (e.g. trial credits with a $0 cost
|
546
|
+
# basis before paid credits with a $5.00 cost basis).
|
547
|
+
#
|
548
|
+
# It's also possible for a single usage event's deduction to _span_ credit blocks.
|
549
|
+
# In this case, Orb will deduct from the next block, ending at the credit block
|
550
|
+
# which consists of unexpiring credits. Each of these deductions will lead to a
|
551
|
+
# _separate_ ledger entry, one per credit block that is deducted from. By default,
|
552
|
+
# the customer's total credit balance in Orb can be negative as a result of a
|
553
|
+
# decrement.
|
554
|
+
#
|
555
|
+
# ## Expiration change
|
556
|
+
#
|
557
|
+
# The expiry of credits can be changed as a result of the API (See
|
558
|
+
# [Add Ledger Entry](create-ledger-entry)). This will create a ledger entry that
|
559
|
+
# specifies the balance as well as the initial and target expiry dates.
|
560
|
+
#
|
561
|
+
# Note that for this entry type, `starting_balance` will equal `ending_balance`,
|
562
|
+
# and the `amount` represents the balance transferred. The credit block linked to
|
563
|
+
# the ledger entry is the source credit block from which there was an expiration
|
564
|
+
# change
|
565
|
+
#
|
566
|
+
# ## Credits expiry
|
567
|
+
#
|
568
|
+
# When a set of credits expire on pre-set expiration date, the customer's balance
|
569
|
+
# automatically reflects this change and adds an entry to the ledger indicating
|
570
|
+
# this event. Note that credit expiry should always happen close to a date
|
571
|
+
# boundary in the customer's timezone.
|
572
|
+
#
|
573
|
+
# ## Void initiated
|
574
|
+
#
|
575
|
+
# Credit blocks can be voided via the API. The `amount` on this entry corresponds
|
576
|
+
# to the number of credits that were remaining in the block at time of void.
|
577
|
+
# `void_reason` will be populated if the void is created with a reason.
|
578
|
+
#
|
579
|
+
# ## Void
|
580
|
+
#
|
581
|
+
# When a set of credits is voided, the customer's balance automatically reflects
|
582
|
+
# this change and adds an entry to the ledger indicating this event.
|
583
|
+
#
|
584
|
+
# ## Amendment
|
585
|
+
#
|
586
|
+
# When credits are added to a customer's balance as a result of a correction, this
|
587
|
+
# entry will be added to the ledger to indicate the adjustment of credits.
|
588
|
+
sig do
|
589
|
+
params(
|
590
|
+
external_customer_id: String,
|
591
|
+
created_at_gt: T.nilable(Time),
|
592
|
+
created_at_gte: T.nilable(Time),
|
593
|
+
created_at_lt: T.nilable(Time),
|
594
|
+
created_at_lte: T.nilable(Time),
|
595
|
+
currency: T.nilable(String),
|
596
|
+
cursor: T.nilable(String),
|
597
|
+
entry_status: T.nilable(Orb::Models::Customers::Credits::LedgerListByExternalIDParams::EntryStatus::OrSymbol),
|
598
|
+
entry_type: T.nilable(Orb::Models::Customers::Credits::LedgerListByExternalIDParams::EntryType::OrSymbol),
|
599
|
+
limit: Integer,
|
600
|
+
minimum_amount: T.nilable(String),
|
601
|
+
request_options: T.nilable(T.any(Orb::RequestOptions, Orb::Util::AnyHash))
|
602
|
+
)
|
603
|
+
.returns(
|
604
|
+
Orb::Page[
|
605
|
+
T.any(
|
606
|
+
Orb::Models::Customers::Credits::LedgerListByExternalIDResponse::IncrementLedgerEntry,
|
607
|
+
Orb::Models::Customers::Credits::LedgerListByExternalIDResponse::DecrementLedgerEntry,
|
608
|
+
Orb::Models::Customers::Credits::LedgerListByExternalIDResponse::ExpirationChangeLedgerEntry,
|
609
|
+
Orb::Models::Customers::Credits::LedgerListByExternalIDResponse::CreditBlockExpiryLedgerEntry,
|
610
|
+
Orb::Models::Customers::Credits::LedgerListByExternalIDResponse::VoidLedgerEntry,
|
611
|
+
Orb::Models::Customers::Credits::LedgerListByExternalIDResponse::VoidInitiatedLedgerEntry,
|
612
|
+
Orb::Models::Customers::Credits::LedgerListByExternalIDResponse::AmendmentLedgerEntry
|
613
|
+
)
|
614
|
+
]
|
615
|
+
)
|
616
|
+
end
|
617
|
+
def list_by_external_id(
|
618
|
+
external_customer_id,
|
619
|
+
created_at_gt: nil,
|
620
|
+
created_at_gte: nil,
|
621
|
+
created_at_lt: nil,
|
622
|
+
created_at_lte: nil,
|
623
|
+
# The ledger currency or custom pricing unit to use.
|
624
|
+
currency: nil,
|
625
|
+
# Cursor for pagination. This can be populated by the `next_cursor` value returned
|
626
|
+
# from the initial request.
|
627
|
+
cursor: nil,
|
628
|
+
entry_status: nil,
|
629
|
+
entry_type: nil,
|
630
|
+
# The number of items to fetch. Defaults to 20.
|
631
|
+
limit: nil,
|
632
|
+
minimum_amount: nil,
|
633
|
+
request_options: {}
|
634
|
+
)
|
635
|
+
end
|
636
|
+
|
637
|
+
# @api private
|
638
|
+
sig { params(client: Orb::Client).returns(T.attached_class) }
|
639
|
+
def self.new(client:)
|
640
|
+
end
|
641
|
+
end
|
642
|
+
end
|
643
|
+
end
|
644
|
+
end
|
645
|
+
end
|