dodopayments 2.8.0 → 2.9.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 (195) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +17 -0
  3. data/README.md +1 -1
  4. data/lib/dodopayments/client.rb +4 -0
  5. data/lib/dodopayments/models/attach_product_entitlement.rb +22 -0
  6. data/lib/dodopayments/models/cancellation_feedback.rb +21 -0
  7. data/lib/dodopayments/models/checkout_session_flags.rb +12 -1
  8. data/lib/dodopayments/models/checkout_session_request.rb +14 -1
  9. data/lib/dodopayments/models/credit_entitlements/credit_ledger_entry.rb +1 -0
  10. data/lib/dodopayments/models/credit_overage_reset_webhook_event.rb +52 -0
  11. data/lib/dodopayments/models/customer_list_entitlements_params.rb +20 -0
  12. data/lib/dodopayments/models/customer_list_entitlements_response.rb +105 -0
  13. data/lib/dodopayments/models/digital_product_delivery.rb +13 -15
  14. data/lib/dodopayments/models/digital_product_delivery_file.rb +32 -8
  15. data/lib/dodopayments/models/entitlement.rb +86 -0
  16. data/lib/dodopayments/models/entitlement_create_params.rb +54 -0
  17. data/lib/dodopayments/models/entitlement_delete_params.rb +20 -0
  18. data/lib/dodopayments/models/entitlement_grant_created_webhook_event.rb +51 -0
  19. data/lib/dodopayments/models/entitlement_grant_delivered_webhook_event.rb +51 -0
  20. data/lib/dodopayments/models/entitlement_grant_failed_webhook_event.rb +51 -0
  21. data/lib/dodopayments/models/entitlement_grant_revoked_webhook_event.rb +51 -0
  22. data/lib/dodopayments/models/entitlement_integration_type.rb +21 -0
  23. data/lib/dodopayments/models/entitlement_list_params.rb +55 -0
  24. data/lib/dodopayments/models/entitlement_retrieve_params.rb +20 -0
  25. data/lib/dodopayments/models/entitlement_update_params.rb +54 -0
  26. data/lib/dodopayments/models/entitlements/entitlement_grant.rb +172 -0
  27. data/lib/dodopayments/models/entitlements/file_delete_params.rb +28 -0
  28. data/lib/dodopayments/models/entitlements/file_upload_params.rb +22 -0
  29. data/lib/dodopayments/models/entitlements/file_upload_response.rb +23 -0
  30. data/lib/dodopayments/models/entitlements/grant_list_params.rb +68 -0
  31. data/lib/dodopayments/models/entitlements/grant_revoke_params.rb +28 -0
  32. data/lib/dodopayments/models/entitlements/license_key_grant.rb +40 -0
  33. data/lib/dodopayments/models/integration_config.rb +174 -0
  34. data/lib/dodopayments/models/integration_config_response.rb +238 -0
  35. data/lib/dodopayments/models/license_key_instance_list_params.rb +9 -1
  36. data/lib/dodopayments/models/one_time_product_cart_item.rb +15 -1
  37. data/lib/dodopayments/models/payment.rb +19 -3
  38. data/lib/dodopayments/models/payment_create_params.rb +23 -35
  39. data/lib/dodopayments/models/payment_create_response.rb +3 -33
  40. data/lib/dodopayments/models/product.rb +12 -217
  41. data/lib/dodopayments/models/product_create_params.rb +25 -6
  42. data/lib/dodopayments/models/product_entitlement_summary.rb +57 -0
  43. data/lib/dodopayments/models/product_list_response.rb +3 -218
  44. data/lib/dodopayments/models/product_update_params.rb +21 -7
  45. data/lib/dodopayments/models/scheduled_plan_change.rb +99 -0
  46. data/lib/dodopayments/models/subscription.rb +20 -102
  47. data/lib/dodopayments/models/subscription_create_params.rb +27 -37
  48. data/lib/dodopayments/models/subscription_create_response.rb +19 -3
  49. data/lib/dodopayments/models/subscription_list_response.rb +3 -103
  50. data/lib/dodopayments/models/subscription_update_params.rb +23 -1
  51. data/lib/dodopayments/models/unsafe_unwrap_webhook_event.rb +11 -1
  52. data/lib/dodopayments/models/unwrap_webhook_event.rb +11 -1
  53. data/lib/dodopayments/models/update_subscription_plan_req.rb +10 -1
  54. data/lib/dodopayments/models/webhook_event_type.rb +1 -0
  55. data/lib/dodopayments/models/webhook_payload.rb +2 -154
  56. data/lib/dodopayments/models.rb +40 -0
  57. data/lib/dodopayments/resources/checkout_sessions.rb +6 -2
  58. data/lib/dodopayments/resources/customers.rb +20 -0
  59. data/lib/dodopayments/resources/entitlements/files.rb +70 -0
  60. data/lib/dodopayments/resources/entitlements/grants.rb +78 -0
  61. data/lib/dodopayments/resources/entitlements.rb +153 -0
  62. data/lib/dodopayments/resources/license_key_instances.rb +3 -1
  63. data/lib/dodopayments/resources/payments.rb +6 -2
  64. data/lib/dodopayments/resources/products.rb +4 -4
  65. data/lib/dodopayments/resources/subscriptions.rb +20 -5
  66. data/lib/dodopayments/resources/webhooks.rb +2 -2
  67. data/lib/dodopayments/version.rb +1 -1
  68. data/lib/dodopayments.rb +30 -0
  69. data/rbi/dodopayments/client.rbi +3 -0
  70. data/rbi/dodopayments/models/attach_product_entitlement.rbi +35 -0
  71. data/rbi/dodopayments/models/cancellation_feedback.rbi +45 -0
  72. data/rbi/dodopayments/models/checkout_session_flags.rbi +20 -3
  73. data/rbi/dodopayments/models/checkout_session_request.rbi +18 -0
  74. data/rbi/dodopayments/models/credit_entitlements/credit_ledger_entry.rbi +5 -0
  75. data/rbi/dodopayments/models/credit_overage_reset_webhook_event.rbi +103 -0
  76. data/rbi/dodopayments/models/customer_list_entitlements_params.rbi +38 -0
  77. data/rbi/dodopayments/models/customer_list_entitlements_response.rbi +189 -0
  78. data/rbi/dodopayments/models/digital_product_delivery.rbi +10 -22
  79. data/rbi/dodopayments/models/digital_product_delivery_file.rbi +40 -8
  80. data/rbi/dodopayments/models/entitlement.rbi +112 -0
  81. data/rbi/dodopayments/models/entitlement_create_params.rbi +112 -0
  82. data/rbi/dodopayments/models/entitlement_delete_params.rbi +38 -0
  83. data/rbi/dodopayments/models/entitlement_grant_created_webhook_event.rbi +103 -0
  84. data/rbi/dodopayments/models/entitlement_grant_delivered_webhook_event.rbi +103 -0
  85. data/rbi/dodopayments/models/entitlement_grant_failed_webhook_event.rbi +102 -0
  86. data/rbi/dodopayments/models/entitlement_grant_revoked_webhook_event.rbi +103 -0
  87. data/rbi/dodopayments/models/entitlement_integration_type.rbi +44 -0
  88. data/rbi/dodopayments/models/entitlement_list_params.rbi +146 -0
  89. data/rbi/dodopayments/models/entitlement_retrieve_params.rbi +38 -0
  90. data/rbi/dodopayments/models/entitlement_update_params.rbi +111 -0
  91. data/rbi/dodopayments/models/entitlements/entitlement_grant.rbi +235 -0
  92. data/rbi/dodopayments/models/entitlements/file_delete_params.rbi +48 -0
  93. data/rbi/dodopayments/models/entitlements/file_upload_params.rbi +40 -0
  94. data/rbi/dodopayments/models/entitlements/file_upload_response.rbi +34 -0
  95. data/rbi/dodopayments/models/entitlements/grant_list_params.rbi +145 -0
  96. data/rbi/dodopayments/models/entitlements/grant_revoke_params.rbi +48 -0
  97. data/rbi/dodopayments/models/entitlements/license_key_grant.rbi +62 -0
  98. data/rbi/dodopayments/models/integration_config.rbi +296 -0
  99. data/rbi/dodopayments/models/integration_config_response.rbi +416 -0
  100. data/rbi/dodopayments/models/license_key_instance_list_params.rbi +8 -0
  101. data/rbi/dodopayments/models/one_time_product_cart_item.rbi +24 -3
  102. data/rbi/dodopayments/models/payment.rbi +31 -3
  103. data/rbi/dodopayments/models/payment_create_params.rbi +28 -56
  104. data/rbi/dodopayments/models/payment_create_response.rbi +3 -68
  105. data/rbi/dodopayments/models/product.rbi +12 -420
  106. data/rbi/dodopayments/models/product_create_params.rbi +43 -7
  107. data/rbi/dodopayments/models/product_entitlement_summary.rbi +88 -0
  108. data/rbi/dodopayments/models/product_list_response.rbi +3 -430
  109. data/rbi/dodopayments/models/product_update_params.rbi +35 -9
  110. data/rbi/dodopayments/models/scheduled_plan_change.rbi +141 -0
  111. data/rbi/dodopayments/models/subscription.rbi +24 -149
  112. data/rbi/dodopayments/models/subscription_create_params.rbi +36 -68
  113. data/rbi/dodopayments/models/subscription_create_response.rbi +47 -3
  114. data/rbi/dodopayments/models/subscription_list_response.rbi +4 -167
  115. data/rbi/dodopayments/models/subscription_update_params.rbi +27 -0
  116. data/rbi/dodopayments/models/unsafe_unwrap_webhook_event.rbi +5 -0
  117. data/rbi/dodopayments/models/unwrap_webhook_event.rbi +5 -0
  118. data/rbi/dodopayments/models/update_subscription_plan_req.rbi +10 -0
  119. data/rbi/dodopayments/models/webhook_event_type.rbi +5 -0
  120. data/rbi/dodopayments/models/webhook_payload.rbi +4 -197
  121. data/rbi/dodopayments/models.rbi +46 -0
  122. data/rbi/dodopayments/resources/checkout_sessions.rbi +16 -0
  123. data/rbi/dodopayments/resources/customers.rbi +14 -0
  124. data/rbi/dodopayments/resources/entitlements/files.rbi +52 -0
  125. data/rbi/dodopayments/resources/entitlements/grants.rbi +65 -0
  126. data/rbi/dodopayments/resources/entitlements.rbi +143 -0
  127. data/rbi/dodopayments/resources/license_key_instances.rbi +3 -0
  128. data/rbi/dodopayments/resources/payments.rbi +10 -2
  129. data/rbi/dodopayments/resources/products.rbi +34 -7
  130. data/rbi/dodopayments/resources/subscriptions.rbi +31 -5
  131. data/rbi/dodopayments/resources/webhooks.rbi +10 -0
  132. data/sig/dodopayments/client.rbs +2 -0
  133. data/sig/dodopayments/models/attach_product_entitlement.rbs +13 -0
  134. data/sig/dodopayments/models/cancellation_feedback.rbs +28 -0
  135. data/sig/dodopayments/models/checkout_session_flags.rbs +10 -3
  136. data/sig/dodopayments/models/checkout_session_request.rbs +5 -0
  137. data/sig/dodopayments/models/credit_entitlements/credit_ledger_entry.rbs +2 -0
  138. data/sig/dodopayments/models/credit_overage_reset_webhook_event.rbs +45 -0
  139. data/sig/dodopayments/models/customer_list_entitlements_params.rbs +23 -0
  140. data/sig/dodopayments/models/customer_list_entitlements_response.rbs +95 -0
  141. data/sig/dodopayments/models/digital_product_delivery.rbs +5 -5
  142. data/sig/dodopayments/models/digital_product_delivery_file.rbs +32 -5
  143. data/sig/dodopayments/models/entitlement.rbs +67 -0
  144. data/sig/dodopayments/models/entitlement_create_params.rbs +46 -0
  145. data/sig/dodopayments/models/entitlement_delete_params.rbs +23 -0
  146. data/sig/dodopayments/models/entitlement_grant_created_webhook_event.rbs +45 -0
  147. data/sig/dodopayments/models/entitlement_grant_delivered_webhook_event.rbs +45 -0
  148. data/sig/dodopayments/models/entitlement_grant_failed_webhook_event.rbs +45 -0
  149. data/sig/dodopayments/models/entitlement_grant_revoked_webhook_event.rbs +45 -0
  150. data/sig/dodopayments/models/entitlement_integration_type.rbs +28 -0
  151. data/sig/dodopayments/models/entitlement_list_params.rbs +69 -0
  152. data/sig/dodopayments/models/entitlement_retrieve_params.rbs +23 -0
  153. data/sig/dodopayments/models/entitlement_update_params.rbs +46 -0
  154. data/sig/dodopayments/models/entitlements/entitlement_grant.rbs +134 -0
  155. data/sig/dodopayments/models/entitlements/file_delete_params.rbs +30 -0
  156. data/sig/dodopayments/models/entitlements/file_upload_params.rbs +25 -0
  157. data/sig/dodopayments/models/entitlements/file_upload_response.rbs +15 -0
  158. data/sig/dodopayments/models/entitlements/grant_list_params.rbs +71 -0
  159. data/sig/dodopayments/models/entitlements/grant_revoke_params.rbs +30 -0
  160. data/sig/dodopayments/models/entitlements/license_key_grant.rbs +37 -0
  161. data/sig/dodopayments/models/integration_config.rbs +147 -0
  162. data/sig/dodopayments/models/integration_config_response.rbs +206 -0
  163. data/sig/dodopayments/models/license_key_instance_list_params.rbs +10 -1
  164. data/sig/dodopayments/models/one_time_product_cart_item.rbs +14 -3
  165. data/sig/dodopayments/models/payment.rbs +16 -4
  166. data/sig/dodopayments/models/payment_create_params.rbs +16 -27
  167. data/sig/dodopayments/models/payment_create_response.rbs +4 -27
  168. data/sig/dodopayments/models/product.rbs +4 -205
  169. data/sig/dodopayments/models/product_create_params.rbs +4 -4
  170. data/sig/dodopayments/models/product_entitlement_summary.rbs +40 -0
  171. data/sig/dodopayments/models/product_list_response.rbs +4 -205
  172. data/sig/dodopayments/models/product_update_params.rbs +4 -4
  173. data/sig/dodopayments/models/scheduled_plan_change.rbs +73 -0
  174. data/sig/dodopayments/models/subscription.rbs +14 -74
  175. data/sig/dodopayments/models/subscription_create_params.rbs +16 -27
  176. data/sig/dodopayments/models/subscription_create_response.rbs +16 -4
  177. data/sig/dodopayments/models/subscription_list_response.rbs +4 -74
  178. data/sig/dodopayments/models/subscription_update_params.rbs +12 -0
  179. data/sig/dodopayments/models/unsafe_unwrap_webhook_event.rbs +5 -0
  180. data/sig/dodopayments/models/unwrap_webhook_event.rbs +5 -0
  181. data/sig/dodopayments/models/update_subscription_plan_req.rbs +5 -0
  182. data/sig/dodopayments/models/webhook_event_type.rbs +2 -0
  183. data/sig/dodopayments/models/webhook_payload.rbs +8 -134
  184. data/sig/dodopayments/models.rbs +40 -0
  185. data/sig/dodopayments/resources/checkout_sessions.rbs +2 -0
  186. data/sig/dodopayments/resources/customers.rbs +5 -0
  187. data/sig/dodopayments/resources/entitlements/files.rbs +20 -0
  188. data/sig/dodopayments/resources/entitlements/grants.rbs +24 -0
  189. data/sig/dodopayments/resources/entitlements.rbs +46 -0
  190. data/sig/dodopayments/resources/license_key_instances.rbs +1 -0
  191. data/sig/dodopayments/resources/payments.rbs +3 -1
  192. data/sig/dodopayments/resources/products.rbs +2 -2
  193. data/sig/dodopayments/resources/subscriptions.rbs +7 -1
  194. data/sig/dodopayments/resources/webhooks.rbs +10 -0
  195. metadata +92 -2
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dodopayments
4
+ module Models
5
+ module Entitlements
6
+ # @see Dodopayments::Resources::Entitlements::Grants#revoke
7
+ class GrantRevokeParams < Dodopayments::Internal::Type::BaseModel
8
+ extend Dodopayments::Internal::Type::RequestParameters::Converter
9
+ include Dodopayments::Internal::Type::RequestParameters
10
+
11
+ # @!attribute id
12
+ #
13
+ # @return [String]
14
+ required :id, String
15
+
16
+ # @!attribute grant_id
17
+ #
18
+ # @return [String]
19
+ required :grant_id, String
20
+
21
+ # @!method initialize(id:, grant_id:, request_options: {})
22
+ # @param id [String]
23
+ # @param grant_id [String]
24
+ # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}]
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dodopayments
4
+ module Models
5
+ module Entitlements
6
+ class LicenseKeyGrant < Dodopayments::Internal::Type::BaseModel
7
+ # @!attribute activations_used
8
+ #
9
+ # @return [Integer]
10
+ required :activations_used, Integer
11
+
12
+ # @!attribute key
13
+ #
14
+ # @return [String]
15
+ required :key, String
16
+
17
+ # @!attribute activations_limit
18
+ #
19
+ # @return [Integer, nil]
20
+ optional :activations_limit, Integer, nil?: true
21
+
22
+ # @!attribute expires_at
23
+ #
24
+ # @return [Time, nil]
25
+ optional :expires_at, Time, nil?: true
26
+
27
+ # @!method initialize(activations_used:, key:, activations_limit: nil, expires_at: nil)
28
+ # Nested representation of license-key grant fields. Present only when the grant's
29
+ # entitlement has `integration_type = 'license_key'` and a row exists in
30
+ # `license_keys`. The grant's top-level `status` is the source of truth for the
31
+ # grant's lifecycle — no per-license-key status is exposed here.
32
+ #
33
+ # @param activations_used [Integer]
34
+ # @param key [String]
35
+ # @param activations_limit [Integer, nil]
36
+ # @param expires_at [Time, nil]
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,174 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dodopayments
4
+ module Models
5
+ # Platform-specific configuration for an entitlement. Each variant uses unique
6
+ # field names so `#[serde(untagged)]` can disambiguate correctly.
7
+ module IntegrationConfig
8
+ extend Dodopayments::Internal::Type::Union
9
+
10
+ variant -> { Dodopayments::IntegrationConfig::GitHubConfig }
11
+
12
+ variant -> { Dodopayments::IntegrationConfig::DiscordConfig }
13
+
14
+ variant -> { Dodopayments::IntegrationConfig::TelegramConfig }
15
+
16
+ variant -> { Dodopayments::IntegrationConfig::FigmaConfig }
17
+
18
+ variant -> { Dodopayments::IntegrationConfig::FramerConfig }
19
+
20
+ variant -> { Dodopayments::IntegrationConfig::NotionConfig }
21
+
22
+ variant -> { Dodopayments::IntegrationConfig::DigitalFilesConfig }
23
+
24
+ variant -> { Dodopayments::IntegrationConfig::LicenseKeyConfig }
25
+
26
+ class GitHubConfig < Dodopayments::Internal::Type::BaseModel
27
+ # @!attribute permission
28
+ # One of: pull, push, admin, maintain, triage
29
+ #
30
+ # @return [String]
31
+ required :permission, String
32
+
33
+ # @!attribute target_id
34
+ #
35
+ # @return [String]
36
+ required :target_id, String
37
+
38
+ # @!method initialize(permission:, target_id:)
39
+ # @param permission [String] One of: pull, push, admin, maintain, triage
40
+ #
41
+ # @param target_id [String]
42
+ end
43
+
44
+ class DiscordConfig < Dodopayments::Internal::Type::BaseModel
45
+ # @!attribute guild_id
46
+ #
47
+ # @return [String]
48
+ required :guild_id, String
49
+
50
+ # @!attribute role_id
51
+ #
52
+ # @return [String, nil]
53
+ optional :role_id, String, nil?: true
54
+
55
+ # @!method initialize(guild_id:, role_id: nil)
56
+ # @param guild_id [String]
57
+ # @param role_id [String, nil]
58
+ end
59
+
60
+ class TelegramConfig < Dodopayments::Internal::Type::BaseModel
61
+ # @!attribute chat_id
62
+ #
63
+ # @return [String]
64
+ required :chat_id, String
65
+
66
+ # @!method initialize(chat_id:)
67
+ # @param chat_id [String]
68
+ end
69
+
70
+ class FigmaConfig < Dodopayments::Internal::Type::BaseModel
71
+ # @!attribute figma_file_id
72
+ #
73
+ # @return [String]
74
+ required :figma_file_id, String
75
+
76
+ # @!method initialize(figma_file_id:)
77
+ # @param figma_file_id [String]
78
+ end
79
+
80
+ class FramerConfig < Dodopayments::Internal::Type::BaseModel
81
+ # @!attribute framer_template_id
82
+ #
83
+ # @return [String]
84
+ required :framer_template_id, String
85
+
86
+ # @!method initialize(framer_template_id:)
87
+ # @param framer_template_id [String]
88
+ end
89
+
90
+ class NotionConfig < Dodopayments::Internal::Type::BaseModel
91
+ # @!attribute notion_template_id
92
+ #
93
+ # @return [String]
94
+ required :notion_template_id, String
95
+
96
+ # @!method initialize(notion_template_id:)
97
+ # @param notion_template_id [String]
98
+ end
99
+
100
+ class DigitalFilesConfig < Dodopayments::Internal::Type::BaseModel
101
+ # @!attribute digital_file_ids
102
+ #
103
+ # @return [Array<String>]
104
+ required :digital_file_ids, Dodopayments::Internal::Type::ArrayOf[String]
105
+
106
+ # @!attribute external_url
107
+ #
108
+ # @return [String, nil]
109
+ optional :external_url, String, nil?: true
110
+
111
+ # @!attribute instructions
112
+ #
113
+ # @return [String, nil]
114
+ optional :instructions, String, nil?: true
115
+
116
+ # @!attribute legacy_file_ids
117
+ # Three-way patchable field (mirrors the credit_entitlements pattern):
118
+ #
119
+ # - omitted → preserve persisted (`None`)
120
+ # - `null` → clear (`Some(None)`)
121
+ # - `[...]` → replace (`Some(Some(...))`)
122
+ #
123
+ # On Create / storage we collapse "clear" and empty-array to `None` so the
124
+ # persisted JSONB never carries a `null` legacy_file_ids key.
125
+ #
126
+ # @return [Array<String>, nil]
127
+ optional :legacy_file_ids, Dodopayments::Internal::Type::ArrayOf[String], nil?: true
128
+
129
+ # @!method initialize(digital_file_ids:, external_url: nil, instructions: nil, legacy_file_ids: nil)
130
+ # Some parameter documentations has been truncated, see
131
+ # {Dodopayments::Models::IntegrationConfig::DigitalFilesConfig} for more details.
132
+ #
133
+ # @param digital_file_ids [Array<String>]
134
+ #
135
+ # @param external_url [String, nil]
136
+ #
137
+ # @param instructions [String, nil]
138
+ #
139
+ # @param legacy_file_ids [Array<String>, nil] Three-way patchable field (mirrors the credit_entitlements pattern):
140
+ end
141
+
142
+ class LicenseKeyConfig < Dodopayments::Internal::Type::BaseModel
143
+ # @!attribute activation_message
144
+ #
145
+ # @return [String, nil]
146
+ optional :activation_message, String, nil?: true
147
+
148
+ # @!attribute activations_limit
149
+ #
150
+ # @return [Integer, nil]
151
+ optional :activations_limit, Integer, nil?: true
152
+
153
+ # @!attribute duration_count
154
+ #
155
+ # @return [Integer, nil]
156
+ optional :duration_count, Integer, nil?: true
157
+
158
+ # @!attribute duration_interval
159
+ #
160
+ # @return [Symbol, Dodopayments::Models::TimeInterval, nil]
161
+ optional :duration_interval, enum: -> { Dodopayments::TimeInterval }, nil?: true
162
+
163
+ # @!method initialize(activation_message: nil, activations_limit: nil, duration_count: nil, duration_interval: nil)
164
+ # @param activation_message [String, nil]
165
+ # @param activations_limit [Integer, nil]
166
+ # @param duration_count [Integer, nil]
167
+ # @param duration_interval [Symbol, Dodopayments::Models::TimeInterval, nil]
168
+ end
169
+
170
+ # @!method self.variants
171
+ # @return [Array(Dodopayments::Models::IntegrationConfig::GitHubConfig, Dodopayments::Models::IntegrationConfig::DiscordConfig, Dodopayments::Models::IntegrationConfig::TelegramConfig, Dodopayments::Models::IntegrationConfig::FigmaConfig, Dodopayments::Models::IntegrationConfig::FramerConfig, Dodopayments::Models::IntegrationConfig::NotionConfig, Dodopayments::Models::IntegrationConfig::DigitalFilesConfig, Dodopayments::Models::IntegrationConfig::LicenseKeyConfig)]
172
+ end
173
+ end
174
+ end
@@ -0,0 +1,238 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dodopayments
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.
9
+ module IntegrationConfigResponse
10
+ extend Dodopayments::Internal::Type::Union
11
+
12
+ variant -> { Dodopayments::IntegrationConfigResponse::GitHubConfig }
13
+
14
+ variant -> { Dodopayments::IntegrationConfigResponse::DiscordConfig }
15
+
16
+ variant -> { Dodopayments::IntegrationConfigResponse::TelegramConfig }
17
+
18
+ variant -> { Dodopayments::IntegrationConfigResponse::FigmaConfig }
19
+
20
+ variant -> { Dodopayments::IntegrationConfigResponse::FramerConfig }
21
+
22
+ variant -> { Dodopayments::IntegrationConfigResponse::NotionConfig }
23
+
24
+ variant -> { Dodopayments::IntegrationConfigResponse::DigitalFilesConfig }
25
+
26
+ variant -> { Dodopayments::IntegrationConfigResponse::LicenseKeyConfig }
27
+
28
+ class GitHubConfig < Dodopayments::Internal::Type::BaseModel
29
+ # @!attribute permission
30
+ #
31
+ # @return [String]
32
+ required :permission, String
33
+
34
+ # @!attribute target_id
35
+ #
36
+ # @return [String]
37
+ required :target_id, String
38
+
39
+ # @!method initialize(permission:, target_id:)
40
+ # @param permission [String]
41
+ # @param target_id [String]
42
+ end
43
+
44
+ class DiscordConfig < Dodopayments::Internal::Type::BaseModel
45
+ # @!attribute guild_id
46
+ #
47
+ # @return [String]
48
+ required :guild_id, String
49
+
50
+ # @!attribute role_id
51
+ #
52
+ # @return [String, nil]
53
+ optional :role_id, String, nil?: true
54
+
55
+ # @!method initialize(guild_id:, role_id: nil)
56
+ # @param guild_id [String]
57
+ # @param role_id [String, nil]
58
+ end
59
+
60
+ class TelegramConfig < Dodopayments::Internal::Type::BaseModel
61
+ # @!attribute chat_id
62
+ #
63
+ # @return [String]
64
+ required :chat_id, String
65
+
66
+ # @!method initialize(chat_id:)
67
+ # @param chat_id [String]
68
+ end
69
+
70
+ class FigmaConfig < Dodopayments::Internal::Type::BaseModel
71
+ # @!attribute figma_file_id
72
+ #
73
+ # @return [String]
74
+ required :figma_file_id, String
75
+
76
+ # @!method initialize(figma_file_id:)
77
+ # @param figma_file_id [String]
78
+ end
79
+
80
+ class FramerConfig < Dodopayments::Internal::Type::BaseModel
81
+ # @!attribute framer_template_id
82
+ #
83
+ # @return [String]
84
+ required :framer_template_id, String
85
+
86
+ # @!method initialize(framer_template_id:)
87
+ # @param framer_template_id [String]
88
+ end
89
+
90
+ class NotionConfig < Dodopayments::Internal::Type::BaseModel
91
+ # @!attribute notion_template_id
92
+ #
93
+ # @return [String]
94
+ required :notion_template_id, String
95
+
96
+ # @!method initialize(notion_template_id:)
97
+ # @param notion_template_id [String]
98
+ end
99
+
100
+ class DigitalFilesConfig < Dodopayments::Internal::Type::BaseModel
101
+ # @!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`).
106
+ #
107
+ # @return [Dodopayments::Models::IntegrationConfigResponse::DigitalFilesConfig::DigitalFiles]
108
+ required :digital_files, -> { Dodopayments::IntegrationConfigResponse::DigitalFilesConfig::DigitalFiles }
109
+
110
+ # @!method initialize(digital_files:)
111
+ # Some parameter documentations has been truncated, see
112
+ # {Dodopayments::Models::IntegrationConfigResponse::DigitalFilesConfig} for more
113
+ # details.
114
+ #
115
+ # @param digital_files [Dodopayments::Models::IntegrationConfigResponse::DigitalFilesConfig::DigitalFiles] Populated digital-files payload for entitlement read surfaces. Mirrors
116
+
117
+ # @see Dodopayments::Models::IntegrationConfigResponse::DigitalFilesConfig#digital_files
118
+ class DigitalFiles < Dodopayments::Internal::Type::BaseModel
119
+ # @!attribute files
120
+ #
121
+ # @return [Array<Dodopayments::Models::IntegrationConfigResponse::DigitalFilesConfig::DigitalFiles::File>]
122
+ required :files,
123
+ -> { Dodopayments::Internal::Type::ArrayOf[Dodopayments::IntegrationConfigResponse::DigitalFilesConfig::DigitalFiles::File] }
124
+
125
+ # @!attribute external_url
126
+ #
127
+ # @return [String, nil]
128
+ optional :external_url, String, nil?: true
129
+
130
+ # @!attribute instructions
131
+ #
132
+ # @return [String, nil]
133
+ optional :instructions, String, nil?: true
134
+
135
+ # @!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`).
140
+ #
141
+ # @param files [Array<Dodopayments::Models::IntegrationConfigResponse::DigitalFilesConfig::DigitalFiles::File>]
142
+ # @param external_url [String, nil]
143
+ # @param instructions [String, nil]
144
+
145
+ class File < Dodopayments::Internal::Type::BaseModel
146
+ # @!attribute download_url
147
+ #
148
+ # @return [String]
149
+ required :download_url, String
150
+
151
+ # @!attribute expires_in
152
+ # Seconds until `download_url` expires.
153
+ #
154
+ # @return [Integer]
155
+ required :expires_in, Integer
156
+
157
+ # @!attribute file_id
158
+ #
159
+ # @return [String]
160
+ required :file_id, String
161
+
162
+ # @!attribute filename
163
+ #
164
+ # @return [String]
165
+ required :filename, String
166
+
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
+ # @!attribute content_type
175
+ #
176
+ # @return [String, nil]
177
+ optional :content_type, String, nil?: true
178
+
179
+ # @!attribute file_size
180
+ #
181
+ # @return [Integer, nil]
182
+ optional :file_size, Integer, nil?: true
183
+
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.
188
+ #
189
+ # @param download_url [String]
190
+ #
191
+ # @param expires_in [Integer] Seconds until `download_url` expires.
192
+ #
193
+ # @param file_id [String]
194
+ #
195
+ # @param filename [String]
196
+ #
197
+ # @param source [String] `"legacy"` for files in `product_files`, `"ee"` for files managed by the
198
+ #
199
+ # @param content_type [String, nil]
200
+ #
201
+ # @param file_size [Integer, nil]
202
+ end
203
+ end
204
+ end
205
+
206
+ class LicenseKeyConfig < Dodopayments::Internal::Type::BaseModel
207
+ # @!attribute activation_message
208
+ #
209
+ # @return [String, nil]
210
+ optional :activation_message, String, nil?: true
211
+
212
+ # @!attribute activations_limit
213
+ #
214
+ # @return [Integer, nil]
215
+ optional :activations_limit, Integer, nil?: true
216
+
217
+ # @!attribute duration_count
218
+ #
219
+ # @return [Integer, nil]
220
+ optional :duration_count, Integer, nil?: true
221
+
222
+ # @!attribute duration_interval
223
+ #
224
+ # @return [Symbol, Dodopayments::Models::TimeInterval, nil]
225
+ optional :duration_interval, enum: -> { Dodopayments::TimeInterval }, nil?: true
226
+
227
+ # @!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]
232
+ end
233
+
234
+ # @!method self.variants
235
+ # @return [Array(Dodopayments::Models::IntegrationConfigResponse::GitHubConfig, Dodopayments::Models::IntegrationConfigResponse::DiscordConfig, Dodopayments::Models::IntegrationConfigResponse::TelegramConfig, Dodopayments::Models::IntegrationConfigResponse::FigmaConfig, Dodopayments::Models::IntegrationConfigResponse::FramerConfig, Dodopayments::Models::IntegrationConfigResponse::NotionConfig, Dodopayments::Models::IntegrationConfigResponse::DigitalFilesConfig, Dodopayments::Models::IntegrationConfigResponse::LicenseKeyConfig)]
236
+ end
237
+ end
238
+ end
@@ -7,6 +7,12 @@ module Dodopayments
7
7
  extend Dodopayments::Internal::Type::RequestParameters::Converter
