Skip to content

omnibus/mondial-relay API reference

Floor
Provider · Omnibus
Version
2.x
Conformance suite
runs, no CI read
Verified for real
Its README does not say
Licence
MIT
composer require omnibus/mondial-relay:2.x-dev

Read from the package's own PHP files at the commit 095e5280847a: its namespaces, classes, interfaces and enums, their public constants, properties and methods with their PHPDoc, and the options its factories take. Nothing of it is run.

Omnibus\MondialRelay

  • Api class

    Mondial Relay's web services (SOAP 1.1, Web_Services.asmx), spoken over plain HTTP: every call is its parameters in the documented order, signed with Security = MD5(the values one after the other + the private key), in capitals.

    7 methods · 4 constants

  • MondialRelayGatewayFactory class

    options: enseigne: '%env(MONDIAL_RELAY_ENSEIGNE)%' # the brand code of the contract (8 characters) private_key: '%env(MONDIAL_RELAY_PRIVATE_KEY)%' sandbox: true # Mondial Relay's public test brand, no contract needed collection: CCC # CCC: collected at the shop; REL: dropped at a relay download_labels: false # true: the PDF inline in the Label, not only its URL rates: [...] # no rating service: Omnibus\Action\ConfiguredRatingAction

    10 options

Omnibus\MondialRelay\Action

  • GetSlipAction class

    WSI3_GetEtiquettes: a booked label again, 10x15 (thermal printers), else A4.

    3 methods

  • PickupAction class

    WSI4_PointRelais_Recherche: the relay points around a postcode, nearest first, that take the parcel's weight. A point's id is "<country>-<number>" (FR-066974): what ShippingAction books to.

    3 methods

  • ShippingAction class

    WSI2_CreationEtiquette: books the shipment - to a relay point when it has one (service 24R), else to the door (service HOM, or the one asked) - and gives the expedition number and the label's link.

    3 methods

  • TrackingAction class

    WSI2_TracingColisDetaille. Its STAT is the parcel's status - 80 registered, 81 on its way, 82 delivered, 83 an anomaly - and each step has a sentence, a date and a place.

    4 methods

Omnibus\MondialRelay

Api class

final class Api Api.php:16

Mondial Relay's web services (SOAP 1.1, Web_Services.asmx), spoken over plain HTTP: every call is its parameters in the documented order, signed with Security = MD5(the values one after the other + the private key), in capitals.

const ENDPOINT = 'https://api.mondialrelay.com/Web_Services.asmx'
const SITE = 'https://www.mondialrelay.com'
const TEST_ENSEIGNE = 'BDTEST13'

Mondial Relay's public test brand: works on the live endpoint, books nothing. Published by Mondial Relay in its integration documentation, the same for everyone: test identifiers, not a secret.

const TEST_PRIVATE_KEY = 'PrivateK'

Api::__construct()

public function __construct(readonly HttpClientInterface $http, readonly string $enseigne, readonly string $privateKey, readonly string $endpoint = self::ENDPOINT)

Api::enseigne()

public function enseigne(): string

Api::call()

public function call(string $method, array $params, array $accept = ['0']): \SimpleXMLElement
$params

in the method's order, Enseigne and Security left out

$accept

STAT codes that are answers, not errors (tracing: 80-83)

Api::download()

public function download(string $url): string

A document the services link to (a label's PDF).

Api::security()

public static function security(array $params, string $privateKey): string

Api::text()

public static function text(?string $value, int $length = 32): string

Mondial Relay takes addresses in capitals, without accents, and cuts each field at a length: "Émile Zola" -> "EMILE ZOLA".

Api::phone()

public static function phone(?string $phone): string

A phone as the services take it: +33612345678 or 0612345678.

MondialRelayGatewayFactory class

final class MondialRelayGatewayFactory extends GatewayFactory MondialRelayGatewayFactory.php:25

options: enseigne: '%env(MONDIAL_RELAY_ENSEIGNE)%' # the brand code of the contract (8 characters) private_key: '%env(MONDIAL_RELAY_PRIVATE_KEY)%' sandbox: true # Mondial Relay's public test brand, no contract needed collection: CCC # CCC: collected at the shop; REL: dropped at a relay download_labels: false # true: the PDF inline in the Label, not only its URL rates: [...] # no rating service: Omnibus\Action\ConfiguredRatingAction

No rating nor cancellation service: prices are the shop's contract, and a label not handed over simply expires.

Options

OptionDefault
enseigneApi::TEST_ENSEIGNErequired
private_keyApi::TEST_PRIVATE_KEYrequired
endpointApi::ENDPOINT
collection'CCC'
download_labelsfalse
omnibus.apifunction (Config $c) { return new Api($this->http ?? HttpClient::create(), (string) $c['enseigne'], (string) $c['private_key'], (string) $c['endpoint']); }
omnibus.action.pickupnew PickupAction()
omnibus.action.shippingstatic fn(Config $c) => new ShippingAction((string) $c['collection'], (bool) $c['download_labels'])
omnibus.action.trackingnew TrackingAction()
omnibus.action.get_slipstatic fn(Config $c) => new GetSlipAction((bool) $c['download_labels'])

Omnibus\MondialRelay\Action

GetSlipAction class

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

WSI3_GetEtiquettes: a booked label again, 10x15 (thermal printers), else A4.

GetSlipAction::__construct()

public function __construct(readonly bool $download = false)

GetSlipAction::supports()

public function supports(Request $request): bool

GetSlipAction::execute()

public function execute(Request $request): void

PickupAction class

final class PickupAction implements ActionInterface, ApiAwareInterface PickupAction.php:19

WSI4_PointRelais_Recherche: the relay points around a postcode, nearest first, that take the parcel's weight. A point's id is "<country>-<number>" (FR-066974): what ShippingAction books to.

PickupAction::__construct()

public function __construct()

PickupAction::supports()

public function supports(Request $request): bool

PickupAction::execute()

public function execute(Request $request): void

ShippingAction class

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

WSI2_CreationEtiquette: books the shipment - to a relay point when it has one (service 24R), else to the door (service HOM, or the one asked) - and gives the expedition number and the label's link.

ShippingAction::__construct()

public function __construct(readonly string $collection = 'CCC', readonly bool $download = false)

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:20

WSI2_TracingColisDetaille. Its STAT is the parcel's status - 80 registered, 81 on its way, 82 delivered, 83 an anomaly - and each step has a sentence, a date and a place.

TrackingAction::__construct()

public function __construct()

TrackingAction::supports()

public function supports(Request $request): bool

TrackingAction::execute()

public function execute(Request $request): void

TrackingAction::publicUrl()

public static function publicUrl(string $number, string $enseigne): string

The public tracking page, for the customer.