如何使用 NodeJS 计算 UPS 运费?
我正在使用 NodeJS 和 MongoDB 开发一个公共电子商务网站,并且我使用 Forever 而不是 nginx 或类似的东西。 (请让我知道我这样做是否完全疯了,以及为什么在我走得太远之前:)
作为这个网站的一部分,我需要计算运费,但我需要知道这些数字是准确的,因为我想结帐时向顾客收费。
我如何使用 Node.js 进行设置?
我有一个解决方案,但我不能保证它是准确的。有人使用 Node 处理过 UPS API 吗?
预先感谢您的帮助
I'm developing a public e-commerce site in NodeJS and MongoDB, and I'm using forever instead of nginx or anything like that. (please let me know if I'm totally insane for doing this and why before I get too far along :)
As part of this site I need to calculate shipping, but I need to know that the numbers are spot on because I want to charge customers at checkout.
How could I set this up with Node.js?
I kind of have one solution, but I have no guarantee that it's accurate. Has anyone dealt with the UPS APIs using Node?
Thanks in advance for your help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
一位名叫 Jesse D. Pate 的人开发了本地 UPS API。我不知道这是否值得,但是 github 存储库位于此处,并且可以安装并使用它与过孔
Someone named Jesse D. Pate has developed a native UPS API. I have no idea if it's worthwhile, but the github repo is here, and it can be installed and toyed around with via
我想我已经弄清楚了......现在开始一个 Github 项目
这是一种通用的方法:
我修改了
./RatingPackage/PACKAGEXMLTools/Rate_Tool_SampleRequest.xml
以包含我的信息然后我将其保存为testRequest.xml
然后将其发布到 https://wwwcie.ups.com/ups.app/xml/Rate(他们的测试服务器)使用命令,它返回一个 XML 文档,然后可以将其转换为(高级)json 格式并在 Web 应用程序中使用。
I think I've got it figured out ...now to start a Github project
This is a universal way to do it:
I modified the
./RatingPackage/PACKAGEXMLTools/Rate_Tool_SampleRequest.xml
to include my information then I saved it astestRequest.xml
then I posted it to https://wwwcie.ups.com/ups.app/xml/Rate (their test server) using the commandand it returns an XML document that can then be converted to the (superior) json format and used in a web app.
我开发了一个节点模块,支持 UPS API 的更多功能(并将继续改进)。使用此模块,您可以提供评级信息、创建货件、生成标签、作废货件、跟踪货件以及执行地址验证。
查看:
npm install Shipping-ups
在此处阅读文档:https:/ /github.com/typefoo/node-shipping-ups
I developed a node module with support for more functionality (and will continue improving) of the UPS API. With this module you can provide rating information, create a shipment, produce a label, void a shipment, track shipments, and perform address validation.
Check it out:
npm install shipping-ups
Read docs here: https://github.com/typefoo/node-shipping-ups