mirror of
https://github.com/internetee/registry.git
synced 2025-08-11 12:09:34 +02:00
remove uneccessary code, adapted to eis billing response, fix logging error
This commit is contained in:
parent
d1e64577b4
commit
ac3244466e
6 changed files with 6 additions and 69 deletions
|
@ -18,7 +18,7 @@ module EisBilling
|
||||||
bank = create_bank_transfer(invoice: invoice, sum: sum, paid_at: paid_at)
|
bank = create_bank_transfer(invoice: invoice, sum: sum, paid_at: paid_at)
|
||||||
create_payment_order(invoice: invoice, everypay_response: everypay_response, payment_status: payment_status)
|
create_payment_order(invoice: invoice, everypay_response: everypay_response, payment_status: payment_status)
|
||||||
|
|
||||||
registrar = Registrar.find_by(reference_no: params[:reference_number])
|
registrar = invoice.buyer
|
||||||
bank.create_activity(registrar, invoice)
|
bank.create_activity(registrar, invoice)
|
||||||
|
|
||||||
render status: 200, json: { status: 'ok' }
|
render status: 200, json: { status: 'ok' }
|
||||||
|
@ -58,7 +58,7 @@ module EisBilling
|
||||||
bank.save
|
bank.save
|
||||||
|
|
||||||
logger.info '++++ BANK TRANSACTION ERRORS ? ++++'
|
logger.info '++++ BANK TRANSACTION ERRORS ? ++++'
|
||||||
looger.info bank.errors
|
logger.info bank.errors
|
||||||
|
|
||||||
bank
|
bank
|
||||||
end
|
end
|
||||||
|
|
|
@ -25,10 +25,9 @@ class Registrar
|
||||||
def send_invoice_data_to_billing_system
|
def send_invoice_data_to_billing_system
|
||||||
add_invoice_instance = EisBilling::AddDeposits.new(@invoice)
|
add_invoice_instance = EisBilling::AddDeposits.new(@invoice)
|
||||||
result = add_invoice_instance.send_invoice
|
result = add_invoice_instance.send_invoice
|
||||||
|
link = JSON.parse(result.body)['everypay_link']
|
||||||
|
|
||||||
p "+++++++++++++ result"
|
@invoice.update(payment_link: link)
|
||||||
p JSON.parse(result.body)['everypay_link']
|
|
||||||
p "+++++++++++++"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def deposit_params
|
def deposit_params
|
||||||
|
|
|
@ -14,11 +14,6 @@ class Registrar
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
invoice = Invoice.find(params[:id])
|
|
||||||
link_handler = EisBilling::GetInvoiceLink.new(invoice.number)
|
|
||||||
response = link_handler.send_request
|
|
||||||
|
|
||||||
@everypay_link = JSON.parse(response.body)['payment_link']
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def cancel
|
def cancel
|
||||||
|
|
|
@ -23,33 +23,8 @@ module EisBilling
|
||||||
data[:invoice_number] = invoice.number
|
data[:invoice_number] = invoice.number
|
||||||
|
|
||||||
data
|
data
|
||||||
|
|
||||||
# invoice = @invoice.to_json(except: [ :order_reference,
|
|
||||||
# :created_at,
|
|
||||||
# :updated_at,
|
|
||||||
# :e_invoice_sent_at,
|
|
||||||
# :items_attributes])
|
|
||||||
|
|
||||||
# parsed_data = JSON.parse(invoice)
|
|
||||||
# parsed_data['role'] = 'registrar'
|
|
||||||
# parsed_data['source'] = 'registry'
|
|
||||||
# parsed_data['description'] = 'some' if parsed_data['description'] == ''
|
|
||||||
|
|
||||||
# parsed_data = replace_key(json_obj: parsed_data, old_key: 'total', new_key: 'transaction_amount')
|
|
||||||
# parsed_data = replace_key(json_obj: parsed_data, old_key: 'reference_no', new_key: 'reference_number')
|
|
||||||
|
|
||||||
# invoice_items_json = @invoice.items.to_json(except: [ :created_at, :updated_at ])
|
|
||||||
# parsed_data['items'] = JSON.parse(invoice_items_json)
|
|
||||||
# parsed_data
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# def replace_key(json_obj:, old_key:, new_key:)
|
|
||||||
# json_obj[new_key] = json_obj[old_key]
|
|
||||||
# json_obj.delete(old_key)
|
|
||||||
|
|
||||||
# json_obj
|
|
||||||
# end
|
|
||||||
|
|
||||||
def base_request(json_obj:)
|
def base_request(json_obj:)
|
||||||
uri = URI(invoice_generator_url)
|
uri = URI(invoice_generator_url)
|
||||||
http = Net::HTTP.new(uri.host, uri.port)
|
http = Net::HTTP.new(uri.host, uri.port)
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
module EisBilling
|
|
||||||
class GetInvoiceLink < EisBilling::Base
|
|
||||||
attr_reader :invoice_number
|
|
||||||
|
|
||||||
def initialize(invoice_number)
|
|
||||||
@invoice_number = invoice_number
|
|
||||||
end
|
|
||||||
|
|
||||||
def send_request
|
|
||||||
base_request
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def base_request
|
|
||||||
uri = URI(invoice_generator_url)
|
|
||||||
http = Net::HTTP.new(uri.host, uri.port)
|
|
||||||
headers = {
|
|
||||||
'Authorization'=>'Bearer foobar',
|
|
||||||
'Content-Type' =>'application/json',
|
|
||||||
'Accept'=> TOKEN
|
|
||||||
}
|
|
||||||
|
|
||||||
res = http.get(invoice_generator_url + "?invoice_number=#{@invoice_number}", headers)
|
|
||||||
res
|
|
||||||
end
|
|
||||||
|
|
||||||
def invoice_generator_url
|
|
||||||
"#{BASE_URL}/api/v1/get_invoice_payment_link/show"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -7,7 +7,7 @@
|
||||||
= image_tag("#{meth}.png")
|
= image_tag("#{meth}.png")
|
||||||
%hr
|
%hr
|
||||||
|
|
||||||
- if @everypay_link.present?
|
- if @invoice.payment_link.present?
|
||||||
= link_to 'Everypay link', @everypay_link, target: :_blank
|
= link_to 'Everypay link', @invoice.payment_link, target: :_blank
|
||||||
- else
|
- else
|
||||||
= "No everypay link"
|
= "No everypay link"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue