Plugin Directory

Changeset 1729128


Ignore:
Timestamp:
09/13/2017 07:33:37 AM (9 years ago)
Author:
blulogistics1
Message:

Live blu API configuration

Location:
blu-logistics/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • blu-logistics/trunk/bluAPI.php

    r1697902 r1729128  
    5858        $newStore = json_decode($stores,true);
    5959
    60         $testAry['apt_id'] = '040';
    61         $testAry['name'] = 'bluPort@bluHQ';
    62         $testAry['bluport_id'] = 'BMV001';
    63         $testAry['loc_desc'] = 'Beside Udders and back entrance';
    64         $testAry['address1'] = '1 Maju Ave';
    65         $testAry['country'] = 'SG';
    66         $testAry['zip_code'] = '556679';
    67         $testAry['latitude'] = '1.365210';
    68         $testAry['longitude'] = '103.865300';
    69         array_unshift($newStore['apt'],$testAry);
    7060        return $newStore['apt'];
    7161    }
     
    8373
    8474        $parcelID = $merchant['blu_merchant_id'].'-'.$order_id;
    85         $parcelAPI = 'http://118.201.198.205:8080/infologBLUAPI_Training/api/SAVEPARCEL';
     75        $parcelAPI = 'http://118.201.198.205:8080/infologBLUAPI/api/SAVEPARCEL';
    8676
    8777        $dropoff = ($dropoff_settings['drop_off'] ? $dropoff_settings['drop_off'] : 0);
     
    200190                </parcel_status>';
    201191
    202         $parcelAPI = 'http://118.201.198.205:8080/infologBLUAPI_Training/api/PARCELTRACK';
     192        $parcelAPI = 'http://118.201.198.205:8080/infologBLUAPI/api/PARCELTRACK';
    203193        $response = $this->blsm_parcel_curl_api($parcelAPI,$postString);
    204194
  • blu-logistics/trunk/class-blu-global-method.php

    r1697902 r1729128  
    924924            $response['rate'] = 0;
    925925
    926             if($this->get_option('free_shipping') == 'yes'){
     926            if($options['use_api'])
     927            {
     928              $result = $this->getAPIPrice($package);
     929
     930              if($result == "FAILED"){
     931                  $response['allowed_countries'] = false;
     932                  return $response;
     933              }
     934              else{
     935                  if($options['mark_up'] == 'fixed'){
     936                    $cost =  $result + $options['price'];
     937                  }
     938                  else if($options['mark_up'] == 'percent'){
     939                    $cost = (($options['price']/100) * WC()->cart->cart_contents_total) + $result;
     940                  }
     941                  else
     942                    $cost = $result;
     943              }
     944
     945              $response['allowed_countries'] = true;
     946              $response['rate'] = $cost;
     947              return $response;
     948
     949            }
     950            else if($this->get_option('free_shipping') == 'yes'){
    927951                $response['allowed_countries'] = true;
    928952                return $response;
    929953            }
    930954            else {
    931                 if($options['use_api'])
    932                 {
    933                   $result = $this->getAPIPrice($package);
    934 
    935                   if($result == "FAILED"){
    936                       $response['allowed_countries'] = false;
    937                       return $response;
    938                   }
    939                   else{
    940                       if($options['mark_up'] == 'fixed'){
    941                         $cost =  $result + $options['price'];
    942                       }
    943                       else if($options['mark_up'] == 'percent'){
    944                         $cost = (($options['price']/100) * WC()->cart->cart_contents_total) + $result;
    945                       }
    946                       else
    947                         $cost = $result;
    948                   }
    949 
    950                 }
    951                 else {
    952                       if($rates[0]['condition'] == 'total'){
    953                         //price based comparisons
    954                         $cost = $this->find_matching_rate(WC()->cart->cart_contents_total, $rates);
    955                       } else {
    956                         //weight based comparison
    957                         $cost = $this->find_matching_rate(WC()->cart->cart_contents_weight, $rates);
    958                       }
    959                 }
    960 
    961                 $cost = round($cost,2);
    962                 $response['allowed_countries'] = true;
    963                 $response['rate'] = $cost;
    964                 return $response;
     955                    if($rates[0]['condition'] == 'total'){
     956                      //price based comparisons
     957                      $cost = $this->find_matching_rate(WC()->cart->cart_contents_total, $rates);
     958                    } else {
     959                      //weight based comparison
     960                      $cost = $this->find_matching_rate(WC()->cart->cart_contents_weight, $rates);
     961                    }
     962
     963                    $response['allowed_countries'] = true;
     964                    $response['rate'] = $cost;
     965                    return $response;
    965966            }
    966967
Note: See TracChangeset for help on using the changeset viewer.