mangopay4-ruby-sdk 3.52.0 → 4.0.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 +35 -0
- data/lib/mangopay/authorization_token.rb +1 -1
- data/lib/mangopay/version.rb +1 -1
- data/mangopay.gemspec +7 -7
- metadata +32 -160
- data/.github/workflows/ruby_cd.yml +0 -34
- data/.github/workflows/ruby_ci.yml +0 -30
- data/.gitignore +0 -30
- data/.rspec +0 -3
- data/Gemfile +0 -2
- data/Rakefile +0 -5
- data/bin/mangopay +0 -9
- data/spec/mangopay/acquiring_spec.rb +0 -207
- data/spec/mangopay/authorization_token_spec.rb +0 -70
- data/spec/mangopay/bank_account_spec.rb +0 -105
- data/spec/mangopay/bankingaliases_spec.rb +0 -29
- data/spec/mangopay/card_registration_spec.rb +0 -123
- data/spec/mangopay/client_spec.png +0 -0
- data/spec/mangopay/client_spec.rb +0 -213
- data/spec/mangopay/configuration_spec.rb +0 -249
- data/spec/mangopay/conversion_spec.rb +0 -103
- data/spec/mangopay/deposit_spec.rb +0 -120
- data/spec/mangopay/dispute_spec.png +0 -0
- data/spec/mangopay/dispute_spec.rb +0 -294
- data/spec/mangopay/event_spec.rb +0 -33
- data/spec/mangopay/fetch_filters_spec.rb +0 -63
- data/spec/mangopay/hook_spec.rb +0 -37
- data/spec/mangopay/idempotency_spec.rb +0 -41
- data/spec/mangopay/identity_verification_spec.rb +0 -91
- data/spec/mangopay/kyc_document_spec.png +0 -0
- data/spec/mangopay/kyc_document_spec.rb +0 -118
- data/spec/mangopay/log_requests_filter_spec.rb +0 -26
- data/spec/mangopay/mandate_spec.rb +0 -99
- data/spec/mangopay/payin_applepay_direct_spec.rb +0 -21
- data/spec/mangopay/payin_bancontact_web_spec.rb +0 -30
- data/spec/mangopay/payin_bankwire_direct_spec.rb +0 -74
- data/spec/mangopay/payin_bankwire_external_instruction_spec.rb +0 -104
- data/spec/mangopay/payin_bizum_web_spec.rb +0 -54
- data/spec/mangopay/payin_blik_web_spec.rb +0 -41
- data/spec/mangopay/payin_card_direct_spec.rb +0 -69
- data/spec/mangopay/payin_card_web_spec.rb +0 -64
- data/spec/mangopay/payin_directdebit_direct_spec.rb +0 -37
- data/spec/mangopay/payin_directdebit_web_spec.rb +0 -38
- data/spec/mangopay/payin_giropay_web_spec.rb +0 -30
- data/spec/mangopay/payin_googlepay_direct_spec.rb +0 -21
- data/spec/mangopay/payin_ideal_web_spec.rb +0 -30
- data/spec/mangopay/payin_intent_spec.rb +0 -302
- data/spec/mangopay/payin_klarna_web_spec.rb +0 -32
- data/spec/mangopay/payin_mbway_web_spec.rb +0 -32
- data/spec/mangopay/payin_multibanco_web_spec.rb +0 -31
- data/spec/mangopay/payin_paybybank_web_spec.rb +0 -56
- data/spec/mangopay/payin_paypal_web_spec.rb +0 -114
- data/spec/mangopay/payin_preauthorized_direct_spec.rb +0 -135
- data/spec/mangopay/payin_satispay_web_spec.rb +0 -32
- data/spec/mangopay/payin_swish_web_spec.rb +0 -30
- data/spec/mangopay/payin_twint_web_spec.rb +0 -30
- data/spec/mangopay/payment_method_metadata_spec.rb +0 -15
- data/spec/mangopay/payout_bankwire_spec.rb +0 -90
- data/spec/mangopay/preauthorization_spec.rb +0 -51
- data/spec/mangopay/recipient_spec.rb +0 -135
- data/spec/mangopay/recurring_payin_spec.rb +0 -557
- data/spec/mangopay/refund_spec.rb +0 -34
- data/spec/mangopay/regulatory_spec.rb +0 -26
- data/spec/mangopay/report_spec.rb +0 -40
- data/spec/mangopay/report_v2_spec.rb +0 -117
- data/spec/mangopay/report_wallets_spec.rb +0 -40
- data/spec/mangopay/settlement_sample.csv +0 -8
- data/spec/mangopay/settlement_sample_bad.csv +0 -8
- data/spec/mangopay/settlement_spec.rb +0 -65
- data/spec/mangopay/shared_resources.rb +0 -1415
- data/spec/mangopay/transaction_spec.rb +0 -59
- data/spec/mangopay/transfer_spec.rb +0 -77
- data/spec/mangopay/ubo_declaration_spec.rb +0 -44
- data/spec/mangopay/ubo_spec.rb +0 -39
- data/spec/mangopay/user_spec.rb +0 -455
- data/spec/mangopay/virtual_account_spec.rb +0 -52
- data/spec/mangopay/wallet_spec.rb +0 -100
- data/spec/spec_helper.rb +0 -31
- data/spec/tmp/.keep +0 -0
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
describe MangoPay::PayIn::PreAuthorized::Direct, type: :feature do
|
|
2
|
-
include_context 'wallets'
|
|
3
|
-
include_context 'payins'
|
|
4
|
-
include_context 'users'
|
|
5
|
-
|
|
6
|
-
def check_type_and_status(payin)
|
|
7
|
-
expect(payin['Type']).to eq('PAYIN')
|
|
8
|
-
expect(payin['Nature']).to eq('REGULAR')
|
|
9
|
-
expect(payin['PaymentType']).to eq('PREAUTHORIZED')
|
|
10
|
-
expect(payin['ExecutionType']).to eq('DIRECT')
|
|
11
|
-
|
|
12
|
-
# SUCCEEDED
|
|
13
|
-
expect(payin['Status']).to eq('SUCCEEDED')
|
|
14
|
-
expect(payin['ResultCode']).to eq('000000')
|
|
15
|
-
expect(payin['ResultMessage']).to eq('Success')
|
|
16
|
-
expect(payin['ExecutionDate']).to be > 0
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
describe 'CREATE' do
|
|
20
|
-
it 'creates a preauthorized direct payin' do
|
|
21
|
-
created = new_payin_preauthorized_direct
|
|
22
|
-
# wait for the transactions to be created
|
|
23
|
-
sleep(2)
|
|
24
|
-
transactions = MangoPay::PreAuthorization.transactions(created['PreauthorizationId'])
|
|
25
|
-
expect(created['Id']).not_to be_nil
|
|
26
|
-
expect(transactions[0]['Status']).to eq('SUCCEEDED')
|
|
27
|
-
check_type_and_status(created)
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
describe 'FETCH' do
|
|
32
|
-
it 'fetches a payin' do
|
|
33
|
-
created = new_payin_preauthorized_direct
|
|
34
|
-
fetched = MangoPay::PayIn.fetch(created['Id'])
|
|
35
|
-
expect(fetched['Id']).to eq(created['Id'])
|
|
36
|
-
expect(fetched['CreationDate']).to eq(created['CreationDate'])
|
|
37
|
-
expect(fetched['CreditedFunds']).to eq(created['CreditedFunds'])
|
|
38
|
-
expect(fetched['CreditedWalletId']).to eq(created['CreditedWalletId'])
|
|
39
|
-
check_type_and_status(created)
|
|
40
|
-
check_type_and_status(fetched)
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
describe 'REFUND' do
|
|
45
|
-
it 'refunds a payin' do
|
|
46
|
-
payin = new_payin_preauthorized_direct
|
|
47
|
-
sleep(2)
|
|
48
|
-
refund = MangoPay::PayIn.refund(payin['Id'], { AuthorId: payin['AuthorId'] })
|
|
49
|
-
expect(refund['Id']).not_to be_nil
|
|
50
|
-
expect(refund['Status']).to eq('SUCCEEDED')
|
|
51
|
-
expect(refund['Type']).to eq('PAYOUT')
|
|
52
|
-
expect(refund['Nature']).to eq('REFUND')
|
|
53
|
-
expect(refund['InitialTransactionType']).to eq('PAYIN')
|
|
54
|
-
expect(refund['InitialTransactionId']).to eq(payin['Id'])
|
|
55
|
-
expect(refund['DebitedWalletId']).to eq(payin['CreditedWalletId'])
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
describe 'CASH FLOW' do
|
|
60
|
-
it 'changes balances correctly' do
|
|
61
|
-
wlt = new_wallet
|
|
62
|
-
wallets_check_amounts(wlt, 0)
|
|
63
|
-
|
|
64
|
-
# payin: feed wlt1 with money
|
|
65
|
-
payin = create_new_payin_preauthorized_direct(wlt, 1000)
|
|
66
|
-
wallets_reload_and_check_amounts(wlt, 1000)
|
|
67
|
-
|
|
68
|
-
# refund the payin
|
|
69
|
-
refund = MangoPay::PayIn.refund(payin['Id'], { AuthorId: payin['AuthorId'] })
|
|
70
|
-
wallets_reload_and_check_amounts(wlt, 0)
|
|
71
|
-
end
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
begin
|
|
75
|
-
describe 'CREATE AND VIEW PRE AUTHORIZED DEPOSIT' do
|
|
76
|
-
it 'creates a card direct pre authorized deposit payin' do
|
|
77
|
-
wallet = new_wallet
|
|
78
|
-
author = new_natural_user
|
|
79
|
-
card_registration = new_card_registration_completed
|
|
80
|
-
deposit = create_new_deposit(card_registration['CardId'], author['Id'])
|
|
81
|
-
|
|
82
|
-
created = create_new_payin_pre_authorized_deposit_direct(deposit['Id'], author['Id'], wallet['Id'])
|
|
83
|
-
|
|
84
|
-
expect(created['Id']).not_to be_nil
|
|
85
|
-
check_type_and_status(created)
|
|
86
|
-
expect(created['DepositId']).to eq(deposit['Id'])
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
xit 'creates a paypal web preauthorized deposit payin' do
|
|
90
|
-
# skipped: The Deposit Status value has to be up to SUCCEEDED
|
|
91
|
-
wallet = new_wallet
|
|
92
|
-
author = new_natural_user
|
|
93
|
-
deposit = create_new_paypal_deposit_preauthorization(author['Id'])
|
|
94
|
-
|
|
95
|
-
created = create_new_payin_pre_authorized_deposit_web(deposit['Id'], author['Id'], wallet['Id'])
|
|
96
|
-
|
|
97
|
-
expect(created['Id']).not_to be_nil
|
|
98
|
-
expect(created['Type']).to eq('PAYIN')
|
|
99
|
-
expect(created['Nature']).to eq('REGULAR')
|
|
100
|
-
expect(created['PaymentType']).to eq('PREAUTHORIZED')
|
|
101
|
-
expect(created['ExecutionType']).to eq('WEB')
|
|
102
|
-
expect(created['Status']).to eq('SUCCEEDED')
|
|
103
|
-
expect(created['DepositId']).to eq(deposit['Id'])
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
it 'creates a card direct pre authorized deposit payin prior to complement' do
|
|
107
|
-
wallet = new_wallet
|
|
108
|
-
author = new_natural_user
|
|
109
|
-
card_registration = new_card_registration_completed
|
|
110
|
-
deposit = create_new_deposit(card_registration['CardId'], author['Id'])
|
|
111
|
-
|
|
112
|
-
created = create_new_deposit_pre_authorized_pay_in_prior_to_complement(deposit['Id'], author['Id'], wallet['Id'])
|
|
113
|
-
|
|
114
|
-
expect(created['Id']).not_to be_nil
|
|
115
|
-
check_type_and_status(created)
|
|
116
|
-
expect(created['DepositId']).to eq(deposit['Id'])
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
# skip because of PSP error
|
|
120
|
-
xit 'creates a card direct pre authorized deposit payin complement' do
|
|
121
|
-
wallet = new_wallet
|
|
122
|
-
author = new_natural_user
|
|
123
|
-
card_registration = new_card_registration_completed
|
|
124
|
-
deposit = create_new_deposit(card_registration['CardId'], author['Id'])
|
|
125
|
-
MangoPay::Deposit.update(deposit['Id'], {PaymentStatus: 'NO_SHOW_REQUESTED'})
|
|
126
|
-
|
|
127
|
-
created = create_new_deposit_pre_authorized_pay_in_complement(deposit['Id'], author['Id'], wallet['Id'])
|
|
128
|
-
|
|
129
|
-
expect(created['Id']).not_to be_nil
|
|
130
|
-
check_type_and_status(created)
|
|
131
|
-
expect(created['DepositId']).to eq(deposit['Id'])
|
|
132
|
-
end
|
|
133
|
-
end
|
|
134
|
-
end
|
|
135
|
-
end
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
describe MangoPay::PayIn::Satispay::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('SATISPAY')
|
|
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 satispay web payin' do
|
|
15
|
-
created = new_payin_satispay_web
|
|
16
|
-
expect(created['Id']).not_to be_nil
|
|
17
|
-
expect(created['Country']).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_satispay_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
|
-
|
|
32
|
-
end
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
describe MangoPay::PayIn::Swish::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('SWISH')
|
|
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 swish web payin' do
|
|
15
|
-
created = new_payin_swish_web
|
|
16
|
-
expect(created['Id']).not_to be_nil
|
|
17
|
-
check_type_and_status(created)
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
describe 'FETCH' do
|
|
22
|
-
it 'fetches a payin' do
|
|
23
|
-
created = new_payin_swish_web
|
|
24
|
-
fetched = MangoPay::PayIn.fetch(created['Id'])
|
|
25
|
-
expect(fetched['Id']).to eq(created['Id'])
|
|
26
|
-
check_type_and_status(created)
|
|
27
|
-
check_type_and_status(fetched)
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
describe MangoPay::PayIn::Twint::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('TWINT')
|
|
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 twint web payin' do
|
|
15
|
-
created = new_payin_twint_web
|
|
16
|
-
expect(created['Id']).not_to be_nil
|
|
17
|
-
check_type_and_status(created)
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
describe 'FETCH' do
|
|
22
|
-
it 'fetches a payin' do
|
|
23
|
-
created = new_payin_twint_web
|
|
24
|
-
fetched = MangoPay::PayIn.fetch(created['Id'])
|
|
25
|
-
expect(fetched['Id']).to eq(created['Id'])
|
|
26
|
-
check_type_and_status(created)
|
|
27
|
-
check_type_and_status(fetched)
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
@@ -1,15 +0,0 @@
|
|
|
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['BinData'][0]['CardType']).not_to be_nil
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
describe MangoPay::PayOut::BankWire, type: :feature do
|
|
2
|
-
include_context 'bank_accounts'
|
|
3
|
-
include_context 'payins'
|
|
4
|
-
include_context 'payouts'
|
|
5
|
-
|
|
6
|
-
def check_type_and_status(payout, check_status = true)
|
|
7
|
-
expect(payout['Type']).to eq('PAYOUT')
|
|
8
|
-
expect(payout['Nature']).to eq('REGULAR')
|
|
9
|
-
expect(payout['PaymentType']).to eq('BANK_WIRE')
|
|
10
|
-
|
|
11
|
-
# linked to correct bank account
|
|
12
|
-
expect(payout['BankAccountId']).to eq(new_bank_account['Id'])
|
|
13
|
-
|
|
14
|
-
if (check_status)
|
|
15
|
-
# not SUCCEEDED yet: waiting for processing
|
|
16
|
-
expect(payout['ExecutionDate']).to be_nil
|
|
17
|
-
expect(payout['Status']).to eq('CREATED')
|
|
18
|
-
expect(payout['ResultCode']).to be_nil
|
|
19
|
-
expect(payout['ResultMessage']).to be_nil
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
describe 'CREATE' do
|
|
24
|
-
|
|
25
|
-
it 'creates a bank wire payout' do
|
|
26
|
-
payin = new_payin_card_direct # this payin is successfull so payout may happen
|
|
27
|
-
payout = create_new_payout_bankwire(payin)
|
|
28
|
-
expect(payout['Id']).not_to be_nil
|
|
29
|
-
check_type_and_status(payout)
|
|
30
|
-
expect(payout['DebitedWalletId']).to eq(payin['CreditedWalletId'])
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
it 'fails if not enough money' do
|
|
34
|
-
payin = new_payin_card_web # this payin is NOT processed yet so payout may NOT happen
|
|
35
|
-
payout = create_new_payout_bankwire(payin, 100)
|
|
36
|
-
expect(payout['Status']).to eq('FAILED')
|
|
37
|
-
expect(payout['ResultCode']).to eq('001001')
|
|
38
|
-
expect(payout['ResultMessage']).to eq('Insufficient wallet balance')
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
describe 'Get Bankwire' do
|
|
43
|
-
it 'gets a bankwire' do
|
|
44
|
-
created = new_payout_bankwire
|
|
45
|
-
fetched = MangoPay::PayOut::BankWire.get_bankwire(created['Id'])
|
|
46
|
-
expect(fetched['Id']).to eq(created['Id'])
|
|
47
|
-
expect(fetched['CreationDate']).to eq(created['CreationDate'])
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
describe 'Check Eligibility' do
|
|
52
|
-
it 'checks the eligibility of a payout' do
|
|
53
|
-
created = new_payout_bankwire
|
|
54
|
-
|
|
55
|
-
eligibility = MangoPay::PayOut::InstantPayoutEligibility::Reachability.create(
|
|
56
|
-
AuthorId: created['AuthorId'],
|
|
57
|
-
DebitedFunds: {
|
|
58
|
-
Amount: 10,
|
|
59
|
-
Currency: 'EUR'
|
|
60
|
-
},
|
|
61
|
-
PayoutModeRequested: 'INSTANT_PAYMENT',
|
|
62
|
-
BankAccountId: created['BankAccountId'],
|
|
63
|
-
DebitedWalletId: created['DebitedWalletId']
|
|
64
|
-
)
|
|
65
|
-
|
|
66
|
-
expect(created).not_to be_nil
|
|
67
|
-
expect(eligibility).not_to be_nil
|
|
68
|
-
end
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
describe 'FETCH' do
|
|
72
|
-
it 'fetches a payout' do
|
|
73
|
-
created = new_payout_bankwire
|
|
74
|
-
fetched = MangoPay::PayOut.fetch(created['Id'])
|
|
75
|
-
expect(fetched['Id']).to eq(created['Id'])
|
|
76
|
-
expect(fetched['CreationDate']).to eq(created['CreationDate'])
|
|
77
|
-
check_type_and_status(created)
|
|
78
|
-
check_type_and_status(fetched)
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
describe 'GET Refunds' do
|
|
83
|
-
it "fetches the pay-out's refunds" do
|
|
84
|
-
payout = new_payout_bankwire
|
|
85
|
-
refunds = MangoPay::PayOut.refunds(payout['Id'])
|
|
86
|
-
expect(refunds).to be_an(Array)
|
|
87
|
-
end
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
end
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
describe MangoPay::PreAuthorization do
|
|
2
|
-
include_context 'users'
|
|
3
|
-
include_context 'payins'
|
|
4
|
-
|
|
5
|
-
describe 'CREATE' do
|
|
6
|
-
it 'creates a new card pre-authorization' do
|
|
7
|
-
cardreg = new_card_registration_completed
|
|
8
|
-
created = new_card_preauthorization
|
|
9
|
-
expect(created['Id']).not_to be_nil
|
|
10
|
-
expect(created['CardId']).to eq(cardreg['CardId'])
|
|
11
|
-
expect(created['AuthorId']).to eq(new_natural_user["Id"])
|
|
12
|
-
expect(created['PayInId']).to be_nil
|
|
13
|
-
expect(created['Status']).to eq('SUCCEEDED')
|
|
14
|
-
expect(created['PaymentStatus']).to eq('WAITING')
|
|
15
|
-
expect(created['PaymentType']).to eq('CARD')
|
|
16
|
-
expect(created['ExecutionType']).to eq('DIRECT')
|
|
17
|
-
# expect(created['Requested3DSVersion']).to eq('V2_1')
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
describe 'UPDATE' do
|
|
22
|
-
it 'updates a card pre-authorization' do
|
|
23
|
-
created = new_card_preauthorization
|
|
24
|
-
updated = MangoPay::PreAuthorization.update(created['Id'] ,{
|
|
25
|
-
PaymentStatus: 'CANCELED'
|
|
26
|
-
})
|
|
27
|
-
expect(updated['PaymentStatus']).to eq('CANCELED')
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
describe 'FETCH' do
|
|
32
|
-
it 'fetches a card pre-authorization' do
|
|
33
|
-
created = new_card_preauthorization
|
|
34
|
-
fetched = MangoPay::PreAuthorization.fetch(created['Id'])
|
|
35
|
-
expect(fetched['Id']).to eq(created['Id'])
|
|
36
|
-
expect(fetched['CardId']).to eq(created['CardId'])
|
|
37
|
-
expect(fetched['AuthorId']).to eq(created['AuthorId'])
|
|
38
|
-
expect(fetched['Tag']).to eq(created['Tag'])
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
describe 'FETCH FOR CARD' do
|
|
43
|
-
it "fetches a card's pre-authorizations" do
|
|
44
|
-
created = new_card_preauthorization
|
|
45
|
-
fetched = MangoPay::Card.get_pre_authorizations(created['CardId'])
|
|
46
|
-
|
|
47
|
-
expect(fetched).to be_an(Array)
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
end
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
describe MangoPay::Recipient do
|
|
2
|
-
include_context 'recipient'
|
|
3
|
-
|
|
4
|
-
describe 'CREATE' do
|
|
5
|
-
it 'creates a new recipient' do
|
|
6
|
-
recipient = new_recipient
|
|
7
|
-
assert_recipient(recipient)
|
|
8
|
-
expect(recipient['Status']).to eq('PENDING')
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
describe 'GET' do
|
|
13
|
-
it 'fetches a recipient' do
|
|
14
|
-
recipient = new_recipient
|
|
15
|
-
fetched = MangoPay::Recipient.get(recipient['Id'])
|
|
16
|
-
assert_recipient(fetched)
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
describe 'GET User Recipients' do
|
|
21
|
-
it 'fetches recipients without query param' do
|
|
22
|
-
john = create_new_natural_user_sca_owner
|
|
23
|
-
create_new_recipient(john['Id'])
|
|
24
|
-
fetched = MangoPay::Recipient.get_user_recipients(john['Id'])
|
|
25
|
-
expect(fetched).not_to be_nil
|
|
26
|
-
expect(fetched).to be_kind_of(Array)
|
|
27
|
-
expect(fetched).not_to be_empty
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
it 'fetches recipients with scope PAYOUT' do
|
|
31
|
-
john = create_new_natural_user_sca_owner
|
|
32
|
-
create_new_recipient(john['Id'])
|
|
33
|
-
fetched = MangoPay::Recipient.get_user_recipients(john['Id'], {RecipientScope: "PAYOUT", page: 1, per_page: 1})
|
|
34
|
-
expect(fetched).not_to be_nil
|
|
35
|
-
expect(fetched).to be_kind_of(Array)
|
|
36
|
-
expect(fetched).not_to be_empty
|
|
37
|
-
expect(fetched.count).to eq(1)
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
it 'fetches recipients with scope PAYIN' do
|
|
41
|
-
john = create_new_natural_user_sca_owner
|
|
42
|
-
create_new_recipient(john['Id'])
|
|
43
|
-
fetched = MangoPay::Recipient.get_user_recipients(john['Id'], {RecipientScope: "PAYIN"})
|
|
44
|
-
expect(fetched).not_to be_nil
|
|
45
|
-
expect(fetched).to be_kind_of(Array)
|
|
46
|
-
expect(fetched).to be_empty
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
describe 'GET Schema' do
|
|
51
|
-
it 'fetches schema for LocalBankTransfer, Individual' do
|
|
52
|
-
schema = MangoPay::Recipient.get_schema('LocalBankTransfer', 'Individual', 'GBP', 'GB')
|
|
53
|
-
expect(schema).not_to be_nil
|
|
54
|
-
expect(schema['DisplayName']).not_to be_nil
|
|
55
|
-
expect(schema['Currency']).not_to be_nil
|
|
56
|
-
expect(schema['RecipientType']).not_to be_nil
|
|
57
|
-
expect(schema['PayoutMethodType']).not_to be_nil
|
|
58
|
-
expect(schema['RecipientScope']).not_to be_nil
|
|
59
|
-
expect(schema['Tag']).not_to be_nil
|
|
60
|
-
expect(schema['IndividualRecipient']).not_to be_nil
|
|
61
|
-
expect(schema['LocalBankTransfer']).not_to be_nil
|
|
62
|
-
expect(schema['BusinessRecipient']).to be_nil
|
|
63
|
-
expect(schema['InternationalBankTransfer']).to be_nil
|
|
64
|
-
expect(schema['Country']).not_to be_nil
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
it 'fetches schema for InternationalBankTransfer, Business' do
|
|
68
|
-
schema = MangoPay::Recipient.get_schema('InternationalBankTransfer', 'Business', 'GBP', 'GB')
|
|
69
|
-
expect(schema).not_to be_nil
|
|
70
|
-
expect(schema['DisplayName']).not_to be_nil
|
|
71
|
-
expect(schema['Currency']).not_to be_nil
|
|
72
|
-
expect(schema['RecipientType']).not_to be_nil
|
|
73
|
-
expect(schema['PayoutMethodType']).not_to be_nil
|
|
74
|
-
expect(schema['RecipientScope']).not_to be_nil
|
|
75
|
-
expect(schema['Tag']).not_to be_nil
|
|
76
|
-
expect(schema['BusinessRecipient']).not_to be_nil
|
|
77
|
-
expect(schema['InternationalBankTransfer']).not_to be_nil
|
|
78
|
-
expect(schema['IndividualRecipient']).to be_nil
|
|
79
|
-
expect(schema['LocalBankTransfer']).to be_nil
|
|
80
|
-
expect(schema['Country']).not_to be_nil
|
|
81
|
-
end
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
describe 'GET Payout Methods' do
|
|
85
|
-
it 'fetches payout methods' do
|
|
86
|
-
payout_methods = MangoPay::Recipient.get_payout_methods('DE', 'EUR')
|
|
87
|
-
expect(payout_methods).not_to be_nil
|
|
88
|
-
expect(payout_methods['AvailablePayoutMethods']).to be_kind_of(Array)
|
|
89
|
-
expect(payout_methods['AvailablePayoutMethods']).not_to be_empty
|
|
90
|
-
end
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
describe 'VALIDATE' do
|
|
94
|
-
it 'validates a recipient' do
|
|
95
|
-
recipient = define_new_recipient
|
|
96
|
-
john = create_new_natural_user_sca_owner
|
|
97
|
-
# it should pass
|
|
98
|
-
MangoPay::Recipient.validate(recipient, john['Id'])
|
|
99
|
-
|
|
100
|
-
# it should throw error
|
|
101
|
-
recipient['Currency'] = nil
|
|
102
|
-
expect { MangoPay::Recipient.validate(recipient, john['Id']) }.to raise_error { |err|
|
|
103
|
-
expect(err).to be_a MangoPay::ResponseError
|
|
104
|
-
expect(err.code).to eq '400'
|
|
105
|
-
expect(err.type).to eq 'param_error'
|
|
106
|
-
}
|
|
107
|
-
end
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
describe 'DEACTIVATE' do
|
|
111
|
-
it 'deactivates a recipient' do
|
|
112
|
-
pending("a recipient needs to be manually activated before running the test")
|
|
113
|
-
john = create_new_natural_user_sca_owner
|
|
114
|
-
recipient = create_new_recipient(john['Id'])
|
|
115
|
-
deactivated = MangoPay::Recipient.deactivate(recipient['Id'])
|
|
116
|
-
fetched = MangoPay::Recipient.get(recipient['Id'])
|
|
117
|
-
expect(deactivated['Status']).to eq('DEACTIVATED')
|
|
118
|
-
expect(fetched['Status']).to eq('DEACTIVATED')
|
|
119
|
-
end
|
|
120
|
-
end
|
|
121
|
-
end
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
def assert_recipient(recipient)
|
|
125
|
-
expect(recipient).not_to be_nil
|
|
126
|
-
expect(recipient['Status']).not_to be_nil
|
|
127
|
-
expect(recipient['DisplayName']).not_to be_nil
|
|
128
|
-
expect(recipient['PayoutMethodType']).not_to be_nil
|
|
129
|
-
expect(recipient['RecipientType']).not_to be_nil
|
|
130
|
-
expect(recipient['IndividualRecipient']).not_to be_nil
|
|
131
|
-
expect(recipient['LocalBankTransfer']).not_to be_nil
|
|
132
|
-
expect(recipient['RecipientScope']).not_to be_nil
|
|
133
|
-
expect(recipient['UserId']).not_to be_nil
|
|
134
|
-
expect(recipient['Country']).not_to be_nil
|
|
135
|
-
end
|