Plugin Directory

Changeset 3327025


Ignore:
Timestamp:
07/13/2025 01:49:12 PM (9 months ago)
Author:
mugglepay
Message:

New Version

Location:
mugglepay
Files:
57 added
9 edited

Legend:

Unmodified
Added
Removed
  • mugglepay/trunk/assets/css/mpwp-admin.css

    r3137189 r3327025  
    1 #woocommerce_mpwp_payment_gateway+.form-table {
     1tr[data-gateway_id="muggle_pay_methods"],
     2tr[data-gateway_id="usdt_methods"],
     3tr[data-gateway_id="usdc_methods"],
     4tr[data-gateway_id="eth_methods"],
     5#muggle_pay_methods.woocommerce-item__payment-gateway,
     6#usdt_methods.woocommerce-item__payment-gateway,
     7#usdc_methods.woocommerce-item__payment-gateway,
     8#eth_methods.woocommerce-item__payment-gateway {
    29    display: none;
    310}
  • mugglepay/trunk/assets/js/blocks/mpwp.js

    r3137189 r3327025  
    1 (() => {
    2     const { wcSettings, wcBlocksRegistry } = window.wc;
     1const { registerPaymentMethod } = window.wc.wcBlocksRegistry;
    32
    4     const data = wcSettings.getSetting("mpwp_data");
     3const mpwp_data = window.wc.wcSettings.getSetting("mpwp_data");
    54
    6     console.log('data', data)
     5const mpwp_label = wp.htmlEntities.decodeEntities(mpwp_data.title || "");
    76
    8     const mpwpTitle = wp.htmlEntities.decodeEntities(data.title || "");
    9     const decodeDescription = () => wp.htmlEntities.decodeEntities(data.description || "");
     7const mpwp_Content = () => {
     8    return wp.htmlEntities.decodeEntities(mpwp_data.description || "");
     9}
    1010
    11     const mpwpPaymentMethod = {
    12         name: "mpwp",
    13         ariaLabel: mpwpTitle,
    14         label: window.React.createElement(
    15             () => {
    16                 return window.React.createElement(() => mpwpTitle);
    17             },
    18             null
    19         ),
    20         content: window.React.createElement(decodeDescription, null),
    21         edit: window.React.createElement(decodeDescription, null),
    22         canMakePayment: () => {
    23             console.log("canMakePaymentcanMakePayment");
    24             console.log("canMakePayment");
    25             return true;
    26         },
    27         supports: {
    28             showSavedCards: false,
    29             showSaveOption: false,
    30             features: data.supports,
    31         },
    32     };
     11const mpwp_Label = (props) => {
     12    const { PaymentMethodLabel } = props.components;
     13    return React.createElement(PaymentMethodLabel, { text: mpwp_label });
     14}
    3315
    34     wcBlocksRegistry.registerPaymentMethod(mpwpPaymentMethod);
    35 })();
     16registerPaymentMethod({
     17    name: "mpwp",
     18    title: React.createElement(mpwp_Label),
     19    description: React.createElement(mpwp_Content),
     20    label: React.createElement(mpwp_Label),
     21    content: React.createElement(mpwp_Content),
     22    gatewayId : "mpwp",
     23    edit: React.createElement(mpwp_Content),
     24    canMakePayment: () => true,
     25    ariaLabel: mpwp_label,
     26    supports: {
     27        features: mpwp_data.supports,
     28    }
     29});
  • mugglepay/trunk/class/class-mpwp-gateway-blocks-support.php

    r3137189 r3327025  
    1717    protected $name = 'mpwp';
    1818
     19    private $gateway;
    1920
    2021    /**
     
    2223     */
    2324    public function initialize() {
     25
    2426        $this->settings = get_option( 'woocommerce_mpwp_settings', array() );
     27       
     28        $gateways = WC()->payment_gateways->payment_gateways();
     29       
     30        $this->gateway  = $gateways[ $this->name ];
    2531
    2632        add_action( 'woocommerce_rest_checkout_process_payment_with_context', array( $this, 'mpwp_failed_payment_notice' ), 8, 2 );
     
    4046
    4147        // return $payment_gateways[ $this->name ]->is_available();
    42 
    43         return true;
     48       
     49        return ! empty( $this->settings[ 'enabled' ] ) && 'yes' === $this->settings[ 'enabled' ];
    4450    }
    4551
     
    5157    public function get_payment_method_script_handles() {
    5258        $script_url = plugins_url( "/assets/js/blocks/mpwp.js", MPWP_MAIN_FILE );
    53 
     59   
    5460        wp_register_script(
    5561            "wc-mpwp-blocks",
    5662            $script_url,
    57             array('wc-blocks-checkout', 'react', 'wc-blocks-registry', 'wc-settings', 'wp-html-entities', 'wp-i18n'),
    58             '1.2',
     63            array(  'wp-element', 'wc-blocks-checkout', 'react', 'wc-blocks-registry', 'wc-settings', 'wp-html-entities', 'wp-i18n'),
     64            '1.4',
    5965            true
    6066        );
     67
    6168        wp_set_script_translations( 'wc-mpwp-blocks', 'mugglepay' );
     69
    6270        return array( "wc-mpwp-blocks" );
    6371    }
     
    7583            'title'             => $this->get_setting( 'title' ),
    7684            'description'       => $this->get_setting( 'description' ),
    77             'supports'          => array_filter( $gateway->supports, array( $gateway, 'supports' ) ),
     85            'supports'          => array_filter( $this->gateway->supports, array( $this->gateway, 'supports' ) ),
    7886            'allow_saved_cards' => is_user_logged_in(),
    7987        );
     
    98106        }
    99107    }
     108
    100109}
  • mugglepay/trunk/class/class-mpwp-gateway.php

    r3178105 r3327025  
    44    exit;
    55}
     6
     7use Automattic\WooCommerce\StoreApi\Exceptions\RouteException;
    68
    79/**
     
    264266
    265267        $result = $this->get_payment_url($order, $this->current_method);
    266 
     268       
    267269        if (is_wp_error($result)) {
    268             wc_add_notice($result->get_error_message(), 'error');
     270            // wc_add_notice($result->get_error_message(), 'error');
     271            throw new RouteException( 'woocommerce_rest_checkout_process_payment_error', esc_html($result->get_error_message() ), 400 );
    269272            return;
    270273        }
  • mugglepay/trunk/muggle-pay.php

    r3271150 r3327025  
    99Plugin URI:   https://mugglepay.com/
    1010Description:  MugglePay is a one-stop payment solution for merchants with an online payment need.
    11 Version:      1.0.8
     11Version:      1.0.9
    1212Author:       MugglePay
    1313Author URI:   https://x.com/mugglepay
     
    2626{
    2727    require_once MPWP_PLUGIN_DIR . 'class/class-mpwp-gateway.php';
     28    require_once MPWP_PLUGIN_DIR . 'class/class-mpwp-muggle-pay.php';
     29    require_once MPWP_PLUGIN_DIR . 'class/class-mpwp-eth.php';
     30    require_once MPWP_PLUGIN_DIR . 'class/class-mpwp-usdc.php';
     31    require_once MPWP_PLUGIN_DIR . 'class/class-mpwp-usdt.php';
    2832
    2933    // add_action( 'init', 'cb_wc_register_blockchain_status' );
     
    3943    // add payment gateway filter
    4044    add_filter('woocommerce_available_payment_gateways', 'mpwp_filter_woocommerce_available_payment_gateways', 10, 1);
     45
    4146}
    4247add_action('plugins_loaded', 'mpwp_init');
     
    4752 */
    4853function mpwp_wc_gateway_woocommerce_block_support() {
    49     if ( class_exists( 'Automattic\WooCommerce\Blocks\Payments\Integrations\AbstractPaymentMethodType' ) ) {
    50         require_once __DIR__ . '/class/class-mpwp-gateway-blocks-support.php';
    51         add_action(
    52             'woocommerce_blocks_payment_method_type_registration',
    53             static function( Automattic\WooCommerce\Blocks\Payments\PaymentMethodRegistry $payment_method_registry ) {
    54                 $payment_method_registry->register( new MPWP_WC_Gateway_Blocks_Support() );
    55             }
    56         );
    57     }
     54
     55    require_once __DIR__ . '/class/class-mpwp-gateway-blocks-support.php';
     56    require_once __DIR__ . '/class/class-mpwp-muggle-pay-methods.php';
     57    require_once __DIR__ . '/class/class-mpwp-usdt-methods.php';
     58    require_once __DIR__ . '/class/class-mpwp-usdc-methods.php';
     59    require_once __DIR__ . '/class/class-mpwp-eth-methods.php';
     60
     61    add_action(
     62        'woocommerce_blocks_payment_method_type_registration',
     63        function( Automattic\WooCommerce\Blocks\Payments\PaymentMethodRegistry $payment_method_registry ) {
     64            $payment_method_registry->register( new MPWP_WC_Gateway_Blocks_Support() );
     65            $payment_method_registry->register( new MPWP_WC_Muggle_Pay_Methods() );
     66            $payment_method_registry->register( new MPWP_WC_Usdt_Methods() );
     67            $payment_method_registry->register( new MPWP_WC_Usdc_Methods() );
     68            $payment_method_registry->register( new MPWP_WC_Eth_Methods() );
     69        }
     70    );
     71
    5872}
    5973add_action( 'woocommerce_blocks_loaded', 'mpwp_wc_gateway_woocommerce_block_support' );
    60 
    6174
    6275// Regiester Gateway To WooCommerce
     
    6477{
    6578    $methods[] = 'MPWP_WC_Gateway';
     79    $methods[] = 'MPWP_WC_Muggle_Pay';
     80    $methods[] = 'MPWP_WC_Usdt';
     81    $methods[] = 'MPWP_WC_Usdc';
     82    $methods[] = 'MPWP_WC_Eth';
    6683    return $methods;
    6784}
     
    150167function mpwp_filter_woocommerce_available_payment_gateways($available_gateways)
    151168{
     169
     170    if ( is_admin() && isset( $available_gateways['eth_methods'] ) ) {
     171        unset( $available_gateways['eth_methods'] );
     172    }
     173
    152174    if (isset($available_gateways['mpwp']) && $available_gateways['mpwp']) {
    153175        $mpwp = $available_gateways['mpwp'];
     
    166188        unset($available_gateways['mpwp']);
    167189    }
     190
    168191    return $available_gateways;
    169192};
     
    183206function mpwp_admin_load_scripts() {
    184207
    185     wp_register_style( 'wpmp-admin-style', MPWP_PLUGIN_URL.'/assets/css/wpmp-admin.css', array(), 1 );
    186     wp_enqueue_style( 'wpmp-admin-style' );
     208    wp_register_style( 'mpwp-admin-style', MPWP_PLUGIN_URL.'/assets/css/mpwp-admin.css', array(), 4 );
     209    wp_enqueue_style( 'mpwp-admin-style' );
    187210   
    188211    wp_enqueue_script('jquery');
    189212   
    190     wp_register_script( 'wpmp-admin-script', MPWP_PLUGIN_URL.'/assets/js/wpmp-admin.js', array(), 1, true );
    191     wp_enqueue_script( 'wpmp-admin-script' );
    192 
    193 }
    194 
    195 add_filter( 'network_admin_plugin_action_links', 'wpmp_add_settings_link_to_network_plugins', 10, 2 );
     213    wp_register_script( 'mpwp-admin-script', MPWP_PLUGIN_URL.'/assets/js/mpwp-admin.js', array(), 1, true );
     214    wp_enqueue_script( 'mpwp-admin-script' );
     215
     216}
     217
     218add_filter( 'network_admin_plugin_action_links', 'mpwp_add_settings_link_to_network_plugins', 10, 2 );
    196219
    197220/**
    198221 * Settings Link
    199222 */
    200 function wpmp_add_settings_link_to_network_plugins($actions, $plugin_file) {
     223function mpwp_add_settings_link_to_network_plugins($actions, $plugin_file) {
    201224   
    202225    if ( 'mugglepay/muggle-pay.php' === $plugin_file )
     
    224247}
    225248
    226 add_filter( 'plugin_action_links', 'wpmp_add_settings_link_to_plugins', 10, 2 );
    227 
    228 function wpmp_add_settings_link_to_plugins($actions, $plugin_file) {
     249add_filter( 'plugin_action_links', 'mpwp_add_settings_link_to_plugins', 10, 2 );
     250
     251function mpwp_add_settings_link_to_plugins($actions, $plugin_file) {
    229252 
    230253    if ( 'mugglepay/muggle-pay.php' === $plugin_file )
     
    239262    return $actions;
    240263}
     264
     265function declare_cart_checkout_blocks_compatibility() {
     266    // Check if the required class exists
     267    if (class_exists('\Automattic\WooCommerce\Utilities\FeaturesUtil')) {
     268        // Declare compatibility for 'cart_checkout_blocks'
     269        \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility('cart_checkout_blocks', __FILE__, true);
     270    }
     271}
     272// Hook the custom function to the 'before_woocommerce_init' action
     273add_action('before_woocommerce_init', 'declare_cart_checkout_blocks_compatibility');
  • mugglepay/trunk/readme-es_ES.txt

    r3271150 r3327025  
    33Etiquetas: mugglepay, woocommerce, pago en criptomonedas, USDT, USDC, Tether, Bitcoin, Ethereum, Solana, BTC, ETH, Visa, Stripe, tarjeta de crédito, Alipay, WeChat
    44Requiere al menos: 5.3
    5 Probado hasta: 6.5.5
     5Probado hasta: 6.8.1
    66Requiere PHP: 7.0
    7 Versión estable: 1.0.8
     7Versión estable: 1.0.9
    88Licencia: GPLv3+
    99URI de licencia: https://www.gnu.org/licenses/gpl-3.0.html
     
    5757== Registro de cambios ==
    5858
     59=== 1.0.9 ===
     60*  Admite pagos en USDC Stellar y Stellar XLM.
     61*  Se agregó soporte para editor de bloques.
     62
     63
    5964=== 1.0.8 ===
    6065*  Se agregó el enlace de Configuración en la página de complementos
  • mugglepay/trunk/readme-ru_RU.txt

    r3271150 r3327025  
    33Теги: mugglepay, woocommerce, криптовалютные платежи, USDT, USDC, Tether, Bitcoin, Ethereum, Solana, BTC, ETH, Visa, Stripe, кредитная карта, Alipay, WeChat
    44Минимальная версия: 5.3
    5 Проверено до: 6.5.5
     5Проверено до: 6.8.1
    66Требуется PHP: 7.0
    7 Стабильная версия: 1.0.8
     7Стабильная версия: 1.0.9
    88Лицензия: GPLv3+
    99URI лицензии: https://www.gnu.org/licenses/gpl-3.0.html
     
    5757== История обновлений ==
    5858
     59=== 1.0.9 ===
     60*  Поддержка платежей USDC Stellar и Stellar XLM.
     61*  Добавлена поддержка редактора блоков.
     62
     63
    5964=== 1.0.8 ===
    6065*  Добавлена ​​ссылка «Настройки» на странице плагинов
  • mugglepay/trunk/readme-zh_CN.txt

    r3271150 r3327025  
    33标签: mugglepay, woocommerce, 加密支付, USDT, USDC, Tether, 比特币, 以太坊, Solana, BTC, ETH, Visa, Stripe, 信用卡, 支付宝, 微信
    44最低要求: 5.3
    5 测试通过: 6.5.5
     5测试通过: 6.8.1
    66最低 PHP 版本: 7.0
    7 稳定版本: 1.0.8
     7稳定版本: 1.0.9
    88许可证: GPLv3+
    99许可证链接: https://www.gnu.org/licenses/gpl-3.0.html
     
    5757== 更新日志 ==
    5858
     59=== 1.0.9 ===
     60*  支持 USDC Stellar 和 Stellar XLM 支付。
     61*  添加了块编辑器支持。
     62
     63
    5964=== 1.0.8 ===
    6065*  在插件页面上添加了设置链接
  • mugglepay/trunk/readme.txt

    r3271150 r3327025  
    33Tags: mugglepay woocommerce crypto payment usdt usdc tether bitcoin ethereum solana btc eth visa stripe credit card alipay wechat
    44Requires at least: 5.3
    5 Tested up to: 6.5.5
     5Tested up to: 6.8.1
    66Requires PHP: 7.0
    7 Stable tag: 1.0.8
     7Stable tag: 1.0.9
    88License: GPLv3+
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    6464== Changelog ==
    6565
     66=== 1.0.9 ===
     67*  Support USDC Stellar and Stellar XLM payments.
     68*  Added block editor support.
     69
     70
    6671=== 1.0.8 ===
    6772*  Added Settings link on plugins page
Note: See TracChangeset for help on using the changeset viewer.