orb-billing 0.9.0 → 0.10.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.
data/rbi/orb/models.rbi CHANGED
@@ -214,6 +214,8 @@ module Orb
214
214
  SubscriptionPriceIntervalsParams =
215
215
  Orb::Models::SubscriptionPriceIntervalsParams
216
216
 
217
+ SubscriptionRedeemCouponParams = Orb::Models::SubscriptionRedeemCouponParams
218
+
217
219
  SubscriptionsAPI = Orb::Models::SubscriptionsAPI
218
220
 
219
221
  SubscriptionSchedulePlanChangeParams =
@@ -1007,6 +1007,34 @@ module Orb
1007
1007
  )
1008
1008
  end
1009
1009
 
1010
+ # Redeem a coupon effective at a given time.
1011
+ sig do
1012
+ params(
1013
+ subscription_id: String,
1014
+ change_option:
1015
+ Orb::SubscriptionRedeemCouponParams::ChangeOption::OrSymbol,
1016
+ coupon_id: String,
1017
+ allow_invoice_credit_or_void: T.nilable(T::Boolean),
1018
+ change_date: T.nilable(Time),
1019
+ request_options: Orb::RequestOptions::OrHash
1020
+ ).returns(Orb::Models::SubscriptionRedeemCouponResponse)
1021
+ end
1022
+ def redeem_coupon(
1023
+ subscription_id,
1024
+ change_option:,
1025
+ # Coupon ID to be redeemed for this subscription.
1026
+ coupon_id:,
1027
+ # If false, this request will fail if it would void an issued invoice or create a
1028
+ # credit note. Consider using this as a safety mechanism if you do not expect
1029
+ # existing invoices to be changed.
1030
+ allow_invoice_credit_or_void: nil,
1031
+ # The date that the coupon discount should take effect. This parameter can only be
1032
+ # passed if the `change_option` is `requested_date`.
1033
+ change_date: nil,
1034
+ request_options: {}
1035
+ )
1036
+ end
1037
+
1010
1038
  # This endpoint can be used to change an existing subscription's plan. It returns
1011
1039
  # the serialized updated subscription object.
1012
1040
  #
@@ -841,7 +841,7 @@ module Orb
841
841
  minimum_amount: String?,
842
842
  name: String,
843
843
  partially_invoiced_amount: String,
844
- price: Orb::Models::price?,
844
+ price: Orb::Models::price,
845
845
  quantity: Float,
846
846
  start_date: Time,
847
847
  sub_line_items: ::Array[Orb::Models::Invoice::LineItem::sub_line_item],
@@ -881,7 +881,7 @@ module Orb
881
881
 
882
882
  attr_accessor partially_invoiced_amount: String
883
883
 
884
- attr_accessor price: Orb::Models::price?
884
+ attr_accessor price: Orb::Models::price
885
885
 
886
886
  attr_accessor quantity: Float
887
887
 
@@ -911,7 +911,7 @@ module Orb
911
911
  minimum_amount: String?,
912
912
  name: String,
913
913
  partially_invoiced_amount: String,
914
- price: Orb::Models::price?,
914
+ price: Orb::Models::price,
915
915
  quantity: Float,
916
916
  start_date: Time,
917
917
  sub_line_items: ::Array[Orb::Models::Invoice::LineItem::sub_line_item],
@@ -936,7 +936,7 @@ module Orb
936
936
  minimum_amount: String?,
937
937
  name: String,
938
938
  partially_invoiced_amount: String,
939
- price: Orb::Models::price?,
939
+ price: Orb::Models::price,
940
940
  quantity: Float,
941
941
  start_date: Time,
942
942
  sub_line_items: ::Array[Orb::Models::Invoice::LineItem::sub_line_item],
@@ -841,7 +841,7 @@ module Orb
841
841
  minimum_amount: String?,
842
842
  name: String,
843
843
  partially_invoiced_amount: String,
844
- price: Orb::Models::price?,
844
+ price: Orb::Models::price,
845
845
  quantity: Float,
846
846
  start_date: Time,
847
847
  sub_line_items: ::Array[Orb::Models::InvoiceFetchUpcomingResponse::LineItem::sub_line_item],
@@ -881,7 +881,7 @@ module Orb
881
881
 
882
882
  attr_accessor partially_invoiced_amount: String
883
883
 
884
- attr_accessor price: Orb::Models::price?
884
+ attr_accessor price: Orb::Models::price
885
885
 
886
886
  attr_accessor quantity: Float
887
887
 
@@ -911,7 +911,7 @@ module Orb
911
911
  minimum_amount: String?,
912
912
  name: String,
