-
Notifications
You must be signed in to change notification settings - Fork 51
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
feat: payment provider and customer step in checkout #59
Conversation
There was a problem hiding this 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.
const request = await context.client.mutate({ | ||
mutation: gql`${setCustomerForOrder.query}`, | ||
variables: setCustomerForOrder.variables, | ||
fetchPolicy: NO_CACHE_FETCH_POLICY | ||
}) as SetCustomerForOrderResponse; | ||
|
||
return request; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can simplify that.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job 👏
const request = await context.client.query<RequestDataStructure<'eligiblePaymentMethods', PaymentMethodQuote[]>>({ | ||
query: gql`${eligiblePaymentMethods.query}`, | ||
variables: eligiblePaymentMethods.variables, | ||
fetchPolicy: NO_CACHE_FETCH_POLICY | ||
}); | ||
return request; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 | |
}); |
const request = await context.client.mutate({ | ||
mutation: gql`${addPaymentToOrder.query}`, | ||
variables: addPaymentToOrder.variables, | ||
fetchPolicy: NO_CACHE_FETCH_POLICY | ||
}) as SetShippingMethodResponse; | ||
|
||
return request; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant variable
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; |
const request = await context.client.mutate({ | ||
mutation: gql`${transitionOrderToState.query}`, | ||
variables: transitionOrderToState.variables, | ||
fetchPolicy: NO_CACHE_FETCH_POLICY | ||
}) as TransitionOrderToState; | ||
|
||
return request; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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; |
router: { | ||
extendRoutes(routes) { | ||
getRoutes(`${__dirname}/_theme`) | ||
.forEach((route) => routes.unshift(route)); | ||
} | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that neccessary?
There was a problem hiding this comment.
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.
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
Checklist: