dodopayments 2.29.0 → 2.31.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 (102) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/README.md +1 -1
  4. data/lib/dodopayments/client.rb +4 -0
  5. data/lib/dodopayments/models/balance_ledger_entry.rb +3 -0
  6. data/lib/dodopayments/models/balance_retrieve_ledger_params.rb +3 -0
  7. data/lib/dodopayments/models/checkout_session_flags.rb +14 -1
  8. data/lib/dodopayments/models/checkout_session_preview_response.rb +86 -4
  9. data/lib/dodopayments/models/checkout_session_request.rb +18 -5
  10. data/lib/dodopayments/models/customers/email_log_item.rb +3 -2
  11. data/lib/dodopayments/models/customers/email_policies.rb +7 -5
  12. data/lib/dodopayments/models/discount_create_params.rb +11 -8
  13. data/lib/dodopayments/models/discount_update_params.rb +6 -5
  14. data/lib/dodopayments/models/moderation_category.rb +31 -0
  15. data/lib/dodopayments/models/moderation_category_provenance.rb +150 -0
  16. data/lib/dodopayments/models/moderation_category_scores.rb +150 -0
  17. data/lib/dodopayments/models/moderation_decision.rb +18 -0
  18. data/lib/dodopayments/models/moderation_provenance.rb +18 -0
  19. data/lib/dodopayments/models/moderation_retrieve_usage_params.rb +14 -0
  20. data/lib/dodopayments/models/moderation_retrieve_usage_response.rb +61 -0
  21. data/lib/dodopayments/models/moderation_screen_params.rb +44 -0
  22. data/lib/dodopayments/models/moderation_screen_response.rb +99 -0
  23. data/lib/dodopayments/models/payment.rb +25 -3
  24. data/lib/dodopayments/models/payment_list_response.rb +21 -1
  25. data/lib/dodopayments/models/payouts/breakup/detail_list_response.rb +5 -4
  26. data/lib/dodopayments/models/payouts/breakup_retrieve_response.rb +17 -1
  27. data/lib/dodopayments/models/refund.rb +22 -1
  28. data/lib/dodopayments/models/refund_list_item.rb +22 -1
  29. data/lib/dodopayments/models/refund_network_reference_type.rb +19 -0
  30. data/lib/dodopayments/models/subscription.rb +10 -1
  31. data/lib/dodopayments/models/subscription_cancelled_by.rb +54 -0
  32. data/lib/dodopayments/models/subscription_list_response.rb +10 -1
  33. data/lib/dodopayments/models/subscription_preview_change_plan_response.rb +18 -7
  34. data/lib/dodopayments/models.rb +18 -0
  35. data/lib/dodopayments/resources/checkout_sessions.rb +6 -6
  36. data/lib/dodopayments/resources/moderation.rb +81 -0
  37. data/lib/dodopayments/resources/payouts/breakup/details.rb +4 -4
  38. data/lib/dodopayments/version.rb +1 -1
  39. data/lib/dodopayments.rb +12 -0
  40. data/rbi/dodopayments/client.rbi +3 -0
  41. data/rbi/dodopayments/models/balance_ledger_entry.rbi +15 -0
  42. data/rbi/dodopayments/models/balance_retrieve_ledger_params.rbi +15 -0
  43. data/rbi/dodopayments/models/checkout_session_flags.rbi +21 -0
  44. data/rbi/dodopayments/models/checkout_session_preview_response.rbi +130 -6
  45. data/rbi/dodopayments/models/checkout_session_request.rbi +31 -8
  46. data/rbi/dodopayments/models/customers/email_log_item.rbi +4 -2
  47. data/rbi/dodopayments/models/customers/email_policies.rbi +10 -6
  48. data/rbi/dodopayments/models/discount_create_params.rbi +18 -12
  49. data/rbi/dodopayments/models/discount_update_params.rbi +8 -6
  50. data/rbi/dodopayments/models/moderation_category.rbi +88 -0
  51. data/rbi/dodopayments/models/moderation_category_provenance.rbi +184 -0
  52. data/rbi/dodopayments/models/moderation_category_scores.rbi +171 -0
  53. data/rbi/dodopayments/models/moderation_decision.rbi +27 -0
  54. data/rbi/dodopayments/models/moderation_provenance.rbi +28 -0
  55. data/rbi/dodopayments/models/moderation_retrieve_usage_params.rbi +32 -0
  56. data/rbi/dodopayments/models/moderation_retrieve_usage_response.rbi +104 -0
  57. data/rbi/dodopayments/models/moderation_screen_params.rbi +68 -0
  58. data/rbi/dodopayments/models/moderation_screen_response.rbi +135 -0
  59. data/rbi/dodopayments/models/payment.rbi +30 -2
  60. data/rbi/dodopayments/models/payment_list_response.rbi +24 -0
  61. data/rbi/dodopayments/models/payouts/breakup/detail_list_response.rbi +8 -6
  62. data/rbi/dodopayments/models/payouts/breakup_retrieve_response.rbi +19 -2
  63. data/rbi/dodopayments/models/refund.rbi +26 -0
  64. data/rbi/dodopayments/models/refund_list_item.rbi +26 -0
  65. data/rbi/dodopayments/models/refund_network_reference_type.rbi +41 -0
  66. data/rbi/dodopayments/models/subscription.rbi +18 -0
  67. data/rbi/dodopayments/models/subscription_cancelled_by.rbi +107 -0
  68. data/rbi/dodopayments/models/subscription_list_response.rbi +18 -0
  69. data/rbi/dodopayments/models/subscription_preview_change_plan_response.rbi +24 -10
  70. data/rbi/dodopayments/models.rbi +20 -0
  71. data/rbi/dodopayments/resources/checkout_sessions.rbi +30 -4
  72. data/rbi/dodopayments/resources/discounts.rbi +5 -3
  73. data/rbi/dodopayments/resources/moderation.rbi +64 -0
  74. data/rbi/dodopayments/resources/payouts/breakup/details.rbi +4 -4
  75. data/sig/dodopayments/client.rbs +2 -0
  76. data/sig/dodopayments/models/balance_ledger_entry.rbs +6 -0
  77. data/sig/dodopayments/models/balance_retrieve_ledger_params.rbs +6 -0
  78. data/sig/dodopayments/models/checkout_session_flags.rbs +7 -0
  79. data/sig/dodopayments/models/checkout_session_preview_response.rbs +52 -0
  80. data/sig/dodopayments/models/checkout_session_request.rbs +4 -6
  81. data/sig/dodopayments/models/moderation_category.rbs +46 -0
  82. data/sig/dodopayments/models/moderation_category_provenance.rbs +100 -0
  83. data/sig/dodopayments/models/moderation_category_scores.rbs +100 -0
  84. data/sig/dodopayments/models/moderation_decision.rbs +15 -0
  85. data/sig/dodopayments/models/moderation_provenance.rbs +14 -0
  86. data/sig/dodopayments/models/moderation_retrieve_usage_params.rbs +15 -0
  87. data/sig/dodopayments/models/moderation_retrieve_usage_response.rbs +42 -0
  88. data/sig/dodopayments/models/moderation_screen_params.rbs +32 -0
  89. data/sig/dodopayments/models/moderation_screen_response.rbs +65 -0
  90. data/sig/dodopayments/models/payment.rbs +10 -0
  91. data/sig/dodopayments/models/payment_list_response.rbs +10 -0
  92. data/sig/dodopayments/models/refund.rbs +10 -0
  93. data/sig/dodopayments/models/refund_list_item.rbs +10 -0
  94. data/sig/dodopayments/models/refund_network_reference_type.rbs +20 -0
  95. data/sig/dodopayments/models/subscription.rbs +5 -0
  96. data/sig/dodopayments/models/subscription_cancelled_by.rbs +43 -0
  97. data/sig/dodopayments/models/subscription_list_response.rbs +5 -0
  98. data/sig/dodopayments/models/subscription_preview_change_plan_response.rbs +5 -0
  99. data/sig/dodopayments/models.rbs +18 -0
  100. data/sig/dodopayments/resources/checkout_sessions.rbs +2 -2
  101. data/sig/dodopayments/resources/moderation.rbs +18 -0
  102. metadata +38 -2
