Skip to content
This repository was archived by the owner on Feb 23, 2024. It is now read-only.

Conversation

@hsingyuc
Copy link
Contributor

Create a PayForOrder service class to implement authentication checks for the pay-for-order checkout block.

Fixes #9400

Screenshots

Before log-in After log-in
Customer Screen Shot 2023-07-25 at 9 57 16 PM Screen Shot 2023-05-08 at 10 27 33 PM
Before verify After verify
Guest guest Screen Shot 2023-05-08 at 10 27 33 PM

Testing

  1. Create a pay-for-order order as a guest
  2. Go to WC -> Orders -> find the order you just created
  3. Click on the Customer payment page and copy the URL to incognito
  4. See asking to verify the email address
  5. Use the billing email in the order you just created
  6. See billing_email added in to the URL and empty cart
  7. Go back to the order you just created
  8. Change Customer to an existing customer
  9. Go back to the Your cart is currently empty! page and refresh
  10. See the login form
  11. Log in as user and see empty cart

Automated Tests

  • Changes in this PR are covered by Automated Tests.
    • Unit tests
    • E2E tests

Changelog

Create a PayForOrder service class to implement authentication checks

@hsingyuc hsingyuc requested a review from mikejolley July 26, 2023 05:16
@github-actions
Copy link
Contributor

github-actions bot commented Jul 26, 2023

The release ZIP for this PR is accessible via:

https://wcblocks.wpcomstaging.com/wp-content/uploads/woocommerce-gutenberg-products-block-10348.zip

Script Dependencies Report

The compare-assets action has detected some changed script dependencies between this branch and trunk. Please review and confirm the following are correct before merging.

Script Handle Added Removed
reviews-frontend.js wc-settings, wp-a11y, wp-api-fetch, wp-compose, wp-element, wp-i18n, wp-is-shallow-equal, wp-polyfill ⚠️
active-filters-frontend.js wc-blocks-data-store, wc-price-format, wc-settings, wp-data, wp-element, wp-html-entities, wp-i18n, wp-is-shallow-equal, wp-polyfill, wp-primitives, wp-url ⚠️
all-products-frontend.js lodash, react, wc-blocks-checkout, wc-blocks-data-store, wc-blocks-registry, wc-blocks-shared-context, wc-blocks-shared-hocs, wc-price-format, wc-settings, wp-a11y, wp-api-fetch, wp-autop, wp-blocks, wp-components, wp-compose, wp-data, wp-deprecated, wp-dom, wp-element, wp-hooks, wp-html-entities, wp-i18n, wp-is-shallow-equal, wp-polyfill, wp-primitives, wp-style-engine, wp-url, wp-warning, wp-wordcount ⚠️
attribute-filter-frontend.js lodash, react, wc-blocks-checkout, wc-blocks-data-store, wc-settings, wp-a11y, wp-compose, wp-data, wp-deprecated, wp-dom, wp-element, wp-html-entities, wp-i18n, wp-is-shallow-equal, wp-keycodes, wp-polyfill, wp-primitives, wp-url, wp-warning ⚠️
cart-frontend.js lodash, react, wc-blocks-checkout, wc-blocks-data-store, wc-blocks-registry, wc-blocks-shared-context, wc-blocks-shared-hocs, wc-price-format, wc-settings, wp-a11y, wp-api-fetch, wp-autop, wp-blocks, wp-compose, wp-data, wp-deprecated, wp-dom, wp-element, wp-hooks, wp-html-entities, wp-i18n, wp-is-shallow-equal, wp-keycodes, wp-plugins, wp-polyfill, wp-primitives, wp-style-engine, wp-url, wp-warning, wp-wordcount ⚠️
checkout-frontend.js lodash, react, wc-blocks-checkout, wc-blocks-data-store, wc-blocks-registry, wc-blocks-shared-hocs, wc-price-format, wc-settings, wp-a11y, wp-api-fetch, wp-autop, wp-compose, wp-data, wp-deprecated, wp-dom, wp-element, wp-hooks, wp-html-entities, wp-i18n, wp-is-shallow-equal, wp-keycodes, wp-plugins, wp-polyfill, wp-primitives, wp-url, wp-warning, wp-wordcount ⚠️
filter-wrapper-frontend.js lodash, react, wc-blocks-checkout, wc-blocks-data-store, wc-blocks-registry, wc-price-format, wc-settings, wp-a11y, wp-compose, wp-data, wp-deprecated, wp-dom, wp-element, wp-html-entities, wp-i18n, wp-is-shallow-equal, wp-keycodes, wp-polyfill, wp-primitives, wp-style-engine, wp-url, wp-warning ⚠️
mini-cart-frontend.js wc-price-format, wc-settings, wp-i18n, wp-polyfill ⚠️
price-filter-frontend.js react, wc-blocks-data-store, wc-price-format, wc-settings, wp-data, wp-element, wp-i18n, wp-is-shallow-equal, wp-polyfill, wp-url ⚠️
rating-filter-frontend.js lodash, react, wc-blocks-checkout, wc-blocks-data-store, wc-settings, wp-a11y, wp-compose, wp-data, wp-deprecated, wp-dom, wp-element, wp-i18n, wp-is-shallow-equal, wp-keycodes, wp-polyfill, wp-primitives, wp-url, wp-warning ⚠️
stock-filter-frontend.js lodash, react, wc-blocks-checkout, wc-blocks-data-store, wc-settings, wp-a11y, wp-compose, wp-data, wp-deprecated, wp-dom, wp-element, wp-html-entities, wp-i18n, wp-is-shallow-equal, wp-keycodes, wp-polyfill, wp-primitives, wp-url, wp-warning ⚠️
mini-cart-component-frontend.js lodash, react, wc-blocks-checkout, wc-blocks-data-store, wc-blocks-registry, wc-price-format, wc-settings, wp-a11y, wp-autop, wp-compose, wp-data, wp-deprecated, wp-dom, wp-element, wp-hooks, wp-html-entities, wp-i18n, wp-is-shallow-equal, wp-keycodes, wp-polyfill, wp-primitives, wp-style-engine, wp-url, wp-warning, wp-wordcount ⚠️

This comment was automatically generated by the ./github/compare-assets action.

TypeScript Errors Report

  • Files with errors: 470
  • Total errors: 2246

🎉 🎉 This PR does not introduce new TS errors.

comments-aggregator

@github-actions
Copy link
Contributor

github-actions bot commented Jul 26, 2023

Size Change: -18.2 kB (-1%)

Total Size: 1.34 MB

Filename Size Change
build/active-filters-frontend.js 8.52 kB -184 B (-2%)
build/active-filters-rtl.css 1.99 kB -32 B (-2%)
build/active-filters-wrapper--mini-cart-contents-block/cart-button--mini-cart-contents-block/checkout-but--e791dc6c-style.js 926 B -31 B (-3%)
build/active-filters-wrapper-frontend.js 7.54 kB -103 B (-1%)
build/active-filters-wrapper-rtl.css 1.85 kB -31 B (-2%)
build/active-filters-wrapper.css 1.85 kB -32 B (-2%)
build/active-filters.css 1.99 kB -33 B (-2%)
build/active-filters.js 7.46 kB -132 B (-2%)
build/add-to-cart-form-rtl.css 355 B -25 B (-7%)
build/add-to-cart-form.css 354 B -24 B (-6%)
build/all-products-frontend.js 9.89 kB -183 B (-2%)
build/all-products-rtl.css 4.19 kB -47 B (-1%)
build/all-products.css 4.19 kB -46 B (-1%)
build/all-products.js 41.1 kB -681 B (-2%)
build/all-reviews-rtl.css 1.79 kB -58 B (-3%)
build/all-reviews.css 1.79 kB -57 B (-3%)
build/all-reviews.js 7.75 kB -120 B (-2%)
build/attribute-filter-frontend.js 22.8 kB -131 B (-1%)
build/attribute-filter-rtl.css 4.14 kB -53 B (-1%)
build/attribute-filter-wrapper-frontend.js 7.56 kB -133 B (-2%)
build/attribute-filter-wrapper-rtl.css 4.01 kB -51 B (-1%)
build/attribute-filter-wrapper.css 4.01 kB -51 B (-1%)
build/attribute-filter.css 4.14 kB -51 B (-1%)
build/attribute-filter.js 13 kB -257 B (-2%)
build/blocks-checkout.js 35 kB -162 B (0%)
build/breadcrumbs-rtl.css 232 B -21 B (-8%)
build/breadcrumbs.css 232 B -21 B (-8%)
build/breadcrumbs.js 2.15 kB +6 B (0%)
build/cart-blocks/cart-accepted-payment-methods-frontend.js 1.33 kB -51 B (-4%)
build/cart-blocks/cart-cross-sells-frontend.js 249 B -4 B (-2%)
build/cart-blocks/cart-cross-sells-products--product-price-frontend.js 2.88 kB -32 B (-1%)
build/cart-blocks/cart-cross-sells-products-frontend.js 3.69 kB -141 B (-4%)
build/cart-blocks/cart-cross-sells-products-style.js 138 B +1 B (+1%)
build/cart-blocks/cart-cross-sells-style.js 250 B -3 B (-1%)
build/cart-blocks/cart-express-payment--checkout-blocks/express-payment-frontend.js 5.09 kB -73 B (-1%)
build/cart-blocks/cart-express-payment-frontend.js 711 B -8 B (-1%)
build/cart-blocks/cart-express-payment-style.js 137 B +1 B (+1%)
build/cart-blocks/cart-items-frontend.js 283 B -18 B (-6%)
build/cart-blocks/cart-items-style.js 219 B -10 B (-4%)
build/cart-blocks/cart-line-items--mini-cart-contents-block/products-table-frontend.js 5.33 kB -146 B (-3%)
build/cart-blocks/cart-line-items-frontend.js 1.06 kB -4 B (0%)
build/cart-blocks/cart-line-items-style.js 136 B -1 B (-1%)
build/cart-blocks/cart-order-summary-frontend.js 1.24 kB -37 B (-3%)
build/cart-blocks/cart-order-summary-style.js 318 B -4 B (-1%)
build/cart-blocks/cart-totals-frontend.js 287 B -20 B (-7%)
build/cart-blocks/cart-totals-style.js 228 B -10 B (-4%)
build/cart-blocks/empty-cart-frontend.js 342 B -5 B (-1%)
build/cart-blocks/empty-cart-style.js 335 B -4 B (-1%)
build/cart-blocks/filled-cart-frontend.js 651 B -4 B (-1%)
build/cart-blocks/filled-cart-style.js 310 B -3 B (-1%)
build/cart-blocks/order-summary-coupon-form-frontend.js 1.56 kB -66 B (-4%)
build/cart-blocks/order-summary-coupon-form-style.js 136 B -1 B (-1%)
build/cart-blocks/order-summary-discount-frontend.js 2.04 kB -81 B (-4%)
build/cart-blocks/order-summary-fee-frontend.js 270 B -2 B (-1%)
build/cart-blocks/order-summary-heading-frontend.js 324 B -9 B (-3%)
build/cart-blocks/order-summary-heading-style.js 325 B -10 B (-3%)
build/cart-blocks/order-summary-shipping-frontend.js 17 kB -69 B (0%)
build/cart-blocks/order-summary-subtotal-frontend.js 271 B -2 B (-1%)
build/cart-blocks/order-summary-subtotal-style.js 137 B +1 B (+1%)
build/cart-blocks/order-summary-taxes-frontend.js 433 B -1 B (0%)
build/cart-blocks/order-summary-taxes-style.js 176 B -1 B (-1%)
build/cart-blocks/proceed-to-checkout-frontend.js 1.41 kB -21 B (-1%)
build/cart-blocks/proceed-to-checkout-style.js 1.09 kB -6 B (-1%)
build/cart-frontend.js 29.6 kB -272 B (-1%)
build/cart-rtl.css 9.48 kB -116 B (-1%)
build/cart.css 9.46 kB -118 B (-1%)
build/cart.js 44.6 kB -667 B (-1%)
build/catalog-sorting-rtl.css 256 B -21 B (-8%)
build/catalog-sorting.css 256 B -20 B (-7%)
build/catalog-sorting.js 1.71 kB +2 B (0%)
build/checkout-blocks/actions-frontend.js 1.8 kB -84 B (-4%)
build/checkout-blocks/actions-style.js 683 B -2 B (0%)
build/checkout-blocks/billing-address--checkout-blocks/shipping-address-frontend.js 4.64 kB -52 B (-1%)
build/checkout-blocks/billing-address-frontend.js 1.17 kB -7 B (-1%)
build/checkout-blocks/billing-address-style.js 531 B -1 B (0%)
build/checkout-blocks/contact-information-frontend.js 2.01 kB -30 B (-1%)
build/checkout-blocks/contact-information-style.js 605 B -3 B (0%)
build/checkout-blocks/express-payment-frontend.js 1.11 kB -25 B (-2%)
build/checkout-blocks/fields-frontend.js 300 B -18 B (-6%)
build/checkout-blocks/fields-style.js 249 B -11 B (-4%)
build/checkout-blocks/order-note-frontend.js 1.09 kB -32 B (-3%)
build/checkout-blocks/order-summary-cart-items-frontend.js 3.62 kB -131 B (-3%)
build/checkout-blocks/order-summary-cart-items-style.js 137 B +1 B (+1%)
build/checkout-blocks/order-summary-coupon-form-frontend.js 1.71 kB -80 B (-4%)
build/checkout-blocks/order-summary-coupon-form-style.js 136 B -1 B (-1%)
build/checkout-blocks/order-summary-discount-frontend.js 2.21 kB -86 B (-4%)
build/checkout-blocks/order-summary-fee-frontend.js 273 B -2 B (-1%)
build/checkout-blocks/order-summary-frontend.js 1.24 kB -39 B (-3%)
build/checkout-blocks/order-summary-shipping-frontend.js 16.9 kB -76 B (0%)
build/checkout-blocks/order-summary-style.js 318 B -2 B (-1%)
build/checkout-blocks/order-summary-subtotal-frontend.js 271 B -2 B (-1%)
build/checkout-blocks/order-summary-taxes-frontend.js 433 B -2 B (0%)
build/checkout-blocks/order-summary-taxes-style.js 176 B -1 B (-1%)
build/checkout-blocks/payment-frontend.js 9.2 kB -83 B (-1%)
build/checkout-blocks/payment-style.js 460 B -1 B (0%)
build/checkout-blocks/pickup-options-frontend.js 4.81 kB -30 B (-1%)
build/checkout-blocks/pickup-options-style.js 440 B -3 B (-1%)
build/checkout-blocks/shipping-address-frontend.js 1.17 kB -9 B (-1%)
build/checkout-blocks/shipping-address-style.js 476 B +1 B (0%)
build/checkout-blocks/shipping-method-frontend.js 2.57 kB -54 B (-2%)
build/checkout-blocks/shipping-method-style.js 1.34 kB -25 B (-2%)
build/checkout-blocks/shipping-methods-frontend.js 6.36 kB -50 B (-1%)
build/checkout-blocks/shipping-methods-style.js 416 B -1 B (0%)
build/checkout-blocks/terms-frontend.js 1.51 kB -46 B (-3%)
build/checkout-blocks/terms-style.js 671 B -6 B (-1%)
build/checkout-blocks/totals-frontend.js 330 B -17 B (-5%)
build/checkout-blocks/totals-style.js 275 B -10 B (-4%)
build/checkout-frontend.js 31.5 kB -298 B (-1%)
build/checkout-rtl.css 9.14 kB -77 B (-1%)
build/checkout.css 9.13 kB -77 B (-1%)
build/checkout.js 47.2 kB -584 B (-1%)
build/customer-account-rtl.css 388 B -18 B (-4%)
build/customer-account.css 387 B -19 B (-5%)
build/customer-account.js 3.17 kB -15 B (0%)
build/featured-category-rtl.css 971 B -15 B (-2%)
build/featured-category.css 970 B -17 B (-2%)
build/featured-category.js 14.7 kB -441 B (-3%)
build/featured-product-rtl.css 1.02 kB -15 B (-1%)
build/featured-product.css 1.02 kB -16 B (-2%)
build/featured-product.js 14.9 kB -353 B (-2%)
build/filter-wrapper-frontend.js 14.2 kB -101 B (-1%)
build/filter-wrapper-rtl.css 375 B -24 B (-6%)
build/filter-wrapper.css 375 B -22 B (-6%)
build/filter-wrapper.js 2.38 kB -15 B (-1%)
build/handpicked-products.js 7.95 kB -163 B (-2%)
build/legacy-template-rtl.css 238 B -20 B (-8%)
build/legacy-template.css 238 B -19 B (-7%)
build/legacy-template.js 8.07 kB -856 B (-10%) 👏
build/mini-cart-component-frontend.js 30.7 kB -187 B (-1%)
build/mini-cart-contents-block/cart-button--mini-cart-contents-block/checkout-button--mini-cart-contents---358acf4e-style.js 249 B -44 B (-15%) 👏
build/mini-cart-contents-block/cart-button-frontend.js 1.69 kB -45 B (-3%)
build/mini-cart-contents-block/cart-button-style.js 381 B -7 B (-2%)
build/mini-cart-contents-block/checkout-button-frontend.js 1.77 kB -42 B (-2%)
build/mini-cart-contents-block/checkout-button-style.js 463 B -7 B (-1%)
build/mini-cart-contents-block/empty-cart-frontend.js 357 B -3 B (-1%)
build/mini-cart-contents-block/empty-cart-style.js 355 B -3 B (-1%)
build/mini-cart-contents-block/filled-cart-frontend.js 266 B -1 B (0%)
build/mini-cart-contents-block/filled-cart-style.js 267 B -1 B (0%)
build/mini-cart-contents-block/footer-frontend.js 3.76 kB -67 B (-2%)
build/mini-cart-contents-block/footer-rtl.css 400 B -19 B (-5%)
build/mini-cart-contents-block/footer-style.js 2.35 kB -56 B (-2%)
build/mini-cart-contents-block/footer.css 400 B -18 B (-4%)
build/mini-cart-contents-block/items-frontend.js 228 B -9 B (-4%)
build/mini-cart-contents-block/items-style.js 229 B -8 B (-3%)
build/mini-cart-contents-block/products-table--product-image--product-title-style.js 316 B -36 B (-10%) 👏
build/mini-cart-contents-block/products-table-frontend.js 543 B -39 B (-7%)
build/mini-cart-contents-block/products-table-rtl.css 2.12 kB -71 B (-3%)
build/mini-cart-contents-block/products-table-style.js 5.31 kB -134 B (-2%)
build/mini-cart-contents-block/products-table.css 2.11 kB -74 B (-3%)
build/mini-cart-contents-block/shopping-button-frontend.js 488 B -50 B (-9%)
build/mini-cart-contents-block/shopping-button-style.js 396 B -7 B (-2%)
build/mini-cart-contents-block/title-frontend.js 1.85 kB -44 B (-2%)
build/mini-cart-contents-block/title-items-counter-frontend.js 1.57 kB -24 B (-2%)
build/mini-cart-contents-block/title-items-counter-style.js 301 B -1 B (0%)
build/mini-cart-contents-block/title-label-frontend.js 1.51 kB -21 B (-1%)
build/mini-cart-contents-block/title-style.js 439 B -6 B (-1%)
build/mini-cart-contents-rtl.css 2.66 kB -75 B (-3%)
build/mini-cart-contents.css 2.65 kB -77 B (-3%)
build/mini-cart-contents.js 17.6 kB -348 B (-2%)
build/mini-cart-frontend.js 2.79 kB -62 B (-2%)
build/mini-cart-rtl.css 2.56 kB -52 B (-2%)
build/mini-cart.css 2.56 kB -56 B (-2%)
build/mini-cart.js 6.32 kB -51 B (-1%)
build/packages-style-rtl.css 3.55 kB -40 B (-1%)
build/packages-style.css 3.55 kB -40 B (-1%)
build/price-filter-frontend.js 14.5 kB -162 B (-1%)
build/price-filter-rtl.css 2.67 kB -31 B (-1%)
build/price-filter-wrapper-frontend.js 6.64 kB -114 B (-2%)
build/price-filter-wrapper-rtl.css 2.53 kB -30 B (-1%)
build/price-filter-wrapper.css 2.53 kB -29 B (-1%)
build/price-filter.css 2.67 kB -31 B (-1%)
build/price-filter.js 8.47 kB -104 B (-1%)
build/price-format.js 1.15 kB -31 B (-3%)
build/product-add-to-cart--product-average-rating--product-button--product-image--product-price--product---1d132d69.js 269 B -3 B (-1%)
build/product-add-to-cart--product-image--product-title.js 315 B -36 B (-10%) 👏
build/product-add-to-cart-frontend.js 8.45 kB -218 B (-3%)
build/product-add-to-cart-rtl.css 1.35 kB -39 B (-3%)
build/product-add-to-cart.css 1.36 kB -39 B (-3%)
build/product-add-to-cart.js 8.5 kB -214 B (-2%)
build/product-average-rating--product-button--product-image--product-price--product-rating--product-ratin--e23975b5.js 927 B -27 B (-3%)
build/product-average-rating-frontend.js 1.7 kB -23 B (-1%)
build/product-best-sellers.js 8.29 kB -160 B (-2%)
build/product-button-frontend.js 4.85 kB -105 B (-2%)
build/product-button-rtl.css 864 B -25 B (-3%)
build/product-button.css 863 B -28 B (-3%)
build/product-button.js 3.85 kB -98 B (-2%)
build/product-categories-rtl.css 651 B -20 B (-3%)
build/product-categories.css 649 B -21 B (-3%)
build/product-categories.js 2.71 kB -1 B (0%)
build/product-category.js 9.26 kB -209 B (-2%)
build/product-collection.js 13.8 kB -154 B (-1%)
build/product-details-rtl.css 394 B -19 B (-5%)
build/product-details.css 391 B -19 B (-5%)
build/product-gallery-large-image-rtl.css 295 B -19 B (-6%)
build/product-gallery-large-image.css 295 B -18 B (-6%)
build/product-gallery-large-image.js 2.01 kB +5 B (0%)
build/product-gallery.js 2.3 kB +4 B (0%)
build/product-image-frontend.js 2.64 kB -76 B (-3%)
build/product-image-gallery-rtl.css 304 B -18 B (-6%)
build/product-image-gallery.css 303 B -19 B (-6%)
build/product-image-rtl.css 922 B -29 B (-3%)
build/product-image.css 920 B -29 B (-3%)
build/product-image.js 1.5 kB -66 B (-4%)
build/product-new.js 8.57 kB -184 B (-2%)
build/product-on-sale.js 8.57 kB -190 B (-2%)
build/product-price-frontend.js 247 B -1 B (0%)
build/product-price-rtl.css 667 B -29 B (-4%)
build/product-price.css 665 B -30 B (-4%)
build/product-price.js 1.65 kB -26 B (-2%)
build/product-query-rtl.css 347 B -20 B (-5%)
build/product-query.css 347 B -18 B (-5%)
build/product-query.js 12.7 kB -248 B (-2%)
build/product-rating-counter-frontend.js 2 kB -24 B (-1%)
build/product-rating-counter.js 686 B -1 B (0%)
build/product-rating-frontend.js 2.34 kB -31 B (-1%)
build/product-rating-rtl.css 244 B -18 B (-7%)
build/product-rating-stars-frontend.js 2.24 kB -30 B (-1%)
build/product-rating-stars-rtl.css 895 B -19 B (-2%)
build/product-rating-stars.css 897 B -19 B (-2%)
build/product-rating-stars.js 933 B -4 B (0%)
build/product-rating.css 244 B -18 B (-7%)
build/product-rating.js 1.03 kB -3 B (0%)
build/product-results-count-rtl.css 228 B -20 B (-8%)
build/product-results-count.css 228 B -19 B (-8%)
build/product-reviews-rtl.css 456 B -18 B (-4%)
build/product-reviews.css 455 B -18 B (-4%)
build/product-sale-badge-frontend.js 1.79 kB -21 B (-1%)
build/product-sale-badge-rtl.css 369 B -23 B (-6%)
build/product-sale-badge.css 370 B -19 B (-5%)
build/product-search-rtl.css 415 B -20 B (-5%)
build/product-search.css 415 B -19 B (-4%)
build/product-search.js 2.62 kB -13 B (0%)
build/product-sku-frontend.js 1.83 kB -36 B (-2%)
build/product-sku-rtl.css 237 B -21 B (-8%)
build/product-sku.css 237 B -21 B (-8%)
build/product-sku.js 519 B -16 B (-3%)
build/product-stock-indicator-frontend.js 2.02 kB -41 B (-2%)
build/product-stock-indicator-rtl.css 229 B -21 B (-8%)
build/product-stock-indicator.css 229 B -21 B (-8%)
build/product-stock-indicator.js 707 B -22 B (-3%)
build/product-summary-frontend.js 2.17 kB -115 B (-5%)
build/product-summary-rtl.css 546 B -25 B (-4%)
build/product-summary.css 546 B -26 B (-5%)
build/product-summary.js 912 B -94 B (-9%)
build/product-tag.js 8.75 kB -205 B (-2%)
build/product-template-rtl.css 418 B -21 B (-5%)
build/product-template.css 418 B -19 B (-4%)
build/product-template.js 3.33 kB -24 B (-1%)
build/product-title-frontend.js 2.2 kB -37 B (-2%)
build/product-title-rtl.css 688 B -30 B (-4%)
build/product-title.css 689 B -30 B (-4%)
build/product-title.js 955 B -18 B (-2%)
build/product-top-rated.js 8.83 kB -175 B (-2%)
build/products-by-attribute.js 9.61 kB -198 B (-2%)
build/rating-filter-frontend.js 21.4 kB -21 B (0%)
build/rating-filter-rtl.css 4.2 kB -48 B (-1%)
build/rating-filter-wrapper-frontend.js 6.18 kB -53 B (-1%)
build/rating-filter-wrapper-rtl.css 4.07 kB -46 B (-1%)
build/rating-filter-wrapper.css 4.07 kB -45 B (-1%)
build/rating-filter.css 4.19 kB -47 B (-1%)
build/rating-filter.js 6.87 kB -74 B (-1%)
build/reviews-by-category-rtl.css 1.79 kB -58 B (-3%)
build/reviews-by-category.css 1.79 kB -57 B (-3%)
build/reviews-by-category.js 11.9 kB -262 B (-2%)
build/reviews-by-product-rtl.css 1.79 kB -58 B (-3%)
build/reviews-by-product.css 1.79 kB -57 B (-3%)
build/reviews-by-product.js 13.1 kB -286 B (-2%)
build/reviews-frontend.js 7.04 kB -143 B (-2%)
build/single-product-rtl.css 375 B -24 B (-6%)
build/single-product.css 375 B -22 B (-6%)
build/single-product.js 11.2 kB -141 B (-1%)
build/stock-filter-frontend.js 21.6 kB -56 B (0%)
build/stock-filter-rtl.css 4.01 kB -52 B (-1%)
build/stock-filter-wrapper-frontend.js 6.38 kB -70 B (-1%)
build/stock-filter-wrapper-rtl.css 3.88 kB -50 B (-1%)
build/stock-filter-wrapper.css 3.88 kB -52 B (-1%)
build/stock-filter.css 4.01 kB -52 B (-1%)
build/stock-filter.js 7.57 kB -71 B (-1%)
build/store-notices.js 1.69 kB +3 B (0%)
build/vendors--active-filters-wrapper--attribute-filter-wrapper--mini-cart-contents-block/cart-button--mi--d6bb29e6-style.js 604 B -2 B (0%)
build/vendors--attribute-filter-wrapper--cart-blocks/order-summary-coupon-form--cart-blocks/order-summary--48e1e4bb-frontend.js 6.83 kB -1 B (0%)
build/vendors--attribute-filter-wrapper--cart-blocks/order-summary-shipping--checkout-blocks/billing-addr--d9f38f9d-frontend.js 4.19 kB -1 B (0%)
build/vendors--cart-blocks/cart-cross-sells-products--cart-blocks/cart-line-items--cart-blocks/cart-order--3c5fe802-frontend.js 5.26 kB +1 B (0%)
build/vendors--cart-blocks/order-summary-shipping--checkout-blocks/billing-address--checkout-blocks/order--decc3dc6-frontend.js 19.4 kB -4 B (0%)
build/vendors--cart-blocks/proceed-to-checkout-style.js 178 B -1 B (-1%)
build/vendors--checkout-blocks/shipping-method-frontend.js 12.4 kB -3 B (0%)
build/vendors--checkout-blocks/shipping-method-style.js 11.7 kB +4 B (0%)
build/vendors--mini-cart-contents-block/products-table-style.js 3.16 kB +1 B (0%)
build/vendors--price-filter-wrapper-frontend.js 2.2 kB +2 B (0%)
build/vendors--product-add-to-cart-frontend.js 7.35 kB +103 B (+1%)
build/wc-blocks-data.js 21.7 kB -652 B (-3%)
build/wc-blocks-editor-style-rtl.css 6.33 kB -57 B (-1%)
build/wc-blocks-editor-style.css 6.34 kB -57 B (-1%)
build/wc-blocks-google-analytics.js 1.54 kB -21 B (-1%)
build/wc-blocks-middleware.js 933 B -1 B (0%)
build/wc-blocks-registry.js 3.18 kB +32 B (+1%)
build/wc-blocks-rtl.css 2.51 kB -36 B (-1%)
build/wc-blocks-shared-context.js 1.1 kB -3 B (0%)
build/wc-blocks-shared-hocs.js 1.62 kB -132 B (-8%)
build/wc-blocks-vendors.js 65.4 kB -68 B (0%)
build/wc-blocks.css 2.51 kB -33 B (-1%)
build/wc-blocks.js 3.7 kB -46 B (-1%)
build/wc-payment-method-cod.js 908 B -1 B (0%)
build/wc-settings.js 2.57 kB -34 B (-1%)
build/wc-shipping-method-pickup-location.js 30.4 kB +1 B (0%)
ℹ️ View Unchanged
Filename Size
build/cart-blocks/cart-accepted-payment-methods-style.js 137 B
build/cart-blocks/order-summary-discount-style.js 136 B
build/cart-blocks/order-summary-fee-style.js 137 B
build/cart-blocks/order-summary-shipping-style.js 178 B
build/checkout-blocks/actions--checkout-blocks/terms-style.js 485 B
build/checkout-blocks/order-summary-discount-style.js 137 B
build/checkout-blocks/order-summary-fee-style.js 137 B
build/checkout-blocks/order-summary-shipping-style.js 137 B
build/checkout-blocks/order-summary-subtotal-style.js 137 B
build/mini-cart-contents-block/title-label-style.js 301 B
build/product-add-to-cart--product-button--product-rating--product-rating-counter--product-rating-stars.js 151 B
build/product-average-rating.js 397 B
build/product-results-count.js 1.67 kB
build/product-sale-badge.js 665 B
build/vendors--attribute-filter-wrapper-frontend.js 5.11 kB
build/vendors--cart-blocks/cart-line-items--checkout-blocks/order-summary-cart-items--mini-cart-contents---233ab542-frontend.js 3.57 kB
build/vendors--checkout-blocks/pickup-options--checkout-blocks/shipping-methods-frontend.js 8.25 kB
build/vendors--mini-cart-contents-block/products-table--price-filter-wrapper--product-price-style.js 5.27 kB
build/vendors--rating-filter-wrapper-frontend.js 5.11 kB
build/vendors--stock-filter-wrapper-frontend.js 5.11 kB
build/wc-interactivity.js 10.4 kB
build/wc-payment-method-bacs.js 816 B
build/wc-payment-method-cheque.js 811 B
build/wc-payment-method-paypal.js 837 B

compressed-size-action

@hsingyuc
Copy link
Contributor Author

Related PR review

@mikejolley
Copy link
Member

The previous Store API PRs made sense to me (ability to pay for orders from 3rd party app), but this is where things start to become unclear for me because this overlaps with core functionality.

  1. Where does this login form/pay page fit in to the flow WooPay are building?
  2. How would a user hit this page if they are not coming from the "My Account" page in WooCommerce (where they are already logged in), where the "pay" links are found?
  3. Would it make sense to protect the legacy shortcode with the same login form? If so, does this change belong in blocks or core?

It's more difficult to maintain core changes from blocks because we have to rely on filters to adjust content, so I want to make sure this change makes sense in the context of blocks rather than core.

cc @ralucaStan who should be aware of these changes.

@hsingyuc
Copy link
Contributor Author

  1. Where does this login form/pay page fit in to the flow WooPay are building?

The login form doesn't affect WooPay but for Blocks Pay-for-order, which will be used in WooPay. WooPay users are already logged in, so they will only see billing email verification or a notice that they can't access the order if it does not belong to them.

I think we should solve the flow in blocks first and then we can adjust if needed in WooPay. What do you expect the flow to look like for blocks checkout with pay-for-orders?

  1. How would a user hit this page if they are not coming from the "My Account" page in WooCommerce (where they are already logged in), where the "pay" links are found?

