Aller au contenu

omnibus/purolator 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
Son README ne le dit pas
Licence
MIT
composer require omnibus/purolator:2.x-dev

Lue dans les fichiers PHP du paquet au commit 4505998105f5 : 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\Purolator

  • Api class

    Purolator's E-Ship web services (SOAP 1.2, basic auth with the development or production key as username): Estimating, Shipping, Tracking and Locator, each its own endpoint and version.

    3 methods · 2 properties · 7 constants

  • Mapping class

    Purolator's XML for ours.

    4 methods · 1 constant

  • PurolatorGatewayFactory class

    options: key: '%env(PUROLATOR_KEY)%' # the development or production key (eship.purolator.com) password: '%env(PUROLATOR_PASSWORD)%' # its password account_number: '%env(PUROLATOR_ACCOUNT)%' sandbox: true rates: [...] # optional: configured prices instead of Estimating

    10 options

Omnibus\Purolator\Action

  • CancelAction class

    Shipping's VoidShipment: a shipment not yet picked up, cancelled.

    3 methods

  • PickupAction class

    Locator's GetLocationsByPostalCode: shipping centres and drop boxes near a postal code.

    3 methods

  • RatingAction class

    Estimating's GetFullEstimate: every service for the shipment, its total and transit days.

    3 methods

  • ShippingAction class

    Shipping's CreateShipment, then ShippingDocuments' GetDocuments for the label's link (a thermal label with option label_format ZPL).

    3 methods

  • TrackingAction class

    Tracking's TrackPackagesByPin: the scans, oldest first.

    3 methods

Omnibus\Purolator

Api class

final class Api Api.php:15

Purolator's E-Ship web services (SOAP 1.2, basic auth with the development or production key as username): Estimating, Shipping, Tracking and Locator, each its own endpoint and version.

const LIVE = 'https://webservices.purolator.com/EWS/V2'
const TEST = 'https://devwebservices.purolator.com/EWS/V2'
const ESTIMATING = ['Estimating/EstimatingService.asmx', '2.2']
const SHIPPING = ['Shipping/ShippingService.asmx', '2.2']
const SHIPPING_DOCUMENTS = ['ShippingDocuments/ShippingDocumentsService.asmx', '1.3']
const TRACKING = ['Tracking/TrackingService.asmx', '1.2']
const LOCATOR = ['Locator/LocatorService.asmx', '1.0']
public readonly string $accountNumber
public readonly bool $sandbox

Api::__construct()

public function __construct(readonly HttpClientInterface $http, readonly string $key, readonly string $password, public readonly string $accountNumber, public readonly bool $sandbox = false, readonly int $timeout = 20)

Api::call()

public function call(array $service, string $request, string $body, string $language = 'en'): \SimpleXMLElement

One SOAP call: the request element's name and inner XML, back as the response element without namespaces.

Api::e()

public static function e(string $s): string

Mapping class

final class Mapping Mapping.php:11

Purolator's XML for ours.

const SERVICES = ['PurolatorExpress' => 'Purolator Express', 'PurolatorExpress9AM' => 'Purolator Express 9AM', 'PurolatorExpress10:30AM' => 'Purolator Express 10:30AM', 'Puro…

Mapping::address()

public static function address(Address $a, ?string $province): string

Mapping::piece()

public static function piece(Parcel $p): string

Mapping::shipment()

public static function shipment(Shipment $s, string $account): string

The <Shipment> both Estimating and Shipping take.

Mapping::status()

public static function status(?string $scanType, ?string $description = null): TrackingStatus

PurolatorGatewayFactory class

final class PurolatorGatewayFactory extends GatewayFactory PurolatorGatewayFactory.php:22

options: key: '%env(PUROLATOR_KEY)%' # the development or production key (eship.purolator.com) password: '%env(PUROLATOR_PASSWORD)%' # its password account_number: '%env(PUROLATOR_ACCOUNT)%' sandbox: true rates: [...] # optional: configured prices instead of Estimating

Options

OptionDefault
sandboxfalse
omnibus.apifunction (Config $c) { $http = $this->http ?? HttpClient::create(); return new Api($http, (string) $c['key'], (string) $c['password'], (string) $c['a…
omnibus.action.ratingstatic fn(Config $c) => $c->get('rates') ? null : new RatingAction()
omnibus.action.shippingnew ShippingAction()
omnibus.action.trackingnew TrackingAction()
omnibus.action.pickupnew PickupAction()
omnibus.action.cancelnew CancelAction()
keyrequired
passwordrequired
account_numberrequired

Omnibus\Purolator\Action

CancelAction class

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

Shipping's VoidShipment: a shipment not yet picked up, cancelled.

CancelAction::__construct()

public function __construct()

CancelAction::supports()

public function supports(Request $request): bool

CancelAction::execute()

public function execute(Request $request): void

PickupAction class

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

Locator's GetLocationsByPostalCode: shipping centres and drop boxes near a postal code.

PickupAction::__construct()

public function __construct()

PickupAction::supports()

public function supports(Request $request): bool

PickupAction::execute()

public function execute(Request $request): void

RatingAction class

final class RatingAction implements ActionInterface, ApiAwareInterface RatingAction.php:15

Estimating's GetFullEstimate: every service for the shipment, its total and transit days.

RatingAction::__construct()

public function __construct()

RatingAction::supports()

public function supports(Request $request): bool

RatingAction::execute()

public function execute(Request $request): void

ShippingAction class

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

Shipping's CreateShipment, then ShippingDocuments' GetDocuments for the label's link (a thermal label with option label_format ZPL).

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

Tracking's TrackPackagesByPin: the scans, oldest first.

TrackingAction::__construct()

public function __construct()

TrackingAction::supports()

public function supports(Request $request): bool

TrackingAction::execute()

public function execute(Request $request): void