mirror of
https://github.com/internetee/registry.git
synced 2025-07-27 13:06:18 +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
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -11,6 +11,6 @@
|
||||||
/config/deploy.rb
|
/config/deploy.rb
|
||||||
/config/master.key
|
/config/master.key
|
||||||
/.idea
|
/.idea
|
||||||
|
/config/master.key
|
||||||
# Do not commit one. Instead, download the latest from https://github.com/internetee/style-guide.
|
# Do not commit one. Instead, download the latest from https://github.com/internetee/style-guide.
|
||||||
.rubocop.yml
|
.rubocop.yml
|
||||||
|
|
|
@ -1,16 +1,7 @@
|
||||||
module EisBilling
|
module EisBilling
|
||||||
class Base
|
class Base
|
||||||
BASE_URL = ''
|
BASE_URL = ENV['eis_billing_system_base_url']
|
||||||
if Rails.env.staging?
|
INITIATOR = 'registry'.freeze
|
||||||
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']
|
|
||||||
|
|
||||||
def self.base_request(url:)
|
def self.base_request(url:)
|
||||||
uri = URI(url)
|
uri = URI(url)
|
||||||
|
@ -25,11 +16,11 @@ module EisBilling
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.generate_token
|
def self.generate_token
|
||||||
JWT.encode(payload, SECRET_WORD )
|
JWT.encode(payload, billing_secret)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.payload
|
def self.payload
|
||||||
{ data: SECRET_ACCESS_WORD }
|
{ initiator: INITIATOR }
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.headers
|
def self.headers
|
||||||
|
@ -38,5 +29,9 @@ module EisBilling
|
||||||
'Content-Type' => 'application/json'
|
'Content-Type' => 'application/json'
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.billing_secret
|
||||||
|
Rails.application.credentials.config[:billing_secret]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
1
config/credentials.yml.enc
Normal file
1
config/credentials.yml.enc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
bXY8qqnyzpMtyIDA74p4C1GiW+cLO7yeUXl5nwZB7yy1Lkv0XbF8juV07MCm7mBgh0BfjK9Ey2sx+QiXH/PimvhNDtgy6vSNbgb5AcQBJ6XwHlXei/DNF7Bt+r5V+ixrDU6FJZ8Y9EQyjZC9zcPiAaMhDMmA71bfiE2vO2TT1T6BZcjD5P4GKmYM7pMDgKATrwauzd6ejuYfTpSBHR51zuUEEBL1uZKSXW/i6vNAE+yuRxNOULWISA0zDPaCipnrMwjf8yWkp9L4qLIcggYpepZm6t+OyAD2XMTz/5skfQRtZ0PGDs7gzJLdAYD6ErUTU9N+n6SPhPpWu0zPFMR/A9t6AudgupmLeADGnkzUyRa4jCLzOnklV4rzAT1vM4zdVhGCgd3JXQL6zptrgHgRQN8i3BhBY2w3KXtFV1N61M6cMuuvTHMMFVI+V9sbRJ58Nok9EVbu5U/WRpuJElKq7xo1bgtY/0NOFq2K+TqZT6RBtSH5sWIdUGJJIbI6VngzfZpUNPiyg9eyShK2Wa2v1BlyLK3zYRD8F9/kNUvLCX7vgSjI/pwifokVAF51GhykhlmpfOyLmEEc011DwD+F4xjkYN1xHY8=--YBWnRjhG+BqNrfar--RcZCpjUq+MNhMOydjZWWTA==
|
Loading…
Add table
Add a link
Reference in a new issue