aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-util/src
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2024-02-19 20:50:03 +0100
committerFlorian Dold <florian@dold.me>2024-02-19 20:50:03 +0100
commit20397e3fba3fe4b274354047f76e3a8f3a92d6b8 (patch)
treee1e79fec4be55b2bb22e6830cea6c2afd5ea6ead /packages/taler-util/src
parent151ab351f6a2e00caecc9a1dda19b724f90a088e (diff)
downloadwallet-core-20397e3fba3fe4b274354047f76e3a8f3a92d6b8.tar.xz
wallet-core: long-poll withdrawal operation status
Diffstat (limited to 'packages/taler-util/src')
-rw-r--r--packages/taler-util/src/taler-types.ts43
1 files changed, 38 insertions, 5 deletions
diff --git a/packages/taler-util/src/taler-types.ts b/packages/taler-util/src/taler-types.ts
index 1bdcf3fb1..4a0c53a79 100644
--- a/packages/taler-util/src/taler-types.ts
+++ b/packages/taler-util/src/taler-types.ts
@@ -27,9 +27,9 @@
import { Amounts, codecForAmountString } from "./amounts.js";
import {
+ Codec,
buildCodecForObject,
buildCodecForUnion,
- Codec,
codecForAny,
codecForBoolean,
codecForConstNumber,
@@ -45,14 +45,14 @@ import { strcmp } from "./helpers.js";
import {
CurrencySpecification,
codecForCurrencySpecificiation,
+ codecForEither,
} from "./index.js";
-import { AgeCommitmentProof, Edx25519PublicKeyEnc } from "./taler-crypto.js";
+import { Edx25519PublicKeyEnc } from "./taler-crypto.js";
import {
- codecForAbsoluteTime,
- codecForDuration,
- codecForTimestamp,
TalerProtocolDuration,
TalerProtocolTimestamp,
+ codecForDuration,
+ codecForTimestamp,
} from "./time.js";
/**
@@ -1228,9 +1228,42 @@ export interface MerchantOrderStatusUnpaid {
* POST {talerBankIntegrationApi}/withdrawal-operation/{wopid}
*/
export interface BankWithdrawalOperationPostResponse {
+ // Current status of the operation
+ // pending: the operation is pending parameters selection (exchange and reserve public key)
+ // selected: the operations has been selected and is pending confirmation
+ // aborted: the operation has been aborted
+ // confirmed: the transfer has been confirmed and registered by the bank
+ status: "selected" | "aborted" | "confirmed" | "pending";
+
+ // URL that the user needs to navigate to in order to
+ // complete some final confirmation (e.g. 2FA).
+ //
+ // Only applicable when status is selected or pending.
+ // It may contain withdrawal operation id
+ confirm_transfer_url?: string;
+
+ // Deprecated field use status instead
+ // The transfer has been confirmed and registered by the bank.
+ // Does not guarantee that the funds have arrived at the exchange already.
transfer_done: boolean;
}
+export const codeForBankWithdrawalOperationPostResponse =
+ (): Codec<BankWithdrawalOperationPostResponse> =>
+ buildCodecForObject<BankWithdrawalOperationPostResponse>()
+ .property(
+ "status",
+ codecForEither(
+ codecForConstString("selected"),
+ codecForConstString("confirmed"),
+ codecForConstString("aborted"),
+ codecForConstString("pending"),
+ ),
+ )
+ .property("confirm_transfer_url", codecOptional(codecForString()))
+ .property("transfer_done", codecForBoolean())
+ .build("BankWithdrawalOperationPostResponse");
+
export type DenominationPubKey = RsaDenominationPubKey | CsDenominationPubKey;
export interface RsaDenominationPubKey {