diff options
Diffstat (limited to 'packages/taler-wallet-core/src/db.ts')
-rw-r--r-- | packages/taler-wallet-core/src/db.ts | 47 |
1 files changed, 30 insertions, 17 deletions
diff --git a/packages/taler-wallet-core/src/db.ts b/packages/taler-wallet-core/src/db.ts index b019be67a..ec11f4d47 100644 --- a/packages/taler-wallet-core/src/db.ts +++ b/packages/taler-wallet-core/src/db.ts @@ -1085,18 +1085,16 @@ export enum PurchaseStatus { Paid = OperationStatusRange.DORMANT_START + 5, } +/** + * Partial information about the downloaded proposal. + * Only contains data that is relevant for indexing on the + * "purchases" object stores. + */ export interface ProposalDownload { - /** - * The contract that was offered by the merchant. - */ - contractTermsRaw: any; - - /** - * Extracted / parsed data from the contract terms. - * - * FIXME: Do we need to store *all* that data in duplicate? - */ - contractData: WalletContractData; + contractTermsHash: string; + fulfillmentUrl?: string; + currency: string; + contractTermsMerchantSig: string; } export interface PurchasePayInfo { @@ -1723,6 +1721,7 @@ export interface PeerPullPaymentInitiationRecord { * Contract terms for the other party. * * FIXME: Nail down type! + * FIXME: Put in contractTerms store */ contractTerms: any; } @@ -1819,6 +1818,18 @@ export interface CoinAvailabilityRecord { freshCoinCount: number; } +export interface ContractTermsRecord { + /** + * Contract terms hash. + */ + h: string; + + /** + * Contract terms JSON. + */ + contractTermsRaw: any; +} + /** * Schema definition for the IndexedDB * wallet database. @@ -1937,13 +1948,8 @@ export const WalletStoresV1 = { byStatus: describeIndex("byStatus", "purchaseStatus"), byFulfillmentUrl: describeIndex( "byFulfillmentUrl", - "download.contractData.fulfillmentUrl", + "download.fulfillmentUrl", ), - // FIXME: Deduplicate! - byMerchantUrlAndOrderId: describeIndex("byMerchantUrlAndOrderId", [ - "download.contractData.merchantBaseUrl", - "download.contractData.orderId", - ]), byUrlAndOrderId: describeIndex("byUrlAndOrderId", [ "merchantBaseUrl", "orderId", @@ -2088,6 +2094,13 @@ export const WalletStoresV1 = { }), {}, ), + contractTerms: describeStore( + "contractTerms", + describeContents<ContractTermsRecord>({ + keyPath: "h", + }), + {}, + ), }; /** |