dodopayments 1.18.0 → 1.18.3

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 (110) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +26 -0
  3. data/README.md +1 -1
  4. data/lib/dodopayments/file_part.rb +55 -0
  5. data/lib/dodopayments/internal/transport/base_client.rb +3 -3
  6. data/lib/dodopayments/internal/transport/pooled_net_requester.rb +1 -1
  7. data/lib/dodopayments/internal/type/converter.rb +1 -1
  8. data/lib/dodopayments/internal/type/{io_like.rb → file_input.rb} +8 -4
  9. data/lib/dodopayments/internal/util.rb +69 -61
  10. data/lib/dodopayments/models/billing_address.rb +9 -5
  11. data/lib/dodopayments/models/create_new_customer.rb +8 -1
  12. data/lib/dodopayments/models/customer_limited_details.rb +5 -3
  13. data/lib/dodopayments/models/customer_list_params.rb +4 -2
  14. data/lib/dodopayments/models/customers/customer_portal_create_params.rb +2 -1
  15. data/lib/dodopayments/models/discount.rb +23 -10
  16. data/lib/dodopayments/models/discount_create_params.rb +15 -5
  17. data/lib/dodopayments/models/discount_list_params.rb +4 -2
  18. data/lib/dodopayments/models/discount_update_params.rb +13 -3
  19. data/lib/dodopayments/models/dispute.rb +17 -6
  20. data/lib/dodopayments/models/dispute_list_params.rb +14 -7
  21. data/lib/dodopayments/models/license_key.rb +26 -11
  22. data/lib/dodopayments/models/license_key_instance_list_params.rb +6 -3
  23. data/lib/dodopayments/models/license_key_list_params.rb +10 -5
  24. data/lib/dodopayments/models/license_key_update_params.rb +9 -3
  25. data/lib/dodopayments/models/one_time_product_cart_item.rb +7 -1
  26. data/lib/dodopayments/models/payment.rb +53 -17
  27. data/lib/dodopayments/models/payment_create_params.rb +22 -7
  28. data/lib/dodopayments/models/payment_create_response.rb +16 -6
  29. data/lib/dodopayments/models/payment_list_params.rb +14 -7
  30. data/lib/dodopayments/models/payout_list_params.rb +4 -2
  31. data/lib/dodopayments/models/payout_list_response.rb +27 -13
  32. data/lib/dodopayments/models/price.rb +38 -13
  33. data/lib/dodopayments/models/product.rb +31 -13
  34. data/lib/dodopayments/models/product_create_params.rb +20 -7
  35. data/lib/dodopayments/models/product_list_params.rb +11 -4
  36. data/lib/dodopayments/models/product_list_response.rb +27 -11
  37. data/lib/dodopayments/models/product_update_params.rb +22 -8
  38. data/lib/dodopayments/models/refund.rb +13 -6
  39. data/lib/dodopayments/models/refund_create_params.rb +4 -2
  40. data/lib/dodopayments/models/refund_list_params.rb +12 -6
  41. data/lib/dodopayments/models/subscription.rb +37 -13
  42. data/lib/dodopayments/models/subscription_change_plan_params.rb +5 -2
  43. data/lib/dodopayments/models/subscription_charge_params.rb +6 -1
  44. data/lib/dodopayments/models/subscription_create_params.rb +34 -11
  45. data/lib/dodopayments/models/subscription_create_response.rb +15 -5
  46. data/lib/dodopayments/models/subscription_list_params.rb +12 -6
  47. data/lib/dodopayments/models/webhook_event_list_params.rb +16 -6
  48. data/lib/dodopayments/resources/customers/customer_portal.rb +4 -2
  49. data/lib/dodopayments/resources/customers.rb +10 -4
  50. data/lib/dodopayments/resources/discounts.rb +38 -13
  51. data/lib/dodopayments/resources/disputes.rb +16 -8
  52. data/lib/dodopayments/resources/license_key_instances.rb +11 -5
  53. data/lib/dodopayments/resources/license_keys.rb +23 -10
  54. data/lib/dodopayments/resources/payments.rb +38 -15
  55. data/lib/dodopayments/resources/payouts.rb +4 -2
  56. data/lib/dodopayments/resources/products/images.rb +3 -1
  57. data/lib/dodopayments/resources/products.rb +56 -20
  58. data/lib/dodopayments/resources/refunds.rb +18 -9
  59. data/lib/dodopayments/resources/subscriptions.rb +62 -22
  60. data/lib/dodopayments/resources/webhook_events.rb +16 -6
  61. data/lib/dodopayments/version.rb +1 -1
  62. data/lib/dodopayments.rb +2 -1
  63. data/rbi/lib/dodopayments/file_part.rbi +34 -0
  64. data/rbi/lib/dodopayments/internal/transport/base_client.rbi +17 -3
  65. data/rbi/lib/dodopayments/internal/type/{io_like.rbi → file_input.rbi} +6 -2
  66. data/rbi/lib/dodopayments/internal/util.rbi +24 -19
  67. data/rbi/lib/dodopayments/models/billing_address.rbi +12 -2
  68. data/rbi/lib/dodopayments/models/create_new_customer.rbi +9 -2
  69. data/rbi/lib/dodopayments/models/customer_limited_details.rbi +8 -2
  70. data/rbi/lib/dodopayments/models/customer_list_params.rbi +7 -2
  71. data/rbi/lib/dodopayments/models/customers/customer_portal_create_params.rbi +5 -2
  72. data/rbi/lib/dodopayments/models/discount.rbi +14 -0
  73. data/rbi/lib/dodopayments/models/discount_create_params.rbi +15 -0
  74. data/rbi/lib/dodopayments/models/discount_list_params.rbi +7 -2
  75. data/rbi/lib/dodopayments/models/discount_update_params.rbi +10 -0
  76. data/rbi/lib/dodopayments/models/dispute.rbi +8 -3
  77. data/rbi/lib/dodopayments/models/dispute_list_params.rbi +7 -0
  78. data/rbi/lib/dodopayments/models/license_key.rbi +12 -0
  79. data/rbi/lib/dodopayments/models/license_key_instance_list_params.rbi +9 -2
  80. data/rbi/lib/dodopayments/models/license_key_list_params.rbi +6 -3
  81. data/rbi/lib/dodopayments/models/license_key_update_params.rbi +12 -2
  82. data/rbi/lib/dodopayments/models/one_time_product_cart_item.rbi +8 -2
  83. data/rbi/lib/dodopayments/models/payment.rbi +31 -0
  84. data/rbi/lib/dodopayments/models/payment_create_params.rbi +14 -0
  85. data/rbi/lib/dodopayments/models/payment_create_response.rbi +7 -0
  86. data/rbi/lib/dodopayments/models/payment_list_params.rbi +7 -0
  87. data/rbi/lib/dodopayments/models/payout_list_params.rbi +7 -2
  88. data/rbi/lib/dodopayments/models/payout_list_response.rbi +13 -0
  89. data/rbi/lib/dodopayments/models/price.rbi +25 -0
  90. data/rbi/lib/dodopayments/models/product.rbi +14 -0
  91. data/rbi/lib/dodopayments/models/product_create_params.rbi +8 -0
  92. data/rbi/lib/dodopayments/models/product_list_params.rbi +15 -2
  93. data/rbi/lib/dodopayments/models/product_list_response.rbi +21 -0
  94. data/rbi/lib/dodopayments/models/product_update_params.rbi +18 -0
  95. data/rbi/lib/dodopayments/models/refund.rbi +7 -3
  96. data/rbi/lib/dodopayments/models/refund_create_params.rbi +7 -2
  97. data/rbi/lib/dodopayments/models/refund_list_params.rbi +6 -0
  98. data/rbi/lib/dodopayments/models/subscription.rbi +15 -0
  99. data/rbi/lib/dodopayments/models/subscription_change_plan_params.rbi +8 -2
  100. data/rbi/lib/dodopayments/models/subscription_charge_params.rbi +6 -2
  101. data/rbi/lib/dodopayments/models/subscription_create_params.rbi +25 -2
  102. data/rbi/lib/dodopayments/models/subscription_create_response.rbi +7 -0
  103. data/rbi/lib/dodopayments/models/subscription_list_params.rbi +6 -0
  104. data/rbi/lib/dodopayments/models/webhook_event_list_params.rbi +6 -0
  105. data/sig/dodopayments/file_part.rbs +21 -0
  106. data/sig/dodopayments/internal/transport/base_client.rbs +9 -3
  107. data/sig/dodopayments/internal/type/{io_like.rbs → file_input.rbs} +1 -1
  108. data/sig/dodopayments/internal/util.rbs +14 -12
  109. data/sig/dodopayments/models/payment.rbs +4 -0
  110. metadata +8 -5
