Plugin Directory

Changeset 3098715


Ignore:
Timestamp:
06/06/2024 02:00:26 PM (22 months ago)
Author:
tabbyai
Message:

Change Tabby promotion merchant code logic

Location:
tabby-checkout
Files:
5 edited
29 copied

Legend:

Unmodified
Added
Removed
  • tabby-checkout/tags/4.10.6/includes/class-wc-tabby-api.php

    r2927757 r3098715  
    7979            if (!empty($body)) {
    8080                $result = json_decode($body);
    81                 if (!property_exists($result, 'error')) $result->error = '';
     81                if (is_object($result) && property_exists($result, 'error')) {
     82                    $msg .= $result->errorType . ': ' . $result->error;
     83                };
    8284                static::debug(['response - body - ', (array)$result]);
    83                 $msg .= $result->errorType . ': ' . $result->error;
    8485            }
    8586            //wc_add_notice( __($msg), 'error');
  • tabby-checkout/tags/4.10.6/includes/class-wc-tabby-config.php

    r3019225 r3098715  
    3939        return in_array($sku, $disabled_skus);
    4040    }
     41    public static function getPromoMerchantCode() {
     42        $currency = self::getTabbyCurrency();
     43
     44        $merchantCode = self::ALLOWED_COUNTRIES[0];
     45        if (($index = array_search($currency, self::ALLOWED_CURRENCIES)) !== false) {
     46            $merchantCode = self::ALLOWED_COUNTRIES[$index];
     47        }
     48
     49        return $merchantCode;
     50    }
    4151}
  • tabby-checkout/tags/4.10.6/includes/class-wc-tabby-promo.php

    r3073241 r3098715  
    168168    }
    169169    public static function getMerchantCode() {
    170         return get_option('tabby_store_code', null) ?: null;
     170        return WC_Tabby_Config::getPromoMerchantCode();
    171171    }
    172172    public static function getPublicKey() {
  • tabby-checkout/tags/4.10.6/readme.txt

    r3073241 r3098715  
    44Requires at least: 5.7
    55Tested up to: 6.5
    6 Stable tag: 4.10.4
     6Stable tag: 4.10.6
    77Requires PHP: 7.0
    88License: GPLv3
     
    2828
    2929== Changelog ==
     30
     31= 4.10.6 =
     32
     33* Change Tabby promotion merchant code logic
    3034
    3135= 4.10.4 =
  • tabby-checkout/tags/4.10.6/tabby-checkout.php

    r3073241 r3098715  
    44 * Plugin URI: https://tabby.ai/
    55 * Description: Tabby Checkout
    6  * Version: 4.10.4
     6 * Version: 4.10.6
    77 * Author: Tabby
    88 * Author URI: https://tabby.ai
     
    1414defined( 'ABSPATH' ) || exit;
    1515
    16 define ('MODULE_TABBY_CHECKOUT_VERSION', '4.10.4');
     16define ('MODULE_TABBY_CHECKOUT_VERSION', '4.10.6');
    1717define ('TABBY_CHECKOUT_DOMAIN', 'checkout.tabby.ai');
    1818define ('TABBY_CHECKOUT_API_DOMAIN', 'api.tabby.ai');
  • tabby-checkout/trunk/includes/class-wc-tabby-api.php

    r2927757 r3098715  
    7979            if (!empty($body)) {
    8080                $result = json_decode($body);
    81                 if (!property_exists($result, 'error')) $result->error = '';
     81                if (is_object($result) && property_exists($result, 'error')) {
     82                    $msg .= $result->errorType . ': ' . $result->error;
     83                };
    8284                static::debug(['response - body - ', (array)$result]);
    83                 $msg .= $result->errorType . ': ' . $result->error;
    8485            }
    8586            //wc_add_notice( __($msg), 'error');
  • tabby-checkout/trunk/includes/class-wc-tabby-config.php

    r3019225 r3098715  
    3939        return in_array($sku, $disabled_skus);
    4040    }
     41    public static function getPromoMerchantCode() {
     42        $currency = self::getTabbyCurrency();
     43
     44        $merchantCode = self::ALLOWED_COUNTRIES[0];
     45        if (($index = array_search($currency, self::ALLOWED_CURRENCIES)) !== false) {
     46            $merchantCode = self::ALLOWED_COUNTRIES[$index];
     47        }
     48
     49        return $merchantCode;
     50    }
    4151}
  • tabby-checkout/trunk/includes/class-wc-tabby-promo.php

    r3073241 r3098715  
    168168    }
    169169    public static function getMerchantCode() {
    170         return get_option('tabby_store_code', null) ?: null;
     170        return WC_Tabby_Config::getPromoMerchantCode();
    171171    }
    172172    public static function getPublicKey() {
  • tabby-checkout/trunk/readme.txt

    r3073241 r3098715  
    44Requires at least: 5.7
    55Tested up to: 6.5
    6 Stable tag: 4.10.4
     6Stable tag: 4.10.6
    77Requires PHP: 7.0
    88License: GPLv3
     
    2828
    2929== Changelog ==
     30
     31= 4.10.6 =
     32
     33* Change Tabby promotion merchant code logic
    3034
    3135= 4.10.4 =
  • tabby-checkout/trunk/tabby-checkout.php

    r3073241 r3098715  
    44 * Plugin URI: https://tabby.ai/
    55 * Description: Tabby Checkout
    6  * Version: 4.10.4
     6 * Version: 4.10.6
    77 * Author: Tabby
    88 * Author URI: https://tabby.ai
     
    1414defined( 'ABSPATH' ) || exit;
    1515
    16 define ('MODULE_TABBY_CHECKOUT_VERSION', '4.10.4');
     16define ('MODULE_TABBY_CHECKOUT_VERSION', '4.10.6');
    1717define ('TABBY_CHECKOUT_DOMAIN', 'checkout.tabby.ai');
    1818define ('TABBY_CHECKOUT_API_DOMAIN', 'api.tabby.ai');
Note: See TracChangeset for help on using the changeset viewer.