paymos 1.5.2 → 1.6.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/paymos/client.rb +2 -24
- data/lib/paymos/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5e0c80046042c2f9d6412a4634125c0a4394e9aab174d20d6b6a26fe60517e76
|
|
4
|
+
data.tar.gz: 52280f1bd972bf101b857e697addf3d1c115c09e87ae2287fdfc506c83606e09
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2a205a28f143426bbbedcafe4240751448d4161d60d7f30650570567a4e5eebf7232a4c0e313ad88853bcaa7e49a4170ddfafe3f0f4ad7e41d6946882e052531
|
|
7
|
+
data.tar.gz: ce658911f58df1d6b5f30bdb4f9c4c5894118019e57604b94d29ea759f3b9e2e568ddf0265b818eb33c91e1da05d0cd848fca5afe1e545c27ce3172767c3271d
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [1.6.0] - 2026-11-03
|
|
6
|
+
|
|
7
|
+
- fix(sdk): resolve preflight lint and conformance vector count for autorelease
|
|
8
|
+
- feat(refunds): finalize clean merchant refunds spec, SDKs, CMS plugins, and targeted test scripts
|
|
9
|
+
|
|
10
|
+
- **403 is no longer reported as an authentication failure.** `Paymos::PermissionError` (subclasses `Paymos::AuthenticationError`, so existing `rescue` blocks keep working) now carries every 403.
|
|
11
|
+
- **Base URL must use HTTPS.** Plain HTTP is accepted only against a loopback host, which is what a local integration test points at. The API secret signs every request, so a plaintext base URL put that credential on the wire.
|
|
12
|
+
|
|
5
13
|
## [1.5.2] - 2026-11-02
|
|
6
14
|
|
|
7
15
|
- wip: snapshot shared working tree before merging main
|
data/lib/paymos/client.rb
CHANGED
|
@@ -37,7 +37,6 @@ module Paymos
|
|
|
37
37
|
@timeout = timeout
|
|
38
38
|
@max_retries = max_retries
|
|
39
39
|
@base_delay = base_delay
|
|
40
|
-
@refund_transport_is_default = !transport
|
|
41
40
|
@transport = transport || method(:default_transport)
|
|
42
41
|
@clock = clock
|
|
43
42
|
@sleeper = sleeper
|
|
@@ -53,7 +52,6 @@ module Paymos
|
|
|
53
52
|
|
|
54
53
|
def request(method, path, payload: nil, query: '')
|
|
55
54
|
method = method.to_s.upcase
|
|
56
|
-
refund_transport = checked_refund_transport(method, path)
|
|
57
55
|
body = payload.nil? ? '' : JSON.generate(payload)
|
|
58
56
|
attempts = 0
|
|
59
57
|
|
|
@@ -67,9 +65,7 @@ module Paymos
|
|
|
67
65
|
'Accept' => 'application/json',
|
|
68
66
|
'User-Agent' => "paymos-ruby/#{VERSION}"
|
|
69
67
|
}
|
|
70
|
-
response = (
|
|
71
|
-
method, "#{@base_url}#{path}#{query}", headers, body.empty? ? nil : body, @timeout
|
|
72
|
-
)
|
|
68
|
+
response = @transport.call(method, "#{@base_url}#{path}#{query}", headers, body.empty? ? nil : body, @timeout)
|
|
73
69
|
rescue IOError, SystemCallError, Timeout::Error, SocketError => e
|
|
74
70
|
if attempts < @max_retries && SAFE_METHODS.include?(method)
|
|
75
71
|
wait(attempts, nil)
|
|
@@ -83,7 +79,7 @@ module Paymos
|
|
|
83
79
|
raise Error, 'Paymos transport returned an invalid response'
|
|
84
80
|
end
|
|
85
81
|
|
|
86
|
-
if attempts < @max_retries &&
|
|
82
|
+
if attempts < @max_retries && retryable?(method, response.status)
|
|
87
83
|
wait(attempts, header(response.headers, 'retry-after'))
|
|
88
84
|
attempts += 1
|
|
89
85
|
next
|
|
@@ -140,24 +136,6 @@ module Paymos
|
|
|
140
136
|
headers: response.to_hash.transform_values(&:first))
|
|
141
137
|
end
|
|
142
138
|
|
|
143
|
-
def refund_create?(method, path)
|
|
144
|
-
method == 'POST' && path == '/v1/refunds'
|
|
145
|
-
end
|
|
146
|
-
|
|
147
|
-
def checked_refund_transport(method, path)
|
|
148
|
-
return nil unless refund_create?(method, path)
|
|
149
|
-
|
|
150
|
-
transport = @transport
|
|
151
|
-
trusted = Paymos::Client.instance_method(:default_transport).bind(self)
|
|
152
|
-
return transport if @refund_transport_is_default && trusted == transport
|
|
153
|
-
|
|
154
|
-
raise ConfigurationError, 'Refund creation requires the standard Net::HTTP transport'
|
|
155
|
-
end
|
|
156
|
-
|
|
157
|
-
def retryable_request?(method, path, status)
|
|
158
|
-
!refund_create?(method, path) && retryable?(method, status)
|
|
159
|
-
end
|
|
160
|
-
|
|
161
139
|
def retryable?(method, status)
|
|
162
140
|
status == 429 || (status >= 500 && SAFE_METHODS.include?(method))
|
|
163
141
|
end
|
data/lib/paymos/version.rb
CHANGED