gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-wallet-core] branch master updated: tip -> reward


From: gnunet
Subject: [taler-wallet-core] branch master updated: tip -> reward
Date: Wed, 30 Aug 2023 16:54:16 +0200

This is an automated email from the git hooks/post-receive script.

sebasjm pushed a commit to branch master
in repository wallet-core.

The following commit(s) were added to refs/heads/master by this push:
     new 183aed4ba tip -> reward
183aed4ba is described below

commit 183aed4ba50e0dd4b9442cd85db8bdd91fa188e5
Author: Sebastian <sebasjm@gmail.com>
AuthorDate: Wed Aug 30 11:54:08 2023 -0300

    tip -> reward
---
 packages/taler-util/src/taleruri.test.ts            | 16 ++++++++--------
 packages/taler-util/src/taleruri.ts                 | 10 +++++-----
 packages/taler-wallet-core/src/operations/reward.ts |  6 +++---
 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,

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]