Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e41ef6a
Add remediation for canceled authorization fees
mgascam Nov 18, 2025
e28efb3
Merge branch 'develop' into cancel-auth-fee-remediation
mgascam Nov 26, 2025
dba00e7
feat: add HPOS support for affected orders remediation
mgascam Nov 26, 2025
1c5aad0
Merge branch 'develop' into cancel-auth-fee-remediation
mgascam Nov 26, 2025
ac87be1
Address copilot comments
mgascam Nov 26, 2025
67b4ebb
feat: enhance remediation logic for canceled authorization fees and i…
mgascam Nov 26, 2025
72b6a74
feat: implement admin notice and remediation tool for canceled author…
mgascam Nov 26, 2025
a917c0b
refactor: remove unused plugin update method and clean up test imports
mgascam Nov 26, 2025
b111c29
feat: enhance remediation tool for canceled authorization fees with d…
mgascam Nov 26, 2025
3a83f23
feat: update remediation logic to change order status from 'refunded'…
mgascam Nov 26, 2025
ea90207
feat: add refund stats cleanup logic and corresponding unit tests for…
mgascam Nov 26, 2025
f8d44ec
Merge branch 'develop' into cancel-auth-fee-remediation
mgascam Nov 27, 2025
1aca52c
feat: add confirmation message for canceled authorization remediation…
mgascam Nov 27, 2025
63ce0c2
feat: remove deprecated admin notice for canceled authorization fee r…
mgascam Nov 27, 2025
f93e62e
feat: remove action for plugin update on upgrader process completion
mgascam Nov 27, 2025
3f7e799
fix: update SQL queries to use IN clause for transaction fee meta key…
mgascam Nov 27, 2025
978cad5
feat: enhance refund deletion message to include deleted refund IDs
mgascam Nov 27, 2025
bbf7c43
Add changelog
mgascam Nov 27, 2025
dd969e7
Merge branch 'develop' into cancel-auth-fee-remediation
mgascam Dec 3, 2025
2fbe206
fix: enhance confirmation message for canceled authorization remediat…
mgascam Dec 4, 2025
ef4a458
Merge branch 'develop' into cancel-auth-fee-remediation
mgascam Dec 4, 2025
2b0dc25
Fix linter error
mgascam Dec 4, 2025
161ee72
fix: update remediation process to trigger WooCommerce refund deletio…
mgascam Dec 4, 2025
fa03b13
feat: add dry run functionality for canceled authorization fee remedi…
mgascam Dec 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions includes/class-wc-payments.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,13 @@ class WC_Payments {
*/
private static $payment_method_service;

/**
* Instance of WC_Payments_Remediate_Canceled_Auth_Fees, created in init function
*
* @var WC_Payments_Remediate_Canceled_Auth_Fees
*/
private static $fee_remediation;

/**
* Entry point to the initialization logic.
*/
Expand Down Expand Up @@ -352,6 +359,7 @@ public static function init() {
add_action( 'admin_init', [ __CLASS__, 'add_woo_admin_notes' ] );
add_action( 'admin_init', [ __CLASS__, 'remove_deprecated_notes' ] );
add_action( 'init', [ __CLASS__, 'install_actions' ] );
add_action( 'upgrader_process_complete', [ __CLASS__, 'on_plugin_update' ], 10, 2 );

add_action( 'woocommerce_blocks_payment_method_type_registration', [ __CLASS__, 'register_checkout_gateway' ] );

Expand Down Expand Up @@ -492,6 +500,7 @@ public static function init() {
include_once __DIR__ . '/class-wc-payments-order-service.php';
include_once __DIR__ . '/class-wc-payments-order-success-page.php';
include_once __DIR__ . '/class-wc-payments-file-service.php';
include_once __DIR__ . '/migrations/class-wc-payments-remediate-canceled-auth-fees.php';
include_once __DIR__ . '/class-wc-payments-webhook-processing-service.php';
include_once __DIR__ . '/class-wc-payments-webhook-reliability-service.php';
include_once __DIR__ . '/fraud-prevention/class-fraud-prevention-service.php';
Expand Down Expand Up @@ -552,6 +561,7 @@ public static function init() {
self::$incentives_service = new WC_Payments_Incentives_Service( self::$database_cache );
self::$duplicate_payment_prevention_service = new Duplicate_Payment_Prevention_Service();
self::$duplicates_detection_service = new Duplicates_Detection_Service();
self::$fee_remediation = new WC_Payments_Remediate_Canceled_Auth_Fees();

( new WooPay_Scheduler( self::$api_client ) )->init();

Expand All @@ -564,6 +574,7 @@ public static function init() {
self::$compatibility_service->init_hooks();
self::$customer_service->init_hooks();
self::$token_service->init_hooks();
self::$fee_remediation->init();

/**
* FLAG: PAYMENT_METHODS_LIST
Expand Down Expand Up @@ -1509,6 +1520,43 @@ public static function update_plugin_version() {
update_option( 'woocommerce_woocommerce_payments_version', WCPAY_VERSION_NUMBER );
}

/**
* Handle plugin updates.
*
* @param WP_Upgrader $upgrader WP_Upgrader instance.
* @param array $options Array of update data.
* @return void
*/
public static function on_plugin_update( $upgrader, $options ) {
if ( 'update' !== $options['action'] || 'plugin' !== $options['type'] ) {
return;
}

// Check if WooPayments was updated.
$plugins = isset( $options['plugins'] ) ? $options['plugins'] : [];
if ( ! in_array( plugin_basename( WCPAY_PLUGIN_FILE ), $plugins, true ) ) {
return;
}

// Ensure get_plugin_data() is available.
if ( ! function_exists( 'get_plugin_data' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}

// Get new version.
$plugin_data = get_plugin_data( WCPAY_PLUGIN_FILE );
$new_version = $plugin_data['Version'];

// Initialize fee_remediation if not already set.
if ( ! isset( self::$fee_remediation ) ) {
include_once __DIR__ . '/migrations/class-wc-payments-remediate-canceled-auth-fees.php';
self::$fee_remediation = new WC_Payments_Remediate_Canceled_Auth_Fees();
}

// Trigger version gate check.
self::$fee_remediation->maybe_schedule_remediation( $new_version );
}

/**
* Sets the plugin activation timestamp.
*
Expand Down
Loading
Loading