Aller au contenu

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

Lue dans les fichiers PHP du paquet au commit d026f05ec2b4 : 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\SfExpress

  • Api class

    SF Express's open platform (sfapi.sf-express.com): one endpoint, the service name and a JSON payload posted as form fields, signed with msgDigest = base64(md5(urlencode(msgData + timestamp + checkword))).

    3 methods · 3 properties · 2 constants

  • SfExpressGatewayFactory class

    options: partner_id: '%env(SF_PARTNER_ID)%' # the open platform's customer code (顾客编码) checkword: '%env(SF_CHECKWORD)%' # its checkword (校验码) monthly_card: '%env(SF_MONTHLY_CARD)%' # the monthly account (月结卡号) that pays sandbox: true rates: [...] # prices from configuration: SF quotes by contract

    8 options

Omnibus\SfExpress\Action

  • CancelAction class

    EXP_RECE_UPDATE_ORDER with dealType 2: the order cancelled by its orderId, the customer order number it was created under (the shipment's reference, or the id ship() drew), which the label keeps as its carrierReference. Not the waybill number: SF does not find an order by it.

    3 methods

  • ShippingAction class

    EXP_RECE_CREATE_ORDER: the waybill (service: the express type id, 1 标快 by default, 2 特快, 5 顺丰次晨...), then its label from COM_RECE_CLOUD_PRINT_WAYBILLS.

    3 methods

  • TrackingAction class

    EXP_RECE_SEARCH_ROUTES: the waybill's routes, oldest first.

    3 methods

Omnibus\SfExpress

Api class

final class Api Api.php:15

SF Express's open platform (sfapi.sf-express.com): one endpoint, the service name and a JSON payload posted as form fields, signed with msgDigest = base64(md5(urlencode(msgData + timestamp + checkword))).

const LIVE = 'https://bspgw.sf-express.com/std/service'
const TEST = 'https://sfapi-sbox.sf-express.com/std/service'
public readonly string $partnerId
public readonly ?string $monthlyCard
public readonly bool $sandbox

Api::__construct()

public function __construct(readonly HttpClientInterface $http, public readonly string $partnerId, readonly string $checkword, public readonly ?string $monthlyCard = null, public readonly bool $sandbox = false, readonly int $timeout = 20)

Api::call()

public function call(string $service, array $data): array
Returns

the apiResultData, decoded

Api::digest()

public static function digest(string $msgData, string $timestamp, string $checkword): string

SfExpressGatewayFactory class

final class SfExpressGatewayFactory extends GatewayFactory SfExpressGatewayFactory.php:22

options: partner_id: '%env(SF_PARTNER_ID)%' # the open platform's customer code (顾客编码) checkword: '%env(SF_CHECKWORD)%' # its checkword (校验码) monthly_card: '%env(SF_MONTHLY_CARD)%' # the monthly account (月结卡号) that pays sandbox: true rates: [...] # prices from configuration: SF quotes by contract

No pickup points. Unverified until an account's keys are at hand.

Options

OptionDefault
monthly_cardnull
sandboxfalse
omnibus.apifunction (Config $c) { $http = $this->http ?? HttpClient::create(); return new Api($http, (string) $c['partner_id'], (string) $c['checkword'], $c['mo…
omnibus.action.shippingnew ShippingAction()
omnibus.action.trackingnew TrackingAction()
omnibus.action.cancelnew CancelAction()
partner_idrequired
checkwordrequired

Omnibus\SfExpress\Action

CancelAction class

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

EXP_RECE_UPDATE_ORDER with dealType 2: the order cancelled by its orderId, the customer order number it was created under (the shipment's reference, or the id ship() drew), which the label keeps as its carrierReference. Not the waybill number: SF does not find an order by it.

CancelAction::__construct()

public function __construct()

CancelAction::supports()

public function supports(Request $request): bool

CancelAction::execute()

public function execute(Request $request): void

ShippingAction class

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

EXP_RECE_CREATE_ORDER: the waybill (service: the express type id, 1 标快 by default, 2 特快, 5 顺丰次晨...), then its label from COM_RECE_CLOUD_PRINT_WAYBILLS.

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

EXP_RECE_SEARCH_ROUTES: the waybill's routes, oldest first.

TrackingAction::__construct()

public function __construct()

TrackingAction::supports()

public function supports(Request $request): bool

TrackingAction::execute()

public function execute(Request $request): void