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

Update payment registration config to include edit components #1928

Merged
merged 5 commits into from
Mar 10, 2020

Conversation

nerrad
Copy link
Contributor

@nerrad nerrad commented Mar 10, 2020

This extracts payment method registration configuration changes from #1780.

We won't want to load payment methods fully in the editor context because that will include unnecessary weight for the page when full payment functionality is not required. So payment method registration includes a configuration for edit that allows payment methods to registry components that are only loaded in the editor context.

This allows for things like:

  • testing for requirements and ensuring they are setup.
  • potentially embedding/modifying configuration for payment methods right in the editor context (as opposed to a separate page)
  • previewing what a setup payment method looks like.

In this pull I implemented the configuration changes including updating our demos and the the checkout payment method components.

I also included updating the CheckoutContextProvider so it receives (and exposes) an isEditor prop for indicating context in which the checkout is used. This, then will allow any child component to read this value from the checkout context and use it for determining alternative behaviour. In this particular pull, this is used to choose which payment method component is loaded from registered payment method configurations.

To test

There is no new user facing functionality in this pull. It is all developer side focused. Testing simply verifies there are no errors when loading the checkout block in the frontend or the backend.

@nerrad nerrad requested a review from a team as a code owner March 10, 2020 15:58
@nerrad nerrad requested review from senadir and a team and removed request for a team March 10, 2020 15:58
@nerrad nerrad self-assigned this Mar 10, 2020
@nerrad nerrad added focus: blocks Specific work involving or impacting how blocks behave. skip-changelog PRs that you don't want to appear in the changelog. type: enhancement The issue is a request for an enhancement. labels Mar 10, 2020
@nerrad nerrad added this to the Future Release milestone Mar 10, 2020
Copy link
Contributor

@Aljullu Aljullu left a comment

Choose a reason for hiding this comment

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

Looking good. Just one comment regarding the order of the arguments of one function that I needed to change to get it to work, but if that's addressed it should be good to go. 👍

currentPaymentMethods.current,
selectedTab,
isEditor
);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the order of the arguments is not correct here. Shouldn't selectedTab be the first one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ooo good catch!

@nerrad nerrad merged commit 7df9625 into master Mar 10, 2020
@nerrad nerrad deleted the update/payment-registration-config-changes branch March 10, 2020 16:35
@nerrad nerrad modified the milestones: Future Release, 2.6.0 Apr 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
focus: blocks Specific work involving or impacting how blocks behave. skip-changelog PRs that you don't want to appear in the changelog. type: enhancement The issue is a request for an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants