woocommerce / woocommerce-square

Square POS and Payments Integration
https://woo.com/products/square
Other
11 stars 7 forks source link

Fatal error while Changing subscription Payment Method #150

Closed qasumitbagthariya closed 5 months ago

qasumitbagthariya commented 5 months ago

Describe the bug

Unable to change payment method on the Subscription page. When attempting to update the payment method

To reproduce

  1. Goto may account > Subscription
  2. Select any subscription and change payment method
  3. Make sure to check mark "Use this payment method for all of my current subscriptions"

Screenshots image

[09-Jun-2024 18:49:41 UTC] PHP Fatal error:  Uncaught Error: Call to a member function payment_method_supports() on false in /Users/sumitbagthariya/Local Sites/square/app/public/wp-content/plugins/woocommerce-subscriptions/vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php:423
Stack trace:
#0 /Users/sumitbagthariya/Local Sites/square/app/public/wp-content/plugins/woocommerce-subscriptions/vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php(373): WC_Subscriptions_Change_Payment_Gateway::update_all_payment_methods_from_subscription(Object(WC_Subscription), 'square_credit_c...')
#1 /Users/sumitbagthariya/Local Sites/square/app/public/wp-includes/class-wp-hook.php(324): WC_Subscriptions_Change_Payment_Gateway::change_payment_method_via_pay_shortcode('')
#2 /Users/sumitbagthariya/Local Sites/square/app/public/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#3 /Users/sumitbagthariya/Local Sites/square/app/public/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#4 /Users/sumitbagthariya/Local Sites/square/app/public/wp-settings.php(717): do_action('wp_loaded')
#5 /Users/sumitbagthariya/Local Sites/square/app/public/wp-config.php(114): require_once('/Users/sumitbag...')
#6 /Users/sumitbagthariya/Local Sites/square/app/public/wp-load.php(50): require_once('/Users/sumitbag...')
#7 /Users/sumitbagthariya/Local Sites/square/app/public/wp-blog-header.php(13): require_once('/Users/sumitbag...')
#8 /Users/sumitbagthariya/Local Sites/square/app/public/index.php(17): require('/Users/sumitbag...')
#9 {main}
  thrown in /Users/sumitbagthariya/Local Sites/square/app/public/wp-content/plugins/woocommerce-subscriptions/vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php on line 423

Expected behavior

Allow users to seamlessly update their payment method without encountering any errors.

Environment (please complete the following information):

Additional details

System status ``` ```
qasumitbagthariya commented 5 months ago

I've tried reproducing the issue with a fresh setup (instawp) but couldn't encounter it. Based on our internal discussions with @Sidsector9 @iamdharmesh, it seems the problem occurred due to local setup issues. Therefore, we need to close this issue. Additionally, share a video as proof.

https://github.com/woocommerce/woocommerce-square/assets/67687255/700717ba-8630-40c3-8459-69613686be09

Testing Environment

- WordPress: 6.5.4 - WooCommerce Subscription - 6.4.0 - Theme: Twenty Twenty-Four 1.1 - WooCommerce - 9.0.0 - PHP: 8.0.30 - Web Server: Nginx 1.20.2 - Browser: Chrome - OS: macOS Ventura 13.3 - Git Branch: trunk

cc @jeffpaul @dkotter