diff options
author | Sebastian <sebasjm@gmail.com> | 2024-06-03 12:04:14 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2024-06-03 12:12:23 -0300 |
commit | 361a6f9d36542a8ce616b33676e96f769ae34d4d (patch) | |
tree | 999dd45c814958785dbdc7e260f37e9ec4a68325 /packages/bank-ui | |
parent | 1beb305d231e8e5632d1d3e2072c39bb74049924 (diff) | |
download | wallet-core-361a6f9d36542a8ce616b33676e96f769ae34d4d.tar.xz |
export accont letter on copy
Diffstat (limited to 'packages/bank-ui')
-rw-r--r-- | packages/bank-ui/src/pages/account/ShowAccountDetails.tsx | 41 | ||||
-rw-r--r-- | packages/bank-ui/src/settings.json | 2 |
2 files changed, 17 insertions, 26 deletions
diff --git a/packages/bank-ui/src/pages/account/ShowAccountDetails.tsx b/packages/bank-ui/src/pages/account/ShowAccountDetails.tsx index 6db0e5512..0e2144d77 100644 --- a/packages/bank-ui/src/pages/account/ShowAccountDetails.tsx +++ b/packages/bank-ui/src/pages/account/ShowAccountDetails.tsx @@ -15,6 +15,7 @@ */ import { AbsoluteTime, + AccountLetter, HttpStatusCode, TalerCorebankApi, TalerError, @@ -200,28 +201,17 @@ export function ShowAccountDetails({ } const url = bank.getRevenueAPI(account); - url.username = account; const baseURL = url.href; - + const revenueURL = new URL(baseURL) + revenueURL.username = account; + revenueURL.password = creds?.token ?? "" const ac = parsePaytoUri(result.body.payto_uri); const payto = !ac?.isKnown ? undefined : ac; - let accountLetter: string | undefined = undefined; - if (payto) { - switch (payto.targetType) { - case "iban": { - accountLetter = `account-info-url=${url.href}\naccount-type=${payto.targetType}\niban=${payto.iban}\nreceiver-name=${result.body.name}\n`; - break; - } - case "x-taler-bank": { - accountLetter = `account-info-url=${url.href}\naccount-type=${payto.targetType}\naccount=${payto.account}\nhost=${payto.host}\nreceiver-name=${result.body.name}\n`; - break; - } - case "bitcoin": { - accountLetter = `account-info-url=${url.href}\naccount-type=${payto.targetType}\naddress=${payto.address}\nreceiver-name=${result.body.name}\n`; - break; - } + const accountLetter : AccountLetter | undefined = !payto + ? undefined + : { + accountURI: result.body.payto_uri, infoURL: revenueURL.href } - } return ( <Fragment> @@ -327,7 +317,7 @@ export function ShowAccountDetails({ name="account-type" id="account-type" disabled={true} - value={account} + value={payto.targetType} autocomplete="off" /> </div> @@ -372,16 +362,16 @@ export function ShowAccountDetails({ <div class="sm:col-span-5"> <label class="block text-sm font-medium leading-6 text-gray-900" - for="iban" + for="account-name" > - {i18n.str`IBAN`} + {i18n.str`Account name`} </label> <div class="mt-2"> <input type="text" class="block w-full disabled:bg-gray-100 rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 data-[error=true]:ring-red-500 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" - name="iban" - id="iban" + name="account-name" + id="account-name" disabled={true} value={payto.account} autocomplete="off" @@ -389,7 +379,7 @@ export function ShowAccountDetails({ </div> <p class="mt-2 text-sm text-gray-500"> <i18n.Translate> - International Bank Account Number. + Bank account identifier for wire transfers. </i18n.Translate> </p> </div> @@ -486,7 +476,7 @@ export function ShowAccountDetails({ <i18n.Translate>Cancel</i18n.Translate> </a> <CopyButton - getContent={() => accountLetter ?? ""} + getContent={() => !accountLetter ? "" : JSON.stringify(accountLetter)} class="flex text-center disabled:opacity-50 disabled:cursor-default cursor-pointer rounded-md bg-indigo-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600" > <i18n.Translate>Copy</i18n.Translate> @@ -498,3 +488,4 @@ export function ShowAccountDetails({ </Fragment> ); } + diff --git a/packages/bank-ui/src/settings.json b/packages/bank-ui/src/settings.json index df5fe75ce..b1df52568 100644 --- a/packages/bank-ui/src/settings.json +++ b/packages/bank-ui/src/settings.json @@ -1,5 +1,5 @@ { - "backendBaseURL": "http://bank.taler.test:1180/", + "backendBaseURL": "http://bank-fir.taler.test:1180/", "simplePasswordForRandomAccounts": true, "allowRandomAccountCreation": true, "bankName": "Taler DEVELOPMENT Bank", |