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

Conversation

@opr
Copy link
Contributor

@opr opr commented Jul 8, 2022

Please review #6672 and merge into this branch before reviewing!

This PR updates the flow of registering payment methods. Once the cart has been initialised, we will run a thunk on the wc/store/payment-methods data store to signify that the store is initialized. This will allow us to set default payment methods and choose the active one.

This PR also refactors the PaymentMethodOptions component to get the saved methods from the data store instead of context. The reason this was done in this PR is because it was coupled with a unit test, so if I made a new PR for it, the changes to the tests here would need to be included there too.

The PR also updates unit tests relating to the payment method context, which has been moved to the data store.

the changes made in this PR in summary are:

  • assets/js/base/context/hooks/test/use-checkout-submit.js Changed to add the payment method store to the mock registry, removed mockUsePaymentMethodDataContext as it was not necessary.
  • assets/js/blocks-registry/payment-methods/registry.ts - remove the calls to updateAvailableExpressPaymentMethods because this is no longer needed, the cart data store does this action once, rather than the payment method registry doing it once for each payment method.
  • assets/js/blocks/cart-checkout-shared/payment-methods/payment-method-options.js - get the saved payment methods from the data store, and consolidate calls to useSelect into a single call.
  • assets/js/blocks/cart-checkout-shared/payment-methods/test/payment-methods.js - mock the store so the "No payment methods" error shows correctly.
  • assets/js/blocks/cart-checkout-shared/payment-methods/saved-payment-method-options.js - add an onChange to the radio control, because of https://github.com/woocommerce/woocommerce-blocks/pull/6636/files#diff-2f98fdd4a7fc8f68f912240d507f845faa1a86076185b1f2b405bf3243363a85R18
  • assets/js/data/cart/index.ts- When the cart is loaded, run the actions that will fully register and set the default payment methods in the wc/store/payment-methods data store.
  • assets/js/data/payment-methods/actions.ts remove unused thunks, and create initializePaymentMethodDataStore action.
  • assets/js/data/payment-methods/test/selectors.js moved this file from the payment method data context directory, this covers setting the payment method back to what it was before interacting with express payment methods.
  • assets/js/data/payment-methods/test/reducers.js - fix tests to remove unused action types.
  • assets/js/data/payment-methods/check-payment-methods.ts - Remove the check for whether the cart is loaded, this is no longer needed as this method is called once by the cart data store when it's loaded.

Testing

Automated Tests

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

User Facing Testing

  1. Smoke test the checkout, use lots of different payment methods.
  2. Use saved payment methods, express payment methods etc.
  3. Try with different shipping options.
  4. Optionally try with subscription products in your cart.
  • Do not include in the Testing Notes

WooCommerce Visibility

  • WooCommerce Core
  • Feature plugin
  • Experimental

Changelog

Add suggested changelog entry here.

@opr opr changed the base branch from trunk to feature/data-store-refactor July 8, 2022 15:23
@opr opr added skip-changelog PRs that you don't want to appear in the changelog. category: tests labels Jul 8, 2022
@opr opr marked this pull request as ready for review July 8, 2022 15:27
@rubikuserbot rubikuserbot requested review from a team and tarhi-saad and removed request for a team July 8, 2022 15:27
@opr opr changed the title Update tests for payment data store WIP: Update tests for payment data store Jul 8, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Jul 8, 2022

Size Change: -422 B (0%)

Total Size: 838 kB

Filename Size Change
build/active-filters-frontend.js 7.32 kB +2 B (0%)
build/active-filters.js 7.99 kB +2 B (0%)
build/all-products-frontend.js 18.1 kB +7 B (0%)
build/all-products.js 33.2 kB +9 B (0%)
build/attribute-filter-frontend.js 21.8 kB +4 B (0%)
build/attribute-filter.js 12.9 kB -2 B (0%)
build/blocks-checkout.js 17.5 kB +1 B (0%)
build/cart-blocks/cart-accepted-payment-methods-frontend.js 1.3 kB -18 B (-1%)
build/cart-blocks/cart-express-payment--checkout-blocks/express-payment-frontend.js 5.02 kB -10 B (0%)
build/cart-blocks/cart-express-payment-frontend.js 794 B -1 B (0%)
build/cart-blocks/cart-line-items--mini-cart-contents-block/products-table-frontend.js 5.27 kB +1 B (0%)
build/cart-blocks/cart-line-items-frontend.js 1.07 kB +1 B (0%)
build/cart-blocks/cart-order-summary-frontend.js 1.1 kB -1 B (0%)
build/cart-blocks/filled-cart-frontend.js 783 B -1 B (0%)
build/cart-blocks/order-summary-coupon-form-frontend.js 2.74 kB +1 B (0%)
build/cart-blocks/order-summary-discount-frontend.js 2.15 kB -1 B (0%)
build/cart-blocks/order-summary-fee-frontend.js 271 B -1 B (0%)
build/cart-blocks/order-summary-shipping--checkout-blocks/order-summary-shipping-frontend.js 6.58 kB -1 B (0%)
build/cart-blocks/order-summary-shipping-frontend.js 427 B -1 B (0%)
build/cart-blocks/order-summary-subtotal-frontend.js 272 B -1 B (0%)
build/cart-blocks/order-summary-taxes-frontend.js 433 B -1 B (0%)
build/cart-frontend.js 41.5 kB -53 B (0%)
build/cart.js 37 kB -67 B (0%)
build/checkout-blocks/actions-frontend.js 1.64 kB -11 B (-1%)
build/checkout-blocks/billing-address-frontend.js 930 B -2 B (0%)
build/checkout-blocks/order-summary-cart-items-frontend.js 3.65 kB +1 B (0%)
build/checkout-blocks/order-summary-coupon-form-frontend.js 2.9 kB +1 B (0%)
build/checkout-blocks/order-summary-fee-frontend.js 274 B -1 B (0%)
build/checkout-blocks/order-summary-frontend.js 1.1 kB -1 B (0%)
build/checkout-blocks/order-summary-taxes-frontend.js 432 B -1 B (0%)
build/checkout-blocks/payment-frontend.js 7.91 kB +2 B (0%)
build/checkout-blocks/shipping-methods-frontend.js 4.82 kB +1 B (0%)
build/checkout-blocks/terms-frontend.js 1.45 kB -9 B (-1%)
build/checkout-frontend.js 43.9 kB -85 B (0%)
build/checkout.js 38.9 kB -85 B (0%)
build/featured-category.js 13.2 kB -5 B (0%)
build/featured-product.js 13.5 kB +3 B (0%)
build/handpicked-products.js 7.37 kB +1 B (0%)
build/legacy-template.js 2.79 kB -1 B (0%)
build/mini-cart-contents-block/footer-frontend.js 3.08 kB -81 B (-3%)
build/mini-cart-contents-block/title-frontend.js 368 B +1 B (0%)
build/mini-cart-contents.js 16.4 kB -35 B (0%)
build/mini-cart.js 4.58 kB -2 B (0%)
build/price-filter-frontend.js 13.3 kB +5 B (0%)
build/price-filter.js 9.1 kB -1 B (0%)
build/product-add-to-cart--product-button--product-category-list--product-image--product-price--product-r--a0326d00.js 226 B -2 B (-1%)
build/product-add-to-cart--product-button--product-image--product-title.js 2.63 kB -2 B (0%)
build/product-add-to-cart-frontend.js 6.57 kB +1 B (0%)
build/product-add-to-cart.js 6.48 kB +1 B (0%)
build/product-best-sellers.js 7.71 kB +2 B (0%)
build/product-button--product-category-list--product-image--product-price--product-rating--product-sale-b--e17c7c01.js 436 B +1 B (0%)
build/product-button--product-image--product-rating--product-sale-badge--product-title.js 303 B +1 B (0%)
build/product-button-frontend.js 1.88 kB -2 B (0%)
build/product-button.js 1.57 kB -1 B (0%)
build/product-category.js 8.68 kB -1 B (0%)
build/product-image.js 1.59 kB -1 B (0%)
build/product-on-sale.js 8.03 kB +2 B (0%)
build/product-price-frontend.js 1.9 kB +2 B (0%)
build/product-price.js 1.51 kB +2 B (0%)
build/product-rating.js 741 B -1 B (0%)
build/product-sale-badge.js 805 B -1 B (0%)
build/product-stock-indicator.js 625 B -1 B (0%)
build/product-title.js 922 B +2 B (0%)
build/product-top-rated.js 7.95 kB +2 B (0%)
build/products-by-attribute.js 8.63 kB +1 B (0%)
build/reviews-by-category.js 11.2 kB +2 B (0%)
build/reviews-by-product.js 12.3 kB +4 B (0%)
build/reviews-frontend.js 7.01 kB -2 B (0%)
build/single-product-frontend.js 21.4 kB +5 B (0%)
build/single-product.js 10.1 kB +7 B (0%)
build/stock-filter-frontend.js 7.51 kB +2 B (0%)
build/stock-filter.js 7.46 kB -1 B (0%)
build/vendors--mini-cart-contents-block/footer-frontend.js 6.86 kB +2 B (0%)
build/vendors--product-add-to-cart-frontend.js 7.53 kB -1 B (0%)
build/wc-blocks-data.js 15.8 kB +8 B (0%)
build/wc-blocks-registry.js 2.8 kB -19 B (-1%)
build/wc-blocks-vendors.js 54.5 kB +2 B (0%)
ℹ️ View Unchanged
Filename Size
build/all-reviews.js 7.8 kB
build/cart-blocks/cart-items-frontend.js 299 B
build/cart-blocks/cart-totals-frontend.js 322 B
build/cart-blocks/empty-cart-frontend.js 347 B
build/cart-blocks/order-summary-heading-frontend.js 455 B
build/cart-blocks/proceed-to-checkout-frontend.js 1.19 kB
build/checkout-blocks/billing-address--checkout-blocks/shipping-address-frontend.js 4.95 kB
build/checkout-blocks/contact-information-frontend.js 3 kB
build/checkout-blocks/express-payment-frontend.js 1.18 kB
build/checkout-blocks/fields-frontend.js 344 B
build/checkout-blocks/order-note-frontend.js 1.13 kB
build/checkout-blocks/order-summary-discount-frontend.js 2.27 kB
build/checkout-blocks/order-summary-shipping-frontend.js 604 B
build/checkout-blocks/order-summary-subtotal-frontend.js 273 B
build/checkout-blocks/shipping-address-frontend.js 1.06 kB
build/checkout-blocks/totals-frontend.js 325 B
build/general-style-rtl.css 1.29 kB
build/general-style.css 1.29 kB
build/mini-cart-component-frontend.js 16.8 kB
build/mini-cart-contents-block/empty-cart-frontend.js 366 B
build/mini-cart-contents-block/filled-cart-frontend.js 230 B
build/mini-cart-contents-block/items-frontend.js 236 B
build/mini-cart-contents-block/products-table-frontend.js 591 B
build/mini-cart-contents-block/shopping-button-frontend.js 288 B
build/mini-cart-frontend.js 1.72 kB
build/price-format.js 1.19 kB
build/product-categories.js 2.41 kB
build/product-category-list-frontend.js 880 B
build/product-category-list.js 502 B
build/product-image-frontend.js 1.88 kB
build/product-new.js 7.71 kB
build/product-query.js 647 B
build/product-rating-frontend.js 1.16 kB
build/product-sale-badge-frontend.js 1.13 kB
build/product-search.js 2.18 kB
build/product-sku-frontend.js 380 B
build/product-sku.js 381 B
build/product-stock-indicator-frontend.js 995 B
build/product-summary-frontend.js 1.28 kB
build/product-summary.js 921 B
build/product-tag-list-frontend.js 874 B
build/product-tag-list.js 500 B
build/product-tag.js 8.08 kB
build/product-title-frontend.js 1.31 kB
build/vendors--cart-blocks/cart-line-items--cart-blocks/cart-order-summary--cart-blocks/order-summary-shi--c02aad66-frontend.js 5.26 kB
build/vendors--cart-blocks/cart-line-items--checkout-blocks/order-summary-cart-items--mini-cart-contents---233ab542-frontend.js 3.14 kB
build/vendors--cart-blocks/order-summary-shipping--checkout-blocks/billing-address--checkout-blocks/order--5b8feb0b-frontend.js 4.85 kB
build/vendors--cart-blocks/order-summary-shipping--checkout-blocks/billing-address--checkout-blocks/order--decc3dc6-frontend.js 19.1 kB
build/wc-blocks-editor-style-rtl.css 5.07 kB
build/wc-blocks-editor-style.css 5.07 kB
build/wc-blocks-google-analytics.js 1.56 kB
build/wc-blocks-middleware.js 932 B
build/wc-blocks-shared-context.js 1.52 kB
build/wc-blocks-shared-hocs.js 1.15 kB
build/wc-blocks-style-rtl.css 22.4 kB
build/wc-blocks-style.css 22.3 kB
build/wc-blocks-vendors-style-rtl.css 1.95 kB
build/wc-blocks-vendors-style.css 1.95 kB
build/wc-blocks.js 2.62 kB
build/wc-payment-method-bacs.js 816 B
build/wc-payment-method-cheque.js 811 B
build/wc-payment-method-cod.js 909 B
build/wc-payment-method-paypal.js 837 B
build/wc-settings.js 2.6 kB

compressed-size-action

@github-actions
Copy link
Contributor

github-actions bot commented Jul 8, 2022

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 react, wc-settings, wp-a11y, wp-api-fetch, wp-compose, wp-element, wp-html-entities, wp-i18n, wp-is-shallow-equal, wp-polyfill ⚠️
all-products-frontend.js lodash, react, 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-block-editor, wp-blocks, 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-url, wp-warning, wp-wordcount ⚠️
price-filter-frontend.js lodash, react, wc-blocks-data-store, wc-price-format, wc-settings, wp-data, wp-element, wp-i18n, wp-is-shallow-equal, wp-polyfill, wp-url ⚠️
attribute-filter-frontend.js lodash, react, wc-blocks-checkout, wc-blocks-data-store, wc-settings, wp-a11y, wp-block-editor, wp-blocks, 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 ⚠️
stock-filter-frontend.js lodash, react, wc-blocks-checkout, wc-blocks-data-store, wc-settings, wp-a11y, wp-data, wp-element, wp-html-entities, wp-i18n, wp-is-shallow-equal, wp-polyfill, wp-url ⚠️
active-filters-frontend.js lodash, react, 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 ⚠️
cart-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 ⚠️
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 ⚠️
mini-cart-frontend.js wc-settings, wp-polyfill ⚠️
single-product-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-block-editor, wp-blocks, 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-url, wp-warning, wp-wordcount ⚠️
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-components, 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-url, wp-warning, wp-wordcount ⚠️

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

@opr opr force-pushed the fix/data-store-tests branch from c2371d3 to 7a2a291 Compare July 8, 2022 17:08
@github-actions
Copy link
Contributor

github-actions bot commented Jul 8, 2022

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
mini-cart-contents.js wc-blocks-registry 🎉

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

@opr opr force-pushed the fix/data-store-tests branch from c9c6021 to df63d7b Compare July 8, 2022 20:02
@github-actions
Copy link
Contributor

github-actions bot commented Jul 8, 2022

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
mini-cart-contents.js wc-blocks-registry 🎉

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

8 similar comments
@github-actions
Copy link
Contributor

github-actions bot commented Jul 8, 2022

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
mini-cart-contents.js wc-blocks-registry 🎉

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

@github-actions
Copy link
Contributor

github-actions bot commented Jul 8, 2022

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
mini-cart-contents.js wc-blocks-registry 🎉

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

@github-actions
Copy link
Contributor

github-actions bot commented Jul 8, 2022

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
mini-cart-contents.js wc-blocks-registry 🎉

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

@github-actions
Copy link
Contributor

github-actions bot commented Jul 9, 2022

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
mini-cart-contents.js wc-blocks-registry 🎉

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

@github-actions
Copy link
Contributor

github-actions bot commented Jul 9, 2022

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
mini-cart-contents.js wc-blocks-registry 🎉

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

@github-actions
Copy link
Contributor

github-actions bot commented Jul 9, 2022

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
mini-cart-contents.js wc-blocks-registry 🎉

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

@github-actions
Copy link
Contributor

github-actions bot commented Jul 9, 2022

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
mini-cart-contents.js wc-blocks-registry 🎉

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

@github-actions
Copy link
Contributor

github-actions bot commented Jul 9, 2022

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
mini-cart-contents.js wc-blocks-registry 🎉

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

@opr opr changed the title WIP: Update tests for payment data store Refactor registration of payment merhods and update unit tests for payment data store Jul 9, 2022
@opr opr changed the title Refactor registration of payment merhods and update unit tests for payment data store Refactor registration of payment methods and update unit tests for payment data store Jul 11, 2022
@github-actions
Copy link
Contributor

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
mini-cart-contents.js wc-blocks-registry 🎉

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

@github-actions
Copy link
Contributor

See if we can stop this being dispatched if the currently...

See if we can stop this being dispatched if the currently selected method is still available.


