-WalletContractData doesn't belong to the DB

This commit is contained in:
Florian Dold 2023-09-11 18:19:45 +02:00
parent 905be0124a
commit cc27750a79
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B
10 changed files with 81 additions and 96 deletions

@ -1 +1 @@
Subproject commit 001f5dd081fc8729ff8def90c4a1c3f93eb8689a Subproject commit 23538677f6c6be2a62f38dc6137ecdd1c76b7b15

View File

@ -57,7 +57,9 @@ import {
DenomKeyType, DenomKeyType,
DenominationPubKey, DenominationPubKey,
ExchangeAuditor, ExchangeAuditor,
InternationalizedString,
MerchantContractTerms, MerchantContractTerms,
MerchantInfo,
PeerContractTerms, PeerContractTerms,
UnblindedSignature, UnblindedSignature,
codecForMerchantContractTerms, codecForMerchantContractTerms,
@ -2667,3 +2669,49 @@ export const codecForTestingSetTimetravelRequest =
buildCodecForObject<TestingSetTimetravelRequest>() buildCodecForObject<TestingSetTimetravelRequest>()
.property("offsetMs", codecForNumber()) .property("offsetMs", codecForNumber())
.build("TestingSetTimetravelRequest"); .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;
}

View File

@ -1035,52 +1035,6 @@ export enum RefundReason {
AbortRefund = "abort-pay-refund", 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 { export enum PurchaseStatus {
/** /**
* Not downloaded yet. * Not downloaded yet.

View File

@ -50,6 +50,8 @@
* Imports. * Imports.
*/ */
import { import {
AllowedAuditorInfo,
AllowedExchangeInfo,
AmountJson, AmountJson,
Amounts, Amounts,
BalancesResponse, BalancesResponse,
@ -60,17 +62,15 @@ import {
ScopeType, ScopeType,
} from "@gnu-taler/taler-util"; } from "@gnu-taler/taler-util";
import { import {
AllowedAuditorInfo,
AllowedExchangeInfo,
RefreshGroupRecord, RefreshGroupRecord,
WalletStoresV1, WalletStoresV1,
WithdrawalGroupStatus, WithdrawalGroupStatus,
} from "../db.js"; } from "../db.js";
import { InternalWalletState } from "../internal-wallet-state.js"; import { InternalWalletState } from "../internal-wallet-state.js";
import { assertUnreachable } from "../util/assertUnreachable.js";
import { checkLogicInvariant } from "../util/invariants.js"; import { checkLogicInvariant } from "../util/invariants.js";
import { GetReadOnlyAccess } from "../util/query.js"; import { GetReadOnlyAccess } from "../util/query.js";
import { getExchangeDetails } from "./exchanges.js"; import { getExchangeDetails } from "./exchanges.js";
import { assertUnreachable } from "../util/assertUnreachable.js";
/** /**
* Logger. * Logger.

View File

@ -63,7 +63,6 @@ import {
RefreshReason, RefreshReason,
SharePaymentResult, SharePaymentResult,
StartRefundQueryForUriResponse, StartRefundQueryForUriResponse,
stringifyPaytoUri,
stringifyPayUri, stringifyPayUri,
stringifyTalerUri, stringifyTalerUri,
TalerError, TalerError,
@ -78,6 +77,7 @@ import {
TransactionState, TransactionState,
TransactionType, TransactionType,
URL, URL,
WalletContractData,
} from "@gnu-taler/taler-util"; } from "@gnu-taler/taler-util";
import { import {
getHttpResponseErrorDetails, getHttpResponseErrorDetails,
@ -95,7 +95,6 @@ import {
PurchaseRecord, PurchaseRecord,
PurchaseStatus, PurchaseStatus,
RefundReason, RefundReason,
WalletContractData,
WalletStoresV1, WalletStoresV1,
} from "../db.js"; } from "../db.js";
import { import {
@ -115,15 +114,13 @@ import { checkDbInvariant } from "../util/invariants.js";
import { GetReadOnlyAccess } from "../util/query.js"; import { GetReadOnlyAccess } from "../util/query.js";
import { import {
constructTaskIdentifier, constructTaskIdentifier,
TaskRunResult,
TaskRunResultType,
RetryInfo, RetryInfo,
TaskIdentifiers,
} from "./common.js";
import {
runLongpollAsync, runLongpollAsync,
runTaskWithErrorReporting, runTaskWithErrorReporting,
spendCoins, spendCoins,
TaskIdentifiers,
TaskRunResult,
TaskRunResultType,
} from "./common.js"; } from "./common.js";
import { import {
calculateRefreshOutput, calculateRefreshOutput,
@ -173,10 +170,7 @@ export async function getTotalPaymentCost(
const allDenoms = await tx.denominations.indexes.byExchangeBaseUrl const allDenoms = await tx.denominations.indexes.byExchangeBaseUrl
.iter(coin.exchangeBaseUrl) .iter(coin.exchangeBaseUrl)
.filter((x) => .filter((x) =>
Amounts.isSameCurrency( Amounts.isSameCurrency(x.value, pcs.coinContributions[i]),
x.value,
pcs.coinContributions[i],
),
); );
const amountLeft = Amounts.sub( const amountLeft = Amounts.sub(
denom.value, denom.value,

View File

@ -41,6 +41,7 @@ import {
TransactionsResponse, TransactionsResponse,
TransactionState, TransactionState,
TransactionType, TransactionType,
WalletContractData,
WithdrawalType, WithdrawalType,
} from "@gnu-taler/taler-util"; } from "@gnu-taler/taler-util";
import { import {
@ -60,7 +61,6 @@ import {
RefreshOperationStatus, RefreshOperationStatus,
RefundGroupRecord, RefundGroupRecord,
RewardRecord, RewardRecord,
WalletContractData,
WithdrawalGroupRecord, WithdrawalGroupRecord,
WithdrawalGroupStatus, WithdrawalGroupStatus,
WithdrawalRecordType, WithdrawalRecordType,

View File

@ -28,21 +28,20 @@ import {
AbsoluteTime, AbsoluteTime,
AgeCommitmentProof, AgeCommitmentProof,
AgeRestriction, AgeRestriction,
AllowedAuditorInfo,
AllowedExchangeInfo,
AmountJson, AmountJson,
AmountLike, AmountLike,
AmountResponse,
Amounts, Amounts,
AmountString, AmountString,
CoinPublicKeyString, CoinPublicKeyString,
CoinStatus, CoinStatus,
ConvertAmountRequest,
DenominationInfo, DenominationInfo,
DenominationPubKey, DenominationPubKey,
DenomSelectionState, DenomSelectionState,
Duration, Duration,
ForcedCoinSel, ForcedCoinSel,
ForcedDenomSel, ForcedDenomSel,
GetAmountRequest,
j2s, j2s,
Logger, Logger,
parsePaytoUri, parsePaytoUri,
@ -50,24 +49,13 @@ import {
PayMerchantInsufficientBalanceDetails, PayMerchantInsufficientBalanceDetails,
PayPeerInsufficientBalanceDetails, PayPeerInsufficientBalanceDetails,
strcmp, strcmp,
TransactionAmountMode,
TransactionType,
UnblindedSignature, UnblindedSignature,
} from "@gnu-taler/taler-util"; } from "@gnu-taler/taler-util";
import { DenominationRecord } from "../db.js";
import { import {
AllowedAuditorInfo,
AllowedExchangeInfo,
DenominationRecord,
} from "../db.js";
import {
DbReadOnlyTransaction,
getExchangeDetails, getExchangeDetails,
GetReadOnlyAccess,
GetReadWriteAccess,
isWithdrawableDenom, isWithdrawableDenom,
StoreNames,
WalletDbReadOnlyTransaction, WalletDbReadOnlyTransaction,
WalletStoresV1,
} from "../index.js"; } from "../index.js";
import { InternalWalletState } from "../internal-wallet-state.js"; import { InternalWalletState } from "../internal-wallet-state.js";
import { import {

View File

@ -38,7 +38,6 @@ import {
ApplyDevExperimentRequest, ApplyDevExperimentRequest,
BackupRecovery, BackupRecovery,
BalancesResponse, BalancesResponse,
FailTransactionRequest,
CheckPeerPullCreditRequest, CheckPeerPullCreditRequest,
CheckPeerPullCreditResponse, CheckPeerPullCreditResponse,
CheckPeerPushDebitRequest, CheckPeerPushDebitRequest,
@ -51,14 +50,19 @@ import {
ConvertAmountRequest, ConvertAmountRequest,
CreateDepositGroupRequest, CreateDepositGroupRequest,
CreateDepositGroupResponse, CreateDepositGroupResponse,
CreateStoredBackupResponse,
DeleteStoredBackupRequest,
DeleteTransactionRequest, DeleteTransactionRequest,
ExchangeDetailedResponse, ExchangeDetailedResponse,
ExchangesListResponse, ExchangesListResponse,
FailTransactionRequest,
ForceRefreshRequest, ForceRefreshRequest,
ForgetKnownBankAccountsRequest, ForgetKnownBankAccountsRequest,
GetAmountRequest, GetAmountRequest,
GetBalanceDetailRequest, GetBalanceDetailRequest,
GetContractTermsDetailsRequest, GetContractTermsDetailsRequest,
GetCurrencyInfoRequest,
GetCurrencyInfoResponse,
GetExchangeTosRequest, GetExchangeTosRequest,
GetExchangeTosResult, GetExchangeTosResult,
GetPlanForOperationRequest, GetPlanForOperationRequest,
@ -85,16 +89,21 @@ import {
PreparePeerPushCreditRequest, PreparePeerPushCreditRequest,
PreparePeerPushCreditResponse, PreparePeerPushCreditResponse,
PrepareRefundRequest, PrepareRefundRequest,
PrepareRewardRequest as PrepareRewardRequest, PrepareRewardRequest,
PrepareTipResult as PrepareRewardResult, PrepareTipResult as PrepareRewardResult,
RecoverStoredBackupRequest,
RecoveryLoadRequest, RecoveryLoadRequest,
RetryTransactionRequest, RetryTransactionRequest,
SetCoinSuspendedRequest, SetCoinSuspendedRequest,
SetWalletDeviceIdRequest, SetWalletDeviceIdRequest,
SharePaymentRequest,
SharePaymentResult,
StartRefundQueryForUriResponse, StartRefundQueryForUriResponse,
StartRefundQueryRequest, StartRefundQueryRequest,
StoredBackupList,
TestPayArgs, TestPayArgs,
TestPayResult, TestPayResult,
TestingSetTimetravelRequest,
Transaction, Transaction,
TransactionByIdRequest, TransactionByIdRequest,
TransactionsRequest, TransactionsRequest,
@ -106,22 +115,13 @@ import {
UserAttentionsResponse, UserAttentionsResponse,
ValidateIbanRequest, ValidateIbanRequest,
ValidateIbanResponse, ValidateIbanResponse,
WalletContractData,
WalletCoreVersion, WalletCoreVersion,
WalletCurrencyInfo, WalletCurrencyInfo,
WithdrawFakebankRequest, WithdrawFakebankRequest,
WithdrawTestBalanceRequest, WithdrawTestBalanceRequest,
WithdrawUriInfoResponse, WithdrawUriInfoResponse,
SharePaymentRequest,
SharePaymentResult,
GetCurrencyInfoRequest,
GetCurrencyInfoResponse,
StoredBackupList,
CreateStoredBackupResponse,
RecoverStoredBackupRequest,
DeleteStoredBackupRequest,
TestingSetTimetravelRequest,
} from "@gnu-taler/taler-util"; } from "@gnu-taler/taler-util";
import { WalletContractData } from "./db.js";
import { import {
AddBackupProviderRequest, AddBackupProviderRequest,
AddBackupProviderResponse, AddBackupProviderResponse,

View File

@ -18,8 +18,6 @@
* *
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { WalletContractData } from "@gnu-taler/taler-wallet-core";
import * as tests from "@gnu-taler/web-util/testing"; import * as tests from "@gnu-taler/web-util/testing";
import { import {
ErrorView, ErrorView,
@ -27,6 +25,7 @@ import {
LoadingView, LoadingView,
ShowView, ShowView,
} from "./ShowFullContractTermPopup.js"; } from "./ShowFullContractTermPopup.js";
import { WalletContractData } from "@gnu-taler/taler-util";
export default { export default {
title: "ShowFullContractTermPopup", title: "ShowFullContractTermPopup",

View File

@ -13,11 +13,13 @@
You should have received a copy of the GNU General Public License along with 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/> GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/ */
import { AbsoluteTime, Duration, Location } from "@gnu-taler/taler-util";
import { import {
WalletApiOperation, AbsoluteTime,
Duration,
Location,
WalletContractData, 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 { styled } from "@linaria/react";
import { Fragment, h, VNode } from "preact"; import { Fragment, h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";