dodopayments 2.10.0 → 2.11.1

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 (156) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +22 -0
  3. data/README.md +9 -9
  4. data/lib/dodopayments/client.rb +4 -0
  5. data/lib/dodopayments/models/checkout_session_flags.rb +15 -1
  6. data/lib/dodopayments/models/checkout_session_request.rb +11 -1
  7. data/lib/dodopayments/models/checkout_session_response.rb +33 -1
  8. data/lib/dodopayments/models/discount_detail.rb +143 -0
  9. data/lib/dodopayments/models/filter_type.rb +71 -0
  10. data/lib/dodopayments/models/github_permission.rb +19 -0
  11. data/lib/dodopayments/models/integration_config.rb +3 -19
  12. data/lib/dodopayments/models/integration_config_response.rb +3 -19
  13. data/lib/dodopayments/models/invoices/payment_retrieve_payout_params.rb +22 -0
  14. data/lib/dodopayments/models/meter_filter.rb +3 -331
  15. data/lib/dodopayments/models/payment.rb +3 -141
  16. data/lib/dodopayments/models/payment_create_params.rb +11 -1
  17. data/lib/dodopayments/models/payment_method_types.rb +1 -0
  18. data/lib/dodopayments/models/product_collection.rb +74 -0
  19. data/lib/dodopayments/models/product_collection_create_params.rb +47 -0
  20. data/lib/dodopayments/models/product_collection_delete_params.rb +20 -0
  21. data/lib/dodopayments/models/product_collection_list_params.rb +46 -0
  22. data/lib/dodopayments/models/product_collection_list_response.rb +65 -0
  23. data/lib/dodopayments/models/product_collection_retrieve_params.rb +20 -0
  24. data/lib/dodopayments/models/product_collection_unarchive_params.rb +20 -0
  25. data/lib/dodopayments/models/product_collection_unarchive_response.rb +33 -0
  26. data/lib/dodopayments/models/product_collection_update_images_params.rb +29 -0
  27. data/lib/dodopayments/models/product_collection_update_images_response.rb +25 -0
  28. data/lib/dodopayments/models/product_collection_update_params.rb +61 -0
  29. data/lib/dodopayments/models/product_collections/group_create_params.rb +22 -0
  30. data/lib/dodopayments/models/product_collections/group_delete_params.rb +28 -0
  31. data/lib/dodopayments/models/product_collections/group_product.rb +26 -0
  32. data/lib/dodopayments/models/product_collections/group_update_params.rb +59 -0
  33. data/lib/dodopayments/models/product_collections/groups/item_create_params.rb +41 -0
  34. data/lib/dodopayments/models/product_collections/groups/item_create_response.rb +15 -0
  35. data/lib/dodopayments/models/product_collections/groups/item_delete_params.rb +36 -0
  36. data/lib/dodopayments/models/product_collections/groups/item_update_params.rb +47 -0
  37. data/lib/dodopayments/models/product_collections/groups/product_collection_product.rb +132 -0
  38. data/lib/dodopayments/models/product_collections/product_collection_group_details.rb +42 -0
  39. data/lib/dodopayments/models/product_collections/product_collection_group_response.rb +39 -0
  40. data/lib/dodopayments/models/subscription.rb +13 -142
  41. data/lib/dodopayments/models/subscription_create_params.rb +11 -1
  42. data/lib/dodopayments/models/subscription_list_response.rb +10 -1
  43. data/lib/dodopayments/models/subscription_update_params.rb +12 -1
  44. data/lib/dodopayments/models/subscription_update_payment_method_params.rb +9 -9
  45. data/lib/dodopayments/models/webhook_event_type.rb +1 -5
  46. data/lib/dodopayments/models.rb +24 -0
  47. data/lib/dodopayments/resources/checkout_sessions.rb +6 -2
  48. data/lib/dodopayments/resources/invoices/payments.rb +18 -0
  49. data/lib/dodopayments/resources/payments.rb +3 -1
  50. data/lib/dodopayments/resources/product_collections/groups/items.rb +111 -0
  51. data/lib/dodopayments/resources/product_collections/groups.rb +109 -0
  52. data/lib/dodopayments/resources/product_collections.rb +179 -0
  53. data/lib/dodopayments/resources/subscriptions.rb +9 -5
  54. data/lib/dodopayments/version.rb +1 -1
  55. data/lib/dodopayments.rb +29 -0
  56. data/rbi/dodopayments/client.rbi +3 -0
  57. data/rbi/dodopayments/models/checkout_session_flags.rbi +23 -0
  58. data/rbi/dodopayments/models/checkout_session_request.rbi +12 -0
  59. data/rbi/dodopayments/models/checkout_session_response.rbi +43 -5
  60. data/rbi/dodopayments/models/discount_detail.rbi +161 -0
  61. data/rbi/dodopayments/models/filter_type.rbi +112 -0
  62. data/rbi/dodopayments/models/github_permission.rbi +26 -0
  63. data/rbi/dodopayments/models/integration_config.rbi +3 -59
  64. data/rbi/dodopayments/models/integration_config_response.rbi +3 -59
  65. data/rbi/dodopayments/models/invoices/payment_retrieve_payout_params.rbi +40 -0
  66. data/rbi/dodopayments/models/meter_filter.rbi +3 -572
  67. data/rbi/dodopayments/models/payment.rbi +3 -163
  68. data/rbi/dodopayments/models/payment_create_params.rbi +12 -0
  69. data/rbi/dodopayments/models/payment_method_types.rbi +1 -0
  70. data/rbi/dodopayments/models/product_collection.rbi +108 -0
  71. data/rbi/dodopayments/models/product_collection_create_params.rbi +82 -0
  72. data/rbi/dodopayments/models/product_collection_delete_params.rbi +38 -0
  73. data/rbi/dodopayments/models/product_collection_list_params.rbi +82 -0
  74. data/rbi/dodopayments/models/product_collection_list_response.rbi +88 -0
  75. data/rbi/dodopayments/models/product_collection_retrieve_params.rbi +38 -0
  76. data/rbi/dodopayments/models/product_collection_unarchive_params.rbi +38 -0
  77. data/rbi/dodopayments/models/product_collection_unarchive_response.rbi +56 -0
  78. data/rbi/dodopayments/models/product_collection_update_images_params.rbi +52 -0
  79. data/rbi/dodopayments/models/product_collection_update_images_response.rbi +40 -0
  80. data/rbi/dodopayments/models/product_collection_update_params.rbi +84 -0
  81. data/rbi/dodopayments/models/product_collections/group_create_params.rbi +40 -0
  82. data/rbi/dodopayments/models/product_collections/group_delete_params.rbi +48 -0
  83. data/rbi/dodopayments/models/product_collections/group_product.rbi +46 -0
  84. data/rbi/dodopayments/models/product_collections/group_update_params.rbi +80 -0
  85. data/rbi/dodopayments/models/product_collections/groups/item_create_params.rbi +68 -0
  86. data/rbi/dodopayments/models/product_collections/groups/item_create_response.rbi +17 -0
  87. data/rbi/dodopayments/models/product_collections/groups/item_delete_params.rbi +55 -0
  88. data/rbi/dodopayments/models/product_collections/groups/item_update_params.rbi +68 -0
  89. data/rbi/dodopayments/models/product_collections/groups/product_collection_product.rbi +148 -0
  90. data/rbi/dodopayments/models/product_collections/product_collection_group_details.rbi +67 -0
  91. data/rbi/dodopayments/models/product_collections/product_collection_group_response.rbi +68 -0
  92. data/rbi/dodopayments/models/subscription.rbi +13 -164
  93. data/rbi/dodopayments/models/subscription_create_params.rbi +12 -0
  94. data/rbi/dodopayments/models/subscription_list_response.rbi +10 -0
  95. data/rbi/dodopayments/models/subscription_update_params.rbi +14 -0
  96. data/rbi/dodopayments/models/subscription_update_payment_method_params.rbi +16 -16
  97. data/rbi/dodopayments/models/webhook_event_type.rbi +4 -18
  98. data/rbi/dodopayments/models.rbi +31 -0
  99. data/rbi/dodopayments/resources/checkout_sessions.rbi +10 -0
  100. data/rbi/dodopayments/resources/invoices/payments.rbi +9 -0
  101. data/rbi/dodopayments/resources/payments.rbi +5 -0
  102. data/rbi/dodopayments/resources/product_collections/groups/items.rbi +83 -0
  103. data/rbi/dodopayments/resources/product_collections/groups.rbi +88 -0
  104. data/rbi/dodopayments/resources/product_collections.rbi +149 -0
  105. data/rbi/dodopayments/resources/subscriptions.rbi +15 -4
  106. data/sig/dodopayments/client.rbs +2 -0
  107. data/sig/dodopayments/models/checkout_session_flags.rbs +7 -0
  108. data/sig/dodopayments/models/checkout_session_request.rbs +5 -0
  109. data/sig/dodopayments/models/checkout_session_response.rbs +27 -3
  110. data/sig/dodopayments/models/discount_detail.rbs +95 -0
  111. data/sig/dodopayments/models/filter_type.rbs +52 -0
  112. data/sig/dodopayments/models/github_permission.rbs +17 -0
  113. data/sig/dodopayments/models/integration_config.rbs +4 -18
  114. data/sig/dodopayments/models/integration_config_response.rbs +4 -18
  115. data/sig/dodopayments/models/invoices/payment_retrieve_payout_params.rbs +25 -0
  116. data/sig/dodopayments/models/meter_filter.rbs +4 -252
  117. data/sig/dodopayments/models/payment.rbs +4 -96
  118. data/sig/dodopayments/models/payment_create_params.rbs +5 -0
  119. data/sig/dodopayments/models/payment_method_types.rbs +2 -0
  120. data/sig/dodopayments/models/product_collection.rbs +55 -0
  121. data/sig/dodopayments/models/product_collection_create_params.rbs +41 -0
  122. data/sig/dodopayments/models/product_collection_delete_params.rbs +23 -0
  123. data/sig/dodopayments/models/product_collection_list_params.rbs +49 -0
  124. data/sig/dodopayments/models/product_collection_list_response.rbs +50 -0
  125. data/sig/dodopayments/models/product_collection_retrieve_params.rbs +23 -0
  126. data/sig/dodopayments/models/product_collection_unarchive_params.rbs +23 -0
  127. data/sig/dodopayments/models/product_collection_unarchive_response.rbs +30 -0
  128. data/sig/dodopayments/models/product_collection_update_images_params.rbs +28 -0
  129. data/sig/dodopayments/models/product_collection_update_images_response.rbs +16 -0
  130. data/sig/dodopayments/models/product_collection_update_params.rbs +51 -0
  131. data/sig/dodopayments/models/product_collections/group_create_params.rbs +27 -0
  132. data/sig/dodopayments/models/product_collections/group_delete_params.rbs +30 -0
  133. data/sig/dodopayments/models/product_collections/group_product.rbs +17 -0
  134. data/sig/dodopayments/models/product_collections/group_update_params.rbs +48 -0
  135. data/sig/dodopayments/models/product_collections/groups/item_create_params.rbs +40 -0
  136. data/sig/dodopayments/models/product_collections/groups/item_create_response.rbs +12 -0
  137. data/sig/dodopayments/models/product_collections/groups/item_delete_params.rbs +36 -0
  138. data/sig/dodopayments/models/product_collections/groups/item_update_params.rbs +40 -0
  139. data/sig/dodopayments/models/product_collections/groups/product_collection_product.rbs +99 -0
  140. data/sig/dodopayments/models/product_collections/product_collection_group_details.rbs +34 -0
  141. data/sig/dodopayments/models/product_collections/product_collection_group_response.rbs +39 -0
  142. data/sig/dodopayments/models/subscription.rbs +9 -96
  143. data/sig/dodopayments/models/subscription_create_params.rbs +5 -0
  144. data/sig/dodopayments/models/subscription_list_response.rbs +5 -0
  145. data/sig/dodopayments/models/subscription_update_params.rbs +5 -0
  146. data/sig/dodopayments/models/subscription_update_payment_method_params.rbs +9 -9
  147. data/sig/dodopayments/models/webhook_event_type.rbs +2 -10
  148. data/sig/dodopayments/models.rbs +24 -0
  149. data/sig/dodopayments/resources/checkout_sessions.rbs +2 -0
  150. data/sig/dodopayments/resources/invoices/payments.rbs +5 -0
  151. data/sig/dodopayments/resources/payments.rbs +1 -0
  152. data/sig/dodopayments/resources/product_collections/groups/items.rbs +33 -0
  153. data/sig/dodopayments/resources/product_collections/groups.rbs +34 -0
  154. data/sig/dodopayments/resources/product_collections.rbs +56 -0
  155. data/sig/dodopayments/resources/subscriptions.rbs +3 -1
  156. metadata +89 -2
@@ -0,0 +1,148 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ module ProductCollections
6
+ module Groups
7
+ class ProductCollectionProduct < Dodopayments::Internal::Type::BaseModel
8
+ OrHash =
9
+ T.type_alias do
10
+ T.any(
11
+ Dodopayments::ProductCollections::Groups::ProductCollectionProduct,
12
+ Dodopayments::Internal::AnyHash
13
+ )
14
+ end
15
+
16
+ sig { returns(String) }
17
+ attr_accessor :id
18
+
19
+ sig { returns(Integer) }
20
+ attr_accessor :addons_count
21
+
22
+ sig { returns(Integer) }
23
+ attr_accessor :files_count
24
+
25
+ # Whether this product has any credit entitlements attached
26
+ sig { returns(T::Boolean) }
27
+ attr_accessor :has_credit_entitlements
28
+
29
+ sig { returns(T::Boolean) }
30
+ attr_accessor :is_recurring
31
+
32
+ sig { returns(T::Boolean) }
33
+ attr_accessor :license_key_enabled
34
+
35
+ sig { returns(Integer) }
36
+ attr_accessor :meters_count
37
+
38
+ sig { returns(String) }
39
+ attr_accessor :product_id
40
+
41
+ sig { returns(T::Boolean) }
42
+ attr_accessor :status
43
+
44
+ sig { returns(T.nilable(Dodopayments::Currency::TaggedSymbol)) }
45
+ attr_accessor :currency
46
+
47
+ sig { returns(T.nilable(String)) }
48
+ attr_accessor :description
49
+
50
+ sig { returns(T.nilable(String)) }
51
+ attr_accessor :name
52
+
53
+ sig { returns(T.nilable(Integer)) }
54
+ attr_accessor :price
55
+
56
+ # One-time price details.
57
+ sig { returns(T.nilable(Dodopayments::Price::Variants)) }
58
+ attr_accessor :price_detail
59
+
60
+ # Represents the different categories of taxation applicable to various products
61
+ # and services.
62
+ sig { returns(T.nilable(Dodopayments::TaxCategory::TaggedSymbol)) }
63
+ attr_accessor :tax_category
64
+
65
+ sig { returns(T.nilable(T::Boolean)) }
66
+ attr_accessor :tax_inclusive
67
+
68
+ sig do
69
+ params(
70
+ id: String,
71
+ addons_count: Integer,
72
+ files_count: Integer,
73
+ has_credit_entitlements: T::Boolean,
74
+ is_recurring: T::Boolean,
75
+ license_key_enabled: T::Boolean,
76
+ meters_count: Integer,
77
+ product_id: String,
78
+ status: T::Boolean,
79
+ currency: T.nilable(Dodopayments::Currency::OrSymbol),
80
+ description: T.nilable(String),
81
+ name: T.nilable(String),
82
+ price: T.nilable(Integer),
83
+ price_detail:
84
+ T.nilable(
85
+ T.any(
86
+ Dodopayments::Price::OneTimePrice::OrHash,
87
+ Dodopayments::Price::RecurringPrice::OrHash,
88
+ Dodopayments::Price::UsageBasedPrice::OrHash
89
+ )
90
+ ),
91
+ tax_category: T.nilable(Dodopayments::TaxCategory::OrSymbol),
92
+ tax_inclusive: T.nilable(T::Boolean)
93
+ ).returns(T.attached_class)
94
+ end
95
+ def self.new(
96
+ id:,
97
+ addons_count:,
98
+ files_count:,
99
+ # Whether this product has any credit entitlements attached
100
+ has_credit_entitlements:,
101
+ is_recurring:,
102
+ license_key_enabled:,
103
+ meters_count:,
104
+ product_id:,
105
+ status:,
106
+ currency: nil,
107
+ description: nil,
108
+ name: nil,
109
+ price: nil,
110
+ # One-time price details.
111
+ price_detail: nil,
112
+ # Represents the different categories of taxation applicable to various products
113
+ # and services.
114
+ tax_category: nil,
115
+ tax_inclusive: nil
116
+ )
117
+ end
118
+
119
+ sig do
120
+ override.returns(
121
+ {
122
+ id: String,
123
+ addons_count: Integer,
124
+ files_count: Integer,
125
+ has_credit_entitlements: T::Boolean,
126
+ is_recurring: T::Boolean,
127
+ license_key_enabled: T::Boolean,
128
+ meters_count: Integer,
129
+ product_id: String,
130
+ status: T::Boolean,
131
+ currency: T.nilable(Dodopayments::Currency::TaggedSymbol),
132
+ description: T.nilable(String),
133
+ name: T.nilable(String),
134
+ price: T.nilable(Integer),
135
+ price_detail: T.nilable(Dodopayments::Price::Variants),
136
+ tax_category:
137
+ T.nilable(Dodopayments::TaxCategory::TaggedSymbol),
138
+ tax_inclusive: T.nilable(T::Boolean)
139
+ }
140
+ )
141
+ end
142
+ def to_hash
143
+ end
144
+ end
145
+ end
146
+ end
147
+ end
148
+ end
@@ -0,0 +1,67 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ ProductCollectionGroupDetails =
6
+ ProductCollections::ProductCollectionGroupDetails
7
+
8
+ module ProductCollections
9
+ class ProductCollectionGroupDetails < Dodopayments::Internal::Type::BaseModel
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ Dodopayments::ProductCollections::ProductCollectionGroupDetails,
14
+ Dodopayments::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ # Products in this group
19
+ sig do
20
+ returns(T::Array[Dodopayments::ProductCollections::GroupProduct])
21
+ end
22
+ attr_accessor :products
23
+
24
+ # Optional group name. Multiple groups can have null names, but named groups must
25
+ # be unique per collection
26
+ sig { returns(T.nilable(String)) }
27
+ attr_accessor :group_name
28
+
29
+ # Status of the group (defaults to true if not provided)
30
+ sig { returns(T.nilable(T::Boolean)) }
31
+ attr_accessor :status
32
+
33
+ sig do
34
+ params(
35
+ products:
36
+ T::Array[Dodopayments::ProductCollections::GroupProduct::OrHash],
37
+ group_name: T.nilable(String),
38
+ status: T.nilable(T::Boolean)
39
+ ).returns(T.attached_class)
40
+ end
41
+ def self.new(
42
+ # Products in this group
43
+ products:,
44
+ # Optional group name. Multiple groups can have null names, but named groups must
45
+ # be unique per collection
46
+ group_name: nil,
47
+ # Status of the group (defaults to true if not provided)
48
+ status: nil
49
+ )
50
+ end
51
+
52
+ sig do
53
+ override.returns(
54
+ {
55
+ products:
56
+ T::Array[Dodopayments::ProductCollections::GroupProduct],
57
+ group_name: T.nilable(String),
58
+ status: T.nilable(T::Boolean)
59
+ }
60
+ )
61
+ end
62
+ def to_hash
63
+ end
64
+ end
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,68 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ ProductCollectionGroupResponse =
6
+ ProductCollections::ProductCollectionGroupResponse
7
+
8
+ module ProductCollections
9
+ class ProductCollectionGroupResponse < Dodopayments::Internal::Type::BaseModel
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ Dodopayments::ProductCollections::ProductCollectionGroupResponse,
14
+ Dodopayments::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ sig { returns(String) }
19
+ attr_accessor :group_id
20
+
21
+ sig do
22
+ returns(
23
+ T::Array[
24
+ Dodopayments::ProductCollections::Groups::ProductCollectionProduct
25
+ ]
26
+ )
27
+ end
28
+ attr_accessor :products
29
+
30
+ sig { returns(T::Boolean) }
31
+ attr_accessor :status
32
+
33
+ sig { returns(T.nilable(String)) }
34
+ attr_accessor :group_name
35
+
36
+ sig do
37
+ params(
38
+ group_id: String,
39
+ products:
40
+ T::Array[
41
+ Dodopayments::ProductCollections::Groups::ProductCollectionProduct::OrHash
42
+ ],
43
+ status: T::Boolean,
44
+ group_name: T.nilable(String)
45
+ ).returns(T.attached_class)
46
+ end
47
+ def self.new(group_id:, products:, status:, group_name: nil)
48
+ end
49
+
50
+ sig do
51
+ override.returns(
52
+ {
53
+ group_id: String,
54
+ products:
55
+ T::Array[
56
+ Dodopayments::ProductCollections::Groups::ProductCollectionProduct
57
+ ],
58
+ status: T::Boolean,
59
+ group_name: T.nilable(String)
60
+ }
61
+ )
62
+ end
63
+ def to_hash
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
@@ -134,6 +134,11 @@ module Dodopayments
134
134
  sig { returns(T.nilable(T::Array[Dodopayments::CustomFieldResponse])) }
135
135
  attr_accessor :custom_field_responses
136
136
 
137
+ # Business / legal name associated with the tax id (B2B). When set this is used on
138
+ # the invoice in place of the customer's personal name.
139
+ sig { returns(T.nilable(String)) }
140
+ attr_accessor :customer_business_name
141
+
137
142
  # DEPRECATED: Use discounts[].cycles_remaining instead.
138
143
  sig { returns(T.nilable(Integer)) }
139
144
  attr_accessor :discount_cycles_remaining
@@ -143,7 +148,7 @@ module Dodopayments
143
148
  attr_accessor :discount_id
144
149
 
145
150
  # All stacked discounts applied, ordered by position
146
- sig { returns(T.nilable(T::Array[Dodopayments::Subscription::Discount])) }
151
+ sig { returns(T.nilable(T::Array[Dodopayments::DiscountDetail])) }
147
152
  attr_accessor :discounts
148
153
 
149
154
  # Timestamp when the subscription will expire
@@ -204,10 +209,10 @@ module Dodopayments
204
209
  cancelled_at: T.nilable(Time),
205
210
  custom_field_responses:
206
211
  T.nilable(T::Array[Dodopayments::CustomFieldResponse::OrHash]),
212
+ customer_business_name: T.nilable(String),
207
213
  discount_cycles_remaining: T.nilable(Integer),
208
214
  discount_id: T.nilable(String),
209
- discounts:
210
- T.nilable(T::Array[Dodopayments::Subscription::Discount::OrHash]),
215
+ discounts: T.nilable(T::Array[Dodopayments::DiscountDetail::OrHash]),
211
216
  expires_at: T.nilable(Time),
212
217
  payment_method_id: T.nilable(String),
213
218
  scheduled_change:
@@ -274,6 +279,9 @@ module Dodopayments
274
279
  cancelled_at: nil,
275
280
  # Customer's responses to custom fields collected during checkout
276
281
  custom_field_responses: nil,
282
+ # Business / legal name associated with the tax id (B2B). When set this is used on
283
+ # the invoice in place of the customer's personal name.
284
+ customer_business_name: nil,
277
285
  # DEPRECATED: Use discounts[].cycles_remaining instead.
278
286
  discount_cycles_remaining: nil,
279
287
  # DEPRECATED: Use discounts instead. Returns the first discount's ID if present.
@@ -328,10 +336,10 @@ module Dodopayments
328
336
  cancelled_at: T.nilable(Time),
329
337
  custom_field_responses:
330
338
  T.nilable(T::Array[Dodopayments::CustomFieldResponse]),
339
+ customer_business_name: T.nilable(String),
331
340
  discount_cycles_remaining: T.nilable(Integer),
