mirror of
https://github.com/internetee/registry.git
synced 2025-07-24 03:30:33 +02:00
Fix leaking test
This commit is contained in:
parent
1cca930744
commit
f6b1db2cce
12 changed files with 134 additions and 31 deletions
|
@ -6,25 +6,19 @@ class Registrar
|
|||
skip_before_action :authenticate_user!, :check_ip_restriction, only: [:back, :callback]
|
||||
# before_action :check_bank
|
||||
|
||||
# to handle existing model we should
|
||||
# get invoice_id and then get number
|
||||
# build BankTransaction without connection with right reference number
|
||||
# do not connect transaction and invoice
|
||||
# TODO: Refactor to :new
|
||||
def pay
|
||||
invoice = Invoice.find(params[:invoice_id])
|
||||
opts = {
|
||||
return_url: self.registrar_return_payment_with_url(params[:bank], invoice_id: invoice.id),
|
||||
# TODO: Add required URL
|
||||
response_url: "https://5fd921b0.ngrok.io/registrar/pay/callback/every_pay"
|
||||
response_url: "https://53e21cc8.ngrok.io/registrar/pay/callback/every_pay"
|
||||
}
|
||||
@payment = ::Payments.create_with_type(params[:bank], invoice, opts)
|
||||
@payment.create_transaction
|
||||
end
|
||||
|
||||
|
||||
# connect invoice and transaction
|
||||
# both back and IPN
|
||||
# TODO: Refactor to be restful
|
||||
def back
|
||||
invoice = Invoice.find(params[:invoice_id])
|
||||
|
@ -60,11 +54,14 @@ class Registrar
|
|||
|
||||
private
|
||||
|
||||
# def banks
|
||||
# ENV['payments_banks'].split(",").map(&:strip)
|
||||
# end
|
||||
def check_supported_payment_method
|
||||
unless supported_payment_method?
|
||||
raise StandardError.new("Not supported payment method")
|
||||
end
|
||||
end
|
||||
|
||||
def check_bank
|
||||
|
||||
def supported_payment_method?
|
||||
raise StandardError.new("Not Implemented bank") unless banks.include?(params[:bank])
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
module Payments
|
||||
class BankLink < Base
|
||||
# TODO: Remove magic numbers, convert certain fields to proper constants
|
||||
# TODO: Remove hashrockets
|
||||
# DONE: Remove hashrockets
|
||||
def form_fields
|
||||
@fields ||= hash = {}
|
||||
hash["VK_SERVICE"] = "1012"
|
||||
|
@ -36,6 +36,8 @@ module Payments
|
|||
|
||||
private
|
||||
|
||||
SUCCESS_FIELDS =
|
||||
|
||||
def validate_success
|
||||
pars = %w(VK_SERVICE VK_VERSION VK_SND_ID VK_REC_ID VK_STAMP VK_T_NO VK_AMOUNT VK_CURR
|
||||
VK_REC_ACC VK_REC_NAME VK_SND_ACC VK_SND_NAME VK_REF VK_MSG VK_T_DATETIME).freeze
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue