Changeset 3317578
- Timestamp:
- 06/25/2025 11:13:34 AM (9 months ago)
- Location:
- tabby-checkout
- Files:
-
- 6 edited
- 34 copied
-
tags/5.6.7 (copied) (copied from tabby-checkout/trunk)
-
tags/5.6.7/assets (copied) (copied from tabby-checkout/trunk/assets)
-
tags/5.6.7/assets/blocks/tabby-installments/index.js (copied) (copied from tabby-checkout/trunk/assets/blocks/tabby-installments/index.js)
-
tags/5.6.7/css (copied) (copied from tabby-checkout/trunk/css)
-
tags/5.6.7/css/tabby.css (copied) (copied from tabby-checkout/trunk/css/tabby.css)
-
tags/5.6.7/i18n (copied) (copied from tabby-checkout/trunk/i18n)
-
tags/5.6.7/i18n/languages/tabby-checkout-ar.mo (copied) (copied from tabby-checkout/trunk/i18n/languages/tabby-checkout-ar.mo)
-
tags/5.6.7/i18n/languages/tabby-checkout-ar.po (copied) (copied from tabby-checkout/trunk/i18n/languages/tabby-checkout-ar.po)
-
tags/5.6.7/i18n/languages/tabby-checkout.pot (copied) (copied from tabby-checkout/trunk/i18n/languages/tabby-checkout.pot)
-
tags/5.6.7/images (copied) (copied from tabby-checkout/trunk/images)
-
tags/5.6.7/includes (copied) (copied from tabby-checkout/trunk/includes)
-
tags/5.6.7/includes/class-wc-blocks-tabby-cart-promotion.php (copied) (copied from tabby-checkout/trunk/includes/class-wc-blocks-tabby-cart-promotion.php)
-
tags/5.6.7/includes/class-wc-blocks-tabby-installments.php (copied) (copied from tabby-checkout/trunk/includes/class-wc-blocks-tabby-installments.php)
-
tags/5.6.7/includes/class-wc-gateway-tabby-checkout-base.php (copied) (copied from tabby-checkout/trunk/includes/class-wc-gateway-tabby-checkout-base.php)
-
tags/5.6.7/includes/class-wc-gateway-tabby-credit-card-installments.php (copied) (copied from tabby-checkout/trunk/includes/class-wc-gateway-tabby-credit-card-installments.php)
-
tags/5.6.7/includes/class-wc-gateway-tabby-installments.php (copied) (copied from tabby-checkout/trunk/includes/class-wc-gateway-tabby-installments.php)
-
tags/5.6.7/includes/class-wc-rest-tabby-controller.php (copied) (copied from tabby-checkout/trunk/includes/class-wc-rest-tabby-controller.php)
-
tags/5.6.7/includes/class-wc-settings-tab-tabby.php (copied) (copied from tabby-checkout/trunk/includes/class-wc-settings-tab-tabby.php)
-
tags/5.6.7/includes/class-wc-tabby-ajax.php (copied) (copied from tabby-checkout/trunk/includes/class-wc-tabby-ajax.php)
-
tags/5.6.7/includes/class-wc-tabby-api-feed.php (copied) (copied from tabby-checkout/trunk/includes/class-wc-tabby-api-feed.php) (4 diffs)
-
tags/5.6.7/includes/class-wc-tabby-api.php (copied) (copied from tabby-checkout/trunk/includes/class-wc-tabby-api.php) (1 diff)
-
tags/5.6.7/includes/class-wc-tabby-config.php (copied) (copied from tabby-checkout/trunk/includes/class-wc-tabby-config.php)
-
tags/5.6.7/includes/class-wc-tabby-cron.php (copied) (copied from tabby-checkout/trunk/includes/class-wc-tabby-cron.php)
-
tags/5.6.7/includes/class-wc-tabby-feed-product-exception.php (copied) (copied from tabby-checkout/trunk/includes/class-wc-tabby-feed-product-exception.php)
-
tags/5.6.7/includes/class-wc-tabby-feed-product.php (copied) (copied from tabby-checkout/trunk/includes/class-wc-tabby-feed-product.php)
-
tags/5.6.7/includes/class-wc-tabby-feed-sharing.php (copied) (copied from tabby-checkout/trunk/includes/class-wc-tabby-feed-sharing.php)
-
tags/5.6.7/includes/class-wc-tabby-promo.php (copied) (copied from tabby-checkout/trunk/includes/class-wc-tabby-promo.php)
-
tags/5.6.7/includes/class-wc-tabby-webhook.php (copied) (copied from tabby-checkout/trunk/includes/class-wc-tabby-webhook.php) (3 diffs)
-
tags/5.6.7/includes/class-wc-tabby.php (copied) (copied from tabby-checkout/trunk/includes/class-wc-tabby.php) (3 diffs)
-
tags/5.6.7/js (copied) (copied from tabby-checkout/trunk/js)
-
tags/5.6.7/js/tabby.js (copied) (copied from tabby-checkout/trunk/js/tabby.js)
-
tags/5.6.7/log (copied) (copied from tabby-checkout/trunk/log)
-
tags/5.6.7/readme.txt (copied) (copied from tabby-checkout/trunk/readme.txt) (1 diff)
-
tags/5.6.7/tabby-checkout.php (copied) (copied from tabby-checkout/trunk/tabby-checkout.php) (2 diffs)
-
trunk/includes/class-wc-tabby-api-feed.php (modified) (4 diffs)
-
trunk/includes/class-wc-tabby-api.php (modified) (1 diff)
-
trunk/includes/class-wc-tabby-webhook.php (modified) (3 diffs)
-
trunk/includes/class-wc-tabby.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/tabby-checkout.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tabby-checkout/tags/5.6.7/includes/class-wc-tabby-api-feed.php
r3170834 r3317578 6 6 const TABBY_CHECKOUT_FEED_CRED_OPTION = 'tabby_checkout_feed_cred'; 7 7 const TABBY_CHECKOUT_FEED_REG_ATTEMPT = 'tabby_checkout_feed_reg_attempt'; 8 const TABBY_CHECKOUT_FEED_UNREG_ATTEMPT = 'tabby_checkout_feed_unreg_attempt'; 8 9 const TABBY_CHECKOUT_FEED_CODES = ['AE', 'SA', 'KW']; 9 10 … … 24 25 return true; 25 26 } 27 // check if there is previous uninstall attempt 28 if (time() < (int)get_option(self::TABBY_CHECKOUT_FEED_UNREG_ATTEMPT, 0)) { 29 // bypass request 30 return false; 31 } 26 32 $cred = json_decode(get_option(self::TABBY_CHECKOUT_FEED_CRED_OPTION, json_encode($this->getFeedCredentials())), true); 27 33 unset($cred['secretKey']); 28 34 $result = $this->request('uninstall', 'POST', $cred); 29 delete_option(self::TABBY_CHECKOUT_FEED_TOKEN_OPTION); 30 delete_option(self::TABBY_CHECKOUT_FEED_CRED_OPTION); 31 delete_option(self::TABBY_CHECKOUT_FEED_REG_ATTEMPT); 35 // successful 36 if (sizeof((array)$result) == 0) { 37 delete_option(self::TABBY_CHECKOUT_FEED_TOKEN_OPTION); 38 delete_option(self::TABBY_CHECKOUT_FEED_CRED_OPTION); 39 delete_option(self::TABBY_CHECKOUT_FEED_REG_ATTEMPT); 40 delete_option(self::TABBY_CHECKOUT_FEED_UNREG_ATTEMPT); 41 } else { 42 // unregister failed 43 update_option(self::TABBY_CHECKOUT_FEED_UNREG_ATTEMPT, time() + 2 * HOUR_IN_SECONDS); 44 } 32 45 33 46 return true; … … 35 48 public function register() { 36 49 // check if there is previous registration attempt 37 $reg_attempt_name = self::TABBY_CHECKOUT_FEED_REG_ATTEMPT; 38 if (time() < (int)get_option($reg_attempt_name, 0)) { 50 if (time() < (int)get_option(self::TABBY_CHECKOUT_FEED_REG_ATTEMPT, 0)) { 39 51 // bypass request 40 52 return false; … … 53 65 } else { 54 66 // registration failed - set transient to 4 hours 55 update_option( $reg_attempt_name, time() + 4 * HOUR_IN_SECONDS);67 update_option(self::TABBY_CHECKOUT_FEED_REG_ATTEMPT, time() + 4 * HOUR_IN_SECONDS); 56 68 57 69 // log site logo for failed registrations -
tabby-checkout/tags/5.6.7/includes/class-wc-tabby-api.php
r3287616 r3317578 76 76 switch ($response['response']['code']) { 77 77 case 200: 78 $result = json_decode($response["body"]) ;78 $result = json_decode($response["body"]) ?: new \StdClass(); 79 79 static::debug(['response - success data', (array)$result]); 80 80 break; 81 case 403: 82 if (substr(trim($response["body"]), 0, 15) == '<!DOCTYPE html>') { 83 static::ddlog('error', 'API html response detected', null, $logData); 84 } 81 85 default: 82 86 $body = $response["body"]; 83 87 $msg = "Server returned: " . $response['response']['code'] . '. '; 84 88 if (!empty($body)) { 85 $result = json_decode($body) ;89 $result = json_decode($body) ?: new \StdClass(); 86 90 if (!property_exists($result, 'error')) { 87 91 $result->error = ''; -
tabby-checkout/tags/5.6.7/includes/class-wc-tabby-webhook.php
r3157667 r3317578 5 5 public static function register() { 6 6 if (WC_Tabby_Api::needs_setup()) { 7 static::ddlog(" info", "Tabby is not configured, but webhook 'register' called. Possible first module installation.");7 static::ddlog("warn", "Tabby is not configured, but webhook 'register' called. Possible first module installation."); 8 8 return; 9 9 } … … 53 53 return WC_Tabby_Api::request('webhooks/' . $hook->id, 'PUT', $data, $code); 54 54 } 55 public static function deleteWebhook($hook, $code) { 56 static::ddlog("info", "Deleting webhook", null, $hook); 57 return WC_Tabby_Api::request('webhooks/' . $hook->id, 'DELETE', null, $code); 58 } 55 59 public static function getWebhooks($code) { 56 60 return WC_Tabby_Api::request('webhooks', 'GET', null, $code); … … 60 64 } 61 65 public static function unregister() { 66 if (WC_Tabby_Api::needs_setup()) { 67 static::ddlog("warn", "Tabby is not configured, but webhook 'unregister' called. Possible wrong module configuration."); 68 return; 69 } 70 // get webhook url 71 $url = WC_REST_Tabby_Controller::getEndpointUrl(); 72 static::ddlog("info", "unregister: Checking webhook is registered.", null, ['url' => $url]); 73 74 // request all webhooks 75 foreach (WC_Tabby_Config::ALLOWED_COUNTRIES as $country) { 76 // get list of registered hooks 77 $hooks = static::getWebhooks($country); 78 // bypass not authorized errors 79 if (static::isNotAuthorized($hooks)) { 80 static::ddlog("info", "unregister: Store code not authorized for merchant", null, ['code' => $country]); 81 continue; 82 } 83 if (!is_array($hooks)) { 84 $hooks = [$hooks]; 85 } 86 foreach ($hooks as $hook) { 87 if (!is_object($hook)) continue; 88 if (property_exists($hook, 'url') && $hook->url == $url && $hook->is_test === static::getIsTest()) { 89 static::deleteWebhook($hook, $country); 90 } 91 } 92 } 62 93 } 63 94 public static function ddlog($status = "error", $message = "Something went wrong", $e = null, $data = null) { -
tabby-checkout/tags/5.6.7/includes/class-wc-tabby.php
r3294207 r3317578 43 43 add_action('woocommerce_before_pay_action', array(__CLASS__, 'woocommerce_store_api_checkout_order_processed')); 44 44 45 // remove old payment methods from settings page 46 add_action('woocommerce_admin_field_payment_gateways', array(__CLASS__, 'woocommerce_admin_field_payment_gateways')); 45 47 } 48 49 public static function woocommerce_admin_field_payment_gateways() { 50 foreach (WC()->payment_gateways()->payment_gateways as $key => $gateway) { 51 switch (get_class($gateway)) { 52 case 'WC_Gateway_Tabby_Credit_Card_Installments': 53 case 'WC_Gateway_Tabby_PayLater': 54 unset (WC()->payment_gateways()->payment_gateways[$key]); 55 break; 56 } 57 } 58 } 59 46 60 public static function woocommerce_checkout_order_processed($order_id, $post_data, &$order) { 47 61 static::woocommerce_store_api_checkout_order_processed($order); … … 61 75 if ($transaction_id = (array_key_exists('transaction_id', $context->payment_data) ? $context->payment_data['transaction_id'] : false)) { 62 76 $gateway->update_order_payment_id($context->order, $transaction_id); 63 $res = $gateway->update_payment_reference_id($transaction_id, $context->order->get_id()); 77 $res = $gateway->update_payment_reference_id( 78 $transaction_id, 79 woocommerce_tabby_get_order_reference_id($context->order) 80 ); 64 81 if (is_object($res) && property_exists($res, 'status') && ($res->status != 'error')) { 65 82 $result->set_status('success'); … … 80 97 if ($order->get_transaction_id()) { 81 98 $gateway->update_order_payment_id($order, $order->get_transaction_id()); 82 $gateway->update_payment_reference_id($order->get_transaction_id(), $order->get_id()); 99 $gateway->update_payment_reference_id( 100 $order->get_transaction_id(), 101 woocommerce_tabby_get_order_reference_id($order) 102 ); 83 103 } 84 104 return $order; -
tabby-checkout/tags/5.6.7/readme.txt
r3294207 r3317578 4 4 Requires at least: 5.7 5 5 Tested up to: 6.8 6 Stable tag: 5.6. 26 Stable tag: 5.6.7 7 7 Requires PHP: 7.0 8 8 License: GPLv3 -
tabby-checkout/tags/5.6.7/tabby-checkout.php
r3294207 r3317578 4 4 * Plugin URI: https://tabby.ai/ 5 5 * Description: Tabby Checkout 6 * Version: 5.6. 26 * Version: 5.6.7 7 7 * Author: Tabby 8 8 * Author URI: https://tabby.ai … … 14 14 defined( 'ABSPATH' ) || exit; 15 15 16 define ('MODULE_TABBY_CHECKOUT_VERSION', '5.6. 2');16 define ('MODULE_TABBY_CHECKOUT_VERSION', '5.6.7'); 17 17 define ('TABBY_CHECKOUT_DOMAIN', 'checkout.tabby.ai'); 18 18 define ('TABBY_CHECKOUT_API_DOMAIN', 'api.tabby.ai'); -
tabby-checkout/trunk/includes/class-wc-tabby-api-feed.php
r3170834 r3317578 6 6 const TABBY_CHECKOUT_FEED_CRED_OPTION = 'tabby_checkout_feed_cred'; 7 7 const TABBY_CHECKOUT_FEED_REG_ATTEMPT = 'tabby_checkout_feed_reg_attempt'; 8 const TABBY_CHECKOUT_FEED_UNREG_ATTEMPT = 'tabby_checkout_feed_unreg_attempt'; 8 9 const TABBY_CHECKOUT_FEED_CODES = ['AE', 'SA', 'KW']; 9 10 … … 24 25 return true; 25 26 } 27 // check if there is previous uninstall attempt 28 if (time() < (int)get_option(self::TABBY_CHECKOUT_FEED_UNREG_ATTEMPT, 0)) { 29 // bypass request 30 return false; 31 } 26 32 $cred = json_decode(get_option(self::TABBY_CHECKOUT_FEED_CRED_OPTION, json_encode($this->getFeedCredentials())), true); 27 33 unset($cred['secretKey']); 28 34 $result = $this->request('uninstall', 'POST', $cred); 29 delete_option(self::TABBY_CHECKOUT_FEED_TOKEN_OPTION); 30 delete_option(self::TABBY_CHECKOUT_FEED_CRED_OPTION); 31 delete_option(self::TABBY_CHECKOUT_FEED_REG_ATTEMPT); 35 // successful 36 if (sizeof((array)$result) == 0) { 37 delete_option(self::TABBY_CHECKOUT_FEED_TOKEN_OPTION); 38 delete_option(self::TABBY_CHECKOUT_FEED_CRED_OPTION); 39 delete_option(self::TABBY_CHECKOUT_FEED_REG_ATTEMPT); 40 delete_option(self::TABBY_CHECKOUT_FEED_UNREG_ATTEMPT); 41 } else { 42 // unregister failed 43 update_option(self::TABBY_CHECKOUT_FEED_UNREG_ATTEMPT, time() + 2 * HOUR_IN_SECONDS); 44 } 32 45 33 46 return true; … … 35 48 public function register() { 36 49 // check if there is previous registration attempt 37 $reg_attempt_name = self::TABBY_CHECKOUT_FEED_REG_ATTEMPT; 38 if (time() < (int)get_option($reg_attempt_name, 0)) { 50 if (time() < (int)get_option(self::TABBY_CHECKOUT_FEED_REG_ATTEMPT, 0)) { 39 51 // bypass request 40 52 return false; … … 53 65 } else { 54 66 // registration failed - set transient to 4 hours 55 update_option( $reg_attempt_name, time() + 4 * HOUR_IN_SECONDS);67 update_option(self::TABBY_CHECKOUT_FEED_REG_ATTEMPT, time() + 4 * HOUR_IN_SECONDS); 56 68 57 69 // log site logo for failed registrations -
tabby-checkout/trunk/includes/class-wc-tabby-api.php
r3287616 r3317578 76 76 switch ($response['response']['code']) { 77 77 case 200: 78 $result = json_decode($response["body"]) ;78 $result = json_decode($response["body"]) ?: new \StdClass(); 79 79 static::debug(['response - success data', (array)$result]); 80 80 break; 81 case 403: 82 if (substr(trim($response["body"]), 0, 15) == '<!DOCTYPE html>') { 83 static::ddlog('error', 'API html response detected', null, $logData); 84 } 81 85 default: 82 86 $body = $response["body"]; 83 87 $msg = "Server returned: " . $response['response']['code'] . '. '; 84 88 if (!empty($body)) { 85 $result = json_decode($body) ;89 $result = json_decode($body) ?: new \StdClass(); 86 90 if (!property_exists($result, 'error')) { 87 91 $result->error = ''; -
tabby-checkout/trunk/includes/class-wc-tabby-webhook.php
r3157667 r3317578 5 5 public static function register() { 6 6 if (WC_Tabby_Api::needs_setup()) { 7 static::ddlog(" info", "Tabby is not configured, but webhook 'register' called. Possible first module installation.");7 static::ddlog("warn", "Tabby is not configured, but webhook 'register' called. Possible first module installation."); 8 8 return; 9 9 } … … 53 53 return WC_Tabby_Api::request('webhooks/' . $hook->id, 'PUT', $data, $code); 54 54 } 55 public static function deleteWebhook($hook, $code) { 56 static::ddlog("info", "Deleting webhook", null, $hook); 57 return WC_Tabby_Api::request('webhooks/' . $hook->id, 'DELETE', null, $code); 58 } 55 59 public static function getWebhooks($code) { 56 60 return WC_Tabby_Api::request('webhooks', 'GET', null, $code); … … 60 64 } 61 65 public static function unregister() { 66 if (WC_Tabby_Api::needs_setup()) { 67 static::ddlog("warn", "Tabby is not configured, but webhook 'unregister' called. Possible wrong module configuration."); 68 return; 69 } 70 // get webhook url 71 $url = WC_REST_Tabby_Controller::getEndpointUrl(); 72 static::ddlog("info", "unregister: Checking webhook is registered.", null, ['url' => $url]); 73 74 // request all webhooks 75 foreach (WC_Tabby_Config::ALLOWED_COUNTRIES as $country) { 76 // get list of registered hooks 77 $hooks = static::getWebhooks($country); 78 // bypass not authorized errors 79 if (static::isNotAuthorized($hooks)) { 80 static::ddlog("info", "unregister: Store code not authorized for merchant", null, ['code' => $country]); 81 continue; 82 } 83 if (!is_array($hooks)) { 84 $hooks = [$hooks]; 85 } 86 foreach ($hooks as $hook) { 87 if (!is_object($hook)) continue; 88 if (property_exists($hook, 'url') && $hook->url == $url && $hook->is_test === static::getIsTest()) { 89 static::deleteWebhook($hook, $country); 90 } 91 } 92 } 62 93 } 63 94 public static function ddlog($status = "error", $message = "Something went wrong", $e = null, $data = null) { -
tabby-checkout/trunk/includes/class-wc-tabby.php
r3294207 r3317578 43 43 add_action('woocommerce_before_pay_action', array(__CLASS__, 'woocommerce_store_api_checkout_order_processed')); 44 44 45 // remove old payment methods from settings page 46 add_action('woocommerce_admin_field_payment_gateways', array(__CLASS__, 'woocommerce_admin_field_payment_gateways')); 45 47 } 48 49 public static function woocommerce_admin_field_payment_gateways() { 50 foreach (WC()->payment_gateways()->payment_gateways as $key => $gateway) { 51 switch (get_class($gateway)) { 52 case 'WC_Gateway_Tabby_Credit_Card_Installments': 53 case 'WC_Gateway_Tabby_PayLater': 54 unset (WC()->payment_gateways()->payment_gateways[$key]); 55 break; 56 } 57 } 58 } 59 46 60 public static function woocommerce_checkout_order_processed($order_id, $post_data, &$order) { 47 61 static::woocommerce_store_api_checkout_order_processed($order); … … 61 75 if ($transaction_id = (array_key_exists('transaction_id', $context->payment_data) ? $context->payment_data['transaction_id'] : false)) { 62 76 $gateway->update_order_payment_id($context->order, $transaction_id); 63 $res = $gateway->update_payment_reference_id($transaction_id, $context->order->get_id()); 77 $res = $gateway->update_payment_reference_id( 78 $transaction_id, 79 woocommerce_tabby_get_order_reference_id($context->order) 80 ); 64 81 if (is_object($res) && property_exists($res, 'status') && ($res->status != 'error')) { 65 82 $result->set_status('success'); … … 80 97 if ($order->get_transaction_id()) { 81 98 $gateway->update_order_payment_id($order, $order->get_transaction_id()); 82 $gateway->update_payment_reference_id($order->get_transaction_id(), $order->get_id()); 99 $gateway->update_payment_reference_id( 100 $order->get_transaction_id(), 101 woocommerce_tabby_get_order_reference_id($order) 102 ); 83 103 } 84 104 return $order; -
tabby-checkout/trunk/readme.txt
r3294207 r3317578 4 4 Requires at least: 5.7 5 5 Tested up to: 6.8 6 Stable tag: 5.6. 26 Stable tag: 5.6.7 7 7 Requires PHP: 7.0 8 8 License: GPLv3 -
tabby-checkout/trunk/tabby-checkout.php
r3294207 r3317578 4 4 * Plugin URI: https://tabby.ai/ 5 5 * Description: Tabby Checkout 6 * Version: 5.6. 26 * Version: 5.6.7 7 7 * Author: Tabby 8 8 * Author URI: https://tabby.ai … … 14 14 defined( 'ABSPATH' ) || exit; 15 15 16 define ('MODULE_TABBY_CHECKOUT_VERSION', '5.6. 2');16 define ('MODULE_TABBY_CHECKOUT_VERSION', '5.6.7'); 17 17 define ('TABBY_CHECKOUT_DOMAIN', 'checkout.tabby.ai'); 18 18 define ('TABBY_CHECKOUT_API_DOMAIN', 'api.tabby.ai');
Note: See TracChangeset
for help on using the changeset viewer.