aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2023-08-30 11:54:08 -0300
committerSebastian <sebasjm@gmail.com>2023-08-30 11:54:08 -0300
commit183aed4ba50e0dd4b9442cd85db8bdd91fa188e5 (patch)
treea97173566bb9bf4124a3f24c312d0a2df8f3cc5a
parent84d4e68ab70c26ffcdccb5d62a507f9acf244fa3 (diff)
tip -> reward
-rw-r--r--packages/taler-util/src/taleruri.test.ts16
-rw-r--r--packages/taler-util/src/taleruri.ts10
-rw-r--r--packages/taler-wallet-core/src/operations/reward.ts6
3 files changed, 16 insertions, 16 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({
diff --git a/packages/taler-wallet-core/src/operations/reward.ts b/packages/taler-wallet-core/src/operations/reward.ts
index 69c888d7a..6f9d3ce85 100644
--- a/packages/taler-wallet-core/src/operations/reward.ts
+++ b/packages/taler-wallet-core/src/operations/reward.ts
@@ -150,14 +150,14 @@ export async function prepareTip(
.mktx((x) => [x.rewards])
.runReadOnly(async (tx) => {
return tx.rewards.indexes.byMerchantTipIdAndBaseUrl.get([
- res.merchantTipId,
+ res.merchantRewardId,
res.merchantBaseUrl,
]);
});
if (!tipRecord) {
const tipStatusUrl = new URL(
- `tips/${res.merchantTipId}`,
+ `rewards/${res.merchantRewardId}`,
res.merchantBaseUrl,
);
logger.trace("checking tip status from", tipStatusUrl.href);
@@ -204,7 +204,7 @@ export async function prepareTip(
next_url: tipPickupStatus.next_url,
merchantBaseUrl: res.merchantBaseUrl,
createdTimestamp: TalerPreciseTimestamp.now(),
- merchantRewardId: res.merchantTipId,
+ merchantRewardId: res.merchantRewardId,
rewardAmountEffective: Amounts.stringify(selectedDenoms.totalCoinValue),
denomsSel: selectedDenoms,
pickedUpTimestamp: undefined,