Plugin Directory

Changeset 3448736


Ignore:
Timestamp:
01/28/2026 01:21:47 PM (2 months ago)
Author:
tabbyai
Message:

tagging version 5.9.2

Location:
tabby-checkout
Files:
6 edited
34 copied

Legend:

Unmodified
Added
Removed
  • tabby-checkout/tags/5.9.2/includes/class-wc-gateway-tabby-checkout-base.php

    r3415134 r3448736  
    185185
    186186    public function payment_fields() {
    187         echo '<script>window.tabbyConfig = '.$this->getTabbyConfig().'</script>';
     187        $config = $this->getFrontTabbyConfig();
     188        if (is_checkout_pay_page()) {
     189            $order_id = $wp->query_vars['order-pay'];
     190            if (empty($order_id)) {
     191                $order_key = $wp->query_vars['key'];
     192                $order_id = wc_get_order_id_by_order_key( $order_key );
     193            }
     194            $order = wc_get_order($order_id);
     195            $customer = new \WC_Customer($order->get_customer_id());
     196            $config['buyer'] = $this->getBuyerObject($order);
     197        }
     198        echo '<script>window.tabbyConfig = '.json_encode($config).'</script>';
    188199        switch ($this->getDescriptionType()) {
    189200            case 0:
     
    213224    }
    214225
     226    public function getFrontTabbyConfig() {
     227        return [
     228            'debug'         => $this->get_api_option('debug') == 'yes' ? 1 : 0,
     229            'hideMethods'   => $this->get_api_option('hide_methods') == 'yes',
     230            'ignoreEmail'   => apply_filters('tabby_checkout_ignore_email', false),
     231            'language'      => $this->getLanguage(),
     232            'locale'        => WC_Tabby_Config::get_lang(),
     233            'localeSource'  => $this->get_api_option('locale_html') == 'yes' ? 'html' : '',
     234            'notAvailableMessage' => __('Sorry Tabby is unable to approve this purchase, please use an alternative payment method for your order.', 'tabby-checkout'),
     235        ];
     236    }
    215237    public function getTabbyConfig($order = null) {
    216238        global $wp;
    217         $config = [];
     239        $config = $this->getFrontTabbyConfig();
    218240        $config['apiKey']  = $this->get_api_option('public_key');
    219241        $config['merchantCode'] = WC_Tabby_Config::getMerchantCode($order);
    220         $config['locale']  = WC_Tabby_Config::get_lang();
    221         $config['language']= $this->getLanguage();
    222         $config['hideMethods'] = $this->get_api_option('hide_methods') == 'yes';
    223         $config['localeSource'] = $this->get_api_option('locale_html') == 'yes' ? 'html' : '';
    224         $config['debug']   = $this->get_api_option('debug') == 'yes' ? 1 : 0;
    225         $config['notAvailableMessage'] = __('Sorry Tabby is unable to approve this purchase, please use an alternative payment method for your order.', 'tabby-checkout');
    226242// used to ignore email on checkout
    227         $config['ignoreEmail'] = apply_filters('tabby_checkout_ignore_email', false);
    228243        $config['buyer_history'] = null;
    229244        // buyer and shipping address for pay_for_order functionality
  • tabby-checkout/tags/5.9.2/includes/class-wc-rest-tabby-controller.php

    r3294207 r3448736  
    6666            return new WP_Error(
    6767                'tabby_webhook_error',
    68                 __('Webhook execution error: ' . $e->getMessage()),
     68                __('Webhook execution error'),
    6969                array('status'  => 503)
    7070            );
  • tabby-checkout/tags/5.9.2/includes/class-wc-tabby-api.php

    r3385742 r3448736  
    100100            if (!file_exists(__DIR__ . '/../log')) mkdir (__DIR__ . '/../log', 0777);
    101101            $fp = fopen(__DIR__ . '/../log/tabby.log', "a+");
    102             $msg = preg_replace("#Bearer sk_[^\n]*\-[0-9a-f]{8}([0-9a-f]{4})\n#s", "Bearer sk_XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX\\1\n", print_r($data, true));
     102            $msg = self::mask_secret_key(print_r($data, true));
    103103            fputs($fp, date("[Y-m-d H:i:s] ") . $msg);
    104104            fclose($fp);
     
    110110            }
    111111        };
     112    }
     113    public static function mask_secret_key($str) {
     114        return preg_replace("#Bearer sk_[^\n]*\-[0-9a-f]{8}([0-9a-f]{4})#s", "Bearer sk_XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX\\1\n", $str);
    112115    }
    113116
     
    145148
    146149        if ($data) {
     150            if (array_key_exists('request.headers', $data)) {
     151                array_walk($data['request.headers'], function (&$item) {
     152                    $item = WC_Tabby_Api::mask_secret_key($item);
     153                });
     154            }
    147155            $log["data"] = $data;
    148156        }
  • tabby-checkout/tags/5.9.2/js/tabby.js

    r3415134 r3448736  
    209209        return jQuery('input[name=woocommerce_pay]').length && (jQuery('input[name=woocommerce_pay]').val() == 1);
    210210    }
    211     getShippingAddress() {
    212         if (this.isPayForOrderPage()) return this.config.shipping_address;
    213         const prefix = jQuery('#ship-to-different-address-checkbox:checked').length > 0 ? 'shipping' : 'billing';
    214         return {
    215             address: this.getAddressStreet(prefix),
    216             city: this.getAddressCity(prefix)
    217         }
    218     }
    219     getAddressStreet(prefix) {
    220         const street1 = jQuery('#' + prefix + '_address_1');
    221         const street2 = jQuery('#' + prefix + '_address_2');
    222        
    223         return (street1 ? street1.val() : '') + (street2 && street2.val() ? ', ' + street2.val() : '');
    224     }
    225     getAddressCity(prefix) {
    226         const city = jQuery('#' + prefix + '_city');
    227         return city ? city.val() : null;
    228     }
    229211}
  • tabby-checkout/tags/5.9.2/readme.txt

    r3447772 r3448736  
    44Requires at least: 5.7
    55Tested up to: 6.9
    6 Stable tag: 5.9.1
     6Stable tag: 5.9.2
    77Requires PHP: 7.0
    88License: GPLv3
     
    2828
    2929== Changelog ==
     30
     31= 5.9.2 =
     32
     33* Internal improvements and security hardening.
    3034
    3135= 5.9.1 =
  • tabby-checkout/tags/5.9.2/tabby-checkout.php

    r3447772 r3448736  
    44 * Plugin URI: https://tabby.ai/
    55 * Description: Tabby Checkout
    6  * Version: 5.9.1
     6 * Version: 5.9.2
    77 * Author: Tabby
    88 * Author URI: https://tabby.ai
     
    1515defined( 'ABSPATH' ) || exit;
    1616
    17 define ('MODULE_TABBY_CHECKOUT_VERSION', '5.9.1');
     17define ('MODULE_TABBY_CHECKOUT_VERSION', '5.9.2');
    1818define ('TABBY_CHECKOUT_DOMAIN', 'checkout.tabby.ai');
    1919define ('TABBY_CHECKOUT_API_DOMAIN', 'api.tabby.ai');
  • tabby-checkout/trunk/includes/class-wc-gateway-tabby-checkout-base.php

    r3415134 r3448736  
    185185
    186186    public function payment_fields() {
    187         echo '<script>window.tabbyConfig = '.$this->getTabbyConfig().'</script>';
     187        $config = $this->getFrontTabbyConfig();
     188        if (is_checkout_pay_page()) {
     189            $order_id = $wp->query_vars['order-pay'];
     190            if (empty($order_id)) {
     191                $order_key = $wp->query_vars['key'];
     192                $order_id = wc_get_order_id_by_order_key( $order_key );
     193            }
     194            $order = wc_get_order($order_id);
     195            $customer = new \WC_Customer($order->get_customer_id());
     196            $config['buyer'] = $this->getBuyerObject($order);
     197        }
     198        echo '<script>window.tabbyConfig = '.json_encode($config).'</script>';
    188199        switch ($this->getDescriptionType()) {
    189200            case 0:
     
    213224    }
    214225
     226    public function getFrontTabbyConfig() {
     227        return [
     228            'debug'         => $this->get_api_option('debug') == 'yes' ? 1 : 0,
     229            'hideMethods'   => $this->get_api_option('hide_methods') == 'yes',
     230            'ignoreEmail'   => apply_filters('tabby_checkout_ignore_email', false),
     231            'language'      => $this->getLanguage(),
     232            'locale'        => WC_Tabby_Config::get_lang(),
     233            'localeSource'  => $this->get_api_option('locale_html') == 'yes' ? 'html' : '',
     234            'notAvailableMessage' => __('Sorry Tabby is unable to approve this purchase, please use an alternative payment method for your order.', 'tabby-checkout'),
     235        ];
     236    }
    215237    public function getTabbyConfig($order = null) {
    216238        global $wp;
    217         $config = [];
     239        $config = $this->getFrontTabbyConfig();
    218240        $config['apiKey']  = $this->get_api_option('public_key');
    219241        $config['merchantCode'] = WC_Tabby_Config::getMerchantCode($order);
    220         $config['locale']  = WC_Tabby_Config::get_lang();
    221         $config['language']= $this->getLanguage();
    222         $config['hideMethods'] = $this->get_api_option('hide_methods') == 'yes';
    223         $config['localeSource'] = $this->get_api_option('locale_html') == 'yes' ? 'html' : '';
    224         $config['debug']   = $this->get_api_option('debug') == 'yes' ? 1 : 0;
    225         $config['notAvailableMessage'] = __('Sorry Tabby is unable to approve this purchase, please use an alternative payment method for your order.', 'tabby-checkout');
    226242// used to ignore email on checkout
    227         $config['ignoreEmail'] = apply_filters('tabby_checkout_ignore_email', false);
    228243        $config['buyer_history'] = null;
    229244        // buyer and shipping address for pay_for_order functionality
  • tabby-checkout/trunk/includes/class-wc-rest-tabby-controller.php

    r3294207 r3448736  
    6666            return new WP_Error(
    6767                'tabby_webhook_error',
    68                 __('Webhook execution error: ' . $e->getMessage()),
     68                __('Webhook execution error'),
    6969                array('status'  => 503)
    7070            );
  • tabby-checkout/trunk/includes/class-wc-tabby-api.php

    r3385742 r3448736  
    100100            if (!file_exists(__DIR__ . '/../log')) mkdir (__DIR__ . '/../log', 0777);
    101101            $fp = fopen(__DIR__ . '/../log/tabby.log', "a+");
    102             $msg = preg_replace("#Bearer sk_[^\n]*\-[0-9a-f]{8}([0-9a-f]{4})\n#s", "Bearer sk_XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX\\1\n", print_r($data, true));
     102            $msg = self::mask_secret_key(print_r($data, true));
    103103            fputs($fp, date("[Y-m-d H:i:s] ") . $msg);
    104104            fclose($fp);
     
    110110            }
    111111        };
     112    }
     113    public static function mask_secret_key($str) {
     114        return preg_replace("#Bearer sk_[^\n]*\-[0-9a-f]{8}([0-9a-f]{4})#s", "Bearer sk_XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX\\1\n", $str);
    112115    }
    113116
     
    145148
    146149        if ($data) {
     150            if (array_key_exists('request.headers', $data)) {
     151                array_walk($data['request.headers'], function (&$item) {
     152                    $item = WC_Tabby_Api::mask_secret_key($item);
     153                });
     154            }
    147155            $log["data"] = $data;
    148156        }
  • tabby-checkout/trunk/js/tabby.js

    r3415134 r3448736  
    209209        return jQuery('input[name=woocommerce_pay]').length && (jQuery('input[name=woocommerce_pay]').val() == 1);
    210210    }
    211     getShippingAddress() {
    212         if (this.isPayForOrderPage()) return this.config.shipping_address;
    213         const prefix = jQuery('#ship-to-different-address-checkbox:checked').length > 0 ? 'shipping' : 'billing';
    214         return {
    215             address: this.getAddressStreet(prefix),
    216             city: this.getAddressCity(prefix)
    217         }
    218     }
    219     getAddressStreet(prefix) {
    220         const street1 = jQuery('#' + prefix + '_address_1');
    221         const street2 = jQuery('#' + prefix + '_address_2');
    222        
    223         return (street1 ? street1.val() : '') + (street2 && street2.val() ? ', ' + street2.val() : '');
    224     }
    225     getAddressCity(prefix) {
    226         const city = jQuery('#' + prefix + '_city');
    227         return city ? city.val() : null;
    228     }
    229211}
  • tabby-checkout/trunk/readme.txt

    r3447772 r3448736  
    44Requires at least: 5.7
    55Tested up to: 6.9
    6 Stable tag: 5.9.1
     6Stable tag: 5.9.2
    77Requires PHP: 7.0
    88License: GPLv3
     
    2828
    2929== Changelog ==
     30
     31= 5.9.2 =
     32
     33* Internal improvements and security hardening.
    3034
    3135= 5.9.1 =
  • tabby-checkout/trunk/tabby-checkout.php

    r3447772 r3448736  
    44 * Plugin URI: https://tabby.ai/
    55 * Description: Tabby Checkout
    6  * Version: 5.9.1
     6 * Version: 5.9.2
    77 * Author: Tabby
    88 * Author URI: https://tabby.ai
     
    1515defined( 'ABSPATH' ) || exit;
    1616
    17 define ('MODULE_TABBY_CHECKOUT_VERSION', '5.9.1');
     17define ('MODULE_TABBY_CHECKOUT_VERSION', '5.9.2');
    1818define ('TABBY_CHECKOUT_DOMAIN', 'checkout.tabby.ai');
    1919define ('TABBY_CHECKOUT_API_DOMAIN', 'api.tabby.ai');
Note: See TracChangeset for help on using the changeset viewer.