mangopay4-ruby-sdk 3.46.0 → 3.48.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/README.md +55 -0
- data/lib/mangopay/pay_in.rb +0 -16
- data/lib/mangopay/version.rb +1 -1
- data/lib/mangopay.rb +41 -10
- data/spec/mangopay/shared_resources.rb +1 -29
- metadata +2 -4
- data/spec/mangopay/payin_payconiq_web_spec.rb +0 -32
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 674878e4aba915f0f767a1a58f76f9330bb0000628d0ea0d5fca7ca124eaa3bc
|
|
4
|
+
data.tar.gz: 5a4dcd8a5b50557536daf8f57b82fb8ebefa8c73cb963a4e5087ab6dfaf6b4e9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d69b73f8eba11516e2cd4c93992732a0eddcc02ab3ba6aa9779b9c692b3a827f17078dba7ce6654d3e2dccf59ab218717dc58111c368ebf790eb17bef05b5df2
|
|
7
|
+
data.tar.gz: f1c53aa135c0f4343522bb7d5df8c65ae7d31654a42075cc39322ecbb394c4538777458b54e369bf9dec1549c3b5e9502246d3186b2d716dc2f29016a77ac46e
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## [3.48.0] - 2026-03-25
|
|
2
|
+
### Removed
|
|
3
|
+
- Payconiq PayIn (`MangoPay::PayIn::PayconiqWeb::Create`) removed following provider discontinuation on 4 Dec 2025 (#334)
|
|
4
|
+
|
|
5
|
+
## [3.47.0] - 2026-03-19
|
|
6
|
+
### Added - mTLS certificates support
|
|
7
|
+
- mTLS certificates are now configurable in the SDK via file paths or encoded strings
|
|
8
|
+
|
|
1
9
|
## [3.46.0] - 2026-02-12
|
|
2
10
|
### FX
|
|
3
11
|
|
data/README.md
CHANGED
|
@@ -19,6 +19,61 @@ or by adding it to your Gemfile ```gem 'mangopay4-ruby-sdk'```
|
|
|
19
19
|
|
|
20
20
|
* Call ```MangoPay.configure``` in your script as shown in the snippet below.
|
|
21
21
|
|
|
22
|
+
## mTLS configuration
|
|
23
|
+
### Set the base URL for mTLS
|
|
24
|
+
|
|
25
|
+
Using mTLS authentication requires your integration to call a base URL with a different hostname from the standard API:
|
|
26
|
+
|
|
27
|
+
* Sandbox: `https://api-mtls.sandbox.mangopay.com`
|
|
28
|
+
* Production: `https://api-mtls.mangopay.com`
|
|
29
|
+
|
|
30
|
+
If using mTLS, your integration should use the `api-mtls` URLs for all API calls, including OAuth token generation.
|
|
31
|
+
|
|
32
|
+
**Caution:** Ensure you set the mTLS base URL, as shown in the configuration examples below. If you don’t, the mTLS certificate will not be transferred to Mangopay. When mTLS is enforced, your integration will result in an error.
|
|
33
|
+
|
|
34
|
+
### Configure the SDK’s mTLS properties
|
|
35
|
+
|
|
36
|
+
The Ruby SDK’s mTLS properties accept one of:
|
|
37
|
+
|
|
38
|
+
* **Base64-encoded string** – To load the certificate content from environment variables
|
|
39
|
+
* **File path** – To point to the locally stored file, for example during testing
|
|
40
|
+
|
|
41
|
+
| Property | Type | Description |
|
|
42
|
+
| --------------------- | ----------------- |------------------------------------------------------------------------------------------|
|
|
43
|
+
| `mtls_cert` | string | Base64-encoded string of the certificate content or path to the certificate `.pem` file. |
|
|
44
|
+
| `mtls_private_key` | string | Base64-encoded string of the private key content or path to the private `.key` file. |
|
|
45
|
+
| `mtls_key_passphrase` | string (optional) | String passphrase if the private key is encrypted. |
|
|
46
|
+
|
|
47
|
+
#### Base64-encoded strings
|
|
48
|
+
|
|
49
|
+
```ruby theme={null}
|
|
50
|
+
MangoPay.configure do |c|
|
|
51
|
+
c.client_id = 'your-mangopay-client-id'
|
|
52
|
+
c.client_apiKey = 'your-mangopay-api-key'
|
|
53
|
+
c.root_url = 'https://api-mtls.sandbox.mangopay.com' # mTLS base URL
|
|
54
|
+
c.preproduction = true
|
|
55
|
+
|
|
56
|
+
c.mtls_cert = ENV['CERTIFICATE_PEM_B64'] # Base64-encoded string
|
|
57
|
+
c.mtls_key = ENV['PRIVATE_KEY_B64'] # Base64-encoded string
|
|
58
|
+
c.mtls_key_passphrase = ENV['YOUR_CERT_PASSPHRASE'] # optional, if encrypted
|
|
59
|
+
end
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
#### File paths
|
|
63
|
+
|
|
64
|
+
```ruby theme={null}
|
|
65
|
+
MangoPay.configure do |c|
|
|
66
|
+
c.client_id = 'your-mangopay-client-id'
|
|
67
|
+
c.client_apiKey = 'your-mangopay-api-key'
|
|
68
|
+
c.root_url = 'https://api-mtls.sandbox.mangopay.com' # mTLS base URL
|
|
69
|
+
c.preproduction = true
|
|
70
|
+
|
|
71
|
+
c.mtls_cert = '/path/to/certificate.pem' # file path
|
|
72
|
+
c.mtls_key = '/path/to/private.key' # file path
|
|
73
|
+
c.mtls_key_passphrase = 'your-cert-passphrase' # optional, if encrypted
|
|
74
|
+
end
|
|
75
|
+
```
|
|
76
|
+
|
|
22
77
|
### Usage
|
|
23
78
|
|
|
24
79
|
```ruby
|
data/lib/mangopay/pay_in.rb
CHANGED
|
@@ -147,22 +147,6 @@ module MangoPay
|
|
|
147
147
|
|
|
148
148
|
end
|
|
149
149
|
|
|
150
|
-
module Payconiq
|
|
151
|
-
|
|
152
|
-
class Web < Resource
|
|
153
|
-
include HTTPCalls::Create
|
|
154
|
-
|
|
155
|
-
def self.url(*)
|
|
156
|
-
"#{MangoPay.api_path}/payins/payment-methods/payconiq"
|
|
157
|
-
end
|
|
158
|
-
|
|
159
|
-
def self.create_legacy(params, idempotency_key = nil)
|
|
160
|
-
MangoPay.request(:post, "#{MangoPay.api_path}/payins/payconiq/web", params, {}, idempotency_key)
|
|
161
|
-
end
|
|
162
|
-
end
|
|
163
|
-
|
|
164
|
-
end
|
|
165
|
-
|
|
166
150
|
module ApplePay
|
|
167
151
|
class Direct < Resource
|
|
168
152
|
include HTTPCalls::Create
|
data/lib/mangopay/version.rb
CHANGED
data/lib/mangopay.rb
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
require 'net/http'
|
|
2
|
+
require 'openssl'
|
|
3
|
+
require 'base64'
|
|
2
4
|
require 'cgi/util'
|
|
3
5
|
require 'digest/md5'
|
|
4
6
|
require 'multi_json'
|
|
@@ -67,7 +69,8 @@ module MangoPay
|
|
|
67
69
|
:temp_dir, :log_file, :log_trace_headers, :http_timeout,
|
|
68
70
|
:http_max_retries, :http_open_timeout,
|
|
69
71
|
:logger, :use_ssl, :uk_header_flag,
|
|
70
|
-
:after_request_proc
|
|
72
|
+
:after_request_proc,
|
|
73
|
+
:mtls_cert, :mtls_key, :mtls_key_passphrase
|
|
71
74
|
|
|
72
75
|
def apply_configuration
|
|
73
76
|
MangoPay.configure do |config|
|
|
@@ -83,6 +86,9 @@ module MangoPay
|
|
|
83
86
|
config.logger = @logger
|
|
84
87
|
config.uk_header_flag = @uk_header_flag
|
|
85
88
|
config.after_request_proc = @after_request_proc
|
|
89
|
+
config.mtls_cert = @mtls_cert
|
|
90
|
+
config.mtls_key = @mtls_key
|
|
91
|
+
config.mtls_key_passphrase = @mtls_key_passphrase
|
|
86
92
|
end
|
|
87
93
|
end
|
|
88
94
|
|
|
@@ -226,9 +232,7 @@ module MangoPay
|
|
|
226
232
|
headers['x-tenant-id'] = 'uk'
|
|
227
233
|
end
|
|
228
234
|
|
|
229
|
-
res = Net::HTTP.start(uri.host, uri.port,
|
|
230
|
-
:max_retries => configuration.http_max_retries,
|
|
231
|
-
:open_timeout => configuration.http_open_timeout, ssl_version: :TLSv1_2) do |http|
|
|
235
|
+
res = Net::HTTP.start(uri.host, uri.port, **ssl_options) do |http|
|
|
232
236
|
req = Net::HTTP::const_get(method.capitalize).new(uri.request_uri, headers)
|
|
233
237
|
req.body = JSON.dump(params)
|
|
234
238
|
before_request_proc.call(req) if before_request_proc
|
|
@@ -296,12 +300,7 @@ module MangoPay
|
|
|
296
300
|
# Join string parts and ensure binary content is preserved
|
|
297
301
|
body = multipart_body.map { |part| part.is_a?(String) ? part.force_encoding("ASCII-8BIT") : part }.join("\r\n")
|
|
298
302
|
|
|
299
|
-
res = Net::HTTP.start(uri.host, uri.port,
|
|
300
|
-
use_ssl: configuration.use_ssl?,
|
|
301
|
-
read_timeout: configuration.http_timeout,
|
|
302
|
-
open_timeout: configuration.http_open_timeout,
|
|
303
|
-
max_retries: configuration.http_max_retries,
|
|
304
|
-
ssl_version: :TLSv1_2) do |http|
|
|
303
|
+
res = Net::HTTP.start(uri.host, uri.port, **ssl_options) do |http|
|
|
305
304
|
req_class = Net::HTTP.const_get(method.capitalize)
|
|
306
305
|
req = req_class.new(uri.request_uri, headers)
|
|
307
306
|
req.body = body
|
|
@@ -380,6 +379,38 @@ module MangoPay
|
|
|
380
379
|
end
|
|
381
380
|
end
|
|
382
381
|
|
|
382
|
+
def ssl_options
|
|
383
|
+
opts = {
|
|
384
|
+
use_ssl: configuration.use_ssl?,
|
|
385
|
+
read_timeout: configuration.http_timeout,
|
|
386
|
+
open_timeout: configuration.http_open_timeout,
|
|
387
|
+
max_retries: configuration.http_max_retries,
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
if defined?(OpenSSL::SSL::TLS1_2_VERSION)
|
|
391
|
+
opts[:min_version] = OpenSSL::SSL::TLS1_2_VERSION
|
|
392
|
+
else
|
|
393
|
+
opts[:ssl_version] = :TLSv1_2
|
|
394
|
+
end
|
|
395
|
+
|
|
396
|
+
if configuration.mtls_cert && configuration.mtls_key
|
|
397
|
+
cert_pem = file_or_pem(configuration.mtls_cert)
|
|
398
|
+
key_pem = file_or_pem(configuration.mtls_key)
|
|
399
|
+
opts[:cert] = OpenSSL::X509::Certificate.new(cert_pem)
|
|
400
|
+
opts[:key] = OpenSSL::PKey.read(key_pem, configuration.mtls_key_passphrase)
|
|
401
|
+
end
|
|
402
|
+
|
|
403
|
+
opts
|
|
404
|
+
end
|
|
405
|
+
|
|
406
|
+
def file_or_pem(value)
|
|
407
|
+
if File.exist?(value)
|
|
408
|
+
File.read(value)
|
|
409
|
+
else
|
|
410
|
+
Base64.decode64(value)
|
|
411
|
+
end
|
|
412
|
+
end
|
|
413
|
+
|
|
383
414
|
def do_request(http, req, uri)
|
|
384
415
|
if logs_required?
|
|
385
416
|
do_request_with_log(http, req, uri)
|
|
@@ -358,34 +358,6 @@ shared_context 'payins' do
|
|
|
358
358
|
)
|
|
359
359
|
end
|
|
360
360
|
|
|
361
|
-
###############################################
|
|
362
|
-
# payconiq/web
|
|
363
|
-
###############################################
|
|
364
|
-
|
|
365
|
-
let(:new_payin_payconiq_web) do
|
|
366
|
-
MangoPay::PayIn::Payconiq::Web.create(
|
|
367
|
-
AuthorId: new_natural_user['Id'],
|
|
368
|
-
CreditedWalletId: new_wallet['Id'],
|
|
369
|
-
DebitedFunds: { Currency: 'EUR', Amount: 100 },
|
|
370
|
-
Fees: { Currency: 'EUR', Amount: 0 },
|
|
371
|
-
ReturnURL: MangoPay.configuration.root_url,
|
|
372
|
-
Country: "BE",
|
|
373
|
-
Tag: 'Custom Meta'
|
|
374
|
-
)
|
|
375
|
-
end
|
|
376
|
-
|
|
377
|
-
let(:new_payin_payconiq_web_legacy) do
|
|
378
|
-
MangoPay::PayIn::Payconiq::Web.create_legacy(
|
|
379
|
-
AuthorId: new_natural_user['Id'],
|
|
380
|
-
CreditedWalletId: new_wallet['Id'],
|
|
381
|
-
DebitedFunds: { Currency: 'EUR', Amount: 100 },
|
|
382
|
-
Fees: { Currency: 'EUR', Amount: 0 },
|
|
383
|
-
ReturnURL: MangoPay.configuration.root_url,
|
|
384
|
-
Country: "BE",
|
|
385
|
-
Tag: 'Custom Meta'
|
|
386
|
-
)
|
|
387
|
-
end
|
|
388
|
-
|
|
389
361
|
###############################################
|
|
390
362
|
# applepay/direct
|
|
391
363
|
###############################################
|
|
@@ -1225,7 +1197,7 @@ shared_context 'instant_conversion' do
|
|
|
1225
1197
|
},
|
|
1226
1198
|
Fees: {
|
|
1227
1199
|
Currency: 'EUR',
|
|
1228
|
-
Amount:
|
|
1200
|
+
Amount: 10,
|
|
1229
1201
|
Type: 'PERCENTAGE'
|
|
1230
1202
|
},
|
|
1231
1203
|
Tag: 'Instant conversion test'
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mangopay4-ruby-sdk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.48.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Geoffroy Lorieux
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2026-
|
|
12
|
+
date: 2026-03-30 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: multi_json
|
|
@@ -159,7 +159,6 @@ files:
|
|
|
159
159
|
- spec/mangopay/payin_mbway_web_spec.rb
|
|
160
160
|
- spec/mangopay/payin_multibanco_web_spec.rb
|
|
161
161
|
- spec/mangopay/payin_paybybank_web_spec.rb
|
|
162
|
-
- spec/mangopay/payin_payconiq_web_spec.rb
|
|
163
162
|
- spec/mangopay/payin_paypal_web_spec.rb
|
|
164
163
|
- spec/mangopay/payin_preauthorized_direct_spec.rb
|
|
165
164
|
- spec/mangopay/payin_satispay_web_spec.rb
|
|
@@ -251,7 +250,6 @@ test_files:
|
|
|
251
250
|
- spec/mangopay/payin_mbway_web_spec.rb
|
|
252
251
|
- spec/mangopay/payin_multibanco_web_spec.rb
|
|
253
252
|
- spec/mangopay/payin_paybybank_web_spec.rb
|
|
254
|
-
- spec/mangopay/payin_payconiq_web_spec.rb
|
|
255
253
|
- spec/mangopay/payin_paypal_web_spec.rb
|
|
256
254
|
- spec/mangopay/payin_preauthorized_direct_spec.rb
|
|
257
255
|
- spec/mangopay/payin_satispay_web_spec.rb
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
describe MangoPay::PayIn::Payconiq::Web, type: :feature do
|
|
2
|
-
include_context 'payins'
|
|
3
|
-
|
|
4
|
-
def check_type_and_status(payin)
|
|
5
|
-
expect(payin['Type']).to eq('PAYIN')
|
|
6
|
-
expect(payin['Nature']).to eq('REGULAR')
|
|
7
|
-
expect(payin['PaymentType']).to eq('PAYCONIQ')
|
|
8
|
-
expect(payin['ExecutionType']).to eq('WEB')
|
|
9
|
-
|
|
10
|
-
# not SUCCEEDED yet: waiting for processing
|
|
11
|
-
expect(payin['Status']).to eq('CREATED')
|
|
12
|
-
expect(payin['ResultCode']).to be_nil
|
|
13
|
-
expect(payin['ResultMessage']).to be_nil
|
|
14
|
-
expect(payin['ExecutionDate']).to be_nil
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
describe 'CREATE' do
|
|
18
|
-
it 'creates a payconiq web payin' do
|
|
19
|
-
created = new_payin_payconiq_web
|
|
20
|
-
expect(created['Id']).not_to be_nil
|
|
21
|
-
check_type_and_status(created)
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
# endpoint removed
|
|
25
|
-
xit 'creates a payconiq web payin using the old endpoint' do
|
|
26
|
-
created = new_payin_payconiq_web_legacy
|
|
27
|
-
expect(created['Id']).not_to be_nil
|
|
28
|
-
check_type_and_status(created)
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
end
|