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