Changeset 3468545
- Timestamp:
- 02/24/2026 10:32:48 AM (2 months ago)
- Location:
- paybybank/trunk
- Files:
-
- 4 edited
-
README.txt (modified) (2 diffs)
-
admin/class-dc-paybybank-admin.php (modified) (1 diff)
-
dc-paybybank.php (modified) (2 diffs)
-
public/class-dc-paybybank-public.php (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
paybybank/trunk/README.txt
r3411994 r3468545 6 6 Stable tag: 3.0.1 7 7 Requires at least: 5.6 8 Tested up to: 6.9 8 Tested up to: 6.9.1 9 9 WC requires at least: 5.6.0 10 WC tested up to: 10. 3.610 WC tested up to: 10.5.2 11 11 Requires PHP: 7.4 12 12 License: GPLv2 or later … … 118 118 == Changelog == 119 119 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 120 134 = 3.0.1 = 121 135 *Release Date - 05 Dec 2025* -
paybybank/trunk/admin/class-dc-paybybank-admin.php
r3411994 r3468545 459 459 // An INSERT ON DUPLICATE KEY UPDATE is performed as a hack to quickly mass update multiple records with a single SQL query. 460 460 $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)"; 462 462 $res = $wpdb->query( $sql ); 463 463 } -
paybybank/trunk/dc-paybybank.php
r3411994 r3468545 8 8 * Author: PayByBank 9 9 * Author URI: https://www.paybybank.eu/ 10 * Version: 3.0. 110 * Version: 3.0.4 11 11 * Text Domain: paybybank 12 12 * Domain Path: /languages 13 13 * Requires at least: 5.6 14 * Tested up to: 6.9 14 * Tested up to: 6.9.1 15 15 * WC requires at least: 5.6.0 16 * WC tested up to: 10. 3.616 * WC tested up to: 10.5.2 17 17 * Requires PHP: 7.4 18 18 * Requires Plugins: woocommerce … … 34 34 * Plugin constants. 35 35 */ 36 define( 'DC_PAYBYBANK_VERSION', '3.0. 1' );36 define( 'DC_PAYBYBANK_VERSION', '3.0.4' ); 37 37 define( 'DC_PAYBYBANK_SLUG', 'paybybank' ); 38 38 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 29 29 private string $payment_code_life; 30 30 private string $order_status; 31 private string $order_status_success;31 // private string $order_status_success; 32 32 private string $extra_fee; 33 private string $paid_email;33 // private string $paid_email; 34 34 private $logger; 35 35 … … 54 54 $this->payment_code_life = $gateway_settings['payment_code_life'] ?? '720'; 55 55 $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'; 57 57 $this->extra_fee = $gateway_settings['extra_fee'] ?? ''; 58 $this->paid_email = $gateway_settings['paid_email'] ?? '';58 // $this->paid_email = $gateway_settings['paid_email'] ?? ''; 59 59 $this->logger = wc_string_to_bool( $gateway_settings['enable_log'] ?? false ) ? wc_get_logger() : false; 60 60 } 61 61 62 62 63 63 64 64 /** … … 109 109 if ( empty( $reference_code ) ) { 110 110 esc_html_e( 'An error occurred with your RF Code. Please contact us to help you complete your order.', 'paybybank' ); 111 111 112 return; 112 113 } 113 114 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 } 119 158 120 159 if ( 'success' === $open_banking_result ) { 121 160 $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' ); 122 161 } 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 } 123 165 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' ); 125 168 } 126 169 … … 128 171 } 129 172 else { 173 // classic RF flow (show RF in thank-you page) 130 174 if ( empty( $instructions ) ) return; 131 175 … … 144 188 145 189 $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 ); 147 191 148 192 echo wpautop( wptexturize( wp_kses_post( $instructions ) ) ); … … 171 215 if ( empty( $reference_code ) ) { 172 216 esc_html_e( 'An error occurred with your PayByBank payment. Please contact us to help you complete your order.', 'paybybank' ); 217 173 218 return; 174 219 } … … 180 225 // Don't show any special message if the order was created via open banking 181 226 // 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 } 185 232 } 186 233 else { // classic payment with RF … … 193 240 } 194 241 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 ); 197 244 } 198 245 else { … … 300 347 '1' => 'alphabank.png', 301 348 '2' => 'nbg.png', 302 '3' => 'piraeus.png',349 '3' => 'piraeus.png', 303 350 '6' => 'nbg.png', 304 351 '8' => 'alphabank.png', … … 354 401 if ( is_wp_error( $bank_options ) ) { 355 402 echo '<div class="dc-paybybank-error-message">' . esc_html( $bank_options->get_error_message() ) . '</div>'; 403 356 404 return; 357 405 } … … 401 449 wp_send_json_error( [ 402 450 'redirect_url' => wc_get_checkout_url() 403 ] );451 ] ); 404 452 } 405 453 … … 412 460 wp_send_json_error( [ 413 461 'redirect_url' => wc_get_checkout_url() 414 ] );462 ] ); 415 463 } 416 464 … … 474 522 $order->set_transaction_id( $transaction_id ); 475 523 } 476 catch ( WC_Data_Exception $e ) {} 524 catch ( WC_Data_Exception $e ) { 525 } 477 526 } 478 527 479 528 // Set order status for the new created order 480 529 $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' ); 482 531 $order->update_status( $status_for_created_order, esc_html( $order_note ) ); 483 532 … … 502 551 wp_send_json_success( [ 503 552 'redirect_url' => $redirect_url ?? $order->get_checkout_order_received_url() 504 ] );553 ] ); 505 554 } 506 555 … … 514 563 wp_send_json_error( [ 515 564 'redirect_url' => wc_get_checkout_url() 516 ] );565 ] ); 517 566 } 518 567
Note: See TracChangeset
for help on using the changeset viewer.
