|
|
|
@ -261,10 +261,10 @@ order.addPayment = async function(transaction, paymentIntent){
|
|
|
|
|
return order
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
order.setTracking = (uuid, trackingCode, shipDate) =>
|
|
|
|
|
order.setTracking = (uuid, trackingCode, shipDate, price_cents) =>
|
|
|
|
|
dbUtil.executeFunction({
|
|
|
|
|
name: 'set_delivery_tracking',
|
|
|
|
|
params: [uuid, trackingCode, shipDate],
|
|
|
|
|
params: [uuid, trackingCode, shipDate, price_cents],
|
|
|
|
|
returnType: 'order',
|
|
|
|
|
single: true
|
|
|
|
|
})
|
|
|
|
@ -298,13 +298,15 @@ order.shipEasyPost = async ( uuid, length, width, height, weight ) => {
|
|
|
|
|
await epShipment.save()
|
|
|
|
|
|
|
|
|
|
// Purchase shipment (lowest USPS rate)
|
|
|
|
|
const {tracking_code, id: easypost_id}
|
|
|
|
|
const {tracking_code, id: easypost_id, selected_rate: {rate: price_string}}
|
|
|
|
|
= await epShipment.buy(epShipment.lowestRate(['USPS']))
|
|
|
|
|
|
|
|
|
|
const price_cents = Math.floor(parseFloat(price_string) * 100)
|
|
|
|
|
|
|
|
|
|
// Save tracking code and easypost id
|
|
|
|
|
return await dbUtil.executeFunction({
|
|
|
|
|
name: 'set_delivery_easypost',
|
|
|
|
|
params: [uuid, easypost_id, tracking_code],
|
|
|
|
|
params: [uuid, easypost_id, tracking_code, price_cents],
|
|
|
|
|
returnType: 'order',
|
|
|
|
|
single: true
|
|
|
|
|
})
|
|
|
|
|