mangopay 3.21.0 → 3.23.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby_ci.yml +0 -4
- data/CHANGELOG.md +16 -0
- data/lib/mangopay/authorization_token.rb +1 -1
- data/lib/mangopay/conversion.rb +39 -0
- data/lib/mangopay/payment_method_metadata.rb +13 -0
- data/lib/mangopay/version.rb +1 -1
- data/lib/mangopay.rb +12 -2
- data/spec/mangopay/conversion_spec.rb +64 -0
- data/spec/mangopay/deposit_spec.rb +2 -3
- data/spec/mangopay/payin_preauthorized_direct_spec.rb +2 -0
- data/spec/mangopay/payment_method_metadata_spec.rb +15 -0
- data/spec/mangopay/recurring_payin_spec.rb +1 -1
- data/spec/mangopay/shared_resources.rb +67 -56
- data/spec/mangopay/transaction_spec.rb +5 -0
- data/spec/mangopay/user_spec.rb +2 -0
- data/spec/mangopay/wallet_spec.rb +5 -0
- metadata +8 -5
- data/lib/mangopay/instant_conversion.rb +0 -24
- data/spec/mangopay/instant_conversion_spec.rb +0 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fe8c22cc128558db9e859283f7e723af2e7bc54e1b2b98cb82afc23f03de814
|
4
|
+
data.tar.gz: 2747bafde96b9a150cdd9505b2348da658d098746ec5fc1d6e5ffd0eafd4637c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f530fd2a85bdeb7ef143048d9ce12f12d2e51a6ddbec4254c316235248add77f52ddf50e890906ca1ea4b0ac43720a397a37e37df5dc8051d5ecc4f5769e801a
|
7
|
+
data.tar.gz: 8044741c0cbb7650780e340321c8e5035f2ed817b355d22fb0f265e81fb1f5afd411c0df0fa2c8b5ca061fa898213cf593f3409a3c7e0fc5dba727804d3fdbc3
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
## [3.23.0] - 2024-03-08
|
2
|
+
### Fixed
|
3
|
+
|
4
|
+
- Conversions endpoint spelling
|
5
|
+
|
6
|
+
### Added
|
7
|
+
|
8
|
+
- The optional Fees parameter is now available on instant conversions, allowing platforms to charge users for FX services. More information [here](https://mangopay.com/docs/release-notes/millefeuille).
|
9
|
+
- Platforms can now use a quote to secure the rate for a conversion between two currencies for a set amount of time. More information [here](https://mangopay.com/docs/release-notes/millefeuille).
|
10
|
+
- Introduced the `uk_header_flag` boolean configuration key. Platforms partnered with Mangopay's UK entity should set this key to true for proper configuration.
|
11
|
+
|
12
|
+
## [3.22.0] - 2024-02-08
|
13
|
+
### Added
|
14
|
+
|
15
|
+
- New endpoint to look up metadata from BIN or Google Pay token. More information [here](https://mangopay.com/docs/release-notes/kisale)
|
16
|
+
|
1
17
|
## [3.21.0] - 2024-01-23
|
2
18
|
### Added
|
3
19
|
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module MangoPay
|
2
|
+
|
3
|
+
class Conversion < 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}/conversions/rate/#{debited_currency}/#{credited_currency}"
|
10
|
+
MangoPay.request(:get, url, params)
|
11
|
+
end
|
12
|
+
|
13
|
+
def create_instant_conversion(params)
|
14
|
+
url = "#{MangoPay.api_path}/conversions/instant-conversion"
|
15
|
+
MangoPay.request(:post, url, params)
|
16
|
+
end
|
17
|
+
|
18
|
+
def create_quoted_conversion(params)
|
19
|
+
url = "#{MangoPay.api_path}/conversions/quoted-conversion"
|
20
|
+
MangoPay.request(:post, url, params)
|
21
|
+
end
|
22
|
+
|
23
|
+
def get(id, params)
|
24
|
+
url = "#{MangoPay.api_path}/conversions/#{id}"
|
25
|
+
MangoPay.request(:get, url, params)
|
26
|
+
end
|
27
|
+
|
28
|
+
def create_quote(params)
|
29
|
+
url = "#{MangoPay.api_path}/conversions/quote"
|
30
|
+
MangoPay.request(:post, url, params)
|
31
|
+
end
|
32
|
+
|
33
|
+
def get_quote(id, params)
|
34
|
+
url = "#{MangoPay.api_path}/conversions/quote/#{id}"
|
35
|
+
MangoPay.request(:get, url, params)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module MangoPay
|
2
|
+
class PaymentMethodMetadata < Resource
|
3
|
+
include HTTPCalls::Fetch
|
4
|
+
include HTTPCalls::Update
|
5
|
+
|
6
|
+
class << self
|
7
|
+
def get_metadata(metadata)
|
8
|
+
url = "#{MangoPay.api_path}/payment-methods/metadata"
|
9
|
+
MangoPay.request(:post, url, metadata)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/lib/mangopay/version.rb
CHANGED
data/lib/mangopay.rb
CHANGED
@@ -44,7 +44,8 @@ module MangoPay
|
|
44
44
|
autoload :Ubo, 'mangopay/ubo'
|
45
45
|
autoload :Regulatory, 'mangopay/regulatory'
|
46
46
|
autoload :Deposit, 'mangopay/deposit'
|
47
|
-
autoload :
|
47
|
+
autoload :Conversion, 'mangopay/conversion'
|
48
|
+
autoload :PaymentMethodMetadata, 'mangopay/payment_method_metadata'
|
48
49
|
|
49
50
|
# temporary
|
50
51
|
autoload :Temp, 'mangopay/temp'
|
@@ -56,7 +57,7 @@ module MangoPay
|
|
56
57
|
:client_id, :client_apiKey,
|
57
58
|
:temp_dir, :log_file, :http_timeout,
|
58
59
|
:http_max_retries, :http_open_timeout,
|
59
|
-
:logger, :use_ssl
|
60
|
+
:logger, :use_ssl, :uk_header_flag
|
60
61
|
|
61
62
|
def apply_configuration
|
62
63
|
MangoPay.configure do |config|
|
@@ -69,6 +70,7 @@ module MangoPay
|
|
69
70
|
config.http_open_timeout = @http_open_timeout
|
70
71
|
config.use_ssl = @use_ssl
|
71
72
|
config.logger = @logger
|
73
|
+
config.uk_header_flag = @uk_header_flag
|
72
74
|
end
|
73
75
|
end
|
74
76
|
|
@@ -99,6 +101,10 @@ module MangoPay
|
|
99
101
|
|
100
102
|
true
|
101
103
|
end
|
104
|
+
|
105
|
+
def uk_header_flag
|
106
|
+
@uk_header_flag || false
|
107
|
+
end
|
102
108
|
end
|
103
109
|
|
104
110
|
class << self
|
@@ -192,6 +198,10 @@ module MangoPay
|
|
192
198
|
headers['Idempotency-Key'] = headers_or_idempotency_key if headers_or_idempotency_key != nil
|
193
199
|
end
|
194
200
|
|
201
|
+
if configuration.uk_header_flag
|
202
|
+
headers['x-tenant-id'] = 'uk'
|
203
|
+
end
|
204
|
+
|
195
205
|
res = Net::HTTP.start(uri.host, uri.port, :use_ssl => configuration.use_ssl?, :read_timeout => configuration.http_timeout,
|
196
206
|
:max_retries => configuration.http_max_retries,
|
197
207
|
:open_timeout => configuration.http_open_timeout, ssl_version: :TLSv1_2) do |http|
|
@@ -0,0 +1,64 @@
|
|
1
|
+
describe MangoPay::Conversion, 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 INSTANT CONVERSION' do
|
14
|
+
it 'creates a new instant 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['Fees']['Amount']).not_to be_nil
|
20
|
+
expect(conversion['Status']).equal? 'SUCCEEDED'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe 'CREATE QUOTED CONVERSION' do
|
25
|
+
it 'creates a new quoted conversion' do
|
26
|
+
conversion = create_quoted_conversion
|
27
|
+
|
28
|
+
expect(conversion['DebitedFunds']['Amount']).not_to be_nil
|
29
|
+
expect(conversion['CreditedFunds']['Amount']).not_to be_nil
|
30
|
+
expect(conversion['Status']).equal? 'SUCCEEDED'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe 'GET EXISTING CONVERSION' do
|
35
|
+
it 'get an existing conversion' do
|
36
|
+
conversion = create_instant_conversion
|
37
|
+
returned_conversion = get_conversion(conversion['Id'])
|
38
|
+
|
39
|
+
expect(returned_conversion['DebitedFunds']['Amount']).not_to be_nil
|
40
|
+
expect(returned_conversion['CreditedFunds']['Amount']).not_to be_nil
|
41
|
+
expect(conversion['Fees']['Amount']).not_to be_nil
|
42
|
+
expect(returned_conversion['Status']).equal? 'SUCCEEDED'
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe 'CREATE CONVERSION QUOTE' do
|
47
|
+
it 'create a conversion quote' do
|
48
|
+
conversion_quote = create_conversion_quote
|
49
|
+
expect(conversion_quote['DebitedFunds']).not_to be_nil
|
50
|
+
expect(conversion_quote['CreditedFunds']).not_to be_nil
|
51
|
+
expect(conversion_quote['Duration']).equal? 90
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
describe 'GET CONVERSION QUOTE' do
|
56
|
+
it 'get a conversion quote' do
|
57
|
+
conversion_quote = create_conversion_quote
|
58
|
+
returned_conversion_quote = get_conversion_quote(conversion_quote['Id'])
|
59
|
+
expect(returned_conversion_quote['DebitedFunds']).not_to be_nil
|
60
|
+
expect(returned_conversion_quote['CreditedFunds']).not_to be_nil
|
61
|
+
expect(returned_conversion_quote['Duration']).equal? 90
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -5,7 +5,7 @@ describe MangoPay::Deposit do
|
|
5
5
|
describe 'CREATE' do
|
6
6
|
it 'creates a new deposit' do
|
7
7
|
author = new_natural_user
|
8
|
-
card_registration =
|
8
|
+
card_registration = new_card_registration_completed
|
9
9
|
deposit = create_new_deposit(card_registration['CardId'], author['Id'])
|
10
10
|
|
11
11
|
assert_deposit(deposit, card_registration['CardId'], author["Id"])
|
@@ -15,7 +15,7 @@ describe MangoPay::Deposit do
|
|
15
15
|
describe 'GET' do
|
16
16
|
it 'get an existing deposit' do
|
17
17
|
author = new_natural_user
|
18
|
-
card_registration =
|
18
|
+
card_registration = new_card_registration_completed
|
19
19
|
deposit = create_new_deposit(card_registration['CardId'], author['Id'])
|
20
20
|
|
21
21
|
assert_deposit(deposit, card_registration['CardId'], author["Id"])
|
@@ -64,7 +64,6 @@ def assert_deposit(deposit, card_reg_id, author_id)
|
|
64
64
|
expect(deposit['CardId']).to eq(card_reg_id)
|
65
65
|
expect(deposit['AuthorId']).to eq(author_id)
|
66
66
|
expect(deposit['SecureModeReturnURL']).not_to be_nil
|
67
|
-
expect(deposit['SecureModeRedirectURL']).not_to be_nil
|
68
67
|
expect(deposit['PaymentType']).not_to be_nil
|
69
68
|
expect(deposit['ExecutionType']).not_to be_nil
|
70
69
|
expect(deposit['StatementDescriptor']).not_to be_nil
|
@@ -19,6 +19,8 @@ describe MangoPay::PayIn::PreAuthorized::Direct, type: :feature do
|
|
19
19
|
describe 'CREATE' do
|
20
20
|
it 'creates a preauthorized direct payin' do
|
21
21
|
created = new_payin_preauthorized_direct
|
22
|
+
# wait for the transactions to be created
|
23
|
+
sleep(2)
|
22
24
|
transactions = MangoPay::PreAuthorization.transactions(created['PreauthorizationId'])
|
23
25
|
expect(created['Id']).not_to be_nil
|
24
26
|
expect(transactions[0]['Status']).to eq('SUCCEEDED')
|
@@ -0,0 +1,15 @@
|
|
1
|
+
describe MangoPay::PaymentMethodMetadata, type: :feature do
|
2
|
+
include_context 'payment_method_metadata'
|
3
|
+
|
4
|
+
describe 'GET PAYMENT METHOD METADATA' do
|
5
|
+
it 'gets a new payment method metadata' do
|
6
|
+
metadata = get_payment_method_metadata
|
7
|
+
|
8
|
+
expect(metadata).not_to be_nil
|
9
|
+
expect(metadata['IssuerCountryCode']).not_to be_nil
|
10
|
+
expect(metadata['IssuingBank']).not_to be_nil
|
11
|
+
expect(metadata['BinData']).not_to be_nil
|
12
|
+
expect(metadata['CardType']).not_to be_nil
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -5,7 +5,7 @@ describe MangoPay::PayIn::RecurringPayments, type: :feature do
|
|
5
5
|
|
6
6
|
describe 'CREATE' do
|
7
7
|
it 'creates a recurring payment' do
|
8
|
-
cardreg =
|
8
|
+
cardreg = new_card_registration_completed
|
9
9
|
wallet = new_wallet
|
10
10
|
recurring = MangoPay::PayIn::RecurringPayments::Recurring.create(
|
11
11
|
AuthorId: new_natural_user['Id'],
|
@@ -379,51 +379,7 @@ shared_context 'payins' do
|
|
379
379
|
data = {
|
380
380
|
data: cardreg['PreregistrationData'],
|
381
381
|
accessKeyRef: cardreg['AccessKey'],
|
382
|
-
cardNumber:
|
383
|
-
cardExpirationDate: 1226,
|
384
|
-
cardCvx: 123 }
|
385
|
-
|
386
|
-
res = Net::HTTP.post_form(URI(cardreg['CardRegistrationURL']), data)
|
387
|
-
raise Exception, [res, res.body] unless res.is_a?(Net::HTTPOK) && res.body.start_with?('data=')
|
388
|
-
|
389
|
-
cardreg['RegistrationData'] = res.body
|
390
|
-
|
391
|
-
# 3rd step: update (fills-in CardId) and return it
|
392
|
-
MangoPay::CardRegistration.update(cardreg['Id'],
|
393
|
-
RegistrationData: cardreg['RegistrationData'])
|
394
|
-
end
|
395
|
-
|
396
|
-
let(:new_card_registration_3dsecure_completed) do
|
397
|
-
# 1st step: create
|
398
|
-
cardreg = new_card_registration
|
399
|
-
|
400
|
-
# 2nd step: tokenize by payline (fills-in RegistrationData)
|
401
|
-
data = {
|
402
|
-
data: cardreg['PreregistrationData'],
|
403
|
-
accessKeyRef: cardreg['AccessKey'],
|
404
|
-
cardNumber: 4970105191923460,
|
405
|
-
cardExpirationDate: 1224,
|
406
|
-
cardCvx: 123 }
|
407
|
-
|
408
|
-
res = Net::HTTP.post_form(URI(cardreg['CardRegistrationURL']), data)
|
409
|
-
raise Exception, [res, res.body] unless res.is_a?(Net::HTTPOK) && res.body.start_with?('data=')
|
410
|
-
|
411
|
-
cardreg['RegistrationData'] = res.body
|
412
|
-
|
413
|
-
# 3rd step: update (fills-in CardId) and return it
|
414
|
-
MangoPay::CardRegistration.update(cardreg['Id'],
|
415
|
-
RegistrationData: cardreg['RegistrationData'])
|
416
|
-
end
|
417
|
-
|
418
|
-
let(:new_card_registration_completed_for_deposit) do
|
419
|
-
# 1st step: create
|
420
|
-
cardreg = new_card_registration
|
421
|
-
|
422
|
-
# 2nd step: tokenize by payline (fills-in RegistrationData)
|
423
|
-
data = {
|
424
|
-
data: cardreg['PreregistrationData'],
|
425
|
-
accessKeyRef: cardreg['AccessKey'],
|
426
|
-
cardNumber: 4970105181818183,
|
382
|
+
cardNumber: 4970107111111119,
|
427
383
|
cardExpirationDate: 1226,
|
428
384
|
cardCvx: 123 }
|
429
385
|
|
@@ -514,8 +470,8 @@ shared_context 'payins' do
|
|
514
470
|
MangoPay::PayIn::Klarna::Web.create(
|
515
471
|
AuthorId: new_natural_user['Id'],
|
516
472
|
CreditedWalletId: new_wallet['Id'],
|
517
|
-
DebitedFunds: {Currency: 'EUR', Amount: 400},
|
518
|
-
Fees: {Currency: 'EUR', Amount: 10},
|
473
|
+
DebitedFunds: { Currency: 'EUR', Amount: 400 },
|
474
|
+
Fees: { Currency: 'EUR', Amount: 10 },
|
519
475
|
ReturnURL: 'http://www.my-site.com/returnURL',
|
520
476
|
LineItems: [
|
521
477
|
{
|
@@ -574,8 +530,8 @@ shared_context 'payins' do
|
|
574
530
|
MangoPay::PayIn::Ideal::Web.create(
|
575
531
|
AuthorId: new_natural_user['Id'],
|
576
532
|
CreditedWalletId: new_wallet['Id'],
|
577
|
-
DebitedFunds: {Currency: 'EUR', Amount: 400},
|
578
|
-
Fees: {Currency: 'EUR', Amount: 10},
|
533
|
+
DebitedFunds: { Currency: 'EUR', Amount: 400 },
|
534
|
+
Fees: { Currency: 'EUR', Amount: 10 },
|
579
535
|
ReturnURL: 'http://www.my-site.com/returnURL',
|
580
536
|
Bic: 'REVOLT21',
|
581
537
|
StatementDescriptor: "test",
|
@@ -590,8 +546,8 @@ shared_context 'payins' do
|
|
590
546
|
MangoPay::PayIn::Giropay::Web.create(
|
591
547
|
AuthorId: new_natural_user['Id'],
|
592
548
|
CreditedWalletId: new_wallet['Id'],
|
593
|
-
DebitedFunds: {Currency: 'EUR', Amount: 400},
|
594
|
-
Fees: {Currency: 'EUR', Amount: 10},
|
549
|
+
DebitedFunds: { Currency: 'EUR', Amount: 400 },
|
550
|
+
Fees: { Currency: 'EUR', Amount: 10 },
|
595
551
|
ReturnURL: 'http://www.my-site.com/returnURL',
|
596
552
|
StatementDescriptor: "test",
|
597
553
|
Tag: 'Test PayIn/Giropay/Web'
|
@@ -785,7 +741,7 @@ shared_context 'payins' do
|
|
785
741
|
# wallet with money
|
786
742
|
###############################################
|
787
743
|
#
|
788
|
-
let(:new_wallet_with_money){ create_new_wallet_with_money(new_natural_user) }
|
744
|
+
let(:new_wallet_with_money) { create_new_wallet_with_money(new_natural_user) }
|
789
745
|
|
790
746
|
def create_new_wallet_with_money(user)
|
791
747
|
wallet = MangoPay::Wallet.create(
|
@@ -940,8 +896,9 @@ end
|
|
940
896
|
###############################################
|
941
897
|
shared_context 'instant_conversion' do
|
942
898
|
include_context 'payins'
|
899
|
+
|
943
900
|
def get_conversion_rate(debited_currency, credited_currency)
|
944
|
-
MangoPay::
|
901
|
+
MangoPay::Conversion.get_rate(debited_currency, credited_currency, params = {})
|
945
902
|
end
|
946
903
|
|
947
904
|
def create_instant_conversion()
|
@@ -953,7 +910,7 @@ shared_context 'instant_conversion' do
|
|
953
910
|
Tag: 'Test wallet'
|
954
911
|
)
|
955
912
|
|
956
|
-
MangoPay::
|
913
|
+
MangoPay::Conversion.create_instant_conversion(
|
957
914
|
AuthorId: user['Id'],
|
958
915
|
CreditedWalletId: credited_wallet['Id'],
|
959
916
|
DebitedWalletId: new_wallet_with_money['Id'],
|
@@ -964,11 +921,65 @@ shared_context 'instant_conversion' do
|
|
964
921
|
Currency: 'EUR',
|
965
922
|
Amount: 79
|
966
923
|
},
|
924
|
+
Fees: {
|
925
|
+
Currency: 'EUR',
|
926
|
+
Amount: 9
|
927
|
+
},
|
967
928
|
Tag: 'Instant conversion test'
|
968
929
|
)
|
969
930
|
end
|
970
931
|
|
971
|
-
def
|
972
|
-
|
932
|
+
def create_quoted_conversion()
|
933
|
+
user = new_natural_user
|
934
|
+
credited_wallet = MangoPay::Wallet.create(
|
935
|
+
Owners: [user['Id']],
|
936
|
+
Description: 'A test wallet',
|
937
|
+
Currency: 'GBP',
|
938
|
+
Tag: 'Test wallet'
|
939
|
+
)
|
940
|
+
quote = create_conversion_quote
|
941
|
+
|
942
|
+
MangoPay::Conversion.create_quoted_conversion(
|
943
|
+
AuthorId: user['Id'],
|
944
|
+
QuoteId: quote['Id'],
|
945
|
+
CreditedWalletId: credited_wallet['Id'],
|
946
|
+
DebitedWalletId: new_wallet_with_money['Id'],
|
947
|
+
Tag: 'Quoted conversion test'
|
948
|
+
)
|
949
|
+
end
|
950
|
+
|
951
|
+
def create_conversion_quote
|
952
|
+
MangoPay::Conversion.create_quote(
|
953
|
+
CreditedFunds: { Currency: 'GBP' },
|
954
|
+
DebitedFunds: { Currency: 'EUR', Amount: 50 },
|
955
|
+
Duration: 90,
|
956
|
+
Tag: 'Created using the Mangopay Ruby SDK'
|
957
|
+
)
|
958
|
+
end
|
959
|
+
|
960
|
+
def get_conversion(id)
|
961
|
+
MangoPay::Conversion.get(id, params = {})
|
962
|
+
end
|
963
|
+
|
964
|
+
def get_conversion_quote(id)
|
965
|
+
MangoPay::Conversion.get_quote(id, params = {})
|
966
|
+
end
|
967
|
+
end
|
968
|
+
|
969
|
+
###############################################
|
970
|
+
# payment methods metadata
|
971
|
+
###############################################
|
972
|
+
shared_context 'payment_method_metadata' do
|
973
|
+
include_context 'payins'
|
974
|
+
|
975
|
+
def get_payment_method_metadata
|
976
|
+
|
977
|
+
wlt = new_wallet
|
978
|
+
pay_in = create_new_payin_card_direct(wlt, 1000)
|
979
|
+
|
980
|
+
MangoPay::PaymentMethodMetadata.get_metadata(
|
981
|
+
Type: 'BIN',
|
982
|
+
Bin: pay_in['CardInfo']['BIN']
|
983
|
+
)
|
973
984
|
end
|
974
985
|
end
|
@@ -22,6 +22,8 @@ describe MangoPay::Transaction do
|
|
22
22
|
it 'fetches list with two transactions after payin and payout done' do
|
23
23
|
payin = new_payin_card_direct
|
24
24
|
payout = create_new_payout_bankwire(payin)
|
25
|
+
# wait for the transactions to be created
|
26
|
+
sleep(2)
|
25
27
|
transactions = MangoPay::Transaction.fetch(new_wallet['Id'])
|
26
28
|
|
27
29
|
expect(transactions).to be_kind_of(Array)
|
@@ -37,6 +39,9 @@ describe MangoPay::Transaction do
|
|
37
39
|
payout = create_new_payout_bankwire(payin)
|
38
40
|
wallet_id = new_wallet['Id']
|
39
41
|
|
42
|
+
# wait for the transactions to be created
|
43
|
+
sleep(2)
|
44
|
+
|
40
45
|
by_nature_reg = MangoPay::Transaction.fetch(wallet_id, {'Nature' => 'REGULAR'})
|
41
46
|
by_nature_ref = MangoPay::Transaction.fetch(wallet_id, {'Nature' => 'REFUND'})
|
42
47
|
expect(by_nature_reg.count).to eq 2
|
data/spec/mangopay/user_spec.rb
CHANGED
@@ -95,6 +95,8 @@ describe MangoPay::User do
|
|
95
95
|
it 'fetches list with two transactions after payin and payout done' do
|
96
96
|
payin = new_payin_card_direct
|
97
97
|
payout = create_new_payout_bankwire(payin)
|
98
|
+
# wait for the transactions to be created
|
99
|
+
sleep(2)
|
98
100
|
transactions = MangoPay::User.transactions(new_natural_user['Id'])
|
99
101
|
|
100
102
|
expect(transactions).to be_kind_of(Array)
|
@@ -48,6 +48,8 @@ describe MangoPay::Wallet do
|
|
48
48
|
it 'fetches list with two transactions after payin and payout done' do
|
49
49
|
payin = new_payin_card_direct
|
50
50
|
payout = create_new_payout_bankwire(payin)
|
51
|
+
# wait for the transactions to be created
|
52
|
+
sleep(2)
|
51
53
|
transactions = MangoPay::Wallet.transactions(new_wallet['Id'])
|
52
54
|
|
53
55
|
expect(transactions).to be_kind_of(Array)
|
@@ -63,6 +65,9 @@ describe MangoPay::Wallet do
|
|
63
65
|
payout = create_new_payout_bankwire(payin)
|
64
66
|
wallet_id = new_wallet['Id']
|
65
67
|
|
68
|
+
# wait for the transactions to be created
|
69
|
+
sleep(2)
|
70
|
+
|
66
71
|
by_nature_reg = MangoPay::Wallet.transactions(wallet_id, {'Nature' => 'REGULAR'})
|
67
72
|
by_nature_ref = MangoPay::Wallet.transactions(wallet_id, {'Nature' => 'REFUND'})
|
68
73
|
expect(by_nature_reg.count).to eq 2
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mangopay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.23.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: 2024-
|
12
|
+
date: 2024-03-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_json
|
@@ -82,6 +82,7 @@ files:
|
|
82
82
|
- lib/mangopay/card.rb
|
83
83
|
- lib/mangopay/card_registration.rb
|
84
84
|
- lib/mangopay/client.rb
|
85
|
+
- lib/mangopay/conversion.rb
|
85
86
|
- lib/mangopay/deposit.rb
|
86
87
|
- lib/mangopay/dispute.rb
|
87
88
|
- lib/mangopay/errors.rb
|
@@ -89,7 +90,6 @@ files:
|
|
89
90
|
- lib/mangopay/filter_parameters.rb
|
90
91
|
- lib/mangopay/hook.rb
|
91
92
|
- lib/mangopay/http_calls.rb
|
92
|
-
- lib/mangopay/instant_conversion.rb
|
93
93
|
- lib/mangopay/json.rb
|
94
94
|
- lib/mangopay/kyc_document.rb
|
95
95
|
- lib/mangopay/legal_user.rb
|
@@ -97,6 +97,7 @@ files:
|
|
97
97
|
- lib/mangopay/natural_user.rb
|
98
98
|
- lib/mangopay/pay_in.rb
|
99
99
|
- lib/mangopay/pay_out.rb
|
100
|
+
- lib/mangopay/payment_method_metadata.rb
|
100
101
|
- lib/mangopay/pre_authorization.rb
|
101
102
|
- lib/mangopay/refund.rb
|
102
103
|
- lib/mangopay/regulatory.rb
|
@@ -117,6 +118,7 @@ files:
|
|
117
118
|
- spec/mangopay/client_spec.png
|
118
119
|
- spec/mangopay/client_spec.rb
|
119
120
|
- spec/mangopay/configuration_spec.rb
|
121
|
+
- spec/mangopay/conversion_spec.rb
|
120
122
|
- spec/mangopay/deposit_spec.rb
|
121
123
|
- spec/mangopay/dispute_spec.png
|
122
124
|
- spec/mangopay/dispute_spec.rb
|
@@ -124,7 +126,6 @@ files:
|
|
124
126
|
- spec/mangopay/fetch_filters_spec.rb
|
125
127
|
- spec/mangopay/hook_spec.rb
|
126
128
|
- spec/mangopay/idempotency_spec.rb
|
127
|
-
- spec/mangopay/instant_conversion_spec.rb
|
128
129
|
- spec/mangopay/kyc_document_spec.png
|
129
130
|
- spec/mangopay/kyc_document_spec.rb
|
130
131
|
- spec/mangopay/log_requests_filter_spec.rb
|
@@ -147,6 +148,7 @@ files:
|
|
147
148
|
- spec/mangopay/payin_paypal_web_spec.rb
|
148
149
|
- spec/mangopay/payin_preauthorized_direct_spec.rb
|
149
150
|
- spec/mangopay/payin_satispay_web_spec.rb
|
151
|
+
- spec/mangopay/payment_method_metadata_spec.rb
|
150
152
|
- spec/mangopay/payout_bankwire_spec.rb
|
151
153
|
- spec/mangopay/preauthorization_spec.rb
|
152
154
|
- spec/mangopay/recurring_payin_spec.rb
|
@@ -194,6 +196,7 @@ test_files:
|
|
194
196
|
- spec/mangopay/client_spec.png
|
195
197
|
- spec/mangopay/client_spec.rb
|
196
198
|
- spec/mangopay/configuration_spec.rb
|
199
|
+
- spec/mangopay/conversion_spec.rb
|
197
200
|
- spec/mangopay/deposit_spec.rb
|
198
201
|
- spec/mangopay/dispute_spec.png
|
199
202
|
- spec/mangopay/dispute_spec.rb
|
@@ -201,7 +204,6 @@ test_files:
|
|
201
204
|
- spec/mangopay/fetch_filters_spec.rb
|
202
205
|
- spec/mangopay/hook_spec.rb
|
203
206
|
- spec/mangopay/idempotency_spec.rb
|
204
|
-
- spec/mangopay/instant_conversion_spec.rb
|
205
207
|
- spec/mangopay/kyc_document_spec.png
|
206
208
|
- spec/mangopay/kyc_document_spec.rb
|
207
209
|
- spec/mangopay/log_requests_filter_spec.rb
|
@@ -224,6 +226,7 @@ test_files:
|
|
224
226
|
- spec/mangopay/payin_paypal_web_spec.rb
|
225
227
|
- spec/mangopay/payin_preauthorized_direct_spec.rb
|
226
228
|
- spec/mangopay/payin_satispay_web_spec.rb
|
229
|
+
- spec/mangopay/payment_method_metadata_spec.rb
|
227
230
|
- spec/mangopay/payout_bankwire_spec.rb
|
228
231
|
- spec/mangopay/preauthorization_spec.rb
|
229
232
|
- spec/mangopay/recurring_payin_spec.rb
|
@@ -1,24 +0,0 @@
|
|
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
|
@@ -1,33 +0,0 @@
|
|
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
|