Plugin Directory

Changeset 2807720


Ignore:
Timestamp:
10/31/2022 08:36:28 AM (3 years ago)
Author:
delyva
Message:

v1.1.35

Location:
delyvax/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • delyvax/trunk/delyvax.php

    r2806190 r2807720  
    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.34
     6    Version: 1.1.35
    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.34');
     15    define('DELYVAX_PLUGIN_VERSION', '1.1.35');
    1616
    1717    require_once plugin_dir_path(__FILE__) . 'functions.php';
  • delyvax/trunk/functions.php

    r2806190 r2807720  
    378378
    379379      $multivendor_option = $settings['multivendor'];
     380
     381      $insurance_premium = $settings['insurance_premium'] ?? '';
    380382
    381383      //----delivery date & time (pull from meta data), if not available, set to +next day 8am.
     
    631633
    632634          $count++;
    633       }
    634 
    635       /// check payment method and set codAmount
    636       $codAmount = 0;
    637       $codCurrency = $order->get_currency();
    638 
    639       if($order->get_payment_method() == 'cod')
    640       {
    641           $codAmount = $main_order->get_total();
    642635      }
    643636
     
    698691      );
    699692
     693      //
    700694      $cod = array(
    701         "amount" => $codAmount,
    702         "currency" => $codCurrency
     695        "id"=> -1,
     696        "qty"=> 1,
     697        "value"=> $total_price
    703698      );
    704699
    705       $resultCreate = DelyvaX_Shipping_API::postCreateOrder($order, $origin, $destination, $weight, $serviceCode, $order_notes, $cod);
     700      $insurance = array(
     701        "id"=> -3,
     702        "qty"=> 1,
     703        "value"=> $total_price
     704      );
     705
     706      $addons = array();
     707
     708      if($order->get_payment_method() == 'cod')
     709      {
     710          array_push($addons, $cod);
     711      }
     712
     713      if($insurance_premium == 'yes')
     714      {
     715          array_push($addons, $insurance);
     716      }
     717      //
     718
     719      $resultCreate = DelyvaX_Shipping_API::postCreateOrder($order, $origin, $destination, $weight, $serviceCode, $order_notes, $addons);
    706720
    707721      if($resultCreate)
  • delyvax/trunk/includes/delyvax-api.php

    r2804159 r2807720  
    1010
    1111        //instant quote
    12         public static function getPriceQuote($origin, $destination, $weight, $cod, $inventories)
     12        public static function getPriceQuote($origin, $destination, $weight, $addons, $inventories)
    1313        {
    1414            $url = Self::$api_endpoint . "/service/instantQuote/";// . trim(esc_attr($settings['integration_id']), " ");
     
    3131                "weight" => $weight,
    3232                "itemType" => $item_type,
    33                 "inventory" => $inventories
    34                 // "cod" => $cod,
     33                "inventory" => $inventories,
     34                "serviceAddon" => $addons
    3535            ];
    3636
     
    6363        }
    6464
    65         public static function postCreateOrder($order, $origin, $destination, $weight, $serviceCode, $order_notes, $cod)
     65        public static function postCreateOrder($order, $origin, $destination, $weight, $serviceCode, $order_notes, $addons)
    6666        {
    6767              $url = Self::$api_endpoint . "/order";// . trim(esc_attr($settings['integration_id']), " ");
     
    8989                      'weight' => $weight,
    9090                      'note' => $order_notes,
    91                       // 'cod'=>$cod,
     91                      "serviceAddon" => $addons,
    9292                      'source'=> $source
    9393                  ];
     
    102102                      'weight' => $weight,
    103103                      'note' => $order_notes,
    104                       // 'cod'=>$cod,
     104                      "serviceAddon" => $addons,
    105105                      'source'=> $source
    106106                  ];
  • delyvax/trunk/includes/delyvax-shipping.php

    r2806190 r2807720  
    250250                )
    251251            ),
     252            'insurance_premium' => array(
     253                'title'     => __( 'Insurance Premium', 'delyvax' ),
     254                'id'        => 'delyvax_insurance_premium',
     255                'description'   => __( 'Enable Insurance Premium - subject to additional charge', 'delyvax' ),
     256                'type'      => 'checkbox',
     257                'default'   => 'no'
     258            ),
    252259            /*
    253260            'weight_option' => array(
     
    384391            $weight_option = $settings['weight_option'] ?? 'BEST';
    385392            $volumetric_constant = $settings['volumetric_constant'] ?? '5000';
     393            $insurance_premium = $settings['insurance_premium'] ?? '';
    386394
    387395            $pdestination = $package["destination"];
     
    611619
    612620            //
    613             $codAmount = 0;
    614621            $cod = array(
    615               "amount" => $codAmount,
    616               "currency" => $currency,
     622              "id"=> -1,
     623              "qty"=> 1,
     624                "value"=> $total_amount
    617625            );
     626
     627            $insurance = array(
     628              "id"=> -3,
     629              "qty"=> 1,
     630                "value"=> $total_amount
     631            );
     632
     633            $addons = array();
     634            array_push($addons, $cod);
     635
     636            if($insurance_premium == 'yes')
     637            {
     638                array_push($addons, $insurance);
     639            }
    618640
    619641            //start DelyvaX API
     
    630652                  )
    631653                {
    632                     $rates = DelyvaX_Shipping_API::getPriceQuote($origin, $destination, $weight, $cod, $inventories);
     654                    $rates = DelyvaX_Shipping_API::getPriceQuote($origin, $destination, $weight, $addons, $inventories);
    633655                }else {
    634656                    $status_allow_checkout = false;
     
    738760                                    $service_label = str_replace('(PICKUP)', '', $service_label);
    739761                          $service_label = str_replace('(PARCEL)', '', $service_label);
    740                                     $service_label = str_replace('(COD)', '', $service_label);
     762                                    // $service_label = str_replace('(COD)', '', $service_label);
    741763
    742764                          if($cost == 0)
  • delyvax/trunk/readme.txt

    r2806190 r2807720  
    44Requires at least: 5.4
    55Tested up to: 5.7
    6 Stable tag: 1.1.34
     6Stable tag: 1.1.35
    77Requires PHP: 7.2
    88License: GPLv3
     
    3333== Changelog ==
    3434
     35= 1.1.35 =
     36*Release Date - 31st October 2022*
     37
     38* Better support for COD & Insurance Cover.
     39
    3540= 1.1.34 =
    36 *Release Date - 31st October 2022*
     41*Release Date - 29th October 2022*
    3742
    3843* Free shipping feature.
Note: See TracChangeset for help on using the changeset viewer.