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
@@ -51,13 +51,30 @@ module Dodopayments
51
51
  # @return [Symbol, Dodopayments::Models::Currency, nil]
52
52
  optional :currency, enum: -> { Dodopayments::Currency }, nil?: true
53
53
 
54
+ # @!attribute network_reference
55
+ # The reference number that the card network or the bank gives to the refund. The
56
+ # customer can give this number to their bank to trace the refund. It is null
57
+ # until the payment processor sends it.
58
+ #
59
+ # @return [String, nil]
60
+ optional :network_reference, String, nil?: true
61
+
62
+ # @!attribute network_reference_type
63
+ # The kind of `network_reference`: ARN, STAN or RRN.
64
+ #
65
+ # @return [Symbol, Dodopayments::Models::RefundNetworkReferenceType, nil]
66
+ optional :network_reference_type, enum: -> { Dodopayments::RefundNetworkReferenceType }, nil?: true
67
+
54
68
  # @!attribute reason
55
69
  # The reason provided for the refund, if any. Optional.
56
70
  #
57
71
  # @return [String, nil]
58
72
  optional :reason, String, nil?: true
59
73
 
60
- # @!method initialize(business_id:, created_at:, is_partial:, payment_id:, refund_id:, status:, amount: nil, currency: nil, reason: nil)
74
+ # @!method initialize(business_id:, created_at:, is_partial:, payment_id:, refund_id:, status:, amount: nil, currency: nil, network_reference: nil, network_reference_type: nil, reason: nil)
75
+ # Some parameter documentations has been truncated, see
76
+ # {Dodopayments::Models::RefundListItem} for more details.
77
+ #
61
78
  # @param business_id [String] The unique identifier of the business issuing the refund.
62
79
  #
63
80
  # @param created_at [Time] The timestamp of when the refund was created in UTC.
@@ -74,6 +91,10 @@ module Dodopayments
74
91
  #
75
92
  # @param currency [Symbol, Dodopayments::Models::Currency, nil] The currency of the refund, represented as an ISO 4217 currency code.
76
93
  #
94
+ # @param network_reference [String, nil] The reference number that the card network or the bank gives to the refund. The
95
+ #
96
+ # @param network_reference_type [Symbol, Dodopayments::Models::RefundNetworkReferenceType, nil] The kind of `network_reference`: ARN, STAN or RRN.
97
+ #
77
98
  # @param reason [String, nil] The reason provided for the refund, if any. Optional.
78
99
  end
79
100
  end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
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
+ ACQUIRER_REFERENCE_NUMBER = :acquirer_reference_number
11
+ SYSTEM_TRACE_AUDIT_NUMBER = :system_trace_audit_number
12
+ RETRIEVAL_REFERENCE_NUMBER = :retrieval_reference_number
13
+ OTHER = :other
14
+
15
+ # @!method self.values
16
+ # @return [Array<Symbol>]
17
+ end
18
+ end
19
+ end
@@ -183,6 +183,13 @@ module Dodopayments
183
183
  # @return [Time, nil]
184
184
  optional :cancelled_at, Time, nil?: true
185
185
 
186
+ # @!attribute cancelled_by
187
+ # The caller that cancelled the subscription or scheduled its cancel. `null` when
188
+ # no caller is known, for example when the system cancelled the subscription.
189
+ #
190
+ # @return [Dodopayments::Models::SubscriptionCancelledBy, nil]
191
+ optional :cancelled_by, -> { Dodopayments::SubscriptionCancelledBy }, nil?: true
192
+
186
193
  # @!attribute custom_field_responses
187
194
  # Customer's responses to custom fields collected during checkout
188
195
  #
@@ -257,7 +264,7 @@ module Dodopayments
257
264
  # @return [Integer, nil]
258
265
  optional :trial_amount, Integer, nil?: true
259
266
 
260
- # @!method initialize(addons:, billing:, brand_id:, cancel_at_next_billing_date:, created_at:, credit_entitlement_cart:, currency:, customer:, has_payment_method:, metadata:, meter_credit_entitlement_cart:, meters:, next_billing_date:, on_demand:, payment_frequency_count:, payment_frequency_interval:, previous_billing_date:, product_id:, quantity:, recurring_pre_tax_amount:, status:, subscription_id:, subscription_period_count:, subscription_period_interval:, tax_inclusive:, trial_period_days:, cancellation_comment: nil, cancellation_feedback: nil, cancelled_at: nil, custom_field_responses: nil, customer_business_name: nil, discount_cycles_remaining: nil, discount_id: nil, discounts: nil, expires_at: nil, paused_at: nil, payment_method_id: nil, scheduled_change: nil, tax_id: nil, trial_amount: nil)
267
+ # @!method initialize(addons:, billing:, brand_id:, cancel_at_next_billing_date:, created_at:, credit_entitlement_cart:, currency:, customer:, has_payment_method:, metadata:, meter_credit_entitlement_cart:, meters:, next_billing_date:, on_demand:, payment_frequency_count:, payment_frequency_interval:, previous_billing_date:, product_id:, quantity:, recurring_pre_tax_amount:, status:, subscription_id:, subscription_period_count:, subscription_period_interval:, tax_inclusive:, trial_period_days:, cancellation_comment: nil, cancellation_feedback: nil, cancelled_at: nil, cancelled_by: nil, custom_field_responses: nil, customer_business_name: nil, discount_cycles_remaining: nil, discount_id: nil, discounts: nil, expires_at: nil, paused_at: nil, payment_method_id: nil, scheduled_change: nil, tax_id: nil, trial_amount: nil)
261
268
  # Some parameter documentations has been truncated, see
262
269
  # {Dodopayments::Models::Subscription} for more details.
263
270
  #
@@ -321,6 +328,8 @@ module Dodopayments
321
328
  #
322
329
  # @param cancelled_at [Time, nil] Cancelled timestamp if the subscription is cancelled
323
330
  #
331
+ # @param cancelled_by [Dodopayments::Models::SubscriptionCancelledBy, nil] The caller that cancelled the subscription or scheduled its cancel.
332
+ #
324
333
  # @param custom_field_responses [Array<Dodopayments::Models::CustomFieldResponse>, nil] Customer's responses to custom fields collected during checkout
325
334
  #
326
335
  # @param customer_business_name [String, nil] Business / legal name associated with the tax id (B2B). When set this is
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dodopayments
4
+ module Models
5
+ class SubscriptionCancelledBy < Dodopayments::Internal::Type::BaseModel
6
+ # @!attribute actor_type
7
+ # The kind of caller.
8
+ #
9
+ # @return [Symbol, Dodopayments::Models::SubscriptionCancelledBy::ActorType]
10
+ required :actor_type, enum: -> { Dodopayments::SubscriptionCancelledBy::ActorType }
11
+
12
+ # @!attribute email
13
+ # Email of the customer or of the dashboard user. `null` for an API key or the
14
+ # Dodo Payments team.
15
+ #
16
+ # @return [String, nil]
17
+ optional :email, String, nil?: true
18
+
19
+ # @!attribute name
20
+ # Name of the customer or of the dashboard user. `null` for an API key or the Dodo
21
+ # Payments team.
22
+ #
23
+ # @return [String, nil]
24
+ optional :name, String, nil?: true
25
+
26
+ # @!method initialize(actor_type:, email: nil, name: nil)
27
+ # Some parameter documentations has been truncated, see
28
+ # {Dodopayments::Models::SubscriptionCancelledBy} for more details.
29
+ #
30
+ # The caller that cancelled a subscription or scheduled its cancel.
31
+ #
32
+ # @param actor_type [Symbol, Dodopayments::Models::SubscriptionCancelledBy::ActorType] The kind of caller.
33
+ #
34
+ # @param email [String, nil] Email of the customer or of the dashboard user. `null` for an API key
35
+ #
36
+ # @param name [String, nil] Name of the customer or of the dashboard user. `null` for an API key
37
+
38
+ # The kind of caller.
39
+ #
40
+ # @see Dodopayments::Models::SubscriptionCancelledBy#actor_type
41
+ module ActorType
42
+ extend Dodopayments::Internal::Type::Enum
43
+
44
+ CUSTOMER = :customer
45
+ MERCHANT_USER = :merchant_user
46
+ API_KEY = :api_key
47
+ DODO_TEAM = :dodo_team
48
+
49
+ # @!method self.values
50
+ # @return [Array<Symbol>]
51
+ end
52
+ end
53
+ end
54
+ end
@@ -146,6 +146,13 @@ module Dodopayments
146
146
  # @return [Time, nil]
147
147
  optional :cancelled_at, Time, nil?: true
148
148
 
149
+ # @!attribute cancelled_by
150
+ # The caller that cancelled the subscription or scheduled its cancel. `null` when
151
+ # no caller is known, for example when the system cancelled the subscription.
152
+ #
153
+ # @return [Dodopayments::Models::SubscriptionCancelledBy, nil]
154
+ optional :cancelled_by, -> { Dodopayments::SubscriptionCancelledBy }, nil?: true
155
+
149
156
  # @!attribute customer_business_name
150
157
  # Business / legal name associated with the tax id (B2B). When set this is used on
151
158
  # the invoice in place of the customer's personal name.
@@ -204,7 +211,7 @@ module Dodopayments
204
211
  # @return [Integer, nil]
205
212
  optional :trial_amount, Integer, nil?: true
206
213
 
207
- # @!method initialize(billing:, cancel_at_next_billing_date:, created_at:, currency:, customer:, discounts:, has_payment_method:, metadata:, next_billing_date:, on_demand:, payment_frequency_count:, payment_frequency_interval:, previous_billing_date:, product_id:, quantity:, recurring_pre_tax_amount:, status:, subscription_id:, subscription_period_count:, subscription_period_interval:, tax_inclusive:, trial_period_days:, cancelled_at: nil, customer_business_name: nil, discount_cycles_remaining: nil, discount_id: nil, paused_at: nil, payment_method_id: nil, product_name: nil, scheduled_change: nil, tax_id: nil, trial_amount: nil)
214
+ # @!method initialize(billing:, cancel_at_next_billing_date:, created_at:, currency:, customer:, discounts:, has_payment_method:, metadata:, next_billing_date:, on_demand:, payment_frequency_count:, payment_frequency_interval:, previous_billing_date:, product_id:, quantity:, recurring_pre_tax_amount:, status:, subscription_id:, subscription_period_count:, subscription_period_interval:, tax_inclusive:, trial_period_days:, cancelled_at: nil, cancelled_by: nil, customer_business_name: nil, discount_cycles_remaining: nil, discount_id: nil, paused_at: nil, payment_method_id: nil, product_name: nil, scheduled_change: nil, tax_id: nil, trial_amount: nil)
208
215
  # Some parameter documentations has been truncated, see
209
216
  # {Dodopayments::Models::SubscriptionListResponse} for more details.
210
217
  #
@@ -256,6 +263,8 @@ module Dodopayments
256
263
  #
257
264
  # @param cancelled_at [Time, nil] Cancelled timestamp if the subscription is cancelled
258
265
  #
266
+ # @param cancelled_by [Dodopayments::Models::SubscriptionCancelledBy, nil] The caller that cancelled the subscription or scheduled its cancel.
267
+ #
259
268
  # @param customer_business_name [String, nil] Business / legal name associated with the tax id (B2B). When set this is
260
269
  #
261
270
  # @param discount_cycles_remaining [Integer, nil] DEPRECATED: Use discounts[].cycles_remaining instead.
@@ -325,15 +325,24 @@ module Dodopayments
325
325
  required :currency, enum: -> { Dodopayments::Currency }
326
326
 
327
327
  # @!attribute customer_credits
328
- # Net credit movement in the smallest currency unit (e.g. cents). **Negative** –
329
- # credits were deducted from the customer's balance to offset the charge (typical
330
- # on upgrades). **Positive** – credits were added to the customer's balance,
331
- # either from a downgrade proration refund or from topping-up the wallet to meet a
332
- # gateway minimum-charge threshold. **Zero** – no credit movement occurred.
328
+ # Net credit movement in the smallest unit of `customer_credits_currency` (e.g.
329
+ # cents). Read `customer_credits_currency` for the currency. It can differ from
330
+ # `currency`. **Negative** – credits were deducted from the customer's balance to
331
+ # offset the charge (typical on upgrades). **Positive** – credits were added to
332
+ # the customer's balance, either from a downgrade proration refund or from
333
+ # topping-up the wallet to meet a gateway minimum-charge threshold. **Zero** – no
334
+ # credit movement occurred.
333
335
  #
334
336
  # @return [Integer]
335
337
  required :customer_credits, Integer
336
338
 
339
+ # @!attribute customer_credits_currency
340
+ # This field gives the currency of `customer_credits`. The credit wallet uses the
341
+ # subscription currency.
342
+ #
343
+ # @return [Symbol, Dodopayments::Models::Currency]
344
+ required :customer_credits_currency, enum: -> { Dodopayments::Currency }
345
+
337
346
  # @!attribute settlement_amount
338
347
  #
339
348
  # @return [Integer]
@@ -359,14 +368,16 @@ module Dodopayments
359
368
  # @return [Integer, nil]
360
369
  optional :tax, Integer, nil?: true
361
370
 
362
- # @!method initialize(currency:, customer_credits:, settlement_amount:, settlement_currency:, total_amount:, settlement_tax: nil, tax: nil)
371
+ # @!method initialize(currency:, customer_credits:, customer_credits_currency:, settlement_amount:, settlement_currency:, total_amount:, settlement_tax: nil, tax: nil)
363
372
  # Some parameter documentations has been truncated, see
364
373
  # {Dodopayments::Models::SubscriptionPreviewChangePlanResponse::ImmediateCharge::Summary}
365
374
  # for more details.
366
375
  #
367
376
  # @param currency [Symbol, Dodopayments::Models::Currency]
368
377
  #
369
- # @param customer_credits [Integer] Net credit movement in the smallest currency unit (e.g. cents).
378
+ # @param customer_credits [Integer] Net credit movement in the smallest unit of `customer_credits_currency` (e.g. ce
379
+ #
380
+ # @param customer_credits_currency [Symbol, Dodopayments::Models::Currency] This field gives the currency of `customer_credits`.
370
381
  #
371
382
  # @param settlement_amount [Integer]
372
383
  #
@@ -350,6 +350,20 @@ module Dodopayments
350
350
 
351
351
  MiscListSupportedCountriesParams = Dodopayments::Models::MiscListSupportedCountriesParams
352
352
 
353
+ ModerationCategory = Dodopayments::Models::ModerationCategory
354
+
355
+ ModerationCategoryProvenance = Dodopayments::Models::ModerationCategoryProvenance
356
+
357
+ ModerationCategoryScores = Dodopayments::Models::ModerationCategoryScores
358
+
359
+ ModerationDecision = Dodopayments::Models::ModerationDecision
360
+
361
+ ModerationProvenance = Dodopayments::Models::ModerationProvenance
362
+
363
+ ModerationRetrieveUsageParams = Dodopayments::Models::ModerationRetrieveUsageParams
364
+
365
+ ModerationScreenParams = Dodopayments::Models::ModerationScreenParams
366
+
353
367
  NewCustomer = Dodopayments::Models::NewCustomer
354
368
 
355
369
  OnDemandSubscription = Dodopayments::Models::OnDemandSubscription
@@ -448,6 +462,8 @@ module Dodopayments
448
462
 
449
463
  RefundListParams = Dodopayments::Models::RefundListParams
450
464
 
465
+ RefundNetworkReferenceType = Dodopayments::Models::RefundNetworkReferenceType
466
+
451
467
  RefundRetrieveParams = Dodopayments::Models::RefundRetrieveParams
452
468
 
453
469
  RefundStatus = Dodopayments::Models::RefundStatus
@@ -462,6 +478,8 @@ module Dodopayments
462
478
 
463
479
  SubscriptionCancelChangePlanParams = Dodopayments::Models::SubscriptionCancelChangePlanParams
464
480
 
481
+ SubscriptionCancelledBy = Dodopayments::Models::SubscriptionCancelledBy
482
+
465
483
  SubscriptionCancelledWebhookEvent = Dodopayments::Models::SubscriptionCancelledWebhookEvent
466
484
 
467
485
  SubscriptionChangePlanParams = Dodopayments::Models::SubscriptionChangePlanParams
@@ -8,13 +8,13 @@ module Dodopayments
8
8
  #
9
9
  # @overload create(product_cart:, allowed_payment_method_types: nil, billing_address: nil, billing_currency: nil, cancel_url: nil, confirm: nil, custom_fields: nil, customer: nil, customer_business_name: nil, customization: nil, discount_code: nil, discount_codes: nil, feature_flags: nil, force_3ds: nil, mandate_min_amount_inr_paise: nil, metadata: nil, minimal_address: nil, payment_method_id: nil, product_collection_id: nil, return_url: nil, short_link: nil, show_saved_payment_methods: nil, subscription_data: nil, tax_id: nil, request_options: {})
10
10
  #
11
- # @param product_cart [Array<Dodopayments::Models::ProductItemReq>]
11
+ # @param product_cart [Array<Dodopayments::Models::ProductItemReq>] The products of the checkout. A cart holds at most 20 of them, one-time and
12
12
  #
13
13
  # @param allowed_payment_method_types [Array<Symbol, Dodopayments::Models::PaymentMethodTypes>, nil] Customers will never see payment methods that are not in this list.
14
14
  #
15
15
  # @param billing_address [Dodopayments::Models::CheckoutSessionBillingAddress, nil] Billing address information for the session
16
16
  #
17
- # @param billing_currency [Symbol, Dodopayments::Models::Currency, nil] This field is ingored if adaptive pricing is disabled
17
+ # @param billing_currency [Symbol, Dodopayments::Models::Currency, nil] The currency to charge the customer in.
18
18
  #
19
19
  # @param cancel_url [String, nil] The URL to redirect the customer if they cancel or go back from the checkout.
20
20
  #
@@ -40,7 +40,7 @@ module Dodopayments
40
40
  #
41
41
  # @param metadata [Hash{Symbol=>String, Float, Boolean}, nil] Additional metadata associated with the payment. Defaults to empty if not provid
42
42
  #
43
- # @param minimal_address [Boolean] If true, only zipcode is required when confirm is true; other address fields rem
43
+ # @param minimal_address [Boolean, nil] If true, only zipcode is required when confirm is true; other address fields rem
44
44
  #
45
45
  # @param payment_method_id [String, nil] Optional payment method ID to use for this checkout session.
46
46
  #
@@ -95,13 +95,13 @@ module Dodopayments
95
95
  #
96
96
  # @overload preview(product_cart:, allowed_payment_method_types: nil, billing_address: nil, billing_currency: nil, cancel_url: nil, confirm: nil, custom_fields: nil, customer: nil, customer_business_name: nil, customization: nil, discount_code: nil, discount_codes: nil, feature_flags: nil, force_3ds: nil, mandate_min_amount_inr_paise: nil, metadata: nil, minimal_address: nil, payment_method_id: nil, product_collection_id: nil, return_url: nil, short_link: nil, show_saved_payment_methods: nil, subscription_data: nil, tax_id: nil, request_options: {})
97
97
  #
98
- # @param product_cart [Array<Dodopayments::Models::ProductItemReq>]
98
+ # @param product_cart [Array<Dodopayments::Models::ProductItemReq>] The products of the checkout. A cart holds at most 20 of them, one-time and
99
99
  #
100
100
  # @param allowed_payment_method_types [Array<Symbol, Dodopayments::Models::PaymentMethodTypes>, nil] Customers will never see payment methods that are not in this list.
101
101
  #
102
102
  # @param billing_address [Dodopayments::Models::CheckoutSessionBillingAddress, nil] Billing address information for the session
103
103
  #
104
- # @param billing_currency [Symbol, Dodopayments::Models::Currency, nil] This field is ingored if adaptive pricing is disabled
104
+ # @param billing_currency [Symbol, Dodopayments::Models::Currency, nil] The currency to charge the customer in.
105
105
  #
106
106
  # @param cancel_url [String, nil] The URL to redirect the customer if they cancel or go back from the checkout.
107
107
  #
@@ -127,7 +127,7 @@ module Dodopayments
127
127
  #
128
128
  # @param metadata [Hash{Symbol=>String, Float, Boolean}, nil] Additional metadata associated with the payment. Defaults to empty if not provid
129
129
  #
130
- # @param minimal_address [Boolean] If true, only zipcode is required when confirm is true; other address fields rem
130
+ # @param minimal_address [Boolean, nil] If true, only zipcode is required when confirm is true; other address fields rem
131
131
  #
132
132
  # @param payment_method_id [String, nil] Optional payment method ID to use for this checkout session.
133
133
  #
@@ -0,0 +1,81 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dodopayments
4
+ module Resources
5
+ class Moderation
6
+ # Shows how many billable screens you made and how close you are to your next
7
+ # charge.
8
+ #
9
+ # **Billing.** A billable screen is a live-mode screen that returns a verdict.
10
+ # Dodo Payments charges $0.30 for each full block of 1000 billable screens and
11
+ # debits the fee from your balance. Each full block is charged within one hour.
12
+ # Screens that do not fill a block stay unbilled until they do. Errors and
13
+ # test-mode screens are free and are not counted.
14
+ #
15
+ # @overload retrieve_usage(request_options: {})
16
+ #
17
+ # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
18
+ #
19
+ # @return [Dodopayments::Models::ModerationRetrieveUsageResponse]
20
+ #
21
+ # @see Dodopayments::Models::ModerationRetrieveUsageParams
22
+ def retrieve_usage(params = {})
23
+ @client.request(
24
+ method: :get,
25
+ path: "moderation/usage",
26
+ model: Dodopayments::Models::ModerationRetrieveUsageResponse,
27
+ options: params[:request_options]
28
+ )
29
+ end
30
+
31
+ # Some parameter documentations has been truncated, see
32
+ # {Dodopayments::Models::ModerationScreenParams} for more details.
33
+ #
34
+ # Screens text, an image, or both, and returns a verdict: `allow`, `flag` or
35
+ # `deny`. The API is fail-closed: do not generate when you get no verdict.
36
+ #
37
+ # **Pricing.** Dodo Payments charges $0.30 per 1000 billable screens and debits
38
+ # the fee from your balance. A billable screen is a live-mode screen that returns
39
+ # a verdict. Errors and test-mode screens are free.
40
+ #
41
+ # **429.** Honour `Retry-After` and retry. A 429 is a throughput limit, not a
42
+ # verdict.
43
+ #
44
+ # **Test mode** returns mock verdicts and never calls the model. The default
45
+ # verdict is `allow`. Put one of these strings in `text` to select another
46
+ # outcome: `dodo_mock_flag` (`flag`), `dodo_mock_deny` (`deny`),
47
+ # `dodo_mock_overloaded` (429) or `dodo_mock_not_ready` (503).
48
+ #
49
+ # @overload screen(image: nil, request_id: nil, text: nil, request_options: {})
50
+ #
51
+ # @param image [String, nil] The image to screen, as base64, with or without a `data:image/...;base64,` prefi
52
+ #
53
+ # @param request_id [String, nil] Your identifier for this screen, up to 128 characters, with no control character
54
+ #
55
+ # @param text [String, nil] The text to screen, up to 8000 characters.
56
+ #
57
+ # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
58
+ #
59
+ # @return [Dodopayments::Models::ModerationScreenResponse]
60
+ #
61
+ # @see Dodopayments::Models::ModerationScreenParams
62
+ def screen(params = {})
63
+ parsed, options = Dodopayments::ModerationScreenParams.dump_request(params)
64
+ @client.request(
65
+ method: :post,
66
+ path: "moderation/screen",
67
+ body: parsed,
68
+ model: Dodopayments::Models::ModerationScreenResponse,
69
+ options: options
70
+ )
71
+ end
72
+
73
+ # @api private
74
+ #
75
+ # @param client [Dodopayments::Client]
76
+ def initialize(client:)
77
+ @client = client
78
+ end
79
+ end
80
+ end
81
+ end
@@ -5,10 +5,10 @@ module Dodopayments
5
5
  class Payouts
6
6
  class Breakup
7
7
  class Details
8
- # Returns paginated individual balance ledger entries for a payout, with each
9
- # entry's amount pro-rated into the payout's currency. Supports pagination via
10
- # `page_size` (default 10, max 100) and `page_number` (default 0) query
11
- # parameters.
8
+ # Returns paginated individual balance ledger entries for a payout. Each entry is
9
+ # converted into the payout's currency at the rate the payout settled at. Supports
10
+ # pagination via `page_size` (default 10, max 100) and `page_number` (default 0)
11
+ # query parameters.
12
12
  #
13
13
  # @overload list(payout_id, page_number: nil, page_size: nil, request_options: {})
14
14
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dodopayments
4
- VERSION = "2.29.0"
4
+ VERSION = "2.31.0"
5
5
  end
data/lib/dodopayments.rb CHANGED
@@ -270,6 +270,15 @@ require_relative "dodopayments/models/meter_retrieve_params"
270
270
  require_relative "dodopayments/models/meter_unarchive_params"
271
271
  require_relative "dodopayments/models/misc_list_supported_countries_params"
272
272
  require_relative "dodopayments/models/misc_list_supported_countries_response"
273
+ require_relative "dodopayments/models/moderation_category"
274
+ require_relative "dodopayments/models/moderation_category_provenance"
275
+ require_relative "dodopayments/models/moderation_category_scores"
276
+ require_relative "dodopayments/models/moderation_decision"
277
+ require_relative "dodopayments/models/moderation_provenance"
278
+ require_relative "dodopayments/models/moderation_retrieve_usage_params"
279
+ require_relative "dodopayments/models/moderation_retrieve_usage_response"
280
+ require_relative "dodopayments/models/moderation_screen_params"
281
+ require_relative "dodopayments/models/moderation_screen_response"
273
282
  require_relative "dodopayments/models/new_customer"
274
283
  require_relative "dodopayments/models/on_demand_subscription"
275
284
  require_relative "dodopayments/models/one_time_product_cart_item"
@@ -352,12 +361,14 @@ require_relative "dodopayments/models/refund_create_params"
352
361
  require_relative "dodopayments/models/refund_failed_webhook_event"
353
362
  require_relative "dodopayments/models/refund_list_item"
354
363
  require_relative "dodopayments/models/refund_list_params"
364
+ require_relative "dodopayments/models/refund_network_reference_type"
355
365
  require_relative "dodopayments/models/refund_retrieve_params"
356
366
  require_relative "dodopayments/models/refund_status"
357
367
  require_relative "dodopayments/models/refund_succeeded_webhook_event"
358
368
  require_relative "dodopayments/models/scheduled_plan_change"
359
369
  require_relative "dodopayments/models/subscription_active_webhook_event"
360
370
  require_relative "dodopayments/models/subscription_cancel_change_plan_params"
371
+ require_relative "dodopayments/models/subscription_cancelled_by"
361
372
  require_relative "dodopayments/models/subscription_cancelled_webhook_event"
362
373
  require_relative "dodopayments/models/subscription_change_plan_params"
363
374
  require_relative "dodopayments/models/subscription_change_plan_response"
@@ -441,6 +452,7 @@ require_relative "dodopayments/resources/license_keys"
441
452
  require_relative "dodopayments/resources/licenses"
442
453
  require_relative "dodopayments/resources/meters"
443
454
  require_relative "dodopayments/resources/misc"
455
+ require_relative "dodopayments/resources/moderation"
444
456
  require_relative "dodopayments/resources/payments"
445
457
  require_relative "dodopayments/resources/payouts"
446
458
  require_relative "dodopayments/resources/payouts/breakup"
@@ -101,6 +101,9 @@ module Dodopayments
101
101
  sig { returns(Dodopayments::Resources::ProductCollections) }
102
102
  attr_reader :product_collections
103
103
 
104
+ sig { returns(Dodopayments::Resources::Moderation) }
105
+ attr_reader :moderation
106
+
104
107
  # @api private
105
108
  sig { override.returns(T::Hash[String, String]) }
106
109
  private def auth_headers
@@ -253,6 +253,21 @@ module Dodopayments
253
253
  :deflection_fees_reversal,
254
254
  Dodopayments::BalanceLedgerEntry::EventType::TaggedSymbol
255
255
  )
256
+ RESERVE_HOLD =
257
+ T.let(
258
+ :reserve_hold,
259
+ Dodopayments::BalanceLedgerEntry::EventType::TaggedSymbol
260
+ )
261
+ RESERVE_RELEASE =
262
+ T.let(
263
+ :reserve_release,
264
+ Dodopayments::BalanceLedgerEntry::EventType::TaggedSymbol
265
+ )
266
+ MODERATION_FEES =
267
+ T.let(
268
+ :moderation_fees,
269
+ Dodopayments::BalanceLedgerEntry::EventType::TaggedSymbol
270
+ )
256
271
 
257
272
  sig do
258
273
  override.returns(
@@ -1045,6 +1045,21 @@ module Dodopayments
1045
1045
  :deflection_fees_reversal,
1046
1046
  Dodopayments::BalanceRetrieveLedgerParams::EventType::TaggedSymbol
1047
1047
  )
1048
+ RESERVE_HOLD =
1049
+ T.let(
1050
+ :reserve_hold,
1051
+ Dodopayments::BalanceRetrieveLedgerParams::EventType::TaggedSymbol
1052
+ )
1053
+ RESERVE_RELEASE =
1054
+ T.let(
1055
+ :reserve_release,
1056
+ Dodopayments::BalanceRetrieveLedgerParams::EventType::TaggedSymbol
1057
+ )
1058
+ MODERATION_FEES =
1059
+ T.let(
1060
+ :moderation_fees,
1061
+ Dodopayments::BalanceRetrieveLedgerParams::EventType::TaggedSymbol
1062
+ )
1048
1063
 
1049
1064
  sig do
1050
1065
  override.returns(
@@ -137,6 +137,18 @@ module Dodopayments
137
137
  sig { params(redirect_immediately: T::Boolean).void }
138
138
  attr_writer :redirect_immediately
139
139
 
140
+ # If true, the customer must give the name on the card to pay by card. Apple Pay
141
+ # and Google Pay also collect the payer name, and the payment stores it as the
142
+ # card holder name. The checkout page enforces this. Other payment methods ignore
143
+ # it.
144
+ #
145
+ # Default is false
146
+ sig { returns(T.nilable(T::Boolean)) }
147
+ attr_reader :require_cardholder_name
148
+
149
+ sig { params(require_cardholder_name: T::Boolean).void }
150
+ attr_writer :require_cardholder_name
151
+
140
152
  # If true, the customer must provide a phone number to complete checkout. Requires
141
153
  # `allow_phone_number_collection` to also be true.
142
154
  #
@@ -193,6 +205,7 @@ module Dodopayments
193
205
  allow_tax_id: T::Boolean,
194
206
  always_create_new_customer: T::Boolean,
195
207
  redirect_immediately: T::Boolean,
208
+ require_cardholder_name: T::Boolean,
196
209
  require_phone_number: T::Boolean,
197
210
  require_tax_id: T::Boolean,
198
211
  single_page: T::Boolean
@@ -245,6 +258,13 @@ module Dodopayments
245
258
  #
246
259
  # Default is false
247
260
  redirect_immediately: nil,
261
+ # If true, the customer must give the name on the card to pay by card. Apple Pay
262
+ # and Google Pay also collect the payer name, and the payment stores it as the
263
+ # card holder name. The checkout page enforces this. Other payment methods ignore
264
+ # it.
265
+ #
266
+ # Default is false
267
+ require_cardholder_name: nil,
248
268
  # If true, the customer must provide a phone number to complete checkout. Requires
249
269
  # `allow_phone_number_collection` to also be true.
250
270
  #
@@ -290,6 +310,7 @@ module Dodopayments
290
310
  allow_tax_id: T::Boolean,
291
311
  always_create_new_customer: T::Boolean,
292
312
  redirect_immediately: T::Boolean,
313
+ require_cardholder_name: T::Boolean,
293
314
  require_phone_number: T::Boolean,
294
315
  require_tax_id: T::Boolean,
295
316
  single_page: T::Boolean