Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: payment provider and customer step in checkout #59

Merged
merged 13 commits into from
Aug 25, 2021

Conversation

Baroshem
Copy link
Contributor

@Baroshem Baroshem commented Aug 24, 2021

Description

Closes #56
Closes #57

I decided to release these two functionalities as one purely because payment wont work without customer step.

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@Baroshem Baroshem changed the title feat: payment provider and customer step in checkout feat: payment provider and customer step in checkout [WIP] Aug 24, 2021
@Baroshem Baroshem changed the base branch from main to feat-#49/shipping-billing August 24, 2021 07:12
Copy link
Collaborator

@michaelbromley michaelbromley left a comment

Choose a reason for hiding this comment

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

The queries look good to me.

@Baroshem Baroshem changed the title feat: payment provider and customer step in checkout [WIP] feat: payment provider and customer step in checkout Aug 25, 2021
Comment on lines +16 to +22
const request = await context.client.mutate({
mutation: gql`${setCustomerForOrder.query}`,
variables: setCustomerForOrder.variables,
fetchPolicy: NO_CACHE_FETCH_POLICY
}) as SetCustomerForOrderResponse;

return request;

Choose a reason for hiding this comment

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

You can simplify that.

Suggested change
const request = await context.client.mutate({
mutation: gql`${setCustomerForOrder.query}`,
variables: setCustomerForOrder.variables,
fetchPolicy: NO_CACHE_FETCH_POLICY
}) as SetCustomerForOrderResponse;
return request;
return await context.client.mutate({
mutation: gql`${setCustomerForOrder.query}`,
variables: setCustomerForOrder.variables,
fetchPolicy: NO_CACHE_FETCH_POLICY
}) as SetCustomerForOrderResponse;

Copy link

@Mateuszpietrusinski Mateuszpietrusinski left a comment

Choose a reason for hiding this comment

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

Good job 👏

Comment on lines +14 to +19
const request = await context.client.query<RequestDataStructure<'eligiblePaymentMethods', PaymentMethodQuote[]>>({
query: gql`${eligiblePaymentMethods.query}`,
variables: eligiblePaymentMethods.variables,
fetchPolicy: NO_CACHE_FETCH_POLICY
});
return request;

Choose a reason for hiding this comment

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

Suggested change
const request = await context.client.query<RequestDataStructure<'eligiblePaymentMethods', PaymentMethodQuote[]>>({
query: gql`${eligiblePaymentMethods.query}`,
variables: eligiblePaymentMethods.variables,
fetchPolicy: NO_CACHE_FETCH_POLICY
});
return request;
return await context.client.query<RequestDataStructure<'eligiblePaymentMethods', PaymentMethodQuote[]>>({
query: gql`${eligiblePaymentMethods.query}`,
variables: eligiblePaymentMethods.variables,
fetchPolicy: NO_CACHE_FETCH_POLICY
});

Comment on lines +21 to +27
const request = await context.client.mutate({
mutation: gql`${addPaymentToOrder.query}`,
variables: addPaymentToOrder.variables,
fetchPolicy: NO_CACHE_FETCH_POLICY
}) as SetShippingMethodResponse;

return request;

Choose a reason for hiding this comment

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

Redundant variable

Suggested change
const request = await context.client.mutate({
mutation: gql`${addPaymentToOrder.query}`,
variables: addPaymentToOrder.variables,
fetchPolicy: NO_CACHE_FETCH_POLICY
}) as SetShippingMethodResponse;
return request;
return await context.client.mutate({
mutation: gql`${addPaymentToOrder.query}`,
variables: addPaymentToOrder.variables,
fetchPolicy: NO_CACHE_FETCH_POLICY
}) as SetShippingMethodResponse;

Comment on lines +16 to +22
const request = await context.client.mutate({
mutation: gql`${transitionOrderToState.query}`,
variables: transitionOrderToState.variables,
fetchPolicy: NO_CACHE_FETCH_POLICY
}) as TransitionOrderToState;

return request;

Choose a reason for hiding this comment

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

Suggested change
const request = await context.client.mutate({
mutation: gql`${transitionOrderToState.query}`,
variables: transitionOrderToState.variables,
fetchPolicy: NO_CACHE_FETCH_POLICY
}) as TransitionOrderToState;
return request;
return await context.client.mutate({
mutation: gql`${transitionOrderToState.query}`,
variables: transitionOrderToState.variables,
fetchPolicy: NO_CACHE_FETCH_POLICY
}) as TransitionOrderToState;

Comment on lines +137 to +142
router: {
extendRoutes(routes) {
getRoutes(`${__dirname}/_theme`)
.forEach((route) => routes.unshift(route));
}
},

Choose a reason for hiding this comment

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

Is that neccessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I need to have a checkout flow start from customer not shipping and in order to do that I have to extend default routes.

@Baroshem Baroshem merged commit d87a589 into feat-#49/shipping-billing Aug 25, 2021
@Baroshem Baroshem mentioned this pull request Aug 25, 2021
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants