dodopayments 1.56.4 → 1.60.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 (54) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/README.md +1 -1
  4. data/lib/dodopayments/models/checkout_session_request.rb +50 -1
  5. data/lib/dodopayments/models/customer.rb +14 -1
  6. data/lib/dodopayments/models/customer_create_params.rb +12 -1
  7. data/lib/dodopayments/models/customer_limited_details.rb +9 -1
  8. data/lib/dodopayments/models/customer_retrieve_payment_methods_params.rb +14 -0
  9. data/lib/dodopayments/models/customer_retrieve_payment_methods_response.rb +183 -0
  10. data/lib/dodopayments/models/customer_update_params.rb +11 -1
  11. data/lib/dodopayments/models/product_create_params.rb +9 -9
  12. data/lib/dodopayments/models/subscription.rb +9 -1
  13. data/lib/dodopayments/models/subscription_list_response.rb +9 -1
  14. data/lib/dodopayments/models/subscription_update_payment_method_params.rb +41 -0
  15. data/lib/dodopayments/models/subscription_update_payment_method_response.rb +34 -0
  16. data/lib/dodopayments/models.rb +4 -0
  17. data/lib/dodopayments/resources/customers.rb +27 -2
  18. data/lib/dodopayments/resources/products.rb +3 -3
  19. data/lib/dodopayments/resources/subscriptions.rb +26 -0
  20. data/lib/dodopayments/version.rb +1 -1
  21. data/lib/dodopayments.rb +4 -0
  22. data/rbi/dodopayments/models/checkout_session_request.rbi +63 -0
  23. data/rbi/dodopayments/models/customer.rbi +11 -0
  24. data/rbi/dodopayments/models/customer_create_params.rbi +17 -1
  25. data/rbi/dodopayments/models/customer_limited_details.rbi +11 -0
  26. data/rbi/dodopayments/models/customer_retrieve_payment_methods_params.rbi +32 -0
  27. data/rbi/dodopayments/models/customer_retrieve_payment_methods_response.rbi +392 -0
  28. data/rbi/dodopayments/models/customer_update_params.rbi +13 -1
  29. data/rbi/dodopayments/models/product_create_params.rbi +8 -8
  30. data/rbi/dodopayments/models/subscription.rbi +8 -0
  31. data/rbi/dodopayments/models/subscription_list_response.rbi +8 -0
  32. data/rbi/dodopayments/models/subscription_update_payment_method_params.rbi +91 -0
  33. data/rbi/dodopayments/models/subscription_update_payment_method_response.rbi +56 -0
  34. data/rbi/dodopayments/models.rbi +6 -0
  35. data/rbi/dodopayments/resources/customers.rbi +25 -1
  36. data/rbi/dodopayments/resources/products.rbi +3 -3
  37. data/rbi/dodopayments/resources/subscriptions.rbi +20 -0
  38. data/sig/dodopayments/models/checkout_session_request.rbs +49 -0
  39. data/sig/dodopayments/models/customer.rbs +7 -0
  40. data/sig/dodopayments/models/customer_create_params.rbs +12 -1
  41. data/sig/dodopayments/models/customer_limited_details.rbs +7 -0
  42. data/sig/dodopayments/models/customer_retrieve_payment_methods_params.rbs +15 -0
  43. data/sig/dodopayments/models/customer_retrieve_payment_methods_response.rbs +180 -0
  44. data/sig/dodopayments/models/customer_update_params.rbs +9 -1
  45. data/sig/dodopayments/models/product_create_params.rbs +6 -6
  46. data/sig/dodopayments/models/subscription.rbs +5 -0
  47. data/sig/dodopayments/models/subscription_list_response.rbs +5 -0
  48. data/sig/dodopayments/models/subscription_update_payment_method_params.rbs +46 -0
  49. data/sig/dodopayments/models/subscription_update_payment_method_response.rbs +35 -0
  50. data/sig/dodopayments/models.rbs +4 -0
  51. data/sig/dodopayments/resources/customers.rbs +7 -0
  52. data/sig/dodopayments/resources/products.rbs +1 -1
  53. data/sig/dodopayments/resources/subscriptions.rbs +8 -0
  54. metadata +14 -2
@@ -9,11 +9,16 @@ module Dodopayments
9
9
  # @return [Dodopayments::Resources::Customers::Wallets]
10
10
  attr_reader :wallets
11
11
 
12
- # @overload create(email:, name:, phone_number: nil, request_options: {})
12
+ # @overload create(email:, name:, metadata: nil, phone_number: nil, request_options: {})
13
13
  #
14
14
  # @param email [String]
15
+ #
15
16
  # @param name [String]
17
+ #
18
+ # @param metadata [Hash{Symbol=>String}] Additional metadata for the customer
19
+ #
16
20
  # @param phone_number [String, nil]
21
+ #
17
22
  # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
18
23
  #
19
24
  # @return [Dodopayments::Models::Customer]
@@ -48,10 +53,12 @@ module Dodopayments
48
53
  )
49
54
  end
50
55
 
51
- # @overload update(customer_id, name: nil, phone_number: nil, request_options: {})
56
+ # @overload update(customer_id, metadata: nil, name: nil, phone_number: nil, request_options: {})
52
57
  #
53
58
  # @param customer_id [String] Customer Id
54
59
  #
60
+ # @param metadata [Hash{Symbol=>String}, nil] Additional metadata for the customer
61
+ #
55
62
  # @param name [String, nil]
56
63
  #
57
64
  # @param phone_number [String, nil]
@@ -97,6 +104,24 @@ module Dodopayments
97
104
  )
98
105
  end
99
106
 
107
+ # @overload retrieve_payment_methods(customer_id, request_options: {})
108
+ #
109
+ # @param customer_id [String] Customer Id
110
+ #
111
+ # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
112
+ #
113
+ # @return [Dodopayments::Models::CustomerRetrievePaymentMethodsResponse]
114
+ #
115
+ # @see Dodopayments::Models::CustomerRetrievePaymentMethodsParams
116
+ def retrieve_payment_methods(customer_id, params = {})
117
+ @client.request(
118
+ method: :get,
119
+ path: ["customers/%1$s/payment-methods", customer_id],
120
+ model: Dodopayments::Models::CustomerRetrievePaymentMethodsResponse,
121
+ options: params[:request_options]
122
+ )
123
+ end
124
+
100
125
  # @api private
101
126
  #
102
127
  # @param client [Dodopayments::Client]
@@ -9,7 +9,9 @@ module Dodopayments
9
9
  # Some parameter documentations has been truncated, see
10
10
  # {Dodopayments::Models::ProductCreateParams} for more details.
11
11
  #
12
- # @overload create(price:, tax_category:, addons: nil, brand_id: nil, description: nil, digital_product_delivery: nil, license_key_activation_message: nil, license_key_activations_limit: nil, license_key_duration: nil, license_key_enabled: nil, metadata: nil, name: nil, request_options: {})
12
+ # @overload create(name:, price:, tax_category:, addons: nil, brand_id: nil, description: nil, digital_product_delivery: nil, license_key_activation_message: nil, license_key_activations_limit: nil, license_key_duration: nil, license_key_enabled: nil, metadata: nil, request_options: {})
13
+ #
14
+ # @param name [String] Name of the product
13
15
  #
14
16
  # @param price [Dodopayments::Models::Price::OneTimePrice, Dodopayments::Models::Price::RecurringPrice, Dodopayments::Models::Price::UsageBasedPrice] Price configuration for the product
15
17
  #
@@ -33,8 +35,6 @@ module Dodopayments
33
35
  #
34
36
  # @param metadata [Hash{Symbol=>String}] Additional metadata for the product
35
37
  #
36
- # @param name [String, nil] Optional name of the product
37
- #
38
38
  # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
39
39
  #
40
40
  # @return [Dodopayments::Models::Product]
@@ -283,6 +283,32 @@ module Dodopayments
283
283
  )
284
284
  end
285
285
 
286
+ # @overload update_payment_method(subscription_id, type:, payment_method_id:, return_url: nil, request_options: {})
287
+ #
288
+ # @param subscription_id [String] Subscription Id
289
+ #
290
+ # @param type [Symbol, Dodopayments::Models::SubscriptionUpdatePaymentMethodParams::Type]
291
+ #
292
+ # @param payment_method_id [String]
293
+ #
294
+ # @param return_url [String, nil]
295
+ #
296
+ # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
297
+ #
298
+ # @return [Dodopayments::Models::SubscriptionUpdatePaymentMethodResponse]
299
+ #
300
+ # @see Dodopayments::Models::SubscriptionUpdatePaymentMethodParams
301
+ def update_payment_method(subscription_id, params)
302
+ parsed, options = Dodopayments::SubscriptionUpdatePaymentMethodParams.dump_request(params)
303
+ @client.request(
304
+ method: :post,
305
+ path: ["subscriptions/%1$s/update-payment-method", subscription_id],
306
+ body: parsed,
307
+ model: Dodopayments::Models::SubscriptionUpdatePaymentMethodResponse,
308
+ options: options
309
+ )
310
+ end
311
+
286
312
  # @api private
287
313
  #
288
314
  # @param client [Dodopayments::Client]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dodopayments
4
- VERSION = "1.56.4"
4
+ VERSION = "1.60.0"
5
5
  end
data/lib/dodopayments.rb CHANGED
@@ -94,6 +94,8 @@ require_relative "dodopayments/models/customer_list_params"
94
94
  require_relative "dodopayments/models/customer_portal_session"
95
95
  require_relative "dodopayments/models/customer_request"
96
96
  require_relative "dodopayments/models/customer_retrieve_params"
97
+ require_relative "dodopayments/models/customer_retrieve_payment_methods_params"
98
+ require_relative "dodopayments/models/customer_retrieve_payment_methods_response"
97
99
  require_relative "dodopayments/models/customers/customer_portal_create_params"
98
100
  require_relative "dodopayments/models/customers/customer_wallet"
99
101
  require_relative "dodopayments/models/customers/wallet_list_params"
@@ -228,6 +230,8 @@ require_relative "dodopayments/models/subscription_retrieve_usage_history_params
228
230
  require_relative "dodopayments/models/subscription_retrieve_usage_history_response"
229
231
  require_relative "dodopayments/models/subscription_status"
230
232
  require_relative "dodopayments/models/subscription_update_params"
233
+ require_relative "dodopayments/models/subscription_update_payment_method_params"
234
+ require_relative "dodopayments/models/subscription_update_payment_method_response"
231
235
  require_relative "dodopayments/models/tax_category"
232
236
  require_relative "dodopayments/models/time_interval"
233
237
  require_relative "dodopayments/models/unsafe_unwrap_webhook_event"
@@ -528,6 +528,48 @@ module Dodopayments
528
528
  sig { params(allow_currency_selection: T::Boolean).void }
529
529
  attr_writer :allow_currency_selection
530
530
 
531
+ sig { returns(T.nilable(T::Boolean)) }
532
+ attr_reader :allow_customer_editing_city
533
+
534
+ sig { params(allow_customer_editing_city: T::Boolean).void }
535
+ attr_writer :allow_customer_editing_city
536
+
537
+ sig { returns(T.nilable(T::Boolean)) }
538
+ attr_reader :allow_customer_editing_country
539
+
540
+ sig { params(allow_customer_editing_country: T::Boolean).void }
541
+ attr_writer :allow_customer_editing_country
542
+
543
+ sig { returns(T.nilable(T::Boolean)) }
544
+ attr_reader :allow_customer_editing_email
545
+
546
+ sig { params(allow_customer_editing_email: T::Boolean).void }
547
+ attr_writer :allow_customer_editing_email
548
+
549
+ sig { returns(T.nilable(T::Boolean)) }
550
+ attr_reader :allow_customer_editing_name
551
+
552
+ sig { params(allow_customer_editing_name: T::Boolean).void }
553
+ attr_writer :allow_customer_editing_name
554
+
555
+ sig { returns(T.nilable(T::Boolean)) }
556
+ attr_reader :allow_customer_editing_state
557
+
558
+ sig { params(allow_customer_editing_state: T::Boolean).void }
559
+ attr_writer :allow_customer_editing_state
560
+
561
+ sig { returns(T.nilable(T::Boolean)) }
562
+ attr_reader :allow_customer_editing_street
563
+
564
+ sig { params(allow_customer_editing_street: T::Boolean).void }
565
+ attr_writer :allow_customer_editing_street
566
+
567
+ sig { returns(T.nilable(T::Boolean)) }
568
+ attr_reader :allow_customer_editing_zipcode
569
+
570
+ sig { params(allow_customer_editing_zipcode: T::Boolean).void }
571
+ attr_writer :allow_customer_editing_zipcode
572
+
531
573
  # If the customer is allowed to apply discount code, set it to true.
