summaryrefslogtreecommitdiff
path: root/packages/taler-util/src/taleruri.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-util/src/taleruri.ts')
-rw-r--r--packages/taler-util/src/taleruri.ts92
1 files changed, 1 insertions, 91 deletions
diff --git a/packages/taler-util/src/taleruri.ts b/packages/taler-util/src/taleruri.ts
index 26d1a324a..15464b981 100644
--- a/packages/taler-util/src/taleruri.ts
+++ b/packages/taler-util/src/taleruri.ts
@@ -41,9 +41,7 @@ export type TalerUri =
| RefundUriResult
| RewardUriResult
| WithdrawUriResult
- | ExchangeUri
- | WithdrawExchangeUri
- | AuditorUri;
+ | WithdrawExchangeUri;
declare const __action_str: unique symbol;
export type TalerActionString = string & { [__action_str]: true };
@@ -105,18 +103,6 @@ export interface RewardUriResult {
merchantRewardId: string;
}
-export interface ExchangeUri {
- type: TalerUriAction.Exchange;
- exchangeBaseUrl: string;
- exchangePub: string;
-}
-
-export interface AuditorUri {
- type: TalerUriAction.Auditor;
- auditorBaseUrl: string;
- auditorPub: string;
-}
-
export interface PayPushUriResult {
type: TalerUriAction.PayPush;
exchangeBaseUrl: string;
@@ -206,8 +192,6 @@ export enum TalerUriAction {
PayPull = "pay-pull",
PayPush = "pay-push",
PayTemplate = "pay-template",
- Exchange = "exchange",
- Auditor = "auditor",
Restore = "restore",
DevExperiment = "dev-experiment",
WithdrawExchange = "withdraw-exchange",
@@ -250,8 +234,6 @@ const parsers: { [A in TalerUriAction]: Parser } = {
[TalerUriAction.Reward]: parseRewardUri,
[TalerUriAction.Withdraw]: parseWithdrawUri,
[TalerUriAction.DevExperiment]: parseDevExperimentUri,
- [TalerUriAction.Exchange]: parseExchangeUri,
- [TalerUriAction.Auditor]: parseAuditorUri,
[TalerUriAction.WithdrawExchange]: parseWithdrawExchangeUri,
};
@@ -296,15 +278,9 @@ export function stringifyTalerUri(uri: TalerUri): string {
case TalerUriAction.Withdraw: {
return stringifyWithdrawUri(uri);
}
- case TalerUriAction.Exchange: {
- return stringifyExchangeUri(uri);
- }
case TalerUriAction.WithdrawExchange: {
return stringifyWithdrawExchange(uri);
}
- case TalerUriAction.Auditor: {
- return stringifyAuditorUri(uri);
- }
}
}
@@ -458,31 +434,6 @@ export function parseRewardUri(s: string): RewardUriResult | undefined {
};
}
-export function parseExchangeUri(s: string): ExchangeUri | undefined {
- const pi = parseProtoInfo(s, "exchange");
- if (!pi) {
- return undefined;
- }
- const c = pi?.rest.split("?");
- const parts = c[0].split("/");
- if (parts.length < 2) {
- return undefined;
- }
- const host = parts[0].toLowerCase();
- const exchangePub = parts[parts.length - 1];
- const pathSegments = parts.slice(1, parts.length - 1);
- const hostAndSegments = [host, ...pathSegments].join("/");
- const exchangeBaseUrl = canonicalizeBaseUrl(
- `${pi.innerProto}://${hostAndSegments}/`,
- );
-
- return {
- type: TalerUriAction.Exchange,
- exchangeBaseUrl,
- exchangePub,
- };
-}
-
export function parseWithdrawExchangeUri(
s: string,
): WithdrawExchangeUri | undefined {
@@ -513,31 +464,6 @@ export function parseWithdrawExchangeUri(
};
}
-export function parseAuditorUri(s: string): AuditorUri | undefined {
- const pi = parseProtoInfo(s, "auditor");
- if (!pi) {
- return undefined;
- }
- const c = pi?.rest.split("?");
- const parts = c[0].split("/");
- if (parts.length < 2) {
- return undefined;
- }
- const host = parts[0].toLowerCase();
- const auditorPub = parts[parts.length - 1];
- const pathSegments = parts.slice(1, parts.length - 1);
- const hostAndSegments = [host, ...pathSegments].join("/");
- const auditorBaseUrl = canonicalizeBaseUrl(
- `${pi.innerProto}://${hostAndSegments}/`,
- );
-
- return {
- type: TalerUriAction.Auditor,
- auditorBaseUrl,
- auditorPub,
- };
-}
-
/**
* Parse a taler[+http]://refund URI.
* Return undefined if not passed a valid URI.
@@ -695,22 +621,6 @@ export function stringifyRewardUri({
return `${proto}://reward/${path}${merchantRewardId}/`;
}
-export function stringifyExchangeUri({
- exchangeBaseUrl,
- exchangePub,
-}: Omit<ExchangeUri, "type">): string {
- const { proto, path } = getUrlInfo(exchangeBaseUrl);
- return `${proto}://exchange/${path}${exchangePub}`;
-}
-
-export function stringifyAuditorUri({
- auditorBaseUrl,
- auditorPub,
-}: Omit<AuditorUri, "type">): string {
- const { proto, path } = getUrlInfo(auditorBaseUrl);
- return `${proto}://auditor/${path}${auditorPub}`;
-}
-
export function stringifyWithdrawUri({
bankIntegrationApiBaseUrl,
withdrawalOperationId,