我试图弄清楚如何使用带有php的fedex api强制星期六交付。任何人都可以帮助一个工作的例子。我已经尝试了几种方式与周五发货日期,他们没有给出星期六交货,只有星期一交货。以下是代码的一部分:
if ($data['special_service']) {
echo "special services friday ship date <br>";
//$request['SpecialServicesRequested']['SpecialServiceTypes'] = 'SATURDAY_DELIVERY';
//$request['RateRequest']['VariableOptionsServiceOptionType'] = 'SATURDAY_DELIVERY';
$request['SpecialServicesRequested']['ShipmentSpecialServiceType'] = 'SATURDAY_DELIVERY';
}
$request['ReturnTransitAndCommit'] = true;
$request['RequestedShipment']['DropoffType'] = 'REGULAR_PICKUP'; // valid values REGULAR_PICKUP, REQUEST_COURIER, ...
$request['RequestedShipment']['ShipTimestamp'] = $date; // date("c", $post[3])
$request['RequestedShipment']['ServiceType'] = $data['service_type']; // valid values STANDARD_OVERNIGHT, PRIORITY_OVERNIGHT, FEDEX_GROUND, ...
$request['RequestedShipment']['PackagingType'] = 'FEDEX_ENVELOPE'; // valid values FEDEX_BOX, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, ...
$request['RequestedShipment']['TotalInsuredValue']=array(
'Amount'=>100,
'Currency'=>'USD'
);
$request['RequestedShipment']['Shipper'] = $this->addShipper();
$request['RequestedShipment']['Recipient'] = $this->addRecipient($data);
$request['RequestedShipment']['ShippingChargesPayment'] = $this->addShippingChargesPayment();
$request['RequestedShipment']['PackageCount'] = '1';
$request['RequestedShipment']['RequestedPackageLineItems'] = $this->addPackageLineItem1();
这是我从代码中得到的结果:
array(3){[&#34; amount&#34;] =&gt; string(5)&#34; 33.53&#34; [&#34; deliveryDate&#34;] =&GT; string(10)&#34; 12/07 / 2015&#34; [&#34;的serviceType&#34;] =&GT;字符串(18)&#34; PRIORITY_OVERNIGHT&#34; }
返回的日期是星期一,并且尚未添加星期六的运费。
答案 0 :(得分:2)
终于有了一些有用的东西:
$ request [&#39; RequestedShipment&#39;] [&#39; SpecialServicesRequested&#39;] [&#39; SpecialServiceTypes&#39;] =&#39; SATURDAY_DELIVERY&#39;;
现在它回归了我所期待的: array(3){[&#34; amount&#34;] =&gt; string(5)&#34; 50.01&#34; [&#34; deliveryDate&#34;] =&GT;字符串(10)&#34; 12/05 / 2015&#34; [&#34;的serviceType&#34;] =&GT;字符串(18)&#34; PRIORITY_OVERNIGHT&#34; }
答案 1 :(得分:1)
使用'SpecialServicesRequested'选项会导致仅返回 星期六传递选项。如果您改为使用'VariableOptions',那么您将获得与标准交付选项混合的星期六交付选项。例如:
$ratesRequest['VariableOptions'] = 'SATURDAY_DELIVERY';