From 43655adff0f8f1db082e1f0c18f1271a29ab8905 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Tue, 28 Jul 2020 15:18:01 +0530 Subject: updated preparePay API according to spec --- src/types/walletTypes.ts | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'src/types') diff --git a/src/types/walletTypes.ts b/src/types/walletTypes.ts index 2ca95bf48..d68f41564 100644 --- a/src/types/walletTypes.ts +++ b/src/types/walletTypes.ts @@ -337,34 +337,36 @@ export interface NextUrlResult { lastSessionId: string | undefined; } +export const enum PreparePayResultType { + PaymentPossible = "payment-possible", + InsufficientBalance = "insufficient-balance", + AlreadyConfirmed = "already-confirmed", +} + export type PreparePayResult = - | PreparePayResultError | PreparePayResultInsufficientBalance - | PreparePayResultPaid + | PreparePayResultAlreadyConfirmed | PreparePayResultPaymentPossible; export interface PreparePayResultPaymentPossible { - status: "payment-possible"; + status: PreparePayResultType.PaymentPossible; proposalId: string; contractTermsRaw: string; totalFees: AmountJson; } export interface PreparePayResultInsufficientBalance { - status: "insufficient-balance"; + status: PreparePayResultType.InsufficientBalance; proposalId: string; contractTermsRaw: any; } -export interface PreparePayResultError { - status: "error"; - error: string; -} - -export interface PreparePayResultPaid { - status: "paid"; +export interface PreparePayResultAlreadyConfirmed { + status: PreparePayResultType.AlreadyConfirmed; contractTermsRaw: any; - nextUrl: string; + paid: boolean; + // Only specified if paid. + nextUrl?: string; } export interface BankWithdrawDetails { -- cgit v1.2.3