aboutsummaryrefslogtreecommitdiff
path: root/packages/merchant-backoffice-ui
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2023-01-23 08:15:22 -0300
committerSebastian <sebasjm@gmail.com>2023-01-23 08:15:22 -0300
commit509011f9bca5c0693102b780fa782e910217f1ae (patch)
treeb67648964113c61ed89854122d17c476229c60b7 /packages/merchant-backoffice-ui
parent59ce6e3d99edc8c0a503094ddb0ed48220109bcf (diff)
fix payto
Diffstat (limited to 'packages/merchant-backoffice-ui')
-rw-r--r--packages/merchant-backoffice-ui/package.json4
-rw-r--r--packages/merchant-backoffice-ui/src/paths/instance/reserves/create/CreatedSuccessfully.tsx9
-rw-r--r--packages/merchant-backoffice-ui/src/paths/instance/reserves/details/DetailPage.tsx14
3 files changed, 22 insertions, 5 deletions
diff --git a/packages/merchant-backoffice-ui/package.json b/packages/merchant-backoffice-ui/package.json
index cffe73e3f..eb3aa1834 100644
--- a/packages/merchant-backoffice-ui/package.json
+++ b/packages/merchant-backoffice-ui/package.json
@@ -1,8 +1,8 @@
{
"private": true,
"name": "@gnu-taler/merchant-backoffice",
- "version": "0.0.4",
- "license": "MIT",
+ "version": "0.0.5",
+ "license": "AGPL-3.0-or-later",
"type": "module",
"scripts": {
"build": "./build.mjs",
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">