Changeset 2672618
- Timestamp:
- 02/04/2022 01:49:53 AM (4 years ago)
- Location:
- delyvax/trunk
- Files:
-
- 5 edited
-
delyvax.php (modified) (2 diffs)
-
functions.php (modified) (5 diffs)
-
includes/delyvax-api.php (modified) (5 diffs)
-
includes/delyvax-shipping.php (modified) (1 diff)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
delyvax/trunk/delyvax.php
r2651255 r2672618 4 4 Plugin URI: https://delyva.com 5 5 description: The official Delyva plugin helps store owners to integrate WooCommerce with [Delyva](https://delyva.com) for seamless service comparison and order processing. 6 Version: 1.1.2 56 Version: 1.1.26 7 7 Author: Delyva 8 8 Author URI: https://delyva.com … … 13 13 defined( 'ABSPATH' ) or die( 'No script kiddies please!' ); 14 14 define('DELYVAX_API_ENDPOINT', 'https://api.delyva.app/'); 15 define('DELYVAX_PLUGIN_VERSION', '1.1.2 5');15 define('DELYVAX_PLUGIN_VERSION', '1.1.26'); 16 16 17 17 require_once plugin_dir_path(__FILE__) . 'functions.php'; -
delyvax/trunk/functions.php
r2651255 r2672618 414 414 { 415 415 $serviceobject = $shipping_item_obj->get_meta_data(); 416 417 // print_r($serviceobject);418 416 419 417 for($i=0; $i < sizeof($serviceobject); $i++) … … 881 879 ); 882 880 883 $resultCreate = DelyvaX_Shipping_API::postCreateOrder($or igin, $destination, $weight, $serviceCode, $order_notes, $cod);881 $resultCreate = DelyvaX_Shipping_API::postCreateOrder($order, $origin, $destination, $weight, $serviceCode, $order_notes, $cod); 884 882 885 883 if($resultCreate) … … 895 893 if($process) 896 894 { 897 // $resultProcess = DelyvaX_Shipping_API::postProcessOrder($order, $user, $shipmentId);898 895 $resultProcess = delyvax_post_process_order($order, $user, $shipmentId); 899 896 … … 993 990 { 994 991 $serviceobject = $shipping_item_obj->get_meta_data(); 995 996 // print_r($serviceobject);997 992 998 993 for($i=0; $i < sizeof($serviceobject); $i++) … … 1005 1000 } 1006 1001 1007 return $resultCreate = DelyvaX_Shipping_API::postProcessOrder($ shipmentId, $serviceCode);1002 return $resultCreate = DelyvaX_Shipping_API::postProcessOrder($order, $shipmentId, $serviceCode); 1008 1003 } 1009 1004 -
delyvax/trunk/includes/delyvax-api.php
r2648895 r2672618 62 62 } 63 63 64 public static function postCreateOrder($or igin, $destination, $weight, $serviceCode, $order_notes, $cod)64 public static function postCreateOrder($order, $origin, $destination, $weight, $serviceCode, $order_notes, $cod) 65 65 { 66 66 $url = Self::$api_endpoint . "/order";// . trim(esc_attr($settings['integration_id']), " "); … … 129 129 return $body['data']; 130 130 } else { 131 throw new Exception("Sorry, something went wrong with the API. If the problem persists, please contact us!"); 131 $body = json_decode($response['body'], true); 132 $order->update_meta_data( 'DelyvaXError', $body['error']['message'] ); 133 $order->save(); 134 throw new Exception("Error: ".$body['error']['message'].". Sorry, something went wrong with the API. If the problem persists, please contact us!"); 132 135 } 133 136 } … … 135 138 } 136 139 137 public static function postProcessOrder($ shipmentId, $serviceCode)140 public static function postProcessOrder($order, $shipmentId, $serviceCode) 138 141 { 139 142 $url = Self::$api_endpoint . "/order/:orderId/process";// . trim(esc_attr($settings['integration_id']), " "); … … 149 152 $processing_days = $settings['processing_days']; 150 153 151 $postRequestArr = [ 152 'orderId' => $shipmentId, 153 "serviceCode" => $serviceCode, 154 "skipQueue" => true, 155 ]; 154 if($serviceCode) 155 { 156 $postRequestArr = [ 157 'orderId' => $shipmentId, 158 "serviceCode" => $serviceCode, 159 "skipQueue" => true, 160 ]; 161 }else { 162 $postRequestArr = [ 163 'orderId' => $shipmentId, 164 "skipQueue" => true, 165 ]; 166 } 156 167 157 168 $response = wp_remote_post($url, array( … … 178 189 return $body['data']; 179 190 } else { 180 throw new Exception("Sorry, something went wrong with the API. If the problem persists, please contact us!"); 191 $body = json_decode($response['body'], true); 192 $order->update_meta_data( 'DelyvaXError', $body['error']['message'] ); 193 $order->save(); 194 throw new Exception("Error: ".$body['error']['message'].". Sorry, something went wrong with the API. If the problem persists, please contact us!"); 181 195 } 182 196 } -
delyvax/trunk/includes/delyvax-shipping.php
r2651255 r2672618 62 62 ), 63 63 'create_shipment_on_paid' => array( 64 'title' => __( ' Fulfil orders immediately', 'delyvax' ),64 'title' => __( 'After order has been paid', 'delyvax' ), 65 65 'id' => 'delyvax_create_shipment_on_paid', 66 'description' => __( 'Create paid delivery order on successful payment by customer. If you do not select this, system will create delivery order as draft upon payment complete.', 'delyvax' ), 67 'type' => 'checkbox', 68 'default' => '' 66 'description' => __( 'After order has been paid, create and process the delivery order immediately OR only create delivery order and save as draft, then you can confirm the delivery order in the customer portal.', 'delyvax' ), 67 'default' => '', 68 'type' => 'select', 69 'options' => array( 70 '' => __( 'Save as draft', 'woocommerce' ), 71 'yes' => __( 'Process immediately', 'woocommerce' ) 72 ) 69 73 ), 70 74 'create_shipment_on_confirm' => array( 71 'title' => __( ' Fulfil orders on "Preparing" status', 'delyvax' ),75 'title' => __( 'After order marked as preparing', 'delyvax' ), 72 76 'id' => 'delyvax_create_shipment_on_confirm', 73 'description' => __( 'Create paid delivery on order status = "preparing" by Store/Merchant/Vendor. If you do not select this, system will create delivery order as draft upon changes to preparing status.', 'delyvax' ), 74 'type' => 'checkbox', 75 'default' => '' 77 'description' => __( 'After order has been marked as preparing, create and process the delivery order immediately OR only create delivery order and save as draft then, you can confirm the delivery order in the customer portal.', 'delyvax' ), 78 'default' => '', 79 'type' => 'select', 80 'options' => array( 81 '' => __( 'Save as draft', 'woocommerce' ), 82 'yes' => __( 'Process immediately', 'woocommerce' ) 83 ) 76 84 ), 77 85 'company_id' => array( -
delyvax/trunk/readme.txt
r2651255 r2672618 4 4 Requires at least: 5.4 5 5 Tested up to: 5.7 6 Stable tag: 1.1.2 56 Stable tag: 1.1.26 7 7 Requires PHP: 7.2 8 8 License: GPLv3 … … 16 16 17 17 Delyva WooCommerce plugin 18 - Create shipment automatically on 'payment completed' or manual click to fulfil order.19 - Fulfil shipment with 'Preparing' button click.20 - Edit order > Fulfil order 21 - Edit order > Print label 22 - Edit order > Track shipment 18 - Create delivery order automatically after order has been paid or manually fulfil order by changing the status to Preparing. 19 - Order list > Fulfil order with change order status to 'Preparing'. 20 - Edit order > Fulfil order or change status to Preparing. 21 - Edit order > Print label, 22 - Edit order > Track shipment. 23 23 - Auto-status updates with Web-hook for preparing, start-collecting, collected, failed-collection, start-delivery, delivered, and failed-delivery. 24 24 … … 29 29 3. Insert your delivery service provider's Company code, Company id, User id, Customer id, and API Key. 30 30 4. Configure the settings as per your requirements. 31 5. Check Settings > General > Timezone. Make sure your timezone is set to city name instead of UTC+X. e.g. Kuala Lumpur, instead of UTC+8. 31 32 32 33 == Changelog == 34 35 = 1.1.26 = 36 *Release Date - 3rd February 2022* 37 38 * Rename settings labels for After order has been paid and after order marked as preparing. 33 39 34 40 = 1.1.25 =
Note: See TracChangeset
for help on using the changeset viewer.