Skip to content
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

Partner Aware Onboarding - Customizations for Square #1426

Merged
merged 34 commits into from
Feb 1, 2024

Conversation

moon0326
Copy link
Contributor

@moon0326 moon0326 commented Jan 12, 2024

Changes proposed in this Pull Request:

Closes #1422

This PR removes Woo Payments from the following REST API endpoints when woocommerce_onboarding_profile.partner is square

  • /wp-json/wc-admin/payment-gateway-suggestions
  • /wp-json/wc-admin/onboarding/free-extensions

It also adds Get paid with Square task.

Screen Shot 2024-01-31 at 1 58 05 PM

How to test the changes in this Pull Request:

Feed Removal

  1. Checkout this branch.
  2. Make sure you're in trial plan.
  3. Use wp cli to update woocommerce_onboarding_profile option value with a:10:{s:15:"business_choice";s:28:"im_just_starting_my_business";s:21:"selling_online_answer";N;s:17:"selling_platforms";N;s:20:"is_store_country_set";b:1;s:8:"industry";a:1:{i:0;N;}s:18:"is_agree_marketing";b:0;s:11:"store_email";s:17:"test@gmail.com";s:9:"completed";b:1;s:23:"is_plugins_page_skipped";b:1;s:7:"partner";s:6:"square";} It includes partner=square
  4. Open your browser's inspector and click Network tab.
  5. Start the core profiler.
  6. On the Tell us a bit about your store page, click Continue button.
  7. Inspect a request to /wp-json/wc-admin/onboarding/free-extensions
  8. Confirm obw/core-profiler.plugins does not have woocommerce-payments
  9. Go to WooCommerce -> Settings -> Payments
  10. Inspect a request to /wp-json/wc-admin/payment-gateway-suggestions
  11. Confirm the response doesn't have woocommerce_payment and woocommerce_payments:with-in-person-payments

Get paid with Square task

  1. Install WooCommerce Square plugin (this will be installed automatically once we deploy WPCOM changes).
  2. Go to WooCommerce -> Home
  3. Confirm Get paid with Square task is the first task.
  4. Click on it.
  5. You should be redirected to Square connect wizard.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?

FOR PR REVIEWER ONLY:

  • I have reviewed that everything is sanitized/escaped appropriately for any SQL or XSS injection possibilities. I made sure Linting is not ignored or disabled.

@moon0326 moon0326 marked this pull request as draft January 12, 2024 00:42
Copy link

github-actions bot commented Jan 12, 2024

Size Change: +197 B (0%)

Total Size: 197 kB

Filename Size Change
./build/index.js 122 kB +197 B (0%)
ℹ️ View Unchanged
Filename Size
./build/53.js 1.05 kB
./build/index.css 883 B
./build/marketing.js 58 kB
./build/payment-gateway-suggestions.css 1.25 kB
./build/payment-gateway-suggestions.js 6.46 kB
./build/plugins.js 3.92 kB
./build/style-index.css 2.15 kB
./build/style-marketing.css 805 B

compressed-size-action

@moon0326 moon0326 marked this pull request as ready for review January 30, 2024 21:29
@moon0326 moon0326 marked this pull request as draft January 30, 2024 23:11
@moon0326 moon0326 changed the title Disable Woo Payments promotions for partner sites Partner Aware Onboarding - Customization for Square Jan 30, 2024
@moon0326 moon0326 changed the title Partner Aware Onboarding - Customization for Square Partner Aware Onboarding - Customizations for Square Jan 30, 2024
@moon0326 moon0326 requested review from a team, adrianduffell and rjchow January 30, 2024 23:56
@moon0326 moon0326 marked this pull request as ready for review January 30, 2024 23:56
Copy link
Contributor

@ilyasfoo ilyasfoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested well! I have some comments:

Inspect a request to /wp-json/wc-admin/payment-gateway-suggestions
Confirm the response doesn't have woocommerce_payment and woocommerce_payments:with-in-person-payments

I get an empty array with this request. Is this expected? For context, the request URL was /wp-json/wc-admin/payment-gateway-suggestions?_locale=user, missing force_default_suggestion=true when comparing to the query in payments task.

It seems the task does not have a header.

cc @verofasulo would you be able to suggest a task header design to use for Get paid with Square? Perhaps reusing the payments header? I think we'll also need the copy specific for Square.

image

class-wc-calypso-bridge-shared.php Show resolved Hide resolved
*
* @return void
*/
private function remove_woo_payments_from_core_profiler_plugin_suggestions() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this is really needed since Core profiler is technically not in the flow for hosted Woo in WPCOM, but doesn't hurt to have it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point 👍 Let's remove it.

src/index.js Outdated
// Setup Square task fill (Partner Aware Onboarding).
registerPlugin( 'wc-calypso-bridge-task-setup-woocommerce-square', {
scope: 'woocommerce-tasks',
render: SetupWooCommerceSquareFill,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since Square is optional (and probably is a very small subset of hosted Woo), I think it'll be beneficial to make this a lazy loaded fill. What if we check for square_connect_url to render it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea! I'll make the change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in 5f86d28

@verofasulo
Copy link

Hey @ilyasfoo, thanks for tagging me!

would you be able to suggest a task header design to use for Get paid with Square? Perhaps reusing the payments header? I think we'll also need the copy specific for Square.

Please reuse the header we use for generic payment methods (the one in place when we don't have WooPayments by default):

image

  • Keep it as the third task (not first).
  • Replace "Get paid" with "Get paid with Square" as @lauroraa suggested.
  • Regarding the header description, we can wait for Square to provide a copy.

moon0326 and others added 2 commits January 31, 2024 08:50
…quare.php

Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>
…quare.php

Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>
@moon0326
Copy link
Contributor Author

Hey @ilyasfoo, thanks for tagging me!

would you be able to suggest a task header design to use for Get paid with Square? Perhaps reusing the payments header? I think we'll also need the copy specific for Square.

Please reuse the header we use for generic payment methods (the one in place when we don't have WooPayments by default):

  • Keep it as the third task (not first).
  • Replace "Get paid" with "Get paid with Square" as @lauroraa suggested.
  • Regarding the header description, we can wait for Square to provide a copy.

Thank you @verofasulo @ilyasfoo

The task is now placed at the 3rd position with cf2a894 commit.

I've also added the task header with 9f95778
Screen Shot 2024-01-31 at 1 58 05 PM

@moon0326
Copy link
Contributor Author

moon0326 commented Jan 31, 2024

I get an empty array with this request. Is this expected? For context, the request URL was /wp-json/wc-admin/payment-gateway-suggestions?_locale=user, missing force_default_suggestion=true when comparing to the query in payments task.

@ilyasfoo I've tested it with a fresh site and wasn't able to reproduce it. Could you please provide a screenshot of the request and response?

@ilyasfoo
Copy link
Contributor

ilyasfoo commented Feb 1, 2024

I've tested it with a fresh site and wasn't able to reproduce it. Could you please provide a screenshot of the request and response?

@moon0326 Here's the request and response

image image

Copy link
Contributor

@ilyasfoo ilyasfoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested well, but I have a few nitpicky comments:

class-wc-calypso-bridge-shared.php Outdated Show resolved Hide resolved
src/index.js Show resolved Hide resolved
moon0326 and others added 4 commits January 31, 2024 20:45
…quare.php

Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>
…quare.php

Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>
…quare.php

Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>
Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>
@moon0326
Copy link
Contributor Author

moon0326 commented Feb 1, 2024

Tested well, but I have a few nitpicky comments:

Thank you for the commits 🙇

@ilyasfoo ilyasfoo self-requested a review February 1, 2024 05:34
Copy link
Contributor

@ilyasfoo ilyasfoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @moon0326 ! Would you like to see if the response (#1426 (comment)) is expected? Otherwise, I think this is good to merge. Pre-approving

Also, just noting that we have a follow-up before launching this:

Regarding the header description, we can wait for Square to provide a copy.

@moon0326
Copy link
Contributor Author

moon0326 commented Feb 1, 2024

Thanks, @moon0326 ! Would you like to see if the response (#1426 (comment)) is expected? Otherwise, I think this is good to merge. Pre-approving

Also, just noting that we have a follow-up before launching this:

Regarding the header description, we can wait for Square to provide a copy.

Thank you! I'll try to reproduce it again.

Regarding the header description, we can wait for Square to provide a copy.

I think we can request it and update it in a follow-up PR. I want everyone to start testing it easily on production soon.

@moon0326
Copy link
Contributor Author

moon0326 commented Feb 1, 2024

Thanks, @moon0326 ! Would you like to see if the response (#1426 (comment)) is expected? Otherwise, I think this is good to merge. Pre-approving

Also, just noting that we have a follow-up before launching this:

Regarding the header description, we can wait for Square to provide a copy.

I've tested it with a fresh site and wasn't able to reproduce it. Could you please provide a screenshot of the request and response?

@moon0326 Here's the request and response

image image

Thank you!

Could you check the following options?

The endpoint returns an empty array when woocommerce_show_marketplace_suggestions is set to no
OR
woocommerce_setting_payments_recommendations_hidden is set to yes

@ilyasfoo
Copy link
Contributor

ilyasfoo commented Feb 1, 2024

The endpoint returns an empty array when woocommerce_show_marketplace_suggestions is set to no

@moon0326 That's it, I had this set to no. Now it's testing well, thanks!

@moon0326 moon0326 merged commit dc6a6c1 into master Feb 1, 2024
5 checks passed
moon0326 added a commit that referenced this pull request Feb 1, 2024
moon0326 added a commit that referenced this pull request Feb 2, 2024
@epeicher epeicher mentioned this pull request Jul 18, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Partner Aware Onboarding] Disable Woo Payments promotions
3 participants