-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,
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;
}

View File

@ -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.

View File

@ -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.

View File

@ -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,

View File

@ -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,

View File

@ -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 {

View File

@ -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,

View File

@ -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",

View File

@ -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";