Changeset 3448855
- Timestamp:
- 01/28/2026 04:21:28 PM (2 months ago)
- Location:
- wintouch-cloud
- Files:
-
- 7 edited
- 12 copied
-
tags/0.0.5 (copied) (copied from wintouch-cloud/trunk)
-
tags/0.0.5/README.md (copied) (copied from wintouch-cloud/trunk/README.md) (1 diff)
-
tags/0.0.5/assets/css/style.css (copied) (copied from wintouch-cloud/trunk/assets/css/style.css)
-
tags/0.0.5/readme.txt (copied) (copied from wintouch-cloud/trunk/readme.txt) (1 diff)
-
tags/0.0.5/src/Api.php (copied) (copied from wintouch-cloud/trunk/src/Api.php)
-
tags/0.0.5/src/Authentication.php (copied) (copied from wintouch-cloud/trunk/src/Authentication.php) (1 diff)
-
tags/0.0.5/src/Menu.php (copied) (copied from wintouch-cloud/trunk/src/Menu.php)
-
tags/0.0.5/src/Order.php (copied) (copied from wintouch-cloud/trunk/src/Order.php) (2 diffs)
-
tags/0.0.5/src/Stock.php (modified) (1 diff)
-
tags/0.0.5/views/Account.php (copied) (copied from wintouch-cloud/trunk/views/Account.php)
-
tags/0.0.5/views/General.php (copied) (copied from wintouch-cloud/trunk/views/General.php)
-
tags/0.0.5/views/Settings.php (copied) (copied from wintouch-cloud/trunk/views/Settings.php)
-
tags/0.0.5/wintouch-cloud.php (copied) (copied from wintouch-cloud/trunk/wintouch-cloud.php) (1 diff)
-
trunk/README.md (modified) (1 diff)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/src/Authentication.php (modified) (1 diff)
-
trunk/src/Order.php (modified) (2 diffs)
-
trunk/src/Stock.php (modified) (1 diff)
-
trunk/wintouch-cloud.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
wintouch-cloud/tags/0.0.5/README.md
r3447688 r3448855 8 8 **Requires at least:** 5.0 9 9 **Tested up to:** 6.9 10 **Stable tag:** 0.0. 410 **Stable tag:** 0.0.5 11 11 **Requires PHP:** 7.2 12 12 **License:** GPLv2 or later -
wintouch-cloud/tags/0.0.5/readme.txt
r3447688 r3448855 4 4 Requires at least: 5.0 5 5 Tested up to: 6.9 6 Stable tag: 0.0. 46 Stable tag: 0.0.5 7 7 Requires PHP: 7.2 8 8 License: GPLv2 or later -
wintouch-cloud/tags/0.0.5/src/Authentication.php
r3447688 r3448855 19 19 try { 20 20 $response = (new Api())->Login($email, $password); 21 22 $userid = $response['value']['userId']; 23 $token = $response['value']['token']; 24 25 update_option('wintouch_userid', $userid, false); 26 update_option('wintouch_usertoken', $token, false); 21 27 } catch (ApiException $ex) { 22 echo esc_html($ex->getMessage()); 23 return false; 28 add_settings_error('wintouch', 'wt', $ex->getMessage(), 'error'); 24 29 } 25 26 $userid = $response['value']['userId'];27 $token = $response['value']['token'];28 29 update_option('wintouch_userid', $userid, false);30 update_option('wintouch_usertoken', $token, false);31 30 } 32 31 -
wintouch-cloud/tags/0.0.5/src/Order.php
r3447688 r3448855 25 25 'OrderId' => $order->get_id(), 26 26 'OrderNumber' => $order->get_order_number(), 27 'IsStockSyncActive' => $stocksync 27 'IsStockSyncActive' => $stocksync, 28 28 ]; 29 29 … … 65 65 'Title' => $product->get_name(), 66 66 'SKU' => $product->get_sku(), 67 'Price' => $item->get_subtotal() + $item->get_subtotal_tax() / $item->get_quantity(),67 'Price' => ($item->get_subtotal() + $item->get_subtotal_tax()) / $item->get_quantity(), 68 68 'Quantity' => $item->get_quantity(), 69 69 'TaxRate' => round(($item->get_subtotal_tax() / $item->get_subtotal()) * 100) -
wintouch-cloud/tags/0.0.5/src/Stock.php
r3443376 r3448855 32 32 } 33 33 34 $data['CodePrefix'] = get_option('wintouch_setting_codeprefix'); 35 $data['CodeDigits'] = intval(get_option('wintouch_setting_codedigits')); 34 $prices_with_tax = wc_prices_include_tax(); 36 35 37 36 $data['Products'] = []; 38 37 foreach ($products as $product) { 39 if ($product->get_manage_stock()) { 40 $tax_class = $product->get_tax_class(); 41 if (empty($tax_class)) { 42 $tax_class = ''; 43 } 38 if ($product->is_type('variable')) { 39 $variations_id = $product->get_children(); 44 40 45 $tax_rates = \WC_Tax::get_rates($tax_class);46 $tax_rate_value = 0;41 foreach ($variations_id as $variation_id) { 42 $variation = wc_get_product($variation_id); 47 43 48 if (is_array($tax_rates) && !empty($tax_rates)) { 49 $first_rate = reset($tax_rates); 50 if (isset($first_rate['rate'])) { 51 $tax_rate_value = floatval($first_rate['rate']); 52 } else { 53 $tax_rate_value = floatval(23); 44 if ($variation->get_manage_stock()) { 45 $tax_rates = \WC_Tax::get_base_tax_rates($variation->get_tax_class()); 46 $first_rate = reset($tax_rates); 47 $tax_rate_value = isset($first_rate['rate']) ? floatval($first_rate['rate']) : floatval(23); 48 49 if ($prices_with_tax) { 50 $price = $variation->get_price(); 51 $taxes = \WC_Tax::calc_tax($price, $tax_rates, false); 52 $price_with_tax = $price + array_sum($taxes); 53 } else { 54 $price_with_tax = $variation->get_price(); 55 } 56 57 $data['Products'][] = [ 58 'Id' => strval($variation->get_id()), 59 'Name' => $variation->get_name(), 60 'TaxRate' => $tax_rate_value, 61 'Price' => $price_with_tax, 62 'BuyPrice' => 0, 63 'Quantity' => $variation->get_stock_quantity() 64 ]; 54 65 } 55 66 } 67 } else { 68 if ($product->get_manage_stock()) { 69 $tax_rates = \WC_Tax::get_base_tax_rates($product->get_tax_class()); 70 $first_rate = reset($tax_rates); 71 $tax_rate_value = isset($first_rate['rate']) ? floatval($first_rate['rate']) : floatval(23); 56 72 57 $data['Products'][] = [ 58 'Id' => strval($product->get_id()), 59 'Name' => $product->get_name(), 60 'TaxRate' => $tax_rate_value, 61 'Price' => $product->get_price(), 62 'BuyPrice' => 0, 63 'Quantity' => $product->get_stock_quantity() 64 ]; 73 if ($prices_with_tax) { 74 $price = $product->get_price(); 75 $taxes = \WC_Tax::calc_tax($price, $tax_rates, false); 76 $price_with_tax = $price + array_sum($taxes); 77 } else { 78 $price_with_tax = $product->get_price(); 79 } 80 81 $data['Products'][] = [ 82 'Id' => strval($product->get_id()), 83 'Name' => $product->get_name(), 84 'TaxRate' => $tax_rate_value, 85 'Price' => $price_with_tax, 86 'BuyPrice' => 0, 87 'Quantity' => $product->get_stock_quantity() 88 ]; 89 } 65 90 } 66 91 } -
wintouch-cloud/tags/0.0.5/wintouch-cloud.php
r3447688 r3448855 3 3 * Plugin Name: WINTOUCH Cloud 4 4 * Description: Uma ferramenta de faturação para o seu negócio. 5 * Version: 0.0. 45 * Version: 0.0.5 6 6 * Author: WINTOUCH 7 7 * Author URI: https://wintouchcloud.com -
wintouch-cloud/trunk/README.md
r3447688 r3448855 8 8 **Requires at least:** 5.0 9 9 **Tested up to:** 6.9 10 **Stable tag:** 0.0. 410 **Stable tag:** 0.0.5 11 11 **Requires PHP:** 7.2 12 12 **License:** GPLv2 or later -
wintouch-cloud/trunk/readme.txt
r3447688 r3448855 4 4 Requires at least: 5.0 5 5 Tested up to: 6.9 6 Stable tag: 0.0. 46 Stable tag: 0.0.5 7 7 Requires PHP: 7.2 8 8 License: GPLv2 or later -
wintouch-cloud/trunk/src/Authentication.php
r3447688 r3448855 19 19 try { 20 20 $response = (new Api())->Login($email, $password); 21 22 $userid = $response['value']['userId']; 23 $token = $response['value']['token']; 24 25 update_option('wintouch_userid', $userid, false); 26 update_option('wintouch_usertoken', $token, false); 21 27 } catch (ApiException $ex) { 22 echo esc_html($ex->getMessage()); 23 return false; 28 add_settings_error('wintouch', 'wt', $ex->getMessage(), 'error'); 24 29 } 25 26 $userid = $response['value']['userId'];27 $token = $response['value']['token'];28 29 update_option('wintouch_userid', $userid, false);30 update_option('wintouch_usertoken', $token, false);31 30 } 32 31 -
wintouch-cloud/trunk/src/Order.php
r3447688 r3448855 25 25 'OrderId' => $order->get_id(), 26 26 'OrderNumber' => $order->get_order_number(), 27 'IsStockSyncActive' => $stocksync 27 'IsStockSyncActive' => $stocksync, 28 28 ]; 29 29 … … 65 65 'Title' => $product->get_name(), 66 66 'SKU' => $product->get_sku(), 67 'Price' => $item->get_subtotal() + $item->get_subtotal_tax() / $item->get_quantity(),67 'Price' => ($item->get_subtotal() + $item->get_subtotal_tax()) / $item->get_quantity(), 68 68 'Quantity' => $item->get_quantity(), 69 69 'TaxRate' => round(($item->get_subtotal_tax() / $item->get_subtotal()) * 100) -
wintouch-cloud/trunk/src/Stock.php
r3443376 r3448855 32 32 } 33 33 34 $data['CodePrefix'] = get_option('wintouch_setting_codeprefix'); 35 $data['CodeDigits'] = intval(get_option('wintouch_setting_codedigits')); 34 $prices_with_tax = wc_prices_include_tax(); 36 35 37 36 $data['Products'] = []; 38 37 foreach ($products as $product) { 39 if ($product->get_manage_stock()) { 40 $tax_class = $product->get_tax_class(); 41 if (empty($tax_class)) { 42 $tax_class = ''; 43 } 38 if ($product->is_type('variable')) { 39 $variations_id = $product->get_children(); 44 40 45 $tax_rates = \WC_Tax::get_rates($tax_class);46 $tax_rate_value = 0;41 foreach ($variations_id as $variation_id) { 42 $variation = wc_get_product($variation_id); 47 43 48 if (is_array($tax_rates) && !empty($tax_rates)) { 49 $first_rate = reset($tax_rates); 50 if (isset($first_rate['rate'])) { 51 $tax_rate_value = floatval($first_rate['rate']); 52 } else { 53 $tax_rate_value = floatval(23); 44 if ($variation->get_manage_stock()) { 45 $tax_rates = \WC_Tax::get_base_tax_rates($variation->get_tax_class()); 46 $first_rate = reset($tax_rates); 47 $tax_rate_value = isset($first_rate['rate']) ? floatval($first_rate['rate']) : floatval(23); 48 49 if ($prices_with_tax) { 50 $price = $variation->get_price(); 51 $taxes = \WC_Tax::calc_tax($price, $tax_rates, false); 52 $price_with_tax = $price + array_sum($taxes); 53 } else { 54 $price_with_tax = $variation->get_price(); 55 } 56 57 $data['Products'][] = [ 58 'Id' => strval($variation->get_id()), 59 'Name' => $variation->get_name(), 60 'TaxRate' => $tax_rate_value, 61 'Price' => $price_with_tax, 62 'BuyPrice' => 0, 63 'Quantity' => $variation->get_stock_quantity() 64 ]; 54 65 } 55 66 } 67 } else { 68 if ($product->get_manage_stock()) { 69 $tax_rates = \WC_Tax::get_base_tax_rates($product->get_tax_class()); 70 $first_rate = reset($tax_rates); 71 $tax_rate_value = isset($first_rate['rate']) ? floatval($first_rate['rate']) : floatval(23); 56 72 57 $data['Products'][] = [ 58 'Id' => strval($product->get_id()), 59 'Name' => $product->get_name(), 60 'TaxRate' => $tax_rate_value, 61 'Price' => $product->get_price(), 62 'BuyPrice' => 0, 63 'Quantity' => $product->get_stock_quantity() 64 ]; 73 if ($prices_with_tax) { 74 $price = $product->get_price(); 75 $taxes = \WC_Tax::calc_tax($price, $tax_rates, false); 76 $price_with_tax = $price + array_sum($taxes); 77 } else { 78 $price_with_tax = $product->get_price(); 79 } 80 81 $data['Products'][] = [ 82 'Id' => strval($product->get_id()), 83 'Name' => $product->get_name(), 84 'TaxRate' => $tax_rate_value, 85 'Price' => $price_with_tax, 86 'BuyPrice' => 0, 87 'Quantity' => $product->get_stock_quantity() 88 ]; 89 } 65 90 } 66 91 } -
wintouch-cloud/trunk/wintouch-cloud.php
r3447688 r3448855 3 3 * Plugin Name: WINTOUCH Cloud 4 4 * Description: Uma ferramenta de faturação para o seu negócio. 5 * Version: 0.0. 45 * Version: 0.0.5 6 6 * Author: WINTOUCH 7 7 * Author URI: https://wintouchcloud.com
Note: See TracChangeset
for help on using the changeset viewer.