diff options
author | Florian Dold <florian.dold@gmail.com> | 2020-09-08 17:40:47 +0530 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2020-09-08 17:40:47 +0530 |
commit | b063382d25d1ed8572ebe2f52bf54247379300d5 (patch) | |
tree | b60e4abf9b5285ffdf3339639ba8dae30d0bfff1 /packages/taler-wallet-core/src/types/walletTypes.ts | |
parent | be77ee284a819f7932831bd85e88c47c655addb2 (diff) | |
download | wallet-core-b063382d25d1ed8572ebe2f52bf54247379300d5.tar.xz |
tipping API and integration test
Diffstat (limited to 'packages/taler-wallet-core/src/types/walletTypes.ts')
-rw-r--r-- | packages/taler-wallet-core/src/types/walletTypes.ts | 56 |
1 files changed, 42 insertions, 14 deletions
diff --git a/packages/taler-wallet-core/src/types/walletTypes.ts b/packages/taler-wallet-core/src/types/walletTypes.ts index 82f29c39d..fb049caf9 100644 --- a/packages/taler-wallet-core/src/types/walletTypes.ts +++ b/packages/taler-wallet-core/src/types/walletTypes.ts @@ -38,7 +38,7 @@ import { ExchangeWireInfo, DenominationSelectionInfo, } from "./dbTypes"; -import { Timestamp } from "../util/time"; +import { Timestamp, codecForTimestamp } from "../util/time"; import { buildCodecForObject, codecForString, @@ -348,23 +348,33 @@ export class ReturnCoinsRequest { static checked: (obj: any) => ReturnCoinsRequest; } -/** - * Status of processing a tip. - */ -export interface TipStatus { +export interface PrepareTipResult { + /** + * Unique ID for the tip assigned by the wallet. + * Typically different from the merchant-generated tip ID. + */ + walletTipId: string; + + /** + * Has the tip already been accepted? + */ accepted: boolean; - amount: AmountJson; - amountLeft: AmountJson; - nextUrl: string; - exchangeUrl: string; - tipId: string; - merchantTipId: string; - merchantOrigin: string; + amount: AmountString; + totalFees: AmountString; + exchangeBaseUrl: string; expirationTimestamp: Timestamp; - timestamp: Timestamp; - totalFees: AmountJson; } +export const codecForPrepareTipResult = (): Codec<PrepareTipResult> => + buildCodecForObject<PrepareTipResult>() + .property("accepted", codecForBoolean()) + .property("amount", codecForAmountString()) + .property("totalFees", codecForAmountString()) + .property("exchangeBaseUrl", codecForString()) + .property("expirationTimestamp", codecForTimestamp) + .property("walletTipId", codecForString()) + .build("PrepareTipResult"); + export interface BenchmarkResult { time: { [s: string]: number }; repetitions: number; @@ -903,3 +913,21 @@ export const codecForForceRefreshRequest = (): Codec<ForceRefreshRequest> => buildCodecForObject<ForceRefreshRequest>() .property("coinPubList", codecForList(codecForString())) .build("ForceRefreshRequest"); + +export interface PrepareTipRequest { + talerTipUri: string; +} + +export const codecForPrepareTipRequest = (): Codec<PrepareTipRequest> => + buildCodecForObject<PrepareTipRequest>() + .property("talerTipUri", codecForString()) + .build("PrepareTipRequest"); + +export interface AcceptTipRequest { + walletTipId: string; +} + +export const codecForAcceptTipRequest = (): Codec<AcceptTipRequest> => + buildCodecForObject<AcceptTipRequest>() + .property("walletTipId", codecForString()) + .build("AcceptTipRequest"); |