dodopayments 1.17.0 → 1.18.1

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 (113) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +32 -0
  3. data/README.md +1 -1
  4. data/lib/dodopayments/file_part.rb +55 -0
  5. data/lib/dodopayments/internal/transport/base_client.rb +3 -3
  6. data/lib/dodopayments/internal/transport/pooled_net_requester.rb +1 -1
  7. data/lib/dodopayments/internal/type/converter.rb +1 -1
  8. data/lib/dodopayments/internal/type/{io_like.rb → file_input.rb} +8 -4
  9. data/lib/dodopayments/internal/util.rb +69 -61
  10. data/lib/dodopayments/models/billing_address.rb +9 -5
  11. data/lib/dodopayments/models/create_new_customer.rb +8 -1
  12. data/lib/dodopayments/models/customer_limited_details.rb +5 -3
  13. data/lib/dodopayments/models/customer_list_params.rb +4 -2
  14. data/lib/dodopayments/models/customers/customer_portal_create_params.rb +2 -1
  15. data/lib/dodopayments/models/discount.rb +23 -10
  16. data/lib/dodopayments/models/discount_create_params.rb +15 -5
  17. data/lib/dodopayments/models/discount_list_params.rb +4 -2
  18. data/lib/dodopayments/models/discount_update_params.rb +13 -3
  19. data/lib/dodopayments/models/dispute.rb +17 -6
  20. data/lib/dodopayments/models/dispute_list_params.rb +14 -7
  21. data/lib/dodopayments/models/license_key.rb +26 -11
  22. data/lib/dodopayments/models/license_key_instance_list_params.rb +6 -3
  23. data/lib/dodopayments/models/license_key_list_params.rb +10 -5
  24. data/lib/dodopayments/models/license_key_update_params.rb +9 -3
  25. data/lib/dodopayments/models/one_time_product_cart_item.rb +7 -1
  26. data/lib/dodopayments/models/payment.rb +41 -16
  27. data/lib/dodopayments/models/payment_create_params.rb +22 -7
  28. data/lib/dodopayments/models/payment_create_response.rb +16 -6
  29. data/lib/dodopayments/models/payment_list_params.rb +14 -7
  30. data/lib/dodopayments/models/payout_list_params.rb +4 -2
  31. data/lib/dodopayments/models/payout_list_response.rb +27 -13
  32. data/lib/dodopayments/models/price.rb +38 -13
  33. data/lib/dodopayments/models/product.rb +31 -13
  34. data/lib/dodopayments/models/product_create_params.rb +20 -7
  35. data/lib/dodopayments/models/product_list_params.rb +11 -4
  36. data/lib/dodopayments/models/product_list_response.rb +27 -11
  37. data/lib/dodopayments/models/product_update_params.rb +22 -8
  38. data/lib/dodopayments/models/refund.rb +13 -6
  39. data/lib/dodopayments/models/refund_create_params.rb +4 -2
  40. data/lib/dodopayments/models/refund_list_params.rb +12 -6
  41. data/lib/dodopayments/models/subscription.rb +46 -14
  42. data/lib/dodopayments/models/subscription_change_plan_params.rb +47 -0
  43. data/lib/dodopayments/models/subscription_charge_params.rb +6 -1
  44. data/lib/dodopayments/models/subscription_create_params.rb +34 -11
  45. data/lib/dodopayments/models/subscription_create_response.rb +15 -5
  46. data/lib/dodopayments/models/subscription_list_params.rb +12 -6
  47. data/lib/dodopayments/models/webhook_event_list_params.rb +16 -6
  48. data/lib/dodopayments/resources/customers/customer_portal.rb +4 -2
  49. data/lib/dodopayments/resources/customers.rb +10 -4
  50. data/lib/dodopayments/resources/discounts.rb +38 -13
  51. data/lib/dodopayments/resources/disputes.rb +16 -8
  52. data/lib/dodopayments/resources/license_key_instances.rb +11 -5
  53. data/lib/dodopayments/resources/license_keys.rb +23 -10
  54. data/lib/dodopayments/resources/payments.rb +38 -15
  55. data/lib/dodopayments/resources/payouts.rb +4 -2
  56. data/lib/dodopayments/resources/products/images.rb +3 -1
  57. data/lib/dodopayments/resources/products.rb +56 -20
  58. data/lib/dodopayments/resources/refunds.rb +18 -9
  59. data/lib/dodopayments/resources/subscriptions.rb +81 -19
  60. data/lib/dodopayments/resources/webhook_events.rb +16 -6
  61. data/lib/dodopayments/version.rb +1 -1
  62. data/lib/dodopayments.rb +3 -1
  63. data/rbi/lib/dodopayments/file_part.rbi +34 -0
  64. data/rbi/lib/dodopayments/internal/transport/base_client.rbi +17 -3
  65. data/rbi/lib/dodopayments/internal/type/{io_like.rbi → file_input.rbi} +6 -2
  66. data/rbi/lib/dodopayments/internal/util.rbi +24 -19
  67. data/rbi/lib/dodopayments/models/billing_address.rbi +12 -2
  68. data/rbi/lib/dodopayments/models/create_new_customer.rbi +9 -2
  69. data/rbi/lib/dodopayments/models/customer_limited_details.rbi +8 -2
  70. data/rbi/lib/dodopayments/models/customer_list_params.rbi +7 -2
  71. data/rbi/lib/dodopayments/models/customers/customer_portal_create_params.rbi +5 -2
  72. data/rbi/lib/dodopayments/models/discount.rbi +14 -0
  73. data/rbi/lib/dodopayments/models/discount_create_params.rbi +15 -0
  74. data/rbi/lib/dodopayments/models/discount_list_params.rbi +7 -2
  75. data/rbi/lib/dodopayments/models/discount_update_params.rbi +10 -0
  76. data/rbi/lib/dodopayments/models/dispute.rbi +8 -3
  77. data/rbi/lib/dodopayments/models/dispute_list_params.rbi +7 -0
  78. data/rbi/lib/dodopayments/models/license_key.rbi +12 -0
  79. data/rbi/lib/dodopayments/models/license_key_instance_list_params.rbi +9 -2
  80. data/rbi/lib/dodopayments/models/license_key_list_params.rbi +6 -3
  81. data/rbi/lib/dodopayments/models/license_key_update_params.rbi +12 -2
  82. data/rbi/lib/dodopayments/models/one_time_product_cart_item.rbi +8 -2
  83. data/rbi/lib/dodopayments/models/payment.rbi +19 -0
  84. data/rbi/lib/dodopayments/models/payment_create_params.rbi +14 -0
  85. data/rbi/lib/dodopayments/models/payment_create_response.rbi +7 -0
  86. data/rbi/lib/dodopayments/models/payment_list_params.rbi +7 -0
  87. data/rbi/lib/dodopayments/models/payout_list_params.rbi +7 -2
  88. data/rbi/lib/dodopayments/models/payout_list_response.rbi +13 -0
  89. data/rbi/lib/dodopayments/models/price.rbi +25 -0
  90. data/rbi/lib/dodopayments/models/product.rbi +14 -0
  91. data/rbi/lib/dodopayments/models/product_create_params.rbi +8 -0
  92. data/rbi/lib/dodopayments/models/product_list_params.rbi +15 -2
  93. data/rbi/lib/dodopayments/models/product_list_response.rbi +21 -0
  94. data/rbi/lib/dodopayments/models/product_update_params.rbi +18 -0
  95. data/rbi/lib/dodopayments/models/refund.rbi +7 -3
  96. data/rbi/lib/dodopayments/models/refund_create_params.rbi +7 -2
  97. data/rbi/lib/dodopayments/models/refund_list_params.rbi +6 -0
  98. data/rbi/lib/dodopayments/models/subscription.rbi +24 -1
  99. data/rbi/lib/dodopayments/models/subscription_change_plan_params.rbi +71 -0
  100. data/rbi/lib/dodopayments/models/subscription_charge_params.rbi +6 -2
  101. data/rbi/lib/dodopayments/models/subscription_create_params.rbi +25 -2
  102. data/rbi/lib/dodopayments/models/subscription_create_response.rbi +7 -0
  103. data/rbi/lib/dodopayments/models/subscription_list_params.rbi +6 -0
  104. data/rbi/lib/dodopayments/models/webhook_event_list_params.rbi +6 -0
  105. data/rbi/lib/dodopayments/resources/subscriptions.rbi +20 -0
  106. data/sig/dodopayments/file_part.rbs +21 -0
  107. data/sig/dodopayments/internal/transport/base_client.rbs +9 -3
  108. data/sig/dodopayments/internal/type/{io_like.rbs → file_input.rbs} +1 -1
  109. data/sig/dodopayments/internal/util.rbs +14 -12
  110. data/sig/dodopayments/models/subscription.rbs +4 -0
  111. data/sig/dodopayments/models/subscription_change_plan_params.rbs +41 -0
  112. data/sig/dodopayments/resources/subscriptions.rbs +8 -0
  113. metadata +11 -5
@@ -95,20 +95,34 @@ module Dodopayments
95
95
  .returns(T.attached_class)
96
96
  end
97
97
  def self.new(
98
+ # Unique identifier for the business to which the product belongs.
98
99
  business_id:,
100
+ # Timestamp when the product was created.
99
101
  created_at:,
102
+ # Indicates if the product is recurring (e.g., subscriptions).
100
103
  is_recurring:,
104
+ # Indicates whether the product requires a license key.
101
105
  license_key_enabled:,
102
106
  price:,
107
+ # Unique identifier for the product.
103
108
  product_id:,
109
+ # Represents the different categories of taxation applicable to various products
110
+ # and services.
104
111
  tax_category:,
112
+ # Timestamp when the product was last updated.
105
113
  updated_at:,
114
+ # Available Addons for subscription products
106
115
  addons: nil,
116
+ # Description of the product, optional.
107
117
  description: nil,
118
+ # URL of the product image, optional.
108
119
  image: nil,
120
+ # Message sent upon license key activation, if applicable.
109
121
  license_key_activation_message: nil,
122
+ # Limit on the number of activations for the license key, if enabled.
110
123
  license_key_activations_limit: nil,
111
124
  license_key_duration: nil,
125
+ # Name of the product, optional.
112
126
  name: nil
113
127
  ); end
