export function createOrder(cart, customer) {
const lines = cart.items.map(toLine);
const total = lines.reduce((sum, line) => sum + line.amount, 0);
return { id: nextId(), customer, lines, total };
}
function toLine(item) {
return { sku: item.sku, qty: item.qty, amount: item.qty * item.price };
}