wallet-core: canonicalize base URL from bank on withdrawal

This commit is contained in:
Florian Dold 2022-10-05 11:11:51 +02:00
parent 66ae0dd220
commit 4d232fd565
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B

View File

@ -1844,6 +1844,10 @@ export async function acceptWithdrawalFromUri(
restrictAge?: number; restrictAge?: number;
}, },
): Promise<AcceptWithdrawalResponse> { ): Promise<AcceptWithdrawalResponse> {
const selectedExchange = canonicalizeBaseUrl(req.selectedExchange);
logger.info(
`accepting withdrawal via ${req.talerWithdrawUri}, canonicalized selected exchange ${selectedExchange}`,
);
const existingWithdrawalGroup = await ws.db const existingWithdrawalGroup = await ws.db
.mktx((x) => [x.withdrawalGroups]) .mktx((x) => [x.withdrawalGroups])
.runReadOnly(async (tx) => { .runReadOnly(async (tx) => {
@ -1870,14 +1874,14 @@ export async function acceptWithdrawalFromUri(
}; };
} }
await updateExchangeFromUrl(ws, req.selectedExchange); await updateExchangeFromUrl(ws, selectedExchange);
const withdrawInfo = await getBankWithdrawalInfo( const withdrawInfo = await getBankWithdrawalInfo(
ws.http, ws.http,
req.talerWithdrawUri, req.talerWithdrawUri,
); );
const exchangePaytoUri = await getExchangePaytoUri( const exchangePaytoUri = await getExchangePaytoUri(
ws, ws,
req.selectedExchange, selectedExchange,
withdrawInfo.wireTypes, withdrawInfo.wireTypes,
); );