Skip to content

Commit

Permalink
Merge pull request #207 from Mangopay/feature/payout_reachability
Browse files Browse the repository at this point in the history
MPSDK-1012: added eligbility payout endpoint
  • Loading branch information
SoloJr authored Mar 31, 2022
2 parents 18fd3b5 + 2637658 commit 6fe7504
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
11 changes: 11 additions & 0 deletions lib/mangopay/pay_out.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,16 @@ def self.get_bankwire(pay_out_id)
MangoPay.request(:get, url);
end
end

# See https://docs.mangopay.com/endpoints/v2.01/payouts#e1058_check-instant-payout-eligibility
module InstantPayoutEligibility
class Reachability < Resource
include HTTPCalls::Create

def self.url(*)
"#{MangoPay.api_path}/payouts/reachability"
end
end
end
end
end
2 changes: 1 addition & 1 deletion spec/mangopay/payin_applepay_direct_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def check_type_and_status(payin)

describe 'CREATE' do
it 'creates a applepay direct payin' do
#pending("no cards to test for")
pending("no cards to test for")
created = new_payin_applepay_direct
expect(created['Id']).not_to be_nil
check_type_and_status(created)
Expand Down
20 changes: 20 additions & 0 deletions spec/mangopay/payout_bankwire_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,26 @@ def check_type_and_status(payout, check_status = true)
end
end

describe 'Check Eligibility' do
it 'checks the eligibility of a payout' do
created = new_payout_bankwire

eligibility = MangoPay::PayOut::InstantPayoutEligibility::Reachability.create(
AuthorId: created['AuthorId'],
DebitedFunds: {
Amount: 10,
Currency: 'EUR'
},
PayoutModeRequested: 'INSTANT_PAYMENT',
BankAccountId: created['BankAccountId'],
DebitedWalletId: created['DebitedWalletId']
)

expect(created).not_to be_nil
expect(eligibility).not_to be_nil
end
end

describe 'FETCH' do
it 'fetches a payout' do
created = new_payout_bankwire
Expand Down

0 comments on commit 6fe7504

Please sign in to comment.