Here are the two flows and how you'd see them. These are flows included in WooCommerce core, the only reason we don't see them with the blocks checkout is because they are hidden with the is_wc_endpoint_url( 'order-pay' ) check. This PR removes that, but I should probably hide it behind a development flag.

Guest

Guest.order.mov

Logged-in user

Logged.in.user.mov
  1. Would it make sense to protect the legacy shortcode with the same login form? If so, does this change belong in blocks or core?

This login form is included already in the legacy shortcode checkout.

This PR just adds the login form to the blocks checkout.

@mikejolley
Copy link
Member

The login form doesn't affect WooPay but for Blocks Pay-for-order, which will be used in WooPay. WooPay users are already logged in, so they will only see billing email verification or a notice that they can't access the order if it does not belong to them.

Ok so to summarize:

  • This PR makes it so that the order-pay endpoint no longer falls back to the shortcode based checkout
  • This PR filters post content to inject a login form before blocks/shortcodes are rendered, if the current request matches the order-pay endpoint.

And for reference this is the code in place currently to use the legacy experience for checkout endpoints, so that the block is only used for the main checkout view:

if ( $this->is_checkout_endpoint() ) {
	// Note: Currently the block only takes care of the main checkout form -- if an endpoint is set, refer to the
	// legacy shortcode instead and do not render block.
	return wc_current_theme_is_fse_theme() ? do_shortcode( '[woocommerce_checkout]' ) : '[woocommerce_checkout]';
}

I think we should solve the flow in blocks first and then we can adjust if needed in WooPay. What do you expect the flow to look like for blocks checkout with pay-for-orders?

My concern is this is widening the scope of responsibility for Blocks substantially. With this change in place, block based checkout will be used for the pay page. This is untested, and hasn't be validated as a viable solution. We also have the concerns about changing address fields. Checkout addresses can not currently be locked down.

Due to this I am not comfortable approving this work without feedback from @ralucaStan and @pmcpinto first.

As for the login form injection, I am not a fan of the approach taken in this PR (filtering the post content and inserting the form). For a quick fix, it could be handled in the Checkout Block render method, or we could just redirect to an existing login page. The Checkout Block does not facilitate logins at present, it just shows a login link.

Handling store login feels like it could use a deeper dive because there would be opportunities to:

  • Create a login form block/component that could be used in multiple places
  • Create a template for Block themes, so the user could customise the login page

Again, this is something that could use feedback from @ralucaStan / @pmcpinto because I am uncertain where this fits in with the roadmap.

@hsingyuc
Copy link
Contributor Author

hsingyuc commented Jul 27, 2023

My concern is this is widening the scope of responsibility for Blocks substantially. With this change in place, block based checkout will be used for the pay page.

I thought this was the original plan behind this project. pdpOw2-2sP-p2#comment-2950 The goal is to get the pay-for-order flow working in blocks and WooPay will just proxy the endpoints. Are you saying that we should try to make WooCommerce Blocks allow payment for pay-for-orders?

