aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2020-08-20 16:51:14 +0530
committerFlorian Dold <florian.dold@gmail.com>2020-08-20 16:51:14 +0530
commit8d72b93a174ed3fbfa52b6fb67976fdfcbd40efc (patch)
treedb83d875a016b0c65446888ebf06c632f4998f06
parent421e613f92b80c81c856d6b074aa160e80e38e3d (diff)
fix refund URI parsing (due to merchant backend change)v0.7.1-dev.21
-rw-r--r--packages/taler-integrationtests/src/test-refund.ts1
-rw-r--r--packages/taler-wallet-core/src/util/taleruri.ts7
2 files changed, 5 insertions, 3 deletions
diff --git a/packages/taler-integrationtests/src/test-refund.ts b/packages/taler-integrationtests/src/test-refund.ts
index f88a399b5..bda609c95 100644
--- a/packages/taler-integrationtests/src/test-refund.ts
+++ b/packages/taler-integrationtests/src/test-refund.ts
@@ -86,6 +86,7 @@ runTest(async (t: GlobalTestState) => {
let r = await wallet.apiRequest("applyRefund", {
talerRefundUri: ref.talerRefundUri,
});
+ t.assertTrue(r.type === "response");
console.log(r);
await wallet.runUntilDone();
diff --git a/packages/taler-wallet-core/src/util/taleruri.ts b/packages/taler-wallet-core/src/util/taleruri.ts
index 43a869afe..56b46c0ff 100644
--- a/packages/taler-wallet-core/src/util/taleruri.ts
+++ b/packages/taler-wallet-core/src/util/taleruri.ts
@@ -199,12 +199,13 @@ export function parseRefundUri(s: string): RefundUriResult | undefined {
}
const c = pi?.rest.split("?");
const parts = c[0].split("/");
- if (parts.length < 2) {
+ if (parts.length < 3) {
return undefined;
}
const host = parts[0].toLowerCase();
- const orderId = parts[parts.length - 1];
- const pathSegments = parts.slice(1, parts.length - 1);
+ 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}/`;