dodopayments 2.9.1 → 2.10.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 (184) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -0
  3. data/README.md +1 -1
  4. data/lib/dodopayments/internal/transport/base_client.rb +2 -0
  5. data/lib/dodopayments/internal/type/union.rb +21 -7
  6. data/lib/dodopayments/models/abandoned_checkout_detected_webhook_event.rb +4 -16
  7. data/lib/dodopayments/models/abandoned_checkout_recovered_webhook_event.rb +4 -16
  8. data/lib/dodopayments/models/checkout_session_request.rb +15 -2
  9. data/lib/dodopayments/models/credit_added_webhook_event.rb +4 -16
  10. data/lib/dodopayments/models/credit_balance_low_webhook_event.rb +4 -16
  11. data/lib/dodopayments/models/credit_deducted_webhook_event.rb +4 -16
  12. data/lib/dodopayments/models/credit_expired_webhook_event.rb +4 -16
  13. data/lib/dodopayments/models/credit_manual_adjustment_webhook_event.rb +4 -16
  14. data/lib/dodopayments/models/credit_overage_charged_webhook_event.rb +4 -16
  15. data/lib/dodopayments/models/credit_overage_reset_webhook_event.rb +4 -16
  16. data/lib/dodopayments/models/credit_rolled_over_webhook_event.rb +4 -16
  17. data/lib/dodopayments/models/credit_rollover_forfeited_webhook_event.rb +4 -16
  18. data/lib/dodopayments/models/dispute_accepted_webhook_event.rb +4 -16
  19. data/lib/dodopayments/models/dispute_cancelled_webhook_event.rb +4 -16
  20. data/lib/dodopayments/models/dispute_challenged_webhook_event.rb +4 -16
  21. data/lib/dodopayments/models/dispute_expired_webhook_event.rb +4 -16
  22. data/lib/dodopayments/models/dispute_lost_webhook_event.rb +4 -16
  23. data/lib/dodopayments/models/dispute_opened_webhook_event.rb +4 -16
  24. data/lib/dodopayments/models/dispute_won_webhook_event.rb +4 -16
  25. data/lib/dodopayments/models/dunning_recovered_webhook_event.rb +4 -16
  26. data/lib/dodopayments/models/dunning_started_webhook_event.rb +4 -16
  27. data/lib/dodopayments/models/entitlement_grant_created_webhook_event.rb +4 -16
  28. data/lib/dodopayments/models/entitlement_grant_delivered_webhook_event.rb +4 -16
  29. data/lib/dodopayments/models/entitlement_grant_failed_webhook_event.rb +4 -16
  30. data/lib/dodopayments/models/entitlement_grant_revoked_webhook_event.rb +4 -16
  31. data/lib/dodopayments/models/license_key_created_webhook_event.rb +4 -16
  32. data/lib/dodopayments/models/payment.rb +153 -3
  33. data/lib/dodopayments/models/payment_cancelled_webhook_event.rb +4 -16
  34. data/lib/dodopayments/models/payment_create_params.rb +15 -3
  35. data/lib/dodopayments/models/payment_create_response.rb +14 -3
  36. data/lib/dodopayments/models/payment_failed_webhook_event.rb +4 -16
  37. data/lib/dodopayments/models/payment_processing_webhook_event.rb +4 -16
  38. data/lib/dodopayments/models/payment_succeeded_webhook_event.rb +4 -16
  39. data/lib/dodopayments/models/payout_list_response.rb +6 -3
  40. data/lib/dodopayments/models/price.rb +20 -48
  41. data/lib/dodopayments/models/product.rb +3 -3
  42. data/lib/dodopayments/models/product_create_params.rb +3 -3
  43. data/lib/dodopayments/models/product_item_req.rb +42 -1
  44. data/lib/dodopayments/models/product_update_params.rb +3 -3
  45. data/lib/dodopayments/models/refund_failed_webhook_event.rb +4 -16
  46. data/lib/dodopayments/models/refund_succeeded_webhook_event.rb +4 -16
  47. data/lib/dodopayments/models/subscription.rb +153 -5
  48. data/lib/dodopayments/models/subscription_active_webhook_event.rb +4 -16
  49. data/lib/dodopayments/models/subscription_cancelled_webhook_event.rb +4 -16
  50. data/lib/dodopayments/models/subscription_create_params.rb +15 -3
  51. data/lib/dodopayments/models/subscription_create_response.rb +14 -3
  52. data/lib/dodopayments/models/subscription_expired_webhook_event.rb +4 -16
  53. data/lib/dodopayments/models/subscription_failed_webhook_event.rb +4 -16
  54. data/lib/dodopayments/models/subscription_list_response.rb +36 -5
  55. data/lib/dodopayments/models/subscription_on_hold_webhook_event.rb +4 -16
  56. data/lib/dodopayments/models/subscription_plan_changed_webhook_event.rb +4 -16
  57. data/lib/dodopayments/models/subscription_preview_change_plan_response.rb +21 -49
  58. data/lib/dodopayments/models/subscription_renewed_webhook_event.rb +4 -16
  59. data/lib/dodopayments/models/subscription_update_payment_method_params.rb +12 -30
  60. data/lib/dodopayments/models/subscription_updated_webhook_event.rb +4 -16
  61. data/lib/dodopayments/models/unsafe_unwrap_webhook_event.rb +41 -39
  62. data/lib/dodopayments/models/unwrap_webhook_event.rb +41 -39
  63. data/lib/dodopayments/models/update_subscription_plan_req.rb +17 -6
  64. data/lib/dodopayments/models/webhook_event_type.rb +3 -0
  65. data/lib/dodopayments/models/webhook_payload.rb +52 -143
  66. data/lib/dodopayments/resources/checkout_sessions.rb +8 -4
  67. data/lib/dodopayments/resources/payments.rb +4 -2
  68. data/lib/dodopayments/resources/subscriptions.rb +12 -6
  69. data/lib/dodopayments/version.rb +1 -1
  70. data/rbi/dodopayments/models/abandoned_checkout_detected_webhook_event.rbi +4 -40
  71. data/rbi/dodopayments/models/abandoned_checkout_recovered_webhook_event.rbi +4 -40
  72. data/rbi/dodopayments/models/checkout_session_request.rbi +14 -0
  73. data/rbi/dodopayments/models/credit_added_webhook_event.rbi +4 -29
  74. data/rbi/dodopayments/models/credit_balance_low_webhook_event.rbi +4 -33
  75. data/rbi/dodopayments/models/credit_deducted_webhook_event.rbi +4 -33
  76. data/rbi/dodopayments/models/credit_expired_webhook_event.rbi +4 -33
  77. data/rbi/dodopayments/models/credit_manual_adjustment_webhook_event.rbi +4 -39
  78. data/rbi/dodopayments/models/credit_overage_charged_webhook_event.rbi +4 -36
  79. data/rbi/dodopayments/models/credit_overage_reset_webhook_event.rbi +4 -36
  80. data/rbi/dodopayments/models/credit_rolled_over_webhook_event.rbi +4 -33
  81. data/rbi/dodopayments/models/credit_rollover_forfeited_webhook_event.rbi +4 -40
  82. data/rbi/dodopayments/models/dispute_accepted_webhook_event.rbi +4 -33
  83. data/rbi/dodopayments/models/dispute_cancelled_webhook_event.rbi +4 -33
  84. data/rbi/dodopayments/models/dispute_challenged_webhook_event.rbi +4 -34
  85. data/rbi/dodopayments/models/dispute_expired_webhook_event.rbi +4 -33
  86. data/rbi/dodopayments/models/dispute_lost_webhook_event.rbi +4 -29
  87. data/rbi/dodopayments/models/dispute_opened_webhook_event.rbi +4 -33
  88. data/rbi/dodopayments/models/dispute_won_webhook_event.rbi +4 -29
  89. data/rbi/dodopayments/models/dunning_recovered_webhook_event.rbi +4 -33
  90. data/rbi/dodopayments/models/dunning_started_webhook_event.rbi +4 -33
  91. data/rbi/dodopayments/models/entitlement_grant_created_webhook_event.rbi +4 -40
  92. data/rbi/dodopayments/models/entitlement_grant_delivered_webhook_event.rbi +4 -40
  93. data/rbi/dodopayments/models/entitlement_grant_failed_webhook_event.rbi +4 -39
  94. data/rbi/dodopayments/models/entitlement_grant_revoked_webhook_event.rbi +4 -40
  95. data/rbi/dodopayments/models/license_key_created_webhook_event.rbi +4 -34
  96. data/rbi/dodopayments/models/payment.rbi +170 -2
  97. data/rbi/dodopayments/models/payment_cancelled_webhook_event.rbi +4 -33
  98. data/rbi/dodopayments/models/payment_create_params.rbi +14 -2
  99. data/rbi/dodopayments/models/payment_create_response.rbi +12 -2
  100. data/rbi/dodopayments/models/payment_failed_webhook_event.rbi +4 -33
  101. data/rbi/dodopayments/models/payment_processing_webhook_event.rbi +4 -34
  102. data/rbi/dodopayments/models/payment_succeeded_webhook_event.rbi +4 -33
  103. data/rbi/dodopayments/models/price.rbi +18 -90
  104. data/rbi/dodopayments/models/product_item_req.rbi +74 -3
  105. data/rbi/dodopayments/models/refund_failed_webhook_event.rbi +4 -31
  106. data/rbi/dodopayments/models/refund_succeeded_webhook_event.rbi +4 -33
  107. data/rbi/dodopayments/models/subscription.rbi +173 -4
  108. data/rbi/dodopayments/models/subscription_active_webhook_event.rbi +4 -36
  109. data/rbi/dodopayments/models/subscription_cancelled_webhook_event.rbi +4 -36
  110. data/rbi/dodopayments/models/subscription_create_params.rbi +14 -2
  111. data/rbi/dodopayments/models/subscription_create_response.rbi +12 -2
  112. data/rbi/dodopayments/models/subscription_expired_webhook_event.rbi +4 -36
  113. data/rbi/dodopayments/models/subscription_failed_webhook_event.rbi +4 -36
  114. data/rbi/dodopayments/models/subscription_list_response.rbi +67 -4
  115. data/rbi/dodopayments/models/subscription_on_hold_webhook_event.rbi +4 -36
  116. data/rbi/dodopayments/models/subscription_plan_changed_webhook_event.rbi +4 -40
  117. data/rbi/dodopayments/models/subscription_preview_change_plan_response.rbi +18 -123
  118. data/rbi/dodopayments/models/subscription_renewed_webhook_event.rbi +4 -36
  119. data/rbi/dodopayments/models/subscription_update_payment_method_params.rbi +12 -96
  120. data/rbi/dodopayments/models/subscription_updated_webhook_event.rbi +4 -36
  121. data/rbi/dodopayments/models/update_subscription_plan_req.rbi +18 -8
  122. data/rbi/dodopayments/models/webhook_event_type.rbi +15 -0
  123. data/rbi/dodopayments/models/webhook_payload.rbi +46 -466
  124. data/rbi/dodopayments/resources/checkout_sessions.rbi +12 -0
  125. data/rbi/dodopayments/resources/payments.rbi +6 -1
  126. data/rbi/dodopayments/resources/subscriptions.rbi +22 -9
  127. data/sig/dodopayments/models/abandoned_checkout_detected_webhook_event.rbs +4 -14
  128. data/sig/dodopayments/models/abandoned_checkout_recovered_webhook_event.rbs +4 -14
  129. data/sig/dodopayments/models/checkout_session_request.rbs +5 -0
  130. data/sig/dodopayments/models/credit_added_webhook_event.rbs +4 -14
  131. data/sig/dodopayments/models/credit_balance_low_webhook_event.rbs +4 -14
  132. data/sig/dodopayments/models/credit_deducted_webhook_event.rbs +4 -14
  133. data/sig/dodopayments/models/credit_expired_webhook_event.rbs +4 -14
  134. data/sig/dodopayments/models/credit_manual_adjustment_webhook_event.rbs +4 -14
  135. data/sig/dodopayments/models/credit_overage_charged_webhook_event.rbs +4 -14
  136. data/sig/dodopayments/models/credit_overage_reset_webhook_event.rbs +4 -14
  137. data/sig/dodopayments/models/credit_rolled_over_webhook_event.rbs +4 -14
  138. data/sig/dodopayments/models/credit_rollover_forfeited_webhook_event.rbs +4 -14
  139. data/sig/dodopayments/models/dispute_accepted_webhook_event.rbs +4 -14
  140. data/sig/dodopayments/models/dispute_cancelled_webhook_event.rbs +4 -14
  141. data/sig/dodopayments/models/dispute_challenged_webhook_event.rbs +4 -14
  142. data/sig/dodopayments/models/dispute_expired_webhook_event.rbs +4 -14
  143. data/sig/dodopayments/models/dispute_lost_webhook_event.rbs +4 -14
  144. data/sig/dodopayments/models/dispute_opened_webhook_event.rbs +4 -14
  145. data/sig/dodopayments/models/dispute_won_webhook_event.rbs +4 -14
  146. data/sig/dodopayments/models/dunning_recovered_webhook_event.rbs +4 -14
  147. data/sig/dodopayments/models/dunning_started_webhook_event.rbs +4 -14
  148. data/sig/dodopayments/models/entitlement_grant_created_webhook_event.rbs +4 -14
  149. data/sig/dodopayments/models/entitlement_grant_delivered_webhook_event.rbs +4 -14
  150. data/sig/dodopayments/models/entitlement_grant_failed_webhook_event.rbs +4 -14
  151. data/sig/dodopayments/models/entitlement_grant_revoked_webhook_event.rbs +4 -14
  152. data/sig/dodopayments/models/license_key_created_webhook_event.rbs +4 -14
  153. data/sig/dodopayments/models/payment.rbs +97 -0
  154. data/sig/dodopayments/models/payment_cancelled_webhook_event.rbs +4 -14
  155. data/sig/dodopayments/models/payment_create_params.rbs +5 -0
  156. data/sig/dodopayments/models/payment_create_response.rbs +5 -0
  157. data/sig/dodopayments/models/payment_failed_webhook_event.rbs +4 -14
  158. data/sig/dodopayments/models/payment_processing_webhook_event.rbs +4 -14
  159. data/sig/dodopayments/models/payment_succeeded_webhook_event.rbs +4 -14
  160. data/sig/dodopayments/models/price.rbs +15 -45
  161. data/sig/dodopayments/models/product_item_req.rbs +27 -3
  162. data/sig/dodopayments/models/refund_failed_webhook_event.rbs +4 -14
  163. data/sig/dodopayments/models/refund_succeeded_webhook_event.rbs +4 -14
  164. data/sig/dodopayments/models/subscription.rbs +97 -0
  165. data/sig/dodopayments/models/subscription_active_webhook_event.rbs +4 -14
  166. data/sig/dodopayments/models/subscription_cancelled_webhook_event.rbs +4 -14
  167. data/sig/dodopayments/models/subscription_create_params.rbs +5 -0
  168. data/sig/dodopayments/models/subscription_create_response.rbs +5 -0
  169. data/sig/dodopayments/models/subscription_expired_webhook_event.rbs +4 -14
  170. data/sig/dodopayments/models/subscription_failed_webhook_event.rbs +4 -14
  171. data/sig/dodopayments/models/subscription_list_response.rbs +24 -0
  172. data/sig/dodopayments/models/subscription_on_hold_webhook_event.rbs +4 -14
  173. data/sig/dodopayments/models/subscription_plan_changed_webhook_event.rbs +4 -14
  174. data/sig/dodopayments/models/subscription_preview_change_plan_response.rbs +15 -45
  175. data/sig/dodopayments/models/subscription_renewed_webhook_event.rbs +4 -14
  176. data/sig/dodopayments/models/subscription_update_payment_method_params.rbs +8 -48
  177. data/sig/dodopayments/models/subscription_updated_webhook_event.rbs +4 -14
  178. data/sig/dodopayments/models/update_subscription_plan_req.rbs +5 -0
  179. data/sig/dodopayments/models/webhook_event_type.rbs +6 -0
  180. data/sig/dodopayments/models/webhook_payload.rbs +50 -213
  181. data/sig/dodopayments/resources/checkout_sessions.rbs +2 -0
  182. data/sig/dodopayments/resources/payments.rbs +1 -0
  183. data/sig/dodopayments/resources/subscriptions.rbs +3 -0
  184. metadata +2 -2
@@ -36,11 +36,20 @@ module Dodopayments
36
36
  required :total_amount, Integer
37
37
 
38
38
  # @!attribute discount_id
39
- # The discount id if discount is applied
39
+ # @deprecated Use `discounts` instead.
40
+ #
41
+ # DEPRECATED: Use discount_ids instead. Returns the first discount's ID if
42
+ # present.
40
43
  #
41
44
  # @return [String, nil]
42
45
  optional :discount_id, String, nil?: true
43
46
 
47
+ # @!attribute discount_ids
48
+ # All stacked discount IDs applied, in order of application
49
+ #
50
+ # @return [Array<String>, nil]
51
+ optional :discount_ids, Dodopayments::Internal::Type::ArrayOf[String], nil?: true
52
+
44
53
  # @!attribute expires_on
45
54
  # Expiry timestamp of the payment link
46
55
  #
@@ -61,7 +70,7 @@ module Dodopayments
61
70
  -> { Dodopayments::Internal::Type::ArrayOf[Dodopayments::OneTimeProductCartItem] },
62
71
  nil?: true
63
72
 
64
- # @!method initialize(client_secret:, customer:, metadata:, payment_id:, total_amount:, discount_id: nil, expires_on: nil, payment_link: nil, product_cart: nil)
73
+ # @!method initialize(client_secret:, customer:, metadata:, payment_id:, total_amount:, discount_id: nil, discount_ids: nil, expires_on: nil, payment_link: nil, product_cart: nil)
65
74
  # Some parameter documentations has been truncated, see
66
75
  # {Dodopayments::Models::PaymentCreateResponse} for more details.
67
76
  #
@@ -75,7 +84,9 @@ module Dodopayments
75
84
  #
76
85
  # @param total_amount [Integer] Total amount of the payment in smallest currency unit (e.g. cents)
77
86
  #
78
- # @param discount_id [String, nil] The discount id if discount is applied
87
+ # @param discount_id [String, nil] DEPRECATED: Use discount_ids instead. Returns the first discount's ID if present
88
+ #
89
+ # @param discount_ids [Array<String>, nil] All stacked discount IDs applied, in order of application
79
90
  #
80
91
  # @param expires_on [Time, nil] Expiry timestamp of the payment link
81
92
  #
@@ -23,29 +23,17 @@ module Dodopayments
23
23
  # @!attribute type
24
24
  # The event type
25
25
  #
26
- # @return [Symbol, Dodopayments::Models::PaymentFailedWebhookEvent::Type]
27
- required :type, enum: -> { Dodopayments::PaymentFailedWebhookEvent::Type }
26
+ # @return [Symbol, :"payment.failed"]
27
+ required :type, const: :"payment.failed"
28
28
 
29
- # @!method initialize(business_id:, data:, timestamp:, type:)
29
+ # @!method initialize(business_id:, data:, timestamp:, type: :"payment.failed")
30
30
  # @param business_id [String] The business identifier
31
31
  #
32
32
  # @param data [Dodopayments::Models::Payment]
33
33
  #
34
34
  # @param timestamp [Time] The timestamp of when the event occurred
35
35
  #
36
- # @param type [Symbol, Dodopayments::Models::PaymentFailedWebhookEvent::Type] The event type
37
-
38
- # The event type
39
- #
40
- # @see Dodopayments::Models::PaymentFailedWebhookEvent#type
41
- module Type
42
- extend Dodopayments::Internal::Type::Enum
43
-
44
- PAYMENT_FAILED = :"payment.failed"
45
-
46
- # @!method self.values
47
- # @return [Array<Symbol>]
48
- end
36
+ # @param type [Symbol, :"payment.failed"] The event type
49
37
  end
50
38
  end
51
39
  end
@@ -23,29 +23,17 @@ module Dodopayments
23
23
  # @!attribute type
24
24
  # The event type
25
25
  #
26
- # @return [Symbol, Dodopayments::Models::PaymentProcessingWebhookEvent::Type]
27
- required :type, enum: -> { Dodopayments::PaymentProcessingWebhookEvent::Type }
26
+ # @return [Symbol, :"payment.processing"]
27
+ required :type, const: :"payment.processing"
28
28
 
29
- # @!method initialize(business_id:, data:, timestamp:, type:)
29
+ # @!method initialize(business_id:, data:, timestamp:, type: :"payment.processing")
30
30
  # @param business_id [String] The business identifier
31
31
  #
32
32
  # @param data [Dodopayments::Models::Payment]
33
33
  #
34
34
  # @param timestamp [Time] The timestamp of when the event occurred
35
35
  #
36
- # @param type [Symbol, Dodopayments::Models::PaymentProcessingWebhookEvent::Type] The event type
37
-
38
- # The event type
39
- #
40
- # @see Dodopayments::Models::PaymentProcessingWebhookEvent#type
41
- module Type
42
- extend Dodopayments::Internal::Type::Enum
43
-
44
- PAYMENT_PROCESSING = :"payment.processing"
45
-
46
- # @!method self.values
47
- # @return [Array<Symbol>]
48
- end
36
+ # @param type [Symbol, :"payment.processing"] The event type
49
37
  end
50
38
  end
51
39
  end
@@ -23,29 +23,17 @@ module Dodopayments
23
23
  # @!attribute type
24
24
  # The event type
25
25
  #
26
- # @return [Symbol, Dodopayments::Models::PaymentSucceededWebhookEvent::Type]
27
- required :type, enum: -> { Dodopayments::PaymentSucceededWebhookEvent::Type }
26
+ # @return [Symbol, :"payment.succeeded"]
27
+ required :type, const: :"payment.succeeded"
28
28
 
29
- # @!method initialize(business_id:, data:, timestamp:, type:)
29
+ # @!method initialize(business_id:, data:, timestamp:, type: :"payment.succeeded")
30
30
  # @param business_id [String] The business identifier
31
31
  #
32
32
  # @param data [Dodopayments::Models::Payment]
33
33
  #
34
34
  # @param timestamp [Time] The timestamp of when the event occurred
35
35
  #
36
- # @param type [Symbol, Dodopayments::Models::PaymentSucceededWebhookEvent::Type] The event type
37
-
38
- # The event type
39
- #
40
- # @see Dodopayments::Models::PaymentSucceededWebhookEvent#type
41
- module Type
42
- extend Dodopayments::Internal::Type::Enum
43
-
44
- PAYMENT_SUCCEEDED = :"payment.succeeded"
45
-
46
- # @!method self.values
47
- # @return [Array<Symbol>]
48
- end
36
+ # @param type [Symbol, :"payment.succeeded"] The event type
49
37
  end
50
38
  end
51
39
  end
@@ -17,7 +17,8 @@ module Dodopayments
17
17
  required :business_id, String
18
18
 
19
19
  # @!attribute chargebacks
20
- # @deprecated
20
+ # @deprecated Use the v3 payout breakup endpoints instead. Will be removed in a future
21
+ # release.
21
22
  #
22
23
  # The total value of chargebacks associated with the payout.
23
24
  #
@@ -55,7 +56,8 @@ module Dodopayments
55
56
  required :payout_id, String
56
57
 
57
58
  # @!attribute refunds
58
- # @deprecated
59
+ # @deprecated Use the v3 payout breakup endpoints instead. Will be removed in a future
60
+ # release.
59
61
  #
60
62
  # The total value of refunds associated with the payout.
61
63
  #
@@ -69,7 +71,8 @@ module Dodopayments
69
71
  required :status, enum: -> { Dodopayments::Models::PayoutListResponse::Status }
70
72
 
71
73
  # @!attribute tax
72
- # @deprecated
74
+ # @deprecated Use the v3 payout breakup endpoints instead. Will be removed in a future
75
+ # release.
73
76
  #
74
77
  # The tax applied to the payout.
75
78
  #
@@ -6,14 +6,16 @@ module Dodopayments
6
6
  module Price
7
7
  extend Dodopayments::Internal::Type::Union
8
8
 
9
+ discriminator :type
10
+
9
11
  # One-time price details.
10
- variant -> { Dodopayments::Price::OneTimePrice }
12
+ variant :one_time_price, -> { Dodopayments::Price::OneTimePrice }
11
13
 
12
14
  # Recurring price details.
13
- variant -> { Dodopayments::Price::RecurringPrice }
15
+ variant :recurring_price, -> { Dodopayments::Price::RecurringPrice }
14
16
 
15
17
  # Usage Based price details.
16
- variant -> { Dodopayments::Price::UsageBasedPrice }
18
+ variant :usage_based_price, -> { Dodopayments::Price::UsageBasedPrice }
17
19
 
18
20
  class OneTimePrice < Dodopayments::Internal::Type::BaseModel
19
21
  # @!attribute currency
@@ -47,8 +49,8 @@ module Dodopayments
47
49
 
48
50
  # @!attribute type
49
51
  #
50
- # @return [Symbol, Dodopayments::Models::Price::OneTimePrice::Type]
51
- required :type, enum: -> { Dodopayments::Price::OneTimePrice::Type }
52
+ # @return [Symbol, :one_time_price]
53
+ required :type, const: :one_time_price
52
54
 
53
55
  # @!attribute pay_what_you_want
54
56
  # Indicates whether the customer can pay any amount they choose. If set to `true`,
@@ -71,7 +73,7 @@ module Dodopayments
71
73
  # @return [Boolean, nil]
72
74
  optional :tax_inclusive, Dodopayments::Internal::Type::Boolean, nil?: true
73
75
 
