-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Paying again for the order is too complicated #753
Comments
It seems that state
In this case we will hop to |
Did you take a look at the
This may be useful to you since it expects the order to be in the |
OK, but this method is not exposed via GQL to frontend. As we discussed on Slack we took the most safe way to do it - we are changing active order in session and then move on with typical |
How did you change the active order in the session? @michaelbromley |
The whole order/checkout flow assumes that there is always a single active order. Adding an
This is because if the Order is in the
In this scenario, are you talking about when a customer places an order, then comes to pick it up and decides at that point to modify the order? |
Thanks, I understand the way you designed the order flow and overall it works great. What I mean is e.g: In the simplest terms: if an order has not been paid yet there should always be an option for the administrator to fulfill the payment (which as you said is not self-evident due to the order design) |
OK, thanks for the clarification. Yes - reality indeed has a habit of not conforming to our perfect designs 😆 This is something we should support. I plan to add this functionality. |
Sorry @stefanvanherwijnen missed your question.
We exposed new gql mutation in ShopApi: @VendurePlugin({
imports: [
PluginCommonModule
],
shopApiExtensions: {
schema: gql`
extend type Mutation {
setActiveOrder(id: ID!): Boolean
}
`,
resolvers: [
ActiveOrderResolver
]
}
}) Which does simple job: @Mutation()
@Allow(Permission.Authenticated)
setActiveOrder(@Ctx() ctx: RequestContext, @Args('id') orderId: number): Promise<boolean> {
if (!ctx?.activeUserId) {
return Promise.resolve(false);
}
return this.orderService.findOne(ctx, orderId).then((order) => {
if (order && order.customer?.user?.id === ctx.activeUserId
&& (
order.state === 'ArrangingAdditionalPayment' ||
order.state === 'ArrangingPayment'
)
) {
order.active = true;
return this.orderRepository.save(order).then(() => {
return true;
})
}
return false;
})
} Front calls it on invalid payment order (user is clicking "pay once again") and then adds new payment to this order. |
Hi all, I'm finally revisiting this to wrap it up and make sure we have all cases handled. I just implemented a couple of changes which will allow the Administrator to manually add a payment, as requested by @stefanvanherwijnen: admin-manual-payment.mp4The concrete change is that the Now I want to make sure I fully understand the original issue from @s3m3n:
I am not 100% clear on how the order gets into the state which causes the issue. Can you lay out step-by-step instructions of how to recreate the bad state? |
This issue seems to be fixed with this comment. For additional issues I propose opening a new issue. |
In our case customer fails with payment of any reason - he could have no battery on smartphone to approve transaction on time. We want him to try again right away, he's paying customer, he's gold for us.
Unfortunately Vendure is not easy on developer to support this simple scenario as ShopApi does not allow to add payment to historical Order, only the active one known from session. Additionally there is Order state
ArrangingAdditionalPayment
available, seems to be perfect in such situation but it's not available in natural flow, you must reachModifying
state first which is typical for Admin and then transition toArrangingAdditionalPayment
.Our ideas how to achieve this:
PaymentAuthorised
toArrangingAdditionalPayment
. When our payment controller receives info that the payment is declined it would transition the Order to the new state right away. Front knows exactly what to do with such order.addPaymentToOrder
ORI think this should be easier as we all want Vendure to be the best e-commerce engine ever!
The text was updated successfully, but these errors were encountered: