Skip to content

Commit

Permalink
fix(payments-plugin): only add already paid when it has a value
Browse files Browse the repository at this point in the history
  • Loading branch information
martijnvdbrug committed Oct 17, 2023
1 parent b33a3ed commit 8c20a11
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions packages/payments-plugin/src/mollie/mollie.helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,16 @@ export function toMollieOrderLines(order: Order, alreadyPaid: number): CreatePar
vatAmount: toAmount(surcharge.priceWithTax - surcharge.price, order.currencyCode),
})));
// Deduct amount already paid
lines.push({
name: 'Already paid',
quantity: 1,
unitPrice: toAmount(-alreadyPaid, order.currencyCode),
totalAmount: toAmount(-alreadyPaid, order.currencyCode),
vatRate: String(0),
vatAmount: toAmount(0, order.currencyCode),
});
if (alreadyPaid) {
lines.push({
name: 'Already paid',
quantity: 1,
unitPrice: toAmount(-alreadyPaid, order.currencyCode),
totalAmount: toAmount(-alreadyPaid, order.currencyCode),
vatRate: String(0),
vatAmount: toAmount(0, order.currencyCode),
});
}
return lines;
}

Expand Down

0 comments on commit 8c20a11

Please sign in to comment.