mirror of
https://github.com/internetee/registry.git
synced 2025-07-21 02:05:57 +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
|
|
@ -1,16 +1,6 @@
|
|||
%h4= t(:pay_by_bank_link)
|
||||
%hr
|
||||
= link_to '#' do
|
||||
= image_tag('swed.png')
|
||||
|
||||
= link_to '#' do
|
||||
= image_tag('seb.png')
|
||||
|
||||
= link_to '#' do
|
||||
= image_tag('nordea.png')
|
||||
|
||||
= link_to '#' do
|
||||
= image_tag('lhv.png')
|
||||
|
||||
= link_to '#' do
|
||||
= image_tag('danske.png')
|
||||
- ENV['payments_banks'].split(",").each do |meth|
|
||||
- meth = meth.strip
|
||||
= link_to registrar_payment_with_path(meth, invoice_id: params[:id]) do
|
||||
= image_tag("#{meth}.png")
|
||||
|
|
|
@ -109,6 +109,19 @@ new_relic_license_key: '42d1c2ba4ed17a9cf6297c59d80e563a3dd3c4fa'
|
|||
secret_key_base: 'please-change-it-you-can-generate-it-with-rake-secret'
|
||||
devise_secret: 'please-change-it-you-can-generate-it-with-rake-secret'
|
||||
|
||||
payments_banks: >
|
||||
seb,
|
||||
swed,
|
||||
lhv
|
||||
payments_seb_url: 'https://www.seb.ee/cgi-bin/dv.sh/ipank.r'
|
||||
payments_seb_bank_certificate: 'eyp_pub.pem'
|
||||
payments_seb_seller_private: 'kaupmees_priv.pem'
|
||||
payments_swed_url: 'https://www.seb.ee/cgi-bin/dv.sh/ipank.r'
|
||||
payments_swed_bank_certificate: 'eyp_pub.pem'
|
||||
payments_swed_seller_private: 'kaupmees_priv.pem'
|
||||
payments_lhv_url: 'https://www.seb.ee/cgi-bin/dv.sh/ipank.r'
|
||||
payments_lhv_bank_certificate: 'eyp_pub.pem'
|
||||
payments_lhv_seller_private: 'kaupmees_priv.pem'
|
||||
|
||||
#
|
||||
# AUTOTEST overwrites
|
||||
|
|
|
@ -91,6 +91,10 @@ Rails.application.routes.draw do
|
|||
get 'load_xml'
|
||||
end
|
||||
end
|
||||
|
||||
get 'pay/:bank' => 'payments#pay', as: 'payment_with'
|
||||
get 'pay/:bank/cancel' => 'payments#cancel',as: 'cancel_payment_with'
|
||||
get 'pay/:bank/return' => 'payments#back', as: 'return_payment_with'
|
||||
end
|
||||
|
||||
# REGISTRANT ROUTES
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue