aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2023-01-15 17:46:56 -0300
committerSebastian <sebasjm@gmail.com>2023-01-15 17:46:56 -0300
commitbfc7b201007b88c7b20d74334edfb84bd54cdf94 (patch)
treeaf42eccacb21c035ea4f66bbc1fb504229cb5f79
parent8e8bada643b73b78991cde9abc375825a18bf9d9 (diff)
downloadwallet-core-bfc7b201007b88c7b20d74334edfb84bd54cdf94.tar.xz
TrackTransaction interface
-rw-r--r--packages/taler-util/src/taler-types.ts63
-rw-r--r--packages/taler-util/src/transactions-types.ts8
-rw-r--r--packages/taler-util/src/wallet-types.ts17
3 files changed, 75 insertions, 13 deletions
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<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
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<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 =