gwinn / boxberry-sdk

Boxberry API实现

v1.0.5 2024-06-21 13:07 UTC

This package is auto-updated.

Last update: 2024-09-21 13:41:39 UTC


README

Build Status Coverage PHP from Packagist Latest stable

Boxberry快递SDK服务

方法

  • ListCities. 配送城市列表
  • ListCitiesFull. 配送城市列表(完整版)
  • ListPoints. 自提点列表
  • ListPointsShort. 所有Boxberry自提点代码及其最后更新日期
  • PointsDescription. 自提点详细信息
  • PointsForParcels. 邮包接收点列表
  • ListZips. 快递单邮政编码列表
  • ZipCheck. 快递单邮政编码检查
  • CourierListCities. 快递城市列表
  • DeliveryCosts. 运费计算器
  • DeliveryCalculation. 新的运费计算器(俄罗斯/欧亚经济联盟国家)
  • ParselCreate. 创建/更新订单
  • ParselSend. 形成包裹接收-交付单
  • CancelOrder. 取消或删除包裹
  • ChangeOrderDetails. 修改包裹数据
  • ChangeOrderStorageDate. 修改包裹存储期限
  • ChangeOrderIssue. 修改包裹领取类型
  • ChangeOrderDeliveryType. 修改配送参数
  • CreateIntake. 创建快递员取件申请
  • ListStatuses. 包裹状态
  • ListStatusesFull. 包裹状态详细列表
  • ListServices. 计算已收费服务
  • ParselCheck. 打印标签链接
  • ParselStory. 包裹跟踪码列表及其详细信息
  • ParselSendStory. 已创建的接收-交付单列表
  • OrdersBalance. 实际已交付但尚未送达客户的订单信息
  • ParselList. 未包含在接收-交付单中的跟踪码列表
  • ParcelInfo. 获取订单信息
  • WarehouseCreate. 添加仓库
  • WarehouseDelete. 删除仓库
  • WarehouseInfo. 仓库信息
  • WarehouseUpdate. 更新仓库

要求

PHP 7.3或更高版本。

安装

composer require Gwinn/boxberry-sdk

使用示例

$yourHttpClientFactory = new \Gwinn\Boxberry\Factory\HttpClientFactory();
$apiClientFactory = new \Gwinn\Boxberry\Factory\ApiClientFactory($yourHttpClientFactory);
$boxberryClient = $apiClientFactory->create(API_TOKEN);

$listCitiesRequest = new \Gwinn\Boxberry\Model\Request\Geography\ListCitiesRequest();
$listCitiesRequest->countryCode = '643';

try{
    // получение городов
    $response = $boxberryClient->listCities($listCitiesRequest);
}catch (ApiException $exception){
    echo $exception->getMessage();
    exit(255);
}
$yourHttpClientFactory = new \Gwinn\Boxberry\Factory\HttpClientFactory();
$apiClientFactory = new \Gwinn\Boxberry\Factory\ApiClientFactory($yourHttpClientFactory);
$boxberryClient = $apiClientFactory->create(API_TOKEN);

$parcel = new \Gwinn\Boxberry\Model\Request\OrderInfo\ParcelInfoRequest\Parcel();
$parcel->orderId = '123';
$parcelInfoRequest = new \Gwinn\Boxberry\Model\Request\OrderInfo\ParcelInfoRequest();
$parcelInfoRequest->parcels = [$parcel];

try{
    // получение информации о посылке
    $response = $boxberryClient->parcelInfo($parcelInfoRequest);
}catch (ApiException $exception){
    echo $exception->getMessage();
    exit(255);
}