From e240d378eb2332e1dc756ab7a957944e2ca6206d Mon Sep 17 00:00:00 2001 From: Andrzej Krzywda Date: Mon, 18 Dec 2023 15:12:44 +0100 Subject: [PATCH] Invoiced read model wasn't ready for async Reverted this to sync jobs. Otherwise it created many invoice records per one order. This resulted in a user bug, where providing billing address didnt allow issuing an invoice. Hard to write tests for this - maybe we should use "real" sidekiq in integration tests? --- .../app/read_models/invoices/configuration.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rails_application/app/read_models/invoices/configuration.rb b/rails_application/app/read_models/invoices/configuration.rb index c5558c9bb..eb2d45e96 100644 --- a/rails_application/app/read_models/invoices/configuration.rb +++ b/rails_application/app/read_models/invoices/configuration.rb @@ -15,11 +15,11 @@ class Order < ApplicationRecord class Configuration def call(event_store) - event_store.subscribe(CreateInvoiceItem, to: [Invoicing::InvoiceItemAdded]) - event_store.subscribe(SetBillingAddress, to: [Invoicing::BillingAddressSet]) - event_store.subscribe(SetPaymentDate, to: [Invoicing::InvoicePaymentDateSet]) - event_store.subscribe(MarkAsIssued, to: [Invoicing::InvoiceIssued]) - event_store.subscribe(MarkOrderSubmitted, to: [Ordering::OrderSubmitted]) + event_store.subscribe(CreateInvoiceItem.new, to: [Invoicing::InvoiceItemAdded]) + event_store.subscribe(SetBillingAddress.new, to: [Invoicing::BillingAddressSet]) + event_store.subscribe(SetPaymentDate.new, to: [Invoicing::InvoicePaymentDateSet]) + event_store.subscribe(MarkAsIssued.new, to: [Invoicing::InvoiceIssued]) + event_store.subscribe(MarkOrderSubmitted.new, to: [Ordering::OrderSubmitted]) end end end