diff --git a/packages/taler-util/src/taler-types.ts b/packages/taler-util/src/taler-types.ts index 9251868e6..8b680bdd9 100644 --- a/packages/taler-util/src/taler-types.ts +++ b/packages/taler-util/src/taler-types.ts @@ -1807,6 +1807,69 @@ export const codecForDepositSuccess = (): Codec => .property("transaction_base_url", codecOptional(codecForString())) .build("DepositSuccess"); +export interface TrackTransactionWired { + // Raw wire transfer identifier of the deposit. + wtid: Base32String; + + // When was the wire transfer given to the bank. + execution_time: TalerProtocolTimestamp; + + // The contribution of this coin to the total (without fees) + coin_contribution: AmountString; + + // Binary-only Signature_ with purpose TALER_SIGNATURE_EXCHANGE_CONFIRM_WIRE + // over a TALER_ConfirmWirePS + // whereby the exchange affirms the successful wire transfer. + exchange_sig: EddsaSignatureString; + + // Public EdDSA key of the exchange that was used to generate the signature. + // Should match one of the exchange's signing keys from /keys. Again given + // explicitly as the client might otherwise be confused by clock skew as to + // which signing key was used. + exchange_pub: EddsaPublicKeyString; +} + +export const codecForTackTransactionWired = (): Codec => + buildCodecForObject() + .property("wtid", codecForString()) + .property("execution_time", codecForTimestamp) + .property("coin_contribution", codecForAmountString()) + .property("exchange_sig", codecForString()) + .property("exchange_pub", codecForString()) + .build("TackTransactionWired"); + +interface TrackTransactionAccepted { + // Legitimization target that the merchant should + // use to check for its KYC status using + // the /kyc-check/$REQUIREMENT_ROW/... endpoint. + // Optional, not present if the deposit has not + // yet been aggregated to the point that a KYC + // need has been evaluated. + requirement_row?: number; + + // True if the KYC check for the merchant has been + // satisfied. False does not mean that KYC + // is strictly needed, unless also a + // legitimization_uuid is provided. + kyc_ok: boolean; + + // Time by which the exchange currently thinks the deposit will be executed. + // Actual execution may be later if the KYC check is not satisfied by then. + execution_time: TalerProtocolTimestamp; +} + +export const codecForTackTransactionAccepted = + (): Codec => + buildCodecForObject() + .property("requirement_row", codecOptional(codecForNumber())) + .property("kyc_ok", codecForBoolean()) + .property("execution_time", codecForTimestamp) + .build("TackTransactionAccepted"); + +export type TrackTransaction = + | ({ type: "accepted" } & TrackTransactionAccepted) + | ({ type: "wired" } & TrackTransactionWired); + export interface PurseDeposit { /** * Amount to be deposited, can be a fraction of the diff --git a/packages/taler-util/src/transactions-types.ts b/packages/taler-util/src/transactions-types.ts index 3678dfa86..e81625a5a 100644 --- a/packages/taler-util/src/transactions-types.ts +++ b/packages/taler-util/src/transactions-types.ts @@ -95,7 +95,7 @@ export interface TransactionCommon { * true if the transaction is still pending, false otherwise * If a transaction is not longer pending, its timestamp will be updated, * but its transactionId will remain unchanged - * + * * @deprecated show extendedStatus */ pending: boolean; @@ -103,7 +103,7 @@ export interface TransactionCommon { /** * True if the transaction encountered a problem that might be * permanent. A frozen transaction won't be automatically retried. - * + * * @deprecated show extendedStatus */ frozen: boolean; @@ -351,7 +351,7 @@ export interface TransactionPayment extends TransactionCommon { /** * How far did the wallet get with processing the payment? - * + * * @deprecated use extendedStatus */ status: PaymentStatus; @@ -548,6 +548,8 @@ export interface TransactionDeposit extends TransactionCommon { amountEffective: AmountString; wireTransferDeadline: TalerProtocolTimestamp; + + wireTransferProgress: number; } export interface TransactionByIdRequest { diff --git a/packages/taler-util/src/wallet-types.ts b/packages/taler-util/src/wallet-types.ts index c32bb94e5..af775a54e 100644 --- a/packages/taler-util/src/wallet-types.ts +++ b/packages/taler-util/src/wallet-types.ts @@ -63,6 +63,7 @@ import { ExchangeAuditor, UnblindedSignature, codecForPeerContractTerms, + TrackTransaction, } from "./taler-types.js"; import { AbsoluteTime, @@ -1624,12 +1625,11 @@ export interface AbortTransactionRequest { forceImmediateAbort?: boolean; } -export const codecForAbortTransaction = - (): Codec => - buildCodecForObject() - .property("transactionId", codecForString()) - .property("forceImmediateAbort", codecOptional(codecForBoolean())) - .build("AbortTransactionRequest"); +export const codecForAbortTransaction = (): Codec => + buildCodecForObject() + .property("transactionId", codecForString()) + .property("forceImmediateAbort", codecOptional(codecForBoolean())) + .build("AbortTransactionRequest"); export interface GetFeeForDepositRequest { depositPaytoUri: string; @@ -1685,10 +1685,7 @@ export interface TrackDepositGroupRequest { } export interface TrackDepositGroupResponse { - responses: { - status: number; - body: any; - }[]; + responses: TrackTransaction[]; } export const codecForTrackDepositGroupRequest =