mothership-ec/cog-mothership-fedex 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mothership-ec/cog-mothership-fedex

最新稳定版本:3.0.1

Composer 安装命令:

composer require mothership-ec/cog-mothership-fedex

包简介

Cog module for dispatching using Fedex

README 文档

README

The Message\Mothership\Fedex cogule provides Fedex integration for dispatching orders. It also provides new dispatch methods for these.

Installation

Install this package using Composer. The package name is mothership-ec/cog-mothership-fedex.

Dispatch methods

This cogule provides two dispatch methods that are added to the order.dispatch.methods service:

  • FedEx Express (fedex-express)
  • FedEx UK (fedex-uk)

Automated dispatch

This cogule integrates with the FedEx Express API and enables automatic dispatch for any dispatch using the type fedex-express.

It is important to note that there is no integration with FedEx UK as they are a totally separate entity and, at the time of writing this, don't have a suitable API for submitting shipments.

API

This cogule contains a small library for interacting with FedEx's SOAP API.

Configuration

There is a configuration fixture for this cogule. To connect to the FedEx API, you'll need to enter some authentication details in there. The base requirement is:

  • api-key - The API key provided by FedEx
  • api-password - The API password provided by FedEx
  • meter-number - The meter number to bill shipments to
  • account-number - The account number responsible for the shipments

For testing, it is possible to create an account on the FedEx Developer Website and generate these details.

Overview of the API library

The API library consists of three main parts:

  • Requests: These detail the request and request data to be sent to the FedEx API.
  • Responses: These detail the response back from the FedEx API for a request. They are defined by the corresponding request.
  • Dispatcher: This is responsible for handling requests, sending them to the FedEx API and returning the relevant response or throwing error exceptions.
  • Services: FedEx group their API into different "services". Each has their own WSDL endpoint. The request defined which service should be used.

You may also notice some references to something called a PreparedRequest. This is an implementation detail you shouldn't need to worry about as an API consumer, but it is essentially there so the API authentication and other top-level generic request data doesn't need to belong to every single Request class.

Events

Before an API request is made, the fedex.api.request event is dispatched. The event is an instance of Message\Mothership\Fedex\Api\Event\RequestEvent so listeners can inspect the request and call methods on it. This happens after the request is validated.

Once a response is received and has been validated an initialised, the fedex.api.response event is dispatched. The event is an instance of Message\Mothership\Fedex\Api\Event\ResponseEvent so the response can be inspected by listeners.

Uploading documents

There is an UploadDocuments request available which allows you to upload any document to the FedEx API and attach it to a shipment that you can submit later. Documents must be wrapped in the API's Document class so that the FedEx document identifier can be retrieved.

When the response has been successfully dispatched by the Dispatcher, the Response returned will have the documents and will have set the identifiers on them.

You can then add these Document instances to a Shipment you're about to submit using addDocument().

Generated Commercial Invoice

It is possible to request for FedEx to generate a commercial invoice for your shipment. This requires the shipper to be signed up for ETD (electronic trade documents) but it's generally a great idea because it saves on a lot of paper and it saves us having to make our own commercial invoices.

Mothership does not generate commercial invoices yet, so it's important to enable this.

To do so, just call requestGeneratedCommercialInvoice(true) on your Shipment instance.

WSDL files

Each service needs its own .wsdl file supplied by FedEx on their developer website. These are stored in /resources/wsdl and are referenced by their relevant service classes (instances of Message\Mothership\Fedex\Api\Service\ServiceInterface).

The endpoints are automatically changed by the API subsystem depending on the value of the test-mode property on the fedex configuration group. The endpoint for both live and test must be set on the service class in the getWsdlEndpoint() method. When adding a new service or .wsdl file, you can get these endpoints by looking at the bottom of the file and finding the value of the location attribute in service->port->address. The live URI will be on the ws.fedex.com host and test URIs will be on the wsbeta.fedex.com host.

mothership-ec/cog-mothership-fedex 适用场景与选型建议

mothership-ec/cog-mothership-fedex 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 186 次下载、GitHub Stars 达 1, 最近一次更新时间为 2015 年 02 月 25 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「products」 「orders」 「order」 「money」 「FedEx」 「dispatch」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 mothership-ec/cog-mothership-fedex 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 mothership-ec/cog-mothership-fedex 我们能提供哪些服务?
定制开发 / 二次开发

基于 mothership-ec/cog-mothership-fedex 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 186
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 21
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 3
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0
  • 更新时间: 2015-02-25