dodopayments 2.38.0 → 2.39.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 (51) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/README.md +1 -1
  4. data/lib/dodopayments/client.rb +4 -0
  5. data/lib/dodopayments/models/app_installation_retrieve_settings_params.rb +14 -0
  6. data/lib/dodopayments/models/app_installation_retrieve_settings_response.rb +87 -0
  7. data/lib/dodopayments/models/customer_retrieve_payment_methods_params.rb +17 -1
  8. data/lib/dodopayments/models/invoice.rb +20 -1
  9. data/lib/dodopayments/models/invoice_create_params.rb +9 -1
  10. data/lib/dodopayments/models/invoice_preview_params.rb +9 -1
  11. data/lib/dodopayments/models/invoice_update_params.rb +9 -1
  12. data/lib/dodopayments/models/subscription_start_trial_params.rb +191 -0
  13. data/lib/dodopayments/models/subscription_start_trial_response.rb +32 -0
  14. data/lib/dodopayments/models.rb +4 -0
  15. data/lib/dodopayments/resources/app_installation.rb +33 -0
  16. data/lib/dodopayments/resources/customers.rb +9 -2
  17. data/lib/dodopayments/resources/invoices.rb +11 -5
  18. data/lib/dodopayments/resources/subscriptions.rb +50 -0
  19. data/lib/dodopayments/version.rb +1 -1
  20. data/lib/dodopayments.rb +5 -0
  21. data/rbi/dodopayments/client.rbi +3 -0
  22. data/rbi/dodopayments/models/app_installation_retrieve_settings_params.rbi +32 -0
  23. data/rbi/dodopayments/models/app_installation_retrieve_settings_response.rbi +105 -0
  24. data/rbi/dodopayments/models/customer_retrieve_payment_methods_params.rbi +28 -2
  25. data/rbi/dodopayments/models/invoice.rbi +25 -0
  26. data/rbi/dodopayments/models/invoice_create_params.rbi +8 -0
  27. data/rbi/dodopayments/models/invoice_preview_params.rbi +8 -0
  28. data/rbi/dodopayments/models/invoice_update_params.rbi +8 -0
  29. data/rbi/dodopayments/models/subscription_start_trial_params.rbi +302 -0
  30. data/rbi/dodopayments/models/subscription_start_trial_response.rbi +50 -0
  31. data/rbi/dodopayments/models.rbi +6 -0
  32. data/rbi/dodopayments/resources/app_installation.rbi +22 -0
  33. data/rbi/dodopayments/resources/customers.rbi +5 -0
  34. data/rbi/dodopayments/resources/invoices.rbi +14 -2
  35. data/rbi/dodopayments/resources/subscriptions.rbi +59 -0
  36. data/sig/dodopayments/client.rbs +2 -0
  37. data/sig/dodopayments/models/app_installation_retrieve_settings_params.rbs +15 -0
  38. data/sig/dodopayments/models/app_installation_retrieve_settings_response.rbs +60 -0
  39. data/sig/dodopayments/models/customer_retrieve_payment_methods_params.rbs +22 -1
  40. data/sig/dodopayments/models/invoice.rbs +12 -0
  41. data/sig/dodopayments/models/invoice_create_params.rbs +5 -0
  42. data/sig/dodopayments/models/invoice_preview_params.rbs +5 -0
  43. data/sig/dodopayments/models/invoice_update_params.rbs +5 -0
  44. data/sig/dodopayments/models/subscription_start_trial_params.rbs +156 -0
  45. data/sig/dodopayments/models/subscription_start_trial_response.rbs +26 -0
  46. data/sig/dodopayments/models.rbs +4 -0
  47. data/sig/dodopayments/resources/app_installation.rbs +11 -0
  48. data/sig/dodopayments/resources/customers.rbs +2 -0
  49. data/sig/dodopayments/resources/invoices.rbs +3 -0
  50. data/sig/dodopayments/resources/subscriptions.rbs +16 -0
  51. metadata +17 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a25912e01185bc094cdeb7fd9b1ebd36cdb9549de340679ec705473b6f536b69
4
- data.tar.gz: 185344521ef4cc360a68f67b47ac9e3963d862f07f8649c2b64fa718bdbc4ff6
3
+ metadata.gz: 7a12c2b0d720c3e806c804b967cc57bdb00e0efa17ddf08dafa6cc44a05e3411
4
+ data.tar.gz: 6deae0462f3791a0da495d9cbdf52859e605fa4fd655ea733dbadb55bb536cfd
5
5
  SHA512:
6
- metadata.gz: 5df132bfb45b3761d03db4a9cf7b4e10a496e9d6598fb6819a72ca03a1447e336d744b2cdb13e2146c98d3fe3e6f1673cf7bd8927c38f3d9575645d793442c32
7
- data.tar.gz: e0fd9cf43b6292c05af82a4512f947178fee99fb1179c233f9e0fd657128b9a8e7b51a840d02e49db258cc39370e24d893d5dc9b1375d2b223bcc8edb65f883c
6
+ metadata.gz: f7bca3f66ddc8c1a73a95df09b0d29153303829bcf98365de9e81641f5d4e8c12d9311d8f3fbab77d5d0b2917ce641736bccd82cf18837d5ea4e518b02afc787
7
+ data.tar.gz: 7bb5f67496b373215e7770e322ef03ffcd7d42ffab11c8615f1f3b806661209095ef40247b177d23e36557c856ec6839075479f63ffc77a64e3ee3433d01fc4e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.39.0](https://github.com/dodopayments/dodopayments-ruby/compare/v2.38.0...v2.39.0) (2026-11-16)
4
+
5
+
6
+ ### Features
7
+
8
+ * **api:** regenerate SDK from latest OpenAPI spec ([3e16a84](https://github.com/dodopayments/dodopayments-ruby/commit/3e16a8423392081f9fabaff6ee262492cfc2b703))
9
+ * **api:** regenerate SDK from latest OpenAPI spec ([18a7986](https://github.com/dodopayments/dodopayments-ruby/commit/18a798647ba190e20f627921f62a27fb1a6edaaf))
10
+
3
11
  ## [2.38.0](https://github.com/dodopayments/dodopayments-ruby/compare/v2.37.0...v2.38.0) (2026-11-10)
4
12
 
5
13
 
data/README.md CHANGED
@@ -23,7 +23,7 @@ To use this gem, install via Bundler by adding the following to your application
23
23
  <!-- x-release-please-start-version -->
24
24
 
25
25
  ```ruby
26
- gem "dodopayments", "~> 2.38.0"
26
+ gem "dodopayments", "~> 2.39.0"
27
27
  ```
28
28
 
29
29
  <!-- x-release-please-end -->
@@ -110,6 +110,9 @@ module Dodopayments
110
110
  # @return [Dodopayments::Resources::Moderation]
111
111
  attr_reader :moderation
112
112
 
113
+ # @return [Dodopayments::Resources::AppInstallation]
114
+ attr_reader :app_installation
115
+
113
116
  # @api private
114
117
  #
115
118
  # @return [Hash{String=>String}]
@@ -325,6 +328,7 @@ module Dodopayments
325
328
  @entitlements = Dodopayments::Resources::Entitlements.new(client: self)
326
329
  @product_collections = Dodopayments::Resources::ProductCollections.new(client: self)
327
330
  @moderation = Dodopayments::Resources::Moderation.new(client: self)
331
+ @app_installation = Dodopayments::Resources::AppInstallation.new(client: self)
328
332
 
329
333
  @workload_identity = nil
330
334
  return if workload_identity.nil?
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dodopayments
4
+ module Models
5
+ # @see Dodopayments::Resources::AppInstallation#retrieve_settings
6
+ class AppInstallationRetrieveSettingsParams < Dodopayments::Internal::Type::BaseModel
7
+ extend Dodopayments::Internal::Type::RequestParameters::Converter
8
+ include Dodopayments::Internal::Type::RequestParameters
9
+
10
+ # @!method initialize(request_options: {})
11
+ # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}]
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,87 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dodopayments
4
+ module Models
5
+ # @see Dodopayments::Resources::AppInstallation#retrieve_settings
6
+ class AppInstallationRetrieveSettingsResponse < Dodopayments::Internal::Type::BaseModel
7
+ # @!attribute action_needed
8
+ # `true` when a required field has no value, or a stored value fails a live rule.
9
+ #
10
+ # @return [Boolean]
11
+ required :action_needed, Dodopayments::Internal::Type::Boolean
12
+
13
+ # @!attribute app_id
14
+ #
15
+ # @return [String]
16
+ required :app_id, String
17
+
18
+ # @!attribute installation_id
19
+ #
20
+ # @return [String]
21
+ required :installation_id, String
22
+
23
+ # @!attribute invalid_keys
24
+ # The keys that need an action.
25
+ #
26
+ # @return [Array<String>]
27
+ required :invalid_keys, Dodopayments::Internal::Type::ArrayOf[String]
28
+
29
+ # @!attribute secrets
30
+ # The values of the secret fields of the live manifest, by key.
31
+ #
32
+ # @return [Object]
33
+ required :secrets, Dodopayments::Internal::Type::Unknown
34
+
35
+ # @!attribute values
36
+ # The values of the fields of the live manifest that are not secrets.
37
+ #
38
+ # @return [Object]
39
+ required :values, Dodopayments::Internal::Type::Unknown
40
+
41
+ # @!attribute live_manifest_version
42
+ # The version of the live settings manifest. It is `null` when the app has no live
43
+ # manifest. Then `values` and `secrets` are empty.
44
+ #
45
+ # @return [Integer, nil]
46
+ optional :live_manifest_version, Integer, nil?: true
47
+
48
+ # @!attribute manifest_version
49
+ # The manifest version of the last save. It is `null` when the installation has no
50
+ # settings.
51
+ #
52
+ # @return [Integer, nil]
53
+ optional :manifest_version, Integer, nil?: true
54
+
55
+ # @!attribute updated_at
56
+ # The time of the last save.
57
+ #
58
+ # @return [Time, nil]
59
+ optional :updated_at, Time, nil?: true
60
+
61
+ # @!method initialize(action_needed:, app_id:, installation_id:, invalid_keys:, secrets:, values:, live_manifest_version: nil, manifest_version: nil, updated_at: nil)
62
+ # Some parameter documentations has been truncated, see
63
+ # {Dodopayments::Models::AppInstallationRetrieveSettingsResponse} for more
64
+ # details.
65
+ #
66
+ # The settings of the App Installation of the app token, with the secret values.
67
+ #
68
+ # @param action_needed [Boolean] `true` when a required field has no value, or a stored value fails a live rule.
69
+ #
70
+ # @param app_id [String]
71
+ #
72
+ # @param installation_id [String]
73
+ #
74
+ # @param invalid_keys [Array<String>] The keys that need an action.
75
+ #
76
+ # @param secrets [Object] The values of the secret fields of the live manifest, by key.
77
+ #
78
+ # @param values [Object] The values of the fields of the live manifest that are not secrets.
79
+ #
80
+ # @param live_manifest_version [Integer, nil] The version of the live settings manifest. It is `null` when the app has no live
81
+ #
82
+ # @param manifest_version [Integer, nil] The manifest version of the last save. It is `null` when the installation has no
83
+ #
84
+ # @param updated_at [Time, nil] The time of the last save.
85
+ end
86
+ end
87
+ end
@@ -12,8 +12,24 @@ module Dodopayments
12
12
  # @return [String]
13
13
  required :customer_id, String
14
14
 
15
- # @!method initialize(customer_id:, request_options: {})
15
+ # @!attribute billing_country
16
+ # ISO country code alpha2 variant
17
+ #
18
+ # @return [Symbol, Dodopayments::Models::CountryCode, nil]
19
+ optional :billing_country, enum: -> { Dodopayments::CountryCode }
20
+
21
+ # @!attribute currency
22
+ #
23
+ # @return [Symbol, Dodopayments::Models::Currency, nil]
24
+ optional :currency, enum: -> { Dodopayments::Currency }
25
+
26
+ # @!method initialize(customer_id:, billing_country: nil, currency: nil, request_options: {})
16
27
  # @param customer_id [String]
28
+ #
29
+ # @param billing_country [Symbol, Dodopayments::Models::CountryCode] ISO country code alpha2 variant
30
+ #
31
+ # @param currency [Symbol, Dodopayments::Models::Currency]
32
+ #
17
33
  # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}]
18
34
  end
19
35
  end
@@ -105,6 +105,14 @@ module Dodopayments
105
105
  # @return [Integer]
106
106
  required :retry_count, Integer
107
107
 
108
+ # @!attribute review_required
109
+ # `true` when a subscription of the invoice has renewal review on now. The value
110
+ # follows the subscription, so it can change after finalise. `review_deadline`
111
+ # shows that this draft waits.
112
+ #
113
+ # @return [Boolean]
114
+ required :review_required, Dodopayments::Internal::Type::Boolean
115
+
108
116
  # @!attribute row_version
109
117
  # Goes up by one on each change. Use it to ignore an older webhook delivery.
110
118
  #
@@ -190,6 +198,12 @@ module Dodopayments
190
198
  # @return [Time, nil]
191
199
  optional :next_retry_at, Time, nil?: true
192
200
 
201
+ # @!attribute payment_method_id
202
+ # The saved card that an automatic charge of the invoice uses.
203
+ #
204
+ # @return [String, nil]
205
+ optional :payment_method_id, String, nil?: true
206
+
193
207
  # @!attribute payment_terms_days
194
208
  # Days from finalise to the due date. `null` when the invoice has a custom due
195
209
  # date.
@@ -227,7 +241,7 @@ module Dodopayments
227
241
  # @return [Time, nil]
228
242
  optional :sent_at, Time, nil?: true
229
243
 
230
- # @!method initialize(allowed_actions:, amount_due:, amount_paid:, amount_refunded:, billing_mode:, business_id:, created_at:, credits:, currency:, customer:, discount_ids:, editable_fields:, frequency:, invoice_id:, metadata:, refund_ids:, retry_count:, row_version:, status:, subscription_ids:, tags:, tax:, total_amount:, collection_method: nil, due_at: nil, dunning_state: nil, finalized_at: nil, hosted_url: nil, lines: nil, memo: nil, next_reminder_at: nil, next_retry_at: nil, payment_terms_days: nil, payments: nil, pdf_url: nil, reminder_settings: nil, review_deadline: nil, sent_at: nil)
244
+ # @!method initialize(allowed_actions:, amount_due:, amount_paid:, amount_refunded:, billing_mode:, business_id:, created_at:, credits:, currency:, customer:, discount_ids:, editable_fields:, frequency:, invoice_id:, metadata:, refund_ids:, retry_count:, review_required:, row_version:, status:, subscription_ids:, tags:, tax:, total_amount:, collection_method: nil, due_at: nil, dunning_state: nil, finalized_at: nil, hosted_url: nil, lines: nil, memo: nil, next_reminder_at: nil, next_retry_at: nil, payment_method_id: nil, payment_terms_days: nil, payments: nil, pdf_url: nil, reminder_settings: nil, review_deadline: nil, sent_at: nil)
231
245
  # Some parameter documentations has been truncated, see
232
246
  # {Dodopayments::Models::Invoice} for more details.
233
247
  #
@@ -268,6 +282,8 @@ module Dodopayments
268
282
  #
269
283
  # @param retry_count [Integer] The number of failed automatic charges.
270
284
  #
285
+ # @param review_required [Boolean] `true` when a subscription of the invoice has renewal review on now. The value f
286
+ #
271
287
  # @param row_version [Integer] Goes up by one on each change. Use it to ignore an older webhook delivery.
272
288
  #
273
289
  # @param status [Symbol, Dodopayments::Models::InvoiceStatus] The `message` of each variant is the label of the invoice document.
@@ -298,6 +314,8 @@ module Dodopayments
298
314
  #
299
315
  # @param next_retry_at [Time, nil]
300
316
  #
317
+ # @param payment_method_id [String, nil] The saved card that an automatic charge of the invoice uses.
318
+ #
301
319
  # @param payment_terms_days [Integer, nil] Days from finalise to the due date. `null` when the invoice has a custom due dat
302
320
  #
303
321
  # @param payments [Array<Dodopayments::Models::Invoice::Payment>, nil] Only on a single invoice. A list leaves it out.
@@ -432,6 +450,7 @@ module Dodopayments
432
450
  BILLING_ADDRESS = :billing_address
433
451
  TAX_ID = :tax_id
434
452
  REVIEW_REQUIRED = :review_required
453
+ PAYMENT_METHOD = :payment_method
435
454
  DUE_AT = :due_at
436
455
  COLLECTION_METHOD = :collection_method
437
456
  MEMO = :memo
@@ -77,6 +77,12 @@ module Dodopayments
77
77
  # @return [Hash{Symbol=>String, Float, Boolean}, nil]
78
78
  optional :metadata, -> { Dodopayments::Internal::Type::HashOf[union: Dodopayments::MetadataItem] }
79
79
 
80
+ # @!attribute payment_method_id
81
+ # A saved card of the customer. The new subscriptions of the invoice charge it.
82
+ #
83
+ # @return [String, nil]
84
+ optional :payment_method_id, String, nil?: true
85
+
80
86
  # @!attribute payment_terms
81
87
  # Do not send it with `due_at`.
82
88
  #
@@ -99,7 +105,7 @@ module Dodopayments
99
105
  # @return [String, nil]
100
106
  optional :idempotency_key, String
101
107
 
102
- # @!method initialize(collection_method:, currency:, customer_id:, items:, billing_address: nil, cc_emails: nil, customer_email: nil, discount_ids: nil, due_at: nil, dunning: nil, memo: nil, metadata: nil, payment_terms: nil, review_required: nil, tax_id: nil, idempotency_key: nil, request_options: {})
108
+ # @!method initialize(collection_method:, currency:, customer_id:, items:, billing_address: nil, cc_emails: nil, customer_email: nil, discount_ids: nil, due_at: nil, dunning: nil, memo: nil, metadata: nil, payment_method_id: nil, payment_terms: nil, review_required: nil, tax_id: nil, idempotency_key: nil, request_options: {})
103
109
  # Some parameter documentations has been truncated, see
104
110
  # {Dodopayments::Models::InvoiceCreateParams} for more details.
105
111
  #
@@ -127,6 +133,8 @@ module Dodopayments
127
133
  #
128
134
  # @param metadata [Hash{Symbol=>String, Float, Boolean}] Arbitrary key-value metadata. Values can be string, integer, number, or boolean.
129
135
  #
136
+ # @param payment_method_id [String, nil] A saved card of the customer. The new subscriptions of the invoice charge it.
137
+ #
130
138
  # @param payment_terms [Dodopayments::Models::InvoiceCreateParams::PaymentTerms::DueOnReceipt, Dodopayments::Models::InvoiceCreateParams::PaymentTerms::Net, nil] Do not send it with `due_at`.
131
139
  #
132
140
  # @param review_required [Boolean] `true` keeps a renewal draft for review before it finalises.
@@ -85,6 +85,12 @@ module Dodopayments
85
85
  # @return [Hash{Symbol=>String, Float, Boolean}, nil]
86
86
  optional :metadata, -> { Dodopayments::Internal::Type::HashOf[union: Dodopayments::MetadataItem] }
87
87
 
88
+ # @!attribute payment_method_id
89
+ # A saved card of the customer. The new subscriptions of the invoice charge it.
90
+ #
91
+ # @return [String, nil]
92
+ optional :payment_method_id, String, nil?: true
93
+
88
94
  # @!attribute payment_terms
89
95
  # Do not send it with `due_at`.
90
96
  #
@@ -102,7 +108,7 @@ module Dodopayments
102
108
  # @return [String, nil]
103
109
  optional :tax_id, String, nil?: true
104
110
 
105
- # @!method initialize(collection_method:, currency:, customer_id:, items:, format_: nil, billing_address: nil, cc_emails: nil, customer_email: nil, discount_ids: nil, due_at: nil, dunning: nil, memo: nil, metadata: nil, payment_terms: nil, review_required: nil, tax_id: nil, request_options: {})
111
+ # @!method initialize(collection_method:, currency:, customer_id:, items:, format_: nil, billing_address: nil, cc_emails: nil, customer_email: nil, discount_ids: nil, due_at: nil, dunning: nil, memo: nil, metadata: nil, payment_method_id: nil, payment_terms: nil, review_required: nil, tax_id: nil, request_options: {})
106
112
  # Some parameter documentations has been truncated, see
107
113
  # {Dodopayments::Models::InvoicePreviewParams} for more details.
108
114
  #
@@ -132,6 +138,8 @@ module Dodopayments
132
138
  #
133
139
  # @param metadata [Hash{Symbol=>String, Float, Boolean}] Arbitrary key-value metadata. Values can be string, integer, number, or boolean.
134
140
  #
141
+ # @param payment_method_id [String, nil] A saved card of the customer. The new subscriptions of the invoice charge it.
142
+ #
135
143
  # @param payment_terms [Dodopayments::Models::InvoicePreviewParams::PaymentTerms::DueOnReceipt, Dodopayments::Models::InvoicePreviewParams::PaymentTerms::Net, nil] Do not send it with `due_at`.
136
144
  #
137
145
  # @param review_required [Boolean] `true` keeps a renewal draft for review before it finalises.
@@ -88,6 +88,12 @@ module Dodopayments
88
88
  -> { Dodopayments::Internal::Type::HashOf[union: Dodopayments::MetadataItem] },
89
89
  nil?: true
90
90
 
91
+ # @!attribute payment_method_id
92
+ # A saved card of the customer. `null` removes the card from the draft.
93
+ #
94
+ # @return [String, nil]
95
+ optional :payment_method_id, String, nil?: true
96
+
91
97
  # @!attribute payment_terms
92
98
  #
93
99
  # @return [Dodopayments::Models::InvoiceUpdateParams::PaymentTerms::DueOnReceipt, Dodopayments::Models::InvoiceUpdateParams::PaymentTerms::Net, nil]
@@ -103,7 +109,7 @@ module Dodopayments
103
109
  # @return [String, nil]
104
110
  optional :tax_id, String, nil?: true
105
111
 
106
- # @!method initialize(invoice_id:, if_match:, billing_address: nil, cc_emails: nil, collection_method: nil, currency: nil, customer_email: nil, customer_id: nil, discount_ids: nil, due_at: nil, dunning: nil, items: nil, memo: nil, metadata: nil, payment_terms: nil, review_required: nil, tax_id: nil, request_options: {})
112
+ # @!method initialize(invoice_id:, if_match:, billing_address: nil, cc_emails: nil, collection_method: nil, currency: nil, customer_email: nil, customer_id: nil, discount_ids: nil, due_at: nil, dunning: nil, items: nil, memo: nil, metadata: nil, payment_method_id: nil, payment_terms: nil, review_required: nil, tax_id: nil, request_options: {})
107
113
  # Some parameter documentations has been truncated, see
108
114
  # {Dodopayments::Models::InvoiceUpdateParams} for more details.
109
115
  #
@@ -135,6 +141,8 @@ module Dodopayments
135
141
  #
136
142
  # @param metadata [Hash{Symbol=>String, Float, Boolean}, nil] Arbitrary key-value metadata. Values can be string, integer, number, or boolean.
137
143
  #
144
+ # @param payment_method_id [String, nil] A saved card of the customer. `null` removes the card from the draft.
145
+ #
138
146
  # @param payment_terms [Dodopayments::Models::InvoiceUpdateParams::PaymentTerms::DueOnReceipt, Dodopayments::Models::InvoiceUpdateParams::PaymentTerms::Net, nil]
139
147
  #
140
148
  # @param review_required [Boolean, nil]
@@ -0,0 +1,191 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dodopayments
4
+ module Models
5
+ # @see Dodopayments::Resources::Subscriptions#start_trial
6
+ class SubscriptionStartTrialParams < Dodopayments::Internal::Type::BaseModel
7
+ extend Dodopayments::Internal::Type::RequestParameters::Converter
8
+ include Dodopayments::Internal::Type::RequestParameters
9
+
10
+ # @!attribute collection_method
11
+ #
12
+ # @return [Symbol, Dodopayments::Models::CollectionMethod]
13
+ required :collection_method, enum: -> { Dodopayments::CollectionMethod }
14
+
15
+ # @!attribute currency
16
+ #
17
+ # @return [Symbol, Dodopayments::Models::Currency]
18
+ required :currency, enum: -> { Dodopayments::Currency }
19
+
20
+ # @!attribute customer_id
21
+ #
22
+ # @return [String]
23
+ required :customer_id, String
24
+
25
+ # @!attribute product_id
26
+ # A recurring product.
27
+ #
28
+ # @return [String]
29
+ required :product_id, String
30
+
31
+ # @!attribute billing_address
32
+ # The billing address of an invoice request.
33
+ #
34
+ # @return [Dodopayments::Models::SubscriptionStartTrialParams::BillingAddress, nil]
35
+ optional :billing_address, -> { Dodopayments::SubscriptionStartTrialParams::BillingAddress }, nil?: true
36
+
37
+ # @!attribute payment_method_id
38
+ # A saved card of the customer. Automatic charge needs it.
39
+ #
40
+ # @return [String, nil]
41
+ optional :payment_method_id, String, nil?: true
42
+
43
+ # @!attribute payment_terms
44
+ # The terms of the invoices after the trial.
45
+ #
46
+ # @return [Dodopayments::Models::SubscriptionStartTrialParams::PaymentTerms::DueOnReceipt, Dodopayments::Models::SubscriptionStartTrialParams::PaymentTerms::Net, nil]
47
+ optional :payment_terms,
48
+ union: -> { Dodopayments::SubscriptionStartTrialParams::PaymentTerms },
49
+ nil?: true
50
+
51
+ # @!attribute quantity
52
+ #
53
+ # @return [Integer, nil]
54
+ optional :quantity, Integer
55
+
56
+ # @!attribute review_required
57
+ # `true` keeps each renewal draft for review before it finalises.
58
+ #
59
+ # @return [Boolean, nil]
60
+ optional :review_required, Dodopayments::Internal::Type::Boolean
61
+
62
+ # @!attribute tax_id
63
+ #
64
+ # @return [String, nil]
65
+ optional :tax_id, String, nil?: true
66
+
67
+ # @!attribute trial_period_days
68
+ # 1 to 730 days. When this is not set, the product trial applies and the trial
69
+ # misuse check runs.
70
+ #
71
+ # @return [Integer, nil]
72
+ optional :trial_period_days, Integer, nil?: true
73
+
74
+ # @!attribute idempotency_key
75
+ #
76
+ # @return [String, nil]
77
+ optional :idempotency_key, String
78
+
79
+ # @!method initialize(collection_method:, currency:, customer_id:, product_id:, billing_address: nil, payment_method_id: nil, payment_terms: nil, quantity: nil, review_required: nil, tax_id: nil, trial_period_days: nil, idempotency_key: nil, request_options: {})
80
+ # Some parameter documentations has been truncated, see
81
+ # {Dodopayments::Models::SubscriptionStartTrialParams} for more details.
82
+ #
83
+ # @param collection_method [Symbol, Dodopayments::Models::CollectionMethod]
84
+ #
85
+ # @param currency [Symbol, Dodopayments::Models::Currency]
86
+ #
87
+ # @param customer_id [String]
88
+ #
89
+ # @param product_id [String] A recurring product.
90
+ #
91
+ # @param billing_address [Dodopayments::Models::SubscriptionStartTrialParams::BillingAddress, nil] The billing address of an invoice request.
92
+ #
93
+ # @param payment_method_id [String, nil] A saved card of the customer. Automatic charge needs it.
94
+ #
95
+ # @param payment_terms [Dodopayments::Models::SubscriptionStartTrialParams::PaymentTerms::DueOnReceipt, Dodopayments::Models::SubscriptionStartTrialParams::PaymentTerms::Net, nil] The terms of the invoices after the trial.
96
+ #
97
+ # @param quantity [Integer]
98
+ #
99
+ # @param review_required [Boolean] `true` keeps each renewal draft for review before it finalises.
100
+ #
101
+ # @param tax_id [String, nil]
102
+ #
103
+ # @param trial_period_days [Integer, nil] 1 to 730 days. When this is not set, the product trial applies and the trial mis
104
+ #
105
+ # @param idempotency_key [String]
106
+ #
107
+ # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}]
108
+
109
+ class BillingAddress < Dodopayments::Internal::Type::BaseModel
110
+ # @!attribute country
111
+ # Two-letter ISO country code (ISO 3166-1 alpha-2)
112
+ #
113
+ # @return [Symbol, Dodopayments::Models::CountryCode]
114
+ required :country, enum: -> { Dodopayments::CountryCode }
115
+
116
+ # @!attribute city
117
+ #
118
+ # @return [String, nil]
119
+ optional :city, String, nil?: true
120
+
121
+ # @!attribute state
122
+ #
123
+ # @return [String, nil]
124
+ optional :state, String, nil?: true
125
+
126
+ # @!attribute street
127
+ #
128
+ # @return [String, nil]
129
+ optional :street, String, nil?: true
130
+
131
+ # @!attribute zipcode
132
+ #
133
+ # @return [String, nil]
134
+ optional :zipcode, String, nil?: true
135
+
136
+ # @!method initialize(country:, city: nil, state: nil, street: nil, zipcode: nil)
137
+ # The billing address of an invoice request.
138
+ #
139
+ # @param country [Symbol, Dodopayments::Models::CountryCode] Two-letter ISO country code (ISO 3166-1 alpha-2)
140
+ #
141
+ # @param city [String, nil]
142
+ #
143
+ # @param state [String, nil]
144
+ #
145
+ # @param street [String, nil]
146
+ #
147
+ # @param zipcode [String, nil]
148
+ end
149
+
150
+ # The terms of the invoices after the trial.
151
+ module PaymentTerms
152
+ extend Dodopayments::Internal::Type::Union
153
+
154
+ discriminator :type
155
+
156
+ variant :due_on_receipt, -> { Dodopayments::SubscriptionStartTrialParams::PaymentTerms::DueOnReceipt }
157
+
158
+ variant :net, -> { Dodopayments::SubscriptionStartTrialParams::PaymentTerms::Net }
159
+
160
+ class DueOnReceipt < Dodopayments::Internal::Type::BaseModel
161
+ # @!attribute type
162
+ #
163
+ # @return [Symbol, :due_on_receipt]
164
+ required :type, const: :due_on_receipt
165
+
166
+ # @!method initialize(type: :due_on_receipt)
167
+ # @param type [Symbol, :due_on_receipt]
168
+ end
169
+
170
+ class Net < Dodopayments::Internal::Type::BaseModel
171
+ # @!attribute days
172
+ #
173
+ # @return [Integer]
174
+ required :days, Integer
175
+
176
+ # @!attribute type
177
+ #
178
+ # @return [Symbol, :net]
179
+ required :type, const: :net
180
+
181
+ # @!method initialize(days:, type: :net)
182
+ # @param days [Integer]
183
+ # @param type [Symbol, :net]
184
+ end
185
+
186
+ # @!method self.variants
187
+ # @return [Array(Dodopayments::Models::SubscriptionStartTrialParams::PaymentTerms::DueOnReceipt, Dodopayments::Models::SubscriptionStartTrialParams::PaymentTerms::Net)]
188
+ end
189
+ end
190
+ end
191
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dodopayments
4
+ module Models
5
+ # @see Dodopayments::Resources::Subscriptions#start_trial
6
+ class SubscriptionStartTrialResponse < Dodopayments::Internal::Type::BaseModel
7
+ # @!attribute invoice_id
8
+ # The paid $0 invoice of the trial.
9
+ #
10
+ # @return [String]
11
+ required :invoice_id, String
12
+
13
+ # @!attribute subscription_id
14
+ #
15
+ # @return [String]
16
+ required :subscription_id, String
17
+
18
+ # @!attribute trial_ends_at
19
+ # The first invoice after the trial bills at this time.
20
+ #
21
+ # @return [Time]
22
+ required :trial_ends_at, Time
23
+
24
+ # @!method initialize(invoice_id:, subscription_id:, trial_ends_at:)
25
+ # @param invoice_id [String] The paid $0 invoice of the trial.
26
+ #
27
+ # @param subscription_id [String]
28
+ #
29
+ # @param trial_ends_at [Time] The first invoice after the trial bills at this time.
30
+ end
31
+ end
32
+ end
@@ -63,6 +63,8 @@ module Dodopayments
63
63
 
64
64
  AddonUpdateParams = Dodopayments::Models::AddonUpdateParams
65
65
 
66
+ AppInstallationRetrieveSettingsParams = Dodopayments::Models::AppInstallationRetrieveSettingsParams
67
+
66
68
  AttachAddon = Dodopayments::Models::AttachAddon
67
69
 
68
70
  AttachCreditEntitlement = Dodopayments::Models::AttachCreditEntitlement
@@ -589,6 +591,8 @@ module Dodopayments
589
591
 
590
592
  SubscriptionServicePeriod = Dodopayments::Models::SubscriptionServicePeriod
591
593
 
594
+ SubscriptionStartTrialParams = Dodopayments::Models::SubscriptionStartTrialParams
595
+
592
596
  SubscriptionStatus = Dodopayments::Models::SubscriptionStatus
593
597
 
594
598
  SubscriptionUnpausedWebhookEvent = Dodopayments::Models::SubscriptionUnpausedWebhookEvent
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dodopayments
4
+ module Resources
5
+ class AppInstallation
6
+ # The settings of the App Installation of the app token, with the secret values.
7
+ # The token grant gives the installation. The token needs `app_settings:read`.
8
+ #
9
+ # @overload retrieve_settings(request_options: {})
10
+ #
11
+ # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
12
+ #
13
+ # @return [Dodopayments::Models::AppInstallationRetrieveSettingsResponse]
14
+ #
15
+ # @see Dodopayments::Models::AppInstallationRetrieveSettingsParams
16
+ def retrieve_settings(params = {})
17
+ @client.request(
18
+ method: :get,
19
+ path: "app-installation/settings",
20
+ model: Dodopayments::Models::AppInstallationRetrieveSettingsResponse,
21
+ options: params[:request_options]
22
+ )
23
+ end
24
+
25
+ # @api private
26
+ #
27
+ # @param client [Dodopayments::Client]
28
+ def initialize(client:)
29
+ @client = client
30
+ end
31
+ end
32
+ end
33
+ end
@@ -214,21 +214,28 @@ module Dodopayments
214
214
  )
215
215
  end
216
216
 
217
- # @overload retrieve_payment_methods(customer_id, request_options: {})
217
+ # @overload retrieve_payment_methods(customer_id, billing_country: nil, currency: nil, request_options: {})
218
218
  #
219
219
  # @param customer_id [String] Customer Id
220
220
  #
221
+ # @param billing_country [Symbol, Dodopayments::Models::CountryCode] ISO country code alpha2 variant
222
+ #
223
+ # @param currency [Symbol, Dodopayments::Models::Currency]
224
+ #
221
225
  # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
222
226
  #
223
227
  # @return [Dodopayments::Models::CustomerRetrievePaymentMethodsResponse]
224
228
  #
225
229
  # @see Dodopayments::Models::CustomerRetrievePaymentMethodsParams
226
230
  def retrieve_payment_methods(customer_id, params = {})
231
+ parsed, options = Dodopayments::CustomerRetrievePaymentMethodsParams.dump_request(params)
232
+ query = Dodopayments::Internal::Util.encode_query_params(parsed)
227
233
  @client.request(
228
234
  method: :get,
229
235
  path: ["customers/%1$s/payment-methods", customer_id],
236
+ query: query,
230
237
  model: Dodopayments::Models::CustomerRetrievePaymentMethodsResponse,
231
- options: params[:request_options]
238
+ options: options
232
239
  )
233
240
  end
234
241