added directo handler for interaction with billing system

This commit is contained in:
olegphenomenon 2022-02-01 13:35:11 +02:00
parent d9696014ff
commit 0259dd7fec
8 changed files with 286 additions and 1 deletions

View file

@ -0,0 +1,30 @@
module EisBilling
class SendDataToDirecto < EisBilling::Base
def self.send_request(object_data:, monthly:, dry:)
base_request(object_data: object_data, monthly: monthly, dry: dry)
end
def self.base_request(object_data:, monthly:, dry:)
prepared_data = {
invoice_data: object_data,
monthly: monthly,
dry: dry,
initiator: 'registry'
}
uri = URI(invoice_generator_url)
http = Net::HTTP.new(uri.host, uri.port)
headers = {
'Authorization' => 'Bearer foobar',
'Content-Type' => 'application/json',
'Accept' => TOKEN
}
http.post(invoice_generator_url, prepared_data.to_json, headers)
end
def self.invoice_generator_url
"#{BASE_URL}/api/v1/directo/directo"
end
end
end