summaryrefslogtreecommitdiff
path: root/packages/taler-util/src
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2024-03-07 19:27:41 +0100
committerFlorian Dold <florian@dold.me>2024-03-07 19:27:41 +0100
commit983d14761eb1c33f4a59211b132f8485b7998bda (patch)
tree6f61f4ddf137233422b4f4e8cdcc810fa7538571 /packages/taler-util/src
parentb2864507bbd4e27a7d74fdcdf801b8eb34dbe3c4 (diff)
downloadwallet-core-983d14761eb1c33f4a59211b132f8485b7998bda.tar.gz
wallet-core-983d14761eb1c33f4a59211b132f8485b7998bda.tar.bz2
wallet-core-983d14761eb1c33f4a59211b132f8485b7998bda.zip
-rewards are gone!
Diffstat (limited to 'packages/taler-util/src')
-rw-r--r--packages/taler-util/src/taleruri.test.ts46
-rw-r--r--packages/taler-util/src/taleruri.ts50
2 files changed, 0 insertions, 96 deletions
diff --git a/packages/taler-util/src/taleruri.test.ts b/packages/taler-util/src/taleruri.test.ts
index 2ff401abc..ab7a27af6 100644
--- a/packages/taler-util/src/taleruri.test.ts
+++ b/packages/taler-util/src/taleruri.test.ts
@@ -24,7 +24,6 @@ import {
parsePayUri,
parseRefundUri,
parseRestoreUri,
- parseRewardUri,
parseWithdrawExchangeUri,
parseWithdrawUri,
stringifyDevExperimentUri,
@@ -34,7 +33,6 @@ import {
stringifyPayUri,
stringifyRefundUri,
stringifyRestoreUri,
- stringifyRewardUri,
stringifyWithdrawExchange,
stringifyWithdrawUri,
} from "./taleruri.js";
@@ -219,50 +217,6 @@ test("taler refund URI (stringify)", (t) => {
});
/**
- * 5.4 action: reward https://lsd.gnunet.org/lsd0006/#name-action-tip
- */
-
-test("taler reward pickup uri", (t) => {
- const url1 = "taler://reward/merchant.example.com/tipid";
- const r1 = parseRewardUri(url1);
- if (!r1) {
- t.fail();
- return;
- }
- t.is(r1.merchantBaseUrl, "https://merchant.example.com/");
-});
-
-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.merchantRewardId, "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.merchantRewardId, "tipid");
-});
-
-test("taler reward URI (stringify)", (t) => {
- const url = stringifyRewardUri({
- merchantBaseUrl: "https://merchant.test/instance/pepe/",
- merchantRewardId: "123",
- });
- t.deepEqual(url, "taler://reward/merchant.test/instance/pepe/123/");
-});
-
-/**
* 5.5 action: pay-push https://lsd.gnunet.org/lsd0006/#name-action-pay-push
*/
diff --git a/packages/taler-util/src/taleruri.ts b/packages/taler-util/src/taleruri.ts
index 15464b981..9717a7d71 100644
--- a/packages/taler-util/src/taleruri.ts
+++ b/packages/taler-util/src/taleruri.ts
@@ -39,7 +39,6 @@ export type TalerUri =
| PayPushUriResult
| BackupRestoreUri
| RefundUriResult
- | RewardUriResult
| WithdrawUriResult
| WithdrawExchangeUri;
@@ -97,12 +96,6 @@ export interface RefundUriResult {
orderId: string;
}
-export interface RewardUriResult {
- type: TalerUriAction.Reward;
- merchantBaseUrl: string;
- merchantRewardId: string;
-}
-
export interface PayPushUriResult {
type: TalerUriAction.PayPush;
exchangeBaseUrl: string;
@@ -188,7 +181,6 @@ export enum TalerUriAction {
Pay = "pay",
Withdraw = "withdraw",
Refund = "refund",
- Reward = "reward",
PayPull = "pay-pull",
PayPush = "pay-push",
PayTemplate = "pay-template",
@@ -231,7 +223,6 @@ const parsers: { [A in TalerUriAction]: Parser } = {
[TalerUriAction.PayTemplate]: parsePayTemplateUri,
[TalerUriAction.Restore]: parseRestoreUri,
[TalerUriAction.Refund]: parseRefundUri,
- [TalerUriAction.Reward]: parseRewardUri,
[TalerUriAction.Withdraw]: parseWithdrawUri,
[TalerUriAction.DevExperiment]: parseDevExperimentUri,
[TalerUriAction.WithdrawExchange]: parseWithdrawExchangeUri,
@@ -272,9 +263,6 @@ export function stringifyTalerUri(uri: TalerUri): string {
case TalerUriAction.Refund: {
return stringifyRefundUri(uri);
}
- case TalerUriAction.Reward: {
- return stringifyRewardUri(uri);
- }
case TalerUriAction.Withdraw: {
return stringifyWithdrawUri(uri);
}
@@ -404,36 +392,6 @@ export function parsePayPullUri(s: string): PayPullUriResult | undefined {
};
}
-/**
- * Parse a taler[+http]://reward URI.
- * Return undefined if not passed a valid URI.
- */
-export function parseRewardUri(s: string): RewardUriResult | undefined {
- const pi = parseProtoInfo(s, "reward");
- 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 unused = parts[parts.length - 1];
- const rewardId = parts[parts.length - 2];
- const pathSegments = parts.slice(1, parts.length - 2);
- const hostAndSegments = [host, ...pathSegments].join("/");
- const merchantBaseUrl = canonicalizeBaseUrl(
- `${pi.innerProto}://${hostAndSegments}/`,
- );
-
- return {
- type: TalerUriAction.Reward,
- merchantBaseUrl,
- merchantRewardId: rewardId,
- };
-}
-
export function parseWithdrawExchangeUri(
s: string,
): WithdrawExchangeUri | undefined {
@@ -613,14 +571,6 @@ export function stringifyRefundUri({
return `${proto}://refund/${path}${orderId}/`;
}
-export function stringifyRewardUri({
- merchantBaseUrl,
- merchantRewardId,
-}: Omit<RewardUriResult, "type">): string {
- const { proto, path } = getUrlInfo(merchantBaseUrl);
- return `${proto}://reward/${path}${merchantRewardId}/`;
-}
-
export function stringifyWithdrawUri({
bankIntegrationApiBaseUrl,
withdrawalOperationId,