orb-billing 0.9.1 → 0.11.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 +26 -0
- data/README.md +1 -1
- data/lib/orb/models/invoice.rb +3 -3
- data/lib/orb/models/invoice_fetch_upcoming_response.rb +3 -3
- data/lib/orb/models/invoice_line_item_create_response.rb +3 -3
- data/lib/orb/models/subscription_redeem_coupon_params.rb +62 -0
- data/lib/orb/models/subscription_redeem_coupon_response.rb +1883 -0
- data/lib/orb/models.rb +2 -0
- data/lib/orb/resources/subscriptions.rb +34 -1
- data/lib/orb/version.rb +1 -1
- data/lib/orb.rb +2 -0
- data/rbi/orb/models/invoice.rbi +31 -33
- data/rbi/orb/models/invoice_fetch_upcoming_response.rbi +31 -33
- data/rbi/orb/models/invoice_line_item_create_response.rbi +31 -33
- data/rbi/orb/models/subscription_redeem_coupon_params.rbi +111 -0
- data/rbi/orb/models/subscription_redeem_coupon_response.rbi +3557 -0
- data/rbi/orb/models.rbi +2 -0
- data/rbi/orb/resources/subscriptions.rbi +29 -1
- data/sig/orb/models/invoice.rbs +4 -4
- data/sig/orb/models/invoice_fetch_upcoming_response.rbs +4 -4
- data/sig/orb/models/invoice_line_item_create_response.rbs +4 -4
- data/sig/orb/models/subscription_redeem_coupon_params.rbs +54 -0
- data/sig/orb/models/subscription_redeem_coupon_response.rbs +1445 -0
- data/sig/orb/models.rbs +2 -0
- data/sig/orb/resources/subscriptions.rbs +9 -0
- metadata +8 -2
data/lib/orb/models.rb
CHANGED
@@ -244,6 +244,8 @@ module Orb
|
|
244
244
|
|
245
245
|
SubscriptionPriceIntervalsParams = Orb::Models::SubscriptionPriceIntervalsParams
|
246
246
|
|
247
|
+
SubscriptionRedeemCouponParams = Orb::Models::SubscriptionRedeemCouponParams
|
248
|
+
|
247
249
|
SubscriptionsAPI = Orb::Models::SubscriptionsAPI
|
248
250
|
|
249
251
|
SubscriptionSchedulePlanChangeParams = Orb::Models::SubscriptionSchedulePlanChangeParams
|
@@ -982,6 +982,39 @@ module Orb
|
|
982
982
|
)
|
983
983
|
end
|
984
984
|
|
985
|
+
# Some parameter documentations has been truncated, see
|
986
|
+
# {Orb::Models::SubscriptionRedeemCouponParams} for more details.
|
987
|
+
#
|
988
|
+
# Redeem a coupon effective at a given time.
|
989
|
+
#
|
990
|
+
# @overload redeem_coupon(subscription_id, change_option:, coupon_id:, allow_invoice_credit_or_void: nil, change_date: nil, request_options: {})
|
991
|
+
#
|
992
|
+
# @param subscription_id [String]
|
993
|
+
#
|
994
|
+
# @param change_option [Symbol, Orb::Models::SubscriptionRedeemCouponParams::ChangeOption]
|
995
|
+
#
|
996
|
+
# @param coupon_id [String] Coupon ID to be redeemed for this subscription.
|
997
|
+
#
|
998
|
+
# @param allow_invoice_credit_or_void [Boolean, nil] If false, this request will fail if it would void an issued invoice or create a
|
999
|
+
#
|
1000
|
+
# @param change_date [Time, nil] The date that the coupon discount should take effect. This parameter can only be
|
1001
|
+
#
|
1002
|
+
# @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil]
|
1003
|
+
#
|
1004
|
+
# @return [Orb::Models::SubscriptionRedeemCouponResponse]
|
1005
|
+
#
|
1006
|
+
# @see Orb::Models::SubscriptionRedeemCouponParams
|
1007
|
+
def redeem_coupon(subscription_id, params)
|
1008
|
+
parsed, options = Orb::SubscriptionRedeemCouponParams.dump_request(params)
|
1009
|
+
@client.request(
|
1010
|
+
method: :post,
|
1011
|
+
path: ["subscriptions/%1$s/redeem_coupon", subscription_id],
|
1012
|
+
body: parsed,
|
1013
|
+
model: Orb::Models::SubscriptionRedeemCouponResponse,
|
1014
|
+
options: options
|
1015
|
+
)
|
1016
|
+
end
|
1017
|
+
|
985
1018
|
# Some parameter documentations has been truncated, see
|
986
1019
|
# {Orb::Models::SubscriptionSchedulePlanChangeParams} for more details.
|
987
1020
|
#
|
@@ -1324,7 +1357,7 @@ module Orb
|
|
1324
1357
|
end
|
1325
1358
|
|
1326
1359
|
# This endpoint can be used to unschedule any pending plan changes on an existing
|
1327
|
-
# subscription.
|
1360
|
+
# subscription. When called, all upcoming plan changes will be unscheduled.
|
1328
1361
|
#
|
1329
1362
|
# @overload unschedule_pending_plan_changes(subscription_id, request_options: {})
|
1330
1363
|
#
|
data/lib/orb/version.rb
CHANGED
data/lib/orb.rb
CHANGED
@@ -213,6 +213,8 @@ require_relative "orb/models/subscription_fetch_usage_params"
|
|
213
213
|
require_relative "orb/models/subscription_list_params"
|
214
214
|
require_relative "orb/models/subscription_price_intervals_params"
|
215
215
|
require_relative "orb/models/subscription_price_intervals_response"
|
216
|
+
require_relative "orb/models/subscription_redeem_coupon_params"
|
217
|
+
require_relative "orb/models/subscription_redeem_coupon_response"
|
216
218
|
require_relative "orb/models/subscriptions"
|
217
219
|
require_relative "orb/models/subscription_schedule_plan_change_params"
|
218
220
|
require_relative "orb/models/subscription_schedule_plan_change_response"
|
data/rbi/orb/models/invoice.rbi
CHANGED
@@ -1646,7 +1646,7 @@ module Orb
|
|
1646
1646
|
#
|
1647
1647
|
# For more on the types of prices, see
|
1648
1648
|
# [the core concepts documentation](/core-concepts#plan-and-price)
|
1649
|
-
sig { returns(
|
1649
|
+
sig { returns(Orb::Price::Variants) }
|
1650
1650
|
attr_accessor :price
|
1651
1651
|
|
1652
1652
|
# Either the fixed fee quantity or the usage during the service period.
|
@@ -1710,37 +1710,35 @@ module Orb
|
|
1710
1710
|
name: String,
|
1711
1711
|
partially_invoiced_amount: String,
|
1712
1712
|
price:
|
1713
|
-
T.
|
1714
|
-
|
1715
|
-
|
1716
|
-
|
1717
|
-
|
1718
|
-
|
1719
|
-
|
1720
|
-
|
1721
|
-
|
1722
|
-
|
1723
|
-
|
1724
|
-
|
1725
|
-
|
1726
|
-
|
1727
|
-
|
1728
|
-
|
1729
|
-
|
1730
|
-
|
1731
|
-
|
1732
|
-
|
1733
|
-
|
1734
|
-
|
1735
|
-
|
1736
|
-
|
1737
|
-
|
1738
|
-
|
1739
|
-
|
1740
|
-
|
1741
|
-
|
1742
|
-
Orb::Price::CumulativeGroupedBulk::OrHash
|
1743
|
-
)
|
1713
|
+
T.any(
|
1714
|
+
Orb::Price::Unit::OrHash,
|
1715
|
+
Orb::Price::Package::OrHash,
|
1716
|
+
Orb::Price::Matrix::OrHash,
|
1717
|
+
Orb::Price::Tiered::OrHash,
|
1718
|
+
Orb::Price::TieredBps::OrHash,
|
1719
|
+
Orb::Price::Bps::OrHash,
|
1720
|
+
Orb::Price::BulkBps::OrHash,
|
1721
|
+
Orb::Price::Bulk::OrHash,
|
1722
|
+
Orb::Price::ThresholdTotalAmount::OrHash,
|
1723
|
+
Orb::Price::TieredPackage::OrHash,
|
1724
|
+
Orb::Price::GroupedTiered::OrHash,
|
1725
|
+
Orb::Price::TieredWithMinimum::OrHash,
|
1726
|
+
Orb::Price::TieredPackageWithMinimum::OrHash,
|
1727
|
+
Orb::Price::PackageWithAllocation::OrHash,
|
1728
|
+
Orb::Price::UnitWithPercent::OrHash,
|
1729
|
+
Orb::Price::MatrixWithAllocation::OrHash,
|
1730
|
+
Orb::Price::TieredWithProration::OrHash,
|
1731
|
+
Orb::Price::UnitWithProration::OrHash,
|
1732
|
+
Orb::Price::GroupedAllocation::OrHash,
|
1733
|
+
Orb::Price::GroupedWithProratedMinimum::OrHash,
|
1734
|
+
Orb::Price::GroupedWithMeteredMinimum::OrHash,
|
1735
|
+
Orb::Price::MatrixWithDisplayName::OrHash,
|
1736
|
+
Orb::Price::BulkWithProration::OrHash,
|
1737
|
+
Orb::Price::GroupedTieredPackage::OrHash,
|
1738
|
+
Orb::Price::MaxGroupTieredPackage::OrHash,
|
1739
|
+
Orb::Price::ScalableMatrixWithUnitPricing::OrHash,
|
1740
|
+
Orb::Price::ScalableMatrixWithTieredPricing::OrHash,
|
1741
|
+
Orb::Price::CumulativeGroupedBulk::OrHash
|
1744
1742
|
),
|
1745
1743
|
quantity: Float,
|
1746
1744
|
start_date: Time,
|
@@ -1840,7 +1838,7 @@ module Orb
|
|
1840
1838
|
minimum_amount: T.nilable(String),
|
1841
1839
|
name: String,
|
1842
1840
|
partially_invoiced_amount: String,
|
1843
|
-
price:
|
1841
|
+
price: Orb::Price::Variants,
|
1844
1842
|
quantity: Float,
|
1845
1843
|
start_date: Time,
|
1846
1844
|
sub_line_items:
|
@@ -2421,7 +2421,7 @@ module Orb
|
|
2421
2421
|
#
|
2422
2422
|
# For more on the types of prices, see
|
2423
2423
|
# [the core concepts documentation](/core-concepts#plan-and-price)
|
2424
|
-
sig { returns(
|
2424
|
+
sig { returns(Orb::Price::Variants) }
|
2425
2425
|
attr_accessor :price
|
2426
2426
|
|
2427
2427
|
# Either the fixed fee quantity or the usage during the service period.
|
@@ -2503,37 +2503,35 @@ module Orb
|
|
2503
2503
|
name: String,
|
2504
2504
|
partially_invoiced_amount: String,
|
2505
2505
|
price:
|
2506
|
-
T.
|
2507
|
-
|
2508
|
-
|
2509
|
-
|
2510
|
-
|
2511
|
-
|
2512
|
-
|
2513
|
-
|
2514
|
-
|
2515
|
-
|
2516
|
-
|
2517
|
-
|
2518
|
-
|
2519
|
-
|
2520
|
-
|
2521
|
-
|
2522
|
-
|
2523
|
-
|
2524
|
-
|
2525
|
-
|
2526
|
-
|
2527
|
-
|
2528
|
-
|
2529
|
-
|
2530
|
-
|
2531
|
-
|
2532
|
-
|
2533
|
-
|
2534
|
-
|
2535
|
-
Orb::Price::CumulativeGroupedBulk::OrHash
|
2536
|
-
)
|
2506
|
+
T.any(
|
2507
|
+
Orb::Price::Unit::OrHash,
|
2508
|
+
Orb::Price::Package::OrHash,
|
2509
|
+
Orb::Price::Matrix::OrHash,
|
2510
|
+
Orb::Price::Tiered::OrHash,
|
2511
|
+
Orb::Price::TieredBps::OrHash,
|
2512
|
+
Orb::Price::Bps::OrHash,
|
2513
|
+
Orb::Price::BulkBps::OrHash,
|
2514
|
+
Orb::Price::Bulk::OrHash,
|
2515
|
+
Orb::Price::ThresholdTotalAmount::OrHash,
|
2516
|
+
Orb::Price::TieredPackage::OrHash,
|
2517
|
+
Orb::Price::GroupedTiered::OrHash,
|
2518
|
+
Orb::Price::TieredWithMinimum::OrHash,
|
2519
|
+
Orb::Price::TieredPackageWithMinimum::OrHash,
|
2520
|
+
Orb::Price::PackageWithAllocation::OrHash,
|
2521
|
+
Orb::Price::UnitWithPercent::OrHash,
|
2522
|
+
Orb::Price::MatrixWithAllocation::OrHash,
|
2523
|
+
Orb::Price::TieredWithProration::OrHash,
|
2524
|
+
Orb::Price::UnitWithProration::OrHash,
|
2525
|
+
Orb::Price::GroupedAllocation::OrHash,
|
2526
|
+
Orb::Price::GroupedWithProratedMinimum::OrHash,
|
2527
|
+
Orb::Price::GroupedWithMeteredMinimum::OrHash,
|
2528
|
+
Orb::Price::MatrixWithDisplayName::OrHash,
|
2529
|
+
Orb::Price::BulkWithProration::OrHash,
|
2530
|
+
Orb::Price::GroupedTieredPackage::OrHash,
|
2531
|
+
Orb::Price::MaxGroupTieredPackage::OrHash,
|
2532
|
+
Orb::Price::ScalableMatrixWithUnitPricing::OrHash,
|
2533
|
+
Orb::Price::ScalableMatrixWithTieredPricing::OrHash,
|
2534
|
+
Orb::Price::CumulativeGroupedBulk::OrHash
|
2537
2535
|
),
|
2538
2536
|
quantity: Float,
|
2539
2537
|
start_date: Time,
|
@@ -2644,7 +2642,7 @@ module Orb
|
|
2644
2642
|
minimum_amount: T.nilable(String),
|
2645
2643
|
name: String,
|
2646
2644
|
partially_invoiced_amount: String,
|
2647
|
-
price:
|
2645
|
+
price: Orb::Price::Variants,
|
2648
2646
|
quantity: Float,
|
2649
2647
|
start_date: Time,
|
2650
2648
|
sub_line_items:
|
@@ -116,7 +116,7 @@ module Orb
|
|
116
116
|
#
|
117
117
|
# For more on the types of prices, see
|
118
118
|
# [the core concepts documentation](/core-concepts#plan-and-price)
|
119
|
-
sig { returns(
|
119
|
+
sig { returns(Orb::Price::Variants) }
|
120
120
|
attr_accessor :price
|
121
121
|
|
122
122
|
# Either the fixed fee quantity or the usage during the service period.
|
@@ -194,37 +194,35 @@ module Orb
|
|
194
194
|
name: String,
|
195
195
|
partially_invoiced_amount: String,
|
196
196
|
price:
|
197
|
-
T.
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
Orb::Price::CumulativeGroupedBulk::OrHash
|
227
|
-
)
|
197
|
+
T.any(
|
198
|
+
Orb::Price::Unit::OrHash,
|
199
|
+
Orb::Price::Package::OrHash,
|
200
|
+
Orb::Price::Matrix::OrHash,
|
201
|
+
Orb::Price::Tiered::OrHash,
|
202
|
+
Orb::Price::TieredBps::OrHash,
|
203
|
+
Orb::Price::Bps::OrHash,
|
204
|
+
Orb::Price::BulkBps::OrHash,
|
205
|
+
Orb::Price::Bulk::OrHash,
|
206
|
+
Orb::Price::ThresholdTotalAmount::OrHash,
|
207
|
+
Orb::Price::TieredPackage::OrHash,
|
208
|
+
Orb::Price::GroupedTiered::OrHash,
|
209
|
+
Orb::Price::TieredWithMinimum::OrHash,
|
210
|
+
Orb::Price::TieredPackageWithMinimum::OrHash,
|
211
|
+
Orb::Price::PackageWithAllocation::OrHash,
|
212
|
+
Orb::Price::UnitWithPercent::OrHash,
|
213
|
+
Orb::Price::MatrixWithAllocation::OrHash,
|
214
|
+
Orb::Price::TieredWithProration::OrHash,
|
215
|
+
Orb::Price::UnitWithProration::OrHash,
|
216
|
+
Orb::Price::GroupedAllocation::OrHash,
|
217
|
+
Orb::Price::GroupedWithProratedMinimum::OrHash,
|
218
|
+
Orb::Price::GroupedWithMeteredMinimum::OrHash,
|
219
|
+
Orb::Price::MatrixWithDisplayName::OrHash,
|
220
|
+
Orb::Price::BulkWithProration::OrHash,
|
221
|
+
Orb::Price::GroupedTieredPackage::OrHash,
|
222
|
+
Orb::Price::MaxGroupTieredPackage::OrHash,
|
223
|
+
Orb::Price::ScalableMatrixWithUnitPricing::OrHash,
|
224
|
+
Orb::Price::ScalableMatrixWithTieredPricing::OrHash,
|
225
|
+
Orb::Price::CumulativeGroupedBulk::OrHash
|
228
226
|
),
|
229
227
|
quantity: Float,
|
230
228
|
start_date: Time,
|
@@ -331,7 +329,7 @@ module Orb
|
|
331
329
|
minimum_amount: T.nilable(String),
|
332
330
|
name: String,
|
333
331
|
partially_invoiced_amount: String,
|
334
|
-
price:
|
332
|
+
price: Orb::Price::Variants,
|
335
333
|
quantity: Float,
|
336
334
|
start_date: Time,
|
337
335
|
sub_line_items:
|
@@ -0,0 +1,111 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Orb
|
4
|
+
module Models
|
5
|
+
class SubscriptionRedeemCouponParams < Orb::Internal::Type::BaseModel
|
6
|
+
extend Orb::Internal::Type::RequestParameters::Converter
|
7
|
+
include Orb::Internal::Type::RequestParameters
|
8
|
+
|
9
|
+
OrHash =
|
10
|
+
T.type_alias do
|
11
|
+
T.any(Orb::SubscriptionRedeemCouponParams, Orb::Internal::AnyHash)
|
12
|
+
end
|
13
|
+
|
14
|
+
sig do
|
15
|
+
returns(Orb::SubscriptionRedeemCouponParams::ChangeOption::OrSymbol)
|
16
|
+
end
|
17
|
+
attr_accessor :change_option
|
18
|
+
|
19
|
+
# Coupon ID to be redeemed for this subscription.
|
20
|
+
sig { returns(String) }
|
21
|
+
attr_accessor :coupon_id
|
22
|
+
|
23
|
+
# If false, this request will fail if it would void an issued invoice or create a
|
24
|
+
# credit note. Consider using this as a safety mechanism if you do not expect
|
25
|
+
# existing invoices to be changed.
|
26
|
+
sig { returns(T.nilable(T::Boolean)) }
|
27
|
+
attr_accessor :allow_invoice_credit_or_void
|
28
|
+
|
29
|
+
# The date that the coupon discount should take effect. This parameter can only be
|
30
|
+
# passed if the `change_option` is `requested_date`.
|
31
|
+
sig { returns(T.nilable(Time)) }
|
32
|
+
attr_accessor :change_date
|
33
|
+
|
34
|
+
sig do
|
35
|
+
params(
|
36
|
+
change_option:
|
37
|
+
Orb::SubscriptionRedeemCouponParams::ChangeOption::OrSymbol,
|
38
|
+
coupon_id: String,
|
39
|
+
allow_invoice_credit_or_void: T.nilable(T::Boolean),
|
40
|
+
change_date: T.nilable(Time),
|
41
|
+
request_options: Orb::RequestOptions::OrHash
|
42
|
+
).returns(T.attached_class)
|
43
|
+
end
|
44
|
+
def self.new(
|
45
|
+
change_option:,
|
46
|
+
# Coupon ID to be redeemed for this subscription.
|
47
|
+
coupon_id:,
|
48
|
+
# If false, this request will fail if it would void an issued invoice or create a
|
49
|
+
# credit note. Consider using this as a safety mechanism if you do not expect
|
50
|
+
# existing invoices to be changed.
|
51
|
+
allow_invoice_credit_or_void: nil,
|
52
|
+
# The date that the coupon discount should take effect. This parameter can only be
|
53
|
+
# passed if the `change_option` is `requested_date`.
|
54
|
+
change_date: nil,
|
55
|
+
request_options: {}
|
56
|
+
)
|
57
|
+
end
|
58
|
+
|
59
|
+
sig do
|
60
|
+
override.returns(
|
61
|
+
{
|
62
|
+
change_option:
|
63
|
+
Orb::SubscriptionRedeemCouponParams::ChangeOption::OrSymbol,
|
64
|
+
coupon_id: String,
|
65
|
+
allow_invoice_credit_or_void: T.nilable(T::Boolean),
|
66
|
+
change_date: T.nilable(Time),
|
67
|
+
request_options: Orb::RequestOptions
|
68
|
+
}
|
69
|
+
)
|
70
|
+
end
|
71
|
+
def to_hash
|
72
|
+
end
|
73
|
+
|
74
|
+
module ChangeOption
|
75
|
+
extend Orb::Internal::Type::Enum
|
76
|
+
|
77
|
+
TaggedSymbol =
|
78
|
+
T.type_alias do
|
79
|
+
T.all(Symbol, Orb::SubscriptionRedeemCouponParams::ChangeOption)
|
80
|
+
end
|
81
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
82
|
+
|
83
|
+
REQUESTED_DATE =
|
84
|
+
T.let(
|
85
|
+
:requested_date,
|
86
|
+
Orb::SubscriptionRedeemCouponParams::ChangeOption::TaggedSymbol
|
87
|
+
)
|
88
|
+
END_OF_SUBSCRIPTION_TERM =
|
89
|
+
T.let(
|
90
|
+
:end_of_subscription_term,
|
91
|
+
Orb::SubscriptionRedeemCouponParams::ChangeOption::TaggedSymbol
|
92
|
+
)
|
93
|
+
IMMEDIATE =
|
94
|
+
T.let(
|
95
|
+
:immediate,
|
96
|
+
Orb::SubscriptionRedeemCouponParams::ChangeOption::TaggedSymbol
|
97
|
+
)
|
98
|
+
|
99
|
+
sig do
|
100
|
+
override.returns(
|
101
|
+
T::Array[
|
102
|
+
Orb::SubscriptionRedeemCouponParams::ChangeOption::TaggedSymbol
|
103
|
+
]
|
104
|
+
)
|
105
|
+
end
|
106
|
+
def self.values
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|