close

Plugin Directory

Changeset 3468545


Ignore:
Timestamp:
02/24/2026 10:32:48 AM (2 months ago)
Author:
theogk
Message:

version 3.0.4 into truck

Location:
paybybank/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • paybybank/trunk/README.txt

    r3411994 r3468545  
    66Stable tag: 3.0.1
    77Requires at least: 5.6
    8 Tested up to: 6.9
     8Tested up to: 6.9.1
    99WC requires at least: 5.6.0
    10 WC tested up to: 10.3.6
     10WC tested up to: 10.5.2
    1111Requires PHP: 7.4
    1212License: GPLv2 or later
     
    118118== Changelog ==
    119119
     120= 3.0.4 =
     121*Release Date - 24 Feb 2026*
     122* Checked compatibility with the latest WordPress and WooCommerce versions.
     123* Compatibility improvement for newer mySQL versions.
     124
     125= 3.0.3 =
     126*Release Date - 29 Jan 2026*
     127* Improved cached order data handling.
     128
     129= 3.0.2 =
     130*Release Date - 28 Jan 2026*
     131* Checked compatibility with the latest WordPress and WooCommerce versions.
     132* Minor fix in email instructions logic.
     133
    120134= 3.0.1 =
    121135*Release Date - 05 Dec 2025*
  • paybybank/trunk/admin/class-dc-paybybank-admin.php

    r3411994 r3468545  
    459459                // An INSERT ON DUPLICATE KEY UPDATE is performed as a hack to quickly mass update multiple records with a single SQL query.
    460460                $values = implode( ", ", $values );
    461                 $sql    = "INSERT INTO {$pbb_table_name} (order_id, pbb_id, rf_code, pbb_status, update_pending) VALUES {$values} AS newval ON DUPLICATE KEY UPDATE pbb_status = newval.pbb_status, update_pending = newval.update_pending";
     461                $sql    = "INSERT INTO {$pbb_table_name} (order_id, pbb_id, rf_code, pbb_status, update_pending) VALUES {$values} ON DUPLICATE KEY UPDATE pbb_status = VALUES(pbb_status), update_pending = VALUES(update_pending)";
    462462                $res    = $wpdb->query( $sql );
    463463            }
  • paybybank/trunk/dc-paybybank.php

    r3411994 r3468545  
    88 * Author:            PayByBank
    99 * Author URI:        https://www.paybybank.eu/
    10  * Version:           3.0.1
     10 * Version:           3.0.4
    1111 * Text Domain:       paybybank
    1212 * Domain Path:       /languages
    1313 * Requires at least: 5.6
    14  * Tested up to:      6.9
     14 * Tested up to:      6.9.1
    1515 * WC requires at least: 5.6.0
    16  * WC tested up to:   10.3.6
     16 * WC tested up to:   10.5.2
    1717 * Requires PHP:      7.4
    1818 * Requires Plugins:  woocommerce
     
    3434     * Plugin constants.
    3535     */
    36     define( 'DC_PAYBYBANK_VERSION', '3.0.1' );
     36    define( 'DC_PAYBYBANK_VERSION', '3.0.4' );
    3737    define( 'DC_PAYBYBANK_SLUG', 'paybybank' );
    3838    define( 'DC_PAYBYBANK_BASE_TEST_PATH', 'https://testapi.e-paylink.com/gateway/rest/api/v1' );
  • paybybank/trunk/public/class-dc-paybybank-public.php

    r3318016 r3468545  
    2929    private string $payment_code_life;
    3030    private string $order_status;
    31     private string $order_status_success;
     31    // private string $order_status_success;
    3232    private string $extra_fee;
    33     private string $paid_email;
     33    // private string $paid_email;
    3434    private $logger;
    3535
     
    5454        $this->payment_code_life    = $gateway_settings['payment_code_life'] ?? '720';
    5555        $this->order_status         = $gateway_settings['order_status'] ?? 'wc-on-hold';
    56         $this->order_status_success = $gateway_settings['order_status_success'] ?? 'wc-paybybank-paid';
     56        // $this->order_status_success = $gateway_settings['order_status_success'] ?? 'wc-paybybank-paid';
    5757        $this->extra_fee            = $gateway_settings['extra_fee'] ?? '';
    58         $this->paid_email           = $gateway_settings['paid_email'] ?? '';
     58        // $this->paid_email           = $gateway_settings['paid_email'] ?? '';
    5959        $this->logger               = wc_string_to_bool( $gateway_settings['enable_log'] ?? false ) ? wc_get_logger() : false;
    6060    }
    6161
    62    
     62
    6363
    6464    /**
     
    109109        if ( empty( $reference_code ) ) {
    110110            esc_html_e( 'An error occurred with your RF Code. Please contact us to help you complete your order.', 'paybybank' );
     111
    111112            return;
    112113        }
    113114
    114         $instructions        = trim( $this->instructions );
    115         $open_banking_result = $order->get_meta( 'dc_pbb_ob_result' );
    116 
    117         // special messages when redirected from open banking - skip default instructions
    118         if ( ! empty( $open_banking_result ) ) {
     115        $instructions         = trim( $this->instructions );
     116        $open_banking_result  = $order->get_meta( 'dc_pbb_ob_result' );
     117        $open_banking_bank_id = $order->get_meta( 'dc_pbb_selected_bank' );
     118
     119        // special messages when redirected from open banking - skip default instructions, hide RF
     120        if ( is_numeric( $open_banking_bank_id ) && $open_banking_bank_id >= 0 ) {
     121
     122            // it should not be empty in any case, probably an object cache issue
     123            // try to clear the cache, give it some time, and then refetch order
     124            if ( empty( $open_banking_result ) ) {
     125
     126                if ( $this->logger ) {
     127                    $this->logger->error( 'Open banking result is missing from Open banking order #' . $order_id, [ 'source' => DC_PAYBYBANK_SLUG ] );
     128                }
     129
     130                // Clear legacy post cache (covers CPT mode and HPOS Sync mode)
     131                clean_post_cache( $order_id );
     132
     133                // Clear WooCommerce specific order caches (covers HPOS and Object Caching)
     134                wp_cache_delete( $order_id, 'orders' );
     135                wp_cache_delete( $order_id, 'order_objects' );
     136
     137                // Clear internal PHP Order Data Cache
     138                try {
     139                    if ( class_exists( 'Automattic\WooCommerce\Internal\DataStores\Orders\OrdersTableDataStore' )
     140                         && class_exists( 'Automattic\WooCommerce\Caches\OrderCache' ) ) {
     141                        $order_cache = wc_get_container()->get( \Automattic\WooCommerce\Caches\OrderCache::class );
     142                        $order_cache->remove( $order_id );
     143                    }
     144                }
     145                catch ( \Exception $e ) {
     146                }
     147
     148                sleep( 0.5 );
     149
     150                $fresh_order = wc_get_order( $order_id );
     151
     152                if ( $order instanceof WC_Order ) {
     153                    $order = $fresh_order;
     154                }
     155
     156                $open_banking_result = $order->get_meta( 'dc_pbb_ob_result' );
     157            }
    119158
    120159            if ( 'success' === $open_banking_result ) {
    121160                $ob_message = __( 'Your order is on hold until we confirm your payment. You will be updated about the status of your order via e-mail soon.', 'paybybank' );
    122161            }
     162            elseif ( 'failure' === $open_banking_result ) {
     163                $ob_message = __( 'Your payment has failed. You can still get your products. You will receive an e-mail in a few minutes with an RF-code and instructions to complete the payment.', 'paybybank' );
     164            }
    123165            else {
    124                 $ob_message = __( 'Your payment has failed. You can still get your products. You will receive an e-mail in a few minutes with an RF-code and instructions to complete the payment.', 'paybybank' );
     166                // if the result is still empty, show a generic message
     167                $ob_message = __( 'Your order is on hold until we confirm your payment. You will be updated about the status of your order via e-mail soon.', 'paybybank' );
    125168            }
    126169
     
    128171        }
    129172        else {
     173            // classic RF flow (show RF in thank-you page)
    130174            if ( empty( $instructions ) ) return;
    131175
     
    144188
    145189            $instructions = str_replace( '{pbb_rf_code}', $reference_code_html, $instructions );
    146             $instructions = str_replace( '{pbb_rf_amount}', wc_price( $order->get_total() ), $instructions ) ;
     190            $instructions = str_replace( '{pbb_rf_amount}', wc_price( $order->get_total() ), $instructions );
    147191
    148192            echo wpautop( wptexturize( wp_kses_post( $instructions ) ) );
     
    171215        if ( empty( $reference_code ) ) {
    172216            esc_html_e( 'An error occurred with your PayByBank payment. Please contact us to help you complete your order.', 'paybybank' );
     217
    173218            return;
    174219        }
     
    180225        // Don't show any special message if the order was created via open banking
    181226        // and the user is redirected to his e-banking (we have no result yet).
    182         if ( empty( $open_banking_result ) && is_numeric( $open_banking_bank_id ) && $open_banking_bank_id >= 0 ) {
    183 
    184             $instructions = __( 'You will receive an e-mail in a few minutes, as soon as we confirm your payment with PayByBank service.', 'paybybank' );
     227        if ( is_numeric( $open_banking_bank_id ) && $open_banking_bank_id >= 0 ) {
     228
     229            if ( empty( $open_banking_result ) ) {
     230                $instructions = __( 'You will receive an e-mail in a few minutes, as soon as we confirm your payment with PayByBank service.', 'paybybank' );
     231            }
    185232        }
    186233        else { // classic payment with RF
     
    193240                }
    194241
    195                 $instructions = str_replace( '{pbb_rf_code}', $reference_code_html, $this->email_instructions ) ;
    196                 $instructions = str_replace( '{pbb_rf_amount}', wc_price( $order->get_total() ), $instructions ) ;
     242                $instructions = str_replace( '{pbb_rf_code}', $reference_code_html, $this->email_instructions );
     243                $instructions = str_replace( '{pbb_rf_amount}', wc_price( $order->get_total() ), $instructions );
    197244            }
    198245            else {
     
    300347            '1'  => 'alphabank.png',
    301348            '2'  => 'nbg.png',
    302             '3' => 'piraeus.png',
     349            '3'  => 'piraeus.png',
    303350            '6'  => 'nbg.png',
    304351            '8'  => 'alphabank.png',
     
    354401        if ( is_wp_error( $bank_options ) ) {
    355402            echo '<div class="dc-paybybank-error-message">' . esc_html( $bank_options->get_error_message() ) . '</div>';
     403
    356404            return;
    357405        }
     
    401449            wp_send_json_error( [
    402450                'redirect_url' => wc_get_checkout_url()
    403             ]);
     451            ] );
    404452        }
    405453
     
    412460            wp_send_json_error( [
    413461                'redirect_url' => wc_get_checkout_url()
    414             ]);
     462            ] );
    415463        }
    416464
     
    474522                    $order->set_transaction_id( $transaction_id );
    475523                }
    476                 catch ( WC_Data_Exception $e ) {}
     524                catch ( WC_Data_Exception $e ) {
     525                }
    477526            }
    478527
    479528            // Set order status for the new created order
    480529            $status_for_created_order = 'wc-' === substr( $this->order_status, 0, 3 ) ? substr( $this->order_status, 3 ) : $this->order_status;
    481             $order_note = $bank_id >= 0 ? __( 'Checkout with PayByBank. Payment via e-banking.', 'paybybank' ) : __( 'Checkout with PayByBank. Payment via manual RF code.', 'paybybank' );
     530            $order_note               = $bank_id >= 0 ? __( 'Checkout with PayByBank. Payment via e-banking.', 'paybybank' ) : __( 'Checkout with PayByBank. Payment via manual RF code.', 'paybybank' );
    482531            $order->update_status( $status_for_created_order, esc_html( $order_note ) );
    483532
     
    502551            wp_send_json_success( [
    503552                'redirect_url' => $redirect_url ?? $order->get_checkout_order_received_url()
    504             ]);
     553            ] );
    505554        }
    506555
     
    514563        wp_send_json_error( [
    515564            'redirect_url' => wc_get_checkout_url()
    516         ]);
     565        ] );
    517566    }
    518567
Note: See TracChangeset for help on using the changeset viewer.