mangopay 3.16.0 → 3.18.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 +11 -0
- data/lib/mangopay/instant_conversion.rb +24 -0
- data/lib/mangopay/pay_in.rb +10 -0
- data/lib/mangopay/version.rb +1 -1
- data/lib/mangopay.rb +11 -2
- data/spec/mangopay/configuration_spec.rb +30 -0
- data/spec/mangopay/instant_conversion_spec.rb +33 -0
- data/spec/mangopay/payin_klarna_web_spec.rb +32 -0
- data/spec/mangopay/payin_multibanco_web_spec.rb +0 -1
- data/spec/mangopay/shared_resources.rb +470 -354
- metadata +7 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4bb8e0bce0fbb8b2a758340182c8be4b0d904ae358cf72637da7e7c63d2413b7
|
|
4
|
+
data.tar.gz: ebeacb1b39d233d2ebec9326d61c69213111fa1dd945f4541068c73fdcbc5061
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3514922d67baa1a1f21fc2fe459fdeca27fd958c4214f0f66daddf3c29358f22cbbf16eb0ee95930c3f882b9e551340c2d59b6f40cf5578c0b5ab698e71e7ea8
|
|
7
|
+
data.tar.gz: 2ee8d0c7015e18a84df5468c869dc328a808ef841da61b4ade65d2223d2eb4031de08e3a6628d26510b241d333d7116ada4881e9329bd0d243907773e5239abc
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
## [3.18.0] - 2023-09-29
|
|
2
|
+
### Added
|
|
3
|
+
- Instantly convert funds between 2 wallets of different currencies owned by the same user with the new SPOT FX endpoints
|
|
4
|
+
|
|
5
|
+
## [3.17.0] - 2023-09-20
|
|
6
|
+
### Added
|
|
7
|
+
|
|
8
|
+
- A new parameter for Paypal : ShippingPreference
|
|
9
|
+
- Klarna is now available as a payment method with Mangopay. This payment method is in private beta. Please contact support if you have any questions.
|
|
10
|
+
- #225 It's now possible to configure ssl_options. It's now possible to set to false in preproduction environment. Thanks to @mantaskujalis
|
|
11
|
+
|
|
1
12
|
## [3.16.0] - 2023-09-04
|
|
2
13
|
### Added
|
|
3
14
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
module MangoPay
|
|
2
|
+
|
|
3
|
+
class InstantConversion < Resource
|
|
4
|
+
include HTTPCalls::Fetch
|
|
5
|
+
include HTTPCalls::Update
|
|
6
|
+
|
|
7
|
+
class << self
|
|
8
|
+
def get_rate(debited_currency, credited_currency, params)
|
|
9
|
+
url = "#{MangoPay.api_path}/conversion/rate/#{debited_currency}/#{credited_currency}"
|
|
10
|
+
MangoPay.request(:get, url, params)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def create(params)
|
|
14
|
+
url = "#{MangoPay.api_path}/instant-conversion"
|
|
15
|
+
MangoPay.request(:post, url, params)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def get(id, params)
|
|
19
|
+
url = "#{MangoPay.api_path}/instant-conversion/#{id}"
|
|
20
|
+
MangoPay.request(:get, url, params)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
data/lib/mangopay/pay_in.rb
CHANGED
|
@@ -187,6 +187,16 @@ module MangoPay
|
|
|
187
187
|
end
|
|
188
188
|
end
|
|
189
189
|
|
|
190
|
+
module Klarna
|
|
191
|
+
class Web < Resource
|
|
192
|
+
include HTTPCalls::Create
|
|
193
|
+
|
|
194
|
+
def self.url(*)
|
|
195
|
+
"#{MangoPay.api_path}/payins/payment-methods/klarna"
|
|
196
|
+
end
|
|
197
|
+
end
|
|
198
|
+
end
|
|
199
|
+
|
|
190
200
|
module RecurringPayments
|
|
191
201
|
class Recurring < Resource
|
|
192
202
|
include HTTPCalls::Create
|
data/lib/mangopay/version.rb
CHANGED
data/lib/mangopay.rb
CHANGED
|
@@ -44,6 +44,7 @@ module MangoPay
|
|
|
44
44
|
autoload :Ubo, 'mangopay/ubo'
|
|
45
45
|
autoload :Regulatory, 'mangopay/regulatory'
|
|
46
46
|
autoload :Deposit, 'mangopay/deposit'
|
|
47
|
+
autoload :InstantConversion, 'mangopay/instant_conversion'
|
|
47
48
|
|
|
48
49
|
# temporary
|
|
49
50
|
autoload :Temp, 'mangopay/temp'
|
|
@@ -53,7 +54,7 @@ module MangoPay
|
|
|
53
54
|
:client_id, :client_apiKey,
|
|
54
55
|
:temp_dir, :log_file, :http_timeout,
|
|
55
56
|
:http_max_retries, :http_open_timeout,
|
|
56
|
-
:logger
|
|
57
|
+
:logger, :use_ssl
|
|
57
58
|
|
|
58
59
|
def preproduction
|
|
59
60
|
@preproduction || false
|
|
@@ -74,6 +75,14 @@ module MangoPay
|
|
|
74
75
|
def http_open_timeout
|
|
75
76
|
@http_open_timeout || 30
|
|
76
77
|
end
|
|
78
|
+
|
|
79
|
+
def use_ssl?
|
|
80
|
+
return true unless preproduction == true
|
|
81
|
+
return true unless defined?(@use_ssl)
|
|
82
|
+
return false if @use_ssl == false
|
|
83
|
+
|
|
84
|
+
true
|
|
85
|
+
end
|
|
77
86
|
end
|
|
78
87
|
|
|
79
88
|
class << self
|
|
@@ -150,7 +159,7 @@ module MangoPay
|
|
|
150
159
|
headers['Idempotency-Key'] = headers_or_idempotency_key if headers_or_idempotency_key != nil
|
|
151
160
|
end
|
|
152
161
|
|
|
153
|
-
res = Net::HTTP.start(uri.host, uri.port, use_ssl
|
|
162
|
+
res = Net::HTTP.start(uri.host, uri.port, :use_ssl => configuration.use_ssl?, :read_timeout => configuration.http_timeout,
|
|
154
163
|
:max_retries => configuration.http_max_retries,
|
|
155
164
|
:open_timeout => configuration.http_open_timeout, ssl_version: :TLSv1_2) do |http|
|
|
156
165
|
req = Net::HTTP::const_get(method.capitalize).new(uri.request_uri, headers)
|
|
@@ -19,6 +19,36 @@ describe MangoPay::Configuration do
|
|
|
19
19
|
expect(users).to be_kind_of(Array)
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
+
describe '.use_ssl?' do
|
|
23
|
+
let(:configuration) { MangoPay::Configuration.new }
|
|
24
|
+
|
|
25
|
+
it 'defaults to true' do
|
|
26
|
+
expect(configuration.use_ssl?).to eq(true)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
context 'when assigned to false in production' do
|
|
30
|
+
before do
|
|
31
|
+
configuration.use_ssl = false
|
|
32
|
+
configuration.preproduction = false
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it 'uses true as value' do
|
|
36
|
+
expect(configuration.use_ssl?).to eq(true)
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
context 'when assigned to false in preproduction' do
|
|
41
|
+
before do
|
|
42
|
+
configuration.use_ssl = false
|
|
43
|
+
configuration.preproduction = true
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
it 'uses assigned as value' do
|
|
47
|
+
expect(configuration.use_ssl?).to eq(false)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
22
52
|
describe 'logger' do
|
|
23
53
|
around(:each) do |example|
|
|
24
54
|
c = MangoPay.configuration
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
describe MangoPay::InstantConversion, type: :feature do
|
|
2
|
+
include_context 'instant_conversion'
|
|
3
|
+
|
|
4
|
+
describe 'GET CONVERSION RATE' do
|
|
5
|
+
it 'get a conversion rate' do
|
|
6
|
+
conversion_rate = get_conversion_rate('EUR','GBP')
|
|
7
|
+
|
|
8
|
+
expect(conversion_rate['ClientRate']).not_to be_nil
|
|
9
|
+
expect(conversion_rate['MarketRate']).not_to be_nil
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe 'CREATE CONVERSION' do
|
|
14
|
+
it 'creates a new conversion' do
|
|
15
|
+
conversion = create_instant_conversion
|
|
16
|
+
|
|
17
|
+
expect(conversion['DebitedFunds']['Amount']).not_to be_nil
|
|
18
|
+
expect(conversion['CreditedFunds']['Amount']).not_to be_nil
|
|
19
|
+
expect(conversion['Status']).equal? 'SUCCEEDED'
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
describe 'GET EXISTING CONVERSION' do
|
|
24
|
+
it 'get an existing conversion' do
|
|
25
|
+
conversion = create_instant_conversion
|
|
26
|
+
returned_conversion = get_instant_conversion(conversion['Id'])
|
|
27
|
+
|
|
28
|
+
expect(returned_conversion['DebitedFunds']['Amount']).not_to be_nil
|
|
29
|
+
expect(returned_conversion['CreditedFunds']['Amount']).not_to be_nil
|
|
30
|
+
expect(returned_conversion['Status']).equal? 'SUCCEEDED'
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
describe MangoPay::PayIn::Klarna::Web, type: :feature do
|
|
2
|
+
include_context 'wallets'
|
|
3
|
+
include_context 'payins'
|
|
4
|
+
|
|
5
|
+
def check_type_and_status(payin)
|
|
6
|
+
expect(payin['Type']).to eq('PAYIN')
|
|
7
|
+
expect(payin['Nature']).to eq('REGULAR')
|
|
8
|
+
expect(payin['PaymentType']).to eq('KLARNA')
|
|
9
|
+
expect(payin['ExecutionType']).to eq('WEB')
|
|
10
|
+
expect(payin['Status']).to eq('CREATED')
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe 'CREATE' do
|
|
14
|
+
it 'creates a klarna web payin' do
|
|
15
|
+
created = new_payin_klarna_web
|
|
16
|
+
expect(created['Id']).not_to be_nil
|
|
17
|
+
expect(created['ReturnURL']).not_to be_nil
|
|
18
|
+
check_type_and_status(created)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
describe 'FETCH' do
|
|
23
|
+
it 'fetches a payin' do
|
|
24
|
+
created = new_payin_klarna_web
|
|
25
|
+
fetched = MangoPay::PayIn.fetch(created['Id'])
|
|
26
|
+
expect(fetched['Id']).to eq(created['Id'])
|
|
27
|
+
check_type_and_status(created)
|
|
28
|
+
check_type_and_status(fetched)
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|