-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
fix(js-sdk, medusa): Allow users to change their mind during the checkout process #10671
base: develop
Are you sure you want to change the base?
fix(js-sdk, medusa): Allow users to change their mind during the checkout process #10671
Conversation
…te the payment collection accordingly - refresh the payment collection on every POST request in the API (makes use of the pre-existing workflow that only creates a new collection if the existing one is out of sync with the cart) - change the frontend library to request a check of the payment collection everytime before initializing a payment session
|
@damianr13 is attempting to deploy a commit to the medusajs Team on Vercel. A member of the Team first needs to authorize it. |
Thanks @damianr13, let me get back to you on this. 🤞🏻 |
await this.client.fetch<HttpTypes.StorePaymentCollectionResponse>( | ||
`/store/payment-collections`, | ||
{ | ||
method: "POST", | ||
headers, | ||
body: collectionBody, | ||
} | ||
) | ||
).payment_collection.id |
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.
sugg: you can return this function directly and remove the Get from underneath
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.
Are they equivalent though? One is a payment collection the other is a payment session.
Before my changes they were still called together but only when the payment collection id was not defined.
await refreshPaymentCollectionForCartWorkflow(req.scope).run({ | ||
input: { cart_id }, | ||
}) | ||
paymentCollection = await getPaymentCollectionForCart(req) |
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.
sugg: can you remove this function here and add this on line 48 instead:
const paymentCollection = await refetchEntity(
"payment_collection",
cartCollectionRelation?.payment_collection?.id,
req.scope,
req.remoteQueryConfig.fields
)
@damianr13 i have a similar issue when customer choose shipping method for his cart and change his mind.
Here the error triggered when add NEW item in the cart :
|
…and update the payment collection accordingly
Addresses #10670