Aller au contenu

omnibus/jdl-express Référence de l’API

Étage
Fournisseur · Omnibus
Version
2.x
Suite de conformité
branchée, CI non lue
Vérifié en réel
Non vérifié en réel
Licence
MIT
composer require omnibus/jdl-express:2.x-dev

Lue dans les fichiers PHP du paquet au commit ec1db9bec868 : 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é.

Omnibus\JdlExpress

  • Api class

    JD Logistics' open platform (api.jdl.com): each API is a path, the payload a JSON body, signed with the app key and secret (sign = md5(secret + "access_token" + token + "app_key" + key + "method" + path + "param_json" + body + "timestamp" + ts + "v" + v + secret), in capitals).

    3 methods · 2 properties · 2 constants

  • JdlExpressGatewayFactory class

    options: app_key: '%env(JDL_APP_KEY)%' # the open platform app app_secret: '%env(JDL_APP_SECRET)%' access_token: '%env(JDL_ACCESS_TOKEN)%' # the merchant's authorisation token customer_code: '%env(JDL_CUSTOMER)%' # the 商家编码 sandbox: true rates: [...] # prices from configuration: JD quotes by contract

    9 options

Omnibus\JdlExpress\Action

  • CancelAction class

    /ecap/v1/orders/cancel.

    3 methods

  • ShippingAction class

    /ecap/v1/orders/create: the order (service: the product code, ed-m-0001 standard by default), its waybill number; the label from /ecap/v1/orders/print.

    3 methods

  • TrackingAction class

    /ecap/v1/orders/trace/query: the waybill's traces, oldest first.

    3 methods

Omnibus\JdlExpress

Api class

final class Api Api.php:15

JD Logistics' open platform (api.jdl.com): each API is a path, the payload a JSON body, signed with the app key and secret (sign = md5(secret + "access_token" + token + "app_key" + key + "method" + path + "param_json" + body + "timestamp" + ts + "v" + v + secret), in capitals).

const LIVE = 'https://api.jdl.com'
const TEST = 'https://uat-api.jdl.com'
public readonly string $customerCode
public readonly bool $sandbox

Api::__construct()

public function __construct(readonly HttpClientInterface $http, readonly string $appKey, readonly string $appSecret, readonly string $accessToken, public readonly string $customerCode, public readonly bool $sandbox = false, readonly int $timeout = 20)

Api::call()

public function call(string $path, array $body): array

Api::sign()

public static function sign(string $secret, string $token, string $key, string $method, string $json, string $timestamp, string $v): string

JdlExpressGatewayFactory class

final class JdlExpressGatewayFactory extends GatewayFactory JdlExpressGatewayFactory.php:23

options: app_key: '%env(JDL_APP_KEY)%' # the open platform app app_secret: '%env(JDL_APP_SECRET)%' access_token: '%env(JDL_ACCESS_TOKEN)%' # the merchant's authorisation token customer_code: '%env(JDL_CUSTOMER)%' # the 商家编码 sandbox: true rates: [...] # prices from configuration: JD quotes by contract

No pickup points. Unverified until an account's keys are at hand.

Options

OptionDefault
sandboxfalse
omnibus.apifunction (Config $c) { $http = $this->http ?? HttpClient::create(); return new Api($http, (string) $c['app_key'], (string) $c['app_secret'], (string)…
omnibus.action.shippingnew ShippingAction()
omnibus.action.trackingnew TrackingAction()
omnibus.action.cancelnew CancelAction()
app_keyrequired
app_secretrequired
access_tokenrequired
customer_coderequired

Omnibus\JdlExpress\Action

CancelAction class

final class CancelAction implements ActionInterface, ApiAwareInterface CancelAction.php:13

/ecap/v1/orders/cancel.

CancelAction::__construct()

public function __construct()

CancelAction::supports()

public function supports(Request $request): bool

CancelAction::execute()

public function execute(Request $request): void

ShippingAction class

final class ShippingAction implements ActionInterface, ApiAwareInterface ShippingAction.php:16

/ecap/v1/orders/create: the order (service: the product code, ed-m-0001 standard by default), its waybill number; the label from /ecap/v1/orders/print.

ShippingAction::__construct()

public function __construct()

ShippingAction::supports()

public function supports(Request $request): bool

ShippingAction::execute()

public function execute(Request $request): void

TrackingAction class

final class TrackingAction implements ActionInterface, ApiAwareInterface TrackingAction.php:16

/ecap/v1/orders/trace/query: the waybill's traces, oldest first.

TrackingAction::__construct()

public function __construct()

TrackingAction::supports()

public function supports(Request $request): bool

TrackingAction::execute()

public function execute(Request $request): void