answear/acs-bundle

Symfony 对 ACS API 的扩展包。

安装数: 7,632

依赖关系: 0

建议者: 0

安全性: 0

星标: 0

关注者: 2

分支: 0

开放问题: 0

类型:symfony-bundle

2.1.1 2024-09-12 07:54 UTC

README

Symfony 的 ACS 取货点集成。

安装

  • 使用 Composer 安装
composer require git@github.com:answear/acs-bundle.git

Answear\AcsBundle\AnswearAcsBundle::class => ['all' => true],
应自动添加到您的 config/bundles.php 文件中,由 Symfony Flex 完成。

设置

  • 提供所需的配置数据:apiKeycompanyIduserIduserPassword
# config/packages/answear_acs.yaml
answear_gls:
    apiKey:
    companyId:
    companyPassword:
    userId:
    userPassword:
    language: //default GR

使用

获取包裹商店

/** @var \Answear\AcsBundle\Service\ParcelShopsService $parcelShopService **/
$parcelShopService->getList(CountryIdEnum $countryId, ?int $kind = null);

将返回 \Answear\AcsBundle\Response\DTO\ParcelShop[] 数组。

其中 countryId 是希腊或塞浦路斯,kind 是根据 ACS 文档的商店类型,null 表示所有类型

错误处理

  • Answear\AcsBundle\Exception\ServiceUnavailable 用于所有 GuzzleException
  • Answear\AcsBundle\Exception\MalformedResponse 用于不正确的响应

最后的话

请随意提交包含新功能、改进或错误修复的 pull request。Answear 团队将非常感激任何评论。