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

Implement ECE for payment processing on block checkout page #3439

Open
wants to merge 27 commits into
base: develop
Choose a base branch
from

Conversation

Mayisha
Copy link
Contributor

@Mayisha Mayisha commented Sep 16, 2024

Fixes #3403

Changes proposed in this Pull Request:

  • Created hooks, event-handlers and utils functions for ECE in blocks.
  • The changes are made following the functions for payment-request and WooPayments.

Testing instructions

  • Enable the ECE feature flag (return true from is_stripe_ece_enabled function or in your database add an option _wcstripe_feature_ece and set yes as the value).
  • As a shopper add a product to your cart and go to the Block checkout page.
  • Confirm that the Google Pay and Apple Pay buttons are loaded.
  • Confirm that you can successfully place an order with Google Pay and Apple Pay.
  • Disable the feature flag and confirm that PRBs are still working without any regression.

@Mayisha Mayisha requested a review from wjrosa September 16, 2024 20:52
@Mayisha
Copy link
Contributor Author

Mayisha commented Sep 16, 2024

@wjrosa I have requested your review as you are also working on ECE issues. Feel free to unassign yourself if you are too occupied 🍫

@annemirasol
Copy link
Contributor

✨ Great work ✨ I can see Google Pay in my initial testing.

  1. Is it expected that an unavailable component still takes up space? In my case, Apple Pay is not available (ie Chrome browser) but the container is still rendered.

Empty Apple Pay container taking up space:
Screenshot 2024-09-17 at 2 01 08 PM

  1. When is_stripe_ece_enabled returns false, I get an empty Express Checkout box. I expected the old Google Pay PRB (or for the entire Express Checkout box to not show at all).

Empty box when Stripe ECE is not enabled:
Screenshot 2024-09-17 at 2 04 25 PM

What I see on develop:
Screenshot 2024-09-17 at 2 06 54 PM

@Mayisha
Copy link
Contributor Author

Mayisha commented Sep 18, 2024

Thanks, @annemirasol for checking this.

Empty Apple Pay container taking up space

I will create a separate issue to handle this scenario. 👀

Empty box when Stripe ECE is not enabled:

After disabling the feature flag, try running npm start again and see if the PRB button loads. Probably the PRB script is not loaded and that's causing the issue. 🤔

@annemirasol
Copy link
Contributor

After disabling the feature flag, try running npm start again and see if the PRB button loads. Probably the PRB script is not loaded and that's causing the issue. 🤔

I'm still getting an empty checkbox after running npm start and doing a full reload. I see errors in the console:

Screenshot 2024-09-18 at 9 34 40 AM

(The hooks.js line with error)
Screenshot 2024-09-18 at 9 35 09 AM

(For comparison, this is my browser console on develop.)
Screenshot 2024-09-18 at 9 31 40 AM

@@ -174,6 +183,7 @@ public function get_payment_method_data() {
return array_replace_recursive(
$this->get_gateway_javascript_params(),
$this->get_payment_request_javascript_params(),
$this->get_express_checkout_javascript_params(),
Copy link
Contributor

Choose a reason for hiding this comment

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

@Mayisha Had some time to closely look at the empty box/403 forbidden problem I reported earlier, and it looks like it's from this line ^ that's not checking whether ECE is enabled or not before replacing JS (nonce) params

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @annemirasol for the findings 😃

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.

[ECE] Implement ECE for payment processing on block checkout page
3 participants