commit c67217eea575b863b92b63061e2c7152d07dedbb
parent d4d1e7beb47a60d8d3570f0570f872e6b10a3a64
Author: Sebastian <sebasjm@gmail.com>
Date: Mon, 21 Oct 2024 13:32:17 -0300
#9228 showing a message when account can't be checked
Diffstat:
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/accounts/create/CreatePage.tsx b/packages/merchant-backoffice-ui/src/paths/instance/accounts/create/CreatePage.tsx
@@ -24,6 +24,7 @@ import {
PaytoUri,
TalerError,
TalerMerchantApi,
+ TalerRevenueApi,
TranslatedString,
assertUnreachable,
parsePaytoUri
@@ -46,7 +47,7 @@ import {
} from "../../../../components/modal/index.js";
import { undefinedIfEmpty } from "../../../../utils/table.js";
import { safeConvertURL } from "../update/UpdatePage.js";
-import { testRevenueAPI } from "./index.js";
+import { testRevenueAPI, TestRevenueErrorType } from "./index.js";
type Entity = TalerMerchantApi.AccountAddDetails & { verified?: boolean };
@@ -177,6 +178,16 @@ export function CreatePage({ onCreate, onBack }: Props): VNode {
});
return;
}
+ case TestRevenueErrorType.CANT_VALIDATE: {
+ setTestError(
+ i18n.str`Request succeeded but server didn't reply the 'credit_account' so we can't check that the account is the same.`,
+ );
+ setState({
+ ...state,
+ verified: undefined,
+ });
+ return;
+ }
default: {
assertUnreachable(resp);
}
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/accounts/create/index.tsx b/packages/merchant-backoffice-ui/src/paths/instance/accounts/create/index.tsx
@@ -87,6 +87,7 @@ export default function CreateValidator({ onConfirm, onBack }: Props): VNode {
export enum TestRevenueErrorType {
ANOTHER_ACCOUNT,
+ CANT_VALIDATE,
}
export async function testRevenueAPI(
@@ -96,6 +97,7 @@ export async function testRevenueAPI(
| OperationOk<PaytoString>
| OperationFail<HttpStatusCode.NotFound>
| OperationFail<HttpStatusCode.Unauthorized>
+ | OperationFail<TestRevenueErrorType.CANT_VALIDATE>
| OperationFail<HttpStatusCode.BadRequest>
| TalerError
> {
@@ -127,6 +129,13 @@ export async function testRevenueAPI(
return resp;
}
+ if (!resp.body.credit_account) {
+ return {
+ type:"fail",
+ case: TestRevenueErrorType.CANT_VALIDATE,
+ detail: undefined,
+ }
+ }
return opFixedSuccess(resp.body.credit_account as PaytoString);
} catch (err) {
if (err instanceof TalerError) {