-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #81 from Mangopay/bugfix/NewPayIn
Added new pay in support
- Loading branch information
Showing
3 changed files
with
69 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,6 +58,9 @@ def self.url(*) | |
end | ||
end | ||
|
||
class ExternalInstruction < Resource | ||
end | ||
|
||
end | ||
|
||
module DirectDebit | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
describe MangoPay::PayIn::BankWire::ExternalInstruction, type: :feature do | ||
include_context 'wallets' | ||
include_context 'payins' | ||
|
||
def check_type_and_status(payin) | ||
expect(payin['Type']).to eq('PAYIN') | ||
expect(payin['Nature']).to eq('REGULAR') | ||
expect(payin['PaymentType']).to eq('BANK_WIRE') | ||
expect(payin['ExecutionType']).to eq('EXTERNAL_INSTRUCTION') | ||
end | ||
|
||
describe 'FETCH' do | ||
it 'fetches a payin' do | ||
MangoPay.configure do |c| | ||
c.preproduction = true | ||
c.client_id = 'sdk-unit-tests' | ||
c.root_url = 'https://api-test.mangopay.com' | ||
c.client_passphrase = '9RMGpwVUwFLK0SurxObJ2yaadDcO0zeKFKxWmthjB93SQjFzy0' | ||
c.http_timeout = 10000 | ||
end | ||
|
||
id = "2826947" | ||
payIn = MangoPay::PayIn.fetch(id) | ||
expect(payIn['Id']).to eq(id) | ||
check_type_and_status(payIn) | ||
end | ||
end | ||
|
||
############################################### | ||
# refund not implemented for this type of payin | ||
############################################### | ||
# describe 'REFUND' do | ||
# it 'refunds a payin' do | ||
# payin = new_payin_bankwire_direct | ||
# refund = MangoPay::PayIn.refund(payin['Id'], {AuthorId: payin['AuthorId']}) | ||
# expect(refund['Id']).not_to be_nil | ||
# expect(refund['Status']).to eq('SUCCEEDED') | ||
# expect(refund['Type']).to eq('PAYOUT') | ||
# expect(refund['Nature']).to eq('REFUND') | ||
# expect(refund['InitialTransactionType']).to eq('PAYIN') | ||
# expect(refund['InitialTransactionId']).to eq(payin['Id']) | ||
# expect(refund['DebitedWalletId']).to eq(payin['CreditedWalletId']) | ||
# end | ||
# end | ||
# | ||
############################################### | ||
# status is CREATED instead of SUCCEEDED | ||
# so no cash flow yet | ||
############################################### | ||
# describe 'CASH FLOW' do | ||
# it 'changes balances correctly' do | ||
# wlt = new_wallet | ||
# wallets_check_amounts(wlt, 0) | ||
# | ||
# # payin: feed wlt1 with money | ||
# payin = create_new_payin_bankwire_direct(wlt, 1000) | ||
# wallets_reload_and_check_amounts(wlt, 1000) | ||
# | ||
# # refund the payin | ||
# refund = MangoPay::PayIn.refund(payin['Id'], {AuthorId: payin['AuthorId']}) | ||
# wallets_reload_and_check_amounts(wlt, 0) | ||
# end | ||
# end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -394,4 +394,4 @@ def create_new_transfer(from_wallet, to_wallet, amnt = 500) | |
Country: 'LU' | ||
}, new_wallet['Id']) | ||
} | ||
end | ||
end |