dodopayments 1.19.0 → 1.20.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 +25 -0
  3. data/README.md +5 -5
  4. data/lib/dodopayments/client.rb +12 -9
  5. data/lib/dodopayments/internal/transport/base_client.rb +1 -1
  6. data/lib/dodopayments/internal/util.rb +3 -3
  7. data/lib/dodopayments/models/addon_cart_response_item.rb +23 -0
  8. data/lib/dodopayments/models/addon_create_params.rb +58 -0
  9. data/lib/dodopayments/models/addon_list_params.rb +30 -0
  10. data/lib/dodopayments/models/addon_response.rb +93 -0
  11. data/lib/dodopayments/models/addon_retrieve_params.rb +14 -0
  12. data/lib/dodopayments/models/addon_update_images_params.rb +14 -0
  13. data/lib/dodopayments/models/addon_update_images_response.rb +22 -0
  14. data/lib/dodopayments/models/addon_update_params.rb +66 -0
  15. data/lib/dodopayments/models/currency.rb +158 -0
  16. data/lib/dodopayments/models/payment.rb +14 -315
  17. data/lib/dodopayments/models/payment_create_params.rb +3 -158
  18. data/lib/dodopayments/models/payment_list_response.rb +3 -157
  19. data/lib/dodopayments/models/payout_list_response.rb +3 -157
  20. data/lib/dodopayments/models/price.rb +6 -314
  21. data/lib/dodopayments/models/product.rb +3 -19
  22. data/lib/dodopayments/models/product_create_params.rb +3 -17
  23. data/lib/dodopayments/models/product_list_response.rb +6 -176
  24. data/lib/dodopayments/models/product_update_params.rb +3 -17
  25. data/lib/dodopayments/models/refund.rb +3 -157
  26. data/lib/dodopayments/models/subscription.rb +21 -158
  27. data/lib/dodopayments/models/subscription_create_params.rb +30 -159
  28. data/lib/dodopayments/models/subscription_create_response.rb +10 -1
  29. data/lib/dodopayments/models/subscription_list_response.rb +179 -0
  30. data/lib/dodopayments/models/subscription_update_params.rb +19 -1
  31. data/lib/dodopayments/models/tax_category.rb +19 -0
  32. data/lib/dodopayments/resources/addons.rb +141 -0
  33. data/lib/dodopayments/resources/payments.rb +1 -1
  34. data/lib/dodopayments/resources/products.rb +2 -2
  35. data/lib/dodopayments/resources/subscriptions.rb +9 -5
  36. data/lib/dodopayments/version.rb +1 -1
  37. data/lib/dodopayments.rb +12 -0
  38. data/rbi/dodopayments/client.rbi +7 -5
  39. data/rbi/dodopayments/errors.rbi +1 -1
  40. data/rbi/dodopayments/models/addon_cart_response_item.rbi +20 -0
  41. data/rbi/dodopayments/models/addon_create_params.rbi +69 -0
  42. data/rbi/dodopayments/models/addon_list_params.rbi +45 -0
  43. data/rbi/dodopayments/models/addon_response.rbi +103 -0
  44. data/rbi/dodopayments/models/addon_retrieve_params.rbi +19 -0
  45. data/rbi/dodopayments/models/addon_update_images_params.rbi +19 -0
  46. data/rbi/dodopayments/models/addon_update_images_response.rbi +19 -0
  47. data/rbi/dodopayments/models/addon_update_params.rbi +77 -0
  48. data/rbi/dodopayments/models/currency.rbi +161 -0
  49. data/rbi/dodopayments/models/payment.rbi +15 -318
  50. data/rbi/dodopayments/models/payment_create_params.rbi +3 -159
  51. data/rbi/dodopayments/models/payment_list_response.rbi +3 -159
  52. data/rbi/dodopayments/models/payout_list_response.rbi +3 -159
  53. data/rbi/dodopayments/models/price.rbi +6 -318
  54. data/rbi/dodopayments/models/product.rbi +3 -20
  55. data/rbi/dodopayments/models/product_create_params.rbi +3 -21
  56. data/rbi/dodopayments/models/product_list_response.rbi +6 -180
  57. data/rbi/dodopayments/models/product_update_params.rbi +3 -21
  58. data/rbi/dodopayments/models/refund.rbi +3 -159
  59. data/rbi/dodopayments/models/subscription.rbi +19 -159
  60. data/rbi/dodopayments/models/subscription_create_params.rbi +27 -160
  61. data/rbi/dodopayments/models/subscription_create_response.rbi +8 -0
  62. data/rbi/dodopayments/models/subscription_list_response.rbi +190 -0
  63. data/rbi/dodopayments/models/subscription_update_params.rbi +37 -1
  64. data/rbi/dodopayments/models/tax_category.rbi +22 -0
  65. data/rbi/dodopayments/resources/addons.rbi +97 -0
  66. data/rbi/dodopayments/resources/payments.rbi +1 -1
  67. data/rbi/dodopayments/resources/products.rbi +2 -2
  68. data/rbi/dodopayments/resources/subscriptions.rbi +13 -2
  69. data/sig/dodopayments/client.rbs +4 -2
  70. data/sig/dodopayments/models/addon_cart_response_item.rbs +15 -0
  71. data/sig/dodopayments/models/addon_create_params.rbs +39 -0
  72. data/sig/dodopayments/models/addon_list_params.rbs +24 -0
  73. data/sig/dodopayments/models/addon_response.rbs +54 -0
  74. data/sig/dodopayments/models/addon_retrieve_params.rbs +15 -0
  75. data/sig/dodopayments/models/addon_update_images_params.rbs +15 -0
  76. data/sig/dodopayments/models/addon_update_images_response.rbs +15 -0
  77. data/sig/dodopayments/models/addon_update_params.rbs +43 -0
  78. data/sig/dodopayments/models/currency.rbs +302 -0
  79. data/sig/dodopayments/models/payment.rbs +10 -604
  80. data/sig/dodopayments/models/payment_create_params.rbs +3 -302
  81. data/sig/dodopayments/models/payment_list_response.rbs +3 -302
  82. data/sig/dodopayments/models/payout_list_response.rbs +3 -302
  83. data/sig/dodopayments/models/price.rbs +6 -604
  84. data/sig/dodopayments/models/product.rbs +3 -16
  85. data/sig/dodopayments/models/product_create_params.rbs +3 -16
  86. data/sig/dodopayments/models/product_list_response.rbs +6 -318
  87. data/sig/dodopayments/models/product_update_params.rbs +3 -16
  88. data/sig/dodopayments/models/refund.rbs +3 -302
  89. data/sig/dodopayments/models/subscription.rbs +11 -302
  90. data/sig/dodopayments/models/subscription_create_params.rbs +19 -302
  91. data/sig/dodopayments/models/subscription_create_response.rbs +4 -0
  92. data/sig/dodopayments/models/subscription_list_response.rbs +98 -0
  93. data/sig/dodopayments/models/subscription_update_params.rbs +14 -0
  94. data/sig/dodopayments/models/tax_category.rbs +16 -0
  95. data/sig/dodopayments/resources/addons.rbs +43 -0
  96. data/sig/dodopayments/resources/payments.rbs +1 -1
  97. data/sig/dodopayments/resources/products.rbs +2 -2
  98. data/sig/dodopayments/resources/subscriptions.rbs +4 -2
  99. metadata +40 -4