@@ -3,19 +3,34 @@
3
3
  module Dodopayments
4
4
  module Resources
5
5
  class Payments
6
+ # Some parameter documentations has been truncated, see
7
+ # {Dodopayments::Models::PaymentCreateParams} for more details.
8
+ #
6
9
  # @overload create(billing:, customer:, product_cart:, allowed_payment_method_types: nil, billing_currency: nil, discount_code: nil, metadata: nil, payment_link: nil, return_url: nil, show_saved_payment_methods: nil, tax_id: nil, request_options: {})
7
10
  #
8
11
  # @param billing [Dodopayments::Models::BillingAddress]
12
+ #
9
13
  # @param customer [Dodopayments::Models::AttachExistingCustomer, Dodopayments::Models::CreateNewCustomer]
10
- # @param product_cart [Array<Dodopayments::Models::OneTimeProductCartItem>]
11
- # @param allowed_payment_method_types [Array<Symbol, Dodopayments::Models::PaymentCreateParams::AllowedPaymentMethodType>, nil]
14
+ #
15
+ # @param product_cart [Array<Dodopayments::Models::OneTimeProductCartItem>] List of products in the cart. Must contain at least 1 and at most 100 items.
16
+ #
17
+ # @param allowed_payment_method_types [Array<Symbol, Dodopayments::Models::PaymentCreateParams::AllowedPaymentMethodType>, nil] List of payment methods allowed during checkout. ...
18
+ #
12
19
  # @param billing_currency [Symbol, Dodopayments::Models::PaymentCreateParams::BillingCurrency, nil]
13
- # @param discount_code [String, nil]
20
+ #
21
+ # @param discount_code [String, nil] Discount Code to apply to the transaction
22
+ #
14
23
  # @param metadata [Hash{Symbol=>String}]
15
- # @param payment_link [Boolean, nil]
16
- # @param return_url [String, nil]
17
- # @param show_saved_payment_methods [Boolean]
18
- # @param tax_id [String, nil]
24
+ #
25
+ # @param payment_link [Boolean, nil] Whether to generate a payment link. Defaults to false if not specified.
26
+ #
27
+ # @param return_url [String, nil] Optional URL to redirect the customer after payment. ...
28
+ #
29
+ # @param show_saved_payment_methods [Boolean] Display saved payment methods of a returning customer ...
30
+ #
31
+ # @param tax_id [String, nil] Tax ID in case the payment is B2B. If tax id validation fails the payment creati
32
+ # ...
33
+ #
19
34
  # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
20
35
  #
21
36
  # @return [Dodopayments::Models::PaymentCreateResponse]
@@ -34,7 +49,8 @@ module Dodopayments
34
49
 
35
50
  # @overload retrieve(payment_id, request_options: {})
36
51
  #
37
- # @param payment_id [String]
52
+ # @param payment_id [String] Payment Id
53
+ #
38
54
  # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
39
55
  #
40
56
  # @return [Dodopayments::Models::Payment]
@@ -51,13 +67,20 @@ module Dodopayments
51
67
 
52
68
  # @overload list(created_at_gte: nil, created_at_lte: nil, customer_id: nil, page_number: nil, page_size: nil, status: nil, subscription_id: nil, request_options: {})
53
69
  #
54
- # @param created_at_gte [Time, nil]
55
- # @param created_at_lte [Time, nil]
56
- # @param customer_id [String, nil]
57
- # @param page_number [Integer, nil]
58
- # @param page_size [Integer, nil]
59
- # @param status [Symbol, Dodopayments::Models::IntentStatus, nil]
60
- # @param subscription_id [String, nil]
70
+ # @param created_at_gte [Time, nil] Get events after this created time
71
+ #
72
+ # @param created_at_lte [Time, nil] Get events created before this time
73
+ #
74
+ # @param customer_id [String, nil] Filter by customer id
75
+ #
76
+ # @param page_number [Integer, nil] Page number default is 0
77
+ #
78
+ # @param page_size [Integer, nil] Page size default is 10 max is 100
79
+ #
80
+ # @param status [Symbol, Dodopayments::Models::IntentStatus, nil] Filter by status
81
+ #
82
+ # @param subscription_id [String, nil] Filter by subscription id
83
+ #
61
84
  # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
62
85
  #
63
86
  # @return [Dodopayments::Internal::DefaultPageNumberPagination<Dodopayments::Models::PaymentListResponse>]
@@ -5,8 +5,10 @@ module Dodopayments
5
5
  class Payouts
6
6
  # @overload list(page_number: nil, page_size: nil, request_options: {})
7
7
  #
8
- # @param page_number [Integer, nil]
9
- # @param page_size [Integer, nil]
8
+ # @param page_number [Integer, nil] Page number default is 0
9
+ #
10
+ # @param page_size [Integer, nil] Page size default is 10 max is 100
11
+ #
10
12
  # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
11
13
  #
12
14
  # @return [Dodopayments::Internal::DefaultPageNumberPagination<Dodopayments::Models::PayoutListResponse>]
@@ -6,8 +6,10 @@ module Dodopayments
6
6
  class Images
7
7
  # @overload update(id, force_update: nil, request_options: {})
8
8
  #
9
- # @param id [String]
9
+ # @param id [String] Product Id
10
+ #
10
11
  # @param force_update [Boolean, nil]
12
+ #
11
13
  # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
12
14
  #
13
15
  # @return [Dodopayments::Models::Products::ImageUpdateResponse]
@@ -6,17 +6,30 @@ module Dodopayments
6
6
  # @return [Dodopayments::Resources::Products::Images]
7
7
  attr_reader :images
8
8
 
9
+ # Some parameter documentations has been truncated, see
10
+ # {Dodopayments::Models::ProductCreateParams} for more details.
11
+ #
9
12
  # @overload create(price:, tax_category:, addons: nil, description: nil, license_key_activation_message: nil, license_key_activations_limit: nil, license_key_duration: nil, license_key_enabled: nil, name: nil, request_options: {})
10
13
  #
11
14
  # @param price [Dodopayments::Models::Price::OneTimePrice, Dodopayments::Models::Price::RecurringPrice]
12
- # @param tax_category [Symbol, Dodopayments::Models::ProductCreateParams::TaxCategory]
13
- # @param addons [Array<String>, nil]
14
- # @param description [String, nil]
15
- # @param license_key_activation_message [String, nil]
16
- # @param license_key_activations_limit [Integer, nil]
15
+ #
16
+ # @param tax_category [Symbol, Dodopayments::Models::ProductCreateParams::TaxCategory] Represents the different categories of taxation applicable to various products a
17
+ # ...
18
+ #
19
+ # @param addons [Array<String>, nil] Addons available for subscription product
20
+ #
21
+ # @param description [String, nil] Optional description of the product
22
+ #
23
+ # @param license_key_activation_message [String, nil] Optional message displayed during license key activation
24
+ #
25
+ # @param license_key_activations_limit [Integer, nil] The number of times the license key can be activated. ...
26
+ #
17
27
  # @param license_key_duration [Dodopayments::Models::LicenseKeyDuration, nil]
18
- # @param license_key_enabled [Boolean, nil]
19
- # @param name [String, nil]
28
+ #
29
+ # @param license_key_enabled [Boolean, nil] When true, generates and sends a license key to your customer. ...
30
+ #
31
+ # @param name [String, nil] Optional name of the product
32
+ #
20
33
  # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
21
34
  #
22
35
  # @return [Dodopayments::Models::Product]
@@ -35,7 +48,8 @@ module Dodopayments
35
48
 
36
49
  # @overload retrieve(id, request_options: {})
37
50
  #
38
- # @param id [String]
51
+ # @param id [String] Product Id
52
+ #
39
53
  # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
40
54
  #
41
55
  # @return [Dodopayments::Models::Product]
@@ -50,19 +64,34 @@ module Dodopayments
50
64
  )
51
65
  end
52
66
 
67
+ # Some parameter documentations has been truncated, see
68
+ # {Dodopayments::Models::ProductUpdateParams} for more details.
69
+ #
53
70
  # @overload update(id, addons: nil, description: nil, image_id: nil, license_key_activation_message: nil, license_key_activations_limit: nil, license_key_duration: nil, license_key_enabled: nil, name: nil, price: nil, tax_category: nil, request_options: {})
54
71
  #
55
72
  # @param id [String]
56
- # @param addons [Array<String>, nil]
57
- # @param description [String, nil]
58
- # @param image_id [String, nil]
59
- # @param license_key_activation_message [String, nil]
60
- # @param license_key_activations_limit [Integer, nil]
73
+ #
74
+ # @param addons [Array<String>, nil] Available Addons for subscription products
75
+ #
76
+ # @param description [String, nil] Description of the product, optional and must be at most 1000 characters.
77
+ #
78
+ # @param image_id [String, nil] Product image id after its uploaded to S3
79
+ #
80
+ # @param license_key_activation_message [String, nil] Message sent to the customer upon license key activation. ...
81
+ #
82
+ # @param license_key_activations_limit [Integer, nil] Limit for the number of activations for the license key. ...
83
+ #
61
84
  # @param license_key_duration [Dodopayments::Models::LicenseKeyDuration, nil]
62
- # @param license_key_enabled [Boolean, nil]
63
- # @param name [String, nil]
85
+ #
86
+ # @param license_key_enabled [Boolean, nil] Whether the product requires a license key. ...
87
+ #
88
+ # @param name [String, nil] Name of the product, optional and must be at most 100 characters.
89
+ #
64
90
  # @param price [Dodopayments::Models::Price::OneTimePrice, Dodopayments::Models::Price::RecurringPrice, nil]
65
- # @param tax_category [Symbol, Dodopayments::Models::ProductUpdateParams::TaxCategory, nil]
91
+ #
92
+ # @param tax_category [Symbol, Dodopayments::Models::ProductUpdateParams::TaxCategory, nil] Represents the different categories of taxation applicable to various products a
93
+ # ...
94
+ #
66
95
  # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
67
96
  #
68
97
  # @return [nil]
@@ -79,12 +108,19 @@ module Dodopayments
79
108
  )
80
109
  end
81
110
 
111
+ # Some parameter documentations has been truncated, see
112
+ # {Dodopayments::Models::ProductListParams} for more details.
113
+ #
82
114
  # @overload list(archived: nil, page_number: nil, page_size: nil, recurring: nil, request_options: {})
83
115
  #
84
- # @param archived [Boolean]
85
- # @param page_number [Integer, nil]
86
- # @param page_size [Integer, nil]
87
- # @param recurring [Boolean, nil]
116
+ # @param archived [Boolean] List archived products
117
+ #
118
+ # @param page_number [Integer, nil] Page number default is 0
119
+ #
120
+ # @param page_size [Integer, nil] Page size default is 10 max is 100
121
+ #
122
+ # @param recurring [Boolean, nil] Filter products by pricing type: ...
123
+ #
88
124
  # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
89
125
  #
90
126
  # @return [Dodopayments::Internal::DefaultPageNumberPagination<Dodopayments::Models::ProductListResponse>]
@@ -5,8 +5,10 @@ module Dodopayments
5
5
  class Refunds
6
6
  # @overload create(payment_id:, reason: nil, request_options: {})
7
7
  #
8
- # @param payment_id [String]
9
- # @param reason [String, nil]
8
+ # @param payment_id [String] The unique identifier of the payment to be refunded.
9
+ #
10
+ # @param reason [String, nil] The reason for the refund, if any. Maximum length is 3000 characters. Optional.
11
+ #
10
12
  # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
11
13
  #
12
14
  # @return [Dodopayments::Models::Refund]
@@ -25,7 +27,8 @@ module Dodopayments
25
27
 
26
28
  # @overload retrieve(refund_id, request_options: {})
27
29
  #
28
- # @param refund_id [String]
30
+ # @param refund_id [String] Refund Id
31
+ #
29
32
  # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
30
33
  #
31
34
  # @return [Dodopayments::Models::Refund]
@@ -42,12 +45,18 @@ module Dodopayments
42
45
 
43
46
  # @overload list(created_at_gte: nil, created_at_lte: nil, customer_id: nil, page_number: nil, page_size: nil, status: nil, request_options: {})
44
47
  #
45
- # @param created_at_gte [Time, nil]
46
- # @param created_at_lte [Time, nil]
47
- # @param customer_id [String, nil]
48
- # @param page_number [Integer, nil]
49
- # @param page_size [Integer, nil]
50
- # @param status [Symbol, Dodopayments::Models::RefundStatus, nil]
48
+ # @param created_at_gte [Time, nil] Get events after this created time
49
+ #
50
+ # @param created_at_lte [Time, nil] Get events created before this time
51
+ #
52
+ # @param customer_id [String, nil] Filter by customer_id
53
+ #
54
+ # @param page_number [Integer, nil] Page number default is 0
55
+ #
56
+ # @param page_size [Integer, nil] Page size default is 10 max is 100
57
+ #
58
+ # @param status [Symbol, Dodopayments::Models::RefundStatus, nil] Filter by status
59
+ #
51
60
  # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
52
61
  #
53
62
  # @return [Dodopayments::Internal::DefaultPageNumberPagination<Dodopayments::Models::Refund>]
@@ -3,22 +3,40 @@
3
3
  module Dodopayments
4
4
  module Resources
5
5
  class Subscriptions
6
+ # Some parameter documentations has been truncated, see
7
+ # {Dodopayments::Models::SubscriptionCreateParams} for more details.
8
+ #
6
9
  # @overload create(billing:, customer:, product_id:, quantity:, allowed_payment_method_types: nil, billing_currency: nil, discount_code: nil, metadata: nil, on_demand: nil, payment_link: nil, return_url: nil, show_saved_payment_methods: nil, tax_id: nil, trial_period_days: nil, request_options: {})
7
10
  #
8
11
  # @param billing [Dodopayments::Models::BillingAddress]
12
+ #
9
13
  # @param customer [Dodopayments::Models::AttachExistingCustomer, Dodopayments::Models::CreateNewCustomer]
10
- # @param product_id [String]
11
- # @param quantity [Integer]
12
- # @param allowed_payment_method_types [Array<Symbol, Dodopayments::Models::SubscriptionCreateParams::AllowedPaymentMethodType>, nil]
14
+ #
15
+ # @param product_id [String] Unique identifier of the product to subscribe to
16
+ #
17
+ # @param quantity [Integer] Number of units to subscribe for. Must be at least 1.
18
+ #
19
+ # @param allowed_payment_method_types [Array<Symbol, Dodopayments::Models::SubscriptionCreateParams::AllowedPaymentMethodType>, nil] List of payment methods allowed during checkout. ...
20
+ #
13
21
  # @param billing_currency [Symbol, Dodopayments::Models::SubscriptionCreateParams::BillingCurrency, nil]
14
- # @param discount_code [String, nil]
22
+ #
23
+ # @param discount_code [String, nil] Discount Code to apply to the subscription
24
+ #
15
25
  # @param metadata [Hash{Symbol=>String}]
26
+ #
16
27
  # @param on_demand [Dodopayments::Models::SubscriptionCreateParams::OnDemand, nil]
17
- # @param payment_link [Boolean, nil]
18
- # @param return_url [String, nil]
19
- # @param show_saved_payment_methods [Boolean]
20
- # @param tax_id [String, nil]
21
- # @param trial_period_days [Integer, nil]
28
+ #
29
+ # @param payment_link [Boolean, nil] If true, generates a payment link. ...
30
+ #
31
+ # @param return_url [String, nil] Optional URL to redirect after successful subscription creation
32
+ #
33
+ # @param show_saved_payment_methods [Boolean] Display saved payment methods of a returning customer ...
34
+ #
35
+ # @param tax_id [String, nil] Tax ID in case the payment is B2B. If tax id validation fails the payment creati
36
+ # ...
37
+ #
38
+ # @param trial_period_days [Integer, nil] Optional trial period in days ...
39
+ #
22
40
  # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
23
41
  #
24
42
  # @return [Dodopayments::Models::SubscriptionCreateResponse]
@@ -37,7 +55,8 @@ module Dodopayments
37
55
 
38
56
  # @overload retrieve(subscription_id, request_options: {})
39
57
  #
40
- # @param subscription_id [String]
58
+ # @param subscription_id [String] Subscription Id
59
+ #
41
60
  # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
42
61
  #
43
62
  # @return [Dodopayments::Models::Subscription]
@@ -54,11 +73,16 @@ module Dodopayments
54
73
 
55
74
  # @overload update(subscription_id, billing: nil, metadata: nil, status: nil, tax_id: nil, request_options: {})
56
75
  #
57
- # @param subscription_id [String]
76
+ # @param subscription_id [String] Subscription Id
77
+ #
58
78
  # @param billing [Dodopayments::Models::BillingAddress, nil]
79
+ #
59
80
  # @param metadata [Hash{Symbol=>String}, nil]
81
+ #
60
82
  # @param status [Symbol, Dodopayments::Models::SubscriptionStatus, nil]
83
+ #
61
84
  # @param tax_id [String, nil]
85
+ #
62
86
  # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
63
87
  #
64
88
  # @return [Dodopayments::Models::Subscription]
@@ -77,12 +101,18 @@ module Dodopayments
77
101
 
78
102
  # @overload list(created_at_gte: nil, created_at_lte: nil, customer_id: nil, page_number: nil, page_size: nil, status: nil, request_options: {})
79
103
  #
80
- # @param created_at_gte [Time, nil]
81
- # @param created_at_lte [Time, nil]
82
- # @param customer_id [String, nil]
83
- # @param page_number [Integer, nil]
84
- # @param page_size [Integer, nil]
85
- # @param status [Symbol, Dodopayments::Models::SubscriptionStatus, nil]
104
+ # @param created_at_gte [Time, nil] Get events after this created time
105
+ #
106
+ # @param created_at_lte [Time, nil] Get events created before this time
107
+ #
108
+ # @param customer_id [String, nil] Filter by customer id
109
+ #
110
+ # @param page_number [Integer, nil] Page number default is 0
111
+ #
112
+ # @param page_size [Integer, nil] Page size default is 10 max is 100
113
+ #
114
+ # @param status [Symbol, Dodopayments::Models::SubscriptionStatus, nil] Filter by status
115
+ #
86
116
  # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
87
117
  #
88
118
  # @return [Dodopayments::Internal::DefaultPageNumberPagination<Dodopayments::Models::Subscription>]
@@ -102,10 +132,14 @@ module Dodopayments
102
132
 
103
133
  # @overload change_plan(subscription_id, product_id:, proration_billing_mode:, quantity:, request_options: {})
104
134
  #
105
- # @param subscription_id [String]
106
- # @param product_id [String]
135
+ # @param subscription_id [String] Subscription Id
136
+ #
137
+ # @param product_id [String] Unique identifier of the product to subscribe to
138
+ #
107
139
  # @param proration_billing_mode [Symbol, Dodopayments::Models::SubscriptionChangePlanParams::ProrationBillingMode]
108
- # @param quantity [Integer]
140
+ #
141
+ # @param quantity [Integer] Number of units to subscribe for. Must be at least 1.
142
+ #
109
143
  # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
110
144
  #
111
145
  # @return [nil]
@@ -122,10 +156,16 @@ module Dodopayments
122
156
  )
123
157
  end
124
158
 
159
+ # Some parameter documentations has been truncated, see
160
+ # {Dodopayments::Models::SubscriptionChargeParams} for more details.
161
+ #
125
162
  # @overload charge(subscription_id, product_price:, request_options: {})
126
163
  #
127
- # @param subscription_id [String]
128
- # @param product_price [Integer]
164
+ # @param subscription_id [String] Subscription Id
165
+ #
166
+ # @param product_price [Integer] The product price. Represented in the lowest denomination of the currency (e.g.,
167
+ # ...
168
+ #
129
169
  # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
130
170
  #
131
171
  # @return [Dodopayments::Models::SubscriptionChargeResponse]
@@ -20,14 +20,24 @@ module Dodopayments
20
20
  )
21
21
  end
22
22
 
23
+ # Some parameter documentations has been truncated, see
24
+ # {Dodopayments::Models::WebhookEventListParams} for more details.
25
+ #
23
26
  # @overload list(created_at_gte: nil, created_at_lte: nil, limit: nil, object_id_: nil, page_number: nil, page_size: nil, request_options: {})
