gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-wallet-core] branch master updated: -add tosAvailableLanguages


From: gnunet
Subject: [taler-wallet-core] branch master updated: -add tosAvailableLanguages
Date: Tue, 12 Dec 2023 16:43:58 +0100

This is an automated email from the git hooks/post-receive script.

dold pushed a commit to branch master
in repository wallet-core.

The following commit(s) were added to refs/heads/master by this push:
     new 0726a39a6 -add tosAvailableLanguages
0726a39a6 is described below

commit 0726a39a6ae1064d59c316547fab5c39df62460b
Author: Florian Dold <florian@dold.me>
AuthorDate: Tue Dec 12 16:43:53 2023 +0100

    -add tosAvailableLanguages
---
 packages/taler-util/src/wallet-types.ts            |  5 ++
 .../taler-wallet-core/src/operations/exchanges.ts  | 59 ++++++++++++----------
 2 files changed, 38 insertions(+), 26 deletions(-)

diff --git a/packages/taler-util/src/wallet-types.ts 
b/packages/taler-util/src/wallet-types.ts
index 52a272cfa..b54ee8c0a 100644
--- a/packages/taler-util/src/wallet-types.ts
+++ b/packages/taler-util/src/wallet-types.ts
@@ -1583,6 +1583,11 @@ export interface GetExchangeTosResult {
    */
   contentLanguage: string | undefined;
 
+  /**
+   * Available languages as advertised by the exchange.
+   */
+  tosAvailableLanguages: string[];
+
   tosStatus: ExchangeTosStatus;
 }
 
diff --git a/packages/taler-wallet-core/src/operations/exchanges.ts 
b/packages/taler-wallet-core/src/operations/exchanges.ts
index 6afafd9f5..88127b71f 100644
--- a/packages/taler-wallet-core/src/operations/exchanges.ts
+++ b/packages/taler-wallet-core/src/operations/exchanges.ts
@@ -27,27 +27,24 @@ import {
   AbsoluteTime,
   Amounts,
   CancellationToken,
-  canonicalizeBaseUrl,
-  codecForExchangeKeysJson,
-  DenominationPubKey,
   DenomKeyType,
+  DenomOperationMap,
+  DenominationInfo,
+  DenominationPubKey,
   Duration,
-  durationFromSpec,
-  encodeCrock,
   ExchangeAuditor,
+  ExchangeDetailedResponse,
   ExchangeGlobalFees,
+  ExchangeListItem,
   ExchangeSignKeyJson,
-  ExchangeEntryState,
   ExchangeWireAccount,
+  ExchangesListResponse,
+  FeeDescription,
   GetExchangeTosResult,
   GlobalFees,
-  hashDenomPub,
-  j2s,
   LibtoolVersion,
   Logger,
-  makeErrorDetail,
   NotificationType,
-  parsePaytoUri,
   Recoup,
   TalerError,
   TalerErrorCode,
@@ -61,16 +58,18 @@ import {
   WireFeeMap,
   WireFeesJson,
   WireInfo,
-  FeeDescription,
-  DenomOperationMap,
-  DenominationInfo,
-  ExchangeDetailedResponse,
-  ExchangeListItem,
-  ExchangesListResponse,
+  canonicalizeBaseUrl,
+  codecForExchangeKeysJson,
+  durationFromSpec,
+  encodeCrock,
+  hashDenomPub,
+  j2s,
+  makeErrorDetail,
+  parsePaytoUri,
 } from "@gnu-taler/taler-util";
 import {
-  getExpiry,
   HttpRequestLibrary,
+  getExpiry,
   readSuccessResponseJsonOrThrow,
   readSuccessResponseTextOrThrow,
 } from "@gnu-taler/taler-util/http";
@@ -82,32 +81,30 @@ import {
   WalletStoresV1,
 } from "../db.js";
 import {
-  createTimeline,
   ExchangeEntryDbRecordStatus,
   ExchangeEntryDbUpdateStatus,
-  isWithdrawableDenom,
   OpenedPromise,
+  WalletDbReadWriteTransaction,
+  createTimeline,
+  isWithdrawableDenom,
   openPromise,
   selectBestForOverlappingDenominations,
   selectMinimumFee,
   timestampPreciseFromDb,
   timestampPreciseToDb,
   timestampProtocolToDb,
-  WalletDbReadWriteTransaction,
 } from "../index.js";
 import { CancelFn, InternalWalletState } from "../internal-wallet-state.js";
 import { checkDbInvariant } from "../util/invariants.js";
 import { GetReadOnlyAccess, GetReadWriteAccess } from "../util/query.js";
 import { WALLET_EXCHANGE_PROTOCOL_VERSION } from "../versions.js";
 import {
-  getExchangeEntryStatusFromRecord,
-  getExchangeState,
-  getExchangeTosStatusFromRecord,
-  getExchangeUpdateStatusFromRecord,
-  makeExchangeListItem,
   TaskIdentifiers,
   TaskRunResult,
   TaskRunResultType,
+  getExchangeState,
+  getExchangeTosStatusFromRecord,
+  makeExchangeListItem,
 } from "./common.js";
 
 const logger = new Logger("exchanges.ts");
@@ -123,6 +120,7 @@ interface ExchangeTosDownloadResult {
   tosEtag: string;
   tosContentType: string;
   tosContentLanguage: string | undefined;
+  tosAvailableLanguages: string[];
 }
 
 async function downloadExchangeWithTermsOfService(
@@ -153,8 +151,16 @@ async function downloadExchangeWithTermsOfService(
   const tosEtag = resp.headers.get("etag") || "unknown";
   const tosContentLanguage = resp.headers.get("content-language") || undefined;
   const tosContentType = resp.headers.get("content-type") || "text/plain";
+  const availLangStr = resp.headers.get("avail-languages") || "";
+  const tosAvailableLanguages = availLangStr.split(",").map((x) => x.trim());
 
-  return { tosText, tosEtag, tosContentType, tosContentLanguage };
+  return {
+    tosText,
+    tosEtag,
+    tosContentType,
+    tosContentLanguage,
+    tosAvailableLanguages,
+  };
 }
 
 /**
@@ -1190,6 +1196,7 @@ export async function getExchangeTos(
     contentType: tosDownload.tosContentType,
     contentLanguage: tosDownload.tosContentLanguage,
     tosStatus: getExchangeTosStatusFromRecord(exchange),
+    tosAvailableLanguages: tosDownload.tosAvailableLanguages,
   };
 }
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]