gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated: wallet-core: show instructed


From: gnunet
Subject: [taler-wallet-core] branch master updated: wallet-core: show instructed amount as raw amount for withdrawal
Date: Sun, 16 Oct 2022 22:18:26 +0200

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

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

The following commit(s) were added to refs/heads/master by this push:
     new b52b074a8 wallet-core: show instructed amount as raw amount for 
withdrawal
b52b074a8 is described below

commit b52b074a8dd119347307f1face35c1c60eb94c44
Author: Florian Dold <florian@dold.me>
AuthorDate: Sun Oct 16 22:18:24 2022 +0200

    wallet-core: show instructed amount as raw amount for withdrawal
---
 packages/taler-util/src/backup-types.ts            |  2 ++
 packages/taler-wallet-cli/src/harness/harness.ts   |  1 +
 packages/taler-wallet-core/src/db.ts               | 29 ++++++++++++++++++----
 .../src/operations/backup/export.ts                |  3 +++
 .../src/operations/backup/import.ts                |  3 +++
 .../src/operations/transactions.ts                 |  8 +++---
 .../taler-wallet-core/src/operations/withdraw.ts   |  2 ++
 7 files changed, 39 insertions(+), 9 deletions(-)

diff --git a/packages/taler-util/src/backup-types.ts 
b/packages/taler-util/src/backup-types.ts
index 5d53f178e..b3eb082ea 100644
--- a/packages/taler-util/src/backup-types.ts
+++ b/packages/taler-util/src/backup-types.ts
@@ -333,6 +333,8 @@ export interface BackupWithdrawalGroup {
    */
   raw_withdrawal_amount: BackupAmountString;
 
+  effective_withdrawal_amount: BackupAmountString;
+
   /**
    * Restrict withdrawals from this reserve to this age.
    */
diff --git a/packages/taler-wallet-cli/src/harness/harness.ts 
b/packages/taler-wallet-cli/src/harness/harness.ts
index a5b519ec3..ae2845655 100644
--- a/packages/taler-wallet-cli/src/harness/harness.ts
+++ b/packages/taler-wallet-cli/src/harness/harness.ts
@@ -1972,6 +1972,7 @@ export class WalletCli {
         ...this.timetravelArgArr,
         "--wallet-db",
         this.dbfile,
+        "advanced",
         "run-pending",
       ],
     );
diff --git a/packages/taler-wallet-core/src/db.ts 
b/packages/taler-wallet-core/src/db.ts
index aa74e327f..258096433 100644
--- a/packages/taler-wallet-core/src/db.ts
+++ b/packages/taler-wallet-core/src/db.ts
@@ -1356,11 +1356,6 @@ export interface WithdrawalGroupRecord {
    */
   status: WithdrawalGroupStatus;
 
-  /**
-   * Amount that was sent by the user to fund the reserve.
-   */
-  instructedAmount: AmountJson;
-
   /**
    * Wire information (as payto URI) for the bank account that
    * transferred funds for this reserve.
@@ -1374,12 +1369,36 @@ export interface WithdrawalGroupRecord {
    */
   restrictAge?: number;
 
+  /**
+   * Amount that was sent by the user to fund the reserve.
+   */
+  instructedAmount: AmountJson;
+
+  /**
+   * Amount that was observed when querying the reserve that
+   * we are withdrawing from.
+   *
+   * Useful for diagnostics.
+   */
+  reserveBalanceAmount?: AmountJson;
+
   /**
    * Amount including fees (i.e. the amount subtracted from the
    * reserve to withdraw all coins in this withdrawal session).
+   *
+   * (Initial amount confirmed by the user, might differ with denomSel
+   * on reselection.)
    */
   rawWithdrawalAmount: AmountJson;
 
+  /**
+   * Amount that will be added to the balance when the withdrawal succeeds.
+   *
+   * (Initial amount confirmed by the user, might differ with denomSel
+   * on reselection.)
+   */
+  effectiveWithdrawalAmount: AmountJson;
+
   /**
    * Denominations selected for withdrawal.
    */
diff --git a/packages/taler-wallet-core/src/operations/backup/export.ts 
b/packages/taler-wallet-core/src/operations/backup/export.ts
index b0f1d6ce1..59b862d70 100644
--- a/packages/taler-wallet-core/src/operations/backup/export.ts
+++ b/packages/taler-wallet-core/src/operations/backup/export.ts
@@ -166,6 +166,9 @@ export async function exportBackup(
           secret_seed: wg.secretSeed,
           exchange_base_url: wg.exchangeBaseUrl,
           instructed_amount: Amounts.stringify(wg.instructedAmount),
+          effective_withdrawal_amount: Amounts.stringify(
+            wg.effectiveWithdrawalAmount,
+          ),
           reserve_priv: wg.reservePriv,
           restrict_age: wg.restrictAge,
           // FIXME: proper status conversion!
diff --git a/packages/taler-wallet-core/src/operations/backup/import.ts 
b/packages/taler-wallet-core/src/operations/backup/import.ts
index f08d152a5..995ae1091 100644
--- a/packages/taler-wallet-core/src/operations/backup/import.ts
+++ b/packages/taler-wallet-core/src/operations/backup/import.ts
@@ -556,6 +556,9 @@ export async function importBackup(
             rawWithdrawalAmount: Amounts.parseOrThrow(
               backupWg.raw_withdrawal_amount,
             ),
+            effectiveWithdrawalAmount: Amounts.parseOrThrow(
+              backupWg.effective_withdrawal_amount,
+            ),
             reservePriv: backupWg.reserve_priv,
             reservePub,
             status: backupWg.timestamp_finish
diff --git a/packages/taler-wallet-core/src/operations/transactions.ts 
b/packages/taler-wallet-core/src/operations/transactions.ts
index 1e7f982bc..b9f8dfdc6 100644
--- a/packages/taler-wallet-core/src/operations/transactions.ts
+++ b/packages/taler-wallet-core/src/operations/transactions.ts
@@ -379,7 +379,7 @@ function buildTransactionForPullPaymentCredit(
   return {
     type: TransactionType.PeerPullCredit,
     amountEffective: Amounts.stringify(wsr.denomsSel.totalCoinValue),
-    amountRaw: Amounts.stringify(wsr.rawWithdrawalAmount),
+    amountRaw: Amounts.stringify(wsr.instructedAmount),
     exchangeBaseUrl: wsr.exchangeBaseUrl,
     pending: !wsr.timestampFinish,
     timestamp: wsr.timestampStart,
@@ -409,7 +409,7 @@ function buildTransactionForPushPaymentCredit(
   return {
     type: TransactionType.PeerPushCredit,
     amountEffective: Amounts.stringify(wsr.denomsSel.totalCoinValue),
-    amountRaw: Amounts.stringify(wsr.rawWithdrawalAmount),
+    amountRaw: Amounts.stringify(wsr.instructedAmount),
     exchangeBaseUrl: wsr.exchangeBaseUrl,
     info: {
       expiration: wsr.wgInfo.contractTerms.purse_expiration,
@@ -436,7 +436,7 @@ function buildTransactionForBankIntegratedWithdraw(
   return {
     type: TransactionType.Withdrawal,
     amountEffective: Amounts.stringify(wsr.denomsSel.totalCoinValue),
-    amountRaw: Amounts.stringify(wsr.rawWithdrawalAmount),
+    amountRaw: Amounts.stringify(wsr.instructedAmount),
     withdrawalDetails: {
       type: WithdrawalType.TalerBankIntegrationApi,
       confirmed: wsr.wgInfo.bankInfo.timestampBankConfirmed ? true : false,
@@ -477,7 +477,7 @@ function buildTransactionForManualWithdraw(
     amountEffective: Amounts.stringify(
       withdrawalGroup.denomsSel.totalCoinValue,
     ),
-    amountRaw: Amounts.stringify(withdrawalGroup.rawWithdrawalAmount),
+    amountRaw: Amounts.stringify(withdrawalGroup.instructedAmount),
     withdrawalDetails: {
       type: WithdrawalType.ManualTransfer,
       reservePub: withdrawalGroup.reservePub,
diff --git a/packages/taler-wallet-core/src/operations/withdraw.ts 
b/packages/taler-wallet-core/src/operations/withdraw.ts
index 59863101a..6be7c7614 100644
--- a/packages/taler-wallet-core/src/operations/withdraw.ts
+++ b/packages/taler-wallet-core/src/operations/withdraw.ts
@@ -932,6 +932,7 @@ async function queryReserve(
         return;
       }
       wg.status = WithdrawalGroupStatus.Ready;
+      wg.reserveBalanceAmount = Amounts.parse(result.response.balance);
       await tx.withdrawalGroups.put(wg);
     });
 
@@ -1700,6 +1701,7 @@ export async function internalCreateWithdrawalGroup(
     instructedAmount: amount,
     timestampStart: now,
     rawWithdrawalAmount: initialDenomSel.totalWithdrawCost,
+    effectiveWithdrawalAmount: initialDenomSel.totalCoinValue,
     secretSeed,
     reservePriv: reserveKeyPair.priv,
     reservePub: reserveKeyPair.pub,

-- 
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]