Browse Source

fix(core): Allow an Order in ArrangingAdditionalPayment to be cancelled

Fixes #1177
Michael Bromley 4 years ago
parent
commit
3e1a3cf01a

+ 3 - 0
packages/core/src/service/helpers/order-state-machine/order-state-machine.ts

@@ -90,6 +90,9 @@ export class OrderStateMachine {
             }
             }
         }
         }
         if (fromState === 'ArrangingAdditionalPayment') {
         if (fromState === 'ArrangingAdditionalPayment') {
+            if (toState === 'Cancelled') {
+                return;
+            }
             const existingPayments = await this.connection.getRepository(data.ctx, Payment).find({
             const existingPayments = await this.connection.getRepository(data.ctx, Payment).find({
                 relations: ['refunds'],
                 relations: ['refunds'],
                 where: {
                 where: {