summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/operations/reserves.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2022-04-19 17:12:43 +0200
committerFlorian Dold <florian@dold.me>2022-04-27 00:50:17 +0200
commita165afa6824980c409d7c2e22e24171e536800e0 (patch)
tree0e8491f092aba2280655ee4728fef0ca02bb8387 /packages/taler-wallet-core/src/operations/reserves.ts
parent9b85d139bf7bdc360ea0894e09f6115cd9d472d8 (diff)
downloadwallet-core-a165afa6824980c409d7c2e22e24171e536800e0.tar.gz
wallet-core-a165afa6824980c409d7c2e22e24171e536800e0.tar.bz2
wallet-core-a165afa6824980c409d7c2e22e24171e536800e0.zip
wallet-core: implement age restriction support
Diffstat (limited to 'packages/taler-wallet-core/src/operations/reserves.ts')
-rw-r--r--packages/taler-wallet-core/src/operations/reserves.ts21
1 files changed, 8 insertions, 13 deletions
diff --git a/packages/taler-wallet-core/src/operations/reserves.ts b/packages/taler-wallet-core/src/operations/reserves.ts
index ff09d1a50..8e606bd60 100644
--- a/packages/taler-wallet-core/src/operations/reserves.ts
+++ b/packages/taler-wallet-core/src/operations/reserves.ts
@@ -200,6 +200,7 @@ export async function createReserve(
lastError: undefined,
currency: req.amount.currency,
operationStatus: OperationStatus.Pending,
+ restrictAge: req.restrictAge,
};
const exchangeInfo = await updateExchangeFromUrl(ws, req.exchange);
@@ -541,12 +542,9 @@ async function updateReserve(
const reserveUrl = new URL(`reserves/${reservePub}`, reserve.exchangeBaseUrl);
reserveUrl.searchParams.set("timeout_ms", "200");
- const resp = await ws.http.get(
- reserveUrl.href,
- {
- timeout: getReserveRequestTimeout(reserve),
- },
- );
+ const resp = await ws.http.get(reserveUrl.href, {
+ timeout: getReserveRequestTimeout(reserve),
+ });
const result = await readSuccessResponseJsonOrErrorCode(
resp,
@@ -632,17 +630,12 @@ async function updateReserve(
amountReservePlus,
amountReserveMinus,
).amount;
- const denomSel = selectWithdrawalDenominations(
- remainingAmount,
- denoms,
- );
+ const denomSel = selectWithdrawalDenominations(remainingAmount, denoms);
logger.trace(
`Remaining unclaimed amount in reseve is ${Amounts.stringify(
remainingAmount,
- )} and can be withdrawn with ${
- denomSel.selectedDenoms.length
- } coins`,
+ )} and can be withdrawn with ${denomSel.selectedDenoms.length} coins`,
);
if (denomSel.selectedDenoms.length === 0) {
@@ -759,6 +752,7 @@ export async function createTalerWithdrawReserve(
selectedExchange: string,
options: {
forcedDenomSel?: ForcedDenomSel;
+ restrictAge?: number;
} = {},
): Promise<AcceptWithdrawalResponse> {
await updateExchangeFromUrl(ws, selectedExchange);
@@ -774,6 +768,7 @@ export async function createTalerWithdrawReserve(
exchange: selectedExchange,
senderWire: withdrawInfo.senderWire,
exchangePaytoUri: exchangePaytoUri,
+ restrictAge: options.restrictAge,
});
// We do this here, as the reserve should be registered before we return,
// so that we can redirect the user to the bank's status page.