8
8
  include Dodopayments::Internal::Type::RequestParameters
9
9
 
10
+ # @!attribute grant_id
11
+ # Filter instances by entitlement grant ID
12
+ #
13
+ # @return [String, nil]
14
+ optional :grant_id, String, nil?: true
15
+
10
16
  # @!attribute license_key_id
11
17
  # Filter by license key ID
12
18
  #
@@ -25,7 +31,9 @@ module Dodopayments
25
31
  # @return [Integer, nil]
26
32
  optional :page_size, Integer, nil?: true
27
33
 
28
- # @!method initialize(license_key_id: nil, page_number: nil, page_size: nil, request_options: {})
34
+ # @!method initialize(grant_id: nil, license_key_id: nil, page_number: nil, page_size: nil, request_options: {})
35
+ # @param grant_id [String, nil] Filter instances by entitlement grant ID
36
+ #
29
37
  # @param license_key_id [String, nil] Filter by license key ID
30
38
  #
31
39
  # @param page_number [Integer, nil] Page number default is 0
@@ -13,9 +13,23 @@ module Dodopayments
13
13
  # @return [Integer]
14
14
  required :quantity, Integer
15
15
 
16
- # @!method initialize(product_id:, quantity:)
16
+ # @!attribute amount
17
+ # Amount the customer pays if pay_what_you_want is enabled. If disabled then
18
+ # amount will be ignored Represented in the lowest denomination of the currency
19
+ # (e.g., cents for USD). For example, to charge $1.00, pass `100`.
20
+ #
21
+ # @return [Integer, nil]
22
+ optional :amount, Integer, nil?: true
23
+
24
+ # @!method initialize(product_id:, quantity:, amount: nil)
25
+ # Some parameter documentations has been truncated, see
26
+ # {Dodopayments::Models::OneTimeProductCartItem} for more details.
27
+ #
17
28
  # @param product_id [String]
29
+ #
18
30
  # @param quantity [Integer]
31
+ #
32
+ # @param amount [Integer, nil] Amount the customer pays if pay_what_you_want is enabled. If disabled then amoun
19
33
  end
20
34
  end
21
35
  end
@@ -189,9 +189,9 @@ module Dodopayments
189
189
  # @!attribute product_cart
190
190
  # List of products purchased in a one-time payment
191
191
  #
192
- # @return [Array<Dodopayments::Models::OneTimeProductCartItem>, nil]
192
+ # @return [Array<Dodopayments::Models::Payment::ProductCart>, nil]
193
193
  optional :product_cart,
194
- -> { Dodopayments::Internal::Type::ArrayOf[Dodopayments::OneTimeProductCartItem] },
194
+ -> { Dodopayments::Internal::Type::ArrayOf[Dodopayments::Payment::ProductCart] },
195
195
  nil?: true
196
196
 
197
197
  # @!attribute refund_status
@@ -295,7 +295,7 @@ module Dodopayments
295
295
  #
296
296
  # @param payment_method_type [String, nil] Specific type of payment method (e.g. "visa", "mastercard")
297
297
  #
298
- # @param product_cart [Array<Dodopayments::Models::OneTimeProductCartItem>, nil] List of products purchased in a one-time payment
298
+ # @param product_cart [Array<Dodopayments::Models::Payment::ProductCart>, nil] List of products purchased in a one-time payment
299
299
  #
300
300
  # @param refund_status [Symbol, Dodopayments::Models::PaymentRefundStatus, nil] Summary of the refund status for this payment. None if no succeeded refunds exis
301
301
  #
@@ -308,6 +308,22 @@ module Dodopayments
308
308
  # @param tax [Integer, nil] Amount of tax collected in smallest currency unit (e.g. cents)
309
309
  #
310
310
  # @param updated_at [Time, nil] Timestamp when the payment was last updated
311
+
312
+ class ProductCart < Dodopayments::Internal::Type::BaseModel
313
+ # @!attribute product_id
314
+ #
315
+ # @return [String]
316
+ required :product_id, String
317
+
318
+ # @!attribute quantity
319
+ #
320
+ # @return [Integer]
321
+ required :quantity, Integer
322
+
323
+ # @!method initialize(product_id:, quantity:)
324
+ # @param product_id [String]
325
+ # @param quantity [Integer]
326
+ end
311
327
  end
312
328
  end
313
329
  end
@@ -22,9 +22,15 @@ module Dodopayments
22
22
  # @!attribute product_cart
23
23
  # List of products in the cart. Must contain at least 1 and at most 100 items.
24
24
  #
25
- # @return [Array<Dodopayments::Models::PaymentCreateParams::ProductCart>]
26
- required :product_cart,
27
- -> { Dodopayments::Internal::Type::ArrayOf[Dodopayments::PaymentCreateParams::ProductCart] }
25
+ # @return [Array<Dodopayments::Models::OneTimeProductCartItem>]
26
+ required :product_cart, -> { Dodopayments::Internal::Type::ArrayOf[Dodopayments::OneTimeProductCartItem] }
27
+
28
+ # @!attribute adaptive_currency_fees_inclusive
29
+ # Whether adaptive currency fees should be included in the price (true) or added
30
+ # on top (false). If not specified, defaults to the business-level setting.
31
+ #
32
+ # @return [Boolean, nil]
33
+ optional :adaptive_currency_fees_inclusive, Dodopayments::Internal::Type::Boolean, nil?: true
28
34
 
29
35
  # @!attribute allowed_payment_method_types
30
36
  # List of payment methods allowed during checkout.
@@ -86,6 +92,14 @@ module Dodopayments
86
92
  # @return [Boolean, nil]
87
93
  optional :redirect_immediately, Dodopayments::Internal::Type::Boolean
88
94
 
95
+ # @!attribute require_phone_number
96
+ # If true, the customer's phone number is required to create this payment.
97
+ # Typically set alongside `payment_link=true` so merchants can enforce phone
98
+ # collection on the hosted payment page. Defaults to false.
99
+ #
100
+ # @return [Boolean, nil]
101
+ optional :require_phone_number, Dodopayments::Internal::Type::Boolean
102
+
89
103
  # @!attribute return_url
90
104
  # Optional URL to redirect the customer after payment. Must be a valid URL if
91
105
  # provided.
@@ -112,7 +126,7 @@ module Dodopayments
112
126
  # @return [String, nil]
113
127
  optional :tax_id, String, nil?: true
114
128
 
115
- # @!method initialize(billing:, customer:, product_cart:, 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, return_url: nil, short_link: nil, show_saved_payment_methods: nil, tax_id: nil, request_options: {})
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: {})
116
130
  # Some parameter documentations has been truncated, see
117
131
  # {Dodopayments::Models::PaymentCreateParams} for more details.
118
132
  #
@@ -120,7 +134,9 @@ module Dodopayments
120
134
  #
121
135
  # @param customer [Dodopayments::Models::AttachExistingCustomer, Dodopayments::Models::NewCustomer] Customer information for the payment
122
136
  #
123
- # @param product_cart [Array<Dodopayments::Models::PaymentCreateParams::ProductCart>] List of products in the cart. Must contain at least 1 and at most 100 items.
137
+ # @param product_cart [Array<Dodopayments::Models::OneTimeProductCartItem>] List of products in the cart. Must contain at least 1 and at most 100 items.
138
+ #
139
+ # @param adaptive_currency_fees_inclusive [Boolean, nil] Whether adaptive currency fees should be included in the price (true) or added o
124
140
  #
125
141
  # @param allowed_payment_method_types [Array<Symbol, Dodopayments::Models::PaymentMethodTypes>, nil] List of payment methods allowed during checkout.
126
142
  #
@@ -138,6 +154,8 @@ module Dodopayments
138
154
  #
139
155
  # @param redirect_immediately [Boolean] If true, redirects the customer immediately after payment completion
140
156
  #
157
+ # @param require_phone_number [Boolean] If true, the customer's phone number is required to create this payment.
158
+ #
141
159
  # @param return_url [String, nil] Optional URL to redirect the customer after payment.
142
160
  #
143
161
  # @param short_link [Boolean, nil] If true, returns a shortened payment link.
@@ -147,36 +165,6 @@ module Dodopayments
147
165
  # @param tax_id [String, nil] Tax ID in case the payment is B2B. If tax id validation fails the payment creati
148
166
  #
149
167
  # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}]
150
-
151
- class ProductCart < Dodopayments::Internal::Type::BaseModel
152
- # @!attribute product_id
153
- #
154
- # @return [String]
155
- required :product_id, String
156
-
157
- # @!attribute quantity
158
- #
159
- # @return [Integer]
160
- required :quantity, Integer
161
-
162
- # @!attribute amount
163
- # Amount the customer pays if pay_what_you_want is enabled. If disabled then
164
- # amount will be ignored Represented in the lowest denomination of the currency
165
- # (e.g., cents for USD). For example, to charge $1.00, pass `100`.
166
- #
167
- # @return [Integer, nil]
168
- optional :amount, Integer, nil?: true
169
-
170
- # @!method initialize(product_id:, quantity:, amount: nil)
171
- # Some parameter documentations has been truncated, see
172
- # {Dodopayments::Models::PaymentCreateParams::ProductCart} for more details.
173
- #
174
- # @param product_id [String]
175
- #
176
- # @param quantity [Integer]
177
- #
178
- # @param amount [Integer, nil] Amount the customer pays if pay_what_you_want is enabled. If disabled then amoun
179
- end
180
168
  end
181
169
  end
182
170
  end