diff options
author | Sebastian <sebasjm@gmail.com> | 2023-01-23 08:15:22 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2023-01-23 08:15:22 -0300 |
commit | 509011f9bca5c0693102b780fa782e910217f1ae (patch) | |
tree | b67648964113c61ed89854122d17c476229c60b7 /packages/merchant-backoffice-ui/src/paths/instance | |
parent | 59ce6e3d99edc8c0a503094ddb0ed48220109bcf (diff) | |
download | wallet-core-509011f9bca5c0693102b780fa782e910217f1ae.tar.xz |
fix payto
Diffstat (limited to 'packages/merchant-backoffice-ui/src/paths/instance')
-rw-r--r-- | packages/merchant-backoffice-ui/src/paths/instance/reserves/create/CreatedSuccessfully.tsx | 9 | ||||
-rw-r--r-- | packages/merchant-backoffice-ui/src/paths/instance/reserves/details/DetailPage.tsx | 14 |
2 files changed, 20 insertions, 3 deletions
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/reserves/create/CreatedSuccessfully.tsx b/packages/merchant-backoffice-ui/src/paths/instance/reserves/create/CreatedSuccessfully.tsx index 92427f3dc..b82907122 100644 --- a/packages/merchant-backoffice-ui/src/paths/instance/reserves/create/CreatedSuccessfully.tsx +++ b/packages/merchant-backoffice-ui/src/paths/instance/reserves/create/CreatedSuccessfully.tsx @@ -14,6 +14,7 @@ GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ +import { parsePaytoUri, stringifyPaytoUri } from "@gnu-taler/taler-util"; import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { h, VNode } from "preact"; import { QR } from "../../../../components/exception/QR.js"; @@ -36,7 +37,13 @@ export function CreatedSuccessfully({ onConfirm, onCreateAnother, }: Props): VNode { - const link = `${entity.response.payto_uri}?message=${entity.response.reserve_pub}&amount=${entity.request.initial_balance}`; + const p = parsePaytoUri(entity.response.payto_uri); + if (p) { + p.params["message"] = entity.response.reserve_pub; + p.params["amount"] = entity.request.initial_balance; + } + + const link = !p ? entity.response.payto_uri : stringifyPaytoUri(p); const { i18n } = useTranslationContext(); return ( <Template onConfirm={onConfirm} onCreateAnother={onCreateAnother}> diff --git a/packages/merchant-backoffice-ui/src/paths/instance/reserves/details/DetailPage.tsx b/packages/merchant-backoffice-ui/src/paths/instance/reserves/details/DetailPage.tsx index 1d54198c8..54e8123e4 100644 --- a/packages/merchant-backoffice-ui/src/paths/instance/reserves/details/DetailPage.tsx +++ b/packages/merchant-backoffice-ui/src/paths/instance/reserves/details/DetailPage.tsx @@ -19,7 +19,11 @@ * @author Sebastian Javier Marchano (sebasjm) */ -import { Amounts } from "@gnu-taler/taler-util"; +import { + Amounts, + parsePaytoUri, + stringifyPaytoUri, +} from "@gnu-taler/taler-util"; import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { format } from "date-fns"; import { Fragment, h, VNode } from "preact"; @@ -49,7 +53,13 @@ export function DetailPage({ id, selected, onBack }: Props): VNode { const didExchangeAckTransfer = Amounts.isNonZero( Amounts.parseOrThrow(selected.exchange_initial_amount), ); - const link = `${selected.payto_uri}?message=${id}&amount=${selected.merchant_initial_amount}`; + const p = parsePaytoUri(selected.payto_uri); + if (p) { + p.params["message"] = id; + p.params["amount"] = selected.merchant_initial_amount; + } + + const link = !p ? selected.payto_uri : stringifyPaytoUri(p); return ( <div class="columns"> |