diff options
Diffstat (limited to 'packages')
4 files changed, 43 insertions, 105 deletions
diff --git a/packages/merchant-backoffice-ui/src/Routing.tsx b/packages/merchant-backoffice-ui/src/Routing.tsx index 4ffad2d6d..c290cd67f 100644 --- a/packages/merchant-backoffice-ui/src/Routing.tsx +++ b/packages/merchant-backoffice-ui/src/Routing.tsx @@ -146,7 +146,6 @@ export const publicPages = { const history = createHashHistory(); export function Routing(_p: Props): VNode { - // const { i18n } = useTranslationContext(); const { state } = useSessionContext(); type GlobalNotifState = @@ -174,77 +173,6 @@ export function Routing(_p: Props): VNode { const shouldLogin = state.status === "loggedOut"; - // function ServerErrorRedirectTo(to: InstancePaths | AdminPaths) { - // return function ServerErrorRedirectToImpl( - // error: HttpError<TalerErrorDetail>, - // ) { - // if (error.type === ErrorType.TIMEOUT) { - // setGlobalNotification({ - // message: i18n.str`The request to the backend take too long and was cancelled`, - // description: i18n.str`Diagnostic from ${error.info.url} is "${error.message}"`, - // type: "ERROR", - // to, - // }); - // } else { - // setGlobalNotification({ - // message: i18n.str`The backend reported a problem: HTTP status #${error.status}`, - // description: i18n.str`Diagnostic from ${error.info.url} is '${error.message}'`, - // details: - // error.type === ErrorType.CLIENT || error.type === ErrorType.SERVER - // ? error.payload.hint - // : undefined, - // type: "ERROR", - // to, - // }); - // } - // return <Redirect to={to} />; - // }; - // } - - // const LoginPageAccessDeniend = onUnauthorized - // const LoginPageAccessDenied = () => { - // return ( - // <Fragment> - // <NotificationCard - // notification={{ - // message: i18n.str`Access denied`, - // description: i18n.str`Session expired or password changed.`, - // type: "ERROR", - // }} - // /> - // <LoginPage /> - // </Fragment> - // ); - // }; - - // function IfAdminCreateDefaultOr<T>(Next: FunctionComponent<unknown>) { - // return function IfAdminCreateDefaultOrImpl(props?: T) { - // if (state.isAdmin && state.instance === DEFAULT_ADMIN_USERNAME) { - // return ( - // <Fragment> - // <NotificationCard - // notification={{ - // message: i18n.str`No 'default' instance configured yet.`, - // description: i18n.str`Create a 'default' instance to begin using the merchant backoffice.`, - // type: "INFO", - // }} - // /> - // <InstanceCreatePage - // forceId={DEFAULT_ADMIN_USERNAME} - // onConfirm={() => { - // route(InstancePaths.bank_list); - // }} - // /> - // </Fragment> - // ); - // } - // if (props) { - // return <Next {...props} />; - // } - // return <Next />; - // }; - // } - if (shouldLogin) { return ( <Fragment> @@ -274,21 +202,24 @@ export function Routing(_p: Props): VNode { <KycBanner /> <NotificationCard notification={globalNotification} /> {error && ( - <NotificationCard - notification={{ - message: "Internal error, please repot", - type: "ERROR", - description: ( - <pre> - { - (error instanceof Error - ? error.stack - : String(error)) as TranslatedString - } - </pre> - ), - }} - /> + <Fragment> + <NotificationCard + notification={{ + message: "Internal error, please report", + type: "ERROR", + + description: ( + <pre> + { + (error instanceof Error + ? error.stack + : String(error)) as TranslatedString + } + </pre> + ), + }} + /> + </Fragment> )} <Router diff --git a/packages/merchant-backoffice-ui/src/components/form/InputPaytoForm.tsx b/packages/merchant-backoffice-ui/src/components/form/InputPaytoForm.tsx index 4ac798afe..9cec72c01 100644 --- a/packages/merchant-backoffice-ui/src/components/form/InputPaytoForm.tsx +++ b/packages/merchant-backoffice-ui/src/components/form/InputPaytoForm.tsx @@ -222,14 +222,15 @@ export function InputPaytoForm<T>({ if (nv !== undefined && nv.isKnown) { if (nv.targetType === "iban" && paths.length >= 2) { //FIXME: workaround EBIC not supported - paths[0] = paths[1] + paths[0] = paths[1]; + delete paths[1]; } setValue({ target: nv.targetType, params: nv.params, path1: paths.length >= 1 ? paths[0] : undefined, path2: paths.length >= 2 ? paths[1] : undefined, - }); + }); } }, [initialValueStr]); @@ -267,17 +268,20 @@ export function InputPaytoForm<T>({ const path1WithSlash = value.path1 && !value.path1.endsWith("/") ? value.path1 + "/" : value.path1; - const str = + const pto = hasErrors || !value.target ? undefined - : stringifyPaytoUri({ + : { targetType: value.target, targetPath: value.path2 ? `${path1WithSlash}${value.path2}` : value.path1 ?? "", params: value.params ?? ({} as any), - isKnown: false, - }); + isKnown: false as const, + }; + + const str = !pto ? undefined : stringifyPaytoUri(pto); + useEffect(() => { onChange(str as any); }, [str]); 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 index 1d08c5058..8b583308f 100644 --- a/packages/merchant-backoffice-ui/src/paths/instance/accounts/create/CreatePage.tsx +++ b/packages/merchant-backoffice-ui/src/paths/instance/accounts/create/CreatePage.tsx @@ -118,8 +118,21 @@ export function CreatePage({ onCreate, onBack }: Props): VNode { setImporting(false); }} onConfirm={(ac) => { - state.payto_uri = ac.accountURI; const u = new URL(ac.infoURL); + const user = u.username + const pwd = u.password + u.password = ""; + u.username = ""; + const credit_facade_url = u.href; + setState({ + payto_uri: ac.accountURI, + credit_facade_credentials: user || pwd ? { + type: "basic", + password: pwd, + username: user, + }: undefined, + credit_facade_url, + }) // if (u.username && ac.accesToken) { // state.credit_facade_credentials = { // type: "bearer", @@ -127,16 +140,6 @@ export function CreatePage({ onCreate, onBack }: Props): VNode { // username: u.username, // }; // } else - if (u.username || u.password) { - state.credit_facade_credentials = { - type: "basic", - password: u.password, - username: u.username, - }; - } - u.password = ""; - u.username = ""; - state.credit_facade_url = u.href; setImporting(false); }} /> 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 index aa1481a2e..7abff255c 100644 --- a/packages/merchant-backoffice-ui/src/paths/instance/accounts/create/index.tsx +++ b/packages/merchant-backoffice-ui/src/paths/instance/accounts/create/index.tsx @@ -111,7 +111,7 @@ export default function CreateValidator({ onConfirm, onBack }: Props): VNode { setNotif({ message: i18n.str`Could not add bank account`, type: "ERROR", - description: i18n.str`The account info URL returned information from an account which is not the same in the account form: ${resp.detail.hint}`, + description: i18n.str`The account info URL returned information from an account which is not the same in the account form: ${resp.detail.hint} and ${request.payto_uri}`, }); return; } |