├── src ├── payment-method │ ├── style.scss │ └── index.js ├── fonts │ ├── woowallet.eot │ ├── woowallet.ttf │ ├── woowallet.woff │ └── woowallet.svg ├── admin │ ├── product.js │ ├── actions.js │ ├── main.js │ ├── export.js │ └── order.js ├── partial-payment │ ├── style.scss │ └── index.js ├── scss │ ├── export.scss │ └── admin.scss └── frontend │ └── main.js ├── .gitignore ├── assets ├── images │ ├── wallet-coupons.png │ ├── wallet-importer.png │ ├── wallet-withdrawal.png │ └── wallet-affiliatewp.png └── jquery │ └── css │ ├── images │ ├── ui-icons_444444_256x240.png │ ├── ui-icons_555555_256x240.png │ ├── ui-icons_777620_256x240.png │ ├── ui-icons_777777_256x240.png │ ├── ui-icons_cc0000_256x240.png │ └── ui-icons_ffffff_256x240.png │ └── responsive.dataTables.min.css ├── postcss.config.js ├── templates ├── no-access.php ├── transactions.php ├── mini-wallet.php ├── topup.php ├── emails │ ├── plain │ │ ├── user-new-transaction.php │ │ └── low-wallet-balance.php │ ├── low-wallet-balance.php │ └── user-new-transaction.php ├── transfer.php ├── admin │ ├── edit-balance.php │ └── html-exporter.php ├── woo-wallet-partial-payment.php ├── referrals.php └── wc-endpoint-wallet.php ├── composer.json ├── includes ├── class-woo-wallet-helper.php ├── marketplace │ ├── wc-merketplace │ │ ├── class-woo-wallet-wcmp.php │ │ └── class-woo-wallet-wcmp-gateway.php │ └── wcfmmp │ │ ├── class-woo-wallet-wcfmmp-gateway.php │ │ └── class-woo-wallet-wcfmmp.php ├── class-woo-wallet-api.php ├── class-woo-wallet-dependencies.php ├── actions │ ├── class-woo-wallet-action-new-registration.php │ ├── class-woo-wallet-action-daily-visits.php │ └── class-woo-wallet-action-product-review.php ├── abstracts │ └── abstract-woo-wallet-actions.php ├── class-woo-wallet-payments-blocks.php ├── class-woo-wallet-actions.php ├── class-woo-wallet-widgets.php ├── helper │ └── woo-wallet-update-functions.php ├── class-woo-wallet-partial-payment-blocks.php ├── emails │ ├── class-woo-wallet-email-low-wallet-balance.php │ └── class-woo-wallet-email-new-transaction.php ├── api │ ├── class-woo-wallet-rest-controller.php │ ├── class-wc-rest-woo-wallet-controller.php │ └── Controllers │ │ └── Version3 │ │ └── class-wc-rest-wallet-controller.php ├── admin │ └── class-woo-wallet-transaction-details.php ├── multicurrency │ ├── woocommerce-currency-switcher │ │ └── class-wallet-multi-currency.php │ └── woocommerce-multilingual │ │ └── class-wallet-wpml-multi-currency.php ├── class-woo-wallet-install.php └── class-woo-wallet-payment-method.php ├── README.md ├── uninstall.php ├── woo-wallet.php ├── package.json └── webpack.config.js /src/payment-method/style.scss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/fonts/woowallet.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/malsubrata/woo-wallet/HEAD/src/fonts/woowallet.eot -------------------------------------------------------------------------------- /src/fonts/woowallet.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/malsubrata/woo-wallet/HEAD/src/fonts/woowallet.ttf -------------------------------------------------------------------------------- /src/fonts/woowallet.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/malsubrata/woo-wallet/HEAD/src/fonts/woowallet.woff -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Grunt 2 | /node_modules/ 3 | none 4 | package-lock.json 5 | 6 | # Sass 7 | .sass-cache/ 8 | /build/ -------------------------------------------------------------------------------- /assets/images/wallet-coupons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/malsubrata/woo-wallet/HEAD/assets/images/wallet-coupons.png -------------------------------------------------------------------------------- /assets/images/wallet-importer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/malsubrata/woo-wallet/HEAD/assets/images/wallet-importer.png -------------------------------------------------------------------------------- /assets/images/wallet-withdrawal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/malsubrata/woo-wallet/HEAD/assets/images/wallet-withdrawal.png -------------------------------------------------------------------------------- /assets/images/wallet-affiliatewp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/malsubrata/woo-wallet/HEAD/assets/images/wallet-affiliatewp.png -------------------------------------------------------------------------------- /assets/jquery/css/images/ui-icons_444444_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/malsubrata/woo-wallet/HEAD/assets/jquery/css/images/ui-icons_444444_256x240.png -------------------------------------------------------------------------------- /assets/jquery/css/images/ui-icons_555555_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/malsubrata/woo-wallet/HEAD/assets/jquery/css/images/ui-icons_555555_256x240.png -------------------------------------------------------------------------------- /assets/jquery/css/images/ui-icons_777620_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/malsubrata/woo-wallet/HEAD/assets/jquery/css/images/ui-icons_777620_256x240.png -------------------------------------------------------------------------------- /assets/jquery/css/images/ui-icons_777777_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/malsubrata/woo-wallet/HEAD/assets/jquery/css/images/ui-icons_777777_256x240.png -------------------------------------------------------------------------------- /assets/jquery/css/images/ui-icons_cc0000_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/malsubrata/woo-wallet/HEAD/assets/jquery/css/images/ui-icons_cc0000_256x240.png -------------------------------------------------------------------------------- /assets/jquery/css/images/ui-icons_ffffff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/malsubrata/woo-wallet/HEAD/assets/jquery/css/images/ui-icons_ffffff_256x240.png -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | // This file is used to configure PostCSS for the Woo Wallet plugin. 2 | // It is used to process CSS files with Tailwind CSS and Autoprefixer. 3 | module.exports = { 4 | plugins: [ 5 | '@tailwindcss/postcss', 6 | 'autoprefixer' 7 | ] 8 | }; 9 | -------------------------------------------------------------------------------- /src/admin/product.js: -------------------------------------------------------------------------------- 1 | /* global woo_wallet_admin_product_param */ 2 | 3 | jQuery(document).ready(function ($) { 4 | if (woo_wallet_admin_product_param.is_hidden) { 5 | $('tr.post-' + woo_wallet_admin_product_param.product_id + '.type-product').remove(); 6 | } 7 | }); -------------------------------------------------------------------------------- /src/admin/actions.js: -------------------------------------------------------------------------------- 1 | jQuery(function ($) { 2 | $('#woo_wallet_referrals_referring_visitors_limit_duration').on('change', function(){ 3 | if('0' === $(this).val()){ 4 | $('#woo_wallet_referrals_referring_visitors_limit').closest('tr').hide(); 5 | } else{ 6 | $('#woo_wallet_referrals_referring_visitors_limit').closest('tr').show(); 7 | } 8 | }).change(); 9 | $('#woo_wallet_referrals_referring_signups_limit_duration').on('change', function(){ 10 | if('0' === $(this).val()){ 11 | $('#woo_wallet_referrals_referring_signups_limit').closest('tr').hide(); 12 | } else{ 13 | $('#woo_wallet_referrals_referring_signups_limit').closest('tr').show(); 14 | } 15 | }).change(); 16 | }); -------------------------------------------------------------------------------- /src/partial-payment/style.scss: -------------------------------------------------------------------------------- 1 | .wc-block-components-partial-payment { 2 | flex-direction: column; 3 | position: relative; 4 | 5 | .wc-block-components-partial-payment_form { 6 | display: flex; 7 | margin-bottom: 0; 8 | width: 100%; 9 | 10 | .wc-block-components-partial-payment_input { 11 | flex-grow: 1; 12 | margin-bottom: 0; 13 | margin-top: 0; 14 | } 15 | 16 | .wc-block-components-partial-payment_button { 17 | flex-shrink: 0; 18 | height: 3em; 19 | margin-left: 8px; 20 | padding-left: 24px; 21 | padding-right: 24px; 22 | white-space: nowrap; 23 | } 24 | } 25 | } 26 | 27 | .slot-wrapper:has(.wc-block-components-discounts-meta) { 28 | padding: 16px 0 !important; 29 | } -------------------------------------------------------------------------------- /templates/no-access.php: -------------------------------------------------------------------------------- 1 | 23 |

24 | 25 |

26 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "malsubrata/woo-wallet", 3 | "type": "wordpress-plugin", 4 | "license": "GPL-3.0-or-later", 5 | "description": "A powerful, extendable WooCommerce wallet system which support payment, partial payment, cashback reward program as well as refund for your WooCommerce store.", 6 | "homepage": "https://standalonetech.com/", 7 | "authors": [ 8 | { 9 | "name": "Subrata Mal", 10 | "email": "m.subrata1991@gmail.com", 11 | "homepage": "https://github.com/malsubrata" 12 | } 13 | ], 14 | "keywords": [ 15 | "wordpress", 16 | "woocommerce-wallet", 17 | "wallet", 18 | "wordpress-plugin" 19 | ], 20 | "support": { 21 | "issues": "https://github.com/malsubrata/woo-wallet/issues" 22 | }, 23 | "require": { 24 | "php": ">=5.6", 25 | "composer/installers": "~1.6" 26 | } 27 | } -------------------------------------------------------------------------------- /includes/class-woo-wallet-helper.php: -------------------------------------------------------------------------------- 1 | update_meta_data( $key, $value ); 30 | } 31 | if ( is_callable( array( $order, 'save' ) ) && $do_save ) { 32 | $order->save(); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # [TeraWallet](https://standalonetech.com/) [![WP compatibility](https://plugintests.com/plugins/woo-wallet/wp-badge.svg)](https://plugintests.com/plugins/woo-wallet/latest) [![PHP compatibility](https://plugintests.com/plugins/woo-wallet/php-badge.svg)](https://plugintests.com/plugins/woo-wallet/latest) 2 | 3 | Welcome to the WooCommerce Wallet repository on GitHub. Here you can browse the source, look at open issues and keep track of development. 4 | 5 | If you are not a developer, please use the [WooCommerce Wallet plugin page](https://wordpress.org/plugins/woo-wallet/) on WordPress.org. 6 | 7 | ## Support 8 | This repository is not suitable for support. Please don't use our issue tracker for support requests, but for core issues only. Support can take place through the appropriate channels: 9 | 10 | * The [TeraWallet premium support portal](https://standalonetech.com/support-forums/) for customers who have purchased extensions. 11 | * [Our community forum on wp.org](https://wordpress.org/support/plugin/woo-wallet) which is available for all WordPress users. 12 | -------------------------------------------------------------------------------- /templates/transactions.php: -------------------------------------------------------------------------------- 1 | 22 | 23 |
24 |

25 | 26 |
27 | 28 |
-------------------------------------------------------------------------------- /templates/mini-wallet.php: -------------------------------------------------------------------------------- 1 | 22 | 28 | -------------------------------------------------------------------------------- /uninstall.php: -------------------------------------------------------------------------------- 1 | query( "DROP TABLE IF EXISTS {$wpdb->base_prefix}woo_wallet_transactions" ); 31 | $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->base_prefix}woo_wallet_transaction_meta" ); 32 | 33 | // Delete options. 34 | $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE '_wallet\_%';" ); 35 | $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE '_woo_wallet\_%';" ); 36 | 37 | // Clear any cached data that has been removed. 38 | wp_cache_flush(); 39 | } 40 | -------------------------------------------------------------------------------- /src/admin/main.js: -------------------------------------------------------------------------------- 1 | /* global terawallet_admin_params */ 2 | import '../scss/admin.scss'; 3 | jQuery(function ($) { 4 | var $wallet_screen = $('.toplevel_page_woo-wallet'), 5 | $title_action = $wallet_screen.find('.wrap h2:first'); 6 | $title_action.html($title_action.html() + ' ' + terawallet_admin_params.export_title + ''); 7 | 8 | $('.lock-unlock-user-wallet').on('click', function(){ 9 | var self = $(this); 10 | var data = { 11 | action : 'lock_unlock_terawallet', 12 | user_id: $(this).data('user_id'), 13 | type: $(this).data('type'), 14 | security : terawallet_admin_params.lock_unlock_nonce 15 | }; 16 | $.post(terawallet_admin_params.ajax_url, data, function(response){ 17 | if('lock' === response.data.type){ 18 | self.find('span').removeClass('dashicons-unlock'); 19 | self.find('span').addClass('dashicons-lock'); 20 | self.find('label').text(response.data.text); 21 | self.data('type', response.data.type); 22 | } else{ 23 | self.find('span').removeClass('dashicons-lock'); 24 | self.find('span').addClass('dashicons-unlock'); 25 | self.find('label').text(response.data.text); 26 | self.data('type', response.data.type); 27 | } 28 | }); 29 | }); 30 | 31 | }); -------------------------------------------------------------------------------- /woo-wallet.php: -------------------------------------------------------------------------------- 1 | __( 'Wallet', 'woo-wallet' ) ) ); 38 | } 39 | 40 | public function add_wallet_vendor_payment_method( $payment_method ) { 41 | if ( 'Enable' === get_wcmp_vendor_settings( 'payment_method_woo_wallet', 'payment' ) ) { 42 | return array_merge( $payment_method, array( 'woo_wallet' => __( 'Wallet', 'woo-wallet' ) ) ); 43 | } 44 | return $payment_method; 45 | } 46 | 47 | public function add_wcmp_wallet_payment_gateway( $load_gateways ) { 48 | $load_gateways[] = 'WCMp_Gateway_Wallet'; 49 | return $load_gateways; 50 | } 51 | 52 | } 53 | 54 | } 55 | Woo_Wallet_WCMp::instance(); 56 | -------------------------------------------------------------------------------- /includes/class-woo-wallet-api.php: -------------------------------------------------------------------------------- 1 | 6 | * @since 1.2.5 7 | * @package StandaleneTech 8 | */ 9 | 10 | if ( ! defined( 'ABSPATH' ) ) { 11 | exit; // Exit if accessed directly. 12 | } 13 | if ( ! class_exists( 'WooWallet_API' ) ) { 14 | /** 15 | * Wallet API class 16 | */ 17 | class WooWallet_API { 18 | /** 19 | * Class constructor. 20 | */ 21 | public function __construct() { 22 | // WP REST API. 23 | $this->rest_api_init(); 24 | } 25 | 26 | /** 27 | * Init WP REST API. 28 | * 29 | * @since 1.2.5 30 | */ 31 | private function rest_api_init() { 32 | // REST API was included starting WordPress 4.4. 33 | if ( ! class_exists( 'WP_REST_Server' ) ) { 34 | return; 35 | } 36 | 37 | // Init REST API routes. 38 | add_action( 'rest_api_init', array( $this, 'register_rest_routes' ), 10 ); 39 | } 40 | 41 | /** 42 | * Include REST API classes. 43 | * 44 | * @since 1.2.5 45 | */ 46 | private function rest_api_includes() { 47 | include_once dirname( __FILE__ ) . '/api/class-wc-rest-woo-wallet-controller.php'; 48 | include_once dirname( __FILE__ ) . '/api/Controllers/Version3/class-wc-rest-wallet-controller.php'; 49 | } 50 | 51 | /** 52 | * Register REST API routes. 53 | * 54 | * @since 1.2.5 55 | */ 56 | public function register_rest_routes() { 57 | $this->rest_api_includes(); 58 | $controllers = array( 59 | // v2 controllers. 60 | 'WC_REST_Woo_Wallet_Controller', 61 | // v3 controllers. 62 | 'WC_REST_TeraWallet_V3_Controller', 63 | ); 64 | foreach ( $controllers as $controller ) { 65 | $woo_wallet_api = new $controller(); 66 | $woo_wallet_api->register_routes(); 67 | } 68 | } 69 | 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /src/scss/export.scss: -------------------------------------------------------------------------------- 1 | .terawallet-exporter-wrapper{ 2 | text-align: center; 3 | max-width: 700px; 4 | margin: 40px auto; 5 | .tw-actions{ 6 | overflow: hidden; 7 | border-top: 1px solid #eee; 8 | margin: 0; 9 | padding: 23px 24px 24px; 10 | line-height: 3em; 11 | button{ 12 | float: right; 13 | font-size: 1.25em; 14 | padding: .5em 1em!important; 15 | line-height: 1.5em!important; 16 | margin-right: .5em; 17 | margin-bottom: 2px; 18 | height: auto!important; 19 | border-radius: 4px; 20 | margin: 0; 21 | opacity: 1; 22 | } 23 | } 24 | .terawallet-exporter{ 25 | background: #fff; 26 | overflow: hidden; 27 | padding: 0; 28 | margin: 0 0 16px; 29 | box-shadow: 0 1px 3px rgba(0,0,0,.13); 30 | color: #555; 31 | text-align: left; 32 | header{ 33 | border-bottom: 1px solid #eee; 34 | margin: 0; 35 | padding: 24px 24px 0; 36 | } 37 | section{ 38 | padding: 24px 24px 0; 39 | } 40 | progress{ 41 | display: none; 42 | width: 100%; 43 | height: 42px; 44 | margin: 0 auto 24px; 45 | background: #f5f5f5; 46 | border: 2px solid #eee; 47 | border-radius: 4px; 48 | padding: 0; 49 | box-shadow: 0 1px 0 0 rgba(255,255,255,.2); 50 | } 51 | .spinner{ 52 | display: none; 53 | } 54 | } 55 | 56 | .terawallet-exporter__exporting { 57 | .spinner{ 58 | display: block; 59 | } 60 | progress{ 61 | display: block; 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "woo-wallet", 3 | "title": "TeraWallet - WooCommerce Wallet", 4 | "version": "1.5.0", 5 | "description": "A powerful, extendable WooCommerce wallet system which support payment, partial payment, cashback reward program as well as refund for your WooCommerce store.", 6 | "main": "Gruntfile.js", 7 | "repository": { 8 | "type": "git", 9 | "url": "git+https://malsubrata@github.com/malsubrata/woo-wallet.git" 10 | }, 11 | "keywords": [ 12 | "woocommerce-wallet", 13 | "wallet", 14 | "wordpress-plugin" 15 | ], 16 | "author": "StandaloneTech", 17 | "license": "GPL-3.0+", 18 | "bugs": { 19 | "url": "https://github.com/malsubrata/woo-wallet/issues" 20 | }, 21 | "homepage": "https://github.com/malsubrata/woo-wallet#readme", 22 | "browserslist": [ 23 | "extends @wordpress/browserslist-config" 24 | ], 25 | "devDependencies": { 26 | "@babel/runtime": "^7.28.4", 27 | "@woocommerce/dependency-extraction-webpack-plugin": "^4.0.0", 28 | "@wordpress/scripts": "^30.16.0", 29 | "autoprefixer": "^10.4.21", 30 | "css-minimizer-webpack-plugin": "^7.0.2", 31 | "mini-css-extract-plugin": "^2.7.6", 32 | "postcss": "^8.5.3", 33 | "postcss-loader": "^8.1.1", 34 | "postcss-rtlcss": "^5.7.0", 35 | "rtlcss": "^4.3.0", 36 | "rtlcss-webpack-plugin": "^4.0.7", 37 | "sass": "^1.87.0", 38 | "sass-loader": "^13.3.3", 39 | "tailwindcss": "^4.1.5", 40 | "webpack": "^5.88.2", 41 | "webpack-cli": "^5.1.4", 42 | "wp-cli": "^0.0.5" 43 | }, 44 | "dependencies": { 45 | "@tailwindcss/postcss": "^4.1.5" 46 | }, 47 | "scripts": { 48 | "build": "wp-scripts build", 49 | "start": "wp-scripts start", 50 | "make-pot": "wp i18n make-pot . languages/woo-wallet.pot" 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /templates/topup.php: -------------------------------------------------------------------------------- 1 | 22 | 23 |
24 |

25 |
26 |
27 | 28 | settings_api->get_option( 'min_topup_amount', '_wallet_settings_general', 0 ); 30 | $max_amount = woo_wallet()->settings_api->get_option( 'max_topup_amount', '_wallet_settings_general', '' ); 31 | ?> 32 | 33 | 34 | 35 |
36 |
37 |
-------------------------------------------------------------------------------- /templates/emails/plain/user-new-transaction.php: -------------------------------------------------------------------------------- 1 | wallet->get_wallet_balance( $user->ID, 'edit' ); 23 | $balance = $currency . $remaining; 24 | echo '= ' . esc_html( $email_heading ) . " =\n\n"; 25 | echo "\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n"; 26 | if ( 'credit' === $type ) { 27 | echo esc_html__( 'Thank you for using your wallet.', 'woo-wallet' ) . esc_html( $balance ) . esc_html__( 'has been credited to your wallet.', 'woo-wallet' ) . ' ' . esc_html__( 'Current wallet balance is', 'woo-wallet' ) . esc_html( $balance ); 28 | } 29 | if ( 'debit' === $type ) { 30 | echo esc_html__( 'Thank you for using your wallet.', 'woo-wallet' ) . esc_html( $balance ) . esc_html__( 'has been debited from your wallet.', 'woo-wallet' ) . ' ' . esc_html__( 'Current wallet balance is', 'woo-wallet' ) . esc_html( $balance ); 31 | } 32 | echo "\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n"; 33 | echo apply_filters( 'woocommerce_email_footer_text', get_option( 'woocommerce_email_footer_text' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 34 | -------------------------------------------------------------------------------- /templates/emails/low-wallet-balance.php: -------------------------------------------------------------------------------- 1 | 30 |

31 | 35 |

36 |

37 | 38 | wallet->get_wallet_balance( $user->ID ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 41 | ?> 42 | 43 |

44 |

45 | 46 |

47 | wallet->get_wallet_balance( $user->ID, 'edit' ); 23 | echo '= ' . esc_html( $email_heading ) . " =\n\n"; 24 | echo "\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n"; 25 | /* translators: 1: wallet amount */ 26 | echo sprintf( esc_html__( 'Your %s wallet balance is low.', 'woo-wallet' ), wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 27 | echo "\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n"; 28 | /* translators: 1: wallet amount */ 29 | echo sprintf( esc_html__( 'Current Balance: %s', 'woo-wallet' ), $currency . ' ' . woo_wallet()->wallet->get_wallet_balance( $user->ID, 'edit' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 30 | echo "\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n"; 31 | echo sprintf( esc_html__( 'Please recharge you wallet now to avoid any disruption.', 'woo-wallet' ) ); 32 | 33 | echo "\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n"; 34 | echo apply_filters( 'woocommerce_email_footer_text', get_option( 'woocommerce_email_footer_text' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 35 | -------------------------------------------------------------------------------- /templates/emails/user-new-transaction.php: -------------------------------------------------------------------------------- 1 | 29 | 30 |

ID ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> wallet->get_wallet_balance( $user->ID ); ?>

31 | 32 | 33 |

ID ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> wallet->get_wallet_balance( $user->ID ); ?>

34 | 35 | { 24 | return decodeEntities( settings.description || '' ); 25 | }; 26 | 27 | const formatedBalance = () => { 28 | const { balance, currency_symbol, decimal_separator, thousand_separator, decimals } = settings; 29 | // Ensure that 'amount' is a valid number 30 | let numericAmount = parseFloat(balance); 31 | if (isNaN(numericAmount)) { 32 | return amount; // Return the original value if it's not a valid number 33 | } 34 | // Format the amount to the required number of decimal places 35 | let fixedAmount = numericAmount.toFixed(decimals); 36 | // Split the integer and decimal parts 37 | let parts = fixedAmount.split('.'); 38 | // Add thousand separator to the integer part only 39 | parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, thousand_separator); 40 | // Rejoin integer and decimal parts with the correct decimal separator 41 | let formattedAmount = parts.join(decimal_separator); 42 | return decodeEntities(`${currency_symbol}${formattedAmount}`); 43 | } 44 | 45 | const CurrentBalance = () => { 46 | return ( 47 | 48 |  { /* translators: 1: Wallet amount */ sprintf(__('| Current Balance: %s', 'woo-wallet'), formatedBalance())} 49 | 50 | ); 51 | } 52 | /** 53 | * Label component 54 | * 55 | * @param {*} props Props from payment API. 56 | */ 57 | const Label = ( props ) => { 58 | const { PaymentMethodLabel } = props.components; 59 | return <> ; 60 | }; 61 | 62 | /** 63 | * Wallet payment method config object. 64 | */ 65 | const Wallet = { 66 | name: "wallet", 67 | label: