Skip to content

Instantly share code, notes, and snippets.

@eujc21
Created September 14, 2015 19:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eujc21/6f360ba27b625ce62b4d to your computer and use it in GitHub Desktop.
Save eujc21/6f360ba27b625ce62b4d to your computer and use it in GitHub Desktop.
Easypost - async on meteor --production issue.
var createShippingWrap = Async.wrap(easypost.Shipment.create);
_(products).each(function(keys,index){
qty = parseFloat(keys.qty).toFixed(2);
weight += keys.weight * (1);
});
parcel.weight = parseFloat(weight);
try{
var result = createShippingWrap({
to_address:easy.toAddress,
from_address:easy.fromAddress,
parcel:parcel
});
result.buy({rate:result.lowestRate(['USPS'],['Priority'])},
Meteor.bindEnvironment(function (err,shipment){
ShipmentLabelAppended.insert({invoiceId:sess_id,label:shipment.postage_label.label_url});
}));
}
catch(error){
console.log("error",error);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment