fix(payment): allow new orders after paid state
This commit is contained in:
@@ -270,6 +270,37 @@ export const paymentMachine = setup({
|
|||||||
|
|
||||||
paid: {
|
paid: {
|
||||||
on: {
|
on: {
|
||||||
|
PaymentPlanSelected: {
|
||||||
|
target: "ready",
|
||||||
|
actions: assign(({ event }) => ({
|
||||||
|
...resetOrderState(),
|
||||||
|
selectedPlanId: event.planId,
|
||||||
|
autoRenew: defaultAutoRenewForPlan(event.planId),
|
||||||
|
})),
|
||||||
|
},
|
||||||
|
PaymentPayChannelChanged: {
|
||||||
|
target: "ready",
|
||||||
|
actions: assign(({ event }) => ({
|
||||||
|
...resetOrderState(),
|
||||||
|
payChannel: event.payChannel,
|
||||||
|
errorMessage: null,
|
||||||
|
})),
|
||||||
|
},
|
||||||
|
PaymentCreateOrderSubmitted: [
|
||||||
|
{
|
||||||
|
guard: ({ context }) =>
|
||||||
|
context.agreed && context.selectedPlanId.length > 0,
|
||||||
|
target: "creatingOrder",
|
||||||
|
actions: assign(resetOrderState),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
target: "ready",
|
||||||
|
actions: assign({
|
||||||
|
errorMessage:
|
||||||
|
"Choose a plan and accept the agreement before continuing.",
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
],
|
||||||
PaymentReset: {
|
PaymentReset: {
|
||||||
target: "ready",
|
target: "ready",
|
||||||
actions: assign(resetOrderState),
|
actions: assign(resetOrderState),
|
||||||
|
|||||||
Reference in New Issue
Block a user