| 1 |
<?php |
| 2 |
|
| 3 |
class Routeapp_Shipment_Tracking { |
| 4 |
|
| 5 |
private $supported_plugins; |
| 6 |
|
| 7 |
public function __construct() { |
| 8 |
$this->supported_plugins = apply_filters('routeapp_supported_plugin_handlers', array( |
| 9 |
new Routeapp_WooCommerce_Shipment_Tracking(), |
| 10 |
new Routeapp_Blazing_Shipment_Tracking(), |
| 11 |
new Routeapp_Mimo_Shipment_Tracking(), |
| 12 |
new Routeapp_Aftership_Shipment_Tracking(), |
| 13 |
new Routeapp_YithWoocommerce_Tracking_Order(), |
| 14 |
new Routeapp_Astracker_Shipment_Tracking(), |
| 15 |
new Routeapp_WooCommerce_Shipment_Tracking_Pro(), |
| 16 |
new Routeapp_USPS_Shipping_Order(), |
| 17 |
new Routeapp_Wooshippinginfo_Tracking(), |
| 18 |
new Routeapp_Woo_Orders_Tracking(), |
| 19 |
new Routeapp_Woocommerce_Orders_Tracking(), |
| 20 |
new Routeapp_Jetpack(), |
| 21 |
new Routeapp_ShippingEasy(), |
| 22 |
new Routeapp_ShipStation(), |
| 23 |
new Routeapp_ShippingEasyCustom(), |
| 24 |
new Routeapp_Shipworks(), |
| 25 |
new Routeapp_PirateShip(), |
| 26 |
new Routeapp_UPS_Shipping() |
| 27 |
)); |
| 28 |
} |
| 29 |
|
| 30 |
public function parse_order_notes($order_id, $route_app) { |
| 31 |
foreach ($this->supported_plugins as $supported_plugin) { |
| 32 |
if ($supported_plugin->is_active()) { |
| 33 |
$supported_plugin->parse_order_notes($order_id, $route_app); |
| 34 |
} |
| 35 |
} |
| 36 |
} |
| 37 |
|
| 38 |
public function update($order_id, $routeapp) { |
| 39 |
foreach ($this->supported_plugins as $supported_plugin) { |
| 40 |
if ($supported_plugin->is_active()) { |
| 41 |
$supported_plugin->update($order_id, $routeapp); |
| 42 |
} |
| 43 |
} |
| 44 |
} |
| 45 |
|
| 46 |
public function get_shipping_provider_name($order_id) { |
| 47 |
foreach ($this->supported_plugins as $supported_plugin) { |
| 48 |
if ($supported_plugin->is_active()) { |
| 49 |
$courier_data = $supported_plugin->get_shipping_provider_name($order_id); |
| 50 |
if ($courier_data) return $courier_data; |
| 51 |
} |
| 52 |
} |
| 53 |
} |
| 54 |
|
| 55 |
public function cancel($order_id, $tracking_number, $product_ids, $routeapp) { |
| 56 |
foreach ($this->supported_plugins as $supported_plugin) { |
| 57 |
if ($supported_plugin->is_active()) { |
| 58 |
return $supported_plugin->cancel($order_id, $tracking_number, $product_ids, $routeapp); |
| 59 |
} |
| 60 |
} |
| 61 |
} |
| 62 |
|
| 63 |
public function get_shipping_info($order_id) { |
| 64 |
foreach ($this->supported_plugins as $supported_plugin) { |
| 65 |
if ($supported_plugin->is_active()) { |
| 66 |
$trackings = $supported_plugin->get_shipping_info($order_id); |
| 67 |
if ($trackings) return $trackings; |
| 68 |
} |
| 69 |
} |
| 70 |
return false; |
| 71 |
} |
| 72 |
|
| 73 |
} |
| 74 |
|