orb-billing 0.6.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +26 -0
  3. data/README.md +1 -1
  4. data/lib/orb/client.rb +4 -0
  5. data/lib/orb/models/{plans/version_create_params.rb → beta/external_plan_id_create_plan_version_params.rb} +1980 -1744
  6. data/lib/orb/models/beta/external_plan_id_fetch_plan_version_params.rb +22 -0
  7. data/lib/orb/models/{plans/external_plan_id_set_default_version_params.rb → beta/external_plan_id_set_default_plan_version_params.rb} +3 -3
  8. data/lib/orb/models/beta_create_plan_version_params.rb +17844 -0
  9. data/lib/orb/models/beta_fetch_plan_version_params.rb +20 -0
  10. data/lib/orb/models/{plan_set_default_version_params.rb → beta_set_default_plan_version_params.rb} +2 -2
  11. data/lib/orb/models/plan_version.rb +735 -0
  12. data/lib/orb/models/plan_version_phase.rb +70 -0
  13. data/lib/orb/models/price.rb +1114 -28
  14. data/lib/orb/models/price_evaluate_multiple_params.rb +8620 -0
  15. data/lib/orb/models/price_evaluate_multiple_response.rb +51 -0
  16. data/lib/orb/models/price_evaluate_params.rb +21 -8529
  17. data/lib/orb/models/price_evaluate_response.rb +3 -38
  18. data/lib/orb/models/subscription_create_params.rb +96 -10
  19. data/lib/orb/models/subscription_price_intervals_params.rb +48 -5
  20. data/lib/orb/models/subscription_schedule_plan_change_params.rb +100 -10
  21. data/lib/orb/models.rb +14 -2
  22. data/lib/orb/resources/beta/external_plan_id.rb +113 -0
  23. data/lib/orb/resources/beta.rb +115 -0
  24. data/lib/orb/resources/plans/external_plan_id.rb +0 -31
  25. data/lib/orb/resources/plans.rb +0 -31
  26. data/lib/orb/resources/prices.rb +69 -8
  27. data/lib/orb/version.rb +1 -1
  28. data/lib/orb.rb +12 -12
  29. data/rbi/orb/client.rbi +3 -0
  30. data/rbi/orb/models/{plans/version_create_params.rbi → beta/external_plan_id_create_plan_version_params.rbi} +3042 -2783
  31. data/rbi/orb/models/{plans/version_retrieve_params.rbi → beta/external_plan_id_fetch_plan_version_params.rbi} +10 -7
  32. data/rbi/orb/models/{plans/external_plan_id_set_default_version_params.rbi → beta/external_plan_id_set_default_plan_version_params.rbi} +3 -3
  33. data/rbi/orb/models/beta_create_plan_version_params.rbi +32809 -0
  34. data/rbi/orb/models/beta_fetch_plan_version_params.rbi +35 -0
  35. data/rbi/orb/models/{plan_set_default_version_params.rbi → beta_set_default_plan_version_params.rbi} +2 -2
  36. data/rbi/orb/models/plan_version.rbi +1367 -0
  37. data/rbi/orb/models/plan_version_phase.rbi +99 -0
  38. data/rbi/orb/models/price.rbi +3220 -184
  39. data/rbi/orb/models/price_evaluate_multiple_params.rbi +15764 -0
  40. data/rbi/orb/models/price_evaluate_multiple_response.rbi +96 -0
  41. data/rbi/orb/models/price_evaluate_params.rbi +25 -15684
  42. data/rbi/orb/models/price_evaluate_response.rbi +5 -68
  43. data/rbi/orb/models/subscription_create_params.rbi +226 -12
  44. data/rbi/orb/models/subscription_price_intervals_params.rbi +113 -6
  45. data/rbi/orb/models/subscription_schedule_plan_change_params.rbi +226 -12
  46. data/rbi/orb/models.rbi +14 -2
  47. data/rbi/orb/resources/{plans/versions.rbi → beta/external_plan_id.rbi} +42 -15
  48. data/rbi/orb/resources/beta.rbi +111 -0
  49. data/rbi/orb/resources/plans/external_plan_id.rbi +0 -22
  50. data/rbi/orb/resources/plans.rbi +0 -22
  51. data/rbi/orb/resources/prices.rbi +66 -4
  52. data/sig/orb/client.rbs +2 -0
  53. data/sig/orb/models/{plans/version_create_params.rbs → beta/external_plan_id_create_plan_version_params.rbs} +1847 -1771
  54. data/sig/orb/models/{plans/version_retrieve_params.rbs → beta/external_plan_id_fetch_plan_version_params.rbs} +7 -7
  55. data/sig/orb/models/{plans/external_plan_id_set_default_version_params.rbs → beta/external_plan_id_set_default_plan_version_params.rbs} +3 -3
  56. data/sig/orb/models/beta_create_plan_version_params.rbs +12953 -0
  57. data/sig/orb/models/beta_fetch_plan_version_params.rbs +20 -0
  58. data/sig/orb/models/{plan_set_default_version_params.rbs → beta_set_default_plan_version_params.rbs} +2 -2
  59. data/sig/orb/models/plan_version.rbs +583 -0
  60. data/sig/orb/models/plan_version_phase.rbs +60 -0
  61. data/sig/orb/models/price.rbs +1430 -86
  62. data/sig/orb/models/price_evaluate_multiple_params.rbs +6230 -0
  63. data/sig/orb/models/price_evaluate_multiple_response.rbs +50 -0
  64. data/sig/orb/models/price_evaluate_params.rbs +10 -6187
  65. data/sig/orb/models/price_evaluate_response.rbs +4 -41
  66. data/sig/orb/models/subscription_create_params.rbs +84 -8
  67. data/sig/orb/models/subscription_price_intervals_params.rbs +42 -4
  68. data/sig/orb/models/subscription_schedule_plan_change_params.rbs +84 -8
  69. data/sig/orb/models.rbs +14 -2
  70. data/sig/orb/resources/beta/external_plan_id.rbs +34 -0
  71. data/sig/orb/resources/beta.rbs +34 -0
  72. data/sig/orb/resources/plans/external_plan_id.rbs +0 -8
  73. data/sig/orb/resources/plans.rbs +0 -8
  74. data/sig/orb/resources/prices.rbs +13 -2
  75. metadata +38 -38
  76. data/lib/orb/models/plans/external_plan_id/version_create_params.rb +0 -17948
  77. data/lib/orb/models/plans/external_plan_id/version_create_response.rb +0 -819
  78. data/lib/orb/models/plans/external_plan_id/version_retrieve_params.rb +0 -24
  79. data/lib/orb/models/plans/external_plan_id/version_retrieve_response.rb +0 -819
  80. data/lib/orb/models/plans/version_create_response.rb +0 -814
  81. data/lib/orb/models/plans/version_retrieve_params.rb +0 -22
  82. data/lib/orb/models/plans/version_retrieve_response.rb +0 -814
  83. data/lib/orb/resources/plans/external_plan_id/versions.rb +0 -88
  84. data/lib/orb/resources/plans/versions.rb +0 -86
  85. data/rbi/orb/models/plans/external_plan_id/version_create_params.rbi +0 -32668
  86. data/rbi/orb/models/plans/external_plan_id/version_create_response.rbi +0 -1562
  87. data/rbi/orb/models/plans/external_plan_id/version_retrieve_params.rbi +0 -42
  88. data/rbi/orb/models/plans/external_plan_id/version_retrieve_response.rbi +0 -1562
  89. data/rbi/orb/models/plans/version_create_response.rbi +0 -1556
  90. data/rbi/orb/models/plans/version_retrieve_response.rbi +0 -1558
  91. data/rbi/orb/resources/plans/external_plan_id/versions.rbi +0 -103
  92. data/sig/orb/models/plans/external_plan_id/version_create_params.rbs +0 -12923
  93. data/sig/orb/models/plans/external_plan_id/version_create_response.rbs +0 -664
  94. data/sig/orb/models/plans/external_plan_id/version_retrieve_params.rbs +0 -27
  95. data/sig/orb/models/plans/external_plan_id/version_retrieve_response.rbs +0 -664
  96. data/sig/orb/models/plans/version_create_response.rbs +0 -662
  97. data/sig/orb/models/plans/version_retrieve_response.rbs +0 -662
  98. data/sig/orb/resources/plans/external_plan_id/versions.rbs +0 -30
  99. data/sig/orb/resources/plans/versions.rbs +0 -28
@@ -6,46 +6,11 @@ module Orb
6
6
  class PriceEvaluateResponse < Orb::Internal::Type::BaseModel
7
7
  # @!attribute data
8
8
  #
9
- # @return [Array<Orb::Models::PriceEvaluateResponse::Data>]
10
- required :data, -> { Orb::Internal::Type::ArrayOf[Orb::Models::PriceEvaluateResponse::Data] }
9
+ # @return [Array<Orb::Models::EvaluatePriceGroup>]
10
+ required :data, -> { Orb::Internal::Type::ArrayOf[Orb::EvaluatePriceGroup] }
11
11
 
12
12
  # @!method initialize(data:)
13
- # @param data [Array<Orb::Models::PriceEvaluateResponse::Data>]
14
-
15
- class Data < Orb::Internal::Type::BaseModel
16
- # @!attribute currency
17
- # The currency of the price
18
- #
19
- # @return [String]
20
- required :currency, String
21
-
22
- # @!attribute price_groups
23
- # The computed price groups associated with input price.
24
- #
25
- # @return [Array<Orb::Models::EvaluatePriceGroup>]
26
- required :price_groups, -> { Orb::Internal::Type::ArrayOf[Orb::EvaluatePriceGroup] }
27
-
28
- # @!attribute inline_price_index
29
- # The index of the inline price
30
- #
31
- # @return [Integer, nil]
32
- optional :inline_price_index, Integer, nil?: true
33
-
34
- # @!attribute price_id
35
- # The ID of the price
36
- #
37
- # @return [String, nil]
38
- optional :price_id, String, nil?: true
39
-
40
- # @!method initialize(currency:, price_groups:, inline_price_index: nil, price_id: nil)
41
- # @param currency [String] The currency of the price
42
- #
43
- # @param price_groups [Array<Orb::Models::EvaluatePriceGroup>] The computed price groups associated with input price.
44
- #
45
- # @param inline_price_index [Integer, nil] The index of the inline price
46
- #
47
- # @param price_id [String, nil] The ID of the price
48
- end
13
+ # @param data [Array<Orb::Models::EvaluatePriceGroup>]
49
14
  end
50
15
  end
51
16
  end
@@ -715,14 +715,22 @@ module Orb
715
715
  # @return [String]
716
716
  required :currency, String
717
717
 
718
+ # @!attribute custom_expiration
719
+ # The custom expiration for the allocation.
720
+ #
721
+ # @return [Orb::Models::SubscriptionCreateParams::AddPrice::AllocationPrice::CustomExpiration, nil]
722
+ optional :custom_expiration,
723
+ -> { Orb::SubscriptionCreateParams::AddPrice::AllocationPrice::CustomExpiration },
724
+ nil?: true
725
+
718
726
  # @!attribute expires_at_end_of_cadence
719
727
  # Whether the allocated amount should expire at the end of the cadence or roll
720
- # over to the next period.
728
+ # over to the next period. Set to null if using custom_expiration.
721
729
  #
722
- # @return [Boolean]
723
- required :expires_at_end_of_cadence, Orb::Internal::Type::Boolean
730
+ # @return [Boolean, nil]
731
+ optional :expires_at_end_of_cadence, Orb::Internal::Type::Boolean, nil?: true
724
732
 
725
- # @!method initialize(amount:, cadence:, currency:, expires_at_end_of_cadence:)
733
+ # @!method initialize(amount:, cadence:, currency:, custom_expiration: nil, expires_at_end_of_cadence: nil)
726
734
  # Some parameter documentations has been truncated, see
727
735
  # {Orb::Models::SubscriptionCreateParams::AddPrice::AllocationPrice} for more
728
736
  # details.
@@ -735,7 +743,9 @@ module Orb
735
743
  #
736
744
  # @param currency [String] An ISO 4217 currency string or a custom pricing unit identifier in which to bill
737
745
  #
738
- # @param expires_at_end_of_cadence [Boolean] Whether the allocated amount should expire at the end of the cadence or roll ove
746
+ # @param custom_expiration [Orb::Models::SubscriptionCreateParams::AddPrice::AllocationPrice::CustomExpiration, nil] The custom expiration for the allocation.
747
+ #
748
+ # @param expires_at_end_of_cadence [Boolean, nil] Whether the allocated amount should expire at the end of the cadence or roll ove
739
749
 
740
750
  # The cadence at which to allocate the amount to the customer.
741
751
  #
@@ -753,6 +763,39 @@ module Orb
753
763
  # @!method self.values
754
764
  # @return [Array<Symbol>]
755
765
  end
766
+
767
+ # @see Orb::Models::SubscriptionCreateParams::AddPrice::AllocationPrice#custom_expiration
768
+ class CustomExpiration < Orb::Internal::Type::BaseModel
769
+ # @!attribute duration
770
+ #
771
+ # @return [Integer]
772
+ required :duration, Integer
773
+
774
+ # @!attribute duration_unit
775
+ #
776
+ # @return [Symbol, Orb::Models::SubscriptionCreateParams::AddPrice::AllocationPrice::CustomExpiration::DurationUnit]
777
+ required :duration_unit,
778
+ enum: -> {
779
+ Orb::SubscriptionCreateParams::AddPrice::AllocationPrice::CustomExpiration::DurationUnit
780
+ }
781
+
782
+ # @!method initialize(duration:, duration_unit:)
783
+ # The custom expiration for the allocation.
784
+ #
785
+ # @param duration [Integer]
786
+ # @param duration_unit [Symbol, Orb::Models::SubscriptionCreateParams::AddPrice::AllocationPrice::CustomExpiration::DurationUnit]
787
+
788
+ # @see Orb::Models::SubscriptionCreateParams::AddPrice::AllocationPrice::CustomExpiration#duration_unit
789
+ module DurationUnit
790
+ extend Orb::Internal::Type::Enum
791
+
792
+ DAY = :day
793
+ MONTH = :month
794
+
795
+ # @!method self.values
796
+ # @return [Array<Symbol>]
797
+ end
798
+ end
756
799
  end
