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é.
ApiclassSF 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
SfExpressGatewayFactoryclassoptions: 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
CancelActionclassEXP_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
ShippingActionclassEXP_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
TrackingActionclassEXP_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 $partnerIdpublic readonly ?string $monthlyCardpublic 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): stringSfExpressGatewayFactory 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
| Option | Default | |
|---|---|---|
monthly_card | null | |
sandbox | false | |
omnibus.api | function (Config $c) {
$http = $this->http ?? HttpClient::create();
return new Api($http, (string) $c['partner_id'], (string) $c['checkword'], $c['mo… | |
omnibus.action.shipping | new ShippingAction() | |
omnibus.action.tracking | new TrackingAction() | |
omnibus.action.cancel | new CancelAction() | |
partner_id | required | |
checkword | required |
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): boolCancelAction::execute()
public function execute(Request $request): voidShippingAction 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): boolShippingAction::execute()
public function execute(Request $request): voidTrackingAction 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): boolTrackingAction::execute()
public function execute(Request $request): void