summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/operations/withdraw.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-wallet-core/src/operations/withdraw.ts')
-rw-r--r--packages/taler-wallet-core/src/operations/withdraw.ts69
1 files changed, 44 insertions, 25 deletions
diff --git a/packages/taler-wallet-core/src/operations/withdraw.ts b/packages/taler-wallet-core/src/operations/withdraw.ts
index 29c2cae40..d198cf482 100644
--- a/packages/taler-wallet-core/src/operations/withdraw.ts
+++ b/packages/taler-wallet-core/src/operations/withdraw.ts
@@ -557,9 +557,12 @@ export async function getBankWithdrawalInfo(
throw Error(`can't parse URL ${talerWithdrawUri}`);
}
- const bankApi = new TalerBankIntegrationHttpClient(uriResult.bankIntegrationApiBaseUrl, http);
+ const bankApi = new TalerBankIntegrationHttpClient(
+ uriResult.bankIntegrationApiBaseUrl,
+ http,
+ );
- const { body: config } = await bankApi.getConfig()
+ const { body: config } = await bankApi.getConfig();
if (!bankApi.isCompatible(config.version)) {
throw TalerError.fromDetail(
@@ -572,12 +575,14 @@ export async function getBankWithdrawalInfo(
);
}
- const resp = await bankApi.getWithdrawalOperationById(uriResult.withdrawalOperationId)
+ const resp = await bankApi.getWithdrawalOperationById(
+ uriResult.withdrawalOperationId,
+ );
if (resp.type === "fail") {
throw TalerError.fromUncheckedDetail(resp.detail);
}
- const { body: status } = resp
+ const { body: status } = resp;
logger.info(`bank withdrawal operation status: ${j2s(status)}`);
@@ -1214,7 +1219,8 @@ export async function updateWithdrawalDenoms(
denom.verificationStatus === DenominationVerificationStatus.Unverified
) {
logger.trace(
- `Validating denomination (${current + 1}/${denominations.length
+ `Validating denomination (${current + 1}/${
+ denominations.length
}) signature of ${denom.denomPubHash}`,
);
let valid = false;
@@ -1859,7 +1865,7 @@ export async function getExchangeWithdrawalInfo(
) {
logger.warn(
`wallet's support for exchange protocol version ${WALLET_EXCHANGE_PROTOCOL_VERSION} might be outdated ` +
- `(exchange has ${exchange.protocolVersionRange}), checking for updates`,
+ `(exchange has ${exchange.protocolVersionRange}), checking for updates`,
);
}
}
@@ -1896,6 +1902,7 @@ export async function getExchangeWithdrawalInfo(
ageRestrictionOptions: hasDenomWithAgeRestriction
? AGE_MASK_GROUPS
: undefined,
+ scopeInfo: exchange.scopeInfo,
};
return ret;
}
@@ -1907,9 +1914,8 @@ export interface GetWithdrawalDetailsForUriOpts {
type WithdrawalOperationMemoryMap = {
[uri: string]: boolean | undefined;
-}
-const ongoingChecks: WithdrawalOperationMemoryMap = {
-}
+};
+const ongoingChecks: WithdrawalOperationMemoryMap = {};
/**
* Get more information about a taler://withdraw URI.
*
@@ -1950,28 +1956,41 @@ export async function getWithdrawalDetailsForUri(
);
});
- // FIXME: this should be removed after the extended version of
+ // FIXME: this should be removed after the extended version of
// withdrawal state machine. issue #8099
- if (info.status === "pending" && opts.notifyChangeFromPendingTimeoutMs !== undefined && !ongoingChecks[talerWithdrawUri]) {
+ if (
+ info.status === "pending" &&
+ opts.notifyChangeFromPendingTimeoutMs !== undefined &&
+ !ongoingChecks[talerWithdrawUri]
+ ) {
ongoingChecks[talerWithdrawUri] = true;
- const bankApi = new TalerBankIntegrationHttpClient(info.apiBaseUrl, ws.http);
+ const bankApi = new TalerBankIntegrationHttpClient(
+ info.apiBaseUrl,
+ ws.http,
+ );
console.log(
`waiting operation (${info.operationId}) to change from pending`,
);
- bankApi.getWithdrawalOperationById(info.operationId, {
- old_state: "pending",
- timeoutMs: opts.notifyChangeFromPendingTimeoutMs
- }).then(resp => {
- console.log(
- `operation (${info.operationId}) to change to ${JSON.stringify(resp, undefined, 2)}`,
- );
- ws.notify({
- type: NotificationType.WithdrawalOperationTransition,
- operationId: info.operationId,
- state: resp.type === "fail" ? info.status : resp.body.status,
+ bankApi
+ .getWithdrawalOperationById(info.operationId, {
+ old_state: "pending",
+ timeoutMs: opts.notifyChangeFromPendingTimeoutMs,
+ })
+ .then((resp) => {
+ console.log(
+ `operation (${info.operationId}) to change to ${JSON.stringify(
+ resp,
+ undefined,
+ 2,
+ )}`,
+ );
+ ws.notify({
+ type: NotificationType.WithdrawalOperationTransition,
+ operationId: info.operationId,
+ state: resp.type === "fail" ? info.status : resp.body.status,
+ });
+ ongoingChecks[talerWithdrawUri] = false;
});
- ongoingChecks[talerWithdrawUri] = false
- })
}
return {