757
800
 
758
801
  class Discount < Orb::Internal::Type::BaseModel
@@ -9937,14 +9980,22 @@ module Orb
9937
9980
  # @return [String]
9938
9981
  required :currency, String
9939
9982
 
9983
+ # @!attribute custom_expiration
9984
+ # The custom expiration for the allocation.
9985
+ #
9986
+ # @return [Orb::Models::SubscriptionCreateParams::ReplacePrice::AllocationPrice::CustomExpiration, nil]
9987
+ optional :custom_expiration,
9988
+ -> { Orb::SubscriptionCreateParams::ReplacePrice::AllocationPrice::CustomExpiration },
9989
+ nil?: true
9990
+
9940
9991
  # @!attribute expires_at_end_of_cadence
9941
9992
  # Whether the allocated amount should expire at the end of the cadence or roll
9942
- # over to the next period.
9993
+ # over to the next period. Set to null if using custom_expiration.
9943
9994
  #
9944
- # @return [Boolean]
9945
- required :expires_at_end_of_cadence, Orb::Internal::Type::Boolean
9995
+ # @return [Boolean, nil]
9996
+ optional :expires_at_end_of_cadence, Orb::Internal::Type::Boolean, nil?: true
9946
9997
 
9947
- # @!method initialize(amount:, cadence:, currency:, expires_at_end_of_cadence:)
9998
+ # @!method initialize(amount:, cadence:, currency:, custom_expiration: nil, expires_at_end_of_cadence: nil)
9948
9999
  # Some parameter documentations has been truncated, see
9949
10000
  # {Orb::Models::SubscriptionCreateParams::ReplacePrice::AllocationPrice} for more
9950
10001
  # details.
@@ -9957,7 +10008,9 @@ module Orb
9957
10008
  #
9958
10009
  # @param currency [String] An ISO 4217 currency string or a custom pricing unit identifier in which to bill
9959
10010
  #
9960
- # @param expires_at_end_of_cadence [Boolean] Whether the allocated amount should expire at the end of the cadence or roll ove
10011
+ # @param custom_expiration [Orb::Models::SubscriptionCreateParams::ReplacePrice::AllocationPrice::CustomExpiration, nil] The custom expiration for the allocation.
10012
+ #
10013
+ # @param expires_at_end_of_cadence [Boolean, nil] Whether the allocated amount should expire at the end of the cadence or roll ove
9961
10014
 
9962
10015
  # The cadence at which to allocate the amount to the customer.
9963
10016
  #
@@ -9975,6 +10028,39 @@ module Orb
9975
10028
  # @!method self.values
9976
10029
  # @return [Array<Symbol>]
9977
10030
  end
10031
+
10032
+ # @see Orb::Models::SubscriptionCreateParams::ReplacePrice::AllocationPrice#custom_expiration
10033
+ class CustomExpiration < Orb::Internal::Type::BaseModel
10034
+ # @!attribute duration
10035
+ #
10036
+ # @return [Integer]
10037
+ required :duration, Integer
10038
+
10039
+ # @!attribute duration_unit
10040
+ #
10041
+ # @return [Symbol, Orb::Models::SubscriptionCreateParams::ReplacePrice::AllocationPrice::CustomExpiration::DurationUnit]
10042
+ required :duration_unit,
10043
+ enum: -> {
10044
+ Orb::SubscriptionCreateParams::ReplacePrice::AllocationPrice::CustomExpiration::DurationUnit
10045
+ }
10046
+
10047
+ # @!method initialize(duration:, duration_unit:)
10048
+ # The custom expiration for the allocation.
10049
+ #
10050
+ # @param duration [Integer]
10051
+ # @param duration_unit [Symbol, Orb::Models::SubscriptionCreateParams::ReplacePrice::AllocationPrice::CustomExpiration::DurationUnit]
10052
+
10053
+ # @see Orb::Models::SubscriptionCreateParams::ReplacePrice::AllocationPrice::CustomExpiration#duration_unit
10054
+ module DurationUnit
10055
+ extend Orb::Internal::Type::Enum
10056
+
10057
+ DAY = :day
10058
+ MONTH = :month
10059
+
10060
+ # @!method self.values
10061
+ # @return [Array<Symbol>]
10062
+ end
10063
+ end
9978
10064
  end
9979
10065
 
9980
10066
  class Discount < Orb::Internal::Type::BaseModel
@@ -218,14 +218,22 @@ module Orb
218
218
  # @return [String]
219
219
  required :currency, String
220
220
 
