codenet/kk-client

dev-master 2017-01-31 22:29 UTC

This package is not auto-updated.

Last update: 2024-09-26 00:19:41 UTC


README

实现的方法

以下是实现API方法的列表

  • /api/login
  • /api/checkPrices
  • /api/checkData
  • /api/makeOrder
  • /api/orders
  • /api/inpostMachines
  • /api/label
  • /api/labelZebra

示例用法

use CodeNet\KKClient\KKClient;

$client = new KKClient($password, $password);
$client->setSessionId($sessionId); // optionally reuse previous session identifier if there is one
$order = $client->createOrder([
    'courierId' => '5'
    // ...
    // order data according to API docs
]);
// alternatively, a request could be CreateOrderRequest object
$request = new CreateOrderRequest();
$request->setCourier($courier); // where $courier could be Courier object or courier ID
// $request->set...

$order = $client->createOrder($request);

echo "Created order #" . $order->getOrderId() . EOL;

测试

  • 将 tests/config.php.dist 复制到 tests/config.php
  • 填写测试环境凭据
  • 运行 phpunit