mirror of
https://github.com/internetee/registry.git
synced 2025-07-28 05:26:17 +02:00
added encoder for billing request
This commit is contained in:
parent
03101a599f
commit
28dcf047ef
3 changed files with 10 additions and 14 deletions
|
@ -1,16 +1,7 @@
|
|||
module EisBilling
|
||||
class Base
|
||||
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'
|
||||
|
||||
SECRET_WORD = ENV['secret_word']
|
||||
SECRET_ACCESS_WORD = ENV['secret_access_word']
|
||||
BASE_URL = ENV['eis_billing_system_base_url']
|
||||
INITIATOR = 'registry'.freeze
|
||||
|
||||
def self.base_request(url:)
|
||||
uri = URI(url)
|
||||
|
@ -25,11 +16,11 @@ module EisBilling
|
|||
end
|
||||
|
||||
def self.generate_token
|
||||
JWT.encode(payload, SECRET_WORD )
|
||||
JWT.encode(payload, billing_secret)
|
||||
end
|
||||
|
||||
def self.payload
|
||||
{ data: SECRET_ACCESS_WORD }
|
||||
{ initiator: INITIATOR }
|
||||
end
|
||||
|
||||
def self.headers
|
||||
|
@ -38,5 +29,9 @@ module EisBilling
|
|||
'Content-Type' => 'application/json'
|
||||
}
|
||||
end
|
||||
|
||||
def self.billing_secret
|
||||
Rails.application.credentials.config[:billing_secret]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue