Skip to content

Commit

Permalink
Update src/cdk/v2/destinations/rakuten/utils.js
Browse files Browse the repository at this point in the history
Co-authored-by: Dilip Kola <[email protected]>
  • Loading branch information
anantjain45823 and koladilip authored Feb 5, 2024
1 parent 1b44237 commit 9de152a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/cdk/v2/destinations/rakuten/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,13 @@ const constructLineItems = (properties) => {

// Map 'amountList' by evaluating 'amount' or deriving it from 'price' and 'quantity'
const amountList = products.map((product) => {
if (!product.amount) {
if (product?.price) {
return product.quantity * product.price * 100;
}
if (!product?.amount && !product?.price) {
throw new InstrumentationError('Either amount or price is required for every product');
}

if (product.price) {
return product.quantity * product.price * 100;
}
return product.amount * 100;
});
productList.amtlist = amountList.join('|');
Expand Down

0 comments on commit 9de152a

Please sign in to comment.