Lue dans les fichiers PHP du paquet au commit a39c55f15574 : 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é.
ApiclassTNT's ExpressConnect (express.tnt.com): XML documents posted as form fields, basic auth for pricing and tracking, the login inside the document for shipping. Still answered for existing accounts since TNT joined FedEx; new accounts get FedEx's APIs instead.
3 methods · 3 properties · 3 constants
MappingclassExpressConnect's XML for ours.
2 methods · 1 constant
TntGatewayFactoryclassoptions: username: '%env(TNT_USERNAME)%' # the ExpressConnect login password: '%env(TNT_PASSWORD)%' account_number: '%env(TNT_ACCOUNT)%' sender: { name, company, street: [], postcode, city, country, phone, email } # optional: the account's collection address when it is not the shipment's sender rates: [...] # optional: configured prices instead of ExpressConnect Pricing
8 options
RatingActionclassExpressConnect Pricing's priceCheck: every service on the lane, with the account's prices.
3 methods
ShippingActionclassExpressConnect Shipping: the consignment posted (an access code comes back), then its result and label fetched with that code. The service is TNT's product code (15N Express by default).
3 methods
TrackingActionclassExpressConnect Tracking: the consignment's status events, oldest first.
3 methods
Omnibus\Tnt
Api class
final class Api Api.php:16
TNT's ExpressConnect (express.tnt.com): XML documents posted as form fields, basic auth for pricing and tracking, the login inside the document for shipping. Still answered for existing accounts since TNT joined FedEx; new accounts get FedEx's APIs instead.
const PRICING = 'https://express.tnt.com/expressconnect/pricing/getprice'const SHIPPING = 'https://express.tnt.com/expressconnect/shipping/ship'const TRACKING = 'https://express.tnt.com/expressconnect/track.do'public readonly string $usernamepublic readonly string $passwordpublic readonly string $accountNumber
Api::__construct()
public function __construct(readonly HttpClientInterface $http, public readonly string $username, public readonly string $password, public readonly string $accountNumber, readonly int $timeout = 20)Api::call()
public function call(string $url, string $field, string $xml, bool $auth = true): \SimpleXMLElementOne XML document posted; back as the parsed answer.
Api::e()
public static function e(string $s): stringMapping class
final class Mapping Mapping.php:9
ExpressConnect's XML for ours.
const SERVICES = ['15N' => 'Express', '09N' => '9:00 Express', '10N' => '10:00 Express', '12N' => '12:00 Express', '48N' => 'Economy Express', '15D' => 'Express Documents', '…
Mapping::address()
public static function address(Address $a): stringMapping::status()
public static function status(?string $code, ?string $description = null): TrackingStatusTntGatewayFactory class
final class TntGatewayFactory extends GatewayFactory TntGatewayFactory.php:25
options: username: '%env(TNT_USERNAME)%' # the ExpressConnect login password: '%env(TNT_PASSWORD)%' account_number: '%env(TNT_ACCOUNT)%' sender: { name, company, street: [], postcode, city, country, phone, email } # optional: the account's collection address when it is not the shipment's sender rates: [...] # optional: configured prices instead of ExpressConnect Pricing
No pickup points, no cancellation: ExpressConnect offers neither; TNT Depots are addressed by phone. ExpressConnect has no sandbox: a test account is one TNT marks as such.
Options
| Option | Default | |
|---|---|---|
omnibus.api | function (Config $c) {
$http = $this->http ?? HttpClient::create();
return new Api($http, (string) $c['username'], (string) $c['password'], (string) … | |
omnibus.action.rating | static fn(Config $c) => $c->get('rates') ? null : new RatingAction() | |
sender | null | |
omnibus.action.shipping | static fn(Config $c) => new ShippingAction(self::collection($c['sender'])) | |
omnibus.action.tracking | new TrackingAction() | |
username | required | |
password | required | |
account_number | required |
Omnibus\Tnt\Action
RatingAction class
final class RatingAction implements ActionInterface, ApiAwareInterface RatingAction.php:15
ExpressConnect Pricing's priceCheck: every service on the lane, with the account's prices.
RatingAction::__construct()
public function __construct()RatingAction::supports()
public function supports(Request $request): boolRatingAction::execute()
public function execute(Request $request): voidShippingAction class
final class ShippingAction implements ActionInterface, ApiAwareInterface ShippingAction.php:21
ExpressConnect Shipping: the consignment posted (an access code comes back), then its result and label fetched with that code. The service is TNT's product code (15N Express by default).
ShippingAction::__construct()
public function __construct(readonly ?Address $collection = null)$collectionthe account's collection address, when it is not the shipment's sender (option "sender")
ShippingAction::supports()
public function supports(Request $request): boolShippingAction::execute()
public function execute(Request $request): voidTrackingAction class
final class TrackingAction implements ActionInterface, ApiAwareInterface TrackingAction.php:17
ExpressConnect Tracking: the consignment's status events, oldest first.
TrackingAction::__construct()
public function __construct()TrackingAction::supports()
public function supports(Request $request): boolTrackingAction::execute()
public function execute(Request $request): void