aboutsummaryrefslogtreecommitdiff
path: root/packages/demobank-ui/src/pages/OperationState/views.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'packages/demobank-ui/src/pages/OperationState/views.tsx')
-rw-r--r--packages/demobank-ui/src/pages/OperationState/views.tsx35
1 files changed, 21 insertions, 14 deletions
diff --git a/packages/demobank-ui/src/pages/OperationState/views.tsx b/packages/demobank-ui/src/pages/OperationState/views.tsx
index a02bb3bbd..98eb7169f 100644
--- a/packages/demobank-ui/src/pages/OperationState/views.tsx
+++ b/packages/demobank-ui/src/pages/OperationState/views.tsx
@@ -96,45 +96,52 @@ export function NeedConfirmationView({ error, onAbort: doAbort, onConfirm: doCon
async function onConfirm() {
errorHandler(async () => {
if (!doConfirm) return;
- const hasError = await doConfirm()
- if (!hasError) {
+ const resp = await doConfirm()
+ if (!resp) {
if (!settings.showWithdrawalSuccess) {
notifyInfo(i18n.str`Wire transfer completed!`)
}
return
}
- switch (hasError.case) {
+ switch (resp.case) {
case TalerErrorCode.BANK_CONFIRM_ABORT_CONFLICT: return notify({
type: "error",
title: i18n.str`The withdrawal has been aborted previously and can't be confirmed`,
- description: hasError.detail.hint as TranslatedString,
- debug: hasError.detail,
+ description: resp.detail.hint as TranslatedString,
+ debug: resp.detail,
})
case TalerErrorCode.BANK_CONFIRM_INCOMPLETE: return notify({
type: "error",
title: i18n.str`The withdraw operation cannot be confirmed because no exchange and reserve public key selection happened before`,
- description: hasError.detail.hint as TranslatedString,
- debug: hasError.detail,
+ description: resp.detail.hint as TranslatedString,
+ debug: resp.detail,
})
case HttpStatusCode.BadRequest: return notify({
type: "error",
title: i18n.str`The operation id is invalid.`,
- description: hasError.detail.hint as TranslatedString,
- debug: hasError.detail,
+ description: resp.detail.hint as TranslatedString,
+ debug: resp.detail,
});
case HttpStatusCode.NotFound: return notify({
type: "error",
title: i18n.str`The operation was not found.`,
- description: hasError.detail.hint as TranslatedString,
- debug: hasError.detail,
+ description: resp.detail.hint as TranslatedString,
+ debug: resp.detail,
});
case TalerErrorCode.BANK_UNALLOWED_DEBIT: return notify({
type: "error",
title: i18n.str`Your balance is not enough.`,
- description: hasError.detail.hint as TranslatedString,
- debug: hasError.detail,
+ description: resp.detail.hint as TranslatedString,
+ debug: resp.detail,
});
- default: assertUnreachable(hasError)
+ case HttpStatusCode.Accepted: {
+ resp.body.challenge_id;
+ return notify({
+ type: "info",
+ title: i18n.str`The operation needs a confirmation to complete.`,
+ });
+ }
+ default: assertUnreachable(resp)
}
})
}