dodopayments 2.9.0 → 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 (219) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +23 -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/digital_product_delivery.rb +14 -7
  19. data/lib/dodopayments/models/digital_product_delivery_file.rb +12 -5
  20. data/lib/dodopayments/models/dispute_accepted_webhook_event.rb +4 -16
  21. data/lib/dodopayments/models/dispute_cancelled_webhook_event.rb +4 -16
  22. data/lib/dodopayments/models/dispute_challenged_webhook_event.rb +4 -16
  23. data/lib/dodopayments/models/dispute_expired_webhook_event.rb +4 -16
  24. data/lib/dodopayments/models/dispute_lost_webhook_event.rb +4 -16
  25. data/lib/dodopayments/models/dispute_opened_webhook_event.rb +4 -16
  26. data/lib/dodopayments/models/dispute_won_webhook_event.rb +4 -16
  27. data/lib/dodopayments/models/dunning_recovered_webhook_event.rb +4 -16
  28. data/lib/dodopayments/models/dunning_started_webhook_event.rb +4 -16
  29. data/lib/dodopayments/models/entitlement.rb +31 -20
  30. data/lib/dodopayments/models/entitlement_create_params.rb +3 -3
  31. data/lib/dodopayments/models/entitlement_grant_created_webhook_event.rb +10 -17
  32. data/lib/dodopayments/models/entitlement_grant_delivered_webhook_event.rb +10 -17
  33. data/lib/dodopayments/models/entitlement_grant_failed_webhook_event.rb +10 -17
  34. data/lib/dodopayments/models/entitlement_grant_revoked_webhook_event.rb +10 -17
  35. data/lib/dodopayments/models/entitlement_update_params.rb +3 -3
  36. data/lib/dodopayments/models/entitlements/entitlement_grant.rb +50 -32
  37. data/lib/dodopayments/models/entitlements/file_upload_response.rb +3 -3
  38. data/lib/dodopayments/models/entitlements/license_key_grant.rb +14 -9
  39. data/lib/dodopayments/models/integration_config.rb +70 -27
  40. data/lib/dodopayments/models/integration_config_response.rb +88 -48
  41. data/lib/dodopayments/models/license_key_created_webhook_event.rb +4 -16
  42. data/lib/dodopayments/models/payment.rb +153 -3
  43. data/lib/dodopayments/models/payment_cancelled_webhook_event.rb +4 -16
  44. data/lib/dodopayments/models/payment_create_params.rb +15 -3
  45. data/lib/dodopayments/models/payment_create_response.rb +14 -3
  46. data/lib/dodopayments/models/payment_failed_webhook_event.rb +4 -16
  47. data/lib/dodopayments/models/payment_processing_webhook_event.rb +4 -16
  48. data/lib/dodopayments/models/payment_succeeded_webhook_event.rb +4 -16
  49. data/lib/dodopayments/models/payout_list_response.rb +6 -3
  50. data/lib/dodopayments/models/price.rb +20 -48
  51. data/lib/dodopayments/models/product.rb +6 -8
  52. data/lib/dodopayments/models/product_create_params.rb +3 -3
  53. data/lib/dodopayments/models/product_entitlement_summary.rb +5 -5
  54. data/lib/dodopayments/models/product_item_req.rb +42 -1
  55. data/lib/dodopayments/models/product_update_params.rb +3 -3
  56. data/lib/dodopayments/models/refund_failed_webhook_event.rb +4 -16
  57. data/lib/dodopayments/models/refund_succeeded_webhook_event.rb +4 -16
  58. data/lib/dodopayments/models/subscription.rb +153 -5
  59. data/lib/dodopayments/models/subscription_active_webhook_event.rb +4 -16
  60. data/lib/dodopayments/models/subscription_cancelled_webhook_event.rb +4 -16
  61. data/lib/dodopayments/models/subscription_create_params.rb +15 -3
  62. data/lib/dodopayments/models/subscription_create_response.rb +14 -3
  63. data/lib/dodopayments/models/subscription_expired_webhook_event.rb +4 -16
  64. data/lib/dodopayments/models/subscription_failed_webhook_event.rb +4 -16
  65. data/lib/dodopayments/models/subscription_list_response.rb +36 -5
  66. data/lib/dodopayments/models/subscription_on_hold_webhook_event.rb +4 -16
  67. data/lib/dodopayments/models/subscription_plan_changed_webhook_event.rb +4 -16
  68. data/lib/dodopayments/models/subscription_preview_change_plan_response.rb +21 -49
  69. data/lib/dodopayments/models/subscription_renewed_webhook_event.rb +4 -16
  70. data/lib/dodopayments/models/subscription_update_payment_method_params.rb +12 -30
  71. data/lib/dodopayments/models/subscription_updated_webhook_event.rb +4 -16
  72. data/lib/dodopayments/models/unsafe_unwrap_webhook_event.rb +41 -39
  73. data/lib/dodopayments/models/unwrap_webhook_event.rb +41 -39
  74. data/lib/dodopayments/models/update_subscription_plan_req.rb +17 -6
  75. data/lib/dodopayments/models/webhook_event_type.rb +3 -0
  76. data/lib/dodopayments/models/webhook_payload.rb +57 -143
  77. data/lib/dodopayments/resources/checkout_sessions.rb +8 -4
  78. data/lib/dodopayments/resources/entitlements/files.rb +3 -10
  79. data/lib/dodopayments/resources/entitlements/grants.rb +2 -4
  80. data/lib/dodopayments/resources/entitlements.rb +2 -2
  81. data/lib/dodopayments/resources/payments.rb +4 -2
  82. data/lib/dodopayments/resources/subscriptions.rb +12 -6
  83. data/lib/dodopayments/version.rb +1 -1
  84. data/rbi/dodopayments/models/abandoned_checkout_detected_webhook_event.rbi +4 -40
  85. data/rbi/dodopayments/models/abandoned_checkout_recovered_webhook_event.rbi +4 -40
  86. data/rbi/dodopayments/models/checkout_session_request.rbi +14 -0
  87. data/rbi/dodopayments/models/credit_added_webhook_event.rbi +4 -29
  88. data/rbi/dodopayments/models/credit_balance_low_webhook_event.rbi +4 -33
  89. data/rbi/dodopayments/models/credit_deducted_webhook_event.rbi +4 -33
  90. data/rbi/dodopayments/models/credit_expired_webhook_event.rbi +4 -33
  91. data/rbi/dodopayments/models/credit_manual_adjustment_webhook_event.rbi +4 -39
  92. data/rbi/dodopayments/models/credit_overage_charged_webhook_event.rbi +4 -36
  93. data/rbi/dodopayments/models/credit_overage_reset_webhook_event.rbi +4 -36
  94. data/rbi/dodopayments/models/credit_rolled_over_webhook_event.rbi +4 -33
  95. data/rbi/dodopayments/models/credit_rollover_forfeited_webhook_event.rbi +4 -40
  96. data/rbi/dodopayments/models/digital_product_delivery.rbi +15 -5
  97. data/rbi/dodopayments/models/digital_product_delivery_file.rbi +11 -0
  98. data/rbi/dodopayments/models/dispute_accepted_webhook_event.rbi +4 -33
  99. data/rbi/dodopayments/models/dispute_cancelled_webhook_event.rbi +4 -33
  100. data/rbi/dodopayments/models/dispute_challenged_webhook_event.rbi +4 -34
  101. data/rbi/dodopayments/models/dispute_expired_webhook_event.rbi +4 -33
  102. data/rbi/dodopayments/models/dispute_lost_webhook_event.rbi +4 -29
  103. data/rbi/dodopayments/models/dispute_opened_webhook_event.rbi +4 -33
  104. data/rbi/dodopayments/models/dispute_won_webhook_event.rbi +4 -29
  105. data/rbi/dodopayments/models/dunning_recovered_webhook_event.rbi +4 -33
  106. data/rbi/dodopayments/models/dunning_started_webhook_event.rbi +4 -33
  107. data/rbi/dodopayments/models/entitlement.rbi +35 -20
  108. data/rbi/dodopayments/models/entitlement_create_params.rbi +8 -5
  109. data/rbi/dodopayments/models/entitlement_grant_created_webhook_event.rbi +8 -40
  110. data/rbi/dodopayments/models/entitlement_grant_delivered_webhook_event.rbi +8 -40
  111. data/rbi/dodopayments/models/entitlement_grant_failed_webhook_event.rbi +8 -39
  112. data/rbi/dodopayments/models/entitlement_grant_revoked_webhook_event.rbi +8 -40
  113. data/rbi/dodopayments/models/entitlement_update_params.rbi +4 -4
  114. data/rbi/dodopayments/models/entitlements/entitlement_grant.rbi +54 -20
  115. data/rbi/dodopayments/models/entitlements/file_upload_response.rbi +4 -4
  116. data/rbi/dodopayments/models/entitlements/license_key_grant.rbi +10 -4
  117. data/rbi/dodopayments/models/integration_config.rbi +141 -26
  118. data/rbi/dodopayments/models/integration_config_response.rbi +153 -38
  119. data/rbi/dodopayments/models/license_key_created_webhook_event.rbi +4 -34
  120. data/rbi/dodopayments/models/payment.rbi +170 -2
  121. data/rbi/dodopayments/models/payment_cancelled_webhook_event.rbi +4 -33
  122. data/rbi/dodopayments/models/payment_create_params.rbi +14 -2
  123. data/rbi/dodopayments/models/payment_create_response.rbi +12 -2
  124. data/rbi/dodopayments/models/payment_failed_webhook_event.rbi +4 -33
  125. data/rbi/dodopayments/models/payment_processing_webhook_event.rbi +4 -34
  126. data/rbi/dodopayments/models/payment_succeeded_webhook_event.rbi +4 -33
  127. data/rbi/dodopayments/models/price.rbi +18 -90
  128. data/rbi/dodopayments/models/product.rbi +4 -8
  129. data/rbi/dodopayments/models/product_entitlement_summary.rbi +8 -8
  130. data/rbi/dodopayments/models/product_item_req.rbi +74 -3
  131. data/rbi/dodopayments/models/refund_failed_webhook_event.rbi +4 -31
  132. data/rbi/dodopayments/models/refund_succeeded_webhook_event.rbi +4 -33
  133. data/rbi/dodopayments/models/subscription.rbi +173 -4
  134. data/rbi/dodopayments/models/subscription_active_webhook_event.rbi +4 -36
  135. data/rbi/dodopayments/models/subscription_cancelled_webhook_event.rbi +4 -36
  136. data/rbi/dodopayments/models/subscription_create_params.rbi +14 -2
  137. data/rbi/dodopayments/models/subscription_create_response.rbi +12 -2
  138. data/rbi/dodopayments/models/subscription_expired_webhook_event.rbi +4 -36
  139. data/rbi/dodopayments/models/subscription_failed_webhook_event.rbi +4 -36
  140. data/rbi/dodopayments/models/subscription_list_response.rbi +67 -4
  141. data/rbi/dodopayments/models/subscription_on_hold_webhook_event.rbi +4 -36
  142. data/rbi/dodopayments/models/subscription_plan_changed_webhook_event.rbi +4 -40
  143. data/rbi/dodopayments/models/subscription_preview_change_plan_response.rbi +18 -123
  144. data/rbi/dodopayments/models/subscription_renewed_webhook_event.rbi +4 -36
  145. data/rbi/dodopayments/models/subscription_update_payment_method_params.rbi +12 -96
  146. data/rbi/dodopayments/models/subscription_updated_webhook_event.rbi +4 -36
  147. data/rbi/dodopayments/models/update_subscription_plan_req.rbi +18 -8
  148. data/rbi/dodopayments/models/webhook_event_type.rbi +15 -0
  149. data/rbi/dodopayments/models/webhook_payload.rbi +48 -466
  150. data/rbi/dodopayments/resources/checkout_sessions.rbi +12 -0
  151. data/rbi/dodopayments/resources/entitlements/files.rbi +3 -10
  152. data/rbi/dodopayments/resources/entitlements/grants.rbi +2 -4
  153. data/rbi/dodopayments/resources/entitlements.rbi +4 -4
  154. data/rbi/dodopayments/resources/payments.rbi +6 -1
  155. data/rbi/dodopayments/resources/subscriptions.rbi +22 -9
  156. data/sig/dodopayments/models/abandoned_checkout_detected_webhook_event.rbs +4 -14
  157. data/sig/dodopayments/models/abandoned_checkout_recovered_webhook_event.rbs +4 -14
  158. data/sig/dodopayments/models/checkout_session_request.rbs +5 -0
  159. data/sig/dodopayments/models/credit_added_webhook_event.rbs +4 -14
  160. data/sig/dodopayments/models/credit_balance_low_webhook_event.rbs +4 -14
  161. data/sig/dodopayments/models/credit_deducted_webhook_event.rbs +4 -14
  162. data/sig/dodopayments/models/credit_expired_webhook_event.rbs +4 -14
  163. data/sig/dodopayments/models/credit_manual_adjustment_webhook_event.rbs +4 -14
  164. data/sig/dodopayments/models/credit_overage_charged_webhook_event.rbs +4 -14
  165. data/sig/dodopayments/models/credit_overage_reset_webhook_event.rbs +4 -14
  166. data/sig/dodopayments/models/credit_rolled_over_webhook_event.rbs +4 -14
  167. data/sig/dodopayments/models/credit_rollover_forfeited_webhook_event.rbs +4 -14
  168. data/sig/dodopayments/models/dispute_accepted_webhook_event.rbs +4 -14
  169. data/sig/dodopayments/models/dispute_cancelled_webhook_event.rbs +4 -14
  170. data/sig/dodopayments/models/dispute_challenged_webhook_event.rbs +4 -14
  171. data/sig/dodopayments/models/dispute_expired_webhook_event.rbs +4 -14
  172. data/sig/dodopayments/models/dispute_lost_webhook_event.rbs +4 -14
  173. data/sig/dodopayments/models/dispute_opened_webhook_event.rbs +4 -14
  174. data/sig/dodopayments/models/dispute_won_webhook_event.rbs +4 -14
  175. data/sig/dodopayments/models/dunning_recovered_webhook_event.rbs +4 -14
  176. data/sig/dodopayments/models/dunning_started_webhook_event.rbs +4 -14
  177. data/sig/dodopayments/models/entitlement.rbs +8 -10
  178. data/sig/dodopayments/models/entitlement_create_params.rbs +6 -4
  179. data/sig/dodopayments/models/entitlement_grant_created_webhook_event.rbs +4 -14
  180. data/sig/dodopayments/models/entitlement_grant_delivered_webhook_event.rbs +4 -14
  181. data/sig/dodopayments/models/entitlement_grant_failed_webhook_event.rbs +4 -14
  182. data/sig/dodopayments/models/entitlement_grant_revoked_webhook_event.rbs +4 -14
  183. data/sig/dodopayments/models/entitlements/entitlement_grant.rbs +4 -11
  184. data/sig/dodopayments/models/integration_config.rbs +28 -4
  185. data/sig/dodopayments/models/integration_config_response.rbs +28 -9
  186. data/sig/dodopayments/models/license_key_created_webhook_event.rbs +4 -14
  187. data/sig/dodopayments/models/payment.rbs +97 -0
  188. data/sig/dodopayments/models/payment_cancelled_webhook_event.rbs +4 -14
  189. data/sig/dodopayments/models/payment_create_params.rbs +5 -0
  190. data/sig/dodopayments/models/payment_create_response.rbs +5 -0
  191. data/sig/dodopayments/models/payment_failed_webhook_event.rbs +4 -14
  192. data/sig/dodopayments/models/payment_processing_webhook_event.rbs +4 -14
  193. data/sig/dodopayments/models/payment_succeeded_webhook_event.rbs +4 -14
  194. data/sig/dodopayments/models/price.rbs +15 -45
  195. data/sig/dodopayments/models/product_item_req.rbs +27 -3
  196. data/sig/dodopayments/models/refund_failed_webhook_event.rbs +4 -14
  197. data/sig/dodopayments/models/refund_succeeded_webhook_event.rbs +4 -14
  198. data/sig/dodopayments/models/subscription.rbs +97 -0
  199. data/sig/dodopayments/models/subscription_active_webhook_event.rbs +4 -14
  200. data/sig/dodopayments/models/subscription_cancelled_webhook_event.rbs +4 -14
  201. data/sig/dodopayments/models/subscription_create_params.rbs +5 -0
  202. data/sig/dodopayments/models/subscription_create_response.rbs +5 -0
  203. data/sig/dodopayments/models/subscription_expired_webhook_event.rbs +4 -14
  204. data/sig/dodopayments/models/subscription_failed_webhook_event.rbs +4 -14
  205. data/sig/dodopayments/models/subscription_list_response.rbs +24 -0
  206. data/sig/dodopayments/models/subscription_on_hold_webhook_event.rbs +4 -14
  207. data/sig/dodopayments/models/subscription_plan_changed_webhook_event.rbs +4 -14
  208. data/sig/dodopayments/models/subscription_preview_change_plan_response.rbs +15 -45
  209. data/sig/dodopayments/models/subscription_renewed_webhook_event.rbs +4 -14
  210. data/sig/dodopayments/models/subscription_update_payment_method_params.rbs +8 -48
  211. data/sig/dodopayments/models/subscription_updated_webhook_event.rbs +4 -14
  212. data/sig/dodopayments/models/update_subscription_plan_req.rbs +5 -0
  213. data/sig/dodopayments/models/webhook_event_type.rbs +6 -0
  214. data/sig/dodopayments/models/webhook_payload.rbs +50 -213
  215. data/sig/dodopayments/resources/checkout_sessions.rbs +2 -0
  216. data/sig/dodopayments/resources/entitlements.rbs +1 -1
  217. data/sig/dodopayments/resources/payments.rbs +1 -0
  218. data/sig/dodopayments/resources/subscriptions.rbs +3 -0
  219. metadata +2 -2
