Open
Description
Description
This issue is regarding the existing catch
block of WC_Payment_Gateway_WCPay::process_payment()
:
woocommerce-payments/includes/class-wc-payment-gateway-wcpay.php
Lines 966 to 1060 in a19f2b0
Presently, there are various checks like ! empty( $payment_information )
, which can never be empty, and they force multiple nested IFs. In addition, early returns (or re-throws in this case) with WC_Payments_Utils::get_filtered_error_message()
could flatten the code further.
Acceptance criteria
- The catch block is carefully inspected, understood, and refactored.
- The block is simple to understand, even if it remains a bit lengthy.
- The PR that fixes this issue should not be merged before RPP / Failures / Catch exceptions and generate erroneous states #7425 is addressed.
- The
rate_limiter_enabled
Process_Payment_Exception
will be handled elsewhere and should not have specific handling here. Context: RPP: Handle failed transaction rate limiter #7672 (comment)
Testing instructions
There should be testing instructions to cover every exception.
Additional context
Epic: #6673
Project: paJDYF-9hL-p2
Metadata
Metadata
Assignees
Labels
WC Payments core related issues, where it’s obvious.For product engineering, architecture work, tech debt and so on.For any issues which are part of any project, including bugs, enhancements, etc.Issues related to CheckoutThe issue is blocked from progressing, waiting for another piece of work to be done.The issue has a PR.The issue is currently not prioritized.