* use cart data to provide country and currency_code
* remove files that likely got added back in from a bad rebase.
* modify canMakePayment config property so it must be a function
* Feed cart data to registered payment methods `canMakePayment` function.
This can then be used by payment methods for determining whether to show the payment method or not.
* implement new canMakePayment signature for cheque
Now canMakePayment doesn’t need to be a promise (payment method registry will handle wrapping all values in a promise to treat them as promises.
* implement canMakePayment as a function
* add logic allowing payment method to be overridden via payment data in request
* hook in to trigger server side processing of stripe payment request
* improvements to shipping data context
- memoize event emitters
- split up emitted events (reduces how often events trigger)
- Include whether rate is being selected in exported data.
* expose `isSelectingRate` value to payment method interface
* fix typo in shipping emitters for emitter type
* include setting of shipping data in payment method success status call
- this also requires changing the nested order of providers in checkout provider
* fix priority logic for event emitters.
- lower priority is supposed to fire before higher priority.
* normalize postal code for comparisons
* move normalize functions into stripe-utils folder
* refactor stripePromise so that it provides a specific instance to each payment method.
This also provides it as a prop to the pm components.
* renadme apple pay express to payment request express
This adds full support for the stripe payment request api instead of just applePay (so GooglePay, MicrosoftPay and ApplePay are now supported).
Also adds numerous fixes to internal logic.
* add handling to skip core checkout validation logic if express payment method is handling payment
Express payment methods have their own internal validation so this removes the need for checkout validating fields. This is also necessary because checkout validation breaks the flow when making a payment using express payment methods because of the order of the flow for these methods.
* splitting out emmitter effects for checkout and improving logic
Splitting up effects limits the potential for firing off emitters more than needed.
* remove unnecessary ref definitions
* fix on cancel action erroring for payment request modal
* ensure unique stripe object for component and canPay
* set default total label if one isn’t configured on the server
* fix order of state changes
* simplify condition
* remove unnecessary dependency
* normalize to uppercase too
* simplify can make payment conditional
* update comment blocks
* remove calculating as a checkout status (making it separate)
* include checkout is calculating for determining whether to flip payment status to process
* only change payment method state for status changes if needed
* fix reducer for shipping state
* include checkoutIsCalculating for determining whether to show validation errors in checkout block
* change where currentStatus is defined
* fix bug with saved payment method option
* Counting helpers for shipping rates and packages
* Use new helpers
* Make shipping calculator use shipping context directly
* Totals should use current address
* Avoid useShippingRates
* Return rates and other items from useShippingRatse in useStoreCart instead
* Update tests
* Merge conflict
* Merge conflict
* Rest API - Ensure totals are up to date on init
* Update cart controller to bail if the cart does not need shipping
* Update todos and wc supported version to match status of core
* Add todos
* Fix customer address population
* exit early
* Only show descriptions if shipping/payment methods > 1
* Hide descriptions if no description text is set
* Fix object length
* methods->options
* Counting helpers for shipping rates and packages
* Use new helpers
* move preview to editor data and alias it no nothing in frontend builds
* seperate context and provider
* pass previewData as a prop to provider
* address comments
* Add customer ID to checkout API response
* Add customer ID to checkout context
* Show/hide remember payment checkbox based on checkout context
* Pass via payment interface instead
* Missing commas
* disable continue to checkout if item is being removed
* rename isPending and selectors/actions to isPendingDelete
* switch itemPendingDelete params order
* change to watching quantity changes not removal
* yield RECEIVE_REMOVED_ITEM
* update types and add return to select
* update tests
* switch params back
* only delete item after response from server
* update tests
* handle errors and unrelated unmounts
* disable row if is loading
* Make validation errors appear
* Make validation errors appear all at once
* Simplify diff
* Expose shippingErrorStatus from shipping context
* Memoize currentErrorStatus
* Pass currentErrorStatus to observers
* Add missing type-def property
* Fix typo in constant name
* Refactor emitEvent so false responses don't return true
* Make onCheckoutProcessing observers return errorMessage and validationErrors properties
* Move no-shipping-placeholder to block - allow pointer events
* Allow payments placeholder to have pointer events
* Enable pointer events for children
* Wrap checkout with disabled
* remove usage of paymentstatus dispatcher from apple pay
* add type-def for payment data response objects
* make sure shape of payment data for stripe cc is as server expects
* include payment data in checkout processor request
* fix bug that got reintroduced in rebase
* rename typedef
* Add interface for setting an express payment error notice.
* fix typedefs
* remove usage of paymentstatus dispatcher from stripe cc
* remove usage of paymentstatus dispatcher from apple pay
* remove any existing express payment notice on click
* revert buggy change with abort payment call
- also ensure that completePayment sets applePayProcessing to false
* Switch add to cart events to useStoreCart hook
* Add to cart endpoint
* Inject dependenct schemas
* Feedback, cart items are based on product schema
* Variable typo
* Move hook to base
* Update totals correcrly
* Update tests to use schema/routes class
* Update tests to correctly use schema
* Remove type hint to prevent strict standards error
* Allow for priority to be set on event emitters
* Add payment event emitters
* add new actions/status to checkout state context
* implement event emitters in payment data context
* refactor checkout state context to use new actions in event emitters
* refactor checkout processor to handle new event emitters
* fix type-defs for registered payment methods
* register observer for cheque payment method integration
* add inline todo
* fix sort
* fix tests and add test for priority usage in event emitters
* remove todo and just add explanatory comment
* condense sort logic
* lowercase test description
* abstract emitter callback to reduce code
* don’t process passed in errors if it’s undefined
* improve error response expectation for payment processing event observer
* Added cheque gateway and payment method registration system
Fix promises
Remove log
Use status, not checkoutstate
Bug @nerrad showed me
Payment method type registry
Refactor integrations to register themselves.
Stripe and Cheque Integrations/registration
Splt gateways into separate files on build
Add settings from server to cheque gateway
Merge apple and credit card stripe scripts
* Missing files from rebase
* Tweaks to payment-methods-registry (https://github.com/woocommerce/woocommerce-blocks/pull/2091)
* Small tweaks and docblock updates
* Handle undefined settings
* rebase fix
* Simplify promise
* Remove filesuffix for payment methods config
* Fix typo
* Rebase fix
* Update cart and block actions
* Add woocommerce_blocks_payment_method_type_registration
* Missing method names
* Missing name in stripe
* replace actions with script dependencies
* Scripts are needed in admin context too, by default
* Put back the hooks...
* Add is_active check to see if assets need to be enqueued or not
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>