Plugin Directory

Changeset 2932622


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

fixed bugs and made it faster

Location:
shiip/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • shiip/trunk/README.txt

    r2820044 r2932622  
    22Contributors: oife
    33Donate link: https://goshiip.com
    4 Tags: logistics, shipping,delivery,ecommerce,kwik,gig,dhl,fedex,naira,dollar,guo,gig,uber,gokada,import,export,nigeria
     4Tags: logistics, shipping,delivery,ecommerce,kwik,gig,dhl,fedex,naira,dollar,guo,flutterwave
    55Requires at least: 4.7
    6 Tested up to: 6.1
    7 Stable tag: 1.0.5
     6Tested up to: 6.2
     7Stable tag: 1.0.6
    88Requires PHP: 5.6
    99License: GPLv2 or later
     
    4242== Changelog ==
    4343
     44= 1.0.5 =
     45* Added more carriers to service your shipments
     46
    4447= 1.0 =
    4548* First Release
  • shiip/trunk/includes/shiipFunctions.php

    r2923398 r2932622  
    77
    88
    9 function getAccessToken(){
    10     $email = get_option("wc_shiip_settings_email", "-" );
    11     $password = get_option("wc_shiip_settings_password", "-" );
     9// function getAccessToken(){
     10//     $email = get_option("wc_shiip_settings_email", "-" );
     11//     $password = get_option("wc_shiip_settings_password", "-" );
    1212 
    1313   
    14     $body = [
    15         'email_phone' => $email,
    16         'password' => $password,
    17     ];
    18    
    19     $body = wp_json_encode( $body );
    20 
    21     // error_log($body);
    22 
    23    
    24     $options = [
    25         'body'        => $body,
    26         'headers'     => [
    27             'Content-Type' => 'application/json',
    28         ],
    29         'timeout'     => 60,
    30         'redirection' => 5,
    31         'blocking'    => true,
    32         'httpversion' => '1.0',
    33         'sslverify'   => false,
    34         'data_format' => 'body',
    35     ];
    36    
    37     $response = wp_remote_post( "https://delivery.apiideraos.com/api/v2/auth/login", $options );
    38     $responseBody = wp_remote_retrieve_body( $response );
    39 
    40     $json = json_decode($responseBody);
    41    
    42    
    43     // error_log($responseBody);
    44    
    45     if($json->status){
    46         add_option("wc_shiip_user",  $responseBody);
    47         add_option("wc_shiip_user_token",  $json->data->token);
    48         add_option("wc_shiip_user_name",  $json->data->user->firstname.' '.$json->data->user->lastname);
    49        
    50        
    51     }
    52    
    53 }
     14//     $body = [
     15//         'email_phone' => $email,
     16//         'password' => $password,
     17//     ];
     18   
     19//     $body = wp_json_encode( $body );
     20
     21//     // error_log($body);
     22
     23   
     24//     $options = [
     25//         'body'        => $body,
     26//         'headers'     => [
     27//             'Content-Type' => 'application/json',
     28//         ],
     29//         'timeout'     => 60,
     30//         'redirection' => 5,
     31//         'blocking'    => true,
     32//         'httpversion' => '1.0',
     33//         'sslverify'   => false,
     34//         'data_format' => 'body',
     35//     ];
     36   
     37//     $response = wp_remote_post( "https://delivery.apiideraos.com/api/v2/auth/login", $options );
     38//     $responseBody = wp_remote_retrieve_body( $response );
     39
     40//     $json = json_decode($responseBody);
     41   
     42   
     43//     // error_log($responseBody);
     44   
     45//     if($json->status){
     46//         add_option("wc_shiip_user",  $responseBody);
     47//         add_option("wc_shiip_user_token",  $json->data->token);
     48//         add_option("wc_shiip_user_name",  $json->data->user->firstname.' '.$json->data->user->lastname);
     49       
     50       
     51//     }
     52   
     53// }
    5454
    5555function getAddressDetails($address){
     
    9595    //end of get aaccount details
    9696   
    97     if(!isset($acctJson->data->user->firstname)){//if it doesnt exist i must login
    98         getAccessToken();
    99         $acctData  = get_option("wc_shiip_user");
    100         $acctJson = json_decode($acctData);
    101     }
     97    // if(!isset($acctJson->data->user->firstname)){//if it doesnt exist i must login
     98    //     getAccessToken();
     99    //     $acctData  = get_option("wc_shiip_user");
     100    //     $acctJson = json_decode($acctData);
     101    // }
    102102   
    103103    $toCountry =  WC()->countries->countries[$pack['destination']['country']]; //To get country name by code
  • shiip/trunk/shiip.php

    r2923398 r2932622  
    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.6
     19* Version:           1.0.7
    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.6' );
     42define( 'SHIIP_VERSION', '1.0.7' );
    4343
    4444
     
    165165}
    166166
     167
     168function getAccessToken(){
     169    $email = get_option("wc_shiip_settings_email", "-" );
     170    $password = get_option("wc_shiip_settings_password", "-" );
     171 
     172   
     173    $body = [
     174        'email_phone' => $email,
     175        'password' => $password,
     176    ];
     177   
     178    $body = wp_json_encode( $body );
     179
     180    // error_log($body);
     181
     182   
     183    $options = [
     184        'body'        => $body,
     185        'headers'     => [
     186            'Content-Type' => 'application/json',
     187        ],
     188        'timeout'     => 60,
     189        'redirection' => 5,
     190        'blocking'    => true,
     191        'httpversion' => '1.0',
     192        'sslverify'   => false,
     193        'data_format' => 'body',
     194    ];
     195   
     196    $response = wp_remote_post( "https://delivery.apiideraos.com/api/v2/auth/login", $options );
     197    $responseBody = wp_remote_retrieve_body( $response );
     198
     199    $json = json_decode($responseBody);
     200   
     201   
     202    // error_log($responseBody);
     203   
     204    if($json->status){
     205        add_option("wc_shiip_user",  $responseBody);
     206        add_option("wc_shiip_user_token",  $json->data->token);
     207        add_option("wc_shiip_user_name",  $json->data->user->firstname.' '.$json->data->user->lastname);
     208       
     209       
     210    }
     211   
     212}
    167213
    168214function shiip_shiping_init() {
     
    15131559    add_action( 'woocommerce_shipping_init', 'your_shipping_method_init' );
    15141560    function shiip_shipping_methods( $methods ) {
    1515        
     1561        getAccessToken();
     1562
    15161563        if(get_option('woocommerce_currency') == "NGN"){
    15171564            //only work if the platform is using naira
Note: See TracChangeset for help on using the changeset viewer.