コード例 #1
0
 public static function create($shipment_source_obj)
 {
     switch ($shipment_source_obj->shipping_service) {
         case '':
             $tracking_obj = null;
             break;
         case 'wf_usps':
             WfTrackingFactory::wf_include_once('WfTrackingUSPS', 'class-wf-tracking-usps.php');
             $tracking_obj = new WfTrackingUSPS();
             break;
         case 'wf_canada_post':
             WfTrackingFactory::wf_include_once('WfTrackingCanadaPost', 'class-wf-tracking-canadapost.php');
             $tracking_obj = new WfTrackingCanadaPost();
             break;
         default:
             WfTrackingFactory::wf_include_once('WfTrackingDefault', 'class-wf-tracking-default.php');
             $tracking_obj = new WfTrackingDefault();
             break;
     }
     if (null != $tracking_obj) {
         $tracking_obj->init($shipment_source_obj);
     }
     return $tracking_obj;
 }
コード例 #2
0
 public static function get_shipment_result($shipment_source_data)
 {
     WfTrackingFactory::init();
     $shipment_source_obj = new ShipmentSource();
     $shipment_source_obj->shipment_id_cs = isset($shipment_source_data['shipment_id_cs']) ? $shipment_source_data['shipment_id_cs'] : '';
     $shipment_source_obj->shipping_service = isset($shipment_source_data['shipping_service']) ? $shipment_source_data['shipping_service'] : '';
     $shipment_source_obj->order_date = isset($shipment_source_data['order_date']) ? $shipment_source_data['order_date'] : '';
     $shipment_source_obj->shipping_postcode = isset($shipment_source_data['shipping_postcode']) ? $shipment_source_data['shipping_postcode'] : '';
     $wf_tracking = WfTrackingFactory::create($shipment_source_obj);
     $shipment_result = $wf_tracking->get_shipment_info();
     return $shipment_result;
 }