Changeset 3432938
- Timestamp:
- 01/05/2026 05:29:04 PM (3 months ago)
- Location:
- bulletproof-checkout-lite/trunk
- Files:
-
- 5 edited
-
README.txt (modified) (2 diffs)
-
bulletproof-checkout-lite.php (modified) (2 diffs)
-
includes/class-wc-bulletproof-payment-gateway-lite.php (modified) (7 diffs)
-
includes/class-wc-bulletproof-shop-orders.php (modified) (8 diffs)
-
includes/class-wc-bulletproof-webhook.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
bulletproof-checkout-lite/trunk/README.txt
r3404386 r3432938 3 3 Tags: woocommerce, 3DS, payment gateway, bulletproof, chargeback, fraud prevention 4 4 WC requires at least: 5.0 5 WC tested up to: 10.3. 55 WC tested up to: 10.3.7 6 6 Tested up to: 6.8.3 7 Stable tag: 1.0.2 27 Stable tag: 1.0.24 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 237 237 = 1.0.22 = 238 238 Added custom logger to the Wordpress Logs 239 = 1.0.24 = 240 Remove unused admin notices -
bulletproof-checkout-lite/trunk/bulletproof-checkout-lite.php
r3404386 r3432938 4 4 * Plugin URI: https://www.bulletproof-checkout.com/ 5 5 * Description: Protect your credit card payments with 3D Secure (3DS) and say goodbye to chargebacks. 6 * Version: 1.0.2 36 * Version: 1.0.24 7 7 * Author: BulletProof Checkout <support@bulletproof-checkout.com> 8 8 * Author URI: https://www.bulletproof-checkout.com/ … … 11 11 * Text Domain: bulletproof-checkout-lite 12 12 * WC requires at least: 5.0 13 * WC tested up to: 10.3. 514 * Tested up to: 6. 8.313 * WC tested up to: 10.3.7 14 * Tested up to: 6.9 15 15 * Requires PHP: 7.4 16 16 * Requires Plugins: woocommerce -
bulletproof-checkout-lite/trunk/includes/class-wc-bulletproof-payment-gateway-lite.php
r3404386 r3432938 350 350 public function bulletproof_payment_response_handler() 351 351 { 352 $logger = wc_get_logger(); 353 $context = array('source' => 'bpcheckout-App'); 352 354 // Check if the order status has already been updated. 353 355 $status_updated = false; … … 365 367 // Code for processing payment responses based on query parameters. 366 368 // phpcs:ignore WordPress.Security.NonceVerification.Recommended 369 370 $logger->info("Data received in the payment response handler: bulletproof_payment_response_handler()", $context); 371 $logger->info(print_r($_GET, true), $context); 367 372 368 373 // Non-3DS customers also will be able to update their postmeta information … … 382 387 if ($status_after_payment_completed != "bp_donotchange") { 383 388 $order->update_status($status_after_payment_completed, __('Status after payment received updated by the BulletProof Plugin. ', 'bulletproof-checkout-lite')); 384 $the_msg = 'Status updated by the BulletProof Plugin due to sale method found is:' . $sale_method_found . '. '; 389 $the_msg = 'Status updated by the BulletProof Plugin Order#:' . $order_id . ' due to sale method found is:' . $sale_method_found . '. Status assigned:' . $status_after_payment_completed; 390 $logger->info($the_msg, $context); 385 391 } 386 392 } … … 394 400 if ($order) { 395 401 $order->update_status('wc-on-hold', __($the_msg, 'bulletproof-checkout-lite')); 402 $the_msg .= ' Status assigned: on-hold . Order#' . $order_id; 403 $logger->info($the_msg, $context); 396 404 } 397 405 } … … 400 408 $order->update_meta_data('_bulletproof_gateway_action_type', $sale_method_found); 401 409 $order->save(); 410 $logger->info("Update the transaction ID for Order#:" . $order_id." to: " . $transaction_id, $context); 402 411 } 403 412 WC()->cart->empty_cart(); … … 420 429 $order->update_status('wc-failed'); 421 430 $order->add_order_note($failed_msg); 431 $logger->info("The transaction for Order#:" . $order_id." was failed. " . $failed_msg, $context); 422 432 } 423 433 } … … 710 720 public function process_refund($order_id, $amount = null, $reason = '') 711 721 { 712 722 error_log('BulletProof is Starting refund Order id#: ' . $order_id); 713 723 // setting log class 714 724 $logger = wc_get_logger(); -
bulletproof-checkout-lite/trunk/includes/class-wc-bulletproof-shop-orders.php
r3404386 r3432938 94 94 95 95 $transaction_id = return_meta_data_lite($result_found, '_transaction_id'); 96 $card_type = return_meta_data_lite($result_found, "_gateway_cctype" , true);96 $card_type = return_meta_data_lite($result_found, "_gateway_cctype"); 97 97 // Check the transaction information 98 98 if (($card_type == "") && ($transaction_id != "")) { … … 165 165 $refund_date = return_meta_data_lite($result_found, '_bulletproof_gateway_void_or_refund_date'); 166 166 $action_type = return_meta_data_lite($result_found, '_bulletproof_gateway_action_type'); 167 $any_cancel_reason = return_meta_data_lite($result_found, "_order_cancelled_reason" , true);168 $transaction_type = strtoupper(return_meta_data_lite($result_found, '_bulletproof_gateway_action_type' , true));169 $billing_first_name = return_meta_data_lite($result_found, "_gateway_first_name" , true);170 $billing_last_name = return_meta_data_lite($result_found, "_gateway_last_name" , true);167 $any_cancel_reason = return_meta_data_lite($result_found, "_order_cancelled_reason"); 168 $transaction_type = strtoupper(return_meta_data_lite($result_found, '_bulletproof_gateway_action_type')); 169 $billing_first_name = return_meta_data_lite($result_found, "_gateway_first_name"); 170 $billing_last_name = return_meta_data_lite($result_found, "_gateway_last_name"); 171 171 if ($card_last4 == "") { 172 $card_last4 = return_meta_data_lite($result_found, "_gateway_last4" , true);172 $card_last4 = return_meta_data_lite($result_found, "_gateway_last4"); 173 173 } 174 174 if ($card_first6 == "") { 175 $card_first6 = return_meta_data_lite($result_found, "_gateway_first6" , true);175 $card_first6 = return_meta_data_lite($result_found, "_gateway_first6"); 176 176 } 177 177 // Cardholder Authentication 178 $cavv = return_meta_data_lite($result_found, "_gateway_cavv" , true);179 $eci = return_meta_data_lite($result_found, "_gateway_eci" , true);180 $cardholder_auth = return_meta_data_lite($result_found, "_gateway_cardholder_auth" , true);181 $display_transaction_id = return_meta_data_lite($result_found, '_payment_gateway_tx_received_prewebhook' , true);178 $cavv = return_meta_data_lite($result_found, "_gateway_cavv"); 179 $eci = return_meta_data_lite($result_found, "_gateway_eci"); 180 $cardholder_auth = return_meta_data_lite($result_found, "_gateway_cardholder_auth"); 181 $display_transaction_id = return_meta_data_lite($result_found, '_payment_gateway_tx_received_prewebhook'); 182 182 if ($display_transaction_id == "") $display_transaction_id = $transaction_id; 183 183 … … 1835 1835 $context = array('source' => 'bpcheckout-App'); 1836 1836 $logger->info("Status update of the order ID#:" . $order_id . " was detected, the old status was:" . $old_status . ", the new status is:" . $new_status, $context); 1837 if (($order_id != "") && ( $old_status == "completed" || $old_status == "processing") && (($new_status == "cancelled") || ($new_status == "refunded"))) {1838 1839 $logger->info(" Starting refund from the BulletProof Lite Plugin for the Order ID#:" . $order_id, $context);1837 if (($order_id != "") && (($new_status == "cancelled") || ($new_status == "refunded"))) { 1838 1839 $logger->info("New status for a potential refund for the Order ID#:" . $order_id . " was detected", $context); 1840 1840 // Check if the order was paid using the BulletProof Lite plugin (or the BulletProof plus plugin) 1841 1841 // $order = wc_get_order($order_id); // not needed as the action has a extra new parameter which includes the $order … … 1847 1847 1848 1848 if ((!empty($payment_method_used)) && (($payment_method_used == "bulletproof_bpcheckout_lite") || ($payment_method_used == "bulletproof_bpcheckout"))) { 1849 $logger->info("Starting refund from the BulletProof Lite Plugin for the Order ID#:" . $order_id, $context); 1849 1850 // check if was previously refunded 1850 1851 $earlier_refund = $order->get_meta('_bulletproof_refunded', true); … … 1861 1862 if ($days_diff < 365) { // limited to two years refund period 1862 1863 $lite_gateway = new Bulletproof_Payment_Gateway_Lite(); 1863 $response_refund = $lite_gateway->process_refund($order_id, $order->get_total() );1864 $response_refund = $lite_gateway->process_refund($order_id, $order->get_total(), ""); 1864 1865 unset($lite_gateway); // Remove the Object from memory ASAP 1865 1866 if (is_wp_error($response_refund)) { … … 1883 1884 return false; 1884 1885 } else { 1885 $the_msg = "Order " . $order_id . " was refunded succesfully after status update from " .$old_status." to ".$new_status.".";1886 $the_msg = "Order " . $order_id . " was refunded succesfully after status update from " . $old_status . " to " . $new_status . "."; 1886 1887 $logger->info($the_msg, $context); 1887 /*1888 /* 1888 1889 try { 1889 1890 $current_user = wp_get_current_user(); … … 1946 1947 } 1947 1948 } else { 1948 error_log("Order " . $order_id . " was not refunded by BulletProof because was originally paid with other payment gateway");1949 $order->add_order_note("This order can not be refunded by BulletProof because was paid on another payment gateway");1950 $order->save();1951 return false;1949 $logger->info("Order " . $order_id . " was not refunded by BulletProof because was originally paid with other payment gateway", $context); 1950 //$order->add_order_note("This order can not be refunded by BulletProof because was paid on another payment gateway"); 1951 //$order->save(); 1952 //return false; 1952 1953 } 1953 1954 } … … 2009 2010 $security_key = ""; 2010 2011 } 2011 if (($username == "") || ($password == "") || ($security_key == "")) { 2012 // Add admin notice 2012 if (class_exists('WC_Admin_Notices')) { 2013 2013 $adminnotice = new WC_Admin_Notices(); 2014 $setting_link = admin_url('admin.php?page=wc-settings&tab=checkout§ion=bulletproof_bpcheckout_lite'); 2015 $adminnotice->add_custom_notice("", sprintf(__("BulletProof Checkout Lite is almost ready. To get started, <a href='%s'>set your BulletProof Checkout Lite account keys</a>.", 'wc-nmi'), $setting_link)); 2016 $adminnotice->output_custom_notices(); 2014 if ((is_plugin_active('bulletproof-checkout-lite/bulletproof-checkout-lite.php')) && is_plugin_active('woocommerce/woocommerce.php')) { 2015 2016 // The enabled property will be 'yes' if enabled, 'no' if disabled in settings. 2017 2018 if ((isset($gateway_settings['enabled'] )&&($gateway_settings['enabled'] === 'yes'))) { 2019 if (($username == "") || ($password == "") || ($security_key == "")) { 2020 // Add admin notice 2021 $setting_link = admin_url('admin.php?page=wc-settings&tab=checkout§ion=bulletproof_bpcheckout_lite'); 2022 $adminnotice->add_custom_notice("BPLITEADD", sprintf(__("BulletProof Checkout Lite is almost ready. To get started, <a href='%s'>set your BulletProof Checkout Lite account keys</a>.", 'wc-nmi'), $setting_link)); 2023 //$adminnotice->output_custom_notices(); 2024 } else { 2025 if ($adminnotice->has_notice("BPLITEADD")) { 2026 $adminnotice->remove_notice("BPLITEADD"); 2027 } 2028 } 2029 } else { 2030 if ($adminnotice->has_notice("BPLITEADD")) { 2031 $adminnotice->remove_notice("BPLITEADD"); 2032 } 2033 } 2034 } else { 2035 if ($adminnotice->has_notice("BPLITEADD")) { 2036 $adminnotice->remove_notice("BPLITEADD"); 2037 } 2038 } 2017 2039 } 2018 2040 if (class_exists('Jetpack') && Jetpack::is_module_active('notes')) { -
bulletproof-checkout-lite/trunk/includes/class-wc-bulletproof-webhook.php
r3368943 r3432938 230 230 { 231 231 if ((isset($data['order_id'])) && (is_numeric($data['order_id']))) { 232 if (isset($data['transaction_id'])){ 233 $transaction_id = $data['transaction_id']; 234 } else { 235 $transaction_id = ""; 236 } 232 237 $order = wc_get_order($data['order_id']); 233 238 if ($order) { 234 if ($order && ($order->get_status() === 'pending' || $order->get_status() === 'Pending payment') || ($order->get_status() === 'completed') || ($order->get_status() === $status_after_order_completed)) { 239 //if ($order && ($order->get_status() === 'pending' || $order->get_status() === 'Pending payment') || ($order->get_status() === 'completed') || ($order->get_status() === $status_after_order_completed)) { 240 if ($order && ($order->get_status() != 'refunded' && $order->get_status() != 'cancelled')) { 235 241 // Only if the payment method used was the BulletProof Lite Plugin will update the status 236 242 $payment_method_used = $order->get_meta('_payment_method', true); … … 261 267 $currency_symbol = get_woocommerce_currency_symbol($currency_code); 262 268 $the_msg = "Partial refund issued by the BulletProof Gateway for " . $currency_symbol . number_format($data['requested_amount'], 2, '.', ''); 269 if ($transaction_id!=""){ 270 $the_msg .= " for transaction " . $transaction_id; 271 } 263 272 $order->add_order_note($the_msg); 264 273 } … … 439 448 header("HTTP/1.0 404 " . $msg, true, 404); 440 449 echo json_encode($msg); 450 error_log("BulletProof Webhook error: " . $msg . " IP Address:" . $the_ip. " Event Type:".$event_type); 441 451 die(); 442 452 break; 443 453 } 444 454 echo json_encode("OK"); 455 error_log("BulletProof executed webhook successfully for IP Address:" . $the_ip . " Event Type:".$event_type); 445 456 die(); 446 457 } else { … … 466 477 header("HTTP/1.0 404 " . $msg, true, 404); 467 478 echo json_encode($msg); 479 error_log("BulletProof Webhook error: " . $msg . " IP Address:" . $the_ip); 468 480 } else { 469 481 header("HTTP/1.0 404 Not Authorized", true, 404); 470 482 echo json_encode("Not Authorized. IP Address:" . $the_ip); 483 error_log("BulletProof Webhook unauthorized access attempt from IP Address:" . $the_ip); 471 484 } 472 485 }
Note: See TracChangeset
for help on using the changeset viewer.