mirror of
https://github.com/internetee/registry.git
synced 2025-07-28 05:26:17 +02:00
updated directo feature
This commit is contained in:
parent
8201e1e0d0
commit
ab8c911da1
2 changed files with 6 additions and 5 deletions
|
@ -12,11 +12,12 @@ class EisBilling::DirectoResponseController < EisBilling::BaseController
|
||||||
|
|
||||||
def process_directo_response(xml, req)
|
def process_directo_response(xml, req)
|
||||||
Rails.logger.info "[Directo] - Responded with body: #{xml}"
|
Rails.logger.info "[Directo] - Responded with body: #{xml}"
|
||||||
Nokogiri::XML(xml).css('Result').each do |res|
|
Nokogiri::XML(req).css('Result').each do |res|
|
||||||
if @month
|
if @month
|
||||||
mark_invoice_as_sent(res: res, req: req)
|
mark_invoice_as_sent(res: res, req: req)
|
||||||
else
|
else
|
||||||
inv = Invoice.find_by(number: res.attributes['docid'].value.to_i)
|
inv = Invoice.find_by(number: res.attributes['docid'].value.to_i)
|
||||||
|
|
||||||
mark_invoice_as_sent(invoice: inv, res: res, req: req)
|
mark_invoice_as_sent(invoice: inv, res: res, req: req)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -25,17 +25,17 @@ module EisBilling
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.generate_token
|
def self.generate_token
|
||||||
JWT.encode(payload, ENV['secret_word'])
|
JWT.encode(payload, SECRET_WORD )
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.payload
|
def self.payload
|
||||||
{ data: ENV['secret_access_word'] }
|
{ data: SECRET_ACCESS_WORD }
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.headers
|
def self.headers
|
||||||
{
|
{
|
||||||
'Authorization' => "Bearer #{generate_token}",
|
'Authorization' => "Bearer #{generate_token}",
|
||||||
'Content-Type' => 'application/json',
|
'Content-Type' => 'application/json'
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue