summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2020-08-07 00:31:54 +0530
committerFlorian Dold <florian.dold@gmail.com>2020-08-07 00:31:54 +0530
commitb791a14c6118f4cdb1cf0257ab499324d3859e6d (patch)
tree9bba328d67e2894c2c54a735ebd99a24d3ccf39d /contrib
parent5698d609efd715668e24c22e20fed9d952723852 (diff)
downloadmerchant-b791a14c6118f4cdb1cf0257ab499324d3859e6d.tar.gz
merchant-b791a14c6118f4cdb1cf0257ab499324d3859e6d.tar.bz2
merchant-b791a14c6118f4cdb1cf0257ab499324d3859e6d.zip
pass status URLs in template instead of using JS, fix remaining #6457 FIXMEs
Diffstat (limited to 'contrib')
-rw-r--r--contrib/offer_refund.en.must2
-rw-r--r--contrib/offer_tip.en.must2
-rw-r--r--contrib/request_payment.en.must220
3 files changed, 3 insertions, 221 deletions
diff --git a/contrib/offer_refund.en.must b/contrib/offer_refund.en.must
index 5aacb85d..8dc9f937 100644
--- a/contrib/offer_refund.en.must
+++ b/contrib/offer_refund.en.must
@@ -90,7 +90,7 @@ body {
<body>
<script>
- let checkUrl = FIXME-#6457_dold_refund_uri_to_URL("{{taler_refund_uri}}");
+ let checkUrl = "{{order_status_url}}";
let delayMs = 500;
function check() {
let req = new XMLHttpRequest();
diff --git a/contrib/offer_tip.en.must b/contrib/offer_tip.en.must
index 339f64ff..0a7f366c 100644
--- a/contrib/offer_tip.en.must
+++ b/contrib/offer_tip.en.must
@@ -90,7 +90,7 @@ body {
<body>
<script>
- let checkUrl = FIXME-#6457_dold_tip_uri_to_URL("{{taler_tip_uri}}");
+ let checkUrl = "{{tip_status_url}}";
let delayMs = 500;
function check() {
let req = new XMLHttpRequest();
diff --git a/contrib/request_payment.en.must b/contrib/request_payment.en.must
index c4beed59..4faa9f27 100644
--- a/contrib/request_payment.en.must
+++ b/contrib/request_payment.en.must
@@ -89,224 +89,6 @@ body {
</head>
<body>
-
-<script>
-{{!
- Auto-generated from https://git.taler.net/wallet-core.git with the command:
-
- $ rollup packages/taler-wallet-core/lib/util/taleruri.js --name "taleruri" --file out.js --format umd
-}}
-
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
- typeof define === 'function' && define.amd ? define(['exports'], factory) :
- (global = global || self, factory(global.taleruri = {}));
-}(this, (function (exports) { 'use strict';
-
- /*
- This file is part of GNU Taler
- (C) 2020 Taler Systems S.A.
-
- GNU Taler is free software; you can redistribute it and/or modify it under the
- terms of the GNU General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with
- GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
- */
- // @ts-ignore
- const _URL = globalThis.URL;
- if (!_URL) {
- throw Error("FATAL: URL not available");
- }
- // @ts-ignore
- const _URLSearchParams = globalThis.URLSearchParams;
- if (!_URLSearchParams) {
- throw Error("FATAL: URLSearchParams not available");
- }
- const URLSearchParams = _URLSearchParams;
-
- /*
- This file is part of GNU Taler
- (C) 2019-2020 Taler Systems S.A.
-
- GNU Taler is free software; you can redistribute it and/or modify it under the
- terms of the GNU General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with
- GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
- */
- /**
- * Parse a taler[+http]://withdraw URI.
- * Return undefined if not passed a valid URI.
- */
- function parseWithdrawUri(s) {
- const pi = parseProtoInfo(s, "withdraw");
- if (!pi) {
- return undefined;
- }
- const parts = pi.rest.split("/");
- if (parts.length < 2) {
- return undefined;
- }
- const host = parts[0].toLowerCase();
- const pathSegments = parts.slice(1, parts.length - 1);
- const withdrawId = parts[parts.length - 1];
- const p = [host, ...pathSegments].join("/");
- return {
- bankIntegrationApiBaseUrl: `${pi.innerProto}://${p}/`,
- withdrawalOperationId: withdrawId,
- };
- }
- /**
- * Classify a taler:// URI.
- */
- function classifyTalerUri(s) {
- const sl = s.toLowerCase();
- if (sl.startsWith("taler://pay/")) {
- return "taler-pay" /* TalerPay */;
- }
- if (sl.startsWith("taler+http://pay/")) {
- return "taler-pay" /* TalerPay */;
- }
- if (sl.startsWith("taler://tip/")) {
- return "taler-tip" /* TalerTip */;
- }
- if (sl.startsWith("taler+http://tip/")) {
- return "taler-tip" /* TalerTip */;
- }
- if (sl.startsWith("taler://refund/")) {
- return "taler-refund" /* TalerRefund */;
- }
- if (sl.startsWith("taler+http://refund/")) {
- return "taler-refund" /* TalerRefund */;
- }
- if (sl.startsWith("taler://withdraw/")) {
- return "taler-withdraw" /* TalerWithdraw */;
- }
- if (sl.startsWith("taler://notify-reserve/")) {
- return "taler-notify-reserve" /* TalerNotifyReserve */;
- }
- return "unknown" /* Unknown */;
- }
- function parseProtoInfo(s, action) {
- const pfxPlain = `taler://${action}/`;
- const pfxHttp = `taler+http://${action}/`;
- if (s.toLowerCase().startsWith(pfxPlain)) {
- return {
- innerProto: "https",
- rest: s.substring(pfxPlain.length),
- };
- }
- else if (s.toLowerCase().startsWith(pfxHttp)) {
- return {
- innerProto: "http",
- rest: s.substring(pfxHttp.length),
- };
- }
- else {
- return undefined;
- }
- }
- /**
- * Parse a taler[+http]://pay URI.
- * Return undefined if not passed a valid URI.
- */
- function parsePayUri(s) {
- var _a, _b;
- const pi = parseProtoInfo(s, "pay");
- if (!pi) {
- return undefined;
- }
- const c = pi === null || pi === void 0 ? void 0 : pi.rest.split("?");
- const q = new URLSearchParams((_a = c[1]) !== null && _a !== void 0 ? _a : "");
- const claimToken = (_b = q.get("c")) !== null && _b !== void 0 ? _b : undefined;
- const parts = c[0].split("/");
- if (parts.length < 3) {
- return undefined;
- }
- const host = parts[0].toLowerCase();
- const sessionId = parts[parts.length - 1];
- const orderId = parts[parts.length - 2];
- const pathSegments = parts.slice(1, parts.length - 2);
- const p = [host, ...pathSegments].join("/");
- const merchantBaseUrl = `${pi.innerProto}://${p}/`;
- return {
- merchantBaseUrl,
- orderId,
- sessionId: sessionId,
- claimToken,
- };
- }
- /**
- * Parse a taler[+http]://tip URI.
- * Return undefined if not passed a valid URI.
- */
- function parseTipUri(s) {
- const pi = parseProtoInfo(s, "tip");
- if (!pi) {
- return undefined;
- }
- const c = pi === null || pi === void 0 ? void 0 : pi.rest.split("?");
- const parts = c[0].split("/");
- if (parts.length < 2) {
- return undefined;
- }
- const host = parts[0].toLowerCase();
- const tipId = parts[parts.length - 1];
- const pathSegments = parts.slice(1, parts.length - 1);
- const p = [host, ...pathSegments].join("/");
- const merchantBaseUrl = `${pi.innerProto}://${p}/`;
- return {
- merchantBaseUrl,
- merchantTipId: tipId,
- };
- }
- /**
- * Parse a taler[+http]://refund URI.
- * Return undefined if not passed a valid URI.
- */
- function parseRefundUri(s) {
- const pi = parseProtoInfo(s, "refund");
- if (!pi) {
- return undefined;
- }
- const c = pi === null || pi === void 0 ? void 0 : pi.rest.split("?");
- const parts = c[0].split("/");
- if (parts.length < 2) {
- return undefined;
- }
- const host = parts[0].toLowerCase();
- const orderId = parts[parts.length - 1];
- const pathSegments = parts.slice(1, parts.length - 1);
- const p = [host, ...pathSegments].join("/");
- const merchantBaseUrl = `${pi.innerProto}://${p}/`;
- return {
- merchantBaseUrl,
- orderId,
- };
- }
-
- exports.classifyTalerUri = classifyTalerUri;
- exports.parsePayUri = parsePayUri;
- exports.parseRefundUri = parseRefundUri;
- exports.parseTipUri = parseTipUri;
- exports.parseWithdrawUri = parseWithdrawUri;
-
- Object.defineProperty(exports, '__esModule', { value: true });
-
-})));
-</script>
-
<script>
function pay_uri_to_order_url(uri) {
let parsed = taleruri.parsePayUri(uri);
@@ -320,7 +102,7 @@ body {
return url;
}
- let checkUrl = pay_uri_to_order_url("{{taler_pay_uri}}");
+ let checkUrl = "{{order_status_url}}";
let delayMs = 500;
function check() {
let req = new XMLHttpRequest();