Skip to content

Commit

Permalink
MPSDK-922: Payconiq implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
SoloJr committed Sep 30, 2021
1 parent a01e1be commit c9a480f
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/mangopay/pay_in.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,17 @@ def self.url(*)

end

module Payconiq

class Web < Resource
include HTTPCalls::Create
def self.url(*)
"#{MangoPay.api_path}/payins/payconiq/#{CGI.escape(class_name.downcase)}"
end
end

end

module ApplePay
class Direct < Resource
include HTTPCalls::Create
Expand Down
25 changes: 25 additions & 0 deletions spec/mangopay/payin_payconiq_web_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
describe MangoPay::PayIn::Payconiq::Web, type: :feature do
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('PAYCONIQ')
expect(payin['ExecutionType']).to eq('WEB')

# not SUCCEEDED yet: waiting for processing
expect(payin['Status']).to eq('CREATED')
expect(payin['ResultCode']).to be_nil
expect(payin['ResultMessage']).to be_nil
expect(payin['ExecutionDate']).to be_nil
end

describe 'CREATE' do
it 'creates a payconiq web payin' do
created = new_payin_payconiq_web
expect(created['Id']).not_to be_nil
check_type_and_status(created)
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 @@ -215,6 +215,22 @@ def create_new_document(user)
)
end

###############################################
# payconiq/web
###############################################

let(:new_payin_payconiq_web) do
MangoPay::PayIn::Payconiq::Web.create(
AuthorId: new_natural_user['Id'],
CreditedWalletId: new_wallet['Id'],
DebitedFunds: {Currency: 'EUR', Amount: 100},
Fees: {Currency: 'EUR', Amount: 0},
ReturnURL: MangoPay.configuration.root_url,
Country: "BE",
Tag: 'Custom Meta'
)
end

###############################################
# applepay/direct
###############################################
Expand Down

0 comments on commit c9a480f

Please sign in to comment.