@@ -2,10 +2,10 @@
2
2
 
3
3
  module Dodopayments
4
4
  module Models
5
- # Public-facing variant of [`IntegrationConfig`]. Mirrors every variant shape on
6
- # the wire EXCEPT `DigitalFiles`, which is replaced with a hydrated
7
- # `digital_files` object (resolved download URLs etc.). The persisted JSONB stays
8
- # ID-only via [`IntegrationConfig`]; this enum is response-only.
5
+ # Integration-specific configuration on an entitlement read response.
6
+ #
7
+ # For `digital_files` entitlements the response includes presigned download URLs
8
+ # for each attached file; other integrations match the shape supplied at creation.
9
9
  module IntegrationConfigResponse
10
10
  extend Dodopayments::Internal::Type::Union
11
11
 
@@ -27,82 +27,106 @@ module Dodopayments
27
27
 
28
28
  class GitHubConfig < Dodopayments::Internal::Type::BaseModel
29
29
  # @!attribute permission
30
+ # Permission to grant on the repository.
30
31
  #
31
- # @return [String]
32
- required :permission, String
32
+ # @return [Symbol, Dodopayments::Models::IntegrationConfigResponse::GitHubConfig::Permission]
33
+ required :permission, enum: -> { Dodopayments::IntegrationConfigResponse::GitHubConfig::Permission }
33
34
 
34
35
  # @!attribute target_id
36
+ # Repository or organisation slug to grant access to.
35
37
  #
36
38
  # @return [String]
37
39
  required :target_id, String
38
40
 
39
41
  # @!method initialize(permission:, target_id:)
40
- # @param permission [String]
41
- # @param target_id [String]
42
+ # @param permission [Symbol, Dodopayments::Models::IntegrationConfigResponse::GitHubConfig::Permission] Permission to grant on the repository.
43
+ #
44
+ # @param target_id [String] Repository or organisation slug to grant access to.
45
+
46
+ # Permission to grant on the repository.
47
+ #
48
+ # @see Dodopayments::Models::IntegrationConfigResponse::GitHubConfig#permission
49
+ module Permission
50
+ extend Dodopayments::Internal::Type::Enum
51
+
52
+ PULL = :pull
53
+ PUSH = :push
54
+ ADMIN = :admin
55
+ MAINTAIN = :maintain
56
+ TRIAGE = :triage
57
+
58
+ # @!method self.values
59
+ # @return [Array<Symbol>]
60
+ end
42
61
  end
43
62
 
44
63
  class DiscordConfig < Dodopayments::Internal::Type::BaseModel
45
64
  # @!attribute guild_id
65
+ # Discord guild (server) ID.
46
66
  #
47
67
  # @return [String]
48
68
  required :guild_id, String
49
69
 
50
70
  # @!attribute role_id
71
+ # Optional Discord role to assign within the guild.
51
72
  #
52
73
  # @return [String, nil]
53
74
  optional :role_id, String, nil?: true
54
75
 
55
76
  # @!method initialize(guild_id:, role_id: nil)
56
- # @param guild_id [String]
57
- # @param role_id [String, nil]
77
+ # @param guild_id [String] Discord guild (server) ID.
78
+ #
79
+ # @param role_id [String, nil] Optional Discord role to assign within the guild.
58
80
  end
59
81
 
60
82
  class TelegramConfig < Dodopayments::Internal::Type::BaseModel
61
83
  # @!attribute chat_id
84
+ # Telegram chat ID. For groups this is typically a negative integer.
62
85
  #
63
86
  # @return [String]
64
87
  required :chat_id, String
65
88
 
66
89
  # @!method initialize(chat_id:)
67
- # @param chat_id [String]
90
+ # @param chat_id [String] Telegram chat ID. For groups this is typically a negative integer.
68
91
  end
69
92
 
70
93
  class FigmaConfig < Dodopayments::Internal::Type::BaseModel
71
94
  # @!attribute figma_file_id
95
+ # Figma file identifier to grant access to.
72
96
  #
73
97
  # @return [String]
74
98
  required :figma_file_id, String
75
99
 
76
100
  # @!method initialize(figma_file_id:)
77
- # @param figma_file_id [String]
101
+ # @param figma_file_id [String] Figma file identifier to grant access to.
78
102
  end
79
103
 
80
104
  class FramerConfig < Dodopayments::Internal::Type::BaseModel
81
105
  # @!attribute framer_template_id
106
+ # Framer template identifier to grant access to.
82
107
  #
83
108
  # @return [String]
84
109
  required :framer_template_id, String
85
110
 
86
111
  # @!method initialize(framer_template_id:)
87
- # @param framer_template_id [String]
112
+ # @param framer_template_id [String] Framer template identifier to grant access to.
88
113
  end
89
114
 
90
115
  class NotionConfig < Dodopayments::Internal::Type::BaseModel
91
116
  # @!attribute notion_template_id
117
+ # Notion template identifier to grant access to.
92
118
  #
93
119
  # @return [String]
94
120
  required :notion_template_id, String
95
121
 
96
122
  # @!method initialize(notion_template_id:)
97
- # @param notion_template_id [String]
123
+ # @param notion_template_id [String] Notion template identifier to grant access to.
98
124
  end
99
125
 
100
126
  class DigitalFilesConfig < Dodopayments::Internal::Type::BaseModel
101
127
  # @!attribute digital_files
102
- # Populated digital-files payload for entitlement read surfaces. Mirrors
103
- # `DigitalProductDelivery` but is sourced from an entitlement's
104
- # `integration_config` (not a grant) and tags each file with its origin (`legacy`
105
- # vs `ee`).
128
+ # Populated digital-files payload with each file's metadata and a short-lived
129
+ # presigned download URL.
106
130
  #
107
131
  # @return [Dodopayments::Models::IntegrationConfigResponse::DigitalFilesConfig::DigitalFiles]
108
132
  required :digital_files, -> { Dodopayments::IntegrationConfigResponse::DigitalFilesConfig::DigitalFiles }
@@ -112,38 +136,47 @@ module Dodopayments
112
136
  # {Dodopayments::Models::IntegrationConfigResponse::DigitalFilesConfig} for more
113
137
  # details.
114
138
  #
115
- # @param digital_files [Dodopayments::Models::IntegrationConfigResponse::DigitalFilesConfig::DigitalFiles] Populated digital-files payload for entitlement read surfaces. Mirrors
139
+ # @param digital_files [Dodopayments::Models::IntegrationConfigResponse::DigitalFilesConfig::DigitalFiles] Populated digital-files payload with each file's metadata and a
116
140
 
117
141
  # @see Dodopayments::Models::IntegrationConfigResponse::DigitalFilesConfig#digital_files
118
142
  class DigitalFiles < Dodopayments::Internal::Type::BaseModel
119
143
  # @!attribute files
144
+ # One entry per attached file.
120
145
  #
121
146
  # @return [Array<Dodopayments::Models::IntegrationConfigResponse::DigitalFilesConfig::DigitalFiles::File>]
122
147
  required :files,
123
148
  -> { Dodopayments::Internal::Type::ArrayOf[Dodopayments::IntegrationConfigResponse::DigitalFilesConfig::DigitalFiles::File] }
124
149
 
125
150
  # @!attribute external_url
151
+ # Optional external URL, passed through from the entitlement configuration.
126
152
  #
127
153
  # @return [String, nil]
128
154
  optional :external_url, String, nil?: true
129
155
 
130
156
  # @!attribute instructions
157
+ # Optional human-readable delivery instructions, passed through from the
158
+ # entitlement configuration.
131
159
  #
132
160
  # @return [String, nil]
133
161
  optional :instructions, String, nil?: true
134
162
 
135
163
  # @!method initialize(files:, external_url: nil, instructions: nil)
136
- # Populated digital-files payload for entitlement read surfaces. Mirrors
137
- # `DigitalProductDelivery` but is sourced from an entitlement's
138
- # `integration_config` (not a grant) and tags each file with its origin (`legacy`
139
- # vs `ee`).
164
+ # Some parameter documentations has been truncated, see
165
+ # {Dodopayments::Models::IntegrationConfigResponse::DigitalFilesConfig::DigitalFiles}
166
+ # for more details.
167
+ #
168
+ # Populated digital-files payload with each file's metadata and a short-lived
169
+ # presigned download URL.
170
+ #
171
+ # @param files [Array<Dodopayments::Models::IntegrationConfigResponse::DigitalFilesConfig::DigitalFiles::File>] One entry per attached file.
140
172
  #
141
- # @param files [Array<Dodopayments::Models::IntegrationConfigResponse::DigitalFilesConfig::DigitalFiles::File>]
142
- # @param external_url [String, nil]
143
- # @param instructions [String, nil]
173
+ # @param external_url [String, nil] Optional external URL, passed through from the entitlement
174
+ #
175
+ # @param instructions [String, nil] Optional human-readable delivery instructions, passed through from
144
176
 
145
177
  class File < Dodopayments::Internal::Type::BaseModel
146
178
  # @!attribute download_url
179
+ # Short-lived presigned URL for downloading the file.
147
180
  #
148
181
  # @return [String]
149
182
  required :download_url, String
@@ -155,80 +188,87 @@ module Dodopayments
155
188
  required :expires_in, Integer
156
189
 
157
190
  # @!attribute file_id
191
+ # Identifier of the attached file.
158
192
  #
159
193
  # @return [String]
160
194
  required :file_id, String
161
195
 
162
196
  # @!attribute filename
197
+ # Original filename of the attached file.
163
198
  #
164
199
  # @return [String]
165
200
  required :filename, String
166
201
 
167
- # @!attribute source
168
- # `"legacy"` for files in `product_files`, `"ee"` for files managed by the
169
- # Entitlements Engine.
170
- #
171
- # @return [String]
172
- required :source, String
173
-
174
202
  # @!attribute content_type
203
+ # Optional content-type declared at upload.
175
204
  #
176
205
  # @return [String, nil]
177
206
  optional :content_type, String, nil?: true
178
207
 
179
208
  # @!attribute file_size
209
+ # Optional size of the file in bytes.
180
210
  #
181
211
  # @return [Integer, nil]
182
212
  optional :file_size, Integer, nil?: true
183
213
 
184
- # @!method initialize(download_url:, expires_in:, file_id:, filename:, source:, content_type: nil, file_size: nil)
185
- # Some parameter documentations has been truncated, see
186
- # {Dodopayments::Models::IntegrationConfigResponse::DigitalFilesConfig::DigitalFiles::File}
187
- # for more details.
214
+ # @!method initialize(download_url:, expires_in:, file_id:, filename:, content_type: nil, file_size: nil)
215
+ # One file in a resolved digital-files payload.
188
216
  #
189
- # @param download_url [String]
217
+ # @param download_url [String] Short-lived presigned URL for downloading the file.
190
218
  #
191
219
  # @param expires_in [Integer] Seconds until `download_url` expires.
192
220
  #
193
- # @param file_id [String]
194
- #
195
- # @param filename [String]
221
+ # @param file_id [String] Identifier of the attached file.
196
222
  #
197
- # @param source [String] `"legacy"` for files in `product_files`, `"ee"` for files managed by the
223
+ # @param filename [String] Original filename of the attached file.
198
224
  #
199
- # @param content_type [String, nil]
225
+ # @param content_type [String, nil] Optional content-type declared at upload.
200
226
  #
201
- # @param file_size [Integer, nil]
227
+ # @param file_size [Integer, nil] Optional size of the file in bytes.
202
228
  end
203
229
  end
204
230
  end
205
231
 
206
232
  class LicenseKeyConfig < Dodopayments::Internal::Type::BaseModel
207
233
  # @!attribute activation_message
234
+ # Optional message displayed when a customer activates the license key (≤ 2500
235
+ # characters).
208
236
  #
209
237
  # @return [String, nil]
210
238
  optional :activation_message, String, nil?: true
211
239
 
212
240
  # @!attribute activations_limit
241
+ # Maximum activations allowed per issued license key. Omit for unlimited.
213
242
  #
214
243
  # @return [Integer, nil]
215
244
  optional :activations_limit, Integer, nil?: true
216
245
 
217
246
  # @!attribute duration_count
247
+ # Validity duration of issued license keys. Provide both `duration_count` and
248
+ # `duration_interval` together for a fixed duration; omit both for non-expiring
249
+ # keys.
218
250
  #
219
251
  # @return [Integer, nil]
220
252
  optional :duration_count, Integer, nil?: true
221
253
 
222
254
  # @!attribute duration_interval
255
+ # Unit of `duration_count`.
223
256
  #
224
257
  # @return [Symbol, Dodopayments::Models::TimeInterval, nil]
225
258
  optional :duration_interval, enum: -> { Dodopayments::TimeInterval }, nil?: true
226
259
 
227
260
  # @!method initialize(activation_message: nil, activations_limit: nil, duration_count: nil, duration_interval: nil)
228
- # @param activation_message [String, nil]
229
- # @param activations_limit [Integer, nil]
230
- # @param duration_count [Integer, nil]
231
- # @param duration_interval [Symbol, Dodopayments::Models::TimeInterval, nil]
261
+ # Some parameter documentations has been truncated, see
262
+ # {Dodopayments::Models::IntegrationConfigResponse::LicenseKeyConfig} for more
263
+ # details.
264
+ #
265
+ # @param activation_message [String, nil] Optional message displayed when a customer activates the license
266
+ #
267
+ # @param activations_limit [Integer, nil] Maximum activations allowed per issued license key. Omit for unlimited.
268
+ #
269
+ # @param duration_count [Integer, nil] Validity duration of issued license keys. Provide both
270
+ #
271
+ # @param duration_interval [Symbol, Dodopayments::Models::TimeInterval, nil] Unit of `duration_count`.
232
272
  end
233
273
 
234
274
  # @!method self.variants
@@ -23,29 +23,17 @@ module Dodopayments
23
23
  # @!attribute type
24
24
  # The event type
25
25
  #
26
- # @return [Symbol, Dodopayments::Models::LicenseKeyCreatedWebhookEvent::Type]
27
- required :type, enum: -> { Dodopayments::LicenseKeyCreatedWebhookEvent::Type }
26
+ # @return [Symbol, :"license_key.created"]
27
+ required :type, const: :"license_key.created"
28
28
 
29
- # @!method initialize(business_id:, data:, timestamp:, type:)
29
+ # @!method initialize(business_id:, data:, timestamp:, type: :"license_key.created")
30
30
  # @param business_id [String] The business identifier
31
31
  #
32
32
  # @param data [Dodopayments::Models::LicenseKey]
33
33
  #
34
34
  # @param timestamp [Time] The timestamp of when the event occurred
35
35
  #
36
- # @param type [Symbol, Dodopayments::Models::LicenseKeyCreatedWebhookEvent::Type] The event type
37
-
38
- # The event type
39
- #
40
- # @see Dodopayments::Models::LicenseKeyCreatedWebhookEvent#type
41
- module Type
42
- extend Dodopayments::Internal::Type::Enum
43
-
44
- LICENSE_KEY_CREATED = :"license_key.created"
45
-
46
- # @!method self.values
47
- # @return [Array<Symbol>]
48
- end
36
+ # @param type [Symbol, :"license_key.created"] The event type
49
37
  end
50
38
  end
51
39
  end
@@ -139,11 +139,21 @@ module Dodopayments
139
139
  nil?: true
140
140
 
141
141
  # @!attribute discount_id
142
- # The discount id if discount is applied
142
+ # @deprecated Use `discounts` instead.
143
+ #
144
+ # DEPRECATED: Use discounts instead. Returns the first discount's ID if present.
143
145
  #
144
146
  # @return [String, nil]
145
147
  optional :discount_id, String, nil?: true
146
148
 
149
+ # @!attribute discounts
150
+ # All stacked discounts applied, ordered by position
151
+ #
152
+ # @return [Array<Dodopayments::Models::Payment::Discount>, nil]
153
+ optional :discounts,
154
+ -> { Dodopayments::Internal::Type::ArrayOf[Dodopayments::Payment::Discount] },
155
+ nil?: true
156
+
147
157
  # @!attribute error_code
148
158
  # An error code if the payment failed
149
159
  #
@@ -233,7 +243,7 @@ module Dodopayments
233
243
  # @return [Time, nil]
234
244
  optional :updated_at, Time, nil?: true
235
245
 
236
- # @!method initialize(billing:, brand_id:, business_id:, created_at:, currency:, customer:, digital_products_delivered:, disputes:, metadata:, payment_id:, refunds:, settlement_amount:, settlement_currency:, total_amount:, card_holder_name: nil, card_issuing_country: nil, card_last_four: nil, card_network: nil, card_type: nil, checkout_session_id: nil, custom_field_responses: nil, discount_id: nil, error_code: nil, error_message: nil, invoice_id: nil, invoice_url: nil, payment_link: nil, payment_method: nil, payment_method_type: nil, product_cart: nil, refund_status: nil, settlement_tax: nil, status: nil, subscription_id: nil, tax: nil, updated_at: nil)
246
+ # @!method initialize(billing:, brand_id:, business_id:, created_at:, currency:, customer:, digital_products_delivered:, disputes:, metadata:, payment_id:, refunds:, settlement_amount:, settlement_currency:, total_amount:, card_holder_name: nil, card_issuing_country: nil, card_last_four: nil, card_network: nil, card_type: nil, checkout_session_id: nil, custom_field_responses: nil, discount_id: nil, discounts: nil, error_code: nil, error_message: nil, invoice_id: nil, invoice_url: nil, payment_link: nil, payment_method: nil, payment_method_type: nil, product_cart: nil, refund_status: nil, settlement_tax: nil, status: nil, subscription_id: nil, tax: nil, updated_at: nil)
237
247
  # Some parameter documentations has been truncated, see
238
248
  # {Dodopayments::Models::Payment} for more details.
239
249
  #
@@ -279,7 +289,9 @@ module Dodopayments
279
289
  #
280
290
  # @param custom_field_responses [Array<Dodopayments::Models::CustomFieldResponse>, nil] Customer's responses to custom fields collected during checkout
281
291
  #
282
- # @param discount_id [String, nil] The discount id if discount is applied
292
+ # @param discount_id [String, nil] DEPRECATED: Use discounts instead. Returns the first discount's ID if present.
293
+ #
294
+ # @param discounts [Array<Dodopayments::Models::Payment::Discount>, nil] All stacked discounts applied, ordered by position
283
295
  #
284
296
  # @param error_code [String, nil] An error code if the payment failed
285
297
  #
@@ -309,6 +321,144 @@ module Dodopayments
309
321
  #
310
322
  # @param updated_at [Time, nil] Timestamp when the payment was last updated
311
323
 
324
+ class Discount < Dodopayments::Internal::Type::BaseModel
325
+ # @!attribute amount
326
+ # The discount amount (basis points for percentage, USD cents for flat)
327
+ #
328
+ # @return [Integer]
329
+ required :amount, Integer
330
+
331
+ # @!attribute business_id
332
+ # The business this discount belongs to
333
+ #
334
+ # @return [String]
335
+ required :business_id, String
336
+
337
+ # @!attribute code
338
+ # The discount code
339
+ #
340
+ # @return [String]
341
+ required :code, String
342
+
343
+ # @!attribute created_at
344
+ # Timestamp when the discount was created
345
+ #
346
+ # @return [Time]
347
+ required :created_at, Time
348
+
349
+ # @!attribute discount_id
350
+ # The unique discount ID
351
+ #
352
+ # @return [String]
353
+ required :discount_id, String
354
+
355
+ # @!attribute metadata
356
+ # Additional metadata
357
+ #
358
+ # @return [Hash{Symbol=>String}]
359
+ required :metadata, Dodopayments::Internal::Type::HashOf[String]
360
+
361
+ # @!attribute position
362
+ # Position of this discount in the stack (0-based)
363
+ #
364
+ # @return [Integer]
365
+ required :position, Integer
366
+
367
+ # @!attribute preserve_on_plan_change
368
+ # Whether this discount should be preserved when a subscription changes plans
369
+ #
370
+ # @return [Boolean]
371
+ required :preserve_on_plan_change, Dodopayments::Internal::Type::Boolean
372
+
373
+ # @!attribute restricted_to
374
+ # List of product IDs to which this discount is restricted
375
+ #
376
+ # @return [Array<String>]
377
+ required :restricted_to, Dodopayments::Internal::Type::ArrayOf[String]
378
+
379
+ # @!attribute times_used
380
+ # How many times this discount has been used
381
+ #
382
+ # @return [Integer]
383
+ required :times_used, Integer
384
+
385
+ # @!attribute type
386
+ # The type of discount
387
+ #
388
+ # @return [Symbol, Dodopayments::Models::DiscountType]
389
+ required :type, enum: -> { Dodopayments::DiscountType }
390
+
391
+ # @!attribute cycles_remaining
392
+ # Remaining billing cycles for this discount on this subscription (None for
393
+ # one-time payments)
394
+ #
395
+ # @return [Integer, nil]
396
+ optional :cycles_remaining, Integer, nil?: true
397
+
398
+ # @!attribute expires_at
399
+ # Optional date/time after which discount is expired
400
+ #
401
+ # @return [Time, nil]
402
+ optional :expires_at, Time, nil?: true
403
+
404
+ # @!attribute name
405
+ # Name for the Discount
406
+ #
407
+ # @return [String, nil]
408
+ optional :name, String, nil?: true
409
+
410
+ # @!attribute subscription_cycles
411
+ # Number of subscription billing cycles this discount is valid for
412
+ #
413
+ # @return [Integer, nil]
414
+ optional :subscription_cycles, Integer, nil?: true
415
+
416
+ # @!attribute usage_limit
417
+ # Usage limit for this discount, if any
418
+ #
419
+ # @return [Integer, nil]
420
+ optional :usage_limit, Integer, nil?: true
421
+
422
+ # @!method initialize(amount:, business_id:, code:, created_at:, discount_id:, metadata:, position:, preserve_on_plan_change:, restricted_to:, times_used:, type:, cycles_remaining: nil, expires_at: nil, name: nil, subscription_cycles: nil, usage_limit: nil)
423
+ # Some parameter documentations has been truncated, see
424
+ # {Dodopayments::Models::Payment::Discount} for more details.
425
+ #
426
+ # Response struct for a discount with its position in a stack and optional
427
+ # cycle-tracking information (for subscriptions).
428
+ #
429
+ # @param amount [Integer] The discount amount (basis points for percentage, USD cents for flat)
430
+ #
431
+ # @param business_id [String] The business this discount belongs to
432
+ #
433
+ # @param code [String] The discount code
434
+ #
435
+ # @param created_at [Time] Timestamp when the discount was created
436
+ #
437
+ # @param discount_id [String] The unique discount ID
438
+ #
439
+ # @param metadata [Hash{Symbol=>String}] Additional metadata
440
+ #
441
+ # @param position [Integer] Position of this discount in the stack (0-based)
442
+ #
443
+ # @param preserve_on_plan_change [Boolean] Whether this discount should be preserved when a subscription changes plans
444
+ #
445
+ # @param restricted_to [Array<String>] List of product IDs to which this discount is restricted
446
+ #
447
+ # @param times_used [Integer] How many times this discount has been used
448
+ #
449
+ # @param type [Symbol, Dodopayments::Models::DiscountType] The type of discount
450
+ #
451
+ # @param cycles_remaining [Integer, nil] Remaining billing cycles for this discount on this subscription (None for one-ti
452
+ #
453
+ # @param expires_at [Time, nil] Optional date/time after which discount is expired
454
+ #
455
+ # @param name [String, nil] Name for the Discount
456
+ #
457
+ # @param subscription_cycles [Integer, nil] Number of subscription billing cycles this discount is valid for
458
+ #
459
+ # @param usage_limit [Integer, nil] Usage limit for this discount, if any
460
+ end
461
+
312
462
  class ProductCart < Dodopayments::Internal::Type::BaseModel
