Lue dans les fichiers PHP du paquet au commit 5a1fd7eb65b4 : 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é.
ApiclassChronopost's web services (SOAP 1.1, ws.chronopost.fr): Quickcost for prices, ShippingServiceWS for labels, TrackingServiceWS for events, PointRelaisServiceWS for Pickup points. The account number and password travel inside each request's body.
4 methods · 3 properties · 5 constants
ChronopostGatewayFactoryclassoptions: account_number: '%env(CHRONOPOST_ACCOUNT)%' # the 8-digit contract number password: '%env(CHRONOPOST_PASSWORD)%' # its web services password sub_account: null # optional, 3 digits rates: [...] # optional: configured prices instead of Quickcost
9 options · 2 constants
MappingclassChronopost's XML for ours. Products: 01 Chrono 13, 02 Chrono 10, 16 Chrono 18, 86 Chrono Relais 13, 17 Chrono Classic (international), 44 Chrono Express.
4 methods · 3 constants
CancelActionclassTrackingServiceWS's cancelSkybill: a skybill not yet picked up, cancelled.
3 methods
PickupActionclassPointRelaisServiceWS's recherchePointChronopostInter: Pickup relays near an address.
3 methods
RatingActionclassQuickcost's calculateProducts: every product for the lane, with the contract's prices (option products: the codes to keep).
3 methods
ShippingActionclassShippingServiceWS's shippingMultiParcelV4: the label (PDF; "ZPL" with option label_format) for a product (service: 01 Chrono 13 by default; a pickupPoint makes it a Relais product, and its id the recipient reference, which is how Chronopost knows the point).
3 methods
TrackingActionclassTrackingServiceWS's trackSkybillV2: the events, oldest first.
3 methods
Omnibus\Chronopost
Api class
final class Api Api.php:16
Chronopost's web services (SOAP 1.1, ws.chronopost.fr): Quickcost for prices, ShippingServiceWS for labels, TrackingServiceWS for events, PointRelaisServiceWS for Pickup points. The account number and password travel inside each request's body.
const BASE = 'https://ws.chronopost.fr'const QUICKCOST = ['/quickcost-cxf/QuickcostServiceWS', 'http://cxf.quickcost.soap.chronopost.fr/']const SHIPPING = ['/shipping-cxf/ShippingServiceWS', 'http://cxf.shipping.soap.chronopost.fr/']const TRACKING = ['/tracking-cxf/TrackingServiceWS', 'http://cxf.tracking.soap.chronopost.fr/']const RELAIS = ['/recherchebt-ws-cxf/PointRelaisServiceWS', 'http://cxf.rechercherbt.soap.chronopost.fr/']public readonly string $accountNumberpublic readonly string $passwordpublic readonly ?string $subAccount
Api::__construct()
public function __construct(readonly HttpClientInterface $http, public readonly string $accountNumber, public readonly string $password, public readonly ?string $subAccount = null, readonly int $timeout = 20)Api::call()
public function call(array $service, string $operation, string $params): \SimpleXMLElementOne SOAP call: the operation and its parameters as inner XML; back as the <return> element.
Api::e()
public static function e(string $s): stringApi::civility()
public static function civility(\Omnibus\Model\Address $a): stringChronopost's civility code for a party: E for a company (Entreprise), M for a person.
ChronopostGatewayFactory class
final class ChronopostGatewayFactory extends GatewayFactory ChronopostGatewayFactory.php:23
options: account_number: '%env(CHRONOPOST_ACCOUNT)%' # the 8-digit contract number password: '%env(CHRONOPOST_PASSWORD)%' # its web services password sub_account: null # optional, 3 digits rates: [...] # optional: configured prices instead of Quickcost
Chronopost has no sandbox: the test account 19869502 / 255562 is the published one.
Options
| Option | Default | |
|---|---|---|
sub_account | null | |
omnibus.api | function (Config $c) {
$http = $this->http ?? HttpClient::create();
return new Api($http, (string) $c['account_number'], (string) $c['password'], $c[… | |
omnibus.action.rating | static fn(Config $c) => $c->get('rates') ? null : new RatingAction() | |
omnibus.action.shipping | new ShippingAction() | |
omnibus.action.tracking | new TrackingAction() | |
omnibus.action.pickup | new PickupAction() | |
omnibus.action.cancel | new CancelAction() | |
account_number | required | |
password | required |
const TEST_ACCOUNT = '19869502'Chronopost's test account, published in its web services' documentation, the same for everyone: test identifiers, not a secret.
const TEST_PASSWORD = '255562'
Mapping class
final class Mapping Mapping.php:9
Chronopost's XML for ours. Products: 01 Chrono 13, 02 Chrono 10, 16 Chrono 18, 86 Chrono Relais 13, 17 Chrono Classic (international), 44 Chrono Express.
const PRODUCTS = [ '01' => 'Chrono 13', '02' => 'Chrono 10', '16' => 'Chrono 18', '86' => 'Chrono Relais 13', '5X' => 'Chrono Relais Europe', '17' => …const RANGES = [ 'fresh' => ['2R', '6S'], // 0 to 4 °C 'freeze' => ['2S', null], // -18 °C: no relay 'ambient' => ['5M', '5Q'], ]The Chronofresh ranges a shipment asks for with its
productoption, at home and (where there is one) to a relay.const CHILLED = ['2R', '6S', '2S']The products that travel cold: Chronopost delivers them only with a use-by date, not yet passed.
Mapping::product()
public static function product(?string $service, ?string $range, bool $toPickupPoint): stringThe product code of a shipment: the service it names, else its
product range (fresh, freeze, ambient) at home or to a relay, else
Chrono 13 (Chrono Relais 13 to a pickup point).
Mapping::day()
public static function day(\DateTimeInterface|string|null $date): ?stringA use-by date as Chronopost reads it (yyyy-mm-dd), from a date or a string.
Mapping::valueXml()
public static function valueXml(string $prefix, Address $a): stringMapping::status()
public static function status(?string $code, ?string $label = null): TrackingStatusOmnibus\Chronopost\Action
CancelAction class
final class CancelAction implements ActionInterface, ApiAwareInterface CancelAction.php:13
TrackingServiceWS's cancelSkybill: a skybill not yet picked up, cancelled.
CancelAction::__construct()
public function __construct()CancelAction::supports()
public function supports(Request $request): boolCancelAction::execute()
public function execute(Request $request): voidPickupAction class
final class PickupAction implements ActionInterface, ApiAwareInterface PickupAction.php:15
PointRelaisServiceWS's recherchePointChronopostInter: Pickup relays near an address.
PickupAction::__construct()
public function __construct()PickupAction::supports()
public function supports(Request $request): boolPickupAction::execute()
public function execute(Request $request): voidRatingAction class
final class RatingAction implements ActionInterface, ApiAwareInterface RatingAction.php:15
Quickcost's calculateProducts: every product for the lane, with the contract's prices (option products: the codes to keep).
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:26
ShippingServiceWS's shippingMultiParcelV4: the label (PDF; "ZPL" with option label_format) for a product (service: 01 Chrono 13 by default; a pickupPoint makes it a Relais product, and its id the recipient reference, which is how Chronopost knows the point).
Chronofresh: the shipment's product option (fresh, freeze, ambient)
picks the range's code (2R, 6S to a relay, 2S, 5M, 5Q) and use_by the
parcel's use-by date (scheduledValue: expirationDate, sellByDate - sell_by
when it differs); saturday asks a Saturday delivery (service 6).
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:17
TrackingServiceWS's trackSkybillV2: the events, oldest first.
TrackingAction::__construct()
public function __construct()TrackingAction::supports()
public function supports(Request $request): boolTrackingAction::execute()
public function execute(Request $request): void