use of org.folio.rest.impl.InvoiceHelper in project mod-invoice by folio-org.
the class CreateInvoiceEventHandler method saveInvoice.
private CompletableFuture<Invoice> saveInvoice(DataImportEventPayload dataImportEventPayload, Map<String, String> okapiHeaders) {
Invoice invoiceToSave = Json.decodeValue(dataImportEventPayload.getContext().get(INVOICE.value()), Invoice.class);
invoiceToSave.setSource(Invoice.Source.EDI);
InvoiceHelper invoiceHelper = new InvoiceHelper(okapiHeaders, Vertx.currentContext(), DEFAULT_LANG);
return invoiceHelper.createInvoice(invoiceToSave).whenComplete((invoice, throwable) -> {
if (throwable == null) {
dataImportEventPayload.getContext().put(INVOICE.value(), Json.encode(invoice));
return;
}
logger.error("Error during creation invoice in the storage", throwable);
});
}
Aggregations