313
463
  # @!attribute product_id
314
464
  #
@@ -23,29 +23,17 @@ module Dodopayments
23
23
  # @!attribute type
24
24
  # The event type
25
25
  #
26
- # @return [Symbol, Dodopayments::Models::PaymentCancelledWebhookEvent::Type]
27
- required :type, enum: -> { Dodopayments::PaymentCancelledWebhookEvent::Type }
26
+ # @return [Symbol, :"payment.cancelled"]
27
+ required :type, const: :"payment.cancelled"
28
28
 
29
- # @!method initialize(business_id:, data:, timestamp:, type:)
29
+ # @!method initialize(business_id:, data:, timestamp:, type: :"payment.cancelled")
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::PaymentCancelledWebhookEvent::Type] The event type
37
-
38
- # The event type
39
- #
40
- # @see Dodopayments::Models::PaymentCancelledWebhookEvent#type
41
- module Type
42
- extend Dodopayments::Internal::Type::Enum
43
-
44
- PAYMENT_CANCELLED = :"payment.cancelled"
45
-
46
- # @!method self.values
47
- # @return [Array<Symbol>]
48
- end
36
+ # @param type [Symbol, :"payment.cancelled"] The event type
49
37
  end
50
38
  end
51
39
  end
@@ -53,11 +53,21 @@ module Dodopayments
53
53
  optional :billing_currency, enum: -> { Dodopayments::Currency }, nil?: true
54
54
 
55
55
  # @!attribute discount_code
56
- # Discount Code to apply to the transaction
56
+ # @deprecated Use `discount_id` instead.
57
+ #
58
+ # DEPRECATED: Use discount_codes instead. Cannot be used together with
59
+ # discount_codes.
57
60
  #
58
61
  # @return [String, nil]
59
62
  optional :discount_code, String, nil?: true
60
63
 
64
+ # @!attribute discount_codes
65
+ # Stacked discount codes to apply, in order of application. Max 20. Cannot be used
66
+ # together with discount_code.
67
+ #
68
+ # @return [Array<String>, nil]
69
+ optional :discount_codes, Dodopayments::Internal::Type::ArrayOf[String], nil?: true
70
+
61
71
  # @!attribute force_3ds
62
72
  # Override merchant default 3DS behaviour for this payment
63
73
  #
@@ -126,7 +136,7 @@ module Dodopayments
126
136
  # @return [String, nil]
127
137
  optional :tax_id, String, nil?: true
128
138
 
129
- # @!method initialize(billing:, customer:, product_cart:, adaptive_currency_fees_inclusive: nil, allowed_payment_method_types: nil, billing_currency: nil, discount_code: nil, force_3ds: nil, metadata: nil, payment_link: nil, payment_method_id: nil, redirect_immediately: nil, require_phone_number: nil, return_url: nil, short_link: nil, show_saved_payment_methods: nil, tax_id: nil, request_options: {})
139
+ # @!method initialize(billing:, customer:, product_cart:, adaptive_currency_fees_inclusive: nil, allowed_payment_method_types: nil, billing_currency: nil, discount_code: nil, discount_codes: nil, force_3ds: nil, metadata: nil, payment_link: nil, payment_method_id: nil, redirect_immediately: nil, require_phone_number: nil, return_url: nil, short_link: nil, show_saved_payment_methods: nil, tax_id: nil, request_options: {})
130
140
  # Some parameter documentations has been truncated, see
131
141
  # {Dodopayments::Models::PaymentCreateParams} for more details.
132
142
  #
@@ -142,7 +152,9 @@ module Dodopayments
142
152
  #
143
153
  # @param billing_currency [Symbol, Dodopayments::Models::Currency, nil] Fix the currency in which the end customer is billed.
144
154
  #
145
- # @param discount_code [String, nil] Discount Code to apply to the transaction
155
+ # @param discount_code [String, nil] DEPRECATED: Use discount_codes instead. Cannot be used together with discount_co
156
+ #
157
+ # @param discount_codes [Array<String>, nil] Stacked discount codes to apply, in order of application. Max 20.
146
158
  #
147
159
  # @param force_3ds [Boolean, nil] Override merchant default 3DS behaviour for this payment
148
160
  #
@@ -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
  #