24
27
  #
25
- # @param created_at_gte [Time, nil]
26
- # @param created_at_lte [Time, nil]
27
- # @param limit [Integer, nil]
28
- # @param object_id_ [String, nil]
29
- # @param page_number [Integer, nil]
30
- # @param page_size [Integer, nil]
28
+ # @param created_at_gte [Time, nil] Get events after this created time
29
+ #
30
+ # @param created_at_lte [Time, nil] Get events created before this time
31
+ #
32
+ # @param limit [Integer, nil] Min : 1, Max : 100, default 10
33
+ #
34
+ # @param object_id_ [String, nil] Get events history of a specific object like payment/subscription/refund/dispute
35
+ # ...
36
+ #
37
+ # @param page_number [Integer, nil] Page number default is 0
38
+ #
39
+ # @param page_size [Integer, nil] Page size default is 10 max is 100
40
+ #
31
41
  # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
32
42
  #
33
43
  # @return [Dodopayments::Internal::DefaultPageNumberPagination<Dodopayments::Models::WebhookEvent>]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dodopayments
4
- VERSION = "1.18.0"
4
+ VERSION = "1.18.3"
5
5
  end
data/lib/dodopayments.rb CHANGED
@@ -31,7 +31,7 @@ require_relative "dodopayments/internal/util"
31
31
  require_relative "dodopayments/internal/type/converter"
32
32
  require_relative "dodopayments/internal/type/unknown"
33
33
  require_relative "dodopayments/internal/type/boolean"
34
- require_relative "dodopayments/internal/type/io_like"
34
+ require_relative "dodopayments/internal/type/file_input"
35
35
  require_relative "dodopayments/internal/type/enum"
36
36
  require_relative "dodopayments/internal/type/union"
37
37
  require_relative "dodopayments/internal/type/array_of"
@@ -41,6 +41,7 @@ require_relative "dodopayments/internal/type/base_page"
41
41
  require_relative "dodopayments/internal/type/request_parameters"
42
42
  require_relative "dodopayments/internal"
43
43
  require_relative "dodopayments/request_options"
44
+ require_relative "dodopayments/file_part"
44
45
  require_relative "dodopayments/errors"
45
46
  require_relative "dodopayments/internal/transport/base_client"
46
47
  require_relative "dodopayments/internal/transport/pooled_net_requester"
@@ -0,0 +1,34 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ class FilePart
5
+ sig { returns(T.any(Pathname, StringIO, IO, String)) }
6
+ attr_reader :content
7
+
8
+ sig { returns(T.nilable(String)) }
9
+ attr_reader :content_type
10
+
11
+ sig { returns(T.nilable(String)) }
12
+ attr_reader :filename
13
+
14
+ # @api private
15
+ sig { returns(String) }
16
+ private def read; end
17
+
18
+ sig { params(a: T.anything).returns(String) }
19
+ def to_json(*a); end
20
+
21
+ sig { params(a: T.anything).returns(String) }
22
+ def to_yaml(*a); end
23
+
24
+ sig do
25
+ params(
26
+ content: T.any(Pathname, StringIO, IO, String),
27
+ filename: T.nilable(String),
28
+ content_type: T.nilable(String)
29
+ )
30
+ .returns(T.attached_class)
31
+ end
32
+ def self.new(content, filename: nil, content_type: nil); end
33
+ end
34
+ end
@@ -24,7 +24,14 @@ module Dodopayments
24
24
  )]
25
25
  ),
26
26
  body: T.nilable(T.anything),
27
- unwrap: T.nilable(Symbol),
27
+ unwrap: T.nilable(
28
+ T.any(
29
+ Symbol,
30
+ Integer,
31
+ T::Array[T.any(Symbol, Integer)],
32
+ T.proc.params(arg0: T.anything).returns(T.anything)
33
+ )
34
+ ),
28
35
  page: T.nilable(T::Class[Dodopayments::Internal::Type::BasePage[Dodopayments::Internal::Type::BaseModel]]),
29
36
  stream: T.nilable(T::Class[T.anything]),
30
37
  model: T.nilable(Dodopayments::Internal::Type::Converter::Input),
@@ -90,7 +97,7 @@ module Dodopayments
90
97
 
91
98
  # @api private
92
99
  sig { returns(Dodopayments::Internal::Transport::PooledNetRequester) }
93
- attr_accessor :requester
100
+ attr_reader :requester
94
101
 
95
102
  # @api private
96
103
  sig do
@@ -170,7 +177,14 @@ module Dodopayments
170
177
  )]
171
178
  ),
172
179
  body: T.nilable(T.anything),
173
- unwrap: T.nilable(Symbol),
180
+ unwrap: T.nilable(
181
+ T.any(
182
+ Symbol,
183
+ Integer,
184
+ T::Array[T.any(Symbol, Integer)],
185
+ T.proc.params(arg0: T.anything).returns(T.anything)
186
+ )
187
+ ),
174
188
  page: T.nilable(T::Class[Dodopayments::Internal::Type::BasePage[Dodopayments::Internal::Type::BaseModel]]),
