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:
Maciej Szlosarczyk 2018-04-11 11:55:52 +03:00
parent f7c2b25a66
commit c5591b4828
No known key found for this signature in database
GPG key ID: 41D62D42D3B0D765
32 changed files with 818 additions and 31 deletions

View 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']}"

View 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")

View file

@ -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")

View 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")

View file

@ -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 }

View 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']}"

View 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")

View file

@ -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)