Changeset 3157667
- Timestamp:
- 09/25/2024 02:34:51 PM (18 months ago)
- Location:
- tabby-checkout/trunk
- Files:
-
- 4 added
- 9 edited
-
assets/blocks/tabby-installments/index.js (modified) (2 diffs)
-
includes/class-wc-gateway-tabby-checkout-base.php (modified) (6 diffs)
-
includes/class-wc-settings-tab-tabby.php (modified) (2 diffs)
-
includes/class-wc-tabby-api-feed.php (added)
-
includes/class-wc-tabby-api.php (modified) (3 diffs)
-
includes/class-wc-tabby-config.php (modified) (3 diffs)
-
includes/class-wc-tabby-feed-product-exception.php (added)
-
includes/class-wc-tabby-feed-product.php (added)
-
includes/class-wc-tabby-feed-sharing.php (added)
-
includes/class-wc-tabby-webhook.php (modified) (1 diff)
-
includes/class-wc-tabby.php (modified) (5 diffs)
-
readme.txt (modified) (3 diffs)
-
tabby-checkout.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tabby-checkout/trunk/assets/blocks/tabby-installments/index.js
r3049660 r3157667 4 4 const registerPaymentMethod = window.wc.wcBlocksRegistry.registerPaymentMethod; 5 5 const getPaymentMethodData = window.wc.wcSettings.getPaymentMethodData; 6 const __ = window.wp.i18n.__; 6 7 7 8 const settings = getPaymentMethodData( 'tabby_installments', {} ); … … 80 81 }, 81 82 ariaLabel: title, 83 placeOrderButtonLabel: __( 84 'Proceed to Tabby', 85 'tabby-checkout' 86 ), 82 87 supports: { 83 88 features: settings?.supports ?? [] -
tabby-checkout/trunk/includes/class-wc-gateway-tabby-checkout-base.php
r3073241 r3157667 173 173 return $res; 174 174 } 175 public function get_order_total() { 175 public function get_order_total($order = null) { 176 if ($order) return (float)$order->get_total(); 176 177 return WC()->cart ? parent::get_order_total() : 0; 177 178 } … … 325 326 }; 326 327 $config = json_decode(static::getTabbyConfig(), true); 328 // show module on checkout if there is no email/phone entered 329 if (empty($config['buyer']['email']) || empty($config['buyer']['phone'])) { 330 return true; 331 } 327 332 $config['payment']['buyer'] = $this->getFrontBuyerObject(); 328 333 $config['payment']['order_history'] = WC_Tabby_AJAX::getOrderHistoryObject( … … 342 347 $is_available = false; 343 348 344 $sha256 = hash('sha256', json_encode($ request));349 $sha256 = hash('sha256', json_encode($this->get_cached_values($request))); 345 350 $tr_name = 'tabby_api_cache_' . $sha256; 346 351 … … 361 366 362 367 return $is_available; 368 } 369 370 protected function get_cached_values($request) { 371 return [ 372 "lang" => $request["lang"], 373 "merchant_code" => $request["merchant_code"], 374 "amount" => $request["payment"]["amount"], 375 "currency" => $request["payment"]["currency"], 376 "email" => $request["payment"]["buyer"]["email"], 377 "phone" => $request["payment"]["buyer"]["phone"] 378 ]; 363 379 } 364 380 … … 395 411 public function getPaymentObject($order) { 396 412 return [ 397 "amount" => $this->formatAmount($this->get_order_total( )),413 "amount" => $this->formatAmount($this->get_order_total($order)), 398 414 "currency" => WC_Tabby_Config::getTabbyCurrency(), 399 415 //"buyer_history" => $this->getBuyerHistoryObject(), … … 496 512 } else { 497 513 wc_add_notice( $redirect_url->get_error_message(), 'error' ); 498 return; 514 return [ 515 'result' => 'failure', 516 'message' => 'Sorry Tabby is unable to approve this purchase, please use an alternative payment method for your order.' 517 ]; 499 518 } 500 519 } catch (\Exception $e) { -
tabby-checkout/trunk/includes/class-wc-settings-tab-tabby.php
r3019225 r3157667 26 26 27 27 public static function tabby_update_settings() { 28 $share_feed_old = get_option('tabby_share_feed', 'yes'); 28 29 woocommerce_update_options( static::tabby_checkout_api_settings([], 'tabby_api') ); 29 30 WC_Tabby_Webhook::register(); 31 $share_feed_new = get_option('tabby_share_feed', 'yes'); 32 if ($share_feed_old !== 'yes' && $share_feed_new === 'yes') { 33 WC_Tabby_Feed_Sharing::register(); 34 }; 35 if ($share_feed_new !== 'yes') { 36 WC_Tabby_Feed_Sharing::unregister(); 37 }; 30 38 } 31 39 … … 65 73 'desc' => __( 'The following options are used to configure Tabby Checkout API', 'tabby-checkout' ), 66 74 'id' => 'tabby-checkout' 75 ); 76 $settings_tabby[] = array( 77 'name' => __( 'Share product feed with Tabby', 'tabby-checkout' ), 78 'id' => 'tabby_share_feed', 79 'type' => 'checkbox', 80 'default' => 'yes' 67 81 ); 68 82 $settings_tabby[] = array( -
tabby-checkout/trunk/includes/class-wc-tabby-api.php
r3098715 r3157667 79 79 if (!empty($body)) { 80 80 $result = json_decode($body); 81 if (is_object($result) && property_exists($result, 'error')) { 81 if (!property_exists($result, 'error')) { 82 $result->error = ''; 82 83 $msg .= $result->errorType . ': ' . $result->error; 83 } ;84 } 84 85 static::debug(['response - body - ', (array)$result]); 85 86 } … … 112 113 $storeURL = parse_url(get_site_url()); 113 114 115 $woo_dir = WP_PLUGIN_DIR . '/woocommerce/woocommerce.php'; 116 $woo_data = get_plugin_data($woo_dir); 117 114 118 $log = array( 115 119 "status" => $status, … … 117 121 118 122 "service" => "woo", 123 "sversion" => $woo_data['Version'], 119 124 "hostname" => $storeURL["host"], 120 125 -
tabby-checkout/trunk/includes/class-wc-tabby-config.php
r3098715 r3157667 5 5 const ALLOWED_COUNTRIES = [ 'AE', 'SA', 'BH', 'KW', 'QA']; 6 6 7 public static function getDefaultMerchantCode() { 8 $currency_code = static::getTabbyCurrency(); 9 10 if (($index = array_search($currency_code, static::ALLOWED_CURRENCIES)) !== false) { 11 return static::ALLOWED_COUNTRIES[$index]; 12 } 13 14 return 'default'; 15 } 7 16 public static function isAvailableForCountry($country_code) { 8 17 if (($allowed = static::getConfiguredCountries()) === false) { … … 13 22 public static function getConfiguredCountries() { 14 23 return get_option('tabby_countries', false); 24 } 25 public static function getShareFeed() { 26 return get_option('tabby_share_feed', 'yes') == 'yes'; 15 27 } 16 28 public static function isAvailableForCurrency($currency_code = null) { … … 36 48 } 37 49 public static function isDisabledForSKU($sku) { 38 $disabled_skus = array_filter(explode("\n", get_option('tabby_checkout_disable_for_sku', ''))); 50 $disabled_skus = array_map( 51 function ($item) {return trim($item);}, 52 array_filter(explode("\n", get_option('tabby_checkout_disable_for_sku', ''))) 53 ); 39 54 return in_array($sku, $disabled_skus); 40 55 } -
tabby-checkout/trunk/includes/class-wc-tabby-webhook.php
r2927757 r3157667 40 40 } 41 41 public static function isNotAuthorized($response) { 42 if (is_object($response) && property_exists($response, 'errorType') && $response->errorType == 'not_authorized') return true;42 if (is_object($response) && property_exists($response, 'errorType') && in_array($response->errorType, ['not_authorized', 'not_found'])) return true; 43 43 return false; 44 44 } -
tabby-checkout/trunk/includes/class-wc-tabby.php
r3049660 r3157667 10 10 WC_Tabby_Cron::init(); 11 11 WC_REST_Tabby_Controller::init(); 12 WC_Tabby_Feed_Sharing::init(); 12 13 13 14 static::init_methods(); … … 20 21 public static function init_methods() { 21 22 add_filter( 'woocommerce_payment_gateways', array(__CLASS__, 'add_checkout_methods')); 22 23 23 add_action( 'woocommerce_blocks_loaded', array(__CLASS__, 'woocommerce_blocks_support')); 24 25 24 } 26 25 public static function woocommerce_blocks_support() { … … 56 55 wp_schedule_single_event( time() + 60 , 'woocommerce_tabby_cancel_unpaid_orders' ); 57 56 WC_Tabby_Webhook::register(); 57 58 if (WC_Tabby_Config::getShareFeed()) { 59 WC_Tabby_Feed_Sharing::register(); 60 } 58 61 } 59 62 … … 61 64 wp_clear_scheduled_hook( 'woocommerce_tabby_cancel_unpaid_orders' ); 62 65 WC_Tabby_Webhook::unregister(); 66 67 if (WC_Tabby_Config::getShareFeed()) { 68 WC_Tabby_Feed_Sharing::unregister(); 69 } 63 70 } 64 71 … … 66 73 load_plugin_textdomain( 'tabby-checkout', false, plugin_basename( dirname(__DIR__) ) . '/i18n/languages' ); 67 74 } 68 69 75 } -
tabby-checkout/trunk/readme.txt
r3098715 r3157667 4 4 Requires at least: 5.7 5 5 Tested up to: 6.5 6 Stable tag: 4.10.66 Stable tag: 5.0.8 7 7 Requires PHP: 7.0 8 8 License: GPLv3 … … 28 28 29 29 == Changelog == 30 31 = 5.0.8 = 32 33 * Minor fixes 34 35 = 5.0.0 = 36 37 * New Product Catalogue Feature 30 38 31 39 = 4.10.6 = … … 201 209 If we share your personal information with our group companies or other third parties, we will take steps to protect your personal information in our contractual agreements with these third parties, and to require that they have appropriate technical and organisational security measures in place, in compliance with applicable data protection laws. 202 210 211 212 == Plugin Update: New Product Catalogue Feature == 213 We’ve introduced an exciting new feature to the Tabby WooCommerce plugin – the **Product Catalogue Feature**, designed to help you list your store’s products seamlessly on the Tabby Shop. Here are the advantages this feature brings to your business: 214 215 **Advantages:** 216 * **Automated Product Listing:** Easily list your entire WooCommerce store inventory on the Tabby Shop without manual intervention. 217 * **Real-Time Stock Updates:** Keep your product listings up-to-date effortlessly, as the plugin automatically syncs inventory availability and reflects out-of-stock items in real time. 218 * **Increased Visibility:** Showcase your products to a broader audience by making them visible to all Tabby app users. 219 * **Traffic Generation:** Drive interested shoppers directly to your WooCommerce store, increasing clicks and potential sales. 220 * **Simplified Setup:** The feature is enabled by default, so there’s nothing you need to do. If needed, you can manage it in the Tabby API settings by simply enabling or disabling the appropriate checkbox. 221 222 This feature helps you reach more shoppers and boost your store’s visibility through the Tabby platform. 223 203 224 == Tabby Promo == 204 225 Customers are not always aware of the different financing options available to them before they reach the checkout. Tabby promo helps your customers learn about the advantages and possibilities of alternative payment methods which has a great impact on the conversion rate and customers' awareness. -
tabby-checkout/trunk/tabby-checkout.php
r3098715 r3157667 4 4 * Plugin URI: https://tabby.ai/ 5 5 * Description: Tabby Checkout 6 * Version: 4.10.66 * Version: 5.0.8 7 7 * Author: Tabby 8 8 * Author URI: https://tabby.ai … … 14 14 defined( 'ABSPATH' ) || exit; 15 15 16 define ('MODULE_TABBY_CHECKOUT_VERSION', ' 4.10.6');16 define ('MODULE_TABBY_CHECKOUT_VERSION', '5.0.8'); 17 17 define ('TABBY_CHECKOUT_DOMAIN', 'checkout.tabby.ai'); 18 18 define ('TABBY_CHECKOUT_API_DOMAIN', 'api.tabby.ai'); 19 define ('TABBY_FEED_API_DOMAIN', 'plugins-api.tabby.ai'); 19 20 20 21 include 'includes/functions.php';
Note: See TracChangeset
for help on using the changeset viewer.