Plugin Directory

Changeset 2907371


Ignore:
Timestamp:
05/03/2023 09:01:20 AM (3 years ago)
Author:
breadintegrations
Message:

v3.3.3 release, discount codes fix, WC & WP compatibility updates

Location:
bread-finance
Files:
5 edited
19 copied

Legend:

Unmodified
Added
Removed
  • bread-finance/tags/release-3.3.3/README.md

    r2897614 r2907371  
    44Requires at least: 4.9
    55Tested up to: 6.1.1
    6 Stable tag: 3.3.2
     6Stable tag: 3.3.3
    77Requires PHP: 5.6
    88WC requires at least: 3.0
     
    7373== Changelog ==
    7474
     75= 3.3.3
     76* Current release
     77* Bug fix for discount codes applied with Avatax enabled
     78
    7579= 3.3.2
    76 * Current release
    7780* Added admin notices to notify merchants of re-configuration they need to make if upgrading to v3.3.0+
    7881* Added local logging of data for Transaction service
  • bread-finance/tags/release-3.3.3/assets/js/v2/main.js

    r2853897 r2907371  
    896896                totalDiscounts: {
    897897                    currency: opts.currency,
    898                     value: (opts.discounts != undefined && opts.discounts.length > 0 ) ? opts.discounts[0].amount : 0
     898                    value: (typeof(opts.discounts) !== 'undefined' && opts.discounts.length > 0 ) ? opts.discounts[0].amount : 0
    899899                },
    900900                totalShipping: {
    901901                    currency: opts.currency,
    902                     value: (opts.shippingOptions != undefined && opts.shippingOptions.length > 0 ) ? opts.shippingOptions[0].cost : 0
     902                    value: (typeof(opts.shippingOptions) !== 'undefined' && opts.shippingOptions.length > 0 ) ? opts.shippingOptions[0].cost : 0
    903903                },
    904904                totalTax: {
    905905                    currency: opts.currency,
    906                     value: (opts.tax != undefined) ? opts.tax : 0
     906                    value: (typeof(opts.tax) !== 'undefined') ? opts.tax : 0
    907907                }
    908908            }
     
    940940        var tokenField = breadController.breadCheckoutHandler.$form.find('input[name="bread_tx_token"]');
    941941
    942         if (application.transactionID == undefined) {
     942        if (typeof(application.transactionID) === 'undefined') {
    943943            var errorInfo = {
    944944                err: application
  • bread-finance/tags/release-3.3.3/bread-finance.php

    r2897614 r2907371  
    66 * Author: Bread Pay
    77 * Author URI: https://payments.breadfinancial.com/
    8  * Version: 3.3.2
     8 * Version: 3.3.3
    99 * Text Domain: bread-finance
    1010 * Domain Path: /i18n/languages/
     
    2222
    2323//Require minimums and constants
    24 define('WC_BREAD_FINANCE_VERSION', '3.3.2');
     24define('WC_BREAD_FINANCE_VERSION', '3.3.3');
    2525define('WC_BREAD_FINANCE_MIN_PHP_VER', '5.6.0');
    2626define('WC_BREAD_FINANCE_MIN_WC_VER', '3.4.0');
  • bread-finance/tags/release-3.3.3/classes/class-bread-finance-options-checkout.php

    r2897614 r2907371  
    4343            );
    4444
    45             $options['customTotal'] = $this->bread_finance_utilities->priceToCents(WC()->cart->get_total('float'));
     45            //Get cart totals
     46            $cartTotal = $this->bread_finance_utilities->priceToCents(WC()->cart->get_total('float'));
    4647            $cartSubtotal = $this->bread_finance_utilities->priceToCents(WC()->cart->get_subtotal('float'));
    47 
    48             /* Include shipping cost in tax calculations to ensure Avalara accounts for shipping tax amount */
     48           
     49            //Get Discounts
     50            $discountResponse = $this->getDiscounts();
     51            $discountTotal = $this->bread_finance_utilities->getDiscountTotal($discountResponse["discounts"] ?: array());
     52           
     53            /*
     54             * Include shipping cost in tax calculations to ensure
     55             * Avalara accounts for shipping tax amount
     56             */
    4957            $shippingCost = 0;
    5058            $shippingResponse = $this->getShipping();
     
    5260                $shippingCost = $shippingResponse['shippingOptions'][0]['cost'];
    5361            }
     62            $options['shippingCountry'] = WC()->customer->get_shipping_country();
     63           
     64            //Get tax
    5465            $taxResponse = $this->getTax($shippingCost);
    55             $discountResponse = $this->getDiscounts();
    56             /* If AvaTax is enabled, calculate customTotal using subtotal + shipping cost + tax - discounts */
    57             if ($this->bread_finance_utilities->isAvataxEnabled()) {
    58                 $discountTotal = $this->bread_finance_utilities->getDiscountTotal($discountResponse["discounts"] ?: array());
    59                 $cartSubtotal = $this->bread_finance_utilities->priceToCents(WC()->cart->get_subtotal('float'));
    60             }
    61 
     66            $taxTotal = isset($taxResponse['tax']) ? $taxResponse['tax'] : 0;
     67         
     68            //Get items
    6269            $options['items'] = $this->getItems();
    6370
     
    6976            }
    7077
     78            //Totals
    7179            $options['subTotal'] = $cartSubtotal;
    72             $options['customTotal'] = ($cartSubtotal + $shippingCost + $taxResponse['tax']) - $discountTotal;
    73             $options['shippingCountry'] = WC()->customer->get_shipping_country();
    74 
     80            $options['customTotal'] = ($cartSubtotal + $shippingCost + $taxTotal) - $discountTotal;
     81            $options['cartTotal'] = $cartTotal;
     82
     83            //Currency options
    7584            $currency = get_woocommerce_currency();
    7685            $options['currency'] = $currency;
  • bread-finance/tags/release-3.3.3/classes/class-bread-finance-utilities.php

    r2897614 r2907371  
    201201
    202202    public function getTaxHelper($shippingCost) {
    203         $tax;
     203        $tax = 0;
    204204        $cart = WC()->cart;
    205205
  • bread-finance/trunk/README.md

    r2897614 r2907371  
    44Requires at least: 4.9
    55Tested up to: 6.1.1
    6 Stable tag: 3.3.2
     6Stable tag: 3.3.3
    77Requires PHP: 5.6
    88WC requires at least: 3.0
     
    7373== Changelog ==
    7474
     75= 3.3.3
     76* Current release
     77* Bug fix for discount codes applied with Avatax enabled
     78
    7579= 3.3.2
    76 * Current release
    7780* Added admin notices to notify merchants of re-configuration they need to make if upgrading to v3.3.0+
    7881* Added local logging of data for Transaction service
  • bread-finance/trunk/assets/js/v2/main.js

    r2853897 r2907371  
    896896                totalDiscounts: {
    897897                    currency: opts.currency,
    898                     value: (opts.discounts != undefined && opts.discounts.length > 0 ) ? opts.discounts[0].amount : 0
     898                    value: (typeof(opts.discounts) !== 'undefined' && opts.discounts.length > 0 ) ? opts.discounts[0].amount : 0
    899899                },
    900900                totalShipping: {
    901901                    currency: opts.currency,
    902                     value: (opts.shippingOptions != undefined && opts.shippingOptions.length > 0 ) ? opts.shippingOptions[0].cost : 0
     902                    value: (typeof(opts.shippingOptions) !== 'undefined' && opts.shippingOptions.length > 0 ) ? opts.shippingOptions[0].cost : 0
    903903                },
    904904                totalTax: {
    905905                    currency: opts.currency,
    906                     value: (opts.tax != undefined) ? opts.tax : 0
     906                    value: (typeof(opts.tax) !== 'undefined') ? opts.tax : 0
    907907                }
    908908            }
     
    940940        var tokenField = breadController.breadCheckoutHandler.$form.find('input[name="bread_tx_token"]');
    941941
    942         if (application.transactionID == undefined) {
     942        if (typeof(application.transactionID) === 'undefined') {
    943943            var errorInfo = {
    944944                err: application
  • bread-finance/trunk/bread-finance.php

    r2897614 r2907371  
    66 * Author: Bread Pay
    77 * Author URI: https://payments.breadfinancial.com/
    8  * Version: 3.3.2
     8 * Version: 3.3.3
    99 * Text Domain: bread-finance
    1010 * Domain Path: /i18n/languages/
     
    2222
    2323//Require minimums and constants
    24 define('WC_BREAD_FINANCE_VERSION', '3.3.2');
     24define('WC_BREAD_FINANCE_VERSION', '3.3.3');
    2525define('WC_BREAD_FINANCE_MIN_PHP_VER', '5.6.0');
    2626define('WC_BREAD_FINANCE_MIN_WC_VER', '3.4.0');
  • bread-finance/trunk/classes/class-bread-finance-options-checkout.php

    r2897614 r2907371  
    4343            );
    4444
    45             $options['customTotal'] = $this->bread_finance_utilities->priceToCents(WC()->cart->get_total('float'));
     45            //Get cart totals
     46            $cartTotal = $this->bread_finance_utilities->priceToCents(WC()->cart->get_total('float'));
    4647            $cartSubtotal = $this->bread_finance_utilities->priceToCents(WC()->cart->get_subtotal('float'));
    47 
    48             /* Include shipping cost in tax calculations to ensure Avalara accounts for shipping tax amount */
     48           
     49            //Get Discounts
     50            $discountResponse = $this->getDiscounts();
     51            $discountTotal = $this->bread_finance_utilities->getDiscountTotal($discountResponse["discounts"] ?: array());
     52           
     53            /*
     54             * Include shipping cost in tax calculations to ensure
     55             * Avalara accounts for shipping tax amount
     56             */
    4957            $shippingCost = 0;
    5058            $shippingResponse = $this->getShipping();
     
    5260                $shippingCost = $shippingResponse['shippingOptions'][0]['cost'];
    5361            }
     62            $options['shippingCountry'] = WC()->customer->get_shipping_country();
     63           
     64            //Get tax
    5465            $taxResponse = $this->getTax($shippingCost);
    55             $discountResponse = $this->getDiscounts();
    56             /* If AvaTax is enabled, calculate customTotal using subtotal + shipping cost + tax - discounts */
    57             if ($this->bread_finance_utilities->isAvataxEnabled()) {
    58                 $discountTotal = $this->bread_finance_utilities->getDiscountTotal($discountResponse["discounts"] ?: array());
    59                 $cartSubtotal = $this->bread_finance_utilities->priceToCents(WC()->cart->get_subtotal('float'));
    60             }
    61 
     66            $taxTotal = isset($taxResponse['tax']) ? $taxResponse['tax'] : 0;
     67         
     68            //Get items
    6269            $options['items'] = $this->getItems();
    6370
     
    6976            }
    7077
     78            //Totals
    7179            $options['subTotal'] = $cartSubtotal;
    72             $options['customTotal'] = ($cartSubtotal + $shippingCost + $taxResponse['tax']) - $discountTotal;
    73             $options['shippingCountry'] = WC()->customer->get_shipping_country();
    74 
     80            $options['customTotal'] = ($cartSubtotal + $shippingCost + $taxTotal) - $discountTotal;
     81            $options['cartTotal'] = $cartTotal;
     82
     83            //Currency options
    7584            $currency = get_woocommerce_currency();
    7685            $options['currency'] = $currency;
  • bread-finance/trunk/classes/class-bread-finance-utilities.php

    r2897614 r2907371  
    201201
    202202    public function getTaxHelper($shippingCost) {
    203         $tax;
     203        $tax = 0;
    204204        $cart = WC()->cart;
    205205
Note: See TracChangeset for help on using the changeset viewer.