Contents

getExchangeTos#

Get the current terms of service of an exchange.

Request:

The request arguments must be a GetExchangeTosRequest object.

Response:

On success, the result is a GetExchangeTosResult object.

Side effects:

Fetches the current terms of service from the exchange over the network and stores the new ETag in the exchange record.

Expected errors:

The caller can handle the following errors inline: WALLET_EXCHANGE_ENTRY_NOT_FOUND.

Details:

The wallet downloads the terms of service from the exchange, using acceptedFormat and acceptLanguage for content negotiation, and updates its stored current ToS version tag. If the exchange does not provide terms of service, tosStatus is "missing-tos" and the content fields carry placeholder values.

interface GetExchangeTosRequest {
  exchangeBaseUrl: string;

  // Acceptable content types for the ToS text, used for content
  // negotiation with the exchange.
  acceptedFormat?: string[];

  // Preferred language for the ToS text.
  acceptLanguage?: string;

  // Correlates progress notifications and allows cancellation.
  progressToken?: string;
}
interface GetExchangeTosResult {
  // Markdown version of the current ToS.
  content: string;

  // Version tag of the current ToS.
  currentEtag: string;

  // Version tag of the last ToS that the user has accepted, if any.
  acceptedEtag: string | undefined;

  // Accepted content type
  contentType: string;

  // Language of the returned content.  If missing, language is
  // unknown.
  contentLanguage: string | undefined;

  // Available languages as advertised by the exchange.
  tosAvailableLanguages: string[];

  tosStatus: ExchangeTosStatus;
}