Fix orders page

main
Ashelyn Dawn 5 years ago
parent 5b506417bc
commit b5da625585

@ -54,14 +54,19 @@ function getShippingEstimate(order){
}
function getAmountPaid(order){
return formatMoney(order.transactions.map(({payment}) => payment.value_cents)
return formatMoney(order.transactions.map(({payments}) => payments.map(payment => payment.value_cents))
.flat()
.reduce((a,b)=>(a+b)))
}
function parsePaymentTime({payment}){
if(typeof payment.time === 'string')
payment.time = DateTime.fromISO(payment.time)
return payment.time
function parsePaymentTime({payments}){
for(const payment of payments) {
if(typeof payment.time === 'string')
payment.time = DateTime.fromISO(payment.time)
}
payments.sort((a,b) => b.time.diff(a.time))
return payments[0].time
}
function sortTransactions(a,b){

Loading…
Cancel
Save