aboutsummaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2024-06-19 10:17:19 -0300
committerSebastian <sebasjm@gmail.com>2024-06-19 10:17:19 -0300
commitfdad16202750ef3bf5102870d66edb9b8383a8d4 (patch)
tree7793c1331e9a0f55a08dea190a86c39ed72e909e /packages
parent3418a2fcb4b73374b5433052d05978cf9212093c (diff)
downloadwallet-core-fdad16202750ef3bf5102870d66edb9b8383a8d4.tar.xz
parse x-taler-bank account when comparing
Diffstat (limited to 'packages')
-rw-r--r--packages/bank-ui/src/hooks/account.ts2
-rw-r--r--packages/bank-ui/src/pages/AccountPage/views.tsx4
-rw-r--r--packages/bank-ui/src/pages/BankFrame.tsx4
-rw-r--r--packages/merchant-backoffice-ui/src/components/modal/index.tsx32
-rw-r--r--packages/merchant-backoffice-ui/src/paths/instance/accounts/create/CreatePage.tsx4
5 files changed, 37 insertions, 9 deletions
diff --git a/packages/bank-ui/src/hooks/account.ts b/packages/bank-ui/src/hooks/account.ts
index 43d43a3f2..b18aad9ad 100644
--- a/packages/bank-ui/src/hooks/account.ts
+++ b/packages/bank-ui/src/hooks/account.ts
@@ -292,7 +292,7 @@ export function useTransactions(account: string, initial?: number) {
TalerCoreBankResultByMethod<"getTransactions">,
TalerHttpError
>([account, token, offset, "getTransactions"], fetcher, {
- refreshInterval: 0,
+ refreshInterval: 10000,
refreshWhenHidden: false,
refreshWhenOffline: false,
// revalidateOnMount: false,
diff --git a/packages/bank-ui/src/pages/AccountPage/views.tsx b/packages/bank-ui/src/pages/AccountPage/views.tsx
index 42892f536..93a769147 100644
--- a/packages/bank-ui/src/pages/AccountPage/views.tsx
+++ b/packages/bank-ui/src/pages/AccountPage/views.tsx
@@ -42,7 +42,7 @@ function ShowDemoInfo({
if (!settings.showDemoDescription) return <Fragment />;
return (
<Attention
- title={i18n.str`This is a demo bank`}
+ title={i18n.str`This is a demo`}
onClose={() => {
updateSettings("showDemoDescription", false);
}}
@@ -59,7 +59,7 @@ function ShowDemoInfo({
</i18n.Translate>
) : (
<i18n.Translate>
- This part of the demo shows how a bank that supports Taler directly
+ Here you will be able to see how a bank that supports Taler directly
would work.
</i18n.Translate>
)}
diff --git a/packages/bank-ui/src/pages/BankFrame.tsx b/packages/bank-ui/src/pages/BankFrame.tsx
index db757ee07..62b5c6f90 100644
--- a/packages/bank-ui/src/pages/BankFrame.tsx
+++ b/packages/bank-ui/src/pages/BankFrame.tsx
@@ -64,6 +64,8 @@ export function BankFrame({
const settings = useSettingsContext();
const [preferences, updatePreferences] = usePreferences();
const [, , resetBankState] = useBankState();
+ const d = useBankCoreApiContext();
+ const config = d === undefined ? undefined : d.config;
const [error, resetError] = useErrorBoundary();
@@ -90,7 +92,7 @@ export function BankFrame({
>
<div class="bg-indigo-600 pb-32">
<Header
- title="Bank"
+ title={config?.bank_name ?? "Bank"}
iconLinkURL={settings.iconLinkURL ?? "#"}
profileURL={routeAccountDetails?.url({})}
notificationURL={
diff --git a/packages/merchant-backoffice-ui/src/components/modal/index.tsx b/packages/merchant-backoffice-ui/src/components/modal/index.tsx
index ce0df75ca..ba32950b5 100644
--- a/packages/merchant-backoffice-ui/src/components/modal/index.tsx
+++ b/packages/merchant-backoffice-ui/src/components/modal/index.tsx
@@ -297,6 +297,28 @@ interface CompareAccountsModalProps {
testPayto: PaytoUri;
}
+function getHostFromHostPath(s: string | undefined) {
+ if (!s) return undefined;
+ try {
+ const u = new URL(`https://${s}`);
+ const endpath = u.pathname.lastIndexOf("/");
+ return u.origin + u.pathname.substring(0, endpath);
+ } catch (e) {
+ return undefined;
+ }
+}
+
+function getAccountIdFromHostPath(s: string | undefined) {
+ if (!s) return undefined;
+ try {
+ const u = new URL(`https://${s}`);
+ const endpath = u.pathname.lastIndexOf("/");
+ return u.pathname.substring(endpath + 1);
+ } catch (e) {
+ return undefined;
+ }
+}
+
export function CompareAccountsModal({
onCancel,
onConfirm,
@@ -365,15 +387,17 @@ export function CompareAccountsModal({
<td>
<i18n.Translate>Host</i18n.Translate>
</td>
- <td>{formPayto?.targetPath ?? "--"}</td>
- <td>{testPayto.targetPath}</td>
+ <td>{getHostFromHostPath(formPayto?.targetPath) ?? "--"}</td>
+ <td>{getHostFromHostPath(testPayto.targetPath)}</td>
</tr>
<tr>
<td>
<i18n.Translate>Account id</i18n.Translate>
</td>
- <td>{formPayto?.targetPath ?? "--"}</td>
- <td>{testPayto.targetPath}</td>
+ <td>
+ {getAccountIdFromHostPath(formPayto?.targetPath) ?? "--"}
+ </td>
+ <td>{getAccountIdFromHostPath(testPayto.targetPath)}</td>
</tr>
</Fragment>
)}
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 21be44a39..8684eb90d 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
@@ -21,6 +21,7 @@
import {
HttpStatusCode,
+ PaytoString,
PaytoUri,
TalerError,
TalerMerchantApi,
@@ -62,6 +63,7 @@ export function CreatePage({ onCreate, onBack }: Props): VNode {
const [importing, setImporting] = useState(false);
const [revenuePayto, setRevenuePayto] = useState<PaytoUri | undefined>(
+ // parsePaytoUri("payto://x-taler-bank/asd.com:1010/asd/pepe"),
undefined,
);
const [state, setState] = useState<Partial<Entity>>({});
@@ -210,7 +212,7 @@ export function CreatePage({ onCreate, onBack }: Props): VNode {
name="payto_uri"
label={i18n.str`Account details`}
/>
- <div class="message-body" style={{marginBottom: 10}}>
+ <div class="message-body" style={{ marginBottom: 10 }}>
<p>
<i18n.Translate>
If the bank supports Taler Revenue API then you can add the