dodopayments 2.20.0 → 2.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/README.md +1 -1
- data/lib/dodopayments/models/checkout_session_preview_response.rb +41 -4
- data/lib/dodopayments/models/credit_entitlements/balance_create_ledger_entry_params.rb +4 -2
- data/lib/dodopayments/models/discount.rb +95 -3
- data/lib/dodopayments/models/discount_create_params.rb +110 -3
- data/lib/dodopayments/models/discount_list_params.rb +7 -2
- data/lib/dodopayments/models/discount_type.rb +1 -0
- data/lib/dodopayments/models/discount_update_params.rb +108 -3
- data/lib/dodopayments/models/payment.rb +162 -1
- data/lib/dodopayments/models/payment_list_params.rb +163 -1
- data/lib/dodopayments/models/payment_method_types.rb +0 -1
- data/lib/dodopayments/models/price.rb +19 -1
- data/lib/dodopayments/models/subscription.rb +11 -1
- data/lib/dodopayments/models/subscription_create_response.rb +10 -1
- data/lib/dodopayments/models/subscription_list_params.rb +12 -1
- data/lib/dodopayments/models/subscription_list_response.rb +11 -1
- data/lib/dodopayments/models/subscription_update_payment_method_webhook_event.rb +40 -0
- data/lib/dodopayments/models/unsafe_unwrap_webhook_event.rb +4 -1
- data/lib/dodopayments/models/unwrap_webhook_event.rb +4 -1
- data/lib/dodopayments/models/webhook_event_type.rb +1 -0
- data/lib/dodopayments/models.rb +3 -0
- data/lib/dodopayments/resources/credit_entitlements/balances.rb +1 -1
- data/lib/dodopayments/resources/discounts.rb +24 -5
- data/lib/dodopayments/resources/payments.rb +3 -1
- data/lib/dodopayments/resources/subscriptions.rb +6 -1
- data/lib/dodopayments/resources/webhooks.rb +2 -2
- data/lib/dodopayments/version.rb +1 -1
- data/lib/dodopayments.rb +1 -0
- data/rbi/dodopayments/models/checkout_session_preview_response.rbi +47 -5
- data/rbi/dodopayments/models/credit_entitlements/balance_create_ledger_entry_params.rbi +6 -2
- data/rbi/dodopayments/models/discount.rbi +151 -2
- data/rbi/dodopayments/models/discount_create_params.rbi +197 -2
- data/rbi/dodopayments/models/discount_list_params.rbi +6 -2
- data/rbi/dodopayments/models/discount_type.rbi +1 -0
- data/rbi/dodopayments/models/discount_update_params.rbi +193 -2
- data/rbi/dodopayments/models/payment.rbi +365 -0
- data/rbi/dodopayments/models/payment_list_params.rbi +327 -0
- data/rbi/dodopayments/models/payment_method_types.rbi +0 -1
- data/rbi/dodopayments/models/price.rbi +20 -0
- data/rbi/dodopayments/models/subscription.rbi +15 -3
- data/rbi/dodopayments/models/subscription_create_response.rbi +13 -3
- data/rbi/dodopayments/models/subscription_list_params.rbi +11 -0
- data/rbi/dodopayments/models/subscription_list_response.rbi +15 -3
- data/rbi/dodopayments/models/subscription_update_payment_method_webhook_event.rbi +67 -0
- data/rbi/dodopayments/models/unsafe_unwrap_webhook_event.rbi +1 -0
- data/rbi/dodopayments/models/unwrap_webhook_event.rbi +1 -0
- data/rbi/dodopayments/models/webhook_event_type.rbi +5 -0
- data/rbi/dodopayments/models.rbi +3 -0
- data/rbi/dodopayments/resources/credit_entitlements/balances.rbi +3 -1
- data/rbi/dodopayments/resources/discounts.rbi +57 -3
- data/rbi/dodopayments/resources/payments.rbi +3 -0
- data/rbi/dodopayments/resources/subscriptions.rbi +3 -0
- data/rbi/dodopayments/resources/webhooks.rbi +2 -0
- data/sig/dodopayments/models/checkout_session_preview_response.rbs +18 -3
- data/sig/dodopayments/models/discount.rbs +69 -0
- data/sig/dodopayments/models/discount_create_params.rbs +69 -0
- data/sig/dodopayments/models/discount_type.rbs +2 -1
- data/sig/dodopayments/models/discount_update_params.rbs +69 -0
- data/sig/dodopayments/models/payment.rbs +145 -0
- data/sig/dodopayments/models/payment_list_params.rbs +308 -0
- data/sig/dodopayments/models/payment_method_types.rbs +0 -2
- data/sig/dodopayments/models/price.rbs +10 -0
- data/sig/dodopayments/models/subscription.rbs +8 -3
- data/sig/dodopayments/models/subscription_create_response.rbs +8 -3
- data/sig/dodopayments/models/subscription_list_params.rbs +7 -0
- data/sig/dodopayments/models/subscription_list_response.rbs +8 -3
- data/sig/dodopayments/models/subscription_update_payment_method_webhook_event.rbs +35 -0
- data/sig/dodopayments/models/unsafe_unwrap_webhook_event.rbs +1 -0
- data/sig/dodopayments/models/unwrap_webhook_event.rbs +1 -0
- data/sig/dodopayments/models/webhook_event_type.rbs +2 -0
- data/sig/dodopayments/models.rbs +2 -0
- data/sig/dodopayments/resources/discounts.rbs +8 -0
- data/sig/dodopayments/resources/payments.rbs +1 -0
- data/sig/dodopayments/resources/subscriptions.rbs +1 -0
- data/sig/dodopayments/resources/webhooks.rbs +2 -0
- metadata +5 -2
data/rbi/dodopayments/models.rbi
CHANGED
|
@@ -511,6 +511,9 @@ module Dodopayments
|
|
|
511
511
|
SubscriptionUpdatePaymentMethodParams =
|
|
512
512
|
Dodopayments::Models::SubscriptionUpdatePaymentMethodParams
|
|
513
513
|
|
|
514
|
+
SubscriptionUpdatePaymentMethodWebhookEvent =
|
|
515
|
+
Dodopayments::Models::SubscriptionUpdatePaymentMethodWebhookEvent
|
|
516
|
+
|
|
514
517
|
TaxCategory = Dodopayments::Models::TaxCategory
|
|
515
518
|
|
|
516
519
|
ThemeConfig = Dodopayments::Models::ThemeConfig
|
|
@@ -134,7 +134,9 @@ module Dodopayments
|
|
|
134
134
|
customer_id,
|
|
135
135
|
# Path param: Credit Entitlement ID
|
|
136
136
|
credit_entitlement_id:,
|
|
137
|
-
# Body param: Amount to credit or debit
|
|
137
|
+
# Body param: Amount to credit or debit. Bounded to a `NUMERIC(38,28)` column, so
|
|
138
|
+
# the integer part must have fewer than 10 digits (< 10^10); larger values
|
|
139
|
+
# previously reached the DB and failed with a 22003 overflow surfaced as a 500.
|
|
138
140
|
amount:,
|
|
139
141
|
# Body param: Entry type: credit or debit
|
|
140
142
|
entry_type:,
|
|
@@ -10,11 +10,23 @@ module Dodopayments
|
|
|
10
10
|
amount: Integer,
|
|
11
11
|
type: Dodopayments::DiscountType::OrSymbol,
|
|
12
12
|
code: T.nilable(String),
|
|
13
|
+
currency_options:
|
|
14
|
+
T.nilable(
|
|
15
|
+
T::Array[
|
|
16
|
+
Dodopayments::DiscountCreateParams::CurrencyOption::OrHash
|
|
17
|
+
]
|
|
18
|
+
),
|
|
19
|
+
customer_eligibility:
|
|
20
|
+
T.nilable(
|
|
21
|
+
Dodopayments::DiscountCreateParams::CustomerEligibility::OrSymbol
|
|
22
|
+
),
|
|
13
23
|
expires_at: T.nilable(Time),
|
|
14
24
|
metadata: T::Hash[Symbol, Dodopayments::MetadataItem::Variants],
|
|
15
25
|
name: T.nilable(String),
|
|
26
|
+
per_customer_usage_limit: T.nilable(Integer),
|
|
16
27
|
preserve_on_plan_change: T::Boolean,
|
|
17
28
|
restricted_to: T.nilable(T::Array[String]),
|
|
29
|
+
starts_at: T.nilable(Time),
|
|
18
30
|
subscription_cycles: T.nilable(Integer),
|
|
19
31
|
usage_limit: T.nilable(Integer),
|
|
20
32
|
request_options: Dodopayments::RequestOptions::OrHash
|
|
@@ -26,23 +38,38 @@ module Dodopayments
|
|
|
26
38
|
#
|
|
27
39
|
# Must be at least 1.
|
|
28
40
|
amount:,
|
|
29
|
-
# The discount type
|
|
41
|
+
# The discount type: `percentage` or `flat` (`flat_per_unit` stays blocked).
|
|
30
42
|
type:,
|
|
31
43
|
# Optionally supply a code (will be uppercased).
|
|
32
44
|
#
|
|
33
45
|
# - Must be at least 3 characters if provided.
|
|
34
46
|
# - If omitted, a random 16-character code is generated.
|
|
35
47
|
code: nil,
|
|
48
|
+
# Per-currency options (flat deduction / percentage cap + minimum subtotal).
|
|
49
|
+
# Required for `flat` codes (must include a resolvable default); optional
|
|
50
|
+
# per-currency caps for `percentage` codes. Per-row invariants are checked in
|
|
51
|
+
# `normalize_currency_options`, not via `#[validate(nested)]`.
|
|
52
|
+
currency_options: nil,
|
|
53
|
+
# Who may redeem this discount code. Defaults to `any` (unrestricted). `specific`
|
|
54
|
+
# starts with zero attached customers (fails closed) until customers are attached
|
|
55
|
+
# via `POST /discounts/{id}/customers`.
|
|
56
|
+
customer_eligibility: nil,
|
|
36
57
|
# When the discount expires, if ever.
|
|
37
58
|
expires_at: nil,
|
|
38
59
|
# Additional metadata for the discount
|
|
39
60
|
metadata: nil,
|
|
40
61
|
name: nil,
|
|
62
|
+
# Maximum number of times a single customer may redeem this discount. Must be
|
|
63
|
+
# `<= usage_limit` when both are set.
|
|
64
|
+
per_customer_usage_limit: nil,
|
|
41
65
|
# Whether this discount should be preserved when a subscription changes plans.
|
|
42
66
|
# Default: false (discount is removed on plan change)
|
|
43
67
|
preserve_on_plan_change: nil,
|
|
44
68
|
# List of product IDs to restrict usage (if any).
|
|
45
69
|
restricted_to: nil,
|
|
70
|
+
# When the discount becomes active, if scheduled for the future. NULL = active
|
|
71
|
+
# immediately. Must be strictly before `expires_at` when both are set.
|
|
72
|
+
starts_at: nil,
|
|
46
73
|
# Number of subscription billing cycles this discount is valid for. If not
|
|
47
74
|
# provided, the discount will be applied indefinitely to all recurring payments
|
|
48
75
|
# related to the subscription.
|
|
@@ -73,12 +100,24 @@ module Dodopayments
|
|
|
73
100
|
discount_id: String,
|
|
74
101
|
amount: T.nilable(Integer),
|
|
75
102
|
code: T.nilable(String),
|
|
103
|
+
currency_options:
|
|
104
|
+
T.nilable(
|
|
105
|
+
T::Array[
|
|
106
|
+
Dodopayments::DiscountUpdateParams::CurrencyOption::OrHash
|
|
107
|
+
]
|
|
108
|
+
),
|
|
109
|
+
customer_eligibility:
|
|
110
|
+
T.nilable(
|
|
111
|
+
Dodopayments::DiscountUpdateParams::CustomerEligibility::OrSymbol
|
|
112
|
+
),
|
|
76
113
|
expires_at: T.nilable(Time),
|
|
77
114
|
metadata:
|
|
78
115
|
T.nilable(T::Hash[Symbol, Dodopayments::MetadataItem::Variants]),
|
|
79
116
|
name: T.nilable(String),
|
|
117
|
+
per_customer_usage_limit: T.nilable(Integer),
|
|
80
118
|
preserve_on_plan_change: T.nilable(T::Boolean),
|
|
81
119
|
restricted_to: T.nilable(T::Array[String]),
|
|
120
|
+
starts_at: T.nilable(Time),
|
|
82
121
|
subscription_cycles: T.nilable(Integer),
|
|
83
122
|
type: T.nilable(Dodopayments::DiscountType::OrSymbol),
|
|
84
123
|
usage_limit: T.nilable(Integer),
|
|
@@ -95,21 +134,34 @@ module Dodopayments
|
|
|
95
134
|
amount: nil,
|
|
96
135
|
# If present, update the discount code (uppercase).
|
|
97
136
|
code: nil,
|
|
137
|
+
# If present, fully replaces the discount's currency options (replace-set
|
|
138
|
+
# semantics, like `restricted_to`). Send an empty array to clear them.
|
|
139
|
+
currency_options: nil,
|
|
140
|
+
# If present, update who may redeem this discount. Plain field (not
|
|
141
|
+
# double-option): the DB column is `NOT NULL`, so it can never be cleared back to
|
|
142
|
+
# unset, only changed to another `CustomerEligibility` value.
|
|
143
|
+
customer_eligibility: nil,
|
|
98
144
|
expires_at: nil,
|
|
99
145
|
# Additional metadata for the discount
|
|
100
146
|
metadata: nil,
|
|
101
147
|
name: nil,
|
|
148
|
+
# If present, update the per-customer usage limit (double-option: send `null` to
|
|
149
|
+
# clear it back to unlimited). Must be `<= usage_limit` (the value in effect after
|
|
150
|
+
# this patch) when both are set.
|
|
151
|
+
per_customer_usage_limit: nil,
|
|
102
152
|
# Whether this discount should be preserved when a subscription changes plans. If
|
|
103
153
|
# not provided, the existing value is kept.
|
|
104
154
|
preserve_on_plan_change: nil,
|
|
105
155
|
# If present, replaces all restricted product IDs with this new set. To remove all
|
|
106
156
|
# restrictions, send empty array
|
|
107
157
|
restricted_to: nil,
|
|
158
|
+
# If present, update `starts_at` (double-option: send `null` to clear it).
|
|
159
|
+
starts_at: nil,
|
|
108
160
|
# Number of subscription billing cycles this discount is valid for. If not
|
|
109
161
|
# provided, the discount will be applied indefinitely to all recurring payments
|
|
110
162
|
# related to the subscription.
|
|
111
163
|
subscription_cycles: nil,
|
|
112
|
-
# If present, update the discount type
|
|
164
|
+
# If present, update the discount type (`percentage` or `flat`).
|
|
113
165
|
type: nil,
|
|
114
166
|
usage_limit: nil,
|
|
115
167
|
request_options: {}
|
|
@@ -133,7 +185,9 @@ module Dodopayments
|
|
|
133
185
|
)
|
|
134
186
|
end
|
|
135
187
|
def list(
|
|
136
|
-
# Filter by active status
|
|
188
|
+
# Filter by active status. `true` = currently redeemable (started, not expired,
|
|
189
|
+
# not usage-exhausted). `false` = not currently redeemable (expired,
|
|
190
|
+
# usage-exhausted, or pending a future `starts_at`).
|
|
137
191
|
active: nil,
|
|
138
192
|
# Filter by discount code (partial match, case-insensitive)
|
|
139
193
|
code: nil,
|
|
@@ -112,6 +112,7 @@ module Dodopayments
|
|
|
112
112
|
brand_id: String,
|
|
113
113
|
created_at_gte: Time,
|
|
114
114
|
created_at_lte: Time,
|
|
115
|
+
currency: Dodopayments::PaymentListParams::Currency::OrSymbol,
|
|
115
116
|
customer_id: String,
|
|
116
117
|
page_number: Integer,
|
|
117
118
|
page_size: Integer,
|
|
@@ -132,6 +133,8 @@ module Dodopayments
|
|
|
132
133
|
created_at_gte: nil,
|
|
133
134
|
# Get events created before this time
|
|
134
135
|
created_at_lte: nil,
|
|
136
|
+
# Filter by currency
|
|
137
|
+
currency: nil,
|
|
135
138
|
# Filter by customer id
|
|
136
139
|
customer_id: nil,
|
|
137
140
|
# Page number default is 0
|
|
@@ -204,6 +204,7 @@ module Dodopayments
|
|
|
204
204
|
sig do
|
|
205
205
|
params(
|
|
206
206
|
brand_id: String,
|
|
207
|
+
cancel_at_next_billing_date: T::Boolean,
|
|
207
208
|
created_at_gte: Time,
|
|
208
209
|
created_at_lte: Time,
|
|
209
210
|
customer_id: String,
|
|
@@ -221,6 +222,8 @@ module Dodopayments
|
|
|
221
222
|
def list(
|
|
222
223
|
# filter by Brand id
|
|
223
224
|
brand_id: nil,
|
|
225
|
+
# Filter by cancel_at_next_billing_date (subscriptions scheduled for cancellation)
|
|
226
|
+
cancel_at_next_billing_date: nil,
|
|
224
227
|
# Get events after this created time
|
|
225
228
|
created_at_gte: nil,
|
|
226
229
|
# Get events created before this time
|
|
@@ -182,6 +182,7 @@ module Dodopayments
|
|
|
182
182
|
Dodopayments::SubscriptionOnHoldWebhookEvent,
|
|
183
183
|
Dodopayments::SubscriptionPlanChangedWebhookEvent,
|
|
184
184
|
Dodopayments::SubscriptionRenewedWebhookEvent,
|
|
185
|
+
Dodopayments::SubscriptionUpdatePaymentMethodWebhookEvent,
|
|
185
186
|
Dodopayments::SubscriptionUpdatedWebhookEvent
|
|
186
187
|
)
|
|
187
188
|
)
|
|
@@ -237,6 +238,7 @@ module Dodopayments
|
|
|
237
238
|
Dodopayments::SubscriptionOnHoldWebhookEvent,
|
|
238
239
|
Dodopayments::SubscriptionPlanChangedWebhookEvent,
|
|
239
240
|
Dodopayments::SubscriptionRenewedWebhookEvent,
|
|
241
|
+
Dodopayments::SubscriptionUpdatePaymentMethodWebhookEvent,
|
|
240
242
|
Dodopayments::SubscriptionUpdatedWebhookEvent
|
|
241
243
|
)
|
|
242
244
|
)
|
|
@@ -8,11 +8,14 @@ module Dodopayments
|
|
|
8
8
|
is_byop: bool,
|
|
9
9
|
product_cart: ::Array[Dodopayments::Models::CheckoutSessionPreviewResponse::ProductCart],
|
|
10
10
|
total_price: Integer,
|
|
11
|
+
next_billing_date: Time?,
|
|
11
12
|
recurring_breakup: Dodopayments::Models::CheckoutSessionPreviewResponse::RecurringBreakup?,
|
|
12
13
|
tax_id_business_name: String?,
|
|
13
14
|
tax_id_err_msg: String?,
|
|
14
15
|
tax_id_format_name: String?,
|
|
15
|
-
total_tax: Integer
|
|
16
|
+
total_tax: Integer?,
|
|
17
|
+
trial_amount: Integer?,
|
|
18
|
+
trial_period_days: Integer?
|
|
16
19
|
}
|
|
17
20
|
|
|
18
21
|
class CheckoutSessionPreviewResponse < Dodopayments::Internal::Type::BaseModel
|
|
@@ -28,6 +31,8 @@ module Dodopayments
|
|
|
28
31
|
|
|
29
32
|
attr_accessor total_price: Integer
|
|
30
33
|
|
|
34
|
+
attr_accessor next_billing_date: Time?
|
|
35
|
+
|
|
31
36
|
attr_accessor recurring_breakup: Dodopayments::Models::CheckoutSessionPreviewResponse::RecurringBreakup?
|
|
32
37
|
|
|
33
38
|
attr_accessor tax_id_business_name: String?
|
|
@@ -38,6 +43,10 @@ module Dodopayments
|
|
|
38
43
|
|
|
39
44
|
attr_accessor total_tax: Integer?
|
|
40
45
|
|
|
46
|
+
attr_accessor trial_amount: Integer?
|
|
47
|
+
|
|
48
|
+
attr_accessor trial_period_days: Integer?
|
|
49
|
+
|
|
41
50
|
def initialize: (
|
|
42
51
|
billing_country: Dodopayments::Models::country_code,
|
|
43
52
|
currency: Dodopayments::Models::currency,
|
|
@@ -45,11 +54,14 @@ module Dodopayments
|
|
|
45
54
|
is_byop: bool,
|
|
46
55
|
product_cart: ::Array[Dodopayments::Models::CheckoutSessionPreviewResponse::ProductCart],
|
|
47
56
|
total_price: Integer,
|
|
57
|
+
?next_billing_date: Time?,
|
|
48
58
|
?recurring_breakup: Dodopayments::Models::CheckoutSessionPreviewResponse::RecurringBreakup?,
|
|
49
59
|
?tax_id_business_name: String?,
|
|
50
60
|
?tax_id_err_msg: String?,
|
|
51
61
|
?tax_id_format_name: String?,
|
|
52
|
-
?total_tax: Integer
|
|
62
|
+
?total_tax: Integer?,
|
|
63
|
+
?trial_amount: Integer?,
|
|
64
|
+
?trial_period_days: Integer?
|
|
53
65
|
) -> void
|
|
54
66
|
|
|
55
67
|
def to_hash: -> {
|
|
@@ -59,11 +71,14 @@ module Dodopayments
|
|
|
59
71
|
is_byop: bool,
|
|
60
72
|
product_cart: ::Array[Dodopayments::Models::CheckoutSessionPreviewResponse::ProductCart],
|
|
61
73
|
total_price: Integer,
|
|
74
|
+
next_billing_date: Time?,
|
|
62
75
|
recurring_breakup: Dodopayments::Models::CheckoutSessionPreviewResponse::RecurringBreakup?,
|
|
63
76
|
tax_id_business_name: String?,
|
|
64
77
|
tax_id_err_msg: String?,
|
|
65
78
|
tax_id_format_name: String?,
|
|
66
|
-
total_tax: Integer
|
|
79
|
+
total_tax: Integer?,
|
|
80
|
+
trial_amount: Integer?,
|
|
81
|
+
trial_period_days: Integer?
|
|
67
82
|
}
|
|
68
83
|
|
|
69
84
|
type current_breakup =
|
|
@@ -6,14 +6,18 @@ module Dodopayments
|
|
|
6
6
|
business_id: String,
|
|
7
7
|
code: String,
|
|
8
8
|
created_at: Time,
|
|
9
|
+
customer_eligibility: Dodopayments::Models::Discount::customer_eligibility,
|
|
9
10
|
discount_id: String,
|
|
10
11
|
metadata: Dodopayments::Models::metadata,
|
|
11
12
|
preserve_on_plan_change: bool,
|
|
12
13
|
restricted_to: ::Array[String],
|
|
13
14
|
times_used: Integer,
|
|
14
15
|
type: Dodopayments::Models::discount_type,
|
|
16
|
+
currency_options: ::Array[Dodopayments::Discount::CurrencyOption],
|
|
15
17
|
expires_at: Time?,
|
|
16
18
|
name: String?,
|
|
19
|
+
per_customer_usage_limit: Integer?,
|
|
20
|
+
starts_at: Time?,
|
|
17
21
|
subscription_cycles: Integer?,
|
|
18
22
|
usage_limit: Integer?
|
|
19
23
|
}
|
|
@@ -27,6 +31,8 @@ module Dodopayments
|
|
|
27
31
|
|
|
28
32
|
attr_accessor created_at: Time
|
|
29
33
|
|
|
34
|
+
attr_accessor customer_eligibility: Dodopayments::Models::Discount::customer_eligibility
|
|
35
|
+
|
|
30
36
|
attr_accessor discount_id: String
|
|
31
37
|
|
|
32
38
|
attr_accessor metadata: Dodopayments::Models::metadata
|
|
@@ -39,10 +45,20 @@ module Dodopayments
|
|
|
39
45
|
|
|
40
46
|
attr_accessor type: Dodopayments::Models::discount_type
|
|
41
47
|
|
|
48
|
+
attr_reader currency_options: ::Array[Dodopayments::Discount::CurrencyOption]?
|
|
49
|
+
|
|
50
|
+
def currency_options=: (
|
|
51
|
+
::Array[Dodopayments::Discount::CurrencyOption]
|
|
52
|
+
) -> ::Array[Dodopayments::Discount::CurrencyOption]
|
|
53
|
+
|
|
42
54
|
attr_accessor expires_at: Time?
|
|
43
55
|
|
|
44
56
|
attr_accessor name: String?
|
|
45
57
|
|
|
58
|
+
attr_accessor per_customer_usage_limit: Integer?
|
|
59
|
+
|
|
60
|
+
attr_accessor starts_at: Time?
|
|
61
|
+
|
|
46
62
|
attr_accessor subscription_cycles: Integer?
|
|
47
63
|
|
|
48
64
|
attr_accessor usage_limit: Integer?
|
|
@@ -52,14 +68,18 @@ module Dodopayments
|
|
|
52
68
|
business_id: String,
|
|
53
69
|
code: String,
|
|
54
70
|
created_at: Time,
|
|
71
|
+
customer_eligibility: Dodopayments::Models::Discount::customer_eligibility,
|
|
55
72
|
discount_id: String,
|
|
56
73
|
metadata: Dodopayments::Models::metadata,
|
|
57
74
|
preserve_on_plan_change: bool,
|
|
58
75
|
restricted_to: ::Array[String],
|
|
59
76
|
times_used: Integer,
|
|
60
77
|
type: Dodopayments::Models::discount_type,
|
|
78
|
+
?currency_options: ::Array[Dodopayments::Discount::CurrencyOption],
|
|
61
79
|
?expires_at: Time?,
|
|
62
80
|
?name: String?,
|
|
81
|
+
?per_customer_usage_limit: Integer?,
|
|
82
|
+
?starts_at: Time?,
|
|
63
83
|
?subscription_cycles: Integer?,
|
|
64
84
|
?usage_limit: Integer?
|
|
65
85
|
) -> void
|
|
@@ -69,17 +89,66 @@ module Dodopayments
|
|
|
69
89
|
business_id: String,
|
|
70
90
|
code: String,
|
|
71
91
|
created_at: Time,
|
|
92
|
+
customer_eligibility: Dodopayments::Models::Discount::customer_eligibility,
|
|
72
93
|
discount_id: String,
|
|
73
94
|
metadata: Dodopayments::Models::metadata,
|
|
74
95
|
preserve_on_plan_change: bool,
|
|
75
96
|
restricted_to: ::Array[String],
|
|
76
97
|
times_used: Integer,
|
|
77
98
|
type: Dodopayments::Models::discount_type,
|
|
99
|
+
currency_options: ::Array[Dodopayments::Discount::CurrencyOption],
|
|
78
100
|
expires_at: Time?,
|
|
79
101
|
name: String?,
|
|
102
|
+
per_customer_usage_limit: Integer?,
|
|
103
|
+
starts_at: Time?,
|
|
80
104
|
subscription_cycles: Integer?,
|
|
81
105
|
usage_limit: Integer?
|
|
82
106
|
}
|
|
107
|
+
|
|
108
|
+
type customer_eligibility = :any | :first_time | :existing | :specific
|
|
109
|
+
|
|
110
|
+
module CustomerEligibility
|
|
111
|
+
extend Dodopayments::Internal::Type::Enum
|
|
112
|
+
|
|
113
|
+
ANY: :any
|
|
114
|
+
FIRST_TIME: :first_time
|
|
115
|
+
EXISTING: :existing
|
|
116
|
+
SPECIFIC: :specific
|
|
117
|
+
|
|
118
|
+
def self?.values: -> ::Array[Dodopayments::Models::Discount::customer_eligibility]
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
type currency_option =
|
|
122
|
+
{
|
|
123
|
+
currency: Dodopayments::Models::currency,
|
|
124
|
+
is_default: bool,
|
|
125
|
+
minimum_subtotal: Integer,
|
|
126
|
+
max_amount_possible: Integer?
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
class CurrencyOption < Dodopayments::Internal::Type::BaseModel
|
|
130
|
+
attr_accessor currency: Dodopayments::Models::currency
|
|
131
|
+
|
|
132
|
+
attr_accessor is_default: bool
|
|
133
|
+
|
|
134
|
+
attr_accessor minimum_subtotal: Integer
|
|
135
|
+
|
|
136
|
+
attr_accessor max_amount_possible: Integer?
|
|
137
|
+
|
|
138
|
+
def initialize: (
|
|
139
|
+
currency: Dodopayments::Models::currency,
|
|
140
|
+
is_default: bool,
|
|
141
|
+
minimum_subtotal: Integer,
|
|
142
|
+
?max_amount_possible: Integer?
|
|
143
|
+
) -> void
|
|
144
|
+
|
|
145
|
+
def to_hash: -> {
|
|
146
|
+
currency: Dodopayments::Models::currency,
|
|
147
|
+
is_default: bool,
|
|
148
|
+
minimum_subtotal: Integer,
|
|
149
|
+
max_amount_possible: Integer?
|
|
150
|
+
}
|
|
151
|
+
end
|
|
83
152
|
end
|
|
84
153
|
end
|
|
85
154
|
end
|
|
@@ -5,11 +5,15 @@ module Dodopayments
|
|
|
5
5
|
amount: Integer,
|
|
6
6
|
type: Dodopayments::Models::discount_type,
|
|
7
7
|
code: String?,
|
|
8
|
+
currency_options: ::Array[Dodopayments::DiscountCreateParams::CurrencyOption]?,
|
|
9
|
+
customer_eligibility: Dodopayments::Models::DiscountCreateParams::customer_eligibility?,
|
|
8
10
|
expires_at: Time?,
|
|
9
11
|
metadata: Dodopayments::Models::metadata,
|
|
10
12
|
name: String?,
|
|
13
|
+
per_customer_usage_limit: Integer?,
|
|
11
14
|
preserve_on_plan_change: bool,
|
|
12
15
|
restricted_to: ::Array[String]?,
|
|
16
|
+
starts_at: Time?,
|
|
13
17
|
subscription_cycles: Integer?,
|
|
14
18
|
usage_limit: Integer?
|
|
15
19
|
}
|
|
@@ -25,6 +29,10 @@ module Dodopayments
|
|
|
25
29
|
|
|
26
30
|
attr_accessor code: String?
|
|
27
31
|
|
|
32
|
+
attr_accessor currency_options: ::Array[Dodopayments::DiscountCreateParams::CurrencyOption]?
|
|
33
|
+
|
|
34
|
+
attr_accessor customer_eligibility: Dodopayments::Models::DiscountCreateParams::customer_eligibility?
|
|
35
|
+
|
|
28
36
|
attr_accessor expires_at: Time?
|
|
29
37
|
|
|
30
38
|
attr_reader metadata: Dodopayments::Models::metadata?
|
|
@@ -35,12 +43,16 @@ module Dodopayments
|
|
|
35
43
|
|
|
36
44
|
attr_accessor name: String?
|
|
37
45
|
|
|
46
|
+
attr_accessor per_customer_usage_limit: Integer?
|
|
47
|
+
|
|
38
48
|
attr_reader preserve_on_plan_change: bool?
|
|
39
49
|
|
|
40
50
|
def preserve_on_plan_change=: (bool) -> bool
|
|
41
51
|
|
|
42
52
|
attr_accessor restricted_to: ::Array[String]?
|
|
43
53
|
|
|
54
|
+
attr_accessor starts_at: Time?
|
|
55
|
+
|
|
44
56
|
attr_accessor subscription_cycles: Integer?
|
|
45
57
|
|
|
46
58
|
attr_accessor usage_limit: Integer?
|
|
@@ -49,11 +61,15 @@ module Dodopayments
|
|
|
49
61
|
amount: Integer,
|
|
50
62
|
type: Dodopayments::Models::discount_type,
|
|
51
63
|
?code: String?,
|
|
64
|
+
?currency_options: ::Array[Dodopayments::DiscountCreateParams::CurrencyOption]?,
|
|
65
|
+
?customer_eligibility: Dodopayments::Models::DiscountCreateParams::customer_eligibility?,
|
|
52
66
|
?expires_at: Time?,
|
|
53
67
|
?metadata: Dodopayments::Models::metadata,
|
|
54
68
|
?name: String?,
|
|
69
|
+
?per_customer_usage_limit: Integer?,
|
|
55
70
|
?preserve_on_plan_change: bool,
|
|
56
71
|
?restricted_to: ::Array[String]?,
|
|
72
|
+
?starts_at: Time?,
|
|
57
73
|
?subscription_cycles: Integer?,
|
|
58
74
|
?usage_limit: Integer?,
|
|
59
75
|
?request_options: Dodopayments::request_opts
|
|
@@ -63,15 +79,68 @@ module Dodopayments
|
|
|
63
79
|
amount: Integer,
|
|
64
80
|
type: Dodopayments::Models::discount_type,
|
|
65
81
|
code: String?,
|
|
82
|
+
currency_options: ::Array[Dodopayments::DiscountCreateParams::CurrencyOption]?,
|
|
83
|
+
customer_eligibility: Dodopayments::Models::DiscountCreateParams::customer_eligibility?,
|
|
66
84
|
expires_at: Time?,
|
|
67
85
|
metadata: Dodopayments::Models::metadata,
|
|
68
86
|
name: String?,
|
|
87
|
+
per_customer_usage_limit: Integer?,
|
|
69
88
|
preserve_on_plan_change: bool,
|
|
70
89
|
restricted_to: ::Array[String]?,
|
|
90
|
+
starts_at: Time?,
|
|
71
91
|
subscription_cycles: Integer?,
|
|
72
92
|
usage_limit: Integer?,
|
|
73
93
|
request_options: Dodopayments::RequestOptions
|
|
74
94
|
}
|
|
95
|
+
|
|
96
|
+
type currency_option =
|
|
97
|
+
{
|
|
98
|
+
currency: Dodopayments::Models::currency,
|
|
99
|
+
is_default: bool,
|
|
100
|
+
max_amount_possible: Integer?,
|
|
101
|
+
minimum_subtotal: Integer
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
class CurrencyOption < Dodopayments::Internal::Type::BaseModel
|
|
105
|
+
attr_accessor currency: Dodopayments::Models::currency
|
|
106
|
+
|
|
107
|
+
attr_reader is_default: bool?
|
|
108
|
+
|
|
109
|
+
def is_default=: (bool) -> bool
|
|
110
|
+
|
|
111
|
+
attr_accessor max_amount_possible: Integer?
|
|
112
|
+
|
|
113
|
+
attr_reader minimum_subtotal: Integer?
|
|
114
|
+
|
|
115
|
+
def minimum_subtotal=: (Integer) -> Integer
|
|
116
|
+
|
|
117
|
+
def initialize: (
|
|
118
|
+
currency: Dodopayments::Models::currency,
|
|
119
|
+
?is_default: bool,
|
|
120
|
+
?max_amount_possible: Integer?,
|
|
121
|
+
?minimum_subtotal: Integer
|
|
122
|
+
) -> void
|
|
123
|
+
|
|
124
|
+
def to_hash: -> {
|
|
125
|
+
currency: Dodopayments::Models::currency,
|
|
126
|
+
is_default: bool,
|
|
127
|
+
max_amount_possible: Integer?,
|
|
128
|
+
minimum_subtotal: Integer
|
|
129
|
+
}
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
type customer_eligibility = :any | :first_time | :existing | :specific
|
|
133
|
+
|
|
134
|
+
module CustomerEligibility
|
|
135
|
+
extend Dodopayments::Internal::Type::Enum
|
|
136
|
+
|
|
137
|
+
ANY: :any
|
|
138
|
+
FIRST_TIME: :first_time
|
|
139
|
+
EXISTING: :existing
|
|
140
|
+
SPECIFIC: :specific
|
|
141
|
+
|
|
142
|
+
def self?.values: -> ::Array[Dodopayments::Models::DiscountCreateParams::customer_eligibility]
|
|
143
|
+
end
|
|
75
144
|
end
|
|
76
145
|
end
|
|
77
146
|
end
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
module Dodopayments
|
|
2
2
|
module Models
|
|
3
|
-
type discount_type = :percentage
|
|
3
|
+
type discount_type = :flat | :percentage
|
|
4
4
|
|
|
5
5
|
module DiscountType
|
|
6
6
|
extend Dodopayments::Internal::Type::Enum
|
|
7
7
|
|
|
8
|
+
FLAT: :flat
|
|
8
9
|
PERCENTAGE: :percentage
|
|
9
10
|
|
|
10
11
|
def self?.values: -> ::Array[Dodopayments::Models::discount_type]
|
|
@@ -5,11 +5,15 @@ module Dodopayments
|
|
|
5
5
|
discount_id: String,
|
|
6
6
|
amount: Integer?,
|
|
7
7
|
code: String?,
|
|
8
|
+
currency_options: ::Array[Dodopayments::DiscountUpdateParams::CurrencyOption]?,
|
|
9
|
+
customer_eligibility: Dodopayments::Models::DiscountUpdateParams::customer_eligibility?,
|
|
8
10
|
expires_at: Time?,
|
|
9
11
|
metadata: Dodopayments::Models::metadata?,
|
|
10
12
|
name: String?,
|
|
13
|
+
per_customer_usage_limit: Integer?,
|
|
11
14
|
preserve_on_plan_change: bool?,
|
|
12
15
|
restricted_to: ::Array[String]?,
|
|
16
|
+
starts_at: Time?,
|
|
13
17
|
subscription_cycles: Integer?,
|
|
14
18
|
type: Dodopayments::Models::discount_type?,
|
|
15
19
|
usage_limit: Integer?
|
|
@@ -26,16 +30,24 @@ module Dodopayments
|
|
|
26
30
|
|
|
27
31
|
attr_accessor code: String?
|
|
28
32
|
|
|
33
|
+
attr_accessor currency_options: ::Array[Dodopayments::DiscountUpdateParams::CurrencyOption]?
|
|
34
|
+
|
|
35
|
+
attr_accessor customer_eligibility: Dodopayments::Models::DiscountUpdateParams::customer_eligibility?
|
|
36
|
+
|
|
29
37
|
attr_accessor expires_at: Time?
|
|
30
38
|
|
|
31
39
|
attr_accessor metadata: Dodopayments::Models::metadata?
|
|
32
40
|
|
|
33
41
|
attr_accessor name: String?
|
|
34
42
|
|
|
43
|
+
attr_accessor per_customer_usage_limit: Integer?
|
|
44
|
+
|
|
35
45
|
attr_accessor preserve_on_plan_change: bool?
|
|
36
46
|
|
|
37
47
|
attr_accessor restricted_to: ::Array[String]?
|
|
38
48
|
|
|
49
|
+
attr_accessor starts_at: Time?
|
|
50
|
+
|
|
39
51
|
attr_accessor subscription_cycles: Integer?
|
|
40
52
|
|
|
41
53
|
attr_accessor type: Dodopayments::Models::discount_type?
|
|
@@ -46,11 +58,15 @@ module Dodopayments
|
|
|
46
58
|
discount_id: String,
|
|
47
59
|
?amount: Integer?,
|
|
48
60
|
?code: String?,
|
|
61
|
+
?currency_options: ::Array[Dodopayments::DiscountUpdateParams::CurrencyOption]?,
|
|
62
|
+
?customer_eligibility: Dodopayments::Models::DiscountUpdateParams::customer_eligibility?,
|
|
49
63
|
?expires_at: Time?,
|
|
50
64
|
?metadata: Dodopayments::Models::metadata?,
|
|
51
65
|
?name: String?,
|
|
66
|
+
?per_customer_usage_limit: Integer?,
|
|
52
67
|
?preserve_on_plan_change: bool?,
|
|
53
68
|
?restricted_to: ::Array[String]?,
|
|
69
|
+
?starts_at: Time?,
|
|
54
70
|
?subscription_cycles: Integer?,
|
|
55
71
|
?type: Dodopayments::Models::discount_type?,
|
|
56
72
|
?usage_limit: Integer?,
|
|
@@ -61,16 +77,69 @@ module Dodopayments
|
|
|
61
77
|
discount_id: String,
|
|
62
78
|
amount: Integer?,
|
|
63
79
|
code: String?,
|
|
80
|
+
currency_options: ::Array[Dodopayments::DiscountUpdateParams::CurrencyOption]?,
|
|
81
|
+
customer_eligibility: Dodopayments::Models::DiscountUpdateParams::customer_eligibility?,
|
|
64
82
|
expires_at: Time?,
|
|
65
83
|
metadata: Dodopayments::Models::metadata?,
|
|
66
84
|
name: String?,
|
|
85
|
+
per_customer_usage_limit: Integer?,
|
|
67
86
|
preserve_on_plan_change: bool?,
|
|
68
87
|
restricted_to: ::Array[String]?,
|
|
88
|
+
starts_at: Time?,
|
|
69
89
|
subscription_cycles: Integer?,
|
|
70
90
|
type: Dodopayments::Models::discount_type?,
|
|
71
91
|
usage_limit: Integer?,
|
|
72
92
|
request_options: Dodopayments::RequestOptions
|
|
73
93
|
}
|
|
94
|
+
|
|
95
|
+
type currency_option =
|
|
96
|
+
{
|
|
97
|
+
currency: Dodopayments::Models::currency,
|
|
98
|
+
is_default: bool,
|
|
99
|
+
max_amount_possible: Integer?,
|
|
100
|
+
minimum_subtotal: Integer
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
class CurrencyOption < Dodopayments::Internal::Type::BaseModel
|
|
104
|
+
attr_accessor currency: Dodopayments::Models::currency
|
|
105
|
+
|
|
106
|
+
attr_reader is_default: bool?
|
|
107
|
+
|
|
108
|
+
def is_default=: (bool) -> bool
|
|
109
|
+
|
|
110
|
+
attr_accessor max_amount_possible: Integer?
|
|
111
|
+
|
|
112
|
+
attr_reader minimum_subtotal: Integer?
|
|
113
|
+
|
|
114
|
+
def minimum_subtotal=: (Integer) -> Integer
|
|
115
|
+
|
|
116
|
+
def initialize: (
|
|
117
|
+
currency: Dodopayments::Models::currency,
|
|
118
|
+
?is_default: bool,
|
|
119
|
+
?max_amount_possible: Integer?,
|
|
120
|
+
?minimum_subtotal: Integer
|
|
121
|
+
) -> void
|
|
122
|
+
|
|
123
|
+
def to_hash: -> {
|
|
124
|
+
currency: Dodopayments::Models::currency,
|
|
125
|
+
is_default: bool,
|
|
126
|
+
max_amount_possible: Integer?,
|
|
127
|
+
minimum_subtotal: Integer
|
|
128
|
+
}
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
type customer_eligibility = :any | :first_time | :existing | :specific
|
|
132
|
+
|
|
133
|
+
module CustomerEligibility
|
|
134
|
+
extend Dodopayments::Internal::Type::Enum
|
|
135
|
+
|
|
136
|
+
ANY: :any
|
|
137
|
+
FIRST_TIME: :first_time
|
|
138
|
+
EXISTING: :existing
|
|
139
|
+
SPECIFIC: :specific
|
|
140
|
+
|
|
141
|
+
def self?.values: -> ::Array[Dodopayments::Models::DiscountUpdateParams::customer_eligibility]
|
|
142
|
+
end
|
|
74
143
|
end
|
|
75
144
|
end
|
|
76
145
|
end
|