diff options
author | Florian Dold <florian@dold.me> | 2024-01-09 18:37:43 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2024-01-09 18:37:43 +0100 |
commit | 4ffca702853771bb3807f3881d710b3fbb6d6191 (patch) | |
tree | f67d1b7aea83e811d1a4d8c4167397c5e7be3d4e /packages/taler-util | |
parent | 46f04b7f123d117cc639db74f66086382a7569c7 (diff) | |
download | wallet-core-4ffca702853771bb3807f3881d710b3fbb6d6191.tar.xz |
-misc. minor fixes, docs
Diffstat (limited to 'packages/taler-util')
-rw-r--r-- | packages/taler-util/src/taleruri.ts | 80 | ||||
-rw-r--r-- | packages/taler-util/src/wallet-types.ts | 2 |
2 files changed, 20 insertions, 62 deletions
diff --git a/packages/taler-util/src/taleruri.ts b/packages/taler-util/src/taleruri.ts index ff164dbbd..8f37dfe76 100644 --- a/packages/taler-util/src/taleruri.ts +++ b/packages/taler-util/src/taleruri.ts @@ -14,11 +14,23 @@ GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ +/** + * @fileoverview + * Construction and parsing of taler:// URIs. + * Specification: https://lsd.gnunet.org/lsd0006/ + */ + +/** + * Imports. + */ import { Codec, Context, DecodingError, renderContext } from "./codec.js"; import { canonicalizeBaseUrl } from "./helpers.js"; import { AmountString } from "./taler-types.js"; -import { URLSearchParams, URL } from "./url.js"; +import { URL, URLSearchParams } from "./url.js"; +/** + * A parsed taler URI. + */ export type TalerUri = | PayUriResult | PayTemplateUriResult @@ -181,10 +193,6 @@ export enum TalerUriType { Unknown = "unknown", } -const talerActionPayPull = "pay-pull"; -const talerActionPayPush = "pay-push"; -const talerActionPayTemplate = "pay-template"; - export enum TalerUriAction { Pay = "pay", Withdraw = "withdraw", @@ -332,7 +340,7 @@ export function parsePayUri(s: string): PayUriResult | undefined { export function parsePayTemplateUri( uriString: string, ): PayTemplateUriResult | undefined { - const pi = parseProtoInfo(uriString, talerActionPayTemplate); + const pi = parseProtoInfo(uriString, TalerUriAction.PayTemplate); if (!pi) { return undefined; } @@ -366,7 +374,7 @@ export function parsePayTemplateUri( } export function parsePayPushUri(s: string): PayPushUriResult | undefined { - const pi = parseProtoInfo(s, talerActionPayPush); + const pi = parseProtoInfo(s, TalerUriAction.PayPush); if (!pi) { return undefined; } @@ -391,7 +399,7 @@ export function parsePayPushUri(s: string): PayPushUriResult | undefined { } export function parsePayPullUri(s: string): PayPullUriResult | undefined { - const pi = parseProtoInfo(s, talerActionPayPull); + const pi = parseProtoInfo(s, TalerUriAction.PayPull); if (!pi) { return undefined; } @@ -598,56 +606,6 @@ export function parseRestoreUri(uri: string): BackupRestoreUri | undefined { // To string functions // ================================================ -/** - * @deprecated use stringifyRecoveryUri - */ -export function constructRecoveryUri(args: { - walletRootPriv: string; - providers: string[]; -}): string { - return stringifyRestoreUri(args); -} - -/** - * @deprecated stringifyPayPullUri - */ -export function constructPayPullUri(args: { - exchangeBaseUrl: string; - contractPriv: string; -}): string { - return stringifyPayPullUri(args); -} - -/** - * @deprecated use stringifyPayPushUri - */ -export function constructPayPushUri(args: { - exchangeBaseUrl: string; - contractPriv: string; -}): string { - return stringifyPayPushUri(args); -} - -/** - * - * @deprecated use stringifyPayUri - */ -export function constructPayUri( - merchantBaseUrl: string, - orderId: string, - sessionId: string, - claimToken?: string, - noncePriv?: string, -): string { - return stringifyPayUri({ - merchantBaseUrl, - orderId, - sessionId, - claimToken, - noncePriv, - }); -} - export function stringifyPayUri({ merchantBaseUrl, orderId, @@ -714,6 +672,7 @@ export function stringifyPayTemplateUri({ const { proto, path, query } = getUrlInfo(merchantBaseUrl, templateParams); return `${proto}://pay-template/${path}${templateId}${query}`; } + export function stringifyRefundUri({ merchantBaseUrl, orderId, @@ -721,6 +680,7 @@ export function stringifyRefundUri({ const { proto, path } = getUrlInfo(merchantBaseUrl); return `${proto}://refund/${path}${orderId}/`; } + export function stringifyRewardUri({ merchantBaseUrl, merchantRewardId, @@ -757,10 +717,6 @@ export function stringifyWithdrawUri({ * Use baseUrl to defined http or https * create path using host+port+pathname * use params to create a query parameter string or empty - * - * @param baseUrl - * @param params - * @returns */ function getUrlInfo( baseUrl: string, diff --git a/packages/taler-util/src/wallet-types.ts b/packages/taler-util/src/wallet-types.ts index a11d858fa..8ccc93c38 100644 --- a/packages/taler-util/src/wallet-types.ts +++ b/packages/taler-util/src/wallet-types.ts @@ -1046,6 +1046,8 @@ export interface CoinRefreshRequest { /** * Wrapper for refresh group IDs. + * + * @deprecated use types instead */ export interface RefreshGroupId { readonly refreshGroupId: string; |