lochinvarwest/rush-ecommerce-api
Composer 安装命令:
composer require lochinvarwest/rush-ecommerce-api
包简介
A Laravel package to interface with the Rush Ecommerce API
README 文档
README
- This package handles the transport layer between your application and the Rush E-Commerce API ( https://www.rush.co.za ).
- It does not help create / format the body / packets sent to Rush. Please refer to the Rush E-Commerce API documentation for the required fields and formats.
- This package does however encode the packets passed to it into JSON, so please pass your arguments as arrays where applicable.
- You will require a Rush E-Commerce API account to get the API Auth Token.
Installation
- Run the following in your project root
composer require "lochinvarwest/rush-ecommerce-api:^0.1"
Publish the config file
php artisan vendor:publish --provider="LochinvarWest\Rush\RushServiceProvider" --tag="config"
Update the config settings.
- Update the config settings in config/rushecommerce.php or insert the relevant .env variables.
return [
'account' => [
'token' => env('RUSH_AUTHTOKEN', null),
'account_email' => env('RUSH_ACCOUNT_EMAIL', null),
]
];
Usage
- Standalone using the Handler.
$handler = RushHandler::create();
// or to override the default account in the config
$handler = RushHandler::create(['token' => $token, 'account_email' => $account_email]);
// then
$handler->getQuotes($deliveryDetails); //for instance
- Using method injection with container registration from the service provider.
class RushController
{
public function index(RushHandler $handler)
{
$handler->getQuotes($deliveryDetails);
}
}
Available API calls:
getQuotes($deliveryDetails)
$deliveryDetails is an array (not json) as per the Rush API documentation (including all volumetric data, pick up, drop off details).
The function returns an object (RushObject) of the reply or throws a RushException with the relevant API or transport error message.
$handler->getQuotes($deliveryDetails);
Or to select the cheapest / fastest quote:
$handler->getQuotes($deliveryDetails)->cheapest();
$handler->getQuotes($deliveryDetails)->fastest();
confirmBooking($bookingDetail)
$bookingDetails is an array of as per the Rush API documentation (all volumetric data, supplier and delivery address along with selected carrier service).
The function returns a 'success' object with the waybill number or throws a RushException with the relevant API or transport error message.
$handler->confirmBooking($bookingDetail);
getPdfWaybill($waybillNumbers)
$waybillNumbers is an array of waybill numbers.
$handler->getPdfWaybill(['waybills' => [] ]);
The function returns an array of objects of URL's to the PDF waybills or throws a RushException with the relevant API or transport error message.
trackWaybill($waybillNumber)
$waybillNumber is the number received from a confirmBooking call.
The function returns an array of the tracking information or throws a RushException with the relevant API or transport error message.
$handler->trackWaybill($waybillNumber);
addressListings()
This function simply returns the JSON list of valid SUBURB-TOWN-POSTCODE address combinations for getting quotes or making bookings on the Rush API. (there are ~20 000 of them)
$handler->addressListings();
lochinvarwest/rush-ecommerce-api 适用场景与选型建议
lochinvarwest/rush-ecommerce-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 08 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 lochinvarwest/rush-ecommerce-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 lochinvarwest/rush-ecommerce-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2020-08-11