diff options
author | Sebastian <sebasjm@gmail.com> | 2023-01-15 17:46:56 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2023-01-15 17:46:56 -0300 |
commit | bfc7b201007b88c7b20d74334edfb84bd54cdf94 (patch) | |
tree | af42eccacb21c035ea4f66bbc1fb504229cb5f79 /packages/taler-util/src/taler-types.ts | |
parent | 8e8bada643b73b78991cde9abc375825a18bf9d9 (diff) | |
download | wallet-core-bfc7b201007b88c7b20d74334edfb84bd54cdf94.tar.xz |
TrackTransaction interface
Diffstat (limited to 'packages/taler-util/src/taler-types.ts')
-rw-r--r-- | packages/taler-util/src/taler-types.ts | 63 |
1 files changed, 63 insertions, 0 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 |