aboutsummaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/taler-util/src/codec.ts13
-rw-r--r--packages/taler-util/src/http-client/types.ts5
-rw-r--r--packages/taler-util/src/wallet-types.ts16
3 files changed, 25 insertions, 9 deletions
diff --git a/packages/taler-util/src/codec.ts b/packages/taler-util/src/codec.ts
index 54d450d82..b04ce0612 100644
--- a/packages/taler-util/src/codec.ts
+++ b/packages/taler-util/src/codec.ts
@@ -146,7 +146,7 @@ class UnionCodecBuilder<
constructor(
private discriminator: TagPropertyLabel,
private baseCodec?: Codec<CommonBaseType>,
- ) {}
+ ) { }
/**
* Define a property for the object.
@@ -491,6 +491,17 @@ export function codecOptional<V>(innerCodec: Codec<V>): Codec<V | undefined> {
};
}
+export function codecOptionalDefault<V>(innerCodec: Codec<V>, def: V): Codec<V> {
+ return {
+ decode(x: any, c?: Context): V {
+ if (x === undefined || x === null) {
+ return def;
+ }
+ return innerCodec.decode(x, c);
+ },
+ };
+}
+
export function codecForLazy<V>(innerCodec: () => Codec<V>): Codec<V> {
let instance: Codec<V> | undefined = undefined
return {
diff --git a/packages/taler-util/src/http-client/types.ts b/packages/taler-util/src/http-client/types.ts
index dd95709f9..2613bd663 100644
--- a/packages/taler-util/src/http-client/types.ts
+++ b/packages/taler-util/src/http-client/types.ts
@@ -13,6 +13,7 @@ import {
codecForNumber,
codecForString,
codecOptional,
+ codecOptionalDefault,
} from "../codec.js";
import { PaytoString, codecForPaytoString } from "../payto.js";
import {
@@ -340,7 +341,7 @@ export const codecForCoreBankConfig = (): Codec<TalerCorebankApi.Config> =>
.property("name", codecForConstString("libeufin-bank"))
.property("version", codecForString())
.property("bank_name", codecForString())
- .property("base_url", codecForString())
+ .property("base_url", codecOptional(codecForString()))
.property("allow_conversion", codecForBoolean())
.property("allow_registrations", codecForBoolean())
.property("allow_deletions", codecForBoolean())
@@ -358,7 +359,7 @@ export const codecForCoreBankConfig = (): Codec<TalerCorebankApi.Config> =>
),
),
)
- .property("wire_type", codecForString())
+ .property("wire_type", codecOptionalDefault(codecForString(), "iban"))
.build("TalerCorebankApi.Config");
//FIXME: implement this codec
diff --git a/packages/taler-util/src/wallet-types.ts b/packages/taler-util/src/wallet-types.ts
index 799cbc601..e0088626d 100644
--- a/packages/taler-util/src/wallet-types.ts
+++ b/packages/taler-util/src/wallet-types.ts
@@ -662,11 +662,11 @@ export interface CoinDumpJson {
withdrawal_reserve_pub: string | undefined;
coin_status: CoinStatus;
spend_allocation:
- | {
- id: string;
- amount: AmountString;
- }
- | undefined;
+ | {
+ id: string;
+ amount: AmountString;
+ }
+ | undefined;
/**
* Information about the age restriction
*/
@@ -800,7 +800,7 @@ export const codecForPreparePayResultPaymentPossible =
)
.build("PreparePayResultPaymentPossible");
-export interface BalanceDetails {}
+export interface BalanceDetails { }
/**
* Detailed reason for why the wallet's balance is insufficient.
@@ -1855,6 +1855,7 @@ export const codecForPrepareBankIntegratedWithdrawalRequest =
export interface PrepareBankIntegratedWithdrawalResponse {
transactionId: string;
+ info: WithdrawUriInfoResponse;
}
export interface ConfirmWithdrawalRequest {
@@ -1941,6 +1942,9 @@ export const codecForApplyRefundFromPurchaseIdRequest =
export interface GetWithdrawalDetailsForUriRequest {
talerWithdrawUri: string;
+ /**
+ * @deprecated not used
+ */
restrictAge?: number;
}