dodopayments 1.56.2 → 1.56.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 12aa5f73bbc394a9c94235aa84d6cd067df7d038adcf3de991bace729b58afd7
4
- data.tar.gz: 99d11f78c2f2cac8457f9d656c190a31bf9e2eaa7369d47351906742d2012a35
3
+ metadata.gz: 7e87a36ea54d7bec5d0cfd23f516b508eb98921982d150de3a7a9915f035991a
4
+ data.tar.gz: 43cfde45462e61c446f009697d73bcef8fe05f8ba132f2ff7e532f2611cf6396
5
5
  SHA512:
6
- metadata.gz: fda9e6a8f1b679fd1d3695c130dceefabc5e354467d70d8319c912a3a55908a182b7ecd0123cb5a4c14123899411a16ff98767a00f867e8d2018562e4b63d2df
7
- data.tar.gz: 29ac046586bd1d5175a1b63bd2f6ed6d8a285b6e5edb49a78531949378d0356e1ffd0ba67d5794728ca2ecfb9abb84fc497d118ee565a825eed380911a60009e
6
+ metadata.gz: 1bb6591747447b4ed03a1808cef250ec12cd6db967fa7ae62ce82324b68c5b0db2f17597787eb0c510f9055340858f57b4f7d340d759e0f01eb525e8712cd021
7
+ data.tar.gz: dd5a3ab5bbab2a2cde57c36358906142d473a39992d85c4ee673b9f8aaeb1a0c24f70641b69c5febe310b14e3f08436d949fde1a389fdedf2de69c245789716d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.56.4 (2025-11-05)
4
+
5
+ Full Changelog: [v1.56.3...v1.56.4](https://github.com/dodopayments/dodopayments-ruby/compare/v1.56.3...v1.56.4)
6
+
7
+ ### Bug Fixes
8
+
9
+ * better thread safety via early initializing SSL store during HTTP client creation ([931e1ee](https://github.com/dodopayments/dodopayments-ruby/commit/931e1eeb8a5cda3c0359ca8dd58621ac10f2aa5a))
10
+
11
+
12
+ ### Chores
13
+
14
+ * bump dependency version and update sorbet types ([af5f49a](https://github.com/dodopayments/dodopayments-ruby/commit/af5f49a7f1d0ed6de5f230e6a9c93ef9ea0d6a38))
15
+
16
+ ## 1.56.3 (2025-10-29)
17
+
18
+ Full Changelog: [v1.56.2...v1.56.3](https://github.com/dodopayments/dodopayments-ruby/compare/v1.56.2...v1.56.3)
19
+
20
+ ### Features
21
+
22
+ * **api:** updated openapi spec to v1.56.3 ([b4f67da](https://github.com/dodopayments/dodopayments-ruby/commit/b4f67dac21364d32b4d4f8de5a14a237747edf1a))
23
+
3
24
  ## 1.56.2 (2025-10-27)
4
25
 
5
26
  Full Changelog: [v1.56.0...v1.56.2](https://github.com/dodopayments/dodopayments-ruby/compare/v1.56.0...v1.56.2)
data/README.md CHANGED
@@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application
17
17
  <!-- x-release-please-start-version -->
18
18
 
19
19
  ```ruby
20
- gem "dodopayments", "~> 1.56.2"
20
+ gem "dodopayments", "~> 1.56.4"
21
21
  ```
22
22
 
23
23
  <!-- x-release-please-end -->
@@ -201,7 +201,8 @@ module Dodopayments
201
201
  self.class::PLATFORM_HEADERS,
202
202
  {
203
203
  "accept" => "application/json",
204
- "content-type" => "application/json"
204
+ "content-type" => "application/json",
205
+ "user-agent" => user_agent
205
206
  },
206
207
  headers
207
208
  )
@@ -219,6 +220,11 @@ module Dodopayments
219
220
  # @return [Hash{String=>String}]
220
221
  private def auth_headers = {}
221
222
 
223
+ # @api private
224
+ #
225
+ # @return [String]
226
+ private def user_agent = "#{self.class.name}/Ruby #{Dodopayments::VERSION}"
227
+
222
228
  # @api private
223
229
  #
224
230
  # @return [String]
@@ -16,10 +16,11 @@ module Dodopayments
16
16
  class << self
17
17
  # @api private
18
18
  #
19
+ # @param cert_store [OpenSSL::X509::Store]
19
20
  # @param url [URI::Generic]
20
21
  #
21
22
  # @return [Net::HTTP]
22
- def connect(url)
23
+ def connect(cert_store:, url:)
23
24
  port =
24
25
  case [url.port, url.scheme]
25
26
  in [Integer, _]
@@ -33,6 +34,8 @@ module Dodopayments
33
34
  Net::HTTP.new(url.host, port).tap do
34
35
  _1.use_ssl = %w[https wss].include?(url.scheme)
35
36
  _1.max_retries = 0
37
+
38
+ (_1.cert_store = cert_store) if _1.use_ssl?
36
39
  end
37
40
  end
38
41
 
@@ -102,7 +105,7 @@ module Dodopayments
102
105
  pool =
103
106
  @mutex.synchronize do
104
107
  @pools[origin] ||= ConnectionPool.new(size: @size) do
105
- self.class.connect(url)
108
+ self.class.connect(cert_store: @cert_store, url: url)
106
109
  end
107
110
  end
108
111
 
@@ -192,6 +195,7 @@ module Dodopayments
192
195
  def initialize(size: self.class::DEFAULT_MAX_CONNECTIONS)
193
196
  @mutex = Mutex.new
194
197
  @size = size
198
+ @cert_store = OpenSSL::X509::Store.new.tap(&:set_default_paths)
195
199
  @pools = {}
196
200
  end
197
201
 
@@ -17,6 +17,7 @@ module Dodopayments
17
17
  EPS = :eps
18
18
  IDEAL = :ideal
19
19
  PRZELEWY24 = :przelewy24
20
+ PAYPAL = :paypal
20
21
  AFFIRM = :affirm
21
22
  KLARNA = :klarna
22
23
  SEPA = :sepa
@@ -28,6 +28,12 @@ module Dodopayments
28
28
  # @return [Boolean]
29
29
  required :is_partial, Dodopayments::Internal::Type::Boolean
30
30
 
31
+ # @!attribute metadata
32
+ # Additional metadata stored with the refund.
33
+ #
34
+ # @return [Hash{Symbol=>String}]
35
+ required :metadata, Dodopayments::Internal::Type::HashOf[String]
36
+
31
37
  # @!attribute payment_id
32
38
  # The unique identifier of the payment associated with the refund.
33
39
  #
@@ -64,7 +70,7 @@ module Dodopayments
64
70
  # @return [String, nil]
65
71
  optional :reason, String, nil?: true
66
72
 
67
- # @!method initialize(business_id:, created_at:, customer:, is_partial:, payment_id:, refund_id:, status:, amount: nil, currency: nil, reason: nil)
73
+ # @!method initialize(business_id:, created_at:, customer:, is_partial:, metadata:, payment_id:, refund_id:, status:, amount: nil, currency: nil, reason: nil)
68
74
  # @param business_id [String] The unique identifier of the business issuing the refund.
69
75
  #
70
76
  # @param created_at [Time] The timestamp of when the refund was created in UTC.
@@ -73,6 +79,8 @@ module Dodopayments
73
79
  #
74
80
  # @param is_partial [Boolean] If true the refund is a partial refund
75
81
  #
82
+ # @param metadata [Hash{Symbol=>String}] Additional metadata stored with the refund.
83
+ #
76
84
  # @param payment_id [String] The unique identifier of the payment associated with the refund.
77
85
  #
78
86
  # @param refund_id [String] The unique identifier of the refund.
@@ -21,17 +21,25 @@ module Dodopayments
21
21
  -> { Dodopayments::Internal::Type::ArrayOf[Dodopayments::RefundCreateParams::Item] },
22
22
  nil?: true
23
23
 
24
+ # @!attribute metadata
25
+ # Additional metadata associated with the refund.
26
+ #
27
+ # @return [Hash{Symbol=>String}, nil]
28
+ optional :metadata, Dodopayments::Internal::Type::HashOf[String]
29
+
24
30
  # @!attribute reason
25
31
  # The reason for the refund, if any. Maximum length is 3000 characters. Optional.
26
32
  #
27
33
  # @return [String, nil]
28
34
  optional :reason, String, nil?: true
29
35
 
30
- # @!method initialize(payment_id:, items: nil, reason: nil, request_options: {})
36
+ # @!method initialize(payment_id:, items: nil, metadata: nil, reason: nil, request_options: {})
31
37
  # @param payment_id [String] The unique identifier of the payment to be refunded.
32
38
  #
33
39
  # @param items [Array<Dodopayments::Models::RefundCreateParams::Item>, nil] Partially Refund an Individual Item
34
40
  #
41
+ # @param metadata [Hash{Symbol=>String}] Additional metadata associated with the refund.
42
+ #
35
43
  # @param reason [String, nil] The reason for the refund, if any. Maximum length is 3000 characters. Optional.
36
44
  #
37
45
  # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}]
@@ -3,12 +3,14 @@
3
3
  module Dodopayments
4
4
  module Resources
5
5
  class Refunds
6
- # @overload create(payment_id:, items: nil, reason: nil, request_options: {})
6
+ # @overload create(payment_id:, items: nil, metadata: nil, reason: nil, request_options: {})
7
7
  #
8
8
  # @param payment_id [String] The unique identifier of the payment to be refunded.
9
9
  #
10
10
  # @param items [Array<Dodopayments::Models::RefundCreateParams::Item>, nil] Partially Refund an Individual Item
11
11
  #
12
+ # @param metadata [Hash{Symbol=>String}] Additional metadata associated with the refund.
13
+ #
12
14
  # @param reason [String, nil] The reason for the refund, if any. Maximum length is 3000 characters. Optional.
13
15
  #
14
16
  # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dodopayments
4
- VERSION = "1.56.2"
4
+ VERSION = "1.56.4"
5
5
  end
data/lib/dodopayments.rb CHANGED
@@ -9,6 +9,7 @@ require "erb"
9
9
  require "etc"
10
10
  require "json"
11
11
  require "net/http"
12
+ require "openssl"
12
13
  require "pathname"
13
14
  require "rbconfig"
14
15
  require "securerandom"
data/manifest.yaml CHANGED
@@ -6,6 +6,7 @@ dependencies:
6
6
  - etc
7
7
  - json
8
8
  - net/http
9
+ - openssl
9
10
  - pathname
10
11
  - rbconfig
11
12
  - securerandom
@@ -180,6 +180,11 @@ module Dodopayments
180
180
  private def auth_headers
181
181
  end
182
182
 
183
+ # @api private
184
+ sig { returns(String) }
185
+ private def user_agent
186
+ end
187
+
183
188
  # @api private
184
189
  sig { returns(String) }
185
190
  private def generate_idempotency_key
@@ -26,8 +26,12 @@ module Dodopayments
26
26
 
27
27
  class << self
28
28
  # @api private
29
- sig { params(url: URI::Generic).returns(Net::HTTP) }
30
- def connect(url)
29
+ sig do
30
+ params(cert_store: OpenSSL::X509::Store, url: URI::Generic).returns(
31
+ Net::HTTP
32
+ )
33
+ end
34
+ def connect(cert_store:, url:)
31
35
  end
32
36
 
33
37
  # @api private
@@ -31,7 +31,7 @@ module Dodopayments
31
31
  #
32
32
  # Assumes superclass fields are totally defined before fields are accessed /
33
33
  # defined on subclasses.
34
- sig { params(child: T.self_type).void }
34
+ sig { params(child: Dodopayments::Internal::Type::BaseModel).void }
35
35
  def inherited(child)
36
36
  end
37
37
 
@@ -282,9 +282,13 @@ module Dodopayments
282
282
 
283
283
  # Create a new instance of a model.
284
284
  sig do
285
- params(data: T.any(T::Hash[Symbol, T.anything], T.self_type)).returns(
286
- T.attached_class
287
- )
285
+ params(
286
+ data:
287
+ T.any(
288
+ T::Hash[Symbol, T.anything],
289
+ Dodopayments::Internal::Type::BaseModel
290
+ )
291
+ ).returns(T.attached_class)
288
292
  end
289
293
  def self.new(data = {})
290
294
  end
@@ -28,6 +28,7 @@ module Dodopayments
28
28
  IDEAL = T.let(:ideal, Dodopayments::PaymentMethodTypes::TaggedSymbol)
29
29
  PRZELEWY24 =
30
30
  T.let(:przelewy24, Dodopayments::PaymentMethodTypes::TaggedSymbol)
31
+ PAYPAL = T.let(:paypal, Dodopayments::PaymentMethodTypes::TaggedSymbol)
31
32
  AFFIRM = T.let(:affirm, Dodopayments::PaymentMethodTypes::TaggedSymbol)
32
33
  KLARNA = T.let(:klarna, Dodopayments::PaymentMethodTypes::TaggedSymbol)
33
34
  SEPA = T.let(:sepa, Dodopayments::PaymentMethodTypes::TaggedSymbol)
@@ -29,6 +29,10 @@ module Dodopayments
29
29
  sig { returns(T::Boolean) }
30
30
  attr_accessor :is_partial
31
31
 
32
+ # Additional metadata stored with the refund.
33
+ sig { returns(T::Hash[Symbol, String]) }
34
+ attr_accessor :metadata
35
+
32
36
  # The unique identifier of the payment associated with the refund.
33
37
  sig { returns(String) }
34
38
  attr_accessor :payment_id
@@ -59,6 +63,7 @@ module Dodopayments
59
63
  created_at: Time,
60
64
  customer: Dodopayments::CustomerLimitedDetails::OrHash,
61
65
  is_partial: T::Boolean,
66
+ metadata: T::Hash[Symbol, String],
62
67
  payment_id: String,
63
68
  refund_id: String,
64
69
  status: Dodopayments::RefundStatus::OrSymbol,
@@ -76,6 +81,8 @@ module Dodopayments
76
81
  customer:,
77
82
  # If true the refund is a partial refund
78
83
  is_partial:,
84
+ # Additional metadata stored with the refund.
85
+ metadata:,
79
86
  # The unique identifier of the payment associated with the refund.
80
87
  payment_id:,
81
88
  # The unique identifier of the refund.
@@ -98,6 +105,7 @@ module Dodopayments
98
105
  created_at: Time,
99
106
  customer: Dodopayments::CustomerLimitedDetails,
100
107
  is_partial: T::Boolean,
108
+ metadata: T::Hash[Symbol, String],
101
109
  payment_id: String,
102
110
  refund_id: String,
103
111
  status: Dodopayments::RefundStatus::TaggedSymbol,
@@ -24,6 +24,13 @@ module Dodopayments
24
24
  end
25
25
  attr_accessor :items
26
26
 
27
+ # Additional metadata associated with the refund.
28
+ sig { returns(T.nilable(T::Hash[Symbol, String])) }
29
+ attr_reader :metadata
30
+
31
+ sig { params(metadata: T::Hash[Symbol, String]).void }
32
+ attr_writer :metadata
33
+
27
34
  # The reason for the refund, if any. Maximum length is 3000 characters. Optional.
28
35
  sig { returns(T.nilable(String)) }
29
36
  attr_accessor :reason
@@ -33,6 +40,7 @@ module Dodopayments
33
40
  payment_id: String,
34
41
  items:
35
42
  T.nilable(T::Array[Dodopayments::RefundCreateParams::Item::OrHash]),
43
+ metadata: T::Hash[Symbol, String],
36
44
  reason: T.nilable(String),
37
45
  request_options: Dodopayments::RequestOptions::OrHash
38
46
  ).returns(T.attached_class)
@@ -42,6 +50,8 @@ module Dodopayments
42
50
  payment_id:,
43
51
  # Partially Refund an Individual Item
44
52
  items: nil,
53
+ # Additional metadata associated with the refund.
54
+ metadata: nil,
45
55
  # The reason for the refund, if any. Maximum length is 3000 characters. Optional.
46
56
  reason: nil,
47
57
  request_options: {}
@@ -53,6 +63,7 @@ module Dodopayments
53
63
  {
54
64
  payment_id: String,
55
65
  items: T.nilable(T::Array[Dodopayments::RefundCreateParams::Item]),
66
+ metadata: T::Hash[Symbol, String],
56
67
  reason: T.nilable(String),
57
68
  request_options: Dodopayments::RequestOptions
58
69
  }
@@ -8,6 +8,7 @@ module Dodopayments
8
8
  payment_id: String,
9
9
  items:
10
10
  T.nilable(T::Array[Dodopayments::RefundCreateParams::Item::OrHash]),
11
+ metadata: T::Hash[Symbol, String],
11
12
  reason: T.nilable(String),
12
13
  request_options: Dodopayments::RequestOptions::OrHash
13
14
  ).returns(Dodopayments::Refund)
@@ -17,6 +18,8 @@ module Dodopayments
17
18
  payment_id:,
18
19
  # Partially Refund an Individual Item
19
20
  items: nil,
21
+ # Additional metadata associated with the refund.
22
+ metadata: nil,
20
23
  # The reason for the refund, if any. Maximum length is 3000 characters. Optional.
21
24
  reason: nil,
22
25
  request_options: {}
@@ -87,6 +87,8 @@ module Dodopayments
87
87
 
88
88
  private def auth_headers: -> ::Hash[String, String]
89
89
 
90
+ private def user_agent: -> String
91
+
90
92
  private def generate_idempotency_key: -> String
91
93
 
92
94
  private def build_request: (
@@ -17,7 +17,10 @@ module Dodopayments
17
17
 
18
18
  DEFAULT_MAX_CONNECTIONS: Integer
19
19
 
20
- def self.connect: (URI::Generic url) -> top
20
+ def self.connect: (
21
+ cert_store: OpenSSL::X509::Store,
22
+ url: URI::Generic
23
+ ) -> top
21
24
 
22
25
  def self.calibrate_socket_timeout: (top conn, Float deadline) -> void
23
26
 
@@ -13,6 +13,7 @@ module Dodopayments
13
13
  | :eps
14
14
  | :ideal
15
15
  | :przelewy24
16
+ | :paypal
16
17
  | :affirm
17
18
  | :klarna
18
19
  | :sepa
@@ -35,6 +36,7 @@ module Dodopayments
35
36
  EPS: :eps
36
37
  IDEAL: :ideal
37
38
  PRZELEWY24: :przelewy24
39
+ PAYPAL: :paypal
38
40
  AFFIRM: :affirm
39
41
  KLARNA: :klarna
40
42
  SEPA: :sepa
@@ -6,6 +6,7 @@ module Dodopayments
6
6
  created_at: Time,
7
7
  customer: Dodopayments::CustomerLimitedDetails,
8
8
  is_partial: bool,
9
+ metadata: ::Hash[Symbol, String],
9
10
  payment_id: String,
10
11
  refund_id: String,
11
12
  status: Dodopayments::Models::refund_status,
@@ -23,6 +24,8 @@ module Dodopayments
23
24
 
24
25
  attr_accessor is_partial: bool
25
26
 
27
+ attr_accessor metadata: ::Hash[Symbol, String]
28
+
26
29
  attr_accessor payment_id: String
27
30
 
28
31
  attr_accessor refund_id: String
@@ -40,6 +43,7 @@ module Dodopayments
40
43
  created_at: Time,
41
44
  customer: Dodopayments::CustomerLimitedDetails,
42
45
  is_partial: bool,
46
+ metadata: ::Hash[Symbol, String],
43
47
  payment_id: String,
44
48
  refund_id: String,
45
49
  status: Dodopayments::Models::refund_status,
@@ -53,6 +57,7 @@ module Dodopayments
53
57
  created_at: Time,
54
58
  customer: Dodopayments::CustomerLimitedDetails,
55
59
  is_partial: bool,
60
+ metadata: ::Hash[Symbol, String],
56
61
  payment_id: String,
57
62
  refund_id: String,
58
63
  status: Dodopayments::Models::refund_status,
@@ -4,6 +4,7 @@ module Dodopayments
4
4
  {
5
5
  payment_id: String,
6
6
  items: ::Array[Dodopayments::RefundCreateParams::Item]?,
7
+ metadata: ::Hash[Symbol, String],
7
8
  reason: String?
8
9
  }
9
10
  & Dodopayments::Internal::Type::request_parameters
@@ -16,11 +17,16 @@ module Dodopayments
16
17
 
17
18
  attr_accessor items: ::Array[Dodopayments::RefundCreateParams::Item]?
18
19
 
20
+ attr_reader metadata: ::Hash[Symbol, String]?
21
+
22
+ def metadata=: (::Hash[Symbol, String]) -> ::Hash[Symbol, String]
23
+
19
24
  attr_accessor reason: String?
20
25
 
21
26
  def initialize: (
22
27
  payment_id: String,
23
28
  ?items: ::Array[Dodopayments::RefundCreateParams::Item]?,
29
+ ?metadata: ::Hash[Symbol, String],
24
30
  ?reason: String?,
25
31
  ?request_options: Dodopayments::request_opts
26
32
  ) -> void
@@ -28,6 +34,7 @@ module Dodopayments
28
34
  def to_hash: -> {
29
35
  payment_id: String,
30
36
  items: ::Array[Dodopayments::RefundCreateParams::Item]?,
37
+ metadata: ::Hash[Symbol, String],
31
38
  reason: String?,
32
39
  request_options: Dodopayments::RequestOptions
33
40
  }
@@ -4,6 +4,7 @@ module Dodopayments
4
4
  def create: (
5
5
  payment_id: String,
6
6
  ?items: ::Array[Dodopayments::RefundCreateParams::Item]?,
7
+ ?metadata: ::Hash[Symbol, String],
7
8
  ?reason: String?,
8
9
  ?request_options: Dodopayments::request_opts
9
10
  ) -> Dodopayments::Refund
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dodopayments
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.56.2
4
+ version: 1.56.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dodo Payments
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-10-27 00:00:00.000000000 Z
11
+ date: 2025-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: connection_pool