@@ -0,0 +1,190 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ class SubscriptionListResponse < Dodopayments::Internal::Type::BaseModel
6
+ sig { returns(Dodopayments::Models::BillingAddress) }
7
+ attr_reader :billing
8
+
9
+ sig { params(billing: T.any(Dodopayments::Models::BillingAddress, Dodopayments::Internal::AnyHash)).void }
10
+ attr_writer :billing
11
+
12
+ # Timestamp when the subscription was created
13
+ sig { returns(Time) }
14
+ attr_accessor :created_at
15
+
16
+ sig { returns(Dodopayments::Models::Currency::TaggedSymbol) }
17
+ attr_accessor :currency
18
+
19
+ sig { returns(Dodopayments::Models::CustomerLimitedDetails) }
20
+ attr_reader :customer
21
+
22
+ sig do
23
+ params(customer: T.any(Dodopayments::Models::CustomerLimitedDetails, Dodopayments::Internal::AnyHash)).void
24
+ end
25
+ attr_writer :customer
26
+
27
+ sig { returns(T::Hash[Symbol, String]) }
28
+ attr_accessor :metadata
29
+
30
+ # Timestamp of the next scheduled billing. Indicates the end of current billing
31
+ # period
32
+ sig { returns(Time) }
33
+ attr_accessor :next_billing_date
34
+
35
+ # Wether the subscription is on-demand or not
36
+ sig { returns(T::Boolean) }
37
+ attr_accessor :on_demand
38
+
39
+ # Number of payment frequency intervals
40
+ sig { returns(Integer) }
41
+ attr_accessor :payment_frequency_count
42
+
43
+ sig { returns(Dodopayments::Models::TimeInterval::TaggedSymbol) }
44
+ attr_accessor :payment_frequency_interval
45
+
46
+ # Timestamp of the last payment. Indicates the start of current billing period
47
+ sig { returns(Time) }
48
+ attr_accessor :previous_billing_date
49
+
50
+ # Identifier of the product associated with this subscription
51
+ sig { returns(String) }
52
+ attr_accessor :product_id
53
+
54
+ # Number of units/items included in the subscription
55
+ sig { returns(Integer) }
56
+ attr_accessor :quantity
57
+
58
+ # Amount charged before tax for each recurring payment in smallest currency unit
59
+ # (e.g. cents)
60
+ sig { returns(Integer) }
61
+ attr_accessor :recurring_pre_tax_amount
62
+
63
+ sig { returns(Dodopayments::Models::SubscriptionStatus::TaggedSymbol) }
64
+ attr_accessor :status
65
+
66
+ # Unique identifier for the subscription
67
+ sig { returns(String) }
68
+ attr_accessor :subscription_id
69
+
70
+ # Number of subscription period intervals
71
+ sig { returns(Integer) }
72
+ attr_accessor :subscription_period_count
73
+
74
+ sig { returns(Dodopayments::Models::TimeInterval::TaggedSymbol) }
75
+ attr_accessor :subscription_period_interval
76
+
77
+ # Indicates if the recurring_pre_tax_amount is tax inclusive
78
+ sig { returns(T::Boolean) }
79
+ attr_accessor :tax_inclusive
80
+
81
+ # Number of days in the trial period (0 if no trial)
82
+ sig { returns(Integer) }
83
+ attr_accessor :trial_period_days
84
+
85
+ # Cancelled timestamp if the subscription is cancelled
86
+ sig { returns(T.nilable(Time)) }
87
+ attr_accessor :cancelled_at
88
+
89
+ # The discount id if discount is applied
90
+ sig { returns(T.nilable(String)) }
91
+ attr_accessor :discount_id
92
+
93
+ # Response struct representing subscription details
94
+ sig do
95
+ params(
96
+ billing: T.any(Dodopayments::Models::BillingAddress, Dodopayments::Internal::AnyHash),
97
+ created_at: Time,
98
+ currency: Dodopayments::Models::Currency::OrSymbol,
99
+ customer: T.any(Dodopayments::Models::CustomerLimitedDetails, Dodopayments::Internal::AnyHash),
100
+ metadata: T::Hash[Symbol, String],
101
+ next_billing_date: Time,
102
+ on_demand: T::Boolean,
103
+ payment_frequency_count: Integer,
104
+ payment_frequency_interval: Dodopayments::Models::TimeInterval::OrSymbol,
105
+ previous_billing_date: Time,
106
+ product_id: String,
107
+ quantity: Integer,
108
+ recurring_pre_tax_amount: Integer,
109
+ status: Dodopayments::Models::SubscriptionStatus::OrSymbol,
110
+ subscription_id: String,
111
+ subscription_period_count: Integer,
112
+ subscription_period_interval: Dodopayments::Models::TimeInterval::OrSymbol,
113
+ tax_inclusive: T::Boolean,
114
+ trial_period_days: Integer,
115
+ cancelled_at: T.nilable(Time),
116
+ discount_id: T.nilable(String)
117
+ )
118
+ .returns(T.attached_class)
119
+ end
120
+ def self.new(
121
+ billing:,
122
+ # Timestamp when the subscription was created
123
+ created_at:,
124
+ currency:,
125
+ customer:,
126
+ metadata:,
127
+ # Timestamp of the next scheduled billing. Indicates the end of current billing
128
+ # period
129
+ next_billing_date:,
130
+ # Wether the subscription is on-demand or not
131
+ on_demand:,
132
+ # Number of payment frequency intervals
133
+ payment_frequency_count:,
134
+ payment_frequency_interval:,
135
+ # Timestamp of the last payment. Indicates the start of current billing period
136
+ previous_billing_date:,
137
+ # Identifier of the product associated with this subscription
138
+ product_id:,
139
+ # Number of units/items included in the subscription
140
+ quantity:,
141
+ # Amount charged before tax for each recurring payment in smallest currency unit
142
+ # (e.g. cents)
143
+ recurring_pre_tax_amount:,
144
+ status:,
145
+ # Unique identifier for the subscription
146
+ subscription_id:,
147
+ # Number of subscription period intervals
148
+ subscription_period_count:,
149
+ subscription_period_interval:,
150
+ # Indicates if the recurring_pre_tax_amount is tax inclusive
151
+ tax_inclusive:,
152
+ # Number of days in the trial period (0 if no trial)
153
+ trial_period_days:,
154
+ # Cancelled timestamp if the subscription is cancelled
155
+ cancelled_at: nil,
156
+ # The discount id if discount is applied
157
+ discount_id: nil
158
+ ); end
159
+ sig do
160
+ override
161
+ .returns(
162
+ {
163
+ billing: Dodopayments::Models::BillingAddress,
164
+ created_at: Time,
165
+ currency: Dodopayments::Models::Currency::TaggedSymbol,
166
+ customer: Dodopayments::Models::CustomerLimitedDetails,
167
+ metadata: T::Hash[Symbol, String],
168
+ next_billing_date: Time,
169
+ on_demand: T::Boolean,
170
+ payment_frequency_count: Integer,
171
+ payment_frequency_interval: Dodopayments::Models::TimeInterval::TaggedSymbol,
172
+ previous_billing_date: Time,
173
+ product_id: String,
174
+ quantity: Integer,
175
+ recurring_pre_tax_amount: Integer,
176
+ status: Dodopayments::Models::SubscriptionStatus::TaggedSymbol,
177
+ subscription_id: String,
178
+ subscription_period_count: Integer,
179
+ subscription_period_interval: Dodopayments::Models::TimeInterval::TaggedSymbol,
180
+ tax_inclusive: T::Boolean,
181
+ trial_period_days: Integer,
182
+ cancelled_at: T.nilable(Time),
183
+ discount_id: T.nilable(String)
184
+ }
185
+ )
186
+ end
187
+ def to_hash; end
188
+ end
189
+ end
190
+ end
@@ -15,6 +15,19 @@ module Dodopayments
15
15
  end
16
16
  attr_writer :billing
17
17
 
18
+ sig { returns(T.nilable(Dodopayments::Models::SubscriptionUpdateParams::DisableOnDemand)) }
19
+ attr_reader :disable_on_demand
20
+
21
+ sig do
22
+ params(
23
+ disable_on_demand: T.nilable(
24
+ T.any(Dodopayments::Models::SubscriptionUpdateParams::DisableOnDemand, Dodopayments::Internal::AnyHash)
25
+ )
26
+ )
27
+ .void
28
+ end
29
+ attr_writer :disable_on_demand
30
+
18
31
  sig { returns(T.nilable(T::Hash[Symbol, String])) }
19
32
  attr_accessor :metadata
20
33
 
@@ -27,6 +40,9 @@ module Dodopayments
27
40
  sig do
28
41
  params(
29
42
  billing: T.nilable(T.any(Dodopayments::Models::BillingAddress, Dodopayments::Internal::AnyHash)),
43
+ disable_on_demand: T.nilable(
44
+ T.any(Dodopayments::Models::SubscriptionUpdateParams::DisableOnDemand, Dodopayments::Internal::AnyHash)
45
+ ),
30
46
  metadata: T.nilable(T::Hash[Symbol, String]),
31
47
  status: T.nilable(Dodopayments::Models::SubscriptionStatus::OrSymbol),
32
48
  tax_id: T.nilable(String),
@@ -34,13 +50,22 @@ module Dodopayments
34
50
  )
35
51
  .returns(T.attached_class)
36
52
  end
37
- def self.new(billing: nil, metadata: nil, status: nil, tax_id: nil, request_options: {}); end
53
+ def self.new(
54
+ billing: nil,
55
+ disable_on_demand: nil,
56
+ metadata: nil,
57
+ status: nil,
58
+ tax_id: nil,
59
+ request_options: {}
60
+ )
61
+ end
38
62
 
39
63
  sig do
40
64
  override
41
65
  .returns(
42
66
  {
43
67
  billing: T.nilable(Dodopayments::Models::BillingAddress),
68
+ disable_on_demand: T.nilable(Dodopayments::Models::SubscriptionUpdateParams::DisableOnDemand),
44
69
  metadata: T.nilable(T::Hash[Symbol, String]),
45
70
  status: T.nilable(Dodopayments::Models::SubscriptionStatus::OrSymbol),
46
71
  tax_id: T.nilable(String),
@@ -49,6 +74,17 @@ module Dodopayments
49
74
  )
50
75
  end
51
76
  def to_hash; end
77
+
78
+ class DisableOnDemand < Dodopayments::Internal::Type::BaseModel
79
+ sig { returns(Time) }
80
+ attr_accessor :next_billing_date
81
+
82
+ sig { params(next_billing_date: Time).returns(T.attached_class) }
83
+ def self.new(next_billing_date:); end
84
+
85
+ sig { override.returns({next_billing_date: Time}) }
86
+ def to_hash; end
87
+ end
52
88
  end
53
89
  end
54
90
  end
@@ -0,0 +1,22 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ # Represents the different categories of taxation applicable to various products
6
+ # and services.
7
+ module TaxCategory
8
+ extend Dodopayments::Internal::Type::Enum
9
+
10
+ TaggedSymbol = T.type_alias { T.all(Symbol, Dodopayments::Models::TaxCategory) }
11
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
12
+
13
+ DIGITAL_PRODUCTS = T.let(:digital_products, Dodopayments::Models::TaxCategory::TaggedSymbol)
14
+ SAAS = T.let(:saas, Dodopayments::Models::TaxCategory::TaggedSymbol)
15
+ E_BOOK = T.let(:e_book, Dodopayments::Models::TaxCategory::TaggedSymbol)
16
+ EDTECH = T.let(:edtech, Dodopayments::Models::TaxCategory::TaggedSymbol)
17
+
18
+ sig { override.returns(T::Array[Dodopayments::Models::TaxCategory::TaggedSymbol]) }
19
+ def self.values; end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,97 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Resources
5
+ class Addons
6
+ sig do
7
+ params(
8
+ currency: Dodopayments::Models::Currency::OrSymbol,
9
+ name: String,
10
+ price: Integer,
11
+ tax_category: Dodopayments::Models::TaxCategory::OrSymbol,
12
+ description: T.nilable(String),
13
+ request_options: Dodopayments::RequestOpts
14
+ )
15
+ .returns(Dodopayments::Models::AddonResponse)
16
+ end
17
+ def create(
18
+ currency:,
19
+ # Name of the Addon
20
+ name:,
21
+ # Amount of the addon
22
+ price:,
23
+ # Represents the different categories of taxation applicable to various products
24
+ # and services.
25
+ tax_category:,
26
+ # Optional description of the Addon
27
+ description: nil,
28
+ request_options: {}
29
+ ); end
30
+ sig do
31
+ params(id: String, request_options: Dodopayments::RequestOpts).returns(Dodopayments::Models::AddonResponse)
32
+ end
33
+ def retrieve(
34
+ # Addon Id
35
+ id,
36
+ request_options: {}
37
+ ); end
38
+ sig do
39
+ params(
40
+ id: String,
41
+ currency: T.nilable(Dodopayments::Models::Currency::OrSymbol),
42
+ description: T.nilable(String),
43
+ image_id: T.nilable(String),
44
+ name: T.nilable(String),
45
+ price: T.nilable(Integer),
46
+ tax_category: T.nilable(Dodopayments::Models::TaxCategory::OrSymbol),
47
+ request_options: Dodopayments::RequestOpts
48
+ )
49
+ .returns(Dodopayments::Models::AddonResponse)
50
+ end
51
+ def update(
52
+ # Addon Id
53
+ id,
54
+ currency: nil,
55
+ # Description of the Addon, optional and must be at most 1000 characters.
56
+ description: nil,
57
+ # Addon image id after its uploaded to S3
58
+ image_id: nil,
59
+ # Name of the Addon, optional and must be at most 100 characters.
60
+ name: nil,
61
+ # Amount of the addon
62
+ price: nil,
63
+ # Represents the different categories of taxation applicable to various products
64
+ # and services.
65
+ tax_category: nil,
66
+ request_options: {}
67
+ ); end
68
+ sig do
69
+ params(
70
+ page_number: T.nilable(Integer),
71
+ page_size: T.nilable(Integer),
72
+ request_options: Dodopayments::RequestOpts
73
+ )
74
+ .returns(Dodopayments::Internal::DefaultPageNumberPagination[Dodopayments::Models::AddonResponse])
75
+ end
76
+ def list(
77
+ # Page number default is 0
78
+ page_number: nil,
79
+ # Page size default is 10 max is 100
80
+ page_size: nil,
81
+ request_options: {}
82
+ ); end
83
+ sig do
84
+ params(id: String, request_options: Dodopayments::RequestOpts)
85
+ .returns(Dodopayments::Models::AddonUpdateImagesResponse)
86
+ end
87
+ def update_images(
88
+ # Addon Id
89
+ id,
90
+ request_options: {}
91
+ ); end
92
+ # @api private
93
+ sig { params(client: Dodopayments::Client).returns(T.attached_class) }
94
+ def self.new(client:); end
95
+ end
96
+ end
97
+ end
@@ -13,7 +13,7 @@ module Dodopayments
13
13
  ),
14
14
  product_cart: T::Array[T.any(Dodopayments::Models::OneTimeProductCartItem, Dodopayments::Internal::AnyHash)],
15
15
  allowed_payment_method_types: T.nilable(T::Array[Dodopayments::Models::PaymentCreateParams::AllowedPaymentMethodType::OrSymbol]),
16
- billing_currency: T.nilable(Dodopayments::Models::PaymentCreateParams::BillingCurrency::OrSymbol),
16
+ billing_currency: T.nilable(Dodopayments::Models::Currency::OrSymbol),
17
17
  discount_code: T.nilable(String),
18
18
  metadata: T::Hash[Symbol, String],
19
19
  payment_link: T.nilable(T::Boolean),
@@ -13,7 +13,7 @@ module Dodopayments
13
13
  Dodopayments::Internal::AnyHash,
14
14
  Dodopayments::Models::Price::RecurringPrice
15
15
  ),
16
- tax_category: Dodopayments::Models::ProductCreateParams::TaxCategory::OrSymbol,
16
+ tax_category: Dodopayments::Models::TaxCategory::OrSymbol,
17
17
  addons: T.nilable(T::Array[String]),
18
18
  description: T.nilable(String),
19
19
  license_key_activation_message: T.nilable(String),
@@ -69,7 +69,7 @@ module Dodopayments
69
69
  Dodopayments::Models::Price::RecurringPrice
70
70
  )
71
71
  ),
72
- tax_category: T.nilable(Dodopayments::Models::ProductUpdateParams::TaxCategory::OrSymbol),
72
+ tax_category: T.nilable(Dodopayments::Models::TaxCategory::OrSymbol),
73
73
  request_options: Dodopayments::RequestOpts
74
74
  )
75
75
  .void
@@ -13,8 +13,11 @@ module Dodopayments
13
13
  ),
14
14
  product_id: String,
15
15
  quantity: Integer,
16
+ addons: T.nilable(
17
+ T::Array[T.any(Dodopayments::Models::SubscriptionCreateParams::Addon, Dodopayments::Internal::AnyHash)]
18
+ ),
16
19
  allowed_payment_method_types: T.nilable(T::Array[Dodopayments::Models::SubscriptionCreateParams::AllowedPaymentMethodType::OrSymbol]),
17
- billing_currency: T.nilable(Dodopayments::Models::SubscriptionCreateParams::BillingCurrency::OrSymbol),
20
+ billing_currency: T.nilable(Dodopayments::Models::Currency::OrSymbol),
18
21
  discount_code: T.nilable(String),
19
22
  metadata: T::Hash[Symbol, String],
20
23
  on_demand: T.nilable(
@@ -36,6 +39,8 @@ module Dodopayments
36
39
  product_id:,
37
40
  # Number of units to subscribe for. Must be at least 1.
38
41
  quantity:,
42
+ # Attach addons to this subscription
43
+ addons: nil,
39
44
  # List of payment methods allowed during checkout.
40
45
  #
41
46
  # Customers will **never** see payment methods that are **not** in this list.
@@ -75,6 +80,9 @@ module Dodopayments
75
80
  params(
76
81
  subscription_id: String,
77
82
  billing: T.nilable(T.any(Dodopayments::Models::BillingAddress, Dodopayments::Internal::AnyHash)),
83
+ disable_on_demand: T.nilable(
84
+ T.any(Dodopayments::Models::SubscriptionUpdateParams::DisableOnDemand, Dodopayments::Internal::AnyHash)
85
+ ),
78
86
  metadata: T.nilable(T::Hash[Symbol, String]),
79
87
  status: T.nilable(Dodopayments::Models::SubscriptionStatus::OrSymbol),
80
88
  tax_id: T.nilable(String),
@@ -86,6 +94,7 @@ module Dodopayments
86
94
  # Subscription Id
87
95
  subscription_id,
88
96
  billing: nil,
97
+ disable_on_demand: nil,
89
98
  metadata: nil,
90
99
  status: nil,
91
100
  tax_id: nil,
@@ -101,7 +110,9 @@ module Dodopayments
101
110
  status: T.nilable(Dodopayments::Models::SubscriptionStatus::OrSymbol),
102
111
  request_options: Dodopayments::RequestOpts
103
112
  )
104
- .returns(Dodopayments::Internal::DefaultPageNumberPagination[Dodopayments::Models::Subscription])
113
+ .returns(
114
+ Dodopayments::Internal::DefaultPageNumberPagination[Dodopayments::Models::SubscriptionListResponse]
115
+ )
105
116
  end
106
117
  def list(
107
118
  # Get events after this created time
@@ -13,7 +13,7 @@ module Dodopayments
13
13
  test_mode: "https://test.dodopayments.com"
14
14
  }
15
15
 
16
- attr_reader bearer_token: String
16
+ attr_reader api_key: String
17
17
 
18
18
  attr_reader payments: Dodopayments::Resources::Payments
19
19
 
@@ -43,10 +43,12 @@ module Dodopayments
43
43
 
44
44
  attr_reader discounts: Dodopayments::Resources::Discounts
45
45
 
46
+ attr_reader addons: Dodopayments::Resources::Addons
47
+
46
48
  private def auth_headers: -> ::Hash[String, String]
47
49
 
48
50
  def initialize: (
49
- ?bearer_token: String?,
51
+ ?api_key: String?,
50
52
  ?environment: :live_mode | :test_mode | nil,
51
53
  ?base_url: String?,
52
54
  ?max_retries: Integer,
@@ -0,0 +1,15 @@
1
+ module Dodopayments
2
+ module Models
3
+ type addon_cart_response_item = { addon_id: String, quantity: Integer }
4
+
5
+ class AddonCartResponseItem < Dodopayments::Internal::Type::BaseModel
6
+ attr_accessor addon_id: String
7
+
8
+ attr_accessor quantity: Integer
9
+
10
+ def initialize: (addon_id: String, quantity: Integer) -> void
11
+
12
+ def to_hash: -> Dodopayments::Models::addon_cart_response_item
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,39 @@
1
+ module Dodopayments
2
+ module Models
3
+ type addon_create_params =
4
+ {
5
+ currency: Dodopayments::Models::currency,
6
+ name: String,
7
+ price: Integer,
8
+ tax_category: Dodopayments::Models::tax_category,
9
+ description: String?
10
+ }
11
+ & Dodopayments::Internal::Type::request_parameters
12
+
13
+ class AddonCreateParams < Dodopayments::Internal::Type::BaseModel
14
+ extend Dodopayments::Internal::Type::RequestParameters::Converter
15
+ include Dodopayments::Internal::Type::RequestParameters
16
+
17
+ attr_accessor currency: Dodopayments::Models::currency
18
+
19
+ attr_accessor name: String
20
+
21
+ attr_accessor price: Integer
22
+
23
+ attr_accessor tax_category: Dodopayments::Models::tax_category
24
+
25
+ attr_accessor description: String?
26
+
27
+ def initialize: (
28
+ currency: Dodopayments::Models::currency,
29
+ name: String,
30
+ price: Integer,
31
+ tax_category: Dodopayments::Models::tax_category,
32
+ ?description: String?,
33
+ ?request_options: Dodopayments::request_opts
34
+ ) -> void
35
+
36
+ def to_hash: -> Dodopayments::Models::addon_create_params
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,24 @@
1
+ module Dodopayments
2
+ module Models
3
+ type addon_list_params =
4
+ { page_number: Integer?, page_size: Integer? }
5
+ & Dodopayments::Internal::Type::request_parameters
6
+
7
+ class AddonListParams < Dodopayments::Internal::Type::BaseModel
8
+ extend Dodopayments::Internal::Type::RequestParameters::Converter
9
+ include Dodopayments::Internal::Type::RequestParameters
10
+
11
+ attr_accessor page_number: Integer?
12
+
13
+ attr_accessor page_size: Integer?
14
+
15
+ def initialize: (
16
+ ?page_number: Integer?,
17
+ ?page_size: Integer?,
18
+ ?request_options: Dodopayments::request_opts
19
+ ) -> void
20
+
21
+ def to_hash: -> Dodopayments::Models::addon_list_params
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,54 @@
1
+ module Dodopayments
2
+ module Models
3
+ type addon_response =
4
+ {
5
+ id: String,
6
+ business_id: String,
7
+ created_at: Time,
8
+ currency: Dodopayments::Models::currency,
9
+ name: String,
10
+ price: Integer,
11
+ tax_category: Dodopayments::Models::tax_category,
12
+ updated_at: Time,
13
+ description: String?,
14
+ image: String?
15
+ }
16
+
17
+ class AddonResponse < Dodopayments::Internal::Type::BaseModel
18
+ attr_accessor id: String
19
+
20
+ attr_accessor business_id: String
21
+
22
+ attr_accessor created_at: Time
23
+
24
+ attr_accessor currency: Dodopayments::Models::currency
25
+
26
+ attr_accessor name: String
27
+
28
+ attr_accessor price: Integer
29
+
30
+ attr_accessor tax_category: Dodopayments::Models::tax_category
31
+
32
+ attr_accessor updated_at: Time
33
+
34
+ attr_accessor description: String?
35
+
36
+ attr_accessor image: String?
37
+
38
+ def initialize: (
39
+ id: String,
40
+ business_id: String,
41
+ created_at: Time,
42
+ currency: Dodopayments::Models::currency,
43
+ name: String,
44
+ price: Integer,
45
+ tax_category: Dodopayments::Models::tax_category,
46
+ updated_at: Time,
47
+ ?description: String?,
48
+ ?image: String?
49
+ ) -> void
50
+
51
+ def to_hash: -> Dodopayments::Models::addon_response
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,15 @@
1
+ module Dodopayments
2
+ module Models
3
+ type addon_retrieve_params =
4
+ { } & Dodopayments::Internal::Type::request_parameters
5
+
6
+ class AddonRetrieveParams < Dodopayments::Internal::Type::BaseModel
7
+ extend Dodopayments::Internal::Type::RequestParameters::Converter
8
+ include Dodopayments::Internal::Type::RequestParameters
9
+
10
+ def initialize: (?request_options: Dodopayments::request_opts) -> void
11
+
12
+ def to_hash: -> Dodopayments::Models::addon_retrieve_params
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module Dodopayments
2
+ module Models
3
+ type addon_update_images_params =
4
+ { } & Dodopayments::Internal::Type::request_parameters
5
+
6
+ class AddonUpdateImagesParams < Dodopayments::Internal::Type::BaseModel
7
+ extend Dodopayments::Internal::Type::RequestParameters::Converter
8
+ include Dodopayments::Internal::Type::RequestParameters
9
+
10
+ def initialize: (?request_options: Dodopayments::request_opts) -> void
11
+
12
+ def to_hash: -> Dodopayments::Models::addon_update_images_params
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module Dodopayments
2
+ module Models
3
+ type addon_update_images_response = { image_id: String, url: String }
4
+
5
+ class AddonUpdateImagesResponse < Dodopayments::Internal::Type::BaseModel
6
+ attr_accessor image_id: String
7
+
8
+ attr_accessor url: String
9
+
10
+ def initialize: (image_id: String, url: String) -> void
11
+
12
+ def to_hash: -> Dodopayments::Models::addon_update_images_response
13
+ end
14
+ end
15
+ end