Skip to content

Commit

Permalink
Add logging when taxRate is not provided by Vertex or couldn't serial…
Browse files Browse the repository at this point in the history
…ize by mapper
  • Loading branch information
vlaskhilkevich committed Jul 26, 2024
1 parent da166bc commit 36a731c
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ private InvoiceItem createTaxInvoiceItem(final InvoiceItem taxableItem, final UU
}

if (taxRate == null) {
logger.info("The tax rate is not provided in the Vertex response for the tax item with ID: {} and calculated tax: {}", taxItem.getId(), calculatedTax);
taxRate = calculatedTax.divide(taxableItem.getAmount(), 5, RoundingMode.HALF_UP).doubleValue();
}

Expand Down Expand Up @@ -363,7 +364,8 @@ private InvoiceItem createTaxInvoiceItem(final InvoiceItem taxableItem, final UU
private String createTaxItemDetails(@Nonnull final Map<String, Object> taxItemDetails) {
try {
return objectMapper.writeValueAsString(taxItemDetails);
} catch (JsonProcessingException ignored) {
} catch (JsonProcessingException exception) {
logger.error("Couldn't serialize the tax item details: {}", taxItemDetails, exception);
return null;
}
}
Expand Down

0 comments on commit 36a731c

Please sign in to comment.