(undefined);
const { lib: api } = useMerchantApiContext();
const { state } = useSessionContext();
const { i18n } = useTranslationContext();
if (!result) return ;
if (result instanceof TalerError) {
return ;
}
if (result.type === "fail") {
switch (result.case) {
case HttpStatusCode.NotFound: {
return ;
}
case HttpStatusCode.BadGateway: {
return Failed to obtain a response from the exchange
;
}
case HttpStatusCode.GatewayTimeout: {
return (
The merchant's interaction with the exchange took too long
);
}
case HttpStatusCode.Unauthorized: {
return
}
default: {
assertUnreachable(result);
}
}
}
return (
{
if (state.status !== "loggedIn") {
return;
}
api.instance
.addRefund(state.token, id, value)
.then(() =>
setNotif({
message: i18n.str`refund created successfully`,
type: "SUCCESS",
}),
)
.catch((error) =>
setNotif({
message: i18n.str`could not create the refund`,
type: "ERROR",
description: error.message,
}),
);
}}
selected={result.body}
/>
);
}