mirror of
https://github.com/internetee/registry.git
synced 2025-06-09 06:04:56 +02:00
Merge pull request #848 from internetee/registry-844
Add extra logging to Directo request and responses
This commit is contained in:
commit
d781e990f5
1 changed files with 9 additions and 4 deletions
|
@ -45,8 +45,10 @@ class Directo < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
data = builder.to_xml.gsub("\n",'')
|
data = builder.to_xml.gsub("\n",'')
|
||||||
response = RestClient::Request.execute(url: ENV['directo_invoice_url'], method: :post, payload: {put: "1", what: "invoice", xmldata: data}, verify_ssl: false).to_s
|
Rails.logger.info("[Directo] XML request: #{data}")
|
||||||
dump_result_to_db(mappers, response)
|
response = RestClient::Request.execute(url: ENV['directo_invoice_url'], method: :post, payload: {put: "1", what: "invoice", xmldata: data}, verify_ssl: false)
|
||||||
|
Rails.logger.info("[Directo] Directo responded with code: #{response.code}, body: #{response.body}")
|
||||||
|
dump_result_to_db(mappers, response.to_s)
|
||||||
end
|
end
|
||||||
|
|
||||||
STDOUT << "#{Time.zone.now.utc} - Directo receipts sending finished. #{counter} of #{total} are sent\n"
|
STDOUT << "#{Time.zone.now.utc} - Directo receipts sending finished. #{counter} of #{total} are sent\n"
|
||||||
|
@ -165,11 +167,15 @@ class Directo < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
data = builder.to_xml.gsub("\n",'')
|
data = builder.to_xml.gsub("\n",'')
|
||||||
|
Rails.logger.info("[Directo] XML request: #{data}")
|
||||||
|
|
||||||
if debug
|
if debug
|
||||||
STDOUT << "#{Time.zone.now.utc} - Directo xml had to be sent #{data}\n"
|
STDOUT << "#{Time.zone.now.utc} - Directo xml had to be sent #{data}\n"
|
||||||
else
|
else
|
||||||
response = RestClient::Request.execute(url: ENV['directo_invoice_url'], method: :post, payload: {put: "1", what: "invoice", xmldata: data}, verify_ssl: false).to_s
|
response = RestClient::Request.execute(url: ENV['directo_invoice_url'], method: :post, payload: {put: "1", what: "invoice", xmldata: data}, verify_ssl: false)
|
||||||
|
Rails.logger.info("[Directo] Directo responded with code: #{response.code}, body: #{response.body}")
|
||||||
|
response = response.to_s
|
||||||
|
|
||||||
Setting.directo_monthly_number_last = directo_next
|
Setting.directo_monthly_number_last = directo_next
|
||||||
Nokogiri::XML(response).css("Result").each do |res|
|
Nokogiri::XML(response).css("Result").each do |res|
|
||||||
Directo.create!(request: data, response: res.as_json.to_h, invoice_number: directo_next)
|
Directo.create!(request: data, response: res.as_json.to_h, invoice_number: directo_next)
|
||||||
|
@ -190,4 +196,3 @@ class Directo < ActiveRecord::Base
|
||||||
@pricelists[account_activity.price_id] = account_activity.price
|
@pricelists[account_activity.price_id] = account_activity.price
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue