Plugin Directory

Changeset 2672618


Ignore:
Timestamp:
02/04/2022 01:49:53 AM (4 years ago)
Author:
delyva
Message:

v1.1.26

Location:
delyvax/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • delyvax/trunk/delyvax.php

    r2651255 r2672618  
    44    Plugin URI: https://delyva.com
    55    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.25
     6    Version: 1.1.26
    77    Author: Delyva
    88    Author URI: https://delyva.com
     
    1313    defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
    1414    define('DELYVAX_API_ENDPOINT', 'https://api.delyva.app/');
    15     define('DELYVAX_PLUGIN_VERSION', '1.1.25');
     15    define('DELYVAX_PLUGIN_VERSION', '1.1.26');
    1616
    1717    require_once plugin_dir_path(__FILE__) . 'functions.php';
  • delyvax/trunk/functions.php

    r2651255 r2672618  
    414414      {
    415415          $serviceobject = $shipping_item_obj->get_meta_data();
    416 
    417           // print_r($serviceobject);
    418416
    419417          for($i=0; $i < sizeof($serviceobject); $i++)
     
    881879      );
    882880
    883       $resultCreate = DelyvaX_Shipping_API::postCreateOrder($origin, $destination, $weight, $serviceCode, $order_notes, $cod);
     881      $resultCreate = DelyvaX_Shipping_API::postCreateOrder($order, $origin, $destination, $weight, $serviceCode, $order_notes, $cod);
    884882
    885883      if($resultCreate)
     
    895893            if($process)
    896894            {
    897                 // $resultProcess = DelyvaX_Shipping_API::postProcessOrder($order, $user, $shipmentId);
    898895                $resultProcess = delyvax_post_process_order($order, $user, $shipmentId);
    899896
     
    993990      {
    994991          $serviceobject = $shipping_item_obj->get_meta_data();
    995 
    996           // print_r($serviceobject);
    997992
    998993          for($i=0; $i < sizeof($serviceobject); $i++)
     
    10051000      }
    10061001
    1007       return $resultCreate = DelyvaX_Shipping_API::postProcessOrder($shipmentId, $serviceCode);
     1002      return $resultCreate = DelyvaX_Shipping_API::postProcessOrder($order, $shipmentId, $serviceCode);
    10081003}
    10091004
  • delyvax/trunk/includes/delyvax-api.php

    r2648895 r2672618  
    6262        }
    6363
    64         public static function postCreateOrder($origin, $destination, $weight, $serviceCode, $order_notes, $cod)
     64        public static function postCreateOrder($order, $origin, $destination, $weight, $serviceCode, $order_notes, $cod)
    6565        {
    6666              $url = Self::$api_endpoint . "/order";// . trim(esc_attr($settings['integration_id']), " ");
     
    129129                      return $body['data'];
    130130                  } 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!");
    132135                  }
    133136              }
     
    135138        }
    136139
    137         public static function postProcessOrder($shipmentId, $serviceCode)
     140        public static function postProcessOrder($order, $shipmentId, $serviceCode)
    138141        {
    139142              $url = Self::$api_endpoint . "/order/:orderId/process";// . trim(esc_attr($settings['integration_id']), " ");
     
    149152              $processing_days = $settings['processing_days'];
    150153
    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              }
    156167
    157168              $response = wp_remote_post($url, array(
     
    178189                    return $body['data'];
    179190                  } 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!");
    181195                  }
    182196              }
  • delyvax/trunk/includes/delyvax-shipping.php

    r2651255 r2672618  
    6262            ),
    6363            'create_shipment_on_paid' => array(
    64                 'title'     => __( 'Fulfil orders immediately', 'delyvax' ),
     64                'title'     => __( 'After order has been paid', 'delyvax' ),
    6565                '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                )
    6973            ),
    7074            'create_shipment_on_confirm' => array(
    71                 'title'     => __( 'Fulfil orders on "Preparing" status', 'delyvax' ),
     75                'title'     => __( 'After order marked as preparing', 'delyvax' ),
    7276                '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                )
    7684            ),
    7785            'company_id' => array(
  • delyvax/trunk/readme.txt

    r2651255 r2672618  
    44Requires at least: 5.4
    55Tested up to: 5.7
    6 Stable tag: 1.1.25
     6Stable tag: 1.1.26
    77Requires PHP: 7.2
    88License: GPLv3
     
    1616
    1717Delyva 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.
    2323- Auto-status updates with Web-hook for preparing, start-collecting, collected, failed-collection, start-delivery, delivered, and failed-delivery.
    2424
     
    29293. Insert your delivery service provider's Company code, Company id, User id, Customer id, and API Key.
    30304. Configure the settings as per your requirements.
     315. 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.
    3132
    3233== 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.
    3339
    3440= 1.1.25 =
Note: See TracChangeset for help on using the changeset viewer.