mirror of
https://github.com/internetee/registry.git
synced 2025-07-27 21:16:12 +02:00
comment out generating invoices via lhv transaction
This commit is contained in:
parent
de9504fef7
commit
ccd9260ce8
9 changed files with 62 additions and 91 deletions
|
@ -26,6 +26,10 @@ class Registrar
|
|||
add_invoice_instance = EisBilling::AddDeposits.new(@invoice)
|
||||
result = add_invoice_instance.send_invoice
|
||||
|
||||
Rails.logger.info "Deposits controller ------->"
|
||||
Rails.logger.info result.body
|
||||
Rails.logger.info "-----------------------------------------"
|
||||
|
||||
link = JSON.parse(result.body)['everypay_link']
|
||||
|
||||
@invoice.update(payment_link: link)
|
||||
|
|
|
@ -109,13 +109,13 @@ class Registrar < ApplicationRecord
|
|||
|
||||
SendEInvoiceJob.set(wait: 1.minute).perform_now(invoice.id, payable: payable)
|
||||
|
||||
add_invoice_instance = EisBilling::AddDeposits.new(invoice)
|
||||
result = add_invoice_instance.send_invoice
|
||||
# add_invoice_instance = EisBilling::AddDeposits.new(invoice)
|
||||
# result = add_invoice_instance.send_invoice
|
||||
|
||||
Rails.logger.info "Invoice created from transaction ------->"
|
||||
Rails.logger.info invoice
|
||||
Rails.logger.info result.body
|
||||
Rails.logger.info "-----------------------------------------"
|
||||
# Rails.logger.info "Invoice created from transaction ------->"
|
||||
# Rails.logger.info invoice
|
||||
# Rails.logger.info result.body
|
||||
# Rails.logger.info "-----------------------------------------"
|
||||
|
||||
invoice
|
||||
end
|
||||
|
|
|
@ -7,7 +7,7 @@ module EisBilling
|
|||
end
|
||||
|
||||
def send_invoice
|
||||
base_request(json_obj: parse_invoice)
|
||||
send_request(json_obj: parse_invoice)
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -25,19 +25,9 @@ module EisBilling
|
|||
data
|
||||
end
|
||||
|
||||
def base_request(json_obj:)
|
||||
uri = URI(invoice_generator_url)
|
||||
http = Net::HTTP.new(uri.host, uri.port)
|
||||
headers = {
|
||||
'Authorization' => 'Bearer foobar',
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => TOKEN
|
||||
}
|
||||
|
||||
http.use_ssl = true
|
||||
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
||||
|
||||
http.post(invoice_generator_url, json_obj.to_json, headers)
|
||||
def send_request(json_obj:)
|
||||
http = EisBilling::Base.base_request(url: invoice_generator_url)
|
||||
http.post(invoice_generator_url, json_obj.to_json, HEADERS)
|
||||
end
|
||||
|
||||
def invoice_generator_url
|
||||
|
|
|
@ -1,18 +1,37 @@
|
|||
module EisBilling
|
||||
class Base
|
||||
|
||||
# crypt = ActiveSupport::MessageEncryptor.new(Rails.application.secrets.secret_key_base[0..31])
|
||||
# irb(main):047:0> encrypted_data = crypt.encrypt_and_sign('PLEASE CREATE INVOICE')
|
||||
# =>
|
||||
# irb(main):048:0> decrypted_back = crypt.decrypt_and_verify(encrypted_data)
|
||||
# =>
|
||||
TOKEN = 'Bearer WA9UvDmzR9UcE5rLqpWravPQtdS8eDMAIynzGdSOTw==--9ZShwwij3qmLeuMJ--NE96w2PnfpfyIuuNzDJTGw=='.freeze
|
||||
BASE_URL = ""
|
||||
|
||||
BASE_URL = ''
|
||||
if Rails.env.staging?
|
||||
BASE_URL = ENV['eis_billing_system_base_url_staging']
|
||||
else
|
||||
BASE_URL = ENV['eis_billing_system_base_url_dev']
|
||||
end
|
||||
|
||||
INITIATOR = 'registry'
|
||||
|
||||
HEADERS = {
|
||||
'Authorization' => 'Bearer foobar',
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => TOKEN
|
||||
}
|
||||
|
||||
def self.base_request(url:)
|
||||
uri = URI(url)
|
||||
http = Net::HTTP.new(uri.host, uri.port)
|
||||
|
||||
unless Rails.env.development?
|
||||
http.use_ssl = true
|
||||
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
||||
end
|
||||
|
||||
http
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,34 +1,21 @@
|
|||
module EisBilling
|
||||
class GetInvoiceNumber < EisBilling::Base
|
||||
def self.send_invoice
|
||||
result = base_request
|
||||
p "+++++++++++"
|
||||
Rails.logger.info invoice_number_generator_url
|
||||
p "+++++++++++"
|
||||
|
||||
Rails.logger.info "---------->"
|
||||
Rails.logger.info result.body
|
||||
Rails.logger.info invoice_generator_url
|
||||
Rails.logger.info "---------->"
|
||||
|
||||
result
|
||||
send_request
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def self.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
|
||||
}
|
||||
|
||||
http.use_ssl = true
|
||||
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
||||
|
||||
http.post(invoice_generator_url, nil, headers)
|
||||
def self.send_request
|
||||
http = EisBilling::Base.base_request(url: invoice_number_generator_url)
|
||||
http.post(invoice_number_generator_url, nil, HEADERS)
|
||||
end
|
||||
|
||||
def self.invoice_generator_url
|
||||
def self.invoice_number_generator_url
|
||||
"#{BASE_URL}/api/v1/invoice_generator/invoice_number_generator"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
module EisBilling
|
||||
class GetReferenceNumber < EisBilling::Base
|
||||
def self.send_request
|
||||
base_request
|
||||
send_request
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -12,22 +12,12 @@ module EisBilling
|
|||
}
|
||||
end
|
||||
|
||||
def self.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
|
||||
}
|
||||
|
||||
http.use_ssl = true
|
||||
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
||||
|
||||
http.post(invoice_generator_url, obj_data.to_json, headers)
|
||||
def self.send_request
|
||||
http = EisBilling::Base.base_request(url: reference_number_generator_url)
|
||||
http.post(reference_number_generator_url, obj_data.to_json, HEADERS)
|
||||
end
|
||||
|
||||
def self.invoice_generator_url
|
||||
def self.reference_number_generator_url
|
||||
"#{BASE_URL}/api/v1/invoice_generator/reference_number_generator"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
module EisBilling
|
||||
class SendDataToDirecto < EisBilling::Base
|
||||
def self.send_request(object_data:, monthly:, dry:)
|
||||
base_request(object_data: object_data, monthly: monthly, dry: dry)
|
||||
send_info(object_data: object_data, monthly: monthly, dry: dry)
|
||||
end
|
||||
|
||||
def self.base_request(object_data:, monthly:, dry:)
|
||||
def self.send_info(object_data:, monthly:, dry:)
|
||||
prepared_data = {
|
||||
invoice_data: object_data,
|
||||
monthly: monthly,
|
||||
|
@ -12,21 +12,11 @@ module EisBilling
|
|||
initiator: INITIATOR
|
||||
}
|
||||
|
||||
uri = URI(invoice_generator_url)
|
||||
http = Net::HTTP.new(uri.host, uri.port)
|
||||
headers = {
|
||||
'Authorization' => 'Bearer foobar',
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => TOKEN
|
||||
}
|
||||
|
||||
http.use_ssl = true
|
||||
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
||||
|
||||
http.post(invoice_generator_url, prepared_data.to_json, headers)
|
||||
http = EisBilling::Base.base_request(url: directo_url)
|
||||
http.post(directo_url, prepared_data.to_json, HEADERS)
|
||||
end
|
||||
|
||||
def self.invoice_generator_url
|
||||
def self.directo_url
|
||||
"#{BASE_URL}/api/v1/directo/directo"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
module EisBilling
|
||||
class SendEInvoice < EisBilling::Base
|
||||
def self.send_request(invoice:, payable:)
|
||||
base_request(invoice: invoice, payable: payable)
|
||||
send_info(invoice: invoice, payable: payable)
|
||||
end
|
||||
|
||||
def self.base_request(invoice:, payable:)
|
||||
def self.send_info(invoice:, payable:)
|
||||
items = []
|
||||
prepared_data = {
|
||||
invoice: invoice,
|
||||
|
@ -33,21 +33,11 @@ module EisBilling
|
|||
|
||||
prepared_data[:items] = items
|
||||
|
||||
uri = URI(invoice_generator_url)
|
||||
http = Net::HTTP.new(uri.host, uri.port)
|
||||
headers = {
|
||||
'Authorization' => 'Bearer foobar',
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => TOKEN
|
||||
}
|
||||
|
||||
http.use_ssl = true
|
||||
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
||||
|
||||
http.post(invoice_generator_url, prepared_data.to_json, headers)
|
||||
http = EisBilling::Base.base_request(url: e_invoice_url)
|
||||
http.post(e_invoice_url, prepared_data.to_json, HEADERS)
|
||||
end
|
||||
|
||||
def self.invoice_generator_url
|
||||
def self.e_invoice_url
|
||||
"#{BASE_URL}/api/v1/e_invoice/e_invoice"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -52,9 +52,10 @@ def base_request(url:, json_obj:)
|
|||
'Accept' => TOKEN
|
||||
}
|
||||
|
||||
|
||||
http.use_ssl = true
|
||||
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
||||
unless Rails.env.development?
|
||||
http.use_ssl = true
|
||||
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
||||
end
|
||||
|
||||
http.post(url, json_obj.to_json, headers)
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue