Lue dans les fichiers PHP du paquet au commit 06d458129418 : ses espaces de noms, classes, interfaces et énumérations, leurs constantes, propriétés et méthodes publiques avec leur PHPDoc, et les options que prennent ses fabriques. Rien n’en est exécuté.
ApiclassZTO's open platform (japi.zto.com): one path per message type, the JSON body signed with x-dataDigest = base64(md5(body + key)) and the company id in x-companyId.
3 methods · 3 properties · 2 constants
ZtoExpressGatewayFactoryclassoptions: company_id: '%env(ZTO_COMPANY_ID)%' # the open platform's company id key: '%env(ZTO_KEY)%' # its key partner_code: null # the 合作商编码 for electronic waybills sandbox: true rates: [...] # prices from configuration: ZTO quotes by contract
8 options
CancelActionclasszto.open.cancelOrder, by the bill code.
3 methods
ShippingActionclasszto.open.createOrder: the order with an electronic waybill (partner code), its bill code; the label as ZTO's print data.
3 methods
TrackingActionclasszto.open.getTraceInfo: the bill's traces, oldest first.
3 methods
Omnibus\ZtoExpress
Api class
final class Api Api.php:15
ZTO's open platform (japi.zto.com): one path per message type, the JSON body signed with x-dataDigest = base64(md5(body + key)) and the company id in x-companyId.
const LIVE = 'https://japi.zto.com'const TEST = 'https://japi-test.zto.com'public readonly string $companyIdpublic readonly ?string $partnerCodepublic readonly bool $sandbox
Api::__construct()
public function __construct(readonly HttpClientInterface $http, public readonly string $companyId, readonly string $key, public readonly ?string $partnerCode = null, public readonly bool $sandbox = false, readonly int $timeout = 20)Api::call()
public function call(string $msgType, array $data): array- Returns
the result
Api::digest()
public static function digest(string $body, string $key): stringZtoExpressGatewayFactory class
final class ZtoExpressGatewayFactory extends GatewayFactory ZtoExpressGatewayFactory.php:22
options: company_id: '%env(ZTO_COMPANY_ID)%' # the open platform's company id key: '%env(ZTO_KEY)%' # its key partner_code: null # the 合作商编码 for electronic waybills sandbox: true rates: [...] # prices from configuration: ZTO quotes by contract
No pickup points. Unverified until an account's keys are at hand.
Options
| Option | Default | |
|---|---|---|
partner_code | null | |
sandbox | false | |
omnibus.api | function (Config $c) {
$http = $this->http ?? HttpClient::create();
return new Api($http, (string) $c['company_id'], (string) $c['key'], $c['partner_… | |
omnibus.action.shipping | new ShippingAction() | |
omnibus.action.tracking | new TrackingAction() | |
omnibus.action.cancel | new CancelAction() | |
company_id | required | |
key | required |
Omnibus\ZtoExpress\Action
CancelAction class
final class CancelAction implements ActionInterface, ApiAwareInterface CancelAction.php:13
zto.open.cancelOrder, by the bill code.
CancelAction::__construct()
public function __construct()CancelAction::supports()
public function supports(Request $request): boolCancelAction::execute()
public function execute(Request $request): voidShippingAction class
final class ShippingAction implements ActionInterface, ApiAwareInterface ShippingAction.php:16
zto.open.createOrder: the order with an electronic waybill (partner code), its bill code; the label as ZTO's print data.
ShippingAction::__construct()
public function __construct()ShippingAction::supports()
public function supports(Request $request): boolShippingAction::execute()
public function execute(Request $request): voidTrackingAction class
final class TrackingAction implements ActionInterface, ApiAwareInterface TrackingAction.php:16
zto.open.getTraceInfo: the bill's traces, oldest first.
TrackingAction::__construct()
public function __construct()TrackingAction::supports()
public function supports(Request $request): boolTrackingAction::execute()
public function execute(Request $request): void