diff options
author | Sebastian <sebasjm@gmail.com> | 2023-08-30 11:54:08 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2023-08-30 11:54:08 -0300 |
commit | 183aed4ba50e0dd4b9442cd85db8bdd91fa188e5 (patch) | |
tree | a97173566bb9bf4124a3f24c312d0a2df8f3cc5a /packages/taler-util/src | |
parent | 84d4e68ab70c26ffcdccb5d62a507f9acf244fa3 (diff) | |
download | wallet-core-183aed4ba50e0dd4b9442cd85db8bdd91fa188e5.tar.xz |
tip -> reward
Diffstat (limited to 'packages/taler-util/src')
-rw-r--r-- | packages/taler-util/src/taleruri.test.ts | 16 | ||||
-rw-r--r-- | packages/taler-util/src/taleruri.ts | 10 |
2 files changed, 13 insertions, 13 deletions
diff --git a/packages/taler-util/src/taleruri.test.ts b/packages/taler-util/src/taleruri.test.ts index 0dcf92252..19b94e191 100644 --- a/packages/taler-util/src/taleruri.test.ts +++ b/packages/taler-util/src/taleruri.test.ts @@ -159,8 +159,8 @@ test("taler refund uri parsing with instance", (t) => { t.is(r1.merchantBaseUrl, "https://merchant.example.com/instances/myinst/"); }); -test("taler tip pickup uri", (t) => { - const url1 = "taler://tip/merchant.example.com/tipid"; +test("taler reward pickup uri", (t) => { + const url1 = "taler://reward/merchant.example.com/tipid"; const r1 = parseRewardUri(url1); if (!r1) { t.fail(); @@ -169,26 +169,26 @@ test("taler tip pickup uri", (t) => { t.is(r1.merchantBaseUrl, "https://merchant.example.com/"); }); -test("taler tip pickup uri with instance", (t) => { - const url1 = "taler://tip/merchant.example.com/instances/tipm/tipid"; +test("taler reward pickup uri with instance", (t) => { + const url1 = "taler://reward/merchant.example.com/instances/tipm/tipid"; const r1 = parseRewardUri(url1); if (!r1) { t.fail(); return; } t.is(r1.merchantBaseUrl, "https://merchant.example.com/instances/tipm/"); - t.is(r1.merchantTipId, "tipid"); + t.is(r1.merchantRewardId, "tipid"); }); -test("taler tip pickup uri with instance and prefix", (t) => { - const url1 = "taler://tip/merchant.example.com/my/pfx/tipm/tipid"; +test("taler reward pickup uri with instance and prefix", (t) => { + const url1 = "taler://reward/merchant.example.com/my/pfx/tipm/tipid"; const r1 = parseRewardUri(url1); if (!r1) { t.fail(); return; } t.is(r1.merchantBaseUrl, "https://merchant.example.com/my/pfx/tipm/"); - t.is(r1.merchantTipId, "tipid"); + t.is(r1.merchantRewardId, "tipid"); }); test("taler peer to peer push URI", (t) => { diff --git a/packages/taler-util/src/taleruri.ts b/packages/taler-util/src/taleruri.ts index fff1ca833..310986eaf 100644 --- a/packages/taler-util/src/taleruri.ts +++ b/packages/taler-util/src/taleruri.ts @@ -63,7 +63,7 @@ export interface RefundUriResult { export interface RewardUriResult { type: TalerUriAction.Reward; merchantBaseUrl: string; - merchantTipId: string; + merchantRewardId: string; } export interface ExchangeUri { @@ -408,7 +408,7 @@ export function parseRewardUri(s: string): RewardUriResult | undefined { return undefined; } const host = parts[0].toLowerCase(); - const tipId = parts[parts.length - 1]; + const rewardId = parts[parts.length - 1]; const pathSegments = parts.slice(1, parts.length - 1); const hostAndSegments = [host, ...pathSegments].join("/"); const merchantBaseUrl = canonicalizeBaseUrl( @@ -418,7 +418,7 @@ export function parseRewardUri(s: string): RewardUriResult | undefined { return { type: TalerUriAction.Reward, merchantBaseUrl, - merchantTipId: tipId, + merchantRewardId: rewardId, }; } @@ -701,10 +701,10 @@ export function stringifyRefundUri({ } export function stringifyRewardUri({ merchantBaseUrl, - merchantTipId, + merchantRewardId, }: Omit<RewardUriResult, "type">): string { const { proto, path } = getUrlInfo(merchantBaseUrl); - return `${proto}://reward/${path}${merchantTipId}`; + return `${proto}://reward/${path}${merchantRewardId}`; } export function stringifyExchangeUri({ |