532
574
  #
533
575
  # Default is true
@@ -568,6 +610,13 @@ module Dodopayments
568
610
  sig do
569
611
  params(
570
612
  allow_currency_selection: T::Boolean,
613
+ allow_customer_editing_city: T::Boolean,
614
+ allow_customer_editing_country: T::Boolean,
615
+ allow_customer_editing_email: T::Boolean,
616
+ allow_customer_editing_name: T::Boolean,
617
+ allow_customer_editing_state: T::Boolean,
618
+ allow_customer_editing_street: T::Boolean,
619
+ allow_customer_editing_zipcode: T::Boolean,
571
620
  allow_discount_code: T::Boolean,
572
621
  allow_phone_number_collection: T::Boolean,
573
622
  allow_tax_id: T::Boolean,
@@ -579,6 +628,13 @@ module Dodopayments
579
628
  #
580
629
  # Default is true
581
630
  allow_currency_selection: nil,
631
+ allow_customer_editing_city: nil,
632
+ allow_customer_editing_country: nil,
633
+ allow_customer_editing_email: nil,
634
+ allow_customer_editing_name: nil,
635
+ allow_customer_editing_state: nil,
636
+ allow_customer_editing_street: nil,
637
+ allow_customer_editing_zipcode: nil,
582
638
  # If the customer is allowed to apply discount code, set it to true.
583
639
  #
584
640
  # Default is true
@@ -603,6 +659,13 @@ module Dodopayments
603
659
  override.returns(
604
660
  {
605
661
  allow_currency_selection: T::Boolean,
662
+ allow_customer_editing_city: T::Boolean,
663
+ allow_customer_editing_country: T::Boolean,
664
+ allow_customer_editing_email: T::Boolean,
665
+ allow_customer_editing_name: T::Boolean,
666
+ allow_customer_editing_state: T::Boolean,
667
+ allow_customer_editing_street: T::Boolean,
668
+ allow_customer_editing_zipcode: T::Boolean,
606
669
  allow_discount_code: T::Boolean,
607
670
  allow_phone_number_collection: T::Boolean,
608
671
  allow_tax_id: T::Boolean,
@@ -23,6 +23,13 @@ module Dodopayments
23
23
  sig { returns(String) }
24
24
  attr_accessor :name
25
25
 
26
+ # Additional metadata for the customer
27
+ sig { returns(T.nilable(T::Hash[Symbol, String])) }
28
+ attr_reader :metadata
29
+
30
+ sig { params(metadata: T::Hash[Symbol, String]).void }
31
+ attr_writer :metadata
32
+
26
33
  sig { returns(T.nilable(String)) }
27
34
  attr_accessor :phone_number
28
35
 
@@ -33,6 +40,7 @@ module Dodopayments
33
40
  customer_id: String,
34
41
  email: String,
35
42
  name: String,
43
+ metadata: T::Hash[Symbol, String],
36
44
  phone_number: T.nilable(String)
37
45
  ).returns(T.attached_class)
38
46
  end
@@ -42,6 +50,8 @@ module Dodopayments
42
50
  customer_id:,
43
51
  email:,
44
52
  name:,
53
+ # Additional metadata for the customer
54
+ metadata: nil,
45
55
  phone_number: nil
46
56
  )
47
57
  end
@@ -54,6 +64,7 @@ module Dodopayments
54
64
  customer_id: String,
55
65
  email: String,
56
66
  name: String,
67
+ metadata: T::Hash[Symbol, String],
57
68
  phone_number: T.nilable(String)
58
69
  }
59
70
  )
@@ -20,6 +20,13 @@ module Dodopayments
20
20
  sig { returns(String) }
21
21
  attr_accessor :name
22
22
 
23
+ # Additional metadata for the customer
24
+ sig { returns(T.nilable(T::Hash[Symbol, String])) }
25
+ attr_reader :metadata
26
+
27
+ sig { params(metadata: T::Hash[Symbol, String]).void }
28
+ attr_writer :metadata
29
+
23
30
  sig { returns(T.nilable(String)) }
24
31
  attr_accessor :phone_number
25
32
 
@@ -27,11 +34,19 @@ module Dodopayments
27
34
  params(
28
35
  email: String,
29
36
  name: String,
37
+ metadata: T::Hash[Symbol, String],
30
38
  phone_number: T.nilable(String),
31
39
  request_options: Dodopayments::RequestOptions::OrHash
32
40
  ).returns(T.attached_class)
33
41
  end
34
- def self.new(email:, name:, phone_number: nil, request_options: {})
42
+ def self.new(
43
+ email:,
44
+ name:,
45
+ # Additional metadata for the customer
46
+ metadata: nil,
47
+ phone_number: nil,
48
+ request_options: {}
49
+ )
35
50
  end
36
51
 
37
52
  sig do
@@ -39,6 +54,7 @@ module Dodopayments
39
54
  {
40
55
  email: String,
41
56
  name: String,
57
+ metadata: T::Hash[Symbol, String],
42
58
  phone_number: T.nilable(String),
43
59
  request_options: Dodopayments::RequestOptions
44
60
  }
@@ -23,6 +23,13 @@ module Dodopayments
23
23
  sig { returns(String) }
24
24
  attr_accessor :name
25
25
 
26
+ # Additional metadata associated with the customer
27
+ sig { returns(T.nilable(T::Hash[Symbol, String])) }
28
+ attr_reader :metadata
29
+
30
+ sig { params(metadata: T::Hash[Symbol, String]).void }
31
+ attr_writer :metadata
32
+
26
33
  # Phone number of the customer
27
34
  sig { returns(T.nilable(String)) }
28
35
  attr_accessor :phone_number
@@ -32,6 +39,7 @@ module Dodopayments
32
39
  customer_id: String,
33
40
  email: String,
34
41
  name: String,
42
+ metadata: T::Hash[Symbol, String],
35
43
  phone_number: T.nilable(String)
36
44
  ).returns(T.attached_class)
37
45
  end
@@ -42,6 +50,8 @@ module Dodopayments
42
50
  email:,
43
51
  # Full name of the customer
44
52
  name:,
53
+ # Additional metadata associated with the customer
54
+ metadata: nil,
45
55
  # Phone number of the customer
46
56
  phone_number: nil
47
57
  )
@@ -53,6 +63,7 @@ module Dodopayments
53
63
  customer_id: String,
54
64
  email: String,
55
65
  name: String,
66
+ metadata: T::Hash[Symbol, String],
56
67
  phone_number: T.nilable(String)
57
68
  }
58
69
  )
@@ -0,0 +1,32 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ class CustomerRetrievePaymentMethodsParams < Dodopayments::Internal::Type::BaseModel
6
+ extend Dodopayments::Internal::Type::RequestParameters::Converter
7
+ include Dodopayments::Internal::Type::RequestParameters
8
+
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(
12
+ Dodopayments::CustomerRetrievePaymentMethodsParams,
13
+ Dodopayments::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ sig do
18
+ params(request_options: Dodopayments::RequestOptions::OrHash).returns(
19
+ T.attached_class
20
+ )
21
+ end
22
+ def self.new(request_options: {})
23
+ end
24
+
25
+ sig do
26
+ override.returns({ request_options: Dodopayments::RequestOptions })
27
+ end
28
+ def to_hash
29
+ end
30
+ end
31
+ end
32
+ end