Plugin Directory

Changeset 2923398


Ignore:
Timestamp:
06/08/2023 12:58:21 PM (3 years ago)
Author:
oife
Message:

added auth headers

Location:
shiip/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • shiip/trunk/includes/shiipFunctions.php

    r2636352 r2923398  
    1919    $body = wp_json_encode( $body );
    2020
    21     error_log($body);
     21    // error_log($body);
    2222
    2323   
     
    4141   
    4242   
    43     error_log($responseBody);
     43    // error_log($responseBody);
    4444   
    4545    if($json->status){
     
    125125    toAddress[email]='.get_option("wc_shiip_settings_email").'&
    126126    toAddress[street1]='.$toAddress.'&
     127    toAddress[address]='.$toAddress.'&
    127128    toAddress[city]='.$toDetail->data->city.'&
    128129    toAddress[state]='.$toDetail->data->state.'&
     
    135136    fromAddress[email]='.get_option("wc_shiip_settings_email").'&
    136137    fromAddress[street1]='.$fromAddress.'&
     138    fromAddress[address]='.$fromAddress.'&
    137139    fromAddress[city]='.$fromDetail->data->city.'&
    138140    fromAddress[state]='.$fromDetail->data->state.'&
     
    169171    $url = str_replace(array("\r", "\n"), '', $url);
    170172   
    171     // error_log($url);
    172    
    173    
    174     $response = wp_remote_get($url);
     173   
     174    $testUrl = str_replace("https://delivery.apiideraos.com/api/v2/tariffs/getquotes/".$provider,"",$url);
     175    // error_log($testUrl);
     176   
     177    $args = array(
     178        'headers'     => array(
     179            'Authorization' => 'Bearer ' . get_option("wc_shiip_user_token"),
     180        ),
     181    );
     182
     183    $response = wp_remote_get($url,$args);
    175184   
    176185    $body = wp_remote_retrieve_body( $response );
    177186   
    178     error_log("resp22.".$body);
     187    // error_log($provider."resp22.".$body."\n\n");
    179188
    180189    if ( is_wp_error( $response ) ) {
  • shiip/trunk/shiip.php

    r2820044 r2923398  
    1717* Plugin URI:        https://app.goshiip.com/
    1818* Description:       The only shipping app you will ever need for your business. You can “Shiip” with top logistics companies at half their standard rates
    19 * Version:           1.0.5
     19* Version:           1.0.6
    2020* Author:            Shiip LLC
    2121* Author URI:        https://goshiip.com/
     
    4040* Rename this for your plugin and update it as you release new versions.
    4141*/
    42 define( 'SHIIP_VERSION', '1.0.5' );
     42define( 'SHIIP_VERSION', '1.0.6' );
    4343
    4444
     
    211211        "user_id": '.$id.',
    212212        "platform": "wordpress - '.get_option('blogname').'",
    213         "rate_id": "'.$rateId.'"
     213        "rate_id": "'.$rateId.'",
     214        "toAddressName": "'.WC()->checkout->get_value( 'billing_first_name' ).' '.WC()->checkout->get_value( 'billing_last_name' ).'",
     215        "toAddressNumber": "'.WC()->checkout->get_value( 'billing_phone' ).'",
     216        "toAddressEmail": "'.WC()->checkout->get_value( 'billing_email' ).'"
    214217    }';
    215218   
     
    219222   
    220223   
     224   
     225
    221226    $options = [
    222227        'body'        => $data,
    223228        'headers'     => [
    224229            'Content-Type' => 'application/json',
     230            'Authorization' => 'Bearer ' . get_option("wc_shiip_user_token"),
    225231        ],
    226232        'timeout'     => 60,
     
    15201526            // $methods['shiipCourierPlus'] = 'WC_ShiipMethod_CourierPlus';
    15211527
    1522             // $methods['shiipFez'] = 'WC_ShiipMethod_Fez';
    1523             $methods['shiipHowl'] = 'WC_ShiipMethod_Howl';
     1528            $methods['shiipFez'] = 'WC_ShiipMethod_Fez';
     1529            // $methods['shiipHowl'] = 'WC_ShiipMethod_Howl';
    15241530            // $methods['shiipUlsino'] = 'WC_ShiipMethod_Ulsino';
    15251531
Note: See TracChangeset for help on using the changeset viewer.