mirror of
https://github.com/internetee/registry.git
synced 2025-08-06 01:35:10 +02:00
Add EveryPay payments
* Refactor BankLink into Payments::BankLink, add Payments::EveryPay * Write tests for existing invoice views * Write basic tests for Payments module
This commit is contained in:
parent
f7c2b25a66
commit
c5591b4828
32 changed files with 818 additions and 31 deletions
19
app/views/registrar/card_payment/complete.haml
Normal file
19
app/views/registrar/card_payment/complete.haml
Normal file
|
@ -0,0 +1,19 @@
|
|||
.row
|
||||
.col-md-12
|
||||
%h4= "Credit card payment successful"
|
||||
%hr
|
||||
%dl.dl-horizontal
|
||||
%dt= t(:invoice)
|
||||
%dd= @invoice.reference_no
|
||||
|
||||
%dt= "Card Type"
|
||||
%dd= params['cc_type'].humanize
|
||||
|
||||
%dt= "Card Holder"
|
||||
%dd= params['cc_holder_name']
|
||||
|
||||
%dt= "Card Last four digits"
|
||||
%dd= params['cc_last_four_digits']
|
||||
|
||||
%dt= "Valid thru"
|
||||
%dd= "#{params['cc_month']}/#{params['cc_year']}"
|
4
app/views/registrar/card_payment/new.haml
Normal file
4
app/views/registrar/card_payment/new.haml
Normal file
|
@ -0,0 +1,4 @@
|
|||
= form_tag "https://igw-demo.every-pay.com/transactions/", method: :post do
|
||||
- @every_pay.keys.each do |k, v|
|
||||
= hidden_field_tag(k, @every_pay[k])
|
||||
= submit_tag t("registrar.invoices.to_card_payment")
|
|
@ -1,6 +1,7 @@
|
|||
%h4= t(:pay_by_bank_link)
|
||||
%h4= t('registrar.invoices.pay_invoice')
|
||||
%hr
|
||||
- ENV['payments_banks'].split(",").each do |meth|
|
||||
|
||||
- locals[:payment_channels].each do |meth|
|
||||
- meth = meth.strip
|
||||
= link_to registrar_payment_with_path(meth, invoice_id: params[:id]) do
|
||||
= image_tag("#{meth}.png")
|
||||
|
|
7
app/views/registrar/invoices/partials/_credit_card.haml
Normal file
7
app/views/registrar/invoices/partials/_credit_card.haml
Normal file
|
@ -0,0 +1,7 @@
|
|||
%h4= t('registrar.invoices.pay_by_credit_card')
|
||||
- @every_pay = EveryPayPayment.new(@invoice).json
|
||||
%hr
|
||||
= form_tag "https://igw-demo.every-pay.com/transactions/", method: :post do
|
||||
- @every_pay.keys.each do |k, v|
|
||||
= hidden_field_tag(k, @every_pay[k])
|
||||
= submit_tag t("registrar.invoices.to_card_payment")
|
|
@ -17,4 +17,4 @@
|
|||
|
||||
- if !@invoice.cancelled? && !@invoice.binded?
|
||||
.row.semifooter
|
||||
.col-md-12.text-right= render 'registrar/invoices/partials/banklinks'
|
||||
.col-md-6-offset-6.text-right= render 'registrar/invoices/partials/banklinks', locals: { payment_channels: Payments::PAYMENT_METHODS }
|
||||
|
|
19
app/views/registrar/payments/every_pay/complete.haml
Normal file
19
app/views/registrar/payments/every_pay/complete.haml
Normal file
|
@ -0,0 +1,19 @@
|
|||
.row
|
||||
.col-md-12
|
||||
%h4= "Credit card payment successful"
|
||||
%hr
|
||||
%dl.dl-horizontal
|
||||
%dt= t(:invoice)
|
||||
%dd= @invoice.reference_no
|
||||
|
||||
%dt= "Card Type"
|
||||
%dd= params['cc_type'].humanize
|
||||
|
||||
%dt= "Card Holder"
|
||||
%dd= params['cc_holder_name']
|
||||
|
||||
%dt= "Card Last four digits"
|
||||
%dd= params['cc_last_four_digits']
|
||||
|
||||
%dt= "Valid thru"
|
||||
%dd= "#{params['cc_month']}/#{params['cc_year']}"
|
4
app/views/registrar/payments/every_pay/new.haml
Normal file
4
app/views/registrar/payments/every_pay/new.haml
Normal file
|
@ -0,0 +1,4 @@
|
|||
= form_tag "https://igw-demo.every-pay.com/transactions/", method: :post do
|
||||
- @every_pay.keys.each do |k, v|
|
||||
= hidden_field_tag(k, @every_pay[k])
|
||||
= submit_tag t("registrar.invoices.to_card_payment")
|
|
@ -1,11 +1,15 @@
|
|||
.h3
|
||||
= t('registrar.invoices.redirected_to_bank')
|
||||
|
||||
.payment-form
|
||||
= form_tag @bank_link.url, method: :post do
|
||||
- @bank_link.fields.each do |k, v|
|
||||
= form_tag @payment.form_url, method: :post do
|
||||
- @payment.form_fields.each do |k, v|
|
||||
= hidden_field_tag k, v
|
||||
= submit_tag "Mine maksma"
|
||||
= submit_tag t('registrar.invoices.go_to_bank')
|
||||
|
||||
:javascript
|
||||
function loadListener () {
|
||||
$('.payment-form form').submit();
|
||||
}
|
||||
|
||||
:coffeescript
|
||||
load_listener = ->
|
||||
$('.payment-form form').submit()
|
||||
window.addEventListener 'load', load_listener
|
||||
document.addEventListener('load', loadListener)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue