Changeset 3177834
- Timestamp:
- 10/29/2024 09:43:26 AM (17 months ago)
- Location:
- splitit-installment-payments
- Files:
-
- 1 added
- 11 edited
-
tags/4.2.2 (added)
-
trunk/CHANGELOG.md (modified) (2 diffs)
-
trunk/assets/js/admin.js (modified) (2 diffs)
-
trunk/classes/class-splitit-flexfields-payment-plugin-settings.php (modified) (2 diffs)
-
trunk/db/create-async-refund-log-table.php (modified) (1 diff)
-
trunk/db/create-log-table.php (modified) (1 diff)
-
trunk/db/create-order-data-with-ipn.php (modified) (1 diff)
-
trunk/db/create-transactions-tracking-table.php (modified) (4 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/splitIt-flexfields-payment-gateway.php (modified) (6 diffs)
-
trunk/template/flex-field-index.php (modified) (1 diff)
-
trunk/uninstall.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
splitit-installment-payments/trunk/CHANGELOG.md
r3158060 r3177834 3 3 All notable changes to this project will be documented in this file 4 4 - 5 6 ### 4.2.2 7 * Added compatibility for multisites 8 * Code improvements and bug fixes 9 * Tested compatibility with WordPress version 6.6.2 and Woocommerce version 9.3.3 5 10 6 11 ### 4.2.1 … … 134 139 ### 1.0.1 135 140 136 * Initial plugin release .141 * Initial plugin release -
splitit-installment-payments/trunk/assets/js/admin.js
r3149855 r3177834 439 439 $( '#woocommerce_splitit_splitit_environment' ).val( env ) 440 440 localStorage.setItem( 'environment', env ); 441 $( '#merchant_login' ).trigger( 'click' )441 document.getElementById('merchant_login').click(); 442 442 } 443 443 ); … … 1133 1133 if (connection && connection.closed) { 1134 1134 window.clearInterval( intervalId ); 1135 $( '[name="save"]' ).trigger( "click");1135 document.querySelector('[name="save"]').click(); 1136 1136 } 1137 1137 }, -
splitit-installment-payments/trunk/classes/class-splitit-flexfields-payment-plugin-settings.php
r3149855 r3177834 266 266 $action = wc_clean( $_GET['action'] ?? null ); 267 267 $post = wc_clean( $_GET['post'] ?? null ); 268 $id = wc_clean( $_GET['id'] ?? null ); 268 269 269 270 if ( $section == $plugin_id ) { … … 277 278 add_action( 'admin_footer', array( 'SplitIt_FlexFields_Payment_Plugin_Settings', 'wpb_hook_javascript' ) ); 278 279 279 if ( ( ! get_option( 'woocommerce_splitit_settings' ) || empty( get_option( 'woocommerce_splitit_settings' ) ) && 280 ( ! get_option( 'splitit_logged_user_data' ) ) || ! get_option( 'api_key' ) ) ) { 280 if ( ! get_option( 'splitit_logged_user_data' ) || ! get_option( 'api_key' ) ) { 281 281 add_action( 'admin_footer', array( 'SplitIt_FlexFields_Payment_Plugin_Settings', 'welcome_pop_up' ) ); 282 282 } 283 283 } 284 284 285 if ( 'edit' === $action && isset( $post) ) {285 if ( ( 'edit' === $action && isset( $post ) ) || ( 'edit' === $action && isset( $id ) ) ) { 286 286 add_action( 287 287 'admin_enqueue_scripts', -
splitit-installment-payments/trunk/db/create-async-refund-log-table.php
r3053263 r3177834 12 12 global $wpdb; 13 13 14 $table_name = $wpdb->prefix . 'splitit_async_refund_log'; 14 $log_data = array( 15 'user_id' => null, 16 'method' => __( 'splitit_flexfields_payment_plugin_create_async_refund_log_table() Splitit', 'splitit_ff_payment' ), 17 ); 15 18 16 $charset_collate = $wpdb->get_charset_collate(); 19 if ( is_multisite() ) { 20 $sites = get_sites(); 21 foreach ( $sites as $site ) { 22 switch_to_blog( $site->blog_id ); 17 23 18 $sql = ''; 19 if ( $wpdb->get_var( "show tables like '$table_name'" ) != $table_name ) { 24 $table_name = $wpdb->prefix . 'splitit_async_refund_log'; 20 25 21 SplitIt_FlexFields_Payment_Plugin_Log::log_to_file( 'Create_async_refund_log_table: ' . $table_name);26 $charset_collate = $wpdb->get_charset_collate(); 22 27 23 $sql = 'CREATE TABLE ' . $table_name . " ( 24 `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, 25 `user_id` bigint(20) unsigned DEFAULT NULL, 26 `order_id` bigint(20) unsigned DEFAULT NULL, 27 `ipn` varchar(255) DEFAULT NULL, 28 `refund_id` varchar(255) DEFAULT NULL, 29 `refund_amount` varchar(255) DEFAULT NULL, 30 `refund_reason` varchar(255) DEFAULT NULL, 31 `action_type` varchar(255) DEFAULT NULL, 32 `comment` varchar(255) DEFAULT NULL, 33 `updated_at` datetime NOT NULL, 34 PRIMARY KEY (`id`) 35 ) $charset_collate;"; 28 $sql = ''; 29 if ( $wpdb->get_var( "show tables like '$table_name'" ) != $table_name ) { 36 30 37 SplitIt_FlexFields_Payment_Plugin_Log::log_to_file( 'sql: ' . $sql ); 38 } 31 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, 'Create_async_refund_log_table: ' . $table_name, 'info' ); 39 32 40 if ( '' !== $sql ) { 41 require_once ABSPATH . 'wp-admin/includes/upgrade.php'; 42 dbDelta( $sql ); 43 } 33 $sql = 'CREATE TABLE ' . $table_name . " ( 34 `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, 35 `user_id` bigint(20) unsigned DEFAULT NULL, 36 `order_id` bigint(20) unsigned DEFAULT NULL, 37 `ipn` varchar(255) DEFAULT NULL, 38 `refund_id` varchar(255) DEFAULT NULL, 39 `refund_amount` varchar(255) DEFAULT NULL, 40 `refund_reason` varchar(255) DEFAULT NULL, 41 `action_type` varchar(255) DEFAULT NULL, 42 `comment` varchar(255) DEFAULT NULL, 43 `updated_at` datetime NOT NULL, 44 PRIMARY KEY (`id`) 45 ) $charset_collate;"; 44 46 45 if ( $wpdb->last_error ) { 46 SplitIt_FlexFields_Payment_Plugin_Log::log_to_file( 'create_async_refund_log_table Error: ' . $wpdb->last_error ); 47 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, 'create_async_refund_log_table sql: ' . $sql, 'info' ); 48 } 49 50 if ( '' !== $sql ) { 51 require_once ABSPATH . 'wp-admin/includes/upgrade.php'; 52 dbDelta( $sql ); 53 } 54 55 if ( $wpdb->last_error ) { 56 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, 'create_splitit_async_refund_log_table Error: ' . $wpdb->last_error, 'error' ); 57 } else { 58 if ( '' !== $sql ) { 59 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, 'splitit_async_refund_log_table successfully created', 'info' ); 60 } 61 } 62 63 restore_current_blog(); 64 } 47 65 } else { 66 $table_name = $wpdb->prefix . 'splitit_async_refund_log'; 67 68 $charset_collate = $wpdb->get_charset_collate(); 69 70 $sql = ''; 71 if ( $wpdb->get_var( "show tables like '$table_name'" ) != $table_name ) { 72 73 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, 'Create_async_refund_log_table: ' . $table_name, 'info' ); 74 75 $sql = 'CREATE TABLE ' . $table_name . " ( 76 `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, 77 `user_id` bigint(20) unsigned DEFAULT NULL, 78 `order_id` bigint(20) unsigned DEFAULT NULL, 79 `ipn` varchar(255) DEFAULT NULL, 80 `refund_id` varchar(255) DEFAULT NULL, 81 `refund_amount` varchar(255) DEFAULT NULL, 82 `refund_reason` varchar(255) DEFAULT NULL, 83 `action_type` varchar(255) DEFAULT NULL, 84 `comment` varchar(255) DEFAULT NULL, 85 `updated_at` datetime NOT NULL, 86 PRIMARY KEY (`id`) 87 ) $charset_collate;"; 88 89 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, 'create_async_refund_log_table sql: ' . $sql, 'info' ); 90 } 91 48 92 if ( '' !== $sql ) { 49 SplitIt_FlexFields_Payment_Plugin_Log::log_to_file( 'create_async_refund_log_table successfully created' ); 93 require_once ABSPATH . 'wp-admin/includes/upgrade.php'; 94 dbDelta( $sql ); 95 } 96 97 if ( $wpdb->last_error ) { 98 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, 'create_splitit_async_refund_log_table Error: ' . $wpdb->last_error, 'error' ); 99 } else { 100 if ( '' !== $sql ) { 101 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, 'splitit_async_refund_log_table successfully created', 'info' ); 102 } 50 103 } 51 104 } -
splitit-installment-payments/trunk/db/create-log-table.php
r2628150 r3177834 7 7 */ 8 8 9 require_once dirname( __DIR__ ) . '/classes/class-splitit-flexfields-payment-plugin-log.php'; 10 9 11 function splitit_flexfields_payment_plugin_create_log_table() { 10 12 global $wpdb; 11 13 12 $table_name = $wpdb->prefix . 'splitit_log'; 14 $log_data = array( 15 'user_id' => null, 16 'method' => __( 'splitit_flexfields_payment_plugin_create_log_table() Splitit', 'splitit_ff_payment' ), 17 ); 13 18 14 $charset_collate = $wpdb->get_charset_collate(); 19 if ( is_multisite() ) { 20 $sites = get_sites(); 21 foreach ( $sites as $site ) { 22 switch_to_blog( $site->blog_id ); 15 23 16 $sql = ''; 17 if ( $wpdb->get_var( "show tables like '$table_name'" ) != $table_name ) { 18 $sql = "CREATE TABLE $table_name ( 19 id bigint(20) unsigned NOT NULL AUTO_INCREMENT, 20 user_id bigint(20) unsigned NULL DEFAULT NULL, 21 method varchar(191) DEFAULT NULL NULL, 22 message TEXT DEFAULT NULL NULL, 23 date datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, 24 FOREIGN KEY (user_id) REFERENCES " . $wpdb->prefix . "users(ID) ON DELETE CASCADE, 25 PRIMARY KEY (id) 26 ) $charset_collate;"; 24 $table_name = $wpdb->prefix . 'splitit_log'; 25 26 $charset_collate = $wpdb->get_charset_collate(); 27 28 if ( $wpdb->get_var( "SHOW TABLES LIKE '$table_name'" ) != $table_name ) { 29 30 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, 'Create_splitit_log_table: ' . $table_name, 'info' ); 31 32 $sql = "CREATE TABLE $table_name ( 33 id bigint(20) unsigned NOT NULL AUTO_INCREMENT, 34 user_id bigint(20) unsigned NULL DEFAULT NULL, 35 method varchar(191) DEFAULT NULL NULL, 36 message TEXT DEFAULT NULL NULL, 37 date datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, 38 FOREIGN KEY (user_id) REFERENCES " . $wpdb->base_prefix . "users(ID) ON DELETE CASCADE, 39 PRIMARY KEY (id) 40 ) $charset_collate;"; 41 42 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, 'create_splitit_log_table sql: ' . $sql, 'info' ); 43 44 require_once ABSPATH . 'wp-admin/includes/upgrade.php'; 45 dbDelta( $sql ); 46 47 if ( $wpdb->last_error ) { 48 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, 'create_splitit_log_table Error: ' . $wpdb->last_error, 'error' ); 49 } else { 50 if ( '' !== $sql ) { 51 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, 'splitit_log_table successfully created', 'info' ); 52 } 53 } 54 } 55 56 restore_current_blog(); 57 } 58 } else { 59 $table_name = $wpdb->prefix . 'splitit_log'; 60 61 $charset_collate = $wpdb->get_charset_collate(); 62 63 if ( $wpdb->get_var( "SHOW TABLES LIKE '$table_name'" ) != $table_name ) { 64 65 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, 'Create_splitit_log_table: ' . $table_name, 'info' ); 66 67 $sql = "CREATE TABLE $table_name ( 68 id bigint(20) unsigned NOT NULL AUTO_INCREMENT, 69 user_id bigint(20) unsigned NULL DEFAULT NULL, 70 method varchar(191) DEFAULT NULL NULL, 71 message TEXT DEFAULT NULL NULL, 72 date datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, 73 FOREIGN KEY (user_id) REFERENCES " . $wpdb->base_prefix . "users(ID) ON DELETE CASCADE, 74 PRIMARY KEY (id) 75 ) $charset_collate;"; 76 77 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, 'create_splitit_log_table sql: ' . $sql, 'info' ); 78 79 require_once ABSPATH . 'wp-admin/includes/upgrade.php'; 80 dbDelta( $sql ); 81 82 if ( $wpdb->last_error ) { 83 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, 'create_splitit_log_table Error: ' . $wpdb->last_error, 'error' ); 84 } else { 85 if ( '' !== $sql ) { 86 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, 'splitit_log_table successfully created', 'info' ); 87 } 88 } 89 } 27 90 } 28 29 require_once ABSPATH . 'wp-admin/includes/upgrade.php';30 dbDelta( $sql );31 91 } -
splitit-installment-payments/trunk/db/create-order-data-with-ipn.php
r2628150 r3177834 7 7 */ 8 8 9 require_once dirname( __DIR__ ) . '/classes/class-splitit-flexfields-payment-plugin-log.php'; 10 9 11 function splitit_flexfields_payment_plugin_create_log_create_order_data_with_ipn() { 10 12 global $wpdb; 11 13 12 $table_name = $wpdb->prefix . 'splitit_order_data_with_ipn'; 14 $log_data = array( 15 'user_id' => null, 16 'method' => __( 'splitit_flexfields_payment_plugin_create_log_create_order_data_with_ipn() Splitit', 'splitit_ff_payment' ), 17 ); 13 18 14 $charset_collate = $wpdb->get_charset_collate(); 19 if ( is_multisite() ) { 20 $sites = get_sites(); 21 foreach ( $sites as $site ) { 22 switch_to_blog( $site->blog_id ); 15 23 16 $sql = ''; 17 if ( $wpdb->get_var( "show tables like '$table_name'" ) != $table_name ) { 18 $sql = 'CREATE TABLE ' . $table_name . " ( 19 `id` int(11) NOT NULL AUTO_INCREMENT, 20 `user_id` int(11) DEFAULT 0, 21 `shipping_method_cost` varchar(255) DEFAULT NULL, 22 `shipping_method_title` varchar(255) DEFAULT NULL, 23 `shipping_method_id` varchar(255) DEFAULT NULL, 24 `coupon_amount` varchar(255) DEFAULT NULL, 25 `coupon_code` varchar(255) DEFAULT NULL, 26 `tax_amount` varchar(255) DEFAULT NULL, 27 `set_shipping_total` varchar(255) DEFAULT NULL, 28 `set_discount_total` varchar(255) DEFAULT NULL, 29 `set_discount_tax` varchar(255) DEFAULT NULL, 30 `set_cart_tax` varchar(255) DEFAULT NULL, 31 `set_shipping_tax` varchar(255) DEFAULT NULL, 32 `set_total` varchar(255) DEFAULT NULL, 33 `wc_cart` TEXT, 34 `get_packages` TEXT, 35 `chosen_shipping_methods_data` TEXT, 36 `ipn` varchar(255) DEFAULT NULL, 37 `session_id` varchar(255) DEFAULT NULL, 38 `user_data` TEXT, 39 `cart_items` TEXT, 40 `updated_at` datetime NOT NULL, 41 PRIMARY KEY (`id`) 42 ) $charset_collate;"; 24 $table_name = $wpdb->prefix . 'splitit_order_data_with_ipn'; 25 26 $charset_collate = $wpdb->get_charset_collate(); 27 28 $sql = ''; 29 if ( $wpdb->get_var( "show tables like '$table_name'" ) != $table_name ) { 30 31 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, 'Create_splitit_order_data_with_ipn_table: ' . $table_name, 'info' ); 32 33 $sql = 'CREATE TABLE ' . $table_name . " ( 34 `id` int(11) NOT NULL AUTO_INCREMENT, 35 `user_id` int(11) DEFAULT 0, 36 `shipping_method_cost` varchar(255) DEFAULT NULL, 37 `shipping_method_title` varchar(255) DEFAULT NULL, 38 `shipping_method_id` varchar(255) DEFAULT NULL, 39 `coupon_amount` varchar(255) DEFAULT NULL, 40 `coupon_code` varchar(255) DEFAULT NULL, 41 `tax_amount` varchar(255) DEFAULT NULL, 42 `set_shipping_total` varchar(255) DEFAULT NULL, 43 `set_discount_total` varchar(255) DEFAULT NULL, 44 `set_discount_tax` varchar(255) DEFAULT NULL, 45 `set_cart_tax` varchar(255) DEFAULT NULL, 46 `set_shipping_tax` varchar(255) DEFAULT NULL, 47 `set_total` varchar(255) DEFAULT NULL, 48 `wc_cart` TEXT, 49 `get_packages` TEXT, 50 `chosen_shipping_methods_data` TEXT, 51 `ipn` varchar(255) DEFAULT NULL, 52 `session_id` varchar(255) DEFAULT NULL, 53 `user_data` TEXT, 54 `cart_items` TEXT, 55 `updated_at` datetime NOT NULL, 56 PRIMARY KEY (`id`) 57 ) $charset_collate;"; 58 59 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, 'create_splitit_order_data_with_ipn_table sql: ' . $sql, 'info' ); 60 } 61 62 require_once ABSPATH . 'wp-admin/includes/upgrade.php'; 63 dbDelta( $sql ); 64 65 if ( $wpdb->last_error ) { 66 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, 'create_splitit_order_data_with_ipn_table Error: ' . $wpdb->last_error, 'error' ); 67 } else { 68 if ( '' !== $sql ) { 69 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, 'splitit_order_data_with_ipn_table successfully created', 'info' ); 70 } 71 } 72 73 restore_current_blog(); 74 } 75 } else { 76 $table_name = $wpdb->prefix . 'splitit_order_data_with_ipn'; 77 78 $charset_collate = $wpdb->get_charset_collate(); 79 80 $sql = ''; 81 if ( $wpdb->get_var( "show tables like '$table_name'" ) != $table_name ) { 82 83 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, 'Create_splitit_order_data_with_ipn_table: ' . $table_name, 'info' ); 84 85 $sql = 'CREATE TABLE ' . $table_name . " ( 86 `id` int(11) NOT NULL AUTO_INCREMENT, 87 `user_id` int(11) DEFAULT 0, 88 `shipping_method_cost` varchar(255) DEFAULT NULL, 89 `shipping_method_title` varchar(255) DEFAULT NULL, 90 `shipping_method_id` varchar(255) DEFAULT NULL, 91 `coupon_amount` varchar(255) DEFAULT NULL, 92 `coupon_code` varchar(255) DEFAULT NULL, 93 `tax_amount` varchar(255) DEFAULT NULL, 94 `set_shipping_total` varchar(255) DEFAULT NULL, 95 `set_discount_total` varchar(255) DEFAULT NULL, 96 `set_discount_tax` varchar(255) DEFAULT NULL, 97 `set_cart_tax` varchar(255) DEFAULT NULL, 98 `set_shipping_tax` varchar(255) DEFAULT NULL, 99 `set_total` varchar(255) DEFAULT NULL, 100 `wc_cart` TEXT, 101 `get_packages` TEXT, 102 `chosen_shipping_methods_data` TEXT, 103 `ipn` varchar(255) DEFAULT NULL, 104 `session_id` varchar(255) DEFAULT NULL, 105 `user_data` TEXT, 106 `cart_items` TEXT, 107 `updated_at` datetime NOT NULL, 108 PRIMARY KEY (`id`) 109 ) $charset_collate;"; 110 111 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, 'create_splitit_order_data_with_ipn_table sql: ' . $sql, 'info' ); 112 } 113 114 require_once ABSPATH . 'wp-admin/includes/upgrade.php'; 115 dbDelta( $sql ); 116 117 if ( $wpdb->last_error ) { 118 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, 'create_splitit_order_data_with_ipn_table Error: ' . $wpdb->last_error, 'error' ); 119 } else { 120 if ( '' !== $sql ) { 121 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, 'splitit_order_data_with_ipn_table successfully created', 'info' ); 122 } 123 } 43 124 } 44 45 require_once ABSPATH . 'wp-admin/includes/upgrade.php';46 dbDelta( $sql );47 125 } -
splitit-installment-payments/trunk/db/create-transactions-tracking-table.php
r3053263 r3177834 12 12 global $wpdb; 13 13 14 $table_name = $wpdb->prefix . 'splitit_transactions_log'; 14 $log_data = array( 15 'user_id' => null, 16 'method' => __( 'splitit_flexfields_payment_plugin_create_transactions_tracking_table() Splitit', 'splitit_ff_payment' ), 17 ); 15 18 16 SplitIt_FlexFields_Payment_Plugin_Log::log_to_file( 'create_transactions_log_table: ' . $table_name ); 17 SplitIt_FlexFields_Payment_Plugin_Log::log_to_file( 'table_from_db: ' . json_encode( $wpdb->get_var( "show tables like '$table_name'" ) ) ); 19 if ( is_multisite() ) { 20 $sites = get_sites(); 21 foreach ( $sites as $site ) { 22 switch_to_blog( $site->blog_id ); 18 23 19 $charset_collate = $wpdb->get_charset_collate();24 $table_name = $wpdb->prefix . 'splitit_transactions_log'; 20 25 21 $sql = '';22 if ( $wpdb->get_var( "show tables like '$table_name'" ) != $table_name ) {26 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, 'Create_splitit_transactions_log: ' . $table_name, 'info' ); 27 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, 'table_from_db: ' . json_encode( $wpdb->get_var( "show tables like '$table_name'" ) ), 'info' ); 23 28 24 SplitIt_FlexFields_Payment_Plugin_Log::log_to_file( 'try to create');29 $charset_collate = $wpdb->get_charset_collate(); 25 30 26 $sql = "CREATE TABLE $table_name ( 27 id bigint(20) unsigned NOT NULL AUTO_INCREMENT, 28 user_id bigint(20) unsigned NULL DEFAULT NULL, 29 order_id bigint(20) unsigned NULL DEFAULT NULL, 30 installment_plan_number varchar(100) DEFAULT NULL NULL, 31 number_of_installments varchar(100) DEFAULT NULL NULL, 32 processing varchar(50) DEFAULT NULL NULL, 33 plan_create_succeed tinyint(4) NOT NULL DEFAULT 0, 34 date datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, 35 FOREIGN KEY (user_id) REFERENCES " . $wpdb->prefix . 'users(ID) ON DELETE CASCADE, 36 FOREIGN KEY (order_id) REFERENCES ' . $wpdb->prefix . "posts(ID) ON DELETE CASCADE, 37 PRIMARY KEY (id) 38 ) $charset_collate;"; 39 } 31 $sql = ''; 32 if ( $wpdb->get_var( "show tables like '$table_name'" ) != $table_name ) { 40 33 41 SplitIt_FlexFields_Payment_Plugin_Log::log_to_file( 'sql: ' . $sql);34 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, 'try to Create_splitit_transactions_log: ' . $table_name, 'info' ); 42 35 43 require_once ABSPATH . 'wp-admin/includes/upgrade.php'; 44 dbDelta( $sql ); 36 $sql = "CREATE TABLE $table_name ( 37 id bigint(20) unsigned NOT NULL AUTO_INCREMENT, 38 user_id bigint(20) unsigned NULL DEFAULT NULL, 39 order_id bigint(20) unsigned NULL DEFAULT NULL, 40 installment_plan_number varchar(100) DEFAULT NULL NULL, 41 number_of_installments varchar(100) DEFAULT NULL NULL, 42 processing varchar(50) DEFAULT NULL NULL, 43 plan_create_succeed tinyint(4) NOT NULL DEFAULT 0, 44 date datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, 45 FOREIGN KEY (user_id) REFERENCES " . $wpdb->base_prefix . 'users(ID) ON DELETE CASCADE, 46 FOREIGN KEY (order_id) REFERENCES ' . $wpdb->prefix . "posts(ID) ON DELETE CASCADE, 47 PRIMARY KEY (id) 48 ) $charset_collate;"; 49 } 45 50 46 if ( $wpdb->last_error ) { 47 SplitIt_FlexFields_Payment_Plugin_Log::log_to_file( 'create_transactions_log_table failed. Error: ' . $wpdb->last_error ); 51 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, 'Create_splitit_transactions_log sql: ' . $sql, 'info' ); 48 52 49 // let's try it again with different parameters.50 SplitIt_FlexFields_Payment_Plugin_Log::log_to_file( '2 attempt create_transactions_log_table: ' . $table_name);53 require_once ABSPATH . 'wp-admin/includes/upgrade.php'; 54 dbDelta( $sql ); 51 55 52 $charset_collate = 'ENGINE=MyISAM ' . $wpdb->get_charset_collate(); 56 if ( $wpdb->last_error ) { 57 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, 'create_transactions_log_table failed. Error: ' . $wpdb->last_error, 'error' ); 58 59 // let's try it again with different parameters. 60 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, '2 attempt create_transactions_log_table: ' . $table_name, 'info' ); 61 62 $charset_collate = 'ENGINE=MyISAM ' . $wpdb->get_charset_collate(); 63 64 $sql = ''; 65 if ( $wpdb->get_var( "show tables like '$table_name'" ) != $table_name ) { 66 67 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, '2 attempt try to create transactions_log_table: ' . $table_name, 'info' ); 68 69 $sql = "CREATE TABLE $table_name ( 70 id bigint(20) unsigned NOT NULL AUTO_INCREMENT, 71 user_id bigint(20) unsigned NULL DEFAULT NULL, 72 order_id bigint(20) unsigned NULL DEFAULT NULL, 73 installment_plan_number varchar(100) DEFAULT NULL NULL, 74 number_of_installments varchar(100) DEFAULT NULL NULL, 75 processing varchar(50) DEFAULT NULL NULL, 76 plan_create_succeed tinyint(4) NOT NULL DEFAULT 0, 77 date datetime DEFAULT CURRENT_TIMESTAMP NOT NULL, 78 FOREIGN KEY (user_id) REFERENCES " . $wpdb->base_prefix . 'users(ID) ON DELETE CASCADE, 79 FOREIGN KEY (order_id) REFERENCES ' . $wpdb->prefix . "posts(ID) ON DELETE CASCADE, 80 PRIMARY KEY (id) 81 ) $charset_collate;"; 82 } 83 84 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, '2 attempt sql: ' . $sql, 'info' ); 85 86 require_once ABSPATH . 'wp-admin/includes/upgrade.php'; 87 dbDelta( $sql ); 88 89 if ( $wpdb->last_error ) { 90 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, '2 attempt create_transactions_log_table failed. Error: ' . $wpdb->last_error, 'error' ); 91 } else { 92 $ms = '' === $sql ? '2 attempt create_transactions_log_table already exist' : '2 attempt create_transactions_log_table successfully created'; 93 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, $ms, 'info' ); 94 } 95 } else { 96 $ms = '' === $sql ? 'create_transactions_log_table already exist' : 'create_transactions_log_table successfully created'; 97 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, $ms, 'info' ); 98 } 99 100 restore_current_blog(); 101 } 102 } else { 103 $table_name = $wpdb->prefix . 'splitit_transactions_log'; 104 105 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, 'Create_splitit_transactions_log: ' . $table_name, 'info' ); 106 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, 'table_from_db: ' . json_encode( $wpdb->get_var( "show tables like '$table_name'" ) ), 'info' ); 107 108 $charset_collate = $wpdb->get_charset_collate(); 53 109 54 110 $sql = ''; 55 111 if ( $wpdb->get_var( "show tables like '$table_name'" ) != $table_name ) { 56 112 57 SplitIt_FlexFields_Payment_Plugin_Log:: log_to_file('2 attempt try to create');113 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, 'try to Create_splitit_transactions_log: ' . $table_name, 'info' ); 58 114 59 115 $sql = "CREATE TABLE $table_name ( … … 65 121 processing varchar(50) DEFAULT NULL NULL, 66 122 plan_create_succeed tinyint(4) NOT NULL DEFAULT 0, 67 date datetime DEFAULT CURRENT_TIMESTAMPNOT NULL,68 FOREIGN KEY (user_id) REFERENCES " . $wpdb-> prefix . 'users(ID) ON DELETE CASCADE,123 date datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, 124 FOREIGN KEY (user_id) REFERENCES " . $wpdb->base_prefix . 'users(ID) ON DELETE CASCADE, 69 125 FOREIGN KEY (order_id) REFERENCES ' . $wpdb->prefix . "posts(ID) ON DELETE CASCADE, 70 126 PRIMARY KEY (id) … … 72 128 } 73 129 74 SplitIt_FlexFields_Payment_Plugin_Log:: log_to_file( '2 attempt sql: ' . $sql);130 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, 'Create_splitit_transactions_log sql: ' . $sql, 'info' ); 75 131 76 132 require_once ABSPATH . 'wp-admin/includes/upgrade.php'; … … 78 134 79 135 if ( $wpdb->last_error ) { 80 SplitIt_FlexFields_Payment_Plugin_Log::log_to_file( '2 attempt create_transactions_log_table failed. Error: ' . $wpdb->last_error ); 136 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, 'create_transactions_log_table failed. Error: ' . $wpdb->last_error, 'error' ); 137 138 // let's try it again with different parameters. 139 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, '2 attempt create_transactions_log_table: ' . $table_name, 'info' ); 140 141 $charset_collate = 'ENGINE=MyISAM ' . $wpdb->get_charset_collate(); 142 143 $sql = ''; 144 if ( $wpdb->get_var( "show tables like '$table_name'" ) != $table_name ) { 145 146 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, '2 attempt try to create transactions_log_table: ' . $table_name, 'info' ); 147 148 $sql = "CREATE TABLE $table_name ( 149 id bigint(20) unsigned NOT NULL AUTO_INCREMENT, 150 user_id bigint(20) unsigned NULL DEFAULT NULL, 151 order_id bigint(20) unsigned NULL DEFAULT NULL, 152 installment_plan_number varchar(100) DEFAULT NULL NULL, 153 number_of_installments varchar(100) DEFAULT NULL NULL, 154 processing varchar(50) DEFAULT NULL NULL, 155 plan_create_succeed tinyint(4) NOT NULL DEFAULT 0, 156 date datetime DEFAULT CURRENT_TIMESTAMP NOT NULL, 157 FOREIGN KEY (user_id) REFERENCES " . $wpdb->base_prefix . 'users(ID) ON DELETE CASCADE, 158 FOREIGN KEY (order_id) REFERENCES ' . $wpdb->prefix . "posts(ID) ON DELETE CASCADE, 159 PRIMARY KEY (id) 160 ) $charset_collate;"; 161 } 162 163 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, '2 attempt sql: ' . $sql, 'info' ); 164 165 require_once ABSPATH . 'wp-admin/includes/upgrade.php'; 166 dbDelta( $sql ); 167 168 if ( $wpdb->last_error ) { 169 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, '2 attempt create_transactions_log_table failed. Error: ' . $wpdb->last_error, 'error' ); 170 } else { 171 $ms = '' === $sql ? '2 attempt create_transactions_log_table already exist' : '2 attempt create_transactions_log_table successfully created'; 172 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, $ms, 'info' ); 173 } 81 174 } else { 82 $ms = '' === $sql ? ' 2 attempt create_transactions_log_table already exist' : '2 attemptcreate_transactions_log_table successfully created';83 SplitIt_FlexFields_Payment_Plugin_Log:: log_to_file( $ms);175 $ms = '' === $sql ? 'create_transactions_log_table already exist' : 'create_transactions_log_table successfully created'; 176 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $log_data, $ms, 'info' ); 84 177 } 85 } else {86 $ms = '' === $sql ? 'create_transactions_log_table already exist' : 'create_transactions_log_table successfully created';87 SplitIt_FlexFields_Payment_Plugin_Log::log_to_file( $ms );88 178 } 89 179 } -
splitit-installment-payments/trunk/readme.txt
r3149855 r3177834 3 3 Tags: ecommerce, e-commerce, checkout, payment, Splitit 4 4 Requires at least: 5.6 5 Tested up to: 6.6. 15 Tested up to: 6.6.2 6 6 WC requires at least: 5.5 7 WC tested up to: 9. 1.48 Stable tag: 4.2. 17 WC tested up to: 9.3.3 8 Stable tag: 4.2.2 9 9 License: GPLv3 10 10 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 61 61 62 62 == Changelog == 63 64 = 4.2.2 - 2024-10-29 = 65 Added compatibility for multisites 66 Code improvements and bug fixes 67 Tested compatibility with WordPress version 6.6.2 and Woocommerce version 9.3.3 63 68 64 69 = 4.2.1 - 2024-09-11 = -
splitit-installment-payments/trunk/splitIt-flexfields-payment-gateway.php
r3149855 r3177834 10 10 * Author: Splitit 11 11 * Author URI: https://www.splitit.com/ 12 * Version: 4.2. 112 * Version: 4.2.2 13 13 */ 14 14 … … 24 24 25 25 global $plugin_version; 26 $plugin_version = '4.2. 1';26 $plugin_version = '4.2.2'; 27 27 28 28 global $required_splitit_php_version; … … 244 244 require_once 'db/create-transactions-tracking-table.php'; 245 245 require_once 'db/create-order-data-with-ipn.php'; 246 247 //for async refunds 248 require_once 'db/create-async-refund-log-table.php'; 246 require_once 'db/create-async-refund-log-table.php'; //for async refunds 249 247 250 248 /* … … 262 260 if ( function_exists( 'splitit_flexfields_payment_plugin_create_async_refund_log_table' ) ) { 263 261 register_activation_hook( __FILE__, 'splitit_flexfields_payment_plugin_create_async_refund_log_table' ); 264 add_action( 'admin_init', 'splitit_flexfields_payment_plugin_create_async_refund_log_table' );265 262 } 266 263 … … 650 647 } 651 648 } else { 652 throw new Exception( __( 'Order with this status cannot be refunded, only cancelled', 'splitit_ff_payment' ));649 return new WP_Error( 'error', "Order with this status cannot be refunded, only cancelled." ); 653 650 } 654 651 } … … 661 658 ); 662 659 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $data, $e->getMessage(), 'error' ); 663 SplitIt_FlexFields_Payment_Plugin_Settings::update_order_status_to_old( wc_get_order( $order_id ) ); 660 661 try { 662 $order = wc_get_order( $order_id ); 663 if ($order->has_status( 'refunded' )) { 664 SplitIt_FlexFields_Payment_Plugin_Settings::update_order_status_to_old( wc_get_order( $order_id ) ); 665 } 666 } catch ( Exception $e ) { 667 SplitIt_FlexFields_Payment_Plugin_Log::save_log_info( $data, $e->getMessage(), 'error' ); 668 return new WP_Error( 'error', "Refund unable to be processed online, consult your Splitit Account to process manually." ); 669 } 664 670 665 671 return new WP_Error( 'error', "Refund unable to be processed online, consult your Splitit Account to process manually." ); -
splitit-installment-payments/trunk/template/flex-field-index.php
r3114779 r3177834 132 132 return false; 133 133 } else { 134 if (window.location.href.includes("ride1up")) { 135 if (($( '[name="billing_state"]' ).length && !$( '[name="billing_state"]' ).val()) || $( '[name="billing_state"]' ).length && $( '[name="billing_state"]' ).val() == '') { 136 setError('Billing State is a required field.'); 137 return; 138 } 139 140 if ($('input[name="ship_to_different_address"]').length && $('input[name="ship_to_different_address"]').is(':checked')) { 141 if (($( '[name="shipping_state"]' ).length && !$( '[name="shipping_state"]' ).val()) || $( '[name="shipping_state"]' ).length && $( '[name="shipping_state"]' ).val() == '') { 142 setError('Shipping State is a required field.'); 143 return; 144 } 145 } 146 } 147 134 148 if ( typeof grecaptcha == 'undefined' || ( typeof grecaptcha != 'undefined' && grecaptcha.getResponse() != "" ) ) { 135 149 if ($('input[name="cf-turnstile-response"]').length) { -
splitit-installment-payments/trunk/uninstall.php
r2628150 r3177834 12 12 } 13 13 14 $option_name = 'woocommerce_splitit_settings'; 14 $option_names = [ 15 'woocommerce_splitit_settings', 16 'splitit_environment', 17 'splitit_sandbox_new_login', 18 'splitit_sandbox_merchant_id', 19 'splitit_sandbox_client_id', 20 'splitit_sandbox_client_secret', 21 'splitit_sandbox_api_key', 22 'splitit_sandbox_terminal_id', 23 'splitit_production_new_login', 24 'splitit_production_merchant_id', 25 'splitit_production_client_id', 26 'splitit_production_client_secret', 27 'splitit_production_api_key', 28 'splitit_production_terminal_id', 29 'splitit_last_deactivation_time', 30 'splitit_last_activation_time', 31 'splitit_logged_user_data', 32 'api_key', 33 'merchant_name', 34 'terminal_name', 35 'merchant_settings' 36 ]; 15 37 16 delete_option( $option_name );38 $sites = is_multisite() ? get_sites() : []; 17 39 18 // @for site options in Multisite 19 delete_site_option( $option_name ); 40 foreach ($option_names as $option_name) { 41 delete_option($option_name); 42 43 foreach ($sites as $site) { 44 delete_blog_option($site->blog_id, $option_name); 45 } 46 } 20 47 21 48 // @drop a custom database table 22 49 global $wpdb; 23 $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}splitit_log" ); 24 $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}splitit_order_data_with_ipn" ); 25 $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}splitit_transactions_log" ); 50 51 if ( is_multisite() ) { 52 53 $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->base_prefix}splitit_log" ); 54 $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->base_prefix}splitit_order_data_with_ipn" ); 55 $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->base_prefix}splitit_transactions_log" ); 56 $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->base_prefix}splitit_async_refund_log" ); 57 $wpdb->query( "DELETE FROM {$wpdb->options} WHERE option_name LIKE 'splitit_refund_data%'" ); 58 59 foreach ( $sites as $site ) { 60 $blog_id = $site->blog_id; 61 62 $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->base_prefix}{$blog_id}_splitit_log" ); 63 $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->base_prefix}{$blog_id}_splitit_order_data_with_ipn" ); 64 $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->base_prefix}{$blog_id}_splitit_transactions_log" ); 65 $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->base_prefix}{$blog_id}_splitit_async_refund_log" ); 66 67 $table_name = $wpdb->base_prefix . $blog_id . '_options'; 68 $wpdb->query( "DELETE FROM $table_name WHERE option_name LIKE 'splitit_refund_data%'" ); 69 } 70 } else { 71 $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}splitit_log" ); 72 $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}splitit_order_data_with_ipn" ); 73 $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}splitit_transactions_log" ); 74 $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}splitit_async_refund_log" ); 75 $wpdb->query( "DELETE FROM {$wpdb->options} WHERE option_name LIKE 'splitit_refund_data%'" ); 76 }
Note: See TracChangeset
for help on using the changeset viewer.