diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/SystemLogger.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/SystemLogger.php similarity index 73% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/SystemLogger.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/SystemLogger.php index 586c74f..bf34a2f 100644 --- a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/SystemLogger.php +++ b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/SystemLogger.php @@ -35,7 +35,7 @@ class SystemLogger var $passed_param; var $result_string; - function SystemLogger() + function __construct() { // constructor definition $this->when = ''; @@ -107,30 +107,30 @@ function metric($type,$linecount,$docno,$connectortime,$latency) */ function writeConfigLog($account,$license,$serviceurl,$companyCode,$environment,$client,$isAvataxEnabled,$isUPCOption,$isSaveTransaction,$isLogEnabled,$isAddressValidation) - { - $logging_folder = $this->createLogPath(); - $log_file_name = $logging_folder . "/Ava-Connector-Configuration-Log-" . date('d-m-Y') . ".txt"; - $log_file = fopen($log_file_name, "a") or die("Unable to open $log_file_name "); + { + $logging_folder = $this->createLogPath(); + $log_file_name = $logging_folder . "/Ava-Connector-Configuration-Log-" . date('d-m-Y') . ".txt"; + $log_file = fopen($log_file_name, "a") or die("Unable to open $log_file_name "); - fprintf($log_file, "%s", "Connector Configuration : "); - fprintf($log_file, "%s%s", "Account ID : ", $account); - fprintf($log_file, "%s%s", " License Key : ", $license); - fprintf($log_file, "%s%s", ",ServiceURL : ", $serviceurl); - fprintf($log_file, "%s%s\r", ",Company Code: ", $companyCode); - fprintf($log_file, "%s%s", "Environment : ", $environment); - fprintf($log_file, "%s%s", ",Client : ", $client); - fprintf($log_file, "%s%s", ",Is Avatax Enabled : ", $isAvataxEnabled); - fprintf($log_file, "%s%s", ",Is UPC Option Enabled: ", $isUPCOption); - fprintf($log_file, "%s%s", ",Is Save Transaction Enabled: ", $isSaveTransaction); - fprintf($log_file, "%s%s", ",Is Log Enabled: ", $isLogEnabled); - fprintf($log_file, "%s%s\r\n", ",Is Address Validation Enabled: ", $isAddressValidation); - //fprintf($log_file, "%s%s\r\n", "------------", "------------"); + fprintf($log_file, "%s", "Connector Configuration : "); + fprintf($log_file, "%s%s", "Account ID : ", $account); + fprintf($log_file, "%s%s", " License Key : ", $license); + fprintf($log_file, "%s%s", ",ServiceURL : ", $serviceurl); + fprintf($log_file, "%s%s\r", ",Company Code: ", $companyCode); + fprintf($log_file, "%s%s", "Environment : ", $environment); + fprintf($log_file, "%s%s", ",Client : ", $client); + fprintf($log_file, "%s%s", ",Is Avatax Enabled : ", $isAvataxEnabled); + fprintf($log_file, "%s%s", ",Is UPC Option Enabled: ", $isUPCOption); + fprintf($log_file, "%s%s", ",Is Save Transaction Enabled: ", $isSaveTransaction); + fprintf($log_file, "%s%s", ",Is Log Enabled: ", $isLogEnabled); + fprintf($log_file, "%s%s\r\n", ",Is Address Validation Enabled: ", $isAddressValidation); + //fprintf($log_file, "%s%s\r\n", "------------", "------------"); - fclose($log_file); - } + fclose($log_file); + } function serviceLog($performance_metrics) - { + { $resp = array(); foreach ($performance_metrics as $entry) { $row = array(); @@ -140,48 +140,48 @@ function serviceLog($performance_metrics) array_push($resp, implode(',', $row)); } - $csv_data = implode("\r\n", $resp); + $csv_data = implode("\r\n", $resp); $url = 'https://qa.cphforavatax.com/Ava_Post_C_Log'; //$url = 'https://avataxforcph.connectorsdev.avatax.com/Ava_Post_C_Log'; $ch = curl_init($url); $options = array( - CURLOPT_RETURNTRANSFER => true, // return web page - CURLOPT_HEADER => false, // don't return headers - CURLOPT_FOLLOWLOCATION => false, // follow redirects - // CURLOPT_ENCODING => "utf-8", // handle all encodings - CURLOPT_AUTOREFERER => true, // set referer on redirect - CURLOPT_CONNECTTIMEOUT => 20, // timeout on connect - CURLOPT_TIMEOUT => 20, // timeout on response - CURLOPT_POST => 1, // i am sending post data - CURLOPT_POSTFIELDS => $csv_data, // this are my post vars - CURLOPT_SSL_VERIFYHOST => 0, // don't verify ssl - CURLOPT_SSL_VERIFYPEER => false, // - CURLOPT_VERBOSE => 1 + CURLOPT_RETURNTRANSFER => true, // return web page + CURLOPT_HEADER => false, // don't return headers + CURLOPT_FOLLOWLOCATION => false, // follow redirects + // CURLOPT_ENCODING => "utf-8", // handle all encodings + CURLOPT_AUTOREFERER => true, // set referer on redirect + CURLOPT_CONNECTTIMEOUT => 20, // timeout on connect + CURLOPT_TIMEOUT => 20, // timeout on response + CURLOPT_POST => 1, // i am sending post data + CURLOPT_POSTFIELDS => $csv_data, // this are my post vars + CURLOPT_SSL_VERIFYHOST => 0, // don't verify ssl + CURLOPT_SSL_VERIFYPEER => false, // + CURLOPT_VERBOSE => 1 ); curl_setopt_array($ch,$options); $data = curl_exec($ch); $curl_errno = curl_errno($ch); - $curl_error = curl_error($ch); + $curl_error = curl_error($ch); curl_close($ch); - return $data; + return $data; //echo "

CURL Response

"; */ } function createLogPath() { // If does not exist, create a folder named ava-sys-logs - under the given path - // $curr_dir = getcwd(); + // $curr_dir = getcwd(); // Check if a folder named ava-logs exist below CWD //$dir_name = 'ava-logs'; - $dir_name = dirname ( __FILE__ ).'/ava-logs'; // For now this is hard-coded - if (is_dir($dir_name)) // Checking if the sub-folder ava-logs exists under current folder - { + $dir_name = dirname ( __FILE__ ).'/ava-logs'; // For now this is hard-coded + // Checking if the sub-folder ava-logs exists under current folder + if (is_dir($dir_name)) { if ($dh = opendir($dir_name)) { @@ -197,17 +197,15 @@ function createLogPath() mkdir($dir_name, 0777, true); } - } - else - { + } else { mkdir($dir_name, 0777, true); } $log_folder = $dir_name; return $log_folder; - } + /* Writes the current system log to designated log file */ function WriteSystemLogToFile() { @@ -226,7 +224,6 @@ function WriteSystemLogToFile() fprintf($log_file, "%s%s\r\n", "------------", "------------"); fclose($log_file); - } function WriteSystemLogToDB() @@ -240,12 +237,9 @@ function WriteSystemLogToDB() $con = mysqli_connect($dbhost_name, $username, $password, $database); // Check connection - if (mysqli_connect_errno()) - { + if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); - } - else - { + } else { ; // connection successful } @@ -282,7 +276,7 @@ function WriteSystemLogToDB() mysqli_query($con, $query); // fetch the record no of last inserted record - $rec_no = mysqli_insert_id($con); + $rec_no = mysqli_insert_id($con); // close the database mysqli_close($con); diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/addon.xml b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/addon.xml similarity index 82% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/addon.xml rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/addon.xml index 6d7170e..bdab74f 100644 --- a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/addon.xml +++ b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/addon.xml @@ -1,23 +1,25 @@ avatax_tax_calculation - 1.0 + 1.1 en Avalara AvaTax Avalara AvaTax 100502 active + Avalara + https://www.avalara.com +
Sign in - - info - fn_avatax_tax_gen_info - - - + + info + fn_avatax_tax_gen_info + + input Account ID generated by AvaTax Account ID* @@ -43,12 +45,12 @@ - AvaTax Service - info - fn_avatax_tax_calculation_testconnection + AvaTax Service + info + fn_avatax_tax_calculation_testconnection - - Company Name* + + Company Name* selectbox @@ -68,8 +70,8 @@ No - - + + Send UPC code to AvaTax radiogroup @@ -97,7 +99,7 @@ - + Enable AvaTax address validation radiogroup 0 @@ -108,7 +110,7 @@ No - + Enable Log @@ -137,8 +139,11 @@
- - + + + + + ALTER TABLE `?:status_descriptions` ADD status VARCHAR(1) NOT NULL; ALTER TABLE `?:status_descriptions` ADD type VARCHAR(1) NOT NULL; UPDATE `?:status_descriptions` SET status = 'A' , type = 'G' where description ='Active'; @@ -155,7 +160,6 @@ UPDATE `?:status_descriptions` SET status = 'P' , type = 'O' where description ='Processed'; UPDATE `?:status_descriptions` SET status = 'R' , type = 'R' where description ='Requested'; UPDATE `?:status_descriptions` SET status = 'U' , type = 'G' where description ='Used'; - ALTER TABLE `?:orders` ADD `avatax_paytax_document_id` INT NOT NULL DEFAULT '0', ADD `avatax_paytax_transaction_id` INT NOT NULL DEFAULT '0', ADD `avatax_paytax_document_code` VARCHAR( 40 ) NOT NULL, ADD `avatax_paytax_error_message` TEXT NOT NULL; ALTER TABLE `?:status_descriptions` ADD `avatax_document_status` VARCHAR( 30 ) NOT NULL; UPDATE `?:status_descriptions` SET avatax_document_status = 'Committed' where status ='C' and type = 'O'; @@ -170,7 +174,6 @@ UPDATE `?:status_descriptions` SET avatax_document_status = 'Voided' where status ='D' and type = 'R'; UPDATE `?:status_descriptions` SET avatax_document_status = 'Committed' where status ='C' and type = 'R'; ALTER TABLE ?:rma_returns ADD `avatax_return_document_code` VARCHAR( 10 ) NOT NULL; - ALTER TABLE ?:users ADD `tax_exempt_number` VARCHAR( 30 ) NOT NULL; ALTER TABLE ?:users ADD `tax_entity_usecode` CHAR( 1 ) NOT NULL; DROP TABLE IF EXISTS ?:avatax_entity_usecode; @@ -184,7 +187,7 @@ ALTER TABLE ?:products ADD `tax_code` VARCHAR( 11 ) DEFAULT 'none'; UPDATE ?:products SET `tax_code`= 'none' WHERE `tax_code` = 'none'; - + ALTER TABLE ?:products ADD `upc_code` VARCHAR( 20 ) DEFAULT 'none'; UPDATE ?:products SET `upc_code`= 'none' WHERE `upc_code` = 'none'; @@ -193,7 +196,27 @@ ALTER TABLE ?:users ADD `tax_exempt_number` VARCHAR( 25 ) NOT NULL DEFAULT 'Tax Exempt'; UPDATE ?:users SET `tax_exempt_number`= 'none' WHERE `tax_exempt_number` = 'Tax Exempt'; - - DROP TABLE IF EXISTS ?:avatax_entity_usecode; + + + + ALTER TABLE `?:status_descriptions` DROP COLUMN status; + ALTER TABLE `?:status_descriptions` DROP COLUMN type; + + ALTER TABLE `?:orders` DROP COLUMN `avatax_paytax_document_id`; + ALTER TABLE `?:orders` DROP COLUMN `avatax_paytax_transaction_id`; + ALTER TABLE `?:orders` DROP COLUMN `avatax_paytax_document_code`; + ALTER TABLE `?:orders` DROP COLUMN `avatax_paytax_error_message`; + + ALTER TABLE `?:status_descriptions` DROP COLUMN `avatax_document_status`; + + ALTER TABLE ?:rma_returns DROP COLUMN `avatax_return_document_code`; + ALTER TABLE ?:users DROP COLUMN `tax_exempt_number`; + ALTER TABLE ?:users DROP COLUMN `tax_entity_usecode`; + + DROP TABLE IF EXISTS ?:avatax_entity_usecode; + + ALTER TABLE ?:products DROP COLUMN `tax_code`; + ALTER TABLE ?:products DROP COLUMN `upc_code`; + ALTER TABLE ?:shippings DROP COLUMN `tax_code`; -
+ \ No newline at end of file diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/controllers/backend/avatax_tax_calculation.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/controllers/backend/avatax_tax_calculation.php new file mode 100644 index 0000000..418e1bb --- /dev/null +++ b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/controllers/backend/avatax_tax_calculation.php @@ -0,0 +1,96 @@ +format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); + $performance_metrics[] = array("CallerTimeStamp","MessageString","CallerAcctNum","DocCode","Operation","ServiceURL","LogType","LogLevel","ERPName","ERPVersion","ConnectorVersion"); + $performance_metrics[] = array($connectorstart,$msgString,$account,"","Connector Configuration",$serviceurl,"Performance","Informational","CS-Cart",PRODUCT_VERSION,AVALARA_VERSION); + + //Call serviceLog function + $returnServiceLog = $config_log->serviceLog($performance_metrics); + //$config_log->writeConfigLog($account,$license,$serviceurl,$companyCode,$environment,$client,$isAvataxEnabled,$isUPCOption,$isSaveTransaction,$isLogEnabled,$isAddressValidation); + exit; + } + + if ($mode == 'create_account') { + $lib_path = Registry::get('config.dir.addons') . 'avatax_tax_calculation/lib/'; + $addon_path = Registry::get('config.dir.addons') . 'avatax_tax_calculation'; + $log_mode = Registry::get('addons.avatax_tax_calculation.avatax_log_mode'); + include_once($lib_path."AvaTax4PHP/avatax_create_account.php"); + exit; + } + + if ($mode == 'tpa') { + $lib_path = Registry::get('config.dir.addons') . 'avatax_tax_calculation/lib/'; + $addon_path = Registry::get('config.dir.addons') . 'avatax_tax_calculation'; + $log_mode = Registry::get('addons.avatax_tax_calculation.avatax_log_mode'); + include_once($lib_path."AvaTax4PHP/tpa.php"); + exit; + } + + if ($mode == 'validate_account') { + $lib_path = Registry::get('config.dir.addons') . 'avatax_tax_calculation/lib/'; + $addon_path = Registry::get('config.dir.addons') . 'avatax_tax_calculation'; + $log_mode = Registry::get('addons.avatax_tax_calculation.avatax_log_mode'); + include_once($lib_path."AvaTax4PHP/avatax_validate_account.php"); + exit; + } +} \ No newline at end of file diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/controllers/backend/profiles_pre.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/controllers/backend/profiles_pre.php similarity index 97% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/controllers/backend/profiles_pre.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/controllers/backend/profiles_pre.php index 2938a5b..6773d38 100644 --- a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/controllers/backend/profiles_pre.php +++ b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/controllers/backend/profiles_pre.php @@ -18,9 +18,6 @@ if (!defined('BOOTSTRAP')) { die('Access denied'); } if ($mode == 'update') { - $content .= "Product Original Price *** \n"; - file_put_contents("usage_log.txt", $content, FILE_APPEND | LOCK_EX); - - + file_put_contents("usage_log.txt", $content, FILE_APPEND | LOCK_EX); } \ No newline at end of file diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/func.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/func.php similarity index 55% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/func.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/func.php index d77df79..db84c17 100644 --- a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/func.php +++ b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/func.php @@ -15,9 +15,9 @@ /*************************************************************************** * * * This source file was cleaned-up to meet the requirements for release * - * done by Avalara - on 02/20/2015 * - * File Version : * - * Last Updated On : 05/27/2016 * + * done by Avalara - on 02/20/2015 * + * File Version : * + * Last Updated On : 03/02/2021 * ***************************************************************************/ @@ -36,532 +36,225 @@ /*************************************************************************** * * - * Function Header * - * * - * File Version : * - * Last Updated On : 02/20/2015 * + * Function Header * + * * + * File Version : * + * Last Updated On : 03/02/2021 * * Description : This function allow user to test the connection * * between CS Cart and Avalara Admin Console. This * * action is performed after installing the AvaTax * * Addon from CS Cart Admin Console * - **********************************************e*****************************/ + ****************************************************************************/ function fn_avatax_tax_calculation_testconnection() { - $curPageURL = explode("?", curPageURL()); + $curPageURL = explode("?", curPageURL()); $text = ' - -
+ +
-
-
- - - -
-
- '; - + } + +
+ '; return $text; } -function fn_avatax_tax_account_creation_info(){ + +function fn_avatax_tax_account_creation_info() { $text=""; - $text = '
+ $text = '
Please click on Sign In tab, once you have successfully created an Avalara AvaTax account.
'; return $text; - } -function fn_avatax_tax_gen_info(){ + +function fn_avatax_tax_gen_info() { $text=""; $text = '
-
If you already have Avalara Account
+
If you already have Avalara Account
'; return $text; } - function fn_avatax_tax_calculation_TPA_link() { - $text = ' - '; - - $text = $text.'
+ $text = '
Click here for AvaTax Tax Profile Assistant
Note: Nexus recommendations are based on the analysis of either your last 1000 transactions or your last 1 year\'s transactional data.
'; - $text=$text .'
'; - return $text; -} + $text = $text .'
'; + $text = $text.' + '; + + return $text; +} + +function fn_avatax_tax_account_provision() { + $text=""; + $curPageURL = explode("?", curPageURL()); + $text = '
-'; - return $text; + '; + return $text; } - - -function fn_avatax_tax_setup_assistant(){ - $text=""; - $curPageURL = explode("?", curPageURL()); - $text = ' - -
- +function fn_avatax_tax_setup_assistant() { + $text=""; + $curPageURL = explode("?", curPageURL()); + $text = ' + + -
-
- '; - return $text; + .ui-dailog-inner { + z-index: 9999 !important; + } + +
+ '; + return $text; } /*************************************************************************** - * * - * Function Header * - * * - * File Version : * - * Last Updated On : 02/20/2015 * - * Description : This function displays the link to Avalara * - * Production Admin Console. * - * To be accessed from Avatax ->Setting * - **********************************************e*****************************/ + * * + * Function Header * + * * + * File Version : * + * Last Updated On : 03/02/2021 * + * Description : This function displays the link to Avalara * + * Production Admin Console. * + * To be accessed from Avatax ->Setting * + ****************************************************************************/ function fn_avatax_tax_calculation_admin_console_link() { $text = ''; return $text; } /*************************************************************************** * * - * Function Header * - * * - * File Version : * - * Last Updated On : 02/20/2015 * - * Description : This function displays the link to Avalara * - * Nexus help. * - * To be accessed from Avatax ->Setting * - **********************************************e*****************************/ + * Function Header * + * * + * File Version : * + * Last Updated On : 03/02/2021 * + * Description : This function displays the link to Avalara * + * Nexus help. * + * To be accessed from Avatax ->Setting * + ****************************************************************************/ function fn_avatax_tax_calculation_admin_nexus_link() { $text = '
@@ -571,19 +264,19 @@ function fn_avatax_tax_calculation_admin_nexus_link() } /*************************************************************************** - * * - * Function Header * - * * - * File Version : * - * Last Updated On : 02/20/2015 * - * Description : This function returns the Page URL via * - * curl library. * - * * - **********************************************e*****************************/ + * * + * Function Header * + * * + * File Version : * + * Last Updated On : 03/02/2021 * + * Description : This function returns the Page URL via * + * curl library. * + * * + ****************************************************************************/ function curPageURL() { $pageURL = 'http'; - if (isset($_SERVER["HTTPS"])&& $_SERVER["HTTPS"] == "on") { + if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") { $pageURL .= "s"; } $pageURL .= "://"; @@ -593,95 +286,80 @@ function curPageURL() $pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]; } return $pageURL; - } /*************************************************************************** * * - * Function Header * - * * - * File Version : * - * Last Updated On : 02/20/2015 * - * Description : This function returns the original price of * - * product by product ID * - * * - **********************************************e*****************************/ + * Function Header * + * * + * File Version : * + * Last Updated On : 03/02/2021 * + * Description : This function returns the original price of * + * product by product ID * + * * + ****************************************************************************/ function fn_product_real_price($product_id) { - - $product_original_price = 0; - - $product_original_price = db_get_field("SELECT price FROM ?:product_prices WHERE product_id = ?i AND lower_limit = 1", $product_id); - - return $product_original_price; + return db_get_field("SELECT price FROM ?:product_prices WHERE product_id = ?i AND lower_limit = 1", $product_id); } - /*************************************************************************** - * * - * Function Header * - * * - * File Version : * - * Last Updated On : 02/20/2015 * - * Description : This function updates the AvaTax fields in order* - * * - **********************************************e*****************************/ + /**************************************************************************** + * * + * Function Header * + * * + * File Version : * + * Last Updated On : 03/02/2021 * + * Description : This function updates the AvaTax fields in order* + * * + ****************************************************************************/ function fn_avatax_tax_calculation_update_order_with_avatax_fields($avatax_document_id, $avatax_transaction_id, $avatax_document_code, $avatax_error_message, $order_id) { - db_query("UPDATE `?:orders` SET avatax_paytax_document_id = '" . (int)$avatax_document_id . "', avatax_paytax_transaction_id = '" . (int)$avatax_transaction_id . "', avatax_paytax_document_code = '" . (int)$avatax_document_code . "', avatax_paytax_error_message = '" . $avatax_error_message . "' WHERE order_id = '" . (int)$order_id . "'"); - } - /*************************************************************************** - * * - * Function Header * - * * - * File Version : * - * Last Updated On : 02/22/2015 * - * Description : This function returns Doc Code from Return Order* - * * - **********************************************e*****************************/ + /**************************************************************************** + * * + * Function Header * + * * + * File Version : * + * Last Updated On : 02/22/2015 * + * Description : This function returns Doc Code from Return Order* + * * + ****************************************************************************/ function fn_avatax_tax_calculation_get_return_order_doc_code($order_id) { - $return_order_doc_code = db_get_field("SELECT count(*) as total FROM ?:rma_returns WHERE order_id = ?i", $order_id); - - return $return_order_doc_code; + return db_get_field("SELECT count(*) as total FROM ?:rma_returns WHERE order_id = ?i", $order_id); } /*************************************************************************** * * - * Function Header * - * * - * File Version : * - * Last Updated On : 02/22/2015 * + * Function Header * + * * + * File Version : * + * Last Updated On : 02/03/2021 * * Description : This function returns the ID of Return Reason * - * * - **********************************************e*****************************/ + * * + ****************************************************************************/ function fn_return_reason($return_reason_id) { - - $return_reason = ""; - - $return_reason = db_get_field("SELECT property FROM ?:rma_property_descriptions WHERE property_id = ?i", $return_reason_id); - - return $return_reason; + return db_get_field("SELECT property FROM ?:rma_property_descriptions WHERE property_id = ?i", $return_reason_id); } /*************************************************************************** * * - * Function Header * - * * - * File Version : * - * Last Updated On : 02/22/2015 * + * Function Header * + * * + * File Version : * + * Last Updated On : 02/03/2021 * * Description : This function returns the ID of Return Reason * - * * - **********************************************e*****************************/ + * * + ****************************************************************************/ function fn_edit_return_with_avatax_doccode($avatax_return_document_code, $return_id) { @@ -699,33 +377,29 @@ function fn_edit_return_with_avatax_doccode($avatax_return_document_code, $retur /*************************************************************************** * * - * Function Header * - * * - * File Version : * - * Last Updated On : 02/22/2015 * + * Function Header * + * * + * File Version : * + * Last Updated On : 02/03/2021 * * Description : This function fetches the tax exemption details * - * from the database table * - **********************************************e*****************************/ - - + * from the database table * + ****************************************************************************/ + function fn_get_tax_exemption_details($user_id) { $tax_exemption_details = db_get_row("SELECT tax_exempt, tax_exempt_number, tax_entity_usecode FROM ?:users WHERE user_id = ?i", $user_id); - if ($tax_exemption_details["tax_exempt"] == 'Y') { - if($tax_exemption_details['tax_exempt_number'] == "") - { - $tax_exemption_details['tax_exempt_number'] = "Exempt"; - } - $tax_exemption_details['tax_entity_usecode'] = ""; - } - + if ($tax_exemption_details["tax_exempt"] == 'Y') { + if ($tax_exemption_details['tax_exempt_number'] == "") { + $tax_exemption_details['tax_exempt_number'] = "Exempt"; + } + $tax_exemption_details['tax_entity_usecode'] = ""; + } if ($tax_exemption_details["tax_exempt"] == 'N') { - if($tax_exemption_details['tax_entity_usecode'] == "-") - { - $tax_exemption_details['tax_entity_usecode'] = ""; - } + if ($tax_exemption_details['tax_entity_usecode'] == "-") { + $tax_exemption_details['tax_entity_usecode'] = ""; + } $tax_exemption_details['tax_exempt_number'] = ""; // $tax_exemption_details['tax_entity_usecode'] = ""; } @@ -736,20 +410,17 @@ function fn_get_tax_exemption_details($user_id) /*************************************************************************** * * - * Function Header * - * * - * File Version : * - * Last Updated On : 02/22/2015 * + * Function Header * + * * + * File Version : * + * Last Updated On : 02/03/2021 * * Description : This function fetches the timestamp when the * - * tax was computed for given Order ID * - **********************************************e*****************************/ + * tax was computed for given Order ID * + ****************************************************************************/ - function fn_avatax_tax_calculation_get_order_timestamp($order_id) +function fn_avatax_tax_calculation_get_order_timestamp($order_id) { - - $order_timestamp = db_get_field("SELECT timestamp FROM ?:orders WHERE order_id = ?i", $order_id); - - return $order_timestamp; + return db_get_field("SELECT timestamp FROM ?:orders WHERE order_id = ?i", $order_id); } #} @@ -758,19 +429,17 @@ function fn_avatax_tax_calculation_get_order_timestamp($order_id) /** [ORDER STATUS CHANGES FUNCTIONS] **/ #{ Region STARTS - - /*************************************************************************** +/**************************************************************************** * * - * Function Header * - * * - * File Version : * - * Last Updated On : 02/22/2015 * - * Description : This function fetches document Status * - **********************************************e*****************************/ + * Function Header * + * * + * File Version : * + * Last Updated On : 02/03/2021 * + * Description : This function fetches document Status * + ****************************************************************************/ function fn_get_avatax_document_status() { - - $order_statuses = fn_get_statuses(STATUSES_ORDER, array(), true); + $order_statuses = fn_get_statuses(); $avatax_document_status = array(); foreach ($order_statuses as $key => $value) { @@ -784,15 +453,14 @@ function fn_get_avatax_document_status() /*************************************************************************** * * - * Function Header * - * * - * File Version : * - * Last Updated On : 02/22/2015 * - * Description : This function fetches document Status * - **********************************************e*****************************/ + * Function Header * + * * + * File Version : * + * Last Updated On : 02/03/2021 * + * Description : This function fetches document Status * + ****************************************************************************/ function fn_get_avatax_return_status() { - $order_statuses = fn_get_statuses(STATUSES_RETURN, array(), true); $avatax_document_status = array(); @@ -807,15 +475,14 @@ function fn_get_avatax_return_status() /*************************************************************************** * * - * Function Header * - * * - * File Version : * - * Last Updated On : 02/22/2015 * - * Description : This function sets Document State = void * - **********************************************e*****************************/ + * Function Header * + * * + * File Version : * + * Last Updated On : 02/03/2021 * + * Description : This function sets Document State = void * + ****************************************************************************/ function fn_document_state_voided($order_info, $status_from) { - $AvaTaxDocumentStatus = fn_get_avatax_document_status(); if (trim($AvaTaxDocumentStatus[$status_from]) == "Committed") { @@ -825,7 +492,7 @@ function fn_document_state_voided($order_info, $status_from) //1. Call CancelTax with CancelCode = DocDeleted $DocDeletedReturn = fn_avatax_tax_calculation_avatax_canceltax($order_info["avatax_paytax_document_code"], "DocDeleted"); - if($DocDeletedReturn == 'Success'){ + if ($DocDeletedReturn == 'Success') { //2. Call GetTax with Commit = False $DocCommittedReturn = fn_avatax_tax_calculation_avatax_gettax_commit($order_info, 0); @@ -839,27 +506,25 @@ function fn_document_state_voided($order_info, $status_from) } } - - /*************************************************************************** +/**************************************************************************** * * - * Function Header * - * * - * File Version : * - * Last Updated On : 02/22/2015 * - * Description : This function changes * -* Document State = Uncommitted * - **********************************************e*****************************/ + * Function Header * + * * + * File Version : * + * Last Updated On : 02/03/2021 * + * Description : This function changes * + * Document State = Uncommitted * + ****************************************************************************/ function fn_document_state_uncommitted($order_info, $status_from) { - $AvaTaxDocumentStatus = fn_get_avatax_document_status(); if (trim($AvaTaxDocumentStatus[$status_from]) == "Committed") { //1. Call CancelTax with CancelCode = Voided $DocVoidedReturn = fn_avatax_tax_calculation_avatax_canceltax($order_info["avatax_paytax_document_code"], "DocVoided"); //2. Call CancelTax with CancelCode = DocDeleted - if($DocVoidedReturn == 'Success'){ + if ($DocVoidedReturn == 'Success') { $DocDeletedReturn = fn_avatax_tax_calculation_avatax_canceltax($order_info["avatax_paytax_document_code"], "DocDeleted"); //3. Call GetTax with Commit = False $DocCommittedReturn = fn_avatax_tax_calculation_avatax_gettax_commit($order_info, 0); @@ -869,7 +534,7 @@ function fn_document_state_uncommitted($order_info, $status_from) $DocDeletedReturn = fn_avatax_tax_calculation_avatax_canceltax($order_info["avatax_paytax_document_code"], "DocDeleted"); //2. Call GetTax with Commit = False - if($DocDeletedReturn == 'Success'){ + if ($DocDeletedReturn == 'Success') { $DocCommittedReturn = fn_avatax_tax_calculation_avatax_gettax_commit($order_info, 0); } } else if (trim($AvaTaxDocumentStatus[$status_from]) == "Uncommitted") { @@ -879,36 +544,32 @@ function fn_document_state_uncommitted($order_info, $status_from) } /**************************************************************************** -* * -* Function Header * -* * -* File Version : * -* Last Updated On : 02/22/2015 * -* Description : This function changes * -* Document State = Committed * -****************************************************************************/ + * * + * Function Header * + * * + * File Version : * + * Last Updated On : 02/03/2021 * + * Description : This function changes * + * Document State = Committed * + ****************************************************************************/ function fn_document_state_committed($order_info, $status_from) { - - $AvaTaxDocumentStatus = fn_get_avatax_document_status(); + $AvaTaxDocumentStatus = fn_get_avatax_document_status(); if (trim($AvaTaxDocumentStatus[$status_from]) == "Committed") { //1. Call CancelTax with CancelCode = Voided $DocVoidedReturn = fn_avatax_tax_calculation_avatax_canceltax($order_info["avatax_paytax_document_code"], "DocVoided"); - if($DocVoidedReturn == 'Success'){ + if ($DocVoidedReturn == 'Success') { //2. Call CancelTax with CancelCode = DocDeleted $DocDeletedReturn = fn_avatax_tax_calculation_avatax_canceltax($order_info["avatax_paytax_document_code"], "DocDeleted"); //3. Call GetTax with Commit = False $DocCommittedReturn = fn_avatax_tax_calculation_avatax_gettax_commit($order_info, 1); } - - - } else if (trim($AvaTaxDocumentStatus[$status_from]) == "Voided") { //1. Call CancelTax with CancelCode = DocDeleted $DocDeletedReturn = fn_avatax_tax_calculation_avatax_canceltax($order_info["avatax_paytax_document_code"], "DocDeleted"); //2. Call GetTax with Commit = False - if($DocDeletedReturn == 'Success'){ + if ($DocDeletedReturn == 'Success') { $DocCommittedReturn = fn_avatax_tax_calculation_avatax_gettax_commit($order_info, 1); } } else if (trim($AvaTaxDocumentStatus[$status_from]) == "Uncommitted") { @@ -917,23 +578,26 @@ function fn_document_state_committed($order_info, $status_from) } } - /**************************************************************************** -* * -* Function Header * -* * -* File Version : * -* Last Updated On : 02/22/2015 * -* Description : This function changes * -* Document State to the desired state as per the * -* passed second parameter * -**********************************************e*****************************/ - -function fn_avatax_change_document_status($order_info,$status_to, $status_from, $order_id = 0) +* * +* Function Header * +* * +* File Version : * +* Last Updated On : 02/03/2021 * +* Description : This function changes * +* Document State to the desired state as per the * +* passed second parameter * +****************************************************************************/ + +function fn_avatax_change_document_status($order_info, $status_to, $status_from, $order_id = 0) { - - - + $log_mode = Registry::get('addons.avatax_tax_calculation.avatax_log_mode'); + if ($log_mode == 1) { + $e = new Exception(); + $application_log->AddSystemLog($timeStamp->format('Y-m-d H:i:s'), __FUNCTION__, __CLASS__, __METHOD__, __FILE__, '', $status_to, $e->getTraceAsString()); + $application_log->WriteSystemLogToFile(); + } + Switch ($status_to) { case 'P': //Processed fn_document_state_committed($order_info, $status_from); @@ -956,7 +620,6 @@ function fn_avatax_change_document_status($order_info,$status_to, $status_from, case 'I': //Canceled fn_document_state_voided($order_info, $status_from); break; - default: //Default //fn_document_state_committed($order_info, $status_from); break; @@ -969,33 +632,26 @@ function fn_avatax_change_document_status($order_info,$status_to, $status_from, /** [AVATAX API CALLS FUNCTIONS] **/ #{ - /**************************************************************************** -* * -* Function Header * -* * -* File Version : * -* Last Updated On : 02/22/2015 * -* Description : This function calculate the Taxable Amount * -* * -* Important (on Feb25): Removed all commented code from this function * -* * -**********************************************e*****************************/ - -function fn_avatax_tax_calculation_avatax_amount($group_products, $shipping_rates, $company_id, $cart, $auth) -{ - - - $timeStamp = new DateTime(); // Create Time Stamp - $connectorstart=$timeStamp->format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); +* * +* Function Header * +* * +* File Version : * +* Last Updated On : 02/03/2021 * +* Description : This function calculate the Taxable Amount * +* * +* Important (on Feb25): Removed all commented code from this function * +* * +****************************************************************************/ + +function fn_avatax_tax_calculation_avatax_amount($group_products, $shipping_rates, $company_id, $cart, $auth, $order_info) +{ + $timeStamp = new DateTime(); + $connectorstart = $timeStamp->format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); $time_start = round(microtime(true) * 1000); $lib_path = Registry::get('config.dir.addons') . 'avatax_tax_calculation/lib/'; require_once($lib_path . "AvaTax4PHP/AvaTax.php"); - spl_autoload_register('__autoload'); - - $environment = 'Development'; - $company_details = fn_get_company_placement_info($company_id); $service_url = Registry::get('addons.avatax_tax_calculation.avatax_service_url'); @@ -1004,9 +660,7 @@ function fn_avatax_tax_calculation_avatax_amount($group_products, $shipping_rate $client = CLIENT_NAME; $CompanyCode = Registry::get('addons.avatax_tax_calculation.avatax_company_code'); - $pos = strpos($service_url, "development"); - if ($pos === false) $environment = 'Production'; - else $environment = 'Development'; + $environment = (strpos($service_url, "development") === false) ? 'Production' : 'Development'; new ATConfig($environment, array('url' => $service_url, 'account' => $account, 'license' => $license, 'client' => $client, 'trace' => TRUE)); @@ -1033,17 +687,11 @@ function fn_avatax_tax_calculation_avatax_amount($group_products, $shipping_rate $DestCountry = $user_info['s_country']; } - $DocType = "SalesOrder"; $a = session_id(); if (empty($a)) session_start(); - - $DocCode=$order_info['order_id']; - if($DocCode=="") - { - $DocCode = session_id(); - } + $DocCode = array_key_exists('order_id', $order_info) && $order_info['order_id'] != "" ? $order_info['order_id'] : session_id(); $SalesPersonCode = ""; $EntityUseCode = ""; $Discount = $cart['subtotal_discount']; @@ -1078,7 +726,6 @@ function fn_avatax_tax_calculation_avatax_amount($group_products, $shipping_rate $request->setCurrencyCode(CART_PRIMARY_CURRENCY); $request->setCommit(FALSE); - //Add Origin Address $origin = new Address(); $origin->setLine1($OrigAddress); @@ -1123,29 +770,19 @@ function fn_avatax_tax_calculation_avatax_amount($group_products, $shipping_rate /////////////////////// UPC Implementation - Start ///////////////////////// // Receiving UPC Code if Set - if(Registry::get('addons.avatax_tax_calculation.avatax_tax_upc') == 1) + if (Registry::get('addons.avatax_tax_calculation.avatax_tax_upc') == 1) { $UpcCode = $product['product_id']; $UpcCode = db_get_field("SELECT `upc_code` FROM ?:products WHERE `product_id` = $UpcCode"); - if ( ($UpcCode == "") || ($UpcCode == "none") ){ - if($product["product_code"] == ""){ - $itemCode = substr($product["product"], 0, 50); - } - else{ - $itemCode = $product["product_code"]; - } - } - else - { + if ( ($UpcCode == "") || ($UpcCode == "none") ) { + $itemCode = $product["product_code"] == "" ? substr($product["product"], 0, 50) : $product["product_code"]; + } else { // UPC Code validation logic will come here : (Future) $itemCode = 'UPC:' . $UpcCode; } - } - else if($product["product_code"] == "") - { + } else if ($product["product_code"] == "") { $itemCode = substr($product["product"], 0, 50); - } - else { + } else { $itemCode = $product["product_code"]; } /////////////////////// UPC Implementation - End ///////////////////////// @@ -1170,7 +807,6 @@ function fn_avatax_tax_calculation_avatax_amount($group_products, $shipping_rate } $shipping_id = $cart['chosen_shipping'][0]; if (isset($shipping_id[0]) || isset($shipping_id)) { - $TaxCode = db_get_field("SELECT `tax_code` FROM ?:shippings WHERE `shipping_id` = $shipping_id"); if ($TaxCode == "none") { $TaxCode = 'FR'; @@ -1195,31 +831,30 @@ function fn_avatax_tax_calculation_avatax_amount($group_products, $shipping_rate $returnMessage = ""; try { - if (!empty($DestPostalCode)) { - $connectortime = round(microtime(true) * 1000)-$time_start; + $connectortime = round(microtime(true) * 1000) - $time_start; $latency = round(microtime(true) * 1000); - $connectorcalling=$timeStamp->format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); + $connectorcalling = $timeStamp->format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); $getTaxResult = $client->getTax($request); - $connectorcomplete=$timeStamp->format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); - $latency = round(microtime(true) * 1000)-$latency; + $connectorcomplete = $timeStamp->format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); + $latency = round(microtime(true) * 1000) - $latency; // Error Trapping if ($getTaxResult->getResultCode() == SeverityLevel::$Success) { /*** * Place holder for logs * getLastRequest * getLastResponse - $client->__getLastRequest() - $client->__getLastRes() - - ******/ - - /************* Logging code snippet (optional) starts here *******************/ - // System Logger starts here: + $client->__getLastRequest() + $client->__getLastRes() + + ******/ + + /************* Logging code snippet (optional) starts here *******************/ + // System Logger starts here: require_once "SystemLogger.php"; // Creating the System Logger Object - $application_log = new SystemLogger; - $connectorend=$timeStamp->format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); + $application_log = new SystemLogger; + $connectorend = $timeStamp->format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); $performance_metrics[] = array("CallerTimeStamp","MessageString","CallerAcctNum","DocCode","Operation","ServiceURL","LogType","LogLevel","ERPName","ERPVersion","ConnectorVersion"); $performance_metrics[] = array($connectorstart,"\"LINECOUNT -".count($getTaxResult->getTaxLines())."PreGetTax Start Time-\"".$connectorstart,$account,$getTaxResult->getDocCode(),"GetTax",$service_url,"Performance","Informational","CS-Cart",PRODUCT_VERSION,AVALARA_VERSION); $performance_metrics[] = array($connectorcalling,"\"LINECOUNT -".count($getTaxResult->getTaxLines())."PreGetTax End Time-\"".$connectorcalling,$account,$getTaxResult->getDocCode(),"GetTax ",$service_url,"Performance","Informational","CS-Cart",PRODUCT_VERSION,AVALARA_VERSION); @@ -1229,30 +864,24 @@ function fn_avatax_tax_calculation_avatax_amount($group_products, $shipping_rate $returnServiceLog = $application_log->serviceLog($performance_metrics); $log_mode = Registry::get('addons.avatax_tax_calculation.avatax_log_mode'); - if($log_mode==1){ - $params = '[Input: ' . ']'; // Create Param List - $u_name = ''; // Eventually will come from $_SESSION[] object - $application_log->AddSystemLog($timeStamp->format('Y-m-d H:i:s'), __FUNCTION__, __CLASS__, __METHOD__, __FILE__, $u_name, $params, $client->__getLastRequest()); // Create System Log - $application_log->WriteSystemLogToFile(); // Log info goes to log file - - $application_log->AddSystemLog($timeStamp->format('Y-m-d H:i:s'), __FUNCTION__, __CLASS__, __METHOD__, __FILE__, $u_name, $params, $client->__getLastResponse()); // Create System Log - $application_log->WriteSystemLogToFile(); // Log info goes to log file + if ($log_mode == 1) { + $params = '[Input: ' . ']'; // Create Param List + $u_name = ''; // Eventually will come from $_SESSION[] object + $application_log->AddSystemLog($timeStamp->format('Y-m-d H:i:s'), __FUNCTION__, __CLASS__, __METHOD__, __FILE__, $u_name, $params, $client->__getLastRequest()); // Create System Log + $application_log->WriteSystemLogToFile(); // Log info goes to log file + + $application_log->AddSystemLog($timeStamp->format('Y-m-d H:i:s'), __FUNCTION__, __CLASS__, __METHOD__, __FILE__, $u_name, $params, $client->__getLastResponse()); // Create System Log + $application_log->WriteSystemLogToFile(); // Log info goes to log file //$application_log->metric('GetTax '.$getTaxResult->getDocType(),count($getTaxResult->getTaxLines()),$getTaxResult->getDocCode(),$connectortime,$latency); - // $application_log->WriteSystemLogToDB(); // Log info goes to DB - // System Logger ends here - // Logging code snippet (optional) ends here - } - else{} - - - - + // $application_log->WriteSystemLogToDB(); // Log info goes to DB + // System Logger ends here + // Logging code snippet (optional) ends here + } // If NOT success - display error messages to console // it is important to iterate through the entire message class return $getTaxResult; - } else { foreach ($getTaxResult->getMessages() as $msg) { $returnMessage .= $msg->getName() . ": " . $msg->getSummary() . "\n"; @@ -1270,34 +899,33 @@ function fn_avatax_tax_calculation_avatax_amount($group_products, $shipping_rate $avatax_tax_error = '
' . $return_message . '
'; fn_set_notification('E', __('error'), $avatax_tax_error); return 0; - } //Comment this line to return SOAP XML } /**************************************************************************** -* * -* Function Header * -* * -* File Version : * -* Last Updated On : 02/22/2015 * -* Description : This function validates the give address * -* Description : along with order info * -* * -* Important (on Feb25): To be removed * -* all commented code from this function * -* * -**********************************************e*****************************/ + * * + * Function Header * + * * + * File Version : * + * Last Updated On : 02/03/2021 * + * Description : This function validates the give address * + * Description : along with order info * + * * + * Important (on Feb25): To be removed * + * all commented code from this function * + * * + ****************************************************************************/ function fn_avatax_tax_calculation_avatax_address_validation($user_data) { - /* + /* $company_details = fn_get_company_placement_info($user_data['company_id']); $environment = 'Development'; - //if(Registry::get('addons.avatax_tax_calculation.avatax_development_mode')==1) $environment = 'Development'; + //if (Registry::get('addons.avatax_tax_calculation.avatax_development_mode')==1) $environment = 'Development'; //else $environment = 'Production'; $service_url = Registry::get('addons.avatax_tax_calculation.avatax_service_url'); @@ -1321,8 +949,8 @@ function fn_avatax_tax_calculation_avatax_address_validation($user_data) $return_message = ""; $lib_path = Registry::get('config.dir.addons') . 'avatax_tax_calculation/lib/'; require_once($lib_path . "AvaTax4PHP/address_validation.php"); - $log_mode = Registry::get('addons.avatax_tax_calculation.avatax_log_mode'); - $addon_path = Registry::get('config.dir.addons') . 'avatax_tax_calculation/'; + $log_mode = Registry::get('addons.avatax_tax_calculation.avatax_log_mode'); + $addon_path = Registry::get('config.dir.addons') . 'avatax_tax_calculation/'; //$return_message = AddressValidation($address_data); @@ -1330,34 +958,32 @@ function fn_avatax_tax_calculation_avatax_address_validation($user_data) if (trim($return_message) != "") { $avatax_address_validation = '
' . $return_message . '
'; } */ - $avatax_address_validation = ""; + $avatax_address_validation = ""; return $avatax_address_validation; } /**************************************************************************** -* * -* Function Header * -* * -* File Version : * -* Last Updated On : 02/22/2015 * -* Description : This function serves as the wrapper function * -* for AvaTax GetTax() Call * -* * -* Important (on Feb25): Removed all commented code from this function * -* * -**********************************************e*****************************/ + * * + * Function Header * + * * + * File Version : * + * Last Updated On : 02/03/2021 * + * Description : This function serves as the wrapper function * + * for AvaTax GetTax() Call * + * * + * Important (on Feb25): Removed all commented code from this function * + * * + ****************************************************************************/ function fn_avatax_tax_calculation_avatax_gettax($order_info, $auth) { - $timeStamp = new DateTime(); // Create Time Stamp - $connectorstart=$timeStamp->format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); + $timeStamp = new DateTime(); // Create Time Stamp + $connectorstart = $timeStamp->format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); $time_start = round(microtime(true) * 1000); $lib_path = Registry::get('config.dir.addons') . 'avatax_tax_calculation/lib/'; require_once($lib_path . "AvaTax4PHP/AvaTax.php"); - spl_autoload_register('__autoload'); - $environment = 'Development'; $company_details = fn_get_company_placement_info($order_info['company_id']); $service_url = Registry::get('addons.avatax_tax_calculation.avatax_service_url'); @@ -1366,9 +992,7 @@ function fn_avatax_tax_calculation_avatax_gettax($order_info, $auth) $client = CLIENT_NAME; $CompanyCode = Registry::get('addons.avatax_tax_calculation.avatax_company_code'); - $pos = strpos($service_url, "development"); - if ($pos === false) $environment = 'Production'; - else $environment = 'Development'; + $environment = strpos($service_url, "development") === false ? 'Production' : 'Development'; new ATConfig($environment, array('url' => $service_url, 'account' => $account, 'license' => $license, 'client' => $client, 'trace' => TRUE)); @@ -1387,16 +1011,9 @@ function fn_avatax_tax_calculation_avatax_gettax($order_info, $auth) $DestRegion = $order_info["s_state"]; $DestPostalCode = $order_info["s_zipcode"]; $DestCountry = $order_info["s_country"]; - + //Code Added for Implementation of Doc Sav Feature in CS Cart 4.2.4 Build - if(Registry::get('addons.avatax_tax_calculation.avatax_tax_savedoc') == 1) - { - $DocType = "SalesInvoice"; - } - else - { - $DocType = "SalesOrder"; - } + $DocType = Registry::get('addons.avatax_tax_calculation.avatax_tax_savedoc') == 1 ? "SalesInvoice" : "SalesOrder"; $DocCode = $order_info['order_id']; $SalesPersonCode = ""; $EntityUseCode = ""; @@ -1486,30 +1103,19 @@ function fn_avatax_tax_calculation_avatax_gettax($order_info, $auth) /////////////////////// UPC Implementation - Start ///////////////////////// // Receiving UPC Code if set - // Implementation of UPC Code Implementation Feature in CS Cart 4.2.4 + // Implementation of UPC Code Implementation Feature in CS Cart 4.2.4 $UpcCode = $product_data['upc_code']; - if(Registry::get('addons.avatax_tax_calculation.avatax_tax_upc') == 1) + if (Registry::get('addons.avatax_tax_calculation.avatax_tax_upc') == 1) { - if ( ($UpcCode == "") || ($UpcCode == "none") ) { - if($v["product_code"] == ""){ - $itemCode = substr($v["product"], 0, 50); - - } - else{ - $itemCode = $v["product_code"]; - } - } - else - { + if ( ($UpcCode == "") || ($UpcCode == "none") ) { + $itemCode = $v["product_code"] == "" ? substr($v["product"], 0, 50) : $v["product_code"]; + } else { // UPC Code validation logic will come here : Future $itemCode = 'UPC:' . $UpcCode; } - } - else if($v["product_code"] == "") - { + } else if ($v["product_code"] == "") { $itemCode = substr($v["product"], 0, 50); - } - else{ + } else { $itemCode = $v["product_code"]; } @@ -1545,7 +1151,7 @@ function fn_avatax_tax_calculation_avatax_gettax($order_info, $auth) $product_total += $v['amount']; } - //Shipping Line Item + // Shipping Line Item // Order Totals $shipping_count = 0; @@ -1609,8 +1215,8 @@ function fn_avatax_tax_calculation_avatax_gettax($order_info, $auth) require_once "SystemLogger.php"; // Creating the System Logger Object - $application_log = new SystemLogger; - $connectorend=$timeStamp->format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); + $application_log = new SystemLogger; + $connectorend = $timeStamp->format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); $performance_metrics[] = array("CallerTimeStamp","MessageString","CallerAcctNum","DocCode","Operation","ServiceURL","LogType","LogLevel","ERPName","ERPVersion","ConnectorVersion"); $performance_metrics[] = array($connectorstart,"\"LINECOUNT -".count($getTaxResult->getTaxLines())."PreGetTax Start Time-\"".$connectorstart,$account,$getTaxResult->getDocCode(),"GetTax",$service_url,"Performance","Informational","CS-Cart",PRODUCT_VERSION,AVALARA_VERSION); $performance_metrics[] = array($connectorcalling,"\"LINECOUNT -".count($getTaxResult->getTaxLines())."PreGetTax End Time-\"".$connectorcalling,$account,$getTaxResult->getDocCode(),"GetTax ",$service_url,"Performance","Informational","CS-Cart",PRODUCT_VERSION,AVALARA_VERSION); @@ -1622,28 +1228,26 @@ function fn_avatax_tax_calculation_avatax_gettax($order_info, $auth) // System Logger starts here: $log_mode = Registry::get('addons.avatax_tax_calculation.avatax_log_mode'); - if($log_mode==1){ + if ($log_mode == 1) { - $params = '[Input: ' . ']'; // Create Param List - $u_name = ''; // Eventually will come from $_SESSION[] object - $application_log->AddSystemLog($timeStamp->format('Y-m-d H:i:s'), __FUNCTION__, __CLASS__, __METHOD__, __FILE__, $u_name, $params, $client->__getLastRequest()); // Create System Log - $application_log->WriteSystemLogToFile(); // Log info goes to log file + $params = '[Input: ' . ']'; // Create Param List + $u_name = ''; // Eventually will come from $_SESSION[] object + $application_log->AddSystemLog($timeStamp->format('Y-m-d H:i:s'), __FUNCTION__, __CLASS__, __METHOD__, __FILE__, $u_name, $params, $client->__getLastRequest()); // Create System Log + $application_log->WriteSystemLogToFile(); // Log info goes to log file - $application_log->AddSystemLog($timeStamp->format('Y-m-d H:i:s'), __FUNCTION__, __CLASS__, __METHOD__, __FILE__, $u_name, $params, $client->__getLastResponse()); // Create System Log - $application_log->WriteSystemLogToFile(); // Log info goes to log file + $application_log->AddSystemLog($timeStamp->format('Y-m-d H:i:s'), __FUNCTION__, __CLASS__, __METHOD__, __FILE__, $u_name, $params, $client->__getLastResponse()); // Create System Log + $application_log->WriteSystemLogToFile(); // Log info goes to log file // $application_log->metric('GetTax '.$getTaxResult->getDocType(),count($getTaxResult->getTaxLines()),$getTaxResult->getDocCode(),$connectortime,$latency); - // $application_log->WriteSystemLogToDB(); // Log info goes to DB - // System Logger ends here - // Logging code snippet (optional) ends here + // $application_log->WriteSystemLogToDB(); // Log info goes to DB + // System Logger ends here + // Logging code snippet (optional) ends here } - else{} - + return $GetTaxData; } else { - foreach ($getTaxResult->getMessages() as $msg) { $returnMessage .= $msg->getName() . ": " . $msg->getSummary() . "\n"; @@ -1668,29 +1272,27 @@ function fn_avatax_tax_calculation_avatax_gettax($order_info, $auth) /**************************************************************************** -* * -* Function Header * -* * -* File Version : * -* Last Updated On : 02/22/2015 * -* Description : This function serves as the wrapper function * -* for AvaTax GetTax() Call * -* * -* Important (on Feb25): Removed all commented code from this function * -* * -**********************************************e*****************************/ + * * + * Function Header * + * * + * File Version : * + * Last Updated On : 02/03/2021 * + * Description : This function serves as the wrapper function * + * for AvaTax GetTax() Call * + * * + * Important (on Feb25): Removed all commented code from this function * + * * + ****************************************************************************/ function fn_avatax_tax_calculation_avatax_gettax_commit($order_info, $commit_status) { - $timeStamp = new DateTime(); // Create Time Stamp + $timeStamp = new DateTime(); // Create Time Stamp $connectorstart=$timeStamp->format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); $time_start = round(microtime(true) * 1000); $lib_path = Registry::get('config.dir.addons') . 'avatax_tax_calculation/lib/'; require_once($lib_path . "AvaTax4PHP/AvaTax.php"); - spl_autoload_register('__autoload'); - $environment = 'Development'; $company_details = fn_get_company_placement_info($order_info['company_id']); $service_url = Registry::get('addons.avatax_tax_calculation.avatax_service_url'); @@ -1698,16 +1300,13 @@ function fn_avatax_tax_calculation_avatax_gettax_commit($order_info, $commit_sta $license = Registry::get('addons.avatax_tax_calculation.avatax_license_key'); $client = CLIENT_NAME; - $pos = strpos($service_url, "development"); - if ($pos === false) $environment = 'Production'; - else $environment = 'Development'; + $environment = strpos($service_url, "development") === false ? 'Production' : 'Development'; new ATConfig($environment, array('url' => $service_url, 'account' => $account, 'license' => $license, 'client' => $client, 'trace' => TRUE)); //Variable Mapping $CustomerCode = $order_info["user_id"]; - $OrigAddress = $company_details["company_address"]; $OrigCity = $company_details["company_city"]; $OrigRegion = $company_details["company_state"]; @@ -1721,14 +1320,7 @@ function fn_avatax_tax_calculation_avatax_gettax_commit($order_info, $commit_sta $DestCountry = $order_info["s_country"]; $CompanyCode = Registry::get('addons.avatax_tax_calculation.avatax_company_code'); - if(Registry::get('addons.avatax_tax_calculation.avatax_tax_savedoc') == 1) - { - $DocType = "SalesInvoice"; - } - else - { - $DocType = "SalesOrder"; - } + $DocType = Registry::get('addons.avatax_tax_calculation.avatax_tax_savedoc') == 1 ? "SalesInvoice" : "SalesOrder"; $DocCode = $order_info["order_id"]; $SalesPersonCode = ""; $EntityUseCode = ""; @@ -1803,51 +1395,36 @@ function fn_avatax_tax_calculation_avatax_gettax_commit($order_info, $commit_sta $avatax_discount_amount = 0; $auth = & $_SESSION['auth']; foreach ($order_info['products'] as $k => $v) { - - $product_original_amount = fn_product_real_price($v["product_id"]); - - $total_amount = ($v["price"] * $v["amount"]); - + $total_amount = ($v["price"] * $v["amount"]); $product_data = fn_get_product_data($v["product_id"], $auth); - $product_categories = ""; foreach ($product_data['category_ids'] as $pck => $pcv) { $product_categories .= fn_get_category_name($pcv) . ","; } $Description = $product_categories; - $TaxCode = $product_data["tax_code"]; - if ($TaxCode == "none") { $TaxCode = 'P0000000'; } - /////////////////////// UPC Implementation - Start ///////////////////////// // Receiving UPC Code if set $UpcCode = $product_data['upc_code']; - if(Registry::get('addons.avatax_tax_calculation.avatax_tax_upc') == 1) - { + if (Registry::get('addons.avatax_tax_calculation.avatax_tax_upc') == 1) { if ( ($UpcCode == "") || ($UpcCode == "none") ) { - if($v["product_code"] == ""){ + if ($v["product_code"] == "") { $itemCode = substr($v["product"], 0, 50); - } - else{ + } else{ $itemCode = $v["product_code"]; } - } - else - { + } else { // UPC Code validation logic will come here : Future $itemCode = 'UPC:' . $UpcCode; } - } - else if($v["product_code"] == "") - { + } else if ($v["product_code"] == "") { $itemCode = substr($v["product"], 0, 50); - } - else{ + } else{ $itemCode = $v["product_code"]; } /////////////////////// UPC Implementation - End ///////////////////////// @@ -1861,17 +1438,13 @@ function fn_avatax_tax_calculation_avatax_gettax_commit($order_info, $commit_sta $line1 = new Line(); - $line1->setNo($i + 1); - $line1->setItemCode($itemCode); $line1->setDescription($v["product"]); $line1->setTaxCode($TaxCode); $line1->setQty($v["amount"]); - $line1->setAmount($total_amount); $line1->setDiscounted(true); - $line1->setRevAcct($RevAcct); $line1->setRef1($Ref1); $line1->setRef2($Ref2); @@ -1898,7 +1471,6 @@ function fn_avatax_tax_calculation_avatax_gettax_commit($order_info, $commit_sta } $line1 = new Line(); $line1->setNo($i + 1); - $line1->setItemCode("Shipping"); $line1->setDescription($order_shipment['shipping']); $line1->setTaxCode($TaxCode); @@ -1918,23 +1490,19 @@ function fn_avatax_tax_calculation_avatax_gettax_commit($order_info, $commit_sta $shipping_count++; } - $request->setLines($lines); - $GetTaxData = array(); $returnMessage = ""; try { - $connectortime = round(microtime(true) * 1000)-$time_start; $latency = round(microtime(true) * 1000); - $connectorcalling=$timeStamp->format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); + $connectorcalling = $timeStamp->format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); $getTaxResult = $client->getTax($request); - $connectorcomplete=$timeStamp->format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); + $connectorcomplete = $timeStamp->format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); $latency = round(microtime(true) * 1000)-$latency; // Error Trapping if ($getTaxResult->getResultCode() == SeverityLevel::$Success) { - $GetTaxData['GetTaxDocCode'] = $getTaxResult->getDocCode(); $GetTaxData['GetTaxDocDate'] = $getTaxResult->getDocDate(); $GetTaxData['GetTaxTotalAmount'] = $getTaxResult->getTotalAmount(); @@ -1944,46 +1512,42 @@ function fn_avatax_tax_calculation_avatax_gettax_commit($order_info, $commit_sta * getLastRequest * getLastResponse */ - /************* Logging code snippet (optional) starts here *******************/ - // System Logger starts here: - require_once "SystemLogger.php"; - // Creating the System Logger Object - $application_log = new SystemLogger; - $connectorend=$timeStamp->format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); - $performance_metrics[] = array("CallerTimeStamp","MessageString","CallerAcctNum","DocCode","Operation","ServiceURL","LogType","LogLevel","ERPName","ERPVersion","ConnectorVersion"); - $performance_metrics[] = array($connectorstart,"\"LINECOUNT -".count($getTaxResult->getTaxLines())."PreGetTax Start Time-\"".$connectorstart,$account,$getTaxResult->getDocCode(),"GetTax",$service_url,"Performance","Informational","CS-Cart",PRODUCT_VERSION,AVALARA_VERSION); - $performance_metrics[] = array($connectorcalling,"\"LINECOUNT -".count($getTaxResult->getTaxLines())."PreGetTax End Time-\"".$connectorcalling,$account,$getTaxResult->getDocCode(),"GetTax ",$service_url,"Performance","Informational","CS-Cart",PRODUCT_VERSION,AVALARA_VERSION); - $performance_metrics[] = array($connectorcomplete,"\"LINECOUNT -".count($getTaxResult->getTaxLines())."PostGetTax Start Time-\"".$connectorcomplete,$account,$getTaxResult->getDocCode(),"GetTax ",$service_url,"Performance","Informational","CS-Cart",PRODUCT_VERSION,AVALARA_VERSION); - $performance_metrics[] = array($connectorend,"\"LINECOUNT -".count($getTaxResult->getTaxLines())."PostGetTax End Time-\"".$connectorend,$account,$getTaxResult->getDocCode(),"GetTax ",$service_url,"Performance","Informational","CS-Cart",PRODUCT_VERSION,AVALARA_VERSION); - //Call serviceLog function - $returnServiceLog = $application_log->serviceLog($performance_metrics); - - $log_mode = Registry::get('addons.avatax_tax_calculation.avatax_log_mode'); - if($log_mode==1){ - $params = '[Input: ' . ']'; // Create Param List - $u_name = ''; // Eventually will come from $_SESSION[] object - $application_log->AddSystemLog($timeStamp->format('Y-m-d H:i:s'), __FUNCTION__, __CLASS__, __METHOD__, __FILE__, $u_name, $params, $client->__getLastRequest()); // Create System Log - $application_log->WriteSystemLogToFile(); // Log info goes to log file + /************* Logging code snippet (optional) starts here *******************/ + // System Logger starts here: + require_once "SystemLogger.php"; + // Creating the System Logger Object + $application_log = new SystemLogger; + $connectorend=$timeStamp->format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); + $performance_metrics[] = array("CallerTimeStamp","MessageString","CallerAcctNum","DocCode","Operation","ServiceURL","LogType","LogLevel","ERPName","ERPVersion","ConnectorVersion"); + $performance_metrics[] = array($connectorstart,"\"LINECOUNT -".count($getTaxResult->getTaxLines())."PreGetTax Start Time-\"".$connectorstart,$account,$getTaxResult->getDocCode(),"GetTax",$service_url,"Performance","Informational","CS-Cart",PRODUCT_VERSION,AVALARA_VERSION); + $performance_metrics[] = array($connectorcalling,"\"LINECOUNT -".count($getTaxResult->getTaxLines())."PreGetTax End Time-\"".$connectorcalling,$account,$getTaxResult->getDocCode(),"GetTax ",$service_url,"Performance","Informational","CS-Cart",PRODUCT_VERSION,AVALARA_VERSION); + $performance_metrics[] = array($connectorcomplete,"\"LINECOUNT -".count($getTaxResult->getTaxLines())."PostGetTax Start Time-\"".$connectorcomplete,$account,$getTaxResult->getDocCode(),"GetTax ",$service_url,"Performance","Informational","CS-Cart",PRODUCT_VERSION,AVALARA_VERSION); + $performance_metrics[] = array($connectorend,"\"LINECOUNT -".count($getTaxResult->getTaxLines())."PostGetTax End Time-\"".$connectorend,$account,$getTaxResult->getDocCode(),"GetTax ",$service_url,"Performance","Informational","CS-Cart",PRODUCT_VERSION,AVALARA_VERSION); + //Call serviceLog function + $returnServiceLog = $application_log->serviceLog($performance_metrics); + + if (Registry::get('addons.avatax_tax_calculation.avatax_log_mode') == 1) { + $params = '[Input: ' . ']'; // Create Param List + $u_name = ''; // Eventually will come from $_SESSION[] object + $application_log->AddSystemLog($timeStamp->format('Y-m-d H:i:s'), __FUNCTION__, __CLASS__, __METHOD__, __FILE__, $u_name, $params, $client->__getLastRequest()); // Create System Log + $application_log->WriteSystemLogToFile(); // Log info goes to log file - $application_log->AddSystemLog($timeStamp->format('Y-m-d H:i:s'), __FUNCTION__, __CLASS__, __METHOD__, __FILE__, $u_name, $params, $client->__getLastResponse()); // Create System Log - $application_log->WriteSystemLogToFile(); // Log info goes to log file + $application_log->AddSystemLog($timeStamp->format('Y-m-d H:i:s'), __FUNCTION__, __CLASS__, __METHOD__, __FILE__, $u_name, $params, $client->__getLastResponse()); // Create System Log + $application_log->WriteSystemLogToFile(); // Log info goes to log file //$application_log->metric('GetTax '.$getTaxResult->getDocType(),count($getTaxResult->getTaxLines()),$getTaxResult->getDocCode(),$connectortime,$latency); - // $application_log->WriteSystemLogToDB(); // Log info goes to DB - // System Logger ends here - // Logging code snippet (optional) ends here + // $application_log->WriteSystemLogToDB(); // Log info goes to DB + // System Logger ends here + // Logging code snippet (optional) ends here } - else{} - + return $GetTaxData; } else { - - if($getTaxResult->getResultCode() == SeverityLevel::$Error){ + if ($getTaxResult->getResultCode() == SeverityLevel::$Error) { $return_message = "AvaTax - Error Message
"; - foreach($getTaxResult->getMessages() as $msg) - { + foreach($getTaxResult->getMessages() as $msg) { $return_message .= $msg->getSummary()."
"; } $avatax_tax_error = '
' . $return_message . '
'; @@ -2018,27 +1582,22 @@ function fn_avatax_tax_calculation_avatax_gettax_commit($order_info, $commit_sta /**************************************************************************** -* * -* Function Header * -* * -* File Version : * -* Last Updated On : 02/22/2015 * -* Description : This function serves as the wrapper function * -* for AvaTax PostTax() Call * -* * -* Important (on Feb25): Removed all commented code from this function * -* * -**********************************************e*****************************/ - + * * + * Function Header * + * * + * File Version : * + * Last Updated On : 02/03/2021 * + * Description : This function serves as the wrapper function * + * for AvaTax PostTax() Call * + * * + * Important (on Feb25): Removed all commented code from this function * + * * + ****************************************************************************/ function fn_avatax_tax_calculation_avatax_posttax($GetTaxReturnValue) { - $environment = 'Development'; - $service_url = Registry::get('addons.avatax_tax_calculation.avatax_service_url'); - $pos = strpos($service_url, "development"); - if ($pos === false) $environment = 'Production'; - else $environment = 'Development'; + $environment = strpos($service_url, "development") === false ? 'Production' : 'Development'; $order_data = array(); $dateTime = new DateTime(); @@ -2069,28 +1628,24 @@ function fn_avatax_tax_calculation_avatax_posttax($GetTaxReturnValue) /**************************************************************************** -* * -* Function Header * -* * -* File Version : * -* Last Updated On : 02/22/2015 * -* Description : This function serves as the wrapper function * -* for AvaTax CancelTax() Call * -* * -* Important (on Feb25): Removed all commented code from this function * -* * -**********************************************e*****************************/ + * * + * Function Header * + * * + * File Version : * + * Last Updated On : 02/03/2021 * + * Description : This function serves as the wrapper function * + * for AvaTax CancelTax() Call * + * * + * Important (on Feb25): Removed all commented code from this function * + * * + ****************************************************************************/ function fn_avatax_tax_calculation_avatax_canceltax($AvaTaxDocumentCode, $CancelCode, $DocType = "SalesInvoice") { //echo $AvaTaxDocumentCode; - $environment = 'Development'; - $service_url = Registry::get('addons.avatax_tax_calculation.avatax_service_url'); - $pos = strpos($service_url, "development"); - if ($pos === false) $environment = 'Production'; - else $environment = 'Development'; + $environment = strpos($service_url, "development") === false ? 'Production' : 'Development'; $order_data = array(); $dateTime = new DateTime(); @@ -2116,28 +1671,23 @@ function fn_avatax_tax_calculation_avatax_canceltax($AvaTaxDocumentCode, $Cancel } /**************************************************************************** -* * -* Function Header * -* * -* File Version : * -* Last Updated On : 02/22/2015 * -* Description : This function fetches gettax history for the * -* sent order details * -* * -* Important (on Feb25): Removed all commented code from this function * -* * -**********************************************e*****************************/ + * * + * Function Header * + * * + * File Version : * + * Last Updated On : 02/03/2021 * + * Description : This function fetches gettax history for the * + * sent order details * + * * + * Important (on Feb25): Removed all commented code from this function * + * * + ****************************************************************************/ function fn_avatax_tax_calculation_avatax_gettax_history($order_info) { - - $environment = 'Development'; - $service_url = Registry::get('addons.avatax_tax_calculation.avatax_service_url'); - $pos = strpos($service_url, "development"); - if ($pos === false) $environment = 'Production'; - else $environment = 'Development'; + $environment = strpos($service_url, "development") === false ? 'Production' : 'Development'; $company_details = fn_get_company_placement_info($order_info['company_id']); @@ -2165,29 +1715,27 @@ function fn_avatax_tax_calculation_avatax_gettax_history($order_info) /**************************************************************************** -* * -* Function Header * -* * -* File Version : * -* Last Updated On : 02/22/2015 * -* Description : This function does tax computation on * -* sent return invoice details * -* * -* Important (on Feb25): Removed all commented code from this function * -* * -**********************************************e*****************************/ + * * + * Function Header * + * * + * File Version : * + * Last Updated On : 02/03/2021 * + * Description : This function does tax computation on * + * sent return invoice details * + * * + * Important (on Feb25): Removed all commented code from this function * + * * + ****************************************************************************/ function fn_avatax_tax_calculation_avatax_return_invoice($return_info, $order_info, $tax_history_data) { - $timeStamp = new DateTime(); // Create Time Stamp - $connectorstart=$timeStamp->format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); + $timeStamp = new DateTime(); // Create Time Stamp + $connectorstart = $timeStamp->format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); $time_start = round(microtime(true) * 1000); $lib_path = Registry::get('config.dir.addons') . 'avatax_tax_calculation/lib/'; require_once($lib_path . "AvaTax4PHP/AvaTax.php"); - spl_autoload_register('__autoload'); - $environment = 'Development'; $company_details = fn_get_company_placement_info($order_info['company_id']); $service_url = Registry::get('addons.avatax_tax_calculation.avatax_service_url'); @@ -2195,10 +1743,7 @@ function fn_avatax_tax_calculation_avatax_return_invoice($return_info, $order_in $license = Registry::get('addons.avatax_tax_calculation.avatax_license_key'); $client = CLIENT_NAME; $CompanyCode = Registry::get('addons.avatax_tax_calculation.avatax_company_code'); - - $pos = strpos($service_url, "development"); - if ($pos === false) $environment = 'Production'; - else $environment = 'Development'; + $environment = strpos($service_url, "development") === false ? 'Production' : 'Development'; new ATConfig($environment, array('url' => $service_url, 'account' => $account, 'license' => $license, 'client' => $client, 'trace' => TRUE)); @@ -2216,21 +1761,14 @@ function fn_avatax_tax_calculation_avatax_return_invoice($return_info, $order_in $DestRegion = $order_info["s_state"]; $DestPostalCode = $order_info["s_zipcode"]; $DestCountry = $order_info["s_country"]; - - //Code Added to implement Doc Type Feature in CS Cart 4.2.4 build) - if(Registry::get('addons.avatax_tax_calculation.avatax_tax_savedoc') == 1) - { - $DocType = "ReturnInvoice"; - } - else - { - $DocType = "ReturnOrder"; - } + + //Code Added to implement Doc Type Feature in CS Cart 4.2.4 build) + $DocType = Registry::get('addons.avatax_tax_calculation.avatax_tax_savedoc') == 1 ? "ReturnInvoice" : "ReturnOrder"; $DocCode = $return_info["avatax_return_document_code"]; $SalesPersonCode = ""; $EntityUseCode = ""; - $Discount = 0;//$order_info['subtotal_discount']; + $Discount = 0; //$order_info['subtotal_discount']; $PurchaseOrderNo = ''; $ExemptionNo = ""; $LocationCode = ''; @@ -2303,200 +1841,187 @@ function fn_avatax_tax_calculation_avatax_return_invoice($return_info, $order_in $return_order_array = $return_info['items']; $accepted_items = $return_order_array['A']; - if(count($accepted_items)>0){ - foreach ($accepted_items as $key_inner => $value_inner) { + if (count($accepted_items) > 0) { + foreach ($accepted_items as $key_inner => $value_inner) { - $v = $order_info["products"][$key_inner]; + $v = $order_info["products"][$key_inner]; - $return_reason = fn_return_reason($value_inner["reason"]); - $product_original_amount = fn_product_real_price($value_inner["product_id"]); - - $total_amount = ($value_inner["price"] * $value_inner["amount"]); + $return_reason = fn_return_reason($value_inner["reason"]); + $product_original_amount = fn_product_real_price($value_inner["product_id"]); + + $total_amount = ($value_inner["price"] * $value_inner["amount"]); - $product_data = fn_get_product_data($value_inner["product_id"], $auth); - $product_categories = ""; - foreach ($product_data['category_ids'] as $pck => $pcv) { - $product_categories .= fn_get_category_name($pcv) . ","; - } - $Description = $product_categories; + $product_data = fn_get_product_data($value_inner["product_id"], $auth); + $product_categories = ""; + foreach ($product_data['category_ids'] as $pck => $pcv) { + $product_categories .= fn_get_category_name($pcv) . ","; + } + $Description = $product_categories; - $TaxCode = $product_data["tax_code"]; + $TaxCode = $product_data["tax_code"]; - if ($TaxCode == "none") { - $TaxCode = 'P0000000'; - } + if ($TaxCode == "none") { + $TaxCode = 'P0000000'; + } - /////////////////////// UPC Implementation - Start ///////////////////////// - // Receiving UPC Code if set - $UpcCode = $product_data['upc_code']; - if(Registry::get('addons.avatax_tax_calculation.avatax_tax_upc') == 1) - { - if ( ($UpcCode == "") || ($UpcCode == "none") ) { - if($product_data["product_code"] == ""){ - $itemCode = substr($product_data["product"], 0, 50); - } - else{ - $itemCode = $product_data["product_code"]; - } + /////////////////////// UPC Implementation - Start ///////////////////////// + // Receiving UPC Code if set + $UpcCode = $product_data['upc_code']; + if (Registry::get('addons.avatax_tax_calculation.avatax_tax_upc') == 1) + { + if ( ($UpcCode == "") || ($UpcCode == "none") ) { + if ($product_data["product_code"] == "") { + $itemCode = substr($product_data["product"], 0, 50); } - else - { - // UPC Code validation logic will come here : Future - $itemCode = 'UPC:' . $UpcCode; + else{ + $itemCode = $product_data["product_code"]; } } - else if($product_data["product_code"] == "") + else { - $itemCode = substr($product_data["product"], 0, 50); - } - else{ - $itemCode = $product_data["product_code"]; - } - /////////////////////// UPC Implementation - End ///////////////////////// - - - $discount_count = 0; - $temp_discount_amount = $product_original_amount - $value_inner["price"]; - if ($temp_discount_amount > 0) { - $discount_count = 1; - $discount_amount = $value_inner["price"]; + // UPC Code validation logic will come here : Future + $itemCode = 'UPC:' . $UpcCode; } + } + else if ($product_data["product_code"] == "") + { + $itemCode = substr($product_data["product"], 0, 50); + } + else{ + $itemCode = $product_data["product_code"]; + } + /////////////////////// UPC Implementation - End ///////////////////////// - $line1 = new Line(); - $line1->setNo($i+1);//$product["product_id"] - - $line1->setItemCode($itemCode); - $line1->setDescription($value_inner["product"]); - $line1->setTaxCode($TaxCode); - - $line1->setQty($value_inner["amount"]); - - $line1->setAmount(-$total_amount); - $line1->setDiscounted(true); - - $line1->setRevAcct($RevAcct); - $line1->setRef1($Ref1); - $line1->setRef2($Ref2); - $line1->setExemptionNo($ExemptionNo); - $line1->setCustomerUsageType($EntityUseCode); - $line1->setOriginAddress($origin); - $line1->setDestinationAddress($destination); - - $lines[$i] = $line1; - $i++; - - $product_total += $value_inner['amount']; + $discount_count = 0; + $temp_discount_amount = $product_original_amount - $value_inner["price"]; + if ($temp_discount_amount > 0) { + $discount_count = 1; + $discount_amount = $value_inner["price"]; } + $line1 = new Line(); + $line1->setNo($i+1);//$product["product_id"] + + $line1->setItemCode($itemCode); + $line1->setDescription($value_inner["product"]); + $line1->setTaxCode($TaxCode); + + $line1->setQty($value_inner["amount"]); + + $line1->setAmount(-$total_amount); + $line1->setDiscounted(true); + + $line1->setRevAcct($RevAcct); + $line1->setRef1($Ref1); + $line1->setRef2($Ref2); + $line1->setExemptionNo($ExemptionNo); + $line1->setCustomerUsageType($EntityUseCode); + $line1->setOriginAddress($origin); + $line1->setDestinationAddress($destination); + + $lines[$i] = $line1; + $i++; + + $product_total += $value_inner['amount']; + } //} - - $request->setLines($lines); - - $TaxOverride = new TaxOverride(); - - $TaxOverride->setTaxOverrideType("TaxDate"); - $TaxOverride->setTaxDate($tax_history_data["DocDate"]); - $TaxOverride->setReason($return_reason); - $request->setTaxOverride($TaxOverride); + $request->setLines($lines); + + $TaxOverride = new TaxOverride(); + + $TaxOverride->setTaxOverrideType("TaxDate"); + $TaxOverride->setTaxDate($tax_history_data["DocDate"]); + $TaxOverride->setReason($return_reason); + $request->setTaxOverride($TaxOverride); - $GetTaxData = array(); - $returnMessage = ""; + $GetTaxData = array(); + $returnMessage = ""; - try { - $connectortime = round(microtime(true) * 1000)-$time_start; - $latency = round(microtime(true) * 1000); - $connectorcalling=$timeStamp->format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); - $getTaxResult = $client->getTax($request); - $connectorcomplete=$timeStamp->format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); - $latency = round(microtime(true) * 1000)-$latency; + try { + $connectortime = round(microtime(true) * 1000) - $time_start; + $latency = round(microtime(true) * 1000); + $connectorcalling=$timeStamp->format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); + $getTaxResult = $client->getTax($request); + $connectorcomplete=$timeStamp->format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); + $latency = round(microtime(true) * 1000)-$latency; - // Error Trapping - if ($getTaxResult->getResultCode() == SeverityLevel::$Success) { + // Error Trapping + if ($getTaxResult->getResultCode() == SeverityLevel::$Success) { + $GetTaxData['GetTaxDocCode'] = $getTaxResult->getDocCode(); + $GetTaxData['GetTaxDocDate'] = $getTaxResult->getDocDate(); + $GetTaxData['GetTaxTotalAmount'] = $getTaxResult->getTotalAmount(); + $GetTaxData['GetTaxTotalTax'] = $getTaxResult->getTotalTax(); + /*** + * Place holder for logs + * getLastRequest + * getLastResponse + */ + + /************* Logging code snippet (optional) starts here *******************/ + // System Logger starts here: + include_once "SystemLogger.php"; + // Creating the System Logger Object + $application_log = new SystemLogger; + + $connectorend=$timeStamp->format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); + $performance_metrics[] = array("CallerTimeStamp","MessageString","CallerAcctNum","DocCode","Operation","ServiceURL","LogType","LogLevel","ERPName","ERPVersion","ConnectorVersion"); + $performance_metrics[] = array($connectorstart,"\"LINECOUNT -".count($getTaxResult->getTaxLines())."PreGetTax Start Time-\"".$connectorstart,$account,$getTaxResult->getDocCode(),"GetTax",$service_url,"Performance","Informational","CS-Cart",PRODUCT_VERSION,AVALARA_VERSION); + $performance_metrics[] = array($connectorcalling,"\"LINECOUNT -".count($getTaxResult->getTaxLines())."PreGetTax End Time-\"".$connectorcalling,$account,$getTaxResult->getDocCode(),"GetTax ",$service_url,"Performance","Informational","CS-Cart",PRODUCT_VERSION,AVALARA_VERSION); + $performance_metrics[] = array($connectorcomplete,"\"LINECOUNT -".count($getTaxResult->getTaxLines())."PostGetTax Start Time-\"".$connectorcomplete,$account,$getTaxResult->getDocCode(),"GetTax ",$service_url,"Performance","Informational","CS-Cart",PRODUCT_VERSION,AVALARA_VERSION); + $performance_metrics[] = array($connectorend,"\"LINECOUNT -".count($getTaxResult->getTaxLines())."PostGetTax End Time\"".$connectorend,$account,$getTaxResult->getDocCode(),"GetTax ",$service_url,"Performance","Informational","CS-Cart",PRODUCT_VERSION,AVALARA_VERSION); + //Call serviceLog function + $returnServiceLog = $application_log->serviceLog($performance_metrics); + + if (Registry::get('addons.avatax_tax_calculation.avatax_log_mode') == 1) { + $params = '[Input: ' . ']'; // Create Param List + $u_name = ''; // Eventually will come from $_SESSION[] object + $application_log->AddSystemLog($timeStamp->format('Y-m-d H:i:s'), __FUNCTION__, __CLASS__, __METHOD__, __FILE__, $u_name, $params, $client->__getLastRequest()); // Create System Log + $application_log->WriteSystemLogToFile(); // Log info goes to log file + + $application_log->AddSystemLog($timeStamp->format('Y-m-d H:i:s'), __FUNCTION__, __CLASS__, __METHOD__, __FILE__, $u_name, $params, $client->__getLastResponse()); // Create System Log + $application_log->WriteSystemLogToFile(); // Log info goes to log file + // $application_log->metric('GetTax '.$getTaxResult->getDocType(),count($getTaxResult->getTaxLines()),$getTaxResult->getDocCode(),$connectortime,$latency); + // $application_log->WriteSystemLogToDB(); // Log info goes to DB + // System Logger ends here + // Logging code snippet (optional) ends here + } - $GetTaxData['GetTaxDocCode'] = $getTaxResult->getDocCode(); - $GetTaxData['GetTaxDocDate'] = $getTaxResult->getDocDate(); - $GetTaxData['GetTaxTotalAmount'] = $getTaxResult->getTotalAmount(); - $GetTaxData['GetTaxTotalTax'] = $getTaxResult->getTotalTax(); - /*** - * Place holder for logs - * getLastRequest - * getLastResponse - */ - - /************* Logging code snippet (optional) starts here *******************/ - // System Logger starts here: - include_once "SystemLogger.php"; - // Creating the System Logger Object - $application_log = new SystemLogger; - - $connectorend=$timeStamp->format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); - $performance_metrics[] = array("CallerTimeStamp","MessageString","CallerAcctNum","DocCode","Operation","ServiceURL","LogType","LogLevel","ERPName","ERPVersion","ConnectorVersion"); - $performance_metrics[] = array($connectorstart,"\"LINECOUNT -".count($getTaxResult->getTaxLines())."PreGetTax Start Time-\"".$connectorstart,$account,$getTaxResult->getDocCode(),"GetTax",$service_url,"Performance","Informational","CS-Cart",PRODUCT_VERSION,AVALARA_VERSION); - $performance_metrics[] = array($connectorcalling,"\"LINECOUNT -".count($getTaxResult->getTaxLines())."PreGetTax End Time-\"".$connectorcalling,$account,$getTaxResult->getDocCode(),"GetTax ",$service_url,"Performance","Informational","CS-Cart",PRODUCT_VERSION,AVALARA_VERSION); - $performance_metrics[] = array($connectorcomplete,"\"LINECOUNT -".count($getTaxResult->getTaxLines())."PostGetTax Start Time-\"".$connectorcomplete,$account,$getTaxResult->getDocCode(),"GetTax ",$service_url,"Performance","Informational","CS-Cart",PRODUCT_VERSION,AVALARA_VERSION); - $performance_metrics[] = array($connectorend,"\"LINECOUNT -".count($getTaxResult->getTaxLines())."PostGetTax End Time\"".$connectorend,$account,$getTaxResult->getDocCode(),"GetTax ",$service_url,"Performance","Informational","CS-Cart",PRODUCT_VERSION,AVALARA_VERSION); - //Call serviceLog function - $returnServiceLog = $application_log->serviceLog($performance_metrics); - - $log_mode = Registry::get('addons.avatax_tax_calculation.avatax_log_mode'); - if($log_mode==1){ - $params = '[Input: ' . ']'; // Create Param List - $u_name = ''; // Eventually will come from $_SESSION[] object - $application_log->AddSystemLog($timeStamp->format('Y-m-d H:i:s'), __FUNCTION__, __CLASS__, __METHOD__, __FILE__, $u_name, $params, $client->__getLastRequest()); // Create System Log - $application_log->WriteSystemLogToFile(); // Log info goes to log file - - $application_log->AddSystemLog($timeStamp->format('Y-m-d H:i:s'), __FUNCTION__, __CLASS__, __METHOD__, __FILE__, $u_name, $params, $client->__getLastResponse()); // Create System Log - $application_log->WriteSystemLogToFile(); // Log info goes to log file - // $application_log->metric('GetTax '.$getTaxResult->getDocType(),count($getTaxResult->getTaxLines()),$getTaxResult->getDocCode(),$connectortime,$latency); + return $GetTaxData; + } else { + $return_message = "AvaTax - Error Message
"; + foreach ($getTaxResult->getMessages() as $msg) { + $return_message .= $msg->getName() . ": " . $msg->getSummary() . "\n"; + } - // $application_log->WriteSystemLogToDB(); // Log info goes to DB - // System Logger ends here - // Logging code snippet (optional) ends here + $avatax_tax_error = '
' . $return_message . '
'; + fn_set_notification('E', __('error'), $avatax_tax_error); + return $getTaxResult; } - else{} - - - - return $GetTaxData; - - } else { + } catch (SoapFault $exception) { + $msg = "Exception: "; + if ($exception) + $msg .= $exception->faultstring; $return_message = "AvaTax - Error Message
"; - foreach ($getTaxResult->getMessages() as $msg) { - $return_message .= $msg->getName() . ": " . $msg->getSummary() . "\n"; - } - + $return_message .= $msg; $avatax_tax_error = '
' . $return_message . '
'; fn_set_notification('E', __('error'), $avatax_tax_error); - return $getTaxResult; - } - } catch (SoapFault $exception) { - $msg = "Exception: "; - if ($exception) - $msg .= $exception->faultstring; - - $return_message = "AvaTax - Error Message
"; - $return_message .= $msg; - $avatax_tax_error = '
' . $return_message . '
'; - fn_set_notification('E', __('error'), $avatax_tax_error); - // If you desire to retrieve SOAP IN / OUT XML - // - Follow directions below - // - if not, leave as is + // If you desire to retrieve SOAP IN / OUT XML + // - Follow directions below + // - if not, leave as is - //echo $msg . "\n"; - return $msg; - // } //UN-comment this line to return SOAP XML - } //Comment this line to return SOAP XML - /**/ - }//end of if - else{ + //echo $msg . "\n"; + return $msg; + // } //UN-comment this line to return SOAP XML + } //Comment this line to return SOAP XML + } else{ return fn_avatax_tax_calculation_avatax_canceltax($return_info['avatax_return_document_code'], "DocVoided", "ReturnInvoice"); - } + } } #} @@ -2506,69 +2031,56 @@ function fn_avatax_tax_calculation_avatax_return_invoice($return_info, $order_in #{ - /**************************************************************************** -* * -* Function Header * -* * -* File Version : * -* Last Updated On : 02/22/2015 * -* Description : This function invoke the posttax() * -* * -* * -* Important (on Feb25): Removed all commented code from this function * -* * -**********************************************e*****************************/ + * * + * Function Header * + * * + * File Version : * + * Last Updated On : 02/03/2021 * + * Description : This function invoke the posttax() * + * * + * Important (on Feb25): Removed all commented code from this function * + * * + ****************************************************************************/ function fn_avatax_tax_calculation_calculate_taxes_post($cart, $group_products, $shipping_rates, $auth, &$calculated_data) { - $user_info = fn_get_user_info($auth['user_id']); $user_data = $cart['user_data']; - $ava_tax_flag=""; - $avatax_product_taxes=""; - $company_id=0; - if(isset($cart['chosen_shipping']) && !empty($cart['chosen_shipping'])) - { + $ava_tax_flag = ""; + $avatax_product_taxes = ""; + $company_id = 0; + if (isset($cart['chosen_shipping']) && !empty($cart['chosen_shipping'])) { $shipping_id = $cart['chosen_shipping'][0]; } $lib_path = Registry::get('config.dir.addons') . 'avatax_tax_calculation/lib/'; - - if (isset($_REQUEST['edit_step'] )) { + + if (isset($_REQUEST['edit_step'] )) { $ava_tax_flag = $_REQUEST['edit_step']; } if ($_REQUEST['dispatch'] == 'order_management.update') { $ava_tax_flag = 'step_four'; } - if (Registry::get('addons.avatax_tax_calculation.avatax_tax_calculation') == 1 && (isset($cart['payment_id']) && $cart['payment_id'] > 0) && (($ava_tax_flag == 'step_four') || (!empty($shipping_id)) || !$cart['shipping_required'] ) ) { - + if (Registry::get('addons.avatax_tax_calculation.avatax_tax_calculation') == 1 && (isset($cart['payment_id']) && $cart['payment_id'] > 0) && (($ava_tax_flag == 'step_four') || (!empty($shipping_id)) || !$cart['shipping_required'] ) ) { $cart_products = $cart['products']; - if(isset($cart['avatax_tax_taxes'])) - { + if (isset($cart['avatax_tax_taxes'])) { $avatax_product_taxes = $cart['avatax_tax_taxes']; } - if(!empty($cart_products[0])) - { + if (!empty($cart_products[0])) { $company_id = $cart_products[0]['company_id']; } $p_rate = 0; $s_rate = 0; + $order_info = !empty($cart['user_data']) ? $cart['user_data'] : fn_get_user_info($auth['user_id']); + //Address Validation Starts Here - /************** + /************** if (Registry::get('addons.avatax_tax_calculation.avatax_tax_address_validation') == 1) { //AvaTax - Address Validation - Check $avatax_tax_country = ""; - if (!empty($cart['user_data'])) { - $order_info = $cart['user_data']; - } else { - $user_info = fn_get_user_info($auth['user_id']); - $order_info = $user_info; - } - - if (trim(Registry::get('addons.avatax_tax_calculation.avatax_tax_address_validation_place')) == "both") { $avatax_tax_country = "|US|CA|"; } else { @@ -2584,7 +2096,7 @@ function fn_avatax_tax_calculation_calculate_taxes_post($cart, $group_products, $errors = true; //$_REQUEST['next_step'] = $_REQUEST['update_step']; } - if($order_info['avatax_paytax_error_message'] != 'Success'){ + if ($order_info['avatax_paytax_error_message'] != 'Success') { //Add error code $avatax_tax_error = "AvaTax - Error Message
"; $avatax_tax_error .= '
' . $order_info['avatax_paytax_error_message'] . '
'; @@ -2592,22 +2104,22 @@ function fn_avatax_tax_calculation_calculate_taxes_post($cart, $group_products, } } } - ************/ - + ************/ //Address Validation Ends Here - if (!empty($cart) && !empty($cart_products) && isset($cart['edit_step'])&& $cart['edit_step']=="step_four") { - $tax_rate_data = fn_avatax_tax_calculation_avatax_amount($group_products, $shipping_rates, $company_id, $cart, $auth); - $rate_value = 0; - $tax_result = 0; + + $rate_value = 0; + $tax_result = 0; + if (!empty($cart) && !empty($cart_products)) { + $tax_rate_data = fn_avatax_tax_calculation_avatax_amount($group_products, $shipping_rates, $company_id, $cart, $auth, $order_info); - if(!empty($tax_rate_data)){ + if (!empty($tax_rate_data)) { if ($tax_rate_data->getResultCode() == SeverityLevel::$Success) { $rate_value = $tax_rate_data->getTaxLine(0)->getRate(); $tax_result = $tax_rate_data->getTotalTax(); - $rate_value = $rate_value * 100; - $p_rate = $tax_result; + $rate_value = $rate_value * 100; + $p_rate = $tax_result; } - if($tax_rate_data->getResultCode() == SeverityLevel::$Error){ + if ($tax_rate_data->getResultCode() == SeverityLevel::$Error) { $return_message = "AvaTax - Error Message
"; foreach($tax_rate_data->getMessages() as $msg) @@ -2633,10 +2145,9 @@ function fn_avatax_tax_calculation_calculate_taxes_post($cart, $group_products, 'P' => $p_rate, 'S' => $s_rate ) - ) - ); + )); - } else { + } else { $avatax_tax_id = 1; $calculated_data = array($avatax_tax_id => array( 'rate_type' => 'P', @@ -2651,114 +2162,104 @@ function fn_avatax_tax_calculation_calculate_taxes_post($cart, $group_products, 'P' => 0, 'S' => 0 ) - ) - ); + )); } } - - - /**************************************************************************** -* * -* Function Header * -* * -* File Version : * -* Last Updated On : 02/22/2015 * -* Description : **** PENDING ***** * -* * -* * -* Important (on Feb25): *** Action Pending *** * -* * -**********************************************e*****************************/ + * * + * Function Header * + * * + * File Version : * + * Last Updated On : 02/03/2021 * + * Description : **** PENDING ***** * + * * + * * + * Important (on Feb25): *** Action Pending *** * + * * + ****************************************************************************/ //function fn_avatax_tax_calculation_post_add_to_cart($product_data, &$cart, $auth, $update) //{ -// if(Registry::get('addons.avatax_tax_calculation.avatax_tax_calculation')==1) -// { -// $cart_products = $cart['products']; +// if (Registry::get('addons.avatax_tax_calculation.avatax_tax_calculation')==1) +// { +// $cart_products = $cart['products']; // -// foreach ($product_data as $key => $data) { -// foreach ($cart_products as $key_cp => $data_cp) { -// if($data['product_id']==$data_cp['product_id']) -// { -// $product_id = $data_cp['product_id']; -// $product_price = $data_cp['price']; -// $company_id = $data_cp['company_id']; -// } -// } -// } +// foreach ($product_data as $key => $data) { +// foreach ($cart_products as $key_cp => $data_cp) { +// if ($data['product_id']==$data_cp['product_id']) +// { +// $product_id = $data_cp['product_id']; +// $product_price = $data_cp['price']; +// $company_id = $data_cp['company_id']; +// } +// } +// } // -// /*$tax_result = fn_avatax_tax_calculation_avatax_amount($product_price, $company_id, $cart, $auth); -// $tax_rate_data = array(); -// foreach($tax_result->getTaxLines() as $tax_line) -// { -// $tax_rate_count = 0; -// foreach($tax_line->getTaxDetails() as $tax_details) -// { -// $tax_rate_data[$tax_rate_count] = array( -// 'tax_rate_id' => $tax_rate_count, -// 'name' => $tax_details->getTaxName(), -// 'rate' => $tax_details->getRate(), -// 'type' => $tax_details->getTaxType(), -// 'amount' => $tax_details->getTax() -// ); -// $tax_rate_count++; -// } -// }*/ +// /*$tax_result = fn_avatax_tax_calculation_avatax_amount($product_price, $company_id, $cart, $auth); +// $tax_rate_data = array(); +// foreach($tax_result->getTaxLines() as $tax_line) +// { +// $tax_rate_count = 0; +// foreach($tax_line->getTaxDetails() as $tax_details) +// { +// $tax_rate_data[$tax_rate_count] = array( +// 'tax_rate_id' => $tax_rate_count, +// 'name' => $tax_details->getTaxName(), +// 'rate' => $tax_details->getRate(), +// 'type' => $tax_details->getTaxType(), +// 'amount' => $tax_details->getTax() +// ); +// $tax_rate_count++; +// } +// }*/ // -// $tax_rate_data = fn_avatax_tax_calculation_get_avatax_taxes($product_price, $company_id, $cart, $auth); -// if(is_array($cart['avatax_tax_taxes'])) $temp_avatax_taxes = $cart['avatax_tax_taxes']; -// else $temp_avatax_taxes = array(); -// $cart['avatax_tax_taxes'] = ($temp_avatax_taxes + array($product_id=>$tax_rate_data)); -// //$cart['avatax_tax_taxes'] = ($temp_avatax_taxes + array($product_price=>$tax_rate_data)); +// $tax_rate_data = fn_avatax_tax_calculation_get_avatax_taxes($product_price, $company_id, $cart, $auth); +// if (is_array($cart['avatax_tax_taxes'])) $temp_avatax_taxes = $cart['avatax_tax_taxes']; +// else $temp_avatax_taxes = array(); +// $cart['avatax_tax_taxes'] = ($temp_avatax_taxes + array($product_id=>$tax_rate_data)); +// //$cart['avatax_tax_taxes'] = ($temp_avatax_taxes + array($product_price=>$tax_rate_data)); // -// fn_get_avatax_document_status(); -// } +// fn_get_avatax_document_status(); +// } //} /**************************************************************************** -* * -* Function Header * -* * -* File Version : * -* Last Updated On : 02/22/2015 * -* Description : This function re-calculate the tax - once the * -* order is updated * -**********************************************e*****************************/ - + * * + * Function Header * + * * + * File Version : * + * Last Updated On : 02/03/2021 * + * Description : This function re-calculate the tax - once the * + * order is updated * + ****************************************************************************/ -function fn_avatax_tax_calculation_update_order($order,$order_id){ +function fn_avatax_tax_calculation_update_order($order, $order_id) { if (Registry::get('addons.avatax_tax_calculation.avatax_tax_calculation') == 1) { - if(Registry::get('addons.avatax_tax_calculation.avatax_tax_savedoc') == 1) - { - $order_info = fn_get_order_info($order_id); - $order['order_id'] = $order_id; - $order['avatax_paytax_document_code'] = $order_info['avatax_paytax_document_code']; - $status_to = $order['order_status']; - $status_from = $order['order_status']; - fn_avatax_change_document_status($order, $status_to, $status_from); - } - else - { - } - + if (Registry::get('addons.avatax_tax_calculation.avatax_tax_savedoc') == 1) { + $order_info = fn_get_order_info($order_id); + $order['order_id'] = $order_id; + $order['avatax_paytax_document_code'] = $order_info['avatax_paytax_document_code']; + $status_to = $order['order_status']; + $status_from = $order['order_status']; + fn_avatax_change_document_status($order, $status_to, $status_from); + } } } /**************************************************************************** -* * -* Function Header * -* * -* File Version : * -* Last Updated On : 02/22/2015 * -* Description : This function calculates the tax on the placed * -* order * -**********************************************e*****************************/ + * * + * Function Header * + * * + * File Version : * + * Last Updated On : 02/03/2021 * + * Description : This function calculates the tax on the placed * + * order * + ****************************************************************************/ function fn_avatax_tax_calculation_place_order($order_id, $action, $order_status, $cart, $auth) { @@ -2772,16 +2273,15 @@ function fn_avatax_tax_calculation_place_order($order_id, $action, $order_status if (Registry::get('addons.avatax_tax_calculation.avatax_tax_calculation') == 1) { $order_info = fn_get_order_info($order_id); - - if (isset($order_info['avatax_paytax_document_code'])) // This checking is to avoid call to AvaTax API when order is edited from the Admin - { + // This checking is to avoid call to AvaTax API when order is edited from the Admin + if (isset($order_info['avatax_paytax_document_code'])) { //Call 2 Methods //1. GetTax with OrderType = SalesInvoice $GetTaxReturnValue = fn_avatax_tax_calculation_avatax_gettax($order_info, $auth); //$avatax_fields_exists = mysql_query("SHOW columns from `?:orders` where field='avatax_paytax_document_id'"); $avatax_fields_exists = db_query("SHOW columns from `?:orders` where field='avatax_paytax_document_id'"); - //if ($avatax_fields_exists==false){ + //if ($avatax_fields_exists==false) { if ($avatax_fields_exists->num_rows == 0) { db_query("ALTER TABLE ?:orders ADD `avatax_paytax_document_id` INT NOT NULL DEFAULT '0', ADD `avatax_paytax_transaction_id` INT NOT NULL DEFAULT '0', ADD `avatax_paytax_document_code` VARCHAR( 40 ) NOT NULL, ADD `avatax_paytax_error_message` TEXT NOT NULL"); @@ -2812,59 +2312,54 @@ function fn_avatax_tax_calculation_place_order($order_id, $action, $order_status } } - /**************************************************************************** -* * -* Function Header * -* * -* File Version : * -* Last Updated On : 02/22/2015 * -* Description : ***** PENDING ***** * -* * -**********************************************e*****************************/ + * * + * Function Header * + * * + * File Version : * + * Last Updated On : 02/03/2021 * + * Description : ***** PENDING ***** * + * * + ****************************************************************************/ function fn_avatax_tax_calculation_is_user_exists_post($user_id, $user_data, $is_exist) { - if (Registry::get('addons.avatax_tax_calculation.avatax_tax_address_validation') == 1) { //AvaTax - Address Validation - Check - $avatax_tax_country = ""; - if (trim(Registry::get('addons.avatax_tax_calculation.avatax_tax_address_validation_place')) == "both") { - $avatax_tax_country = "|US|CA|"; - } else { - $avatax_tax_country = "|" . Registry::get('addons.avatax_tax_calculation.avatax_tax_address_validation_place') . "|"; - } - $avatax_tax_country_pos = strpos($avatax_tax_country, "|" . $user_data["s_country"] . "|"); - - if ($avatax_tax_country_pos !== false) { - $return_message = fn_avatax_tax_calculation_avatax_address_validation($user_data); + //$avatax_tax_country = ""; + //if (trim(Registry::get('addons.avatax_tax_calculation.avatax_tax_address_validation_place')) == "both") { + // $avatax_tax_country = "|US|CA|"; + //} else { + // $avatax_tax_country = "|" . Registry::get('addons.avatax_tax_calculation.avatax_tax_address_validation_place') . "|"; + //} + //$avatax_tax_country_pos = strpos($avatax_tax_country, "|" . $user_data["s_country"] . "|"); + + //if ($avatax_tax_country_pos !== false) { + // $return_message = fn_avatax_tax_calculation_avatax_address_validation($user_data); //Registry::set('addons.avatax_tax_calculation.avatax_tax_flag','1'); - if (trim($return_message) != "") { - fn_set_notification('E', __('error'), $return_message); - $errors = true; + // if (trim($return_message) != "") { + // fn_set_notification('E', __('error'), $return_message); + // $errors = true; //$_REQUEST['next_step'] = $_REQUEST['update_step']; - } - } + // } + //} } } - /**************************************************************************** -* * -* Function Header * -* * -* File Version : * -* Last Updated On : 02/22/2015 * -* Description : Recalculate the tax when the order status is * -* changed from one state to another * -**********************************************e*****************************/ - + * * + * Function Header * + * * + * File Version : * + * Last Updated On : 02/03/2021 * + * Description : Recalculate the tax when the order status is * + * changed from one state to another * + ****************************************************************************/ function fn_avatax_tax_calculation_change_order_status($status_to, $status_from, $order_info, $force_notification, $order_statuses, $place_order) { - //Code added for address validation - /*** + /*** if (Registry::get('addons.avatax_tax_calculation.avatax_tax_address_validation') == 1) { //AvaTax - Address Validation - Check $avatax_tax_country = ""; @@ -2883,7 +2378,7 @@ function fn_avatax_tax_calculation_change_order_status($status_to, $status_from, $errors = true; //$_REQUEST['next_step'] = $_REQUEST['update_step']; } - if($order_info['avatax_paytax_error_message'] != 'Success'){ + if ($order_info['avatax_paytax_error_message'] != 'Success') { //Add error code $avatax_tax_error = "AvaTax - Error Message
"; $avatax_tax_error .= '
' . $order_info['avatax_paytax_error_message'] . '
'; @@ -2891,13 +2386,12 @@ function fn_avatax_tax_calculation_change_order_status($status_to, $status_from, } } } - *****/ + *****/ //Code for address validation ends here. - if ((trim($status_from) != trim($status_to)) && Registry::get('addons.avatax_tax_calculation.avatax_tax_calculation') == 1) //This checking is to avoid more call to AvaTax API - { - if(Registry::get('addons.avatax_tax_calculation.avatax_tax_savedoc') == 1) - { + //This checking is to avoid more call to AvaTax API + if ((trim($status_from) != trim($status_to)) && Registry::get('addons.avatax_tax_calculation.avatax_tax_calculation') == 1) { + if (Registry::get('addons.avatax_tax_calculation.avatax_tax_savedoc') == 1) { if ($status_from == 'N') //This checking is to avoid more call to AvaTax API { if ($status_to != 'O') { @@ -2907,21 +2401,17 @@ function fn_avatax_tax_calculation_change_order_status($status_to, $status_from, fn_avatax_change_document_status($order_info, $status_to, $status_from); } } - else - { - - } } } /**************************************************************************** -* * -* Function Header * -* * -* File Version : * -* Last Updated On : 02/22/2015 * -* Description : **** PENDING ***** * -**********************************************e*****************************/ + * * + * Function Header * + * * + * File Version : * + * Last Updated On : 02/03/2021 * + * Description : **** PENDING ***** * + ****************************************************************************/ function fn_avatax_tax_calculation_send_return_mail_pre($return_info, $order_info) { @@ -2938,24 +2428,21 @@ function fn_avatax_tax_calculation_send_return_mail_pre($return_info, $order_inf if (is_array($ReturnsReturnValue)) { fn_edit_return_with_avatax_doccode($ReturnsReturnValue['GetTaxDocCode'], $return_info['return_id']); } - } - } /**************************************************************************** -* * -* Function Header * -* * -* File Version : * -* Last Updated On : 02/22/2015 * -* Description : This function invokes CancelTax on return order * -**********************************************e*****************************/ +* * +* Function Header * +* * +* File Version : * +* Last Updated On : 02/03/2021 * +* Description : This function invokes CancelTax on return order * +****************************************************************************/ function fn_return_state_voided($return_info, $order_info,$status_from) { - $AvaTaxDocumentStatus = fn_get_avatax_return_status(); if (trim($AvaTaxDocumentStatus[$status_from]) == "Committed") { @@ -2971,25 +2458,23 @@ function fn_return_state_voided($return_info, $order_info,$status_from) /**************************************************************************** -* * -* Function Header * -* * -* File Version : * -* Last Updated On : 02/22/2015 * -* Description : This function invokes CancelTax on return order * -**********************************************e*****************************/ - + * * + * Function Header * + * * + * File Version : * + * Last Updated On : 02/03/2021 * + * Description : This function invokes CancelTax on return order* + ****************************************************************************/ function fn_return_state_uncommitted($return_info, $order_info,$status_from) { - $AvaTaxDocumentStatus = fn_get_avatax_return_status(); $TaxHistoryReturnValue = fn_avatax_tax_calculation_avatax_gettax_history($order_info); if (trim($AvaTaxDocumentStatus[$status_from]) == "Committed") { //1. Call CancelTax with CancelCode = Voided $DocVoidedReturn = fn_avatax_tax_calculation_avatax_canceltax($return_info['avatax_return_document_code'], "DocVoided", "ReturnInvoice"); - if($DocVoidedReturn == 'Success'){ + if ($DocVoidedReturn == 'Success') { //2. Call CancelTax with CancelCode = DocDeleted $DocDeletedReturn =fn_avatax_tax_calculation_avatax_canceltax($return_info['avatax_return_document_code'], "DocDeleted", "ReturnInvoice"); //3. Call GetTax with Commit = False @@ -2998,7 +2483,7 @@ function fn_return_state_uncommitted($return_info, $order_info,$status_from) } else if (trim($AvaTaxDocumentStatus[$status_from]) == "Voided") { //1. Call CancelTax with CancelCode = DocDeleted $DocDeletedReturn = fn_avatax_tax_calculation_avatax_canceltax($return_info['avatax_return_document_code'], "DocDeleted", "ReturnInvoice"); - if($DocDeletedReturn == 'Success'){ + if ($DocDeletedReturn == 'Success') { //2. Call GetTax with Commit = False $DocCommittedReturn = fn_avatax_tax_calculation_avatax_return_invoice($return_info, $order_info, $TaxHistoryReturnValue); } @@ -3010,24 +2495,23 @@ function fn_return_state_uncommitted($return_info, $order_info,$status_from) /**************************************************************************** -* * -* Function Header * -* * -* File Version : * -* Last Updated On : 02/22/2015 * -* Description : This function invokes CancelTax on return order * -**********************************************e*****************************/ + * * + * Function Header * + * * + * File Version : * + * Last Updated On : 02/03/2021 * + * Description : This function invokes CancelTax on return order* + ****************************************************************************/ function fn_return_state_committed($return_info, $order_info,$status_from) { - $AvaTaxDocumentStatus = fn_get_avatax_return_status(); $TaxHistoryReturnValue = fn_avatax_tax_calculation_avatax_gettax_history($order_info); if (trim($AvaTaxDocumentStatus[$status_from]) == "Committed") { //1. Call CancelTax with CancelCode = Voided $DocVoidedReturn = fn_avatax_tax_calculation_avatax_canceltax($return_info['avatax_return_document_code'], "DocVoided", "ReturnInvoice"); - if($DocVoidedReturn == 'Success'){ + if ($DocVoidedReturn == 'Success') { //2. Call CancelTax with CancelCode = DocDeleted $DocDeletedReturn = fn_avatax_tax_calculation_avatax_canceltax($return_info['avatax_return_document_code'], "DocDeleted", "ReturnInvoice"); @@ -3038,37 +2522,33 @@ function fn_return_state_committed($return_info, $order_info,$status_from) //1. Call CancelTax with CancelCode = DocDeleted $DocDeletedReturn = fn_avatax_tax_calculation_avatax_canceltax($return_info['avatax_return_document_code'], "DocDeleted", "ReturnInvoice"); - if($DocDeletedReturn == 'Success'){ + if ($DocDeletedReturn == 'Success') { //2. Call GetTax with Commit = False $DocCommittedReturn = fn_avatax_tax_calculation_avatax_return_invoice($return_info, $order_info, $TaxHistoryReturnValue); } } else if (trim($AvaTaxDocumentStatus[$status_from]) == "Uncommitted") { //1. Call GetTax with Commit = True $DocCommittedReturn = fn_avatax_tax_calculation_avatax_return_invoice($return_info, $order_info, $TaxHistoryReturnValue); - - } } /**************************************************************************** -* * -* Function Header * -* * -* File Version : * -* Last Updated On : 02/22/2015 * -* Description : This function changes the Return Status of * -* a return order * -**********************************************e*****************************/ + * * + * Function Header * + * * + * File Version : * + * Last Updated On : 02/03/2021 * + * Description : This function changes the Return Status of * + * a return order * + ****************************************************************************/ function fn_avatax_tax_calculation_change_return_status($return_info, $order_info) { - $change_return_status = $_REQUEST['change_return_status']; - $status_from = $change_return_status['status_from']; - + $status_from = $change_return_status['status_from']; - if (Registry::get('addons.avatax_tax_calculation.avatax_tax_calculation') == 1) { - if(Registry::get('addons.avatax_tax_calculation.avatax_tax_savedoc') == 1) + if (Registry::get('addons.avatax_tax_calculation.avatax_tax_calculation') == 1) { + if (Registry::get('addons.avatax_tax_calculation.avatax_tax_savedoc') == 1) { Switch ($return_info['status']) { case 'A': //Accepted @@ -3085,81 +2565,65 @@ function fn_avatax_tax_calculation_change_return_status($return_info, $order_inf break; } } - else - { - - } } } /**************************************************************************** -* * -* Function Header * -* * -* File Version : * -* Last Updated On : 02/22/2015 * -* Description : This function feeds entity use code to * -* view from Database * -* * -**********************************************e*****************************/ - - -function fn_avatax_tax_calculation_get_user_info_before($condition, $user_id, $user_fields) -{ - $user_fields = implode(",",$user_fields) . ", tax_exempt_number, tax_entity_usecode "; + * * + * Function Header * + * * + * File Version : * + * Last Updated On : 02/03/2021 * + * Description : This function feeds entity use code to * + * view from Database * + * * + ****************************************************************************/ +function fn_avatax_tax_calculation_get_user_info_before(&$condition, &$user_id, &$user_fields, &$join) +{ + array_push($user_fields, "tax_exempt_number"); + array_push($user_fields, "tax_entity_usecode"); + $tax_entity_usecode_data = db_get_array("SELECT * FROM ?:avatax_entity_usecode WHERE 1"); Registry::get('view')->assign('tax_entity_usecode_data', $tax_entity_usecode_data); } /**************************************************************************** -* * -* Function Header * -* * -* File Version : * -* Last Updated On : 09/07/2015 * -* Description : This function is for Avatax Address Validation * -**********************************************e*****************************/ + * * + * Function Header * + * * + * File Version : * + * Last Updated On : 09/07/2015 * + * Description : This function is for Avatax Address Validation * + ****************************************************************************/ function fn_avatax_tax_calculation_address_validation($flag) { - $address_validation = Registry::get('addons.avatax_tax_calculation.avatax_tax_address_validation'); - if($address_validation && !empty($_REQUEST['userData'])){ + if ($address_validation && !empty($_REQUEST['userData'])) { $user_data = array(); - $resArr=array(); + $resArr = array(); $address_data = array(); $valid_address_data = array(); parse_str($_REQUEST['userData'], $userDataarray); $user_data = $userDataarray['user_data']; - $address_data["service_url"] = Registry::get('addons.avatax_tax_calculation.avatax_service_url'); + $address_data["service_url"] = Registry::get('addons.avatax_tax_calculation.avatax_service_url'); $address_data["account"] = Registry::get('addons.avatax_tax_calculation.avatax_account_number'); - $address_data["license"] = Registry::get('addons.avatax_tax_calculation.avatax_license_key'); - $environment = 'Development'; - - - $pos = strpos($address_data["service_url"], "development"); - if ($pos === false) $environment = 'Production'; - else $environment = 'Development'; - - - $address_data["environment"]=$environment; + $environment = strpos($address_data["service_url"], "development") === false ? 'Production': 'Development'; + $address_data["environment"] = $environment; - - //$address_data["client"] = CLIENT_NAME; - if($flag==1){ - $address_data["line1"] = $user_data["b_address"]; - $address_data["line2"] = $user_data["b_address_2"]; - //$address_data["line3"] = ""; - $address_data["city"] = $user_data["b_city"]; - $address_data["region"] = $user_data["b_state"]; - $address_data["postalcode"] = $user_data["b_zipcode"]; - $address_data["country"] = $user_data["b_country"]; - } - else if($flag==2) - { + //$address_data["client"] = CLIENT_NAME; + if ($flag == 1) { + $address_data["line1"] = $user_data["b_address"]; + $address_data["line2"] = $user_data["b_address_2"]; + //$address_data["line3"] = ""; + $address_data["city"] = $user_data["b_city"]; + $address_data["region"] = $user_data["b_state"]; + $address_data["postalcode"] = $user_data["b_zipcode"]; + $address_data["country"] = $user_data["b_country"]; + } else if ($flag == 2) { $address_data["line1"] = $user_data["s_address"]; $address_data["line2"] = $user_data["s_address_2"]; //$address_data["line3"] = ""; @@ -3179,7 +2643,7 @@ function fn_avatax_tax_calculation_address_validation($flag) $valid_address_data["state"] = $address->getRegion(); $valid_address_data["country"] = $address->getCountry(); - if($return_message != ""){ + if ($return_message != "") { $resArr["success"]=0; $resArr["msg"]=$return_message_js; $resArr["address"]=$address_data; @@ -3189,45 +2653,37 @@ function fn_avatax_tax_calculation_address_validation($flag) $resArr["msg"]=$valid_address_data; $resArr["address"]=$address_data; } - echo json_encode($resArr); + echo json_encode($resArr); exit; - }//End of If - - + } } function fn_avatax_tax_calculation_update_cart_by_data_post($cart, $new_cart_data, $auth) { - $order_id=$cart['order_id']; - $order_info = fn_get_order_info($order_id); - $cart['stored_taxes']='Y'; - $cart['tax_subtotal']=$GetTaxReturnValue['GetTaxTotalTax']; - - $GetTaxReturnValue = fn_avatax_tax_calculation_avatax_gettax($order_info, $auth); - $rate_value=$GetTaxReturnValue['GetTaxTotalTax']; - $avatax_tax_id=1; - return $cart["stored_taxes_data"] = array($avatax_tax_id => array( - 'rate_type' => 'P', - 'rate_value' => $rate_value, - 'price_includes_tax' => 'N', - 'priority' => 0, - 'tax_subtotal' => $tax_result, - 'description' => 'Total Tax', - 'applies' => Array - ( - 'P' => $p_rate, - 'S' => $s_rate - ) + $order_id = $cart['order_id']; + $order_info = fn_get_order_info($order_id); + $cart['stored_taxes'] = 'Y'; + $cart['tax_subtotal'] = $GetTaxReturnValue['GetTaxTotalTax']; + + $GetTaxReturnValue = fn_avatax_tax_calculation_avatax_gettax($order_info, $auth); + $rate_value = $GetTaxReturnValue['GetTaxTotalTax']; + $avatax_tax_id = 1; + return $cart["stored_taxes_data"] = array($avatax_tax_id => array( + 'rate_type' => 'P', + 'rate_value' => $rate_value, + 'price_includes_tax' => 'N', + 'priority' => 0, + 'tax_subtotal' => $tax_result, + 'description' => 'Total Tax', + 'applies' => array ( + 'P' => $p_rate, + 'S' => $s_rate ) - ); - - + )); } - - #} //$content .= "Product Original Price *** ".print_r($product_original_price,true)."\n"; //file_put_contents("usage_log.txt", $content, FILE_APPEND | LOCK_EX); diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/init.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/init.php similarity index 80% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/init.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/init.php index c647f1a..4edefb6 100644 --- a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/init.php +++ b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/init.php @@ -15,14 +15,13 @@ if (!defined('BOOTSTRAP')) { die('Access denied'); } fn_register_hooks( - - 'calculate_taxes_post', - 'place_order', - 'update_order', - //'is_user_exists_post', - 'change_order_status', - 'send_return_mail_pre', - 'change_return_status', - 'address_validation', - 'get_user_info_before' + 'calculate_taxes_post', + 'place_order', + 'update_order', + 'is_user_exists_post', + 'change_order_status', + 'send_return_mail_pre', + 'change_return_status', + 'address_validation', + 'get_user_info_before' ); diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/AvaTax.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/AvaTax.php similarity index 85% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/AvaTax.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/AvaTax.php index 0031e65..e781569 100644 --- a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/AvaTax.php +++ b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/AvaTax.php @@ -9,28 +9,25 @@ * Defines class loading search path. */ -function __autoload($class_name) +spl_autoload_register(function ($class_name) { - - $path=dirname(__FILE__).'/classes/'.$class_name . '.class.php'; + $path = dirname(__FILE__).'/classes/'.$class_name . '.class.php'; if(!file_exists($path)) { - $path=dirname(__FILE__).'/classes/BatchSvc/'.$class_name . '.class.php'; + $path = dirname(__FILE__).'/classes/BatchSvc/'.$class_name . '.class.php'; } if(!file_exists($path)) { - - $path=dirname(__FILE__).'/classes/AvaCert2Svc/'.$class_name . '.class.php'; + $path = dirname(__FILE__).'/classes/AvaCert2Svc/'.$class_name . '.class.php'; } - - if(file_exists($path)) - { - require_once $path; - } - -} + + if(file_exists($path)) + { + require_once $path; + } +}); function EnsureIsArray( $obj ) { diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/TPAConfiguration.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/TPAConfiguration.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/TPAConfiguration.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/TPAConfiguration.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/address_validation.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/address_validation.php similarity index 96% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/address_validation.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/address_validation.php index 41b4f67..fc49743 100644 --- a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/address_validation.php +++ b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/address_validation.php @@ -4,7 +4,6 @@ //{ //require_once('AvaTax.php'); include_once($lib_path."AvaTax4PHP/AvaTax.php"); - spl_autoload_register(__autoload); $return_message = ""; $return_message_js = ""; diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/avatax_accounts.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/avatax_accounts.php new file mode 100644 index 0000000..d369113 --- /dev/null +++ b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/avatax_accounts.php @@ -0,0 +1,86 @@ +$development_url, 'account'=>$account,'license'=>$license,'client'=>$client, 'trace'=> TRUE)); + + $client = new AccountServiceSoap($environment); + + $return_message = ""; + + try + { + $result = $client->CompanyFetch(""); + $response= array(); + + if($result->getResultCode() != SeverityLevel::$Success) + { + $return_message .= "Error - AvaTax Account Service Message\n"; + + foreach($result->getMessages() as $msg) + { + //$return_message .= $msg->getName().": ".$msg->getSummary()."
"; + $return_message .= $msg->getSummary(); + } + $response["msg"]=$return_message; + $response["address"]=""; + } + else if($result->getResultCode() == SeverityLevel::$Success && $result->getValidCompanies() != "") + { + $arr=array(); + $validCompanies=array(); + $validCompanies=$result->getValidCompanies(); + foreach ($validCompanies as $obj) { + $arr[$obj->CompanyCode] = $obj->CompanyName; + } + $return_message .= json_encode($arr); + } + echo($return_message); + + if($log == 1) + { + require_once('classes/SystemLogger.class.php'); + $timeStamp = new DateTime(); // Create Time Stamp + $params = '[Input: ' . ']'; // Create Param List + $u_name = ''; // Eventually will come from $_SESSION[] object + + // Creating the System Logger Object + $application_log = new SystemLogger; + + $application_log->AddSystemLog($timeStamp->format('Y-m-d H:i:s'), __FUNCTION__, __CLASS__, __METHOD__, __FILE__, $u_name, $params, $client->__getLastRequest()); // Create System Log + $application_log->WriteSystemLogToFile(); // Log info goes to log file + + $application_log->AddSystemLog($timeStamp->format('Y-m-d H:i:s'), __FUNCTION__, __CLASS__, __METHOD__, __FILE__, $u_name, $params, $client->__getLastResponse()); // Create System Log + $application_log->WriteSystemLogToFile(); // Log info goes to log file + } + + //return json_encode($response); + } + catch(SoapFault $exception) + { + $return_message .= "Exception: "; + if($exception) + { + $return_message .= $exception->faultstring; + $return_message .= $client->__getLastRequest() . "
"; + $return_message .= $client->__getLastResponse() . "
"; + } + //return $return_message; + print_r($return_message); + } +} + +if(isset($_POST["from"]) && $_POST["from"]=="AvaTaxFetchCompanies") +{ + AccountValidation(); +} +?> \ No newline at end of file diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/avatax_config.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/avatax_config.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/avatax_config.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/avatax_config.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/avatax_create_account.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/avatax_create_account.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/avatax_create_account.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/avatax_create_account.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/avatax_test_connection.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/avatax_test_connection.php similarity index 96% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/avatax_test_connection.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/avatax_test_connection.php index d0f7bf9..c2d55e8 100644 --- a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/avatax_test_connection.php +++ b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/avatax_test_connection.php @@ -1,7 +1,6 @@ format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); + + new ATConfig($order_data["environment"], array('url'=>$order_data["service_url"], 'account'=>$order_data["account"],'license'=>$order_data["license"],'client'=>$order_data["client"], 'trace'=> TRUE)); + + $client = new TaxServiceSoap($order_data["environment"]); + $request = new CancelTaxRequest(); + + $request->setCompanyCode($order_data["CompanyCode"]); + $request->setDocType($order_data["DocType"]); + $request->setDocCode($order_data["DocCode"]); + if($order_data["CancelCode"] == "Docvoided") + { + $order_data["CancelCode"] = "DocVoided"; + } + $request->setCancelCode($order_data["CancelCode"]); + + $CancelTaxReturnValue = array(); + + // PostTax and Results + try + { + $connectorcalling = $timeStamp->format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); + $result = $client->cancelTax($request); + $connectorcomplete = $timeStamp->format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); + + // Creating the System Logger Object + $application_log = new SystemLogger; + $connectorend = $timeStamp->format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); + $performance_metrics[] = array("CallerTimeStamp","MessageString","CallerAcctNum","DocCode","Operation","ServiceURL","LogType","LogLevel","ERPName","ERPVersion","ConnectorVersion"); + $performance_metrics[] = array($connectorstart,"PreCancelTax Start Time-\"".$connectorstart,$order_data["account"],$order_data["DocCode"],"CancelTax",$order_data["service_url"],"Performance","Informational","CS-Cart",PRODUCT_VERSION,AVALARA_VERSION); + $performance_metrics[] = array($connectorcalling,"PreCancelTax End Time-\"".$connectorcalling,$order_data["account"],$order_data["DocCode"],"CancelTax",$order_data["service_url"],"Performance","Informational","CS-Cart",PRODUCT_VERSION,AVALARA_VERSION); + $performance_metrics[] = array($connectorcomplete,"PostCancelTax Start Time-\"".$connectorcomplete,$order_data["account"],$order_data["DocCode"],"CancelTax",$order_data["service_url"],"Performance","Informational","CS-Cart",PRODUCT_VERSION,AVALARA_VERSION); + $performance_metrics[] = array($connectorend,"PostCancelTax End Time-\"".$connectorend,$order_data["account"],$order_data["DocCode"],"CancelTax",$order_data["service_url"],"Performance","Informational","CS-Cart",PRODUCT_VERSION,AVALARA_VERSION); + //Call serviceLog function + $returnServiceLog = $application_log->serviceLog($performance_metrics); + + /************* Logging code snippet (optional) starts here *******************/ + // System Logger starts here: + + if($log_mode == 1){ + $params = '[Input: ' . ']'; // Create Param List + $u_name = ''; // Eventually will come from $_SESSION[] object + $application_log->AddSystemLog($timeStamp->format('Y-m-d H:i:s'), __FUNCTION__, __CLASS__, __METHOD__, __FILE__, $u_name, $params, $client->__getLastRequest()); // Create System Log + $application_log->WriteSystemLogToFile(); // Log info goes to log file + + $application_log->AddSystemLog($timeStamp->format('Y-m-d H:i:s'), __FUNCTION__, __CLASS__, __METHOD__, __FILE__, $u_name, $params, $client->__getLastResponse()); // Create System Log + $application_log->WriteSystemLogToFile(); // Log info goes to log file + + // $application_log->WriteSystemLogToDB(); // Log info goes to DB + // System Logger ends here + // Logging code snippet (optional) ends here + } + + /*** + * Place holder for logs + * getLastRequest + * getLastResponse + */ + + // Success - Display GetTaxResults to console + if ($result->getResultCode() != SeverityLevel::$Success) { + if($result->getResultCode() == SeverityLevel::$Error){ + + $return_message = "AvaTax - Error Message
"; + foreach($result->getMessages() as $msg) + { + //$return_message .= $msg->getName().": ".$msg->getSummary()."
"; + $return_message .= $msg->getSummary()."
"; + } + $avatax_tax_error = '
' . $return_message . '
'; + fn_set_notification('E', __('error'), $avatax_tax_error); + $returnMessage = SeverityLevel::$Error; + } + } + else + { + $returnMessage = $result->getResultCode(); + } + // If NOT success - display error or warning messages to console + // it is important to itterate through the entire message class + } + catch (SoapFault $exception) + { + $msg = "Exception: "; + if ($exception) + $msg .= $exception->faultstring; + $return_message = "AvaTax - Error Message
"; + $return_message .= $msg; + $avatax_tax_error = '
' . $return_message . '
'; + fn_set_notification('E', __('error'), $avatax_tax_error); + + // If you desire to retrieve SOAP IN / OUT XML + // - Follow directions below + // - if not, leave as is + // } //UN-comment this line to return SOAP XML + $returnMessage = SeverityLevel::$Error; + + //echo $client->__getLastRequest() . "\n"; + //echo $client->__getLastResponse() . "\n"; + } //Comment this line to return SOAP XML +//} +?> \ No newline at end of file diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ATConfig.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ATConfig.class.php similarity index 96% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ATConfig.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ATConfig.class.php index 42ae916..f314466 100644 --- a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ATConfig.class.php +++ b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ATConfig.class.php @@ -64,9 +64,9 @@ public function __get($n) 'avacert2WSDL' => 'file://'.$__wsdldir.'/AvaCert2Svc.wsdl', 'account' => '', 'license' => '', - 'adapter' => 'avatax4php,15.5.0.0', + 'adapter' => 'avatax4php,15.6.0.0', 'client' => 'AvalaraPHPInterface,1.0', - 'name' => '15.5.0.0', + 'name' => '15.6.0.0', 'trace' => true) // change to false for production ); ?> \ No newline at end of file diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ATObject.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ATObject.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ATObject.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ATObject.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AccountServiceSoap.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AccountServiceSoap.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AccountServiceSoap.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AccountServiceSoap.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/Address.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/Address.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/Address.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/Address.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AddressLocationType.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AddressLocationType.class.php new file mode 100644 index 0000000..bc56ea2 --- /dev/null +++ b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AddressLocationType.class.php @@ -0,0 +1,20 @@ +AddressCode; } + public function getLocationTypeCode() { return $this->LocationTypeCode; } + + public function setAddressCode($value) { $this->AddressCode = $value; return $this; } + public function setLocationTypeCode($value) { LocationType::Validate($value); $this->LocationTypeCode = $value; return $this; } +} \ No newline at end of file diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AddressServiceSoap.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AddressServiceSoap.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AddressServiceSoap.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AddressServiceSoap.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AddressType.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AddressType.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AddressType.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AddressType.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AdjustTaxRequest.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AdjustTaxRequest.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AdjustTaxRequest.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AdjustTaxRequest.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AdjustTaxResult.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AdjustTaxResult.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AdjustTaxResult.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AdjustTaxResult.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ApplyPaymentRequest.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ApplyPaymentRequest.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ApplyPaymentRequest.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ApplyPaymentRequest.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ApplyPaymentResult.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ApplyPaymentResult.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ApplyPaymentResult.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ApplyPaymentResult.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/AvaCert2Soap.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/AvaCert2Soap.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/AvaCert2Soap.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/AvaCert2Soap.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/Certificate.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/Certificate.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/Certificate.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/Certificate.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateGetRequest.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateGetRequest.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateGetRequest.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateGetRequest.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateGetResult.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateGetResult.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateGetResult.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateGetResult.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateImageGetRequest.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateImageGetRequest.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateImageGetRequest.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateImageGetRequest.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateImageGetResult.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateImageGetResult.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateImageGetResult.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateImageGetResult.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateJurisdiction.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateJurisdiction.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateJurisdiction.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateJurisdiction.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateRequest.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateRequest.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateRequest.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateRequest.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateRequestGetRequest.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateRequestGetRequest.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateRequestGetRequest.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateRequestGetRequest.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateRequestGetResult.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateRequestGetResult.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateRequestGetResult.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateRequestGetResult.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateRequestInitiateRequest.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateRequestInitiateRequest.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateRequestInitiateRequest.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateRequestInitiateRequest.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateRequestInitiateResult.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateRequestInitiateResult.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateRequestInitiateResult.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateRequestInitiateResult.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateRequestStage.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateRequestStage.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateRequestStage.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateRequestStage.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateRequestStatus.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateRequestStatus.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateRequestStatus.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateRequestStatus.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateStatus.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateStatus.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateStatus.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateStatus.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateUsage.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateUsage.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateUsage.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CertificateUsage.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CommunicationMode.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CommunicationMode.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CommunicationMode.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CommunicationMode.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/Customer.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/Customer.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/Customer.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/Customer.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CustomerSaveRequest.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CustomerSaveRequest.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CustomerSaveRequest.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CustomerSaveRequest.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CustomerSaveResult.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CustomerSaveResult.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CustomerSaveResult.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/CustomerSaveResult.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/FormatType.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/FormatType.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/FormatType.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/FormatType.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/RequestType.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/RequestType.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/RequestType.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/RequestType.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/ReviewStatus.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/ReviewStatus.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/ReviewStatus.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvaCert2Svc/ReviewStatus.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvalaraSoapClient.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvalaraSoapClient.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvalaraSoapClient.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/AvalaraSoapClient.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BRBuyerTypeEnum.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BRBuyerTypeEnum.class.php new file mode 100644 index 0000000..76a5525 --- /dev/null +++ b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BRBuyerTypeEnum.class.php @@ -0,0 +1,35 @@ + \ No newline at end of file diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BaseResult.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BaseResult.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BaseResult.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BaseResult.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/AuditMessage.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/AuditMessage.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/AuditMessage.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/AuditMessage.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/AvaTaxBatchSvc.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/AvaTaxBatchSvc.php similarity index 93% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/AvaTaxBatchSvc.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/AvaTaxBatchSvc.php index 0b8073e..c30a7ed 100644 --- a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/AvaTaxBatchSvc.php +++ b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/AvaTaxBatchSvc.php @@ -7,18 +7,18 @@ * Defines class loading search path. * * @author Avalara - * @copyright © 2004 - 2011 Avalara, Inc. All rights reserved. + * @copyright ďż˝ 2004 - 2011 Avalara, Inc. All rights reserved. * @package Base */ -function __autoload($class_name) +spl_autoload_register(function ($class_name) { require_once $class_name . '.class.php'; -} +}); function EnsureIsArray( $obj ) { - if( is_object($obj)) + if(is_object($obj)) { $item[0] = $obj; } @@ -29,8 +29,6 @@ function EnsureIsArray( $obj ) return $item; } - - /** * Takes xml as a string and returns it nicely indented * diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BaseResult.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BaseResult.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BaseResult.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BaseResult.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/Batch.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/Batch.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/Batch.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/Batch.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchDelete.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchDelete.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchDelete.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchDelete.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchDeleteResponse.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchDeleteResponse.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchDeleteResponse.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchDeleteResponse.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFetch.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFetch.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFetch.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFetch.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFetchResponse.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFetchResponse.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFetchResponse.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFetchResponse.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFetchResult.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFetchResult.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFetchResult.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFetchResult.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFile.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFile.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFile.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFile.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFileDelete.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFileDelete.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFileDelete.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFileDelete.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFileDeleteResponse.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFileDeleteResponse.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFileDeleteResponse.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFileDeleteResponse.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFileFetch.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFileFetch.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFileFetch.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFileFetch.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFileFetchResponse.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFileFetchResponse.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFileFetchResponse.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFileFetchResponse.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFileFetchResult.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFileFetchResult.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFileFetchResult.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFileFetchResult.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFileSave.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFileSave.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFileSave.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFileSave.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFileSaveResponse.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFileSaveResponse.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFileSaveResponse.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFileSaveResponse.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFileSaveResult.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFileSaveResult.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFileSaveResult.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchFileSaveResult.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchProcess.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchProcess.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchProcess.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchProcess.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchProcessRequest.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchProcessRequest.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchProcessRequest.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchProcessRequest.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchProcessResponse.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchProcessResponse.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchProcessResponse.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchProcessResponse.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchProcessResult.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchProcessResult.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchProcessResult.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchProcessResult.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchSave.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchSave.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchSave.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchSave.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchSaveResponse.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchSaveResponse.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchSaveResponse.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchSaveResponse.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchSaveResult.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchSaveResult.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchSaveResult.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchSaveResult.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchSvc.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchSvc.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchSvc.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/BatchSvc.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/DeleteRequest.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/DeleteRequest.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/DeleteRequest.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/DeleteRequest.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/DeleteResult.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/DeleteResult.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/DeleteResult.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/DeleteResult.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/FetchRequest.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/FetchRequest.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/FetchRequest.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/FetchRequest.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/FilterRequest.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/FilterRequest.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/FilterRequest.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/FilterRequest.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/FilterResult.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/FilterResult.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/FilterResult.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/FilterResult.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/IsAuthorized.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/IsAuthorized.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/IsAuthorized.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/IsAuthorized.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/IsAuthorizedResponse.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/IsAuthorizedResponse.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/IsAuthorizedResponse.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/IsAuthorizedResponse.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/IsAuthorizedResult.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/IsAuthorizedResult.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/IsAuthorizedResult.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/IsAuthorizedResult.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/Message.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/Message.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/Message.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/Message.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/Ping.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/Ping.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/Ping.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/Ping.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/PingResponse.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/PingResponse.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/PingResponse.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/PingResponse.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/PingResult.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/PingResult.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/PingResult.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/PingResult.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/Profile.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/Profile.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/Profile.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/Profile.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/SeverityLevel.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/SeverityLevel.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/SeverityLevel.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BatchSvc/SeverityLevel.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BoundaryLevel.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BoundaryLevel.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BoundaryLevel.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/BoundaryLevel.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/CancelCode.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/CancelCode.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/CancelCode.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/CancelCode.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/CancelTaxRequest.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/CancelTaxRequest.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/CancelTaxRequest.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/CancelTaxRequest.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/CancelTaxResult.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/CancelTaxResult.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/CancelTaxResult.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/CancelTaxResult.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/CommitTaxRequest.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/CommitTaxRequest.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/CommitTaxRequest.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/CommitTaxRequest.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/CommitTaxResult.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/CommitTaxResult.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/CommitTaxResult.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/CommitTaxResult.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/DetailLevel.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/DetailLevel.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/DetailLevel.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/DetailLevel.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/DocStatus.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/DocStatus.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/DocStatus.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/DocStatus.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/DocumentType.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/DocumentType.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/DocumentType.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/DocumentType.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/DynamicSoapClient.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/DynamicSoapClient.class.php similarity index 87% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/DynamicSoapClient.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/DynamicSoapClient.class.php index 13ce523..ca9c573 100644 --- a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/DynamicSoapClient.class.php +++ b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/DynamicSoapClient.class.php @@ -14,7 +14,7 @@ * @see TaxServiceSoap * * @author Avalara - * @copyright © 2004 - 2011 Avalara, Inc. All rights reserved. + * @copyright ďż˝ 2004 - 2011 Avalara, Inc. All rights reserved. * @package Base */ @@ -27,13 +27,13 @@ public function __construct($wsdl,$options,&$config) $this->config = $config; } - public function __call($n,$args) - { + public function __call($n,$args) + { $profileHeader = new SoapHeader('http://avatax.avalara.com/services','Profile',new SoapVar($this->profileXML(),XSD_ANYXML)); $securityHeader = new SoapHeader('http://avatax.avalara.com/services','Security',new SoapVar($this->securityXML(),XSD_ANYXML)); - $result = $this->__soapCall($n,$args,NULL,array($securityHeader,$profileHeader)); + $result = $this->__soapCall($n, $args, NULL, array($securityHeader, $profileHeader)); return $result; - } + } private function securityXML() { @@ -52,8 +52,8 @@ private function profileXML() return ''. ''.$this->config->name.''. - ''.$this->config->client.''. - ''.$this->config->adapter.''. + ''.$this->config->client.''. + ''.$this->config->adapter.''. ''; } diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/Enum.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/Enum.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/Enum.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/Enum.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/GetAllParameterBagItemsResult.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/GetAllParameterBagItemsResult.class.php new file mode 100644 index 0000000..4f97df9 --- /dev/null +++ b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/GetAllParameterBagItemsResult.class.php @@ -0,0 +1,21 @@ +ParameterBags = $value; return $this; } //array + + public function getParameterBags() + { + return is_array($this->ParameterBags) ? $this->ParameterBags : EnsureIsArray($this->ParameterBags->ParameterBag); + } //array +} +?> \ No newline at end of file diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/GetParameterBagItemsRequest.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/GetParameterBagItemsRequest.class.php new file mode 100644 index 0000000..dadf2cf --- /dev/null +++ b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/GetParameterBagItemsRequest.class.php @@ -0,0 +1,43 @@ +Category = $value; } + + /** + * @param string $value + */ + public function setCountry($value) { $this->Country = $value;} + + /** + * + * @param string $value + */ + public function setState($value) { $this->State = $value;} + + public function getCategory() { return $this->Category;} + + public function getCountry() { return $this->Country;} + + public function getState() { return $this->State;} +} + +?> \ No newline at end of file diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/GetParameterBagItemsResult.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/GetParameterBagItemsResult.class.php new file mode 100644 index 0000000..3778a31 --- /dev/null +++ b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/GetParameterBagItemsResult.class.php @@ -0,0 +1,21 @@ +ParameterBags = $value; return $this; } //array Changed for 15.6.0.0 + + public function getParameterBags() + { + return is_array($this->ParameterBags) ? $this->ParameterBags : EnsureIsArray($this->ParameterBags->ParameterBag); + } //array Changed for 15.6.0.0 +} +?> \ No newline at end of file diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/GetTaxHistoryRequest.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/GetTaxHistoryRequest.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/GetTaxHistoryRequest.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/GetTaxHistoryRequest.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/GetTaxHistoryResult.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/GetTaxHistoryResult.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/GetTaxHistoryResult.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/GetTaxHistoryResult.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/GetTaxRequest.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/GetTaxRequest.class.php similarity index 71% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/GetTaxRequest.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/GetTaxRequest.class.php index e383851..6ffddec 100644 --- a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/GetTaxRequest.class.php +++ b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/GetTaxRequest.class.php @@ -20,6 +20,7 @@ class GetTaxRequest private $CompanyCode; // string private $DocCode; private $DocType; + private $BRBuyerType; //Changed for 15.6.0.0 private $DocDate; //date private $SalespersonCode; //string private $CustomerCode; //string @@ -31,6 +32,8 @@ class GetTaxRequest private $DestinationCode; //string private $Addresses; //array private $Lines; //array + private $AddressLocationTypes; //array //Changed for 15.6.0.0 + private $ParameterBagItems; //array //Changed for 15.6.0.0 private $DetailLevel; //Summary or Document or Line or Tax or Diagnostic private $ReferenceCode; // string private $LocationCode; //string @@ -38,6 +41,14 @@ class GetTaxRequest private $BatchCode; //string private $OriginAddress; //address private $DestinationAddress; //address + private $BRBuyer_IsExempt_COFINS=false; //boolean //Changed for 15.6.0.0 + private $BRBuyer_IsExempt_CSLL=false; //boolean //Changed for 15.6.0.0 + private $BRBuyer_IsExempt_PIS=false; //boolean //Changed for 15.6.0.0 + private $BRBuyer_IsExemptOrCannotWH_COFINSRF=false; //boolean //Changed for 15.6.0.0 + private $BRBuyer_IsExemptOrCannotWH_CSLLRF=false; //boolean //Changed for 15.6.0.0 + private $BRBuyer_IsExemptOrCannotWH_IRRF=false; //boolean //Changed for 15.6.0.0 + private $BRBuyer_IsExemptOrCannotWH_PISRF=false; //boolean //Changed for 15.6.0.0 + private $IsSellerImporterOfRecord=false; //boolean //Changed for 15.6.0.0 //@author: Swetal @@ -50,18 +61,27 @@ class GetTaxRequest private $BusinessIdentificationNo; //string private $ExchangeRateEffDate; //date private $PosLaneCode; //string - - - + private $Description; //string Changed for 15.6.0.0 + private $Email; //string Changed for 15.6.0.0 + public function __construct() { $this->DocDate = date("Y-m-d"); $this->Commit=false; + $this->BRBuyer_IsExempt_COFINS=false; //Changed for 15.6.0.0 + $this->BRBuyer_IsExempt_CSLL=false; //Changed for 15.6.0.0 + $this->BRBuyer_IsExempt_PIS=false; //Changed for 15.6.0.0 + $this->BRBuyer_IsExemptOrCannotWH_COFINSRF=false; //Changed for 15.6.0.0 + $this->BRBuyer_IsExemptOrCannotWH_CSLLRF=false; //Changed for 15.6.0.0 + $this->BRBuyer_IsExemptOrCannotWH_IRRF=false; //Changed for 15.6.0.0 + $this->BRBuyer_IsExemptOrCannotWH_PISRF=false; //Changed for 15.6.0.0 + $this->IsSellerImporterOfRecord=false; //Changed for 15.6.0.0 $this->HashCode=0; $this->Discount=0.0; $this->DocType=DocumentType::$SalesInvoice; + $this->BRBuyerType=BRBuyerTypeEnum::$IND; //Changed for 15.6.0.0 $this->DetailLevel=DetailLevel::$Document; $this->DocCode = date("Y-m-d-H-i-s.u"); $this->CustomerCode='CustomerCodeString'; @@ -83,7 +103,12 @@ public function prepare() $this->Addresses = array(); $this->OriginCode = $this->registerAddress($this->OriginAddress); $this->DestinationCode = $this->registerAddress($this->DestinationAddress); - foreach($this->Lines as &$line) + if(isset($this->Lines->Line)) + $allLines = $this->Lines->Line; + else + $allLines = $this->Lines; + + foreach($allLines as &$line) { $line->registerAddressesIn($this); } @@ -213,7 +238,8 @@ public function setCompanyCode($value) { $this->CompanyCode = $value; return $th * */ public function setDocType($value) { DocumentType::Validate($value); $this->DocType = $value; return $this; } //SalesOrder or SalesInvoice or PurchaseOrder or PurchaseInvoice or ReturnOrder or ReturnInvoice - + + public function setBRBuyerType($value) { BRBuyerTypeEnum::Validate($value); $this->BRBuyerType = $value; return $this; } //Changed for 15.6.0.0 /** * Specifies the level of detail to return. * @@ -317,6 +343,22 @@ public function setDiscount($value) { $this->Discount = $value; return $this; } */ public function setAddresses($value) { $this->Addresses = $value; return $this; } //array + /** + * Set AddressLocationTypes + * + * @param array $value + + */ + public function setAddressLocationTypes($value) { $this->AddressLocationTypes = $value; return $this; } //array Changed for 15.6.0.0 + + /** + * Set ParameterBagItems + * + * @param array $value + + */ + public function setParameterBagItems($value) { $this->ParameterBagItems = $value; return $this; } //array Changed for 15.6.0.0 + /** * Set tax lines * @@ -334,6 +376,71 @@ public function setHashCode($value) { $this->HashCode = $value; return $this; } * */ public function setCommit($value) { $this->Commit = $value; return $this; } //boolean + + /** + * This has been defaulted to False ; + * + * @param boolean $value + * + */ + public function setBRBuyer_IsExempt_COFINS($value) { $this->BRBuyer_IsExempt_COFINS = $value; return $this; } //boolean Changed for 15.6.0.0 + + /** + * This has been defaulted to False ; + * + * @param boolean $value + * + */ + public function setIsSellerImporterOfRecord($value) { $this->IsSellerImporterOfRecord = $value; return $this; } //boolean Changed for 15.6.0.0 + + /** + * This has been defaulted to False ; + * + * @param boolean $value + * + */ + public function setBRBuyer_IsExempt_CSLL($value) { $this->BRBuyer_IsExempt_CSLL = $value; return $this; } //boolean Changed for 15.6.0.0 + + /** + * This has been defaulted to False ; + * + * @param boolean $value + * + */ + public function setBRBuyer_IsExempt_PIS($value) { $this->BRBuyer_IsExempt_PIS = $value; return $this; } //boolean Changed for 15.6.0.0 + + /** + * This has been defaulted to False ; + * + * @param boolean $value + * + */ + public function setBRBuyer_IsExemptOrCannotWH_COFINSRF($value) { $this->BRBuyer_IsExemptOrCannotWH_COFINSRF = $value; return $this; } //boolean Changed for 15.6.0.0 + + /** + * This has been defaulted to False ; + * + * @param boolean $value + * + */ + public function setBRBuyer_IsExemptOrCannotWH_CSLLRF($value) { $this->BRBuyer_IsExemptOrCannotWH_CSLLRF = $value; return $this; } //boolean Changed for 15.6.0.0 + + /** + * This has been defaulted to False ; + * + * @param boolean $value + * + */ + public function setBRBuyer_IsExemptOrCannotWH_IRRF($value) { $this->BRBuyer_IsExemptOrCannotWH_IRRF = $value; return $this; } //boolean Changed for 15.6.0.0 + + /** + * This has been defaulted to False ; + * + * @param boolean $value + * + */ + public function setBRBuyer_IsExemptOrCannotWH_PISRF($value) { $this->BRBuyer_IsExemptOrCannotWH_PISRF = $value; return $this; } //boolean Changed for 15.6.0.0 + //public function setIsTotalTaxOverriden($value) { $this->IsTotalTaxOverriden = ($value ? true : false); return $this; } //boolean /** @@ -416,6 +523,16 @@ public function setPosLaneCode($value) $this->PosLaneCode = $value;// return $this; } //string + public function setDescription($value) + { + $this->Description = $value;// return $this; + } //string Changed for 15.6.0.0 + + public function setEmail($value) + { + $this->Email = $value;// return $this; + } //string Changed for 15.6.0.0 + /** *TaxOverride for the document. * @@ -437,6 +554,7 @@ public function setReferenceCode($value) public function getCompanyCode() { return $this->CompanyCode;} //string public function getDocType() { return $this->DocType;} //SalesOrder or SalesInvoice or PurchaseOrder or PurchaseInvoice or ReturnOrder or ReturnInvoice + public function getBRBuyerType() { return $this->BRBuyerType;} //Changed for 15.6.0.0 public function getDocCode() { return $this->DocCode;} //string invoice number public function getDocDate() { return $this->DocDate;} //date public function salespersonCode() { return $this->SalespersonCode;} //string @@ -458,14 +576,16 @@ public function getAddresses() //@swetal //Changed from $this->Addresses to $this->Addresses->BaseAddress - return is_array($this->Addresses) ? $this->Addresses : EnsureIsArray($this->Addresses->BaseAddress); - - - - - - + return is_array($this->Addresses) ? $this->Addresses : EnsureIsArray($this->Addresses->BaseAddress); } //array + public function getAddressLocationTypes() + { + return is_array($this->AddressLocationTypes) ? $this->AddressLocationTypes : EnsureIsArray($this->AddressLocationTypes->AddressLocationType); + } //array Changed for 15.6.0.0 + public function getParameterBagItems() + { + return is_array($this->ParameterBagItems) ? $this->ParameterBagItems : EnsureIsArray($this->ParameterBagItems->ParameterBagItem); + } //array Changed for 15.6.0.0 public function getLines() { return is_array($this->Lines) ? $this->Lines : EnsureIsArray($this->Lines->Line); @@ -477,6 +597,15 @@ public function getLocationCode() { return $this->LocationCode;} //string public function getBatchCode() { return $this->BatchCode;} //string public function getCommit() { return $this->Commit;} //boolean + + public function getBRBuyer_IsExempt_COFINS() { return $this->BRBuyer_IsExempt_COFINS;} //boolean Changed for 15.6.0.0 + public function getBRBuyer_IsExempt_CSLL() { return $this->BRBuyer_IsExempt_CSLL;} //boolean Changed for 15.6.0.0 + public function getBRBuyer_IsExempt_PIS() { return $this->BRBuyer_IsExempt_PIS;} //boolean Changed for 15.6.0.0 + public function getBRBuyer_IsExemptOrCannotWH_COFINSRF() { return $this->BRBuyer_IsExemptOrCannotWH_COFINSRF;} //boolean Changed for 15.6.0.0 + public function getBRBuyer_IsExemptOrCannotWH_CSLLRF() { return $this->BRBuyer_IsExemptOrCannotWH_CSLLRF;} //boolean Changed for 15.6.0.0 + public function getBRBuyer_IsExemptOrCannotWH_IRRF() { return $this->BRBuyer_IsExemptOrCannotWH_IRRF;} //boolean Changed for 15.6.0.0 + public function getBRBuyer_IsExemptOrCannotWH_PISRF() { return $this->BRBuyer_IsExemptOrCannotWH_PISRF;} //boolean Changed for 15.6.0.0 + public function getIsSellerImporterOfRecord() { return $this->IsSellerImporterOfRecord;} //boolean Changed for 15.6.0.0 //public function getIsTotalTaxOverriden() { return $this->IsTotalTaxOverriden;} //boolean @@ -491,6 +620,8 @@ public function getPaymentDate() { return $this->PaymentDate; } //date public function getExchangeRateEffDate(){ return $this->ExchangeRateEffDate; } //date public function getBusinessIdentificationNo() {return $this->BusinessIdentificationNo; } //string public function getPosLaneCode() {return $this->PosLaneCode; } //string + public function getDescription() {return $this->Description; } //string Changed for 15.6.0.0 + public function getEmail() {return $this->Email; } //string Changed for 15.6.0.0 public function getTaxOverride(){ return $this->TaxOverride;} public function getReferenceCode() diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/GetTaxResult.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/GetTaxResult.class.php similarity index 94% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/GetTaxResult.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/GetTaxResult.class.php index 4404c89..a960790 100644 --- a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/GetTaxResult.class.php +++ b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/GetTaxResult.class.php @@ -39,6 +39,8 @@ class GetTaxResult // extends BaseResult //Added new properties to upgrade to 5.3 interface private $TotalTaxCalculated; //decimal private $TaxSummary; //ArrayOfTaxDetail + private $ParameterBagItems; //array //Added for 15.6.0.0 + private $Description; //string //Added for 15.6.0.0 /** @@ -51,6 +53,8 @@ class GetTaxResult // extends BaseResult */ public function getDocId() {return $this->DocId; } + //Added for + public function getDescription() {return $this->Description; } /** * Gets the internal reference code used by the client application. This is used for operations such as Post and GetTaxHistory. *

@@ -262,10 +266,10 @@ public function getResultCode() { return $this->ResultCode; } */ public function getMessages() { return EnsureIsArray($this->Messages->Message); } - - - - + public function getParameterBagItems() + { + return is_array($this->ParameterBagItems) ? $this->ParameterBagItems : EnsureIsArray($this->ParameterBagItems->ParameterBagItem); + } //array Changed for 15.6.0.0 } diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/IsAuthorizedResult.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/IsAuthorizedResult.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/IsAuthorizedResult.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/IsAuthorizedResult.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/JurisdictionType.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/JurisdictionType.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/JurisdictionType.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/JurisdictionType.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/Line.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/Line.class.php similarity index 86% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/Line.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/Line.class.php index fa5c6d2..0669aaa 100644 --- a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/Line.class.php +++ b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/Line.class.php @@ -29,6 +29,9 @@ class Line private $Ref2; //string private $ExemptionNo; //string //zero tax will result if filled in private $CustomerUsageType; //string + private $UnitOfMeasurement; //string //Changed for 15.6.0.0 + private $AddressLocationTypes; //array //Changed for 15.6.0.0 + private $ParameterBagItems; //array //Changed for 15.6.0.0 private $BatchCode; //string private $TaxOverride; //TaxOverride @@ -139,6 +142,24 @@ public function setExemptionNo($value) { $this->ExemptionNo = $value; return $th */ public function setCustomerUsageType($value) { $this->CustomerUsageType = $value; return $this; } //string + public function setUnitOfMeasurement($value) { $this->UnitOfMeasurement = $value; return $this; } //string Changed for 15.6.0.0 + + /** + * Set AddressLocationTypes + * + * @param array $value + + */ + public function setAddressLocationTypes($value) { $this->AddressLocationTypes = $value; return $this; } //array Changed for 15.6.0.0 + + /** + * Set ParameterBagItems + * + * @param array $value + + */ + public function setParameterBagItems($value) { $this->ParameterBagItems = $value; return $this; } //array Changed for 15.6.0.0 + /** * Enter description here... * @@ -263,6 +284,7 @@ public function getRef1() { return $this->Ref1; } //string public function getRef2() { return $this->Ref2; } //string public function getExemptionNo() { return $this->ExemptionNo; } //string //zero tax will result if filled in public function getCustomerUsageType() { return $this->CustomerUsageType; } //string + public function getUnitOfMeasurement() { return $this->UnitOfMeasurement; } //string Changed for 15.6.0.0 public function getBatchCode() { return $this->BatchCode; } //string public function getQty() { return $this->Qty; } //decimal @@ -275,8 +297,15 @@ public function getDiscounted() { return $this->Discounted; } //boolean public function getOriginAddress() { return $this->OriginAddress; } //Address public function getDestinationAddress() { return $this->DestinationAddress; } //Address + public function getAddressLocationTypes() + { + return is_array($this->AddressLocationTypes) ? $this->AddressLocationTypes : EnsureIsArray($this->AddressLocationTypes->AddressLocationType); + } //array Changed for 15.6.0.0 + public function getParameterBagItems() + { + return is_array($this->ParameterBagItems) ? $this->ParameterBagItems : EnsureIsArray($this->ParameterBagItems->ParameterBagItem); + } //array Changed for 15.6.0.0 - /**#@-*/ } diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/LocationType.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/LocationType.class.php new file mode 100644 index 0000000..6b350c0 --- /dev/null +++ b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/LocationType.class.php @@ -0,0 +1,38 @@ + \ No newline at end of file diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/Message.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/Message.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/Message.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/Message.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ParameterBag.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ParameterBag.class.php new file mode 100644 index 0000000..2505ac0 --- /dev/null +++ b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ParameterBag.class.php @@ -0,0 +1,36 @@ +ParameterBagId = $value;} + public function setCategory($value) { $this->Category = $value;} + public function setCountry($value) { $this->Country = $value;} + public function setState($value) { $this->State = $value;} + public function setName($value) { $this->Name = $value;} + public function setDataType($value) { $this->DataType = $value;} + public function setDescription($value) { $this->Description = $value;} + + public function getParameterBagId() { return $this->ParameterBagId;} + public function getCategory() { return $this->Category;} + public function getCountry() { return $this->Country;} + public function getState() { return $this->State;} + public function getName() { return $this->Name;} + public function getDataType() { return $this->DataType;} + public function getDescription() { return $this->Description;} +} +?> \ No newline at end of file diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ParameterBagItem.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ParameterBagItem.class.php new file mode 100644 index 0000000..f98633c --- /dev/null +++ b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ParameterBagItem.class.php @@ -0,0 +1,20 @@ +Name; } + public function getValue() { return $this->Value; } + + public function setName($value) { $this->Name = $value; return $this; } + public function setValue($value) { $this->Value = $value; return $this; } +} \ No newline at end of file diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/PingResult.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/PingResult.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/PingResult.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/PingResult.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/PostTaxRequest.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/PostTaxRequest.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/PostTaxRequest.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/PostTaxRequest.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/PostTaxResult.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/PostTaxResult.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/PostTaxResult.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/PostTaxResult.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ReconcileTaxHistoryRequest.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ReconcileTaxHistoryRequest.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ReconcileTaxHistoryRequest.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ReconcileTaxHistoryRequest.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ReconcileTaxHistoryResult.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ReconcileTaxHistoryResult.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ReconcileTaxHistoryResult.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ReconcileTaxHistoryResult.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/SearchTaxHistoryResult.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/SearchTaxHistoryResult.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/SearchTaxHistoryResult.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/SearchTaxHistoryResult.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ServiceMode.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ServiceMode.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ServiceMode.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ServiceMode.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/SeverityLevel.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/SeverityLevel.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/SeverityLevel.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/SeverityLevel.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/TaxDetail.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/TaxDetail.class.php similarity index 80% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/TaxDetail.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/TaxDetail.class.php index 912d746..87fd200 100644 --- a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/TaxDetail.class.php +++ b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/TaxDetail.class.php @@ -43,6 +43,12 @@ class TaxDetail //Task# 25610 private $StateAssignedNo; + //Added on 14 Oct 2016 + private $TaxableUnits; //decimal //Added for 15.6.0.0 + private $NonTaxableUnits; //decimal //Added for 15.6.0.0 + private $ExemptUnits; //decimal //Added for 15.6.0.0 + private $UnitOfBasis; //string Changed for 15.6.0.0 + public function getStateAssignedNo() { return $this->StateAssignedNo; @@ -104,6 +110,10 @@ public function getTaxable() {return $this->Taxable; } public function getBase() {return $this->Base; } + public function getTaxableValue() {return $this->TaxableValue; } //Changed for 15.6.0.0 + public function getNonTaxableValue() {return $this->NonTaxableValue; } //Changed for 15.6.0.0 + public function getExemptValue() {return $this->ExemptValue; } //Changed for 15.6.0.0 + public function getUnitOfBasis() {return $this->UnitOfBasis; } //Changed for 15.6.0.0 /** * Gets the Rate amount. @@ -184,9 +194,13 @@ public function getTaxAuthorityType() {return $this->TaxAuthorityType; } public function getCountry(){ return $this->Country;} public function getRegion(){ return $this->Region;} public function getTaxCalculated(){ return $this->TaxCalculated;} - public function getTaxGroup(){ return $this->TaxGroup;} - - + + //Added for 15.6.0.0 + public function getTaxableUnits(){ return $this->TaxableUnits;} + public function getNonTaxableUnits(){ return $this->NonTaxableUnits;} + public function getExemptUnits(){ return $this->ExemptUnits;} + + public function getTaxGroup(){ return $this->TaxGroup;} } diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/TaxLine.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/TaxLine.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/TaxLine.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/TaxLine.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/TaxOverride.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/TaxOverride.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/TaxOverride.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/TaxOverride.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/TaxOverrideType.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/TaxOverrideType.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/TaxOverrideType.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/TaxOverrideType.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/TaxRequest.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/TaxRequest.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/TaxRequest.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/TaxRequest.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/TaxServiceSoap.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/TaxServiceSoap.class.php similarity index 74% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/TaxServiceSoap.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/TaxServiceSoap.class.php index 6436994..aa6aee6 100644 --- a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/TaxServiceSoap.class.php +++ b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/TaxServiceSoap.class.php @@ -18,7 +18,7 @@ * * * @author Avalara - * @copyright © 2004 - 2011 Avalara, Inc. All rights reserved. + * @copyright ďż˝ 2004 - 2011 Avalara, Inc. All rights reserved. * @package Tax */ @@ -34,40 +34,42 @@ class TaxServiceSoap extends AvalaraSoapClient 'IsAuthorizedResult' => 'IsAuthorizedResult', 'PingResult' => 'PingResult', 'ValidateResult' => 'ValidateResult', - 'Line'=>'Line', - 'AdjustTaxRequest'=>'AdjustTaxRequest', - 'AdjustTaxResult'=>'AdjustTaxResult', - 'CancelTaxRequest'=>'CancelTaxRequest', - 'CancelTaxResult'=>'CancelTaxResult', - 'CommitTaxRequest'=>'CommitTaxRequest', - 'CommitTaxResult'=>'CommitTaxResult', - 'GetTaxRequest'=>'GetTaxRequest', - 'GetTaxResult'=>'GetTaxResult', - 'GetTaxHistoryRequest'=>'GetTaxHistoryRequest', - 'GetTaxHistoryResult'=>'GetTaxHistoryResult', - 'PostTaxRequest'=>'PostTaxRequest', - 'PostTaxResult'=>'PostTaxResult', - 'ReconcileTaxHistoryRequest'=>'ReconcileTaxHistoryRequest', - 'ReconcileTaxHistoryResult'=>'ReconcileTaxHistoryResult', - 'TaxLine'=>'TaxLine', + 'Line'=>'Line', + 'AdjustTaxRequest'=>'AdjustTaxRequest', + 'AdjustTaxResult'=>'AdjustTaxResult', + 'CancelTaxRequest'=>'CancelTaxRequest', + 'CancelTaxResult'=>'CancelTaxResult', + 'CommitTaxRequest'=>'CommitTaxRequest', + 'CommitTaxResult'=>'CommitTaxResult', + 'GetTaxRequest'=>'GetTaxRequest', + 'GetTaxResult'=>'GetTaxResult', + 'GetTaxHistoryRequest'=>'GetTaxHistoryRequest', + 'GetTaxHistoryResult'=>'GetTaxHistoryResult', + 'PostTaxRequest'=>'PostTaxRequest', + 'PostTaxResult'=>'PostTaxResult', + 'ReconcileTaxHistoryRequest'=>'ReconcileTaxHistoryRequest', + 'ReconcileTaxHistoryResult'=>'ReconcileTaxHistoryResult', + 'TaxLine'=>'TaxLine', 'TaxDetail' => 'TaxDetail', - 'ApplyPaymentRequest'=>'ApplyPaymentRequest', - 'ApplyPaymentResult'=>'ApplyPaymentResult', - 'BaseResult'=>'BaseResult', - 'TaxOverride'=>'TaxOverride' - ); + 'ApplyPaymentRequest'=>'ApplyPaymentRequest', + 'ApplyPaymentResult'=>'ApplyPaymentResult', + 'GetParameterBagItemsRequest'=>'GetParameterBagItemsRequest', //Changed for 15.6.0.0 + 'GetParameterBagItemsResult'=>'GetParameterBagItemsResult', //Changed for 15.6.0.0 + 'BaseResult'=>'BaseResult', + 'TaxOverride'=>'TaxOverride' + ); -public function __construct($configurationName = 'Default') + public function __construct($configurationName = 'Default') { $config = new ATConfig($configurationName); - + $this->client = new DynamicSoapClient ( $config->taxWSDL, array ( - 'location' => $config->url.$config->taxService, - 'trace' => $config->trace, - 'classmap' => TaxServiceSoap::$classmap + 'location' => $config->url.$config->taxService, + 'trace' => $config->trace, + 'classmap' => TaxServiceSoap::$classmap ), $config ); @@ -86,8 +88,8 @@ public function __construct($configurationName = 'Default') */ public function getTax(&$getTaxRequest) { - $getTaxRequest->prepare(); - return $this->client->GetTax(array('GetTaxRequest' => $getTaxRequest))->GetTaxResult; + $getTaxRequest->prepare(); + return $this->client->GetTax(array('GetTaxRequest' => $getTaxRequest))->GetTaxResult; } /** @@ -106,12 +108,12 @@ public function getTax(&$getTaxRequest) * @throws SoapFault */ /*public com.avalara.avatax.services.tax.GetTaxHistoryResult getTaxHistory(com.avalara.avatax.services.tax.GetTaxHistoryRequest getTaxHistoryRequest) throws SoapFault; - */ - public function getTaxHistory(&$getTaxHistoryRequest) + */ + public function getTaxHistory(&$getTaxHistoryRequest) { - $result = $this->client->GetTaxHistory(array('GetTaxHistoryRequest'=>$getTaxHistoryRequest))->GetTaxHistoryResult; - $result->getGetTaxRequest()->postFetch(); - return $result; + $result = $this->client->GetTaxHistory(array('GetTaxHistoryRequest'=>$getTaxHistoryRequest))->GetTaxHistoryResult; + $result->getGetTaxRequest()->postFetch(); + return $result; } /** @@ -129,12 +131,12 @@ public function getTaxHistory(&$getTaxHistoryRequest) * @return a {@link PostTaxResult} object * @throws SoapFault */ - + /*public com.avalara.avatax.services.tax.PostTaxResult postTax(com.avalara.avatax.services.tax.PostTaxRequest postTaxRequest) throws SoapFault; - */ + */ public function postTax(&$postTaxRequest) - { - return $this->client->PostTax(array('PostTaxRequest'=>$postTaxRequest))->PostTaxResult; + { + return $this->client->PostTax(array('PostTaxRequest'=>$postTaxRequest))->PostTaxResult; } /** @@ -153,13 +155,14 @@ public function postTax(&$postTaxRequest) * @return a {@link CommitTaxResult} object * @throws SoapFault */ - + /*public com.avalara.avatax.services.tax.CommitTaxResult commitTax(com.avalara.avatax.services.tax.CommitTaxRequest commitTaxRequest) throws SoapFault; - */ - public function commitTax(&$commitTaxRequest) + */ + public function commitTax(&$commitTaxRequest) { - return $this->client->CommitTax(array('CommitTaxRequest'=>$commitTaxRequest))->CommitTaxResult; + return $this->client->CommitTax(array('CommitTaxRequest'=>$commitTaxRequest))->CommitTaxResult; } + /** * Cancels a previously calculated tax; This is for use as a * compensating action when posting on the client fails to complete. @@ -182,10 +185,10 @@ public function commitTax(&$commitTaxRequest) * @throws SoapFault */ /* public com.avalara.avatax.services.tax.CancelTaxResult cancelTax(com.avalara.avatax.services.tax.CancelTaxRequest cancelTaxRequest) throws SoapFault; - */ - public function cancelTax(&$cancelTaxRequest) + */ + public function cancelTax(&$cancelTaxRequest) { - return $this->client->CancelTax(array('CancelTaxRequest'=>$cancelTaxRequest))->CancelTaxResult; + return $this->client->CancelTax(array('CancelTaxRequest'=>$cancelTaxRequest))->CancelTaxResult; } /** @@ -219,9 +222,9 @@ public function cancelTax(&$cancelTaxRequest) */ /*public com.avalara.avatax.services.tax.ReconcileTaxHistoryResult reconcileTaxHistory(com.avalara.avatax.services.tax.ReconcileTaxHistoryRequest reconcileTaxHistoryRequest) throws SoapFault; */ - public function reconcileTaxHistory(&$reconcileTaxHistoryRequest) + public function reconcileTaxHistory(&$reconcileTaxHistoryRequest) { - return $this->client->ReconcileTaxHistory(array('ReconcileTaxHistoryRequest'=>$reconcileTaxHistoryRequest))->ReconcileTaxHistoryResult; + return $this->client->ReconcileTaxHistory(array('ReconcileTaxHistoryRequest'=>$reconcileTaxHistoryRequest))->ReconcileTaxHistoryResult; } /** @@ -235,13 +238,13 @@ public function reconcileTaxHistory(&$reconcileTaxHistoryRequest) * @return a {@link AdjustTaxResult} object * @throws SoapFault */ - + /*public com.avalara.avatax.services.tax.CommitTaxResult commitTax(com.avalara.avatax.services.tax.CommitTaxRequest commitTaxRequest) throws SoapFault; - */ - public function adjustTax(&$adjustTaxRequest) + */ + public function adjustTax(&$adjustTaxRequest) { - $adjustTaxRequest->getGetTaxRequest()->prepare(); - return $this->client->AdjustTax(array('AdjustTaxRequest'=>$adjustTaxRequest))->AdjustTaxResult; + $adjustTaxRequest->getGetTaxRequest()->prepare(); + return $this->client->AdjustTax(array('AdjustTaxRequest'=>$adjustTaxRequest))->AdjustTaxResult; } /** * Checks authentication of and authorization to one or more @@ -261,7 +264,7 @@ public function adjustTax(&$adjustTaxRequest) * @return IsAuthorizedResult * @throws SoapFault */ - + public function isAuthorized($operations) { @@ -287,17 +290,27 @@ public function ping($message = '') /** * This method is used to apply a payment to a document for cash basis accounting. Applies a payment date to an existing invoice - * It sets the document PaymentDate and changes the reporting date from the DocDate default. It may be called before or after a document is committed. It should not be used for accrual basis accounting + * It sets the document PaymentDate and changes the reporting date from the DocDate default. It may be called before or after a document is committed. It should not be used for accrual basis accounting * * @param ApplyPaymentRequest $applyPaymentRequest * @return ApplyPaymentResult */ public function applyPayment(&$applyPaymentRequest) - { - return $this->client->ApplyPayment(array('ApplyPaymentRequest' => $applyPaymentRequest))->ApplyPaymentResult; - } + { + return $this->client->ApplyPayment(array('ApplyPaymentRequest' => $applyPaymentRequest))->ApplyPaymentResult; + } -} + //Added for Changed for 15.6.0.0 + public function getParameterBagItems(&$getParameterBagItemsRequest) + { + return $this->client->GetParameterBagItems(array('GetParameterBagItemsRequest' => $getParameterBagItemsRequest))->GetParameterBagItemsResult; + } -?> + //Added for Changed for 15.6.0.0 + public function getAllParameterBagItems() + { + return $this->client->GetAllParameterBagItems()->GetAllParameterBagItemsResult; + } +} +?> \ No newline at end of file diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/TaxType.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/TaxType.class.php similarity index 53% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/TaxType.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/TaxType.class.php index 6f0ab7e..8008b01 100644 --- a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/TaxType.class.php +++ b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/TaxType.class.php @@ -22,6 +22,18 @@ class TaxType// extends Enum public static $Fee = 'Fee'; public static $Rental = 'Rental'; public static $Excise ='Excise'; + public static $LodgingTax ='LodgingTax'; //Added for 15.6.0.0 + public static $Hospitality ='Hospitality'; //Added for 15.6.0.0 + public static $Preservation ='Preservation'; //Added for 15.6.0.0 + public static $TransientRoom ='TransientRoom'; //Added for 15.6.0.0 + public static $Hotel ='Hotel'; //Added for 15.6.0.0 + public static $CountyAccommodations ='CountyAccommodations'; //Added for 15.6.0.0 + public static $Accommodations ='Accommodations'; //Added for 15.6.0.0 + public static $StateAccommodations ='StateAccommodations'; //Added for 15.6.0.0 + public static $Tourism ='Tourism'; //Added for 15.6.0.0 + public static $ConventionCenter ='ConventionCenter'; //Added for 15.6.0.0 + //public static $LodgingFee ='LodgingFee'; //Removed from Taxsvc2 + /* public static function Values() { diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/TextCase.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/TextCase.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/TextCase.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/TextCase.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ValidAddress.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ValidAddress.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ValidAddress.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ValidAddress.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ValidateRequest.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ValidateRequest.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ValidateRequest.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ValidateRequest.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ValidateResult.class.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ValidateResult.class.php similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ValidateResult.class.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/ValidateResult.class.php diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/wsdl/Account.wsdl b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/wsdl/Account.wsdl similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/wsdl/Account.wsdl rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/wsdl/Account.wsdl diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/wsdl/Address.wsdl b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/wsdl/Address.wsdl similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/wsdl/Address.wsdl rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/wsdl/Address.wsdl diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/wsdl/AvaCert2Svc.wsdl b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/wsdl/AvaCert2Svc.wsdl similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/wsdl/AvaCert2Svc.wsdl rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/wsdl/AvaCert2Svc.wsdl diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/wsdl/AvaCertSvc.wsdl b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/wsdl/AvaCertSvc.wsdl similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/wsdl/AvaCertSvc.wsdl rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/wsdl/AvaCertSvc.wsdl diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/wsdl/BatchSvc.wsdl b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/wsdl/BatchSvc.wsdl similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/wsdl/BatchSvc.wsdl rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/wsdl/BatchSvc.wsdl diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/wsdl/Tax.wsdl b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/wsdl/Tax.wsdl similarity index 82% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/wsdl/Tax.wsdl rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/wsdl/Tax.wsdl index 25287ff..a42a1af 100644 --- a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/wsdl/Tax.wsdl +++ b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/classes/wsdl/Tax.wsdl @@ -24,6 +24,7 @@ + @@ -39,8 +40,27 @@ + + + + + + + + + + + + + + + + + + + @@ -55,6 +75,25 @@ + + + + + + + + + + + + + + + + + + + @@ -88,6 +127,7 @@ + @@ -97,8 +137,10 @@ - + + + @@ -109,6 +151,17 @@ + + + + + + + + + + + @@ -169,6 +222,7 @@ + @@ -212,6 +266,7 @@ + @@ -232,12 +287,12 @@ + - @@ -272,6 +327,10 @@ + + + + @@ -295,6 +354,16 @@ + + + + + + + + + + @@ -321,8 +390,8 @@ - + @@ -643,7 +712,6 @@ - @@ -653,9 +721,9 @@ - + @@ -680,6 +748,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -790,7 +923,25 @@ - + + + + + + + + + + + + + + + + + + + Calculates taxes on a document @@ -846,8 +997,18 @@ + + Retrieves all parameter bag items of provided category or entire set + + + + + Retrieves parameter bag items of provided category or entire set + + + - + @@ -962,8 +1123,28 @@ + + + + + + + + + + + + + + + + + + + + - + @@ -1078,13 +1259,33 @@ + + + + + + + + + + + + + + + + + + + + - - + + - - + + \ No newline at end of file diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/get_tax_history.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/get_tax_history.php new file mode 100644 index 0000000..9c6ce7e --- /dev/null +++ b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/get_tax_history.php @@ -0,0 +1,104 @@ +format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); + + new ATConfig($order_data["environment"], array('url'=>$order_data["service_url"], 'account'=>$order_data["account"],'license'=>$order_data["license"],'client'=>$order_data["client"], 'trace'=> TRUE)); + + $client = new TaxServiceSoap($order_data["environment"]); + $request = new GetTaxHistoryRequest(); + + $request->setCompanyCode($order_data["CompanyCode"]); + $request->setDocType($order_data["DocType"]); + $request->setDocCode($order_data["DocCode"]); + + //$returnMessage = ""; + $GetTaxHistoryReturnValue = array(); + + // Get Tax History and Results + try + { + $connectorcalling=$timeStamp->format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); + $result = $client->getTaxHistory($request); + $connectorcomplete=$timeStamp->format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); + // Creating the System Logger Object + $application_log = new SystemLogger; + $connectorend=$timeStamp->format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); + $performance_metrics[] = array("CallerTimeStamp","MessageString","CallerAcctNum","DocCode","Operation","ServiceURL","LogType","LogLevel","ERPName","ERPVersion","ConnectorVersion"); + $performance_metrics[] = array($connectorstart,"PreGetTaxHistory Start Time-\"".$connectorstart,$order_data["account"],$order_data["DocCode"],"TaxHistory",$order_data["service_url"],"Performance","Informational","CS-Cart",PRODUCT_VERSION,AVALARA_VERSION); + $performance_metrics[] = array($connectorcalling,"PreGetTaxHistory End Time-\"".$connectorcalling,$order_data["account"],$order_data["DocCode"],"TaxHistory",$order_data["service_url"],"Performance","Informational","CS-Cart",PRODUCT_VERSION,AVALARA_VERSION); + $performance_metrics[] = array($connectorcomplete,"PostGetTaxHistory Start Time-\"".$connectorcomplete,$order_data["account"],$order_data["DocCode"],"TaxHistory",$order_data["service_url"],"Performance","Informational","CS-Cart",PRODUCT_VERSION,AVALARA_VERSION); + $performance_metrics[] = array($connectorend,"PostGetTaxHistory End Time-\"".$connectorend,$order_data["account"],$order_data["DocCode"],"TaxHistory",$order_data["service_url"],"Performance","Informational","CS-Cart",PRODUCT_VERSION,AVALARA_VERSION); + //Call serviceLog function + $returnServiceLog = $application_log->serviceLog($performance_metrics); + + /*** + * Place holder for logs + * getLastRequest + * getLastResponse + */ + + /************* Logging code snippet (optional) starts here *******************/ + // System Logger starts here: + + + if($log_mode == 1){ + + $timeStamp = new DateTime(); // Create Time Stamp + $params = '[Input: ' . ']'; // Create Param List + $u_name = ''; // Eventually will come from $_SESSION[] object + + + $application_log->AddSystemLog($timeStamp->format('Y-m-d H:i:s'), __FUNCTION__, __CLASS__, __METHOD__, __FILE__, $u_name, $params, $client->__getLastRequest()); // Create System Log + $application_log->WriteSystemLogToFile(); // Log info goes to log file + + $application_log->AddSystemLog($timeStamp->format('Y-m-d H:i:s'), __FUNCTION__, __CLASS__, __METHOD__, __FILE__, $u_name, $params, $client->__getLastResponse()); // Create System Log + $application_log->WriteSystemLogToFile(); // Log info goes to log file + + // $application_log->WriteSystemLogToDB(); // Log info goes to DB + // System Logger ends here + // Logging code snippet (optional) ends here + } + + // Success - Display GetTaxResults to console + if ($result->getResultCode() != SeverityLevel::$Success) { + foreach ($result->getMessages() as $msg) { + $returnMessage .= $msg->getName() . ": " . $msg->getSummary() . "\n"; + } + return "Error :".$returnMessage; + } + else + { + $GetTaxHistoryReturnValue["DocDate"] = $result->getGetTaxResult()->getDocDate(); + $GetTaxHistoryReturnValue["TaxDate"] = $result->getGetTaxResult()->getTaxDate(); + $GetTaxHistoryReturnValue["DocCode"] = $result->getGetTaxResult()->getDocCode(); + //return $GetTaxHistoryReturnValue; + } + // If NOT success - display error or warning messages to console + // it is important to itterate through the entire message class + } + catch (SoapFault $exception) + { + $msg = "Exception: "; + if ($exception) + $msg .= $exception->faultstring; + + // If you desire to retrieve SOAP IN / OUT XML + // - Follow directions below + // - if not, leave as is + // } //UN-comment this line to return SOAP XML + $returnMessage .= $msg . "\n"; + $returnMessage .= $client->__getLastRequest() . "\n"; + $returnMessage .= $client->__getLastResponse() . "\n"; + return $returnMessage; + + //echo $client->__getLastRequest() . "\n"; + //echo $client->__getLastResponse() . "\n"; + } //Comment this line to return SOAP XML +//} +?> \ No newline at end of file diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/post_tax.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/post_tax.php similarity index 97% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/post_tax.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/post_tax.php index af54a33..38aa2cf 100644 --- a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/post_tax.php +++ b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/post_tax.php @@ -3,7 +3,6 @@ //{ //require_once('AvaTax.php'); include_once($lib_path."AvaTax4PHP/AvaTax.php"); - spl_autoload_register(__autoload); include_once $addon_path."SystemLogger.php"; $timeStamp = new DateTime(); // Create Time Stamp $connectorstart=$timeStamp->format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/tpa.php b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/tpa.php similarity index 51% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/tpa.php rename to Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/tpa.php index 2081b81..5153dd5 100644 --- a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/tpa.php +++ b/Avalara AvaTax for CS Cart version 00.00.11.00/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/tpa.php @@ -1,17 +1,17 @@ "; $xml.= " - + ".$_REQUEST['acc']." ".$_REQUEST['license']." ".$_REQUEST['username']." @@ -20,36 +20,36 @@ ".$_REQUEST['companyCode'].""; //Fetch Company details -$companyQuery="SELECT distinct company,address,city,state,country,zipcode,email,phone from ".$tablePrefix."companies LIMIT 0,1"; +$companyQuery = "SELECT distinct company,address,city,state,country,zipcode,email,phone from ".$tablePrefix."companies LIMIT 0,1"; -$companyRes=mysqli_query($con,$companyQuery); +$companyRes = mysqli_query($con,$companyQuery); -while($companyData=mysqli_fetch_array($companyRes)) +while($companyData = mysqli_fetch_array($companyRes)) { - $companyName=$companyData['company']; - $companyAddress=$companyData['address']; - $companyCity=$companyData['city']; - $companyState=$companyData['state']; - $companyCountry=$companyData['country']; - $companyZip=$companyData['zipcode']; - $companyEmail=$companyData['email']; - $companyPhone=$companyData['phone']; + $companyName = $companyData['company']; + $companyAddress = $companyData['address']; + $companyCity = $companyData['city']; + $companyState = $companyData['state']; + $companyCountry = $companyData['country']; + $companyZip = $companyData['zipcode']; + $companyEmail = $companyData['email']; + $companyPhone = $companyData['phone']; - $xml.=" - CSCart - - + $xml.=" + CSCart + + ".$companyName." TinAva BinAva

- ".$companyAddress." + ".$companyAddress." ".$companyState." ".$companyZip." ".$companyCity." ".$companyState." ".$companyCountry." - ".$companyZip." + ".$companyZip."
".$companyEmail." @@ -63,72 +63,69 @@ } $xml.=" - + ".$companyCountry." ".$companyState." - + - - ".$companyCountry." - ".$companyState." - - - "; + + ".$companyCountry." + ".$companyState." + + + "; //Fetch all order count to calculate average -$orderAvgQuery="SELECT count(order_id) as 'Count' FROM ".$tablePrefix."orders"; -$orderAvgQueryRes=mysqli_query($con,$orderAvgQuery); -$orderAvgQueryData=mysqli_fetch_array($orderAvgQueryRes,MYSQLI_ASSOC); - $orderAvgQueryRows=$orderAvgQueryData['Count']; - +$orderAvgQuery = "SELECT count(order_id) as 'Count' FROM ".$tablePrefix."orders"; +$orderAvgQueryRes = mysqli_query($con,$orderAvgQuery); +$orderAvgQueryData = mysqli_fetch_array($orderAvgQueryRes,MYSQLI_ASSOC); +$orderAvgQueryRows = $orderAvgQueryData['Count']; //Fetch all order delivery information of unique addresses - $today=date("Y-m-d"); - $oneYearBack=date("Y-m-d",strtotime("$today -1 year")); - $addressQuery="SELECT s_country,s_state FROM ".$tablePrefix."orders where from_unixtime(`timestamp`) BETWEEN '".$oneYearBack."' and NOW() GROUP BY s_state order by order_id desc LIMIT 0,1000"; +$today = date("Y-m-d"); +$oneYearBack = date("Y-m-d",strtotime("$today -1 year")); +$addressQuery = "SELECT s_country,s_state FROM ".$tablePrefix."orders where from_unixtime(`timestamp`) BETWEEN '".$oneYearBack."' and NOW() GROUP BY s_state order by order_id desc LIMIT 0,1000"; -$addressRes=mysqli_query($con,$addressQuery); -while($addressData=mysqli_fetch_array($addressRes,MYSQLI_ASSOC)) +$addressRes = mysqli_query($con,$addressQuery); +while($addressData = mysqli_fetch_array($addressRes,MYSQLI_ASSOC)) { - //To check tax has been calculated for how may invoices for selected state and country - $invoicesChargedQry = "SELECT COUNT(*) AS 'Count' FROM ".$tablePrefix."orders where from_unixtime(`timestamp`) BETWEEN '".$oneYearBack."' and NOW() and s_state='".$addressData["s_state"]."' and s_country='".$addressData["s_country"]."' and avatax_paytax_document_code <>'' order by order_id desc LIMIT 0,1000"; - $invoicesChargedRes = mysqli_query($con,$invoicesChargedQry); - $invoicesChargedData = mysqli_fetch_array($invoicesChargedRes,MYSQL_ASSOC); - $invoicesChargedCount = $invoicesChargedData['Count']; + //To check tax has been calculated for how may invoices for selected state and country + $invoicesChargedQry = "SELECT COUNT(*) AS 'Count' FROM ".$tablePrefix."orders where from_unixtime(`timestamp`) BETWEEN '".$oneYearBack."' and NOW() and s_state='".$addressData["s_state"]."' and s_country='".$addressData["s_country"]."' and avatax_paytax_document_code <>'' order by order_id desc LIMIT 0,1000"; + $invoicesChargedRes = mysqli_query($con,$invoicesChargedQry); + $invoicesChargedData = mysqli_fetch_array($invoicesChargedRes,MYSQL_ASSOC); + $invoicesChargedCount = $invoicesChargedData['Count']; - $totalInvoicesQry = "SELECT COUNT(*) AS 'Count' FROM ".$tablePrefix."orders where from_unixtime(`timestamp`) BETWEEN '".$oneYearBack."' and NOW() and s_state='".$addressData['s_state']."' and s_country='".$addressData['s_country']."' LIMIT 0,1000"; - $totalInvoicesRes = mysqli_query($con,$totalInvoicesQry); - $totalInvoicesData = mysqli_fetch_array($totalInvoicesRes,MYSQL_ASSOC); - + $totalInvoicesQry = "SELECT COUNT(*) AS 'Count' FROM ".$tablePrefix."orders where from_unixtime(`timestamp`) BETWEEN '".$oneYearBack."' and NOW() and s_state='".$addressData['s_state']."' and s_country='".$addressData['s_country']."' LIMIT 0,1000"; + $totalInvoicesRes = mysqli_query($con,$totalInvoicesQry); + $totalInvoicesData = mysqli_fetch_array($totalInvoicesRes,MYSQL_ASSOC); - $totalInvoicesCount = $totalInvoicesData["Count"]; + $totalInvoicesCount = $totalInvoicesData["Count"]; - //To calculate avergae of tax calculated invoices - $avgCount = ($invoicesChargedCount * 100) / $totalInvoicesCount; - - + //To calculate avergae of tax calculated invoices + $avgCount = ($invoicesChargedCount * 100) / $totalInvoicesCount; + $xml.=" - ".trim($addressData['s_country'])." - ".trim($addressData['s_state'])." - ".round($avgCount,0)." - ".$totalInvoicesCount." - "; + ".trim($addressData['s_country'])." + ".trim($addressData['s_state'])." + ".round($avgCount,0)." + ".$totalInvoicesCount." + "; } $xml.=""; //Check Tax exempt user count -$exemptCustQry="SELECT tax_exempt, COUNT(*) as 'Count' FROM ".$tablePrefix."users where user_type='C' GROUP BY tax_exempt"; -$exemptCustRes=mysqli_query($con,$exemptCustQry); -$totalCustCnt=0; -$exemptCustCnt=0; +$exemptCustQry = "SELECT tax_exempt, COUNT(*) as 'Count' FROM ".$tablePrefix."users where user_type='C' GROUP BY tax_exempt"; +$exemptCustRes = mysqli_query($con,$exemptCustQry); +$totalCustCnt = 0; +$exemptCustCnt = 0; while($exemptCustData=mysqli_fetch_array($exemptCustRes,MYSQLI_ASSOC)) { - if($exemptCustData['tax_exempt']=='Y') - $exemptCustCnt=$exemptCustData['Count']; - - $totalCustCnt=$totalCustCnt+$exemptCustData['Count']; + if($exemptCustData['tax_exempt']=='Y') + $exemptCustCnt=$exemptCustData['Count']; + + $totalCustCnt=$totalCustCnt+$exemptCustData['Count']; } $xml.=" @@ -138,7 +135,7 @@ true - + ".$totalCustCnt." ".$exemptCustCnt." "; @@ -146,15 +143,15 @@ //Check Tax exempt user details if($exemptCustCnt>0) { - $exemptCustQry="SELECT firstname,lastname,user_id FROM ".$tablePrefix."users where user_type='C' and tax_exempt='Y'"; - $exemptCustRes=mysqli_query($con,$exemptCustQry); - while($exemptCustData=mysqli_fetch_array($exemptCustRes,MYSQLI_ASSOC)) - { + $exemptCustQry="SELECT firstname,lastname,user_id FROM ".$tablePrefix."users where user_type='C' and tax_exempt='Y'"; + $exemptCustRes=mysqli_query($con,$exemptCustQry); + while($exemptCustData=mysqli_fetch_array($exemptCustRes,MYSQLI_ASSOC)) + { $xml.=" Enabled ".$exemptCustData['user_id']." "; - } + } } else { @@ -164,15 +161,15 @@ "; } //check for products -$productQry="select ".$tablePrefix."products.product_code,".$tablePrefix."product_descriptions.product FROM ".$tablePrefix."products inner join ".$tablePrefix."product_descriptions on ".$tablePrefix."products.product_id=".$tablePrefix."product_descriptions.product_id"; -$prodRes=mysqli_query($con,$productQry); -$totalProdCnt=0; -$productArr=array(); +$productQry = "select ".$tablePrefix."products.product_code,".$tablePrefix."product_descriptions.product FROM ".$tablePrefix."products inner join ".$tablePrefix."product_descriptions on ".$tablePrefix."products.product_id=".$tablePrefix."product_descriptions.product_id"; +$prodRes = mysqli_query($con,$productQry); +$totalProdCnt = 0; +$productArr = array(); while($productData=mysqli_fetch_array($prodRes,MYSQLI_ASSOC)) { $productArr[]=$productData; } - $totalProdCnt=count($productArr); +$totalProdCnt=count($productArr); //check for non taxable items $ntProductQry="select ".$tablePrefix."products.product_code,".$tablePrefix."product_descriptions.product FROM ".$tablePrefix."products inner join ".$tablePrefix."product_descriptions on ".$tablePrefix."products.product_id=".$tablePrefix."product_descriptions.product_id where ".$tablePrefix."products.tax_code='NT'"; @@ -185,29 +182,28 @@ } $totalNTProdCnt=count($ntproductArr); - $xml.=" ".$totalProdCnt." - "; + "; if($totalProdCnt>0) { for($cnt=0;$cnt<$totalProdCnt;$cnt++) { $xml .=" - ".trim(htmlentities($productArr[$cnt]['product']))." - ".trim(htmlentities($productArr[$cnt]['product_code']))." + ".trim(htmlentities($productArr[$cnt]['product']))." + ".trim(htmlentities($productArr[$cnt]['product_code']))." "; } }else{ - $xml .=" - - - "; + $xml .=" + + + "; } - $xml .=" + $xml .=" ".$totalNTProdCnt." ".$totalNTProdCnt." @@ -216,13 +212,13 @@ for($ntcnt=0;$ntcnt<$totalNTProdCnt;$ntcnt++) { $xml .=" - ".trim(htmlentities($ntproductArr[$ntcnt]['product']))." - ".trim(htmlentities($ntproductArr[$ntcnt]['product_code']))." + ".trim(htmlentities($ntproductArr[$ntcnt]['product']))." + ".trim(htmlentities($ntproductArr[$ntcnt]['product_code']))." "; } } else{ - $xml .=" + $xml .=" "; @@ -238,7 +234,7 @@ - + @@ -264,20 +260,17 @@ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $output = curl_exec($ch); - - if(curl_errno($ch)) { - echo "In error"; + echo "In error"; print curl_error($ch); - curl_close($ch); + curl_close($ch); } else { - curl_close($ch); - - echo json_encode($output); - //echo ""; - //echo "In success"; + curl_close($ch); + echo json_encode($output); + //echo ""; + //echo "In success"; } ?> \ No newline at end of file diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/controllers/backend/avatax_tax_calculation.php b/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/controllers/backend/avatax_tax_calculation.php deleted file mode 100644 index fa94757..0000000 --- a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/controllers/backend/avatax_tax_calculation.php +++ /dev/null @@ -1,98 +0,0 @@ -format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); - $performance_metrics[] = array("CallerTimeStamp","MessageString","CallerAcctNum","DocCode","Operation","ServiceURL","LogType","LogLevel","ERPName","ERPVersion","ConnectorVersion"); - $performance_metrics[] = array($connectorstart,$msgString,$account,"","Connector Configuration",$serviceurl,"Performance","Informational","CS-Cart",PRODUCT_VERSION,AVALARA_VERSION); - - //Call serviceLog function - $returnServiceLog = $config_log->serviceLog($performance_metrics); - //$config_log->writeConfigLog($account,$license,$serviceurl,$companyCode,$environment,$client,$isAvataxEnabled,$isUPCOption,$isSaveTransaction,$isLogEnabled,$isAddressValidation); - exit; - -} -if ($mode == 'create_account') { - - $lib_path = Registry::get('config.dir.addons') . 'avatax_tax_calculation/lib/'; - $addon_path = Registry::get('config.dir.addons') . 'avatax_tax_calculation'; - $log_mode = Registry::get('addons.avatax_tax_calculation.avatax_log_mode'); - include_once($lib_path."AvaTax4PHP/avatax_create_account.php"); - exit; -} -if ($mode == 'tpa') { - - $lib_path = Registry::get('config.dir.addons') . 'avatax_tax_calculation/lib/'; - $addon_path = Registry::get('config.dir.addons') . 'avatax_tax_calculation'; - $log_mode = Registry::get('addons.avatax_tax_calculation.avatax_log_mode'); - include_once($lib_path."AvaTax4PHP/tpa.php"); - exit; -} -if ($mode == 'validate_account') { - - $lib_path = Registry::get('config.dir.addons') . 'avatax_tax_calculation/lib/'; - $addon_path = Registry::get('config.dir.addons') . 'avatax_tax_calculation'; - $log_mode = Registry::get('addons.avatax_tax_calculation.avatax_log_mode'); - include_once($lib_path."AvaTax4PHP/avatax_validate_account.php"); - exit; -} diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/avatax_accounts.php b/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/avatax_accounts.php deleted file mode 100644 index 5af90ba..0000000 --- a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/avatax_accounts.php +++ /dev/null @@ -1,89 +0,0 @@ -$development_url, 'account'=>$account,'license'=>$license,'client'=>$client, 'trace'=> TRUE)); - - $client = new AccountServiceSoap($environment); - - $return_message = ""; - - try - { - $result = $client->CompanyFetch(""); - $response= array(); - - if($result->getResultCode() != SeverityLevel::$Success) - { - $return_message .= "Error - AvaTax Account Service Message\n"; - - foreach($result->getMessages() as $msg) - { - //$return_message .= $msg->getName().": ".$msg->getSummary()."
"; - $return_message .= $msg->getSummary(); - } - $response["msg"]=$return_message; - $response["address"]=""; - } - else if($result->getResultCode() == SeverityLevel::$Success && $result->getValidCompanies() != "") - { - $arr=array(); - $validCompanies=array(); - $validCompanies=$result->getValidCompanies(); - foreach ($validCompanies as $obj) { - $arr[$obj->CompanyCode] = $obj->CompanyName; - } - $return_message .= json_encode($arr); - } - echo($return_message); - - if($log == 1) - { - require_once('classes/SystemLogger.class.php'); - $timeStamp = new DateTime(); // Create Time Stamp - $params = '[Input: ' . ']'; // Create Param List - $u_name = ''; // Eventually will come from $_SESSION[] object - - // Creating the System Logger Object - $application_log = new SystemLogger; - - $application_log->AddSystemLog($timeStamp->format('Y-m-d H:i:s'), __FUNCTION__, __CLASS__, __METHOD__, __FILE__, $u_name, $params, $client->__getLastRequest()); // Create System Log - $application_log->WriteSystemLogToFile(); // Log info goes to log file - - $application_log->AddSystemLog($timeStamp->format('Y-m-d H:i:s'), __FUNCTION__, __CLASS__, __METHOD__, __FILE__, $u_name, $params, $client->__getLastResponse()); // Create System Log - $application_log->WriteSystemLogToFile(); // Log info goes to log file - } - - //return json_encode($response); - } - catch(SoapFault $exception) - { - $return_message .= "Exception: "; - if($exception) - $return_message .= $exception->faultstring; - $return_message .= $client->__getLastRequest() . "
"; - $return_message .= $client->__getLastResponse() . "
"; - - //return $return_message; - print_r($return_message); - } -} - -if(isset($_POST["from"]) && $_POST["from"]=="AvaTaxFetchCompanies"){ - - - AccountValidation(); -} -?> \ No newline at end of file diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/cancel_tax.php b/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/cancel_tax.php deleted file mode 100644 index 35ba72d..0000000 --- a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/cancel_tax.php +++ /dev/null @@ -1,112 +0,0 @@ -format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); - - - new ATConfig($order_data["environment"], array('url'=>$order_data["service_url"], 'account'=>$order_data["account"],'license'=>$order_data["license"],'client'=>$order_data["client"], 'trace'=> TRUE)); - - $client = new TaxServiceSoap($order_data["environment"]); - $request = new CancelTaxRequest(); - - $request->setCompanyCode($order_data["CompanyCode"]); - $request->setDocType($order_data["DocType"]); - $request->setDocCode($order_data["DocCode"]); - if($order_data["CancelCode"]=="Docvoided") - { - $order_data["CancelCode"]="DocVoided"; - } - $request->setCancelCode($order_data["CancelCode"]); - - $CancelTaxReturnValue = array(); - - // PostTax and Results - try - { - $connectorcalling=$timeStamp->format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); - $result = $client->cancelTax($request); - $connectorcomplete=$timeStamp->format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); - - // Creating the System Logger Object - $application_log = new SystemLogger; - $connectorend=$timeStamp->format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); - $performance_metrics[] = array("CallerTimeStamp","MessageString","CallerAcctNum","DocCode","Operation","ServiceURL","LogType","LogLevel","ERPName","ERPVersion","ConnectorVersion"); - $performance_metrics[] = array($connectorstart,"PreCancelTax Start Time-\"".$connectorstart,$order_data["account"],$order_data["DocCode"],"CancelTax",$order_data["service_url"],"Performance","Informational","CS-Cart",PRODUCT_VERSION,AVALARA_VERSION); - $performance_metrics[] = array($connectorcalling,"PreCancelTax End Time-\"".$connectorcalling,$order_data["account"],$order_data["DocCode"],"CancelTax",$order_data["service_url"],"Performance","Informational","CS-Cart",PRODUCT_VERSION,AVALARA_VERSION); - $performance_metrics[] = array($connectorcomplete,"PostCancelTax Start Time-\"".$connectorcomplete,$order_data["account"],$order_data["DocCode"],"CancelTax",$order_data["service_url"],"Performance","Informational","CS-Cart",PRODUCT_VERSION,AVALARA_VERSION); - $performance_metrics[] = array($connectorend,"PostCancelTax End Time-\"".$connectorend,$order_data["account"],$order_data["DocCode"],"CancelTax",$order_data["service_url"],"Performance","Informational","CS-Cart",PRODUCT_VERSION,AVALARA_VERSION); - //Call serviceLog function - $returnServiceLog = $application_log->serviceLog($performance_metrics); - - - - /************* Logging code snippet (optional) starts here *******************/ - // System Logger starts here: - - if($log_mode==1){ - $params = '[Input: ' . ']'; // Create Param List - $u_name = ''; // Eventually will come from $_SESSION[] object - $application_log->AddSystemLog($timeStamp->format('Y-m-d H:i:s'), __FUNCTION__, __CLASS__, __METHOD__, __FILE__, $u_name, $params, $client->__getLastRequest()); // Create System Log - $application_log->WriteSystemLogToFile(); // Log info goes to log file - - $application_log->AddSystemLog($timeStamp->format('Y-m-d H:i:s'), __FUNCTION__, __CLASS__, __METHOD__, __FILE__, $u_name, $params, $client->__getLastResponse()); // Create System Log - $application_log->WriteSystemLogToFile(); // Log info goes to log file - - // $application_log->WriteSystemLogToDB(); // Log info goes to DB - // System Logger ends here - // Logging code snippet (optional) ends here - } - else{} - - /*** - * Place holder for logs - * getLastRequest - * getLastResponse - */ - - // Success - Display GetTaxResults to console - if ($result->getResultCode() != SeverityLevel::$Success) { - if($result->getResultCode() == SeverityLevel::$Error){ - - $return_message = "AvaTax - Error Message
"; - foreach($result->getMessages() as $msg) - { - //$return_message .= $msg->getName().": ".$msg->getSummary()."
"; - $return_message .= $msg->getSummary()."
"; - } - $avatax_tax_error = '
' . $return_message . '
'; - fn_set_notification('E', __('error'), $avatax_tax_error); - $returnMessage = SeverityLevel::$Error; - } - - } - else - { - $returnMessage = $result->getResultCode(); - } - // If NOT success - display error or warning messages to console - // it is important to itterate through the entire message class - } - catch (SoapFault $exception) - { - $msg = "Exception: "; - if ($exception) - $msg .= $exception->faultstring; - $return_message = "AvaTax - Error Message
"; - $return_message .= $msg; - $avatax_tax_error = '
' . $return_message . '
'; - fn_set_notification('E', __('error'), $avatax_tax_error); - - // If you desire to retrieve SOAP IN / OUT XML - // - Follow directions below - // - if not, leave as is - // } //UN-comment this line to return SOAP XML - $returnMessage = SeverityLevel::$Error; - - //echo $client->__getLastRequest() . "\n"; - //echo $client->__getLastResponse() . "\n"; - } //Comment this line to return SOAP XML -//} -?> \ No newline at end of file diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/get_tax_history.php b/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/get_tax_history.php deleted file mode 100644 index 6a64adb..0000000 --- a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/app/addons/avatax_tax_calculation/lib/AvaTax4PHP/get_tax_history.php +++ /dev/null @@ -1,108 +0,0 @@ -format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); - - new ATConfig($order_data["environment"], array('url'=>$order_data["service_url"], 'account'=>$order_data["account"],'license'=>$order_data["license"],'client'=>$order_data["client"], 'trace'=> TRUE)); - - $client = new TaxServiceSoap($order_data["environment"]); - $request = new GetTaxHistoryRequest(); - - $request->setCompanyCode($order_data["CompanyCode"]); - $request->setDocType($order_data["DocType"]); - $request->setDocCode($order_data["DocCode"]); - - //$returnMessage = ""; - $GetTaxHistoryReturnValue = array(); - - // Get Tax History and Results - try - { - $connectorcalling=$timeStamp->format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); - $result = $client->getTaxHistory($request); - $connectorcomplete=$timeStamp->format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); - // Creating the System Logger Object - $application_log = new SystemLogger; - $connectorend=$timeStamp->format('Y-m-d\TH:i:s').".".substr((string)microtime(), 2, 3)." ".$timeStamp->format("P"); - $performance_metrics[] = array("CallerTimeStamp","MessageString","CallerAcctNum","DocCode","Operation","ServiceURL","LogType","LogLevel","ERPName","ERPVersion","ConnectorVersion"); - $performance_metrics[] = array($connectorstart,"PreGetTaxHistory Start Time-\"".$connectorstart,$order_data["account"],$order_data["DocCode"],"TaxHistory",$order_data["service_url"],"Performance","Informational","CS-Cart",PRODUCT_VERSION,AVALARA_VERSION); - $performance_metrics[] = array($connectorcalling,"PreGetTaxHistory End Time-\"".$connectorcalling,$order_data["account"],$order_data["DocCode"],"TaxHistory",$order_data["service_url"],"Performance","Informational","CS-Cart",PRODUCT_VERSION,AVALARA_VERSION); - $performance_metrics[] = array($connectorcomplete,"PostGetTaxHistory Start Time-\"".$connectorcomplete,$order_data["account"],$order_data["DocCode"],"TaxHistory",$order_data["service_url"],"Performance","Informational","CS-Cart",PRODUCT_VERSION,AVALARA_VERSION); - $performance_metrics[] = array($connectorend,"PostGetTaxHistory End Time-\"".$connectorend,$order_data["account"],$order_data["DocCode"],"TaxHistory",$order_data["service_url"],"Performance","Informational","CS-Cart",PRODUCT_VERSION,AVALARA_VERSION); - //Call serviceLog function - $returnServiceLog = $application_log->serviceLog($performance_metrics); - - - - /*** - * Place holder for logs - * getLastRequest - * getLastResponse - */ - - /************* Logging code snippet (optional) starts here *******************/ - // System Logger starts here: - - - if($log_mode==1){ - - $timeStamp = new DateTime(); // Create Time Stamp - $params = '[Input: ' . ']'; // Create Param List - $u_name = ''; // Eventually will come from $_SESSION[] object - - - $application_log->AddSystemLog($timeStamp->format('Y-m-d H:i:s'), __FUNCTION__, __CLASS__, __METHOD__, __FILE__, $u_name, $params, $client->__getLastRequest()); // Create System Log - $application_log->WriteSystemLogToFile(); // Log info goes to log file - - $application_log->AddSystemLog($timeStamp->format('Y-m-d H:i:s'), __FUNCTION__, __CLASS__, __METHOD__, __FILE__, $u_name, $params, $client->__getLastResponse()); // Create System Log - $application_log->WriteSystemLogToFile(); // Log info goes to log file - - // $application_log->WriteSystemLogToDB(); // Log info goes to DB - // System Logger ends here - // Logging code snippet (optional) ends here - } - else{} - - // Success - Display GetTaxResults to console - if ($result->getResultCode() != SeverityLevel::$Success) { - foreach ($result->getMessages() as $msg) { - $returnMessage .= $msg->getName() . ": " . $msg->getSummary() . "\n"; - } - return "Error :".$returnMessage; - } - else - { - $GetTaxHistoryReturnValue["DocDate"] = $result->getGetTaxResult()->getDocDate(); - $GetTaxHistoryReturnValue["TaxDate"] = $result->getGetTaxResult()->getTaxDate(); - $GetTaxHistoryReturnValue["DocCode"] = $result->getGetTaxResult()->getDocCode(); - //return $GetTaxHistoryReturnValue; - } - // If NOT success - display error or warning messages to console - // it is important to itterate through the entire message class - } - catch (SoapFault $exception) - { - $msg = "Exception: "; - if ($exception) - $msg .= $exception->faultstring; - - // If you desire to retrieve SOAP IN / OUT XML - // - Follow directions below - // - if not, leave as is - // } //UN-comment this line to return SOAP XML - $returnMessage .= $msg . "\n"; - $returnMessage .= $client->__getLastRequest() . "\n"; - $returnMessage .= $client->__getLastResponse() . "\n"; - return $returnMessage; - - //echo $client->__getLastRequest() . "\n"; - //echo $client->__getLastResponse() . "\n"; - } //Comment this line to return SOAP XML -//} -?> \ No newline at end of file diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/media/images/Thumbs.db b/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/media/images/Thumbs.db deleted file mode 100644 index f2bf748..0000000 Binary files a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/media/images/Thumbs.db and /dev/null differ diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/templates/addons/avatax_tax_calculation/hooks/index/scripts.post.tpl b/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/templates/addons/avatax_tax_calculation/hooks/index/scripts.post.tpl new file mode 100644 index 0000000..1936499 --- /dev/null +++ b/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/templates/addons/avatax_tax_calculation/hooks/index/scripts.post.tpl @@ -0,0 +1,3 @@ +{if ($runtime.controller == "addons" && $runtime.mode == "update")} + {script src="js/addons/avatax_tax_calculation/index.js"} +{/if} \ No newline at end of file diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/templates/addons/avatax_tax_calculation/hooks/products/tax_code.pre.tpl b/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/templates/addons/avatax_tax_calculation/hooks/products/update_product_tax_ids.pre.tpl similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/templates/addons/avatax_tax_calculation/hooks/products/tax_code.pre.tpl rename to Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/templates/addons/avatax_tax_calculation/hooks/products/update_product_tax_ids.pre.tpl diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/templates/addons/avatax_tax_calculation/hooks/profiles/detailed_content.post.tpl b/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/templates/addons/avatax_tax_calculation/hooks/profiles/detailed_content.post.tpl new file mode 100644 index 0000000..f6050d7 --- /dev/null +++ b/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/templates/addons/avatax_tax_calculation/hooks/profiles/detailed_content.post.tpl @@ -0,0 +1,20 @@ + {include file="common/subheader.tpl" title="AvaTax"} + +
+ + +
+ +
+
+ +
+ +
+ +
+
\ No newline at end of file diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/templates/addons/avatax_tax_calculation/hooks/profiles/tax_exempt_number.pre.tpl b/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/templates/addons/avatax_tax_calculation/hooks/profiles/tax_exempt_number.pre.tpl deleted file mode 100644 index 26891fb..0000000 --- a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/templates/addons/avatax_tax_calculation/hooks/profiles/tax_exempt_number.pre.tpl +++ /dev/null @@ -1,18 +0,0 @@ -
- - -
- -
-
- -
- -
- -
-
\ No newline at end of file diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/templates/addons/avatax_tax_calculation/hooks/shippings/tax_code.pre.tpl b/Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/templates/addons/avatax_tax_calculation/hooks/shippings/update.pre.tpl similarity index 100% rename from Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/templates/addons/avatax_tax_calculation/hooks/shippings/tax_code.pre.tpl rename to Avalara AvaTax for CS Cart version 00.00.11.00/design/backend/templates/addons/avatax_tax_calculation/hooks/shippings/update.pre.tpl diff --git a/Avalara AvaTax for CS Cart version 00.00.11.00/js/addons/avatax_tax_calculation/index.js b/Avalara AvaTax for CS Cart version 00.00.11.00/js/addons/avatax_tax_calculation/index.js new file mode 100644 index 0000000..d1614a4 --- /dev/null +++ b/Avalara AvaTax for CS Cart version 00.00.11.00/js/addons/avatax_tax_calculation/index.js @@ -0,0 +1,238 @@ +$( document ).ready(function() { + if (document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_account_number\']").value != "") { + $("#avatax_tax_calculation_section2").hide(); + $("#signinInfo").hide(); + } + + $(".cm-dialog-closer").click(function() { + if (document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_company_code\']").value != "") { + $("[id^=\'container_addon_option_avatax_tax_calculation_select_codes\']").hide(); + } + if (document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_account_number\']").value != "" + && document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_company_code\']").value == "") { + alert("AvaTax Company Code should not be empty.\n Click On Test Connection to get Company Codes"); + return false; + } + }); + + $(".btn-primary").click(function() { + if (!validateFields()) { return false; } + if (document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_company_code\']").value == "") { + alert("AvaTax Company Code should not be empty.\n Click On Test Connection to get Company Codes"); + return false; + } else { + var accountVal = document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_account_number\']").value; + var licenseVal = document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_license_key\']").value; + var serviceURLVal = document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_service_url\']").value; + var isAvataxEnabled = $("[id^=\'addon_option_avatax_tax_calculation_avatax_tax_calculation\'] input[type=radio]:checked").val(); + var isUPCOption = $("[id^=\'addon_option_avatax_tax_calculation_avatax_tax_upc\'] input[type=radio]:checked").val(); + var isSaveTransaction = $("[id^=\'addon_option_avatax_tax_calculation_avatax_tax_savedoc\'] input[type=radio]:checked").val(); + var isAddressValidation = $("[id^=\'addon_option_avatax_tax_calculation_avatax_tax_address_validation\'] input[type=radio]:checked").val(); + var isLogEnabled = $("[id^=\'addon_option_avatax_tax_calculation_avatax_log_mode input\'][type=radio]:checked").val(); + var companyCode = document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_company_code\']").value; + var environment = serviceURLVal.indexOf("development") > 0 ? "Development" : "Production"; + + $.ajax({ + url:"?dispatch=avatax_tax_calculation.config_log&security_hash="+Tygh.security_hash+"&acc="+accountVal+"&license="+licenseVal+"&serviceurl="+serviceURLVal+"&environment="+environment+"&client=" + AVATAX_CLIENT + "&isAvataxEnabled="+isAvataxEnabled+"&isUPCOption="+isUPCOption+"&isSaveTransaction="+isSaveTransaction+"&isLogEnabled="+isLogEnabled+"&companyCode="+companyCode+"&isAddressValidation="+isAddressValidation, + success: function(result) { + //alert(result); + }, + async: false, + type : "POST" + }); + } + }); + + //Hide the company name and and code fields if it is not added + if (document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_company_code\']").value == "") { + $("[id^=\'container_addon_option_avatax_tax_calculation_avatax_company_code\']").hide(); + } + $("[id^=\'container_addon_option_avatax_tax_calculation_select_codes\']").hide(); + $("[id^=\'addon_option_avatax_tax_calculation_avatax_company_code\']").attr("readonly", "true"); +}); + +if (document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_company_code\']").value != "") { + $("[id^=\'addon_option_avatax_tax_calculation_avatax_account_number\']").on("input", function() { + $("[id^=\'addon_option_avatax_tax_calculation_avatax_company_code\']").val(""); + $("[id^=\'container_addon_option_avatax_tax_calculation_avatax_company_code\']").hide(); + $("[id^=\'container_addon_option_avatax_tax_calculation_select_codes\']").hide(); + }); +} + +$("[id^=\'addon_option_avatax_tax_calculation_avatax_license_key\']").on("input", function() { + $("[id^=\'addon_option_avatax_tax_calculation_avatax_company_code\']").val(""); + $("[id^=\'container_addon_option_avatax_tax_calculation_avatax_company_code\']").hide(); + $("[id^=\'container_addon_option_avatax_tax_calculation_select_codes\']").hide(); +}) ; + +document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_service_url\']").addEventListener("change", function () { + document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_company_code\']").value = ""; + $("[id^=\'container_addon_option_avatax_tax_calculation_avatax_company_code\']").hide(); + $("[id^=\'container_addon_option_avatax_tax_calculation_select_codes\']").hide(); +}); + +$("[id^=\'addon_option_avatax_tax_calculation_select_codes\']").change( function() { + $(this).find(":selected").each(function () { + $("[id^=\'addon_option_avatax_tax_calculation_avatax_company_code\']").val($(this).val()); + }); +}); + +document.getElementById("variant_avatax_tax_calculation_1").addEventListener("click", function() { + if (document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_account_number\']").value == "") { + alert("AvaTax Account ID should not empty."); + document.getElementById("variant_avatax_tax_calculation_0").checked = true; + document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_account_number\']").focus(); + } + else if (document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_license_key\']").value == "") { + alert("AvaTax License Key should not empty."); + document.getElementById("variant_avatax_tax_calculation_0").checked = true; + document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_license_key\']").focus(); + } + else if (document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_service_url\']").value == "") { + alert("AvaTax Service URL should not empty."); + document.getElementById("variant_avatax_tax_calculation_0").checked = true; + document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_service_url\']").focus(); + } + else if (document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_company_code\']").value == "") { + alert("AvaTax Company Code should not empty."); + document.getElementById("variant_avatax_tax_calculation_0").checked = true; + document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_company_code\']").focus(); + } +}); + +document.getElementById("variant_avatax_tax_address_validation_1").addEventListener("click", function() { + if (document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_account_number\']").value == "") { + alert("AvaTax Account ID should not empty."); + document.getElementById("variant_avatax_tax_calculation_0").checked = true; + document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_account_number\']").focus(); + } + else if (document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_license_key\']").value == "") { + alert("AvaTax License Key should not empty."); + document.getElementById("variant_avatax_tax_calculation_0").checked = true; + document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_license_key\']").focus(); + } + else if (document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_service_url\']").value == "") { + alert("AvaTax Service URL should not empty."); + document.getElementById("variant_avatax_tax_calculation_0").checked = true; + document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_service_url\']").focus(); + } + else if (document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_company_code\']").value == "") { + alert("AvaTax Company Name should not empty."); + document.getElementById("variant_avatax_tax_calculation_0").checked = true; + document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_company_code\']").focus(); + } +}); + +var devMode = document.getElementById("addon_option_avatax_tax_calculation_avatax_development_mode"); +if(devMode !== null) { + devMode.addEventListener("click", function() { + var selectedVal = ""; + var selected = $('input[type="radio"][id="variant_avatax_development_mode_1"]:checked'); + if (selected.length > 0) { + selectedValue = selected.val(); + } else { + selected = $('input[type="radio"][id="variant_avatax_development_mode_0"]:checked'); + if (selected.length > 0) + selectedValue = selected.val(); + } + + document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_service_url\']").removeAttr("disabled"); + + if (selectedValue == 1) + document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_service_url\']").val("https://development.avalara.net/"); + else if (selectedValue == 0) + document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_service_url\']").val("https://avatax.avalara.net"); + }); +} + +document.getElementById("AvaTaxTestConnection").addEventListener("click", function() { + if (validateFields()) { + $("#AvaTaxTestConnectionDialog").html('
Work In Progress...
Work In Progress...
'); + $("#AvaTaxTestConnectionDialog").dialog({ + width:350, + height:200, + buttons: { + "OK": function() { + $( this ).dialog( "close" ); + } + }, + open: function( event, ui ) { + if (!$("#AvaTaxTestConnectionDialog").parent().hasClass("ui-dailog-inner")) + $("#AvaTaxTestConnectionDialog").parent().addClass("ui-dailog-inner"); + } + }); + var accountVal = document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_account_number\']").value; + var licenseVal = document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_license_key\']").value; + var serviceURLVal = document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_service_url\']").value; + + var environment = serviceURLVal.indexOf("development") > 0 ? "Development" : "Production"; + + $.post("?dispatch=avatax_tax_calculation.connection_test&security_hash="+Tygh.security_hash+"&from=AvaTaxConnectionTest&acc="+accountVal+"&license="+licenseVal+"&serviceurl="+serviceURLVal+"&environment="+environment+"&client=" + AVATAX_CLIENT, {q: ""}, function(data) { + if (data.length > 0) { + $("#AvaTaxTestConnectionDialog").html(data); + if (!data.match(/Failed/gi)) { + showCompanyFields(); + validateCompany(); + } else { + $("[id^=\'addon_option_avatax_tax_calculation_avatax_company_code\']").val(""); + $("[id^=\'container_addon_option_avatax_tax_calculation_avatax_company_code\']").hide(); + } + } + }); + } +}); + +function validateFields() { + if (document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_account_number\']").value == "") { + alert("Please enter AvaTax Account ID!"); + document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_account_number\']").focus(); + return false; + } else if (document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_account_number\']").value.length!=10) { + alert("AvaTax Account ID should not be less than or greater than 10 digits!"); + document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_account_number\']").focus(); + return false; + } else if (document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_license_key\']").value == "") { + alert("Please enter AvaTax License Key"); + document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_license_key\']").focus(); + return false; + } else if (document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_license_key\']").value.length!=16) { + alert("AvaTax License Key should not be less than or greater than 16 chars"); + document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_license_key\']").focus(); + return false; + } else if (document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_service_url\']").value == "") { + alert("Please enter AvaTax Service URL"); + document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_service_url\']").focus(); + return false; + } + + return true; +} + +function showCompanyFields() { + $("[id^=\'addon_option_avatax_tax_calculation_avatax_company_code\']").attr("readonly", "true"); + $("[id^=\'container_addon_option_avatax_tax_calculation_avatax_company_code\']").show(); + $("[id^=\'container_addon_option_avatax_tax_calculation_select_codes\']").show(); +} + +function validateCompany() { + + var accountVal = document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_account_number\']").value; + var licenseVal = document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_license_key\']").value; + var serviceURLVal = document.querySelector("[id^=\'addon_option_avatax_tax_calculation_avatax_service_url\']").value; + + var environment = serviceURLVal.indexOf("development") ? "Development" : "Production"; + + $.post("?dispatch=avatax_tax_calculation.setup_assistant&security_hash="+Tygh.security_hash+"&from=AvaTaxFetchCompanies&acc="+accountVal+"&license="+licenseVal+"&serviceurl="+serviceURLVal+"&environment="+environment+"&client=" + AVATAX_CLIENT, {q: ""}, function(data) { + if (data.length > 0) { + var accountsData = JSON.parse(data); + $("[id^=\'addon_option_avatax_tax_calculation_select_codes\']").find("option").remove(); + var _select=""; + _select = $("