mirror of
https://github.com/internetee/registry.git
synced 2025-06-08 21:54:48 +02:00
Generate REPP auth token for bulk renew
This commit is contained in:
parent
b8aeba6beb
commit
240da481e5
2 changed files with 4 additions and 3 deletions
|
@ -14,7 +14,7 @@ class Registrar
|
||||||
|
|
||||||
if ready_to_renew?
|
if ready_to_renew?
|
||||||
res = Depp::Domain.bulk_renew(domain_ids_for_bulk_renew, params[:period],
|
res = Depp::Domain.bulk_renew(domain_ids_for_bulk_renew, params[:period],
|
||||||
current_registrar_user.registrar)
|
current_registrar_user)
|
||||||
|
|
||||||
flash_message(JSON.parse(res))
|
flash_message(JSON.parse(res))
|
||||||
else
|
else
|
||||||
|
|
|
@ -30,9 +30,10 @@ module Depp
|
||||||
['10 years', '10y'],
|
['10 years', '10y'],
|
||||||
]
|
]
|
||||||
|
|
||||||
def self.bulk_renew(domains, period, _registrar)
|
def self.bulk_renew(domains, period, registrar)
|
||||||
payload = { domains: domains, renew_period: period }
|
payload = { domains: domains, renew_period: period }
|
||||||
headers = { Authorization: 'Basic dGVzdDp0ZXN0MTIz' }
|
token = Base64.urlsafe_encode64("#{registrar.username}:#{registrar.plain_text_password}")
|
||||||
|
headers = { Authorization: "Basic #{token}" }
|
||||||
|
|
||||||
RestClient.post("#{ENV['repp_url']}domains/renew/bulk", payload, headers).response
|
RestClient.post("#{ENV['repp_url']}domains/renew/bulk", payload, headers).response
|
||||||
rescue RestClient::ExceptionWithResponse => e
|
rescue RestClient::ExceptionWithResponse => e
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue