summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/types
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-wallet-core/src/types')
-rw-r--r--packages/taler-wallet-core/src/types/dbTypes.ts4
-rw-r--r--packages/taler-wallet-core/src/types/notifications.ts1
-rw-r--r--packages/taler-wallet-core/src/types/talerTypes.ts17
-rw-r--r--packages/taler-wallet-core/src/types/walletTypes.ts56
4 files changed, 49 insertions, 29 deletions
diff --git a/packages/taler-wallet-core/src/types/dbTypes.ts b/packages/taler-wallet-core/src/types/dbTypes.ts
index 0ee41a6a5..4e2ba1bb4 100644
--- a/packages/taler-wallet-core/src/types/dbTypes.ts
+++ b/packages/taler-wallet-core/src/types/dbTypes.ts
@@ -986,7 +986,7 @@ export interface TipRecord {
/**
* Tip ID chosen by the wallet.
*/
- tipId: string;
+ walletTipId: string;
/**
* The merchant's identifier for this tip.
@@ -1760,7 +1760,7 @@ class ReserveHistoryStore extends Store<ReserveHistoryRecord> {
class TipsStore extends Store<TipRecord> {
constructor() {
- super("tips", { keyPath: "tipId" });
+ super("tips", { keyPath: "walletTipId" });
}
}
diff --git a/packages/taler-wallet-core/src/types/notifications.ts b/packages/taler-wallet-core/src/types/notifications.ts
index 7a51f0d83..e1b9a7aff 100644
--- a/packages/taler-wallet-core/src/types/notifications.ts
+++ b/packages/taler-wallet-core/src/types/notifications.ts
@@ -186,6 +186,7 @@ export interface ProposalOperationErrorNotification {
export interface TipOperationErrorNotification {
type: NotificationType.TipOperationError;
+ error: TalerErrorDetails;
}
export interface WithdrawOperationErrorNotification {
diff --git a/packages/taler-wallet-core/src/types/talerTypes.ts b/packages/taler-wallet-core/src/types/talerTypes.ts
index c944f1561..52dc4cb62 100644
--- a/packages/taler-wallet-core/src/types/talerTypes.ts
+++ b/packages/taler-wallet-core/src/types/talerTypes.ts
@@ -773,17 +773,11 @@ export class WithdrawOperationStatusResponse {
* Response from the merchant.
*/
export class TipPickupGetResponse {
- extra: any;
-
- amount: string;
-
- amount_left: string;
+ tip_amount: string;
exchange_url: string;
- stamp_expire: Timestamp;
-
- stamp_created: Timestamp;
+ expiration: Timestamp;
}
export class WithdrawResponse {
@@ -1261,12 +1255,9 @@ export const codecForWithdrawOperationStatusResponse = (): Codec<
export const codecForTipPickupGetResponse = (): Codec<TipPickupGetResponse> =>
buildCodecForObject<TipPickupGetResponse>()
- .property("extra", codecForAny())
- .property("amount", codecForString())
- .property("amount_left", codecForString())
+ .property("tip_amount", codecForString())
.property("exchange_url", codecForString())
- .property("stamp_expire", codecForTimestamp)
- .property("stamp_created", codecForTimestamp)
+ .property("expiration", codecForTimestamp)
.build("TipPickupGetResponse");
export const codecForRecoupConfirmation = (): Codec<RecoupConfirmation> =>
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");