Fix orders page

main
Ashelyn Dawn 5 years ago
parent 5b506417bc
commit b5da625585

@ -54,14 +54,19 @@ function getShippingEstimate(order){
} }
function getAmountPaid(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))) .reduce((a,b)=>(a+b)))
} }
function parsePaymentTime({payment}){ function parsePaymentTime({payments}){
if(typeof payment.time === 'string') for(const payment of payments) {
payment.time = DateTime.fromISO(payment.time) if(typeof payment.time === 'string')
return payment.time payment.time = DateTime.fromISO(payment.time)
}
payments.sort((a,b) => b.time.diff(a.time))
return payments[0].time
} }
function sortTransactions(a,b){ function sortTransactions(a,b){

Loading…
Cancel
Save