Changeset 2819318
- Timestamp:
- 11/16/2022 09:26:05 PM (3 years ago)
- Location:
- avify
- Files:
-
- 22 added
- 12 deleted
- 20 edited
- 1 copied
-
tags/1.0.4 (copied) (copied from avify/trunk)
-
tags/1.0.4/.git/FETCH_HEAD (modified) (1 diff)
-
tags/1.0.4/.git/HEAD (modified) (1 diff)
-
tags/1.0.4/.git/config (modified) (1 diff)
-
tags/1.0.4/.git/index (modified) (previous)
-
tags/1.0.4/.git/logs/HEAD (modified) (1 diff)
-
tags/1.0.4/.git/objects/0c (added)
-
tags/1.0.4/.git/objects/0c/f47fabf0b9fe44b51fdcde36c7209e243da514 (added)
-
tags/1.0.4/.git/objects/13 (deleted)
-
tags/1.0.4/.git/objects/31 (deleted)
-
tags/1.0.4/.git/objects/59 (added)
-
tags/1.0.4/.git/objects/59/906f195b79c5044470a7543223618b351a9f9a (added)
-
tags/1.0.4/.git/objects/5f (added)
-
tags/1.0.4/.git/objects/5f/25971015a2ebd08e980d02a38a58dfc02201c5 (added)
-
tags/1.0.4/.git/objects/6a (deleted)
-
tags/1.0.4/.git/objects/b9/cde937ff6170529b0882959496109ba4910df9 (added)
-
tags/1.0.4/.git/objects/ed (added)
-
tags/1.0.4/.git/objects/ed/fb8f58fe9ca8a36eacdb3b864dbe8768574b24 (added)
-
tags/1.0.4/.git/objects/ef (deleted)
-
tags/1.0.4/.git/objects/f4/29bc64807e4e259ba68814ab1a45bb8c00fd62 (deleted)
-
tags/1.0.4/.git/objects/f4/6c5934af92c0905e0eb9392fdcd3ad8f103927 (added)
-
tags/1.0.4/.git/refs/tags/1.0.3 (deleted)
-
tags/1.0.4/.git/refs/tags/1.0.4 (added)
-
tags/1.0.4/.git/shallow (modified) (1 diff)
-
tags/1.0.4/README.md (modified) (2 diffs)
-
tags/1.0.4/avify-payments-initializer.php (modified) (1 diff)
-
tags/1.0.4/avify-payments-shipping.php (modified) (10 diffs)
-
tags/1.0.4/readme.txt (modified) (2 diffs)
-
trunk/.git/FETCH_HEAD (modified) (1 diff)
-
trunk/.git/HEAD (modified) (1 diff)
-
trunk/.git/config (modified) (1 diff)
-
trunk/.git/index (modified) (previous)
-
trunk/.git/logs/HEAD (modified) (1 diff)
-
trunk/.git/objects/0c (added)
-
trunk/.git/objects/0c/f47fabf0b9fe44b51fdcde36c7209e243da514 (added)
-
trunk/.git/objects/13 (deleted)
-
trunk/.git/objects/31 (deleted)
-
trunk/.git/objects/59 (added)
-
trunk/.git/objects/59/906f195b79c5044470a7543223618b351a9f9a (added)
-
trunk/.git/objects/5f (added)
-
trunk/.git/objects/5f/25971015a2ebd08e980d02a38a58dfc02201c5 (added)
-
trunk/.git/objects/6a (deleted)
-
trunk/.git/objects/b9/cde937ff6170529b0882959496109ba4910df9 (added)
-
trunk/.git/objects/ed (added)
-
trunk/.git/objects/ed/fb8f58fe9ca8a36eacdb3b864dbe8768574b24 (added)
-
trunk/.git/objects/ef (deleted)
-
trunk/.git/objects/f4/29bc64807e4e259ba68814ab1a45bb8c00fd62 (deleted)
-
trunk/.git/objects/f4/6c5934af92c0905e0eb9392fdcd3ad8f103927 (added)
-
trunk/.git/refs/tags/1.0.3 (deleted)
-
trunk/.git/refs/tags/1.0.4 (added)
-
trunk/.git/shallow (modified) (1 diff)
-
trunk/README.md (modified) (2 diffs)
-
trunk/avify-payments-initializer.php (modified) (1 diff)
-
trunk/avify-payments-shipping.php (modified) (10 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
avify/tags/1.0.4/.git/FETCH_HEAD
r2784324 r2819318 1 f4 29bc64807e4e259ba68814ab1a45bb8c00fd62 'f429bc64807e4e259ba68814ab1a45bb8c00fd62' of https://github.com/avify-com/avify-wordpress-plugin1 f46c5934af92c0905e0eb9392fdcd3ad8f103927 'f46c5934af92c0905e0eb9392fdcd3ad8f103927' of https://github.com/avify-com/avify-wordpress-plugin -
avify/tags/1.0.4/.git/HEAD
r2784324 r2819318 1 f4 29bc64807e4e259ba68814ab1a45bb8c00fd621 f46c5934af92c0905e0eb9392fdcd3ad8f103927 -
avify/tags/1.0.4/.git/config
r2784324 r2819318 10 10 auto = 0 11 11 [http "https://github.com/"] 12 extraheader = AUTHORIZATION: basic eC1hY2Nlc3MtdG9rZW46Z2hzX 0dCSms3VHRMdHljU01nbmdWRnBiNDZIMDVqQkpUNjRFb2NyWQ==12 extraheader = AUTHORIZATION: basic eC1hY2Nlc3MtdG9rZW46Z2hzX1FRR2k1QW9nNXB5UE9UckN6WXpDbzU2VFNTMGI4ZzBKRDRydQ== -
avify/tags/1.0.4/.git/logs/HEAD
r2784324 r2819318 1 0000000000000000000000000000000000000000 f4 29bc64807e4e259ba68814ab1a45bb8c00fd62 runner <runner@fv-az220-516.shdwizndlbjulinwhzhdmup5sb.jx.internal.cloudapp.net> 1663120850 +0000 checkout: moving from master to refs/tags/1.0.31 0000000000000000000000000000000000000000 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 f4 29bc64807e4e259ba68814ab1a45bb8c00fd621 f46c5934af92c0905e0eb9392fdcd3ad8f103927 -
avify/tags/1.0.4/README.md
r2784324 r2819318 4 4 Requires at least: 5.6 5 5 Tested up to: 5.9.2 6 Stable tag: 1.0. 36 Stable tag: 1.0.4 7 7 Requires PHP: 7.0 8 8 License: GPLv2 or later … … 58 58 ## Changelog 59 59 60 ### 1.0.4 61 62 * Improve Avify rates collect. 63 60 64 ### 1.0.3 61 65 -
avify/tags/1.0.4/avify-payments-initializer.php
r2784324 r2819318 7 7 * Plugin URI: 8 8 * Description: Connect your WooCommerce account to Avify and send all your orders to one centralized inventory. 9 * Version: 1.0. 39 * Version: 1.0.4 10 10 * Author: Avify 11 11 * Author URI: https://avify.com/ -
avify/tags/1.0.4/avify-payments-shipping.php
r2784324 r2819318 18 18 } 19 19 // Write the log file. 20 $file = $upload_dir . '/wc-logs/' . $file . '.log';20 $file = $upload_dir . '/wc-logs/' . $file . date("Y-m-d") . '.log'; 21 21 $file = fopen($file, $mode); 22 22 $bytes = fwrite($file, current_time('mysql') . " : " . $entry . "\n"); … … 26 26 } 27 27 28 if (!function_exists(' avify_quote')) {28 if (!function_exists('create_avify_quote')) { 29 29 function create_avify_quote($AVIFY_URL, $AVIFY_SHOP_ID) 30 30 { … … 108 108 public function calculate_shipping($package = array()) 109 109 { 110 //WC()->session->set('avify_lock', false); 110 111 $isCheckout = (is_checkout() || is_cart()); 111 112 if ($isCheckout && !WC()->session->get('avify_lock')) { … … 115 116 $AVIFY_URL = $this->get_option('avify_url'); 116 117 $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; 124 128 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 129 131 //Get from session 130 $avifyQuoteId = WC()->session->get('avify_quote_' . $wooCartKey);132 /*$avifyQuoteId = WC()->session->get('avify_quote_' . $wooCartKey); 131 133 if (!$avifyQuoteId) { 132 134 $avifyQuoteId = create_avify_quote($AVIFY_URL, $AVIFY_SHOP_ID); … … 155 157 WC()->session->set('avify_lock', false); 156 158 avify_log('avify quote id : ' . $avifyQuoteId); 157 avify_log("avify cookie: $avifyCookie"); 159 avify_log("avify cookie: $avifyCookie");*/ 158 160 159 161 //Local avify cart 160 $cart = WC()->cart;162 /*$cart = WC()->cart; 161 163 $avifyLocalQuote = WC()->session->get('avify_local_quote_' . $wooCartKey); 162 164 if ($avifyLocalQuote) { … … 164 166 } else { 165 167 $avifyLocalQuote = []; 166 } 168 }*/ 167 169 168 170 //Update items 169 foreach ($cart->get_cart() as $item) {171 /*foreach ($cart->get_cart() as $item) { 170 172 $sku = $item['data']->get_meta( 'avify_sku', true ); 171 173 $update = false; … … 224 226 } 225 227 } 226 } 228 }*/ 227 229 //Delete items 228 foreach ($avifyLocalQuote as $avfSku => $avfLocalItem) {230 /*foreach ($avifyLocalQuote as $avfSku => $avfLocalItem) { 229 231 $found = false; 230 232 foreach ($cart->get_cart() as $item) { … … 245 247 } 246 248 } 247 WC()->session->set('avify_local_quote_' . $wooCartKey, json_encode($avifyLocalQuote)); 249 WC()->session->set('avify_local_quote_' . $wooCartKey, json_encode($avifyLocalQuote));*/ 248 250 249 251 /** Rates **/ 250 252 if (!isset($package['destination'])) { 253 WC()->session->set('avify_lock', false); 251 254 return; 252 255 } … … 272 275 273 276 $address = $package['destination']; 277 $responseHeaders = []; 274 278 $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}", 276 280 [ 277 "Cookie: $avifyCookie",281 "Cookie: " . $avifyCookie ?: "", 278 282 'Content-Type: application/json' 279 283 ], 280 284 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 300 293 ); 301 302 294 if (!isset($avifyRates['data'])) { 303 295 avify_log('No rates found on avify...'); 304 296 avify_log($avifyRates); 297 WC()->session->set('avify_lock', false); 305 298 return; 306 299 } 300 if(isset($responseHeaders['set-cookie'][0])) { 301 WC()->session->set('avify_cookie_' . $sessionUUID, $responseHeaders['set-cookie'][0]); 302 } 303 307 304 $rates = []; 308 305 foreach ($avifyRates['data'] as $avifyRate) { … … 323 320 } 324 321 //shuffle($rates); 322 if(!$rates) { 323 WC()->session->set('avify_lock', false); 324 return; 325 } 325 326 foreach ($rates as $rate) { 326 327 $this->add_rate($rate); 327 328 } 329 WC()->session->set('avify_lock', false); 328 330 } else { 329 331 avify_log(WC()->session->get('avify_lock') ? 'locked...' : 'no-locked...'); -
avify/tags/1.0.4/readme.txt
r2784324 r2819318 4 4 Requires at least: 5.6 5 5 Tested up to: 5.9.2 6 Stable tag: 1.0. 36 Stable tag: 1.0.4 7 7 Requires PHP: 7.0 8 8 License: GPLv2 or later … … 58 58 == Changelog == 59 59 60 ### 1.0.3 60 ### 1.0.4 61 62 * Improve Avify rates collect. 63 64 = 1.0.3 = 61 65 62 66 * Remove avify url as default value. -
avify/trunk/.git/FETCH_HEAD
r2784324 r2819318 1 f4 29bc64807e4e259ba68814ab1a45bb8c00fd62 'f429bc64807e4e259ba68814ab1a45bb8c00fd62' of https://github.com/avify-com/avify-wordpress-plugin1 f46c5934af92c0905e0eb9392fdcd3ad8f103927 'f46c5934af92c0905e0eb9392fdcd3ad8f103927' of https://github.com/avify-com/avify-wordpress-plugin -
avify/trunk/.git/HEAD
r2784324 r2819318 1 f4 29bc64807e4e259ba68814ab1a45bb8c00fd621 f46c5934af92c0905e0eb9392fdcd3ad8f103927 -
avify/trunk/.git/config
r2784324 r2819318 10 10 auto = 0 11 11 [http "https://github.com/"] 12 extraheader = AUTHORIZATION: basic eC1hY2Nlc3MtdG9rZW46Z2hzX 0dCSms3VHRMdHljU01nbmdWRnBiNDZIMDVqQkpUNjRFb2NyWQ==12 extraheader = AUTHORIZATION: basic eC1hY2Nlc3MtdG9rZW46Z2hzX1FRR2k1QW9nNXB5UE9UckN6WXpDbzU2VFNTMGI4ZzBKRDRydQ== -
avify/trunk/.git/logs/HEAD
r2784324 r2819318 1 0000000000000000000000000000000000000000 f4 29bc64807e4e259ba68814ab1a45bb8c00fd62 runner <runner@fv-az220-516.shdwizndlbjulinwhzhdmup5sb.jx.internal.cloudapp.net> 1663120850 +0000 checkout: moving from master to refs/tags/1.0.31 0000000000000000000000000000000000000000 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 f4 29bc64807e4e259ba68814ab1a45bb8c00fd621 f46c5934af92c0905e0eb9392fdcd3ad8f103927 -
avify/trunk/README.md
r2784324 r2819318 4 4 Requires at least: 5.6 5 5 Tested up to: 5.9.2 6 Stable tag: 1.0. 36 Stable tag: 1.0.4 7 7 Requires PHP: 7.0 8 8 License: GPLv2 or later … … 58 58 ## Changelog 59 59 60 ### 1.0.4 61 62 * Improve Avify rates collect. 63 60 64 ### 1.0.3 61 65 -
avify/trunk/avify-payments-initializer.php
r2784324 r2819318 7 7 * Plugin URI: 8 8 * Description: Connect your WooCommerce account to Avify and send all your orders to one centralized inventory. 9 * Version: 1.0. 39 * Version: 1.0.4 10 10 * Author: Avify 11 11 * Author URI: https://avify.com/ -
avify/trunk/avify-payments-shipping.php
r2784324 r2819318 18 18 } 19 19 // Write the log file. 20 $file = $upload_dir . '/wc-logs/' . $file . '.log';20 $file = $upload_dir . '/wc-logs/' . $file . date("Y-m-d") . '.log'; 21 21 $file = fopen($file, $mode); 22 22 $bytes = fwrite($file, current_time('mysql') . " : " . $entry . "\n"); … … 26 26 } 27 27 28 if (!function_exists(' avify_quote')) {28 if (!function_exists('create_avify_quote')) { 29 29 function create_avify_quote($AVIFY_URL, $AVIFY_SHOP_ID) 30 30 { … … 108 108 public function calculate_shipping($package = array()) 109 109 { 110 //WC()->session->set('avify_lock', false); 110 111 $isCheckout = (is_checkout() || is_cart()); 111 112 if ($isCheckout && !WC()->session->get('avify_lock')) { … … 115 116 $AVIFY_URL = $this->get_option('avify_url'); 116 117 $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; 124 128 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 129 131 //Get from session 130 $avifyQuoteId = WC()->session->get('avify_quote_' . $wooCartKey);132 /*$avifyQuoteId = WC()->session->get('avify_quote_' . $wooCartKey); 131 133 if (!$avifyQuoteId) { 132 134 $avifyQuoteId = create_avify_quote($AVIFY_URL, $AVIFY_SHOP_ID); … … 155 157 WC()->session->set('avify_lock', false); 156 158 avify_log('avify quote id : ' . $avifyQuoteId); 157 avify_log("avify cookie: $avifyCookie"); 159 avify_log("avify cookie: $avifyCookie");*/ 158 160 159 161 //Local avify cart 160 $cart = WC()->cart;162 /*$cart = WC()->cart; 161 163 $avifyLocalQuote = WC()->session->get('avify_local_quote_' . $wooCartKey); 162 164 if ($avifyLocalQuote) { … … 164 166 } else { 165 167 $avifyLocalQuote = []; 166 } 168 }*/ 167 169 168 170 //Update items 169 foreach ($cart->get_cart() as $item) {171 /*foreach ($cart->get_cart() as $item) { 170 172 $sku = $item['data']->get_meta( 'avify_sku', true ); 171 173 $update = false; … … 224 226 } 225 227 } 226 } 228 }*/ 227 229 //Delete items 228 foreach ($avifyLocalQuote as $avfSku => $avfLocalItem) {230 /*foreach ($avifyLocalQuote as $avfSku => $avfLocalItem) { 229 231 $found = false; 230 232 foreach ($cart->get_cart() as $item) { … … 245 247 } 246 248 } 247 WC()->session->set('avify_local_quote_' . $wooCartKey, json_encode($avifyLocalQuote)); 249 WC()->session->set('avify_local_quote_' . $wooCartKey, json_encode($avifyLocalQuote));*/ 248 250 249 251 /** Rates **/ 250 252 if (!isset($package['destination'])) { 253 WC()->session->set('avify_lock', false); 251 254 return; 252 255 } … … 272 275 273 276 $address = $package['destination']; 277 $responseHeaders = []; 274 278 $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}", 276 280 [ 277 "Cookie: $avifyCookie",281 "Cookie: " . $avifyCookie ?: "", 278 282 'Content-Type: application/json' 279 283 ], 280 284 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 300 293 ); 301 302 294 if (!isset($avifyRates['data'])) { 303 295 avify_log('No rates found on avify...'); 304 296 avify_log($avifyRates); 297 WC()->session->set('avify_lock', false); 305 298 return; 306 299 } 300 if(isset($responseHeaders['set-cookie'][0])) { 301 WC()->session->set('avify_cookie_' . $sessionUUID, $responseHeaders['set-cookie'][0]); 302 } 303 307 304 $rates = []; 308 305 foreach ($avifyRates['data'] as $avifyRate) { … … 323 320 } 324 321 //shuffle($rates); 322 if(!$rates) { 323 WC()->session->set('avify_lock', false); 324 return; 325 } 325 326 foreach ($rates as $rate) { 326 327 $this->add_rate($rate); 327 328 } 329 WC()->session->set('avify_lock', false); 328 330 } else { 329 331 avify_log(WC()->session->get('avify_lock') ? 'locked...' : 'no-locked...'); -
avify/trunk/readme.txt
r2784324 r2819318 4 4 Requires at least: 5.6 5 5 Tested up to: 5.9.2 6 Stable tag: 1.0. 36 Stable tag: 1.0.4 7 7 Requires PHP: 7.0 8 8 License: GPLv2 or later … … 58 58 == Changelog == 59 59 60 ### 1.0.3 60 ### 1.0.4 61 62 * Improve Avify rates collect. 63 64 = 1.0.3 = 61 65 62 66 * Remove avify url as default value.
Note: See TracChangeset
for help on using the changeset viewer.