-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Display alert on WP Admin if Jetpack is not connected #391
Conversation
Stop WCPayments plugin initialization when Jetpack is not connected. When new instance of WC_Payments_Account class is created as part of the WCPayments plugin initialization, an HTTP request is sent with Jetpack Client which leads to the fatal error when Jetpack is not connected. This is why we have to check if Jetpack is connected before creating an instance of WC_Payments_Account class.
This is raw and early implementation. See TODOs in changes for more details. |
Will this PR (eventually) also fix #332 ? |
Yes, It should IMO. |
Add Jetpack to plugin dependencies to stop WCPayments plugin initialization when Jetpack is not installed or deactivated. Allert message is displayed in wp-admin when Jetpack is not activated.
Updated as per design in #195
Move all Jetpack Client related code to the existing class WC_Payments_Http to keep it in the same place. Move all Jetpack Client related code to the existing class WC_Payments_Http
Replaced check_for_jetpack_layer introduced in #394.
@vbelolapotkov looking good! Thanks! I noticed when installing jetpack, the notification is still present, I don't think it's necessary to show it at this point Lastly, When jetpack is simply not set up, please just remove the "Don't worry, this is a temporary thing." Sentence. |
@LevinMedia thanks for the feedback!
Removed all alerts when pluign installation is in progres. 4a4bd98.
Fixed with 02c12c8. |
I was a little surprised that, with WooCommerce Payments installed and activated, if I then disconnected my Jetpack, the only place I see that WooCommerce Payments is effectively disabled is on the wp-admin Plugins page. I expected to see this notice basically throughout wp-admin - not just on the Plugins page What do you think @LevinMedia ? |
@allendav I think it's okay just there for now. How about we look at adding it elsewhere If we get an influx of people de-activating jetpack and are confused as to why their payments aren't working? |
@allendav can you reproduce it? @LevinMedia are you experiencing the same? Asking because it works fine on my end. The only pages where it's hidden are Jetpack setup page and plugin installation in progress. Here are the screenshots from wp-admin dashboard and posts. I don't see it on the WooCommerce Admin pages though, so it looks like WooCommerce Admin ignores general wp-admin notices. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works well for me. Left one comment.
@@ -139,23 +139,13 @@ public static function check_plugin_dependencies( $silent ) { | |||
return true; | |||
} | |||
|
|||
// TODO - Remove/update when Jetpack Connection package is all we need. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have we moved this todo to an issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't found any specific issue on that topic but I guess it should be part of #111 epic. Would you prefer creating a particular issue for this and adding TODO comment to the wc-payments-http
class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That will work well, as long as we don't forget about this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added TODO with f4639fa
Fixes #339 #249 #195
Relates to #196
Resolved conflicts with #394 should not affect #332 🙂
Changes proposed in this Pull Request
Testing instructions
For fresh WooCommerce site without WCPayments configured start at step 3.
Go to Admin > Plugins > Installed plugins and deactivate Jetpack.
Alert should appear at the top.
Install Jetpack if removed at step 2 or it does not exist after step 2.
Activate Jetpack but do not set up at the moment. If Jetpack setup page is displayed, go to Dashboard.
Go to Jetpack setup page, connect it and get back to the admin dashboard.
At this step tunnelled Http connection is required (details are here in section 2.3.1.1.).
Go to Payments > Settings: