<?php // 宅配物流訂單幕前建立 define('HOME_URL', 'http://www.sample.com.tw/logistics_dev'); require 'AllPay.Logistics.Integration.php'; try { $AL = new AllpayLogistics(); $AL->HashKey = '5294y06JbISpM5x9'; $AL->HashIV = 'v77hoKGq4kWxNNIS'; $AL->Send = array('MerchantID' => '2000132', 'MerchantTradeNo' => 'no' . date('YmdHis'), 'MerchantTradeDate' => date('Y/m/d H:i:s'), 'LogisticsType' => LogisticsType::HOME, 'LogisticsSubType' => LogisticsSubType::TCAT, 'GoodsAmount' => 1500, 'CollectionAmount' => 10, 'IsCollection' => IsCollection::NO, 'GoodsName' => '測試商品', 'SenderName' => '歐付寶(寄)', 'SenderPhone' => '0226550115', 'SenderCellPhone' => '0911222333', 'ReceiverName' => '歐付寶(收)', 'ReceiverPhone' => '0226550115', 'ReceiverCellPhone' => '0933222111', 'ReceiverEmail' => '*****@*****.**', 'TradeDesc' => '測試交易敘述', 'ServerReplyURL' => HOME_URL . '/ServerReplyURL.php', 'ClientReplyURL' => HOME_URL . '/ClientReplyURL.php', 'LogisticsC2CReplyURL' => HOME_URL . '/LogisticsC2CReplyURL.php', 'Remark' => '測試備註', 'PlatformID' => ''); $AL->SendExtend = array('SenderZipCode' => '11560', 'SenderAddress' => '台北市南港區三重路19-2號10樓D棟', 'ReceiverZipCode' => '11560', 'ReceiverAddress' => '台北市南港區三重路19-2號5樓D棟', 'Temperature' => Temperature::FREEZE, 'Distance' => Distance::SAME, 'Specification' => Specification::CM_150, 'ScheduledDeliveryTime' => ScheduledDeliveryTime::TIME_17_20); // CreateShippingOrder(Button名稱, Form target) $html = $AL->CreateShippingOrder('宅配物流訂單建立'); echo $html; } catch (Exception $e) { echo $e->getMessage(); }
<?php // 宅配物流訂單建立 require '../lib/AllPay.Logistics.Integration.php'; try { $AL = new AllpayLogistics(); $AL->HashKey = '5294y06JbISpM5x9'; $AL->HashIV = 'v77hoKGq4kWxNNIS'; $AL->Send = array('MerchantID' => '2000132', 'MerchantTradeNo' => date('YmdHis'), 'MerchantTradeDate' => date('Y/m/d H:i:s'), 'LogisticsType' => LogisticsType::HOME, 'LogisticsSubType' => LogisticsSubType::TCAT, 'GoodsAmount' => 1500, 'CollectionAmount' => 10, 'IsCollection' => IsCollection::NO, 'GoodsName' => '測試商品', 'SenderName' => '歐付寶(寄)', 'SenderPhone' => '0226550115', 'SenderCellPhone' => '0911222333', 'ReceiverName' => '歐付寶(收)', 'ReceiverPhone' => '0226550115', 'ReceiverCellPhone' => '0933222111', 'ReceiverEmail' => '*****@*****.**', 'TradeDesc' => '測試交易敘述', 'ServerReplyURL' => 'http://www.sample.com.tw/ServerReplyURL.php', 'ClientReplyURL' => 'http://www.sample.com.tw/ClientReplyURL.php', 'LogisticsC2CReplyURL' => 'http://www.sample.com.tw/LogisticsC2CReplyURL.php', 'Remark' => '測試備註', 'PlatformID' => ''); $AL->SendExtend = array('SenderZipCode' => '11560', 'SenderAddress' => '台北市南港區三重路19-2號10樓D棟', 'ReceiverZipCode' => '11560', 'ReceiverAddress' => '台北市南港區三重路19-2號5樓D棟', 'Temperature' => Temperature::FREEZE, 'Distance' => Distance::SAME, 'Specification' => Specification::CM_150, 'ScheduledDeliveryTime' => ScheduledDeliveryTime::TIME_17_20); $Result = $AL->CreateShippingOrder('物流訂單建立', '_blank'); echo $Result; } catch (Exception $e) { echo $e->getMessage(); }
<?php // 超商取貨物流訂單幕前建立 define('HOME_URL', 'http://www.sample.com.tw/logistics_dev'); require 'AllPay.Logistics.Integration.php'; try { $AL = new AllpayLogistics(); $AL->HashKey = '5294y06JbISpM5x9'; $AL->HashIV = 'v77hoKGq4kWxNNIS'; $AL->Send = array('MerchantID' => '2000132', 'MerchantTradeNo' => 'no' . date('YmdHis'), 'MerchantTradeDate' => date('Y/m/d H:i:s'), 'LogisticsType' => LogisticsType::CVS, 'LogisticsSubType' => LogisticsSubType::UNIMART, 'GoodsAmount' => 1500, 'CollectionAmount' => 10, 'IsCollection' => IsCollection::YES, 'GoodsName' => '測試商品A#測試商品B', 'SenderName' => '歐付寶(寄)', 'SenderPhone' => '0226550115', 'SenderCellPhone' => '0911222333', 'ReceiverName' => '歐付寶(收)', 'ReceiverPhone' => '0226550115', 'ReceiverCellPhone' => '0933222111', 'ReceiverEmail' => '*****@*****.**', 'TradeDesc' => '測試交易敘述', 'ServerReplyURL' => HOME_URL . '/ServerReplyURL.php', 'ClientReplyURL' => HOME_URL . '/ClientReplyURL.php', 'LogisticsC2CReplyURL' => HOME_URL . '/LogisticsC2CReplyURL.php', 'Remark' => '測試備註', 'PlatformID' => ''); $AL->SendExtend = array('ReceiverStoreID' => '991182', 'ReturnStoreID' => '991182'); // CreateShippingOrder(Button名稱, Form target) $html = $AL->CreateShippingOrder('超商取貨物流訂單建立'); echo $html; } catch (Exception $e) { echo $e->getMessage(); }
assert_internal_type("array", gettype($sTest_Result), $sTest_Subject); unset($sHome_URL, $oA_L, $sTest_Subject, $sTest_Result); /** * 幕前超商取貨物流訂單產生(CreateShippingOrder) */ $sTest_Subject = "allPay 超商取貨物流訂單產生(CreateShippingOrder)"; $sTest_Result = ""; $sHome_URL = "http://www.sample.com.tw"; try { $oA_L = new AllpayLogistics(); $oA_L->HashKey = TestMerchantInfo::HASH_KEY; $oA_L->HashIV = TestMerchantInfo::HASH_IV; $oA_L->Send = array("MerchantID" => TestMerchantInfo::MERCHANT_ID, "MerchantTradeNo" => "no" . date("YmdHis"), "MerchantTradeDate" => date("Y/m/d H:i:s"), "LogisticsType" => LogisticsType::CVS, "LogisticsSubType" => LogisticsSubType::FAMILY, "GoodsAmount" => 1500, "CollectionAmount" => 10, "IsCollection" => IsCollection::YES, "GoodsName" => "測試商品 A#測試商品 B", "SenderName" => "測試寄件者", "SenderPhone" => "0226550115", "SenderCellPhone" => "0911222333", "ReceiverName" => "測試收件者", "ReceiverPhone" => "0226550115", "ReceiverCellPhone" => "0933222111", "ReceiverEmail" => "*****@*****.**", "TradeDesc" => "測試交易敘述", "ServerReplyURL" => $sHome_URL . "/ServerReplyURL.php", "ClientReplyURL" => $sHome_URL . "/ClientReplyURL.php", "LogisticsC2CReplyURL" => $sHome_URL . "/LogisticsC2CReplyURL.php", "Remark" => "測試備註", "PlatformID" => ""); $oA_L->SendExtend = array("ReceiverStoreID" => "001779", "ReturnStoreID" => "001779"); // CreateShippingOrder(Button 名稱, Form target) $sTest_Result = $oA_L->CreateShippingOrder("超商取貨物流訂單建立"); } catch (Exception $e) { $sTest_Result = $e->getMessage(); unset($e); } assert_have($sTest_Result, "allpayForm", $sTest_Subject); unset($sHome_URL, $oA_L, $sTest_Subject, $sTest_Result); /** * 幕後超商取貨物流訂單產生(CreateShippingOrder) */ $sTest_Subject = "allPay 幕後超商取貨物流訂單產生(BGCreateShippingOrder)"; $sTest_Result = ""; $sHome_URL = "http://www.sample.com.tw"; try { $oA_L = new AllpayLogistics(); $oA_L->HashKey = TestMerchantInfo::HASH_KEY;