Plugin Directory

Changeset 3359611


Ignore:
Timestamp:
09/11/2025 07:11:46 AM (5 months ago)
Author:
netingweb
Message:

Releasing version 20250911 - Added WooCommerce Blocks support for credit card and PayPal payments.

Location:
gestpay-for-woocommerce
Files:
13 added
14 edited
1 copied

Legend:

Unmodified
Added
Removed
  • gestpay-for-woocommerce/tags/20250911/gestpay-for-woocommerce.php

    r3305565 r3359611  
    44 * Plugin URI: http://wordpress.org/plugins/gestpay-for-woocommerce/
    55 * Description: Abilita il sistema di pagamento GestPay by Axerve (Gruppo Banca Sella) in WooCommerce.
    6  * Version: 20250603
     6 * Version: 20250911
    77 * Requires at least: 4.7
    88 * Requires PHP: 7.0
     
    7676
    7777add_action( 'before_woocommerce_init', function() {
    78     if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
    79         \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
    80     }
    81 } );
     78    if ( class_exists( '\Automattic\WooCommerce\Utilities\FeaturesUtil' ) ) {
     79        \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
     80        \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'cart_checkout_blocks', __FILE__, true );
     81    }
     82});
    8283
    8384function gestpay_init_wc_gateway_gestpay() {
     
    180181            $this->textdomain   = $this->Helper->plugin_slug;
    181182            $this->logfile      = $this->id;
    182             $this->logo         = $this->plugin_url . '/images/gestpay-logo.png';
     183            $this->logo         = $this->plugin_url . 'images/gestpay-logo.png';
    183184            $this->method_title = $title;
    184185        }
     
    965966
    966967/**
     968 * Handle PayPal payment processing from blocks checkout
     969 */
     970add_action( 'template_redirect', 'wc_gateway_gestpay_handle_blocks_paypal_payment' );
     971function wc_gateway_gestpay_handle_blocks_paypal_payment() {
     972   
     973    // Only handle on checkout page
     974    if ( ! is_checkout() ) {
     975        return;
     976    }
     977   
     978    // Check if this is a PayPal blocks payment
     979    if ( ! isset( $_GET['gestpay_payment_type'] ) || $_GET['gestpay_payment_type'] !== 'PAYPAL' ) {
     980        return;
     981    }
     982   
     983    if ( ! isset( $_GET['gestpay_blocks'] ) || $_GET['gestpay_blocks'] !== '1' ) {
     984        return;
     985    }
     986   
     987    if ( ! isset( $_GET['payment_method'] ) || $_GET['payment_method'] !== 'wc_gateway_gestpay_paypal' ) {
     988        return;
     989    }
     990   
     991    // Check if cart is not empty
     992    if ( WC()->cart->is_empty() ) {
     993        wc_add_notice( 'Your cart is empty.', 'error' );
     994        wp_redirect( wc_get_cart_url() );
     995        exit;
     996    }
     997   
     998    // Create order
     999    $order = wc_create_order();
     1000   
     1001    // Add items from cart
     1002    foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
     1003        $order->add_product(
     1004            $cart_item['data'],
     1005            $cart_item['quantity']
     1006        );
     1007    }
     1008   
     1009    // Set payment method
     1010    $order->set_payment_method( 'wc_gateway_gestpay_paypal' );
     1011   
     1012    // Set billing and shipping addresses
     1013    $order->set_address( WC()->customer->get_billing(), 'billing' );
     1014    $order->set_address( WC()->customer->get_shipping(), 'shipping' );
     1015   
     1016    // Calculate totals
     1017    $order->calculate_totals();
     1018   
     1019    // Process payment with PayPal gateway
     1020    if ( class_exists( 'WC_Gateway_Gestpay_PAYPAL' ) ) {
     1021        $paypal_gateway = new WC_Gateway_Gestpay_PAYPAL();
     1022        $result = $paypal_gateway->process_payment( $order->get_id() );
     1023       
     1024        if ( isset( $result['result'] ) && $result['result'] === 'success' ) {
     1025            // Payment successful, redirect to payment page
     1026            wp_redirect( $result['redirect'] );
     1027            exit;
     1028        } else {
     1029            // Payment failed
     1030            wc_add_notice( 'Payment processing failed. Please try again.', 'error' );
     1031            wp_redirect( wc_get_checkout_url() );
     1032            exit;
     1033        }
     1034    } else {
     1035        // PayPal gateway not available
     1036        wc_add_notice( 'PayPal payment method is not available.', 'error' );
     1037        wp_redirect( wc_get_checkout_url() );
     1038        exit;
     1039    }
     1040}
     1041
     1042/**
    9671043 * Add this action to listen for the order status manually changed
    9681044 */
     
    9741050}
    9751051
     1052/**
     1053 * Register Gestpay payment methods for WooCommerce Blocks
     1054 */
     1055add_action( 'woocommerce_blocks_payment_method_type_registration', 'gestpay_register_blocks_payment_methods', 10 );
     1056function gestpay_register_blocks_payment_methods( $payment_method_registry ) {
     1057   
     1058    // Only register if WooCommerce Blocks is active
     1059    if ( ! class_exists( 'Automattic\WooCommerce\Blocks\Assets\Api' ) ) {
     1060        return;
     1061    }
     1062   
     1063    // Only register if WooCommerce is fully loaded
     1064    if ( ! function_exists( 'WC' ) || ! WC() ) {
     1065        return;
     1066    }
     1067   
     1068    try {
     1069        // Get the Asset API instance
     1070        $asset_api = \Automattic\WooCommerce\Blocks\Package::container()->get( \Automattic\WooCommerce\Blocks\Assets\Api::class );
     1071       
     1072        // Register the main Gestpay payment method
     1073        if ( ! class_exists( 'Gestpay_Blocks_Integration' ) ) {
     1074            require_once plugin_dir_path( GESTPAY_MAIN_FILE ) . 'inc/class-gestpay-blocks-integration.php';
     1075        }
     1076       
     1077        if ( class_exists( 'Gestpay_Blocks_Integration' ) ) {
     1078            $payment_method_registry->register( new Gestpay_Blocks_Integration( $asset_api ) );
     1079           
     1080            if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
     1081                error_log( 'Gestpay Blocks Integration: Main payment method registered successfully' );
     1082            }
     1083        }
     1084       
     1085        // Register the PayPal payment method
     1086        if ( ! class_exists( 'Gestpay_PayPal_Blocks_Integration' ) ) {
     1087            require_once plugin_dir_path( GESTPAY_MAIN_FILE ) . 'inc/class-gestpay-paypal-blocks-integration.php';
     1088        }
     1089       
     1090        if ( class_exists( 'Gestpay_PayPal_Blocks_Integration' ) ) {
     1091            $payment_method_registry->register( new Gestpay_PayPal_Blocks_Integration( $asset_api ) );
     1092           
     1093            if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
     1094                error_log( 'Gestpay Blocks Integration: PayPal payment method registered successfully' );
     1095            }
     1096        }
     1097       
     1098    } catch ( Exception $e ) {
     1099        // Log error if debug is enabled
     1100        if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
     1101            error_log( 'Gestpay Blocks Integration Error: ' . $e->getMessage() );
     1102        }
     1103    }
     1104}
     1105
     1106/**
     1107 * Enqueue Gestpay blocks styles
     1108 */
     1109add_action( 'wp_enqueue_scripts', 'gestpay_enqueue_blocks_styles' );
     1110function gestpay_enqueue_blocks_styles() {
     1111   
     1112    // Only enqueue on checkout page or when blocks are active
     1113    if ( ! is_checkout() && ! has_block( 'woocommerce/checkout' ) ) {
     1114        return;
     1115    }
     1116   
     1117    // Enqueue main GestPay blocks styles
     1118    $main_css_path = plugin_dir_path( GESTPAY_MAIN_FILE ) . 'assets/css/blocks/gestpay-blocks.css';
     1119    if ( file_exists( $main_css_path ) ) {
     1120        wp_enqueue_style(
     1121            'gestpay-blocks-styles',
     1122            plugin_dir_url( GESTPAY_MAIN_FILE ) . 'assets/css/blocks/gestpay-blocks.css',
     1123            array(),
     1124            '20250911'
     1125        );
     1126    }
     1127   
     1128    // Enqueue PayPal blocks styles
     1129    $paypal_css_path = plugin_dir_path( GESTPAY_MAIN_FILE ) . 'assets/css/blocks/gestpay-paypal-blocks.css';
     1130    if ( file_exists( $paypal_css_path ) ) {
     1131        wp_enqueue_style(
     1132            'gestpay-paypal-blocks-styles',
     1133            plugin_dir_url( GESTPAY_MAIN_FILE ) . 'assets/css/blocks/gestpay-paypal-blocks.css',
     1134            array(),
     1135            '20250911'
     1136        );
     1137    }
     1138}
     1139
  • gestpay-for-woocommerce/tags/20250911/inc/class-gestpay-iframe.php

    r3305565 r3359611  
    127127        require_once 'checkout-payment-fields.php';
    128128        wp_enqueue_script( 'gestpay-for-woocommerce-iframe-js', $this->Gestpay->iframe_url );
     129        wp_enqueue_script( 'gestpay-iframe-ready', $this->Helper->plugin_url . "assets/js/iFrameReady.js", ['jquery'], '' , true);
     130        $localize = [
     131            'shopLogin' => esc_js( $this->Gestpay->shopLogin ),
     132            'encString' => esc_js( $encString ),
     133            'paRes' => esc_js( $paRes ),
     134            'transKey' => esc_js( $transKey ),
     135            'iframe_pay_progress' => esc_js( $this->Gestpay->strings['iframe_pay_progress'] ),
     136            'ws_S2S_resp_url' => esc_js( $this->Gestpay->ws_S2S_resp_url ),
     137            'sameSite' => is_ssl() ? '; SameSite=None; Secure' : '',
     138            'pagam3d_url' => $this->Gestpay->pagam3d_url,
     139            'is_cvv_required' => $this->Gestpay->is_cvv_required,
     140            'iframe_loading' => $this->Gestpay->strings['iframe_loading'],
     141            'iframe_browser_err' => $this->Gestpay->strings['iframe_browser_err']
     142        ];
     143        wp_localize_script( "gestpay-iframe-ready", "gestpayReadyObject", $localize);
    129144        //error_log('Gestpay iFrame - Script iframe caricato: ' . $this->Gestpay->iframe_url);
    130         ?>
    131 
    132         <script type="text/javascript">
    133         var GestpayIframe = {}
    134 
    135         /**
    136          * Handle asynchronous security check result for the 1st and 2nd page load.
    137          */
    138         GestpayIframe.PaymentPageLoad = function( Result ) {
    139 
    140             // Check for errors: if the Result.ErroCode is 10 the iFrame
    141             // is created correctly and the security check are passed
    142             if ( Result.ErrorCode == 10 ) {
    143 
    144                 // Handle 3D authentication 2nd call
    145                 var paRes = '<?php echo esc_js( $paRes ); ?>';
    146                 var transKey = '<?php echo esc_js( $transKey ); ?>';
    147 
    148                 if ( paRes.length > 0 && transKey.length > 0 ) {
    149                     // The cardholder land for the 2nd page load, after 3D Secure authentication,
    150                     // so we can proceed to process the transaction without showing the form
    151 
    152                     document.getElementById( 'gestpay-inner-freeze-pane-text' ).innerHTML = '<?php echo esc_js( $this->Gestpay->strings['iframe_pay_progress'] ); ?>';
    153 
    154                     var params = {
    155                         PARes: paRes,
    156                         TransKey: transKey
    157                     };
    158 
    159                     GestPay.SendPayment( params, GestpayIframe.PaymentCallBack );
    160                 }
    161                 else {
    162                     // 1st page load: show the form with the credit card fields
    163                     document.getElementById( 'gestpay-inner-freeze-pane' ).className = 'gestpay-off';
    164                     document.getElementById( 'gestpay-freeze-pane' ).className = 'gestpay-off';
    165                     document.getElementById( 'gestpay-cc-form' ).className = 'gestpay-on';
    166                 }
    167             }
    168             else {
    169                 GestpayIframe.OnError(Result);
    170             }
    171         };
    172 
    173         /**
    174          * Handle payment results.
    175          */
    176         GestpayIframe.PaymentCallBack = function ( Result ) {
    177 
    178             if ( Result.ErrorCode == 0 ) {
    179                 // --- Transaction correctly processed
    180 
    181                 var baseUrl = "<?php echo esc_js( $this->Gestpay->ws_S2S_resp_url ); ?>";
    182 
    183                 // Decrypt the string to read the transaction results
    184                 document.location.replace( baseUrl + '&a=<?php echo esc_js( $this->Gestpay->shopLogin ); ?>&b=' + Result.EncryptedString );
    185             }
    186             else {
    187                 // --- An error has occurred: check for 3D authentication required
    188 
    189                 if ( Result.ErrorCode == 8006 ) {
    190                     // The credit card is enrolled: we must send the card holder
    191                     // to the authentication page on the issuer website
    192 
    193                     var expDate = new Date();
    194                     expDate.setTime( expDate.getTime() + (1200000) );
    195                     expDate = expDate.toGMTString();
    196 
    197                     // Get the TransKey, IMPORTANT! this value must be stored for further use
    198                     var TransKey = Result.TransKey;
    199                     var SameSite = '<?php echo is_ssl() ? '; SameSite=None; Secure' : ''; ?>';
    200                     document.cookie = 'TransKey=' + TransKey.toString() + '; expires=' + expDate + ' ; path=/' + SameSite;
    201 
    202                     // Retrieve all parameters.
    203                     var a = '<?php echo esc_js( $this->Gestpay->shopLogin ); ?>';
    204                     var b = Result.VBVRisp;
    205 
    206                     // The landing page where the user will be redirected after the issuer authentication
    207                     var c = document.location.href;
    208 
    209                     // Redirect the user to the issuer authentication page
    210                     var AuthUrl = '<?php echo esc_js( $this->Gestpay->pagam3d_url ); ?>';
    211 
    212                     document.location.replace( AuthUrl + '?a=' + a + '&b=' + b + '&c=' + c );
    213                 }
    214                 else {
    215                     // Hide overlapping layer
    216                     document.getElementById( 'gestpay-inner-freeze-pane' ).className = 'gestpay-off';
    217                     document.getElementById( 'gestpay-freeze-pane' ).className = 'gestpay-off';
    218                     document.getElementById( 'gestpay-submit' ).disabled = false;
    219 
    220                     // Check the ErrorCode and ErrorDescription
    221                     if ( Result.ErrorCode == 1119 || Result.ErrorCode == 1120 ) {
    222                         document.getElementById( 'gestpay-cc-number' ).focus();
    223                     }
    224                     else if ( Result.ErrorCode == 1124 || Result.ErrorCode == 1126 ) {
    225                         document.getElementById( 'gestpay-cc-exp-month' ).focus();
    226                     }
    227                     else if ( Result.ErrorCode == 1125 ) {
    228                         document.getElementById( 'gestpay-cc-exp-year' ).focus();
    229                     }
    230                     else if ( Result.ErrorCode == 1149 ) {
    231                         <?php if ( $this->Gestpay->is_cvv_required ) : ?>
    232                         document.getElementById( 'gestpay-cc-cvv' ).focus();
    233                         <?php endif; ?>
    234                     }
    235 
    236                     GestpayIframe.OnError(Result);
    237                 }
    238             }
    239         };
    240 
    241         GestpayIframe.OnError = function( Result ) {
    242             // Show the error box
    243             document.getElementById( 'gestpay-error-box' ).innerHTML = 'Error: ' + Result.ErrorCode +' - ' + Result.ErrorDescription;
    244             document.getElementById( 'gestpay-error-box' ).className = 'gestpay-on';
    245             document.getElementById( 'gestpay-inner-freeze-pane' ).className = 'gestpay-off';
    246             document.getElementById( 'gestpay-freeze-pane' ).className = 'gestpay-off';
    247 
    248             // Clean up cookies.
    249             document.cookie = '<?php echo 'TransKey'; ?>' + '=;expires=Thu, 01 Jan 1970 00:00:01 GMT;';
    250             document.cookie = '<?php echo 'GestPayEncString'; ?>' + '=;expires=Thu, 01 Jan 1970 00:00:01 GMT;';
    251 
    252             // Show the reload button
    253             document.getElementById( "iframe-reload-btn" ).style.display = 'inline-block';
    254         };
    255 
    256         /**
    257          * Send data to GestPay and process transaction.
    258          * @see gestpay-for-woocommerce/inc/checkout-payment-fields.php
    259          */
    260         function gestpayCheckCC() {
    261 
    262             document.getElementById( 'gestpay-submit' ).disabled = true;
    263             document.getElementById( 'gestpay-freeze-pane' ).className = 'gestpay-freeze-pane-on';
    264             document.getElementById( 'gestpay-inner-freeze-pane-text' ).innerHTML = '<?php echo esc_js( $this->Gestpay->strings['iframe_pay_progress'] ); ?>';
    265             document.getElementById( 'gestpay-inner-freeze-pane' ).className = 'gestpay-on';
    266 
    267             var params = {
    268                 CC    : document.getElementById( 'gestpay-cc-number' ).value
    269                ,EXPMM : document.getElementById( 'gestpay-cc-exp-month' ).value
    270                ,EXPYY : document.getElementById( 'gestpay-cc-exp-year' ).value
    271                 <?php if ( $this->Gestpay->is_cvv_required ) : ?>
    272                ,CVV2  : document.getElementById( 'gestpay-cc-cvv' ).value
    273                 <?php endif; ?>
    274             };
    275 
    276             GestPay.SendPayment( params, GestpayIframe.PaymentCallBack );
    277 
    278             // To free the Shop from the need to comply with PCI-DSS Security standard, the OnSubmit event
    279             // of the Credit card form must avoid to postback the Credit Card data to the checkout page!
    280             return false;
    281         }
    282 
    283         jQuery(document).ready(function($) {
    284             if (typeof BrowserEnabled !== 'undefined' && BrowserEnabled) {
    285                 // Check if the browser support HTML5 postmessage
    286                 var a = '<?php echo esc_js( $this->Gestpay->shopLogin ); ?>';
    287                 var b = '<?php echo esc_js( $encString ); ?>';
    288 
    289                 // Create the iFrame
    290                 GestPay.CreatePaymentPage( a, b, GestpayIframe.PaymentPageLoad );
    291 
    292                 // Raise the Overlap layer and text
    293                 document.getElementById( 'gestpay-freeze-pane' ).className = 'gestpay-freeze-pane-on';
    294                 document.getElementById( 'gestpay-inner-freeze-pane-text' ).innerHTML = '<?php echo esc_js( $this->Gestpay->strings['iframe_loading'] ); ?>';
    295                 document.getElementById( 'gestpay-inner-freeze-pane' ).className = 'gestpay-on';
    296             }
    297             else {
    298                 document.getElementById( 'gestpay-error-box' ).innerHTML = '<?php echo esc_js( $this->Gestpay->strings['iframe_browser_err'] ); ?>';
    299                 document.getElementById( 'gestpay-error-box' ).className = 'gestpay-on';
    300             }
    301         });
    302         </script>
    303 
    304         <?php
     145       
    305146    }
    306147
  • gestpay-for-woocommerce/tags/20250911/inc/class-gestpay-s2s.php

    r3303342 r3359611  
    5151     */
    5252    function validate_payment_fields() {
    53 
    5453        // Skip validation if reusing a token
    5554        // Here there is no need to decrypt the token
  • gestpay-for-woocommerce/tags/20250911/inc/class-wc-settings-tab-gestpay.php

    r3303342 r3359611  
    312312            array(
    313313                'title' => '',
    314                 'desc' => 'Con Gestpay Professional è possibile aggiungere pagine di pagamento differenti per differenti metodi di pagamento.<br>Seleziona qui quali modilità di pagamento abilitare; poi salva e infine vai nel tab "Cassa" per vedere abilitati i tipi di pagamento selezionati.<br>Si faccia riferimento al manuale per maggiori informazioni. Nota: i metodi di pagamento selezionati devono essere abilitati anche nel Backoffice Gestpay.',
     314                'desc' => 'Con Gestpay Professional è possibile aggiungere pagine di pagamento differenti per differenti metodi di pagamento.<br>Seleziona qui quali modilità di pagamento abilitare; poi salva e infine vai nel tab "Cassa" per vedere abilitati i tipi di pagamento selezionati.<br>Si faccia riferimento al manuale per maggiori informazioni. Nota: i metodi di pagamento selezionati devono essere abilitati anche nel Backoffice Gestpay.<br/><br/>Con l’ultima versione del nostro plugin, il <b>checkout a blocchi di WooCommerce è già compatibile con i pagamenti con carta e PayPal</b>.
     315Se utilizzi esclusivamente questi metodi, puoi attivarlo subito e offrire un\'esperienza d’acquisto più moderna ai tuoi clienti.<br/>
     316Il supporto per gli altri metodi di pagamento (es. MyBank, BancomatPay) verrà rilasciato progressivamente nelle prossime versioni.<br/><br/>
     317⚠️ Attivando il checkout a blocchi, verranno mostrati solo i metodi di pagamento compatibili (Carte di Credito e PayPal). Eventuali altri metodi attivi nel tuo shop non saranno visibili ai clienti fino al completamento del supporto.<br/><br/>
     318Se vuoi <b>disabilitare il checkout a blocchi per garantire l\'utilizzo di tutti i metodi di pagamento attivi nel tuo shop, puoi seguire la guida disponibile sulla <a href="https://doc.fabrick.it/it/plugin/woocommerce/blocks-integration/" target="_blank">documentazione ufficiale di Fabrick</a>.</b><br/>',
    315319                'type' => 'title',
    316320                'id' => 'wc_gestpaypro_moregateways_options',
  • gestpay-for-woocommerce/tags/20250911/inc/payment_types/gestpay-mybank.php

    r3276807 r3359611  
    136136        $mybank_url = '<a href="https://mybank.eu" target="_blank" title="MyBank"><strong>mybank.eu</strong></a>';
    137137        $mybank_banner = '<div id="mybank-container-img"><a href="https://mybank.eu" target="_blank"><img src="'.esc_url( $this->plugin_url . 'images/mybank-tagline-positive-it.png' ).'" style="background-color:#fff!important"/></a></div>';
    138         echo wp_kses_post( $mybank_banner ) . '<p>' . esc_html( $this->strings['mybank_payoff'] ) . ' ' . wp_kses_post( $mybank_url ) . '</p>';
     138        echo wp_kses_post( $mybank_banner ) . '<p>' . wp_kses_post( $this->strings['mybank_payoff'] ) . ' ' . wp_kses_post( $mybank_url ) . '</p>';
    139139
    140140        if ( $this->required_selection ) {
  • gestpay-for-woocommerce/tags/20250911/lib/gestpay-mybank.js

    r3276807 r3359611  
    99 */
    1010
    11 (function($){
     11(function ($) {
     12  function gestpayMyBankSelectWoo() {
     13    if (!$().selectWoo) {
     14      return;
     15    }
    1216
    13     function gestpayMyBankSelectWoo() {
    14         if ( !$().selectWoo ) {
    15             return;
     17    // Works on checkout and order_review forms
     18    var form = "form.woocommerce-checkout";
     19    if ($("form#order_review").length > 0) {
     20      form = "form#order_review";
     21    }
     22
     23    if (
     24      $(form + ' input[name="payment_method"]:checked').attr("id") !=
     25      "payment_method_wc_gateway_gestpay_mybank"
     26    ) {
     27      // Don't run on other payment methods
     28      return;
     29    }
     30
     31    $("select#gestpay-mybank-banklist").selectWoo({
     32      matcher: function (params, data) {
     33        // Thanks to Yuray https://stackoverflow.com/a/31626588/1992799
     34
     35        // If there are no search terms, return all of the data
     36        if ($.trim(params.term) === "") {
     37          return data;
    1638        }
    1739
    18         // Works on checkout and order_review forms
    19         var form = 'form.woocommerce-checkout';
    20         if ( $( 'form#order_review' ).length > 0 ) {
    21             form = 'form#order_review';
     40        var keywords = params.term.split(" ");
     41
     42        // check if data.text contains all of keywords, if some is missing, return null
     43        for (var i = 0; i < keywords.length; i++) {
     44          if (
     45            data.text.toUpperCase().indexOf(keywords[i].toUpperCase()) == -1
     46          ) {
     47            // Return `null` if the term should not be displayed
     48            return null;
     49          }
    2250        }
    2351
    24         if ( $( form + ' input[name="payment_method"]:checked' ).attr( 'id' ) != 'payment_method_wc_gateway_gestpay_mybank' ) {
    25             // Don't run on other payment methods
    26             return;
    27         }
    28 
    29         $( 'select#gestpay-mybank-banklist' ).selectWoo({
    30             matcher: function (params, data) {
    31                 // Thanks to Yuray https://stackoverflow.com/a/31626588/1992799
    32 
    33                 // If there are no search terms, return all of the data
    34                 if ($.trim(params.term) === '') {
    35                     return data;
    36                 }
    37 
    38                 var keywords = (params.term).split(" ");
    39 
    40                 // check if data.text contains all of keywords, if some is missing, return null
    41                 for (var i = 0; i < keywords.length; i++) {
    42                     if (((data.text).toUpperCase()).indexOf((keywords[i]).toUpperCase()) == -1) {
    43                         // Return `null` if the term should not be displayed
    44                         return null;
    45                     }
    46                 }
    47 
    48                 // If here, data.text contains all keywords, so return it.
    49                 return data;
    50             }
    51         });
    52 
    53         // Be sure there is enaugh space for the asterisk of the required field
    54         var $span = $( 'select#gestpay-mybank-banklist+.select2-container' );
    55         if ( $span.length == 1 ) {
    56             $span.width( $span.width() - 20 );
    57         }
    58     }
    59 
    60     // Runs when selecting or when reloading the already selected method.
    61     $( document.body ).on( 'payment_method_selected updated_checkout', function() {
    62         gestpayMyBankSelectWoo();
     52        // If here, data.text contains all keywords, so return it.
     53        return data;
     54      },
    6355    });
    6456
     57    // Be sure there is enaugh space for the asterisk of the required field
     58    var $span = $("select#gestpay-mybank-banklist+.select2-container");
     59    if ($span.length == 1) {
     60      const intvalWidth = setInterval(function () {
     61        if ($span.width() > 100) {
     62          clearInterval(intvalWidth);
     63          $span.width($span.width() - 20);
     64        }
     65      }, 100);
     66    }
     67  }
     68
     69  // Runs when selecting or when reloading the already selected method.
     70  $(document.body).on("payment_method_selected updated_checkout", function () {
     71    gestpayMyBankSelectWoo();
     72  });
    6573})(jQuery);
  • gestpay-for-woocommerce/tags/20250911/readme.txt

    r3305565 r3359611  
    44Requires at least: 4.7
    55Requires PHP: 7.0
    6 Tested up to: 6.8
    7 Stable tag: 20250603
     6Tested up to: 6.8.2
     7Stable tag: 20250911
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
    1010WC requires at least: 3.0
    11 WC tested up to: 9.4.2
     11WC tested up to: 10.0.4
    1212
    1313Axerve Free Plugin for Woocommerce extends WooCommerce providing the payment gateway Axerve.
     
    6969== Changelog ==
    7070
     71= 20250911 =
     72* Feature: Added WooCommerce Blocks support for credit card and PayPal payments
     73  - Integrated GestPay payment methods with WooCommerce Blocks checkout
     74  - Added support for credit card payments in blocks checkout
     75  - Added support for PayPal payments in blocks checkout
     76  - Enhanced checkout experience with modern block-based interface
     77  - Note: Support for other payment methods in blocks will be added in future releases
     78* Fix: Nothing added
     79* Security: Nothing added
     80* Improvement: Enhanced checkout experience with blocks integration
     81* Checks: Verified compatibility with WordPress 6.8.2, WooCommerce 10.0.4
     82* Note: This release enables seamless integration of GestPay payments in WooCommerce Blocks checkout
     83
    7184= 20250603 =
    7285* Fix: Removed unnecessary error_log messages that were causing log file inflation
  • gestpay-for-woocommerce/trunk/gestpay-for-woocommerce.php

    r3305565 r3359611  
    44 * Plugin URI: http://wordpress.org/plugins/gestpay-for-woocommerce/
    55 * Description: Abilita il sistema di pagamento GestPay by Axerve (Gruppo Banca Sella) in WooCommerce.
    6  * Version: 20250603
     6 * Version: 20250911
    77 * Requires at least: 4.7
    88 * Requires PHP: 7.0
     
    7676
    7777add_action( 'before_woocommerce_init', function() {
    78     if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
    79         \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
    80     }
    81 } );
     78    if ( class_exists( '\Automattic\WooCommerce\Utilities\FeaturesUtil' ) ) {
     79        \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
     80        \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'cart_checkout_blocks', __FILE__, true );
     81    }
     82});
    8283
    8384function gestpay_init_wc_gateway_gestpay() {
     
    180181            $this->textdomain   = $this->Helper->plugin_slug;
    181182            $this->logfile      = $this->id;
    182             $this->logo         = $this->plugin_url . '/images/gestpay-logo.png';
     183            $this->logo         = $this->plugin_url . 'images/gestpay-logo.png';
    183184            $this->method_title = $title;
    184185        }
     
    965966
    966967/**
     968 * Handle PayPal payment processing from blocks checkout
     969 */
     970add_action( 'template_redirect', 'wc_gateway_gestpay_handle_blocks_paypal_payment' );
     971function wc_gateway_gestpay_handle_blocks_paypal_payment() {
     972   
     973    // Only handle on checkout page
     974    if ( ! is_checkout() ) {
     975        return;
     976    }
     977   
     978    // Check if this is a PayPal blocks payment
     979    if ( ! isset( $_GET['gestpay_payment_type'] ) || $_GET['gestpay_payment_type'] !== 'PAYPAL' ) {
     980        return;
     981    }
     982   
     983    if ( ! isset( $_GET['gestpay_blocks'] ) || $_GET['gestpay_blocks'] !== '1' ) {
     984        return;
     985    }
     986   
     987    if ( ! isset( $_GET['payment_method'] ) || $_GET['payment_method'] !== 'wc_gateway_gestpay_paypal' ) {
     988        return;
     989    }
     990   
     991    // Check if cart is not empty
     992    if ( WC()->cart->is_empty() ) {
     993        wc_add_notice( 'Your cart is empty.', 'error' );
     994        wp_redirect( wc_get_cart_url() );
     995        exit;
     996    }
     997   
     998    // Create order
     999    $order = wc_create_order();
     1000   
     1001    // Add items from cart
     1002    foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
     1003        $order->add_product(
     1004            $cart_item['data'],
     1005            $cart_item['quantity']
     1006        );
     1007    }
     1008   
     1009    // Set payment method
     1010    $order->set_payment_method( 'wc_gateway_gestpay_paypal' );
     1011   
     1012    // Set billing and shipping addresses
     1013    $order->set_address( WC()->customer->get_billing(), 'billing' );
     1014    $order->set_address( WC()->customer->get_shipping(), 'shipping' );
     1015   
     1016    // Calculate totals
     1017    $order->calculate_totals();
     1018   
     1019    // Process payment with PayPal gateway
     1020    if ( class_exists( 'WC_Gateway_Gestpay_PAYPAL' ) ) {
     1021        $paypal_gateway = new WC_Gateway_Gestpay_PAYPAL();
     1022        $result = $paypal_gateway->process_payment( $order->get_id() );
     1023       
     1024        if ( isset( $result['result'] ) && $result['result'] === 'success' ) {
     1025            // Payment successful, redirect to payment page
     1026            wp_redirect( $result['redirect'] );
     1027            exit;
     1028        } else {
     1029            // Payment failed
     1030            wc_add_notice( 'Payment processing failed. Please try again.', 'error' );
     1031            wp_redirect( wc_get_checkout_url() );
     1032            exit;
     1033        }
     1034    } else {
     1035        // PayPal gateway not available
     1036        wc_add_notice( 'PayPal payment method is not available.', 'error' );
     1037        wp_redirect( wc_get_checkout_url() );
     1038        exit;
     1039    }
     1040}
     1041
     1042/**
    9671043 * Add this action to listen for the order status manually changed
    9681044 */
     
    9741050}
    9751051
     1052/**
     1053 * Register Gestpay payment methods for WooCommerce Blocks
     1054 */
     1055add_action( 'woocommerce_blocks_payment_method_type_registration', 'gestpay_register_blocks_payment_methods', 10 );
     1056function gestpay_register_blocks_payment_methods( $payment_method_registry ) {
     1057   
     1058    // Only register if WooCommerce Blocks is active
     1059    if ( ! class_exists( 'Automattic\WooCommerce\Blocks\Assets\Api' ) ) {
     1060        return;
     1061    }
     1062   
     1063    // Only register if WooCommerce is fully loaded
     1064    if ( ! function_exists( 'WC' ) || ! WC() ) {
     1065        return;
     1066    }
     1067   
     1068    try {
     1069        // Get the Asset API instance
     1070        $asset_api = \Automattic\WooCommerce\Blocks\Package::container()->get( \Automattic\WooCommerce\Blocks\Assets\Api::class );
     1071       
     1072        // Register the main Gestpay payment method
     1073        if ( ! class_exists( 'Gestpay_Blocks_Integration' ) ) {
     1074            require_once plugin_dir_path( GESTPAY_MAIN_FILE ) . 'inc/class-gestpay-blocks-integration.php';
     1075        }
     1076       
     1077        if ( class_exists( 'Gestpay_Blocks_Integration' ) ) {
     1078            $payment_method_registry->register( new Gestpay_Blocks_Integration( $asset_api ) );
     1079           
     1080            if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
     1081                error_log( 'Gestpay Blocks Integration: Main payment method registered successfully' );
     1082            }
     1083        }
     1084       
     1085        // Register the PayPal payment method
     1086        if ( ! class_exists( 'Gestpay_PayPal_Blocks_Integration' ) ) {
     1087            require_once plugin_dir_path( GESTPAY_MAIN_FILE ) . 'inc/class-gestpay-paypal-blocks-integration.php';
     1088        }
     1089       
     1090        if ( class_exists( 'Gestpay_PayPal_Blocks_Integration' ) ) {
     1091            $payment_method_registry->register( new Gestpay_PayPal_Blocks_Integration( $asset_api ) );
     1092           
     1093            if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
     1094                error_log( 'Gestpay Blocks Integration: PayPal payment method registered successfully' );
     1095            }
     1096        }
     1097       
     1098    } catch ( Exception $e ) {
     1099        // Log error if debug is enabled
     1100        if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
     1101            error_log( 'Gestpay Blocks Integration Error: ' . $e->getMessage() );
     1102        }
     1103    }
     1104}
     1105
     1106/**
     1107 * Enqueue Gestpay blocks styles
     1108 */
     1109add_action( 'wp_enqueue_scripts', 'gestpay_enqueue_blocks_styles' );
     1110function gestpay_enqueue_blocks_styles() {
     1111   
     1112    // Only enqueue on checkout page or when blocks are active
     1113    if ( ! is_checkout() && ! has_block( 'woocommerce/checkout' ) ) {
     1114        return;
     1115    }
     1116   
     1117    // Enqueue main GestPay blocks styles
     1118    $main_css_path = plugin_dir_path( GESTPAY_MAIN_FILE ) . 'assets/css/blocks/gestpay-blocks.css';
     1119    if ( file_exists( $main_css_path ) ) {
     1120        wp_enqueue_style(
     1121            'gestpay-blocks-styles',
     1122            plugin_dir_url( GESTPAY_MAIN_FILE ) . 'assets/css/blocks/gestpay-blocks.css',
     1123            array(),
     1124            '20250911'
     1125        );
     1126    }
     1127   
     1128    // Enqueue PayPal blocks styles
     1129    $paypal_css_path = plugin_dir_path( GESTPAY_MAIN_FILE ) . 'assets/css/blocks/gestpay-paypal-blocks.css';
     1130    if ( file_exists( $paypal_css_path ) ) {
     1131        wp_enqueue_style(
     1132            'gestpay-paypal-blocks-styles',
     1133            plugin_dir_url( GESTPAY_MAIN_FILE ) . 'assets/css/blocks/gestpay-paypal-blocks.css',
     1134            array(),
     1135            '20250911'
     1136        );
     1137    }
     1138}
     1139
  • gestpay-for-woocommerce/trunk/inc/class-gestpay-iframe.php

    r3305565 r3359611  
    127127        require_once 'checkout-payment-fields.php';
    128128        wp_enqueue_script( 'gestpay-for-woocommerce-iframe-js', $this->Gestpay->iframe_url );
     129        wp_enqueue_script( 'gestpay-iframe-ready', $this->Helper->plugin_url . "assets/js/iFrameReady.js", ['jquery'], '' , true);
     130        $localize = [
     131            'shopLogin' => esc_js( $this->Gestpay->shopLogin ),
     132            'encString' => esc_js( $encString ),
     133            'paRes' => esc_js( $paRes ),
     134            'transKey' => esc_js( $transKey ),
     135            'iframe_pay_progress' => esc_js( $this->Gestpay->strings['iframe_pay_progress'] ),
     136            'ws_S2S_resp_url' => esc_js( $this->Gestpay->ws_S2S_resp_url ),
     137            'sameSite' => is_ssl() ? '; SameSite=None; Secure' : '',
     138            'pagam3d_url' => $this->Gestpay->pagam3d_url,
     139            'is_cvv_required' => $this->Gestpay->is_cvv_required,
     140            'iframe_loading' => $this->Gestpay->strings['iframe_loading'],
     141            'iframe_browser_err' => $this->Gestpay->strings['iframe_browser_err']
     142        ];
     143        wp_localize_script( "gestpay-iframe-ready", "gestpayReadyObject", $localize);
    129144        //error_log('Gestpay iFrame - Script iframe caricato: ' . $this->Gestpay->iframe_url);
    130         ?>
    131 
    132         <script type="text/javascript">
    133         var GestpayIframe = {}
    134 
    135         /**
    136          * Handle asynchronous security check result for the 1st and 2nd page load.
    137          */
    138         GestpayIframe.PaymentPageLoad = function( Result ) {
    139 
    140             // Check for errors: if the Result.ErroCode is 10 the iFrame
    141             // is created correctly and the security check are passed
    142             if ( Result.ErrorCode == 10 ) {
    143 
    144                 // Handle 3D authentication 2nd call
    145                 var paRes = '<?php echo esc_js( $paRes ); ?>';
    146                 var transKey = '<?php echo esc_js( $transKey ); ?>';
    147 
    148                 if ( paRes.length > 0 && transKey.length > 0 ) {
    149                     // The cardholder land for the 2nd page load, after 3D Secure authentication,
    150                     // so we can proceed to process the transaction without showing the form
    151 
    152                     document.getElementById( 'gestpay-inner-freeze-pane-text' ).innerHTML = '<?php echo esc_js( $this->Gestpay->strings['iframe_pay_progress'] ); ?>';
    153 
    154                     var params = {
    155                         PARes: paRes,
    156                         TransKey: transKey
    157                     };
    158 
    159                     GestPay.SendPayment( params, GestpayIframe.PaymentCallBack );
    160                 }
    161                 else {
    162                     // 1st page load: show the form with the credit card fields
    163                     document.getElementById( 'gestpay-inner-freeze-pane' ).className = 'gestpay-off';
    164                     document.getElementById( 'gestpay-freeze-pane' ).className = 'gestpay-off';
    165                     document.getElementById( 'gestpay-cc-form' ).className = 'gestpay-on';
    166                 }
    167             }
    168             else {
    169                 GestpayIframe.OnError(Result);
    170             }
    171         };
    172 
    173         /**
    174          * Handle payment results.
    175          */
    176         GestpayIframe.PaymentCallBack = function ( Result ) {
    177 
    178             if ( Result.ErrorCode == 0 ) {
    179                 // --- Transaction correctly processed
    180 
    181                 var baseUrl = "<?php echo esc_js( $this->Gestpay->ws_S2S_resp_url ); ?>";
    182 
    183                 // Decrypt the string to read the transaction results
    184                 document.location.replace( baseUrl + '&a=<?php echo esc_js( $this->Gestpay->shopLogin ); ?>&b=' + Result.EncryptedString );
    185             }
    186             else {
    187                 // --- An error has occurred: check for 3D authentication required
    188 
    189                 if ( Result.ErrorCode == 8006 ) {
    190                     // The credit card is enrolled: we must send the card holder
    191                     // to the authentication page on the issuer website
    192 
    193                     var expDate = new Date();
    194                     expDate.setTime( expDate.getTime() + (1200000) );
    195                     expDate = expDate.toGMTString();
    196 
    197                     // Get the TransKey, IMPORTANT! this value must be stored for further use
    198                     var TransKey = Result.TransKey;
    199                     var SameSite = '<?php echo is_ssl() ? '; SameSite=None; Secure' : ''; ?>';
    200                     document.cookie = 'TransKey=' + TransKey.toString() + '; expires=' + expDate + ' ; path=/' + SameSite;
    201 
    202                     // Retrieve all parameters.
    203                     var a = '<?php echo esc_js( $this->Gestpay->shopLogin ); ?>';
    204                     var b = Result.VBVRisp;
    205 
    206                     // The landing page where the user will be redirected after the issuer authentication
    207                     var c = document.location.href;
    208 
    209                     // Redirect the user to the issuer authentication page
    210                     var AuthUrl = '<?php echo esc_js( $this->Gestpay->pagam3d_url ); ?>';
    211 
    212                     document.location.replace( AuthUrl + '?a=' + a + '&b=' + b + '&c=' + c );
    213                 }
    214                 else {
    215                     // Hide overlapping layer
    216                     document.getElementById( 'gestpay-inner-freeze-pane' ).className = 'gestpay-off';
    217                     document.getElementById( 'gestpay-freeze-pane' ).className = 'gestpay-off';
    218                     document.getElementById( 'gestpay-submit' ).disabled = false;
    219 
    220                     // Check the ErrorCode and ErrorDescription
    221                     if ( Result.ErrorCode == 1119 || Result.ErrorCode == 1120 ) {
    222                         document.getElementById( 'gestpay-cc-number' ).focus();
    223                     }
    224                     else if ( Result.ErrorCode == 1124 || Result.ErrorCode == 1126 ) {
    225                         document.getElementById( 'gestpay-cc-exp-month' ).focus();
    226                     }
    227                     else if ( Result.ErrorCode == 1125 ) {
    228                         document.getElementById( 'gestpay-cc-exp-year' ).focus();
    229                     }
    230                     else if ( Result.ErrorCode == 1149 ) {
    231                         <?php if ( $this->Gestpay->is_cvv_required ) : ?>
    232                         document.getElementById( 'gestpay-cc-cvv' ).focus();
    233                         <?php endif; ?>
    234                     }
    235 
    236                     GestpayIframe.OnError(Result);
    237                 }
    238             }
    239         };
    240 
    241         GestpayIframe.OnError = function( Result ) {
    242             // Show the error box
    243             document.getElementById( 'gestpay-error-box' ).innerHTML = 'Error: ' + Result.ErrorCode +' - ' + Result.ErrorDescription;
    244             document.getElementById( 'gestpay-error-box' ).className = 'gestpay-on';
    245             document.getElementById( 'gestpay-inner-freeze-pane' ).className = 'gestpay-off';
    246             document.getElementById( 'gestpay-freeze-pane' ).className = 'gestpay-off';
    247 
    248             // Clean up cookies.
    249             document.cookie = '<?php echo 'TransKey'; ?>' + '=;expires=Thu, 01 Jan 1970 00:00:01 GMT;';
    250             document.cookie = '<?php echo 'GestPayEncString'; ?>' + '=;expires=Thu, 01 Jan 1970 00:00:01 GMT;';
    251 
    252             // Show the reload button
    253             document.getElementById( "iframe-reload-btn" ).style.display = 'inline-block';
    254         };
    255 
    256         /**
    257          * Send data to GestPay and process transaction.
    258          * @see gestpay-for-woocommerce/inc/checkout-payment-fields.php
    259          */
    260         function gestpayCheckCC() {
    261 
    262             document.getElementById( 'gestpay-submit' ).disabled = true;
    263             document.getElementById( 'gestpay-freeze-pane' ).className = 'gestpay-freeze-pane-on';
    264             document.getElementById( 'gestpay-inner-freeze-pane-text' ).innerHTML = '<?php echo esc_js( $this->Gestpay->strings['iframe_pay_progress'] ); ?>';
    265             document.getElementById( 'gestpay-inner-freeze-pane' ).className = 'gestpay-on';
    266 
    267             var params = {
    268                 CC    : document.getElementById( 'gestpay-cc-number' ).value
    269                ,EXPMM : document.getElementById( 'gestpay-cc-exp-month' ).value
    270                ,EXPYY : document.getElementById( 'gestpay-cc-exp-year' ).value
    271                 <?php if ( $this->Gestpay->is_cvv_required ) : ?>
    272                ,CVV2  : document.getElementById( 'gestpay-cc-cvv' ).value
    273                 <?php endif; ?>
    274             };
    275 
    276             GestPay.SendPayment( params, GestpayIframe.PaymentCallBack );
    277 
    278             // To free the Shop from the need to comply with PCI-DSS Security standard, the OnSubmit event
    279             // of the Credit card form must avoid to postback the Credit Card data to the checkout page!
    280             return false;
    281         }
    282 
    283         jQuery(document).ready(function($) {
    284             if (typeof BrowserEnabled !== 'undefined' && BrowserEnabled) {
    285                 // Check if the browser support HTML5 postmessage
    286                 var a = '<?php echo esc_js( $this->Gestpay->shopLogin ); ?>';
    287                 var b = '<?php echo esc_js( $encString ); ?>';
    288 
    289                 // Create the iFrame
    290                 GestPay.CreatePaymentPage( a, b, GestpayIframe.PaymentPageLoad );
    291 
    292                 // Raise the Overlap layer and text
    293                 document.getElementById( 'gestpay-freeze-pane' ).className = 'gestpay-freeze-pane-on';
    294                 document.getElementById( 'gestpay-inner-freeze-pane-text' ).innerHTML = '<?php echo esc_js( $this->Gestpay->strings['iframe_loading'] ); ?>';
    295                 document.getElementById( 'gestpay-inner-freeze-pane' ).className = 'gestpay-on';
    296             }
    297             else {
    298                 document.getElementById( 'gestpay-error-box' ).innerHTML = '<?php echo esc_js( $this->Gestpay->strings['iframe_browser_err'] ); ?>';
    299                 document.getElementById( 'gestpay-error-box' ).className = 'gestpay-on';
    300             }
    301         });
    302         </script>
    303 
    304         <?php
     145       
    305146    }
    306147
  • gestpay-for-woocommerce/trunk/inc/class-gestpay-s2s.php

    r3303342 r3359611  
    5151     */
    5252    function validate_payment_fields() {
    53 
    5453        // Skip validation if reusing a token
    5554        // Here there is no need to decrypt the token
  • gestpay-for-woocommerce/trunk/inc/class-wc-settings-tab-gestpay.php

    r3303342 r3359611  
    312312            array(
    313313                'title' => '',
    314                 'desc' => 'Con Gestpay Professional è possibile aggiungere pagine di pagamento differenti per differenti metodi di pagamento.<br>Seleziona qui quali modilità di pagamento abilitare; poi salva e infine vai nel tab "Cassa" per vedere abilitati i tipi di pagamento selezionati.<br>Si faccia riferimento al manuale per maggiori informazioni. Nota: i metodi di pagamento selezionati devono essere abilitati anche nel Backoffice Gestpay.',
     314                'desc' => 'Con Gestpay Professional è possibile aggiungere pagine di pagamento differenti per differenti metodi di pagamento.<br>Seleziona qui quali modilità di pagamento abilitare; poi salva e infine vai nel tab "Cassa" per vedere abilitati i tipi di pagamento selezionati.<br>Si faccia riferimento al manuale per maggiori informazioni. Nota: i metodi di pagamento selezionati devono essere abilitati anche nel Backoffice Gestpay.<br/><br/>Con l’ultima versione del nostro plugin, il <b>checkout a blocchi di WooCommerce è già compatibile con i pagamenti con carta e PayPal</b>.
     315Se utilizzi esclusivamente questi metodi, puoi attivarlo subito e offrire un\'esperienza d’acquisto più moderna ai tuoi clienti.<br/>
     316Il supporto per gli altri metodi di pagamento (es. MyBank, BancomatPay) verrà rilasciato progressivamente nelle prossime versioni.<br/><br/>
     317⚠️ Attivando il checkout a blocchi, verranno mostrati solo i metodi di pagamento compatibili (Carte di Credito e PayPal). Eventuali altri metodi attivi nel tuo shop non saranno visibili ai clienti fino al completamento del supporto.<br/><br/>
     318Se vuoi <b>disabilitare il checkout a blocchi per garantire l\'utilizzo di tutti i metodi di pagamento attivi nel tuo shop, puoi seguire la guida disponibile sulla <a href="https://doc.fabrick.it/it/plugin/woocommerce/blocks-integration/" target="_blank">documentazione ufficiale di Fabrick</a>.</b><br/>',
    315319                'type' => 'title',
    316320                'id' => 'wc_gestpaypro_moregateways_options',
  • gestpay-for-woocommerce/trunk/inc/payment_types/gestpay-mybank.php

    r3276807 r3359611  
    136136        $mybank_url = '<a href="https://mybank.eu" target="_blank" title="MyBank"><strong>mybank.eu</strong></a>';
    137137        $mybank_banner = '<div id="mybank-container-img"><a href="https://mybank.eu" target="_blank"><img src="'.esc_url( $this->plugin_url . 'images/mybank-tagline-positive-it.png' ).'" style="background-color:#fff!important"/></a></div>';
    138         echo wp_kses_post( $mybank_banner ) . '<p>' . esc_html( $this->strings['mybank_payoff'] ) . ' ' . wp_kses_post( $mybank_url ) . '</p>';
     138        echo wp_kses_post( $mybank_banner ) . '<p>' . wp_kses_post( $this->strings['mybank_payoff'] ) . ' ' . wp_kses_post( $mybank_url ) . '</p>';
    139139
    140140        if ( $this->required_selection ) {
  • gestpay-for-woocommerce/trunk/lib/gestpay-mybank.js

    r3276807 r3359611  
    99 */
    1010
    11 (function($){
     11(function ($) {
     12  function gestpayMyBankSelectWoo() {
     13    if (!$().selectWoo) {
     14      return;
     15    }
    1216
    13     function gestpayMyBankSelectWoo() {
    14         if ( !$().selectWoo ) {
    15             return;
     17    // Works on checkout and order_review forms
     18    var form = "form.woocommerce-checkout";
     19    if ($("form#order_review").length > 0) {
     20      form = "form#order_review";
     21    }
     22
     23    if (
     24      $(form + ' input[name="payment_method"]:checked').attr("id") !=
     25      "payment_method_wc_gateway_gestpay_mybank"
     26    ) {
     27      // Don't run on other payment methods
     28      return;
     29    }
     30
     31    $("select#gestpay-mybank-banklist").selectWoo({
     32      matcher: function (params, data) {
     33        // Thanks to Yuray https://stackoverflow.com/a/31626588/1992799
     34
     35        // If there are no search terms, return all of the data
     36        if ($.trim(params.term) === "") {
     37          return data;
    1638        }
    1739
    18         // Works on checkout and order_review forms
    19         var form = 'form.woocommerce-checkout';
    20         if ( $( 'form#order_review' ).length > 0 ) {
    21             form = 'form#order_review';
     40        var keywords = params.term.split(" ");
     41
     42        // check if data.text contains all of keywords, if some is missing, return null
     43        for (var i = 0; i < keywords.length; i++) {
     44          if (
     45            data.text.toUpperCase().indexOf(keywords[i].toUpperCase()) == -1
     46          ) {
     47            // Return `null` if the term should not be displayed
     48            return null;
     49          }
    2250        }
    2351
    24         if ( $( form + ' input[name="payment_method"]:checked' ).attr( 'id' ) != 'payment_method_wc_gateway_gestpay_mybank' ) {
    25             // Don't run on other payment methods
    26             return;
    27         }
    28 
    29         $( 'select#gestpay-mybank-banklist' ).selectWoo({
    30             matcher: function (params, data) {
    31                 // Thanks to Yuray https://stackoverflow.com/a/31626588/1992799
    32 
    33                 // If there are no search terms, return all of the data
    34                 if ($.trim(params.term) === '') {
    35                     return data;
    36                 }
    37 
    38                 var keywords = (params.term).split(" ");
    39 
    40                 // check if data.text contains all of keywords, if some is missing, return null
    41                 for (var i = 0; i < keywords.length; i++) {
    42                     if (((data.text).toUpperCase()).indexOf((keywords[i]).toUpperCase()) == -1) {
    43                         // Return `null` if the term should not be displayed
    44                         return null;
    45                     }
    46                 }
    47 
    48                 // If here, data.text contains all keywords, so return it.
    49                 return data;
    50             }
    51         });
    52 
    53         // Be sure there is enaugh space for the asterisk of the required field
    54         var $span = $( 'select#gestpay-mybank-banklist+.select2-container' );
    55         if ( $span.length == 1 ) {
    56             $span.width( $span.width() - 20 );
    57         }
    58     }
    59 
    60     // Runs when selecting or when reloading the already selected method.
    61     $( document.body ).on( 'payment_method_selected updated_checkout', function() {
    62         gestpayMyBankSelectWoo();
     52        // If here, data.text contains all keywords, so return it.
     53        return data;
     54      },
    6355    });
    6456
     57    // Be sure there is enaugh space for the asterisk of the required field
     58    var $span = $("select#gestpay-mybank-banklist+.select2-container");
     59    if ($span.length == 1) {
     60      const intvalWidth = setInterval(function () {
     61        if ($span.width() > 100) {
     62          clearInterval(intvalWidth);
     63          $span.width($span.width() - 20);
     64        }
     65      }, 100);
     66    }
     67  }
     68
     69  // Runs when selecting or when reloading the already selected method.
     70  $(document.body).on("payment_method_selected updated_checkout", function () {
     71    gestpayMyBankSelectWoo();
     72  });
    6573})(jQuery);
  • gestpay-for-woocommerce/trunk/readme.txt

    r3305565 r3359611  
    44Requires at least: 4.7
    55Requires PHP: 7.0
    6 Tested up to: 6.8
    7 Stable tag: 20250603
     6Tested up to: 6.8.2
     7Stable tag: 20250911
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
    1010WC requires at least: 3.0
    11 WC tested up to: 9.4.2
     11WC tested up to: 10.0.4
    1212
    1313Axerve Free Plugin for Woocommerce extends WooCommerce providing the payment gateway Axerve.
     
    6969== Changelog ==
    7070
     71= 20250911 =
     72* Feature: Added WooCommerce Blocks support for credit card and PayPal payments
     73  - Integrated GestPay payment methods with WooCommerce Blocks checkout
     74  - Added support for credit card payments in blocks checkout
     75  - Added support for PayPal payments in blocks checkout
     76  - Enhanced checkout experience with modern block-based interface
     77  - Note: Support for other payment methods in blocks will be added in future releases
     78* Fix: Nothing added
     79* Security: Nothing added
     80* Improvement: Enhanced checkout experience with blocks integration
     81* Checks: Verified compatibility with WordPress 6.8.2, WooCommerce 10.0.4
     82* Note: This release enables seamless integration of GestPay payments in WooCommerce Blocks checkout
     83
    7184= 20250603 =
    7285* Fix: Removed unnecessary error_log messages that were causing log file inflation
Note: See TracChangeset for help on using the changeset viewer.