221
+ # @!attribute custom_expiration
222
+ # The custom expiration for the allocation.
223
+ #
224
+ # @return [Orb::Models::SubscriptionPriceIntervalsParams::Add::AllocationPrice::CustomExpiration, nil]
225
+ optional :custom_expiration,
226
+ -> { Orb::SubscriptionPriceIntervalsParams::Add::AllocationPrice::CustomExpiration },
227
+ nil?: true
228
+
221
229
  # @!attribute expires_at_end_of_cadence
222
230
  # Whether the allocated amount should expire at the end of the cadence or roll
223
- # over to the next period.
231
+ # over to the next period. Set to null if using custom_expiration.
224
232
  #
225
- # @return [Boolean]
226
- required :expires_at_end_of_cadence, Orb::Internal::Type::Boolean
233
+ # @return [Boolean, nil]
234
+ optional :expires_at_end_of_cadence, Orb::Internal::Type::Boolean, nil?: true
227
235
 
228
- # @!method initialize(amount:, cadence:, currency:, expires_at_end_of_cadence:)
236
+ # @!method initialize(amount:, cadence:, currency:, custom_expiration: nil, expires_at_end_of_cadence: nil)
229
237
  # Some parameter documentations has been truncated, see
230
238
  # {Orb::Models::SubscriptionPriceIntervalsParams::Add::AllocationPrice} for more
231
239
  # details.
@@ -238,7 +246,9 @@ module Orb
238
246
  #
239
247
  # @param currency [String] An ISO 4217 currency string or a custom pricing unit identifier in which to bill
240
248
  #
241
- # @param expires_at_end_of_cadence [Boolean] Whether the allocated amount should expire at the end of the cadence or roll ove
249
+ # @param custom_expiration [Orb::Models::SubscriptionPriceIntervalsParams::Add::AllocationPrice::CustomExpiration, nil] The custom expiration for the allocation.
250
+ #
251
+ # @param expires_at_end_of_cadence [Boolean, nil] Whether the allocated amount should expire at the end of the cadence or roll ove
242
252
 
243
253
  # The cadence at which to allocate the amount to the customer.
244
254
  #
@@ -256,6 +266,39 @@ module Orb
256
266
  # @!method self.values
257
267
  # @return [Array<Symbol>]
258
268
  end
269
+
270
+ # @see Orb::Models::SubscriptionPriceIntervalsParams::Add::AllocationPrice#custom_expiration
271
+ class CustomExpiration < Orb::Internal::Type::BaseModel
272
+ # @!attribute duration
273
+ #
274
+ # @return [Integer]
275
+ required :duration, Integer
276
+
277
+ # @!attribute duration_unit
278
+ #
279
+ # @return [Symbol, Orb::Models::SubscriptionPriceIntervalsParams::Add::AllocationPrice::CustomExpiration::DurationUnit]
280
+ required :duration_unit,
281
+ enum: -> {
282
+ Orb::SubscriptionPriceIntervalsParams::Add::AllocationPrice::CustomExpiration::DurationUnit
283
+ }
284
+
285
+ # @!method initialize(duration:, duration_unit:)
286
+ # The custom expiration for the allocation.
287
+ #
288
+ # @param duration [Integer]
289
+ # @param duration_unit [Symbol, Orb::Models::SubscriptionPriceIntervalsParams::Add::AllocationPrice::CustomExpiration::DurationUnit]
290
+
291
+ # @see Orb::Models::SubscriptionPriceIntervalsParams::Add::AllocationPrice::CustomExpiration#duration_unit
292
+ module DurationUnit
293
+ extend Orb::Internal::Type::Enum
294
+
295
+ DAY = :day
296
+ MONTH = :month
297
+
298
+ # @!method self.values
299
+ # @return [Array<Symbol>]
300
+ end
301
+ end
259
302
  end
260
303
 
261
304
  module Discount
@@ -688,14 +688,24 @@ module Orb
688
688
  # @return [String]
689
689
  required :currency, String
690
690
 
691
+ # @!attribute custom_expiration
692
+ # The custom expiration for the allocation.
693
+ #
694
+ # @return [Orb::Models::SubscriptionSchedulePlanChangeParams::AddPrice::AllocationPrice::CustomExpiration, nil]
695
+ optional :custom_expiration,
696
+ -> {
697
+ Orb::SubscriptionSchedulePlanChangeParams::AddPrice::AllocationPrice::CustomExpiration
698
+ },
699
+ nil?: true
700
+
691
701
  # @!attribute expires_at_end_of_cadence
692
702
  # Whether the allocated amount should expire at the end of the cadence or roll
693
- # over to the next period.
703
+ # over to the next period. Set to null if using custom_expiration.
694
704
  #
695
- # @return [Boolean]
696
- required :expires_at_end_of_cadence, Orb::Internal::Type::Boolean
705
+ # @return [Boolean, nil]
706
+ optional :expires_at_end_of_cadence, Orb::Internal::Type::Boolean, nil?: true
697
707
 
