Changes in woo-wallet/trunk [2816610:2817824]
- Location:
- woo-wallet/trunk
- Files:
-
- 4 edited
-
includes/class-woo-wallet-ajax.php (modified) (1 diff)
-
includes/class-woo-wallet-payment-method.php (modified) (1 diff)
-
readme.txt (modified) (1 diff)
-
woo-wallet.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
woo-wallet/trunk/includes/class-woo-wallet-ajax.php
r2816610 r2817824 1 1 <?php 2 2 /** 3 3 * Plugin ajax file 4 4 * 5 5 * @package WooWallet 6 6 */ 7 7 8 8 if ( ! defined( 'ABSPATH' ) ) { 9 9 exit; // Exit if accessed directly. 10 10 } 11 11 if ( ! class_exists( 'Woo_Wallet_Ajax' ) ) { 12 12 /** 13 13 * Plugin Ajax class 14 14 */ 15 15 class Woo_Wallet_Ajax { 16 16 17 17 /** 18 18 * The single instance of the class. 19 19 * 20 20 * @var Woo_Wallet_Ajax 21 21 * @since 1.1.10 22 22 */ 23 23 protected static $_instance = null; 24 24 25 25 /** 26 26 * Main instance 27 27 * 28 28 * @return class object 29 29 */ 30 30 public static function instance() { 31 31 if ( is_null( self::$_instance ) ) { 32 32 self::$_instance = new self(); 33 33 } 34 34 return self::$_instance; 35 35 } 36 36 37 37 /** 38 38 * Class constructor 39 39 */ 40 40 public function __construct() { 41 41 add_action( 'wp_ajax_woo_wallet_order_refund', array( $this, 'woo_wallet_order_refund' ) ); 42 42 add_action( 'wp_ajax_woocommerce_wallet_rated', array( $this, 'woocommerce_wallet_rated' ) ); 43 43 add_action( 'wp_ajax_woo-wallet-user-search', array( $this, 'woo_wallet_user_search' ) ); 44 44 add_action( 'wp_ajax_woo_wallet_partial_payment_update_session', array( $this, 'woo_wallet_partial_payment_update_session' ) ); 45 45 add_action( 'wp_ajax_woo_wallet_refund_partial_payment', array( $this, 'woo_wallet_refund_partial_payment' ) ); 46 46 add_action( 'wp_ajax_woo-wallet-dismiss-promotional-notice', array( $this, 'woo_wallet_dismiss_promotional_notice' ) ); 47 47 add_action( 'wp_ajax_draw_wallet_transaction_details_table', array( $this, 'draw_wallet_transaction_details_table' ) ); 48 48 49 49 add_action( 'woocommerce_order_after_calculate_totals', array( $this, 'recalculate_order_cashback_after_calculate_totals' ), 10, 2 ); 50 50 51 51 add_action( 'wp_ajax_terawallet_export_user_search', array( $this, 'terawallet_export_user_search' ) ); 52 52 53 53 add_action( 'wp_ajax_terawallet_do_ajax_transaction_export', array( $this, 'terawallet_do_ajax_transaction_export' ) ); 54 54 55 55 add_action( 'wp_ajax_lock_unlock_terawallet', array( $this, 'lock_unlock_terawallet' ) ); 56 56 } 57 57 /** 58 58 * Lock / Unlock user wallet 59 59 * 60 60 * @return void 61 61 */ 62 62 public function lock_unlock_terawallet() { 63 63 check_ajax_referer( 'lock-unlock-nonce', 'security' ); 64 64 $user_id = isset( $_POST['user_id'] ) ? sanitize_text_field( wp_unslash( $_POST['user_id'] ) ) : 0; 65 65 $type = isset( $_POST['type'] ) ? sanitize_text_field( wp_unslash( $_POST['type'] ) ) : ''; 66 if ( ! current_user_can( 'edit_user', $user_id ) ) { 67 wp_die( -1 ); 68 } 66 69 if ( 'lock' === $type ) { 67 70 update_user_meta( $user_id, '_is_wallet_locked', true ); 68 71 wp_send_json_success( 69 72 array( 70 73 'type' => 'unlock', 71 74 'text' => __( 72 75 'Unlock', 73 76 'woo-wallet' 74 77 ), 75 78 ) 76 79 ); 77 80 } else { 78 81 delete_user_meta( $user_id, '_is_wallet_locked' ); 79 82 wp_send_json_success( 80 83 array( 81 84 'type' => 'lock', 82 85 'text' => __( 83 86 'Lock', 84 87 'woo-wallet' 85 88 ), 86 89 ) 87 90 ); 88 91 } 89 92 } 90 93 /** 91 94 * Generate export CSV file. 92 95 */ 93 96 public function terawallet_do_ajax_transaction_export() { 94 97 check_ajax_referer( 'terawallet-exporter-script', 'security' ); 95 98 include_once WOO_WALLET_ABSPATH . 'includes/export/class-terawallet-csv-exporter.php'; 96 99 $step = isset( $_POST['step'] ) ? absint( $_POST['step'] ) : 1; 97 100 98 101 $exporter = new TeraWallet_CSV_Exporter(); 99 102 100 103 $exporter->set_step( $step ); 101 104 102 105 if ( ! empty( $_POST['selected_columns'] ) ) { 103 106 $exporter->set_columns_to_export( wp_unslash( $_POST['selected_columns'] ) ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized 104 107 } 105 108 106 109 if ( ! empty( $_POST['selected_users'] ) ) { 107 110 $exporter->set_users_to_export( wp_unslash( $_POST['selected_users'] ) ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized 108 111 } 109 112 110 113 if ( ! empty( $_POST['start_date'] ) ) { 111 114 $exporter->set_start_date( sanitize_text_field( wp_unslash( $_POST['start_date'] ) ) ); 112 115 } 113 116 114 117 if ( ! empty( $_POST['end_date'] ) ) { 115 118 $exporter->set_end_date( sanitize_text_field( wp_unslash( $_POST['end_date'] ) ) ); 116 119 } 117 120 118 121 if ( ! empty( $_POST['filename'] ) ) { 119 122 $exporter->set_filename( sanitize_text_field( wp_unslash( $_POST['filename'] ) ) ); 120 123 } 121 124 $exporter->write_to_csv(); 122 125 $query_args = array( 123 126 'nonce' => wp_create_nonce( 'terawallet-transaction-csv' ), 124 127 'action' => 'download_export_csv', 125 128 'filename' => $exporter->get_filename(), 126 129 ); 127 130 if ( $exporter->get_percent_complete() >= 100 ) { 128 131 wp_send_json_success( 129 132 array( 130 133 'step' => 'done', 131 134 'percentage' => 100, 132 135 'url' => add_query_arg( $query_args, admin_url( 'admin.php?page=terawallet-exporter' ) ), 133 136 ) 134 137 ); 135 138 } else { 136 139 wp_send_json_success( 137 140 array( 138 141 'step' => ++$step, 139 142 'percentage' => $exporter->get_percent_complete(), 140 143 'columns' => '', 141 144 ) 142 145 ); 143 146 } 144 147 } 145 148 146 149 /** 147 150 * Search users for export transactions. 148 151 */ 149 152 public function terawallet_export_user_search() { 150 153 check_ajax_referer( 'search-user', 'security' ); 151 154 $term = isset( $_POST['term'] ) ? sanitize_text_field( wp_unslash( $_POST['term'] ) ) : ''; 152 155 $return = array(); 153 156 $blog_id = isset( $_POST['site_id'] ) ? sanitize_text_field( wp_unslash( $_POST['site_id'] ) ) : get_current_blog_id(); 154 157 155 158 $users = get_users( 156 159 array( 157 160 'blog_id' => $blog_id, 158 161 'search' => '*' . $term . '*', 159 162 'search_columns' => array( 'user_login', 'user_nicename', 'user_email' ), 160 163 ) 161 164 ); 162 165 163 166 foreach ( $users as $user ) { 164 167 $return[] = array( 165 168 /* translators: 1: user_login, 2: user_email */ 166 169 'label' => sprintf( _x( '%1$s (%2$s)', 'user autocomplete result', 'woo-wallet' ), $user->user_login, $user->user_email ), 167 170 'value' => $user->ID, 168 171 ); 169 172 } 170 173 wp_send_json( $return ); 171 174 } 172 175 173 176 /** 174 177 * Recalculate and send order cashback. 175 178 * 176 179 * @param Bool $and_taxes Description. 177 180 * @param WC_Order $order order. 178 181 */ 179 182 public function recalculate_order_cashback_after_calculate_totals( $and_taxes, $order ) { 180 183 $cashback_amount = woo_wallet()->cashback->calculate_cashback( false, $order->get_id(), true ); 181 184 $transaction_id = get_post_meta( $order->get_id(), '_general_cashback_transaction_id', true ); 182 185 if ( $transaction_id ) { 183 186 update_wallet_transaction( $transaction_id, $order->get_customer_id(), array( 'amount' => $cashback_amount ), array( '%f' ) ); 184 187 } 185 188 } 186 189 187 190 /** 188 191 * Wallet partial payment refund. 189 192 */ 190 193 public function woo_wallet_refund_partial_payment() { 191 194 if ( ! current_user_can( 'edit_shop_orders' ) ) { 192 195 wp_die( -1 ); 193 196 } 194 197 $response = array( 'success' => false ); 195 198 $order_id = absint( filter_input( INPUT_POST, 'order_id' ) ); 196 199 $order = wc_get_order( $order_id ); 197 200 $partial_payment_amount = get_order_partial_payment_amount( $order_id ); 198 201 $transaction_id = woo_wallet()->wallet->credit( $order->get_customer_id(), $partial_payment_amount, __( 'Wallet refund #', 'woo-wallet' ) . $order->get_order_number() ); 199 202 if ( $transaction_id ) { 200 203 $response['success'] = true; 201 204 /* translators: wallet amount */ 202 205 $order->add_order_note( sprintf( __( '%s refunded to customer wallet', 'woo-wallet' ), wc_price( $partial_payment_amount, woo_wallet_wc_price_args( $order->get_customer_id() ) ) ) ); 203 206 update_post_meta( $order_id, '_woo_wallet_partial_payment_refunded', true ); 204 207 update_post_meta( $order_id, '_partial_payment_refund_id', $transaction_id ); 205 208 do_action( 'woo_wallet_partial_order_refunded', $order_id, $transaction_id ); 206 209 } 207 210 wp_send_json( $response ); 208 211 } 209 212 210 213 /** 211 214 * Process refund through wallet 212 215 * 213 216 * @throws Exception To return errors. 214 217 */ 215 218 public function woo_wallet_order_refund() { 216 219 ob_start(); 217 220 check_ajax_referer( 'order-item', 'security' ); 218 221 if ( ! current_user_can( 'edit_shop_orders' ) ) { 219 222 wp_die( -1 ); 220 223 } 221 224 $order_id = isset( $_POST['order_id'] ) ? absint( $_POST['order_id'] ) : 0; 222 225 $refund_amount = isset( $_POST['refund_amount'] ) ? wc_format_decimal( sanitize_text_field( wp_unslash( $_POST['refund_amount'] ) ), wc_get_price_decimals() ) : 0; 223 226 $refunded_amount = isset( $_POST['refunded_amount'] ) ? wc_format_decimal( sanitize_text_field( wp_unslash( $_POST['refunded_amount'] ) ), wc_get_price_decimals() ) : 0; 224 227 $refund_reason = isset( $_POST['refund_reason'] ) ? sanitize_text_field( wp_unslash( $_POST['refund_reason'] ) ) : ''; 225 228 $line_item_qtys = isset( $_POST['line_item_qtys'] ) ? array_map( 'intval', json_decode( sanitize_text_field( wp_unslash( $_POST['line_item_qtys'] ) ), true ) ) : array(); 226 229 $line_item_totals = isset( $_POST['line_item_totals'] ) ? array_map( 'floatval', json_decode( sanitize_text_field( wp_unslash( $_POST['line_item_totals'] ) ), true ) ) : array(); 227 230 $line_item_tax_totals = isset( $_POST['line_item_tax_totals'] ) ? array_map( 'floatval', json_decode( sanitize_text_field( wp_unslash( $_POST['line_item_tax_totals'] ) ), true ) ) : array(); 228 231 $api_refund = isset( $_POST['api_refund'] ) && 'true' === $_POST['api_refund']; 229 232 $restock_refunded_items = isset( $_POST['restock_refunded_items'] ) && 'true' === $_POST['restock_refunded_items']; 230 233 $refund = false; 231 234 $response = array(); 232 235 try { 233 236 $order = wc_get_order( $order_id ); 234 237 $max_refund = wc_format_decimal( $order->get_total() - $order->get_total_refunded(), wc_get_price_decimals() ); 235 238 236 239 if ( ( ! $refund_amount && ( wc_format_decimal( 0, wc_get_price_decimals() ) !== $refund_amount ) ) || $max_refund < $refund_amount || 0 > $refund_amount ) { 237 240 throw new Exception( __( 'Invalid refund amount', 'woocommerce' ) ); 238 241 } 239 242 240 243 if ( wc_format_decimal( $order->get_total_refunded(), wc_get_price_decimals() ) !== $refunded_amount ) { 241 244 throw new Exception( __( 'Error processing refund. Please try again.', 'woocommerce' ) ); 242 245 } 243 246 244 247 // Prepare line items which we are refunding. 245 248 $line_items = array(); 246 249 $item_ids = array_unique( array_merge( array_keys( $line_item_qtys ), array_keys( $line_item_totals ) ) ); 247 250 248 251 foreach ( $item_ids as $item_id ) { 249 252 $line_items[ $item_id ] = array( 250 253 'qty' => 0, 251 254 'refund_total' => 0, 252 255 'refund_tax' => array(), 253 256 ); 254 257 } 255 258 foreach ( $line_item_qtys as $item_id => $qty ) { 256 259 $line_items[ $item_id ]['qty'] = max( $qty, 0 ); 257 260 } 258 261 foreach ( $line_item_totals as $item_id => $total ) { 259 262 $line_items[ $item_id ]['refund_total'] = wc_format_decimal( $total ); 260 263 } 261 264 foreach ( $line_item_tax_totals as $item_id => $tax_totals ) { 262 265 $line_items[ $item_id ]['refund_tax'] = array_filter( array_map( 'wc_format_decimal', $tax_totals ) ); 263 266 } 264 267 265 268 // Create the refund object. 266 269 $refund = wc_create_refund( 267 270 array( 268 271 'amount' => $refund_amount, 269 272 'reason' => $refund_reason, 270 273 'order_id' => $order_id, 271 274 'line_items' => $line_items, 272 275 'refund_payment' => $api_refund, 273 276 'restock_items' => $restock_refunded_items, 274 277 ) 275 278 ); 276 279 if ( ! is_wp_error( $refund ) ) { 277 280 $transaction_id = woo_wallet()->wallet->credit( $order->get_customer_id(), $refund_amount, $refund_reason ); 278 281 if ( ! $transaction_id ) { 279 282 throw new Exception( __( 'Refund not credited to customer', 'woo-wallet' ) ); 280 283 } else { 281 284 do_action( 'woo_wallet_order_refunded', $order, $refund, $transaction_id ); 282 285 } 283 286 } 284 287 285 288 if ( is_wp_error( $refund ) ) { 286 289 throw new Exception( $refund->get_error_message() ); 287 290 } 288 291 289 292 if ( did_action( 'woocommerce_order_fully_refunded' ) ) { 290 293 $response['status'] = 'fully_refunded'; 291 294 } 292 295 } catch ( Exception $e ) { 293 296 wp_send_json_error( array( 'error' => $e->getMessage() ) ); 294 297 } 295 298 // wp_send_json_success must be outside the try block not to break phpunit tests. 296 299 wp_send_json_success( $response ); 297 300 } 298 301 299 302 /** 300 303 * Mark wallet rated. 301 304 */ 302 305 public function woocommerce_wallet_rated() { 303 306 if ( current_user_can( 'manage_options' ) ) { 304 307 update_option( 'woocommerce_wallet_admin_footer_text_rated', true ); 305 308 } 306 309 die; 307 310 } 308 311 309 312 /** 310 313 * Search users 311 314 */ 312 315 public function woo_wallet_user_search() { 313 316 check_ajax_referer( 'search-user', 'security' ); 314 317 $return = array(); 315 318 $term = isset( $_POST['term'] ) ? sanitize_text_field( wp_unslash( $_POST['term'] ) ) : ''; 316 319 if ( apply_filters( 'woo_wallet_user_search_exact_match', true ) ) { 317 320 $user = get_user_by( apply_filters( 'woo_wallet_user_search_by', 'email' ), $term ); 318 321 if ( $user && wp_get_current_user()->user_email !== $user->user_email ) { 319 322 $return[] = array( 320 323 /* translators: 1: user_login, 2: user_email */ 321 324 'label' => sprintf( _x( '%1$s (%2$s)', 'user autocomplete result', 'woo-wallet' ), $user->user_login, $user->user_email ), 322 325 'value' => $user->ID, 323 326 ); 324 327 } 325 328 } else { 326 329 $blog_id = isset( $_POST['site_id'] ) ? sanitize_text_field( wp_unslash( $_POST['site_id'] ) ) : get_current_blog_id(); 327 330 328 331 $users = get_users( 329 332 array( 330 333 'blog_id' => $blog_id, 331 334 'search' => '*' . $term . '*', 332 335 'exclude' => array( get_current_user_id() ), 333 336 'search_columns' => array( 'user_login', 'user_nicename', 'user_email' ), 334 337 ) 335 338 ); 336 339 337 340 foreach ( $users as $user ) { 338 341 $return[] = array( 339 342 /* translators: 1: user_login, 2: user_email */ 340 343 'label' => sprintf( _x( '%1$s (%2$s)', 'user autocomplete result', 'woo-wallet' ), $user->user_login, $user->user_email ), 341 344 'value' => $user->ID, 342 345 ); 343 346 } 344 347 } 345 348 wp_send_json( $return ); 346 349 } 347 350 /** 348 351 * Update partial payment session. 349 352 * 350 353 * @return void 351 354 */ 352 355 public function woo_wallet_partial_payment_update_session() { 353 356 if ( isset( $_POST['checked'] ) && 'true' === $_POST['checked'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing 354 357 update_wallet_partial_payment_session( true ); 355 358 } else { 356 359 update_wallet_partial_payment_session(); 357 360 } 358 361 wp_die(); 359 362 } 360 363 /** 361 364 * Dismiss wallet promotonal message. 362 365 * 363 366 * @return void 364 367 */ 365 368 public function woo_wallet_dismiss_promotional_notice() { 366 369 if ( ! current_user_can( 'manage_options' ) ) { 367 370 wp_send_json_error( __( 'You have no permission to do that', 'woo-wallet' ) ); 368 371 } 369 372 370 373 if ( isset( $_POST['nonce'] ) && ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce'] ) ), 'woo_wallet_admin' ) ) { 371 374 wp_send_json_error( __( 'Invalid nonce', 'woo-wallet' ) ); 372 375 } 373 376 update_option( '_woo_wallet_promotion_dismissed', true ); 374 377 wp_send_json_success(); 375 378 } 376 379 377 380 /** 378 381 * Send wallet transaction AJAX response. 379 382 */ 380 383 public function draw_wallet_transaction_details_table() { 381 384 check_ajax_referer( 'woo-wallet-transactions', 'security' ); 382 385 $start = isset( $_POST['start'] ) ? sanitize_text_field( wp_unslash( $_POST['start'] ) ) : 0; 383 386 $length = isset( $_POST['length'] ) ? sanitize_text_field( wp_unslash( $_POST['length'] ) ) : 10; 384 387 $search = isset( $_POST['search'] ) ? array_map( 'sanitize_text_field', wp_unslash( $_POST['search'] ) ) : ''; 385 388 $args = array( 386 389 'limit' => "$start, $length", 387 390 ); 388 391 if ( isset( $search['value'] ) && ! empty( $search['value'] ) ) { 389 392 $args['where'] = array( 390 393 array( 391 394 'key' => 'date', 392 395 'value' => $search['value'] . '%', 393 396 'operator' => 'LIKE', 394 397 ), 395 398 ); 396 399 } 397 400 $transactions = get_wallet_transactions( $args ); 398 401 unset( $args['limit'] ); 399 402 $records_total = get_wallet_transactions_count( get_current_user_id() ); 400 403 401 404 $response = array( 402 405 'draw' => isset( $_POST['draw'] ) ? sanitize_text_field( wp_unslash( $_POST['draw'] ) ) : 1, 403 406 'recordsTotal' => $records_total, 404 407 'recordsFiltered' => count( get_wallet_transactions( $args ) ), 405 408 'data' => array(), 406 409 ); 407 410 if ( $transactions ) { 408 411 foreach ( $transactions as $transaction ) { 409 412 $response['data'][] = apply_filters( 410 413 'woo_wallet_transactons_datatable_row_data', 411 414 array( 412 415 'id' => $transaction->transaction_id, 413 416 'credit' => 'credit' === $transaction->type ? wc_price( apply_filters( 'woo_wallet_amount', $transaction->amount, $transaction->currency, $transaction->user_id ), woo_wallet_wc_price_args( $transaction->user_id ) ) : ' - ', 414 417 'debit' => 'debit' === $transaction->type ? wc_price( apply_filters( 'woo_wallet_amount', $transaction->amount, $transaction->currency, $transaction->user_id ), woo_wallet_wc_price_args( $transaction->user_id ) ) : ' - ', 415 418 'details' => $transaction->details, 416 419 'date' => wc_string_to_datetime( $transaction->date )->date_i18n( wc_date_format() ), 417 420 ), 418 421 $transaction 419 422 ); 420 423 } 421 424 } 422 425 wp_send_json( $response ); 423 426 } 424 427 425 428 } 426 429 427 430 } 428 431 Woo_Wallet_Ajax::instance(); -
woo-wallet/trunk/includes/class-woo-wallet-payment-method.php
r2816610 r2817824 1 1 <?php 2 2 3 3 if ( ! defined( 'ABSPATH' ) ) { 4 4 exit; // Exit if accessed directly. 5 5 } 6 6 if ( class_exists( 'WC_Payment_Gateway' ) ) { 7 7 8 8 class Woo_Gateway_Wallet_payment extends WC_Payment_Gateway { 9 9 10 10 /** 11 11 * Class constructor 12 12 */ 13 13 public function __construct() { 14 14 $this->setup_properties(); 15 15 $this->supports = array( 16 16 'products', 17 17 'refunds', 18 18 'subscriptions', 19 19 'multiple_subscriptions', 20 20 'subscription_cancellation', 21 21 'subscription_suspension', 22 22 'subscription_reactivation', 23 23 'subscription_amount_changes', 24 24 'subscription_date_changes', 25 25 'subscription_payment_method_change', 26 26 'subscription_payment_method_change_customer', 27 27 'subscription_payment_method_change_admin', 28 28 ); 29 29 // Load the settings. 30 30 $this->init_form_fields(); 31 31 $this->init_settings(); 32 32 // Get settings. 33 33 $this->title = $this->get_option( 'title' ); 34 34 $this->description = $this->get_option( 'description' ); 35 35 $this->instructions = $this->get_option( 'instructions' ); 36 36 37 37 add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) ); 38 38 /* support for woocommerce subscription plugin */ 39 39 add_action( 'woocommerce_scheduled_subscription_payment_' . $this->id, array( $this, 'scheduled_subscription_payment' ), 10, 2 ); 40 40 41 41 add_action( 'woocommerce_pre_payment_complete', array( $this, 'woocommerce_pre_payment_complete' ) ); 42 42 } 43 43 44 44 /** 45 45 * Setup general properties for the gateway. 46 46 */ 47 47 protected function setup_properties() { 48 48 $this->id = 'wallet'; 49 49 $this->method_title = __( 'Wallet', 'woo-wallet' ); 50 50 $this->method_description = __( 'Have your customers pay with wallet.', 'woo-wallet' ); 51 51 $this->has_fields = false; 52 52 } 53 53 54 54 /** 55 55 * Initialise Gateway Settings Form Fields. 56 56 */ 57 57 public function init_form_fields() { 58 58 $this->form_fields = array( 59 59 'enabled' => array( 60 60 'title' => __( 'Enable/Disable', 'woo-wallet' ), 61 61 'label' => __( 'Enable wallet payments', 'woo-wallet' ), 62 62 'type' => 'checkbox', 63 63 'description' => '', 64 64 'default' => 'yes', 65 65 ), 66 66 'title' => array( 67 67 'title' => __( 'Title', 'woo-wallet' ), 68 68 'type' => 'text', 69 69 'description' => __( 'This controls the title which the user sees during checkout.', 'woo-wallet' ), 70 70 'default' => __( 'Wallet payment', 'woo-wallet' ), 71 71 'desc_tip' => true, 72 72 ), 73 73 'description' => array( 74 74 'title' => __( 'Description', 'woo-wallet' ), 75 75 'type' => 'textarea', 76 76 'description' => __( 'Payment method description that the customer will see on your checkout.', 'woo-wallet' ), 77 77 'default' => __( 'Pay with wallet.', 'woo-wallet' ), 78 78 'desc_tip' => true, 79 79 ), 80 80 'instructions' => array( 81 81 'title' => __( 'Instructions', 'woo-wallet' ), 82 82 'type' => 'textarea', 83 83 'description' => __( 'Instructions that will be added to the thank you page.', 'woo-wallet' ), 84 84 'default' => __( 'Pay with wallet.', 'woo-wallet' ), 85 85 'desc_tip' => true, 86 86 ), 87 87 ); 88 88 } 89 89 90 90 /** 91 91 * Is gateway available 92 92 * 93 93 * @return boolean 94 94 */ 95 95 public function is_available() { 96 96 if ( is_checkout() ) { 97 97 return apply_filters( 'woo_wallet_payment_is_available', ( parent::is_available() && is_full_payment_through_wallet() && is_user_logged_in() && ! is_enable_wallet_partial_payment() && ! is_wallet_account_locked() ) ); 98 98 } 99 99 return parent::is_available(); 100 100 } 101 101 /** 102 102 * Display wallet balance as Icon. 103 103 * 104 104 * @return string 105 105 */ 106 106 public function get_icon() { 107 107 $current_balance = woo_wallet()->wallet->get_wallet_balance( get_current_user_id() ); 108 108 return apply_filters( 'woo_wallet_gateway_icon', sprintf( __( ' | Current Balance: <strong>%s</strong>', 'woo-wallet' ), $current_balance ), $this->id ); 109 109 } 110 110 111 111 /** 112 112 * Is $order_id a subscription? 113 113 * 114 114 * @param int $order_id order_id. 115 115 * @return boolean 116 116 */ 117 117 protected function is_subscription( $order_id ) { 118 118 return ( function_exists( 'wcs_order_contains_subscription' ) && ( wcs_order_contains_subscription( $order_id ) || wcs_is_subscription( $order_id ) || wcs_order_contains_renewal( $order_id ) ) ); 119 119 } 120 120 121 121 /** 122 122 * Process wallet payment 123 123 * 124 124 * @param int $order_id order_id. 125 125 * @return array 126 126 */ 127 127 public function process_payment( $order_id ) { 128 128 $order = wc_get_order( $order_id ); 129 129 if ( ( $order->get_total( 'edit' ) > woo_wallet()->wallet->get_wallet_balance( get_current_user_id(), 'edit' ) ) && apply_filters( 'woo_wallet_disallow_negative_transaction', ( woo_wallet()->wallet->get_wallet_balance( get_current_user_id(), 'edit' ) <= 0 || $order->get_total( 'edit' ) > woo_wallet()->wallet->get_wallet_balance( get_current_user_id(), 'edit' ) ), $order->get_total( 'edit' ), woo_wallet()->wallet->get_wallet_balance( get_current_user_id(), 'edit' ) ) ) { 130 130 wc_add_notice( __( 'Payment error: ', 'woo-wallet' ) . sprintf( __( 'Your wallet balance is low. Please add %s to proceed with this transaction.', 'woo-wallet' ), wc_price( $order->get_total( 'edit' ) - woo_wallet()->wallet->get_wallet_balance( get_current_user_id(), 'edit' ), woo_wallet_wc_price_args( $order->get_customer_id() ) ) ), 'error' ); 131 131 return; 132 132 } 133 133 134 134 // Reduce stock levels. 135 135 wc_reduce_stock_levels( $order_id ); 136 136 137 137 // Remove cart. 138 138 WC()->cart->empty_cart(); 139 139 140 140 // Complete order payment. 141 141 $order->payment_complete(); 142 142 143 143 // Return thankyou redirect. 144 144 return array( 145 145 'result' => 'success', 146 146 'redirect' => $this->get_return_url( $order ), 147 147 ); 148 148 } 149 149 /** 150 150 * Debit user wallet on WooCommerce payment complete. 151 151 * 152 152 * @param WC_Order $order_id order_id. 153 153 * @throws Exception WooCommerce expeptions. 154 154 */ 155 155 public function woocommerce_pre_payment_complete( $order_id ) { 156 156 $order = wc_get_order( $order_id ); 157 157 if ( 'wallet' === $order->get_payment_method( 'edit' ) && ! $order->get_transaction_id( 'edit' ) && $order->has_status( apply_filters( 'woocommerce_valid_order_statuses_for_payment_complete', array( 'on-hold', 'pending', 'failed', 'cancelled' ), $order ) ) ) { 158 158 if ( woo_wallet()->wallet->get_wallet_balance( $order->get_customer_id( 'edit' ), 'edit' ) >= $order->get_total( 'edit' ) ) { 159 159 $wallet_response = woo_wallet()->wallet->debit( $order->get_customer_id( 'edit' ), $order->get_total( 'edit' ), apply_filters( 'woo_wallet_order_payment_description', __( 'For order payment #', 'woo-wallet' ) . $order->get_order_number(), $order ) ); 160 160 if ( $wallet_response ) { 161 161 $order->set_transaction_id( $wallet_response ); 162 162 do_action( 'woo_wallet_payment_processed', $order_id, $wallet_response ); 163 163 $order->save(); 164 164 } else { 165 165 throw new Exception( __( 'Something went wrong with processing payment please try again.', 'woo-wallet' ) ); 166 166 } 167 167 } else { 168 168 throw new Exception( __( 'Insufficient wallet balance', 'woo-wallet' ) ); 169 169 } 170 170 } 171 171 } 172 172 173 173 /** 174 174 * Process a refund if supported. 175 175 * 176 176 * @param int $order_id Order ID. 177 177 * @param float $amount Refund amount. 178 178 * @param string $reason Refund reason. 179 179 * @return bool|WP_Error 180 * @throws Exception WP_Error Exceptions. 180 181 */ 181 182 public function process_refund( $order_id, $amount = null, $reason = '' ) { 182 183 $order = wc_get_order( $order_id ); 183 184 $refund_reason = $reason ? $reason : __( 'Wallet refund #', 'woo-wallet' ) . $order->get_order_number(); 184 185 $transaction_id = woo_wallet()->wallet->credit( $order->get_customer_id(), $amount, $refund_reason ); 185 186 if ( ! $transaction_id ) { 186 187 throw new Exception( __( 'Refund not credited to customer', 'woo-wallet' ) ); 187 188 } 188 189 do_action( 'woo_wallet_order_refunded', $order, $amount, $transaction_id ); 189 190 return true; 190 191 } 191 192 192 193 /** 193 194 * Process renewal payment for subscription order 194 195 * 195 196 * @param int $amount_to_charge amount_to_charge. 196 197 * @param WC_Order $order order. 197 198 * @return void 198 199 */ 199 200 public function scheduled_subscription_payment( $amount_to_charge, $order ) { 200 201 if ( get_post_meta( $order->get_id(), '_wallet_scheduled_subscription_payment_processed', true ) ) { 201 202 return; 202 203 } 203 204 $order->payment_complete(); 204 205 update_post_meta( $order->get_id(), '_wallet_scheduled_subscription_payment_processed', true ); 205 206 } 206 207 } 207 208 } -
woo-wallet/trunk/readme.txt
r2816610 r2817824 1 1 === TeraWallet - For WooCommerce === 2 2 Contributors: standalonetech, subratamal, moumitaadak 3 3 Tags: woo wallet, woocommerce wallet, wp wallet, user wallet, refund, cashback, partial payment, wallet, wc wallet, woocommerce credits 4 Requires PHP: 5.65 Requires at least: 4.44 Requires PHP: 7.2 5 Requires at least: 5.8 6 6 Tested up to: 6.1 7 Stable tag: 1.4. 37 Stable tag: 1.4.4 8 8 Donate link: https://paypal.me/standalonetech 9 9 License: GPLv3 10 10 License URI: https://www.gnu.org/licenses/gpl-3.0.html 11 11 12 12 A powerful, extendable WooCommerce wallet system which support payment, partial payment, cashback reward program as well as refund for your WooCommerce store. 13 13 14 14 == Description == 15 15 16 16 TeraWallet allows customers to store their money in a digital wallet. The customers can use the wallet money for purchasing products from the store. The customers can add money to their wallet using various payment methods set by the admin. The admin can set cashback rules according to cart price or product. The customers will receive their cashback amount in their wallet account. The admin can process refund to customer wallet. 17 17 18 18 [youtube https://www.youtube.com/watch?v=Fnpp8qxAWBw] 19 19 20 20 = Use case of TeraWallet = 21 21 With this extension, the customers won't have to fill in the payment details every time. They can simply log in and pay for products using the wallet money. The customers will also get the advantage for earning cashback using the wallet money. The admin can process refund to the customer wallet. 22 22 23 23 = Features of TeraWallet = 24 24 - Wallet system works just like any other payment method. 25 25 - Set wallet system payment method title for the front-end. 26 26 - The customers can use various payment methods to add money. 27 27 - The admin can process refund using the wallet money. 28 28 - Customers will earn cashback according to cart price, product or product category wise. 29 29 - Customers can made partial payment. 30 30 - Set cashback amount calculation using fixed or percent method. 31 31 - Admin can export users wallet transactions. 32 32 - Admin can setup low wallet balance notification email. 33 33 - Admin can lock / unlock any user wallet. 34 34 - From the backend, the admin can view the transaction history. 35 35 - Customers receive notification emails for every wallet transaction. 36 36 - The admin can adjust the wallet amount of any customer from the backend. 37 37 - Users can transfer wallet amount to other user. 38 38 - Shortcode `woo-wallet` which will display user wallet page. 39 39 - Built with a REST API 40 40 - Convert WooCommerce coupon into cashback. 41 41 - Support WordPress Multisite Network 42 42 - Supports multiple languages translations. 43 43 - Supports WooCommerce Subscriptions. 44 44 - Supports WooCommerce Multivendor Marketplace by WC Lovers. 45 45 - Supports WC Marketplace. 46 46 - Supports Dokan Multivendor Marketplace. 47 47 48 48 > Take a step forward and try our [demo](https://standalonetech.com/). 49 49 50 50 = Workflow of TeraWallet = 51 51 After the plugin installation, the admin needs to do the payment method configuration. Set the title and select allowed payments for adding money. 52 52 Now for enable cashback rules, navigate to WooWallet > Settings > Credit. Now setup cashback rule according to your requirement. If cashback rule set to product wise then admin will have an option to add cashback rule for each product. 53 53 On the front-end, the customers can log in to the store and go to wallet page from My Account. Enter the amount to add and then complete the checkout process just like any other product purchase. 54 54 55 55 = Translator Contributors = 56 56 - [#fa_IR](https://translate.wordpress.org/locale/fa/default/wp-plugins/woo-wallet) - [@rahimvaziri](https://wordpress.org/support/users/rahimvaziri/) 57 57 - [#es_ES](https://translate.wordpress.org/locale/es/default/wp-plugins/woo-wallet) - [@chipweb](https://wordpress.org/support/users/chipweb/) 58 58 59 59 == Installation == 60 60 61 61 = Minimum Requirements = 62 62 63 63 * PHP version 5.2.4 or greater (PHP 5.6 or greater is recommended) 64 64 * MySQL version 5.0 or greater (MySQL 5.6 or greater is recommended) 65 65 * WordPress 4.4+ 66 66 * WooCommerce 3.0+ 67 67 68 68 = Automatic installation = 69 69 70 70 Automatic installation is the easiest option as WordPress handles the file transfers itself and you don’t need to leave your web browser. To do an automatic install of WooCommerce Wallet Payment, log in to your WordPress dashboard, navigate to the Plugins menu and click Add New. 71 71 72 72 In the search field type “WooCommerce Wallet Payment” and click Search Plugins. Once you’ve found our WooCommerce Wallet Payment plugin you can view details about it such as the point release, rating and description. Most importantly of course, you can install it by simply clicking “Install Now”. 73 73 74 74 = Manual installation = 75 75 76 76 The manual installation method involves downloading our plugin and uploading it to your webserver via your favourite FTP application. The WordPress codex contains [instructions on how to do this here](https://codex.wordpress.org/Managing_Plugins#Manual_Plugin_Installation). 77 77 78 78 = Updating = 79 79 80 80 Automatic updates should work like a charm; as always though, ensure you backup your site just in case. 81 81 82 82 If on the off-chance you do encounter issues with the wallet endpoints pages after an update you simply need to flush the permalinks by going to WordPress > Settings > Permalinks and hitting 'save'. That should return things to normal. 83 83 84 84 == Frequently Asked Questions == 85 85 86 86 = Does this plugin work with newest WP version and also older versions? = 87 87 88 88 Yes, this plugin works fine with WordPress 4.9, It is also compatible for older WordPress versions upto 4.4. 89 89 90 90 = Up to which version of WooCommerce this plugin compatible with? = 91 91 92 92 This plugin is compatible with the latest version of WooCommerce. 93 93 94 94 = Will WooCommerce Wallet work with WordPress multisite network? = 95 95 96 96 Yes, WooCommerce Wallet plugin is fully compatible with Wordpress multisite. 97 97 98 98 = Where can I get support or talk to other users? = 99 99 100 100 If you get stuck, you can ask for help in the [WordPress Plugin Forum](https://wordpress.org/support/plugin/woo-wallet) or just email us at support@standalonetech.com. 101 101 102 102 = Where can I report bugs or contribute to the project? = 103 103 104 104 Bugs can be reported either in our support forum or preferably on the [GitHub repository](https://github.com/malsubrata/woo-wallet/issues). 105 105 106 106 = Where can I find the REST API documentation? = 107 107 108 108 You can find the documentation of our [Wallet REST API Docs](https://github.com/malsubrata/woo-wallet/wiki/API-V3). 109 109 110 110 = This plugin is awesome! Can I contribute? = 111 111 112 112 Yes you can! Join in on our [GitHub repository](https://github.com/malsubrata/woo-wallet) :) 113 113 114 114 == Screenshots == 115 115 116 116 1. User wallet page. 117 117 2. Transfer wallet balance. 118 118 3. View transaction details. 119 119 4. All user balance details. 120 120 5. Admin view transaction details. 121 121 6. Admin adjust wallet balance. 122 122 7. WooCommerce wallet payment gateway. 123 123 8. WooCommerce refund. 124 124 9. Wallet actions. 125 125 126 126 == Changelog == 127 = 1.4.4 - 2022-11-14 = 128 * Fix - Security issue on the function lock_unlock_terawallet. 129 127 130 = 1.4.3 - 2022-11-11 = 128 131 * Fix - Datatable ajax issue. 129 132 130 133 = 1.4.2 - 2022-11-11 = 131 134 * Fix - Mini wallet nav menu location. 132 135 133 136 = 1.4.1 - 2022-11-11 = 134 137 * Fix - Fix Cannot uncheck checkbox issue in plugin settings page. 135 138 136 139 = 1.4.0 - 2022-11-4 = 137 140 * Fix - Plugin CSRF issue ( Thanks Muhammad Daffa ). 138 141 * Add - Compatibility with WP 6.1 139 142 140 143 = 1.3.24 - 2022-03-18 = 141 144 * Fix - Wallet payment process. 142 145 * Fix - Referral signup action. 143 146 * Tweak - Wallet pages will be removed from account page if user is bolocked. 144 147 * Add - REST API V3 [API Docs](https://github.com/malsubrata/woo-wallet/wiki/API-V3). 145 148 146 149 = 1.3.23 - 2022-02-17 = 147 150 * Fix - Compatibility with WooCommerce Subscription plugin. 148 151 * Fix - Referral order amount 149 152 * Fix - Cashback issue for guest user. 150 153 * Add - Support for order created via rest API. 151 154 152 155 = 1.3.22 - 2021-12-23 = 153 156 * Fix - Plugin title translation issue. 154 157 155 158 = 1.3.21 -2021-12-22 = 156 159 * Fix - Exporter column header. 157 160 * Fix - Incorrect wallet top-up this month widget. 158 161 * Tweak - Delete Transaction history without effecting User balance. 159 162 * Fix - Cashback coupon for Guest User. 160 163 * Fix - Referring signup bug. 161 164 * Add - Compatibility with Dokan > 3.3. 162 165 163 166 = 1.3.20 - 2021-11-26 = 164 167 * Fix - Wallet top-up issue. 165 168 * Fix - Extension page CSS issue. 166 169 167 170 = 1.3.19 - 2021-07-02 = 168 171 * Add - Now admin can setup low wallet balance notification email. 169 172 * Add - Admin can export wallet transactions. 170 173 * Add - Admin can lock / unlock user wallet. 171 174 172 175 = 1.3.18 - 2021-3-18 = 173 176 * Add - Now admin can see which user make credit / debit transaction. 174 177 * Fix - Cashback recalculation issue. 175 178 * Fix - Debit Round up issue for bulk action. 176 179 * Fix - Removed order again button from wallet rechargeable order details page. 177 180 * Tweak - Now referral bonus will be credited after user purchase something from the store. 178 181 * Dev - Added new filter `woo_wallet_calculate_cashback_on_total` to set cashback on order total or subtotal. 179 182 180 183 = 1.3.17 - 2020-12-29 = 181 184 * Fix - Fix URL while searching users in balance details page. 182 185 * Fix - Redirect issue in adjust balance page. 183 186 * Fix - Decimal point issue in bulk credit, debit wallet balance. 184 187 * Fix - WooCommerce Analytics report. 185 188 186 189 = 1.3.16 - 2020-08-26 = 187 190 * Add - New wallet recharge state in dashboard widget. 188 191 * Tweak - Now cashback will be calculated on order total instead of order subtotal. 189 192 * Tweak - Excluded wallet rechargable orders from WooCommerce analytics page. 190 193 * Tweak - Database query result performance optimization. 191 194 * Fix - Translation issue and wp list table display issue for mobile. 192 195 * Fix - Redirection issue in wallet dashboard for wallet shortcode. 193 196 * Dev - Added hooks into WooCommerce product review action. 194 197 195 198 = 1.3.15 - 2020-04-22 = 196 199 * Add - AJAX datatable on wallet transaction details page. 197 200 * Add - Custom field in WP nav menu setting to display wallet icon and amount instead of menu title. 198 201 * Notice - Mini wallet display location settings will be removed on next update use WooCommerce endpoint menu item instead. 199 202 200 203 = 1.3.14 - 2020-03-07 = 201 204 * Add - Bulk credit debit option for admin #46. 202 205 * Fix - Current link attributes in wallet details page #45. 203 206 204 207 = 1.3.13 - 2020-02-08 = 205 208 * Fix - Wallet top-up issue. 206 209 207 210 = 1.3.12 - 2020-02-07 = 208 211 * Add - Mini wallet RTL support. 209 212 * Add - Support for WooCommerce subscription payment method change. 210 213 * Add - Copy to clipboard function in referral URL. 211 214 * Fix - Cashback recalculation function. 212 215 * Fix - Loading issue in wallet transfer searchbox. 213 216 * Tweak - `is_full_payment_through_wallet` function. 214 217 * Dev - Added `woo_wallet_cashback_rules` filter. 215 218 * Dev - Added `created_by` database column to `woo_wallet_transactions` table. 216 219 217 220 = 1.3.11 - 2019-11-13 = 218 221 * Add - Mini wallet shortcode. 219 222 * Fix - Cashback amount for product cart rule. 220 223 * Fix - Wallet endpoint issue for shortcode. 221 224 222 225 = 1.3.10 - 2019-09-11 = 223 226 * Add - Submit button at Wallet Top-Up widget. 224 227 * Fix - Cashback calculation issue for product category. 225 228 * Fix - Partial payment template. 226 229 * Fix - WooCommerce endpoint save issue. 227 230 * Tweak - Alter database column amount and balance. 228 231 229 232 = 1.3.9 - 2019-06-18 = 230 233 * New - Now admin can configure cashback for variable products. 231 234 232 235 = 1.3.8 - 2019-06-07 = 233 236 * Add - Role wise filter in wallet transaction page. 234 237 * Add - Hooks and Filters. 235 238 236 239 = 1.3.7 - 2019-05-05 = 237 240 * Add - Minimum transfer limit. 238 241 * Fix - Dokan withdrawal issue. 239 242 240 243 = 1.3.6 - 2019-04-19 = 241 244 * Updated - Plugin name change. 242 245 243 246 = 1.3.5 - 2019-04-18 = 244 247 * Add - Support for WC version 3.6. 245 248 * Add - Referral action. 246 249 * Fix - `wc_format_decimal` function use in partial payment. 247 250 * Remove - Deprecated WC functions. 248 251 249 252 = 1.3.4 - 2019-03-23 = 250 253 * Added - Compatibility with WooCommerce Germanized plugin. 251 254 * Add - Empty datatable info translation string 252 255 * Add - Fee amount in woowallet cart total function. 253 256 * Fix - Wallet transfer menu issue. 254 257 255 258 = 1.3.3 - 2019-03-04 = 256 259 * Fix - Plugin dependencies file. 257 260 258 261 = 1.3.2 - 2019-02-27 = 259 262 * Add - Now cart items will be restored after successful wallet top-up. 260 263 * Fix - Partial payment issues. 261 264 * Fix - Cashback calculation for variable product. 262 265 * Fix - Transaction date issue. 263 266 * Fix - Order by balance column in WooWallet balance details table. 264 267 * Tweak - Cashback logic. 265 268 * Tweak - Wallet funds transfer description. 266 269 267 270 = 1.3.1 - 2019-02-04 = 268 271 * Fix - Cashback issue. 269 272 270 273 = 1.3.0 - 2019-02-02 = 271 274 * Add - Now cashback will be credited if admin create order for customer. 272 275 * Add - Added wallet top-up widget. 273 276 * Fix - Disable partial payment if user balance is zero. 274 277 * Fix - Multiple ajax call for partial payment. 275 278 * Fix - Delete transaction records upon deletion of user. 276 279 * Tweak - Daily visit. 277 280 278 281 [See changelog for all versions](https://raw.githubusercontent.com/malsubrata/woo-wallet/master/changelog.txt). 279 282 280 283 == Upgrade Notice == 281 284 282 285 = 1.3 = -
woo-wallet/trunk/woo-wallet.php
r2816610 r2817824 1 1 <?php 2 2 /** 3 3 * Plugin Name: TeraWallet 4 4 * Plugin URI: https://wordpress.org/plugins/woo-wallet/ 5 5 * Description: The leading wallet plugin for WooCommerce with partial payment, refunds, cashbacks and what not! 6 6 * Author: StandaloneTech 7 7 * Author URI: https://standalonetech.com/ 8 * Version: 1.4. 38 * Version: 1.4.4 9 9 * Requires at least: 4.4 10 10 * Tested up to: 6.1 11 11 * WC requires at least: 3.0 12 * WC tested up to: 7. 012 * WC tested up to: 7.1 13 13 * 14 14 * Text Domain: woo-wallet 15 15 * Domain Path: /languages/ 16 16 * 17 17 * 18 18 * This program is free software: you can redistribute it and/or modify 19 19 * it under the terms of the GNU General Public License as published by 20 20 * the Free Software Foundation, either version 3 of the License, or 21 21 * (at your option) any later version. 22 22 * 23 23 * This program is distributed in the hope that it will be useful, 24 24 * but WITHOUT ANY WARRANTY; without even the implied warranty of 25 25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26 26 * GNU General Public License for more details. 27 27 * 28 28 * You should have received a copy of the GNU General Public License 29 29 * along with this program. If not, see <http://www.gnu.org/licenses/>. 30 30 * 31 31 * @package WooWallet 32 32 */ 33 33 34 34 if ( ! defined( 'ABSPATH' ) ) { 35 35 exit; 36 36 } 37 37 38 38 // Define WOO_WALLET_PLUGIN_FILE. 39 39 if ( ! defined( 'WOO_WALLET_PLUGIN_FILE' ) ) { 40 40 define( 'WOO_WALLET_PLUGIN_FILE', __FILE__ ); 41 41 } 42 42 43 43 // Define WOO_WALLET_ABSPATH. 44 44 if ( ! defined( 'WOO_WALLET_ABSPATH' ) ) { 45 45 define( 'WOO_WALLET_ABSPATH', dirname( WOO_WALLET_PLUGIN_FILE ) . '/' ); 46 46 } 47 47 48 48 // Define WOO_WALLET_PLUGIN_VERSION. 49 49 if ( ! defined( 'WOO_WALLET_PLUGIN_VERSION' ) ) { 50 define( 'WOO_WALLET_PLUGIN_VERSION', '1.4. 3' );50 define( 'WOO_WALLET_PLUGIN_VERSION', '1.4.4' ); 51 51 } 52 52 53 53 // include dependencies file. 54 54 if ( ! class_exists( 'Woo_Wallet_Dependencies' ) ) { 55 55 include_once dirname( __FILE__ ) . '/includes/class-woo-wallet-dependencies.php'; 56 56 } 57 57 58 58 // Include the main class. 59 59 if ( ! class_exists( 'WooWallet' ) ) { 60 60 include_once dirname( __FILE__ ) . '/includes/class-woo-wallet.php'; 61 61 } 62 62 /** 63 63 * Returns the main instance of WooWallet. 64 64 * 65 65 * @since 1.1.0 66 66 * @return WooWallet 67 67 */ 68 68 function woo_wallet() { 69 69 return WooWallet::instance(); 70 70 } 71 71 72 72 $GLOBALS['woo_wallet'] = woo_wallet();
Note: See TracChangeset
for help on using the changeset viewer.