mirror of
https://github.com/internetee/registry.git
synced 2025-07-22 18:56:05 +02:00
Remove capybara-selenium
This commit is contained in:
parent
eda6772c6f
commit
d7dc1017b0
15 changed files with 126 additions and 162 deletions
|
@ -1,9 +1,9 @@
|
|||
class Registrar
|
||||
class PaymentsController < BaseController
|
||||
protect_from_forgery except: :back
|
||||
protect_from_forgery except: [:back, :callback]
|
||||
|
||||
skip_authorization_check # actually anyone can pay, no problems at all
|
||||
skip_before_action :authenticate_user!, :check_ip_restriction, only: [:back]
|
||||
skip_before_action :authenticate_user!, :check_ip_restriction, only: [:back, :callback]
|
||||
# before_action :check_bank
|
||||
|
||||
# to handle existing model we should
|
||||
|
@ -15,7 +15,8 @@ class Registrar
|
|||
invoice = Invoice.find(params[:invoice_id])
|
||||
opts = {
|
||||
return_url: self.registrar_return_payment_with_url(params[:bank], invoice_id: invoice.id),
|
||||
response_url: self.registrar_return_payment_with_url(params[:bank])
|
||||
# TODO: Add required URL
|
||||
response_url: "https://5fd921b0.ngrok.io/registrar/pay/callback/every_pay"
|
||||
}
|
||||
@payment = ::Payments.create_with_type(params[:bank], invoice, opts)
|
||||
@payment.create_transaction
|
||||
|
@ -43,6 +44,20 @@ class Registrar
|
|||
redirect_to registrar_invoice_path(invoice)
|
||||
end
|
||||
|
||||
def callback
|
||||
invoice = Invoice.find(params[:invoice_id])
|
||||
opts = { response: params }
|
||||
@payment = ::Payments.create_with_type(params[:bank], invoice, opts)
|
||||
|
||||
if @payment.valid_response? && @payment.settled_payment?
|
||||
@payment.complete_transaction
|
||||
|
||||
if invoice.binded?
|
||||
render status: 200, json: { ok: :ok }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# def banks
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue