Skip to content

Commit

Permalink
Merge pull request #2427 from internetee/lhv-connect-does-not-process…
Browse files Browse the repository at this point in the history
…-payments

added send invoice status during payment order paying
  • Loading branch information
vohmar authored Sep 2, 2022
2 parents 3ae8993 + 00d97aa commit 2bc1a55
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/models/bank_transaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ 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')
else
payment_order.update(notes: 'Failed to create activity', status: 'failed')
end
Expand Down
1 change: 1 addition & 0 deletions app/services/eis_billing/add_deposits.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions test/models/bank_transaction_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions test/system/admin_area/bank_statement_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions test/tasks/invoices/process_payments_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2bc1a55

Please sign in to comment.