fix refund URI parsing (due to merchant backend change)

This commit is contained in:
Florian Dold 2020-08-20 16:51:14 +05:30
parent 421e613f92
commit 8d72b93a17
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B
2 changed files with 5 additions and 3 deletions

View File

@ -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();

View File

@ -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}/`;