diff options
author | Florian Dold <florian.dold@gmail.com> | 2019-12-03 00:52:15 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2019-12-03 00:52:15 +0100 |
commit | c33dd75711a39403bd4dd9940caab6d5e6ad2d77 (patch) | |
tree | 7d7d9c64b5074a8f533302add3b1674c5d424c8d /src/dbTypes.ts | |
parent | a5137c32650b0b9aa2abbe55e4f4f3f60ed78e07 (diff) | |
download | wallet-core-c33dd75711a39403bd4dd9940caab6d5e6ad2d77.tar.xz |
pending operations (pay/proposals)
Diffstat (limited to 'src/dbTypes.ts')
-rw-r--r-- | src/dbTypes.ts | 64 |
1 files changed, 52 insertions, 12 deletions
diff --git a/src/dbTypes.ts b/src/dbTypes.ts index 731f0358b..4f374c260 100644 --- a/src/dbTypes.ts +++ b/src/dbTypes.ts @@ -586,22 +586,30 @@ export interface CoinRecord { } export enum ProposalStatus { + /** + * Not downloaded yet. + */ + DOWNLOADING = "downloading", + /** + * Proposal downloaded, but the user needs to accept/reject it. + */ PROPOSED = "proposed", + /** + * The user has accepted the proposal. + */ ACCEPTED = "accepted", + /** + * The user has rejected the proposal. + */ REJECTED = "rejected", -} - -/** - * Record for a downloaded order, stored in the wallet's database. - */ -@Checkable.Class() -export class ProposalRecord { /** - * URL where the proposal was downloaded. + * Downloaded proposal was detected as a re-purchase. */ - @Checkable.String() - url: string; + REPURCHASE = "repurchase", +} +@Checkable.Class() +export class ProposalDownload { /** * The contract that was offered by the merchant. */ @@ -615,10 +623,27 @@ export class ProposalRecord { merchantSig: string; /** - * Hash of the contract terms. + * Signature by the merchant over the contract details. */ @Checkable.String() contractTermsHash: string; +} + +/** + * Record for a downloaded order, stored in the wallet's database. + */ +@Checkable.Class() +export class ProposalRecord { + /** + * URL where the proposal was downloaded. + */ + @Checkable.String() + url: string; + + /** + * Downloaded data from the merchant. + */ + download: ProposalDownload | undefined; /** * Unique ID when the order is stored in the wallet DB. @@ -639,9 +664,18 @@ export class ProposalRecord { @Checkable.String() noncePriv: string; + /** + * Public key for the nonce. + */ + @Checkable.String() + noncePub: string; + @Checkable.String() proposalStatus: ProposalStatus; + @Checkable.String() + repurchaseProposalId: string | undefined; + /** * Session ID we got when downloading the contract. */ @@ -911,6 +945,12 @@ export interface PurchaseRecord { * The abort (with refund) was completed for this (incomplete!) purchase. */ abortDone: boolean; + + /** + * Proposal ID for this purchase. Uniquely identifies the + * purchase and the proposal. + */ + proposalId: string; } /** @@ -1076,7 +1116,7 @@ export namespace Stores { class PurchasesStore extends Store<PurchaseRecord> { constructor() { - super("purchases", { keyPath: "contractTermsHash" }); + super("purchases", { keyPath: "proposalId" }); } fulfillmentUrlIndex = new Index<string, PurchaseRecord>( |