Plugin Directory

Changeset 3219747


Ignore:
Timestamp:
01/09/2025 04:23:59 PM (15 months ago)
Author:
ceretax
Message:

Release 1.3.0

Location:
ceretax/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • ceretax/trunk/ceretax.php

    r3165281 r3219747  
    22/**
    33 * Plugin Name: CereTax
    4  * Plugin URI: https://woocommerce.com/products/woocommerce-ceretax/
     4 * Plugin URI: https://wordpress.org/plugins/ceretax/
    55 * Description: Simplify sales tax complexity with CereTax for WooCommerce.
    6  * Version: 1.2.0
     6 * Version: 1.3.0
    77 * Author: CereTax, Inc.
    88 * Author URI: https://www.ceretax.com/
     
    3939// Version of plugin.
    4040if ( ! defined( 'CWAFC_VERSION' ) ) {
    41     define( 'CWAFC_VERSION', '1.0.0' );
     41    define( 'CWAFC_VERSION', '1.3.0' );
    4242}
    4343
  • ceretax/trunk/changelog.txt

    r3165281 r3219747  
    11*** Ceretax ***
    22
    3 2024-10-07 - version 1.2.0
     32024-10-08 - version 1.2.0
    44 * First Release.
     5
     62024-10-19 - version 1.2.1
     7 * Fix fees related text in admin side.
     8
     92024-12-15 - version 1.2.2
     10 * Fix - fees and tax fatal errors
     11 * Fix - fees and tax display errors.
     12
     132024-12-31 - version 1.3.0
     14 * add - Partial payment behavior for delivery fee
     15 * add - Trial order (0 value order) payment with shipping amount
     16 * add - Subscription and Renewal orders with shipping and it's payment behavior
  • ceretax/trunk/inc/admin/class-cwafc-admin-action.php

    r3165281 r3219747  
    4242            add_action( 'created_product_cat', array( $this, 'action__cwafc_save_custom_field_in_product_category' ), 10, 2 );
    4343            add_action( 'edited_product_cat', array( $this, 'action__cwafc_save_custom_field_in_product_category' ), 10, 2 );
     44            add_action( 'admin_footer', array( $this, 'action__cwafc_admin_footer_function' ), 20 );
    4445        }
    4546
     
    371372            // phpcs:enable WordPress.Security.NonceVerification.Missing
    372373        }
     374
     375        /**
     376         * Admin footer style
     377         *
     378         * @return void
     379         */
     380        public function action__cwafc_admin_footer_function() {
     381            ?>
     382            <style>
     383                /* Hide the 3rd tr of .wc-order-totals if .wc-used-coupons is found */
     384                .wc-order-data-row:has(.wc-used-coupons) .wc-order-totals:first-of-type tr:nth-of-type(3) {
     385                    display: none !important;
     386                }
     387
     388                /* Hide the 2nd tr of .wc-order-totals if .wc-used-coupons is not found */
     389                .wc-order-data-row:not(:has(.wc-used-coupons)) .wc-order-totals:first-of-type tr:nth-of-type(2) {
     390                    display: none !important;
     391                }
     392
     393            </style>
     394            <?php
     395        }
    373396    }
    374397
  • ceretax/trunk/inc/class-cwafc.php

    r3165281 r3219747  
    8080            // Apply the tax/fee.
    8181            add_action( 'woocommerce_cart_calculate_fees', array( $this, 'action__cwafc_apply_custom_tax_rate' ) );
     82            add_action( 'woocommerce_admin_order_totals_after_tax', array( $this, 'action__cwafc_add_custom_item_order_admin' ) );
    8283            // Add address validation button on checkout page.
    8384            add_action( 'woocommerce_before_order_notes', array( $this, 'action__cwafc_add_address_validate_button' ) );
     
    9697            // Allow woocommerce subscriptions to add recurring fee.
    9798            add_filter( 'woocommerce_subscriptions_is_recurring_fee', '__return_true' );
     99        }
     100
     101        /**
     102         * Show order caclulation
     103         *
     104         * @param string $order_id Order ID.
     105         * @return void
     106         */
     107        public function action__cwafc_add_custom_item_order_admin( $order_id ) {
     108
     109            $ceretax_data = get_post_meta( $order_id, 'ceretax_data', true );
     110            $ceretax_data = json_decode( $ceretax_data );
     111
     112            $total_tax_invoice = $ceretax_data->invoice->totalTaxInvoice;
     113
     114
     115            $order      = wc_get_order( $order_id );
     116            $fee_amount = null;
     117            $order_total_fees = $order->get_total_fees();
     118            $order_remain_fees = 0;
     119            foreach ( $order->get_fees() as $fee_id => $fee ) {
     120                if ( $fee->get_name() === 'Tax' ) {
     121                    $fee_amount = $fee->get_amount();
     122                    if ( is_numeric( $order_total_fees ) && is_numeric( $fee_amount ) ) {
     123                        $order_remain_fees = (float) $order_total_fees - (float) $fee_amount;
     124                    }
     125                    $fee->save();
     126                    break;
     127                }
     128            }
     129
     130            if ( 0 < $order_remain_fees ) {
     131                echo '<tr>';
     132                echo '<td class="label">' . __( 'Fees', 'ceretax' ) . ':</td>';
     133                echo '<td width="1%"></td>';
     134                echo '<td class="total">' . wc_price( $order_remain_fees ) . '</td>';
     135                echo '</tr>';
     136            }
     137            echo '<tr>';
     138            echo '<td class="label">' . __( 'Tax', 'ceretax' ) . ':</td>';
     139            echo '<td width="1%"></td>';
     140            echo '<td class="total">' . wc_price( $total_tax_invoice ) . '</td>';
     141            echo '</tr>';
    98142        }
    99143
     
    897941         */
    898942        public function action__cwafc_order_after_calculate_totals( $and_taxes, $order ) {
    899 
    900943            $cere_tax_post_transactions = get_option( CWAFC_PREFIX . '_cere_tax_post_transactions' );
    901944            if ( 'yes' !== $cere_tax_post_transactions ) {
    902945                return false;
    903946            }
    904 
    905947            // Prevent infinite loop using a transient or custom flag.
    906948            if ( get_transient( 'prevent_order_calculate_totals' ) ) {
    907949                return;
    908950            }
    909 
    910951            $shipping_address_1 = $order->get_shipping_address_1();
    911952            if ( ! empty( $shipping_address_1 ) ) {
     
    952993                    $order->add_item( $item_fee );
    953994                }
    954 
     995                $order->update_meta_data( 'ceretax', '56' );
    955996                // Set the transient to prevent recursion.
    956997                set_transient( 'prevent_order_calculate_totals', true, 10 );
     
    10121053                $api_url = 'https://calc.cert.ceretax.net/sale';
    10131054            }
     1055
     1056            $item_count      = 0;
     1057            $order_status    = $order->get_status();
     1058            $created_via     = $order->get_meta( '_created_via' );
     1059            $order_parent_id = $order->get_parent_id();
     1060            $order_type      = $order->get_type();
     1061
    10141062            foreach ( $order->get_items() as $item_id => $item ) {
    1015                 $product_id = $item->get_product_id();
    1016                 $product    = wc_get_product( $product_id );
     1063
     1064                $product_id              = $item->get_product_id();
     1065                $product                 = wc_get_product( $product_id );
     1066                $order_item_trial_length = $product->get_meta( '_subscription_trial_length' );
    10171067
    10181068                // Get PS code.
     
    10341084                }
    10351085
    1036                 $line_items[] = array(
     1086                $line_items[ $item_count ] = array(
    10371087                    'lineID'             => (string) $item_id,
    10381088                    'dateOfTransaction'  => gmdate( 'Y-m-d' ),
     
    10581108                    ),
    10591109                );
     1110
     1111                $this->cwafc_wc_add_custom_logs( array( 'order_id' => $order->get_id(), '$order_parent_id' => $order_parent_id, 'order_type' => $order_type, 'order_item_trial_length' => $order_item_trial_length, 'created_via' => $created_via, 'order_status' => $order_status ), 'ceretax-api-TEST' );
     1112
     1113                // Check if deposit and scheduled orders.
     1114                if ( ! empty( $order_parent_id ) && 'wc_deposits' === $created_via && 'scheduled-payment' === $order_status ) {
     1115                    $line_items[ $item_count ]['attributes'] = array(
     1116                        array(
     1117                            'key'   => 'noDeliveryFee',
     1118                            'value' => 'Y',
     1119                        ),
     1120                    );
     1121                }
     1122
     1123                // Check if subscription trial main order.
     1124                if ( empty( $order_parent_id ) && 'subscription' !== $created_via && ! empty( $order_item_trial_length ) ) {
     1125                    $line_items[ $item_count ]['attributes'] = array(
     1126                        array(
     1127                            'key'   => 'noDeliveryFee',
     1128                            'value' => 'Y',
     1129                        ),
     1130                    );
     1131                }
     1132                $item_count++;
    10601133            }
    10611134
     
    12681341
    12691342            if ( ! WC()->cart->is_empty() ) {
     1343                $item_count = 0;
    12701344                foreach ( WC()->cart->get_cart() as $cart_item_id => $cart_item ) {
    1271                     $product_id = $cart_item['product_id'];
    1272                     $product    = wc_get_product( $product_id );
     1345                    $product_id             = $cart_item['product_id'];
     1346                    $product                = wc_get_product( $product_id );
     1347                    $cart_item_trial_length = $product->get_meta( '_subscription_trial_length' );
    12731348
    12741349                    // Get PS code.
     
    12991374                    $invoice_total_amount += $line_total;
    13001375
    1301                     $cart_items[] = array(
     1376                    $cart_items[ $item_count ] = array(
    13021377                        'lineID'             => $cart_item_id,
    13031378                        'dateOfTransaction'  => gmdate( 'Y-m-d' ),
     
    13231398                        ),
    13241399                    );
     1400
     1401                    // Check if subscription trial main order.
     1402                    if ( ! empty( $cart_item_trial_length ) ) {
     1403                        $cart_items[ $item_count ]['attributes'] = array(
     1404                            array(
     1405                                'key'   => 'noDeliveryFee',
     1406                                'value' => 'Y',
     1407                            ),
     1408                        );
     1409                    }
     1410                    $item_count++;
     1411
    13251412                }
    13261413            }
  • ceretax/trunk/readme.txt

    r3179144 r3219747  
    55Tested up to: 6.6.1
    66Requires PHP: 5.6
    7 Stable tag: 1.2.0
     7Stable tag: 1.3.0
    88License: GNU General Public License v3.0
    99URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    1717CereTax's all-in-one sales tax solution seamlessly integrates into WooCommerce, automating sales tax on your orders. Utilizing countless technological advancements, CereTax was engineered in a way that truly revolutionizes the way a tax calculation platform operates, focusing on speed, dependability, scalability, accuracy, and customization. With CereTax, you'll have confidence that your business has the tools to:
    1818
    19 * Collect the correct sales taxes everywhere you do business.
    20 * Stay in compliance and be audit ready.
    21 * Easily track and report advanced analytics.
    22 * Grow painlessly as you add new products, add new markets, and acquire companies.
    23 * Always get the answers when you need them with world-class support.
     19* Collect the correct sales taxes everywhere you do business
     20* Stay in compliance and be audit ready
     21* Easily track and report advanced analytics
     22* Grow painlessly as you add new products, add new markets, and acquire companies
     23* Always get the answers when you need them with world-class support
    2424
    2525= CereTax Features =
    2626
    2727* Real-time Sales Tax Calculations: CereTax automatically calculates sales tax on your orders based on location, product, and service taxability.
    28 * Precise Tax Assignments: Pinpoint accuracy with our industry first, proprietary GIS method - even for remote locations!
     28* Precise Tax Assignments: Pinpoint accuracy with our industry first, proprietary GIS method – even for remote locations!
    2929* Reports and Analytics: Deep, actionable analytics for your entire enterprise through one User Interface. Link business units and sales channels all through one unified platform.
    3030* Audit Tools: Be prepared at all times with on-demand detailed reporting down to the transaction level and explanations for taxability decisions, along with statute and citation references are available at a transaction level right through the UI.
    31 
    32 = Pricing =
    33 * The CereTax plugin requires a subscription to CereTax's tax calculation service. [Reach out to CereTax](https://www.ceretax.com/contact) today to get started!
    3431
    3532== Installation ==
     
    3936== Changelog ==
    4037
     38= 1.3.0 =
     39* add - Partial payment behavior for delivery fee
     40* add - Trial order (0 value order) payment with shipping amount
     41* add - Subscription and Renewal orders with shipping and it's payment behavior
     42
     43= 1.2.2 =
     44* Fix - fees and tax fatal errors
     45* Fix - fees and tax display errors
     46
     47= 1.2.1 =
     48* Fix - fees related text in admin side
     49
    4150= 1.2.0 =
    4251* Initial Release
     
    4453== Upgrade Notice ==
    4554
     55= 1.3.0 =
     561.3.0 is fix - fees related text in admin side
     57
    4658= 1.2.0 =
    47591.2.0 is Initial Release.
Note: See TracChangeset for help on using the changeset viewer.