We could try to figure out how to make this work just for WooPay, but this seems like a wasted opportunity to make this also work in blocks.

This is untested, and hasn't be validated as a viable solution.

This PR puts this change behind the development flag. I thought we had agreed on this solution and are slowly implementing the changes to make this happen, but please let me know if you were thinking something else.

We also have the concerns about changing address fields. Checkout addresses can not currently be locked down.

That will happen in a future PR. The endpoints and client changes still need to be added. Since this is behind a development flag, it should be okay, right?

I thought this comment meant this authentication flow would be okay as long as it was behind a feature flag.

For a quick fix, it could be handled in the Checkout Block render method, or we could just redirect to an existing login page.

I thought the fix in this PR was the quickest solution. Could you share why replacing the content is not a good solution?

Adding new blocks would be a better solution long-term, but it seems like it would increase the scope of this project a lot. I think this is something we could always add later.

I don't think a redirect works. There is a login page, but there's no email verification page right now in core. We need to render that form somewhere.

@mikejolley
Copy link
Member

@hsingyuc I want to get some feedback from the rest of the team before proceeding—they are on a meetup this week.

The Store API changes were safe behind a flag, but we're starting to touch Checkout Block logic now and I want to avoid regressions. I'm also slightly worried we'll stuff all the new payment page logic into the existing checkout block and make it more difficult to maintain.

There are also other ways we could approach offering a payment page, for example:

  • there could be a template for the endpoint (like we've just implemented for the Order Confirmation page)
  • there could be a new block, similar to checkout, on a different page that is managed separately to the main checkout block to keep the logic separated

We should make sure both teams are in alignment before proceeding, especially if Rubik will maintain this once complete.

I thought the fix in this PR was the quickest solution. Could you share why replacing the content is not a good solution?

  • the_content hook runs for all rendered content, site wide, so there are performance concerns
  • this would break any content outside of the block thats within post_content
  • it's unclear to me if this would work with block templates, or just on pages. Would need to test that.

Login should be kept within the confines of the block requiring it IMO.

@hsingyuc
Copy link
Contributor Author

@hsingyuc I want to get some feedback from the rest of the team before proceeding—they are on a meetup this week.

Got it, let's wait for feedback from @ralucaStan and @pmcpinto.

the_content hook runs for all rendered content, site wide, so there are performance concerns

Isn't this only run once per page?

this would break any content outside of the block thats within post_content

Could you expand on this? I'm not quite sure I understand.

it's unclear to me if this would work with block templates, or just on pages. Would need to test that.

That's a good point. I think this is something that needs to be tested. Currently, pay-for-order routes are limited to the "checkout" page pay for order route checkout/order-pay/ORDER_ID so I don't think we would hit this issue.

But if we wanted this to work anywhere the block is used, it might be good to move to use a block instead of filtering the_content. This is not how core works right now, but I think it would be a good addition.

there could be a new block, similar to checkout

I think this could be a good idea. My only concern is that it greatly increases the scope of this project. I'm not sure it's absolutely necessary for this MVP, but if we decide that's the best solution I'm okay with doing that as long as we understand it will take longer and cannot meet GA deadlines.

@pmcpinto
Copy link

Thanks for the ping.

My concern is this is widening the scope of responsibility for Blocks substantially. With this change in place, block based checkout will be used for the pay page. This is untested, and hasn't be validated as a viable solution. We also have the concerns about changing address fields. Checkout addresses can not currently be locked down.

What are we really trying to achieve with the changes? Is it having WooPay as an option in the Pay for order the end goal?

Handling store login feels like it could use a deeper dive because there would be opportunities to:
Create a login form block/component that could be used in multiple places
Create a template for Block themes, so the user could customise the login page

Yes. With the changes to strengthen the order confirmation flow, we'll need a login page for the order confirmation template.

@hsingyuc
Copy link
Contributor Author

hsingyuc commented Aug 1, 2023

Is it having WooPay as an option in the Pay for order the end goal?

Yes. I think a secondary goal is to set this up so that WooCommerce Blocks also can turn on the pay-for-order flow in blocks checkout when ready.

Right now this is all behind a development flag so it will not be turned on for blocks by default.

Yes. With the changes to strengthen the order confirmation flow, we'll need a login page for the order confirmation template.

My current solution adds a login and email confirmation using the forms in core. I think @mikejolley wants to create those as blocks in the current experience instead of reusing the core ones.

I believe this is a good idea long-term, but I wanted to use the existing flows to save time for GA. If we are not worried about including this logic in blocks right now, we can skip the forms here since it's not needed for WooPay.

@ralucaStan
Copy link
Contributor

@hsingyuc could you be more specific about how to Create a pay-for-order order as a guest?

My concern is this is widening the scope of responsibility for Blocks substantially. With this change in place, block based checkout will be used for the pay page. This is untested, and hasn't be validated as a viable solution. We also have the concerns about changing address fields. Checkout addresses can not currently be locked down.

It appears @mikejolley has some concerns. Where was the decision taken? For some background WC also has email address check on the order confirmation page woocommerce/woocommerce#39191

As for the login form injection, I am not a fan of the approach taken in this PR (filtering the post content and inserting the form). For a quick fix, it could be handled in the Checkout Block render method, or we could just redirect to an existing login page. The Checkout Block does not facilitate logins at present, it just shows a login link. - @mikejolley

I think we should solve the flow in blocks first and then we can adjust if needed in WooPay. What do you expect the flow to look like for blocks checkout with pay-for-orders? - @hsingyuc

@hsingyuc we are skeptical of this approach because we have never included login in the checkout blocks. If there is a need to login, we redirect users to the shortcode login page. This is an approach we are using and we are sticking with it until we have an explicit request to implement authentication at the block level; we need to have first an overview of adding login here, what is impacted, how it works with the template experience etc. before proceeding to implementation. @pmcpinto can confirm that this is on our roadmap, but not a priority at the moment.

This login form is included already in the legacy shortcode checkout.
This PR just adds the login form to the blocks checkout.

This PR puts this change behind the development flag. I thought we had agreed on this solution and are slowly implementing the changes to make this happen, but please let me know if you were thinking something else.- @hsingyuc

Just to highlight that we were not aware of the implications of having login at this level. Can't we work with using the shortcode login, and then redirecting to the pay for order? - @hsingyuc

I thought the fix in this PR was the quickest solution. Could you share why replacing the content is not a good solution?
Adding new blocks would be a better solution long-term, but it seems like it would increase the scope of this project a lot. I think this is something we could always add later. - @hsingyuc

I am going to let @pmcpinto answer this one. I don't think we should pick solutions for the sake of speed. We clearly need to align, especially since, as Mike pointed out, the responsibility for this change will land on Team Rubik and we can't give a confidence vote on this approach; and it's not aligned with the roadmap for blocks. @hsingyuc I understand where you are coming from, but we might need to reassess the expected result.

@hsingyuc
Copy link
Contributor Author

hsingyuc commented Aug 8, 2023

@hsingyuc could you be more specific about how to Create a pay-for-order order as a guest?

For example, when you have a bookable product and need the merchant's approval on the booking. Merchants will receive an email to approve the booking. Customers will receive the confirmation and the pay-for-order link to the checkout page.

booking1.mov
booking.2.mov

@hsingyuc we are skeptical of this approach because we have never included login in the checkout blocks. If there is a need to login, we redirect users to the shortcode login page.

The approach I took above is also using the shortcode login and not including a login directly in blocks. I think Mike's concern is that it uses the_content filter, and he's worried that this will not work if the block is used on a non-checkout page. I understand the concern for this, but the current pay-for-order page can't be used outside of the checkout page assigned in settings.
Screen Shot 2023-08-08 at 9 01 01 AM

@hsingyuc we are skeptical of this approach because we have never included login in the checkout blocks. If there is a need to login, we redirect users to the shortcode login page. This is an approach we are using and we are sticking with it until we have an explicit request to implement authentication at the block level; we need to have first an overview of adding login here, what is impacted, how it works with the template experience etc. before proceeding to implementation. @pmcpinto can confirm that this is on our roadmap, but not a priority at the moment.

It's okay if it's not a priority because we can add the block login page later when you are ready. We can add this on the WooPay side separately right now.

Just to highlight that we were not aware of the implications of having login at this level. Can't we work with using the shortcode login, and then redirecting to the pay for order? - @hsingyuc

Just to be clear, we are using the shortcode login embedded in the current page (not within blocks) instead of a redirect. The problem is that Core does not have an email form verification page, so switching to redirect for that does not work. They do have an email verification form, which is what we use here.

I am going to let @pmcpinto answer this one. I don't think we should pick solutions for the sake of speed. We clearly need to align, especially since, as Mike pointed out, the responsibility for this change will land on Team Rubik and we can't give a confidence vote on this approach; and it's not aligned with the roadmap for blocks. @hsingyuc I understand where you are coming from, but we might need to reassess the expected result.

Sounds good. @pmcpinto, any inputs?

@pmcpinto
Copy link

pmcpinto commented Aug 9, 2023

Thanks for the clarification. This niche use case isn’t a priority for us. The team is hesitant to offer support for it at this time due to its untested nature, which could potentially result in unforeseen repercussions. Moreover, this could increase our maintenance workload. Is there a feasible approach to integrate this into WooPay without impacting the blocks and slowing down the path for GA?

@hsingyuc
Copy link
Contributor Author

hsingyuc commented Aug 9, 2023

This niche use case isn’t a priority for us.

@pmcpinto CMIIAW. Pay-for-order is a Core function, so eventually, Blocks will add pay-for-order block like Block checkout/Shortcode checkout. By niche use case, do you mean we don't have enough pay-for-order orders? It seems like we might have enough use cases between Subscriptions, WooCommerce Bookings, and Pre-Orders.

The team is hesitant to offer support for it at this time due to its untested nature, which could potentially result in unforeseen repercussions.

Currently, we put them behind the feature flag for testing the whole flow. Any other suggestions on a thorough testing plan so we can prevent any regressions?

It seems like eventually we'll have to do this unless we plan to remove this feature from Core entirely and not support those products.

Moreover, this could increase our maintenance workload. Is there a feasible approach to integrate this into WooPay without impacting the blocks and slowing down the path for GA?

Yes, we can move the logic to WooPay. I'm not sure how complex it would be right now.

@pierorocca
Copy link

Thanks for the clarification. This niche use case isn’t a priority for us.

@pmcpinto what specifically are you referring to as a niche use case? Pay-for-order flow is core order payment functionality. It enables multiple Woo extensions including WooCommerce Bookings (Over 20K+ installs, ~2900 active merchants $249/year) and pre-orders canonical extension (~1100 active merchants at $159/year). It was a key configuration option in the core onboarding flow when we started, and which was recently replaced with a non-industry specific site builder wizard (TBD if the new generic approach is justified. I can create a service store with bookings in < 2 minutes on multiple competing platforms). Not having any accelerated checkouts compatible with this order placement flow is a problem.

Regarding embedding pay-for-order flow functionality into WooPay, I think this is where systems design guidance and perspective from @marcinbot would be valuable. My opinion is that the BE contributing to core/blocks is more appropriate and reliable than shifting core functionality to a non-core feature of a plugin.

@marcinbot
Copy link

My opinion is that the BE contributing to core/blocks is more appropriate and reliable than shifting core functionality to a non-core feature of a plugin.

After reading the discussion here my understanding is that:

  • We're trying to add functionality for guests to pay for orders using a link provided in, for example, emails. They have to confirm their identity before payment and are presented with a login form.
  • The feature is put behind a flag
  • The team feels this falls outside of the existing area covered by Blocks (checkout vs pay-for-order vs login)
  • The team has some doubts regarding the implementation detail (login form embedded rather than redirected to)
  • The team feels that this addresses only an edge case and as such the cost/benefit ratio of having to maintain it is not justifiable

I think historically similar scenarios resulted in the change being added to the non-core plugin. This has often resulted in questions being asked about why some work is being duplicated, so I realise it's far from an ideal solution.

If this is a blocker for WooPay, then I think we might have to implement it there, at least for the time being. The politics of how the code can be contributed to on a larger scale, and who should maintain it, should probably be discussed separately. It does sound like the changes proposed here open the door for a larger expansion of the Blocks plugin, so some more planning might be required.

@hsingyuc
Copy link
Contributor Author

Thank you all for your time and the discussion! I believe we have a conclusion to not implement the checks into Blocks now but maybe later in the future. I'm going to close this PR and next conversation is happening here.

@hsingyuc hsingyuc closed this Aug 11, 2023
@pierorocca
Copy link

Thanks @marcinbot.

@ralucaStan
Copy link
Contributor

Thank you all!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Check authentication for logged out user on the checkout blocks pay for order page

7 participants