Skip to content

Commit

Permalink
Merge pull request #253 from Mangopay/feature/bancontact-web-payin
Browse files Browse the repository at this point in the history
added Bancontact web PayIn
  • Loading branch information
iulian03 authored Aug 7, 2024
2 parents 986c65e + 6f131b2 commit a10a48a
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/mangopay/pay_in.rb
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,16 @@ def self.url(*)
end
end

module Bancontact
class Web < Resource
include HTTPCalls::Create

def self.url(*)
"#{MangoPay.api_path}/payins/payment-methods/bancontact"
end
end
end

module RecurringPayments
class Recurring < Resource
include HTTPCalls::Create
Expand Down
30 changes: 30 additions & 0 deletions spec/mangopay/payin_bancontact_web_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
describe MangoPay::PayIn::Bancontact::Web, 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('BCMC')
expect(payin['ExecutionType']).to eq('WEB')
expect(payin['Status']).to eq('CREATED')
end

describe 'CREATE' do
it 'creates a bancontact web payin' do
created = new_payin_bancontact_web
expect(created['Id']).not_to be_nil
check_type_and_status(created)
end
end

describe 'FETCH' do
it 'fetches a payin' do
created = new_payin_bancontact_web
fetched = MangoPay::PayIn.fetch(created['Id'])
expect(fetched['Id']).to eq(created['Id'])
check_type_and_status(created)
check_type_and_status(fetched)
end
end
end
16 changes: 16 additions & 0 deletions spec/mangopay/shared_resources.rb
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,22 @@ def create_new_document(user)
)
end

###############################################
# Bancontact/web
###############################################
let(:new_payin_bancontact_web) do
MangoPay::PayIn::Bancontact::Web.create(
AuthorId: new_natural_user['Id'],
CreditedWalletId: new_wallet['Id'],
DebitedFunds: { Currency: 'EUR', Amount: 400 },
Fees: { Currency: 'EUR', Amount: 10 },
ReturnURL: 'http://www.my-site.com/returnURL',
StatementDescriptor: "test",
Tag: 'Test PayIn/Bancontact/Web',
Culture: 'FR'
)
end

###############################################
# PAYPAL/web V2
###############################################
Expand Down

0 comments on commit a10a48a

Please sign in to comment.