913
913
  partially_invoiced_amount: String,
914
- price: Orb::Models::price?,
914
+ price: Orb::Models::price,
915
915
  quantity: Float,
916
916
  start_date: Time,
917
917
  sub_line_items: ::Array[Orb::Models::InvoiceFetchUpcomingResponse::LineItem::sub_line_item],
@@ -936,7 +936,7 @@ module Orb
936
936
  minimum_amount: String?,
937
937
  name: String,
938
938
  partially_invoiced_amount: String,
939
- price: Orb::Models::price?,
939
+ price: Orb::Models::price,
940
940
  quantity: Float,
941
941
  start_date: Time,
942
942
  sub_line_items: ::Array[Orb::Models::InvoiceFetchUpcomingResponse::LineItem::sub_line_item],
@@ -17,7 +17,7 @@ module Orb
17
17
  minimum_amount: String?,
18
18
  name: String,
19
19
  partially_invoiced_amount: String,
20
- price: Orb::Models::price?,
20
+ price: Orb::Models::price,
21
21
  quantity: Float,
22
22
  start_date: Time,
23
23
  sub_line_items: ::Array[Orb::Models::InvoiceLineItemCreateResponse::sub_line_item],
@@ -57,7 +57,7 @@ module Orb
57
57
 
58
58
  attr_accessor partially_invoiced_amount: String
59
59
 
60
- attr_accessor price: Orb::Models::price?
60
+ attr_accessor price: Orb::Models::price
61
61
 
62
62
  attr_accessor quantity: Float
63
63
 
@@ -87,7 +87,7 @@ module Orb
87
87
  minimum_amount: String?,
88
88
  name: String,
89
89
  partially_invoiced_amount: String,
90
- price: Orb::Models::price?,
90
+ price: Orb::Models::price,
91
91
  quantity: Float,
92
92
  start_date: Time,
93
93
  sub_line_items: ::Array[Orb::Models::InvoiceLineItemCreateResponse::sub_line_item],
@@ -112,7 +112,7 @@ module Orb
112
112
  minimum_amount: String?,
113
113
  name: String,
114
114
  partially_invoiced_amount: String,
115
- price: Orb::Models::price?,
115
+ price: Orb::Models::price,
116
116
  quantity: Float,
117
117
  start_date: Time,
118
118
  sub_line_items: ::Array[Orb::Models::InvoiceLineItemCreateResponse::sub_line_item],
@@ -0,0 +1,54 @@
1
+ module Orb
2
+ module Models
3
+ type subscription_redeem_coupon_params =
4
+ {
5
+ change_option: Orb::Models::SubscriptionRedeemCouponParams::change_option,
6
+ coupon_id: String,
7
+ allow_invoice_credit_or_void: bool?,
8
+ change_date: Time?
9
+ }
10
+ & Orb::Internal::Type::request_parameters
11
+
12
+ class SubscriptionRedeemCouponParams < Orb::Internal::Type::BaseModel
13
+ extend Orb::Internal::Type::RequestParameters::Converter
14
+ include Orb::Internal::Type::RequestParameters
15
+
16
+ attr_accessor change_option: Orb::Models::SubscriptionRedeemCouponParams::change_option
17
+
18
+ attr_accessor coupon_id: String
19
+
20
+ attr_accessor allow_invoice_credit_or_void: bool?
21
+
22
+ attr_accessor change_date: Time?
23
+
24
+ def initialize: (
25
+ change_option: Orb::Models::SubscriptionRedeemCouponParams::change_option,
26
+ coupon_id: String,
27
+ ?allow_invoice_credit_or_void: bool?,
28
+ ?change_date: Time?,
29
+ ?request_options: Orb::request_opts
30
+ ) -> void
31
+
32
+ def to_hash: -> {
33
+ change_option: Orb::Models::SubscriptionRedeemCouponParams::change_option,
34
+ coupon_id: String,
35
+ allow_invoice_credit_or_void: bool?,
36
+ change_date: Time?,
37
+ request_options: Orb::RequestOptions
38
+ }
39
+
40
+ type change_option =
41
+ :requested_date | :end_of_subscription_term | :immediate
42
+
43
+ module ChangeOption
44
+ extend Orb::Internal::Type::Enum
45
+
46
+ REQUESTED_DATE: :requested_date
47
+ END_OF_SUBSCRIPTION_TERM: :end_of_subscription_term
48
+ IMMEDIATE: :immediate
49
+
50
+ def self?.values: -> ::Array[Orb::Models::SubscriptionRedeemCouponParams::change_option]
51
+ end
52
+ end
53
+ end
54
+ end