mirror of
https://github.com/internetee/registry.git
synced 2025-06-05 04:07:33 +02:00
Replace LHV JKS store with P12
This commit is contained in:
parent
65a749edc8
commit
64def385b0
4 changed files with 16 additions and 18 deletions
|
@ -148,9 +148,8 @@ action_mailer_default_port: # default: no port (80)
|
|||
action_mailer_default_from: # no-reply@example.com
|
||||
action_mailer_force_delete_from: # `From` header for `DomainDeleteMailer#forced` email
|
||||
|
||||
lhv_keystore:
|
||||
lhv_p12_keystore:
|
||||
lhv_keystore_password:
|
||||
lhv_keystore_alias:
|
||||
lhv_ca_file: # Needed only in dev mode
|
||||
lhv_dev_mode: 'false'
|
||||
|
||||
|
@ -163,9 +162,8 @@ test:
|
|||
action_mailer_default_host: 'registry.test'
|
||||
action_mailer_default_from: 'no-reply@registry.test'
|
||||
action_mailer_force_delete_from: 'legal@registry.test'
|
||||
lhv_keystore: 'test/fixtures/files/keystore.jks'
|
||||
lhv_p12_keystore: 'test/fixtures/files/keystore.p12'
|
||||
lhv_keystore_password: 'testtest'
|
||||
lhv_keystore_alias: 'testtest'
|
||||
|
||||
# Airbrake // Errbit:
|
||||
airbrake_host: "https://your-errbit-host.ee"
|
||||
|
|
|
@ -3,12 +3,9 @@ namespace :dev do
|
|||
remitter_iban = ENV['remitter_iban']
|
||||
beneficiary_iban = Setting.registry_iban
|
||||
|
||||
keystore_password = ENV['lhv_keystore_password']
|
||||
keystore_alias = ENV['lhv_keystore_alias']
|
||||
keystore = Keystores::JavaKeystore.new
|
||||
keystore.load(ENV['lhv_keystore'], keystore_password)
|
||||
cert = keystore.get_certificate(keystore_alias)
|
||||
key = keystore.get_key(keystore_alias, keystore_password)
|
||||
keystore = OpenSSL::PKCS12.new(File.read(ENV['lhv_p12_keystore']), ENV['lhv_keystore_password'])
|
||||
key = keystore.key
|
||||
cert = keystore.certificate
|
||||
|
||||
api_base_uri = URI.parse('https://testconnect.lhv.eu/connect-prelive')
|
||||
request_headers = { 'content-type' => 'application/xml' }
|
||||
|
@ -38,4 +35,4 @@ namespace :dev do
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,12 +2,9 @@ namespace :invoices do
|
|||
task process_payments: :environment do
|
||||
registry_bank_account_iban = Setting.registry_iban
|
||||
|
||||
keystore_password = ENV['lhv_keystore_password']
|
||||
keystore_alias = ENV['lhv_keystore_alias']
|
||||
keystore = Keystores::JavaKeystore.new
|
||||
keystore.load(ENV['lhv_keystore'], keystore_password)
|
||||
cert = keystore.get_certificate(keystore_alias)
|
||||
key = keystore.get_key(keystore_alias, keystore_password)
|
||||
keystore = OpenSSL::PKCS12.new(File.read(ENV['lhv_p12_keystore']), ENV['lhv_keystore_password'])
|
||||
key = keystore.key
|
||||
cert = keystore.certificate
|
||||
|
||||
api = Lhv::ConnectApi.new
|
||||
api.cert = cert
|
||||
|
@ -46,4 +43,4 @@ namespace :invoices do
|
|||
|
||||
puts "Transactions processed: #{incoming_transactions.size}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -88,6 +88,12 @@ class ProcessPaymentsTaskTest < ActiveSupport::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
def test_parses_keystore_properly
|
||||
assert_nothing_raised do
|
||||
run_task
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def run_task
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue