woocommerce / woocommerce-gateway-stripe

The official Stripe Payment Gateway for WooCommerce
https://wordpress.org/plugins/woocommerce-gateway-stripe/
228 stars 201 forks source link

Redundancy in WC_Stripe_Webhook_Handler::process_webhook_refund() #2722

Open danielvonmitschke opened 11 months ago

danielvonmitschke commented 11 months ago

There seems to be a redundancy in the WC_Stripe_Webhook_Handler::process_webhook_refund() method. At first we try to find the corresponding order via the refund id and then in line 590 we check if the web hook refund id equals the order refund id and abort (to prevent double refunds). But we could not have found the order via refund id in the first place if the refund id is not equal. So from my perspective we could omit WC_Stripe_Helper::get_order_by_refund_id() all together and only load the order via charge id as done a few lines later. The comparison of the web hook refund id to the order refund id in line 590 will take care of double refunds anyway.

github-actions[bot] commented 3 days ago

Hi, This issue has gone 150 days (5 months) without any activity. This means it is time for a check-in to make sure it is still relevant. If you are still experiencing this issue with the latest version, you can help the project by responding to confirm the problem and by providing any updated reproduction steps. Thanks for helping out.