dodopayments 2.20.1 → 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 +8 -0
- data/README.md +1 -1
- data/lib/dodopayments/models/checkout_session_preview_response.rb +30 -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 +145 -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_response.rb +11 -1
- 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/version.rb +1 -1
- data/rbi/dodopayments/models/checkout_session_preview_response.rbi +33 -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 +347 -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_response.rbi +15 -3
- 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/sig/dodopayments/models/checkout_session_preview_response.rbs +13 -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 +135 -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_response.rbs +8 -3
- data/sig/dodopayments/resources/discounts.rbs +8 -0
- data/sig/dodopayments/resources/payments.rbs +1 -0
- metadata +2 -2
|
@@ -28,6 +28,29 @@ module Dodopayments
|
|
|
28
28
|
sig { returns(T.nilable(String)) }
|
|
29
29
|
attr_accessor :code
|
|
30
30
|
|
|
31
|
+
# If present, fully replaces the discount's currency options (replace-set
|
|
32
|
+
# semantics, like `restricted_to`). Send an empty array to clear them.
|
|
33
|
+
sig do
|
|
34
|
+
returns(
|
|
35
|
+
T.nilable(
|
|
36
|
+
T::Array[Dodopayments::DiscountUpdateParams::CurrencyOption]
|
|
37
|
+
)
|
|
38
|
+
)
|
|
39
|
+
end
|
|
40
|
+
attr_accessor :currency_options
|
|
41
|
+
|
|
42
|
+
# If present, update who may redeem this discount. Plain field (not
|
|
43
|
+
# double-option): the DB column is `NOT NULL`, so it can never be cleared back to
|
|
44
|
+
# unset, only changed to another `CustomerEligibility` value.
|
|
45
|
+
sig do
|
|
46
|
+
returns(
|
|
47
|
+
T.nilable(
|
|
48
|
+
Dodopayments::DiscountUpdateParams::CustomerEligibility::OrSymbol
|
|
49
|
+
)
|
|
50
|
+
)
|
|
51
|
+
end
|
|
52
|
+
attr_accessor :customer_eligibility
|
|
53
|
+
|
|
31
54
|
sig { returns(T.nilable(Time)) }
|
|
32
55
|
attr_accessor :expires_at
|
|
33
56
|
|
|
@@ -42,6 +65,12 @@ module Dodopayments
|
|
|
42
65
|
sig { returns(T.nilable(String)) }
|
|
43
66
|
attr_accessor :name
|
|
44
67
|
|
|
68
|
+
# If present, update the per-customer usage limit (double-option: send `null` to
|
|
69
|
+
# clear it back to unlimited). Must be `<= usage_limit` (the value in effect after
|
|
70
|
+
# this patch) when both are set.
|
|
71
|
+
sig { returns(T.nilable(Integer)) }
|
|
72
|
+
attr_accessor :per_customer_usage_limit
|
|
73
|
+
|
|
45
74
|
# Whether this discount should be preserved when a subscription changes plans. If
|
|
46
75
|
# not provided, the existing value is kept.
|
|
47
76
|
sig { returns(T.nilable(T::Boolean)) }
|
|
@@ -52,13 +81,17 @@ module Dodopayments
|
|
|
52
81
|
sig { returns(T.nilable(T::Array[String])) }
|
|
53
82
|
attr_accessor :restricted_to
|
|
54
83
|
|
|
84
|
+
# If present, update `starts_at` (double-option: send `null` to clear it).
|
|
85
|
+
sig { returns(T.nilable(Time)) }
|
|
86
|
+
attr_accessor :starts_at
|
|
87
|
+
|
|
55
88
|
# Number of subscription billing cycles this discount is valid for. If not
|
|
56
89
|
# provided, the discount will be applied indefinitely to all recurring payments
|
|
57
90
|
# related to the subscription.
|
|
58
91
|
sig { returns(T.nilable(Integer)) }
|
|
59
92
|
attr_accessor :subscription_cycles
|
|
60
93
|
|
|
61
|
-
# If present, update the discount type
|
|
94
|
+
# If present, update the discount type (`percentage` or `flat`).
|
|
62
95
|
sig { returns(T.nilable(Dodopayments::DiscountType::OrSymbol)) }
|
|
63
96
|
attr_accessor :type
|
|
64
97
|
|
|
@@ -70,12 +103,24 @@ module Dodopayments
|
|
|
70
103
|
discount_id: String,
|
|
71
104
|
amount: T.nilable(Integer),
|
|
72
105
|
code: T.nilable(String),
|
|
106
|
+
currency_options:
|
|
107
|
+
T.nilable(
|
|
108
|
+
T::Array[
|
|
109
|
+
Dodopayments::DiscountUpdateParams::CurrencyOption::OrHash
|
|
110
|
+
]
|
|
111
|
+
),
|
|
112
|
+
customer_eligibility:
|
|
113
|
+
T.nilable(
|
|
114
|
+
Dodopayments::DiscountUpdateParams::CustomerEligibility::OrSymbol
|
|
115
|
+
),
|
|
73
116
|
expires_at: T.nilable(Time),
|
|
74
117
|
metadata:
|
|
75
118
|
T.nilable(T::Hash[Symbol, Dodopayments::MetadataItem::Variants]),
|
|
76
119
|
name: T.nilable(String),
|
|
120
|
+
per_customer_usage_limit: T.nilable(Integer),
|
|
77
121
|
preserve_on_plan_change: T.nilable(T::Boolean),
|
|
78
122
|
restricted_to: T.nilable(T::Array[String]),
|
|
123
|
+
starts_at: T.nilable(Time),
|
|
79
124
|
subscription_cycles: T.nilable(Integer),
|
|
80
125
|
type: T.nilable(Dodopayments::DiscountType::OrSymbol),
|
|
81
126
|
usage_limit: T.nilable(Integer),
|
|
@@ -91,21 +136,34 @@ module Dodopayments
|
|
|
91
136
|
amount: nil,
|
|
92
137
|
# If present, update the discount code (uppercase).
|
|
93
138
|
code: nil,
|
|
139
|
+
# If present, fully replaces the discount's currency options (replace-set
|
|
140
|
+
# semantics, like `restricted_to`). Send an empty array to clear them.
|
|
141
|
+
currency_options: nil,
|
|
142
|
+
# If present, update who may redeem this discount. Plain field (not
|
|
143
|
+
# double-option): the DB column is `NOT NULL`, so it can never be cleared back to
|
|
144
|
+
# unset, only changed to another `CustomerEligibility` value.
|
|
145
|
+
customer_eligibility: nil,
|
|
94
146
|
expires_at: nil,
|
|
95
147
|
# Additional metadata for the discount
|
|
96
148
|
metadata: nil,
|
|
97
149
|
name: nil,
|
|
150
|
+
# If present, update the per-customer usage limit (double-option: send `null` to
|
|
151
|
+
# clear it back to unlimited). Must be `<= usage_limit` (the value in effect after
|
|
152
|
+
# this patch) when both are set.
|
|
153
|
+
per_customer_usage_limit: nil,
|
|
98
154
|
# Whether this discount should be preserved when a subscription changes plans. If
|
|
99
155
|
# not provided, the existing value is kept.
|
|
100
156
|
preserve_on_plan_change: nil,
|
|
101
157
|
# If present, replaces all restricted product IDs with this new set. To remove all
|
|
102
158
|
# restrictions, send empty array
|
|
103
159
|
restricted_to: nil,
|
|
160
|
+
# If present, update `starts_at` (double-option: send `null` to clear it).
|
|
161
|
+
starts_at: nil,
|
|
104
162
|
# Number of subscription billing cycles this discount is valid for. If not
|
|
105
163
|
# provided, the discount will be applied indefinitely to all recurring payments
|
|
106
164
|
# related to the subscription.
|
|
107
165
|
subscription_cycles: nil,
|
|
108
|
-
# If present, update the discount type
|
|
166
|
+
# If present, update the discount type (`percentage` or `flat`).
|
|
109
167
|
type: nil,
|
|
110
168
|
usage_limit: nil,
|
|
111
169
|
request_options: {}
|
|
@@ -118,12 +176,22 @@ module Dodopayments
|
|
|
118
176
|
discount_id: String,
|
|
119
177
|
amount: T.nilable(Integer),
|
|
120
178
|
code: T.nilable(String),
|
|
179
|
+
currency_options:
|
|
180
|
+
T.nilable(
|
|
181
|
+
T::Array[Dodopayments::DiscountUpdateParams::CurrencyOption]
|
|
182
|
+
),
|
|
183
|
+
customer_eligibility:
|
|
184
|
+
T.nilable(
|
|
185
|
+
Dodopayments::DiscountUpdateParams::CustomerEligibility::OrSymbol
|
|
186
|
+
),
|
|
121
187
|
expires_at: T.nilable(Time),
|
|
122
188
|
metadata:
|
|
123
189
|
T.nilable(T::Hash[Symbol, Dodopayments::MetadataItem::Variants]),
|
|
124
190
|
name: T.nilable(String),
|
|
191
|
+
per_customer_usage_limit: T.nilable(Integer),
|
|
125
192
|
preserve_on_plan_change: T.nilable(T::Boolean),
|
|
126
193
|
restricted_to: T.nilable(T::Array[String]),
|
|
194
|
+
starts_at: T.nilable(Time),
|
|
127
195
|
subscription_cycles: T.nilable(Integer),
|
|
128
196
|
type: T.nilable(Dodopayments::DiscountType::OrSymbol),
|
|
129
197
|
usage_limit: T.nilable(Integer),
|
|
@@ -133,6 +201,129 @@ module Dodopayments
|
|
|
133
201
|
end
|
|
134
202
|
def to_hash
|
|
135
203
|
end
|
|
204
|
+
|
|
205
|
+
class CurrencyOption < Dodopayments::Internal::Type::BaseModel
|
|
206
|
+
OrHash =
|
|
207
|
+
T.type_alias do
|
|
208
|
+
T.any(
|
|
209
|
+
Dodopayments::DiscountUpdateParams::CurrencyOption,
|
|
210
|
+
Dodopayments::Internal::AnyHash
|
|
211
|
+
)
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
# The currency this option applies to.
|
|
215
|
+
sig { returns(Dodopayments::Currency::OrSymbol) }
|
|
216
|
+
attr_accessor :currency
|
|
217
|
+
|
|
218
|
+
# Whether this row is the default to convert from for unconfigured currencies. At
|
|
219
|
+
# most one row per discount may be default.
|
|
220
|
+
sig { returns(T.nilable(T::Boolean)) }
|
|
221
|
+
attr_reader :is_default
|
|
222
|
+
|
|
223
|
+
sig { params(is_default: T::Boolean).void }
|
|
224
|
+
attr_writer :is_default
|
|
225
|
+
|
|
226
|
+
# The most this code discounts in this currency's subunits. For `flat` codes this
|
|
227
|
+
# is the deduction; for `percentage` codes it is the max-discount cap. Must be > 0
|
|
228
|
+
# if provided.
|
|
229
|
+
sig { returns(T.nilable(Integer)) }
|
|
230
|
+
attr_accessor :max_amount_possible
|
|
231
|
+
|
|
232
|
+
# Eligible-cart threshold in this currency's subunits (0 = no minimum).
|
|
233
|
+
sig { returns(T.nilable(Integer)) }
|
|
234
|
+
attr_reader :minimum_subtotal
|
|
235
|
+
|
|
236
|
+
sig { params(minimum_subtotal: Integer).void }
|
|
237
|
+
attr_writer :minimum_subtotal
|
|
238
|
+
|
|
239
|
+
# A per-currency discount option (request shape).
|
|
240
|
+
#
|
|
241
|
+
# `max_amount_possible` is the most this code discounts in this currency — the
|
|
242
|
+
# flat deduction for `flat` codes, or the max-discount cap for `percentage` codes.
|
|
243
|
+
# Maps to the DB column of the same name.
|
|
244
|
+
sig do
|
|
245
|
+
params(
|
|
246
|
+
currency: Dodopayments::Currency::OrSymbol,
|
|
247
|
+
is_default: T::Boolean,
|
|
248
|
+
max_amount_possible: T.nilable(Integer),
|
|
249
|
+
minimum_subtotal: Integer
|
|
250
|
+
).returns(T.attached_class)
|
|
251
|
+
end
|
|
252
|
+
def self.new(
|
|
253
|
+
# The currency this option applies to.
|
|
254
|
+
currency:,
|
|
255
|
+
# Whether this row is the default to convert from for unconfigured currencies. At
|
|
256
|
+
# most one row per discount may be default.
|
|
257
|
+
is_default: nil,
|
|
258
|
+
# The most this code discounts in this currency's subunits. For `flat` codes this
|
|
259
|
+
# is the deduction; for `percentage` codes it is the max-discount cap. Must be > 0
|
|
260
|
+
# if provided.
|
|
261
|
+
max_amount_possible: nil,
|
|
262
|
+
# Eligible-cart threshold in this currency's subunits (0 = no minimum).
|
|
263
|
+
minimum_subtotal: nil
|
|
264
|
+
)
|
|
265
|
+
end
|
|
266
|
+
|
|
267
|
+
sig do
|
|
268
|
+
override.returns(
|
|
269
|
+
{
|
|
270
|
+
currency: Dodopayments::Currency::OrSymbol,
|
|
271
|
+
is_default: T::Boolean,
|
|
272
|
+
max_amount_possible: T.nilable(Integer),
|
|
273
|
+
minimum_subtotal: Integer
|
|
274
|
+
}
|
|
275
|
+
)
|
|
276
|
+
end
|
|
277
|
+
def to_hash
|
|
278
|
+
end
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
# If present, update who may redeem this discount. Plain field (not
|
|
282
|
+
# double-option): the DB column is `NOT NULL`, so it can never be cleared back to
|
|
283
|
+
# unset, only changed to another `CustomerEligibility` value.
|
|
284
|
+
module CustomerEligibility
|
|
285
|
+
extend Dodopayments::Internal::Type::Enum
|
|
286
|
+
|
|
287
|
+
TaggedSymbol =
|
|
288
|
+
T.type_alias do
|
|
289
|
+
T.all(
|
|
290
|
+
Symbol,
|
|
291
|
+
Dodopayments::DiscountUpdateParams::CustomerEligibility
|
|
292
|
+
)
|
|
293
|
+
end
|
|
294
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
295
|
+
|
|
296
|
+
ANY =
|
|
297
|
+
T.let(
|
|
298
|
+
:any,
|
|
299
|
+
Dodopayments::DiscountUpdateParams::CustomerEligibility::TaggedSymbol
|
|
300
|
+
)
|
|
301
|
+
FIRST_TIME =
|
|
302
|
+
T.let(
|
|
303
|
+
:first_time,
|
|
304
|
+
Dodopayments::DiscountUpdateParams::CustomerEligibility::TaggedSymbol
|
|
305
|
+
)
|
|
306
|
+
EXISTING =
|
|
307
|
+
T.let(
|
|
308
|
+
:existing,
|
|
309
|
+
Dodopayments::DiscountUpdateParams::CustomerEligibility::TaggedSymbol
|
|
310
|
+
)
|
|
311
|
+
SPECIFIC =
|
|
312
|
+
T.let(
|
|
313
|
+
:specific,
|
|
314
|
+
Dodopayments::DiscountUpdateParams::CustomerEligibility::TaggedSymbol
|
|
315
|
+
)
|
|
316
|
+
|
|
317
|
+
sig do
|
|
318
|
+
override.returns(
|
|
319
|
+
T::Array[
|
|
320
|
+
Dodopayments::DiscountUpdateParams::CustomerEligibility::TaggedSymbol
|
|
321
|
+
]
|
|
322
|
+
)
|
|
323
|
+
end
|
|
324
|
+
def self.values
|
|
325
|
+
end
|
|
326
|
+
end
|
|
136
327
|
end
|
|
137
328
|
end
|
|
138
329
|
end
|
|
@@ -139,6 +139,22 @@ module Dodopayments
|
|
|
139
139
|
sig { returns(T.nilable(String)) }
|
|
140
140
|
attr_accessor :error_message
|
|
141
141
|
|
|
142
|
+
# Purpose-built failure messaging for the merchant and the customer, derived from
|
|
143
|
+
# `error_code`. Present whenever `error_code` is set, regardless of payment
|
|
144
|
+
# status; unrecognised codes still resolve via a generic fallback rather than
|
|
145
|
+
# being omitted. The customer copy is always generic for fraud-sensitive declines
|
|
146
|
+
# (lost/stolen/pickup/fraudulent) so the true reason is never leaked.
|
|
147
|
+
sig { returns(T.nilable(Dodopayments::Payment::FailureDetails)) }
|
|
148
|
+
attr_reader :failure_details
|
|
149
|
+
|
|
150
|
+
sig do
|
|
151
|
+
params(
|
|
152
|
+
failure_details:
|
|
153
|
+
T.nilable(Dodopayments::Payment::FailureDetails::OrHash)
|
|
154
|
+
).void
|
|
155
|
+
end
|
|
156
|
+
attr_writer :failure_details
|
|
157
|
+
|
|
142
158
|
# Invoice ID for this payment. Uses India-specific invoice ID if available.
|
|
143
159
|
sig { returns(T.nilable(String)) }
|
|
144
160
|
attr_accessor :invoice_id
|
|
@@ -228,6 +244,8 @@ module Dodopayments
|
|
|
228
244
|
discounts: T.nilable(T::Array[Dodopayments::DiscountDetail::OrHash]),
|
|
229
245
|
error_code: T.nilable(String),
|
|
230
246
|
error_message: T.nilable(String),
|
|
247
|
+
failure_details:
|
|
248
|
+
T.nilable(Dodopayments::Payment::FailureDetails::OrHash),
|
|
231
249
|
invoice_id: T.nilable(String),
|
|
232
250
|
invoice_url: T.nilable(String),
|
|
233
251
|
payment_link: T.nilable(String),
|
|
@@ -312,6 +330,12 @@ module Dodopayments
|
|
|
312
330
|
error_code: nil,
|
|
313
331
|
# An error message if the payment failed
|
|
314
332
|
error_message: nil,
|
|
333
|
+
# Purpose-built failure messaging for the merchant and the customer, derived from
|
|
334
|
+
# `error_code`. Present whenever `error_code` is set, regardless of payment
|
|
335
|
+
# status; unrecognised codes still resolve via a generic fallback rather than
|
|
336
|
+
# being omitted. The customer copy is always generic for fraud-sensitive declines
|
|
337
|
+
# (lost/stolen/pickup/fraudulent) so the true reason is never leaked.
|
|
338
|
+
failure_details: nil,
|
|
315
339
|
# Invoice ID for this payment. Uses India-specific invoice ID if available.
|
|
316
340
|
invoice_id: nil,
|
|
317
341
|
# URL to download the invoice PDF for this payment.
|
|
@@ -379,6 +403,7 @@ module Dodopayments
|
|
|
379
403
|
discounts: T.nilable(T::Array[Dodopayments::DiscountDetail]),
|
|
380
404
|
error_code: T.nilable(String),
|
|
381
405
|
error_message: T.nilable(String),
|
|
406
|
+
failure_details: T.nilable(Dodopayments::Payment::FailureDetails),
|
|
382
407
|
invoice_id: T.nilable(String),
|
|
383
408
|
invoice_url: T.nilable(String),
|
|
384
409
|
payment_link: T.nilable(String),
|
|
@@ -425,6 +450,328 @@ module Dodopayments
|
|
|
425
450
|
end
|
|
426
451
|
end
|
|
427
452
|
|
|
453
|
+
class FailureDetails < Dodopayments::Internal::Type::BaseModel
|
|
454
|
+
OrHash =
|
|
455
|
+
T.type_alias do
|
|
456
|
+
T.any(
|
|
457
|
+
Dodopayments::Payment::FailureDetails,
|
|
458
|
+
Dodopayments::Internal::AnyHash
|
|
459
|
+
)
|
|
460
|
+
end
|
|
461
|
+
|
|
462
|
+
# The unified error code (echoes `error_code`).
|
|
463
|
+
sig { returns(String) }
|
|
464
|
+
attr_accessor :code
|
|
465
|
+
|
|
466
|
+
# The primary CTA to show the customer.
|
|
467
|
+
sig do
|
|
468
|
+
returns(
|
|
469
|
+
Dodopayments::Payment::FailureDetails::CustomerCta::TaggedSymbol
|
|
470
|
+
)
|
|
471
|
+
end
|
|
472
|
+
attr_accessor :customer_cta
|
|
473
|
+
|
|
474
|
+
# Whether the customer can resolve this themselves (e.g. fix CVC).
|
|
475
|
+
sig { returns(T::Boolean) }
|
|
476
|
+
attr_accessor :customer_fixable
|
|
477
|
+
|
|
478
|
+
# The customer-facing string. Always generic (`C11`) for the fraud-4.
|
|
479
|
+
sig { returns(String) }
|
|
480
|
+
attr_accessor :customer_message
|
|
481
|
+
|
|
482
|
+
# The customer message template identifier (C1..C20).
|
|
483
|
+
sig do
|
|
484
|
+
returns(
|
|
485
|
+
Dodopayments::Payment::FailureDetails::CustomerTemplate::TaggedSymbol
|
|
486
|
+
)
|
|
487
|
+
end
|
|
488
|
+
attr_accessor :customer_template
|
|
489
|
+
|
|
490
|
+
# Soft or hard decline.
|
|
491
|
+
sig do
|
|
492
|
+
returns(
|
|
493
|
+
Dodopayments::Payment::FailureDetails::DeclineType::TaggedSymbol
|
|
494
|
+
)
|
|
495
|
+
end
|
|
496
|
+
attr_accessor :decline_type
|
|
497
|
+
|
|
498
|
+
# Merchant-facing headline + recommended action (Payment Details). For the fraud-4
|
|
499
|
+
# this includes the operator "do not reveal" warning.
|
|
500
|
+
sig { returns(String) }
|
|
501
|
+
attr_accessor :merchant_message
|
|
502
|
+
|
|
503
|
+
# Purpose-built failure messaging for the merchant and the customer, derived from
|
|
504
|
+
# `error_code`. Present whenever `error_code` is set, regardless of payment
|
|
505
|
+
# status; unrecognised codes still resolve via a generic fallback rather than
|
|
506
|
+
# being omitted. The customer copy is always generic for fraud-sensitive declines
|
|
507
|
+
# (lost/stolen/pickup/fraudulent) so the true reason is never leaked.
|
|
508
|
+
sig do
|
|
509
|
+
params(
|
|
510
|
+
code: String,
|
|
511
|
+
customer_cta:
|
|
512
|
+
Dodopayments::Payment::FailureDetails::CustomerCta::OrSymbol,
|
|
513
|
+
customer_fixable: T::Boolean,
|
|
514
|
+
customer_message: String,
|
|
515
|
+
customer_template:
|
|
516
|
+
Dodopayments::Payment::FailureDetails::CustomerTemplate::OrSymbol,
|
|
517
|
+
decline_type:
|
|
518
|
+
Dodopayments::Payment::FailureDetails::DeclineType::OrSymbol,
|
|
519
|
+
merchant_message: String
|
|
520
|
+
).returns(T.attached_class)
|
|
521
|
+
end
|
|
522
|
+
def self.new(
|
|
523
|
+
# The unified error code (echoes `error_code`).
|
|
524
|
+
code:,
|
|
525
|
+
# The primary CTA to show the customer.
|
|
526
|
+
customer_cta:,
|
|
527
|
+
# Whether the customer can resolve this themselves (e.g. fix CVC).
|
|
528
|
+
customer_fixable:,
|
|
529
|
+
# The customer-facing string. Always generic (`C11`) for the fraud-4.
|
|
530
|
+
customer_message:,
|
|
531
|
+
# The customer message template identifier (C1..C20).
|
|
532
|
+
customer_template:,
|
|
533
|
+
# Soft or hard decline.
|
|
534
|
+
decline_type:,
|
|
535
|
+
# Merchant-facing headline + recommended action (Payment Details). For the fraud-4
|
|
536
|
+
# this includes the operator "do not reveal" warning.
|
|
537
|
+
merchant_message:
|
|
538
|
+
)
|
|
539
|
+
end
|
|
540
|
+
|
|
541
|
+
sig do
|
|
542
|
+
override.returns(
|
|
543
|
+
{
|
|
544
|
+
code: String,
|
|
545
|
+
customer_cta:
|
|
546
|
+
Dodopayments::Payment::FailureDetails::CustomerCta::TaggedSymbol,
|
|
547
|
+
customer_fixable: T::Boolean,
|
|
548
|
+
customer_message: String,
|
|
549
|
+
customer_template:
|
|
550
|
+
Dodopayments::Payment::FailureDetails::CustomerTemplate::TaggedSymbol,
|
|
551
|
+
decline_type:
|
|
552
|
+
Dodopayments::Payment::FailureDetails::DeclineType::TaggedSymbol,
|
|
553
|
+
merchant_message: String
|
|
554
|
+
}
|
|
555
|
+
)
|
|
556
|
+
end
|
|
557
|
+
def to_hash
|
|
558
|
+
end
|
|
559
|
+
|
|
560
|
+
# The primary CTA to show the customer.
|
|
561
|
+
module CustomerCta
|
|
562
|
+
extend Dodopayments::Internal::Type::Enum
|
|
563
|
+
|
|
564
|
+
TaggedSymbol =
|
|
565
|
+
T.type_alias do
|
|
566
|
+
T.all(Symbol, Dodopayments::Payment::FailureDetails::CustomerCta)
|
|
567
|
+
end
|
|
568
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
569
|
+
|
|
570
|
+
EDIT_AND_RETRY =
|
|
571
|
+
T.let(
|
|
572
|
+
:edit_and_retry,
|
|
573
|
+
Dodopayments::Payment::FailureDetails::CustomerCta::TaggedSymbol
|
|
574
|
+
)
|
|
575
|
+
USE_ANOTHER_METHOD =
|
|
576
|
+
T.let(
|
|
577
|
+
:use_another_method,
|
|
578
|
+
Dodopayments::Payment::FailureDetails::CustomerCta::TaggedSymbol
|
|
579
|
+
)
|
|
580
|
+
TRY_AGAIN =
|
|
581
|
+
T.let(
|
|
582
|
+
:try_again,
|
|
583
|
+
Dodopayments::Payment::FailureDetails::CustomerCta::TaggedSymbol
|
|
584
|
+
)
|
|
585
|
+
TRY_LATER =
|
|
586
|
+
T.let(
|
|
587
|
+
:try_later,
|
|
588
|
+
Dodopayments::Payment::FailureDetails::CustomerCta::TaggedSymbol
|
|
589
|
+
)
|
|
590
|
+
RETRY_AND_VERIFY =
|
|
591
|
+
T.let(
|
|
592
|
+
:retry_and_verify,
|
|
593
|
+
Dodopayments::Payment::FailureDetails::CustomerCta::TaggedSymbol
|
|
594
|
+
)
|
|
595
|
+
RESTART =
|
|
596
|
+
T.let(
|
|
597
|
+
:restart,
|
|
598
|
+
Dodopayments::Payment::FailureDetails::CustomerCta::TaggedSymbol
|
|
599
|
+
)
|
|
600
|
+
UPDATE_METHOD =
|
|
601
|
+
T.let(
|
|
602
|
+
:update_method,
|
|
603
|
+
Dodopayments::Payment::FailureDetails::CustomerCta::TaggedSymbol
|
|
604
|
+
)
|
|
605
|
+
|
|
606
|
+
sig do
|
|
607
|
+
override.returns(
|
|
608
|
+
T::Array[
|
|
609
|
+
Dodopayments::Payment::FailureDetails::CustomerCta::TaggedSymbol
|
|
610
|
+
]
|
|
611
|
+
)
|
|
612
|
+
end
|
|
613
|
+
def self.values
|
|
614
|
+
end
|
|
615
|
+
end
|
|
616
|
+
|
|
617
|
+
# The customer message template identifier (C1..C20).
|
|
618
|
+
module CustomerTemplate
|
|
619
|
+
extend Dodopayments::Internal::Type::Enum
|
|
620
|
+
|
|
621
|
+
TaggedSymbol =
|
|
622
|
+
T.type_alias do
|
|
623
|
+
T.all(
|
|
624
|
+
Symbol,
|
|
625
|
+
Dodopayments::Payment::FailureDetails::CustomerTemplate
|
|
626
|
+
)
|
|
627
|
+
end
|
|
628
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
629
|
+
|
|
630
|
+
C1 =
|
|
631
|
+
T.let(
|
|
632
|
+
:C1,
|
|
633
|
+
Dodopayments::Payment::FailureDetails::CustomerTemplate::TaggedSymbol
|
|
634
|
+
)
|
|
635
|
+
C2 =
|
|
636
|
+
T.let(
|
|
637
|
+
:C2,
|
|
638
|
+
Dodopayments::Payment::FailureDetails::CustomerTemplate::TaggedSymbol
|
|
639
|
+
)
|
|
640
|
+
C3 =
|
|
641
|
+
T.let(
|
|
642
|
+
:C3,
|
|
643
|
+
Dodopayments::Payment::FailureDetails::CustomerTemplate::TaggedSymbol
|
|
644
|
+
)
|
|
645
|
+
C4 =
|
|
646
|
+
T.let(
|
|
647
|
+
:C4,
|
|
648
|
+
Dodopayments::Payment::FailureDetails::CustomerTemplate::TaggedSymbol
|
|
649
|
+
)
|
|
650
|
+
C5 =
|
|
651
|
+
T.let(
|
|
652
|
+
:C5,
|
|
653
|
+
Dodopayments::Payment::FailureDetails::CustomerTemplate::TaggedSymbol
|
|
654
|
+
)
|
|
655
|
+
C6 =
|
|
656
|
+
T.let(
|
|
657
|
+
:C6,
|
|
658
|
+
Dodopayments::Payment::FailureDetails::CustomerTemplate::TaggedSymbol
|
|
659
|
+
)
|
|
660
|
+
C7 =
|
|
661
|
+
T.let(
|
|
662
|
+
:C7,
|
|
663
|
+
Dodopayments::Payment::FailureDetails::CustomerTemplate::TaggedSymbol
|
|
664
|
+
)
|
|
665
|
+
C8 =
|
|
666
|
+
T.let(
|
|
667
|
+
:C8,
|
|
668
|
+
Dodopayments::Payment::FailureDetails::CustomerTemplate::TaggedSymbol
|
|
669
|
+
)
|
|
670
|
+
C9 =
|
|
671
|
+
T.let(
|
|
672
|
+
:C9,
|
|
673
|
+
Dodopayments::Payment::FailureDetails::CustomerTemplate::TaggedSymbol
|
|
674
|
+
)
|
|
675
|
+
C10 =
|
|
676
|
+
T.let(
|
|
677
|
+
:C10,
|
|
678
|
+
Dodopayments::Payment::FailureDetails::CustomerTemplate::TaggedSymbol
|
|
679
|
+
)
|
|
680
|
+
C11 =
|
|
681
|
+
T.let(
|
|
682
|
+
:C11,
|
|
683
|
+
Dodopayments::Payment::FailureDetails::CustomerTemplate::TaggedSymbol
|
|
684
|
+
)
|
|
685
|
+
C12 =
|
|
686
|
+
T.let(
|
|
687
|
+
:C12,
|
|
688
|
+
Dodopayments::Payment::FailureDetails::CustomerTemplate::TaggedSymbol
|
|
689
|
+
)
|
|
690
|
+
C13 =
|
|
691
|
+
T.let(
|
|
692
|
+
:C13,
|
|
693
|
+
Dodopayments::Payment::FailureDetails::CustomerTemplate::TaggedSymbol
|
|
694
|
+
)
|
|
695
|
+
C14 =
|
|
696
|
+
T.let(
|
|
697
|
+
:C14,
|
|
698
|
+
Dodopayments::Payment::FailureDetails::CustomerTemplate::TaggedSymbol
|
|
699
|
+
)
|
|
700
|
+
C15 =
|
|
701
|
+
T.let(
|
|
702
|
+
:C15,
|
|
703
|
+
Dodopayments::Payment::FailureDetails::CustomerTemplate::TaggedSymbol
|
|
704
|
+
)
|
|
705
|
+
C16 =
|
|
706
|
+
T.let(
|
|
707
|
+
:C16,
|
|
708
|
+
Dodopayments::Payment::FailureDetails::CustomerTemplate::TaggedSymbol
|
|
709
|
+
)
|
|
710
|
+
C17 =
|
|
711
|
+
T.let(
|
|
712
|
+
:C17,
|
|
713
|
+
Dodopayments::Payment::FailureDetails::CustomerTemplate::TaggedSymbol
|
|
714
|
+
)
|
|
715
|
+
C18 =
|
|
716
|
+
T.let(
|
|
717
|
+
:C18,
|
|
718
|
+
Dodopayments::Payment::FailureDetails::CustomerTemplate::TaggedSymbol
|
|
719
|
+
)
|
|
720
|
+
C19 =
|
|
721
|
+
T.let(
|
|
722
|
+
:C19,
|
|
723
|
+
Dodopayments::Payment::FailureDetails::CustomerTemplate::TaggedSymbol
|
|
724
|
+
)
|
|
725
|
+
C20 =
|
|
726
|
+
T.let(
|
|
727
|
+
:C20,
|
|
728
|
+
Dodopayments::Payment::FailureDetails::CustomerTemplate::TaggedSymbol
|
|
729
|
+
)
|
|
730
|
+
|
|
731
|
+
sig do
|
|
732
|
+
override.returns(
|
|
733
|
+
T::Array[
|
|
734
|
+
Dodopayments::Payment::FailureDetails::CustomerTemplate::TaggedSymbol
|
|
735
|
+
]
|
|
736
|
+
)
|
|
737
|
+
end
|
|
738
|
+
def self.values
|
|
739
|
+
end
|
|
740
|
+
end
|
|
741
|
+
|
|
742
|
+
# Soft or hard decline.
|
|
743
|
+
module DeclineType
|
|
744
|
+
extend Dodopayments::Internal::Type::Enum
|
|
745
|
+
|
|
746
|
+
TaggedSymbol =
|
|
747
|
+
T.type_alias do
|
|
748
|
+
T.all(Symbol, Dodopayments::Payment::FailureDetails::DeclineType)
|
|
749
|
+
end
|
|
750
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
751
|
+
|
|
752
|
+
SOFT =
|
|
753
|
+
T.let(
|
|
754
|
+
:soft,
|
|
755
|
+
Dodopayments::Payment::FailureDetails::DeclineType::TaggedSymbol
|
|
756
|
+
)
|
|
757
|
+
HARD =
|
|
758
|
+
T.let(
|
|
759
|
+
:hard,
|
|
760
|
+
Dodopayments::Payment::FailureDetails::DeclineType::TaggedSymbol
|
|
761
|
+
)
|
|
762
|
+
|
|
763
|
+
sig do
|
|
764
|
+
override.returns(
|
|
765
|
+
T::Array[
|
|
766
|
+
Dodopayments::Payment::FailureDetails::DeclineType::TaggedSymbol
|
|
767
|
+
]
|
|
768
|
+
)
|
|
769
|
+
end
|
|
770
|
+
def self.values
|
|
771
|
+
end
|
|
772
|
+
end
|
|
773
|
+
end
|
|
774
|
+
|
|
428
775
|
class ProductCart < Dodopayments::Internal::Type::BaseModel
|
|
429
776
|
OrHash =
|
|
430
777
|
T.type_alias do
|