TrackTransaction interface

This commit is contained in:
Sebastian 2023-01-15 17:46:56 -03:00
parent 8e8bada643
commit bfc7b20100
No known key found for this signature in database
GPG Key ID: BE4FF68352439FC1
3 changed files with 75 additions and 13 deletions

View File

@ -1807,6 +1807,69 @@ export const codecForDepositSuccess = (): Codec<DepositSuccess> =>
.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<TrackTransactionWired> =>
buildCodecForObject<TrackTransactionWired>()
.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<TrackTransactionAccepted> =>
buildCodecForObject<TrackTransactionAccepted>()
.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

View File

@ -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 {

View File

@ -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<AbortTransactionRequest> =>
buildCodecForObject<AbortTransactionRequest>()
.property("transactionId", codecForString())
.property("forceImmediateAbort", codecOptional(codecForBoolean()))
.build("AbortTransactionRequest");
export const codecForAbortTransaction = (): Codec<AbortTransactionRequest> =>
buildCodecForObject<AbortTransactionRequest>()
.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 =