332
341
  discount_id: T.nilable(String),
333
- discounts:
334
- T.nilable(T::Array[Dodopayments::Subscription::Discount]),
342
+ discounts: T.nilable(T::Array[Dodopayments::DiscountDetail]),
335
343
  expires_at: T.nilable(Time),
336
344
  payment_method_id: T.nilable(String),
337
345
  scheduled_change: T.nilable(Dodopayments::ScheduledPlanChange),
@@ -341,165 +349,6 @@ module Dodopayments
341
349
  end
342
350
  def to_hash
343
351
  end
344
-
345
- class Discount < Dodopayments::Internal::Type::BaseModel
346
- OrHash =
347
- T.type_alias do
348
- T.any(
349
- Dodopayments::Subscription::Discount,
350
- Dodopayments::Internal::AnyHash
351
- )
352
- end
353
-
354
- # The discount amount (basis points for percentage, USD cents for flat)
355
- sig { returns(Integer) }
356
- attr_accessor :amount
357
-
358
- # The business this discount belongs to
359
- sig { returns(String) }
360
- attr_accessor :business_id
361
-
362
- # The discount code
363
- sig { returns(String) }
364
- attr_accessor :code
365
-
366
- # Timestamp when the discount was created
367
- sig { returns(Time) }
368
- attr_accessor :created_at
369
-
370
- # The unique discount ID
371
- sig { returns(String) }
372
- attr_accessor :discount_id
373
-
374
- # Additional metadata
375
- sig { returns(T::Hash[Symbol, String]) }
376
- attr_accessor :metadata
377
-
378
- # Position of this discount in the stack (0-based)
379
- sig { returns(Integer) }
380
- attr_accessor :position
381
-
382
- # Whether this discount should be preserved when a subscription changes plans
383
- sig { returns(T::Boolean) }
384
- attr_accessor :preserve_on_plan_change
385
-
386
- # List of product IDs to which this discount is restricted
387
- sig { returns(T::Array[String]) }
388
- attr_accessor :restricted_to
389
-
390
- # How many times this discount has been used
391
- sig { returns(Integer) }
392
- attr_accessor :times_used
393
-
394
- # The type of discount
395
- sig { returns(Dodopayments::DiscountType::TaggedSymbol) }
396
- attr_accessor :type
397
-
398
- # Remaining billing cycles for this discount on this subscription (None for
399
- # one-time payments)
400
- sig { returns(T.nilable(Integer)) }
401
- attr_accessor :cycles_remaining
402
-
403
- # Optional date/time after which discount is expired
404
- sig { returns(T.nilable(Time)) }
405
- attr_accessor :expires_at
406
-
407
- # Name for the Discount
408
- sig { returns(T.nilable(String)) }
409
- attr_accessor :name
410
-
411
- # Number of subscription billing cycles this discount is valid for
412
- sig { returns(T.nilable(Integer)) }
413
- attr_accessor :subscription_cycles
414
-
415
- # Usage limit for this discount, if any
416
- sig { returns(T.nilable(Integer)) }
417
- attr_accessor :usage_limit
418
-
419
- # Response struct for a discount with its position in a stack and optional
420
- # cycle-tracking information (for subscriptions).
421
- sig do
422
- params(
423
- amount: Integer,
424
- business_id: String,
425
- code: String,
426
- created_at: Time,
427
- discount_id: String,
428
- metadata: T::Hash[Symbol, String],
429
- position: Integer,
430
- preserve_on_plan_change: T::Boolean,
431
- restricted_to: T::Array[String],
432
- times_used: Integer,
433
- type: Dodopayments::DiscountType::OrSymbol,
434
- cycles_remaining: T.nilable(Integer),
435
- expires_at: T.nilable(Time),
436
- name: T.nilable(String),
437
- subscription_cycles: T.nilable(Integer),
438
- usage_limit: T.nilable(Integer)
439
- ).returns(T.attached_class)
440
- end
441
- def self.new(
442
- # The discount amount (basis points for percentage, USD cents for flat)
443
- amount:,
444
- # The business this discount belongs to
445
- business_id:,
446
- # The discount code
447
- code:,
448
- # Timestamp when the discount was created
449
- created_at:,
450
- # The unique discount ID
451
- discount_id:,
452
- # Additional metadata
453
- metadata:,
454
- # Position of this discount in the stack (0-based)
455
- position:,
456
- # Whether this discount should be preserved when a subscription changes plans
457
- preserve_on_plan_change:,
458
- # List of product IDs to which this discount is restricted
459
- restricted_to:,
460
- # How many times this discount has been used
461
- times_used:,
462
- # The type of discount
463
- type:,
464
- # Remaining billing cycles for this discount on this subscription (None for
465
- # one-time payments)
466
- cycles_remaining: nil,
467
- # Optional date/time after which discount is expired
468
- expires_at: nil,
469
- # Name for the Discount
470
- name: nil,
471
- # Number of subscription billing cycles this discount is valid for
472
- subscription_cycles: nil,
473
- # Usage limit for this discount, if any
474
- usage_limit: nil
475
- )
476
- end
477
-
478
- sig do
479
- override.returns(
480
- {
481
- amount: Integer,
482
- business_id: String,
483
- code: String,
484
- created_at: Time,
485
- discount_id: String,
486
- metadata: T::Hash[Symbol, String],
487
- position: Integer,
488
- preserve_on_plan_change: T::Boolean,
489
- restricted_to: T::Array[String],
490
- times_used: Integer,
491
- type: Dodopayments::DiscountType::TaggedSymbol,
492
- cycles_remaining: T.nilable(Integer),
493
- expires_at: T.nilable(Time),
494
- name: T.nilable(String),
495
- subscription_cycles: T.nilable(Integer),
496
- usage_limit: T.nilable(Integer)
497
- }
498
- )
499
- end
500
- def to_hash
501
- end
502
- end
503
352
  end
504
353
  end
505
354
  end
@@ -57,6 +57,12 @@ module Dodopayments
57
57
  sig { returns(T.nilable(Dodopayments::Currency::OrSymbol)) }
58
58
  attr_accessor :billing_currency
59
59
 
60
+ # Optional business / legal name associated with the tax id. When provided
61
+ # together with a valid tax id for a B2B purchase, this name is rendered on the
62
+ # invoice instead of the customer's personal name.
63
+ sig { returns(T.nilable(String)) }
64
+ attr_accessor :customer_business_name
65
+
60
66
  # DEPRECATED: Use discount_codes instead. Cannot be used together with
61
67
  # discount_codes.
62
68
  sig { returns(T.nilable(String)) }
@@ -168,6 +174,7 @@ module Dodopayments
168
174
  allowed_payment_method_types:
169
175
  T.nilable(T::Array[Dodopayments::PaymentMethodTypes::OrSymbol]),
170
176
  billing_currency: T.nilable(Dodopayments::Currency::OrSymbol),
177
+ customer_business_name: T.nilable(String),
171
178
  discount_code: T.nilable(String),
172
179
  discount_codes: T.nilable(T::Array[String]),
173
180
  force_3ds: T.nilable(T::Boolean),
@@ -209,6 +216,10 @@ module Dodopayments
209
216
  # Fix the currency in which the end customer is billed. If Dodo Payments cannot
