orb-billing 1.57.0 → 1.59.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/README.md +1 -1
- data/lib/orb/client.rb +0 -8
- data/lib/orb/models/invoice_list_params.rb +12 -11
- data/lib/orb/models/invoice_list_summary_params.rb +12 -11
- data/lib/orb/models/invoice_status_filter.rb +18 -0
- data/lib/orb/models/migration_create_params.rb +10 -1
- data/lib/orb/models/{beta_create_plan_version_params.rb → plan_create_plan_version_params.rb} +430 -430
- data/lib/orb/models/{beta_fetch_plan_version_params.rb → plan_fetch_plan_version_params.rb} +2 -2
- data/lib/orb/models/{beta_set_default_plan_version_params.rb → plan_set_default_plan_version_params.rb} +2 -2
- data/lib/orb/models/plan_version.rb +1 -1
- data/lib/orb/models/plans/draft_discard_params.rb +22 -0
- data/lib/orb/models/plans/draft_fetch_params.rb +22 -0
- data/lib/orb/models/plans/draft_publish_params.rb +31 -0
- data/lib/orb/models/plans/draft_save_params.rb +7522 -0
- data/lib/orb/models/plans/external_plan_id/draft_discard_params.rb +24 -0
- data/lib/orb/models/plans/external_plan_id/draft_fetch_params.rb +24 -0
- data/lib/orb/models/plans/external_plan_id/draft_publish_params.rb +33 -0
- data/lib/orb/models/plans/external_plan_id/draft_save_params.rb +7595 -0
- data/lib/orb/models/{beta → plans}/external_plan_id_create_plan_version_params.rb +430 -430
- data/lib/orb/models/{beta → plans}/external_plan_id_fetch_plan_version_params.rb +2 -2
- data/lib/orb/models/{beta → plans}/external_plan_id_set_default_plan_version_params.rb +2 -2
- data/lib/orb/models/plans/plan_version_draft.rb +279 -0
- data/lib/orb/models/subscription_list_params.rb +52 -15
- data/lib/orb/models/subscription_list_summary_params.rb +50 -15
- data/lib/orb/models/subscription_status_filter.rb +16 -0
- data/lib/orb/models.rb +10 -8
- data/lib/orb/resources/customers/credits/ledger.rb +56 -0
- data/lib/orb/resources/invoices.rb +16 -2
- data/lib/orb/resources/migrations.rb +3 -1
- data/lib/orb/resources/plans/draft.rb +124 -0
- data/lib/orb/resources/plans/external_plan_id/draft.rb +126 -0
- data/lib/orb/resources/plans/external_plan_id.rb +96 -0
- data/lib/orb/resources/plans.rb +96 -0
- data/lib/orb/resources/subscriptions.rb +6 -6
- data/lib/orb/version.rb +1 -1
- data/lib/orb.rb +19 -8
- data/rbi/orb/client.rbi +0 -7
- data/rbi/orb/models/invoice_list_params.rbi +37 -17
- data/rbi/orb/models/invoice_list_summary_params.rbi +38 -18
- data/rbi/orb/models/invoice_status_filter.rbi +22 -0
- data/rbi/orb/models/migration_create_params.rbi +13 -0
- data/rbi/orb/models/{beta_create_plan_version_params.rbi → plan_create_plan_version_params.rbi} +744 -744
- data/rbi/orb/models/{beta_fetch_plan_version_params.rbi → plan_fetch_plan_version_params.rbi} +2 -2
- data/rbi/orb/models/{beta_set_default_plan_version_params.rbi → plan_set_default_plan_version_params.rbi} +2 -2
- data/rbi/orb/models/plans/draft_discard_params.rbi +37 -0
- data/rbi/orb/models/plans/draft_fetch_params.rbi +37 -0
- data/rbi/orb/models/plans/draft_publish_params.rbi +54 -0
- data/rbi/orb/models/plans/draft_save_params.rbi +13143 -0
- data/rbi/orb/models/plans/external_plan_id/draft_discard_params.rbi +42 -0
- data/rbi/orb/models/plans/external_plan_id/draft_fetch_params.rbi +42 -0
- data/rbi/orb/models/plans/external_plan_id/draft_publish_params.rbi +59 -0
- data/rbi/orb/models/plans/external_plan_id/draft_save_params.rbi +13256 -0
- data/rbi/orb/models/{beta → plans}/external_plan_id_create_plan_version_params.rbi +744 -744
- data/rbi/orb/models/{beta → plans}/external_plan_id_fetch_plan_version_params.rbi +2 -2
- data/rbi/orb/models/{beta → plans}/external_plan_id_set_default_plan_version_params.rbi +2 -2
- data/rbi/orb/models/plans/plan_version_draft.rbi +502 -0
- data/rbi/orb/models/subscription_list_params.rbi +100 -21
- data/rbi/orb/models/subscription_list_summary_params.rbi +99 -28
- data/rbi/orb/models/subscription_status_filter.rbi +23 -0
- data/rbi/orb/models.rbi +10 -8
- data/rbi/orb/resources/customers/credits/ledger.rbi +56 -0
- data/rbi/orb/resources/invoices.rbi +28 -2
- data/rbi/orb/resources/migrations.rbi +4 -0
- data/rbi/orb/resources/{beta/external_plan_id.rbi → plans/draft.rbi} +58 -59
- data/rbi/orb/resources/plans/external_plan_id/draft.rbi +126 -0
- data/rbi/orb/resources/plans/external_plan_id.rbi +102 -0
- data/rbi/orb/resources/plans.rbi +94 -0
- data/rbi/orb/resources/subscriptions.rbi +25 -6
- data/sig/orb/client.rbs +0 -2
- data/sig/orb/models/invoice_list_params.rbs +10 -12
- data/sig/orb/models/invoice_list_summary_params.rbs +6 -8
- data/sig/orb/models/invoice_status_filter.rbs +17 -0
- data/sig/orb/models/migration_create_params.rbs +7 -0
- data/sig/orb/models/{beta_create_plan_version_params.rbs → plan_create_plan_version_params.rbs} +448 -448
- data/sig/orb/models/{beta_fetch_plan_version_params.rbs → plan_fetch_plan_version_params.rbs} +2 -2
- data/sig/orb/models/{beta_set_default_plan_version_params.rbs → plan_set_default_plan_version_params.rbs} +2 -2
- data/sig/orb/models/plans/draft_discard_params.rbs +25 -0
- data/sig/orb/models/plans/draft_fetch_params.rbs +25 -0
- data/sig/orb/models/plans/draft_publish_params.rbs +32 -0
- data/sig/orb/models/plans/draft_save_params.rbs +5210 -0
- data/sig/orb/models/plans/external_plan_id/draft_discard_params.rbs +27 -0
- data/sig/orb/models/plans/external_plan_id/draft_fetch_params.rbs +27 -0
- data/sig/orb/models/plans/external_plan_id/draft_publish_params.rbs +34 -0
- data/sig/orb/models/plans/external_plan_id/draft_save_params.rbs +5215 -0
- data/sig/orb/models/{beta → plans}/external_plan_id_create_plan_version_params.rbs +447 -447
- data/sig/orb/models/{beta → plans}/external_plan_id_fetch_plan_version_params.rbs +1 -1
- data/sig/orb/models/{beta → plans}/external_plan_id_set_default_plan_version_params.rbs +1 -1
- data/sig/orb/models/plans/plan_version_draft.rbs +205 -0
- data/sig/orb/models/subscription_list_params.rbs +34 -14
- data/sig/orb/models/subscription_list_summary_params.rbs +34 -14
- data/sig/orb/models/subscription_status_filter.rbs +15 -0
- data/sig/orb/models.rbs +10 -8
- data/sig/orb/resources/invoices.rbs +1 -1
- data/sig/orb/resources/migrations.rbs +1 -0
- data/sig/orb/resources/plans/draft.rbs +37 -0
- data/sig/orb/resources/plans/external_plan_id/draft.rbs +39 -0
- data/sig/orb/resources/plans/external_plan_id.rbs +27 -0
- data/sig/orb/resources/plans.rbs +27 -0
- data/sig/orb/resources/subscriptions.rbs +4 -4
- metadata +2044 -2005
- data/lib/orb/resources/beta/external_plan_id.rb +0 -108
- data/lib/orb/resources/beta.rb +0 -114
- data/rbi/orb/resources/beta.rbi +0 -110
- data/sig/orb/resources/beta/external_plan_id.rbs +0 -34
- data/sig/orb/resources/beta.rbs +0 -34
|
@@ -150,7 +150,7 @@ module Orb
|
|
|
150
150
|
#
|
|
151
151
|
# @param limit [Integer] The number of items to fetch. Defaults to 20.
|
|
152
152
|
#
|
|
153
|
-
# @param status [Array<Symbol, Orb::Models::
|
|
153
|
+
# @param status [Symbol, Orb::Models::InvoiceStatusFilter, Array<Symbol, Orb::Models::InvoiceStatusFilter>, nil]
|
|
154
154
|
#
|
|
155
155
|
# @param subscription_id [String, nil]
|
|
156
156
|
#
|
|
@@ -392,7 +392,7 @@ module Orb
|
|
|
392
392
|
#
|
|
393
393
|
# @param limit [Integer] The number of items to fetch. Defaults to 20.
|
|
394
394
|
#
|
|
395
|
-
# @param status [Symbol, Orb::Models::
|
|
395
|
+
# @param status [Symbol, Orb::Models::InvoiceStatusFilter, Array<Symbol, Orb::Models::InvoiceStatusFilter>, nil]
|
|
396
396
|
#
|
|
397
397
|
# @param subscription_id [String, nil]
|
|
398
398
|
#
|
|
@@ -457,6 +457,20 @@ module Orb
|
|
|
457
457
|
# be provided to pay using agent-granted credentials instead. This action can only
|
|
458
458
|
# be taken on invoices with status "issued".
|
|
459
459
|
#
|
|
460
|
+
# A `200` response means Orb attempted the charge, not that the payment succeeded.
|
|
461
|
+
# A declined card still returns `200`. To check the outcome, read the returned
|
|
462
|
+
# invoice:
|
|
463
|
+
#
|
|
464
|
+
# - `status` is `paid` if the payment succeeded. It stays `issued` if the payment
|
|
465
|
+
# failed or is still processing.
|
|
466
|
+
# - The newest entry in `payment_attempts` has `succeeded: true` only if the
|
|
467
|
+
# charge went through.
|
|
468
|
+
#
|
|
469
|
+
# Some payment methods (such as ACH debits) settle asynchronously, so the outcome
|
|
470
|
+
# may not be known when this endpoint returns. Listen for the
|
|
471
|
+
# `invoice.payment_succeeded` and `invoice.payment_failed` webhooks to get the
|
|
472
|
+
# final result.
|
|
473
|
+
#
|
|
460
474
|
# @overload pay(invoice_id, shared_payment_token_id: nil, request_options: {})
|
|
461
475
|
#
|
|
462
476
|
# @param invoice_id [String]
|
|
@@ -21,7 +21,7 @@ module Orb
|
|
|
21
21
|
# filters. Each subscription is migrated asynchronously; fetch the migration to
|
|
22
22
|
# follow its status.
|
|
23
23
|
#
|
|
24
|
-
# @overload create(effective_time:, target_plan_version_number:, allow_invoice_credit_or_void: nil, can_defer_billing: nil, effective_date: nil, excluded_subscription_ids: nil, external_plan_id: nil, in_trial: nil, included_subscription_ids: nil, plan_id: nil, plan_version_numbers: nil, reason: nil, statuses: nil, request_options: {})
|
|
24
|
+
# @overload create(effective_time:, target_plan_version_number:, allow_invoice_credit_or_void: nil, can_defer_billing: nil, effective_date: nil, excluded_subscription_ids: nil, external_plan_id: nil, in_trial: nil, included_subscription_ids: nil, plan_id: nil, plan_version_numbers: nil, reason: nil, skip_grace_period: nil, statuses: nil, request_options: {})
|
|
25
25
|
#
|
|
26
26
|
# @param effective_time [Symbol, Orb::Models::MigrationCreateParams::EffectiveTime] When the migration takes effect: 'immediately', 'requested_date' on `effective_d
|
|
27
27
|
#
|
|
@@ -48,6 +48,8 @@ module Orb
|
|
|
48
48
|
#
|
|
49
49
|
# @param reason [String, nil] Why the migration was created.
|
|
50
50
|
#
|
|
51
|
+
# @param skip_grace_period [Boolean] A new migration waits 5 minutes before it changes any subscriptions, so it can b
|
|
52
|
+
#
|
|
51
53
|
# @param statuses [Array<Symbol, Orb::Models::MigrationCreateParams::Status>] Migrate subscriptions with these statuses. Defaults to active subscriptions.
|
|
52
54
|
#
|
|
53
55
|
# @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Orb
|
|
4
|
+
module Resources
|
|
5
|
+
class Plans
|
|
6
|
+
# The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be
|
|
7
|
+
# subscribed to by a customer. Plans define the billing behavior of the
|
|
8
|
+
# subscription. You can see more about how to configure prices in the
|
|
9
|
+
# [Price resource](/reference/price).
|
|
10
|
+
class Draft
|
|
11
|
+
# This endpoint discards the plan's draft version. Prices and adjustments the
|
|
12
|
+
# draft created stay in the Pricebook.
|
|
13
|
+
#
|
|
14
|
+
# @overload discard(plan_id, request_options: {})
|
|
15
|
+
#
|
|
16
|
+
# @param plan_id [String]
|
|
17
|
+
# @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
18
|
+
#
|
|
19
|
+
# @return [nil]
|
|
20
|
+
#
|
|
21
|
+
# @see Orb::Models::Plans::DraftDiscardParams
|
|
22
|
+
def discard(plan_id, params = {})
|
|
23
|
+
@client.request(
|
|
24
|
+
method: :delete,
|
|
25
|
+
path: ["plans/%1$s/draft", plan_id],
|
|
26
|
+
model: NilClass,
|
|
27
|
+
options: params[:request_options]
|
|
28
|
+
)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# This endpoint returns the plan's unpublished draft version, with its changes
|
|
32
|
+
# applied on top of the latest published version. It returns a 404 if the plan has
|
|
33
|
+
# no draft.
|
|
34
|
+
#
|
|
35
|
+
# @overload fetch(plan_id, request_options: {})
|
|
36
|
+
#
|
|
37
|
+
# @param plan_id [String]
|
|
38
|
+
# @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
39
|
+
#
|
|
40
|
+
# @return [Orb::Models::Plans::PlanVersionDraft]
|
|
41
|
+
#
|
|
42
|
+
# @see Orb::Models::Plans::DraftFetchParams
|
|
43
|
+
def fetch(plan_id, params = {})
|
|
44
|
+
@client.request(
|
|
45
|
+
method: :get,
|
|
46
|
+
path: ["plans/%1$s/draft", plan_id],
|
|
47
|
+
model: Orb::Plans::PlanVersionDraft,
|
|
48
|
+
options: params[:request_options]
|
|
49
|
+
)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# This endpoint publishes the plan's draft as the next numbered version. A draft
|
|
53
|
+
# that fails plan version validation is a 400 and is left as it was.
|
|
54
|
+
#
|
|
55
|
+
# @overload publish(plan_id, set_as_default: nil, request_options: {})
|
|
56
|
+
#
|
|
57
|
+
# @param plan_id [String]
|
|
58
|
+
#
|
|
59
|
+
# @param set_as_default [Boolean] Also make the new version the plan's default.
|
|
60
|
+
#
|
|
61
|
+
# @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
62
|
+
#
|
|
63
|
+
# @return [Orb::Models::PlanVersion]
|
|
64
|
+
#
|
|
65
|
+
# @see Orb::Models::Plans::DraftPublishParams
|
|
66
|
+
def publish(plan_id, params = {})
|
|
67
|
+
parsed, options = Orb::Plans::DraftPublishParams.dump_request(params)
|
|
68
|
+
@client.request(
|
|
69
|
+
method: :post,
|
|
70
|
+
path: ["plans/%1$s/draft/publish", plan_id],
|
|
71
|
+
body: parsed,
|
|
72
|
+
model: Orb::PlanVersion,
|
|
73
|
+
options: options
|
|
74
|
+
)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# This endpoint creates the plan's draft version or fully replaces its changes.
|
|
78
|
+
# The changes are always relative to the latest published version. A save replaces
|
|
79
|
+
# the draft; last write wins.
|
|
80
|
+
#
|
|
81
|
+
# @overload save(plan_id, add_adjustments: nil, add_prices: nil, description: nil, remove_adjustments: nil, remove_prices: nil, replace_adjustments: nil, replace_prices: nil, request_options: {})
|
|
82
|
+
#
|
|
83
|
+
# @param plan_id [String]
|
|
84
|
+
#
|
|
85
|
+
# @param add_adjustments [Array<Orb::Models::Plans::DraftSaveParams::AddAdjustment>, nil] Additional adjustments to be added to the plan.
|
|
86
|
+
#
|
|
87
|
+
# @param add_prices [Array<Orb::Models::Plans::DraftSaveParams::AddPrice>, nil] Additional prices to be added to the plan.
|
|
88
|
+
#
|
|
89
|
+
# @param description [String, nil] Optional description of what changes in this draft
|
|
90
|
+
#
|
|
91
|
+
# @param remove_adjustments [Array<Orb::Models::Plans::DraftSaveParams::RemoveAdjustment>, nil] Adjustments to be removed from the plan.
|
|
92
|
+
#
|
|
93
|
+
# @param remove_prices [Array<Orb::Models::Plans::DraftSaveParams::RemovePrice>, nil] Prices to be removed from the plan.
|
|
94
|
+
#
|
|
95
|
+
# @param replace_adjustments [Array<Orb::Models::Plans::DraftSaveParams::ReplaceAdjustment>, nil] Adjustments to be replaced with additional adjustments on the plan.
|
|
96
|
+
#
|
|
97
|
+
# @param replace_prices [Array<Orb::Models::Plans::DraftSaveParams::ReplacePrice>, nil] Prices to be replaced with additional prices on the plan.
|
|
98
|
+
#
|
|
99
|
+
# @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
100
|
+
#
|
|
101
|
+
# @return [Orb::Models::Plans::PlanVersionDraft]
|
|
102
|
+
#
|
|
103
|
+
# @see Orb::Models::Plans::DraftSaveParams
|
|
104
|
+
def save(plan_id, params = {})
|
|
105
|
+
parsed, options = Orb::Plans::DraftSaveParams.dump_request(params)
|
|
106
|
+
@client.request(
|
|
107
|
+
method: :put,
|
|
108
|
+
path: ["plans/%1$s/draft", plan_id],
|
|
109
|
+
body: parsed,
|
|
110
|
+
model: Orb::Plans::PlanVersionDraft,
|
|
111
|
+
options: options
|
|
112
|
+
)
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# @api private
|
|
116
|
+
#
|
|
117
|
+
# @param client [Orb::Client]
|
|
118
|
+
def initialize(client:)
|
|
119
|
+
@client = client
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
end
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Orb
|
|
4
|
+
module Resources
|
|
5
|
+
class Plans
|
|
6
|
+
class ExternalPlanID
|
|
7
|
+
# The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be
|
|
8
|
+
# subscribed to by a customer. Plans define the billing behavior of the
|
|
9
|
+
# subscription. You can see more about how to configure prices in the
|
|
10
|
+
# [Price resource](/reference/price).
|
|
11
|
+
class Draft
|
|
12
|
+
# This endpoint discards the plan's draft version. Prices and adjustments the
|
|
13
|
+
# draft created stay in the Pricebook.
|
|
14
|
+
#
|
|
15
|
+
# @overload discard(external_plan_id, request_options: {})
|
|
16
|
+
#
|
|
17
|
+
# @param external_plan_id [String]
|
|
18
|
+
# @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
19
|
+
#
|
|
20
|
+
# @return [nil]
|
|
21
|
+
#
|
|
22
|
+
# @see Orb::Models::Plans::ExternalPlanID::DraftDiscardParams
|
|
23
|
+
def discard(external_plan_id, params = {})
|
|
24
|
+
@client.request(
|
|
25
|
+
method: :delete,
|
|
26
|
+
path: ["plans/external_plan_id/%1$s/draft", external_plan_id],
|
|
27
|
+
model: NilClass,
|
|
28
|
+
options: params[:request_options]
|
|
29
|
+
)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# This endpoint returns the plan's unpublished draft version, with its changes
|
|
33
|
+
# applied on top of the latest published version. It returns a 404 if the plan has
|
|
34
|
+
# no draft.
|
|
35
|
+
#
|
|
36
|
+
# @overload fetch(external_plan_id, request_options: {})
|
|
37
|
+
#
|
|
38
|
+
# @param external_plan_id [String]
|
|
39
|
+
# @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
40
|
+
#
|
|
41
|
+
# @return [Orb::Models::Plans::PlanVersionDraft]
|
|
42
|
+
#
|
|
43
|
+
# @see Orb::Models::Plans::ExternalPlanID::DraftFetchParams
|
|
44
|
+
def fetch(external_plan_id, params = {})
|
|
45
|
+
@client.request(
|
|
46
|
+
method: :get,
|
|
47
|
+
path: ["plans/external_plan_id/%1$s/draft", external_plan_id],
|
|
48
|
+
model: Orb::Plans::PlanVersionDraft,
|
|
49
|
+
options: params[:request_options]
|
|
50
|
+
)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# This endpoint publishes the plan's draft as the next numbered version. A draft
|
|
54
|
+
# that fails plan version validation is a 400 and is left as it was.
|
|
55
|
+
#
|
|
56
|
+
# @overload publish(external_plan_id, set_as_default: nil, request_options: {})
|
|
57
|
+
#
|
|
58
|
+
# @param external_plan_id [String]
|
|
59
|
+
#
|
|
60
|
+
# @param set_as_default [Boolean] Also make the new version the plan's default.
|
|
61
|
+
#
|
|
62
|
+
# @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
63
|
+
#
|
|
64
|
+
# @return [Orb::Models::PlanVersion]
|
|
65
|
+
#
|
|
66
|
+
# @see Orb::Models::Plans::ExternalPlanID::DraftPublishParams
|
|
67
|
+
def publish(external_plan_id, params = {})
|
|
68
|
+
parsed, options = Orb::Plans::ExternalPlanID::DraftPublishParams.dump_request(params)
|
|
69
|
+
@client.request(
|
|
70
|
+
method: :post,
|
|
71
|
+
path: ["plans/external_plan_id/%1$s/draft/publish", external_plan_id],
|
|
72
|
+
body: parsed,
|
|
73
|
+
model: Orb::PlanVersion,
|
|
74
|
+
options: options
|
|
75
|
+
)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# This endpoint creates the plan's draft version or fully replaces its changes.
|
|
79
|
+
# The changes are always relative to the latest published version. A save replaces
|
|
80
|
+
# the draft; last write wins.
|
|
81
|
+
#
|
|
82
|
+
# @overload save(external_plan_id, add_adjustments: nil, add_prices: nil, description: nil, remove_adjustments: nil, remove_prices: nil, replace_adjustments: nil, replace_prices: nil, request_options: {})
|
|
83
|
+
#
|
|
84
|
+
# @param external_plan_id [String]
|
|
85
|
+
#
|
|
86
|
+
# @param add_adjustments [Array<Orb::Models::Plans::ExternalPlanID::DraftSaveParams::AddAdjustment>, nil] Additional adjustments to be added to the plan.
|
|
87
|
+
#
|
|
88
|
+
# @param add_prices [Array<Orb::Models::Plans::ExternalPlanID::DraftSaveParams::AddPrice>, nil] Additional prices to be added to the plan.
|
|
89
|
+
#
|
|
90
|
+
# @param description [String, nil] Optional description of what changes in this draft
|
|
91
|
+
#
|
|
92
|
+
# @param remove_adjustments [Array<Orb::Models::Plans::ExternalPlanID::DraftSaveParams::RemoveAdjustment>, nil] Adjustments to be removed from the plan.
|
|
93
|
+
#
|
|
94
|
+
# @param remove_prices [Array<Orb::Models::Plans::ExternalPlanID::DraftSaveParams::RemovePrice>, nil] Prices to be removed from the plan.
|
|
95
|
+
#
|
|
96
|
+
# @param replace_adjustments [Array<Orb::Models::Plans::ExternalPlanID::DraftSaveParams::ReplaceAdjustment>, nil] Adjustments to be replaced with additional adjustments on the plan.
|
|
97
|
+
#
|
|
98
|
+
# @param replace_prices [Array<Orb::Models::Plans::ExternalPlanID::DraftSaveParams::ReplacePrice>, nil] Prices to be replaced with additional prices on the plan.
|
|
99
|
+
#
|
|
100
|
+
# @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
101
|
+
#
|
|
102
|
+
# @return [Orb::Models::Plans::PlanVersionDraft]
|
|
103
|
+
#
|
|
104
|
+
# @see Orb::Models::Plans::ExternalPlanID::DraftSaveParams
|
|
105
|
+
def save(external_plan_id, params = {})
|
|
106
|
+
parsed, options = Orb::Plans::ExternalPlanID::DraftSaveParams.dump_request(params)
|
|
107
|
+
@client.request(
|
|
108
|
+
method: :put,
|
|
109
|
+
path: ["plans/external_plan_id/%1$s/draft", external_plan_id],
|
|
110
|
+
body: parsed,
|
|
111
|
+
model: Orb::Plans::PlanVersionDraft,
|
|
112
|
+
options: options
|
|
113
|
+
)
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# @api private
|
|
117
|
+
#
|
|
118
|
+
# @param client [Orb::Client]
|
|
119
|
+
def initialize(client:)
|
|
120
|
+
@client = client
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
end
|
|
@@ -8,6 +8,13 @@ module Orb
|
|
|
8
8
|
# subscription. You can see more about how to configure prices in the
|
|
9
9
|
# [Price resource](/reference/price).
|
|
10
10
|
class ExternalPlanID
|
|
11
|
+
# The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be
|
|
12
|
+
# subscribed to by a customer. Plans define the billing behavior of the
|
|
13
|
+
# subscription. You can see more about how to configure prices in the
|
|
14
|
+
# [Price resource](/reference/price).
|
|
15
|
+
# @return [Orb::Resources::Plans::ExternalPlanID::Draft]
|
|
16
|
+
attr_reader :draft
|
|
17
|
+
|
|
11
18
|
# Some parameter documentations has been truncated, see
|
|
12
19
|
# {Orb::Models::Plans::ExternalPlanIDUpdateParams} for more details.
|
|
13
20
|
#
|
|
@@ -45,6 +52,44 @@ module Orb
|
|
|
45
52
|
)
|
|
46
53
|
end
|
|
47
54
|
|
|
55
|
+
# This endpoint allows the creation of a new plan version for an existing plan.
|
|
56
|
+
#
|
|
57
|
+
# @overload create_plan_version(external_plan_id, version:, add_adjustments: nil, add_prices: nil, remove_adjustments: nil, remove_prices: nil, replace_adjustments: nil, replace_prices: nil, set_as_default: nil, request_options: {})
|
|
58
|
+
#
|
|
59
|
+
# @param external_plan_id [String]
|
|
60
|
+
#
|
|
61
|
+
# @param version [Integer] New version number.
|
|
62
|
+
#
|
|
63
|
+
# @param add_adjustments [Array<Orb::Models::Plans::ExternalPlanIDCreatePlanVersionParams::AddAdjustment>, nil] Additional adjustments to be added to the plan.
|
|
64
|
+
#
|
|
65
|
+
# @param add_prices [Array<Orb::Models::Plans::ExternalPlanIDCreatePlanVersionParams::AddPrice>, nil] Additional prices to be added to the plan.
|
|
66
|
+
#
|
|
67
|
+
# @param remove_adjustments [Array<Orb::Models::Plans::ExternalPlanIDCreatePlanVersionParams::RemoveAdjustment>, nil] Adjustments to be removed from the plan.
|
|
68
|
+
#
|
|
69
|
+
# @param remove_prices [Array<Orb::Models::Plans::ExternalPlanIDCreatePlanVersionParams::RemovePrice>, nil] Prices to be removed from the plan.
|
|
70
|
+
#
|
|
71
|
+
# @param replace_adjustments [Array<Orb::Models::Plans::ExternalPlanIDCreatePlanVersionParams::ReplaceAdjustment>, nil] Adjustments to be replaced with additional adjustments on the plan.
|
|
72
|
+
#
|
|
73
|
+
# @param replace_prices [Array<Orb::Models::Plans::ExternalPlanIDCreatePlanVersionParams::ReplacePrice>, nil] Prices to be replaced with additional prices on the plan.
|
|
74
|
+
#
|
|
75
|
+
# @param set_as_default [Boolean, nil] Set this new plan version as the default
|
|
76
|
+
#
|
|
77
|
+
# @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
78
|
+
#
|
|
79
|
+
# @return [Orb::Models::PlanVersion]
|
|
80
|
+
#
|
|
81
|
+
# @see Orb::Models::Plans::ExternalPlanIDCreatePlanVersionParams
|
|
82
|
+
def create_plan_version(external_plan_id, params)
|
|
83
|
+
parsed, options = Orb::Plans::ExternalPlanIDCreatePlanVersionParams.dump_request(params)
|
|
84
|
+
@client.request(
|
|
85
|
+
method: :post,
|
|
86
|
+
path: ["plans/external_plan_id/%1$s/versions", external_plan_id],
|
|
87
|
+
body: parsed,
|
|
88
|
+
model: Orb::PlanVersion,
|
|
89
|
+
options: options
|
|
90
|
+
)
|
|
91
|
+
end
|
|
92
|
+
|
|
48
93
|
# This endpoint is used to fetch [plan](/core-concepts##plan-and-price) details
|
|
49
94
|
# given an external_plan_id identifier. It returns information about the prices
|
|
50
95
|
# included in the plan and their configuration, as well as the product that the
|
|
@@ -79,11 +124,62 @@ module Orb
|
|
|
79
124
|
)
|
|
80
125
|
end
|
|
81
126
|
|
|
127
|
+
# This endpoint is used to fetch a plan version. It returns the phases, prices,
|
|
128
|
+
# and adjustments present on this version of the plan.
|
|
129
|
+
#
|
|
130
|
+
# @overload fetch_plan_version(version, external_plan_id:, request_options: {})
|
|
131
|
+
#
|
|
132
|
+
# @param version [String]
|
|
133
|
+
# @param external_plan_id [String]
|
|
134
|
+
# @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
135
|
+
#
|
|
136
|
+
# @return [Orb::Models::PlanVersion]
|
|
137
|
+
#
|
|
138
|
+
# @see Orb::Models::Plans::ExternalPlanIDFetchPlanVersionParams
|
|
139
|
+
def fetch_plan_version(version, params)
|
|
140
|
+
parsed, options = Orb::Plans::ExternalPlanIDFetchPlanVersionParams.dump_request(params)
|
|
141
|
+
external_plan_id =
|
|
142
|
+
parsed.delete(:external_plan_id) do
|
|
143
|
+
raise ArgumentError.new("missing required path argument #{_1}")
|
|
144
|
+
end
|
|
145
|
+
@client.request(
|
|
146
|
+
method: :get,
|
|
147
|
+
path: ["plans/external_plan_id/%1$s/versions/%2$s", external_plan_id, version],
|
|
148
|
+
model: Orb::PlanVersion,
|
|
149
|
+
options: options
|
|
150
|
+
)
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
# This endpoint allows setting the default version of a plan.
|
|
154
|
+
#
|
|
155
|
+
# @overload set_default_plan_version(external_plan_id, version:, request_options: {})
|
|
156
|
+
#
|
|
157
|
+
# @param external_plan_id [String]
|
|
158
|
+
#
|
|
159
|
+
# @param version [Integer] Plan version to set as the default.
|
|
160
|
+
#
|
|
161
|
+
# @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
162
|
+
#
|
|
163
|
+
# @return [Orb::Models::Plan]
|
|
164
|
+
#
|
|
165
|
+
# @see Orb::Models::Plans::ExternalPlanIDSetDefaultPlanVersionParams
|
|
166
|
+
def set_default_plan_version(external_plan_id, params)
|
|
167
|
+
parsed, options = Orb::Plans::ExternalPlanIDSetDefaultPlanVersionParams.dump_request(params)
|
|
168
|
+
@client.request(
|
|
169
|
+
method: :post,
|
|
170
|
+
path: ["plans/external_plan_id/%1$s/set_default_version", external_plan_id],
|
|
171
|
+
body: parsed,
|
|
172
|
+
model: Orb::Plan,
|
|
173
|
+
options: options
|
|
174
|
+
)
|
|
175
|
+
end
|
|
176
|
+
|
|
82
177
|
# @api private
|
|
83
178
|
#
|
|
84
179
|
# @param client [Orb::Client]
|
|
85
180
|
def initialize(client:)
|
|
86
181
|
@client = client
|
|
182
|
+
@draft = Orb::Resources::Plans::ExternalPlanID::Draft.new(client: client)
|
|
87
183
|
end
|
|
88
184
|
end
|
|
89
185
|
end
|
data/lib/orb/resources/plans.rb
CHANGED
|
@@ -14,6 +14,13 @@ module Orb
|
|
|
14
14
|
# @return [Orb::Resources::Plans::ExternalPlanID]
|
|
15
15
|
attr_reader :external_plan_id
|
|
16
16
|
|
|
17
|
+
# The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be
|
|
18
|
+
# subscribed to by a customer. Plans define the billing behavior of the
|
|
19
|
+
# subscription. You can see more about how to configure prices in the
|
|
20
|
+
# [Price resource](/reference/price).
|
|
21
|
+
# @return [Orb::Resources::Plans::Draft]
|
|
22
|
+
attr_reader :draft
|
|
23
|
+
|
|
17
24
|
# The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be
|
|
18
25
|
# subscribed to by a customer. Plans define the billing behavior of the
|
|
19
26
|
# subscription. You can see more about how to configure prices in the
|
|
@@ -145,6 +152,44 @@ module Orb
|
|
|
145
152
|
)
|
|
146
153
|
end
|
|
147
154
|
|
|
155
|
+
# This endpoint allows the creation of a new plan version for an existing plan.
|
|
156
|
+
#
|
|
157
|
+
# @overload create_plan_version(plan_id, version:, add_adjustments: nil, add_prices: nil, remove_adjustments: nil, remove_prices: nil, replace_adjustments: nil, replace_prices: nil, set_as_default: nil, request_options: {})
|
|
158
|
+
#
|
|
159
|
+
# @param plan_id [String]
|
|
160
|
+
#
|
|
161
|
+
# @param version [Integer] New version number.
|
|
162
|
+
#
|
|
163
|
+
# @param add_adjustments [Array<Orb::Models::PlanCreatePlanVersionParams::AddAdjustment>, nil] Additional adjustments to be added to the plan.
|
|
164
|
+
#
|
|
165
|
+
# @param add_prices [Array<Orb::Models::PlanCreatePlanVersionParams::AddPrice>, nil] Additional prices to be added to the plan.
|
|
166
|
+
#
|
|
167
|
+
# @param remove_adjustments [Array<Orb::Models::PlanCreatePlanVersionParams::RemoveAdjustment>, nil] Adjustments to be removed from the plan.
|
|
168
|
+
#
|
|
169
|
+
# @param remove_prices [Array<Orb::Models::PlanCreatePlanVersionParams::RemovePrice>, nil] Prices to be removed from the plan.
|
|
170
|
+
#
|
|
171
|
+
# @param replace_adjustments [Array<Orb::Models::PlanCreatePlanVersionParams::ReplaceAdjustment>, nil] Adjustments to be replaced with additional adjustments on the plan.
|
|
172
|
+
#
|
|
173
|
+
# @param replace_prices [Array<Orb::Models::PlanCreatePlanVersionParams::ReplacePrice>, nil] Prices to be replaced with additional prices on the plan.
|
|
174
|
+
#
|
|
175
|
+
# @param set_as_default [Boolean, nil] Set this new plan version as the default
|
|
176
|
+
#
|
|
177
|
+
# @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
178
|
+
#
|
|
179
|
+
# @return [Orb::Models::PlanVersion]
|
|
180
|
+
#
|
|
181
|
+
# @see Orb::Models::PlanCreatePlanVersionParams
|
|
182
|
+
def create_plan_version(plan_id, params)
|
|
183
|
+
parsed, options = Orb::PlanCreatePlanVersionParams.dump_request(params)
|
|
184
|
+
@client.request(
|
|
185
|
+
method: :post,
|
|
186
|
+
path: ["plans/%1$s/versions", plan_id],
|
|
187
|
+
body: parsed,
|
|
188
|
+
model: Orb::PlanVersion,
|
|
189
|
+
options: options
|
|
190
|
+
)
|
|
191
|
+
end
|
|
192
|
+
|
|
148
193
|
# This endpoint is used to fetch [plan](/core-concepts#plan-and-price) details
|
|
149
194
|
# given a plan identifier. It returns information about the prices included in the
|
|
150
195
|
# plan and their configuration, as well as the product that the plan is attached
|
|
@@ -180,12 +225,63 @@ module Orb
|
|
|
180
225
|
)
|
|
181
226
|
end
|
|
182
227
|
|
|
228
|
+
# This endpoint is used to fetch a plan version. It returns the phases, prices,
|
|
229
|
+
# and adjustments present on this version of the plan.
|
|
230
|
+
#
|
|
231
|
+
# @overload fetch_plan_version(version, plan_id:, request_options: {})
|
|
232
|
+
#
|
|
233
|
+
# @param version [String]
|
|
234
|
+
# @param plan_id [String]
|
|
235
|
+
# @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
236
|
+
#
|
|
237
|
+
# @return [Orb::Models::PlanVersion]
|
|
238
|
+
#
|
|
239
|
+
# @see Orb::Models::PlanFetchPlanVersionParams
|
|
240
|
+
def fetch_plan_version(version, params)
|
|
241
|
+
parsed, options = Orb::PlanFetchPlanVersionParams.dump_request(params)
|
|
242
|
+
plan_id =
|
|
243
|
+
parsed.delete(:plan_id) do
|
|
244
|
+
raise ArgumentError.new("missing required path argument #{_1}")
|
|
245
|
+
end
|
|
246
|
+
@client.request(
|
|
247
|
+
method: :get,
|
|
248
|
+
path: ["plans/%1$s/versions/%2$s", plan_id, version],
|
|
249
|
+
model: Orb::PlanVersion,
|
|
250
|
+
options: options
|
|
251
|
+
)
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
# This endpoint allows setting the default version of a plan.
|
|
255
|
+
#
|
|
256
|
+
# @overload set_default_plan_version(plan_id, version:, request_options: {})
|
|
257
|
+
#
|
|
258
|
+
# @param plan_id [String]
|
|
259
|
+
#
|
|
260
|
+
# @param version [Integer] Plan version to set as the default.
|
|
261
|
+
#
|
|
262
|
+
# @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
263
|
+
#
|
|
264
|
+
# @return [Orb::Models::Plan]
|
|
265
|
+
#
|
|
266
|
+
# @see Orb::Models::PlanSetDefaultPlanVersionParams
|
|
267
|
+
def set_default_plan_version(plan_id, params)
|
|
268
|
+
parsed, options = Orb::PlanSetDefaultPlanVersionParams.dump_request(params)
|
|
269
|
+
@client.request(
|
|
270
|
+
method: :post,
|
|
271
|
+
path: ["plans/%1$s/set_default_version", plan_id],
|
|
272
|
+
body: parsed,
|
|
273
|
+
model: Orb::Plan,
|
|
274
|
+
options: options
|
|
275
|
+
)
|
|
276
|
+
end
|
|
277
|
+
|
|
183
278
|
# @api private
|
|
184
279
|
#
|
|
185
280
|
# @param client [Orb::Client]
|
|
186
281
|
def initialize(client:)
|
|
187
282
|
@client = client
|
|
188
283
|
@external_plan_id = Orb::Resources::Plans::ExternalPlanID.new(client: client)
|
|
284
|
+
@draft = Orb::Resources::Plans::Draft.new(client: client)
|
|
189
285
|
@migrations = Orb::Resources::Plans::Migrations.new(client: client)
|
|
190
286
|
end
|
|
191
287
|
end
|
|
@@ -422,9 +422,9 @@ module Orb
|
|
|
422
422
|
#
|
|
423
423
|
# @param cursor [String, nil] Cursor for pagination. This can be populated by the `next_cursor` value returned
|
|
424
424
|
#
|
|
425
|
-
# @param customer_id [Array<String>, nil]
|
|
425
|
+
# @param customer_id [String, Array<String>, nil]
|
|
426
426
|
#
|
|
427
|
-
# @param external_customer_id [Array<String>, nil]
|
|
427
|
+
# @param external_customer_id [String, Array<String>, nil]
|
|
428
428
|
#
|
|
429
429
|
# @param external_plan_id [String, nil]
|
|
430
430
|
#
|
|
@@ -432,7 +432,7 @@ module Orb
|
|
|
432
432
|
#
|
|
433
433
|
# @param plan_id [String, nil]
|
|
434
434
|
#
|
|
435
|
-
# @param status [Symbol, Orb::Models::
|
|
435
|
+
# @param status [Symbol, Orb::Models::SubscriptionStatusFilter, Array<Symbol, Orb::Models::SubscriptionStatusFilter>, nil]
|
|
436
436
|
#
|
|
437
437
|
# @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
438
438
|
#
|
|
@@ -922,9 +922,9 @@ module Orb
|
|
|
922
922
|
#
|
|
923
923
|
# @param cursor [String, nil] Cursor for pagination. This can be populated by the `next_cursor` value returned
|
|
924
924
|
#
|
|
925
|
-
# @param customer_id [String, nil]
|
|
925
|
+
# @param customer_id [String, Array<String>, nil]
|
|
926
926
|
#
|
|
927
|
-
# @param external_customer_id [String, nil]
|
|
927
|
+
# @param external_customer_id [String, Array<String>, nil]
|
|
928
928
|
#
|
|
929
929
|
# @param external_plan_id [String, nil]
|
|
930
930
|
#
|
|
@@ -932,7 +932,7 @@ module Orb
|
|
|
932
932
|
#
|
|
933
933
|
# @param plan_id [String, nil]
|
|
934
934
|
#
|
|
935
|
-
# @param status [Symbol, Orb::Models::
|
|
935
|
+
# @param status [Symbol, Orb::Models::SubscriptionStatusFilter, Array<Symbol, Orb::Models::SubscriptionStatusFilter>, nil]
|
|
936
936
|
#
|
|
937
937
|
# @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
938
938
|
#
|
data/lib/orb/version.rb
CHANGED