diff --git a/src/main/java/org/folio/service/InvoiceLineStorageService.java b/src/main/java/org/folio/service/InvoiceLineStorageService.java index 1dc44bc..9dd7ce0 100644 --- a/src/main/java/org/folio/service/InvoiceLineStorageService.java +++ b/src/main/java/org/folio/service/InvoiceLineStorageService.java @@ -35,11 +35,11 @@ public void createInvoiceLine(InvoiceLine invoiceLine, Handler invoiceLinesDAO.createInvoiceLine(invoiceLine, conn) - .compose(invoiceLineId -> auditOutboxService.saveInvoiceLineOutboxLog(conn, invoiceLine, InvoiceLineAuditEvent.Action.CREATE, headers)) - .compose(v -> auditOutboxService.processOutboxEventLogs(headers, vertxContext))) + .compose(invoiceLineId -> auditOutboxService.saveInvoiceLineOutboxLog(conn, invoiceLine, InvoiceLineAuditEvent.Action.CREATE, headers))) .onSuccess(s -> { log.info("createInvoiceLine:: Successfully created a new invoiceLine by id: {}", invoiceLine.getId()); asyncResultHandler.handle(buildResponseWithLocation(headers.get(OKAPI_URL), INVOICE_LINES_PREFIX + invoiceLine.getId(), invoiceLine)); + auditOutboxService.processOutboxEventLogs(headers, vertxContext); }) .onFailure(f -> { log.error("Error occurred while creating a new invoiceLine with id: {}", invoiceLine.getId(), f); @@ -55,11 +55,11 @@ public void updateInvoiceLine(String id, InvoiceLine invoiceLine, Map invoiceLinesDAO.updateInvoiceLine(id, invoiceLine, conn) - .compose(invoiceLineId -> auditOutboxService.saveInvoiceLineOutboxLog(conn, invoiceLine, InvoiceLineAuditEvent.Action.EDIT, headers)) - .compose(v -> auditOutboxService.processOutboxEventLogs(headers, vertxContext))) + .compose(invoiceLineId -> auditOutboxService.saveInvoiceLineOutboxLog(conn, invoiceLine, InvoiceLineAuditEvent.Action.EDIT, headers))) .onSuccess(s -> { log.info("updateInvoiceLine:: Successfully updated invoice line with id: {}", id); asyncResultHandler.handle(buildNoContentResponse()); + auditOutboxService.processOutboxEventLogs(headers, vertxContext); }) .onFailure(f -> { log.error("Error occurred while updating invoice line with id: {}", id, f); diff --git a/src/main/java/org/folio/service/InvoiceStorageService.java b/src/main/java/org/folio/service/InvoiceStorageService.java index 7f6a89c..2c7d2d1 100644 --- a/src/main/java/org/folio/service/InvoiceStorageService.java +++ b/src/main/java/org/folio/service/InvoiceStorageService.java @@ -49,11 +49,11 @@ public void postInvoiceStorageInvoices(Invoice invoice, Handler invoiceDAO.createInvoice(invoice, conn) - .compose(invoiceId -> auditOutboxService.saveInvoiceOutboxLog(conn, invoice, InvoiceAuditEvent.Action.CREATE, headers)) - .compose(v -> auditOutboxService.processOutboxEventLogs(headers, vertxContext))) + .compose(invoiceId -> auditOutboxService.saveInvoiceOutboxLog(conn, invoice, InvoiceAuditEvent.Action.CREATE, headers))) .onSuccess(s -> { log.info("postInvoiceStorageInvoices:: Successfully created a new invoice by id: {}", invoice.getId()); asyncResultHandler.handle(buildResponseWithLocation(headers.get(OKAPI_URL), INVOICE_PREFIX + invoice.getId(), invoice)); + auditOutboxService.processOutboxEventLogs(headers, vertxContext); }) .onFailure(f -> { log.error("Error occurred while creating a new invoice with id: {}", invoice.getId(), f); @@ -69,11 +69,11 @@ public void putInvoiceStorageInvoicesById(String id, Invoice invoice, Map invoiceDAO.updateInvoice(id, invoice, conn) - .compose(invoiceId -> auditOutboxService.saveInvoiceOutboxLog(conn, invoice, InvoiceAuditEvent.Action.EDIT, headers)) - .compose(v -> auditOutboxService.processOutboxEventLogs(headers, vertxContext))) + .compose(invoiceId -> auditOutboxService.saveInvoiceOutboxLog(conn, invoice, InvoiceAuditEvent.Action.EDIT, headers))) .onSuccess(s -> { log.info("putInvoiceStorageInvoicesById:: Successfully updated invoice with id: {}", id); asyncResultHandler.handle(buildNoContentResponse()); + auditOutboxService.processOutboxEventLogs(headers, vertxContext); }) .onFailure(f -> { log.error("Error occurred while updating invoice with id: {}", id, f);