114
128
  sig do
@@ -70,13 +70,21 @@ module Dodopayments
70
70
  end
71
71
  def self.new(
72
72
  price:,
73
+ # Represents the different categories of taxation applicable to various products
74
+ # and services.
73
75
  tax_category:,
76
+ # Addons available for subscription product
74
77
  addons: nil,
78
+ # Optional description of the product
75
79
  description: nil,
80
+ # Optional message displayed during license key activation
76
81
  license_key_activation_message: nil,
82
+ # The number of times the license key can be activated. Must be 0 or greater
77
83
  license_key_activations_limit: nil,
78
84
  license_key_duration: nil,
85
+ # When true, generates and sends a license key to your customer. Defaults to false
79
86
  license_key_enabled: nil,
87
+ # Optional name of the product
80
88
  name: nil,
81
89
  request_options: {}
82
90
  ); end
@@ -39,8 +39,21 @@ module Dodopayments
39
39
  )
40
40
  .returns(T.attached_class)
41
41
  end
42
- def self.new(archived: nil, page_number: nil, page_size: nil, recurring: nil, request_options: {}); end
43
-
42
+ def self.new(
43
+ # List archived products
44
+ archived: nil,
45
+ # Page number default is 0
46
+ page_number: nil,
47
+ # Page size default is 10 max is 100
48
+ page_size: nil,
49
+ # Filter products by pricing type:
50
+ #
51
+ # - `true`: Show only recurring pricing products (e.g. subscriptions)
52
+ # - `false`: Show only one-time price products
53
+ # - `null` or absent: Show both types of products
54
+ recurring: nil,
55
+ request_options: {}
56
+ ); end
44
57
  sig do
45
58
  override
46
59
  .returns(
@@ -92,18 +92,39 @@ module Dodopayments
92
92
  .returns(T.attached_class)
93
93
  end
94
94
  def self.new(
95
+ # Unique identifier for the business to which the product belongs.
95
96
  business_id:,
97
+ # Timestamp when the product was created.
96
98
  created_at:,
99
+ # Indicates if the product is recurring (e.g., subscriptions).
97
100
  is_recurring:,
101
+ # Unique identifier for the product.
98
102
  product_id:,
103
+ # Represents the different categories of taxation applicable to various products
104
+ # and services.
99
105
  tax_category:,
106
+ # Timestamp when the product was last updated.
100
107
  updated_at:,
101
108
  currency: nil,
109
+ # Description of the product, optional.
102
110
  description: nil,
111
+ # URL of the product image, optional.
103
112
  image: nil,
113
+ # Name of the product, optional.
104
114
  name: nil,
115
+ # Price of the product, optional.
116
+ #
117
+ # The price is represented in the lowest denomination of the currency. For
118
+ # example:
119
+ #
120
+ # - In USD, a price of `$12.34` would be represented as `1234` (cents).
121
+ # - In JPY, a price of `¥1500` would be represented as `1500` (yen).
122
+ # - In INR, a price of `₹1234.56` would be represented as `123456` (paise).
123
+ #
124
+ # This ensures precision and avoids floating-point rounding errors.
105
125
  price: nil,
106
126
  price_detail: nil,
127
+ # Indicates if the price is tax inclusive
107
128
  tax_inclusive: nil
108
129
  ); end
109
130
  sig do
@@ -89,15 +89,33 @@ module Dodopayments
89
89
  .returns(T.attached_class)
90
90
  end
91
91
  def self.new(
92
+ # Available Addons for subscription products
92
93
  addons: nil,
94
+ # Description of the product, optional and must be at most 1000 characters.
93
95
  description: nil,
96
+ # Product image id after its uploaded to S3
94
97
  image_id: nil,
98
+ # Message sent to the customer upon license key activation.
99
+ #
100
+ # Only applicable if `license_key_enabled` is `true`. This message contains
101
+ # instructions for activating the license key.
95
102
  license_key_activation_message: nil,
103
+ # Limit for the number of activations for the license key.
104
+ #
105
+ # Only applicable if `license_key_enabled` is `true`. Represents the maximum
106
+ # number of times the license key can be activated.
96
107
  license_key_activations_limit: nil,
97
108
  license_key_duration: nil,
109
+ # Whether the product requires a license key.
110
+ #
111
+ # If `true`, additional fields related to license key (duration, activations
112
+ # limit, activation message) become applicable.
98
113
  license_key_enabled: nil,
114
+ # Name of the product, optional and must be at most 100 characters.
99
115
  name: nil,
100
116
  price: nil,
117
+ # Represents the different categories of taxation applicable to various products
118
+ # and services.
101
119
  tax_category: nil,
102
120
  request_options: {}
103
121
  ); end
@@ -47,17 +47,21 @@ module Dodopayments
47
47
  .returns(T.attached_class)
48
48
  end
49
49
  def self.new(
50
+ # The unique identifier of the business issuing the refund.
50
51
  business_id:,
52
+ # The timestamp of when the refund was created in UTC.
51
53
  created_at:,
54
+ # The unique identifier of the payment associated with the refund.
52
55
  payment_id:,
56
+ # The unique identifier of the refund.
53
57
  refund_id:,
54
58
  status:,
59
+ # The refunded amount.
55
60
  amount: nil,
56
61
  currency: nil,
62
+ # The reason provided for the refund, if any. Optional.
57
63
  reason: nil
58
- )
59
- end
60
-
64
+ ); end
61
65
  sig do
62
66
  override
63
67
  .returns(
@@ -22,8 +22,13 @@ module Dodopayments
22
22
  )
23
23
  .returns(T.attached_class)
24
24
  end
25
- def self.new(payment_id:, reason: nil, request_options: {}); end
26
-
25
+ def self.new(
26
+ # The unique identifier of the payment to be refunded.
27
+ payment_id:,
28
+ # The reason for the refund, if any. Maximum length is 3000 characters. Optional.
29
+ reason: nil,
30
+ request_options: {}
31
+ ); end
27
32
  sig do
28
33
  override
29
34
  .returns({
@@ -43,11 +43,17 @@ module Dodopayments
43
43
  .returns(T.attached_class)
44
44
  end
45
45
  def self.new(
46
+ # Get events after this created time
46
47
  created_at_gte: nil,
48
+ # Get events created before this time
47
49
  created_at_lte: nil,
50
+ # Filter by customer_id
48
51
  customer_id: nil,
52
+ # Page number default is 0
49
53
  page_number: nil,
54
+ # Page size default is 10 max is 100
50
55
  page_size: nil,
56
+ # Filter by status
51
57
  status: nil,
52
58
  request_options: {}
53
59
  ); end
@@ -27,7 +27,8 @@ module Dodopayments
27
27
  sig { returns(T::Hash[Symbol, String]) }
28
28
  attr_accessor :metadata
29
29
 
30
- # Timestamp of the next scheduled billing
30
+ # Timestamp of the next scheduled billing. Indicates the end of current billing
31
+ # period
31
32
  sig { returns(Time) }
32
33
  attr_accessor :next_billing_date
33
34
 
@@ -38,6 +39,10 @@ module Dodopayments
38
39
  sig { returns(Dodopayments::Models::TimeInterval::TaggedSymbol) }
39
40
  attr_accessor :payment_frequency_interval
40
41
 
42
+ # Timestamp of the last payment. Indicates the start of current billing period
43
+ sig { returns(Time) }
44
+ attr_accessor :previous_billing_date
45
+
41
46
  # Identifier of the product associated with this subscription
42
47
  sig { returns(String) }
43
48
  attr_accessor :product_id
@@ -92,6 +97,7 @@ module Dodopayments
92
97
  next_billing_date: Time,
93
98
  payment_frequency_count: Integer,
94
99
  payment_frequency_interval: Dodopayments::Models::TimeInterval::OrSymbol,
100
+ previous_billing_date: Time,
95
101
  product_id: String,
96
102
  quantity: Integer,
97
103
  recurring_pre_tax_amount: Integer,
@@ -108,23 +114,39 @@ module Dodopayments
108
114
  end
109
115
  def self.new(
110
116
  billing:,
117
+ # Timestamp when the subscription was created
111
118
  created_at:,
112
119
  currency:,
113
120
  customer:,
114
121
  metadata:,
122
+ # Timestamp of the next scheduled billing. Indicates the end of current billing
123
+ # period
115
124
  next_billing_date:,
125
+ # Number of payment frequency intervals
116
126
  payment_frequency_count:,
117
127
  payment_frequency_interval:,
128
+ # Timestamp of the last payment. Indicates the start of current billing period
129
+ previous_billing_date:,
130
+ # Identifier of the product associated with this subscription
118
131
  product_id:,
132
+ # Number of units/items included in the subscription
119
133
  quantity:,
134
+ # Amount charged before tax for each recurring payment in smallest currency unit
135
+ # (e.g. cents)
120
136
  recurring_pre_tax_amount:,
121
137
  status:,
138
+ # Unique identifier for the subscription
122
139
  subscription_id:,
140
+ # Number of subscription period intervals
123
141
  subscription_period_count:,
124
142
  subscription_period_interval:,
143
+ # Indicates if the recurring_pre_tax_amount is tax inclusive
125
144
  tax_inclusive:,
145
+ # Number of days in the trial period (0 if no trial)
126
146
  trial_period_days:,
147
+ # Cancelled timestamp if the subscription is cancelled
127
148
  cancelled_at: nil,
149
+ # The discount id if discount is applied
128
150
  discount_id: nil
129
151
  ); end
130
152
  sig do
@@ -139,6 +161,7 @@ module Dodopayments
139
161
  next_billing_date: Time,
140
162
  payment_frequency_count: Integer,
141
163
  payment_frequency_interval: Dodopayments::Models::TimeInterval::TaggedSymbol,
164
+ previous_billing_date: Time,
142
165
  product_id: String,
143
166
  quantity: Integer,
144
167
  recurring_pre_tax_amount: Integer,
@@ -0,0 +1,71 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ class SubscriptionChangePlanParams < Dodopayments::Internal::Type::BaseModel
6
+ extend Dodopayments::Internal::Type::RequestParameters::Converter
7
+ include Dodopayments::Internal::Type::RequestParameters
8
+
9
+ # Unique identifier of the product to subscribe to
10
+ sig { returns(String) }
11
+ attr_accessor :product_id
12
+
13
+ sig { returns(Dodopayments::Models::SubscriptionChangePlanParams::ProrationBillingMode::OrSymbol) }
14
+ attr_accessor :proration_billing_mode
15
+
16
+ # Number of units to subscribe for. Must be at least 1.
17
+ sig { returns(Integer) }
18
+ attr_accessor :quantity
19
+
20
+ sig do
21
+ params(
22
+ product_id: String,
23
+ proration_billing_mode: Dodopayments::Models::SubscriptionChangePlanParams::ProrationBillingMode::OrSymbol,
24
+ quantity: Integer,
25
+ request_options: T.any(Dodopayments::RequestOptions, Dodopayments::Internal::AnyHash)
26
+ )
27
+ .returns(T.attached_class)
28
+ end
29
+ def self.new(
30
+ # Unique identifier of the product to subscribe to
31
+ product_id:,
32
+ proration_billing_mode:,
33
+ # Number of units to subscribe for. Must be at least 1.
34
+ quantity:,
35
+ request_options: {}
36
+ ); end
37
+ sig do
38
+ override
39
+ .returns(
40
+ {
41
+ product_id: String,
42
+ proration_billing_mode: Dodopayments::Models::SubscriptionChangePlanParams::ProrationBillingMode::OrSymbol,
43
+ quantity: Integer,
44
+ request_options: Dodopayments::RequestOptions
45
+ }
46
+ )
47
+ end
48
+ def to_hash; end
49
+
50
+ module ProrationBillingMode
51
+ extend Dodopayments::Internal::Type::Enum
52
+
53
+ TaggedSymbol =
54
+ T.type_alias { T.all(Symbol, Dodopayments::Models::SubscriptionChangePlanParams::ProrationBillingMode) }
55
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
56
+
57
+ PRORATED_IMMEDIATELY =
58
+ T.let(
59
+ :prorated_immediately,
60
+ Dodopayments::Models::SubscriptionChangePlanParams::ProrationBillingMode::TaggedSymbol
61
+ )
62
+
63
+ sig do
64
+ override
65
+ .returns(T::Array[Dodopayments::Models::SubscriptionChangePlanParams::ProrationBillingMode::TaggedSymbol])
66
+ end
67
+ def self.values; end
68
+ end
69
+ end
70
+ end
71
+ end
@@ -18,8 +18,12 @@ module Dodopayments
18
18
  )
19
19
  .returns(T.attached_class)
20
20
  end
21
- def self.new(product_price:, request_options: {}); end
22
-
21
+ def self.new(
22
+ # The product price. Represented in the lowest denomination of the currency (e.g.,
23
+ # cents for USD). For example, to charge $1.00, pass `100`.
24
+ product_price:,
25
+ request_options: {}
26
+ ); end
23
27
  sig { override.returns({product_price: Integer, request_options: Dodopayments::RequestOptions}) }
24
28
  def to_hash; end
25
29
  end
@@ -116,17 +116,33 @@ module Dodopayments
116
116
  def self.new(
117
117
  billing:,
118
118
  customer:,
119
+ # Unique identifier of the product to subscribe to
119
120
  product_id:,
121
+ # Number of units to subscribe for. Must be at least 1.
120
122
  quantity:,
123
+ # List of payment methods allowed during checkout.
124
+ #
125
+ # Customers will **never** see payment methods that are **not** in this list.
126
+ # However, adding a method here **does not guarantee** customers will see it.
127
+ # Availability still depends on other factors (e.g., customer location, merchant
128
+ # settings).
121
129
  allowed_payment_method_types: nil,
122
130
  billing_currency: nil,
131
+ # Discount Code to apply to the subscription
123
132
  discount_code: nil,
124
133
  metadata: nil,
125
134
  on_demand: nil,
135
+ # If true, generates a payment link. Defaults to false if not specified.
126
136
  payment_link: nil,
137
+ # Optional URL to redirect after successful subscription creation
127
138
  return_url: nil,
139
+ # Display saved payment methods of a returning customer False by default
128
140
  show_saved_payment_methods: nil,
141
+ # Tax ID in case the payment is B2B. If tax id validation fails the payment
142
+ # creation will fail
129
143
  tax_id: nil,
144
+ # Optional trial period in days If specified, this value overrides the trial
145
+ # period set in the product's price Must be between 0 and 10000 days
130
146
  trial_period_days: nil,
131
147
  request_options: {}
132
148
  ); end
@@ -382,8 +398,15 @@ module Dodopayments
382
398
  attr_accessor :product_price
383
399
 
384
400
  sig { params(mandate_only: T::Boolean, product_price: T.nilable(Integer)).returns(T.attached_class) }
385
- def self.new(mandate_only:, product_price: nil); end
386
-
401
+ def self.new(
402
+ # If set as True, does not perform any charge and only authorizes payment method
403
+ # details for future use.
404
+ mandate_only:,
405
+ # Product price for the initial charge to customer If not specified the stored
406
+ # price of the product will be used Represented in the lowest denomination of the
407
+ # currency (e.g., cents for USD). For example, to charge $1.00, pass `100`.
408
+ product_price: nil
409
+ ); end
387
410
  sig { override.returns({mandate_only: T::Boolean, product_price: T.nilable(Integer)}) }
388
411
  def to_hash; end
389
412
  end
@@ -51,10 +51,17 @@ module Dodopayments
51
51
  def self.new(
52
52
  customer:,
53
53
  metadata:,
54
+ # Tax will be added to the amount and charged to the customer on each billing
55
+ # cycle
54
56
  recurring_pre_tax_amount:,
57
+ # Unique identifier for the subscription
55
58
  subscription_id:,
59
+ # Client secret used to load Dodo checkout SDK NOTE : Dodo checkout SDK will be
60
+ # coming soon
56
61
  client_secret: nil,
62
+ # The discount id if discount is applied
57
63
  discount_id: nil,
64
+ # URL to checkout page
58
65
  payment_link: nil
59
66
  ); end
60
67
  sig do
@@ -43,11 +43,17 @@ module Dodopayments
43
43
  .returns(T.attached_class)
44
44
  end
45
45
  def self.new(
46
+ # Get events after this created time
46
47
  created_at_gte: nil,
48
+ # Get events created before this time
47
49
  created_at_lte: nil,
50
+ # Filter by customer id
48
51
  customer_id: nil,
52
+ # Page number default is 0
49
53
  page_number: nil,
54
+ # Page size default is 10 max is 100
50
55
  page_size: nil,
56
+ # Filter by status
51
57
  status: nil,
52
58
  request_options: {}
53
59
  ); end
@@ -43,11 +43,17 @@ module Dodopayments
43
43
  .returns(T.attached_class)
44
44
  end
45
45
  def self.new(
46
+ # Get events after this created time
46
47
  created_at_gte: nil,
48
+ # Get events created before this time
47
49
  created_at_lte: nil,
50
+ # Min : 1, Max : 100, default 10
48
51
  limit: nil,
52
+ # Get events history of a specific object like payment/subscription/refund/dispute
49
53
  object_id_: nil,
54
+ # Page number default is 0
50
55
  page_number: nil,
56
+ # Page size default is 10 max is 100
51
57
  page_size: nil,
52
58
  request_options: {}
53
59
  ); end
@@ -121,6 +121,26 @@ module Dodopayments
121
121
  status: nil,
122
122
  request_options: {}
123
123
  ); end
124
+ sig do
125
+ params(
126
+ subscription_id: String,
127
+ product_id: String,
128
+ proration_billing_mode: Dodopayments::Models::SubscriptionChangePlanParams::ProrationBillingMode::OrSymbol,
129
+ quantity: Integer,
130
+ request_options: T.nilable(T.any(Dodopayments::RequestOptions, Dodopayments::Internal::AnyHash))
131
+ )
132
+ .void
133
+ end
134
+ def change_plan(
135
+ # Subscription Id
136
+ subscription_id,
137
+ # Unique identifier of the product to subscribe to
138
+ product_id:,
139
+ proration_billing_mode:,
140
+ # Number of units to subscribe for. Must be at least 1.
141
+ quantity:,
142
+ request_options: {}
143
+ ); end
124
144
  sig do
125
145
  params(
126
146
  subscription_id: String,
@@ -0,0 +1,21 @@
1
+ module Dodopayments
2
+ class FilePart
3
+ attr_reader content: Pathname | StringIO | IO | String
4
+
5
+ attr_reader content_type: String?
6
+
7
+ attr_reader filename: String?
8
+
9
+ private def read: -> String
10
+
11
+ def to_json: (*top a) -> String
12
+
13
+ def to_yaml: (*top a) -> String
14
+
15
+ def initialize: (
16
+ Pathname | StringIO | IO | String content,
17
+ ?filename: String?,
18
+ ?content_type: String?
19
+ ) -> void
20
+ end
21
+ end
@@ -11,7 +11,10 @@ module Dodopayments
11
11
  | Integer
12
12
  | ::Array[(String | Integer)?])?]?,
13
13
  body: top?,
14
- unwrap: Symbol?,
14
+ unwrap: (Symbol
15
+ | Integer
16
+ | ::Array[(Symbol | Integer)]
17
+ | (^(top arg0) -> top))?,
15
18
  page: Class?,
16
19
  stream: Class?,
17
20
  model: Dodopayments::Internal::Type::Converter::input?,
@@ -53,7 +56,7 @@ module Dodopayments
53
56
  ) -> void
54
57
 
55
58
  # @api private
56
- attr_accessor requester: Dodopayments::Internal::Transport::PooledNetRequester
59
+ attr_reader requester: Dodopayments::Internal::Transport::PooledNetRequester
57
60
 
58
61
  def initialize: (
59
62
  base_url: String,
@@ -96,7 +99,10 @@ module Dodopayments
96
99
  | Integer
97
100
  | ::Array[(String | Integer)?])?]?,
98
101
  ?body: top?,
99
- ?unwrap: Symbol?,
102
+ ?unwrap: (Symbol
103
+ | Integer
104
+ | ::Array[(Symbol | Integer)]
105
+ | (^(top arg0) -> top))?,
100
106
  ?page: Class?,
101
107
  ?stream: Class?,
102
108
  ?model: Dodopayments::Internal::Type::Converter::input?,
@@ -1,7 +1,7 @@
1
1
  module Dodopayments
2
2
  module Internal
3
3
  module Type
4
- class IOLike
4
+ class FileInput
5
5
  extend Dodopayments::Internal::Type::Converter
6
6
 
7
7
  def self.===: (top other) -> bool
@@ -29,8 +29,10 @@ module Dodopayments
29
29
 
30
30
  def self?.dig: (
31
31
  ::Hash[Symbol, top] | ::Array[top] | top data,
32
- (Symbol | Integer | ::Array[(Symbol | Integer)])? pick,
33
- ?top? sentinel
32
+ (Symbol
33
+ | Integer
34
+ | ::Array[(Symbol | Integer)]
35
+ | (^(top arg0) -> top))? pick
34
36
  ) {
35
37
  -> top?
36
38
  } -> top?
@@ -73,16 +75,6 @@ module Dodopayments
73
75
  | ::Array[(String | Integer)?])?] headers
74
76
  ) -> ::Hash[String, String]
75
77
 
76
- class SerializationAdapter
77
- attr_reader inner: Pathname | IO
78
-
79
- def to_json: (*top a) -> String
80
-
81
- def to_yaml: (*top a) -> String
82
-
83
- def initialize: (Pathname | IO inner) -> void
84
- end
85
-
86
78
  class ReadIOAdapter
87
79
  def close?: -> bool?
88
80
 
@@ -103,6 +95,16 @@ module Dodopayments
103
95
  (Enumerator::Yielder y) -> void
104
96
  } -> Enumerable[String]
105
97
 
98
+ JSON_CONTENT: Regexp
99
+ JSONL_CONTENT: Regexp
100
+
101
+ def self?.write_multipart_content: (
102
+ Enumerator::Yielder y,
103
+ val: top,
104
+ closing: ::Array[^-> void],
105
+ ?content_type: String?
106
+ ) -> void
107
+
106
108
  def self?.write_multipart_chunk: (
107
109
  Enumerator::Yielder y,
108
110
  boundary: String,
@@ -10,6 +10,7 @@ module Dodopayments
10
10
  next_billing_date: Time,
11
11
  payment_frequency_count: Integer,
12
12
  payment_frequency_interval: Dodopayments::Models::time_interval,
13
+ previous_billing_date: Time,
13
14
  product_id: String,
14
15
  quantity: Integer,
15
16
  recurring_pre_tax_amount: Integer,
@@ -40,6 +41,8 @@ module Dodopayments
40
41
 
41
42
  attr_accessor payment_frequency_interval: Dodopayments::Models::time_interval
42
43
 
44
+ attr_accessor previous_billing_date: Time
45
+
43
46
  attr_accessor product_id: String
44
47
 
45
48
  attr_accessor quantity: Integer
@@ -71,6 +74,7 @@ module Dodopayments
71
74
  next_billing_date: Time,
72
75
  payment_frequency_count: Integer,
73
76
  payment_frequency_interval: Dodopayments::Models::time_interval,
77
+ previous_billing_date: Time,
74
78
  product_id: String,
75
79
  quantity: Integer,
76
80
  recurring_pre_tax_amount: Integer,