Skip to content

Commit

Permalink
fix: check if property is present
Browse files Browse the repository at this point in the history
  • Loading branch information
shanikantsingh committed Apr 22, 2024
1 parent 43c8f6a commit 5995172
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,14 @@ function getLineItems({ Order: order, Basket: basket }) {
const quantity = LineItemHelper.getQuantity(lineItem);
const itemAmount = LineItemHelper.getItemAmount(lineItem).divide(quantity);
const vatAmount = LineItemHelper.getVatAmount(lineItem).divide(quantity);
let category = PAYPAL_ITEM_CATEGORY[0];
if (lineItem.hasOwnProperty('category')) {
category = PAYPAL_ITEM_CATEGORY.indexOf(lineItem.category) > -1 ? lineItem.category : PAYPAL_ITEM_CATEGORY[0]
}
return {
quantity: quantity,
description: description,
itemCategory: PAYPAL_ITEM_CATEGORY.indexOf(lineItem.category) > -1 ? lineItem.category : PAYPAL_ITEM_CATEGORY[0],
itemCategory: category,
sku: id,
amountExcludingTax: itemAmount.getValue().toFixed(),
taxAmount: vatAmount.getValue().toFixed()
Expand Down

0 comments on commit 5995172

Please sign in to comment.