Story#107571572 can create SEB bank request

This commit is contained in:
Vladimir Krylov 2015-11-11 16:59:20 +02:00
parent 587e7db062
commit f6110b8319
5 changed files with 112 additions and 10 deletions

View file

@ -1,26 +1,25 @@
class Registrar::PaymentsController < RegistrarController
protect_from_forgery except: :back
skip_authorization_check # actually anyone can pay, no problems at all
skip_before_action :authenticate_user!, :check_ip, only: [:back]
before_action :check_bank
# to handle existing model we should
# get invoice_id and then get reference_number
# get invoice_id and then get number
# build BankTransaction without connection with right reference number
# do not connect transaction and invoice
def pay
invoice = Invoice.find(params[:invoice_id])
render text: "You are trying to pay with #{params[:bank]} for #{invoice.reference_no}"
@bank_link = BankLink::Request.new(params[:bank], invoice, self)
@bank_link.make_transaction
end
def cancel
end
# connect invoice and transaction
# both back and IPN
def back
@bank_link = BankLink::Response.new(params[:bank], params)
end
private