74
- # @!method initialize(currency:, discount:, price:, purchasing_power_parity:, type:, pay_what_you_want: nil, suggested_price: nil, tax_inclusive: nil)
76
+ # @!method initialize(currency:, discount:, price:, purchasing_power_parity:, pay_what_you_want: nil, suggested_price: nil, tax_inclusive: nil, type: :one_time_price)
75
77
  # Some parameter documentations has been truncated, see
76
78
  # {Dodopayments::Models::Price::OneTimePrice} for more details.
77
79
  #
@@ -85,23 +87,13 @@ module Dodopayments
85
87
  #
86
88
  # @param purchasing_power_parity [Boolean] Indicates if purchasing power parity adjustments are applied to the price.
87
89
  #
88
- # @param type [Symbol, Dodopayments::Models::Price::OneTimePrice::Type]
89
- #
90
90
  # @param pay_what_you_want [Boolean] Indicates whether the customer can pay any amount they choose.
91
91
  #
92
92
  # @param suggested_price [Integer, nil] A suggested price for the user to pay. This value is only considered if
93
93
  #
94
94
  # @param tax_inclusive [Boolean, nil] Indicates if the price is tax inclusive.
95
-
96
- # @see Dodopayments::Models::Price::OneTimePrice#type
97
- module Type
98
- extend Dodopayments::Internal::Type::Enum
99
-
100
- ONE_TIME_PRICE = :one_time_price
101
-
102
- # @!method self.values
103
- # @return [Array<Symbol>]
104
- end
95
+ #
96
+ # @param type [Symbol, :one_time_price]
105
97
  end
106
98
 
107
99
  class RecurringPrice < Dodopayments::Internal::Type::BaseModel
@@ -159,8 +151,8 @@ module Dodopayments
159
151
 
160
152
  # @!attribute type
161
153
  #
162
- # @return [Symbol, Dodopayments::Models::Price::RecurringPrice::Type]
163
- required :type, enum: -> { Dodopayments::Price::RecurringPrice::Type }
154
+ # @return [Symbol, :recurring_price]
155
+ required :type, const: :recurring_price
164
156
 
165
157
  # @!attribute tax_inclusive
166
158
  # Indicates if the price is tax inclusive
@@ -174,7 +166,7 @@ module Dodopayments
174
166
  # @return [Integer, nil]
175
167
  optional :trial_period_days, Integer
176
168
 
177
- # @!method initialize(currency:, discount:, payment_frequency_count:, payment_frequency_interval:, price:, purchasing_power_parity:, subscription_period_count:, subscription_period_interval:, type:, tax_inclusive: nil, trial_period_days: nil)
169
+ # @!method initialize(currency:, discount:, payment_frequency_count:, payment_frequency_interval:, price:, purchasing_power_parity:, subscription_period_count:, subscription_period_interval:, tax_inclusive: nil, trial_period_days: nil, type: :recurring_price)
178
170
  # Some parameter documentations has been truncated, see
179
171
  # {Dodopayments::Models::Price::RecurringPrice} for more details.
180
172
  #
@@ -196,21 +188,11 @@ module Dodopayments
196
188
  #
197
189
  # @param subscription_period_interval [Symbol, Dodopayments::Models::TimeInterval] The time interval for the subscription period (e.g., day, month, year).
198
190
  #
199
- # @param type [Symbol, Dodopayments::Models::Price::RecurringPrice::Type]
200
- #
201
191
  # @param tax_inclusive [Boolean, nil] Indicates if the price is tax inclusive
202
192
  #
203
193
  # @param trial_period_days [Integer] Number of days for the trial period. A value of `0` indicates no trial period.
204
-
205
- # @see Dodopayments::Models::Price::RecurringPrice#type
206
- module Type
207
- extend Dodopayments::Internal::Type::Enum
208
-
209
- RECURRING_PRICE = :recurring_price
210
-
211
- # @!method self.values
212
- # @return [Array<Symbol>]
213
- end
194
+ #
195
+ # @param type [Symbol, :recurring_price]
214
196
  end
215
197
 
216
198
  class UsageBasedPrice < Dodopayments::Internal::Type::BaseModel
@@ -268,8 +250,8 @@ module Dodopayments
268
250
 
269
251
  # @!attribute type
270
252
  #
271
- # @return [Symbol, Dodopayments::Models::Price::UsageBasedPrice::Type]
272
- required :type, enum: -> { Dodopayments::Price::UsageBasedPrice::Type }
253
+ # @return [Symbol, :usage_based_price]
254
+ required :type, const: :usage_based_price
273
255
 
274
256
  # @!attribute meters
275
257
  #
@@ -286,7 +268,7 @@ module Dodopayments
286
268
  # @return [Boolean, nil]
287
269
  optional :tax_inclusive, Dodopayments::Internal::Type::Boolean, nil?: true
288
270
 
289
- # @!method initialize(currency:, discount:, fixed_price:, payment_frequency_count:, payment_frequency_interval:, purchasing_power_parity:, subscription_period_count:, subscription_period_interval:, type:, meters: nil, tax_inclusive: nil)
271
+ # @!method initialize(currency:, discount:, fixed_price:, payment_frequency_count:, payment_frequency_interval:, purchasing_power_parity:, subscription_period_count:, subscription_period_interval:, meters: nil, tax_inclusive: nil, type: :usage_based_price)
290
272
  # Some parameter documentations has been truncated, see
291
273
  # {Dodopayments::Models::Price::UsageBasedPrice} for more details.
292
274
  #
@@ -308,21 +290,11 @@ module Dodopayments
308
290
  #
309
291
  # @param subscription_period_interval [Symbol, Dodopayments::Models::TimeInterval] The time interval for the subscription period (e.g., day, month, year).
310
292
  #
311
- # @param type [Symbol, Dodopayments::Models::Price::UsageBasedPrice::Type]
312
- #
313
293
  # @param meters [Array<Dodopayments::Models::AddMeterToPrice>, nil]
314
294
  #
315
295
  # @param tax_inclusive [Boolean, nil] Indicates if the price is tax inclusive
316
-
317
- # @see Dodopayments::Models::Price::UsageBasedPrice#type
318
- module Type
319
- extend Dodopayments::Internal::Type::Enum
320
-
321
- USAGE_BASED_PRICE = :usage_based_price
322
-
323
- # @!method self.values
324
- # @return [Array<Symbol>]
325
- end
296
+ #
297
+ # @param type [Symbol, :usage_based_price]
326
298
  end
327
299
 
328
300
  # @!method self.variants
@@ -42,7 +42,7 @@ module Dodopayments
42
42
  required :is_recurring, Dodopayments::Internal::Type::Boolean
43
43
 
44
44
  # @!attribute license_key_enabled
45
- # @deprecated
45
+ # @deprecated Use the dedicated entitlements API to configure license-key delivery.
46
46
  #
47
47
  # Indicates whether the product requires a license key.
48
48
  #
@@ -105,7 +105,7 @@ module Dodopayments
105
105
  optional :image, String, nil?: true
106
106
 
107
107
  # @!attribute license_key_activation_message
108
- # @deprecated
108
+ # @deprecated Use the dedicated entitlements API to configure license-key delivery.
109
109
  #
110
110
  # Message sent upon license key activation, if applicable.
111
111
  #
@@ -113,7 +113,7 @@ module Dodopayments
113
113
  optional :license_key_activation_message, String, nil?: true
114
114
 
115
115
  # @!attribute license_key_activations_limit
116
- # @deprecated
116
+ # @deprecated Use the dedicated entitlements API to configure license-key delivery.
117
117
  #
118
118
  # Limit on the number of activations for the license key, if enabled.
119
119
  #
@@ -70,7 +70,7 @@ module Dodopayments
70
70
  nil?: true
71
71
 
72
72
  # @!attribute license_key_activation_message
73
- # @deprecated
73
+ # @deprecated Use the dedicated entitlements API to configure license-key delivery.
74
74
  #
75
75
  # Optional message displayed during license key activation
76
76
  #
@@ -81,7 +81,7 @@ module Dodopayments
81
81
  optional :license_key_activation_message, String, nil?: true
82
82
 
83
83
  # @!attribute license_key_activations_limit
84
- # @deprecated
84
+ # @deprecated Use the dedicated entitlements API to configure license-key delivery.
85
85
  #
86
86
  # The number of times the license key can be activated. Must be 0 or greater
87
87
  #
@@ -103,7 +103,7 @@ module Dodopayments
103
103
  optional :license_key_duration, -> { Dodopayments::LicenseKeyDuration }, nil?: true
104
104
 
105
105
  # @!attribute license_key_enabled
106
- # @deprecated
106
+ # @deprecated Use the dedicated entitlements API to configure license-key delivery.
107
107
  #
108
108
  # When true, generates and sends a license key to your customer. Defaults to false
109
109
  #
@@ -32,7 +32,18 @@ module Dodopayments
32
32
  # @return [Integer, nil]
33
33
  optional :amount, Integer, nil?: true
34
34
 
35
- # @!method initialize(product_id:, quantity:, addons: nil, amount: nil)
35
+ # @!attribute credit_entitlements
36
+ # Per-checkout-session overrides for credit entitlements already attached to this
37
+ # product. Each entry overrides the `credits_amount` granted by the referenced
38
+ # credit entitlement when this checkout session is fulfilled. The
39
+ # credit_entitlement_id must already be attached to the product.
40
+ #
41
+ # @return [Array<Dodopayments::Models::ProductItemReq::CreditEntitlement>, nil]
42
+ optional :credit_entitlements,
43
+ -> { Dodopayments::Internal::Type::ArrayOf[Dodopayments::ProductItemReq::CreditEntitlement] },
44
+ nil?: true
45
+
46
+ # @!method initialize(product_id:, quantity:, addons: nil, amount: nil, credit_entitlements: nil)
36
47
  # Some parameter documentations has been truncated, see
37
48
  # {Dodopayments::Models::ProductItemReq} for more details.
38
49
  #
@@ -43,6 +54,36 @@ module Dodopayments
43
54
  # @param addons [Array<Dodopayments::Models::AttachAddon>, nil] only valid if product is a subscription
44
55
  #
45
56
  # @param amount [Integer, nil] Amount the customer pays if pay_what_you_want is enabled. If disabled then amoun
57
+ #
58
+ # @param credit_entitlements [Array<Dodopayments::Models::ProductItemReq::CreditEntitlement>, nil] Per-checkout-session overrides for credit entitlements already attached
59
+
60
+ class CreditEntitlement < Dodopayments::Internal::Type::BaseModel
61
+ # @!attribute credit_entitlement_id
62
+ # ID of the credit entitlement to override. Must already be attached to the
63
+ # product.
64
+ #
65
+ # @return [String]
66
+ required :credit_entitlement_id, String
67
+
68
+ # @!attribute credits_amount
69
+ # Number of credits to grant for this checkout session, overriding the
70
+ # product-level `credits_amount` set on the credit entitlement mapping. Must be
71
+ # greater than zero.
72
+ #
73
+ # @return [String]
74
+ required :credits_amount, String
75
+
76
+ # @!method initialize(credit_entitlement_id:, credits_amount:)
77
+ # Some parameter documentations has been truncated, see
78
+ # {Dodopayments::Models::ProductItemReq::CreditEntitlement} for more details.
79
+ #
80
+ # Per-checkout-session override for a single credit entitlement attached to a
81
+ # product.
82
+ #
83
+ # @param credit_entitlement_id [String] ID of the credit entitlement to override. Must already be attached to the produc
84
+ #
85
+ # @param credits_amount [String] Number of credits to grant for this checkout session, overriding the
86
+ end
46
87
  end
47
88
  end
48
89
  end
@@ -64,7 +64,7 @@ module Dodopayments
64
64
  optional :image_id, String, nil?: true
65
65
 
66
66
  # @!attribute license_key_activation_message
67
- # @deprecated
67
+ # @deprecated Use the dedicated entitlements API to configure license-key delivery.
68
68
  #
69
69
  # Message sent to the customer upon license key activation.
70
70
  #
@@ -77,7 +77,7 @@ module Dodopayments
77
77
  optional :license_key_activation_message, String, nil?: true
78
78
 
79
79
  # @!attribute license_key_activations_limit
80
- # @deprecated
80
+ # @deprecated Use the dedicated entitlements API to configure license-key delivery.
81
81
  #
82
82
  # Limit for the number of activations for the license key.
83
83
  #
@@ -101,7 +101,7 @@ module Dodopayments
101
101
  optional :license_key_duration, -> { Dodopayments::LicenseKeyDuration }, nil?: true
102
102
 
103
103
  # @!attribute license_key_enabled
104
- # @deprecated
104
+ # @deprecated Use the dedicated entitlements API to configure license-key delivery.
105
105
  #
106
106
  # Whether the product requires a license key.
107
107
  #
@@ -23,29 +23,17 @@ module Dodopayments
23
23
  # @!attribute type
24
24
  # The event type
25
25
  #
26
- # @return [Symbol, Dodopayments::Models::RefundFailedWebhookEvent::Type]
27
- required :type, enum: -> { Dodopayments::RefundFailedWebhookEvent::Type }
26
+ # @return [Symbol, :"refund.failed"]
27
+ required :type, const: :"refund.failed"
28
28
 
29
- # @!method initialize(business_id:, data:, timestamp:, type:)
29
+ # @!method initialize(business_id:, data:, timestamp:, type: :"refund.failed")
30
30
  # @param business_id [String] The business identifier
31
31
  #
32
32
  # @param data [Dodopayments::Models::Refund]
33
33
  #
34
34
  # @param timestamp [Time] The timestamp of when the event occurred
35
35
  #
36
- # @param type [Symbol, Dodopayments::Models::RefundFailedWebhookEvent::Type] The event type
37
-
38
- # The event type
39
- #
40
- # @see Dodopayments::Models::RefundFailedWebhookEvent#type
41
- module Type
42
- extend Dodopayments::Internal::Type::Enum
43
-
44
- REFUND_FAILED = :"refund.failed"
45
-
46
- # @!method self.values
47
- # @return [Array<Symbol>]
48
- end
36
+ # @param type [Symbol, :"refund.failed"] The event type
49
37
  end
50
38
  end
51
39
  end
@@ -23,29 +23,17 @@ module Dodopayments
23
23
  # @!attribute type
24
24
  # The event type
25
25
  #
26
- # @return [Symbol, Dodopayments::Models::RefundSucceededWebhookEvent::Type]
27
- required :type, enum: -> { Dodopayments::RefundSucceededWebhookEvent::Type }
26
+ # @return [Symbol, :"refund.succeeded"]
27
+ required :type, const: :"refund.succeeded"
28
28
 
29
- # @!method initialize(business_id:, data:, timestamp:, type:)
29
+ # @!method initialize(business_id:, data:, timestamp:, type: :"refund.succeeded")
30
30
  # @param business_id [String] The business identifier
31
31
  #
32
32
  # @param data [Dodopayments::Models::Refund]
33
33
  #
34
34
  # @param timestamp [Time] The timestamp of when the event occurred
35
35
  #
36
- # @param type [Symbol, Dodopayments::Models::RefundSucceededWebhookEvent::Type] The event type
37
-
38
- # The event type
39
- #
40
- # @see Dodopayments::Models::RefundSucceededWebhookEvent#type
41
- module Type
42
- extend Dodopayments::Internal::Type::Enum
43
-
44
- REFUND_SUCCEEDED = :"refund.succeeded"
45
-
46
- # @!method self.values
47
- # @return [Array<Symbol>]
48
- end
36
+ # @param type [Symbol, :"refund.succeeded"] The event type
49
37
  end
50
38
  end
51
39
  end