1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-01 12:24:28 +01:00
fab-manager/app/controllers/api/payzen_controller.rb

25 lines
700 B
Ruby
Raw Normal View History

# frozen_string_literal: true
# API Controller for accessing PayZen API endpoints through the front-end app
2021-04-09 17:17:58 +02:00
class API::PayzenController < API::PaymentsController
require 'pay_zen/charge'
def sdk_test
str = 'fab-manager'
client = PayZen::Charge.new(base_url: params[:base_url], username: params[:username], password: params[:password])
res = client.sdk_test(str)
2021-04-02 17:16:27 +02:00
@status = (res['answer']['value'] == str)
rescue SocketError
@status = false
end
2021-04-09 17:17:58 +02:00
def create_payment
amount = card_amount
client = PayZen::Charge.new
@result = client.create_payment(amount: amount, customer: { reference: params[:customer][:id], email: params[:customer][:email] })
end
end