@@ -0,0 +1,135 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ class ModerationScreenResponse < Dodopayments::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ Dodopayments::Models::ModerationScreenResponse,
10
+ Dodopayments::Internal::AnyHash
11
+ )
12
+ end
13
+
14
+ # The probability, from 0 to 1, that the screen falls in each category.
15
+ sig { returns(Dodopayments::ModerationCategoryScores) }
16
+ attr_reader :categories
17
+
18
+ sig do
19
+ params(categories: Dodopayments::ModerationCategoryScores::OrHash).void
20
+ end
21
+ attr_writer :categories
22
+
23
+ # True when real-person likeness and sexual content together crossed their
24
+ # combined threshold, the pattern of a sexual deepfake.
25
+ sig { returns(T::Boolean) }
26
+ attr_accessor :compound_triggered
27
+
28
+ # The verdict. `allow` means the content passed. `deny` means block the content.
29
+ # `flag` means apply your own judgement. It is not a soft deny.
30
+ sig { returns(Dodopayments::ModerationDecision::TaggedSymbol) }
31
+ attr_accessor :decision
32
+
33
+ # The time the screen took, in milliseconds.
34
+ sig { returns(Integer) }
35
+ attr_accessor :latency_ms
36
+
37
+ # True when the text was also screened in a normalized form, with obfuscation such
38
+ # as invisible or look-alike characters removed.
39
+ sig { returns(T::Boolean) }
40
+ attr_accessor :normalized_applied
41
+
42
+ # Human-readable reasons for the decision. The wording can change, so do not parse
43
+ # it.
44
+ sig { returns(T::Array[String]) }
45
+ attr_accessor :notes
46
+
47
+ # The number of yes/no questions the model answered for this screen.
48
+ sig { returns(Integer) }
49
+ attr_accessor :passes
50
+
51
+ # How each score in `categories` was measured.
52
+ sig { returns(Dodopayments::ModerationCategoryProvenance) }
53
+ attr_reader :provenance
54
+
55
+ sig do
56
+ params(
57
+ provenance: Dodopayments::ModerationCategoryProvenance::OrHash
58
+ ).void
59
+ end
60
+ attr_writer :provenance
61
+
62
+ # The `request_id` you sent, or null.
63
+ sig { returns(T.nilable(String)) }
64
+ attr_accessor :request_id
65
+
66
+ # The categories whose score crossed the threshold of the category. It can be
67
+ # empty on a `flag` from the general check. `notes` then gives the reason.
68
+ sig { returns(T::Array[Dodopayments::ModerationCategory::TaggedSymbol]) }
69
+ attr_accessor :triggered
70
+
71
+ # The verdict of one screen.
72
+ sig do
73
+ params(
74
+ categories: Dodopayments::ModerationCategoryScores::OrHash,
75
+ compound_triggered: T::Boolean,
76
+ decision: Dodopayments::ModerationDecision::OrSymbol,
77
+ latency_ms: Integer,
78
+ normalized_applied: T::Boolean,
79
+ notes: T::Array[String],
80
+ passes: Integer,
81
+ provenance: Dodopayments::ModerationCategoryProvenance::OrHash,
82
+ request_id: T.nilable(String),
83
+ triggered: T::Array[Dodopayments::ModerationCategory::OrSymbol]
84
+ ).returns(T.attached_class)
85
+ end
86
+ def self.new(
87
+ # The probability, from 0 to 1, that the screen falls in each category.
88
+ categories:,
89
+ # True when real-person likeness and sexual content together crossed their
90
+ # combined threshold, the pattern of a sexual deepfake.
91
+ compound_triggered:,
92
+ # The verdict. `allow` means the content passed. `deny` means block the content.
93
+ # `flag` means apply your own judgement. It is not a soft deny.
94
+ decision:,
95
+ # The time the screen took, in milliseconds.
96
+ latency_ms:,
97
+ # True when the text was also screened in a normalized form, with obfuscation such
98
+ # as invisible or look-alike characters removed.
99
+ normalized_applied:,
100
+ # Human-readable reasons for the decision. The wording can change, so do not parse
101
+ # it.
102
+ notes:,
103
+ # The number of yes/no questions the model answered for this screen.
104
+ passes:,
105
+ # How each score in `categories` was measured.
106
+ provenance:,
107
+ # The `request_id` you sent, or null.
108
+ request_id:,
109
+ # The categories whose score crossed the threshold of the category. It can be
110
+ # empty on a `flag` from the general check. `notes` then gives the reason.
111
+ triggered:
112
+ )
113
+ end
114
+
115
+ sig do
116
+ override.returns(
117
+ {
118
+ categories: Dodopayments::ModerationCategoryScores,
119
+ compound_triggered: T::Boolean,
120
+ decision: Dodopayments::ModerationDecision::TaggedSymbol,
121
+ latency_ms: Integer,
122
+ normalized_applied: T::Boolean,
123
+ notes: T::Array[String],
124
+ passes: Integer,
125
+ provenance: Dodopayments::ModerationCategoryProvenance,
126
+ request_id: T.nilable(String),
127
+ triggered: T::Array[Dodopayments::ModerationCategory::TaggedSymbol]
128
+ }
129
+ )
130
+ end
131
+ def to_hash
132
+ end
133
+ end
134
+ end
135
+ end
@@ -48,6 +48,12 @@ module Dodopayments
48
48
  sig { returns(T::Array[Dodopayments::Dispute]) }
