29 lines
912 B
JavaScript
29 lines
912 B
JavaScript
export function formatMoney(amount, currency) {
|
|
return new Intl.NumberFormat("de-DE", {
|
|
style: "currency",
|
|
currency,
|
|
}).format(amount);
|
|
}
|
|
|
|
export function orderSummaryRows(order) {
|
|
return [
|
|
["Paket", order.type],
|
|
["Paket-ID", order.packageId],
|
|
...(order.variantId
|
|
? [
|
|
["Variante", order.variantLabel],
|
|
["Varianten-ID", order.variantId],
|
|
]
|
|
: []),
|
|
["Laufzeit", order.durationLabel || `${order.durationWeeks} Wochen`],
|
|
["Menge", String(order.quantity)],
|
|
["Abrechnung", order.billingInterval],
|
|
["Nettopreis", formatMoney(order.netPrice, order.currency)],
|
|
[
|
|
`MwSt. (${order.taxRate} %)`,
|
|
formatMoney(order.taxAmount, order.currency),
|
|
],
|
|
["Gesamtbetrag", formatMoney(order.grossPrice, order.currency)],
|
|
];
|
|
}
|