From 00d97aac066039338b90b58f080d53319b0f4843 Mon Sep 17 00:00:00 2001 From: olegphenomenon Date: Thu, 1 Sep 2022 13:59:26 +0300 Subject: [PATCH] fixed tests --- app/models/bank_transaction.rb | 2 +- app/services/eis_billing/add_deposits.rb | 1 + test/models/bank_transaction_test.rb | 6 ++++++ test/system/admin_area/bank_statement_test.rb | 3 +++ test/tasks/invoices/process_payments_test.rb | 6 ++++++ 5 files changed, 17 insertions(+), 1 deletion(-) diff --git a/app/models/bank_transaction.rb b/app/models/bank_transaction.rb index 91429d40c2..ef2ab33708 100644 --- a/app/models/bank_transaction.rb +++ b/app/models/bank_transaction.rb @@ -48,7 +48,7 @@ def create_internal_payment_record(invoice:, registrar:, channel: nil) if create_activity(registrar, invoice) payment_order.paid! EisBilling::SendInvoiceStatus.send_info(invoice_number: invoice.number, - status: 'paid') + status: 'paid') else payment_order.update(notes: 'Failed to create activity', status: 'failed') end diff --git a/app/services/eis_billing/add_deposits.rb b/app/services/eis_billing/add_deposits.rb index c9a47d360e..3ccd2db881 100644 --- a/app/services/eis_billing/add_deposits.rb +++ b/app/services/eis_billing/add_deposits.rb @@ -21,6 +21,7 @@ def parse_invoice data[:custom_field1] = invoice.description data[:custom_field2] = INITIATOR data[:invoice_number] = invoice.number + data[:reference_number] = invoice.reference_no data end diff --git a/test/models/bank_transaction_test.rb b/test/models/bank_transaction_test.rb index 8cb62ab48b..e4a66c296d 100644 --- a/test/models/bank_transaction_test.rb +++ b/test/models/bank_transaction_test.rb @@ -4,6 +4,12 @@ class BankTransactionTest < ActiveSupport::TestCase setup do @registrar = registrars(:bestnames) @invoice = invoices(:one) + + response_message = { + message: 'got it' + } + stub_request(:post, 'https://eis_billing_system:3000/api/v1/invoice_generator/invoice_status') + .to_return(status: 200, body: response_message.to_json, headers: {}) end def test_matches_against_invoice_nubmber_and_reference_number diff --git a/test/system/admin_area/bank_statement_test.rb b/test/system/admin_area/bank_statement_test.rb index f86e6ef53c..325577694a 100644 --- a/test/system/admin_area/bank_statement_test.rb +++ b/test/system/admin_area/bank_statement_test.rb @@ -7,6 +7,9 @@ class AdminAreaBankStatementTest < ApplicationSystemTestCase @invoice = invoices(:one) Spy.on_instance_method(EisBilling::BaseController, :authorized).and_return(true) + response_message = { message: 'got it' } + stub_request(:post, 'https://eis_billing_system:3000/api/v1/invoice_generator/invoice_status') + .to_return(status: 200, body: response_message.to_json, headers: {}) end def test_update_bank_statement diff --git a/test/tasks/invoices/process_payments_test.rb b/test/tasks/invoices/process_payments_test.rb index 60ef3d8d8d..15a9bb2a3b 100644 --- a/test/tasks/invoices/process_payments_test.rb +++ b/test/tasks/invoices/process_payments_test.rb @@ -16,6 +16,12 @@ class ProcessPaymentsTaskTest < ActiveJob::TestCase @account_activity = account_activities(:one) @account = accounts(:cash) + response_message = { + message: 'got it' + } + stub_request(:post, 'https://eis_billing_system:3000/api/v1/invoice_generator/invoice_status') + .to_return(status: 200, body: response_message.to_json, headers: {}) + Setting.registry_iban = beneficiary_iban Lhv::ConnectApi.class_eval do