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;
|
return undefined;
|
||||||
}
|
}
|
||||||
const oldState = computeDepositTransactionStatus(dg);
|
const oldState = computeDepositTransactionStatus(dg);
|
||||||
|
let newOpStatus: DepositOperationStatus | undefined;
|
||||||
switch (dg.operationStatus) {
|
switch (dg.operationStatus) {
|
||||||
case DepositOperationStatus.Finished:
|
case DepositOperationStatus.PendingDeposit:
|
||||||
return undefined;
|
newOpStatus = DepositOperationStatus.SuspendedDeposit;
|
||||||
case DepositOperationStatus.PendingDeposit: {
|
break;
|
||||||
dg.operationStatus = DepositOperationStatus.SuspendedDeposit;
|
case DepositOperationStatus.PendingKyc:
|
||||||
await tx.depositGroups.put(dg);
|
newOpStatus = DepositOperationStatus.SuspendedKyc;
|
||||||
return {
|
break;
|
||||||
oldTxState: oldState,
|
case DepositOperationStatus.PendingTrack:
|
||||||
newTxState: computeDepositTransactionStatus(dg),
|
newOpStatus = DepositOperationStatus.SuspendedTrack;
|
||||||
};
|
break;
|
||||||
}
|
case DepositOperationStatus.Aborting:
|
||||||
case DepositOperationStatus.SuspendedDeposit:
|
newOpStatus = DepositOperationStatus.SuspendedAborting;
|
||||||
return undefined;
|
break;
|
||||||
}
|
}
|
||||||
return undefined;
|
if (!newOpStatus) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
dg.operationStatus = newOpStatus;
|
||||||
|
await tx.depositGroups.put(dg);
|
||||||
|
return {
|
||||||
|
oldTxState: oldState,
|
||||||
|
newTxState: computeDepositTransactionStatus(dg),
|
||||||
|
};
|
||||||
});
|
});
|
||||||
stopLongpolling(ws, retryTag);
|
stopLongpolling(ws, retryTag);
|
||||||
notifyTransition(ws, transactionId, transitionInfo);
|
notifyTransition(ws, transactionId, transitionInfo);
|
||||||
@ -263,21 +272,30 @@ export async function resumeDepositGroup(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const oldState = computeDepositTransactionStatus(dg);
|
const oldState = computeDepositTransactionStatus(dg);
|
||||||
|
let newOpStatus: DepositOperationStatus | undefined;
|
||||||
switch (dg.operationStatus) {
|
switch (dg.operationStatus) {
|
||||||
case DepositOperationStatus.Finished:
|
|
||||||
return;
|
|
||||||
case DepositOperationStatus.PendingDeposit: {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
case DepositOperationStatus.SuspendedDeposit:
|
case DepositOperationStatus.SuspendedDeposit:
|
||||||
dg.operationStatus = DepositOperationStatus.PendingDeposit;
|
newOpStatus = DepositOperationStatus.PendingDeposit;
|
||||||
await tx.depositGroups.put(dg);
|
break;
|
||||||
return {
|
case DepositOperationStatus.SuspendedAborting:
|
||||||
oldTxState: oldState,
|
newOpStatus = DepositOperationStatus.Aborting;
|
||||||
newTxState: computeDepositTransactionStatus(dg),
|
break;
|
||||||
};
|
case DepositOperationStatus.SuspendedKyc:
|
||||||
|
newOpStatus = DepositOperationStatus.PendingKyc;
|
||||||
|
break;
|
||||||
|
case DepositOperationStatus.SuspendedTrack:
|
||||||
|
newOpStatus = DepositOperationStatus.PendingTrack;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return undefined;
|
if (!newOpStatus) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
dg.operationStatus = newOpStatus;
|
||||||
|
await tx.depositGroups.put(dg);
|
||||||
|
return {
|
||||||
|
oldTxState: oldState,
|
||||||
|
newTxState: computeDepositTransactionStatus(dg),
|
||||||
|
};
|
||||||
});
|
});
|
||||||
ws.workAvailable.trigger();
|
ws.workAvailable.trigger();
|
||||||
notifyTransition(ws, transactionId, transitionInfo);
|
notifyTransition(ws, transactionId, transitionInfo);
|
||||||
|
Loading…
Reference in New Issue
Block a user