gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated (e05ba843a -> dcddc4c53)


From: gnunet
Subject: [taler-wallet-core] branch master updated (e05ba843a -> dcddc4c53)
Date: Fri, 25 Nov 2022 16:19:00 +0100

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

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

    from e05ba843a fix 7465
     new c121eb875 fix: ageRestriction option was missing
     new dcddc4c53 revert the Lost payment result

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 packages/taler-util/src/wallet-types.ts             | 18 +-----------------
 .../src/operations/backup/index.ts                  | 21 ++++++++-------------
 .../src/operations/pay-merchant.ts                  |  5 +----
 packages/taler-wallet-core/src/wallet.ts            |  5 ++++-
 .../src/cta/Payment/index.ts                        | 14 ++------------
 .../src/cta/Payment/state.ts                        |  7 -------
 .../src/cta/Payment/views.tsx                       | 18 ------------------
 7 files changed, 16 insertions(+), 72 deletions(-)

diff --git a/packages/taler-util/src/wallet-types.ts 
b/packages/taler-util/src/wallet-types.ts
index 0c837f2d0..61f2f3b73 100644
--- a/packages/taler-util/src/wallet-types.ts
+++ b/packages/taler-util/src/wallet-types.ts
@@ -385,7 +385,6 @@ export enum PreparePayResultType {
   PaymentPossible = "payment-possible",
   InsufficientBalance = "insufficient-balance",
   AlreadyConfirmed = "already-confirmed",
-  Lost = "lost",
 }
 
 export const codecForPreparePayResultPaymentPossible =
@@ -434,12 +433,6 @@ export const codecForPreparePayResultAlreadyConfirmed =
       .property("proposalId", codecForString())
       .build("PreparePayResultAlreadyConfirmed");
 
-export const codecForPreparePayResultPaymentLost =
-  (): Codec<PreparePayResultPaymentLost> =>
-    buildCodecForObject<PreparePayResultPaymentLost>()
-      .property("status", codecForConstString(PreparePayResultType.Lost))
-      .build("PreparePayResultLost");
-
 export const codecForPreparePayResult = (): Codec<PreparePayResult> =>
   buildCodecForUnion<PreparePayResult>()
     .discriminateOn("status")
@@ -455,10 +448,6 @@ export const codecForPreparePayResult = (): 
Codec<PreparePayResult> =>
       PreparePayResultType.PaymentPossible,
       codecForPreparePayResultPaymentPossible(),
     )
-    .alternative(
-      PreparePayResultType.Lost,
-      codecForPreparePayResultPaymentLost(),
-    )
     .build("PreparePayResult");
 
 /**
@@ -467,8 +456,7 @@ export const codecForPreparePayResult = (): 
Codec<PreparePayResult> =>
 export type PreparePayResult =
   | PreparePayResultInsufficientBalance
   | PreparePayResultAlreadyConfirmed
-  | PreparePayResultPaymentPossible
-  | PreparePayResultPaymentLost;
+  | PreparePayResultPaymentPossible;
 
 /**
  * Payment is possible.
@@ -504,10 +492,6 @@ export interface PreparePayResultAlreadyConfirmed {
   talerUri?: string;
 }
 
-export interface PreparePayResultPaymentLost {
-  status: PreparePayResultType.Lost;
-}
-
 export interface BankWithdrawDetails {
   selectionDone: boolean;
   transferDone: boolean;
diff --git a/packages/taler-wallet-core/src/operations/backup/index.ts 
b/packages/taler-wallet-core/src/operations/backup/index.ts
index eef838b0c..a44e8f55a 100644
--- a/packages/taler-wallet-core/src/operations/backup/index.ts
+++ b/packages/taler-wallet-core/src/operations/backup/index.ts
@@ -368,10 +368,7 @@ async function runBackupCycleForProvider(
       }
     }
 
-    if (
-      res === undefined ||
-      res.status === PreparePayResultType.AlreadyConfirmed
-    ) {
+    if (res === undefined) {
       //claimed
 
       await ws.db
@@ -400,10 +397,6 @@ async function runBackupCycleForProvider(
     }
     const result = res;
 
-    if (result.status === PreparePayResultType.Lost) {
-      throw Error("invalid state, could not get proposal for backup");
-    }
-
     await ws.db
       .mktx((x) => [x.backupProviders, x.operationRetries])
       .runReadWrite(async (tx) => {
@@ -890,7 +883,13 @@ async function getProviderPaymentInfo(
   const status = await checkPaymentByProposalId(
     ws,
     provider.currentPaymentProposalId,
-  );
+  ).catch(() => undefined);
+
+  if (!status) {
+    return {
+      type: ProviderPaymentType.Unpaid,
+    };
+  }
 
   switch (status.status) {
     case PreparePayResultType.InsufficientBalance:
@@ -903,10 +902,6 @@ async function getProviderPaymentInfo(
         type: ProviderPaymentType.Pending,
         talerUri: status.talerUri,
       };
-    case PreparePayResultType.Lost:
-      return {
-        type: ProviderPaymentType.Unpaid,
-      };
     case PreparePayResultType.AlreadyConfirmed:
       if (status.paid) {
         return {
diff --git a/packages/taler-wallet-core/src/operations/pay-merchant.ts 
b/packages/taler-wallet-core/src/operations/pay-merchant.ts
index d3d0a12bd..ed7f17a18 100644
--- a/packages/taler-wallet-core/src/operations/pay-merchant.ts
+++ b/packages/taler-wallet-core/src/operations/pay-merchant.ts
@@ -1291,10 +1291,7 @@ export async function checkPaymentByProposalId(
       return tx.purchases.get(proposalId);
     });
   if (!proposal) {
-    // throw Error(`could not get proposal ${proposalId}`);
-    return {
-      status: PreparePayResultType.Lost,
-    };
+    throw Error(`could not get proposal ${proposalId}`);
   }
   if (proposal.purchaseStatus === PurchaseStatus.RepurchaseDetected) {
     const existingProposalId = proposal.repurchaseProposalId;
diff --git a/packages/taler-wallet-core/src/wallet.ts 
b/packages/taler-wallet-core/src/wallet.ts
index 5ad86dfe8..2167de534 100644
--- a/packages/taler-wallet-core/src/wallet.ts
+++ b/packages/taler-wallet-core/src/wallet.ts
@@ -100,6 +100,7 @@ import {
   WalletCoreVersion,
   WalletNotification,
   codecForUserAttentionByIdRequest,
+  ManualWithdrawalDetails,
 } from "@gnu-taler/taler-util";
 import { TalerCryptoInterface } from "./crypto/cryptoImplementation.js";
 import {
@@ -1091,12 +1092,14 @@ async function dispatchRequestInternal<Op extends 
WalletApiOperation>(
         Amounts.parseOrThrow(req.amount),
         req.restrictAge,
       );
-      return {
+      const resp: ManualWithdrawalDetails = {
         amountRaw: req.amount,
         amountEffective: Amounts.stringify(wi.selectedDenoms.totalCoinValue),
         paytoUris: wi.exchangePaytoUris,
         tosAccepted: wi.termsOfServiceAccepted,
+        ageRestrictionOptions: wi.ageRestrictionOptions,
       };
+      return resp;
     }
     case WalletApiOperation.GetBalances: {
       return await getBalances(ws);
diff --git a/packages/taler-wallet-webextension/src/cta/Payment/index.ts 
b/packages/taler-wallet-webextension/src/cta/Payment/index.ts
index 80822b381..9bca8f74f 100644
--- a/packages/taler-wallet-webextension/src/cta/Payment/index.ts
+++ b/packages/taler-wallet-webextension/src/cta/Payment/index.ts
@@ -27,7 +27,7 @@ import { ButtonHandler } from "../../mui/handlers.js";
 import { compose, StateViewMap } from "../../utils/index.js";
 import { wxApi } from "../../wxApi.js";
 import { useComponentState } from "./state.js";
-import { BaseView, LoadingUriView, LostView } from "./views.js";
+import { BaseView, LoadingUriView } from "./views.js";
 
 export interface Props {
   talerPayUri?: string;
@@ -41,7 +41,6 @@ export type State =
   | State.LoadingUriError
   | State.Ready
   | State.NoEnoughBalance
-  | State.Lost
   | State.NoBalanceForCurrency
   | State.Confirmed;
 
@@ -64,10 +63,7 @@ export namespace State {
   }
   export interface NoBalanceForCurrency extends BaseInfo {
     status: "no-balance-for-currency";
-    payStatus:
-      | PreparePayResultInsufficientBalance
-      | PreparePayResultPaymentPossible
-      | PreparePayResultAlreadyConfirmed;
+    payStatus: PreparePayResult;
     balance: undefined;
   }
   export interface NoEnoughBalance extends BaseInfo {
@@ -82,11 +78,6 @@ export namespace State {
     balance: AmountJson;
   }
 
-  export interface Lost {
-    status: "lost";
-    error: undefined;
-  }
-
   export interface Confirmed extends BaseInfo {
     status: "confirmed";
     payStatus: PreparePayResultAlreadyConfirmed;
@@ -99,7 +90,6 @@ const viewMapping: StateViewMap<State> = {
   "loading-uri": LoadingUriView,
   "no-balance-for-currency": BaseView,
   "no-enough-balance": BaseView,
-  lost: LostView,
   confirmed: BaseView,
   ready: BaseView,
 };
diff --git a/packages/taler-wallet-webextension/src/cta/Payment/state.ts 
b/packages/taler-wallet-webextension/src/cta/Payment/state.ts
index b90b1e495..970af5b81 100644
--- a/packages/taler-wallet-webextension/src/cta/Payment/state.ts
+++ b/packages/taler-wallet-webextension/src/cta/Payment/state.ts
@@ -83,13 +83,6 @@ export function useComponentState(
   }
   const { payStatus } = hook.response;
 
-  if (payStatus.status === PreparePayResultType.Lost) {
-    return {
-      status: "lost",
-      error: undefined,
-    };
-  }
-
   const amount = Amounts.parseOrThrow(payStatus.amountRaw);
 
   const foundBalance = hook.response.balance.balances.find(
diff --git a/packages/taler-wallet-webextension/src/cta/Payment/views.tsx 
b/packages/taler-wallet-webextension/src/cta/Payment/views.tsx
index 6b502a87f..0f6cb5c28 100644
--- a/packages/taler-wallet-webextension/src/cta/Payment/views.tsx
+++ b/packages/taler-wallet-webextension/src/cta/Payment/views.tsx
@@ -65,21 +65,6 @@ type SupportedStates =
   | State.NoBalanceForCurrency
   | State.NoEnoughBalance;
 
-export function LostView(state: State.Lost): VNode {
-  const { i18n } = useTranslationContext();
-
-  return (
-    <ErrorMessage
-      title={<i18n.Translate>Could not load pay status</i18n.Translate>}
-      description={
-        <i18n.Translate>
-          The proposal was lost, another should be downloaded
-        </i18n.Translate>
-      }
-    />
-  );
-}
-
 export function BaseView(state: SupportedStates): VNode {
   const { i18n } = useTranslationContext();
 
@@ -417,9 +402,6 @@ export function ButtonsSection({
       </Fragment>
     );
   }
-  if (payStatus.status === PreparePayResultType.Lost) {
-    return <Fragment />;
-  }
 
   assertUnreachable(payStatus);
 }

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