Aller au contenu

omnibus/dtdc 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/dtdc:2.x-dev

Lue dans les fichiers PHP du paquet au commit 139d00dc1ce8 : 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\Dtdc

  • Api class

    DTDC's customer integration APIs (an api-key per customer for consignments and cancellation; a separate access token for tracking, fetched with the tracking username and password).

    3 methods · 4 properties · 4 constants

  • DtdcGatewayFactory class

    options: api_key: '%env(DTDC_API_KEY)%' # the customer integration key customer_code: '%env(DTDC_CUSTOMER)%' tracking_username: null # the tracking API's login tracking_password: null sandbox: true rates: [...] # prices from configuration: DTDC quotes by contract

    10 options

Omnibus\Dtdc\Action

  • CancelAction class

    POST /consignment/cancel.

    3 methods

  • GetSlipAction class

    GET /consignment/label by reference number: the label of a consignment booked earlier, as ship() fetches it (label code SHIP_LABEL_4X6, PDF: DTDC prints no other format).

    4 methods

  • ShippingAction class

    POST /consignment/softdata: the consignment (service: B2C Priority by default, PTP for Priority, GROUND...), then its label from /consignment/label.

    4 methods

  • TrackingAction class

    The tracking API's getTrackDetails: the consignment's actions, oldest first.

    3 methods

Omnibus\Dtdc

Api class

final class Api Api.php:15

DTDC's customer integration APIs (an api-key per customer for consignments and cancellation; a separate access token for tracking, fetched with the tracking username and password).

const LIVE = 'https://dtdcapi.shipsy.io/api/customer/integration'
const TEST = 'https://demodashboardapi.shipsy.in/api/customer/integration'
const TRACKING = 'https://blktracksvc.dtdc.com/dtdc-api/rest/JSONCnTrk/getTrackDetails'
const TRACKING_TOKEN = 'https://blktracksvc.dtdc.com/dtdc-api/api/dtdc/authenticate'
public readonly string $customerCode
public readonly ?string $trackingUsername
public readonly ?string $trackingPassword
public readonly bool $sandbox

Api::__construct()

public function __construct(readonly HttpClientInterface $http, readonly string $apiKey, public readonly string $customerCode, public readonly ?string $trackingUsername = null, public readonly ?string $trackingPassword = null, public readonly bool $sandbox = false, readonly int $timeout = 20)

Api::call()

public function call(string $method, string $path, ?array $body = null, array $query = []): array

Api::track()

public function track(string $number): array

DtdcGatewayFactory class

final class DtdcGatewayFactory extends GatewayFactory DtdcGatewayFactory.php:24

options: api_key: '%env(DTDC_API_KEY)%' # the customer integration key customer_code: '%env(DTDC_CUSTOMER)%' tracking_username: null # the tracking API's login tracking_password: null sandbox: true rates: [...] # prices from configuration: DTDC quotes by contract

No pickup points: DTDC delivers to the door. Unverified until an account's keys are at hand.

Options

OptionDefault
tracking_usernamenull
tracking_passwordnull
sandboxfalse
omnibus.apifunction (Config $c) { $http = $this->http ?? HttpClient::create(); return new Api($http, (string) $c['api_key'], (string) $c['customer_code'], $c['t…
omnibus.action.shippingnew ShippingAction()
omnibus.action.trackingstatic fn(Config $c) => $c['tracking_username'] && $c['tracking_password'] ? new TrackingAction() : null
omnibus.action.cancelnew CancelAction()the tracking API has a login of its own
omnibus.action.get_slipnew GetSlipAction()
api_keyrequired
customer_coderequired

Omnibus\Dtdc\Action

CancelAction class

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

POST /consignment/cancel.

CancelAction::__construct()

public function __construct()

CancelAction::supports()

public function supports(Request $request): bool

CancelAction::execute()

public function execute(Request $request): void

GetSlipAction class

final class GetSlipAction implements ActionInterface, ApiAwareInterface GetSlipAction.php:18

GET /consignment/label by reference number: the label of a consignment booked earlier, as ship() fetches it (label code SHIP_LABEL_4X6, PDF: DTDC prints no other format).

GetSlipAction::__construct()

public function __construct()

GetSlipAction::supports()

public function supports(Request $request): bool

GetSlipAction::execute()

public function execute(Request $request): void

GetSlipAction::fetch()

public static function fetch(Api $api, string $number, string $labelCode): ?string

The consignment's label, base64-decoded, or null when DTDC sends none.

ShippingAction class

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

POST /consignment/softdata: the consignment (service: B2C Priority by default, PTP for Priority, GROUND...), then its label from /consignment/label.

ShippingAction::__construct()

public function __construct()

ShippingAction::supports()

public function supports(Request $request): bool

ShippingAction::execute()

public function execute(Request $request): void

ShippingAction::trackingUrl()

public static function trackingUrl(string $number): string

TrackingAction class

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

The tracking API's getTrackDetails: the consignment's actions, oldest first.

TrackingAction::__construct()

public function __construct()

TrackingAction::supports()

public function supports(Request $request): bool

TrackingAction::execute()

public function execute(Request $request): void