49
49
  attr_accessor :disputes
50
50
 
51
+ # True when one payment starts more than one subscription. Read this field to find
52
+ # the payment type. Do not read the length of `subscription_ids`. Do not read
53
+ # `subscription_id` for null.
54
+ sig { returns(T::Boolean) }
55
+ attr_accessor :is_multi_subscription
56
+
51
57
  # Whether this payment was created solely to update a subscription's payment
52
58
  # method (a zero-/setup-amount charge). `false` for normal charges.
53
59
  sig { returns(T::Boolean) }
@@ -88,6 +94,12 @@ module Dodopayments
88
94
  sig { returns(Dodopayments::Currency::TaggedSymbol) }
89
95
  attr_accessor :settlement_currency
90
96
 
97
+ # Every subscription that this payment starts or charges, in a stable order. It is
98
+ # empty for a one-time payment. It holds the value of `subscription_id` when the
99
+ # payment names one subscription.
100
+ sig { returns(T::Array[String]) }
101
+ attr_accessor :subscription_ids
102
+
91
103
  # Total amount charged to the customer including tax, in the currency's smallest
92
104
  # unit (e.g. cents for USD, yen for JPY, fils for KWD — see the currency's decimal
93
105
  # places)
@@ -186,7 +198,9 @@ module Dodopayments
186
198
  sig { returns(T.nilable(Dodopayments::IntentStatus::TaggedSymbol)) }
187
199
  attr_accessor :status
188
200
 
189
- # Identifier of the subscription if payment is part of a subscription
201
+ # Identifier of the subscription if payment is part of a subscription. A
202
+ # multi-subscription payment leaves this null, because no single subscription owns
203
+ # the payment. Read `subscription_ids` for those.
190
204
  sig { returns(T.nilable(String)) }
191
205
  attr_accessor :subscription_id
192
206
 
@@ -209,6 +223,7 @@ module Dodopayments
209
223
  customer: Dodopayments::CustomerLimitedDetails::OrHash,
210
224
  digital_products_delivered: T::Boolean,
211
225
  disputes: T::Array[Dodopayments::Dispute::OrHash],
226
+ is_multi_subscription: T::Boolean,
212
227
  is_update_payment_method: T::Boolean,
213
228
  metadata: T::Hash[Symbol, Dodopayments::MetadataItem::Variants],
214
229
  payment_id: String,
@@ -217,6 +232,7 @@ module Dodopayments
217
232
  retry_attempt: Integer,
218
233
  settlement_amount: Integer,
219
234
  settlement_currency: Dodopayments::Currency::OrSymbol,
235
+ subscription_ids: T::Array[String],
220
236
  total_amount: Integer,
221
237
  card_holder_name: T.nilable(String),
222
238
  card_issuing_country: T.nilable(Dodopayments::CountryCode::OrSymbol),
@@ -263,6 +279,10 @@ module Dodopayments
263
279
  digital_products_delivered:,
264
280
  # List of disputes associated with this payment
265
281
  disputes:,
282
+ # True when one payment starts more than one subscription. Read this field to find
283
+ # the payment type. Do not read the length of `subscription_ids`. Do not read
284
+ # `subscription_id` for null.
285
+ is_multi_subscription:,
266
286
  # Whether this payment was created solely to update a subscription's payment
267
287
  # method (a zero-/setup-amount charge). `false` for normal charges.
268
288
  is_update_payment_method:,
@@ -287,6 +307,10 @@ module Dodopayments
287
307
  # balance. This may differ from the customer's payment currency in adaptive
288
308
  # pricing scenarios.
289
309
  settlement_currency:,
310
+ # Every subscription that this payment starts or charges, in a stable order. It is
311
+ # empty for a one-time payment. It holds the value of `subscription_id` when the
312
+ # payment names one subscription.
313
+ subscription_ids:,
290
314
  # Total amount charged to the customer including tax, in the currency's smallest
291
315
  # unit (e.g. cents for USD, yen for JPY, fils for KWD — see the currency's decimal
292
316
  # places)
@@ -339,7 +363,9 @@ module Dodopayments
339
363
  settlement_tax: nil,
340
364
  # Current status of the payment intent
341
365
  status: nil,
342
- # Identifier of the subscription if payment is part of a subscription
366
+ # Identifier of the subscription if payment is part of a subscription. A
367
+ # multi-subscription payment leaves this null, because no single subscription owns
368
+ # the payment. Read `subscription_ids` for those.
343
369
  subscription_id: nil,
344
370
  # Amount of tax collected in the currency's smallest unit (e.g. cents for USD, yen
345
371
  # for JPY, fils for KWD)
@@ -360,6 +386,7 @@ module Dodopayments
360
386
  customer: Dodopayments::CustomerLimitedDetails,
361
387
  digital_products_delivered: T::Boolean,
362
388
  disputes: T::Array[Dodopayments::Dispute],
389
+ is_multi_subscription: T::Boolean,
363
390
  is_update_payment_method: T::Boolean,
364
391
  metadata: T::Hash[Symbol, Dodopayments::MetadataItem::Variants],
365
392
  payment_id: String,
@@ -369,6 +396,7 @@ module Dodopayments
369
396
  retry_attempt: Integer,
370
397
  settlement_amount: Integer,
371
398
  settlement_currency: Dodopayments::Currency::TaggedSymbol,
399
+ subscription_ids: T::Array[String],
372
400
  total_amount: Integer,
373
401
  card_holder_name: T.nilable(String),
374
402
  card_issuing_country:
@@ -34,6 +34,12 @@ module Dodopayments
34
34
  sig { returns(T::Boolean) }
35
35
  attr_accessor :has_license_key
36
36
 
37
+ # True when one payment starts more than one subscription. Read this field to find
38
+ # the payment type. Do not read the length of `subscription_ids`. Do not read
39
+ # `subscription_id` for null.
40
+ sig { returns(T::Boolean) }
41
+ attr_accessor :is_multi_subscription
42
+
37
43
  # Arbitrary key-value metadata. Values can be string, integer, number, or boolean.
