diff options
author | Florian Dold <florian@dold.me> | 2024-01-16 13:15:40 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2024-01-16 13:15:40 +0100 |
commit | 1c286ebb2f1c817f5362517d47466c39826c8699 (patch) | |
tree | c0cfcee641529032ee06674b943036fe5c0a7cef /packages/taler-util | |
parent | 2e2cf4049a771c82fcc520686de3ace7603baa05 (diff) | |
download | wallet-core-1c286ebb2f1c817f5362517d47466c39826c8699.tar.xz |
wallet-core: implement remaining DD48 calls, test
Diffstat (limited to 'packages/taler-util')
-rw-r--r-- | packages/taler-util/src/taler-error-codes.ts | 8 | ||||
-rw-r--r-- | packages/taler-util/src/wallet-types.ts | 63 |
2 files changed, 55 insertions, 16 deletions
diff --git a/packages/taler-util/src/taler-error-codes.ts b/packages/taler-util/src/taler-error-codes.ts index 9dd965d1b..6b9362329 100644 --- a/packages/taler-util/src/taler-error-codes.ts +++ b/packages/taler-util/src/taler-error-codes.ts @@ -3905,6 +3905,14 @@ export enum TalerErrorCode { /** + * An exchange entry is still used by the exchange, thus it can't be deleted without purging. + * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). + * (A value of 0 indicates that the error is generated client-side). + */ + WALLET_EXCHANGE_ENTRY_USED = 7033, + + + /** * We encountered a timeout with our payment backend. * Returned with an HTTP status code of #MHD_HTTP_GATEWAY_TIMEOUT (504). * (A value of 0 indicates that the error is generated client-side). diff --git a/packages/taler-util/src/wallet-types.ts b/packages/taler-util/src/wallet-types.ts index 583d5dff5..52156cf9e 100644 --- a/packages/taler-util/src/wallet-types.ts +++ b/packages/taler-util/src/wallet-types.ts @@ -577,11 +577,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 */ @@ -944,14 +944,14 @@ export interface PreparePayResultAlreadyConfirmed { } export interface BankWithdrawDetails { - status: WithdrawalOperationStatus, + status: WithdrawalOperationStatus; amount: AmountJson; senderWire?: string; suggestedExchange?: string; confirmTransferUrl?: string; wireTypes: string[]; - operationId: string, - apiBaseUrl: string, + operationId: string; + apiBaseUrl: string; } export interface AcceptWithdrawalResponse { @@ -1701,6 +1701,31 @@ export const codecForUpdateExchangeEntryRequest = .property("exchangeBaseUrl", codecForString()) .build("UpdateExchangeEntryRequest"); +export interface GetExchangeResourcesRequest { + exchangeBaseUrl: string; +} + +export const codecForGetExchangeResourcesRequest = + (): Codec<GetExchangeResourcesRequest> => + buildCodecForObject<GetExchangeResourcesRequest>() + .property("exchangeBaseUrl", codecForString()) + .build("GetExchangeResourcesRequest"); + +export interface GetExchangeResourcesResponse { + hasResources: boolean; +} + +export interface DeleteExchangeRequest { + exchangeBaseUrl: string; + purge?: boolean; +} + +export const codecForDeleteExchangeRequest = (): Codec<DeleteExchangeRequest> => + buildCodecForObject<DeleteExchangeRequest>() + .property("exchangeBaseUrl", codecForString()) + .property("purge", codecOptional(codecForBoolean())) + .build("DeleteExchangeRequest"); + export interface ForceExchangeUpdateRequest { exchangeBaseUrl: string; } @@ -1810,7 +1835,10 @@ export const codecForGetWithdrawalDetailsForUri = buildCodecForObject<GetWithdrawalDetailsForUriRequest>() .property("talerWithdrawUri", codecForString()) .property("restrictAge", codecOptional(codecForNumber())) - .property("notifyChangeFromPendingTimeoutMs", codecOptional(codecForNumber())) + .property( + "notifyChangeFromPendingTimeoutMs", + codecOptional(codecForNumber()), + ) .build("GetWithdrawalDetailsForUriRequest"); export interface ListKnownBankAccountsRequest { @@ -2191,7 +2219,7 @@ export interface TxIdResponse { export interface WithdrawUriInfoResponse { operationId: string; - status: WithdrawalOperationStatus, + status: WithdrawalOperationStatus; confirmTransferUrl?: string; amount: AmountString; defaultExchangeBaseUrl?: string; @@ -2203,12 +2231,15 @@ export const codecForWithdrawUriInfoResponse = buildCodecForObject<WithdrawUriInfoResponse>() .property("operationId", codecForString()) .property("confirmTransferUrl", codecOptional(codecForString())) - .property("status", codecForEither( - codecForConstString("pending"), - codecForConstString("selected"), - codecForConstString("aborted"), - codecForConstString("confirmed"), - )) + .property( + "status", + codecForEither( + codecForConstString("pending"), + codecForConstString("selected"), + codecForConstString("aborted"), + codecForConstString("confirmed"), + ), + ) .property("amount", codecForAmountString()) .property("defaultExchangeBaseUrl", codecOptional(codecForString())) .property("possibleExchanges", codecForList(codecForExchangeListItem())) |