sf4/omnivabundle

与 Omniva API 通信的库

v1.6 2018-09-05 11:07 UTC

This package is not auto-updated.

Last update: 2024-09-27 16:10:51 UTC


README

PHP 用于快递的封装 Omniva 集成

Build Status Maintainability Total Downloads

SensioLabsInsight Scrutinizer Code Quality

示例

$client = new \SoapClient('https://edixml.post.ee/epmx/services/messagesService.wsdl', array('login' => 'xxx', 'password' => 'xxx'));
/** @noinspection PhpUndefinedMethodInspection */
$request = $client->preSendMsg([
    'partner' => '24432',
    'interchange' => [
        'header' => [
            'file_id' => date('Ymd'),
            'sender_cd' => '24432'
        ],
        'item_list' => [
            [
                'id' => 'JJEE2443256789',
                'service' => 'PU',
                'comment' =>  "Comment",
                'receiverAddressee' => [
                    'person_name' => "xxx xxx",
                    'mobile' => '+372xxx',
                    'address' => ['offloadPostcode' => '96079'],
                ],
                'measures' => ['weight' => '0'],
                'add_service' => [
                    'option' => ['code' => 'ST'],
                ],
            ],
        ],
    ],
]);

获取标签

返回带有编码 PDF 及条码的标签响应(stdClass 对象)。要查看响应结构,请参考 getLabel 的 phpdoc。

$client = new Client($username, $password);
$client->getLabel($parcel);

获取取货点列表

此端点返回取货点列表。取货点可以是终端或邮局。字段 类型 决定字段是 终端(类型:0)还是 邮局(类型:1)。

// username & password is not necessary for pickup points
$client = new Client($username, $password);

$points = $client->getPickupPoints();

进一步开发的想法

  • 实现 Client 跟踪
  • 添加 Symfony\Constraint 用于数据验证