38
44
  sig { returns(T::Hash[Symbol, Dodopayments::MetadataItem::Variants]) }
39
45
  attr_accessor :metadata
@@ -50,6 +56,12 @@ module Dodopayments
50
56
  end
51
57
  attr_accessor :payment_provider
52
58
 
59
+ # Every subscription that this payment starts or charges, in a stable order. It is
60
+ # empty for a one-time payment. It holds the value of `subscription_id` when the
61
+ # payment names one subscription.
62
+ sig { returns(T::Array[String]) }
63
+ attr_accessor :subscription_ids
64
+
53
65
  sig { returns(Integer) }
54
66
  attr_accessor :total_amount
55
67
 
@@ -100,10 +112,12 @@ module Dodopayments
100
112
  customer: Dodopayments::CustomerLimitedDetails::OrHash,
101
113
  digital_products_delivered: T::Boolean,
102
114
  has_license_key: T::Boolean,
115
+ is_multi_subscription: T::Boolean,
103
116
  metadata: T::Hash[Symbol, Dodopayments::MetadataItem::Variants],
104
117
  payment_id: String,
105
118
  payment_provider:
106
119
  Dodopayments::Models::PaymentListResponse::PaymentProvider::OrSymbol,
120
+ subscription_ids: T::Array[String],
107
121
  total_amount: Integer,
108
122
  card_last_four: T.nilable(String),
109
123
  card_network: T.nilable(String),
@@ -124,12 +138,20 @@ module Dodopayments
124
138
  customer:,
125
139
  digital_products_delivered:,
126
140
  has_license_key:,
141
+ # True when one payment starts more than one subscription. Read this field to find
142
+ # the payment type. Do not read the length of `subscription_ids`. Do not read
143
+ # `subscription_id` for null.
144
+ is_multi_subscription:,
127
145
  # Arbitrary key-value metadata. Values can be string, integer, number, or boolean.
128
146
  metadata:,
129
147
  payment_id:,
130
148
  # Which processor handled this payment. `stripe` / `adyen` for BYOP routes (the
131
149
  # merchant's own payment connector); `dodo` for everything Dodo processed itself.
132
150
  payment_provider:,
151
+ # Every subscription that this payment starts or charges, in a stable order. It is
152
+ # empty for a one-time payment. It holds the value of `subscription_id` when the
153
+ # payment names one subscription.
154
+ subscription_ids:,
133
155
  total_amount:,
134
156
  # The last four digits of the card
135
157
  card_last_four: nil,
@@ -160,10 +182,12 @@ module Dodopayments
160
182
  customer: Dodopayments::CustomerLimitedDetails,
161
183
  digital_products_delivered: T::Boolean,
162
184
  has_license_key: T::Boolean,
185
+ is_multi_subscription: T::Boolean,
163
186
  metadata: T::Hash[Symbol, Dodopayments::MetadataItem::Variants],
164
187
  payment_id: String,
165
188
  payment_provider:
166
189
  Dodopayments::Models::PaymentListResponse::PaymentProvider::TaggedSymbol,
190
+ subscription_ids: T::Array[String],
167
191
  total_amount: Integer,
168
192
  card_last_four: T.nilable(String),
169
193
  card_network: T.nilable(String),
@@ -36,8 +36,9 @@ module Dodopayments
36
36
  attr_accessor :original_currency
37
37
 
38
38
  # Amount in the payout's currency, in that currency's smallest unit (cents for
39
- # USD, yen for JPY, fils for KWD). Uses cumulative rounding to ensure sum matches
40
- # payout total exactly.
39
+ # USD, yen for JPY, fils for KWD). The entry is converted at the rate the payout
40
+ # settled at. These amounts sum to the value of the entries, which can be less
41
+ # than the payout: the grouped breakup reports the difference as `unattributed`.
41
42
  sig { returns(Integer) }
42
43
  attr_accessor :payout_currency_amount
43
44
 
@@ -53,8 +54,8 @@ module Dodopayments
53
54
  sig { returns(T.nilable(String)) }
54
55
  attr_accessor :reference_object_id
55
56
 
56
- # Individual balance ledger entry for a payout, with amounts pro-rated into the
57
- # payout's currency.
57
+ # Individual balance ledger entry for a payout, converted into the payout's
58
+ # currency.
58
59
  sig do
59
60
  params(
60
61
  id: String,
@@ -82,8 +83,9 @@ module Dodopayments
82
83
  # Original currency as ISO 4217 code (e.g., "USD", "EUR").
83
84
  original_currency:,
84
85
  # Amount in the payout's currency, in that currency's smallest unit (cents for
85
- # USD, yen for JPY, fils for KWD). Uses cumulative rounding to ensure sum matches
86
- # payout total exactly.
86
+ # USD, yen for JPY, fils for KWD). The entry is converted at the rate the payout
87
+ # settled at. These amounts sum to the value of the entries, which can be less
88
+ # than the payout: the grouped breakup reports the difference as `unattributed`.
87
89
  payout_currency_amount:,
88
90
  # USD equivalent of the original amount (in cents).
89
91
  usd_equivalent_amount:,
@@ -13,7 +13,8 @@ module Dodopayments
13
13
  end
14
14
 
15
15
  # The type of balance ledger event (e.g., "payment", "refund", "dispute",
16
- # "payment_fees").
16
+ # "payment_fees"), or `unattributed` for the payout amount the entries do not
17
+ # account for.
17
18
  sig { returns(String) }
18
19
  attr_accessor :event_type
19
20
 
@@ -23,12 +24,28 @@ module Dodopayments
23
24
  attr_accessor :total
24
25
 
25
26
  # Payout breakup aggregated by event type, with amounts in the payout's currency.
27
+ #
28
+ # The rows sum to the payout amount. The last row can be `unattributed`, which is
29
+ # not a ledger event type. It holds the payout amount less the entries that fund
30
+ # it, and it takes either sign:
31
+ #
32
+ # - Positive: the entries come to less than the payout, so the payout drew on the
33
+ # balance an earlier cycle left over. A cycle of refunds and disputes produces a
34
+ # large positive value.
35
+ # - Negative: the entries come to more than the payout, and the remainder funds a
36
+ # later payout. This is the common case, for two reasons. The walk that claims
37
+ # the entries stops at the first one that reaches its target, so it passes the
38
+ # target by part of an entry. The target is also the gross debit, which holds
39
+ # the payout fee, and the fee is not a line here.
40
+ #
41
+ # The row is absent when the two are equal.
26
42
  sig do
27
43
  params(event_type: String, total: Integer).returns(T.attached_class)
28
44
  end
29
45
  def self.new(
30
46
  # The type of balance ledger event (e.g., "payment", "refund", "dispute",
31
- # "payment_fees").
47
+ # "payment_fees"), or `unattributed` for the payout amount the entries do not
48
+ # account for.
32
49
  event_type:,
33
50
  # Total amount for this event type in the payout's currency, in that currency's
34
51
  # smallest unit (cents for USD, yen for JPY, fils for KWD).
@@ -57,6 +57,20 @@ module Dodopayments
57
57
  sig { returns(T.nilable(Dodopayments::Currency::TaggedSymbol)) }
58
58
  attr_accessor :currency
59
59
 
60
+ # The reference number that the card network or the bank gives to the refund. The
61
+ # customer can give this number to their bank to trace the refund. It is null
62
+ # until the payment processor sends it.
63
+ sig { returns(T.nilable(String)) }
64
+ attr_accessor :network_reference
65
+
66
+ # The kind of `network_reference`: ARN, STAN or RRN.
67
+ sig do
68
+ returns(
69
+ T.nilable(Dodopayments::RefundNetworkReferenceType::TaggedSymbol)
70
+ )
71
+ end
72
+ attr_accessor :network_reference_type
73
+
60
74
  # The reason provided for the refund, if any. Optional.
61
75
  sig { returns(T.nilable(String)) }
62
76
  attr_accessor :reason
@@ -74,6 +88,9 @@ module Dodopayments
74
88
  status: Dodopayments::RefundStatus::OrSymbol,
75
89
  amount: T.nilable(Integer),
76
90
  currency: T.nilable(Dodopayments::Currency::OrSymbol),
91
+ network_reference: T.nilable(String),
92
+ network_reference_type:
93
+ T.nilable(Dodopayments::RefundNetworkReferenceType::OrSymbol),
77
94
  reason: T.nilable(String)
78
95
  ).returns(T.attached_class)
79
96
  end
@@ -100,6 +117,12 @@ module Dodopayments
100
117
  amount: nil,
101
118
  # The currency of the refund, represented as an ISO 4217 currency code.
102
119
  currency: nil,
120
+ # The reference number that the card network or the bank gives to the refund. The
121
+ # customer can give this number to their bank to trace the refund. It is null
122
+ # until the payment processor sends it.
123
+ network_reference: nil,
124
+ # The kind of `network_reference`: ARN, STAN or RRN.
125
+ network_reference_type: nil,
103
126
  # The reason provided for the refund, if any. Optional.
104
127
  reason: nil
105
128
  )
@@ -119,6 +142,9 @@ module Dodopayments
119
142
  status: Dodopayments::RefundStatus::TaggedSymbol,
120
143
  amount: T.nilable(Integer),
121
144
  currency: T.nilable(Dodopayments::Currency::TaggedSymbol),
145
+ network_reference: T.nilable(String),
146
+ network_reference_type:
147
+ T.nilable(Dodopayments::RefundNetworkReferenceType::TaggedSymbol),
122
148
  reason: T.nilable(String)
123
149
  }
124
150
  )
@@ -40,6 +40,20 @@ module Dodopayments
40
40
  sig { returns(T.nilable(Dodopayments::Currency::TaggedSymbol)) }
41
41
  attr_accessor :currency
