Plugin Directory

Changeset 2819318


Ignore:
Timestamp:
11/16/2022 09:26:05 PM (3 years ago)
Author:
avify
Message:

Update to version 1.0.4 from GitHub

Location:
avify
Files:
22 added
12 deleted
20 edited
1 copied

Legend:

Unmodified
Added
Removed
  • avify/tags/1.0.4/.git/FETCH_HEAD

    r2784324 r2819318  
    1 f429bc64807e4e259ba68814ab1a45bb8c00fd62        'f429bc64807e4e259ba68814ab1a45bb8c00fd62' of https://github.com/avify-com/avify-wordpress-plugin
     1f46c5934af92c0905e0eb9392fdcd3ad8f103927        'f46c5934af92c0905e0eb9392fdcd3ad8f103927' of https://github.com/avify-com/avify-wordpress-plugin
  • avify/tags/1.0.4/.git/HEAD

    r2784324 r2819318  
    1 f429bc64807e4e259ba68814ab1a45bb8c00fd62
     1f46c5934af92c0905e0eb9392fdcd3ad8f103927
  • avify/tags/1.0.4/.git/config

    r2784324 r2819318  
    1010    auto = 0
    1111[http "https://github.com/"]
    12     extraheader = AUTHORIZATION: basic eC1hY2Nlc3MtdG9rZW46Z2hzX0dCSms3VHRMdHljU01nbmdWRnBiNDZIMDVqQkpUNjRFb2NyWQ==
     12    extraheader = AUTHORIZATION: basic eC1hY2Nlc3MtdG9rZW46Z2hzX1FRR2k1QW9nNXB5UE9UckN6WXpDbzU2VFNTMGI4ZzBKRDRydQ==
  • avify/tags/1.0.4/.git/logs/HEAD

    r2784324 r2819318  
    1 0000000000000000000000000000000000000000 f429bc64807e4e259ba68814ab1a45bb8c00fd62 runner <runner@fv-az220-516.shdwizndlbjulinwhzhdmup5sb.jx.internal.cloudapp.net> 1663120850 +0000 checkout: moving from master to refs/tags/1.0.3
     10000000000000000000000000000000000000000 f46c5934af92c0905e0eb9392fdcd3ad8f103927 runner <runner@fv-az453-380.hss2zji4abbufegd5wcf2so25h.dx.internal.cloudapp.net> 1668633943 +0000 checkout: moving from master to refs/tags/1.0.4
  • avify/tags/1.0.4/.git/shallow

    r2784324 r2819318  
    1 f429bc64807e4e259ba68814ab1a45bb8c00fd62
     1f46c5934af92c0905e0eb9392fdcd3ad8f103927
  • avify/tags/1.0.4/README.md

    r2784324 r2819318  
    44Requires at least: 5.6
    55Tested up to: 5.9.2
    6 Stable tag: 1.0.3
     6Stable tag: 1.0.4
    77Requires PHP: 7.0
    88License: GPLv2 or later
     
    5858## Changelog
    5959
     60### 1.0.4
     61
     62* Improve Avify rates collect.
     63
    6064### 1.0.3
    6165
  • avify/tags/1.0.4/avify-payments-initializer.php

    r2784324 r2819318  
    77 * Plugin URI:
    88 * Description: Connect your WooCommerce account to Avify and send all your orders to one centralized inventory.
    9  * Version: 1.0.3
     9 * Version: 1.0.4
    1010 * Author: Avify
    1111 * Author URI: https://avify.com/
  • avify/tags/1.0.4/avify-payments-shipping.php

    r2784324 r2819318  
    1818            }
    1919            // Write the log file.
    20             $file = $upload_dir . '/wc-logs/' . $file . '.log';
     20            $file = $upload_dir . '/wc-logs/' . $file . date("Y-m-d") . '.log';
    2121            $file = fopen($file, $mode);
    2222            $bytes = fwrite($file, current_time('mysql') . " : " . $entry . "\n");
     
    2626    }
    2727
    28     if (!function_exists('avify_quote')) {
     28    if (!function_exists('create_avify_quote')) {
    2929        function create_avify_quote($AVIFY_URL, $AVIFY_SHOP_ID)
    3030        {
     
    108108                public function calculate_shipping($package = array())
    109109                {
     110                    //WC()->session->set('avify_lock', false);
    110111                    $isCheckout = (is_checkout() || is_cart());
    111112                    if ($isCheckout && !WC()->session->get('avify_lock')) {
     
    115116                        $AVIFY_URL = $this->get_option('avify_url');
    116117                        $AVIFY_SHOP_ID = $this->get_option('avify_shop_id');
    117 
    118                         $carUUID = WC()->session->get('avify_cart_uuid');
    119                         if(is_null($carUUID)) {
    120                             $carUUID = uniqid();
    121                             WC()->session->set('avify_cart_uuid', $carUUID);
    122                         }
    123                         $wooCartKey = $carUUID;
     118                        $sessionUUID = WC()->session->get('avify_session_uuid');
     119                        if(is_null($sessionUUID)) {
     120                            $sessionUUID = uniqid();
     121                            WC()->session->set('avify_session_uuid', $sessionUUID);
     122                        }
     123                        $avifyCookie = WC()->session->get('avify_cookie_' . $sessionUUID);
     124                        $cart = WC()->cart;
     125
     126                        /** Cart Sync **/
     127                        /*$wooCartKey = $carUUID;
    124128                        if (!$wooCartKey) return null;
    125 
    126                         avify_log('get avify shipping rates woo cart: ' . $wooCartKey);
    127 
    128                         /** Cart Sync **/
     129                        avify_log('get avify shipping rates woo cart: ' . $wooCartKey);*/
     130
    129131                        //Get from session
    130                         $avifyQuoteId = WC()->session->get('avify_quote_' . $wooCartKey);
     132                        /*$avifyQuoteId = WC()->session->get('avify_quote_' . $wooCartKey);
    131133                        if (!$avifyQuoteId) {
    132134                            $avifyQuoteId = create_avify_quote($AVIFY_URL, $AVIFY_SHOP_ID);
     
    155157                        WC()->session->set('avify_lock', false);
    156158                        avify_log('avify quote id : ' . $avifyQuoteId);
    157                         avify_log("avify cookie: $avifyCookie");
     159                        avify_log("avify cookie: $avifyCookie");*/
    158160
    159161                        //Local avify cart
    160                         $cart = WC()->cart;
     162                        /*$cart = WC()->cart;
    161163                        $avifyLocalQuote = WC()->session->get('avify_local_quote_' . $wooCartKey);
    162164                        if ($avifyLocalQuote) {
     
    164166                        } else {
    165167                            $avifyLocalQuote = [];
    166                         }
     168                        }*/
    167169
    168170                        //Update items
    169                         foreach ($cart->get_cart() as $item) {
     171                        /*foreach ($cart->get_cart() as $item) {
    170172                            $sku = $item['data']->get_meta( 'avify_sku', true );
    171173                            $update = false;
     
    224226                                }
    225227                            }
    226                         }
     228                        }*/
    227229                        //Delete items
    228                         foreach ($avifyLocalQuote as $avfSku => $avfLocalItem) {
     230                        /*foreach ($avifyLocalQuote as $avfSku => $avfLocalItem) {
    229231                            $found = false;
    230232                            foreach ($cart->get_cart() as $item) {
     
    245247                            }
    246248                        }
    247                         WC()->session->set('avify_local_quote_' . $wooCartKey, json_encode($avifyLocalQuote));
     249                        WC()->session->set('avify_local_quote_' . $wooCartKey, json_encode($avifyLocalQuote));*/
    248250
    249251                        /** Rates **/
    250252                        if (!isset($package['destination'])) {
     253                            WC()->session->set('avify_lock', false);
    251254                            return;
    252255                        }
     
    272275
    273276                        $address = $package['destination'];
     277                        $responseHeaders = [];
    274278                        $avifyRates = Curl::post(
    275                             $AVIFY_URL . "/rest/V1/guest-carts/{$avifyQuoteId}/estimate-shipping-methods",
     279                            $AVIFY_URL . "/rest/V1/avify/wordpress/hook/shipping/{$AVIFY_SHOP_ID}",
    276280                            [
    277                                 "Cookie: $avifyCookie",
     281                                "Cookie: " . $avifyCookie ?: "",
    278282                                'Content-Type: application/json'
    279283                            ],
    280284                            json_encode([
    281                                 "address" => [
    282                                     "city" => $address['city'],
    283                                     "country_id" => $address['country'],
    284                                     "postcode" => $address['postcode'],
    285                                     "region" => $address['state'],
    286                                     "street" => [$address['address_1'], $address['address_2']],
    287                                     "custom_attributes" => [
    288                                         "latitude" => $latitude,
    289                                         "longitude" => $longitude
    290                                     ],
    291                                     "telephone" => "",
    292                                     "extension_attributes" => [],
    293                                     "firstname" => "",
    294                                     "lastname" => "",
    295                                     "middlename" => "",
    296                                     "region_code" => "",
    297                                     "region_id" => 0
    298                                 ]
    299                             ])
     285                                "items" => $cart->get_cart(),
     286                                "country_id" => $address['country'],
     287                                "postcode" => $address['postcode'],
     288                                //"currency" => get_woocommerce_currency(),
     289                                "weight" => wc_get_weight( $cart->get_cart_contents_weight(), 'g' ),
     290                                "latitude" => $latitude,
     291                                "longitude" => $longitude
     292                            ]), $responseHeaders
    300293                        );
    301 
    302294                        if (!isset($avifyRates['data'])) {
    303295                            avify_log('No rates found on avify...');
    304296                            avify_log($avifyRates);
     297                            WC()->session->set('avify_lock', false);
    305298                            return;
    306299                        }
     300                        if(isset($responseHeaders['set-cookie'][0])) {
     301                            WC()->session->set('avify_cookie_' . $sessionUUID, $responseHeaders['set-cookie'][0]);
     302                        }
     303
    307304                        $rates = [];
    308305                        foreach ($avifyRates['data'] as $avifyRate) {
     
    323320                        }
    324321                        //shuffle($rates);
     322                        if(!$rates) {
     323                            WC()->session->set('avify_lock', false);
     324                            return;
     325                        }
    325326                        foreach ($rates as $rate) {
    326327                            $this->add_rate($rate);
    327328                        }
     329                        WC()->session->set('avify_lock', false);
    328330                    } else {
    329331                        avify_log(WC()->session->get('avify_lock') ? 'locked...' : 'no-locked...');
  • avify/tags/1.0.4/readme.txt

    r2784324 r2819318  
    44Requires at least: 5.6
    55Tested up to: 5.9.2
    6 Stable tag: 1.0.3
     6Stable tag: 1.0.4
    77Requires PHP: 7.0
    88License: GPLv2 or later
     
    5858== Changelog ==
    5959
    60 ### 1.0.3
     60### 1.0.4
     61
     62* Improve Avify rates collect.
     63
     64= 1.0.3 =
    6165
    6266* Remove avify url as default value.
  • avify/trunk/.git/FETCH_HEAD

    r2784324 r2819318  
    1 f429bc64807e4e259ba68814ab1a45bb8c00fd62        'f429bc64807e4e259ba68814ab1a45bb8c00fd62' of https://github.com/avify-com/avify-wordpress-plugin
     1f46c5934af92c0905e0eb9392fdcd3ad8f103927        'f46c5934af92c0905e0eb9392fdcd3ad8f103927' of https://github.com/avify-com/avify-wordpress-plugin
  • avify/trunk/.git/HEAD

    r2784324 r2819318  
    1 f429bc64807e4e259ba68814ab1a45bb8c00fd62
     1f46c5934af92c0905e0eb9392fdcd3ad8f103927
  • avify/trunk/.git/config

    r2784324 r2819318  
    1010    auto = 0
    1111[http "https://github.com/"]
    12     extraheader = AUTHORIZATION: basic eC1hY2Nlc3MtdG9rZW46Z2hzX0dCSms3VHRMdHljU01nbmdWRnBiNDZIMDVqQkpUNjRFb2NyWQ==
     12    extraheader = AUTHORIZATION: basic eC1hY2Nlc3MtdG9rZW46Z2hzX1FRR2k1QW9nNXB5UE9UckN6WXpDbzU2VFNTMGI4ZzBKRDRydQ==
  • avify/trunk/.git/logs/HEAD

    r2784324 r2819318  
    1 0000000000000000000000000000000000000000 f429bc64807e4e259ba68814ab1a45bb8c00fd62 runner <runner@fv-az220-516.shdwizndlbjulinwhzhdmup5sb.jx.internal.cloudapp.net> 1663120850 +0000 checkout: moving from master to refs/tags/1.0.3
     10000000000000000000000000000000000000000 f46c5934af92c0905e0eb9392fdcd3ad8f103927 runner <runner@fv-az453-380.hss2zji4abbufegd5wcf2so25h.dx.internal.cloudapp.net> 1668633943 +0000 checkout: moving from master to refs/tags/1.0.4
  • avify/trunk/.git/shallow

    r2784324 r2819318  
    1 f429bc64807e4e259ba68814ab1a45bb8c00fd62
     1f46c5934af92c0905e0eb9392fdcd3ad8f103927
  • avify/trunk/README.md

    r2784324 r2819318  
    44Requires at least: 5.6
    55Tested up to: 5.9.2
    6 Stable tag: 1.0.3
     6Stable tag: 1.0.4
    77Requires PHP: 7.0
    88License: GPLv2 or later
     
    5858## Changelog
    5959
     60### 1.0.4
     61
     62* Improve Avify rates collect.
     63
    6064### 1.0.3
    6165
  • avify/trunk/avify-payments-initializer.php

    r2784324 r2819318  
    77 * Plugin URI:
    88 * Description: Connect your WooCommerce account to Avify and send all your orders to one centralized inventory.
    9  * Version: 1.0.3
     9 * Version: 1.0.4
    1010 * Author: Avify
    1111 * Author URI: https://avify.com/
  • avify/trunk/avify-payments-shipping.php

    r2784324 r2819318  
    1818            }
    1919            // Write the log file.
    20             $file = $upload_dir . '/wc-logs/' . $file . '.log';
     20            $file = $upload_dir . '/wc-logs/' . $file . date("Y-m-d") . '.log';
    2121            $file = fopen($file, $mode);
    2222            $bytes = fwrite($file, current_time('mysql') . " : " . $entry . "\n");
     
    2626    }
    2727
    28     if (!function_exists('avify_quote')) {
     28    if (!function_exists('create_avify_quote')) {
    2929        function create_avify_quote($AVIFY_URL, $AVIFY_SHOP_ID)
    3030        {
     
    108108                public function calculate_shipping($package = array())
    109109                {
     110                    //WC()->session->set('avify_lock', false);
    110111                    $isCheckout = (is_checkout() || is_cart());
    111112                    if ($isCheckout && !WC()->session->get('avify_lock')) {
     
    115116                        $AVIFY_URL = $this->get_option('avify_url');
    116117                        $AVIFY_SHOP_ID = $this->get_option('avify_shop_id');
    117 
    118                         $carUUID = WC()->session->get('avify_cart_uuid');
    119                         if(is_null($carUUID)) {
    120                             $carUUID = uniqid();
    121                             WC()->session->set('avify_cart_uuid', $carUUID);
    122                         }
    123                         $wooCartKey = $carUUID;
     118                        $sessionUUID = WC()->session->get('avify_session_uuid');
     119                        if(is_null($sessionUUID)) {
     120                            $sessionUUID = uniqid();
     121                            WC()->session->set('avify_session_uuid', $sessionUUID);
     122                        }
     123                        $avifyCookie = WC()->session->get('avify_cookie_' . $sessionUUID);
     124                        $cart = WC()->cart;
     125
     126                        /** Cart Sync **/
     127                        /*$wooCartKey = $carUUID;
    124128                        if (!$wooCartKey) return null;
    125 
    126                         avify_log('get avify shipping rates woo cart: ' . $wooCartKey);
    127 
    128                         /** Cart Sync **/
     129                        avify_log('get avify shipping rates woo cart: ' . $wooCartKey);*/
     130
    129131                        //Get from session
    130                         $avifyQuoteId = WC()->session->get('avify_quote_' . $wooCartKey);
     132                        /*$avifyQuoteId = WC()->session->get('avify_quote_' . $wooCartKey);
    131133                        if (!$avifyQuoteId) {
    132134                            $avifyQuoteId = create_avify_quote($AVIFY_URL, $AVIFY_SHOP_ID);
     
    155157                        WC()->session->set('avify_lock', false);
    156158                        avify_log('avify quote id : ' . $avifyQuoteId);
    157                         avify_log("avify cookie: $avifyCookie");
     159                        avify_log("avify cookie: $avifyCookie");*/
    158160
    159161                        //Local avify cart
    160                         $cart = WC()->cart;
     162                        /*$cart = WC()->cart;
    161163                        $avifyLocalQuote = WC()->session->get('avify_local_quote_' . $wooCartKey);
    162164                        if ($avifyLocalQuote) {
     
    164166                        } else {
    165167                            $avifyLocalQuote = [];
    166                         }
     168                        }*/
    167169
    168170                        //Update items
    169                         foreach ($cart->get_cart() as $item) {
     171                        /*foreach ($cart->get_cart() as $item) {
    170172                            $sku = $item['data']->get_meta( 'avify_sku', true );
    171173                            $update = false;
     
    224226                                }
    225227                            }
    226                         }
     228                        }*/
    227229                        //Delete items
    228                         foreach ($avifyLocalQuote as $avfSku => $avfLocalItem) {
     230                        /*foreach ($avifyLocalQuote as $avfSku => $avfLocalItem) {
    229231                            $found = false;
    230232                            foreach ($cart->get_cart() as $item) {
     
    245247                            }
    246248                        }
    247                         WC()->session->set('avify_local_quote_' . $wooCartKey, json_encode($avifyLocalQuote));
     249                        WC()->session->set('avify_local_quote_' . $wooCartKey, json_encode($avifyLocalQuote));*/
    248250
    249251                        /** Rates **/
    250252                        if (!isset($package['destination'])) {
     253                            WC()->session->set('avify_lock', false);
    251254                            return;
    252255                        }
     
    272275
    273276                        $address = $package['destination'];
     277                        $responseHeaders = [];
    274278                        $avifyRates = Curl::post(
    275                             $AVIFY_URL . "/rest/V1/guest-carts/{$avifyQuoteId}/estimate-shipping-methods",
     279                            $AVIFY_URL . "/rest/V1/avify/wordpress/hook/shipping/{$AVIFY_SHOP_ID}",
    276280                            [
    277                                 "Cookie: $avifyCookie",
     281                                "Cookie: " . $avifyCookie ?: "",
    278282                                'Content-Type: application/json'
    279283                            ],
    280284                            json_encode([
    281                                 "address" => [
    282                                     "city" => $address['city'],
    283                                     "country_id" => $address['country'],
    284                                     "postcode" => $address['postcode'],
    285                                     "region" => $address['state'],
    286                                     "street" => [$address['address_1'], $address['address_2']],
    287                                     "custom_attributes" => [
    288                                         "latitude" => $latitude,
    289                                         "longitude" => $longitude
    290                                     ],
    291                                     "telephone" => "",
    292                                     "extension_attributes" => [],
    293                                     "firstname" => "",
    294                                     "lastname" => "",
    295                                     "middlename" => "",
    296                                     "region_code" => "",
    297                                     "region_id" => 0
    298                                 ]
    299                             ])
     285                                "items" => $cart->get_cart(),
     286                                "country_id" => $address['country'],
     287                                "postcode" => $address['postcode'],
     288                                //"currency" => get_woocommerce_currency(),
     289                                "weight" => wc_get_weight( $cart->get_cart_contents_weight(), 'g' ),
     290                                "latitude" => $latitude,
     291                                "longitude" => $longitude
     292                            ]), $responseHeaders
    300293                        );
    301 
    302294                        if (!isset($avifyRates['data'])) {
    303295                            avify_log('No rates found on avify...');
    304296                            avify_log($avifyRates);
     297                            WC()->session->set('avify_lock', false);
    305298                            return;
    306299                        }
     300                        if(isset($responseHeaders['set-cookie'][0])) {
     301                            WC()->session->set('avify_cookie_' . $sessionUUID, $responseHeaders['set-cookie'][0]);
     302                        }
     303
    307304                        $rates = [];
    308305                        foreach ($avifyRates['data'] as $avifyRate) {
     
    323320                        }
    324321                        //shuffle($rates);
     322                        if(!$rates) {
     323                            WC()->session->set('avify_lock', false);
     324                            return;
     325                        }
    325326                        foreach ($rates as $rate) {
    326327                            $this->add_rate($rate);
    327328                        }
     329                        WC()->session->set('avify_lock', false);
    328330                    } else {
    329331                        avify_log(WC()->session->get('avify_lock') ? 'locked...' : 'no-locked...');
  • avify/trunk/readme.txt

    r2784324 r2819318  
    44Requires at least: 5.6
    55Tested up to: 5.9.2
    6 Stable tag: 1.0.3
     6Stable tag: 1.0.4
    77Requires PHP: 7.0
    88License: GPLv2 or later
     
    5858== Changelog ==
    5959
    60 ### 1.0.3
     60### 1.0.4
     61
     62* Improve Avify rates collect.
     63
     64= 1.0.3 =
    6165
    6266* Remove avify url as default value.
Note: See TracChangeset for help on using the changeset viewer.