diff options
author | Florian Dold <florian@dold.me> | 2023-08-29 09:45:45 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2023-08-29 09:46:43 +0200 |
commit | 55bdc161b58ddf4f24e32dff9acd8011a4364327 (patch) | |
tree | 1506387802bff37c376cd50bc42c444344afe928 /packages/taler-wallet-core/src/operations | |
parent | b13bd85215ad64e7a2764ac7e7fee5945ffa1c07 (diff) |
taler-harness: add exchange-purse test
Diffstat (limited to 'packages/taler-wallet-core/src/operations')
3 files changed, 2 insertions, 24 deletions
diff --git a/packages/taler-wallet-core/src/operations/pay-peer-common.ts b/packages/taler-wallet-core/src/operations/pay-peer-common.ts index 1bc2e8d49..4fdfecb4d 100644 --- a/packages/taler-wallet-core/src/operations/pay-peer-common.ts +++ b/packages/taler-wallet-core/src/operations/pay-peer-common.ts @@ -420,28 +420,6 @@ export const codecForExchangePurseStatus = (): Codec<ExchangePurseStatus> => .property("merge_timestamp", codecOptional(codecForTimestamp)) .build("ExchangePurseStatus"); -export function talerPaytoFromExchangeReserve( - exchangeBaseUrl: string, - reservePub: string, -): string { - const url = new URL(exchangeBaseUrl); - let proto: string; - if (url.protocol === "http:") { - proto = "taler-reserve-http"; - } else if (url.protocol === "https:") { - proto = "taler-reserve"; - } else { - throw Error(`unsupported exchange base URL protocol (${url.protocol})`); - } - - let path = url.pathname; - if (!path.endsWith("/")) { - path = path + "/"; - } - - return `payto://${proto}/${url.host}${url.pathname}${reservePub}`; -} - export async function getMergeReserveInfo( ws: InternalWalletState, req: { diff --git a/packages/taler-wallet-core/src/operations/pay-peer-pull-credit.ts b/packages/taler-wallet-core/src/operations/pay-peer-pull-credit.ts index 88b441cdd..954300264 100644 --- a/packages/taler-wallet-core/src/operations/pay-peer-pull-credit.ts +++ b/packages/taler-wallet-core/src/operations/pay-peer-pull-credit.ts @@ -45,6 +45,7 @@ import { j2s, makeErrorDetail, stringifyTalerUri, + talerPaytoFromExchangeReserve, } from "@gnu-taler/taler-util"; import { readSuccessResponseJsonOrErrorCode, @@ -74,7 +75,6 @@ import { import { codecForExchangePurseStatus, getMergeReserveInfo, - talerPaytoFromExchangeReserve, } from "./pay-peer-common.js"; import { constructTransactionIdentifier, diff --git a/packages/taler-wallet-core/src/operations/pay-peer-push-credit.ts b/packages/taler-wallet-core/src/operations/pay-peer-push-credit.ts index e76b934fa..c552d63f0 100644 --- a/packages/taler-wallet-core/src/operations/pay-peer-push-credit.ts +++ b/packages/taler-wallet-core/src/operations/pay-peer-push-credit.ts @@ -47,6 +47,7 @@ import { j2s, makeErrorDetail, parsePayPushUri, + talerPaytoFromExchangeReserve, } from "@gnu-taler/taler-util"; import { readSuccessResponseJsonOrThrow } from "@gnu-taler/taler-util/http"; import { @@ -71,7 +72,6 @@ import { updateExchangeFromUrl } from "./exchanges.js"; import { codecForExchangePurseStatus, getMergeReserveInfo, - talerPaytoFromExchangeReserve, } from "./pay-peer-common.js"; import { TransitionInfo, |