210
217
  # support that currency for this transaction, it will not proceed
211
218
  billing_currency: nil,
219
+ # Optional business / legal name associated with the tax id. When provided
220
+ # together with a valid tax id for a B2B purchase, this name is rendered on the
221
+ # invoice instead of the customer's personal name.
222
+ customer_business_name: nil,
212
223
  # DEPRECATED: Use discount_codes instead. Cannot be used together with
213
224
  # discount_codes.
214
225
  discount_code: nil,
@@ -274,6 +285,7 @@ module Dodopayments
274
285
  allowed_payment_method_types:
275
286
  T.nilable(T::Array[Dodopayments::PaymentMethodTypes::OrSymbol]),
276
287
  billing_currency: T.nilable(Dodopayments::Currency::OrSymbol),
288
+ customer_business_name: T.nilable(String),
277
289
  discount_code: T.nilable(String),
278
290
  discount_codes: T.nilable(T::Array[String]),
279
291
  force_3ds: T.nilable(T::Boolean),
@@ -113,6 +113,11 @@ module Dodopayments
113
113
  sig { returns(T.nilable(Time)) }
114
114
  attr_accessor :cancelled_at
115
115
 
116
+ # Business / legal name associated with the tax id (B2B). When set this is used on
117
+ # the invoice in place of the customer's personal name.
118
+ sig { returns(T.nilable(String)) }
119
+ attr_accessor :customer_business_name
120
+
116
121
  # DEPRECATED: Use discounts[].cycles_remaining instead.
117
122
  sig { returns(T.nilable(Integer)) }
118
123
  attr_accessor :discount_cycles_remaining
@@ -172,6 +177,7 @@ module Dodopayments
172
177
  tax_inclusive: T::Boolean,
173
178
  trial_period_days: Integer,
174
179
  cancelled_at: T.nilable(Time),
180
+ customer_business_name: T.nilable(String),
175
181
  discount_cycles_remaining: T.nilable(Integer),
176
182
  discount_id: T.nilable(String),
177
183
  payment_method_id: T.nilable(String),
@@ -228,6 +234,9 @@ module Dodopayments
228
234
  trial_period_days:,
229
235
  # Cancelled timestamp if the subscription is cancelled
230
236
  cancelled_at: nil,
237
+ # Business / legal name associated with the tax id (B2B). When set this is used on
238
+ # the invoice in place of the customer's personal name.
239
+ customer_business_name: nil,
231
240
  # DEPRECATED: Use discounts[].cycles_remaining instead.
232
241
  discount_cycles_remaining: nil,
233
242
  # DEPRECATED: Use discounts instead.
@@ -273,6 +282,7 @@ module Dodopayments
273
282
  tax_inclusive: T::Boolean,
274
283
  trial_period_days: Integer,
275
284
  cancelled_at: T.nilable(Time),
285
+ customer_business_name: T.nilable(String),
276
286
  discount_cycles_remaining: T.nilable(Integer),
277
287
  discount_id: T.nilable(String),
278
288
  payment_method_id: T.nilable(String),
@@ -60,6 +60,13 @@ module Dodopayments
60
60
  end
61
61
  attr_accessor :credit_entitlement_cart
62
62
 
63
+ # Optional business / legal name associated with the tax id. When provided
64
+ # together with a valid tax id for a B2B subscription, this name is rendered on
65
+ # the invoice instead of the customer's personal name. Send `null` to explicitly
66
+ # clear the business name.
67
+ sig { returns(T.nilable(String)) }
68
+ attr_accessor :customer_business_name
69
+
63
70
  sig { returns(T.nilable(String)) }
64
71
  attr_accessor :customer_name
65
72
 
@@ -110,6 +117,7 @@ module Dodopayments
110
117
  Dodopayments::SubscriptionUpdateParams::CreditEntitlementCart::OrHash
111
118
  ]
112
119
  ),
120
+ customer_business_name: T.nilable(String),
113
121
  customer_name: T.nilable(String),
114
122
  disable_on_demand:
115
123
  T.nilable(
@@ -136,6 +144,11 @@ module Dodopayments
136
144
  cancellation_feedback: nil,
137
145
  # Update credit entitlement cart settings
138
146
  credit_entitlement_cart: nil,
147
+ # Optional business / legal name associated with the tax id. When provided
148
+ # together with a valid tax id for a B2B subscription, this name is rendered on
149
+ # the invoice instead of the customer's personal name. Send `null` to explicitly
150
+ # clear the business name.
151
+ customer_business_name: nil,
139
152
  customer_name: nil,
140
153
  disable_on_demand: nil,
141
154
  metadata: nil,
@@ -165,6 +178,7 @@ module Dodopayments
165
178
  Dodopayments::SubscriptionUpdateParams::CreditEntitlementCart
166
179
  ]
167
180
  ),
181
+ customer_business_name: T.nilable(String),
168
182
  customer_name: T.nilable(String),
169
183
  disable_on_demand:
170
184
  T.nilable(