// TODO See if we can stop this being dispatched if the currently selected method is still available.
await setDefaultPaymentMethod( paymentMethods );
dispatch( {
type: ACTION_TYPES.SET_AVAILABLE_PAYMENT_METHODS,

🚀 This comment was generated by the automations bot based on a todo comment in 9aec214 in #6669. cc @opr

@github-actions
Copy link
Contributor

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
mini-cart-contents.js wc-blocks-registry 🎉

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

2 similar comments
@github-actions
Copy link
Contributor

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
mini-cart-contents.js wc-blocks-registry 🎉

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

@github-actions
Copy link
Contributor

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
mini-cart-contents.js wc-blocks-registry 🎉

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

@opr opr force-pushed the fix/data-store-tests branch from 9e1d98a to cb1c8aa Compare August 22, 2022 13:20
@github-actions
Copy link
Contributor

The release ZIP for this PR is accessible via:

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

@opr opr merged commit c5b173d into feature/data-store-refactor Aug 22, 2022
@opr opr deleted the fix/data-store-tests branch August 22, 2022 13:56
opr added a commit that referenced this pull request Aug 23, 2022
…yment data store (#6669)

* Mock getCartTotals

* Change test to use data store instead of context

* Move payment method context test to data store selectors

* Change description of test suite

* Bump commit to trigger tests

* Fix path in test

* update package lock

* Set correct state payment method reducer tests/use correct actions

* Get saved payment methods from store not context

* Mock stores and update tests to allow switching payment methods

* Update tests to get onSubmit from checkoutEventsContext

* Remove cartTotalsLoaded check from payment method initialize check

* Make PaymentMethods test wait until payments initialized

* initialize payment method data store when cart is loaded

* Remove unneeded actions and add initializePaymentMethodDataStore

* Remove check for cart totals loaded in checkPaymentMethods

* Remove updateAvilablePaymentMethods from registry

* Remove unneeded mock

* Remove unused import

* Rename imports to fix eslint errors

* Remove unused imports

* Remove return false from checkPaymentMethods

* Remove unnecessary setPaymentMethodsInitialized call

* Add todo comment to track refactoring opportunity

* Remove savedpayment methods from payment method context and rename it

* Rename payment method data context to payment method events context

* Add tests for setDefaultPaymentMethods

* Optimize the availablePaymentMethods state data

Store only the "name" attribute for now.

* Get list of payment methods from the registry instead of the store

We are using this hook to get some React elements in the payment method
object. So, we are getting the raw data directly from the registry instead
of the store.

* Fix payment state not loading on the Checkout edit page

* Handle checkout edit page case

* Fix infinite loop error on C&C Blocks

* Include @wordpress/redux-routine in transformIgnorePatterns jest config

Co-authored-by: Saad Tarhi <[email protected]>
opr added a commit that referenced this pull request Aug 24, 2022
…yment data store (#6669)

* Mock getCartTotals

* Change test to use data store instead of context

* Move payment method context test to data store selectors

* Change description of test suite

* Bump commit to trigger tests

* Fix path in test

* update package lock

* Set correct state payment method reducer tests/use correct actions

* Get saved payment methods from store not context

* Mock stores and update tests to allow switching payment methods

* Update tests to get onSubmit from checkoutEventsContext

* Remove cartTotalsLoaded check from payment method initialize check

* Make PaymentMethods test wait until payments initialized

* initialize payment method data store when cart is loaded

* Remove unneeded actions and add initializePaymentMethodDataStore

* Remove check for cart totals loaded in checkPaymentMethods

* Remove updateAvilablePaymentMethods from registry

* Remove unneeded mock

* Remove unused import

* Rename imports to fix eslint errors

* Remove unused imports

* Remove return false from checkPaymentMethods

* Remove unnecessary setPaymentMethodsInitialized call

* Add todo comment to track refactoring opportunity

* Remove savedpayment methods from payment method context and rename it

* Rename payment method data context to payment method events context

* Add tests for setDefaultPaymentMethods

* Optimize the availablePaymentMethods state data

Store only the "name" attribute for now.

* Get list of payment methods from the registry instead of the store

We are using this hook to get some React elements in the payment method
object. So, we are getting the raw data directly from the registry instead
of the store.

* Fix payment state not loading on the Checkout edit page

* Handle checkout edit page case

* Fix infinite loop error on C&C Blocks

* Include @wordpress/redux-routine in transformIgnorePatterns jest config

Co-authored-by: Saad Tarhi <[email protected]>
opr added a commit that referenced this pull request Aug 25, 2022
…yment data store (#6669)

* Mock getCartTotals

* Change test to use data store instead of context

* Move payment method context test to data store selectors

* Change description of test suite

* Bump commit to trigger tests

* Fix path in test

* update package lock

* Set correct state payment method reducer tests/use correct actions

* Get saved payment methods from store not context

* Mock stores and update tests to allow switching payment methods

* Update tests to get onSubmit from checkoutEventsContext

* Remove cartTotalsLoaded check from payment method initialize check

* Make PaymentMethods test wait until payments initialized

* initialize payment method data store when cart is loaded

* Remove unneeded actions and add initializePaymentMethodDataStore

* Remove check for cart totals loaded in checkPaymentMethods

* Remove updateAvilablePaymentMethods from registry

* Remove unneeded mock

* Remove unused import

* Rename imports to fix eslint errors

* Remove unused imports

* Remove return false from checkPaymentMethods

* Remove unnecessary setPaymentMethodsInitialized call

* Add todo comment to track refactoring opportunity

* Remove savedpayment methods from payment method context and rename it

* Rename payment method data context to payment method events context

* Add tests for setDefaultPaymentMethods

* Optimize the availablePaymentMethods state data

Store only the "name" attribute for now.

* Get list of payment methods from the registry instead of the store

We are using this hook to get some React elements in the payment method
object. So, we are getting the raw data directly from the registry instead
of the store.

* Fix payment state not loading on the Checkout edit page

* Handle checkout edit page case

* Fix infinite loop error on C&C Blocks

* Include @wordpress/redux-routine in transformIgnorePatterns jest config

Co-authored-by: Saad Tarhi <[email protected]>
opr added a commit that referenced this pull request Sep 5, 2022
…yment data store (#6669)

* Mock getCartTotals

* Change test to use data store instead of context

* Move payment method context test to data store selectors

* Change description of test suite

* Bump commit to trigger tests

* Fix path in test

* update package lock

* Set correct state payment method reducer tests/use correct actions

* Get saved payment methods from store not context

* Mock stores and update tests to allow switching payment methods

* Update tests to get onSubmit from checkoutEventsContext

* Remove cartTotalsLoaded check from payment method initialize check

* Make PaymentMethods test wait until payments initialized

* initialize payment method data store when cart is loaded

* Remove unneeded actions and add initializePaymentMethodDataStore

* Remove check for cart totals loaded in checkPaymentMethods

* Remove updateAvilablePaymentMethods from registry

* Remove unneeded mock

* Remove unused import

* Rename imports to fix eslint errors

* Remove unused imports

* Remove return false from checkPaymentMethods

* Remove unnecessary setPaymentMethodsInitialized call

* Add todo comment to track refactoring opportunity

* Remove savedpayment methods from payment method context and rename it

* Rename payment method data context to payment method events context

* Add tests for setDefaultPaymentMethods

* Optimize the availablePaymentMethods state data

Store only the "name" attribute for now.

* Get list of payment methods from the registry instead of the store

We are using this hook to get some React elements in the payment method
object. So, we are getting the raw data directly from the registry instead
of the store.

* Fix payment state not loading on the Checkout edit page

* Handle checkout edit page case

* Fix infinite loop error on C&C Blocks

* Include @wordpress/redux-routine in transformIgnorePatterns jest config

Co-authored-by: Saad Tarhi <[email protected]>
opr added a commit that referenced this pull request Sep 5, 2022
…yment data store (#6669)

* Mock getCartTotals

* Change test to use data store instead of context

* Move payment method context test to data store selectors

* Change description of test suite

* Bump commit to trigger tests

* Fix path in test

* update package lock

* Set correct state payment method reducer tests/use correct actions

* Get saved payment methods from store not context

* Mock stores and update tests to allow switching payment methods

* Update tests to get onSubmit from checkoutEventsContext

* Remove cartTotalsLoaded check from payment method initialize check

* Make PaymentMethods test wait until payments initialized

* initialize payment method data store when cart is loaded

* Remove unneeded actions and add initializePaymentMethodDataStore

* Remove check for cart totals loaded in checkPaymentMethods

* Remove updateAvilablePaymentMethods from registry

* Remove unneeded mock

* Remove unused import

* Rename imports to fix eslint errors

* Remove unused imports

* Remove return false from checkPaymentMethods

* Remove unnecessary setPaymentMethodsInitialized call

* Add todo comment to track refactoring opportunity

* Remove savedpayment methods from payment method context and rename it

* Rename payment method data context to payment method events context

* Add tests for setDefaultPaymentMethods

* Optimize the availablePaymentMethods state data

Store only the "name" attribute for now.

* Get list of payment methods from the registry instead of the store

We are using this hook to get some React elements in the payment method
object. So, we are getting the raw data directly from the registry instead
of the store.

* Fix payment state not loading on the Checkout edit page

* Handle checkout edit page case

* Fix infinite loop error on C&C Blocks

* Include @wordpress/redux-routine in transformIgnorePatterns jest config

Co-authored-by: Saad Tarhi <[email protected]>
opr added a commit that referenced this pull request Sep 15, 2022
…yment data store (#6669)

* Mock getCartTotals

* Change test to use data store instead of context

* Move payment method context test to data store selectors

* Change description of test suite

* Bump commit to trigger tests

* Fix path in test

* update package lock

* Set correct state payment method reducer tests/use correct actions

* Get saved payment methods from store not context

* Mock stores and update tests to allow switching payment methods

* Update tests to get onSubmit from checkoutEventsContext

* Remove cartTotalsLoaded check from payment method initialize check

* Make PaymentMethods test wait until payments initialized

* initialize payment method data store when cart is loaded

* Remove unneeded actions and add initializePaymentMethodDataStore

* Remove check for cart totals loaded in checkPaymentMethods

* Remove updateAvilablePaymentMethods from registry

* Remove unneeded mock

* Remove unused import

* Rename imports to fix eslint errors

* Remove unused imports

* Remove return false from checkPaymentMethods

* Remove unnecessary setPaymentMethodsInitialized call

* Add todo comment to track refactoring opportunity

* Remove savedpayment methods from payment method context and rename it

* Rename payment method data context to payment method events context

* Add tests for setDefaultPaymentMethods

* Optimize the availablePaymentMethods state data

Store only the "name" attribute for now.

* Get list of payment methods from the registry instead of the store

We are using this hook to get some React elements in the payment method
object. So, we are getting the raw data directly from the registry instead
of the store.

* Fix payment state not loading on the Checkout edit page

* Handle checkout edit page case

* Fix infinite loop error on C&C Blocks

* Include @wordpress/redux-routine in transformIgnorePatterns jest config

Co-authored-by: Saad Tarhi <[email protected]>
alexflorisca pushed a commit that referenced this pull request Sep 28, 2022
…yment data store (#6669)

* Mock getCartTotals

* Change test to use data store instead of context

* Move payment method context test to data store selectors

* Change description of test suite

* Bump commit to trigger tests

* Fix path in test

* update package lock

* Set correct state payment method reducer tests/use correct actions

* Get saved payment methods from store not context

* Mock stores and update tests to allow switching payment methods

* Update tests to get onSubmit from checkoutEventsContext

* Remove cartTotalsLoaded check from payment method initialize check

* Make PaymentMethods test wait until payments initialized

* initialize payment method data store when cart is loaded

* Remove unneeded actions and add initializePaymentMethodDataStore

* Remove check for cart totals loaded in checkPaymentMethods

* Remove updateAvilablePaymentMethods from registry

* Remove unneeded mock

* Remove unused import

* Rename imports to fix eslint errors

* Remove unused imports

* Remove return false from checkPaymentMethods

* Remove unnecessary setPaymentMethodsInitialized call

* Add todo comment to track refactoring opportunity

* Remove savedpayment methods from payment method context and rename it

* Rename payment method data context to payment method events context

* Add tests for setDefaultPaymentMethods

* Optimize the availablePaymentMethods state data

Store only the "name" attribute for now.

* Get list of payment methods from the registry instead of the store

We are using this hook to get some React elements in the payment method
object. So, we are getting the raw data directly from the registry instead
of the store.

* Fix payment state not loading on the Checkout edit page

* Handle checkout edit page case

* Fix infinite loop error on C&C Blocks

* Include @wordpress/redux-routine in transformIgnorePatterns jest config

Co-authored-by: Saad Tarhi <[email protected]>
alexflorisca pushed a commit that referenced this pull request Sep 28, 2022
…yment data store (#6669)

* Mock getCartTotals

* Change test to use data store instead of context

* Move payment method context test to data store selectors

* Change description of test suite

* Bump commit to trigger tests

* Fix path in test

* update package lock

* Set correct state payment method reducer tests/use correct actions

* Get saved payment methods from store not context

* Mock stores and update tests to allow switching payment methods

* Update tests to get onSubmit from checkoutEventsContext

* Remove cartTotalsLoaded check from payment method initialize check

* Make PaymentMethods test wait until payments initialized

* initialize payment method data store when cart is loaded

* Remove unneeded actions and add initializePaymentMethodDataStore

* Remove check for cart totals loaded in checkPaymentMethods

* Remove updateAvilablePaymentMethods from registry

* Remove unneeded mock

* Remove unused import

* Rename imports to fix eslint errors

* Remove unused imports

* Remove return false from checkPaymentMethods

* Remove unnecessary setPaymentMethodsInitialized call

* Add todo comment to track refactoring opportunity

* Remove savedpayment methods from payment method context and rename it

* Rename payment method data context to payment method events context

* Add tests for setDefaultPaymentMethods

* Optimize the availablePaymentMethods state data

Store only the "name" attribute for now.

* Get list of payment methods from the registry instead of the store

We are using this hook to get some React elements in the payment method
object. So, we are getting the raw data directly from the registry instead
of the store.

* Fix payment state not loading on the Checkout edit page

* Handle checkout edit page case

* Fix infinite loop error on C&C Blocks

* Include @wordpress/redux-routine in transformIgnorePatterns jest config

Co-authored-by: Saad Tarhi <[email protected]>
alexflorisca pushed a commit that referenced this pull request Sep 28, 2022
…yment data store (#6669)

* Mock getCartTotals

* Change test to use data store instead of context

* Move payment method context test to data store selectors

* Change description of test suite

* Bump commit to trigger tests

* Fix path in test

* update package lock

* Set correct state payment method reducer tests/use correct actions

* Get saved payment methods from store not context

* Mock stores and update tests to allow switching payment methods

* Update tests to get onSubmit from checkoutEventsContext

* Remove cartTotalsLoaded check from payment method initialize check

* Make PaymentMethods test wait until payments initialized

* initialize payment method data store when cart is loaded

* Remove unneeded actions and add initializePaymentMethodDataStore

* Remove check for cart totals loaded in checkPaymentMethods

* Remove updateAvilablePaymentMethods from registry

* Remove unneeded mock

* Remove unused import

* Rename imports to fix eslint errors

* Remove unused imports

* Remove return false from checkPaymentMethods

* Remove unnecessary setPaymentMethodsInitialized call

* Add todo comment to track refactoring opportunity

* Remove savedpayment methods from payment method context and rename it

* Rename payment method data context to payment method events context

* Add tests for setDefaultPaymentMethods

* Optimize the availablePaymentMethods state data

Store only the "name" attribute for now.

* Get list of payment methods from the registry instead of the store

We are using this hook to get some React elements in the payment method
object. So, we are getting the raw data directly from the registry instead
of the store.

* Fix payment state not loading on the Checkout edit page

* Handle checkout edit page case

* Fix infinite loop error on C&C Blocks

* Include @wordpress/redux-routine in transformIgnorePatterns jest config

Co-authored-by: Saad Tarhi <[email protected]>
senadir pushed a commit to senadir/woocommerce-blocks that referenced this pull request Nov 12, 2022
…yment data store (woocommerce#6669)

* Mock getCartTotals

* Change test to use data store instead of context

* Move payment method context test to data store selectors

* Change description of test suite

* Bump commit to trigger tests

* Fix path in test

* update package lock

* Set correct state payment method reducer tests/use correct actions

* Get saved payment methods from store not context

* Mock stores and update tests to allow switching payment methods

* Update tests to get onSubmit from checkoutEventsContext

* Remove cartTotalsLoaded check from payment method initialize check

* Make PaymentMethods test wait until payments initialized

* initialize payment method data store when cart is loaded

* Remove unneeded actions and add initializePaymentMethodDataStore

* Remove check for cart totals loaded in checkPaymentMethods

* Remove updateAvilablePaymentMethods from registry

* Remove unneeded mock

* Remove unused import

* Rename imports to fix eslint errors

* Remove unused imports

* Remove return false from checkPaymentMethods

* Remove unnecessary setPaymentMethodsInitialized call

* Add todo comment to track refactoring opportunity

* Remove savedpayment methods from payment method context and rename it

* Rename payment method data context to payment method events context

* Add tests for setDefaultPaymentMethods

* Optimize the availablePaymentMethods state data

Store only the "name" attribute for now.

* Get list of payment methods from the registry instead of the store

We are using this hook to get some React elements in the payment method
object. So, we are getting the raw data directly from the registry instead
of the store.

* Fix payment state not loading on the Checkout edit page

* Handle checkout edit page case

* Fix infinite loop error on C&C Blocks

* Include @wordpress/redux-routine in transformIgnorePatterns jest config

Co-authored-by: Saad Tarhi <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

skip-changelog PRs that you don't want to appear in the changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants