mirror of
https://github.com/internetee/registry.git
synced 2025-07-24 03:30:33 +02:00
Story#107571572 prepare workflow for payments with bank
This commit is contained in:
parent
96e599f885
commit
587e7db062
4 changed files with 56 additions and 14 deletions
35
app/controllers/registrar/payments_controller.rb
Normal file
35
app/controllers/registrar/payments_controller.rb
Normal file
|
@ -0,0 +1,35 @@
|
|||
class Registrar::PaymentsController < RegistrarController
|
||||
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
|
||||
# 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}"
|
||||
end
|
||||
|
||||
def cancel
|
||||
|
||||
end
|
||||
|
||||
# connect invoice and transaction
|
||||
# both back and IPN
|
||||
def back
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
def banks
|
||||
ENV['payments_banks'].split(",").map(&:strip)
|
||||
end
|
||||
|
||||
def check_bank
|
||||
raise StandardError.new("Not Implemented bank") unless banks.include?(params[:bank])
|
||||
end
|
||||
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue