mangopay 3.20.0 → 3.22.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 +1 -1
- data/CHANGELOG.md +10 -0
- data/lib/mangopay/card.rb +5 -0
- data/lib/mangopay/payment_method_metadata.rb +13 -0
- data/lib/mangopay/version.rb +1 -1
- data/lib/mangopay.rb +1 -0
- data/spec/mangopay/card_registration_spec.rb +8 -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 +27 -52
- 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 +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d92bb15f455816281326eca83963d639590bcb68580848ff6c4589cee926a0a9
|
4
|
+
data.tar.gz: 4162a17a66cfa34730c0ed90d27fecb375654d3e4175a82431863ec64e25e57c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53796ff9758362b4d5e6cf5cf848b14e55928876e15ea78cd4f7105f1731a62344851d786b9103dd4ac1f58976dcfbd8b8b3aac0f16fdec424ccc669c60ffdec
|
7
|
+
data.tar.gz: 0a17dc77df68459acc86123ba7bd48806fe02fb8c07a5485aeaa8bef323a9998bd77d37e4ed241136774e20eb26054ed2db464fa3f7a678de7f3ea431a63a07e
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
## [3.22.0] - 2024-02-08
|
2
|
+
### Added
|
3
|
+
|
4
|
+
- New endpoint to look up metadata from BIN or Google Pay token. More information [here](https://mangopay.com/docs/release-notes/kisale)
|
5
|
+
|
6
|
+
## [3.21.0] - 2024-01-23
|
7
|
+
### Added
|
8
|
+
|
9
|
+
- The endpoint [View a card Validation](https://mangopay.com/docs/endpoints/card-validations#view-card-validation) is now available
|
10
|
+
|
1
11
|
## [3.20.0] - 2023-11-15
|
2
12
|
### Added
|
3
13
|
|
data/lib/mangopay/card.rb
CHANGED
@@ -40,6 +40,11 @@ module MangoPay
|
|
40
40
|
url = "#{MangoPay.api_path}/cards/#{card_id}/validation"
|
41
41
|
MangoPay.request(:post, url, params)
|
42
42
|
end
|
43
|
+
|
44
|
+
def get_card_validation(card_id, validation_id)
|
45
|
+
url = "#{MangoPay.api_path}/cards/#{card_id}/validation/#{validation_id}"
|
46
|
+
MangoPay.request(:get, url)
|
47
|
+
end
|
43
48
|
end
|
44
49
|
end
|
45
50
|
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
@@ -45,6 +45,7 @@ module MangoPay
|
|
45
45
|
autoload :Regulatory, 'mangopay/regulatory'
|
46
46
|
autoload :Deposit, 'mangopay/deposit'
|
47
47
|
autoload :InstantConversion, 'mangopay/instant_conversion'
|
48
|
+
autoload :PaymentMethodMetadata, 'mangopay/payment_method_metadata'
|
48
49
|
|
49
50
|
# temporary
|
50
51
|
autoload :Temp, 'mangopay/temp'
|
@@ -100,5 +100,13 @@ describe MangoPay::CardRegistration do
|
|
100
100
|
|
101
101
|
expect(validated).to_not be_nil
|
102
102
|
end
|
103
|
+
|
104
|
+
it "fetches card validation" do
|
105
|
+
created = new_card_registration_completed
|
106
|
+
card_validation = create_card_validation(created['UserId'], created['CardId'])
|
107
|
+
fetched_card_validation = MangoPay::Card.get_card_validation(created['CardId'], card_validation['Id'])
|
108
|
+
|
109
|
+
expect(card_validation['Id']).equal? fetched_card_validation['Id']
|
110
|
+
end
|
103
111
|
end
|
104
112
|
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,6 +896,7 @@ 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
901
|
MangoPay::InstantConversion.get_rate(debited_currency, credited_currency, params = {})
|
945
902
|
end
|
@@ -971,4 +928,22 @@ shared_context 'instant_conversion' do
|
|
971
928
|
def get_instant_conversion(id)
|
972
929
|
MangoPay::InstantConversion.get(id, params = {})
|
973
930
|
end
|
931
|
+
end
|
932
|
+
|
933
|
+
###############################################
|
934
|
+
# payment methods metadata
|
935
|
+
###############################################
|
936
|
+
shared_context 'payment_method_metadata' do
|
937
|
+
include_context 'payins'
|
938
|
+
|
939
|
+
def get_payment_method_metadata
|
940
|
+
|
941
|
+
wlt = new_wallet
|
942
|
+
pay_in = create_new_payin_card_direct(wlt, 1000)
|
943
|
+
|
944
|
+
MangoPay::PaymentMethodMetadata.get_metadata(
|
945
|
+
Type: 'BIN',
|
946
|
+
Bin: pay_in['CardInfo']['BIN']
|
947
|
+
)
|
948
|
+
end
|
974
949
|
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.22.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:
|
12
|
+
date: 2024-02-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_json
|
@@ -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
|
@@ -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
|
@@ -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
|