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,26 +0,0 @@
|
|
|
1
|
-
describe MangoPay do
|
|
2
|
-
include_context 'users'
|
|
3
|
-
include_context 'payins'
|
|
4
|
-
require 'json'
|
|
5
|
-
|
|
6
|
-
describe 'requests log file' do
|
|
7
|
-
|
|
8
|
-
let(:log_file) do
|
|
9
|
-
File.join(MangoPay.configuration.temp_dir, 'mangopay.log.tmp')
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
it 'filters confidential parameters' do
|
|
13
|
-
FileUtils.rm_f(log_file)
|
|
14
|
-
MangoPay.configuration.log_file = log_file
|
|
15
|
-
created = new_card_registration
|
|
16
|
-
lines = File.open(log_file).select { |l| l.include?('AccessKey') }
|
|
17
|
-
lines.each do |line|
|
|
18
|
-
result = JSON.load(/({.+})\s+$/.match(line)[0])
|
|
19
|
-
expect(result['AccessKey']).to eq('[FILTERED]')
|
|
20
|
-
expect(result['Id']).not_to eq('[FILTERED]')
|
|
21
|
-
end
|
|
22
|
-
FileUtils.rm_f(log_file)
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
end
|
|
26
|
-
end
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
describe MangoPay::Mandate do
|
|
2
|
-
include_context 'mandates'
|
|
3
|
-
|
|
4
|
-
def check_status(mandate)
|
|
5
|
-
expect(mandate['Status']).to eq('CREATED')
|
|
6
|
-
expect(mandate['MandateType']).to eq('DIRECT_DEBIT')
|
|
7
|
-
expect(mandate['ExecutionType']).to eq('WEB')
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
describe 'CREATE' do
|
|
11
|
-
it 'creates a mandate' do
|
|
12
|
-
mandate = new_mandate
|
|
13
|
-
expect(mandate['Id']).to_not be_nil
|
|
14
|
-
check_status(mandate)
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
describe 'FETCH' do
|
|
19
|
-
|
|
20
|
-
it 'fetches a mandate' do
|
|
21
|
-
created = new_mandate
|
|
22
|
-
fetched = MangoPay::Mandate.fetch(created['Id'])
|
|
23
|
-
expect(fetched['Id']).to eq(created['Id'])
|
|
24
|
-
expect(fetched['CreationDate']).to eq(created['CreationDate'])
|
|
25
|
-
expect(fetched['UserId']).to eq(created['UserId'])
|
|
26
|
-
expect(fetched['BankAccountId']).to eq(created['BankAccountId'])
|
|
27
|
-
check_status(created)
|
|
28
|
-
check_status(fetched)
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
it 'fetches (all) mandates' do
|
|
32
|
-
created1 = create_new_mandate()
|
|
33
|
-
created2 = create_new_mandate()
|
|
34
|
-
fetched = MangoPay::Mandate.fetch({'per_page' => 2, 'sort' => 'CreationDate:desc'})
|
|
35
|
-
|
|
36
|
-
expect(fetched).to be_kind_of(Array)
|
|
37
|
-
expect(fetched.count).to eq 2 # exactly 2 as pagiantion requested
|
|
38
|
-
|
|
39
|
-
# all 2 are at top as lastly created
|
|
40
|
-
# but may share the same CreationDate
|
|
41
|
-
# so the order between them is undetermined
|
|
42
|
-
expect(fetched.map {|m| m['Id']}).to include(created1['Id'], created2['Id'])
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
describe 'FETCH FOR USER AND BANK ACCOUNT' do
|
|
48
|
-
|
|
49
|
-
it 'fetches mandates for user' do
|
|
50
|
-
created1 = create_new_mandate()
|
|
51
|
-
created2 = create_new_mandate()
|
|
52
|
-
expect(created1['UserId']).to eq(created2['UserId']) # both for same user
|
|
53
|
-
|
|
54
|
-
user_id = created1['UserId']
|
|
55
|
-
fetched = MangoPay::Mandate.fetch_for_user(user_id, {'per_page' => 2, 'sort' => 'CreationDate:desc'})
|
|
56
|
-
|
|
57
|
-
expect(fetched).to be_kind_of(Array)
|
|
58
|
-
expect(fetched.count).to eq 2 # exactly 2 as pagiantion requested
|
|
59
|
-
expect(fetched.map {|m| m['Id']}).to include(created1['Id'], created2['Id'])
|
|
60
|
-
expect((fetched.map {|m| m['UserId']}).uniq).to eq([user_id])
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
it 'fetches mandates for user bank account' do
|
|
64
|
-
created1 = create_new_mandate()
|
|
65
|
-
created2 = create_new_mandate()
|
|
66
|
-
expect(created1['UserId']).to eq(created2['UserId']) # both for same user
|
|
67
|
-
expect(created1['BankAccountId']).to eq(created2['BankAccountId']) # both for same bank account
|
|
68
|
-
|
|
69
|
-
user_id = created1['UserId']
|
|
70
|
-
bank_acc_id = created1['BankAccountId']
|
|
71
|
-
fetched = MangoPay::Mandate.fetch_for_user_bank_account(user_id, bank_acc_id, {'per_page' => 2, 'sort' => 'CreationDate:desc'})
|
|
72
|
-
|
|
73
|
-
expect(fetched).to be_kind_of(Array)
|
|
74
|
-
expect(fetched.count).to eq 2 # exactly 2 as pagiantion requested
|
|
75
|
-
expect(fetched.map {|m| m['Id']}).to include(created1['Id'], created2['Id'])
|
|
76
|
-
expect((fetched.map {|m| m['UserId']}).uniq).to eq([user_id])
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
describe 'CANCEL' do
|
|
82
|
-
it 'cancels a mandate' do
|
|
83
|
-
created = new_mandate
|
|
84
|
-
expect { MangoPay::Mandate.cancel(created['Id']) }.to raise_error { |err|
|
|
85
|
-
expect(err).to be_a MangoPay::ResponseError
|
|
86
|
-
expect(err.code).to eq '400'
|
|
87
|
-
expect(err.type).to eq 'mandate_cannot_be_cancelled'
|
|
88
|
-
}
|
|
89
|
-
end
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
describe 'FETCH Transactions' do
|
|
93
|
-
it "fetches a mandate's transactions" do
|
|
94
|
-
mandate = new_mandate
|
|
95
|
-
transactions = MangoPay::Mandate.transactions(mandate['Id'])
|
|
96
|
-
expect(transactions).to be_an(Array)
|
|
97
|
-
end
|
|
98
|
-
end
|
|
99
|
-
end
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
describe MangoPay::PayIn::ApplePay::Direct, 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('APPLEPAY')
|
|
8
|
-
expect(payin['ExecutionType']).to eq('DIRECT')
|
|
9
|
-
expect(payin['Status']).to eq('SUCCEEDED')
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
describe 'CREATE' do
|
|
13
|
-
it 'creates a applepay direct payin' do
|
|
14
|
-
pending("no cards to test for")
|
|
15
|
-
created = new_payin_applepay_direct
|
|
16
|
-
expect(created['Id']).not_to be_nil
|
|
17
|
-
check_type_and_status(created)
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
describe MangoPay::PayIn::Bancontact::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('BCMC')
|
|
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 bancontact web payin' do
|
|
15
|
-
created = new_payin_bancontact_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_bancontact_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,74 +0,0 @@
|
|
|
1
|
-
describe MangoPay::PayIn::BankWire::Direct, 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('BANK_WIRE')
|
|
9
|
-
expect(payin['ExecutionType']).to eq('DIRECT')
|
|
10
|
-
|
|
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 bankwire direct payin' do
|
|
19
|
-
created = new_payin_bankwire_direct
|
|
20
|
-
expect(created['Id']).not_to be_nil
|
|
21
|
-
check_type_and_status(created)
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
describe 'FETCH' do
|
|
26
|
-
it 'fetches a payin' do
|
|
27
|
-
created = new_payin_bankwire_direct
|
|
28
|
-
fetched = MangoPay::PayIn.fetch(created['Id'])
|
|
29
|
-
expect(fetched['Id']).to eq(created['Id'])
|
|
30
|
-
expect(fetched['CreationDate']).to eq(created['CreationDate'])
|
|
31
|
-
expect(fetched['DeclaredDebitedFunds']).to eq(created['DeclaredDebitedFunds'])
|
|
32
|
-
expect(fetched['CreditedWalletId']).to eq(created['CreditedWalletId'])
|
|
33
|
-
check_type_and_status(created)
|
|
34
|
-
check_type_and_status(fetched)
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
###############################################
|
|
39
|
-
# refund not implemented for this type of payin
|
|
40
|
-
###############################################
|
|
41
|
-
# describe 'REFUND' do
|
|
42
|
-
# it 'refunds a payin' do
|
|
43
|
-
# payin = new_payin_bankwire_direct
|
|
44
|
-
# refund = MangoPay::PayIn.refund(payin['Id'], {AuthorId: payin['AuthorId']})
|
|
45
|
-
# expect(refund['Id']).not_to be_nil
|
|
46
|
-
# expect(refund['Status']).to eq('SUCCEEDED')
|
|
47
|
-
# expect(refund['Type']).to eq('PAYOUT')
|
|
48
|
-
# expect(refund['Nature']).to eq('REFUND')
|
|
49
|
-
# expect(refund['InitialTransactionType']).to eq('PAYIN')
|
|
50
|
-
# expect(refund['InitialTransactionId']).to eq(payin['Id'])
|
|
51
|
-
# expect(refund['DebitedWalletId']).to eq(payin['CreditedWalletId'])
|
|
52
|
-
# end
|
|
53
|
-
# end
|
|
54
|
-
#
|
|
55
|
-
###############################################
|
|
56
|
-
# status is CREATED instead of SUCCEEDED
|
|
57
|
-
# so no cash flow yet
|
|
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_bankwire_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
|
-
end
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
describe MangoPay::PayIn::BankWire::ExternalInstruction, type: :feature do
|
|
2
|
-
include_context 'wallets'
|
|
3
|
-
include_context 'payins'
|
|
4
|
-
|
|
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('BANK_WIRE')
|
|
10
|
-
expect(payin['ExecutionType']).to eq('EXTERNAL_INSTRUCTION')
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
describe 'FETCH' do
|
|
14
|
-
it 'fetches a payin' do
|
|
15
|
-
backupConfig = MangoPay.configuration.clone
|
|
16
|
-
MangoPay.configure do |c|
|
|
17
|
-
c.preproduction = true
|
|
18
|
-
c.client_id = 'sdk-unit-tests'
|
|
19
|
-
c.root_url = 'https://api.sandbox.mangopay.com'
|
|
20
|
-
c.client_apiKey = 'cqFfFrWfCcb7UadHNxx2C9Lo6Djw8ZduLi7J9USTmu8bhxxpju'
|
|
21
|
-
c.http_timeout = 10000
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
id = "payin_m_01JK6199ED4VGBP98ABRJVDS9D"
|
|
25
|
-
payIn = MangoPay::PayIn.fetch(id)
|
|
26
|
-
expect(payIn['Id']).to eq(id)
|
|
27
|
-
check_type_and_status(payIn)
|
|
28
|
-
MangoPay.configuration = backupConfig
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
it 'fetches a bankwire external instruction with iban' do
|
|
32
|
-
backupConfig = MangoPay.configuration.clone
|
|
33
|
-
MangoPay.configure do |c|
|
|
34
|
-
c.preproduction = true
|
|
35
|
-
c.client_id = 'sdk-unit-tests'
|
|
36
|
-
c.root_url = 'https://api.sandbox.mangopay.com'
|
|
37
|
-
c.client_apiKey = 'cqFfFrWfCcb7UadHNxx2C9Lo6Djw8ZduLi7J9USTmu8bhxxpju'
|
|
38
|
-
c.http_timeout = 10000
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
payInId = "payin_m_01JK6199ED4VGBP98ABRJVDS9D"
|
|
42
|
-
payIn = MangoPay::PayIn.fetch(payInId)
|
|
43
|
-
expect(payIn).to_not be(nil)
|
|
44
|
-
expect(payIn['Id']).to eq(payInId)
|
|
45
|
-
check_type_and_status(payIn)
|
|
46
|
-
MangoPay.configuration = backupConfig
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
it 'fetches a bankwire external instruction with account number' do
|
|
50
|
-
backupConfig = MangoPay.configuration.clone
|
|
51
|
-
MangoPay.configure do |c|
|
|
52
|
-
c.preproduction = true
|
|
53
|
-
c.client_id = 'sdk-unit-tests'
|
|
54
|
-
c.root_url = 'https://api.sandbox.mangopay.com'
|
|
55
|
-
c.client_apiKey = 'cqFfFrWfCcb7UadHNxx2C9Lo6Djw8ZduLi7J9USTmu8bhxxpju'
|
|
56
|
-
c.http_timeout = 10000
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
payInId = "payin_m_01JK6199ED4VGBP98ABRJVDS9D"
|
|
60
|
-
payIn = MangoPay::PayIn.fetch(payInId)
|
|
61
|
-
expect(payIn).to_not be(nil)
|
|
62
|
-
expect(payIn['Id']).to eq(payInId)
|
|
63
|
-
check_type_and_status(payIn)
|
|
64
|
-
MangoPay.configuration = backupConfig
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
###############################################
|
|
69
|
-
# refund not implemented for this type of payin
|
|
70
|
-
###############################################
|
|
71
|
-
# describe 'REFUND' do
|
|
72
|
-
# it 'refunds a payin' do
|
|
73
|
-
# payin = new_payin_bankwire_direct
|
|
74
|
-
# refund = MangoPay::PayIn.refund(payin['Id'], {AuthorId: payin['AuthorId']})
|
|
75
|
-
# expect(refund['Id']).not_to be_nil
|
|
76
|
-
# expect(refund['Status']).to eq('SUCCEEDED')
|
|
77
|
-
# expect(refund['Type']).to eq('PAYOUT')
|
|
78
|
-
# expect(refund['Nature']).to eq('REFUND')
|
|
79
|
-
# expect(refund['InitialTransactionType']).to eq('PAYIN')
|
|
80
|
-
# expect(refund['InitialTransactionId']).to eq(payin['Id'])
|
|
81
|
-
# expect(refund['DebitedWalletId']).to eq(payin['CreditedWalletId'])
|
|
82
|
-
# end
|
|
83
|
-
# end
|
|
84
|
-
#
|
|
85
|
-
###############################################
|
|
86
|
-
# status is CREATED instead of SUCCEEDED
|
|
87
|
-
# so no cash flow yet
|
|
88
|
-
###############################################
|
|
89
|
-
# describe 'CASH FLOW' do
|
|
90
|
-
# it 'changes balances correctly' do
|
|
91
|
-
# wlt = new_wallet
|
|
92
|
-
# wallets_check_amounts(wlt, 0)
|
|
93
|
-
#
|
|
94
|
-
# # payin: feed wlt1 with money
|
|
95
|
-
# payin = create_new_payin_bankwire_direct(wlt, 1000)
|
|
96
|
-
# wallets_reload_and_check_amounts(wlt, 1000)
|
|
97
|
-
#
|
|
98
|
-
# # refund the payin
|
|
99
|
-
# refund = MangoPay::PayIn.refund(payin['Id'], {AuthorId: payin['AuthorId']})
|
|
100
|
-
# wallets_reload_and_check_amounts(wlt, 0)
|
|
101
|
-
# end
|
|
102
|
-
# end
|
|
103
|
-
|
|
104
|
-
end
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
describe MangoPay::PayIn::Bizum::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['PaymentType']).to eq('BIZUM')
|
|
8
|
-
expect(payin['ExecutionType']).to eq('WEB')
|
|
9
|
-
expect(payin['Status']).to eq('CREATED')
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
describe 'CREATE' do
|
|
13
|
-
it 'creates a bizum web payin with phone' do
|
|
14
|
-
created = new_payin_bizum_web_with_phone
|
|
15
|
-
expect(created['Id']).not_to be_nil
|
|
16
|
-
expect(created['Phone']).not_to be_nil
|
|
17
|
-
expect(created['ReturnURL']).to be_nil
|
|
18
|
-
check_type_and_status(created)
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
it 'creates a bizum web payin with return url' do
|
|
22
|
-
created = new_payin_bizum_web_with_return_url
|
|
23
|
-
expect(created['Id']).not_to be_nil
|
|
24
|
-
expect(created['Phone']).to be_nil
|
|
25
|
-
expect(created['ReturnURL']).not_to be_nil
|
|
26
|
-
check_type_and_status(created)
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
describe 'FETCH' do
|
|
31
|
-
it 'fetches a bizum payin with phone' do
|
|
32
|
-
created = new_payin_bizum_web_with_phone
|
|
33
|
-
fetched = MangoPay::PayIn.fetch(created['Id'])
|
|
34
|
-
expect(fetched['Id']).to eq(created['Id'])
|
|
35
|
-
expect(fetched['Phone']).not_to be_nil
|
|
36
|
-
expect(fetched['Phone']).to eq(created['Phone'])
|
|
37
|
-
expect(fetched['ReturnURL']).to be_nil
|
|
38
|
-
expect(fetched['ReturnURL']).to eq(created['ReturnURL'])
|
|
39
|
-
check_type_and_status(created)
|
|
40
|
-
check_type_and_status(fetched)
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
it 'fetches a bizum payin with return url' do
|
|
44
|
-
created = new_payin_bizum_web_with_return_url
|
|
45
|
-
fetched = MangoPay::PayIn.fetch(created['Id'])
|
|
46
|
-
expect(fetched['Id']).to eq(created['Id'])
|
|
47
|
-
expect(fetched['ReturnURL']).not_to be_nil
|
|
48
|
-
expect(fetched['Phone']).to be_nil
|
|
49
|
-
expect(fetched['ReturnURL']).to eq(created['ReturnURL'])
|
|
50
|
-
check_type_and_status(created)
|
|
51
|
-
check_type_and_status(fetched)
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
end
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
describe MangoPay::PayIn::Blik::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('BLIK')
|
|
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 blik web payin' do
|
|
15
|
-
created = new_payin_blik_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
|
-
|
|
21
|
-
it 'creates a blik web payin with code' do
|
|
22
|
-
created = new_payin_blik_web_with_code
|
|
23
|
-
expect(created['Id']).not_to be_nil
|
|
24
|
-
expect(created['Code']).not_to be_nil
|
|
25
|
-
expect(created['IpAddress']).not_to be_nil
|
|
26
|
-
expect(created['BrowserInfo']).not_to be_nil
|
|
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_blik_web
|
|
34
|
-
fetched = MangoPay::PayIn.fetch(created['Id'])
|
|
35
|
-
expect(fetched['Id']).to eq(created['Id'])
|
|
36
|
-
check_type_and_status(created)
|
|
37
|
-
check_type_and_status(fetched)
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
end
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
describe MangoPay::PayIn::Card::Direct, 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('CARD')
|
|
9
|
-
expect(payin['ExecutionType']).to eq('DIRECT')
|
|
10
|
-
|
|
11
|
-
# SUCCEEDED
|
|
12
|
-
expect(payin['Status']).to eq('SUCCEEDED')
|
|
13
|
-
expect(payin['ResultCode']).to eq('000000')
|
|
14
|
-
expect(payin['ResultMessage']).to eq('Success')
|
|
15
|
-
expect(payin['ExecutionDate']).to be > 0
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
describe 'CREATE' do
|
|
19
|
-
it 'creates a card direct payin' do
|
|
20
|
-
created = new_payin_card_direct
|
|
21
|
-
expect(created['Id']).not_to be_nil
|
|
22
|
-
# expect(created['Requested3DSVersion']).not_to be_nil
|
|
23
|
-
check_type_and_status(created)
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
describe 'FETCH' do
|
|
28
|
-
it 'fetches a payin' do
|
|
29
|
-
created = new_payin_card_direct
|
|
30
|
-
fetched = MangoPay::PayIn.fetch(created['Id'])
|
|
31
|
-
expect(fetched['Id']).to eq(created['Id'])
|
|
32
|
-
expect(fetched['CreationDate']).to eq(created['CreationDate'])
|
|
33
|
-
expect(fetched['CreditedFunds']).to eq(created['CreditedFunds'])
|
|
34
|
-
expect(fetched['CreditedWalletId']).to eq(created['CreditedWalletId'])
|
|
35
|
-
check_type_and_status(created)
|
|
36
|
-
check_type_and_status(fetched)
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
describe 'REFUND' do
|
|
41
|
-
it 'refunds a payin' do
|
|
42
|
-
payin = new_payin_card_direct
|
|
43
|
-
refund = MangoPay::PayIn.refund(payin['Id'], {AuthorId: payin['AuthorId']})
|
|
44
|
-
expect(refund['Id']).not_to be_nil
|
|
45
|
-
expect(refund['Status']).to eq('SUCCEEDED')
|
|
46
|
-
expect(refund['Type']).to eq('PAYOUT')
|
|
47
|
-
expect(refund['Nature']).to eq('REFUND')
|
|
48
|
-
expect(refund['InitialTransactionType']).to eq('PAYIN')
|
|
49
|
-
expect(refund['InitialTransactionId']).to eq(payin['Id'])
|
|
50
|
-
expect(refund['DebitedWalletId']).to eq(payin['CreditedWalletId'])
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
describe 'CASH FLOW' do
|
|
55
|
-
it 'changes balances correctly' do
|
|
56
|
-
wlt = new_wallet
|
|
57
|
-
wallets_check_amounts(wlt, 0)
|
|
58
|
-
|
|
59
|
-
# payin: feed wlt1 with money
|
|
60
|
-
payin = create_new_payin_card_direct(wlt, 1000)
|
|
61
|
-
wallets_reload_and_check_amounts(wlt, 1000)
|
|
62
|
-
|
|
63
|
-
# refund the payin
|
|
64
|
-
refund = MangoPay::PayIn.refund(payin['Id'], {AuthorId: payin['AuthorId']})
|
|
65
|
-
wallets_reload_and_check_amounts(wlt, 0)
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
end
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
describe MangoPay::PayIn::Card::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('CARD')
|
|
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 card web payin' do
|
|
19
|
-
created = new_payin_card_web
|
|
20
|
-
expect(created['Id']).not_to be_nil
|
|
21
|
-
check_type_and_status(created)
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
describe 'CREATE with PaylineV2' do
|
|
26
|
-
it 'creates a card web payin with payline v2' do
|
|
27
|
-
created = new_payin_card_web_payline
|
|
28
|
-
expect(created['Id']).not_to be_nil
|
|
29
|
-
# expect(created['RedirectURL']).to include('https://www.maysite.com/payline_template/')
|
|
30
|
-
check_type_and_status(created)
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
describe 'EXTENDED' do
|
|
35
|
-
context 'when resource not exists' do
|
|
36
|
-
it 'fetches extended information' do
|
|
37
|
-
expect { MangoPay::PayIn::Card::Web.extended(1000000) }.to \
|
|
38
|
-
raise_error(MangoPay::ResponseError)
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
describe 'FETCH' do
|
|
44
|
-
it 'fetches a payin' do
|
|
45
|
-
created = new_payin_card_web
|
|
46
|
-
fetched = MangoPay::PayIn.fetch(created['Id'])
|
|
47
|
-
expect(fetched['Id']).to eq(created['Id'])
|
|
48
|
-
expect(fetched['CreationDate']).to eq(created['CreationDate'])
|
|
49
|
-
expect(fetched['CreditedFunds']).to eq(created['CreditedFunds'])
|
|
50
|
-
expect(fetched['CreditedWalletId']).to eq(created['CreditedWalletId'])
|
|
51
|
-
check_type_and_status(created)
|
|
52
|
-
check_type_and_status(fetched)
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
describe 'FETCH Refunds' do
|
|
57
|
-
it "fetches the pay-in's refunds" do
|
|
58
|
-
payin = new_payin_card_web
|
|
59
|
-
refunds = MangoPay::PayIn.refunds(payin['Id'])
|
|
60
|
-
expect(refunds).to be_an(Array)
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
end
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
describe MangoPay::PayIn::DirectDebit::Direct, 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('DIRECT_DEBIT')
|
|
8
|
-
expect(payin['ExecutionType']).to eq('DIRECT')
|
|
9
|
-
|
|
10
|
-
# FAILED: the related Mandate is not confirmed yet
|
|
11
|
-
expect(payin['Status']).to eq('FAILED')
|
|
12
|
-
expect(payin['ResultMessage']).to eq('The Status of this Mandate does not allow for payments')
|
|
13
|
-
expect(payin['ExecutionDate']).to be_nil
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
describe 'CREATE' do
|
|
17
|
-
it 'creates a directdebit direct payin' do
|
|
18
|
-
created = new_payin_directdebit_direct
|
|
19
|
-
expect(created['Id']).not_to be_nil
|
|
20
|
-
check_type_and_status(created)
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
describe 'FETCH' do
|
|
25
|
-
it 'fetches a payin' do
|
|
26
|
-
created = new_payin_directdebit_direct
|
|
27
|
-
fetched = MangoPay::PayIn.fetch(created['Id'])
|
|
28
|
-
expect(fetched['Id']).to eq(created['Id'])
|
|
29
|
-
expect(fetched['CreationDate']).to eq(created['CreationDate'])
|
|
30
|
-
expect(fetched['CreditedFunds']).to eq(created['CreditedFunds'])
|
|
31
|
-
expect(fetched['CreditedWalletId']).to eq(created['CreditedWalletId'])
|
|
32
|
-
check_type_and_status(created)
|
|
33
|
-
check_type_and_status(fetched)
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
end
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
describe MangoPay::PayIn::DirectDebit::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('DIRECT_DEBIT')
|
|
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 directdebit web payin' do
|
|
19
|
-
created = new_payin_directdebit_web
|
|
20
|
-
expect(created['Id']).not_to be_nil
|
|
21
|
-
check_type_and_status(created)
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
describe 'FETCH' do
|
|
26
|
-
it 'fetches a payin' do
|
|
27
|
-
created = new_payin_directdebit_web
|
|
28
|
-
fetched = MangoPay::PayIn.fetch(created['Id'])
|
|
29
|
-
expect(fetched['Id']).to eq(created['Id'])
|
|
30
|
-
expect(fetched['CreationDate']).to eq(created['CreationDate'])
|
|
31
|
-
expect(fetched['CreditedFunds']).to eq(created['CreditedFunds'])
|
|
32
|
-
expect(fetched['CreditedWalletId']).to eq(created['CreditedWalletId'])
|
|
33
|
-
check_type_and_status(created)
|
|
34
|
-
check_type_and_status(fetched)
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
end
|