aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2023-09-11 18:19:45 +0200
committerFlorian Dold <florian@dold.me>2023-09-11 18:20:00 +0200
commitcc27750a79d8d4dbbedaa0dfcf21fe21a7464936 (patch)
treed1d6392fe35018fd784d0789f6089f9f933002bc
parent905be0124a1b013d802db33265879d4b80501362 (diff)
-WalletContractData doesn't belong to the DB
m---------build-system/taler-build-scripts0
-rw-r--r--packages/taler-util/src/wallet-types.ts48
-rw-r--r--packages/taler-wallet-core/src/db.ts46
-rw-r--r--packages/taler-wallet-core/src/operations/balance.ts6
-rw-r--r--packages/taler-wallet-core/src/operations/pay-merchant.ts16
-rw-r--r--packages/taler-wallet-core/src/operations/transactions.ts2
-rw-r--r--packages/taler-wallet-core/src/util/coinSelection.ts18
-rw-r--r--packages/taler-wallet-core/src/wallet-api-types.ts24
-rw-r--r--packages/taler-wallet-webextension/src/components/ShowFullContractTermPopup.stories.tsx3
-rw-r--r--packages/taler-wallet-webextension/src/components/ShowFullContractTermPopup.tsx12
10 files changed, 80 insertions, 95 deletions
diff --git a/build-system/taler-build-scripts b/build-system/taler-build-scripts
-Subproject 001f5dd081fc8729ff8def90c4a1c3f93eb8689
+Subproject 23538677f6c6be2a62f38dc6137ecdd1c76b7b1
diff --git a/packages/taler-util/src/wallet-types.ts b/packages/taler-util/src/wallet-types.ts
index c6f19c73f..f7bd3d120 100644
--- a/packages/taler-util/src/wallet-types.ts
+++ b/packages/taler-util/src/wallet-types.ts
@@ -57,7 +57,9 @@ import {
DenomKeyType,
DenominationPubKey,
ExchangeAuditor,
+ InternationalizedString,
MerchantContractTerms,
+ MerchantInfo,
PeerContractTerms,
UnblindedSignature,
codecForMerchantContractTerms,
@@ -2667,3 +2669,49 @@ export const codecForTestingSetTimetravelRequest =
buildCodecForObject<TestingSetTimetravelRequest>()
.property("offsetMs", codecForNumber())
.build("TestingSetTimetravelRequest");
+
+export interface AllowedAuditorInfo {
+ auditorBaseUrl: string;
+ auditorPub: string;
+}
+
+export interface AllowedExchangeInfo {
+ exchangeBaseUrl: string;
+ exchangePub: string;
+}
+
+/**
+ * Data extracted from the contract terms that is relevant for payment
+ * processing in the wallet.
+ */
+export interface WalletContractData {
+ /**
+ * Fulfillment URL, or the empty string if the order has no fulfillment URL.
+ *
+ * Stored as a non-nullable string as we use this field for IndexedDB indexing.
+ */
+ fulfillmentUrl: string;
+
+ contractTermsHash: string;
+ fulfillmentMessage?: string;
+ fulfillmentMessageI18n?: InternationalizedString;
+ merchantSig: string;
+ merchantPub: string;
+ merchant: MerchantInfo;
+ amount: AmountString;
+ orderId: string;
+ merchantBaseUrl: string;
+ summary: string;
+ summaryI18n: { [lang_tag: string]: string } | undefined;
+ autoRefund: TalerProtocolDuration | undefined;
+ maxWireFee: AmountString;
+ wireFeeAmortization: number;
+ payDeadline: TalerProtocolTimestamp;
+ refundDeadline: TalerProtocolTimestamp;
+ allowedExchanges: AllowedExchangeInfo[];
+ timestamp: TalerProtocolTimestamp;
+ wireMethod: string;
+ wireInfoHash: string;
+ maxDepositFee: AmountString;
+ minimumAge?: number;
+}
diff --git a/packages/taler-wallet-core/src/db.ts b/packages/taler-wallet-core/src/db.ts
index 3a8109320..ba1f5b8c0 100644
--- a/packages/taler-wallet-core/src/db.ts
+++ b/packages/taler-wallet-core/src/db.ts
@@ -1035,52 +1035,6 @@ export enum RefundReason {
AbortRefund = "abort-pay-refund",
}
-export interface AllowedAuditorInfo {
- auditorBaseUrl: string;
- auditorPub: string;
-}
-
-export interface AllowedExchangeInfo {
- exchangeBaseUrl: string;
- exchangePub: string;
-}
-
-/**
- * Data extracted from the contract terms that is relevant for payment
- * processing in the wallet.
- */
-export interface WalletContractData {
- /**
- * Fulfillment URL, or the empty string if the order has no fulfillment URL.
- *
- * Stored as a non-nullable string as we use this field for IndexedDB indexing.
- */
- fulfillmentUrl: string;
-
- contractTermsHash: string;
- fulfillmentMessage?: string;
- fulfillmentMessageI18n?: InternationalizedString;
- merchantSig: string;
- merchantPub: string;
- merchant: MerchantInfo;
- amount: AmountString;
- orderId: string;
- merchantBaseUrl: string;
- summary: string;
- summaryI18n: { [lang_tag: string]: string } | undefined;
- autoRefund: TalerProtocolDuration | undefined;
- maxWireFee: AmountString;
- wireFeeAmortization: number;
- payDeadline: TalerProtocolTimestamp;
- refundDeadline: TalerProtocolTimestamp;
- allowedExchanges: AllowedExchangeInfo[];
- timestamp: TalerProtocolTimestamp;
- wireMethod: string;
- wireInfoHash: string;
- maxDepositFee: AmountString;
- minimumAge?: number;
-}
-
export enum PurchaseStatus {
/**
* Not downloaded yet.
diff --git a/packages/taler-wallet-core/src/operations/balance.ts b/packages/taler-wallet-core/src/operations/balance.ts
index a20ded2af..8034f78ea 100644
--- a/packages/taler-wallet-core/src/operations/balance.ts
+++ b/packages/taler-wallet-core/src/operations/balance.ts
@@ -50,6 +50,8 @@
* Imports.
*/
import {
+ AllowedAuditorInfo,
+ AllowedExchangeInfo,
AmountJson,
Amounts,
BalancesResponse,
@@ -60,17 +62,15 @@ import {
ScopeType,
} from "@gnu-taler/taler-util";
import {
- AllowedAuditorInfo,
- AllowedExchangeInfo,
RefreshGroupRecord,
WalletStoresV1,
WithdrawalGroupStatus,
} from "../db.js";
import { InternalWalletState } from "../internal-wallet-state.js";
+import { assertUnreachable } from "../util/assertUnreachable.js";
import { checkLogicInvariant } from "../util/invariants.js";
import { GetReadOnlyAccess } from "../util/query.js";
import { getExchangeDetails } from "./exchanges.js";
-import { assertUnreachable } from "../util/assertUnreachable.js";
/**
* Logger.
diff --git a/packages/taler-wallet-core/src/operations/pay-merchant.ts b/packages/taler-wallet-core/src/operations/pay-merchant.ts
index 57367bb20..fe0cbeda0 100644
--- a/packages/taler-wallet-core/src/operations/pay-merchant.ts
+++ b/packages/taler-wallet-core/src/operations/pay-merchant.ts
@@ -63,7 +63,6 @@ import {
RefreshReason,
SharePaymentResult,
StartRefundQueryForUriResponse,
- stringifyPaytoUri,
stringifyPayUri,
stringifyTalerUri,
TalerError,
@@ -78,6 +77,7 @@ import {
TransactionState,
TransactionType,
URL,
+ WalletContractData,
} from "@gnu-taler/taler-util";
import {
getHttpResponseErrorDetails,
@@ -95,7 +95,6 @@ import {
PurchaseRecord,
PurchaseStatus,
RefundReason,
- WalletContractData,
WalletStoresV1,
} from "../db.js";
import {
@@ -115,15 +114,13 @@ import { checkDbInvariant } from "../util/invariants.js";
import { GetReadOnlyAccess } from "../util/query.js";
import {
constructTaskIdentifier,
- TaskRunResult,
- TaskRunResultType,
RetryInfo,
- TaskIdentifiers,
-} from "./common.js";
-import {
runLongpollAsync,
runTaskWithErrorReporting,
spendCoins,
+ TaskIdentifiers,
+ TaskRunResult,
+ TaskRunResultType,
} from "./common.js";
import {
calculateRefreshOutput,
@@ -173,10 +170,7 @@ export async function getTotalPaymentCost(
const allDenoms = await tx.denominations.indexes.byExchangeBaseUrl
.iter(coin.exchangeBaseUrl)
.filter((x) =>
- Amounts.isSameCurrency(
- x.value,
- pcs.coinContributions[i],
- ),
+ Amounts.isSameCurrency(x.value, pcs.coinContributions[i]),
);
const amountLeft = Amounts.sub(
denom.value,
diff --git a/packages/taler-wallet-core/src/operations/transactions.ts b/packages/taler-wallet-core/src/operations/transactions.ts
index 7bdb9af5b..31655ad71 100644
--- a/packages/taler-wallet-core/src/operations/transactions.ts
+++ b/packages/taler-wallet-core/src/operations/transactions.ts
@@ -41,6 +41,7 @@ import {
TransactionsResponse,
TransactionState,
TransactionType,
+ WalletContractData,
WithdrawalType,
} from "@gnu-taler/taler-util";
import {
@@ -60,7 +61,6 @@ import {
RefreshOperationStatus,
RefundGroupRecord,
RewardRecord,
- WalletContractData,
WithdrawalGroupRecord,
WithdrawalGroupStatus,
WithdrawalRecordType,
diff --git a/packages/taler-wallet-core/src/util/coinSelection.ts b/packages/taler-wallet-core/src/util/coinSelection.ts
index ef2f85789..6fd0f1b86 100644
--- a/packages/taler-wallet-core/src/util/coinSelection.ts
+++ b/packages/taler-wallet-core/src/util/coinSelection.ts
@@ -28,21 +28,20 @@ import {
AbsoluteTime,
AgeCommitmentProof,
AgeRestriction,
+ AllowedAuditorInfo,
+ AllowedExchangeInfo,
AmountJson,
AmountLike,
- AmountResponse,
Amounts,
AmountString,
CoinPublicKeyString,
CoinStatus,
- ConvertAmountRequest,
DenominationInfo,
DenominationPubKey,
DenomSelectionState,
Duration,
ForcedCoinSel,
ForcedDenomSel,
- GetAmountRequest,
j2s,
Logger,
parsePaytoUri,
@@ -50,24 +49,13 @@ import {
PayMerchantInsufficientBalanceDetails,
PayPeerInsufficientBalanceDetails,
strcmp,
- TransactionAmountMode,
- TransactionType,
UnblindedSignature,
} from "@gnu-taler/taler-util";
+import { DenominationRecord } from "../db.js";
import {
- AllowedAuditorInfo,
- AllowedExchangeInfo,
- DenominationRecord,
-} from "../db.js";
-import {
- DbReadOnlyTransaction,
getExchangeDetails,
- GetReadOnlyAccess,
- GetReadWriteAccess,
isWithdrawableDenom,
- StoreNames,
WalletDbReadOnlyTransaction,
- WalletStoresV1,
} from "../index.js";
import { InternalWalletState } from "../internal-wallet-state.js";
import {
diff --git a/packages/taler-wallet-core/src/wallet-api-types.ts b/packages/taler-wallet-core/src/wallet-api-types.ts
index d89ad257a..67c05a42f 100644
--- a/packages/taler-wallet-core/src/wallet-api-types.ts
+++ b/packages/taler-wallet-core/src/wallet-api-types.ts
@@ -38,7 +38,6 @@ import {
ApplyDevExperimentRequest,
BackupRecovery,
BalancesResponse,
- FailTransactionRequest,
CheckPeerPullCreditRequest,
CheckPeerPullCreditResponse,
CheckPeerPushDebitRequest,
@@ -51,14 +50,19 @@ import {
ConvertAmountRequest,
CreateDepositGroupRequest,
CreateDepositGroupResponse,
+ CreateStoredBackupResponse,
+ DeleteStoredBackupRequest,
DeleteTransactionRequest,
ExchangeDetailedResponse,
ExchangesListResponse,
+ FailTransactionRequest,
ForceRefreshRequest,
ForgetKnownBankAccountsRequest,
GetAmountRequest,
GetBalanceDetailRequest,
GetContractTermsDetailsRequest,
+ GetCurrencyInfoRequest,
+ GetCurrencyInfoResponse,
GetExchangeTosRequest,
GetExchangeTosResult,
GetPlanForOperationRequest,
@@ -85,16 +89,21 @@ import {
PreparePeerPushCreditRequest,
PreparePeerPushCreditResponse,
PrepareRefundRequest,
- PrepareRewardRequest as PrepareRewardRequest,
+ PrepareRewardRequest,
PrepareTipResult as PrepareRewardResult,
+ RecoverStoredBackupRequest,
RecoveryLoadRequest,
RetryTransactionRequest,
SetCoinSuspendedRequest,
SetWalletDeviceIdRequest,
+ SharePaymentRequest,
+ SharePaymentResult,
StartRefundQueryForUriResponse,
StartRefundQueryRequest,
+ StoredBackupList,
TestPayArgs,
TestPayResult,
+ TestingSetTimetravelRequest,
Transaction,
TransactionByIdRequest,
TransactionsRequest,
@@ -106,22 +115,13 @@ import {
UserAttentionsResponse,
ValidateIbanRequest,
ValidateIbanResponse,
+ WalletContractData,
WalletCoreVersion,
WalletCurrencyInfo,
WithdrawFakebankRequest,
WithdrawTestBalanceRequest,
WithdrawUriInfoResponse,
- SharePaymentRequest,
- SharePaymentResult,
- GetCurrencyInfoRequest,
- GetCurrencyInfoResponse,
- StoredBackupList,
- CreateStoredBackupResponse,
- RecoverStoredBackupRequest,
- DeleteStoredBackupRequest,
- TestingSetTimetravelRequest,
} from "@gnu-taler/taler-util";
-import { WalletContractData } from "./db.js";
import {
AddBackupProviderRequest,
AddBackupProviderResponse,
diff --git a/packages/taler-wallet-webextension/src/components/ShowFullContractTermPopup.stories.tsx b/packages/taler-wallet-webextension/src/components/ShowFullContractTermPopup.stories.tsx
index 74c92cbc6..1b1802b8c 100644
--- a/packages/taler-wallet-webextension/src/components/ShowFullContractTermPopup.stories.tsx
+++ b/packages/taler-wallet-webextension/src/components/ShowFullContractTermPopup.stories.tsx
@@ -18,8 +18,6 @@
*
* @author Sebastian Javier Marchano (sebasjm)
*/
-
-import { WalletContractData } from "@gnu-taler/taler-wallet-core";
import * as tests from "@gnu-taler/web-util/testing";
import {
ErrorView,
@@ -27,6 +25,7 @@ import {
LoadingView,
ShowView,
} from "./ShowFullContractTermPopup.js";
+import { WalletContractData } from "@gnu-taler/taler-util";
export default {
title: "ShowFullContractTermPopup",
diff --git a/packages/taler-wallet-webextension/src/components/ShowFullContractTermPopup.tsx b/packages/taler-wallet-webextension/src/components/ShowFullContractTermPopup.tsx
index db9b6ebcd..0b3cca0b2 100644
--- a/packages/taler-wallet-webextension/src/components/ShowFullContractTermPopup.tsx
+++ b/packages/taler-wallet-webextension/src/components/ShowFullContractTermPopup.tsx
@@ -13,11 +13,13 @@
You should have received a copy of the GNU General Public License along with
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-import { AbsoluteTime, Duration, Location } from "@gnu-taler/taler-util";
import {
- WalletApiOperation,
+ AbsoluteTime,
+ Duration,
+ Location,
WalletContractData,
-} from "@gnu-taler/taler-wallet-core";
+} from "@gnu-taler/taler-util";
+import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import { styled } from "@linaria/react";
import { Fragment, h, VNode } from "preact";
import { useState } from "preact/hooks";
@@ -334,8 +336,8 @@ export function ShowView({ contractTerms, hideHandler }: States.Show): VNode {
!contractTerms.autoRefund
? Duration.getZero()
: Duration.fromTalerProtocolDuration(
- contractTerms.autoRefund,
- ),
+ contractTerms.autoRefund,
+ ),
)}
format="dd MMMM yyyy, HH:mm"
/>