summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/operations/reserves.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2021-12-13 11:28:15 +0100
committerFlorian Dold <florian@dold.me>2021-12-13 11:28:15 +0100
commitc493a3069ec330b955efd8604cb9d8b76277c74e (patch)
tree32fb0ad5306f4e7000da4997c27a1abf3da96fcf /packages/taler-wallet-core/src/operations/reserves.ts
parent38d8239f937de047f127d37cd23ca6829db8e3e4 (diff)
downloadwallet-core-c493a3069ec330b955efd8604cb9d8b76277c74e.tar.gz
wallet-core-c493a3069ec330b955efd8604cb9d8b76277c74e.tar.bz2
wallet-core-c493a3069ec330b955efd8604cb9d8b76277c74e.zip
wallet-core: reset reserve retry when resetting withdrawal retry
Diffstat (limited to 'packages/taler-wallet-core/src/operations/reserves.ts')
-rw-r--r--packages/taler-wallet-core/src/operations/reserves.ts53
1 files changed, 41 insertions, 12 deletions
diff --git a/packages/taler-wallet-core/src/operations/reserves.ts b/packages/taler-wallet-core/src/operations/reserves.ts
index 43e0d7d36..5a9fbb405 100644
--- a/packages/taler-wallet-core/src/operations/reserves.ts
+++ b/packages/taler-wallet-core/src/operations/reserves.ts
@@ -15,35 +15,63 @@
*/
import {
- AcceptWithdrawalResponse, addPaytoQueryParams, Amounts, canonicalizeBaseUrl, codecForBankWithdrawalOperationPostResponse,
+ AcceptWithdrawalResponse,
+ addPaytoQueryParams,
+ Amounts,
+ canonicalizeBaseUrl,
+ codecForBankWithdrawalOperationPostResponse,
codecForReserveStatus,
- codecForWithdrawOperationStatusResponse, CreateReserveRequest,
- CreateReserveResponse, Duration,
+ codecForWithdrawOperationStatusResponse,
+ CreateReserveRequest,
+ CreateReserveResponse,
+ Duration,
durationMax,
- durationMin, encodeCrock, getRandomBytes, getTimestampNow, Logger, NotificationType, randomBytes, ReserveTransactionType,
- TalerErrorCode, TalerErrorDetails, URL
+ durationMin,
+ encodeCrock,
+ getRandomBytes,
+ getTimestampNow,
+ Logger,
+ NotificationType,
+ randomBytes,
+ ReserveTransactionType,
+ TalerErrorCode,
+ TalerErrorDetails,
+ URL,
} from "@gnu-taler/taler-util";
import { InternalWalletState } from "../common.js";
import {
ReserveBankInfo,
- ReserveRecord, ReserveRecordStatus, WalletStoresV1, WithdrawalGroupRecord
+ ReserveRecord,
+ ReserveRecordStatus,
+ WalletStoresV1,
+ WithdrawalGroupRecord,
} from "../db.js";
import { guardOperationException, OperationFailedError } from "../errors.js";
import { assertUnreachable } from "../util/assertUnreachable.js";
import {
readSuccessResponseJsonOrErrorCode,
readSuccessResponseJsonOrThrow,
- throwUnexpectedRequestError
+ throwUnexpectedRequestError,
} from "../util/http.js";
import { GetReadOnlyAccess } from "../util/query.js";
import {
- getRetryDuration, initRetryInfo, updateRetryInfoTimeout
+ getRetryDuration,
+ initRetryInfo,
+ updateRetryInfoTimeout,
} from "../util/retries.js";
import {
- getExchangeDetails, getExchangePaytoUri, getExchangeTrust, updateExchangeFromUrl
+ getExchangeDetails,
+ getExchangePaytoUri,
+ getExchangeTrust,
+ updateExchangeFromUrl,
} from "./exchanges.js";
import {
- denomSelectionInfoToState, getBankWithdrawalInfo, getCandidateWithdrawalDenoms, processWithdrawGroup, selectWithdrawalDenominations, updateWithdrawalDenoms
+ denomSelectionInfoToState,
+ getBankWithdrawalInfo,
+ getCandidateWithdrawalDenoms,
+ processWithdrawGroup,
+ selectWithdrawalDenominations,
+ updateWithdrawalDenoms,
} from "./withdraw.js";
const logger = new Logger("reserves.ts");
@@ -514,7 +542,7 @@ async function updateReserve(
if (
resp.status === 404 &&
result.talerErrorResponse.code ===
- TalerErrorCode.EXCHANGE_RESERVES_GET_STATUS_UNKNOWN
+ TalerErrorCode.EXCHANGE_RESERVES_GET_STATUS_UNKNOWN
) {
ws.notify({
type: NotificationType.ReserveNotYetFound,
@@ -617,7 +645,8 @@ async function updateReserve(
logger.trace(
`Remaining unclaimed amount in reseve is ${Amounts.stringify(
remainingAmount,
- )} and can be withdrawn with ${denomSelInfo.selectedDenoms.length
+ )} and can be withdrawn with ${
+ denomSelInfo.selectedDenoms.length
} coins`,
);