spec/lib/mangopay/shared_resources.rb in mangopay-3.0.7 vs spec/lib/mangopay/shared_resources.rb in mangopay-3.0.8

- old
+ new

@@ -202,9 +202,55 @@ SecureModeReturnURL: 'http://test.com', Tag: 'Test PayIn/Card/Direct' }) end + ############################################### + # card/direct with pre-authorization + ############################################### + + let(:new_card_preauthorization) { create_new_card_preauthorization(new_card_registration_completed) } + def create_new_card_preauthorization(cardreg, amnt = 1000) + MangoPay::PreAuthorization.create({ + AuthorId: new_natural_user['Id'], + DebitedFunds: { Currency: 'EUR', Amount: amnt }, + CardId: cardreg['CardId'], + SecureMode: 'DEFAULT', + SecureModeReturnURL: 'http://test.com', + Tag: 'Test Card PreAuthorization' + }) + end + + let(:new_payin_preauthorized_direct) { create_new_payin_preauthorized_direct(new_wallet) } + def create_new_payin_preauthorized_direct(to_wallet, amnt = 1000) + preauth = new_card_preauthorization + MangoPay::PayIn::PreAuthorized::Direct.create({ + AuthorId: new_natural_user['Id'], + CreditedUserId: to_wallet['Owners'][0], + CreditedWalletId: to_wallet['Id'], + DebitedFunds: { Currency: 'EUR', Amount: amnt }, + Fees: { Currency: 'EUR', Amount: 0 }, + PreauthorizationId: preauth['Id'], + Tag: 'Test PayIn/PreAuthorized/Direct' + }) + end + + ############################################### + # bankwire/direct + ############################################### + + let(:new_payin_bankwire_direct) { create_new_payin_bankwire_direct(new_wallet) } + def create_new_payin_bankwire_direct(to_wallet, amnt = 1000) + MangoPay::PayIn::BankWire::Direct.create({ + AuthorId: new_natural_user['Id'], + CreditedUserId: to_wallet['Owners'][0], + CreditedWalletId: to_wallet['Id'], + DeclaredDebitedFunds: { Currency: 'EUR', Amount: amnt }, + DeclaredFees: { Currency: 'EUR', Amount: 0 }, + Tag: 'Test PayIn/BankWire/Direct' + }) + end + end ############################################### shared_context 'payouts' do ###############################################