|
|
|
@ -283,17 +283,15 @@ order.setDelivery = (uuid, description, deliveryDate) =>
|
|
|
|
|
order.shipEasyPost = async ( uuid, length, width, height, weight ) => {
|
|
|
|
|
// Retrieve address
|
|
|
|
|
const {address} = await order.findByUUID(uuid)
|
|
|
|
|
const {shipping_from} = await config.getLatestConfig()
|
|
|
|
|
|
|
|
|
|
if(!shipping_from?.easypost_id)
|
|
|
|
|
throw new Error("Cannot ship - no from address set in config")
|
|
|
|
|
|
|
|
|
|
// Create shipment
|
|
|
|
|
const epShipment = new easypost.Shipment({
|
|
|
|
|
to_address: address.easypost_id,
|
|
|
|
|
from_address: {
|
|
|
|
|
street1: '11381 N. Sampson Drive',
|
|
|
|
|
city: 'Highland',
|
|
|
|
|
state: 'UT',
|
|
|
|
|
zip: '84003',
|
|
|
|
|
country: 'US'
|
|
|
|
|
},
|
|
|
|
|
from_address: shipping_from.easypost_id,
|
|
|
|
|
parcel: {length, width, height, weight}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|