698
- # @!method initialize(amount:, cadence:, currency:, expires_at_end_of_cadence:)
708
+ # @!method initialize(amount:, cadence:, currency:, custom_expiration: nil, expires_at_end_of_cadence: nil)
699
709
  # Some parameter documentations has been truncated, see
700
710
  # {Orb::Models::SubscriptionSchedulePlanChangeParams::AddPrice::AllocationPrice}
701
711
  # for more details.
@@ -708,7 +718,9 @@ module Orb
708
718
  #
709
719
  # @param currency [String] An ISO 4217 currency string or a custom pricing unit identifier in which to bill
710
720
  #
711
- # @param expires_at_end_of_cadence [Boolean] Whether the allocated amount should expire at the end of the cadence or roll ove
721
+ # @param custom_expiration [Orb::Models::SubscriptionSchedulePlanChangeParams::AddPrice::AllocationPrice::CustomExpiration, nil] The custom expiration for the allocation.
722
+ #
723
+ # @param expires_at_end_of_cadence [Boolean, nil] Whether the allocated amount should expire at the end of the cadence or roll ove
712
724
 
713
725
  # The cadence at which to allocate the amount to the customer.
714
726
  #
@@ -726,6 +738,39 @@ module Orb
726
738
  # @!method self.values
727
739
  # @return [Array<Symbol>]
728
740
  end
741
+
742
+ # @see Orb::Models::SubscriptionSchedulePlanChangeParams::AddPrice::AllocationPrice#custom_expiration
743
+ class CustomExpiration < Orb::Internal::Type::BaseModel
744
+ # @!attribute duration
745
+ #
746
+ # @return [Integer]
747
+ required :duration, Integer
748
+
749
+ # @!attribute duration_unit
750
+ #
751
+ # @return [Symbol, Orb::Models::SubscriptionSchedulePlanChangeParams::AddPrice::AllocationPrice::CustomExpiration::DurationUnit]
752
+ required :duration_unit,
753
+ enum: -> {
754
+ Orb::SubscriptionSchedulePlanChangeParams::AddPrice::AllocationPrice::CustomExpiration::DurationUnit
755
+ }
756
+
757
+ # @!method initialize(duration:, duration_unit:)
758
+ # The custom expiration for the allocation.
759
+ #
760
+ # @param duration [Integer]
761
+ # @param duration_unit [Symbol, Orb::Models::SubscriptionSchedulePlanChangeParams::AddPrice::AllocationPrice::CustomExpiration::DurationUnit]
762
+
763
+ # @see Orb::Models::SubscriptionSchedulePlanChangeParams::AddPrice::AllocationPrice::CustomExpiration#duration_unit
764
+ module DurationUnit
765
+ extend Orb::Internal::Type::Enum
766
+
767
+ DAY = :day
768
+ MONTH = :month
769
+
770
+ # @!method self.values
771
+ # @return [Array<Symbol>]
772
+ end
773
+ end
729
774
  end
730
775
 
731
776
  class Discount < Orb::Internal::Type::BaseModel
@@ -9974,14 +10019,24 @@ module Orb
9974
10019
  # @return [String]
9975
10020
  required :currency, String
9976
10021
 
10022
+ # @!attribute custom_expiration
10023
+ # The custom expiration for the allocation.
10024
+ #
10025
+ # @return [Orb::Models::SubscriptionSchedulePlanChangeParams::ReplacePrice::AllocationPrice::CustomExpiration, nil]
10026
+ optional :custom_expiration,
10027
+ -> {
10028
+ Orb::SubscriptionSchedulePlanChangeParams::ReplacePrice::AllocationPrice::CustomExpiration
10029
+ },
10030
+ nil?: true
10031
+
9977
10032
  # @!attribute expires_at_end_of_cadence
9978
10033
  # Whether the allocated amount should expire at the end of the cadence or roll
9979
- # over to the next period.
10034
+ # over to the next period. Set to null if using custom_expiration.
9980
10035
  #
9981
- # @return [Boolean]
9982
- required :expires_at_end_of_cadence, Orb::Internal::Type::Boolean
10036
+ # @return [Boolean, nil]
10037
+ optional :expires_at_end_of_cadence, Orb::Internal::Type::Boolean, nil?: true
9983
10038
 
9984
- # @!method initialize(amount:, cadence:, currency:, expires_at_end_of_cadence:)
10039
+ # @!method initialize(amount:, cadence:, currency:, custom_expiration: nil, expires_at_end_of_cadence: nil)
9985
10040
  # Some parameter documentations has been truncated, see
9986
10041
  # {Orb::Models::SubscriptionSchedulePlanChangeParams::ReplacePrice::AllocationPrice}
9987
10042
  # for more details.
@@ -9994,7 +10049,9 @@ module Orb
9994
10049
  #
9995
10050
  # @param currency [String] An ISO 4217 currency string or a custom pricing unit identifier in which to bill
9996
10051
  #
9997
- # @param expires_at_end_of_cadence [Boolean] Whether the allocated amount should expire at the end of the cadence or roll ove
10052
+ # @param custom_expiration [Orb::Models::SubscriptionSchedulePlanChangeParams::ReplacePrice::AllocationPrice::CustomExpiration, nil] The custom expiration for the allocation.
10053
+ #
10054
+ # @param expires_at_end_of_cadence [Boolean, nil] Whether the allocated amount should expire at the end of the cadence or roll ove
9998
10055
 
9999
10056
  # The cadence at which to allocate the amount to the customer.
10000
10057
  #
@@ -10012,6 +10069,39 @@ module Orb
10012
10069
  # @!method self.values
10013
10070
  # @return [Array<Symbol>]
10014
10071
  end
10072
+
10073
+ # @see Orb::Models::SubscriptionSchedulePlanChangeParams::ReplacePrice::AllocationPrice#custom_expiration
10074
+ class CustomExpiration < Orb::Internal::Type::BaseModel
10075
+ # @!attribute duration
10076
+ #
10077
+ # @return [Integer]
10078
+ required :duration, Integer
10079
+
10080
+ # @!attribute duration_unit
10081
+ #
10082
+ # @return [Symbol, Orb::Models::SubscriptionSchedulePlanChangeParams::ReplacePrice::AllocationPrice::CustomExpiration::DurationUnit]
10083
+ required :duration_unit,
10084
+ enum: -> {
10085
+ Orb::SubscriptionSchedulePlanChangeParams::ReplacePrice::AllocationPrice::CustomExpiration::DurationUnit
10086
+ }
10087
+
10088
+ # @!method initialize(duration:, duration_unit:)
10089
+ # The custom expiration for the allocation.
10090
+ #
10091
+ # @param duration [Integer]
10092
+ # @param duration_unit [Symbol, Orb::Models::SubscriptionSchedulePlanChangeParams::ReplacePrice::AllocationPrice::CustomExpiration::DurationUnit]
10093
+
10094
+ # @see Orb::Models::SubscriptionSchedulePlanChangeParams::ReplacePrice::AllocationPrice::CustomExpiration#duration_unit
10095
+ module DurationUnit
10096
+ extend Orb::Internal::Type::Enum
10097
+
10098
+ DAY = :day
10099
+ MONTH = :month
10100
+
10101
+ # @!method self.values
10102
+ # @return [Array<Symbol>]
10103
+ end
10104
+ end
10015
10105
  end
10016
10106
 
10017
10107
  class Discount < Orb::Internal::Type::BaseModel
data/lib/orb/models.rb CHANGED
@@ -59,6 +59,14 @@ module Orb
59
59
 
60
60
  AmountDiscount = Orb::Models::AmountDiscount
61
61
 
62
+ Beta = Orb::Models::Beta
63
+
64
+ BetaCreatePlanVersionParams = Orb::Models::BetaCreatePlanVersionParams
65
+
66
+ BetaFetchPlanVersionParams = Orb::Models::BetaFetchPlanVersionParams
67
+
68
+ BetaSetDefaultPlanVersionParams = Orb::Models::BetaSetDefaultPlanVersionParams
69
+
62
70
  BillableMetric = Orb::Models::BillableMetric
63
71
 
64
72
  BillingCycleRelativeDate = Orb::Models::BillingCycleRelativeDate
@@ -190,14 +198,18 @@ module Orb
190
198
 
191
199
  Plans = Orb::Models::Plans
192
200
 
193
- PlanSetDefaultVersionParams = Orb::Models::PlanSetDefaultVersionParams
194
-
195
201
  PlanUpdateParams = Orb::Models::PlanUpdateParams
196
202
 
203
+ PlanVersion = Orb::Models::PlanVersion
204
+
205
+ PlanVersionPhase = Orb::Models::PlanVersionPhase
206
+
197
207
  Price = Orb::Models::Price
198
208
 
199
209
  PriceCreateParams = Orb::Models::PriceCreateParams
200
210
 
211
+ PriceEvaluateMultipleParams = Orb::Models::PriceEvaluateMultipleParams
212
+
201
213
  PriceEvaluateParams = Orb::Models::PriceEvaluateParams
202
214
 
203
215
  PriceFetchParams = Orb::Models::PriceFetchParams
@@ -0,0 +1,113 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Orb
4
+ module Resources
5
+ class Beta
6
+ class ExternalPlanID
7
+ # This API endpoint is in beta and its interface may change. It is recommended for
8
+ # use only in test mode.
9
+ #
10
+ # This endpoint allows the creation of a new plan version for an existing plan.
11
+ #
12
+ # @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: {})
13
+ #
14
+ # @param external_plan_id [String]
15
+ #
16
+ # @param version [Integer] New version number.
17
+ #
18
+ # @param add_adjustments [Array<Orb::Models::Beta::ExternalPlanIDCreatePlanVersionParams::AddAdjustment>, nil] Additional adjustments to be added to the plan.
19
+ #
20
+ # @param add_prices [Array<Orb::Models::Beta::ExternalPlanIDCreatePlanVersionParams::AddPrice>, nil] Additional prices to be added to the plan.
21
+ #
22
+ # @param remove_adjustments [Array<Orb::Models::Beta::ExternalPlanIDCreatePlanVersionParams::RemoveAdjustment>, nil] Adjustments to be removed from the plan.
23
+ #
24
+ # @param remove_prices [Array<Orb::Models::Beta::ExternalPlanIDCreatePlanVersionParams::RemovePrice>, nil] Prices to be removed from the plan.
25
+ #
26
+ # @param replace_adjustments [Array<Orb::Models::Beta::ExternalPlanIDCreatePlanVersionParams::ReplaceAdjustment>, nil] Adjustments to be replaced with additional adjustments on the plan.
27
+ #
28
+ # @param replace_prices [Array<Orb::Models::Beta::ExternalPlanIDCreatePlanVersionParams::ReplacePrice>, nil] Prices to be replaced with additional prices on the plan.
29
+ #
30
+ # @param set_as_default [Boolean, nil] Set this new plan version as the default
31
+ #
32
+ # @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil]
33
+ #
34
+ # @return [Orb::Models::PlanVersion]
35
+ #
36
+ # @see Orb::Models::Beta::ExternalPlanIDCreatePlanVersionParams
37
+ def create_plan_version(external_plan_id, params)
38
+ parsed, options = Orb::Beta::ExternalPlanIDCreatePlanVersionParams.dump_request(params)
39
+ @client.request(
40
+ method: :post,
41
+ path: ["plans/external_plan_id/%1$s/versions", external_plan_id],
42
+ body: parsed,
43
+ model: Orb::PlanVersion,
44
+ options: options
45
+ )
46
+ end
47
+
48
+ # This API endpoint is in beta and its interface may change. It is recommended for
49
+ # use only in test mode.
50
+ #
51
+ # This endpoint is used to fetch a plan version. It returns the phases, prices,
52
+ # and adjustments present on this version of the plan.
53
+ #
54
+ # @overload fetch_plan_version(version, external_plan_id:, request_options: {})
55
+ #
56
+ # @param version [String]
57
+ # @param external_plan_id [String]
58
+ # @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil]
59
+ #
60
+ # @return [Orb::Models::PlanVersion]
61
+ #
62
+ # @see Orb::Models::Beta::ExternalPlanIDFetchPlanVersionParams
63
+ def fetch_plan_version(version, params)
64
+ parsed, options = Orb::Beta::ExternalPlanIDFetchPlanVersionParams.dump_request(params)
65
+ external_plan_id =
66
+ parsed.delete(:external_plan_id) do
67
+ raise ArgumentError.new("missing required path argument #{_1}")
68
+ end
69
+ @client.request(
70
+ method: :get,
71
+ path: ["plans/external_plan_id/%1$s/versions/%2$s", external_plan_id, version],
72
+ model: Orb::PlanVersion,
73
+ options: options
74
+ )
75
+ end
76
+
77
+ # This API endpoint is in beta and its interface may change. It is recommended for
78
+ # use only in test mode.
79
+ #
80
+ # This endpoint allows setting the default version of a plan.
81
+ #
82
+ # @overload set_default_plan_version(external_plan_id, version:, request_options: {})
83
+ #
84
+ # @param external_plan_id [String]
85
+ #
86
+ # @param version [Integer] Plan version to set as the default.
87
+ #
88
+ # @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil]
89
+ #
90
+ # @return [Orb::Models::Plan]
91
+ #
92
+ # @see Orb::Models::Beta::ExternalPlanIDSetDefaultPlanVersionParams
93
+ def set_default_plan_version(external_plan_id, params)
94
+ parsed, options = Orb::Beta::ExternalPlanIDSetDefaultPlanVersionParams.dump_request(params)
95
+ @client.request(
96
+ method: :post,
97
+ path: ["plans/external_plan_id/%1$s/set_default_version", external_plan_id],
98
+ body: parsed,
99
+ model: Orb::Plan,
100
+ options: options
101
+ )
102
+ end
103
+
104
+ # @api private
105
+ #
106
+ # @param client [Orb::Client]
107
+ def initialize(client:)
108
+ @client = client
109
+ end
110
+ end
111
+ end
112
+ end
113
+ end