Created
September 14, 2015 19:28
-
-
Save eujc21/6f360ba27b625ce62b4d to your computer and use it in GitHub Desktop.
Easypost - async on meteor --production issue.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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