42
42
 
43
+ # The reference number that the card network or the bank gives to the refund. The
44
+ # customer can give this number to their bank to trace the refund. It is null
45
+ # until the payment processor sends it.
46
+ sig { returns(T.nilable(String)) }
47
+ attr_accessor :network_reference
48
+
49
+ # The kind of `network_reference`: ARN, STAN or RRN.
50
+ sig do
51
+ returns(
52
+ T.nilable(Dodopayments::RefundNetworkReferenceType::TaggedSymbol)
53
+ )
54
+ end
55
+ attr_accessor :network_reference_type
56
+
43
57
  # The reason provided for the refund, if any. Optional.
44
58
  sig { returns(T.nilable(String)) }
45
59
  attr_accessor :reason
@@ -54,6 +68,9 @@ module Dodopayments
54
68
  status: Dodopayments::RefundStatus::OrSymbol,
55
69
  amount: T.nilable(Integer),
56
70
  currency: T.nilable(Dodopayments::Currency::OrSymbol),
71
+ network_reference: T.nilable(String),
72
+ network_reference_type:
73
+ T.nilable(Dodopayments::RefundNetworkReferenceType::OrSymbol),
57
74
  reason: T.nilable(String)
58
75
  ).returns(T.attached_class)
59
76
  end
@@ -74,6 +91,12 @@ module Dodopayments
74
91
  amount: nil,
75
92
  # The currency of the refund, represented as an ISO 4217 currency code.
76
93
  currency: nil,
94
+ # The reference number that the card network or the bank gives to the refund. The
95
+ # customer can give this number to their bank to trace the refund. It is null
96
+ # until the payment processor sends it.
97
+ network_reference: nil,
98
+ # The kind of `network_reference`: ARN, STAN or RRN.
99
+ network_reference_type: nil,
77
100
  # The reason provided for the refund, if any. Optional.
78
101
  reason: nil
79
102
  )
@@ -90,6 +113,9 @@ module Dodopayments
90
113
  status: Dodopayments::RefundStatus::TaggedSymbol,
91
114
  amount: T.nilable(Integer),
92
115
  currency: T.nilable(Dodopayments::Currency::TaggedSymbol),
116
+ network_reference: T.nilable(String),
117
+ network_reference_type:
118
+ T.nilable(Dodopayments::RefundNetworkReferenceType::TaggedSymbol),
93
119
  reason: T.nilable(String)
94
120
  }
95
121
  )
@@ -0,0 +1,41 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ # The kind of reference number that the card network or the bank gives to a
6
+ # refund.
7
+ module RefundNetworkReferenceType
8
+ extend Dodopayments::Internal::Type::Enum
9
+
10
+ TaggedSymbol =
11
+ T.type_alias { T.all(Symbol, Dodopayments::RefundNetworkReferenceType) }
12
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
13
+
14
+ ACQUIRER_REFERENCE_NUMBER =
15
+ T.let(
16
+ :acquirer_reference_number,
17
+ Dodopayments::RefundNetworkReferenceType::TaggedSymbol
18
+ )
19
+ SYSTEM_TRACE_AUDIT_NUMBER =
20
+ T.let(
21
+ :system_trace_audit_number,
22
+ Dodopayments::RefundNetworkReferenceType::TaggedSymbol
23
+ )
24
+ RETRIEVAL_REFERENCE_NUMBER =
25
+ T.let(
26
+ :retrieval_reference_number,
27
+ Dodopayments::RefundNetworkReferenceType::TaggedSymbol
28
+ )
29
+ OTHER =
30
+ T.let(:other, Dodopayments::RefundNetworkReferenceType::TaggedSymbol)
31
+
32
+ sig do
33
+ override.returns(
34
+ T::Array[Dodopayments::RefundNetworkReferenceType::TaggedSymbol]
35
+ )
36
+ end
37
+ def self.values
38
+ end
39
+ end
40
+ end
41
+ end
@@ -139,6 +139,18 @@ module Dodopayments
139
139
  sig { returns(T.nilable(Time)) }
140
140
  attr_accessor :cancelled_at
141
141
 
142
+ # The caller that cancelled the subscription or scheduled its cancel. `null` when
143
+ # no caller is known, for example when the system cancelled the subscription.
144
+ sig { returns(T.nilable(Dodopayments::SubscriptionCancelledBy)) }
145
+ attr_reader :cancelled_by
146
+
147
+ sig do
148
+ params(
149
+ cancelled_by: T.nilable(Dodopayments::SubscriptionCancelledBy::OrHash)
150
+ ).void
151
+ end
152
+ attr_writer :cancelled_by
153
+
142
154
  # Customer's responses to custom fields collected during checkout
143
155
  sig { returns(T.nilable(T::Array[Dodopayments::CustomFieldResponse])) }
144
156
  attr_accessor :custom_field_responses
@@ -229,6 +241,8 @@ module Dodopayments
229
241
  cancellation_feedback:
230
242
  T.nilable(Dodopayments::CancellationFeedback::OrSymbol),
231
243
  cancelled_at: T.nilable(Time),
244
+ cancelled_by:
245
+ T.nilable(Dodopayments::SubscriptionCancelledBy::OrHash),
232
246
  custom_field_responses:
233
247
  T.nilable(T::Array[Dodopayments::CustomFieldResponse::OrHash]),
234
248
  customer_business_name: T.nilable(String),
@@ -306,6 +320,9 @@ module Dodopayments
306
320
  cancellation_feedback: nil,
307
321
  # Cancelled timestamp if the subscription is cancelled
308
322
  cancelled_at: nil,
323
+ # The caller that cancelled the subscription or scheduled its cancel. `null` when
324
+ # no caller is known, for example when the system cancelled the subscription.
325
+ cancelled_by: nil,
309
326
  # Customer's responses to custom fields collected during checkout
310
327
  custom_field_responses: nil,
311
328
  # Business / legal name associated with the tax id (B2B). When set this is used on
@@ -372,6 +389,7 @@ module Dodopayments
372
389
  cancellation_feedback:
373
390
  T.nilable(Dodopayments::CancellationFeedback::TaggedSymbol),
374
391
  cancelled_at: T.nilable(Time),
392
+ cancelled_by: T.nilable(Dodopayments::SubscriptionCancelledBy),
375
393
  custom_field_responses:
376
394
  T.nilable(T::Array[Dodopayments::CustomFieldResponse]),
377
395
  customer_business_name: T.nilable(String),
@@ -0,0 +1,107 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ class SubscriptionCancelledBy < Dodopayments::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ Dodopayments::SubscriptionCancelledBy,
10
+ Dodopayments::Internal::AnyHash
11
+ )
12
+ end
13
+
14
+ # The kind of caller.
15
+ sig do
16
+ returns(Dodopayments::SubscriptionCancelledBy::ActorType::TaggedSymbol)
17
+ end
18
+ attr_accessor :actor_type
19
+
20
+ # Email of the customer or of the dashboard user. `null` for an API key or the
21
+ # Dodo Payments team.
22
+ sig { returns(T.nilable(String)) }
23
+ attr_accessor :email
24
+
25
+ # Name of the customer or of the dashboard user. `null` for an API key or the Dodo
26
+ # Payments team.
27
+ sig { returns(T.nilable(String)) }
28
+ attr_accessor :name
29
+
30
+ # The caller that cancelled a subscription or scheduled its cancel.
31
+ sig do
32
+ params(
33
+ actor_type:
34
+ Dodopayments::SubscriptionCancelledBy::ActorType::OrSymbol,
35
+ email: T.nilable(String),
36
+ name: T.nilable(String)
37
+ ).returns(T.attached_class)
38
+ end
39
+ def self.new(
40
+ # The kind of caller.
41
+ actor_type:,
42
+ # Email of the customer or of the dashboard user. `null` for an API key or the
43
+ # Dodo Payments team.
44
+ email: nil,
45
+ # Name of the customer or of the dashboard user. `null` for an API key or the Dodo
46
+ # Payments team.
47
+ name: nil
48
+ )
49
+ end
50
+
51
+ sig do
52
+ override.returns(
53
+ {
54
+ actor_type:
55
+ Dodopayments::SubscriptionCancelledBy::ActorType::TaggedSymbol,
56
+ email: T.nilable(String),
57
+ name: T.nilable(String)
58
+ }
59
+ )
60
+ end
61
+ def to_hash
62
+ end
63
+
64
+ # The kind of caller.
65
+ module ActorType
66
+ extend Dodopayments::Internal::Type::Enum
67
+
68
+ TaggedSymbol =
69
+ T.type_alias do
70
+ T.all(Symbol, Dodopayments::SubscriptionCancelledBy::ActorType)
71
+ end
72
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
73
+
74
+ CUSTOMER =
75
+ T.let(
76
+ :customer,
77
+ Dodopayments::SubscriptionCancelledBy::ActorType::TaggedSymbol
78
+ )
79
+ MERCHANT_USER =
80
+ T.let(
81
+ :merchant_user,
82
+ Dodopayments::SubscriptionCancelledBy::ActorType::TaggedSymbol
83
+ )
84
+ API_KEY =
85
+ T.let(
86
+ :api_key,
87
+ Dodopayments::SubscriptionCancelledBy::ActorType::TaggedSymbol
88
+ )
89
+ DODO_TEAM =
90
+ T.let(
91
+ :dodo_team,
92
+ Dodopayments::SubscriptionCancelledBy::ActorType::TaggedSymbol
93
+ )
94
+
95
+ sig do
96
+ override.returns(
97
+ T::Array[
98
+ Dodopayments::SubscriptionCancelledBy::ActorType::TaggedSymbol
99
+ ]
100
+ )
101
+ end
102
+ def self.values
103
+ end
104
+ end
105
+ end
106
+ end
107
+ end