wallet-core: fix some deposit transitions
This commit is contained in:
parent
a844136489
commit
5af24c1e88
@ -224,21 +224,30 @@ export async function suspendDepositGroup(
|
||||
return undefined;
|
||||
}
|
||||
const oldState = computeDepositTransactionStatus(dg);
|
||||
let newOpStatus: DepositOperationStatus | undefined;
|
||||
switch (dg.operationStatus) {
|
||||
case DepositOperationStatus.Finished:
|
||||
case DepositOperationStatus.PendingDeposit:
|
||||
newOpStatus = DepositOperationStatus.SuspendedDeposit;
|
||||
break;
|
||||
case DepositOperationStatus.PendingKyc:
|
||||
newOpStatus = DepositOperationStatus.SuspendedKyc;
|
||||
break;
|
||||
case DepositOperationStatus.PendingTrack:
|
||||
newOpStatus = DepositOperationStatus.SuspendedTrack;
|
||||
break;
|
||||
case DepositOperationStatus.Aborting:
|
||||
newOpStatus = DepositOperationStatus.SuspendedAborting;
|
||||
break;
|
||||
}
|
||||
if (!newOpStatus) {
|
||||
return undefined;
|
||||
case DepositOperationStatus.PendingDeposit: {
|
||||
dg.operationStatus = DepositOperationStatus.SuspendedDeposit;
|
||||
}
|
||||
dg.operationStatus = newOpStatus;
|
||||
await tx.depositGroups.put(dg);
|
||||
return {
|
||||
oldTxState: oldState,
|
||||
newTxState: computeDepositTransactionStatus(dg),
|
||||
};
|
||||
}
|
||||
case DepositOperationStatus.SuspendedDeposit:
|
||||
return undefined;
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
stopLongpolling(ws, retryTag);
|
||||
notifyTransition(ws, transactionId, transitionInfo);
|
||||
@ -263,21 +272,30 @@ export async function resumeDepositGroup(
|
||||
return;
|
||||
}
|
||||
const oldState = computeDepositTransactionStatus(dg);
|
||||
let newOpStatus: DepositOperationStatus | undefined;
|
||||
switch (dg.operationStatus) {
|
||||
case DepositOperationStatus.Finished:
|
||||
return;
|
||||
case DepositOperationStatus.PendingDeposit: {
|
||||
return;
|
||||
}
|
||||
case DepositOperationStatus.SuspendedDeposit:
|
||||
dg.operationStatus = DepositOperationStatus.PendingDeposit;
|
||||
newOpStatus = DepositOperationStatus.PendingDeposit;
|
||||
break;
|
||||
case DepositOperationStatus.SuspendedAborting:
|
||||
newOpStatus = DepositOperationStatus.Aborting;
|
||||
break;
|
||||
case DepositOperationStatus.SuspendedKyc:
|
||||
newOpStatus = DepositOperationStatus.PendingKyc;
|
||||
break;
|
||||
case DepositOperationStatus.SuspendedTrack:
|
||||
newOpStatus = DepositOperationStatus.PendingTrack;
|
||||
break;
|
||||
}
|
||||
if (!newOpStatus) {
|
||||
return undefined;
|
||||
}
|
||||
dg.operationStatus = newOpStatus;
|
||||
await tx.depositGroups.put(dg);
|
||||
return {
|
||||
oldTxState: oldState,
|
||||
newTxState: computeDepositTransactionStatus(dg),
|
||||
};
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
ws.workAvailable.trigger();
|
||||
notifyTransition(ws, transactionId, transitionInfo);
|
||||
|
Loading…
Reference in New Issue
Block a user