175
189
  stream: T.nilable(T::Class[T.anything]),
176
190
  model: T.nilable(Dodopayments::Internal::Type::Converter::Input),
@@ -5,8 +5,12 @@ module Dodopayments
5
5
  module Type
6
6
  # @api private
7
7
  #
8
- # Either `Pathname` or `StringIO`.
9
- class IOLike
8
+ # Either `Pathname` or `StringIO`, or `IO`, or
9
+ # `Dodopayments::Internal::Type::FileInput`.
10
+ #
11
+ # Note: when `IO` is used, all retries are disabled, since many IO` streams are
12
+ # not rewindable.
13
+ class FileInput
10
14
  extend Dodopayments::Internal::Type::Converter
11
15
 
12
16
  abstract!
@@ -68,13 +68,19 @@ module Dodopayments
68
68
  sig do
69
69
  params(
70
70
  data: T.any(Dodopayments::Internal::AnyHash, T::Array[T.anything], T.anything),
71
- pick: T.nilable(T.any(Symbol, Integer, T::Array[T.any(Symbol, Integer)])),
72
- sentinel: T.nilable(T.anything),
71
+ pick: T.nilable(
72
+ T.any(
73
+ Symbol,
74
+ Integer,
75
+ T::Array[T.any(Symbol, Integer)],
76
+ T.proc.params(arg0: T.anything).returns(T.anything)
77
+ )
78
+ ),
73
79
  blk: T.nilable(T.proc.returns(T.anything))
74
80
  )
75
81
  .returns(T.nilable(T.anything))
76
82
  end
77
- def dig(data, pick, sentinel = nil, &blk); end
83
+ def dig(data, pick, &blk); end
78
84
  end
79
85
 
80
86
  class << self
@@ -143,22 +149,6 @@ module Dodopayments
143
149
  def normalized_headers(*headers); end
144
150
  end
145
151
 
146
- # @api private
147
- class SerializationAdapter
148
- sig { returns(T.any(Pathname, IO)) }
149
- attr_reader :inner
150
-
151
- sig { params(a: T.anything).returns(String) }
152
- def to_json(*a); end
153
-
154
- sig { params(a: T.anything).returns(String) }
155
- def to_yaml(*a); end
156
-
157
- # @api private
158
- sig { params(inner: T.any(Pathname, IO)).returns(T.attached_class) }
159
- def self.new(inner); end
160
- end
161
-
162
152
  # @api private
163
153
  #
164
154
  # An adapter that satisfies the IO interface required by `::IO.copy_stream`
@@ -195,7 +185,22 @@ module Dodopayments
195
185
  def writable_enum(&blk); end
196
186
  end
197
187
 
188
+ JSON_CONTENT = T.let(%r{^application/(?:vnd(?:\.[^.]+)*\+)?json(?!l)}, Regexp)
189
+ JSONL_CONTENT = T.let(%r{^application/(?:x-)?jsonl}, Regexp)
190
+
198
191
  class << self
192
+ # @api private
193
+ sig do
194
+ params(
195
+ y: Enumerator::Yielder,
196
+ val: T.anything,
197
+ closing: T::Array[T.proc.void],
198
+ content_type: T.nilable(String)
199
+ )
200
+ .void
201
+ end
202
+ private def write_multipart_content(y, val:, closing:, content_type: nil); end
203
+
199
204
  # @api private
200
205
  sig do
201
206
  params(
@@ -33,8 +33,18 @@ module Dodopayments
33
33
  )
34
34
  .returns(T.attached_class)
35
35
  end
36
- def self.new(city:, country:, state:, street:, zipcode:); end
37
-
36
+ def self.new(
37
+ # City name
38
+ city:,
39
+ # ISO country code alpha2 variant
40
+ country:,
41
+ # State or province name
42
+ state:,
43
+ # Street address including house number and unit/apartment if applicable
44
+ street:,
45
+ # Postal code or ZIP code
46
+ zipcode:
47
+ ); end
38
48
  sig do
39
49
  override
40
50
  .returns(
@@ -25,8 +25,15 @@ module Dodopayments
25
25
  params(email: String, name: String, create_new_customer: T::Boolean, phone_number: T.nilable(String))
26
26
  .returns(T.attached_class)
27
27
  end
28
- def self.new(email:, name:, create_new_customer: nil, phone_number: nil); end
29
-
28
+ def self.new(
29
+ email:,
30
+ name:,
31
+ # When false, the most recently created customer object with the given email is
32
+ # used if exists. When true, a new customer object is always created False by
33
+ # default
34
+ create_new_customer: nil,
35
+ phone_number: nil
36
+ ); end
30
37
  sig do
31
38
  override
32
39
  .returns({