Commit Graph

14 Commits

Author SHA1 Message Date
Alex Florisca c9109183b8 Remove CustomerDataContext (https://github.com/woocommerce/woocommerce-blocks/pull/7686)
* Remove CustomerDataContext

* bot: update checkstyle.xml

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-11-24 14:20:44 +00:00
Thomas Roberts 7f8be00f74 Add tests to ensure argument passed to `canMakePayment` is correct (https://github.com/woocommerce/woocommerce-blocks/pull/7478)
* Add tests to ensure argument passed to canMakePayment is correct

* bot: update checkstyle.xml

* bot: update checkstyle.xml

* Fix import and type after rebase

* bot: update checkstyle.xml

* Trigger Build

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-11-21 04:13:24 -08:00
Alex Florisca a73d6af443 Move paymentResult to the payment store (https://github.com/woocommerce/woocommerce-blocks/pull/7692)
* Move paymentResult to the payment store

* bot: update checkstyle.xml

* Update docs

* Fix typerror

* bot: update checkstyle.xml

* bot: update checkstyle.xml

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Tarun Vijwani <tarun.vijwani@automattic.com>
2022-11-18 12:13:00 +00:00
Alex Florisca ddd0cc2300 Move payment utils and delete orderPaymentMethods (https://github.com/woocommerce/woocommerce-blocks/pull/7679)
* Moved all payment utils functions in a utils folder

* Delete  as it's not being used

* bot: update checkstyle.xml

* bot: update checkstyle.xml

* Fix TS error

* bot: update checkstyle.xml

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-11-16 09:38:48 +00:00
Alex Florisca bf8d56ec72 Refactor the payment status (https://github.com/woocommerce/woocommerce-blocks/pull/7666)
* Add actions and selectors for new paymemt status

* Remove set_complete from reducer

* Replace all usages of getCurrentStatus with specific sepectors

* Replace all `setCurrentStatus` with individual actions

* Update docs

* Removed currentStatus

* bot: update checkstyle.xml

* Update docs/third-party-developers/extensibility/data-store/payment.md

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>

* Address Thomas feedback

* Add link to deprecated message

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
2022-11-15 12:27:39 +00:00
Alex Florisca fc44b9fc4d Remove the experimental flag that's used to include thunks in wp.data (https://github.com/woocommerce/woocommerce-blocks/pull/7617)
* Remove the experimental flag that's used to include thunks in wp.data

* bot: update checkstyle.xml

* Fix ts error from previous PR

* bot: update checkstyle.xml

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-11-14 09:07:49 +00:00
dependabot[bot] 9a7f1e17e1 Bump @woocommerce/eslint-plugin from 2.0.0 to 2.2.0 (https://github.com/woocommerce/woocommerce-blocks/pull/6837)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-11-12 02:14:18 +07:00
Alex Florisca 9fa34effce Remove paymentStatuses, isDoingExpressPayment and isExpressPaymentMethodActive from the payment store state (https://github.com/woocommerce/woocommerce-blocks/pull/7643)
* Remove isExpressPaymentMethodActive and paymentStatus.isDoingExpressPayment from the payment store

* Remove uneccessary paymentStatuses key from the payments store
2022-11-10 16:15:31 +00:00
Alex Florisca fd0ab2331b Improve the performance of checking payment methods (https://github.com/woocommerce/woocommerce-blocks/pull/7413)
* Improve the performance of checking payment methods

* Use the default names of imports from @wordpress/data

* Fix circular dependency

* Fix __internalUpdateAvailablePaymentMethods

Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
2022-10-25 14:21:11 +01:00
Thomas Roberts 1eda6f8f3d Fix wrong keys being sent in `canMakePayment` and customer data showing in the Checkout block in the editor (https://github.com/woocommerce/woocommerce-blocks/pull/7434)
* Construct args for canMakePayment with correct keys

* When the CheckoutEventsContext mounts, initialize payment store

* Destructure useSelect correctly

* Dispatch __internalInitializePaymentStore in selector tests

* Update selector name to __internalUpdateAvailablePaymentMethods

* Remove check for editor when registering checkout store

* Add check for when express payment methods have updated too

* Ensure billingAddress key exists in canMakePayment arg

* Use editor context to know if we're in editor
2022-10-20 08:02:43 -07:00
Alex Florisca 48c450c469 Remove duplicate shouldSavePaymentMethod selector (https://github.com/woocommerce/woocommerce-blocks/pull/7381) 2022-10-19 04:48:04 -07:00
Thomas Roberts c798378edf Prevent resetting default payment method if available payment method is still available (https://github.com/woocommerce/woocommerce-blocks/pull/7276)
* Refresh the default payment method only if the active one is unavailable

* Add new type for serializable data store payment method

* Update uses of PaymentMethods/ExpressPaymentMethods to the plain version

* Add tests for setAvailablePaymentMethods action

* Update data store key  in tests
2022-10-07 10:32:17 -07:00
Alex Florisca 7bf79f33d9 Rename payment-method-data-context to payment-events-context and PAYMENT_METHOD_DATA_STORE_KEY to PAYMENT_STORE_KEY (https://github.com/woocommerce/woocommerce-blocks/pull/7304)
* Rename payment-method-data-context to payment-event-context and tidy up types and things

* Rename uses of PAYMENT_METHOD_DATA_STORE_KEY to PAYMENT_STORE_KEY

* Rename __internalInitializePaymentMethodDataStore and unsubscribeInitializePaymentMethodDataStore

* Rename unsubscribeInitializePaymentMethodDataStore
2022-10-06 13:46:46 +01:00
Thomas Roberts df3b785244 Rename `wc/store/payment-methods` to `wc/store/payment` (https://github.com/woocommerce/woocommerce-blocks/pull/7267)
* Rename wc/store/payment-methods to wc/store/payment

* Rename folder to payment

Co-authored-by: Alex Florisca <alex.florisca@automattic.com>
2022-10-05 13:01:56 +01:00