diff options
Diffstat (limited to 'packages/taler-util')
40 files changed, 3056 insertions, 1566 deletions
diff --git a/packages/taler-util/package.json b/packages/taler-util/package.json index a2dbae40f..e9f688529 100644 --- a/packages/taler-util/package.json +++ b/packages/taler-util/package.json @@ -1,6 +1,6 @@ { "name": "@gnu-taler/taler-util", - "version": "0.12.12", + "version": "0.13.8", "description": "Generic helper functionality for GNU Taler", "type": "module", "types": "./lib/index.node.d.ts", diff --git a/packages/taler-util/src/MerchantApiClient.ts b/packages/taler-util/src/MerchantApiClient.ts index ef3ea2ff7..59cd3ab6d 100644 --- a/packages/taler-util/src/MerchantApiClient.ts +++ b/packages/taler-util/src/MerchantApiClient.ts @@ -107,6 +107,8 @@ export interface PrivateOrderStatusQuery { /** * Client for the GNU Taler merchant backend. + * + * @deprecated in favor of TalerMerchantInstanceHttpClient */ export class MerchantApiClient { /** diff --git a/packages/taler-util/src/account-restrictions.ts b/packages/taler-util/src/account-restrictions.ts new file mode 100644 index 000000000..3b3724487 --- /dev/null +++ b/packages/taler-util/src/account-restrictions.ts @@ -0,0 +1,43 @@ +/* + This file is part of GNU Taler + (C) 2024 Taler Systems S.A. + + GNU Taler is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ + +import { InternationalizedString } from "./types-taler-common.js"; +import { AccountRestriction } from "./types-taler-exchange.js"; + +export function checkAccountRestriction( + paytoUri: string, + restrictions: AccountRestriction[], +): { ok: boolean; hint?: string; hintI18n?: InternationalizedString } { + for (const myRestriction of restrictions) { + switch (myRestriction.type) { + case "deny": + return { ok: false }; + case "regex": { + const regex = new RegExp(myRestriction.payto_regex); + if (!regex.test(paytoUri)) { + return { + ok: false, + hint: myRestriction.human_hint, + hintI18n: myRestriction.human_hint_i18n, + }; + } + } + } + } + return { + ok: true, + }; +} diff --git a/packages/taler-util/src/bank-api-client.ts b/packages/taler-util/src/bank-api-client.ts index 642232962..9cb80b005 100644 --- a/packages/taler-util/src/bank-api-client.ts +++ b/packages/taler-util/src/bank-api-client.ts @@ -37,6 +37,7 @@ import { opEmptySuccess, opKnownHttpFailure, opUnknownFailure, + PaytoString, RegisterAccountRequest, stringToBytes, TalerError, @@ -151,6 +152,25 @@ export class WireGatewayApiClient { logger.info(`add-incoming response status: ${resp.status}`); await checkSuccessResponseOrThrow(resp); } + + async adminAddKycauth(params: { + amount: string; + accountPub: string; + debitAccountPayto: string; + }): Promise<void> { + let url = new URL(`admin/add-kycauth`, this.baseUrl); + const resp = await this.httpLib.fetch(url.href, { + method: "POST", + body: { + amount: params.amount, + account_pub: params.accountPub, + debit_account: params.debitAccountPayto, + }, + headers: this.makeAuthHeader(), + }); + logger.info(`add-kycauth response status: ${resp.status}`); + await checkSuccessResponseOrThrow(resp); + } } export interface AccountBalance { @@ -202,12 +222,23 @@ export class TalerCorebankApiClient { return readSuccessResponseJsonOrThrow(resp, codecForAny()); } - async getTransactions(username: string): Promise<void> { - const reqUrl = new URL(`accounts/${username}/transactions`, this.baseUrl); + async makeTransaction( + amount: AmountString, + target: PaytoString, + ): Promise<void> { + const reqUrl = new URL( + `accounts/${this.args.auth!.username}/transactions`, + this.baseUrl, + ); const resp = await this.httpLib.fetch(reqUrl.href, { - method: "GET", + method: "POST", + body: { + amount, + payto_uri: target, + }, headers: { ...this.makeAuthHeader(), + "Content-Type": "application/json", }, }); @@ -215,19 +246,17 @@ export class TalerCorebankApiClient { logger.info(`result: ${j2s(res)}`); } - async createTransaction( - username: string, - req: BankAccessApiCreateTransactionRequest, - ): Promise<any> { + async getTransactions(username: string): Promise<void> { const reqUrl = new URL(`accounts/${username}/transactions`, this.baseUrl); - const resp = await this.httpLib.fetch(reqUrl.href, { - method: "POST", - body: req, - headers: this.makeAuthHeader(), + method: "GET", + headers: { + ...this.makeAuthHeader(), + }, }); - return await readSuccessResponseJsonOrThrow(resp, codecForAny()); + const res = await readSuccessResponseJsonOrThrow(resp, codecForAny()); + logger.info(`result: ${j2s(res)}`); } async registerAccountExtended(req: RegisterAccountRequest): Promise<void> { diff --git a/packages/taler-util/src/codec.ts b/packages/taler-util/src/codec.ts index b04ce0612..cd727a792 100644 --- a/packages/taler-util/src/codec.ts +++ b/packages/taler-util/src/codec.ts @@ -83,6 +83,7 @@ interface Alternative { class ObjectCodecBuilder<OutputType, PartialOutputType> { private propList: Prop[] = []; + private _allowExtra: boolean = false; /** * Define a property for the object. @@ -98,6 +99,11 @@ class ObjectCodecBuilder<OutputType, PartialOutputType> { return this as any; } + allowExtra(): ObjectCodecBuilder<OutputType, PartialOutputType> { + this._allowExtra = true; + return this; + } + /** * Return the built codec. * @@ -106,6 +112,7 @@ class ObjectCodecBuilder<OutputType, PartialOutputType> { */ build(objectDisplayName: string): Codec<PartialOutputType> { const propList = this.propList; + const allowExtra = this._allowExtra; return { decode(x: any, c?: Context): PartialOutputType { if (!c) { @@ -129,6 +136,20 @@ class ObjectCodecBuilder<OutputType, PartialOutputType> { ); obj[prop.name] = propVal; } + for (const prop in x) { + if (prop in obj) { + continue; + } + if (allowExtra) { + obj[prop] = x[prop]; + } else { + logger.warn( + `Extra property ${prop} for ${objectDisplayName} at ${renderContext( + c, + )}`, + ); + } + } return obj as PartialOutputType; }, }; @@ -146,7 +167,7 @@ class UnionCodecBuilder< constructor( private discriminator: TagPropertyLabel, private baseCodec?: Codec<CommonBaseType>, - ) { } + ) {} /** * Define a property for the object. @@ -491,7 +512,10 @@ export function codecOptional<V>(innerCodec: Codec<V>): Codec<V | undefined> { }; } -export function codecOptionalDefault<V>(innerCodec: Codec<V>, def: V): Codec<V> { +export function codecOptionalDefault<V>( + innerCodec: Codec<V>, + def: V, +): Codec<V> { return { decode(x: any, c?: Context): V { if (x === undefined || x === null) { @@ -503,18 +527,17 @@ export function codecOptionalDefault<V>(innerCodec: Codec<V>, def: V): Codec<V> } export function codecForLazy<V>(innerCodec: () => Codec<V>): Codec<V> { - let instance: Codec<V> | undefined = undefined + let instance: Codec<V> | undefined = undefined; return { decode(x: any, c?: Context): V { if (instance === undefined) { - instance = innerCodec() + instance = innerCodec(); } return instance.decode(x, c); }, }; } - export type CodecType<T> = T extends Codec<infer X> ? X : any; export function codecForEither<T extends Array<Codec<unknown>>>( diff --git a/packages/taler-util/src/errors.ts b/packages/taler-util/src/errors.ts index 41d470972..ed0f0db65 100644 --- a/packages/taler-util/src/errors.ts +++ b/packages/taler-util/src/errors.ts @@ -35,6 +35,9 @@ import { type empty = Record<string, never>; export interface DetailsMap { + [TalerErrorCode.WALLET_PAY_MERCHANT_KYC_MISSING]: { + exchangeResponse: any; + }; [TalerErrorCode.WALLET_PENDING_OPERATION_FAILED]: { innerError: TalerErrorDetail; transactionId?: string; @@ -182,6 +185,9 @@ export interface DetailsMap { type ErrBody<Y> = Y extends keyof DetailsMap ? DetailsMap[Y] : empty; +export type TypedTalerErrorDetail<Y> = TalerErrorDetail & + (Y extends keyof DetailsMap ? DetailsMap[Y] : {}); + export function makeErrorDetail<C extends TalerErrorCode>( code: C, detail: ErrBody<C>, diff --git a/packages/taler-util/src/http-client/authentication.ts b/packages/taler-util/src/http-client/authentication.ts index fa48f3da6..7e3297ff0 100644 --- a/packages/taler-util/src/http-client/authentication.ts +++ b/packages/taler-util/src/http-client/authentication.ts @@ -88,9 +88,37 @@ export class TalerAuthenticationHttpClient { } /** - * + * FIXME: merge this with createAccessTokenBearer the protocol of both + * services need to reply the same + * * @returns */ + async createAccessTokenBearer_BANK(token: AccessToken, body: TokenRequest) { + const url = new URL(`token`, this.baseUrl); + const resp = await this.httpLib.fetch(url.href, { + method: "POST", + headers: { + Authorization: makeBearerTokenAuthHeader(token), + }, + body, + }); + switch (resp.status) { + case HttpStatusCode.Ok: + return opSuccessFromHttp(resp, codecForTokenSuccessResponse()); + //FIXME: missing in docs + case HttpStatusCode.Unauthorized: + return opKnownHttpFailure(resp.status, resp); + case HttpStatusCode.NotFound: + return opKnownHttpFailure(resp.status, resp); + default: + return opUnknownFailure(resp, await readTalerErrorResponse(resp)); + } + } + + /** + * + * @returns + */ async createAccessTokenBearer(token: AccessToken, body: TokenRequest) { const url = new URL(`token`, this.baseUrl); const resp = await this.httpLib.fetch(url.href, { @@ -125,6 +153,9 @@ export class TalerAuthenticationHttpClient { case HttpStatusCode.Ok: return opEmptySuccess(resp); //FIXME: missing in docs + case HttpStatusCode.NoContent: + return opEmptySuccess(resp); + //FIXME: missing in docs case HttpStatusCode.NotFound: return opKnownHttpFailure(resp.status, resp); default: diff --git a/packages/taler-util/src/http-client/bank-core.ts b/packages/taler-util/src/http-client/bank-core.ts index 2639018a8..2fef0adb6 100644 --- a/packages/taler-util/src/http-client/bank-core.ts +++ b/packages/taler-util/src/http-client/bank-core.ts @@ -68,7 +68,6 @@ import { } from "../types-taler-corebank.js"; import { CacheEvictor, - IdempotencyRetry, addLongPollingParam, addPaginationParams, makeBearerTokenAuthHeader, @@ -129,7 +128,8 @@ export class TalerCoreBankHttpClient { * */ async getConfig(): Promise< - OperationFail<HttpStatusCode.NotFound> | OperationOk<TalerCorebankApi.TalerCorebankConfigResponse> + | OperationFail<HttpStatusCode.NotFound> + | OperationOk<TalerCorebankApi.TalerCorebankConfigResponse> > { const url = new URL(`config`, this.baseUrl); const resp = await this.httpLib.fetch(url.href, { @@ -230,6 +230,10 @@ export class TalerCoreBankHttpClient { return opKnownTalerFailure(details.code, details); case TalerErrorCode.BANK_MISSING_TAN_INFO: return opKnownTalerFailure(details.code, details); + case TalerErrorCode.BANK_PASSWORD_TOO_SHORT: + return opKnownTalerFailure(details.code, details); + case TalerErrorCode.BANK_PASSWORD_TOO_LONG: + return opKnownTalerFailure(details.code, details); default: return opUnknownFailure(resp, details); } @@ -326,6 +330,10 @@ export class TalerCoreBankHttpClient { return opKnownTalerFailure(details.code, details); case TalerErrorCode.BANK_MISSING_TAN_INFO: return opKnownTalerFailure(details.code, details); + case TalerErrorCode.BANK_PASSWORD_TOO_SHORT: + return opKnownTalerFailure(details.code, details); + case TalerErrorCode.BANK_PASSWORD_TOO_LONG: + return opKnownTalerFailure(details.code, details); default: return opUnknownFailure(resp, details); } @@ -538,7 +546,6 @@ export class TalerCoreBankHttpClient { async createTransaction( auth: UserAndToken, body: TalerCorebankApi.CreateTransactionRequest, - idempotencyCheck: IdempotencyRetry | undefined, cid?: string, ): Promise< //manually definition all return types because of recursion @@ -554,9 +561,6 @@ export class TalerCoreBankHttpClient { | OperationFail<TalerErrorCode.BANK_TRANSFER_REQUEST_UID_REUSED> > { const url = new URL(`accounts/${auth.username}/transactions`, this.baseUrl); - if (idempotencyCheck) { - body.request_uid = idempotencyCheck.uid; - } const resp = await this.httpLib.fetch(url.href, { method: "POST", headers: { @@ -592,11 +596,7 @@ export class TalerCoreBankHttpClient { case TalerErrorCode.BANK_UNALLOWED_DEBIT: return opKnownTalerFailure(details.code, details); case TalerErrorCode.BANK_TRANSFER_REQUEST_UID_REUSED: - if (!idempotencyCheck) { - return opKnownTalerFailure(details.code, details); - } - const nextRetry = idempotencyCheck.next(); - return this.createTransaction(auth, body, nextRetry, cid); + return opKnownTalerFailure(details.code, details); default: return opUnknownFailure(resp, details); } @@ -648,7 +648,12 @@ export class TalerCoreBankHttpClient { * https://docs.taler.net/core/api-corebank.html#post--accounts-$USERNAME-withdrawals-$WITHDRAWAL_ID-confirm * */ - async confirmWithdrawalById(auth: UserAndToken, wid: string, cid?: string) { + async confirmWithdrawalById( + auth: UserAndToken, + body: TalerCorebankApi.BankAccountConfirmWithdrawalRequest, + wid: string, + cid?: string, + ) { const url = new URL( `accounts/${auth.username}/withdrawals/${wid}/confirm`, this.baseUrl, @@ -659,6 +664,7 @@ export class TalerCoreBankHttpClient { Authorization: makeBearerTokenAuthHeader(auth.token), "X-Challenge-Id": cid, }, + body, }); switch (resp.status) { case HttpStatusCode.Accepted: @@ -683,6 +689,10 @@ export class TalerCoreBankHttpClient { return opKnownTalerFailure(details.code, details); case TalerErrorCode.BANK_UNALLOWED_DEBIT: return opKnownTalerFailure(details.code, details); + case TalerErrorCode.BANK_AMOUNT_DIFFERS: + return opKnownTalerFailure(details.code, details); + case TalerErrorCode.BANK_AMOUNT_REQUIRED: + return opKnownTalerFailure(details.code, details); default: return opUnknownFailure(resp, details); } @@ -794,10 +804,10 @@ export class TalerCoreBankHttpClient { switch (details.code) { case TalerErrorCode.BANK_TRANSFER_REQUEST_UID_REUSED: return opKnownTalerFailure(details.code, details); - case TalerErrorCode.BANK_CONVERSION_AMOUNT_TO_SMALL: - return opKnownTalerFailure(details.code, details); case TalerErrorCode.BANK_BAD_CONVERSION: return opKnownTalerFailure(details.code, details); + case TalerErrorCode.BANK_CONVERSION_AMOUNT_TO_SMALL: + return opKnownTalerFailure(details.code, details); case TalerErrorCode.BANK_UNALLOWED_DEBIT: return opKnownTalerFailure(details.code, details); case TalerErrorCode.BANK_CONFIRM_INCOMPLETE: @@ -816,7 +826,13 @@ export class TalerCoreBankHttpClient { } } case HttpStatusCode.NotImplemented: - return opKnownHttpFailure(resp.status, resp); + const details = await readTalerErrorResponse(resp); + switch (details.code) { + case TalerErrorCode.BANK_TAN_CHANNEL_NOT_SUPPORTED: + return opKnownTalerFailure(details.code, details); + default: + return opKnownHttpFailure(resp.status, resp); + } default: return opUnknownFailure(resp, await readTalerErrorResponse(resp)); } diff --git a/packages/taler-util/src/http-client/bank-integration.ts b/packages/taler-util/src/http-client/bank-integration.ts index 8e98bb783..9bcdac683 100644 --- a/packages/taler-util/src/http-client/bank-integration.ts +++ b/packages/taler-util/src/http-client/bank-integration.ts @@ -155,7 +155,7 @@ export class TalerBankIntegrationHttpClient { return opKnownTalerFailure(details.code, details); case TalerErrorCode.BANK_AMOUNT_DIFFERS: return opKnownTalerFailure(details.code, details); - case TalerErrorCode.BANK_AMOUNT_REQUIRED: + case TalerErrorCode.BANK_UNALLOWED_DEBIT: return opKnownTalerFailure(details.code, details); default: return opUnknownFailure(resp, details); diff --git a/packages/taler-util/src/http-client/bank-revenue.ts b/packages/taler-util/src/http-client/bank-revenue.ts index 6acff91f6..dfa007fa1 100644 --- a/packages/taler-util/src/http-client/bank-revenue.ts +++ b/packages/taler-util/src/http-client/bank-revenue.ts @@ -30,12 +30,21 @@ import { opSuccessFromHttp, opUnknownFailure, } from "../operation.js"; -import { LongPollParams, PaginationParams } from "../types-taler-common.js"; +import { + AccessToken, + LongPollParams, + PaginationParams, +} from "../types-taler-common.js"; import { codecForRevenueConfig, codecForRevenueIncomingHistory, } from "../types-taler-revenue.js"; -import { addLongPollingParam, addPaginationParams } from "./utils.js"; +import { + addLongPollingParam, + addPaginationParams, + BasicOrTokenAuth, + createAuthorizationHeader, +} from "./utils.js"; export type TalerBankRevenueResultByMethod< prop extends keyof TalerRevenueHttpClient, @@ -44,10 +53,7 @@ export type TalerBankRevenueErrorsByMethod< prop extends keyof TalerRevenueHttpClient, > = FailCasesByMethod<TalerRevenueHttpClient, prop>; -type UsernameAndPassword = { - username: string; - password: string; -}; + /** * The API is used by the merchant (or other parties) to query * for incoming transactions to their account. @@ -62,7 +68,7 @@ export class TalerRevenueHttpClient { this.httpLib = httpClient ?? createPlatformHttpLib(); } - public readonly PROTOCOL_VERSION = "0:0:0"; + public readonly PROTOCOL_VERSION = "1:0:0"; isCompatible(version: string): boolean { const compare = LibtoolVersion.compare(this.PROTOCOL_VERSION, version); @@ -73,14 +79,12 @@ export class TalerRevenueHttpClient { * https://docs.taler.net/core/api-bank-revenue.html#get--config * */ - async getConfig(auth?: UsernameAndPassword) { + async getConfig(auth?: BasicOrTokenAuth) { const url = new URL(`config`, this.baseUrl); const resp = await this.httpLib.fetch(url.href, { method: "GET", headers: { - Authorization: auth - ? makeBasicAuthHeader(auth.username, auth.password) - : undefined, + Authorization: createAuthorizationHeader(auth), }, }); switch (resp.status) { @@ -100,7 +104,7 @@ export class TalerRevenueHttpClient { * @returns */ async getHistory( - auth?: UsernameAndPassword, + auth?: BasicOrTokenAuth, params?: PaginationParams & LongPollParams, ) { const url = new URL(`history`, this.baseUrl); @@ -109,9 +113,7 @@ export class TalerRevenueHttpClient { const resp = await this.httpLib.fetch(url.href, { method: "GET", headers: { - Authorization: auth - ? makeBasicAuthHeader(auth.username, auth.password) - : undefined, + Authorization: createAuthorizationHeader(auth), }, }); switch (resp.status) { diff --git a/packages/taler-util/src/http-client/bank-wire.ts b/packages/taler-util/src/http-client/bank-wire.ts index 84df50208..c002bd125 100644 --- a/packages/taler-util/src/http-client/bank-wire.ts +++ b/packages/taler-util/src/http-client/bank-wire.ts @@ -34,6 +34,7 @@ import { codecForIncomingHistory, codecForOutgoingHistory, codecForTransferResponse, + codecForBankWireTransferList, } from "../types-taler-wire-gateway.js"; import { addLongPollingParam, addPaginationParams } from "./utils.js"; @@ -89,7 +90,10 @@ export class TalerWireGatewayHttpClient { * https://docs.taler.net/core/api-bank-wire.html#post--transfer * */ - async transfer(auth: string, body: TalerWireGatewayApi.TransferRequest) { + async makeWireTransfer( + auth: string, + body: TalerWireGatewayApi.TransferRequest, + ) { const url = new URL(`transfer`, this.baseUrl); const resp = await this.httpLib.fetch(url.href, { method: "POST", @@ -117,6 +121,79 @@ export class TalerWireGatewayHttpClient { } /** + * https://docs.taler.net/core/api-bank-wire.html#get--transfers + * + */ + async getTransfers( + auth: string, + params?: { + status?: TalerWireGatewayApi.WireTransferStatus; + } & PaginationParams, + ) { + const url = new URL(`transfers`, this.baseUrl); + if (params) { + if (params.status) { + url.searchParams.set("status", params.status); + } + } + addPaginationParams(url, params); + const resp = await this.httpLib.fetch(url.href, { + method: "GET", + headers: { + Authorization: makeBasicAuthHeader(this.username, auth), + }, + }); + switch (resp.status) { + case HttpStatusCode.Ok: + return opSuccessFromHttp(resp, codecForBankWireTransferList()); + //FIXME: account should not be returned or make it optional + case HttpStatusCode.NoContent: + return opFixedSuccess({ + transfers: [], + debit_account: undefined, + }); + //FIXME: show more details in docs + case HttpStatusCode.BadRequest: + return opKnownHttpFailure(resp.status, resp); + case HttpStatusCode.Unauthorized: + return opKnownHttpFailure(resp.status, resp); + //FIXME: show more details in docs + case HttpStatusCode.NotFound: + return opKnownHttpFailure(resp.status, resp); + default: + return opUnknownFailure(resp, await readTalerErrorResponse(resp)); + } + } + + /** + * https://docs.taler.net/core/api-bank-wire.html#get--transfers-$ROW_ID + * + */ + async getTransferStatus(auth: string, rowId?: number) { + const url = new URL(`transfers/${String(rowId)}`, this.baseUrl); + const resp = await this.httpLib.fetch(url.href, { + method: "GET", + headers: { + Authorization: makeBasicAuthHeader(this.username, auth), + }, + }); + switch (resp.status) { + case HttpStatusCode.Ok: + return opSuccessFromHttp(resp, codecForBankWireTransferList()); + //FIXME: account should not be returned or make it optional + case HttpStatusCode.BadRequest: + return opKnownHttpFailure(resp.status, resp); + case HttpStatusCode.Unauthorized: + return opKnownHttpFailure(resp.status, resp); + //FIXME: show more details in docs + case HttpStatusCode.NotFound: + return opKnownHttpFailure(resp.status, resp); + default: + return opUnknownFailure(resp, await readTalerErrorResponse(resp)); + } + } + + /** * https://docs.taler.net/core/api-bank-wire.html#get--history-incoming * */ @@ -227,4 +304,33 @@ export class TalerWireGatewayHttpClient { return opUnknownFailure(resp, await readTalerErrorResponse(resp)); } } + + /** + * https://docs.taler.net/core/api-bank-wire.html#post--admin-add-kycauth + * + */ + async addKycAuth(auth: string, body: TalerWireGatewayApi.AddIncomingRequest) { + const url = new URL(`admin/add-kycauth`, this.baseUrl); + const resp = await this.httpLib.fetch(url.href, { + method: "POST", + headers: { + Authorization: makeBasicAuthHeader(this.username, auth), + }, + body, + }); + switch (resp.status) { + case HttpStatusCode.Ok: + return opSuccessFromHttp(resp, codecForAddIncomingResponse()); + //FIXME: show more details in docs + case HttpStatusCode.BadRequest: + return opKnownHttpFailure(resp.status, resp); + case HttpStatusCode.Unauthorized: + return opKnownHttpFailure(resp.status, resp); + //FIXME: show more details in docs + case HttpStatusCode.NotFound: + return opKnownHttpFailure(resp.status, resp); + default: + return opUnknownFailure(resp, await readTalerErrorResponse(resp)); + } + } } diff --git a/packages/taler-util/src/http-client/challenger.ts b/packages/taler-util/src/http-client/challenger.ts index 1b0fda300..1c6f54be2 100644 --- a/packages/taler-util/src/http-client/challenger.ts +++ b/packages/taler-util/src/http-client/challenger.ts @@ -63,7 +63,7 @@ export enum ChallengerCacheEviction { export class ChallengerHttpClient { httpLib: HttpRequestLibrary; cacheEvictor: CacheEvictor<ChallengerCacheEviction>; - public readonly PROTOCOL_VERSION = "1:0:0"; + public readonly PROTOCOL_VERSION = "2:0:0"; constructor( readonly baseUrl: string, diff --git a/packages/taler-util/src/http-client/exchange.ts b/packages/taler-util/src/http-client/exchange.ts index 9b7635cb4..7526fd8a0 100644 --- a/packages/taler-util/src/http-client/exchange.ts +++ b/packages/taler-util/src/http-client/exchange.ts @@ -1,3 +1,19 @@ +/* + This file is part of GNU Taler + (C) 2022-2024 Taler Systems S.A. + + GNU Taler is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ + import { HttpRequestLibrary, readSuccessResponseJsonOrThrow, @@ -17,16 +33,18 @@ import { opKnownAlternativeFailure, opKnownHttpFailure, opSuccessFromHttp, - opUnknownFailure + opUnknownFailure, } from "../operation.js"; +import { Codec, codecForAny } from "../codec.js"; import { TalerSignaturePurpose, + bufferForUint64, buildSigPS, decodeCrock, eddsaSign, encodeCrock, stringToBytes, - timestampRoundedToBuffer + timestampRoundedToBuffer, } from "../taler-crypto.js"; import { AccessToken, @@ -35,10 +53,12 @@ import { PaginationParams, ReserveAccount, SigningKey, - codecForTalerCommonConfigResponse + codecForTalerCommonConfigResponse, } from "../types-taler-common.js"; import { AmlDecisionRequest, + BatchWithdrawResponse, + ExchangeBatchWithdrawRequest, ExchangeVersionResponse, KycRequirementInformationId, WalletKycRequest, @@ -52,13 +72,14 @@ import { codecForExchangeKeys, codecForKycProcessClientInformation, codecForKycProcessStartInformation, - codecForLegitimizationNeededResponse + codecForLegitimizationNeededResponse, } from "../types-taler-exchange.js"; -import { CacheEvictor, addMerchantPaginationParams, nullEvictor } from "./utils.js"; +import { CacheEvictor, addPaginationParams, nullEvictor } from "./utils.js"; import { TalerError } from "../errors.js"; import { TalerErrorCode } from "../taler-error-codes.js"; import { codecForEmptyObject } from "../types-taler-wallet.js"; +import { canonicalJson } from "../helpers.js"; export type TalerExchangeResultByMethod< prop extends keyof TalerExchangeHttpClient, @@ -68,14 +89,17 @@ export type TalerExchangeErrorsByMethod< > = FailCasesByMethod<TalerExchangeHttpClient, prop>; export enum TalerExchangeCacheEviction { - CREATE_DESCISION, + UPLOAD_KYC_FORM, + MAKE_AML_DECISION, } +declare const __pubId: unique symbol; +export type ReservePub = string & { [__pubId]: true }; /** */ export class TalerExchangeHttpClient { httpLib: HttpRequestLibrary; - public readonly PROTOCOL_VERSION = "20:0:0"; + public readonly PROTOCOL_VERSION = "21:0:0"; cacheEvictor: CacheEvictor<TalerExchangeCacheEviction>; constructor( @@ -91,6 +115,20 @@ export class TalerExchangeHttpClient { const compare = LibtoolVersion.compare(this.PROTOCOL_VERSION, version); return compare?.compatible ?? false; } + + // TERMS + + /** + * https://docs.taler.net/core/api-exchange.html#get--seed + * + */ + /** + * https://docs.taler.net/core/api-exchange.html#get--seed + * + */ + + // EXCHANGE INFORMATION + /** * https://docs.taler.net/core/api-exchange.html#get--seed * @@ -163,6 +201,7 @@ export class TalerExchangeHttpClient { return opUnknownFailure(resp, await readTalerErrorResponse(resp)); } } + /** * https://docs.taler.net/core/api-merchant.html#get--config * @@ -181,10 +220,390 @@ export class TalerExchangeHttpClient { } } - // TERMS + // + // MANAGEMENT + // + + /** + * https://docs.taler.net/core/api-exchange.html#get--management-keys + * + */ + async getFutureKeys(): Promise<never> { + throw Error("not yet implemented"); + } + + /** + * https://docs.taler.net/core/api-exchange.html#post--management-keys + * + */ + async signFutureKeys(): Promise<never> { + throw Error("not yet implemented"); + } + + /** + * https://docs.taler.net/core/api-exchange.html#post--management-denominations-$H_DENOM_PUB-revoke + * + */ + async revokeFutureDenominationKeys(): Promise<never> { + throw Error("not yet implemented"); + } + /** + * https://docs.taler.net/core/api-exchange.html#post--management-signkeys-$EXCHANGE_PUB-revoke + * + */ + async revokeFutureSigningKeys(): Promise<never> { + throw Error("not yet implemented"); + } + + /** + * https://docs.taler.net/core/api-exchange.html#post--management-auditors + * + */ + async enableAuditor(): Promise<never> { + throw Error("not yet implemented"); + } + + /** + * https://docs.taler.net/core/api-exchange.html#post--management-auditors-$AUDITOR_PUB-disable + * + */ + async disableAuditor(): Promise<never> { + throw Error("not yet implemented"); + } + + /** + * https://docs.taler.net/core/api-exchange.html#post--management-wire-fee + * + */ + async configWireFee(): Promise<never> { + throw Error("not yet implemented"); + } + + /** + * https://docs.taler.net/core/api-exchange.html#post--management-global-fees + * + */ + async configGlobalFees(): Promise<never> { + throw Error("not yet implemented"); + } + + /** + * https://docs.taler.net/core/api-exchange.html#post--management-wire + * + */ + async enableWireMethod(): Promise<never> { + throw Error("not yet implemented"); + } + + /** + * https://docs.taler.net/core/api-exchange.html#post--management-wire-disable + * + */ + async disableWireMethod(): Promise<never> { + throw Error("not yet implemented"); + } + + /** + * https://docs.taler.net/core/api-exchange.html#post--management-drain + * + */ + async drainProfits(): Promise<never> { + throw Error("not yet implemented"); + } + + /** + * https://docs.taler.net/core/api-exchange.html#post--management-aml-officers + * + */ + async updateOfficer(): Promise<never> { + throw Error("not yet implemented"); + } + + /** + * https://docs.taler.net/core/api-exchange.html#post--management-partners + * + */ + async enablePartner(): Promise<never> { + throw Error("not yet implemented"); + } + + // + // AUDITOR + // + + /** + * https://docs.taler.net/core/api-exchange.html#post--auditors-$AUDITOR_PUB-$H_DENOM_PUB + * + */ + async addAuditor(): Promise<never> { + throw Error("not yet implemented"); + } + + // + // WITHDRAWAL + // + + /** + * https://docs.taler.net/core/api-exchange.html#get--reserves-$RESERVE_PUB + * + */ + async getReserveInfo(): Promise<never> { + throw Error("not yet implemented"); + } + + /** + * https://docs.taler.net/core/api-exchange.html#post--csr-withdraw + * + */ + async prepareCsrWithdawal(): Promise<never> { + throw Error("not yet implemented"); + } + + /** + * https://docs.taler.net/core/api-exchange.html#post--reserves-$RESERVE_PUB-batch-withdraw + * + */ + async withdraw(rid: ReservePub, body: ExchangeBatchWithdrawRequest) { + const url = new URL(`reserves/${rid}/batch-withdraw`, this.baseUrl); + + const resp = await this.httpLib.fetch(url.href, { + method: "POST", + body, + }); + + switch (resp.status) { + case HttpStatusCode.Ok: + return opSuccessFromHttp( + resp, + codecForAny() as Codec<BatchWithdrawResponse>, + ); + case HttpStatusCode.Forbidden: + return opKnownHttpFailure(resp.status, resp); + case HttpStatusCode.BadRequest: + return opKnownHttpFailure(resp.status, resp); + case HttpStatusCode.NotFound: + return opKnownHttpFailure(resp.status, resp); + case HttpStatusCode.Conflict: + return opKnownHttpFailure(resp.status, resp); + case HttpStatusCode.Gone: + return opKnownHttpFailure(resp.status, resp); + case HttpStatusCode.UnavailableForLegalReasons: + return opKnownAlternativeFailure( + resp, + resp.status, + codecForLegitimizationNeededResponse(), + ); + default: + return opUnknownFailure(resp, await readTalerErrorResponse(resp)); + } + } + + /** + * https://docs.taler.net/core/api-exchange.html#withdraw-with-age-restriction + * + */ + async withdrawWithAge(): Promise<never> { + throw Error("not yet implemented"); + } + + /** + * https://docs.taler.net/core/api-exchange.html#post--age-withdraw-$ACH-reveal + * + */ + async revealCoinsForAge(): Promise<never> { + throw Error("not yet implemented"); + } + + // + // RESERVE HISTORY + // + + /** + * https://docs.taler.net/core/api-exchange.html#get--reserves-$RESERVE_PUB-history + * + */ + async getResverveHistory(): Promise<never> { + throw Error("not yet implemented"); + } // - // KYC operations + // COIN HISTORY + // + + /** + * https://docs.taler.net/core/api-exchange.html#get--coins-$COIN_PUB-history + * + */ + async getCoinHistory(): Promise<never> { + throw Error("not yet implemented"); + } + + // + // DEPOSIT + // + + /** + * https://docs.taler.net/core/api-exchange.html#post--batch-deposit + * + */ + async deposit(): Promise<never> { + throw Error("not yet implemented"); + } + + // + // REFRESH + // + + /** + * https://docs.taler.net/core/api-exchange.html#post--csr-melt + * + */ + async prepareCsrMelt(): Promise<never> { + throw Error("not yet implemented"); + } + + /** + * https://docs.taler.net/core/api-exchange.html#post--coins-$COIN_PUB-melt + * + */ + async meltCoin(): Promise<never> { + throw Error("not yet implemented"); + } + + /** + * https://docs.taler.net/core/api-exchange.html#post--refreshes-$RCH-reveal + * + */ + async releaveCoin(): Promise<never> { + throw Error("not yet implemented"); + } + + /** + * https://docs.taler.net/core/api-exchange.html#get--coins-$COIN_PUB-link + * + */ + async linkCoin(): Promise<never> { + throw Error("not yet implemented"); + } + + // + // RECOUP + // + + /** + * https://docs.taler.net/core/api-exchange.html#post--coins-$COIN_PUB-recoup + * + */ + async recoupReserveCoin(): Promise<never> { + throw Error("not yet implemented"); + } + + /** + * https://docs.taler.net/core/api-exchange.html#post--coins-$COIN_PUB-recoup-refresh + * + */ + async recoupRefreshCoin(): Promise<never> { + throw Error("not yet implemented"); + } + + // WIRE TRANSFER + + /** + * https://docs.taler.net/core/api-exchange.html#get--transfers-$WTID + * + */ + async getWireTransferInfo(): Promise<never> { + throw Error("not yet implemented"); + } + + /** + * https://docs.taler.net/core/api-exchange.html#get--deposits-$H_WIRE-$MERCHANT_PUB-$H_CONTRACT_TERMS-$COIN_PUB + * + */ + async getWireTransferIdForDeposit(): Promise<never> { + throw Error("not yet implemented"); + } + + // REFUND + + /** + * https://docs.taler.net/core/api-exchange.html#post--coins-$COIN_PUB-refund + * + */ + async refund(): Promise<never> { + throw Error("not yet implemented"); + } + + // WALLET TO WALLET + + /** + * https://docs.taler.net/core/api-exchange.html#get--purses-$PURSE_PUB-merge + * + */ + async getPurseInfoAtMerge(): Promise<never> { + throw Error("not yet implemented"); + } + + /** + * https://docs.taler.net/core/api-exchange.html#get--purses-$PURSE_PUB-deposit + * + */ + async getPurseInfoAtDeposit(): Promise<never> { + throw Error("not yet implemented"); + } + + /** + * https://docs.taler.net/core/api-exchange.html#post--purses-$PURSE_PUB-create + * + */ + async createPurseFromDeposit(): Promise<never> { + throw Error("not yet implemented"); + } + + /** + * https://docs.taler.net/core/api-exchange.html#delete--purses-$PURSE_PUB + * + */ + async deletePurse(): Promise<never> { + throw Error("not yet implemented"); + } + + /** + * https://docs.taler.net/core/api-exchange.html#post--purses-$PURSE_PUB-merge + * + */ + async mergePurse(): Promise<never> { + throw Error("not yet implemented"); + } + + /** + * https://docs.taler.net/core/api-exchange.html#post--reserves-$RESERVE_PUB-purse + * + */ + async createPurseFromReserve(): Promise<never> { + throw Error("not yet implemented"); + } + + /** + * https://docs.taler.net/core/api-exchange.html#post--purses-$PURSE_PUB-deposit + * + */ + async depositIntoPurse(): Promise<never> { + throw Error("not yet implemented"); + } + + // WADS + + /** + * https://docs.taler.net/core/api-exchange.html#get--wads-$WAD_ID + * + */ + async getWadInfo(): Promise<never> { + throw Error("not yet implemented"); + } + + // + // KYC // /** @@ -198,7 +617,7 @@ export class TalerExchangeHttpClient { balance, reserve_pub: account.id, reserve_sig: encodeCrock(account.signingKey), - } + }; const resp = await this.httpLib.fetch(url.href, { method: "POST", @@ -213,29 +632,41 @@ export class TalerExchangeHttpClient { case HttpStatusCode.Forbidden: return opKnownHttpFailure(resp.status, resp); case HttpStatusCode.UnavailableForLegalReasons: - return opKnownAlternativeFailure(resp, resp.status, codecForLegitimizationNeededResponse()); + return opKnownAlternativeFailure( + resp, + resp.status, + codecForLegitimizationNeededResponse(), + ); default: return opUnknownFailure(resp, await readTalerErrorResponse(resp)); } } /** - * https://docs.taler.net/core/api-exchange.html#post--kyc-wallet + * https://docs.taler.net/core/api-exchange.html#get--kyc-check-$H_PAYTO * */ - async checkKycStatus(account: ReserveAccount, requirementId: number, params: { - timeout?: number, - } = {}) { - const url = new URL(`kyc-check/${String(requirementId)}`, this.baseUrl); + async checkKycStatus( + signingKey: SigningKey, + paytoHash: string, + params: { + timeout?: number; + awaitAuth?: boolean; + } = {}, + ) { + const url = new URL(`kyc-check/${paytoHash}`, this.baseUrl); if (params.timeout !== undefined) { url.searchParams.set("timeout_ms", String(params.timeout)); } + if (params.awaitAuth !== undefined) { + url.searchParams.set("await_auth", params.awaitAuth ? "YES" : "NO"); + } const resp = await this.httpLib.fetch(url.href, { method: "GET", headers: { - "Account-Owner-Signature": buildKYCQuerySignature(account.signingKey), + "Account-Owner-Signature": buildKYCQuerySignature(signingKey), }, }); @@ -243,9 +674,9 @@ export class TalerExchangeHttpClient { case HttpStatusCode.Ok: return opSuccessFromHttp(resp, codecForAccountKycStatus()); case HttpStatusCode.Accepted: - return opKnownAlternativeFailure(resp, resp.status, codecForAccountKycStatus()); + return opSuccessFromHttp(resp, codecForAccountKycStatus()); case HttpStatusCode.NoContent: - return opEmptySuccess(resp); + return opFixedSuccess(undefined); case HttpStatusCode.Forbidden: return opKnownHttpFailure(resp.status, resp); case HttpStatusCode.NotFound: @@ -258,12 +689,16 @@ export class TalerExchangeHttpClient { } /** - * https://docs.taler.net/core/api-exchange.html#get--kyc-info-$ACCESS_TOKEN - * - */ - async checkKycInfo(token: AccessToken, known: KycRequirementInformationId[], params: { - timeout?: number, - } = {}) { + * https://docs.taler.net/core/api-exchange.html#get--kyc-info-$ACCESS_TOKEN + * + */ + async checkKycInfo( + token: AccessToken, + known: KycRequirementInformationId[], + params: { + timeout?: number; + } = {}, + ) { const url = new URL(`kyc-info/${token}`, this.baseUrl); if (params.timeout !== undefined) { @@ -273,15 +708,25 @@ export class TalerExchangeHttpClient { const resp = await this.httpLib.fetch(url.href, { method: "GET", headers: { - "If-None-Match": known.length ? known.join(",") : undefined - } + "If-None-Match": known.length ? known.join(",") : undefined, + }, }); switch (resp.status) { case HttpStatusCode.Ok: return opSuccessFromHttp(resp, codecForKycProcessClientInformation()); + case HttpStatusCode.Accepted: + return opKnownAlternativeFailure( + resp, + HttpStatusCode.Accepted, + codecForEmptyObject(), + ); case HttpStatusCode.NoContent: - return opKnownAlternativeFailure(resp, HttpStatusCode.NoContent, codecForEmptyObject()); + return opKnownAlternativeFailure( + resp, + HttpStatusCode.NoContent, + codecForEmptyObject(), + ); case HttpStatusCode.NotModified: return opKnownHttpFailure(resp.status, resp); default: @@ -289,7 +734,6 @@ export class TalerExchangeHttpClient { } } - /** * https://docs.taler.net/core/api-exchange.html#post--kyc-upload-$ID * @@ -303,8 +747,12 @@ export class TalerExchangeHttpClient { }); switch (resp.status) { - case HttpStatusCode.NoContent: + case HttpStatusCode.NoContent: { + this.cacheEvictor.notifySuccess( + TalerExchangeCacheEviction.UPLOAD_KYC_FORM, + ); return opEmptySuccess(resp); + } case HttpStatusCode.NotFound: return opKnownHttpFailure(resp.status, resp); case HttpStatusCode.Conflict: @@ -320,13 +768,15 @@ export class TalerExchangeHttpClient { * https://docs.taler.net/core/api-exchange.html#post--kyc-start-$ID * */ - async startKycProcess(requirement: KycRequirementInformationId, body: object = {}) { + async startExternalKycProcess( + requirement: KycRequirementInformationId, + body: object = {}, + ) { const url = new URL(`kyc-start/${requirement}`, this.baseUrl); - const resp = await this.httpLib.fetch(url.href, { method: "POST", - body + body, }); switch (resp.status) { @@ -343,119 +793,40 @@ export class TalerExchangeHttpClient { } } + /** + * https://docs.taler.net/core/api-exchange.html#get--kyc-proof-$PROVIDER_NAME?state=$H_PAYTO + * + */ + async completeExternalKycProcess( + provider: string, + state: string, + code: string, + ) { + const url = new URL( + `kyc-proof/${provider}?state=${state}&code=${code}`, + this.baseUrl, + ); + + const resp = await this.httpLib.fetch(url.href, { + method: "GET", + redirect: "manual", + }); + + switch (resp.status) { + case HttpStatusCode.SeeOther: + return opEmptySuccess(resp); + case HttpStatusCode.NotFound: + return opKnownHttpFailure(resp.status, resp); + default: + return opUnknownFailure(resp, await readTalerErrorResponse(resp)); + } + } + // // AML operations // /** - * https://docs.taler.net/core/api-exchange.html#get--aml-$OFFICER_PUB-decisions-$STATE - * - */ - // async getDecisionsByState( - // auth: OfficerAccount, - // state: TalerExchangeApi.AmlState, - // pagination?: PaginationParams, - // ) { - // const url = new URL( - // `aml/${auth.id}/decisions/${TalerExchangeApi.AmlState[state]}`, - // this.baseUrl, - // ); - // addPaginationParams(url, pagination); - - // const resp = await this.httpLib.fetch(url.href, { - // method: "GET", - // headers: { - // "Taler-AML-Officer-Signature": buildQuerySignature(auth.signingKey), - // }, - // }); - - // switch (resp.status) { - // case HttpStatusCode.Ok: - // return opSuccessFromHttp(resp, codecForAmlRecords()); - // case HttpStatusCode.NoContent: - // return opFixedSuccess({ records: [] }); - // //this should be unauthorized - // case HttpStatusCode.Forbidden: - // return opKnownHttpFailure(resp.status, resp); - // case HttpStatusCode.Unauthorized: - // return opKnownHttpFailure(resp.status, resp); - // case HttpStatusCode.NotFound: - // return opKnownHttpFailure(resp.status, resp); - // case HttpStatusCode.Conflict: - // return opKnownHttpFailure(resp.status, resp); - // default: - // return opUnknownFailure(resp, await readTalerErrorResponse(resp)); - // } - // } - - // /** - // * https://docs.taler.net/core/api-exchange.html#get--aml-$OFFICER_PUB-decision-$H_PAYTO - // * - // */ - // async getDecisionDetails(auth: OfficerAccount, account: string) { - // const url = new URL(`aml/${auth.id}/decision/${account}`, this.baseUrl); - - // const resp = await this.httpLib.fetch(url.href, { - // method: "GET", - // headers: { - // "Taler-AML-Officer-Signature": buildQuerySignature(auth.signingKey), - // }, - // }); - - // switch (resp.status) { - // case HttpStatusCode.Ok: - // return opSuccessFromHttp(resp, codecForAmlDecisionDetails()); - // case HttpStatusCode.NoContent: - // return opFixedSuccess({ aml_history: [], kyc_attributes: [] }); - // //this should be unauthorized - // case HttpStatusCode.Forbidden: - // return opKnownHttpFailure(resp.status, resp); - // case HttpStatusCode.Unauthorized: - // return opKnownHttpFailure(resp.status, resp); - // case HttpStatusCode.NotFound: - // return opKnownHttpFailure(resp.status, resp); - // case HttpStatusCode.Conflict: - // return opKnownHttpFailure(resp.status, resp); - // default: - // return opUnknownFailure(resp, await readTalerErrorResponse(resp)); - // } - // } - - // /** - // * https://docs.taler.net/core/api-exchange.html#post--aml-$OFFICER_PUB-decision - // * - // */ - // async addDecisionDetails( - // auth: OfficerAccount, - // decision: Omit<TalerExchangeApi.AmlDecision, "officer_sig">, - // ) { - // const url = new URL(`aml/${auth.id}/decision`, this.baseUrl); - - // const body = buildDecisionSignature(auth.signingKey, decision); - // const resp = await this.httpLib.fetch(url.href, { - // method: "POST", - // body, - // }); - - // switch (resp.status) { - // case HttpStatusCode.NoContent: - // return opEmptySuccess(resp); - // //FIXME: this should be unauthorized - // case HttpStatusCode.Forbidden: - // return opKnownHttpFailure(resp.status, resp); - // case HttpStatusCode.Unauthorized: - // return opKnownHttpFailure(resp.status, resp); - // //FIXME: this two need to be split by error code - // case HttpStatusCode.NotFound: - // return opKnownHttpFailure(resp.status, resp); - // case HttpStatusCode.Conflict: - // return opKnownHttpFailure(resp.status, resp); - // default: - // return opUnknownFailure(resp, await readTalerErrorResponse(resp)); - // } - // } - - /** * https://docs.taler.net/core/api-exchange.html#get--aml-$OFFICER_PUB-measures * */ @@ -481,26 +852,23 @@ export class TalerExchangeHttpClient { * https://docs.taler.net/core/api-exchange.html#get--aml-$OFFICER_PUB-measures * */ - async getAmlKycStatistics(auth: OfficerAccount, name: string, filter: { - since?: Date - until?: Date - } = {}) { + async getAmlKycStatistics( + auth: OfficerAccount, + name: string, + filter: { + since?: Date; + until?: Date; + } = {}, + ) { const url = new URL(`aml/${auth.id}/kyc-statistics/${name}`, this.baseUrl); if (filter.since !== undefined) { - url.searchParams.set( - "start_date", - String(filter.since.getTime()) - ); + url.searchParams.set("start_date", String(filter.since.getTime())); } if (filter.until !== undefined) { - url.searchParams.set( - "end_date", - String(filter.until.getTime()) - ); + url.searchParams.set("end_date", String(filter.until.getTime())); } - const resp = await this.httpLib.fetch(url.href, { method: "GET", headers: { @@ -519,14 +887,17 @@ export class TalerExchangeHttpClient { * https://docs.taler.net/core/api-exchange.html#get--aml-$OFFICER_PUB-decisions * */ - async getAmlDecisions(auth: OfficerAccount, params: PaginationParams & { - account?: string, - active?: boolean, - investigation?: boolean, - } = {}) { + async getAmlDecisions( + auth: OfficerAccount, + params: PaginationParams & { + account?: string; + active?: boolean; + investigation?: boolean; + } = {}, + ) { const url = new URL(`aml/${auth.id}/decisions`, this.baseUrl); - addMerchantPaginationParams(url, params); + addPaginationParams(url, params); if (params.account !== undefined) { url.searchParams.set("h_payto", params.account); } @@ -534,7 +905,10 @@ export class TalerExchangeHttpClient { url.searchParams.set("active", params.active ? "YES" : "NO"); } if (params.investigation !== undefined) { - url.searchParams.set("investigation", params.investigation ? "YES" : "NO"); + url.searchParams.set( + "investigation", + params.investigation ? "YES" : "NO", + ); } const resp = await this.httpLib.fetch(url.href, { @@ -564,10 +938,14 @@ export class TalerExchangeHttpClient { * https://docs.taler.net/core/api-exchange.html#get--aml-$OFFICER_PUB-attributes-$H_PAYTO * */ - async getAmlAttributesForAccount(auth: OfficerAccount, account: string, params: PaginationParams = {}) { + async getAmlAttributesForAccount( + auth: OfficerAccount, + account: string, + params: PaginationParams = {}, + ) { const url = new URL(`aml/${auth.id}/attributes/${account}`, this.baseUrl); - addMerchantPaginationParams(url, params); + addPaginationParams(url, params); const resp = await this.httpLib.fetch(url.href, { method: "GET", headers: { @@ -591,12 +969,14 @@ export class TalerExchangeHttpClient { } } - /** * https://docs.taler.net/core/api-exchange.html#get--aml-$OFFICER_PUB-attributes-$H_PAYTO * */ - async makeAmlDesicion(auth: OfficerAccount, decision: Omit<AmlDecisionRequest, "officer_sig">) { + async makeAmlDesicion( + auth: OfficerAccount, + decision: Omit<AmlDecisionRequest, "officer_sig">, + ) { const url = new URL(`aml/${auth.id}/decision`, this.baseUrl); const body = buildAMLDecisionSignature(auth.signingKey, decision); @@ -609,8 +989,12 @@ export class TalerExchangeHttpClient { }); switch (resp.status) { - case HttpStatusCode.NoContent: + case HttpStatusCode.NoContent: { + this.cacheEvictor.notifySuccess( + TalerExchangeCacheEviction.MAKE_AML_DECISION, + ); return opEmptySuccess(resp); + } case HttpStatusCode.Forbidden: return opKnownHttpFailure(resp.status, resp); case HttpStatusCode.NotFound: @@ -622,20 +1006,57 @@ export class TalerExchangeHttpClient { } } + // RESERVE control + + /** + * https://docs.taler.net/core/api-exchange.html#post--reserves-$RESERVE_PUB-open + * + */ + async reserveOpen(): Promise<never> { + throw Error("not yet implemented"); + } + + /** + * https://docs.taler.net/core/api-exchange.html#get--reserves-attest-$RESERVE_PUB + * + */ + async getReserveAttributes(): Promise<never> { + throw Error("not yet implemented"); + } + + /** + * https://docs.taler.net/core/api-exchange.html#post--reserves-attest-$RESERVE_PUB + * + */ + async signReserveAttributes(): Promise<never> { + throw Error("not yet implemented"); + } + + /** + * https://docs.taler.net/core/api-exchange.html#post--reserves-$RESERVE_PUB-close + * + */ + async closeReserve(): Promise<never> { + throw Error("not yet implemented"); + } + + /** + * https://docs.taler.net/core/api-exchange.html#delete--reserves-$RESERVE_PUB + * + */ + async deleteReserve(): Promise<never> { + throw Error("not yet implemented"); + } } function buildKYCQuerySignature(key: SigningKey): string { - const sigBlob = buildSigPS( - TalerSignaturePurpose.AML_QUERY, - ).build(); + const sigBlob = buildSigPS(TalerSignaturePurpose.KYC_AUTH).build(); return encodeCrock(eddsaSign(sigBlob, key)); } function buildAMLQuerySignature(key: SigningKey): string { - const sigBlob = buildSigPS( - TalerSignaturePurpose.AML_QUERY, - ).build(); + const sigBlob = buildSigPS(TalerSignaturePurpose.AML_QUERY).build(); return encodeCrock(eddsaSign(sigBlob, key)); } @@ -647,16 +1068,21 @@ function buildAMLDecisionSignature( const zero = new Uint8Array(new ArrayBuffer(64)); const sigBlob = buildSigPS(TalerSignaturePurpose.AML_DECISION) - //TODO: new need the null terminator, also in the exchange - .put(hash(stringToBytes(decision.justification))) //check null .put(timestampRoundedToBuffer(decision.decision_time)) - // .put(amountToBuffer(decision.new_threshold)) .put(decodeCrock(decision.h_payto)) - .put(zero) //kyc_requirement - // .put(bufferForUint32(decision.new_state)) + .put(hash(stringToBytes(decision.justification))) + .put(hash(stringToBytes(canonicalJson(decision.properties) + "\0"))) + .put(hash(stringToBytes(canonicalJson(decision.new_rules) + "\0"))) + .put( + decision.new_measures != null + ? hash(stringToBytes(decision.new_measures)) + : zero, + ) + .put(bufferForUint64(decision.keep_investigating ? 1 : 0)) .build(); const officer_sig = encodeCrock(eddsaSign(sigBlob, key)); + return { ...decision, officer_sig, diff --git a/packages/taler-util/src/http-client/merchant.ts b/packages/taler-util/src/http-client/merchant.ts index e765d286b..e6af6dfe8 100644 --- a/packages/taler-util/src/http-client/merchant.ts +++ b/packages/taler-util/src/http-client/merchant.ts @@ -45,6 +45,7 @@ import { codecForOtpDeviceSummaryResponse, codecForOutOfStockResponse, codecForPaidRefundStatusResponse, + codecForPaymentDeniedLegallyResponse, codecForPaymentResponse, codecForPostOrderResponse, codecForProductDetail, @@ -76,8 +77,8 @@ import { } from "@gnu-taler/taler-util/http"; import { opSuccessFromHttp, opUnknownFailure } from "../operation.js"; import { + addPaginationParams, CacheEvictor, - addMerchantPaginationParams, makeBearerTokenAuthHeader, nullEvictor, } from "./utils.js"; @@ -137,7 +138,7 @@ export enum TalerMerchantManagementCacheEviction { * Uses libtool's current:revision:age versioning. */ export class TalerMerchantInstanceHttpClient { - public readonly PROTOCOL_VERSION = "16:0:0"; + public readonly PROTOCOL_VERSION = "17:0:1"; readonly httpLib: HttpRequestLibrary; readonly cacheEvictor: CacheEvictor<TalerMerchantInstanceCacheEviction>; @@ -276,6 +277,12 @@ export class TalerMerchantInstanceHttpClient { return opKnownHttpFailure(resp.status, resp); case HttpStatusCode.GatewayTimeout: return opKnownHttpFailure(resp.status, resp); + case HttpStatusCode.UnavailableForLegalReasons: + return opKnownAlternativeFailure( + resp, + resp.status, + codecForPaymentDeniedLegallyResponse(), + ); default: return opUnknownFailure(resp, await readTalerErrorResponse(resp)); } @@ -431,6 +438,12 @@ export class TalerMerchantInstanceHttpClient { return opKnownHttpFailure(resp.status, resp); case HttpStatusCode.NotFound: return opKnownHttpFailure(resp.status, resp); + case HttpStatusCode.UnavailableForLegalReasons: + return opKnownAlternativeFailure( + resp, + resp.status, + codecForPaymentDeniedLegallyResponse(), + ); default: return opUnknownFailure(resp, await readTalerErrorResponse(resp)); } @@ -604,6 +617,8 @@ export class TalerMerchantInstanceHttpClient { }); switch (resp.status) { + case HttpStatusCode.Ok: + return opSuccessFromHttp(resp, codecForAccountKycRedirects()); case HttpStatusCode.Accepted: return opSuccessFromHttp(resp, codecForAccountKycRedirects()); case HttpStatusCode.NoContent: @@ -712,7 +727,7 @@ export class TalerMerchantInstanceHttpClient { ) { const url = new URL(`private/accounts`, this.baseUrl); - // addMerchantPaginationParams(url, params); + // addPaginationParams(url, params); const headers: Record<string, string> = {}; if (token) { @@ -809,7 +824,7 @@ export class TalerMerchantInstanceHttpClient { ) { const url = new URL(`private/categories`, this.baseUrl); - // addMerchantPaginationParams(url, params); + // addPaginationParams(url, params); const headers: Record<string, string> = {}; if (token) { @@ -1051,7 +1066,7 @@ export class TalerMerchantInstanceHttpClient { ) { const url = new URL(`private/products`, this.baseUrl); - addMerchantPaginationParams(url, params); + addPaginationParams(url, params); const headers: Record<string, string> = {}; if (token) { @@ -1234,6 +1249,12 @@ export class TalerMerchantInstanceHttpClient { return opKnownHttpFailure(resp.status, resp); case HttpStatusCode.Unauthorized: // FIXME: missing in docs return opKnownHttpFailure(resp.status, resp); + case HttpStatusCode.UnavailableForLegalReasons: + return opKnownAlternativeFailure( + resp, + resp.status, + codecForPaymentDeniedLegallyResponse(), + ); case HttpStatusCode.Conflict: return opKnownHttpFailure(resp.status, resp); case HttpStatusCode.Gone: @@ -1277,7 +1298,7 @@ export class TalerMerchantInstanceHttpClient { if (params.wired !== undefined) { url.searchParams.set("wired", params.wired ? "YES" : "NO"); } - addMerchantPaginationParams(url, params); + addPaginationParams(url, params); const headers: Record<string, string> = {}; if (token) { @@ -1471,6 +1492,12 @@ export class TalerMerchantInstanceHttpClient { return opKnownHttpFailure(resp.status, resp); case HttpStatusCode.Conflict: return opKnownHttpFailure(resp.status, resp); + case HttpStatusCode.UnavailableForLegalReasons: + return opKnownAlternativeFailure( + resp, + resp.status, + codecForPaymentDeniedLegallyResponse(), + ); default: return opUnknownFailure(resp, await readTalerErrorResponse(resp)); } @@ -1538,7 +1565,7 @@ export class TalerMerchantInstanceHttpClient { if (params.verified !== undefined) { url.searchParams.set("verified", params.verified ? "YES" : "NO"); } - addMerchantPaginationParams(url, params); + addPaginationParams(url, params); const headers: Record<string, string> = {}; if (token) { @@ -1679,7 +1706,7 @@ export class TalerMerchantInstanceHttpClient { ) { const url = new URL(`private/otp-devices`, this.baseUrl); - addMerchantPaginationParams(url, params); + addPaginationParams(url, params); const headers: Record<string, string> = {}; if (token) { @@ -1852,7 +1879,7 @@ export class TalerMerchantInstanceHttpClient { ) { const url = new URL(`private/templates`, this.baseUrl); - addMerchantPaginationParams(url, params); + addPaginationParams(url, params); const headers: Record<string, string> = {}; if (token) { @@ -2584,3 +2611,29 @@ export class TalerMerchantManagementHttpClient extends TalerMerchantInstanceHttp } } } + +// 2024-09-23T01:23:14.421Z http.ts INFO malformed error response (status 200): { +// "kyc_data": [ +// { +// "payto_uri": "payto://iban/DE1327812254798?receiver-name=the%20name%20of%20merchant", +// "exchange_url": "http://exchange.taler.test:1180/", +// "no_keys": false, +// "auth_conflict": false, +// "exchange_http_status": 204, +// "limits": [], +// "payto_kycauths": [ +// "payto://iban/DE9714548806481?receiver-name=Exchanger+Normal&subject=54DR9R0CEWA1A7FK3QWABJ1PRBCD2X6S418Y5DE0P9Q1ASKTX770" +// ] +// }, +// { +// "payto_uri": "payto://iban/DE1327812254798?receiver-name=the%20name%20of%20merchant", +// "exchange_url": "https://exchange.demo.taler.net/", +// "no_keys": false, +// "auth_conflict": false, +// "exchange_http_status": 400, +// "exchange_code": 26, +// "access_token": "0000000000000000000000000000000000000000000000000000", +// "limits": [] +// } +// ] +// } diff --git a/packages/taler-util/src/http-client/officer-account.ts b/packages/taler-util/src/http-client/officer-account.ts index 612fd815e..f5f55ea1b 100644 --- a/packages/taler-util/src/http-client/officer-account.ts +++ b/packages/taler-util/src/http-client/officer-account.ts @@ -17,11 +17,8 @@ import { EncryptionNonce, LockedAccount, - LockedReserve, OfficerAccount, OfficerId, - ReserveAccount, - ReserveId, SigningKey, createEddsaKeyPair, decodeCrock, @@ -31,7 +28,7 @@ import { encryptWithDerivedKey, getRandomBytesF, kdf, - stringToBytes, + stringToBytes } from "@gnu-taler/taler-util"; /** @@ -100,36 +97,6 @@ export async function createNewOfficerAccount( } /** - * Restore previous session and unlock account with password - * - * @param salt string from which crypto params will be derived - * @param key secured private key - * @param password password for the private key - * @returns - */ -export async function unlockWalletKycAccount( - account: LockedReserve, - password: string, -): Promise<ReserveAccount> { - const rawKey = decodeCrock(account); - const rawPassword = stringToBytes(password); - - const signingKey = (await decryptWithDerivedKey( - rawKey, - rawPassword, - password, - ).catch((e) => { - throw new UnwrapKeyError(e instanceof Error ? e.message : String(e)); - })) as SigningKey; - - const publicKey = eddsaGetPublic(signingKey); - - const accountId = encodeCrock(publicKey) as ReserveId; - - return { id: accountId, signingKey }; -} - -/** * Create new account (secured private key) * secured with the given password * diff --git a/packages/taler-util/src/http-client/utils.ts b/packages/taler-util/src/http-client/utils.ts index baea3ce6f..a69eb0847 100644 --- a/packages/taler-util/src/http-client/utils.ts +++ b/packages/taler-util/src/http-client/utils.ts @@ -46,29 +46,38 @@ export function makeBearerTokenAuthHeader(token: AccessToken): string { return `Bearer ${token}`; } +export type BasicOrTokenAuth = BasicAuth | TokenAuth; + +export type BasicAuth = { + type: "basic"; + username: string; + password: string; +}; + +export type TokenAuth = { + type: "bearer"; + token: AccessToken; +}; + +export function createAuthorizationHeader(auth?: BasicOrTokenAuth): string | undefined { + if (!auth) return undefined; + switch (auth.type) { + case "basic": { + return makeBasicAuthHeader(auth.username, auth.password); + } + case "bearer": { + return makeBearerTokenAuthHeader(auth.token); + } + } + return undefined; +} + /** * https://bugs.gnunet.org/view.php?id=7949 */ export function addPaginationParams(url: URL, pagination?: PaginationParams) { if (!pagination) return; if (pagination.offset) { - url.searchParams.set("start", pagination.offset); - } - const order = !pagination || pagination.order === "asc" ? 1 : -1; - const limit = - !pagination || !pagination.limit || pagination.limit === 0 - ? 5 - : Math.abs(pagination.limit); - //always send delta - url.searchParams.set("delta", String(order * limit)); -} - -export function addMerchantPaginationParams( - url: URL, - pagination?: PaginationParams, -) { - if (!pagination) return; - if (pagination.offset) { url.searchParams.set("offset", pagination.offset); } const order = !pagination || pagination.order === "asc" ? 1 : -1; @@ -76,14 +85,14 @@ export function addMerchantPaginationParams( !pagination || !pagination.limit || pagination.limit === 0 ? 5 : Math.abs(pagination.limit); - //always send delta + //always send limit url.searchParams.set("limit", String(order * limit)); } export function addLongPollingParam(url: URL, param?: LongPollParams) { if (!param) return; if (param.timeoutMs) { - url.searchParams.set("long_poll_ms", String(param.timeoutMs)); + url.searchParams.set("timeout_ms", String(param.timeoutMs)); } } @@ -95,26 +104,3 @@ export const nullEvictor: CacheEvictor<unknown> = { notifySuccess: () => Promise.resolve(), }; -export class IdempotencyRetry { - public readonly uid: string; - public readonly timesLeft: number; - public readonly maxTries: number; - - private constructor(timesLeft: number, maxTimesLeft: number) { - this.timesLeft = timesLeft; - this.maxTries = maxTimesLeft; - this.uid = encodeCrock(getRandomBytes(32)); - } - - static tryFiveTimes() { - return new IdempotencyRetry(5, 5); - } - - next(): IdempotencyRetry | undefined { - const left = this.timesLeft - 1; - if (left <= 0) { - return undefined; - } - return new IdempotencyRetry(left, this.maxTries); - } -} diff --git a/packages/taler-util/src/http-common.ts b/packages/taler-util/src/http-common.ts index 7e7173ac5..3f310e2b6 100644 --- a/packages/taler-util/src/http-common.ts +++ b/packages/taler-util/src/http-common.ts @@ -333,14 +333,16 @@ export function throwUnexpectedRequestError( httpResponse: HttpResponse, talerErrorResponse: TalerErrorResponse, ): never { + const errorDetails = { + requestUrl: httpResponse.requestUrl, + requestMethod: httpResponse.requestMethod, + httpStatusCode: httpResponse.status, + errorResponse: talerErrorResponse, + }; + logger.trace(`unexpected request error: ${j2s(errorDetails)}`); throw TalerError.fromDetail( TalerErrorCode.WALLET_UNEXPECTED_REQUEST_ERROR, - { - requestUrl: httpResponse.requestUrl, - requestMethod: httpResponse.requestMethod, - httpStatusCode: httpResponse.status, - errorResponse: talerErrorResponse, - }, + errorDetails, `Unexpected HTTP status ${httpResponse.status} in response`, ); } @@ -502,6 +504,8 @@ export function encodeBody(body: unknown): ArrayBuffer { return body.buffer; } else if (body instanceof ArrayBuffer) { return body; + } else if (body instanceof URLSearchParams) { + return textEncoder.encode(body.toString()).buffer; } else if (typeof body === "object" && body.constructor.name === "FormData") { return body as ArrayBuffer; } else if (typeof body === "object") { diff --git a/packages/taler-util/src/http-impl.node.ts b/packages/taler-util/src/http-impl.node.ts index fc5fe5e98..9cc78f848 100644 --- a/packages/taler-util/src/http-impl.node.ts +++ b/packages/taler-util/src/http-impl.node.ts @@ -138,6 +138,10 @@ export class HttpLibImpl implements HttpRequestLibrary { reqBody = encodeBody(opt.body); } + if (opt?.body instanceof URLSearchParams) { + requestHeadersMap["Content-Type"] = "application/x-www-form-urlencoded" + } + let path = parsedUrl.pathname; if (parsedUrl.search != null) { path += parsedUrl.search; diff --git a/packages/taler-util/src/http-impl.qtart.ts b/packages/taler-util/src/http-impl.qtart.ts index fbc80489c..42a7f41e2 100644 --- a/packages/taler-util/src/http-impl.qtart.ts +++ b/packages/taler-util/src/http-impl.qtart.ts @@ -19,9 +19,9 @@ /** * Imports. */ -import { Logger, openPromise } from "@gnu-taler/taler-util"; +import { j2s, Logger, openPromise } from "@gnu-taler/taler-util"; import { TalerError } from "./errors.js"; -import { HttpLibArgs, encodeBody, getDefaultHeaders } from "./http-common.js"; +import { encodeBody, getDefaultHeaders, HttpLibArgs } from "./http-common.js"; import { Headers, HttpRequestLibrary, @@ -173,7 +173,10 @@ export class HttpLibImpl implements HttpRequestLibrary { throw e; } - logger.trace(`got qtart http response, status ${res.status}`); + if (logger.shouldLogTrace()) { + logger.trace(`got qtart http response, status ${res.status}`); + logger.trace(`response headers: ${j2s(res.headers)}`); + } if (timeoutHandle != null) { clearTimeout(timeoutHandle); @@ -192,7 +195,16 @@ export class HttpLibImpl implements HttpRequestLibrary { continue; } const headerName = headerStr.slice(0, splitPos).trim().toLowerCase(); - const headerValue = headerStr.slice(splitPos + 1).trim(); + let headerValue = headerStr.slice(splitPos + 1).trim(); + // FIXME: This is a hotfix for the broken native networking implementation on Android + // that sends the content type header value in square brackets + if ( + headerName === "content-type" && + headerValue.startsWith("[") && + headerValue.endsWith("]") + ) { + headerValue = headerValue.substring(1, headerValue.length - 2); + } headers.set(headerName, headerValue); } } diff --git a/packages/taler-util/src/i18n.ts b/packages/taler-util/src/i18n.ts index f43f543ea..3c6f5ac57 100644 --- a/packages/taler-util/src/i18n.ts +++ b/packages/taler-util/src/i18n.ts @@ -60,6 +60,18 @@ export function singular( return tr; } +function withContext(ctx: string): typeof singular { + return function (t: TemplateStringsArray, ...v: any[]): TranslatedString { + const s = toI18nString(t); + const tr = jed + .translate(s) + .withContext(ctx) + .ifPlural(1, s) + .fetch(...v); + return tr; + }; +} + /** * Internationalize a string template without serializing */ @@ -79,14 +91,18 @@ export function translate( export function Translate({ children, debug, + context: ctx, }: { children: any; debug?: boolean; + context?: string; }): any { const c = [].concat(children); const s = stringifyArray(c); if (!s) return []; - const translation: TranslatedString = jed.ngettext(s, s, 1); + const translation: TranslatedString = ctx + ? jed.npgettext(ctx, s, s, 1) + : jed.ngettext(s, s, 1); if (debug) { console.log("looking for ", s, "got", translation); } @@ -156,6 +172,7 @@ function stringifyArray(children: Array<any>): string { export const i18n = { str: singular, + ctx: withContext, singular, Translate, translate, diff --git a/packages/taler-util/src/index.node.ts b/packages/taler-util/src/index.node.ts index ba4c6cf4e..b853c2c6e 100644 --- a/packages/taler-util/src/index.node.ts +++ b/packages/taler-util/src/index.node.ts @@ -21,4 +21,5 @@ initNodePrng(); export * from "./index.js"; export * from "./talerconfig.js"; export * from "./globbing/minimatch.js"; +export * from "./kyc-aml-utils.js"; export { setPrintHttpRequestAsCurl } from "./http-impl.node.js"; diff --git a/packages/taler-util/src/index.ts b/packages/taler-util/src/index.ts index d6a2fa614..d640ba41d 100644 --- a/packages/taler-util/src/index.ts +++ b/packages/taler-util/src/index.ts @@ -2,66 +2,74 @@ import { TalerErrorCode } from "./taler-error-codes.js"; export { TalerErrorCode }; - export * from "./amounts.js"; - export * from "./bank-api-client.js"; - export * from "./base64.js"; - export * from "./bitcoin.js"; - export * from "./CancellationToken.js"; - export * from "./codec.js"; - export * from "./contract-terms.js"; - export * from "./errors.js"; - export { fnutil } from "./fnutils.js"; - export * from "./helpers.js"; - export * from "./http-client/authentication.js"; - export * from "./http-client/bank-conversion.js"; - export * from "./http-client/bank-core.js"; - export * from "./http-client/bank-integration.js"; - export * from "./http-client/bank-revenue.js"; - export * from "./http-client/bank-wire.js"; - export * from "./http-client/challenger.js"; - export * from "./http-client/exchange.js"; - export * from "./http-client/merchant.js"; - export * from "./http-client/officer-account.js"; - export { CacheEvictor } from "./http-client/utils.js"; - export * from "./http-status-codes.js"; - export * from "./i18n.js"; - export * from "./iban.js"; - export * from "./invariants.js"; - export * from "./kdf.js"; - export * from "./libtool-version.js"; - export * from "./logging.js"; - export * from "./MerchantApiClient.js"; - export { - crypto_sign_keyPair_fromSeed, - randomBytes, - secretbox, - secretbox_open, - setPRNG - } from "./nacl-fast.js"; - export * from "./notifications.js"; - export * from "./observability.js"; - export * from "./operation.js"; - export * from "./payto.js"; - export * from "./promises.js"; - export * from "./qr.js"; - export { RequestThrottler } from "./RequestThrottler.js"; - export * from "./ReserveStatus.js"; - export * from "./ReserveTransaction.js"; - export * from "./rfc3548.js"; - export * from "./taler-crypto.js"; - export * from "./taleruri.js"; - export { TaskThrottler } from "./TaskThrottler.js"; - export * from "./time.js"; - export * from "./timer.js"; - export * from "./transaction-test-data.js"; - export * from "./url.js"; +export * from "./amounts.js"; +export * from "./bank-api-client.js"; +export * from "./base64.js"; +export * from "./bitcoin.js"; +export * from "./CancellationToken.js"; +export * from "./codec.js"; +export * from "./contract-terms.js"; +export * from "./errors.js"; +export { fnutil } from "./fnutils.js"; +export * from "./helpers.js"; +export * from "./http-client/authentication.js"; +export * from "./http-client/bank-conversion.js"; +export * from "./http-client/bank-core.js"; +export * from "./http-client/bank-integration.js"; +export * from "./http-client/bank-revenue.js"; +export * from "./http-client/bank-wire.js"; +export * from "./http-client/challenger.js"; +export * from "./http-client/exchange.js"; +export * from "./http-client/merchant.js"; +export * from "./http-client/officer-account.js"; +export { + CacheEvictor, + BasicOrTokenAuth, + BasicAuth, + TokenAuth, +} from "./http-client/utils.js"; +export * from "./http-status-codes.js"; +export * from "./i18n.js"; +export * from "./iban.js"; +export * from "./invariants.js"; +export * from "./kdf.js"; +export * from "./libtool-version.js"; +export * from "./logging.js"; +export * from "./MerchantApiClient.js"; +export { + crypto_sign_keyPair_fromSeed, + randomBytes, + secretbox, + secretbox_open, + setPRNG, +} from "./nacl-fast.js"; +export * from "./notifications.js"; +export * from "./observability.js"; +export * from "./operation.js"; +export * from "./payto.js"; +export * from "./promises.js"; +export * from "./qr.js"; +export { RequestThrottler } from "./RequestThrottler.js"; +export * from "./ReserveStatus.js"; +export * from "./ReserveTransaction.js"; +export * from "./rfc3548.js"; +export * from "./taler-crypto.js"; +export * from "./taleruri.js"; +export { TaskThrottler } from "./TaskThrottler.js"; +export * from "./time.js"; +export * from "./timer.js"; +export * from "./transaction-test-data.js"; +export * from "./url.js"; +// FIXME: remove all this, needs refactor export * from "./types-taler-bank-conversion.js"; export * from "./types-taler-bank-integration.js"; -export * from "./types-taler-common.js"; export * from "./types-taler-corebank.js"; export * from "./types-taler-exchange.js"; export * from "./types-taler-merchant.js"; +// end + +export * from "./types-taler-common.js"; export * from "./types-taler-sync.js"; export * from "./types-taler-wallet-transactions.js"; export * from "./types-taler-wallet.js"; @@ -74,5 +82,8 @@ export * as TalerExchangeApi from "./types-taler-exchange.js"; export * as TalerMerchantApi from "./types-taler-merchant.js"; export * as TalerRevenueApi from "./types-taler-revenue.js"; export * as TalerWireGatewayApi from "./types-taler-wire-gateway.js"; +export * as TalerKycAml from "./types-taler-kyc-aml.js"; export * from "./taler-signatures.js"; + +export * from "./account-restrictions.js"; diff --git a/packages/taler-util/src/kyc-aml-utils.ts b/packages/taler-util/src/kyc-aml-utils.ts new file mode 100644 index 000000000..d689d1b34 --- /dev/null +++ b/packages/taler-util/src/kyc-aml-utils.ts @@ -0,0 +1,61 @@ +/* + This file is part of GNU Taler + (C) 2022-2024 Taler Systems S.A. + + GNU Taler is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ + +import { AmlProgramParams, KycConverterParams } from "./types-taler-kyc-aml.js"; + +// https://docs.taler.net/taler-kyc-manual.html#implementing-your-own-aml-programs + +export function parseKycConverterParams(): KycConverterParams { + return process.argv.reduce((prev, arg, idx, list) => { + if (idx === 0) { + prev.name = arg; + } + if (arg === "-v") { + prev.showVersion = true; + } else if (arg === "-V") { + prev.debug = true; + } else if (arg === "--list-outputs") { + prev.showOutputs = true; + } else if (arg === "-h") { + prev.showHelp = true; + } else if (arg === "-c") { + prev.config = list[idx + 1]; + } + return prev; + }, {} as KycConverterParams); +} + +export function parseAmlProgramParams(): AmlProgramParams { + return process.argv.reduce((prev, arg, idx, list) => { + if (idx === 0) { + prev.name = arg; + } + if (arg === "-v") { + prev.showVersion = true; + } else if (arg === "-V") { + prev.debug = true; + } else if (arg === "-r") { + prev.showRequiredContext = true; + } else if (arg === "-a") { + prev.showRequiredAttributes = true; + } else if (arg === "-h") { + prev.showHelp = true; + } else if (arg === "-c") { + prev.config = list[idx + 1]; + } + return prev; + }, {} as AmlProgramParams); +} diff --git a/packages/taler-util/src/notifications.ts b/packages/taler-util/src/notifications.ts index c3e0070bc..eefa21cde 100644 --- a/packages/taler-util/src/notifications.ts +++ b/packages/taler-util/src/notifications.ts @@ -85,8 +85,10 @@ export interface ExchangeStateTransitionNotification { /** * New state of the exchange. + * + * If missing, exchange got deleted. */ - newExchangeState: ExchangeEntryState; + newExchangeState?: ExchangeEntryState; /** * Summary of the error that occurred when trying to update the exchange entry, diff --git a/packages/taler-util/src/operation.ts b/packages/taler-util/src/operation.ts index 6b5eb61a6..d757fd529 100644 --- a/packages/taler-util/src/operation.ts +++ b/packages/taler-util/src/operation.ts @@ -31,14 +31,14 @@ import { TalerErrorDetail, } from "./index.js"; -type OperationFailWithBodyOrNever<ErrorEnum, ErrorMap> = - ErrorEnum extends keyof ErrorMap ? OperationFailWithBody<ErrorMap> : never; +// type OperationFailWithBodyOrNever<ErrorEnum, ErrorMap> = +// ErrorEnum extends keyof ErrorMap ? OperationFailWithBody<ErrorMap> : never; export type OperationResult<Body, ErrorEnum, K = never> = | OperationOk<Body> | OperationAlternative<ErrorEnum, any> | OperationFail<ErrorEnum> - | OperationFailWithBodyOrNever<ErrorEnum, K>; +// | OperationFailWithBodyOrNever<ErrorEnum, K>; export function isOperationOk<T, E>( c: OperationResult<T, E>, @@ -75,7 +75,7 @@ export interface OperationFail<T> { */ case: T; - detail: TalerErrorDetail; + detail?: TalerErrorDetail; } /** @@ -88,12 +88,12 @@ export interface OperationAlternative<T, B> { body: B; } -export interface OperationFailWithBody<B> { - type: "fail"; +// export interface OperationFailWithBody<B> { +// type: "fail"; - case: keyof B; - body: B[OperationFailWithBody<B>["case"]]; -} +// case: keyof B; +// body: B[OperationFailWithBody<B>["case"]]; +// } export async function opSuccessFromHttp<T>( resp: HttpResponse, @@ -115,10 +115,15 @@ export function opEmptySuccess(resp: HttpResponse): OperationOk<void> { return { type: "ok" as const, body: void 0 }; } -export async function opKnownFailureWithBody<B>( - case_: keyof B, - body: B[typeof case_], -): Promise<OperationFailWithBody<B>> { +export async function opKnownFailure<T>( + case_: T): Promise<OperationFail<T>> { + return { type: "fail", case: case_ }; +} + +export async function opKnownFailureWithBody<T,B>( + case_: T, + body: B, +): Promise<OperationAlternative<T, B>> { return { type: "fail", case: case_, body }; } @@ -182,8 +187,8 @@ export function narrowOpSuccessOrThrow<Body, ErrorEnum>( } } -export async function succeedOrThrow<R, E>( - promise: Promise<OperationResult<R, E>>, +export async function succeedOrThrow<R>( + promise: Promise<OperationResult<R, unknown>>, ): Promise<R> { const resp = await promise; if (isOperationOk(resp)) { @@ -196,6 +201,30 @@ export async function succeedOrThrow<R, E>( throw TalerError.fromException(resp); } +export async function alternativeOrThrow<Error,Body, Alt>( + s: Error, + promise: Promise<OperationOk<Body> + | OperationAlternative<Error, Alt> + | OperationFail<Error>>, +): Promise<Alt> { + const resp = await promise; + if (isOperationOk(resp)) { + throw TalerError.fromException( + new Error(`request succeed but failure "${s}" was expected`), + ); + } + if (isOperationFail(resp) && resp.case !== s) { + throw TalerError.fromException( + new Error( + `request failed with "${JSON.stringify( + resp, + )}" but case "${s}" was expected`, + ), + ); + } + return (resp as any).body; +} + export async function failOrThrow<E>( s: E, promise: Promise<OperationResult<unknown, E>>, @@ -223,10 +252,10 @@ export type ResultByMethod< p extends keyof TT, > = TT[p] extends (...args: any[]) => infer Ret ? Ret extends Promise<infer Result> - ? Result extends OperationResult<any, any> - ? Result - : never - : never //api always use Promises + ? Result extends OperationResult<any, any> + ? Result + : never + : never //api always use Promises : never; //error cases just for functions export type FailCasesByMethod<TT extends object, p extends keyof TT> = Exclude< diff --git a/packages/taler-util/src/payto.ts b/packages/taler-util/src/payto.ts index f50f97e58..3c28a9ad0 100644 --- a/packages/taler-util/src/payto.ts +++ b/packages/taler-util/src/payto.ts @@ -99,21 +99,25 @@ export function buildPayto( type: "iban", iban: string, bic: string | undefined, + params?: Record<string, string>, ): PaytoUriIBAN; export function buildPayto( type: "bitcoin", address: string, reserve: string | undefined, + params?: Record<string, string>, ): PaytoUriBitcoin; export function buildPayto( type: "x-taler-bank", host: string, account: string, + params?: Record<string, string>, ): PaytoUriTalerBank; export function buildPayto( type: PaytoType, first: string, second?: string, + params: Record<string, string> = {}, ): PaytoUriGeneric { switch (type) { case "bitcoin": { @@ -123,7 +127,7 @@ export function buildPayto( targetType: "bitcoin", targetPath: first, address: uppercased, - params: {}, + params, segwitAddrs: !second ? [] : generateFakeSegwitAddress(second, first), }; return result; @@ -134,7 +138,7 @@ export function buildPayto( isKnown: true, targetType: "iban", iban: uppercased, - params: {}, + params, targetPath: !second ? uppercased : `${second}/${uppercased}`, }; return result; @@ -146,7 +150,7 @@ export function buildPayto( targetType: "x-taler-bank", host: first, account: second, - params: {}, + params, targetPath: `${first}/${second}`, }; return result; @@ -218,6 +222,35 @@ export function hashPaytoUri(p: PaytoUri | string): Uint8Array { return hashTruncate32(stringToBytes(paytoUri + "\0")); } +export function stringifyReservePaytoUri( + exchangeBaseUrl: string, + reservePub: string, +): string { + const url = new URL(exchangeBaseUrl); + let target: string; + let domainWithOptPort: string; + if (url.protocol === "https:") { + target = "taler-reserve"; + if (url.port != "443" && url.port !== "") { + domainWithOptPort = `${url.hostname}:${url.port}`; + } else { + domainWithOptPort = `${url.hostname}`; + } + } else { + target = "taler-reserve-http"; + if (url.port != "80" && url.port !== "") { + domainWithOptPort = `${url.hostname}:${url.port}`; + } else { + domainWithOptPort = `${url.hostname}`; + } + } + let optPath = ""; + if (url.pathname !== "/" && url.pathname !== "") { + optPath = url.pathname; + } + return `payto://${target}/${domainWithOptPort}${optPath}/${reservePub}`; +} + /** * Parse a valid payto:// uri into a PaytoUri object * RFC 8905 diff --git a/packages/taler-util/src/qr.ts b/packages/taler-util/src/qr.ts index 4d90ccf14..4858a3ba0 100644 --- a/packages/taler-util/src/qr.ts +++ b/packages/taler-util/src/qr.ts @@ -99,7 +99,19 @@ function encodePaytoAsEpcQr(paytoUri: string): EncodeResult { return { type: "skip" }; } const amountStr = parsedPayto.params["amount"]; - Amounts.stringifyValue; + + const parts = parsedPayto.targetPath.split("/"); + + const iban = parts[parts.length - 1]; + + const amt = + amountStr !== undefined + ? `${Amounts.currencyOf(amountStr)}${Amounts.stringifyValue( + amountStr, + 2, + )}` + : ""; + const lines = [ "BCD", // service tag "002", // version @@ -107,10 +119,8 @@ function encodePaytoAsEpcQr(paytoUri: string): EncodeResult { "SCT", // Identification "", // optional BIC parsedPayto.params["receiver-name"], // Beneficiary name - parsedPayto.targetPath, // Beneficiary IBAN - amountStr !== undefined - ? `${Amounts.currencyOf(amountStr)}${Amounts.stringifyValue(amountStr, 2)}` - : "", // Amount (optional) + iban, // Beneficiary IBAN + amt, // Amount (optional) "", // AT-44 Purpose parsedPayto.params["message"], // AT-05 Unstructured remittance information ]; diff --git a/packages/taler-util/src/taler-error-codes.ts b/packages/taler-util/src/taler-error-codes.ts index 3877932e1..e756ad87d 100644 --- a/packages/taler-util/src/taler-error-codes.ts +++ b/packages/taler-util/src/taler-error-codes.ts @@ -22,8 +22,6 @@ */ export enum TalerErrorCode { - - /** * Special code to indicate success (no error). * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -31,7 +29,6 @@ export enum TalerErrorCode { */ NONE = 0, - /** * An error response did not include an error code in the format expected by the client. Most likely, the server does not speak the GNU Taler protocol. Check the URL and/or the network connection to the server. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -39,7 +36,6 @@ export enum TalerErrorCode { */ INVALID = 1, - /** * An internal failure happened on the client side. Details should be in the local logs. Check if you are using the latest available version or file a report with the developers. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -47,7 +43,6 @@ export enum TalerErrorCode { */ GENERIC_CLIENT_INTERNAL_ERROR = 2, - /** * The client does not support the protocol version advertised by the server. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -55,7 +50,6 @@ export enum TalerErrorCode { */ GENERIC_CLIENT_UNSUPPORTED_PROTOCOL_VERSION = 3, - /** * The response we got from the server was not in the expected format. Most likely, the server does not speak the GNU Taler protocol. Check the URL and/or the network connection to the server. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -63,7 +57,6 @@ export enum TalerErrorCode { */ GENERIC_INVALID_RESPONSE = 10, - /** * The operation timed out. Trying again might help. Check the network connection. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -71,7 +64,6 @@ export enum TalerErrorCode { */ GENERIC_TIMEOUT = 11, - /** * The protocol version given by the server does not follow the required format. Most likely, the server does not speak the GNU Taler protocol. Check the URL and/or the network connection to the server. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -79,7 +71,6 @@ export enum TalerErrorCode { */ GENERIC_VERSION_MALFORMED = 12, - /** * The service responded with a reply that was in the right data format, but the content did not satisfy the protocol. Please file a bug report. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -87,7 +78,6 @@ export enum TalerErrorCode { */ GENERIC_REPLY_MALFORMED = 13, - /** * There is an error in the client-side configuration, for example an option is set to an invalid value. Check the logs and fix the local configuration. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -95,7 +85,6 @@ export enum TalerErrorCode { */ GENERIC_CONFIGURATION_INVALID = 14, - /** * The client made a request to a service, but received an error response it does not know how to handle. Please file a bug report. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -103,7 +92,6 @@ export enum TalerErrorCode { */ GENERIC_UNEXPECTED_REQUEST_ERROR = 15, - /** * The token used by the client to authorize the request does not grant the required permissions for the request. Check the requirements and obtain a suitable authorization token to proceed. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -111,7 +99,6 @@ export enum TalerErrorCode { */ GENERIC_TOKEN_PERMISSION_INSUFFICIENT = 16, - /** * The HTTP method used is invalid for this endpoint. This is likely a bug in the client implementation. Check if you are using the latest available version and/or file a report with the developers. * Returned with an HTTP status code of #MHD_HTTP_METHOD_NOT_ALLOWED (405). @@ -119,7 +106,6 @@ export enum TalerErrorCode { */ GENERIC_METHOD_INVALID = 20, - /** * There is no endpoint defined for the URL provided by the client. Check if you used the correct URL and/or file a report with the developers of the client software. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -127,7 +113,6 @@ export enum TalerErrorCode { */ GENERIC_ENDPOINT_UNKNOWN = 21, - /** * The JSON in the client's request was malformed. This is likely a bug in the client implementation. Check if you are using the latest available version and/or file a report with the developers. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -135,7 +120,6 @@ export enum TalerErrorCode { */ GENERIC_JSON_INVALID = 22, - /** * Some of the HTTP headers provided by the client were malformed and caused the server to not be able to handle the request. This is likely a bug in the client implementation. Check if you are using the latest available version and/or file a report with the developers. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -143,7 +127,6 @@ export enum TalerErrorCode { */ GENERIC_HTTP_HEADERS_MALFORMED = 23, - /** * The payto:// URI provided by the client is malformed. Check that you are using the correct syntax as of RFC 8905 and/or that you entered the bank account number correctly. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -151,7 +134,6 @@ export enum TalerErrorCode { */ GENERIC_PAYTO_URI_MALFORMED = 24, - /** * A required parameter in the request was missing. This is likely a bug in the client implementation. Check if you are using the latest available version and/or file a report with the developers. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -159,7 +141,6 @@ export enum TalerErrorCode { */ GENERIC_PARAMETER_MISSING = 25, - /** * A parameter in the request was malformed. This is likely a bug in the client implementation. Check if you are using the latest available version and/or file a report with the developers. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -167,7 +148,6 @@ export enum TalerErrorCode { */ GENERIC_PARAMETER_MALFORMED = 26, - /** * The reserve public key was malformed. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -175,7 +155,6 @@ export enum TalerErrorCode { */ GENERIC_RESERVE_PUB_MALFORMED = 27, - /** * The body in the request could not be decompressed by the server. This is likely a bug in the client implementation. Check if you are using the latest available version and/or file a report with the developers. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -183,7 +162,6 @@ export enum TalerErrorCode { */ GENERIC_COMPRESSION_INVALID = 28, - /** * A segment in the path of the URL provided by the client is malformed. Check that you are using the correct encoding for the URL. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -191,7 +169,6 @@ export enum TalerErrorCode { */ GENERIC_PATH_SEGMENT_MALFORMED = 29, - /** * The currency involved in the operation is not acceptable for this server. Check your configuration and make sure the currency specified for a given service provider is one of the currencies supported by that provider. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -199,7 +176,6 @@ export enum TalerErrorCode { */ GENERIC_CURRENCY_MISMATCH = 30, - /** * The URI is longer than the longest URI the HTTP server is willing to parse. If you believe this was a legitimate request, contact the server administrators and/or the software developers to increase the limit. * Returned with an HTTP status code of #MHD_HTTP_URI_TOO_LONG (414). @@ -207,7 +183,6 @@ export enum TalerErrorCode { */ GENERIC_URI_TOO_LONG = 31, - /** * The body is too large to be permissible for the endpoint. If you believe this was a legitimate request, contact the server administrators and/or the software developers to increase the limit. * Returned with an HTTP status code of #MHD_HTTP_CONTENT_TOO_LARGE (413). @@ -215,7 +190,6 @@ export enum TalerErrorCode { */ GENERIC_UPLOAD_EXCEEDS_LIMIT = 32, - /** * The service refused the request due to lack of proper authorization. * Returned with an HTTP status code of #MHD_HTTP_UNAUTHORIZED (401). @@ -223,7 +197,6 @@ export enum TalerErrorCode { */ GENERIC_UNAUTHORIZED = 40, - /** * The service refused the request as the given authorization token is unknown. * Returned with an HTTP status code of #MHD_HTTP_UNAUTHORIZED (401). @@ -231,7 +204,6 @@ export enum TalerErrorCode { */ GENERIC_TOKEN_UNKNOWN = 41, - /** * The service refused the request as the given authorization token expired. * Returned with an HTTP status code of #MHD_HTTP_UNAUTHORIZED (401). @@ -239,7 +211,6 @@ export enum TalerErrorCode { */ GENERIC_TOKEN_EXPIRED = 42, - /** * The service refused the request as the given authorization token is malformed. * Returned with an HTTP status code of #MHD_HTTP_UNAUTHORIZED (401). @@ -247,7 +218,6 @@ export enum TalerErrorCode { */ GENERIC_TOKEN_MALFORMED = 43, - /** * The service refused the request due to lack of proper rights on the resource. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -255,7 +225,6 @@ export enum TalerErrorCode { */ GENERIC_FORBIDDEN = 44, - /** * The service failed initialize its connection to the database. The system administrator should check that the service has permissions to access the database and that the database is running. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -263,7 +232,6 @@ export enum TalerErrorCode { */ GENERIC_DB_SETUP_FAILED = 50, - /** * The service encountered an error event to just start the database transaction. The system administrator should check that the database is running. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -271,7 +239,6 @@ export enum TalerErrorCode { */ GENERIC_DB_START_FAILED = 51, - /** * The service failed to store information in its database. The system administrator should check that the database is running and review the service logs. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -279,7 +246,6 @@ export enum TalerErrorCode { */ GENERIC_DB_STORE_FAILED = 52, - /** * The service failed to fetch information from its database. The system administrator should check that the database is running and review the service logs. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -287,7 +253,6 @@ export enum TalerErrorCode { */ GENERIC_DB_FETCH_FAILED = 53, - /** * The service encountered an unrecoverable error trying to commit a transaction to the database. The system administrator should check that the database is running and review the service logs. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -295,7 +260,6 @@ export enum TalerErrorCode { */ GENERIC_DB_COMMIT_FAILED = 54, - /** * The service encountered an error event to commit the database transaction, even after repeatedly retrying it there was always a conflicting transaction. This indicates a repeated serialization error; it should only happen if some client maliciously tries to create conflicting concurrent transactions. It could also be a sign of a missing index. Check if you are using the latest available version and/or file a report with the developers. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -303,7 +267,6 @@ export enum TalerErrorCode { */ GENERIC_DB_SOFT_FAILURE = 55, - /** * The service's database is inconsistent and violates service-internal invariants. Check if you are using the latest available version and/or file a report with the developers. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -311,7 +274,6 @@ export enum TalerErrorCode { */ GENERIC_DB_INVARIANT_FAILURE = 56, - /** * The HTTP server experienced an internal invariant failure (bug). Check if you are using the latest available version and/or file a report with the developers. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -319,7 +281,6 @@ export enum TalerErrorCode { */ GENERIC_INTERNAL_INVARIANT_FAILURE = 60, - /** * The service could not compute a cryptographic hash over some JSON value. Check if you are using the latest available version and/or file a report with the developers. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -327,7 +288,6 @@ export enum TalerErrorCode { */ GENERIC_FAILED_COMPUTE_JSON_HASH = 61, - /** * The service could not compute an amount. Check if you are using the latest available version and/or file a report with the developers. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -335,7 +295,6 @@ export enum TalerErrorCode { */ GENERIC_FAILED_COMPUTE_AMOUNT = 62, - /** * The HTTP server had insufficient memory to parse the request. Restarting services periodically can help, especially if Postgres is using excessive amounts of memory. Check with the system administrator to investigate. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -343,7 +302,6 @@ export enum TalerErrorCode { */ GENERIC_PARSER_OUT_OF_MEMORY = 70, - /** * The HTTP server failed to allocate memory. Restarting services periodically can help, especially if Postgres is using excessive amounts of memory. Check with the system administrator to investigate. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -351,7 +309,6 @@ export enum TalerErrorCode { */ GENERIC_ALLOCATION_FAILURE = 71, - /** * The HTTP server failed to allocate memory for building JSON reply. Restarting services periodically can help, especially if Postgres is using excessive amounts of memory. Check with the system administrator to investigate. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -359,7 +316,6 @@ export enum TalerErrorCode { */ GENERIC_JSON_ALLOCATION_FAILURE = 72, - /** * The HTTP server failed to allocate memory for making a CURL request. Restarting services periodically can help, especially if Postgres is using excessive amounts of memory. Check with the system administrator to investigate. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -367,7 +323,6 @@ export enum TalerErrorCode { */ GENERIC_CURL_ALLOCATION_FAILURE = 73, - /** * The backend could not locate a required template to generate an HTML reply. The system administrator should check if the resource files are installed in the correct location and are readable to the service. * Returned with an HTTP status code of #MHD_HTTP_NOT_ACCEPTABLE (406). @@ -375,7 +330,6 @@ export enum TalerErrorCode { */ GENERIC_FAILED_TO_LOAD_TEMPLATE = 74, - /** * The backend could not expand the template to generate an HTML reply. The system administrator should investigate the logs and check if the templates are well-formed. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -383,7 +337,6 @@ export enum TalerErrorCode { */ GENERIC_FAILED_TO_EXPAND_TEMPLATE = 75, - /** * Exchange is badly configured and thus cannot operate. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -391,7 +344,6 @@ export enum TalerErrorCode { */ EXCHANGE_GENERIC_BAD_CONFIGURATION = 1000, - /** * Operation specified unknown for this endpoint. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -399,7 +351,6 @@ export enum TalerErrorCode { */ EXCHANGE_GENERIC_OPERATION_UNKNOWN = 1001, - /** * The number of segments included in the URI does not match the number of segments expected by the endpoint. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -407,7 +358,6 @@ export enum TalerErrorCode { */ EXCHANGE_GENERIC_WRONG_NUMBER_OF_SEGMENTS = 1002, - /** * The same coin was already used with a different denomination previously. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -415,7 +365,6 @@ export enum TalerErrorCode { */ EXCHANGE_GENERIC_COIN_CONFLICTING_DENOMINATION_KEY = 1003, - /** * The public key of given to a "/coins/" endpoint of the exchange was malformed. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -423,7 +372,6 @@ export enum TalerErrorCode { */ EXCHANGE_GENERIC_COINS_INVALID_COIN_PUB = 1004, - /** * The exchange is not aware of the denomination key the wallet requested for the operation. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -431,7 +379,6 @@ export enum TalerErrorCode { */ EXCHANGE_GENERIC_DENOMINATION_KEY_UNKNOWN = 1005, - /** * The signature of the denomination key over the coin is not valid. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -439,7 +386,6 @@ export enum TalerErrorCode { */ EXCHANGE_DENOMINATION_SIGNATURE_INVALID = 1006, - /** * The exchange failed to perform the operation as it could not find the private keys. This is a problem with the exchange setup, not with the client's request. * Returned with an HTTP status code of #MHD_HTTP_SERVICE_UNAVAILABLE (503). @@ -447,7 +393,6 @@ export enum TalerErrorCode { */ EXCHANGE_GENERIC_KEYS_MISSING = 1007, - /** * Validity period of the denomination lies in the future. * Returned with an HTTP status code of #MHD_HTTP_PRECONDITION_FAILED (412). @@ -455,7 +400,6 @@ export enum TalerErrorCode { */ EXCHANGE_GENERIC_DENOMINATION_VALIDITY_IN_FUTURE = 1008, - /** * Denomination key of the coin is past its expiration time for the requested operation. * Returned with an HTTP status code of #MHD_HTTP_GONE (410). @@ -463,7 +407,6 @@ export enum TalerErrorCode { */ EXCHANGE_GENERIC_DENOMINATION_EXPIRED = 1009, - /** * Denomination key of the coin has been revoked. * Returned with an HTTP status code of #MHD_HTTP_GONE (410). @@ -471,7 +414,6 @@ export enum TalerErrorCode { */ EXCHANGE_GENERIC_DENOMINATION_REVOKED = 1010, - /** * An operation where the exchange interacted with a security module timed out. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -479,7 +421,6 @@ export enum TalerErrorCode { */ EXCHANGE_GENERIC_SECMOD_TIMEOUT = 1011, - /** * The respective coin did not have sufficient residual value for the operation. The "history" in this response provides the "residual_value" of the coin, which may be less than its "original_value". * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -487,7 +428,6 @@ export enum TalerErrorCode { */ EXCHANGE_GENERIC_INSUFFICIENT_FUNDS = 1012, - /** * The exchange had an internal error reconstructing the transaction history of the coin that was being processed. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -495,7 +435,6 @@ export enum TalerErrorCode { */ EXCHANGE_GENERIC_COIN_HISTORY_COMPUTATION_FAILED = 1013, - /** * The exchange failed to obtain the transaction history of the given coin from the database while generating an insufficient funds errors. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -503,7 +442,6 @@ export enum TalerErrorCode { */ EXCHANGE_GENERIC_HISTORY_DB_ERROR_INSUFFICIENT_FUNDS = 1014, - /** * The same coin was already used with a different age hash previously. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -511,7 +449,6 @@ export enum TalerErrorCode { */ EXCHANGE_GENERIC_COIN_CONFLICTING_AGE_HASH = 1015, - /** * The requested operation is not valid for the cipher used by the selected denomination. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -519,7 +456,6 @@ export enum TalerErrorCode { */ EXCHANGE_GENERIC_INVALID_DENOMINATION_CIPHER_FOR_OPERATION = 1016, - /** * The provided arguments for the operation use inconsistent ciphers. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -527,7 +463,6 @@ export enum TalerErrorCode { */ EXCHANGE_GENERIC_CIPHER_MISMATCH = 1017, - /** * The number of denominations specified in the request exceeds the limit of the exchange. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -535,7 +470,6 @@ export enum TalerErrorCode { */ EXCHANGE_GENERIC_NEW_DENOMS_ARRAY_SIZE_EXCESSIVE = 1018, - /** * The coin is not known to the exchange (yet). * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -543,7 +477,6 @@ export enum TalerErrorCode { */ EXCHANGE_GENERIC_COIN_UNKNOWN = 1019, - /** * The time at the server is too far off from the time specified in the request. Most likely the client system time is wrong. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -551,7 +484,6 @@ export enum TalerErrorCode { */ EXCHANGE_GENERIC_CLOCK_SKEW = 1020, - /** * The specified amount for the coin is higher than the value of the denomination of the coin. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -559,7 +491,6 @@ export enum TalerErrorCode { */ EXCHANGE_GENERIC_AMOUNT_EXCEEDS_DENOMINATION_VALUE = 1021, - /** * The exchange was not properly configured with global fees. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -567,7 +498,6 @@ export enum TalerErrorCode { */ EXCHANGE_GENERIC_GLOBAL_FEES_MISSING = 1022, - /** * The exchange was not properly configured with wire fees. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -575,7 +505,6 @@ export enum TalerErrorCode { */ EXCHANGE_GENERIC_WIRE_FEES_MISSING = 1023, - /** * The purse public key was malformed. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -583,7 +512,6 @@ export enum TalerErrorCode { */ EXCHANGE_GENERIC_PURSE_PUB_MALFORMED = 1024, - /** * The purse is unknown. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -591,7 +519,6 @@ export enum TalerErrorCode { */ EXCHANGE_GENERIC_PURSE_UNKNOWN = 1025, - /** * The purse has expired. * Returned with an HTTP status code of #MHD_HTTP_GONE (410). @@ -599,7 +526,6 @@ export enum TalerErrorCode { */ EXCHANGE_GENERIC_PURSE_EXPIRED = 1026, - /** * The exchange has no information about the "reserve_pub" that was given. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -607,7 +533,6 @@ export enum TalerErrorCode { */ EXCHANGE_GENERIC_RESERVE_UNKNOWN = 1027, - /** * The exchange is not allowed to proceed with the operation until the client has satisfied a KYC check. * Returned with an HTTP status code of #MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS (451). @@ -615,7 +540,6 @@ export enum TalerErrorCode { */ EXCHANGE_GENERIC_KYC_REQUIRED = 1028, - /** * Inconsistency between provided age commitment and attest: either none or both must be provided * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -623,7 +547,6 @@ export enum TalerErrorCode { */ EXCHANGE_PURSE_DEPOSIT_COIN_CONFLICTING_ATTEST_VS_AGE_COMMITMENT = 1029, - /** * The provided attestation for the minimum age couldn't be verified by the exchange. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -631,7 +554,6 @@ export enum TalerErrorCode { */ EXCHANGE_PURSE_DEPOSIT_COIN_AGE_ATTESTATION_FAILURE = 1030, - /** * The purse was deleted. * Returned with an HTTP status code of #MHD_HTTP_GONE (410). @@ -639,7 +561,6 @@ export enum TalerErrorCode { */ EXCHANGE_GENERIC_PURSE_DELETED = 1031, - /** * The public key of the AML officer in the URL was malformed. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -647,7 +568,6 @@ export enum TalerErrorCode { */ EXCHANGE_GENERIC_AML_OFFICER_PUB_MALFORMED = 1032, - /** * The signature affirming the GET request of the AML officer is invalid. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -655,7 +575,6 @@ export enum TalerErrorCode { */ EXCHANGE_GENERIC_AML_OFFICER_GET_SIGNATURE_INVALID = 1033, - /** * The specified AML officer does not have access at this time. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -663,7 +582,6 @@ export enum TalerErrorCode { */ EXCHANGE_GENERIC_AML_OFFICER_ACCESS_DENIED = 1034, - /** * The requested operation is denied pending the resolution of an anti-money laundering investigation by the exchange operator. This is a manual process, please wait and retry later. * Returned with an HTTP status code of #MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS (451). @@ -671,7 +589,6 @@ export enum TalerErrorCode { */ EXCHANGE_GENERIC_AML_PENDING = 1035, - /** * The requested operation is denied as the account was frozen on suspicion of money laundering. Please contact the exchange operator. * Returned with an HTTP status code of #MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS (451). @@ -679,7 +596,6 @@ export enum TalerErrorCode { */ EXCHANGE_GENERIC_AML_FROZEN = 1036, - /** * The exchange failed to start a KYC attribute conversion helper process. It is likely configured incorrectly. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -687,6 +603,33 @@ export enum TalerErrorCode { */ EXCHANGE_GENERIC_KYC_CONVERTER_FAILED = 1037, + /** + * The KYC operation failed. This could be because the KYC provider rejected the KYC data provided, or because the user aborted the KYC process. + * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). + * (A value of 0 indicates that the error is generated client-side). + */ + EXCHANGE_GENERIC_KYC_FAILED = 1038, + + /** + * A fallback measure for a KYC operation failed. This is a bug. Users should contact the exchange operator. + * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). + * (A value of 0 indicates that the error is generated client-side). + */ + EXCHANGE_GENERIC_KYC_FALLBACK_FAILED = 1039, + + /** + * The specified fallback measure for a KYC operation is unknown. This is a bug. Users should contact the exchange operator. + * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). + * (A value of 0 indicates that the error is generated client-side). + */ + EXCHANGE_GENERIC_KYC_FALLBACK_UNKNOWN = 1040, + + /** + * The exchange is not aware of the bank account (payto URI or hash thereof) specified in the request and thus cannot perform the requested operation. The client should check that the select account is correct. + * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). + * (A value of 0 indicates that the error is generated client-side). + */ + EXCHANGE_GENERIC_BANK_ACCOUNT_UNKNOWN = 1041, /** * The exchange did not find information about the specified transaction in the database. @@ -695,7 +638,6 @@ export enum TalerErrorCode { */ EXCHANGE_DEPOSITS_GET_NOT_FOUND = 1100, - /** * The wire hash of given to a "/deposits/" handler was malformed. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -703,7 +645,6 @@ export enum TalerErrorCode { */ EXCHANGE_DEPOSITS_GET_INVALID_H_WIRE = 1101, - /** * The merchant key of given to a "/deposits/" handler was malformed. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -711,7 +652,6 @@ export enum TalerErrorCode { */ EXCHANGE_DEPOSITS_GET_INVALID_MERCHANT_PUB = 1102, - /** * The hash of the contract terms given to a "/deposits/" handler was malformed. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -719,7 +659,6 @@ export enum TalerErrorCode { */ EXCHANGE_DEPOSITS_GET_INVALID_H_CONTRACT_TERMS = 1103, - /** * The coin public key of given to a "/deposits/" handler was malformed. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -727,7 +666,6 @@ export enum TalerErrorCode { */ EXCHANGE_DEPOSITS_GET_INVALID_COIN_PUB = 1104, - /** * The signature returned by the exchange in a /deposits/ request was malformed. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -735,7 +673,6 @@ export enum TalerErrorCode { */ EXCHANGE_DEPOSITS_GET_INVALID_SIGNATURE_BY_EXCHANGE = 1105, - /** * The signature of the merchant is invalid. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -743,7 +680,6 @@ export enum TalerErrorCode { */ EXCHANGE_DEPOSITS_GET_MERCHANT_SIGNATURE_INVALID = 1106, - /** * The provided policy data was not accepted * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -751,7 +687,6 @@ export enum TalerErrorCode { */ EXCHANGE_DEPOSITS_POLICY_NOT_ACCEPTED = 1107, - /** * The given reserve does not have sufficient funds to admit the requested withdraw operation at this time. The response includes the current "balance" of the reserve as well as the transaction "history" that lead to this balance. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -759,7 +694,6 @@ export enum TalerErrorCode { */ EXCHANGE_WITHDRAW_INSUFFICIENT_FUNDS = 1150, - /** * The given reserve does not have sufficient funds to admit the requested age-withdraw operation at this time. The response includes the current "balance" of the reserve as well as the transaction "history" that lead to this balance. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -767,7 +701,6 @@ export enum TalerErrorCode { */ EXCHANGE_AGE_WITHDRAW_INSUFFICIENT_FUNDS = 1151, - /** * The amount to withdraw together with the fee exceeds the numeric range for Taler amounts. This is not a client failure, as the coin value and fees come from the exchange's configuration. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -775,7 +708,6 @@ export enum TalerErrorCode { */ EXCHANGE_WITHDRAW_AMOUNT_FEE_OVERFLOW = 1152, - /** * The exchange failed to create the signature using the denomination key. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -783,7 +715,6 @@ export enum TalerErrorCode { */ EXCHANGE_WITHDRAW_SIGNATURE_FAILED = 1153, - /** * The signature of the reserve is not valid. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -791,7 +722,6 @@ export enum TalerErrorCode { */ EXCHANGE_WITHDRAW_RESERVE_SIGNATURE_INVALID = 1154, - /** * When computing the reserve history, we ended up with a negative overall balance, which should be impossible. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -799,7 +729,6 @@ export enum TalerErrorCode { */ EXCHANGE_RESERVE_HISTORY_ERROR_INSUFFICIENT_FUNDS = 1155, - /** * The reserve did not have sufficient funds in it to pay for a full reserve history statement. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -807,7 +736,6 @@ export enum TalerErrorCode { */ EXCHANGE_GET_RESERVE_HISTORY_ERROR_INSUFFICIENT_BALANCE = 1156, - /** * Withdraw period of the coin to be withdrawn is in the past. * Returned with an HTTP status code of #MHD_HTTP_GONE (410). @@ -815,7 +743,6 @@ export enum TalerErrorCode { */ EXCHANGE_WITHDRAW_DENOMINATION_KEY_LOST = 1158, - /** * The client failed to unblind the blind signature. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -823,7 +750,6 @@ export enum TalerErrorCode { */ EXCHANGE_WITHDRAW_UNBLIND_FAILURE = 1159, - /** * The client re-used a withdraw nonce, which is not allowed. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -831,7 +757,6 @@ export enum TalerErrorCode { */ EXCHANGE_WITHDRAW_NONCE_REUSE = 1160, - /** * The client provided an unknown commitment for an age-withdraw request. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -839,7 +764,6 @@ export enum TalerErrorCode { */ EXCHANGE_AGE_WITHDRAW_COMMITMENT_UNKNOWN = 1161, - /** * The total sum of amounts from the denominations did overflow. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -847,7 +771,6 @@ export enum TalerErrorCode { */ EXCHANGE_AGE_WITHDRAW_AMOUNT_OVERFLOW = 1162, - /** * The total sum of value and fees from the denominations differs from the committed amount with fees. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -855,7 +778,6 @@ export enum TalerErrorCode { */ EXCHANGE_AGE_WITHDRAW_AMOUNT_INCORRECT = 1163, - /** * The original commitment differs from the calculated hash * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -863,7 +785,6 @@ export enum TalerErrorCode { */ EXCHANGE_AGE_WITHDRAW_REVEAL_INVALID_HASH = 1164, - /** * The maximum age in the commitment is too large for the reserve * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -871,7 +792,6 @@ export enum TalerErrorCode { */ EXCHANGE_AGE_WITHDRAW_MAXIMUM_AGE_TOO_LARGE = 1165, - /** * The batch withdraw included a planchet that was already withdrawn. This is not allowed. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -879,7 +799,6 @@ export enum TalerErrorCode { */ EXCHANGE_WITHDRAW_BATCH_IDEMPOTENT_PLANCHET = 1175, - /** * The signature made by the coin over the deposit permission is not valid. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -887,7 +806,6 @@ export enum TalerErrorCode { */ EXCHANGE_DEPOSIT_COIN_SIGNATURE_INVALID = 1205, - /** * The same coin was already deposited for the same merchant and contract with other details. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -895,7 +813,6 @@ export enum TalerErrorCode { */ EXCHANGE_DEPOSIT_CONFLICTING_CONTRACT = 1206, - /** * The stated value of the coin after the deposit fee is subtracted would be negative. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -903,7 +820,6 @@ export enum TalerErrorCode { */ EXCHANGE_DEPOSIT_NEGATIVE_VALUE_AFTER_FEE = 1207, - /** * The stated refund deadline is after the wire deadline. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -911,7 +827,6 @@ export enum TalerErrorCode { */ EXCHANGE_DEPOSIT_REFUND_DEADLINE_AFTER_WIRE_DEADLINE = 1208, - /** * The stated wire deadline is "never", which makes no sense. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -919,7 +834,6 @@ export enum TalerErrorCode { */ EXCHANGE_DEPOSIT_WIRE_DEADLINE_IS_NEVER = 1209, - /** * The exchange failed to canonicalize and hash the given wire format. For example, the merchant failed to provide the "salt" or a valid payto:// URI in the wire details. Note that while the exchange will do some basic sanity checking on the wire details, it cannot warrant that the banking system will ultimately be able to route to the specified address, even if this check passed. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -927,7 +841,6 @@ export enum TalerErrorCode { */ EXCHANGE_DEPOSIT_INVALID_WIRE_FORMAT_JSON = 1210, - /** * The hash of the given wire address does not match the wire hash specified in the proposal data. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -935,7 +848,6 @@ export enum TalerErrorCode { */ EXCHANGE_DEPOSIT_INVALID_WIRE_FORMAT_CONTRACT_HASH_CONFLICT = 1211, - /** * The signature provided by the exchange is not valid. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -943,7 +855,6 @@ export enum TalerErrorCode { */ EXCHANGE_DEPOSIT_INVALID_SIGNATURE_BY_EXCHANGE = 1221, - /** * The deposited amount is smaller than the deposit fee, which would result in a negative contribution. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -951,7 +862,6 @@ export enum TalerErrorCode { */ EXCHANGE_DEPOSIT_FEE_ABOVE_AMOUNT = 1222, - /** * The proof of policy fulfillment was invalid. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -959,7 +869,6 @@ export enum TalerErrorCode { */ EXCHANGE_EXTENSIONS_INVALID_FULFILLMENT = 1240, - /** * The coin history was requested with a bad signature. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -967,7 +876,6 @@ export enum TalerErrorCode { */ EXCHANGE_COIN_HISTORY_BAD_SIGNATURE = 1251, - /** * The reserve history was requested with a bad signature. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -975,7 +883,6 @@ export enum TalerErrorCode { */ EXCHANGE_RESERVE_HISTORY_BAD_SIGNATURE = 1252, - /** * The exchange encountered melt fees exceeding the melted coin's contribution. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -983,7 +890,6 @@ export enum TalerErrorCode { */ EXCHANGE_MELT_FEES_EXCEED_CONTRIBUTION = 1302, - /** * The signature made with the coin to be melted is invalid. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -991,7 +897,6 @@ export enum TalerErrorCode { */ EXCHANGE_MELT_COIN_SIGNATURE_INVALID = 1303, - /** * The denomination of the given coin has past its expiration date and it is also not a valid zombie (that is, was not refreshed with the fresh coin being subjected to recoup). * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -999,7 +904,6 @@ export enum TalerErrorCode { */ EXCHANGE_MELT_COIN_EXPIRED_NO_ZOMBIE = 1305, - /** * The signature returned by the exchange in a melt request was malformed. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -1007,7 +911,6 @@ export enum TalerErrorCode { */ EXCHANGE_MELT_INVALID_SIGNATURE_BY_EXCHANGE = 1306, - /** * The provided transfer keys do not match up with the original commitment. Information about the original commitment is included in the response. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -1015,7 +918,6 @@ export enum TalerErrorCode { */ EXCHANGE_REFRESHES_REVEAL_COMMITMENT_VIOLATION = 1353, - /** * Failed to produce the blinded signatures over the coins to be returned. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -1023,7 +925,6 @@ export enum TalerErrorCode { */ EXCHANGE_REFRESHES_REVEAL_SIGNING_ERROR = 1354, - /** * The exchange is unaware of the refresh session specified in the request. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -1031,7 +932,6 @@ export enum TalerErrorCode { */ EXCHANGE_REFRESHES_REVEAL_SESSION_UNKNOWN = 1355, - /** * The size of the cut-and-choose dimension of the private transfer keys request does not match #TALER_CNC_KAPPA - 1. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -1039,7 +939,6 @@ export enum TalerErrorCode { */ EXCHANGE_REFRESHES_REVEAL_CNC_TRANSFER_ARRAY_SIZE_INVALID = 1356, - /** * The number of envelopes given does not match the number of denomination keys given. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -1047,7 +946,6 @@ export enum TalerErrorCode { */ EXCHANGE_REFRESHES_REVEAL_NEW_DENOMS_ARRAY_SIZE_MISMATCH = 1358, - /** * The exchange encountered a numeric overflow totaling up the cost for the refresh operation. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -1055,7 +953,6 @@ export enum TalerErrorCode { */ EXCHANGE_REFRESHES_REVEAL_COST_CALCULATION_OVERFLOW = 1359, - /** * The exchange's cost calculation shows that the melt amount is below the costs of the transaction. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -1063,7 +960,6 @@ export enum TalerErrorCode { */ EXCHANGE_REFRESHES_REVEAL_AMOUNT_INSUFFICIENT = 1360, - /** * The signature made with the coin over the link data is invalid. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -1071,7 +967,6 @@ export enum TalerErrorCode { */ EXCHANGE_REFRESHES_REVEAL_LINK_SIGNATURE_INVALID = 1361, - /** * The refresh session hash given to a /refreshes/ handler was malformed. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -1079,7 +974,6 @@ export enum TalerErrorCode { */ EXCHANGE_REFRESHES_REVEAL_INVALID_RCH = 1362, - /** * Operation specified invalid for this endpoint. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -1087,7 +981,6 @@ export enum TalerErrorCode { */ EXCHANGE_REFRESHES_REVEAL_OPERATION_INVALID = 1363, - /** * The client provided age commitment data, but age restriction is not supported on this server. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -1095,7 +988,6 @@ export enum TalerErrorCode { */ EXCHANGE_REFRESHES_REVEAL_AGE_RESTRICTION_NOT_SUPPORTED = 1364, - /** * The client provided invalid age commitment data: missing, not an array, or array of invalid size. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -1103,7 +995,6 @@ export enum TalerErrorCode { */ EXCHANGE_REFRESHES_REVEAL_AGE_RESTRICTION_COMMITMENT_INVALID = 1365, - /** * The coin specified in the link request is unknown to the exchange. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -1111,7 +1002,6 @@ export enum TalerErrorCode { */ EXCHANGE_LINK_COIN_UNKNOWN = 1400, - /** * The public key of given to a /transfers/ handler was malformed. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -1119,7 +1009,6 @@ export enum TalerErrorCode { */ EXCHANGE_TRANSFERS_GET_WTID_MALFORMED = 1450, - /** * The exchange did not find information about the specified wire transfer identifier in the database. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -1127,7 +1016,6 @@ export enum TalerErrorCode { */ EXCHANGE_TRANSFERS_GET_WTID_NOT_FOUND = 1451, - /** * The exchange did not find information about the wire transfer fees it charged. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -1135,7 +1023,6 @@ export enum TalerErrorCode { */ EXCHANGE_TRANSFERS_GET_WIRE_FEE_NOT_FOUND = 1452, - /** * The exchange found a wire fee that was above the total transfer value (and thus could not have been charged). * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -1143,7 +1030,6 @@ export enum TalerErrorCode { */ EXCHANGE_TRANSFERS_GET_WIRE_FEE_INCONSISTENT = 1453, - /** * The wait target of the URL was not in the set of expected values. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -1151,7 +1037,6 @@ export enum TalerErrorCode { */ EXCHANGE_PURSES_INVALID_WAIT_TARGET = 1475, - /** * The signature on the purse status returned by the exchange was invalid. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -1159,7 +1044,6 @@ export enum TalerErrorCode { */ EXCHANGE_PURSES_GET_INVALID_SIGNATURE_BY_EXCHANGE = 1476, - /** * The exchange knows literally nothing about the coin we were asked to refund. But without a transaction history, we cannot issue a refund. This is kind-of OK, the owner should just refresh it directly without executing the refund. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -1167,7 +1051,6 @@ export enum TalerErrorCode { */ EXCHANGE_REFUND_COIN_NOT_FOUND = 1500, - /** * We could not process the refund request as the coin's transaction history does not permit the requested refund because then refunds would exceed the deposit amount. The "history" in the response proves this. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -1175,7 +1058,6 @@ export enum TalerErrorCode { */ EXCHANGE_REFUND_CONFLICT_DEPOSIT_INSUFFICIENT = 1501, - /** * The exchange knows about the coin we were asked to refund, but not about the specific /deposit operation. Hence, we cannot issue a refund (as we do not know if this merchant public key is authorized to do a refund). * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -1183,7 +1065,6 @@ export enum TalerErrorCode { */ EXCHANGE_REFUND_DEPOSIT_NOT_FOUND = 1502, - /** * The exchange can no longer refund the customer/coin as the money was already transferred (paid out) to the merchant. (It should be past the refund deadline.) * Returned with an HTTP status code of #MHD_HTTP_GONE (410). @@ -1191,7 +1072,6 @@ export enum TalerErrorCode { */ EXCHANGE_REFUND_MERCHANT_ALREADY_PAID = 1503, - /** * The refund fee specified for the request is lower than the refund fee charged by the exchange for the given denomination key of the refunded coin. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -1199,7 +1079,6 @@ export enum TalerErrorCode { */ EXCHANGE_REFUND_FEE_TOO_LOW = 1504, - /** * The refunded amount is smaller than the refund fee, which would result in a negative refund. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -1207,7 +1086,6 @@ export enum TalerErrorCode { */ EXCHANGE_REFUND_FEE_ABOVE_AMOUNT = 1505, - /** * The signature of the merchant is invalid. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -1215,7 +1093,6 @@ export enum TalerErrorCode { */ EXCHANGE_REFUND_MERCHANT_SIGNATURE_INVALID = 1506, - /** * Merchant backend failed to create the refund confirmation signature. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -1223,7 +1100,6 @@ export enum TalerErrorCode { */ EXCHANGE_REFUND_MERCHANT_SIGNING_FAILED = 1507, - /** * The signature returned by the exchange in a refund request was malformed. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -1231,7 +1107,6 @@ export enum TalerErrorCode { */ EXCHANGE_REFUND_INVALID_SIGNATURE_BY_EXCHANGE = 1508, - /** * The failure proof returned by the exchange is incorrect. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -1239,7 +1114,6 @@ export enum TalerErrorCode { */ EXCHANGE_REFUND_INVALID_FAILURE_PROOF_BY_EXCHANGE = 1509, - /** * Conflicting refund granted before with different amount but same refund transaction ID. * Returned with an HTTP status code of #MHD_HTTP_FAILED_DEPENDENCY (424). @@ -1247,7 +1121,6 @@ export enum TalerErrorCode { */ EXCHANGE_REFUND_INCONSISTENT_AMOUNT = 1510, - /** * The given coin signature is invalid for the request. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -1255,7 +1128,6 @@ export enum TalerErrorCode { */ EXCHANGE_RECOUP_SIGNATURE_INVALID = 1550, - /** * The exchange could not find the corresponding withdraw operation. The request is denied. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -1263,7 +1135,6 @@ export enum TalerErrorCode { */ EXCHANGE_RECOUP_WITHDRAW_NOT_FOUND = 1551, - /** * The coin's remaining balance is zero. The request is denied. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -1271,7 +1142,6 @@ export enum TalerErrorCode { */ EXCHANGE_RECOUP_COIN_BALANCE_ZERO = 1552, - /** * The exchange failed to reproduce the coin's blinding. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -1279,7 +1149,6 @@ export enum TalerErrorCode { */ EXCHANGE_RECOUP_BLINDING_FAILED = 1553, - /** * The coin's remaining balance is zero. The request is denied. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -1287,7 +1156,6 @@ export enum TalerErrorCode { */ EXCHANGE_RECOUP_COIN_BALANCE_NEGATIVE = 1554, - /** * The coin's denomination has not been revoked yet. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -1295,7 +1163,6 @@ export enum TalerErrorCode { */ EXCHANGE_RECOUP_NOT_ELIGIBLE = 1555, - /** * The given coin signature is invalid for the request. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -1303,7 +1170,6 @@ export enum TalerErrorCode { */ EXCHANGE_RECOUP_REFRESH_SIGNATURE_INVALID = 1575, - /** * The exchange could not find the corresponding melt operation. The request is denied. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -1311,7 +1177,6 @@ export enum TalerErrorCode { */ EXCHANGE_RECOUP_REFRESH_MELT_NOT_FOUND = 1576, - /** * The exchange failed to reproduce the coin's blinding. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -1319,7 +1184,6 @@ export enum TalerErrorCode { */ EXCHANGE_RECOUP_REFRESH_BLINDING_FAILED = 1578, - /** * The coin's denomination has not been revoked yet. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -1327,7 +1191,6 @@ export enum TalerErrorCode { */ EXCHANGE_RECOUP_REFRESH_NOT_ELIGIBLE = 1580, - /** * This exchange does not allow clients to request /keys for times other than the current (exchange) time. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -1335,7 +1198,6 @@ export enum TalerErrorCode { */ EXCHANGE_KEYS_TIMETRAVEL_FORBIDDEN = 1600, - /** * A signature in the server's response was malformed. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -1343,7 +1205,6 @@ export enum TalerErrorCode { */ EXCHANGE_WIRE_SIGNATURE_INVALID = 1650, - /** * No bank accounts are enabled for the exchange. The administrator should enable-account using the taler-exchange-offline tool. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -1351,7 +1212,6 @@ export enum TalerErrorCode { */ EXCHANGE_WIRE_NO_ACCOUNTS_CONFIGURED = 1651, - /** * The payto:// URI stored in the exchange database for its bank account is malformed. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -1359,7 +1219,6 @@ export enum TalerErrorCode { */ EXCHANGE_WIRE_INVALID_PAYTO_CONFIGURED = 1652, - /** * No wire fees are configured for an enabled wire method of the exchange. The administrator must set the wire-fee using the taler-exchange-offline tool. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -1367,7 +1226,6 @@ export enum TalerErrorCode { */ EXCHANGE_WIRE_FEES_NOT_CONFIGURED = 1653, - /** * This purse was previously created with different meta data. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -1375,7 +1233,6 @@ export enum TalerErrorCode { */ EXCHANGE_RESERVES_PURSE_CREATE_CONFLICTING_META_DATA = 1675, - /** * This purse was previously merged with different meta data. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -1383,7 +1240,6 @@ export enum TalerErrorCode { */ EXCHANGE_RESERVES_PURSE_MERGE_CONFLICTING_META_DATA = 1676, - /** * The reserve has insufficient funds to create another purse. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -1391,7 +1247,6 @@ export enum TalerErrorCode { */ EXCHANGE_RESERVES_PURSE_CREATE_INSUFFICIENT_FUNDS = 1677, - /** * The purse fee specified for the request is lower than the purse fee charged by the exchange at this time. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -1399,7 +1254,6 @@ export enum TalerErrorCode { */ EXCHANGE_RESERVES_PURSE_FEE_TOO_LOW = 1678, - /** * The payment request cannot be deleted anymore, as it either already completed or timed out. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -1407,7 +1261,6 @@ export enum TalerErrorCode { */ EXCHANGE_PURSE_DELETE_ALREADY_DECIDED = 1679, - /** * The signature affirming the purse deletion is invalid. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -1415,7 +1268,6 @@ export enum TalerErrorCode { */ EXCHANGE_PURSE_DELETE_SIGNATURE_INVALID = 1680, - /** * Withdrawal from the reserve requires age restriction to be set. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -1423,7 +1275,6 @@ export enum TalerErrorCode { */ EXCHANGE_RESERVES_AGE_RESTRICTION_REQUIRED = 1681, - /** * The exchange failed to talk to the process responsible for its private denomination keys or the helpers had no denominations (properly) configured. * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502). @@ -1431,7 +1282,6 @@ export enum TalerErrorCode { */ EXCHANGE_DENOMINATION_HELPER_UNAVAILABLE = 1700, - /** * The response from the denomination key helper process was malformed. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -1439,7 +1289,6 @@ export enum TalerErrorCode { */ EXCHANGE_DENOMINATION_HELPER_BUG = 1701, - /** * The helper refuses to sign with the key, because it is too early: the validity period has not yet started. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -1447,7 +1296,6 @@ export enum TalerErrorCode { */ EXCHANGE_DENOMINATION_HELPER_TOO_EARLY = 1702, - /** * The signature of the exchange on the reply was invalid. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -1455,7 +1303,6 @@ export enum TalerErrorCode { */ EXCHANGE_PURSE_DEPOSIT_EXCHANGE_SIGNATURE_INVALID = 1725, - /** * The exchange failed to talk to the process responsible for its private signing keys. * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502). @@ -1463,7 +1310,6 @@ export enum TalerErrorCode { */ EXCHANGE_SIGNKEY_HELPER_UNAVAILABLE = 1750, - /** * The response from the online signing key helper process was malformed. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -1471,7 +1317,6 @@ export enum TalerErrorCode { */ EXCHANGE_SIGNKEY_HELPER_BUG = 1751, - /** * The helper refuses to sign with the key, because it is too early: the validity period has not yet started. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -1479,7 +1324,6 @@ export enum TalerErrorCode { */ EXCHANGE_SIGNKEY_HELPER_TOO_EARLY = 1752, - /** * The purse expiration time is in the past at the time of its creation. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -1487,7 +1331,6 @@ export enum TalerErrorCode { */ EXCHANGE_RESERVES_PURSE_EXPIRATION_BEFORE_NOW = 1775, - /** * The purse expiration time is set to never, which is not allowed. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -1495,7 +1338,6 @@ export enum TalerErrorCode { */ EXCHANGE_RESERVES_PURSE_EXPIRATION_IS_NEVER = 1776, - /** * The signature affirming the merge of the purse is invalid. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -1503,7 +1345,6 @@ export enum TalerErrorCode { */ EXCHANGE_RESERVES_PURSE_MERGE_SIGNATURE_INVALID = 1777, - /** * The signature by the reserve affirming the merge is invalid. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -1511,7 +1352,6 @@ export enum TalerErrorCode { */ EXCHANGE_RESERVES_RESERVE_MERGE_SIGNATURE_INVALID = 1778, - /** * The signature by the reserve affirming the open operation is invalid. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -1519,7 +1359,6 @@ export enum TalerErrorCode { */ EXCHANGE_RESERVES_OPEN_BAD_SIGNATURE = 1785, - /** * The signature by the reserve affirming the close operation is invalid. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -1527,7 +1366,6 @@ export enum TalerErrorCode { */ EXCHANGE_RESERVES_CLOSE_BAD_SIGNATURE = 1786, - /** * The signature by the reserve affirming the attestion request is invalid. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -1535,7 +1373,6 @@ export enum TalerErrorCode { */ EXCHANGE_RESERVES_ATTEST_BAD_SIGNATURE = 1787, - /** * The exchange does not know an origin account to which the remaining reserve balance could be wired to, and the wallet failed to provide one. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -1543,7 +1380,6 @@ export enum TalerErrorCode { */ EXCHANGE_RESERVES_CLOSE_NO_TARGET_ACCOUNT = 1788, - /** * The reserve balance is insufficient to pay for the open operation. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -1551,7 +1387,6 @@ export enum TalerErrorCode { */ EXCHANGE_RESERVES_OPEN_INSUFFICIENT_FUNDS = 1789, - /** * The auditor that was supposed to be disabled is unknown to this exchange. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -1559,7 +1394,6 @@ export enum TalerErrorCode { */ EXCHANGE_MANAGEMENT_AUDITOR_NOT_FOUND = 1800, - /** * The exchange has a more recently signed conflicting instruction and is thus refusing the current change (replay detected). * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -1567,7 +1401,6 @@ export enum TalerErrorCode { */ EXCHANGE_MANAGEMENT_AUDITOR_MORE_RECENT_PRESENT = 1801, - /** * The signature to add or enable the auditor does not validate. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -1575,7 +1408,6 @@ export enum TalerErrorCode { */ EXCHANGE_MANAGEMENT_AUDITOR_ADD_SIGNATURE_INVALID = 1802, - /** * The signature to disable the auditor does not validate. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -1583,7 +1415,6 @@ export enum TalerErrorCode { */ EXCHANGE_MANAGEMENT_AUDITOR_DEL_SIGNATURE_INVALID = 1803, - /** * The signature to revoke the denomination does not validate. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -1591,7 +1422,6 @@ export enum TalerErrorCode { */ EXCHANGE_MANAGEMENT_DENOMINATION_REVOKE_SIGNATURE_INVALID = 1804, - /** * The signature to revoke the online signing key does not validate. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -1599,7 +1429,6 @@ export enum TalerErrorCode { */ EXCHANGE_MANAGEMENT_SIGNKEY_REVOKE_SIGNATURE_INVALID = 1805, - /** * The exchange has a more recently signed conflicting instruction and is thus refusing the current change (replay detected). * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -1607,7 +1436,6 @@ export enum TalerErrorCode { */ EXCHANGE_MANAGEMENT_WIRE_MORE_RECENT_PRESENT = 1806, - /** * The signingkey specified is unknown to the exchange. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -1615,7 +1443,6 @@ export enum TalerErrorCode { */ EXCHANGE_MANAGEMENT_KEYS_SIGNKEY_UNKNOWN = 1807, - /** * The signature to publish wire account does not validate. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -1623,7 +1450,6 @@ export enum TalerErrorCode { */ EXCHANGE_MANAGEMENT_WIRE_DETAILS_SIGNATURE_INVALID = 1808, - /** * The signature to add the wire account does not validate. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -1631,7 +1457,6 @@ export enum TalerErrorCode { */ EXCHANGE_MANAGEMENT_WIRE_ADD_SIGNATURE_INVALID = 1809, - /** * The signature to disable the wire account does not validate. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -1639,7 +1464,6 @@ export enum TalerErrorCode { */ EXCHANGE_MANAGEMENT_WIRE_DEL_SIGNATURE_INVALID = 1810, - /** * The wire account to be disabled is unknown to the exchange. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -1647,7 +1471,6 @@ export enum TalerErrorCode { */ EXCHANGE_MANAGEMENT_WIRE_NOT_FOUND = 1811, - /** * The signature to affirm wire fees does not validate. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -1655,7 +1478,6 @@ export enum TalerErrorCode { */ EXCHANGE_MANAGEMENT_WIRE_FEE_SIGNATURE_INVALID = 1812, - /** * The signature conflicts with a previous signature affirming different fees. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -1663,7 +1485,6 @@ export enum TalerErrorCode { */ EXCHANGE_MANAGEMENT_WIRE_FEE_MISMATCH = 1813, - /** * The signature affirming the denomination key is invalid. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -1671,7 +1492,6 @@ export enum TalerErrorCode { */ EXCHANGE_MANAGEMENT_KEYS_DENOMKEY_ADD_SIGNATURE_INVALID = 1814, - /** * The signature affirming the signing key is invalid. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -1679,7 +1499,6 @@ export enum TalerErrorCode { */ EXCHANGE_MANAGEMENT_KEYS_SIGNKEY_ADD_SIGNATURE_INVALID = 1815, - /** * The signature conflicts with a previous signature affirming different fees. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -1687,7 +1506,6 @@ export enum TalerErrorCode { */ EXCHANGE_MANAGEMENT_GLOBAL_FEE_MISMATCH = 1816, - /** * The signature affirming the fee structure is invalid. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -1695,7 +1513,6 @@ export enum TalerErrorCode { */ EXCHANGE_MANAGEMENT_GLOBAL_FEE_SIGNATURE_INVALID = 1817, - /** * The signature affirming the profit drain is invalid. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -1703,7 +1520,6 @@ export enum TalerErrorCode { */ EXCHANGE_MANAGEMENT_DRAIN_PROFITS_SIGNATURE_INVALID = 1818, - /** * The signature affirming the AML decision is invalid. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -1711,7 +1527,6 @@ export enum TalerErrorCode { */ EXCHANGE_AML_DECISION_ADD_SIGNATURE_INVALID = 1825, - /** * The AML officer specified is not allowed to make AML decisions right now. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -1719,7 +1534,6 @@ export enum TalerErrorCode { */ EXCHANGE_AML_DECISION_INVALID_OFFICER = 1826, - /** * There is a more recent AML decision on file. The decision was rejected as timestamps of AML decisions must be monotonically increasing. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -1727,7 +1541,6 @@ export enum TalerErrorCode { */ EXCHANGE_AML_DECISION_MORE_RECENT_PRESENT = 1827, - /** * There AML decision would impose an AML check of a type that is not provided by any KYC provider known to the exchange. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -1735,7 +1548,6 @@ export enum TalerErrorCode { */ EXCHANGE_AML_DECISION_UNKNOWN_CHECK = 1828, - /** * The signature affirming the change in the AML officer status is invalid. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -1743,7 +1555,6 @@ export enum TalerErrorCode { */ EXCHANGE_MANAGEMENT_UPDATE_AML_OFFICER_SIGNATURE_INVALID = 1830, - /** * A more recent decision about the AML officer status is known to the exchange. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -1751,7 +1562,6 @@ export enum TalerErrorCode { */ EXCHANGE_MANAGEMENT_AML_OFFICERS_MORE_RECENT_PRESENT = 1831, - /** * The purse was previously created with different meta data. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -1759,7 +1569,6 @@ export enum TalerErrorCode { */ EXCHANGE_PURSE_CREATE_CONFLICTING_META_DATA = 1850, - /** * The purse was previously created with a different contract. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -1767,7 +1576,6 @@ export enum TalerErrorCode { */ EXCHANGE_PURSE_CREATE_CONFLICTING_CONTRACT_STORED = 1851, - /** * A coin signature for a deposit into the purse is invalid. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -1775,7 +1583,6 @@ export enum TalerErrorCode { */ EXCHANGE_PURSE_CREATE_COIN_SIGNATURE_INVALID = 1852, - /** * The purse expiration time is in the past. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -1783,7 +1590,6 @@ export enum TalerErrorCode { */ EXCHANGE_PURSE_CREATE_EXPIRATION_BEFORE_NOW = 1853, - /** * The purse expiration time is "never". * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -1791,7 +1597,6 @@ export enum TalerErrorCode { */ EXCHANGE_PURSE_CREATE_EXPIRATION_IS_NEVER = 1854, - /** * The purse signature over the purse meta data is invalid. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -1799,7 +1604,6 @@ export enum TalerErrorCode { */ EXCHANGE_PURSE_CREATE_SIGNATURE_INVALID = 1855, - /** * The signature over the encrypted contract is invalid. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -1807,7 +1611,6 @@ export enum TalerErrorCode { */ EXCHANGE_PURSE_ECONTRACT_SIGNATURE_INVALID = 1856, - /** * The signature from the exchange over the confirmation is invalid. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -1815,7 +1618,6 @@ export enum TalerErrorCode { */ EXCHANGE_PURSE_CREATE_EXCHANGE_SIGNATURE_INVALID = 1857, - /** * The coin was previously deposited with different meta data. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -1823,7 +1625,6 @@ export enum TalerErrorCode { */ EXCHANGE_PURSE_DEPOSIT_CONFLICTING_META_DATA = 1858, - /** * The encrypted contract was previously uploaded with different meta data. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -1831,7 +1632,6 @@ export enum TalerErrorCode { */ EXCHANGE_PURSE_ECONTRACT_CONFLICTING_META_DATA = 1859, - /** * The deposited amount is less than the purse fee. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -1839,7 +1639,6 @@ export enum TalerErrorCode { */ EXCHANGE_CREATE_PURSE_NEGATIVE_VALUE_AFTER_FEE = 1860, - /** * The signature using the merge key is invalid. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -1847,7 +1646,6 @@ export enum TalerErrorCode { */ EXCHANGE_PURSE_MERGE_INVALID_MERGE_SIGNATURE = 1876, - /** * The signature using the reserve key is invalid. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -1855,7 +1653,6 @@ export enum TalerErrorCode { */ EXCHANGE_PURSE_MERGE_INVALID_RESERVE_SIGNATURE = 1877, - /** * The targeted purse is not yet full and thus cannot be merged. Retrying the request later may succeed. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -1863,7 +1660,6 @@ export enum TalerErrorCode { */ EXCHANGE_PURSE_NOT_FULL = 1878, - /** * The signature from the exchange over the confirmation is invalid. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -1871,7 +1667,6 @@ export enum TalerErrorCode { */ EXCHANGE_PURSE_MERGE_EXCHANGE_SIGNATURE_INVALID = 1879, - /** * The exchange of the target account is not a partner of this exchange. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -1879,7 +1674,6 @@ export enum TalerErrorCode { */ EXCHANGE_MERGE_PURSE_PARTNER_UNKNOWN = 1880, - /** * The signature affirming the new partner is invalid. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -1887,7 +1681,6 @@ export enum TalerErrorCode { */ EXCHANGE_MANAGEMENT_ADD_PARTNER_SIGNATURE_INVALID = 1890, - /** * Conflicting data for the partner already exists with the exchange. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -1895,7 +1688,6 @@ export enum TalerErrorCode { */ EXCHANGE_MANAGEMENT_ADD_PARTNER_DATA_CONFLICT = 1891, - /** * The auditor signature over the denomination meta data is invalid. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -1903,7 +1695,6 @@ export enum TalerErrorCode { */ EXCHANGE_AUDITORS_AUDITOR_SIGNATURE_INVALID = 1900, - /** * The auditor that was specified is unknown to this exchange. * Returned with an HTTP status code of #MHD_HTTP_PRECONDITION_FAILED (412). @@ -1911,7 +1702,6 @@ export enum TalerErrorCode { */ EXCHANGE_AUDITORS_AUDITOR_UNKNOWN = 1901, - /** * The auditor that was specified is no longer used by this exchange. * Returned with an HTTP status code of #MHD_HTTP_GONE (410). @@ -1919,6 +1709,47 @@ export enum TalerErrorCode { */ EXCHANGE_AUDITORS_AUDITOR_INACTIVE = 1902, + /** + * The KYC info access token is not recognized. Hence the request was denied. + * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). + * (A value of 0 indicates that the error is generated client-side). + */ + EXCHANGE_KYC_INFO_AUTHORIZATION_FAILED = 1919, + + /** + * The exchange got stuck in a long series of (likely recursive) KYC rules without user-inputs that did not result in a timely conclusion. This is a configuration failure. Please contact the administrator. + * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). + * (A value of 0 indicates that the error is generated client-side). + */ + EXCHANGE_KYC_RECURSIVE_RULE_DETECTED = 1920, + + /** + * The submitted KYC data lacks an attribute that is required by the KYC form. Please submit the complete form. + * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). + * (A value of 0 indicates that the error is generated client-side). + */ + EXCHANGE_KYC_AML_FORM_INCOMPLETE = 1921, + + /** + * The request requires an AML program which is no longer configured at the exchange. Contact the exchange operator to address the configuration issue. + * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). + * (A value of 0 indicates that the error is generated client-side). + */ + EXCHANGE_KYC_GENERIC_AML_PROGRAM_GONE = 1922, + + /** + * The given check is not of type 'form' and thus using this handler for form submission is incorrect. + * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). + * (A value of 0 indicates that the error is generated client-side). + */ + EXCHANGE_KYC_NOT_A_FORM = 1923, + + /** + * The request requires a check which is no longer configured at the exchange. Contact the exchange operator to address the configuration issue. + * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). + * (A value of 0 indicates that the error is generated client-side). + */ + EXCHANGE_KYC_GENERIC_CHECK_GONE = 1924, /** * The signature affirming the wallet's KYC request was invalid. @@ -1927,7 +1758,6 @@ export enum TalerErrorCode { */ EXCHANGE_KYC_WALLET_SIGNATURE_INVALID = 1925, - /** * The exchange received an unexpected malformed response from its KYC backend. * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502). @@ -1935,7 +1765,6 @@ export enum TalerErrorCode { */ EXCHANGE_KYC_PROOF_BACKEND_INVALID_RESPONSE = 1926, - /** * The backend signaled an unexpected failure. * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502). @@ -1943,7 +1772,6 @@ export enum TalerErrorCode { */ EXCHANGE_KYC_PROOF_BACKEND_ERROR = 1927, - /** * The backend signaled an authorization failure. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -1951,7 +1779,6 @@ export enum TalerErrorCode { */ EXCHANGE_KYC_PROOF_BACKEND_AUTHORIZATION_FAILED = 1928, - /** * The exchange is unaware of having made an the authorization request. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -1959,7 +1786,6 @@ export enum TalerErrorCode { */ EXCHANGE_KYC_PROOF_REQUEST_UNKNOWN = 1929, - /** * The KYC authorization signature was invalid. Hence the request was denied. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -1967,7 +1793,6 @@ export enum TalerErrorCode { */ EXCHANGE_KYC_CHECK_AUTHORIZATION_FAILED = 1930, - /** * The request used a logic specifier that is not known to the exchange. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -1975,7 +1800,6 @@ export enum TalerErrorCode { */ EXCHANGE_KYC_GENERIC_LOGIC_UNKNOWN = 1931, - /** * The request requires a logic which is no longer configured at the exchange. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -1983,7 +1807,6 @@ export enum TalerErrorCode { */ EXCHANGE_KYC_GENERIC_LOGIC_GONE = 1932, - /** * The logic plugin had a bug in its interaction with the KYC provider. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -1991,7 +1814,6 @@ export enum TalerErrorCode { */ EXCHANGE_KYC_GENERIC_LOGIC_BUG = 1933, - /** * The exchange could not process the request with its KYC provider because the provider refused access to the service. This indicates some configuration issue at the Taler exchange operator. * Returned with an HTTP status code of #MHD_HTTP_NETWORK_AUTHENTICATION_REQUIRED (511). @@ -1999,7 +1821,6 @@ export enum TalerErrorCode { */ EXCHANGE_KYC_GENERIC_PROVIDER_ACCESS_REFUSED = 1934, - /** * There was a timeout in the interaction between the exchange and the KYC provider. The most likely cause is some networking problem. Trying again later might succeed. * Returned with an HTTP status code of #MHD_HTTP_GATEWAY_TIMEOUT (504). @@ -2007,7 +1828,6 @@ export enum TalerErrorCode { */ EXCHANGE_KYC_GENERIC_PROVIDER_TIMEOUT = 1935, - /** * The KYC provider responded with a status that was completely unexpected by the KYC logic of the exchange. * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502). @@ -2015,7 +1835,6 @@ export enum TalerErrorCode { */ EXCHANGE_KYC_GENERIC_PROVIDER_UNEXPECTED_REPLY = 1936, - /** * The rate limit of the exchange at the KYC provider has been exceeded. Trying much later might work. * Returned with an HTTP status code of #MHD_HTTP_SERVICE_UNAVAILABLE (503). @@ -2023,7 +1842,6 @@ export enum TalerErrorCode { */ EXCHANGE_KYC_GENERIC_PROVIDER_RATE_LIMIT_EXCEEDED = 1937, - /** * The request to the webhook lacked proper authorization or authentication data. * Returned with an HTTP status code of #MHD_HTTP_UNAUTHORIZED (401). @@ -2031,15 +1849,13 @@ export enum TalerErrorCode { */ EXCHANGE_KYC_WEBHOOK_UNAUTHORIZED = 1938, - /** - * The exchange is unaware of the given requirement row. + * The exchange is unaware of the requested payto URI with respect to the KYC status. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). * (A value of 0 indicates that the error is generated client-side). */ EXCHANGE_KYC_CHECK_REQUEST_UNKNOWN = 1939, - /** * The exchange has no account public key to check the KYC authorization signature against. Hence the request was denied. The user should do a wire transfer to the exchange with the KYC authorization key in the subject. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -2047,7 +1863,6 @@ export enum TalerErrorCode { */ EXCHANGE_KYC_CHECK_AUTHORIZATION_KEY_UNKNOWN = 1940, - /** * The form has been previously uploaded, and may only be filed once. The user should be redirected to their main KYC page and see if any other steps need to be taken. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -2055,7 +1870,6 @@ export enum TalerErrorCode { */ EXCHANGE_KYC_FORM_ALREADY_UPLOADED = 1941, - /** * The internal state of the exchange specifying KYC measures is malformed. Please contact technical support. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -2063,7 +1877,6 @@ export enum TalerErrorCode { */ EXCHANGE_KYC_MEASURES_MALFORMED = 1942, - /** * The specified index does not refer to a valid KYC measure. Please check the URL. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -2071,7 +1884,6 @@ export enum TalerErrorCode { */ EXCHANGE_KYC_MEASURE_INDEX_INVALID = 1943, - /** * The operation is not supported by the selected KYC logic. This is either caused by a configuration change or some invalid use of the API. Please contact technical support. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -2079,6 +1891,40 @@ export enum TalerErrorCode { */ EXCHANGE_KYC_INVALID_LOGIC_TO_CHECK = 1944, + /** + * The AML program failed. This is either caused by a configuration change or a bug. Please contact technical support. + * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). + * (A value of 0 indicates that the error is generated client-side). + */ + EXCHANGE_KYC_AML_PROGRAM_FAILURE = 1945, + + /** + * The AML program returned a malformed result. This is a bug. Please contact technical support. + * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). + * (A value of 0 indicates that the error is generated client-side). + */ + EXCHANGE_KYC_AML_PROGRAM_MALFORMED_RESULT = 1946, + + /** + * The response from the KYC provider lacked required attributes. Please contact technical support. + * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502). + * (A value of 0 indicates that the error is generated client-side). + */ + EXCHANGE_KYC_GENERIC_PROVIDER_INCOMPLETE_REPLY = 1947, + + /** + * The context of the KYC check lacked required fields. This is a bug. Please contact technical support. + * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). + * (A value of 0 indicates that the error is generated client-side). + */ + EXCHANGE_KYC_GENERIC_PROVIDER_INCOMPLETE_CONTEXT = 1948, + + /** + * The logic plugin had a bug in its AML processing. This is a bug. Please contact technical support. + * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). + * (A value of 0 indicates that the error is generated client-side). + */ + EXCHANGE_KYC_GENERIC_AML_LOGIC_BUG = 1949, /** * The exchange does not know a contract under the given contract public key. @@ -2087,7 +1933,6 @@ export enum TalerErrorCode { */ EXCHANGE_CONTRACTS_UNKNOWN = 1950, - /** * The URL does not encode a valid exchange public key in its path. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -2095,7 +1940,6 @@ export enum TalerErrorCode { */ EXCHANGE_CONTRACTS_INVALID_CONTRACT_PUB = 1951, - /** * The returned encrypted contract did not decrypt. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -2103,7 +1947,6 @@ export enum TalerErrorCode { */ EXCHANGE_CONTRACTS_DECRYPTION_FAILED = 1952, - /** * The signature on the encrypted contract did not validate. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -2111,7 +1954,6 @@ export enum TalerErrorCode { */ EXCHANGE_CONTRACTS_SIGNATURE_INVALID = 1953, - /** * The decrypted contract was malformed. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -2119,7 +1961,6 @@ export enum TalerErrorCode { */ EXCHANGE_CONTRACTS_DECODING_FAILED = 1954, - /** * A coin signature for a deposit into the purse is invalid. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -2127,7 +1968,6 @@ export enum TalerErrorCode { */ EXCHANGE_PURSE_DEPOSIT_COIN_SIGNATURE_INVALID = 1975, - /** * It is too late to deposit coins into the purse. * Returned with an HTTP status code of #MHD_HTTP_GONE (410). @@ -2135,6 +1975,12 @@ export enum TalerErrorCode { */ EXCHANGE_PURSE_DEPOSIT_DECIDED_ALREADY = 1976, + /** + * The exchange is currently processing the KYC status and is not able to return a response yet. + * Returned with an HTTP status code of #MHD_HTTP_ACCEPTED (202). + * (A value of 0 indicates that the error is generated client-side). + */ + EXCHANGE_KYC_INFO_BUSY = 1977, /** * TOTP key is not valid. @@ -2143,7 +1989,6 @@ export enum TalerErrorCode { */ EXCHANGE_TOTP_KEY_INVALID = 1980, - /** * The backend could not find the merchant instance specified in the request. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -2151,7 +1996,6 @@ export enum TalerErrorCode { */ MERCHANT_GENERIC_INSTANCE_UNKNOWN = 2000, - /** * The start and end-times in the wire fee structure leave a hole. This is not allowed. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -2159,7 +2003,6 @@ export enum TalerErrorCode { */ MERCHANT_GENERIC_HOLE_IN_WIRE_FEE_STRUCTURE = 2001, - /** * The merchant was unable to obtain a valid answer to /wire from the exchange. * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502). @@ -2167,7 +2010,6 @@ export enum TalerErrorCode { */ MERCHANT_GENERIC_EXCHANGE_WIRE_REQUEST_FAILED = 2002, - /** * The product category is not known to the backend. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -2175,7 +2017,6 @@ export enum TalerErrorCode { */ MERCHANT_GENERIC_CATEGORY_UNKNOWN = 2003, - /** * The proposal is not known to the backend. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -2183,7 +2024,6 @@ export enum TalerErrorCode { */ MERCHANT_GENERIC_ORDER_UNKNOWN = 2005, - /** * The order provided to the backend could not be completed, because a product to be completed via inventory data is not actually in our inventory. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -2191,7 +2031,6 @@ export enum TalerErrorCode { */ MERCHANT_GENERIC_PRODUCT_UNKNOWN = 2006, - /** * The reward ID is unknown. This could happen if the reward has expired. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -2199,7 +2038,6 @@ export enum TalerErrorCode { */ MERCHANT_GENERIC_REWARD_ID_UNKNOWN = 2007, - /** * The contract obtained from the merchant backend was malformed. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -2207,7 +2045,6 @@ export enum TalerErrorCode { */ MERCHANT_GENERIC_DB_CONTRACT_CONTENT_INVALID = 2008, - /** * The order we found does not match the provided contract hash. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -2215,7 +2052,6 @@ export enum TalerErrorCode { */ MERCHANT_GENERIC_CONTRACT_HASH_DOES_NOT_MATCH_ORDER = 2009, - /** * The exchange failed to provide a valid response to the merchant's /keys request. * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502). @@ -2223,7 +2059,6 @@ export enum TalerErrorCode { */ MERCHANT_GENERIC_EXCHANGE_KEYS_FAILURE = 2010, - /** * The exchange failed to respond to the merchant on time. * Returned with an HTTP status code of #MHD_HTTP_GATEWAY_TIMEOUT (504). @@ -2231,7 +2066,6 @@ export enum TalerErrorCode { */ MERCHANT_GENERIC_EXCHANGE_TIMEOUT = 2011, - /** * The merchant failed to talk to the exchange. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -2239,7 +2073,6 @@ export enum TalerErrorCode { */ MERCHANT_GENERIC_EXCHANGE_CONNECT_FAILURE = 2012, - /** * The exchange returned a maformed response. * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502). @@ -2247,7 +2080,6 @@ export enum TalerErrorCode { */ MERCHANT_GENERIC_EXCHANGE_REPLY_MALFORMED = 2013, - /** * The exchange returned an unexpected response status. * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502). @@ -2255,7 +2087,6 @@ export enum TalerErrorCode { */ MERCHANT_GENERIC_EXCHANGE_UNEXPECTED_STATUS = 2014, - /** * The merchant refused the request due to lack of authorization. * Returned with an HTTP status code of #MHD_HTTP_UNAUTHORIZED (401). @@ -2263,7 +2094,6 @@ export enum TalerErrorCode { */ MERCHANT_GENERIC_UNAUTHORIZED = 2015, - /** * The merchant instance specified in the request was deleted. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -2271,7 +2101,6 @@ export enum TalerErrorCode { */ MERCHANT_GENERIC_INSTANCE_DELETED = 2016, - /** * The backend could not find the inbound wire transfer specified in the request. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -2279,7 +2108,6 @@ export enum TalerErrorCode { */ MERCHANT_GENERIC_TRANSFER_UNKNOWN = 2017, - /** * The backend could not find the template(id) because it is not exist. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -2287,7 +2115,6 @@ export enum TalerErrorCode { */ MERCHANT_GENERIC_TEMPLATE_UNKNOWN = 2018, - /** * The backend could not find the webhook(id) because it is not exist. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -2295,7 +2122,6 @@ export enum TalerErrorCode { */ MERCHANT_GENERIC_WEBHOOK_UNKNOWN = 2019, - /** * The backend could not find the webhook(serial) because it is not exist. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -2303,7 +2129,6 @@ export enum TalerErrorCode { */ MERCHANT_GENERIC_PENDING_WEBHOOK_UNKNOWN = 2020, - /** * The backend could not find the OTP device(id) because it is not exist. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -2311,7 +2136,6 @@ export enum TalerErrorCode { */ MERCHANT_GENERIC_OTP_DEVICE_UNKNOWN = 2021, - /** * The account is not known to the backend. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -2319,7 +2143,6 @@ export enum TalerErrorCode { */ MERCHANT_GENERIC_ACCOUNT_UNKNOWN = 2022, - /** * The wire hash was malformed. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -2327,7 +2150,6 @@ export enum TalerErrorCode { */ MERCHANT_GENERIC_H_WIRE_MALFORMED = 2023, - /** * The currency specified in the operation does not work with the current state of the given resource. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -2335,6 +2157,12 @@ export enum TalerErrorCode { */ MERCHANT_GENERIC_CURRENCY_MISMATCH = 2024, + /** + * The exchange specified in the operation is not trusted by this exchange. The client should limit its operation to exchanges enabled by the merchant, or ask the merchant to enable additional exchanges in the configuration. + * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). + * (A value of 0 indicates that the error is generated client-side). + */ + MERCHANT_GENERIC_EXCHANGE_UNTRUSTED = 2025, /** * The exchange failed to provide a valid answer to the tracking request, thus those details are not in the response. @@ -2343,7 +2171,6 @@ export enum TalerErrorCode { */ MERCHANT_GET_ORDERS_EXCHANGE_TRACKING_FAILURE = 2100, - /** * The merchant backend failed to construct the request for tracking to the exchange, thus tracking details are not in the response. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -2351,7 +2178,6 @@ export enum TalerErrorCode { */ MERCHANT_GET_ORDERS_ID_EXCHANGE_REQUEST_FAILURE = 2103, - /** * The merchant backend failed trying to contact the exchange for tracking details, thus those details are not in the response. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -2359,7 +2185,6 @@ export enum TalerErrorCode { */ MERCHANT_GET_ORDERS_ID_EXCHANGE_LOOKUP_START_FAILURE = 2104, - /** * The claim token used to authenticate the client is invalid for this order. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -2367,7 +2192,6 @@ export enum TalerErrorCode { */ MERCHANT_GET_ORDERS_ID_INVALID_TOKEN = 2105, - /** * The contract terms hash used to authenticate the client is invalid for this order. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -2375,7 +2199,6 @@ export enum TalerErrorCode { */ MERCHANT_GET_ORDERS_ID_INVALID_CONTRACT_HASH = 2106, - /** * The exchange responded saying that funds were insufficient (for example, due to double-spending). * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -2383,7 +2206,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_ORDERS_ID_PAY_INSUFFICIENT_FUNDS = 2150, - /** * The denomination key used for payment is not listed among the denomination keys of the exchange. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -2391,7 +2213,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_ORDERS_ID_PAY_DENOMINATION_KEY_NOT_FOUND = 2151, - /** * The denomination key used for payment is not audited by an auditor approved by the merchant. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -2399,7 +2220,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_ORDERS_ID_PAY_DENOMINATION_KEY_AUDITOR_FAILURE = 2152, - /** * There was an integer overflow totaling up the amounts or deposit fees in the payment. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -2407,7 +2227,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_ORDERS_ID_PAY_AMOUNT_OVERFLOW = 2153, - /** * The deposit fees exceed the total value of the payment. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -2415,7 +2234,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_ORDERS_ID_PAY_FEES_EXCEED_PAYMENT = 2154, - /** * After considering deposit and wire fees, the payment is insufficient to satisfy the required amount for the contract. The client should revisit the logic used to calculate fees it must cover. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -2423,7 +2241,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_ORDERS_ID_PAY_INSUFFICIENT_DUE_TO_FEES = 2155, - /** * Even if we do not consider deposit and wire fees, the payment is insufficient to satisfy the required amount for the contract. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -2431,7 +2248,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_ORDERS_ID_PAY_PAYMENT_INSUFFICIENT = 2156, - /** * The signature over the contract of one of the coins was invalid. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -2439,7 +2255,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_ORDERS_ID_PAY_COIN_SIGNATURE_INVALID = 2157, - /** * When we tried to find information about the exchange to issue the deposit, we failed. This usually only happens if the merchant backend is somehow unable to get its own HTTP client logic to work. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -2447,7 +2262,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_ORDERS_ID_PAY_EXCHANGE_LOOKUP_FAILED = 2158, - /** * The refund deadline in the contract is after the transfer deadline. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -2455,7 +2269,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_ORDERS_ID_PAY_REFUND_DEADLINE_PAST_WIRE_TRANSFER_DEADLINE = 2159, - /** * The order was already paid (maybe by another wallet). * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -2463,7 +2276,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_ORDERS_ID_PAY_ALREADY_PAID = 2160, - /** * The payment is too late, the offer has expired. * Returned with an HTTP status code of #MHD_HTTP_GONE (410). @@ -2471,7 +2283,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_ORDERS_ID_PAY_OFFER_EXPIRED = 2161, - /** * The "merchant" field is missing in the proposal data. This is an internal error as the proposal is from the merchant's own database at this point. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -2479,7 +2290,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_ORDERS_ID_PAY_MERCHANT_FIELD_MISSING = 2162, - /** * Failed to locate merchant's account information matching the wire hash given in the proposal. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -2487,7 +2297,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_ORDERS_ID_PAY_WIRE_HASH_UNKNOWN = 2163, - /** * The deposit time for the denomination has expired. * Returned with an HTTP status code of #MHD_HTTP_GONE (410). @@ -2495,7 +2304,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_ORDERS_ID_PAY_DENOMINATION_DEPOSIT_EXPIRED = 2165, - /** * The exchange of the deposited coin charges a wire fee that could not be added to the total (total amount too high). * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -2503,7 +2311,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_ORDERS_ID_PAY_EXCHANGE_WIRE_FEE_ADDITION_FAILED = 2166, - /** * The contract was not fully paid because of refunds. Note that clients MAY treat this as paid if, for example, contracts must be executed despite of refunds. * Returned with an HTTP status code of #MHD_HTTP_PAYMENT_REQUIRED (402). @@ -2511,7 +2318,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_ORDERS_ID_PAY_REFUNDED = 2167, - /** * According to our database, we have refunded more than we were paid (which should not be possible). * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -2519,7 +2325,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_ORDERS_ID_PAY_REFUNDS_EXCEED_PAYMENTS = 2168, - /** * Legacy stuff. Remove me with protocol v1. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -2527,7 +2332,6 @@ export enum TalerErrorCode { */ DEAD_QQQ_PAY_MERCHANT_POST_ORDERS_ID_ABORT_REFUND_REFUSED_PAYMENT_COMPLETE = 2169, - /** * The payment failed at the exchange. * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502). @@ -2535,7 +2339,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_ORDERS_ID_PAY_EXCHANGE_FAILED = 2170, - /** * The payment required a minimum age but one of the coins (of a denomination with support for age restriction) did not provide any age_commitment. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -2543,7 +2346,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_ORDERS_ID_PAY_AGE_COMMITMENT_MISSING = 2171, - /** * The payment required a minimum age but one of the coins provided an age_commitment that contained a wrong number of public keys compared to the number of age groups defined in the denomination of the coin. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -2551,7 +2353,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_ORDERS_ID_PAY_AGE_COMMITMENT_SIZE_MISMATCH = 2172, - /** * The payment required a minimum age but one of the coins provided a minimum_age_sig that couldn't be verified with the given age_commitment for that particular minimum age. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -2559,7 +2360,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_ORDERS_ID_PAY_AGE_VERIFICATION_FAILED = 2173, - /** * The payment required no minimum age but one of the coins (of a denomination with support for age restriction) did not provide the required h_age_commitment. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -2567,7 +2367,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_ORDERS_ID_PAY_AGE_COMMITMENT_HASH_MISSING = 2174, - /** * The exchange does not support the selected bank account of the merchant. Likely the merchant had stale data on the bank accounts of the exchange and thus selected an inappropriate exchange when making the offer. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -2575,7 +2374,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_ORDERS_ID_PAY_WIRE_METHOD_UNSUPPORTED = 2175, - /** * The payment requires the wallet to select a choice from the choices array and pass it in the 'choice_index' field of the request. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -2583,7 +2381,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_ORDERS_ID_PAY_CHOICE_INDEX_MISSING = 2176, - /** * The 'choice_index' field is invalid. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -2591,7 +2388,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_ORDERS_ID_PAY_CHOICE_INDEX_OUT_OF_BOUNDS = 2177, - /** * The provided 'tokens' array does not match with the required input tokens of the order. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -2599,7 +2395,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_ORDERS_ID_PAY_INPUT_TOKENS_MISMATCH = 2178, - /** * Invalid token issue signature (blindly signed by merchant) for provided token. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -2607,7 +2402,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_ORDERS_ID_PAY_TOKEN_ISSUE_SIG_INVALID = 2179, - /** * Invalid token use signature (EdDSA, signed by wallet) for provided token. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -2615,7 +2409,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_ORDERS_ID_PAY_TOKEN_USE_SIG_INVALID = 2180, - /** * The provided number of tokens does not match the required number. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -2623,7 +2416,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_ORDERS_ID_PAY_TOKEN_COUNT_MISMATCH = 2181, - /** * The provided number of token envelopes does not match the specified number. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -2631,7 +2423,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_ORDERS_ID_PAY_TOKEN_ENVELOPE_COUNT_MISMATCH = 2182, - /** * Invalid token because it was already used, is expired or not yet valid. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -2639,6 +2430,12 @@ export enum TalerErrorCode { */ MERCHANT_POST_ORDERS_ID_PAY_TOKEN_INVALID = 2183, + /** + * The payment violates a transaction limit configured at the given exchange. The wallet has a bug in that it failed to check exchange limits during coin selection. Please report the bug to your wallet developer. + * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). + * (A value of 0 indicates that the error is generated client-side). + */ + MERCHANT_POST_ORDERS_ID_PAY_EXCHANGE_TRANSACTION_LIMIT_VIOLATION = 2184, /** * The contract hash does not match the given order ID. @@ -2647,7 +2444,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_ORDERS_ID_PAID_CONTRACT_HASH_MISMATCH = 2200, - /** * The signature of the merchant is not valid for the given contract hash. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -2655,7 +2451,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_ORDERS_ID_PAID_COIN_SIGNATURE_INVALID = 2201, - /** * A token family with this ID but conflicting data exists. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -2663,7 +2458,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_TOKEN_FAMILY_CONFLICT = 2225, - /** * The backend is unaware of a token family with the given ID. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -2671,7 +2465,6 @@ export enum TalerErrorCode { */ MERCHANT_PATCH_TOKEN_FAMILY_NOT_FOUND = 2226, - /** * The merchant failed to send the exchange the refund request. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -2679,7 +2472,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_ORDERS_ID_ABORT_EXCHANGE_REFUND_FAILED = 2251, - /** * The merchant failed to find the exchange to process the lookup. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -2687,7 +2479,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_ORDERS_ID_ABORT_EXCHANGE_LOOKUP_FAILED = 2252, - /** * The merchant could not find the contract. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -2695,7 +2486,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_ORDERS_ID_ABORT_CONTRACT_NOT_FOUND = 2253, - /** * The payment was already completed and thus cannot be aborted anymore. * Returned with an HTTP status code of #MHD_HTTP_PRECONDITION_FAILED (412). @@ -2703,7 +2493,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_ORDERS_ID_ABORT_REFUND_REFUSED_PAYMENT_COMPLETE = 2254, - /** * The hash provided by the wallet does not match the order. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -2711,7 +2500,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_ORDERS_ID_ABORT_CONTRACT_HASH_MISSMATCH = 2255, - /** * The array of coins cannot be empty. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -2719,7 +2507,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_ORDERS_ID_ABORT_COINS_ARRAY_EMPTY = 2256, - /** * We are waiting for the exchange to provide us with key material before checking the wire transfer. * Returned with an HTTP status code of #MHD_HTTP_ACCEPTED (202). @@ -2727,7 +2514,6 @@ export enum TalerErrorCode { */ MERCHANT_EXCHANGE_TRANSFERS_AWAITING_KEYS = 2258, - /** * We are waiting for the exchange to provide us with the list of aggregated transactions. * Returned with an HTTP status code of #MHD_HTTP_ACCEPTED (202). @@ -2735,7 +2521,6 @@ export enum TalerErrorCode { */ MERCHANT_EXCHANGE_TRANSFERS_AWAITING_LIST = 2259, - /** * The endpoint indicated in the wire transfer does not belong to a GNU Taler exchange. * Returned with an HTTP status code of #MHD_HTTP_OK (200). @@ -2743,7 +2528,6 @@ export enum TalerErrorCode { */ MERCHANT_EXCHANGE_TRANSFERS_FATAL_NO_EXCHANGE = 2260, - /** * The exchange indicated in the wire transfer claims to know nothing about the wire transfer. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -2751,7 +2535,6 @@ export enum TalerErrorCode { */ MERCHANT_EXCHANGE_TRANSFERS_FATAL_NOT_FOUND = 2261, - /** * The interaction with the exchange is delayed due to rate limiting. * Returned with an HTTP status code of #MHD_HTTP_ACCEPTED (202). @@ -2759,7 +2542,6 @@ export enum TalerErrorCode { */ MERCHANT_EXCHANGE_TRANSFERS_RATE_LIMITED = 2262, - /** * We experienced a transient failure in our interaction with the exchange. * Returned with an HTTP status code of #MHD_HTTP_ACCEPTED (202). @@ -2767,7 +2549,6 @@ export enum TalerErrorCode { */ MERCHANT_EXCHANGE_TRANSFERS_TRANSIENT_FAILURE = 2263, - /** * The response from the exchange was unacceptable and should be reviewed with an auditor. * Returned with an HTTP status code of #MHD_HTTP_OK (200). @@ -2775,7 +2556,6 @@ export enum TalerErrorCode { */ MERCHANT_EXCHANGE_TRANSFERS_HARD_FAILURE = 2264, - /** * We could not claim the order because the backend is unaware of it. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -2783,7 +2563,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_ORDERS_ID_CLAIM_NOT_FOUND = 2300, - /** * We could not claim the order because someone else claimed it first. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -2791,7 +2570,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_ORDERS_ID_CLAIM_ALREADY_CLAIMED = 2301, - /** * The client-side experienced an internal failure. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -2799,7 +2577,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_ORDERS_ID_CLAIM_CLIENT_INTERNAL_FAILURE = 2302, - /** * The backend failed to sign the refund request. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -2807,7 +2584,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_ORDERS_ID_REFUND_SIGNATURE_FAILED = 2350, - /** * The client failed to unblind the signature returned by the merchant. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -2815,7 +2591,6 @@ export enum TalerErrorCode { */ MERCHANT_REWARD_PICKUP_UNBLIND_FAILURE = 2400, - /** * The exchange returned a failure code for the withdraw operation. * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502). @@ -2823,7 +2598,6 @@ export enum TalerErrorCode { */ MERCHANT_REWARD_PICKUP_EXCHANGE_ERROR = 2403, - /** * The merchant failed to add up the amounts to compute the pick up value. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -2831,7 +2605,6 @@ export enum TalerErrorCode { */ MERCHANT_REWARD_PICKUP_SUMMATION_FAILED = 2404, - /** * The reward expired. * Returned with an HTTP status code of #MHD_HTTP_GONE (410). @@ -2839,7 +2612,6 @@ export enum TalerErrorCode { */ MERCHANT_REWARD_PICKUP_HAS_EXPIRED = 2405, - /** * The requested withdraw amount exceeds the amount remaining to be picked up. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -2847,7 +2619,6 @@ export enum TalerErrorCode { */ MERCHANT_REWARD_PICKUP_AMOUNT_EXCEEDS_REWARD_REMAINING = 2406, - /** * The merchant did not find the specified denomination key in the exchange's key set. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -2855,7 +2626,6 @@ export enum TalerErrorCode { */ MERCHANT_REWARD_PICKUP_DENOMINATION_UNKNOWN = 2407, - /** * The merchant instance has no active bank accounts configured. However, at least one bank account must be available to create new orders. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -2863,7 +2633,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_POST_ORDERS_INSTANCE_CONFIGURATION_LACKS_WIRE = 2500, - /** * The proposal had no timestamp and the merchant backend failed to obtain the current local time. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -2871,7 +2640,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_POST_ORDERS_NO_LOCALTIME = 2501, - /** * The order provided to the backend could not be parsed; likely some required fields were missing or ill-formed. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -2879,7 +2647,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_POST_ORDERS_PROPOSAL_PARSE_ERROR = 2502, - /** * A conflicting order (sharing the same order identifier) already exists at this merchant backend instance. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -2887,7 +2654,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_POST_ORDERS_ALREADY_EXISTS = 2503, - /** * The order creation request is invalid because the given wire deadline is before the refund deadline. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -2895,7 +2661,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_POST_ORDERS_REFUND_AFTER_WIRE_DEADLINE = 2504, - /** * The order creation request is invalid because the delivery date given is in the past. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -2903,7 +2668,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_POST_ORDERS_DELIVERY_DATE_IN_PAST = 2505, - /** * The order creation request is invalid because a wire deadline of "never" is not allowed. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -2911,7 +2675,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_POST_ORDERS_WIRE_DEADLINE_IS_NEVER = 2506, - /** * The order creation request is invalid because the given payment deadline is in the past. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -2919,7 +2682,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_POST_ORDERS_PAY_DEADLINE_IN_PAST = 2507, - /** * The order creation request is invalid because the given refund deadline is in the past. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -2927,7 +2689,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_POST_ORDERS_REFUND_DEADLINE_IN_PAST = 2508, - /** * The backend does not trust any exchange that would allow funds to be wired to any bank account of this instance using the wire method specified with the order. Note that right now, we do not support the use of exchange bank accounts with mandatory currency conversion. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -2935,7 +2696,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_POST_ORDERS_NO_EXCHANGES_FOR_WIRE_METHOD = 2509, - /** * One of the paths to forget is malformed. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -2943,7 +2703,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_PATCH_ORDERS_ID_FORGET_PATH_SYNTAX_INCORRECT = 2510, - /** * One of the paths to forget was not marked as forgettable. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -2951,6 +2710,19 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_PATCH_ORDERS_ID_FORGET_PATH_NOT_FORGETTABLE = 2511, + /** + * The refund amount would violate a refund transaction limit configured at the given exchange. Please find another way to refund the customer, and inquire with your legislator why they make strange banking regulations. + * Returned with an HTTP status code of #MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS (451). + * (A value of 0 indicates that the error is generated client-side). + */ + MERCHANT_POST_ORDERS_ID_REFUND_EXCHANGE_TRANSACTION_LIMIT_VIOLATION = 2512, + + /** + * The total order amount exceeds hard legal transaction limits from the available exchanges, thus a customer could never legally make this payment. You may try to increase your limits by passing legitimization checks with exchange operators. You could also inquire with your legislator why the limits are prohibitively low for your business. + * Returned with an HTTP status code of #MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS (451). + * (A value of 0 indicates that the error is generated client-side). + */ + MERCHANT_PRIVATE_POST_ORDERS_AMOUNT_EXCEEDS_LEGAL_LIMITS = 2513, /** * The order provided to the backend could not be deleted, our offer is still valid and awaiting payment. Deletion may work later after the offer has expired if it remains unpaid. @@ -2959,7 +2731,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_DELETE_ORDERS_AWAITING_PAYMENT = 2520, - /** * The order provided to the backend could not be deleted as the order was already paid. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -2967,7 +2738,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_DELETE_ORDERS_ALREADY_PAID = 2521, - /** * The amount to be refunded is inconsistent: either is lower than the previous amount being awarded, or it exceeds the original price paid by the customer. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -2975,7 +2745,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_POST_ORDERS_ID_REFUND_INCONSISTENT_AMOUNT = 2530, - /** * Only paid orders can be refunded, and the frontend specified an unpaid order to issue a refund for. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -2983,7 +2752,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_POST_ORDERS_ID_REFUND_ORDER_UNPAID = 2531, - /** * The refund delay was set to 0 and thus no refunds are ever allowed for this order. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -2991,7 +2759,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_POST_ORDERS_ID_REFUND_NOT_ALLOWED_BY_CONTRACT = 2532, - /** * The token family slug provided in this order could not be found in the merchant database. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -2999,7 +2766,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_POST_ORDERS_TOKEN_FAMILY_SLUG_UNKNOWN = 2533, - /** * A token family referenced in this order is either expired or not valid yet. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3007,7 +2773,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_POST_ORDERS_TOKEN_FAMILY_NOT_VALID = 2534, - /** * The exchange says it does not know this transfer. * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502). @@ -3015,7 +2780,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_POST_TRANSFERS_EXCHANGE_UNKNOWN = 2550, - /** * We internally failed to execute the /track/transfer request. * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502). @@ -3023,7 +2787,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_POST_TRANSFERS_REQUEST_ERROR = 2551, - /** * The amount transferred differs between what was submitted and what the exchange claimed. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3031,7 +2794,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_POST_TRANSFERS_CONFLICTING_TRANSFERS = 2552, - /** * The exchange gave conflicting information about a coin which has been wire transferred. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3039,7 +2801,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_POST_TRANSFERS_CONFLICTING_REPORTS = 2553, - /** * The exchange charged a different wire fee than what it originally advertised, and it is higher. * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502). @@ -3047,7 +2808,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_POST_TRANSFERS_BAD_WIRE_FEE = 2554, - /** * We did not find the account that the transfer was made to. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -3055,7 +2815,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_POST_TRANSFERS_ACCOUNT_NOT_FOUND = 2555, - /** * The backend could not delete the transfer as the echange already replied to our inquiry about it and we have integrated the result. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3063,7 +2822,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_DELETE_TRANSFERS_ALREADY_CONFIRMED = 2556, - /** * The backend was previously informed about a wire transfer with the same ID but a different amount. Multiple wire transfers with the same ID are not allowed. If the new amount is correct, the old transfer should first be deleted. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3071,7 +2829,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_POST_TRANSFERS_CONFLICTING_SUBMISSION = 2557, - /** * The amount transferred differs between what was submitted and what the exchange claimed. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -3079,7 +2836,6 @@ export enum TalerErrorCode { */ MERCHANT_EXCHANGE_TRANSFERS_CONFLICTING_TRANSFERS = 2563, - /** * The merchant backend cannot create an instance under the given identifier as one already exists. Use PATCH to modify the existing entry. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3087,7 +2843,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_POST_INSTANCES_ALREADY_EXISTS = 2600, - /** * The merchant backend cannot create an instance because the authentication configuration field is malformed. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -3095,7 +2850,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_POST_INSTANCES_BAD_AUTH = 2601, - /** * The merchant backend cannot update an instance's authentication settings because the provided authentication settings are malformed. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -3103,7 +2857,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_POST_INSTANCE_AUTH_BAD_AUTH = 2602, - /** * The merchant backend cannot create an instance under the given identifier, the previous one was deleted but must be purged first. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3111,7 +2864,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_POST_INSTANCES_PURGE_REQUIRED = 2603, - /** * The merchant backend cannot update an instance under the given identifier, the previous one was deleted but must be purged first. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3119,7 +2871,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_PATCH_INSTANCES_PURGE_REQUIRED = 2625, - /** * The bank account referenced in the requested operation was not found. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -3127,7 +2878,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_ACCOUNT_DELETE_UNKNOWN_ACCOUNT = 2626, - /** * The bank account specified in the request already exists at the merchant. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3135,7 +2885,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_ACCOUNT_EXISTS = 2627, - /** * The product ID exists. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3143,7 +2892,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_POST_PRODUCTS_CONFLICT_PRODUCT_EXISTS = 2650, - /** * A category with the same name exists already. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3151,7 +2899,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_POST_CATEGORIES_CONFLICT_CATEGORY_EXISTS = 2651, - /** * The update would have reduced the total amount of product lost, which is not allowed. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3159,7 +2906,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_PATCH_PRODUCTS_TOTAL_LOST_REDUCED = 2660, - /** * The update would have mean that more stocks were lost than what remains from total inventory after sales, which is not allowed. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -3167,7 +2913,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_PATCH_PRODUCTS_TOTAL_LOST_EXCEEDS_STOCKS = 2661, - /** * The update would have reduced the total amount of product in stock, which is not allowed. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3175,7 +2920,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_PATCH_PRODUCTS_TOTAL_STOCKED_REDUCED = 2662, - /** * The update would have reduced the total amount of product sold, which is not allowed. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3183,7 +2927,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_PATCH_PRODUCTS_TOTAL_SOLD_REDUCED = 2663, - /** * The lock request is for more products than we have left (unlocked) in stock. * Returned with an HTTP status code of #MHD_HTTP_GONE (410). @@ -3191,7 +2934,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_POST_PRODUCTS_LOCK_INSUFFICIENT_STOCKS = 2670, - /** * The deletion request is for a product that is locked. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3199,7 +2941,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_DELETE_PRODUCTS_CONFLICTING_LOCK = 2680, - /** * The requested wire method is not supported by the exchange. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3207,7 +2948,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_POST_RESERVES_UNSUPPORTED_WIRE_METHOD = 2700, - /** * The requested exchange does not allow rewards. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3215,7 +2955,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_POST_RESERVES_REWARDS_NOT_ALLOWED = 2701, - /** * The reserve could not be deleted because it is unknown. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -3223,7 +2962,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_DELETE_RESERVES_NO_SUCH_RESERVE = 2710, - /** * The reserve that was used to fund the rewards has expired. * Returned with an HTTP status code of #MHD_HTTP_GONE (410). @@ -3231,7 +2969,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_POST_REWARD_AUTHORIZE_RESERVE_EXPIRED = 2750, - /** * The reserve that was used to fund the rewards was not found in the DB. * Returned with an HTTP status code of #MHD_HTTP_SERVICE_UNAVAILABLE (503). @@ -3239,7 +2976,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_POST_REWARD_AUTHORIZE_RESERVE_UNKNOWN = 2751, - /** * The backend knows the instance that was supposed to support the reward, and it was configured for rewardping. However, the funds remaining are insufficient to cover the reward, and the merchant should top up the reserve. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -3247,7 +2983,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_POST_REWARD_AUTHORIZE_INSUFFICIENT_FUNDS = 2752, - /** * The backend failed to find a reserve needed to authorize the reward. * Returned with an HTTP status code of #MHD_HTTP_SERVICE_UNAVAILABLE (503). @@ -3255,7 +2990,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_POST_REWARD_AUTHORIZE_RESERVE_NOT_FOUND = 2753, - /** * The merchant backend encountered a failure in computing the deposit total. * Returned with an HTTP status code of #MHD_HTTP_OK (200). @@ -3263,7 +2997,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_GET_ORDERS_ID_AMOUNT_ARITHMETIC_FAILURE = 2800, - /** * The template ID already exists. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3271,7 +3004,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_POST_TEMPLATES_CONFLICT_TEMPLATE_EXISTS = 2850, - /** * The OTP device ID already exists. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3279,7 +3011,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_POST_OTP_DEVICES_CONFLICT_OTP_DEVICE_EXISTS = 2851, - /** * Amount given in the using template and in the template contract. There is a conflict. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3287,7 +3018,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_USING_TEMPLATES_AMOUNT_CONFLICT_TEMPLATES_CONTRACT_AMOUNT = 2860, - /** * Subject given in the using template and in the template contract. There is a conflict. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3295,7 +3025,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_USING_TEMPLATES_SUMMARY_CONFLICT_TEMPLATES_CONTRACT_SUBJECT = 2861, - /** * Amount not given in the using template and in the template contract. There is a conflict. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3303,7 +3032,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_USING_TEMPLATES_NO_AMOUNT = 2862, - /** * Subject not given in the using template and in the template contract. There is a conflict. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3311,7 +3039,6 @@ export enum TalerErrorCode { */ MERCHANT_POST_USING_TEMPLATES_NO_SUMMARY = 2863, - /** * The webhook ID elready exists. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3319,7 +3046,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_POST_WEBHOOKS_CONFLICT_WEBHOOK_EXISTS = 2900, - /** * The webhook serial elready exists. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3327,7 +3053,6 @@ export enum TalerErrorCode { */ MERCHANT_PRIVATE_POST_PENDING_WEBHOOKS_CONFLICT_PENDING_WEBHOOK_EXISTS = 2910, - /** * The auditor refused the connection due to a lack of authorization. * Returned with an HTTP status code of #MHD_HTTP_UNAUTHORIZED (401). @@ -3335,7 +3060,6 @@ export enum TalerErrorCode { */ AUDITOR_GENERIC_UNAUTHORIZED = 3001, - /** * This method is not allowed here. * Returned with an HTTP status code of #MHD_HTTP_METHOD_NOT_ALLOWED (405). @@ -3343,7 +3067,6 @@ export enum TalerErrorCode { */ AUDITOR_GENERIC_METHOD_NOT_ALLOWED = 3002, - /** * The signature from the exchange on the deposit confirmation is invalid. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -3351,7 +3074,6 @@ export enum TalerErrorCode { */ AUDITOR_DEPOSIT_CONFIRMATION_SIGNATURE_INVALID = 3100, - /** * The exchange key used for the signature on the deposit confirmation was revoked. * Returned with an HTTP status code of #MHD_HTTP_GONE (410). @@ -3359,7 +3081,6 @@ export enum TalerErrorCode { */ AUDITOR_EXCHANGE_SIGNING_KEY_REVOKED = 3101, - /** * The requested resource could not be found. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -3367,7 +3088,6 @@ export enum TalerErrorCode { */ AUDITOR_RESOURCE_NOT_FOUND = 3102, - /** * The URI is missing a path component. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -3375,7 +3095,6 @@ export enum TalerErrorCode { */ AUDITOR_URI_MISSING_PATH_COMPONENT = 3103, - /** * Wire transfer attempted with credit and debit party being the same bank account. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -3383,7 +3102,6 @@ export enum TalerErrorCode { */ BANK_SAME_ACCOUNT = 5101, - /** * Wire transfer impossible, due to financial limitation of the party that attempted the payment. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3391,7 +3109,6 @@ export enum TalerErrorCode { */ BANK_UNALLOWED_DEBIT = 5102, - /** * Negative numbers are not allowed (as value and/or fraction) to instantiate an amount object. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -3399,7 +3116,6 @@ export enum TalerErrorCode { */ BANK_NEGATIVE_NUMBER_AMOUNT = 5103, - /** * A too big number was used (as value and/or fraction) to instantiate an amount object. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -3407,7 +3123,6 @@ export enum TalerErrorCode { */ BANK_NUMBER_TOO_BIG = 5104, - /** * The bank account referenced in the requested operation was not found. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -3415,7 +3130,6 @@ export enum TalerErrorCode { */ BANK_UNKNOWN_ACCOUNT = 5106, - /** * The transaction referenced in the requested operation (typically a reject operation), was not found. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -3423,7 +3137,6 @@ export enum TalerErrorCode { */ BANK_TRANSACTION_NOT_FOUND = 5107, - /** * Bank received a malformed amount string. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -3431,7 +3144,6 @@ export enum TalerErrorCode { */ BANK_BAD_FORMAT_AMOUNT = 5108, - /** * The client does not own the account credited by the transaction which is to be rejected, so it has no rights do reject it. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -3439,7 +3151,6 @@ export enum TalerErrorCode { */ BANK_REJECT_NO_RIGHTS = 5109, - /** * This error code is returned when no known exception types captured the exception. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -3447,7 +3158,6 @@ export enum TalerErrorCode { */ BANK_UNMANAGED_EXCEPTION = 5110, - /** * This error code is used for all those exceptions that do not really need a specific error code to return to the client. Used for example when a client is trying to register with a unavailable username. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -3455,7 +3165,6 @@ export enum TalerErrorCode { */ BANK_SOFT_EXCEPTION = 5111, - /** * The request UID for a request to transfer funds has already been used, but with different details for the transfer. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3463,7 +3172,6 @@ export enum TalerErrorCode { */ BANK_TRANSFER_REQUEST_UID_REUSED = 5112, - /** * The withdrawal operation already has a reserve selected. The current request conflicts with the existing selection. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3471,7 +3179,6 @@ export enum TalerErrorCode { */ BANK_WITHDRAWAL_OPERATION_RESERVE_SELECTION_CONFLICT = 5113, - /** * The wire transfer subject duplicates an existing reserve public key. But wire transfer subjects must be unique. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3479,7 +3186,6 @@ export enum TalerErrorCode { */ BANK_DUPLICATE_RESERVE_PUB_SUBJECT = 5114, - /** * The client requested a transaction that is so far in the past, that it has been forgotten by the bank. * Returned with an HTTP status code of #MHD_HTTP_GONE (410). @@ -3487,7 +3193,6 @@ export enum TalerErrorCode { */ BANK_ANCIENT_TRANSACTION_GONE = 5115, - /** * The client attempted to abort a transaction that was already confirmed. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3495,7 +3200,6 @@ export enum TalerErrorCode { */ BANK_ABORT_CONFIRM_CONFLICT = 5116, - /** * The client attempted to confirm a transaction that was already aborted. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3503,7 +3207,6 @@ export enum TalerErrorCode { */ BANK_CONFIRM_ABORT_CONFLICT = 5117, - /** * The client attempted to register an account with the same name. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3511,7 +3214,6 @@ export enum TalerErrorCode { */ BANK_REGISTER_CONFLICT = 5118, - /** * The client attempted to confirm a withdrawal operation before the wallet posted the required details. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -3519,7 +3221,6 @@ export enum TalerErrorCode { */ BANK_POST_WITHDRAWAL_OPERATION_REQUIRED = 5119, - /** * The client tried to register a new account under a reserved username (like 'admin' for example). * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3527,7 +3228,6 @@ export enum TalerErrorCode { */ BANK_RESERVED_USERNAME_CONFLICT = 5120, - /** * The client tried to register a new account with an username already in use. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3535,7 +3235,6 @@ export enum TalerErrorCode { */ BANK_REGISTER_USERNAME_REUSE = 5121, - /** * The client tried to register a new account with a payto:// URI already in use. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3543,7 +3242,6 @@ export enum TalerErrorCode { */ BANK_REGISTER_PAYTO_URI_REUSE = 5122, - /** * The client tried to delete an account with a non null balance. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3551,7 +3249,6 @@ export enum TalerErrorCode { */ BANK_ACCOUNT_BALANCE_NOT_ZERO = 5123, - /** * The client tried to create a transaction or an operation that credit an unknown account. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3559,7 +3256,6 @@ export enum TalerErrorCode { */ BANK_UNKNOWN_CREDITOR = 5124, - /** * The client tried to create a transaction or an operation that debit an unknown account. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3567,7 +3263,6 @@ export enum TalerErrorCode { */ BANK_UNKNOWN_DEBTOR = 5125, - /** * The client tried to perform an action prohibited for exchange accounts. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3575,7 +3270,6 @@ export enum TalerErrorCode { */ BANK_ACCOUNT_IS_EXCHANGE = 5126, - /** * The client tried to perform an action reserved for exchange accounts. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3583,7 +3277,6 @@ export enum TalerErrorCode { */ BANK_ACCOUNT_IS_NOT_EXCHANGE = 5127, - /** * Received currency conversion is wrong. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3591,7 +3284,6 @@ export enum TalerErrorCode { */ BANK_BAD_CONVERSION = 5128, - /** * The account referenced in this operation is missing tan info for the chosen channel. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3599,7 +3291,6 @@ export enum TalerErrorCode { */ BANK_MISSING_TAN_INFO = 5129, - /** * The client attempted to confirm a transaction with incomplete info. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3607,7 +3298,6 @@ export enum TalerErrorCode { */ BANK_CONFIRM_INCOMPLETE = 5130, - /** * The request rate is too high. The server is refusing requests to guard against brute-force attacks. * Returned with an HTTP status code of #MHD_HTTP_TOO_MANY_REQUESTS (429). @@ -3615,7 +3305,6 @@ export enum TalerErrorCode { */ BANK_TAN_RATE_LIMITED = 5131, - /** * This TAN channel is not supported. * Returned with an HTTP status code of #MHD_HTTP_NOT_IMPLEMENTED (501). @@ -3623,7 +3312,6 @@ export enum TalerErrorCode { */ BANK_TAN_CHANNEL_NOT_SUPPORTED = 5132, - /** * Failed to send TAN using the helper script. Either script is not found, or script timeout, or script terminated with a non-successful result. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -3631,7 +3319,6 @@ export enum TalerErrorCode { */ BANK_TAN_CHANNEL_SCRIPT_FAILED = 5133, - /** * The client's response to the challenge was invalid. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -3639,7 +3326,6 @@ export enum TalerErrorCode { */ BANK_TAN_CHALLENGE_FAILED = 5134, - /** * A non-admin user has tried to change their legal name. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3647,7 +3333,6 @@ export enum TalerErrorCode { */ BANK_NON_ADMIN_PATCH_LEGAL_NAME = 5135, - /** * A non-admin user has tried to change their debt limit. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3655,7 +3340,6 @@ export enum TalerErrorCode { */ BANK_NON_ADMIN_PATCH_DEBT_LIMIT = 5136, - /** * A non-admin user has tried to change their password whihout providing the current one. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3663,7 +3347,6 @@ export enum TalerErrorCode { */ BANK_NON_ADMIN_PATCH_MISSING_OLD_PASSWORD = 5137, - /** * Provided old password does not match current password. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3671,7 +3354,6 @@ export enum TalerErrorCode { */ BANK_PATCH_BAD_OLD_PASSWORD = 5138, - /** * An admin user has tried to become an exchange. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3679,7 +3361,6 @@ export enum TalerErrorCode { */ BANK_PATCH_ADMIN_EXCHANGE = 5139, - /** * A non-admin user has tried to change their cashout account. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3687,7 +3368,6 @@ export enum TalerErrorCode { */ BANK_NON_ADMIN_PATCH_CASHOUT = 5140, - /** * A non-admin user has tried to change their contact info. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3695,7 +3375,6 @@ export enum TalerErrorCode { */ BANK_NON_ADMIN_PATCH_CONTACT = 5141, - /** * The client tried to create a transaction that credit the admin account. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3703,7 +3382,6 @@ export enum TalerErrorCode { */ BANK_ADMIN_CREDITOR = 5142, - /** * The referenced challenge was not found. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -3711,7 +3389,6 @@ export enum TalerErrorCode { */ BANK_CHALLENGE_NOT_FOUND = 5143, - /** * The referenced challenge has expired. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3719,7 +3396,6 @@ export enum TalerErrorCode { */ BANK_TAN_CHALLENGE_EXPIRED = 5144, - /** * A non-admin user has tried to create an account with 2fa. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3727,7 +3403,6 @@ export enum TalerErrorCode { */ BANK_NON_ADMIN_SET_TAN_CHANNEL = 5145, - /** * A non-admin user has tried to set their minimum cashout amount. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3735,7 +3410,6 @@ export enum TalerErrorCode { */ BANK_NON_ADMIN_SET_MIN_CASHOUT = 5146, - /** * Amount of currency conversion it less than the minimum allowed. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3743,7 +3417,6 @@ export enum TalerErrorCode { */ BANK_CONVERSION_AMOUNT_TO_SMALL = 5147, - /** * Specified amount will not work for this withdrawal. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3751,7 +3424,6 @@ export enum TalerErrorCode { */ BANK_AMOUNT_DIFFERS = 5148, - /** * The backend requires an amount to be specified. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -3759,6 +3431,19 @@ export enum TalerErrorCode { */ BANK_AMOUNT_REQUIRED = 5149, + /** + * Provided password is too short. + * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). + * (A value of 0 indicates that the error is generated client-side). + */ + BANK_PASSWORD_TOO_SHORT = 5150, + + /** + * Provided password is too long. + * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). + * (A value of 0 indicates that the error is generated client-side). + */ + BANK_PASSWORD_TOO_LONG = 5151, /** * The sync service failed find the account in its database. @@ -3767,7 +3452,6 @@ export enum TalerErrorCode { */ SYNC_ACCOUNT_UNKNOWN = 6100, - /** * The SHA-512 hash provided in the If-None-Match header is malformed. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -3775,7 +3459,6 @@ export enum TalerErrorCode { */ SYNC_BAD_IF_NONE_MATCH = 6101, - /** * The SHA-512 hash provided in the If-Match header is malformed or missing. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -3783,7 +3466,6 @@ export enum TalerErrorCode { */ SYNC_BAD_IF_MATCH = 6102, - /** * The signature provided in the "Sync-Signature" header is malformed or missing. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -3791,7 +3473,6 @@ export enum TalerErrorCode { */ SYNC_BAD_SYNC_SIGNATURE = 6103, - /** * The signature provided in the "Sync-Signature" header does not match the account, old or new Etags. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -3799,7 +3480,6 @@ export enum TalerErrorCode { */ SYNC_INVALID_SIGNATURE = 6104, - /** * The "Content-length" field for the upload is not a number. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -3807,7 +3487,6 @@ export enum TalerErrorCode { */ SYNC_MALFORMED_CONTENT_LENGTH = 6105, - /** * The "Content-length" field for the upload is too big based on the server's terms of service. * Returned with an HTTP status code of #MHD_HTTP_CONTENT_TOO_LARGE (413). @@ -3815,7 +3494,6 @@ export enum TalerErrorCode { */ SYNC_EXCESSIVE_CONTENT_LENGTH = 6106, - /** * The server is out of memory to handle the upload. Trying again later may succeed. * Returned with an HTTP status code of #MHD_HTTP_CONTENT_TOO_LARGE (413). @@ -3823,7 +3501,6 @@ export enum TalerErrorCode { */ SYNC_OUT_OF_MEMORY_ON_CONTENT_LENGTH = 6107, - /** * The uploaded data does not match the Etag. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -3831,7 +3508,6 @@ export enum TalerErrorCode { */ SYNC_INVALID_UPLOAD = 6108, - /** * HTTP server experienced a timeout while awaiting promised payment. * Returned with an HTTP status code of #MHD_HTTP_REQUEST_TIMEOUT (408). @@ -3839,7 +3515,6 @@ export enum TalerErrorCode { */ SYNC_PAYMENT_GENERIC_TIMEOUT = 6109, - /** * Sync could not setup the payment request with its own backend. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -3847,7 +3522,6 @@ export enum TalerErrorCode { */ SYNC_PAYMENT_CREATE_BACKEND_ERROR = 6110, - /** * The sync service failed find the backup to be updated in its database. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -3855,7 +3529,6 @@ export enum TalerErrorCode { */ SYNC_PREVIOUS_BACKUP_UNKNOWN = 6111, - /** * The "Content-length" field for the upload is missing. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -3863,7 +3536,6 @@ export enum TalerErrorCode { */ SYNC_MISSING_CONTENT_LENGTH = 6112, - /** * Sync had problems communicating with its payment backend. * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502). @@ -3871,7 +3543,6 @@ export enum TalerErrorCode { */ SYNC_GENERIC_BACKEND_ERROR = 6113, - /** * Sync experienced a timeout communicating with its payment backend. * Returned with an HTTP status code of #MHD_HTTP_GATEWAY_TIMEOUT (504). @@ -3879,7 +3550,6 @@ export enum TalerErrorCode { */ SYNC_GENERIC_BACKEND_TIMEOUT = 6114, - /** * The wallet does not implement a version of the exchange protocol that is compatible with the protocol version of the exchange. * Returned with an HTTP status code of #MHD_HTTP_NOT_IMPLEMENTED (501). @@ -3887,7 +3557,6 @@ export enum TalerErrorCode { */ WALLET_EXCHANGE_PROTOCOL_VERSION_INCOMPATIBLE = 7000, - /** * The wallet encountered an unexpected exception. This is likely a bug in the wallet implementation. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -3895,7 +3564,6 @@ export enum TalerErrorCode { */ WALLET_UNEXPECTED_EXCEPTION = 7001, - /** * The wallet received a response from a server, but the response can't be parsed. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -3903,7 +3571,6 @@ export enum TalerErrorCode { */ WALLET_RECEIVED_MALFORMED_RESPONSE = 7002, - /** * The wallet tried to make a network request, but it received no response. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -3911,7 +3578,6 @@ export enum TalerErrorCode { */ WALLET_NETWORK_ERROR = 7003, - /** * The wallet tried to make a network request, but it was throttled. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -3919,7 +3585,6 @@ export enum TalerErrorCode { */ WALLET_HTTP_REQUEST_THROTTLED = 7004, - /** * The wallet made a request to a service, but received an error response it does not know how to handle. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -3927,7 +3592,6 @@ export enum TalerErrorCode { */ WALLET_UNEXPECTED_REQUEST_ERROR = 7005, - /** * The denominations offered by the exchange are insufficient. Likely the exchange is badly configured or not maintained. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -3935,7 +3599,6 @@ export enum TalerErrorCode { */ WALLET_EXCHANGE_DENOMINATIONS_INSUFFICIENT = 7006, - /** * The wallet does not support the operation requested by a client. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -3943,7 +3606,6 @@ export enum TalerErrorCode { */ WALLET_CORE_API_OPERATION_UNKNOWN = 7007, - /** * The given taler://pay URI is invalid. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -3951,7 +3613,6 @@ export enum TalerErrorCode { */ WALLET_INVALID_TALER_PAY_URI = 7008, - /** * The signature on a coin by the exchange's denomination key is invalid after unblinding it. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -3959,7 +3620,6 @@ export enum TalerErrorCode { */ WALLET_EXCHANGE_COIN_SIGNATURE_INVALID = 7009, - /** * The exchange does not know about the reserve (yet), and thus withdrawal can't progress. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -3967,7 +3627,6 @@ export enum TalerErrorCode { */ WALLET_EXCHANGE_WITHDRAW_RESERVE_UNKNOWN_AT_EXCHANGE = 7010, - /** * The wallet core service is not available. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -3975,7 +3634,6 @@ export enum TalerErrorCode { */ WALLET_CORE_NOT_AVAILABLE = 7011, - /** * The bank has aborted a withdrawal operation, and thus a withdrawal can't complete. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -3983,7 +3641,6 @@ export enum TalerErrorCode { */ WALLET_WITHDRAWAL_OPERATION_ABORTED_BY_BANK = 7012, - /** * An HTTP request made by the wallet timed out. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -3991,7 +3648,6 @@ export enum TalerErrorCode { */ WALLET_HTTP_REQUEST_GENERIC_TIMEOUT = 7013, - /** * The order has already been claimed by another wallet. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -3999,7 +3655,6 @@ export enum TalerErrorCode { */ WALLET_ORDER_ALREADY_CLAIMED = 7014, - /** * A group of withdrawal operations (typically for the same reserve at the same exchange) has errors and will be tried again later. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4007,7 +3662,6 @@ export enum TalerErrorCode { */ WALLET_WITHDRAWAL_GROUP_INCOMPLETE = 7015, - /** * The signature on a coin by the exchange's denomination key (obtained through the merchant via a reward) is invalid after unblinding it. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4015,7 +3669,6 @@ export enum TalerErrorCode { */ WALLET_REWARD_COIN_SIGNATURE_INVALID = 7016, - /** * The wallet does not implement a version of the bank integration API that is compatible with the version offered by the bank. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4023,7 +3676,6 @@ export enum TalerErrorCode { */ WALLET_BANK_INTEGRATION_PROTOCOL_VERSION_INCOMPATIBLE = 7017, - /** * The wallet processed a taler://pay URI, but the merchant base URL in the downloaded contract terms does not match the merchant base URL derived from the URI. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4031,7 +3683,6 @@ export enum TalerErrorCode { */ WALLET_CONTRACT_TERMS_BASE_URL_MISMATCH = 7018, - /** * The merchant's signature on the contract terms is invalid. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4039,7 +3690,6 @@ export enum TalerErrorCode { */ WALLET_CONTRACT_TERMS_SIGNATURE_INVALID = 7019, - /** * The contract terms given by the merchant are malformed. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4047,7 +3697,6 @@ export enum TalerErrorCode { */ WALLET_CONTRACT_TERMS_MALFORMED = 7020, - /** * A pending operation failed, and thus the request can't be completed. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4055,7 +3704,6 @@ export enum TalerErrorCode { */ WALLET_PENDING_OPERATION_FAILED = 7021, - /** * A payment was attempted, but the merchant had an internal server error (5xx). * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4063,7 +3711,6 @@ export enum TalerErrorCode { */ WALLET_PAY_MERCHANT_SERVER_ERROR = 7022, - /** * The crypto worker failed. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4071,7 +3718,6 @@ export enum TalerErrorCode { */ WALLET_CRYPTO_WORKER_ERROR = 7023, - /** * The crypto worker received a bad request. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4079,7 +3725,6 @@ export enum TalerErrorCode { */ WALLET_CRYPTO_WORKER_BAD_REQUEST = 7024, - /** * A KYC step is required before withdrawal can proceed. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4087,7 +3732,6 @@ export enum TalerErrorCode { */ WALLET_WITHDRAWAL_KYC_REQUIRED = 7025, - /** * The wallet does not have sufficient balance to create a deposit group. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4095,7 +3739,6 @@ export enum TalerErrorCode { */ WALLET_DEPOSIT_GROUP_INSUFFICIENT_BALANCE = 7026, - /** * The wallet does not have sufficient balance to create a peer push payment. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4103,7 +3746,6 @@ export enum TalerErrorCode { */ WALLET_PEER_PUSH_PAYMENT_INSUFFICIENT_BALANCE = 7027, - /** * The wallet does not have sufficient balance to pay for an invoice. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4111,7 +3753,6 @@ export enum TalerErrorCode { */ WALLET_PEER_PULL_PAYMENT_INSUFFICIENT_BALANCE = 7028, - /** * A group of refresh operations has errors and will be tried again later. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4119,7 +3760,6 @@ export enum TalerErrorCode { */ WALLET_REFRESH_GROUP_INCOMPLETE = 7029, - /** * The exchange's self-reported base URL does not match the one that the wallet is using. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4127,7 +3767,6 @@ export enum TalerErrorCode { */ WALLET_EXCHANGE_BASE_URL_MISMATCH = 7030, - /** * The order has already been paid by another wallet. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4135,7 +3774,6 @@ export enum TalerErrorCode { */ WALLET_ORDER_ALREADY_PAID = 7031, - /** * An exchange that is required for some request is currently not available. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4143,7 +3781,6 @@ export enum TalerErrorCode { */ WALLET_EXCHANGE_UNAVAILABLE = 7032, - /** * An exchange entry is still used by the exchange, thus it can't be deleted without purging. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4151,7 +3788,6 @@ export enum TalerErrorCode { */ WALLET_EXCHANGE_ENTRY_USED = 7033, - /** * The wallet database is unavailable and the wallet thus is not operational. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4159,7 +3795,6 @@ export enum TalerErrorCode { */ WALLET_DB_UNAVAILABLE = 7034, - /** * A taler:// URI is malformed and can't be parsed. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4167,7 +3802,6 @@ export enum TalerErrorCode { */ WALLET_TALER_URI_MALFORMED = 7035, - /** * A wallet-core request was cancelled and thus can't provide a response. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4175,7 +3809,6 @@ export enum TalerErrorCode { */ WALLET_CORE_REQUEST_CANCELLED = 7036, - /** * A wallet-core request failed because the user needs to first accept the exchange's terms of service. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4183,7 +3816,6 @@ export enum TalerErrorCode { */ WALLET_EXCHANGE_TOS_NOT_ACCEPTED = 7037, - /** * An exchange entry could not be updated, as the exchange's new details conflict with the new details. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4191,7 +3823,6 @@ export enum TalerErrorCode { */ WALLET_EXCHANGE_ENTRY_UPDATE_CONFLICT = 7038, - /** * The wallet's information about the exchange is outdated. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4199,6 +3830,33 @@ export enum TalerErrorCode { */ WALLET_EXCHANGE_ENTRY_OUTDATED = 7039, + /** + * The merchant needs to do KYC first, the payment could not be completed. + * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). + * (A value of 0 indicates that the error is generated client-side). + */ + WALLET_PAY_MERCHANT_KYC_MISSING = 7040, + + /** + * A peer-pull-debit transaction was aborted because the exchange reported the purse as gone. + * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). + * (A value of 0 indicates that the error is generated client-side). + */ + WALLET_PEER_PULL_DEBIT_PURSE_GONE = 7041, + + /** + * A transaction was aborted on explicit request by the user. + * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). + * (A value of 0 indicates that the error is generated client-side). + */ + WALLET_TRANSACTION_ABORTED_BY_USER = 7042, + + /** + * A transaction was abandoned on explicit request by the user. + * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). + * (A value of 0 indicates that the error is generated client-side). + */ + WALLET_TRANSACTION_ABANDONED_BY_USER = 7043, /** * We encountered a timeout with our payment backend. @@ -4207,7 +3865,6 @@ export enum TalerErrorCode { */ ANASTASIS_GENERIC_BACKEND_TIMEOUT = 8000, - /** * The backend requested payment, but the request is malformed. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4215,7 +3872,6 @@ export enum TalerErrorCode { */ ANASTASIS_GENERIC_INVALID_PAYMENT_REQUEST = 8001, - /** * The backend got an unexpected reply from the payment processor. * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502). @@ -4223,7 +3879,6 @@ export enum TalerErrorCode { */ ANASTASIS_GENERIC_BACKEND_ERROR = 8002, - /** * The "Content-length" field for the upload is missing. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -4231,7 +3886,6 @@ export enum TalerErrorCode { */ ANASTASIS_GENERIC_MISSING_CONTENT_LENGTH = 8003, - /** * The "Content-length" field for the upload is malformed. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -4239,7 +3893,6 @@ export enum TalerErrorCode { */ ANASTASIS_GENERIC_MALFORMED_CONTENT_LENGTH = 8004, - /** * The backend failed to setup an order with the payment processor. * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502). @@ -4247,7 +3900,6 @@ export enum TalerErrorCode { */ ANASTASIS_GENERIC_ORDER_CREATE_BACKEND_ERROR = 8005, - /** * The backend was not authorized to check for payment with the payment processor. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -4255,7 +3907,6 @@ export enum TalerErrorCode { */ ANASTASIS_GENERIC_PAYMENT_CHECK_UNAUTHORIZED = 8006, - /** * The backend could not check payment status with the payment processor. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -4263,7 +3914,6 @@ export enum TalerErrorCode { */ ANASTASIS_GENERIC_PAYMENT_CHECK_START_FAILED = 8007, - /** * The Anastasis provider could not be reached. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4271,7 +3921,6 @@ export enum TalerErrorCode { */ ANASTASIS_GENERIC_PROVIDER_UNREACHABLE = 8008, - /** * HTTP server experienced a timeout while awaiting promised payment. * Returned with an HTTP status code of #MHD_HTTP_REQUEST_TIMEOUT (408). @@ -4279,7 +3928,6 @@ export enum TalerErrorCode { */ ANASTASIS_PAYMENT_GENERIC_TIMEOUT = 8009, - /** * The key share is unknown to the provider. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -4287,7 +3935,6 @@ export enum TalerErrorCode { */ ANASTASIS_TRUTH_UNKNOWN = 8108, - /** * The authorization method used for the key share is no longer supported by the provider. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -4295,7 +3942,6 @@ export enum TalerErrorCode { */ ANASTASIS_TRUTH_AUTHORIZATION_METHOD_NO_LONGER_SUPPORTED = 8109, - /** * The client needs to respond to the challenge. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -4303,7 +3949,6 @@ export enum TalerErrorCode { */ ANASTASIS_TRUTH_CHALLENGE_RESPONSE_REQUIRED = 8110, - /** * The client's response to the challenge was invalid. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -4311,7 +3956,6 @@ export enum TalerErrorCode { */ ANASTASIS_TRUTH_CHALLENGE_FAILED = 8111, - /** * The backend is not aware of having issued the provided challenge code. Either this is the wrong code, or it has expired. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -4319,7 +3963,6 @@ export enum TalerErrorCode { */ ANASTASIS_TRUTH_CHALLENGE_UNKNOWN = 8112, - /** * The backend failed to initiate the authorization process. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -4327,7 +3970,6 @@ export enum TalerErrorCode { */ ANASTASIS_TRUTH_AUTHORIZATION_START_FAILED = 8114, - /** * The authorization succeeded, but the key share is no longer available. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -4335,7 +3977,6 @@ export enum TalerErrorCode { */ ANASTASIS_TRUTH_KEY_SHARE_GONE = 8115, - /** * The backend forgot the order we asked the client to pay for * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502). @@ -4343,7 +3984,6 @@ export enum TalerErrorCode { */ ANASTASIS_TRUTH_ORDER_DISAPPEARED = 8116, - /** * The backend itself reported a bad exchange interaction. * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502). @@ -4351,7 +3991,6 @@ export enum TalerErrorCode { */ ANASTASIS_TRUTH_BACKEND_EXCHANGE_BAD = 8117, - /** * The backend reported a payment status we did not expect. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -4359,7 +3998,6 @@ export enum TalerErrorCode { */ ANASTASIS_TRUTH_UNEXPECTED_PAYMENT_STATUS = 8118, - /** * The backend failed to setup the order for payment. * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502). @@ -4367,7 +4005,6 @@ export enum TalerErrorCode { */ ANASTASIS_TRUTH_PAYMENT_CREATE_BACKEND_ERROR = 8119, - /** * The decryption of the key share failed with the provided key. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -4375,7 +4012,6 @@ export enum TalerErrorCode { */ ANASTASIS_TRUTH_DECRYPTION_FAILED = 8120, - /** * The request rate is too high. The server is refusing requests to guard against brute-force attacks. * Returned with an HTTP status code of #MHD_HTTP_TOO_MANY_REQUESTS (429). @@ -4383,7 +4019,6 @@ export enum TalerErrorCode { */ ANASTASIS_TRUTH_RATE_LIMITED = 8121, - /** * A request to issue a challenge is not valid for this authentication method. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -4391,7 +4026,6 @@ export enum TalerErrorCode { */ ANASTASIS_TRUTH_CHALLENGE_WRONG_METHOD = 8123, - /** * The backend failed to store the key share because the UUID is already in use. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -4399,7 +4033,6 @@ export enum TalerErrorCode { */ ANASTASIS_TRUTH_UPLOAD_UUID_EXISTS = 8150, - /** * The backend failed to store the key share because the authorization method is not supported. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -4407,7 +4040,6 @@ export enum TalerErrorCode { */ ANASTASIS_TRUTH_UPLOAD_METHOD_NOT_SUPPORTED = 8151, - /** * The provided phone number is not an acceptable number. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -4415,7 +4047,6 @@ export enum TalerErrorCode { */ ANASTASIS_SMS_PHONE_INVALID = 8200, - /** * Failed to run the SMS transmission helper process. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -4423,7 +4054,6 @@ export enum TalerErrorCode { */ ANASTASIS_SMS_HELPER_EXEC_FAILED = 8201, - /** * Provider failed to send SMS. Helper terminated with a non-successful result. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -4431,7 +4061,6 @@ export enum TalerErrorCode { */ ANASTASIS_SMS_HELPER_COMMAND_FAILED = 8202, - /** * The provided email address is not an acceptable address. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -4439,7 +4068,6 @@ export enum TalerErrorCode { */ ANASTASIS_EMAIL_INVALID = 8210, - /** * Failed to run the E-mail transmission helper process. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -4447,7 +4075,6 @@ export enum TalerErrorCode { */ ANASTASIS_EMAIL_HELPER_EXEC_FAILED = 8211, - /** * Provider failed to send E-mail. Helper terminated with a non-successful result. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -4455,7 +4082,6 @@ export enum TalerErrorCode { */ ANASTASIS_EMAIL_HELPER_COMMAND_FAILED = 8212, - /** * The provided postal address is not an acceptable address. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -4463,7 +4089,6 @@ export enum TalerErrorCode { */ ANASTASIS_POST_INVALID = 8220, - /** * Failed to run the mail transmission helper process. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -4471,7 +4096,6 @@ export enum TalerErrorCode { */ ANASTASIS_POST_HELPER_EXEC_FAILED = 8221, - /** * Provider failed to send mail. Helper terminated with a non-successful result. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -4479,7 +4103,6 @@ export enum TalerErrorCode { */ ANASTASIS_POST_HELPER_COMMAND_FAILED = 8222, - /** * The provided IBAN address is not an acceptable IBAN. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -4487,7 +4110,6 @@ export enum TalerErrorCode { */ ANASTASIS_IBAN_INVALID = 8230, - /** * The provider has not yet received the IBAN wire transfer authorizing the disclosure of the key share. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -4495,7 +4117,6 @@ export enum TalerErrorCode { */ ANASTASIS_IBAN_MISSING_TRANSFER = 8231, - /** * The backend did not find a TOTP key in the data provided. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -4503,7 +4124,6 @@ export enum TalerErrorCode { */ ANASTASIS_TOTP_KEY_MISSING = 8240, - /** * The key provided does not satisfy the format restrictions for an Anastasis TOTP key. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -4511,7 +4131,6 @@ export enum TalerErrorCode { */ ANASTASIS_TOTP_KEY_INVALID = 8241, - /** * The given if-none-match header is malformed. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -4519,7 +4138,6 @@ export enum TalerErrorCode { */ ANASTASIS_POLICY_BAD_IF_NONE_MATCH = 8301, - /** * The server is out of memory to handle the upload. Trying again later may succeed. * Returned with an HTTP status code of #MHD_HTTP_CONTENT_TOO_LARGE (413). @@ -4527,7 +4145,6 @@ export enum TalerErrorCode { */ ANASTASIS_POLICY_OUT_OF_MEMORY_ON_CONTENT_LENGTH = 8304, - /** * The signature provided in the "Anastasis-Policy-Signature" header is malformed or missing. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -4535,7 +4152,6 @@ export enum TalerErrorCode { */ ANASTASIS_POLICY_BAD_SIGNATURE = 8305, - /** * The given if-match header is malformed. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -4543,7 +4159,6 @@ export enum TalerErrorCode { */ ANASTASIS_POLICY_BAD_IF_MATCH = 8306, - /** * The uploaded data does not match the Etag. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -4551,7 +4166,6 @@ export enum TalerErrorCode { */ ANASTASIS_POLICY_INVALID_UPLOAD = 8307, - /** * The provider is unaware of the requested policy. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -4559,7 +4173,6 @@ export enum TalerErrorCode { */ ANASTASIS_POLICY_NOT_FOUND = 8350, - /** * The given action is invalid for the current state of the reducer. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4567,7 +4180,6 @@ export enum TalerErrorCode { */ ANASTASIS_REDUCER_ACTION_INVALID = 8400, - /** * The given state of the reducer is invalid. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4575,7 +4187,6 @@ export enum TalerErrorCode { */ ANASTASIS_REDUCER_STATE_INVALID = 8401, - /** * The given input to the reducer is invalid. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4583,7 +4194,6 @@ export enum TalerErrorCode { */ ANASTASIS_REDUCER_INPUT_INVALID = 8402, - /** * The selected authentication method does not work for the Anastasis provider. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4591,7 +4201,6 @@ export enum TalerErrorCode { */ ANASTASIS_REDUCER_AUTHENTICATION_METHOD_NOT_SUPPORTED = 8403, - /** * The given input and action do not work for the current state. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4599,7 +4208,6 @@ export enum TalerErrorCode { */ ANASTASIS_REDUCER_INPUT_INVALID_FOR_STATE = 8404, - /** * We experienced an unexpected failure interacting with the backend. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4607,7 +4215,6 @@ export enum TalerErrorCode { */ ANASTASIS_REDUCER_BACKEND_FAILURE = 8405, - /** * The contents of a resource file did not match our expectations. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4615,7 +4222,6 @@ export enum TalerErrorCode { */ ANASTASIS_REDUCER_RESOURCE_MALFORMED = 8406, - /** * A required resource file is missing. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4623,7 +4229,6 @@ export enum TalerErrorCode { */ ANASTASIS_REDUCER_RESOURCE_MISSING = 8407, - /** * An input did not match the regular expression. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4631,7 +4236,6 @@ export enum TalerErrorCode { */ ANASTASIS_REDUCER_INPUT_REGEX_FAILED = 8408, - /** * An input did not match the custom validation logic. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4639,7 +4243,6 @@ export enum TalerErrorCode { */ ANASTASIS_REDUCER_INPUT_VALIDATION_FAILED = 8409, - /** * Our attempts to download the recovery document failed with all providers. Most likely the personal information you entered differs from the information you provided during the backup process and you should go back to the previous step. Alternatively, if you used a backup provider that is unknown to this application, you should add that provider manually. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4647,7 +4250,6 @@ export enum TalerErrorCode { */ ANASTASIS_REDUCER_POLICY_LOOKUP_FAILED = 8410, - /** * Anastasis provider reported a fatal failure. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4655,7 +4257,6 @@ export enum TalerErrorCode { */ ANASTASIS_REDUCER_BACKUP_PROVIDER_FAILED = 8411, - /** * Anastasis provider failed to respond to the configuration request. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4663,7 +4264,6 @@ export enum TalerErrorCode { */ ANASTASIS_REDUCER_PROVIDER_CONFIG_FAILED = 8412, - /** * The policy we downloaded is malformed. Must have been a client error while creating the backup. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4671,7 +4271,6 @@ export enum TalerErrorCode { */ ANASTASIS_REDUCER_POLICY_MALFORMED = 8413, - /** * We failed to obtain the policy, likely due to a network issue. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4679,7 +4278,6 @@ export enum TalerErrorCode { */ ANASTASIS_REDUCER_NETWORK_FAILED = 8414, - /** * The recovered secret did not match the required syntax. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4687,7 +4285,6 @@ export enum TalerErrorCode { */ ANASTASIS_REDUCER_SECRET_MALFORMED = 8415, - /** * The challenge data provided is too large for the available providers. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4695,7 +4292,6 @@ export enum TalerErrorCode { */ ANASTASIS_REDUCER_CHALLENGE_DATA_TOO_BIG = 8416, - /** * The provided core secret is too large for some of the providers. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4703,7 +4299,6 @@ export enum TalerErrorCode { */ ANASTASIS_REDUCER_SECRET_TOO_BIG = 8417, - /** * The provider returned in invalid configuration. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4711,7 +4306,6 @@ export enum TalerErrorCode { */ ANASTASIS_REDUCER_PROVIDER_INVALID_CONFIG = 8418, - /** * The reducer encountered an internal error, likely a bug that needs to be reported. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4719,7 +4313,6 @@ export enum TalerErrorCode { */ ANASTASIS_REDUCER_INTERNAL_ERROR = 8419, - /** * The reducer already synchronized with all providers. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4727,7 +4320,6 @@ export enum TalerErrorCode { */ ANASTASIS_REDUCER_PROVIDERS_ALREADY_SYNCED = 8420, - /** * The Donau failed to perform the operation as it could not find the private keys. This is a problem with the Donau setup, not with the client's request. * Returned with an HTTP status code of #MHD_HTTP_SERVICE_UNAVAILABLE (503). @@ -4735,7 +4327,6 @@ export enum TalerErrorCode { */ DONAU_GENERIC_KEYS_MISSING = 8607, - /** * The signature of the charity key is not valid. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -4743,7 +4334,6 @@ export enum TalerErrorCode { */ DONAU_CHARITY_SIGNATURE_INVALID = 8608, - /** * The charity is unknown. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -4751,7 +4341,6 @@ export enum TalerErrorCode { */ DONAU_CHARITY_NOT_FOUND = 8609, - /** * The donation amount specified in the request exceeds the limit of the charity. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -4759,7 +4348,6 @@ export enum TalerErrorCode { */ DONAU_EXCEEDING_DONATION_LIMIT = 8610, - /** * The Donau is not aware of the donation unit requested for the operation. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -4767,7 +4355,6 @@ export enum TalerErrorCode { */ DONAU_GENERIC_DONATION_UNIT_UNKNOWN = 8611, - /** * The Donau failed to talk to the process responsible for its private donation unit keys or the helpers had no donation units (properly) configured. * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502). @@ -4775,7 +4362,6 @@ export enum TalerErrorCode { */ DONAU_DONATION_UNIT_HELPER_UNAVAILABLE = 8612, - /** * The Donau failed to talk to the process responsible for its private signing keys. * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502). @@ -4783,7 +4369,6 @@ export enum TalerErrorCode { */ DONAU_SIGNKEY_HELPER_UNAVAILABLE = 8613, - /** * The response from the online signing key helper process was malformed. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -4791,7 +4376,6 @@ export enum TalerErrorCode { */ DONAU_SIGNKEY_HELPER_BUG = 8614, - /** * The number of segments included in the URI does not match the number of segments expected by the endpoint. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -4799,7 +4383,6 @@ export enum TalerErrorCode { */ DONAU_GENERIC_WRONG_NUMBER_OF_SEGMENTS = 8615, - /** * The signature of the donation receipt is not valid. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -4807,7 +4390,6 @@ export enum TalerErrorCode { */ DONAU_DONATION_RECEIPT_SIGNATURE_INVALID = 8616, - /** * The client re-used a unique donor identifier nonce, which is not allowed. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -4815,7 +4397,6 @@ export enum TalerErrorCode { */ DONAU_DONOR_IDENTIFIER_NONCE_REUSE = 8617, - /** * A generic error happened in the LibEuFin nexus. See the enclose details JSON for more information. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4823,7 +4404,6 @@ export enum TalerErrorCode { */ LIBEUFIN_NEXUS_GENERIC_ERROR = 9000, - /** * An uncaught exception happened in the LibEuFin nexus service. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -4831,7 +4411,6 @@ export enum TalerErrorCode { */ LIBEUFIN_NEXUS_UNCAUGHT_EXCEPTION = 9001, - /** * A generic error happened in the LibEuFin sandbox. See the enclose details JSON for more information. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). @@ -4839,7 +4418,6 @@ export enum TalerErrorCode { */ LIBEUFIN_SANDBOX_GENERIC_ERROR = 9500, - /** * An uncaught exception happened in the LibEuFin sandbox service. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -4847,7 +4425,6 @@ export enum TalerErrorCode { */ LIBEUFIN_SANDBOX_UNCAUGHT_EXCEPTION = 9501, - /** * This validation method is not supported by the service. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -4855,7 +4432,6 @@ export enum TalerErrorCode { */ TALDIR_METHOD_NOT_SUPPORTED = 9600, - /** * Number of allowed attempts for initiating a challenge exceeded. * Returned with an HTTP status code of #MHD_HTTP_TOO_MANY_REQUESTS (429). @@ -4863,7 +4439,6 @@ export enum TalerErrorCode { */ TALDIR_REGISTER_RATE_LIMITED = 9601, - /** * The client is unknown or unauthorized. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -4871,7 +4446,6 @@ export enum TalerErrorCode { */ CHALLENGER_GENERIC_CLIENT_UNKNOWN = 9750, - /** * The client is not authorized to use the given redirect URI. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -4879,7 +4453,6 @@ export enum TalerErrorCode { */ CHALLENGER_GENERIC_CLIENT_FORBIDDEN_BAD_REDIRECT_URI = 9751, - /** * The service failed to execute its helper process to send the challenge. * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500). @@ -4887,7 +4460,6 @@ export enum TalerErrorCode { */ CHALLENGER_HELPER_EXEC_FAILED = 9752, - /** * The grant is unknown to the service (it could also have expired). * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -4895,7 +4467,6 @@ export enum TalerErrorCode { */ CHALLENGER_GRANT_UNKNOWN = 9753, - /** * The code given is not even well-formed. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -4903,7 +4474,6 @@ export enum TalerErrorCode { */ CHALLENGER_CLIENT_FORBIDDEN_BAD_CODE = 9754, - /** * The service is not aware of the referenced validation process. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -4911,7 +4481,6 @@ export enum TalerErrorCode { */ CHALLENGER_GENERIC_VALIDATION_UNKNOWN = 9755, - /** * The code given is not valid. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -4919,7 +4488,6 @@ export enum TalerErrorCode { */ CHALLENGER_CLIENT_FORBIDDEN_INVALID_CODE = 9756, - /** * Too many attempts have been made, validation is temporarily disabled for this address. * Returned with an HTTP status code of #MHD_HTTP_TOO_MANY_REQUESTS (429). @@ -4927,7 +4495,6 @@ export enum TalerErrorCode { */ CHALLENGER_TOO_MANY_ATTEMPTS = 9757, - /** * The PIN code provided is incorrect. * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). @@ -4935,7 +4502,6 @@ export enum TalerErrorCode { */ CHALLENGER_INVALID_PIN = 9758, - /** * The token cannot be valid as no address was ever provided by the client. * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). @@ -4943,13 +4509,10 @@ export enum TalerErrorCode { */ CHALLENGER_MISSING_ADDRESS = 9759, - /** * End of error code range. * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). * (A value of 0 indicates that the error is generated client-side). */ END = 9999, - - } diff --git a/packages/taler-util/src/taler-signatures.ts b/packages/taler-util/src/taler-signatures.ts index 5c9690528..f529a456b 100644 --- a/packages/taler-util/src/taler-signatures.ts +++ b/packages/taler-util/src/taler-signatures.ts @@ -50,8 +50,8 @@ export function signAmlDecision( builder.put(hash(stringToBytes(decision.justification))); builder.put(hash(stringToBytes(canonicalJson(decision.properties) + "\0"))); builder.put(hash(stringToBytes(canonicalJson(decision.new_rules) + "\0"))); - if (decision.new_measure != null) { - builder.put(hash(stringToBytes(decision.new_measure))); + if (decision.new_measures != null) { + builder.put(hash(stringToBytes(decision.new_measures))); } else { builder.put(new Uint8Array(64)); } diff --git a/packages/taler-util/src/types-taler-bank-integration.ts b/packages/taler-util/src/types-taler-bank-integration.ts index 02161474f..517d59f38 100644 --- a/packages/taler-util/src/types-taler-bank-integration.ts +++ b/packages/taler-util/src/types-taler-bank-integration.ts @@ -68,10 +68,15 @@ export interface BankWithdrawalOperationStatus { // Optional since **vC2EC**. suggested_amount?: AmountString | undefined; + // Minimum amount that the wallet can choose to withdraw. + // Only applicable when the amount is not fixed. + // @since **v4**. + min_amount?: AmountString; + // Maximum amount that the wallet can choose to withdraw. // Only applicable when the amount is not fixed. - // @since **vC2EC**. - max_amount?: AmountString | undefined; + // @since **v4**. + max_amount?: AmountString; // The non-Taler card fees the customer will have // to pay to the bank / payment service provider @@ -165,17 +170,19 @@ export const codecForBankWithdrawalOperationStatus = codecForConstString("confirmed"), ), ) - .property("amount", codecOptional(codecForAmountString())) .property("currency", codecOptional(codecForCurrencyName())) + .property("amount", codecOptional(codecForAmountString())) .property("suggested_amount", codecOptional(codecForAmountString())) + .property("min_amount", codecOptional(codecForAmountString())) + .property("max_amount", codecOptional(codecForAmountString())) .property("card_fees", codecOptional(codecForAmountString())) .property("sender_wire", codecOptional(codecForPaytoString())) .property("suggested_exchange", codecOptional(codecForURLString())) + .property("required_exchange", codecOptional(codecForURLString())) .property("confirm_transfer_url", codecOptional(codecForURLString())) .property("wire_types", codecForList(codecForString())) .property("selected_reserve_pub", codecOptional(codecForString())) .property("selected_exchange_account", codecOptional(codecForString())) - .property("max_amount", codecOptional(codecForAmountString())) .build("TalerBankIntegrationApi.BankWithdrawalOperationStatus"); export const codecForBankWithdrawalOperationPostResponse = diff --git a/packages/taler-util/src/types-taler-common.ts b/packages/taler-util/src/types-taler-common.ts index 6fc314f25..dd983cf2e 100644 --- a/packages/taler-util/src/types-taler-common.ts +++ b/packages/taler-util/src/types-taler-common.ts @@ -40,7 +40,7 @@ import { codecForString, codecOptional, } from "./codec.js"; -import { codecForEither } from "./index.js"; +import { ReservePub, codecForEither } from "./index.js"; import { TalerProtocolDuration, TalerProtocolTimestamp, @@ -291,21 +291,6 @@ export type HashCodeString = string; export type WireSalt = string; -export interface WalletKycUuid { - // UUID that the wallet should use when initiating - // the KYC check. - requirement_row: number; - - // Hash of the payto:// account URI for the wallet. - h_payto: string; -} - -export const codecForWalletKycUuid = (): Codec<WalletKycUuid> => - buildCodecForObject<WalletKycUuid>() - .property("requirement_row", codecForNumber()) - .property("h_payto", codecForString()) - .build("WalletKycUuid"); - export interface MerchantUsingTemplateDetails { summary?: string; amount?: AmountString; @@ -540,25 +525,11 @@ export interface OfficerAccount { signingKey: SigningKey; } - -declare const opaque_ReserveAccount: unique symbol; -/** - * Sealed private key for AML officer - */ -export type LockedReserve = string & { [opaque_ReserveAccount]: true }; - -declare const opaque_ReserveId: unique symbol; -/** - * Public key for AML officer - */ -export type ReserveId = string & { [opaque_ReserveId]: true }; - export interface ReserveAccount { - id: ReserveId; + id: ReservePub; signingKey: SigningKey; } - export type PaginationParams = { /** * row identifier as the starting point of the query diff --git a/packages/taler-util/src/types-taler-corebank.ts b/packages/taler-util/src/types-taler-corebank.ts index 994623e4d..c93272a7d 100644 --- a/packages/taler-util/src/types-taler-corebank.ts +++ b/packages/taler-util/src/types-taler-corebank.ts @@ -124,6 +124,14 @@ export interface TalerCorebankConfigResponse { // Wire transfer execution fees. // @since v4, will become mandatory in the next version. wire_transfer_fees?: AmountString; + + // Minimum wire transfer amount allowed. Only applies to bank transactions and withdrawals. + // @since **v4**, will become mandatory in the next version. + min_wire_transfer_amount?: AmountString; + + // Maximum wire transfer amount allowed. Only applies to bank transactions and withdrawals. + // @since **v4**, will become mandatory in the next version. + max_wire_transfer_amount?: AmountString; } export interface BankAccountCreateWithdrawalRequest { @@ -138,6 +146,15 @@ export interface BankAccountCreateWithdrawalRequest { suggested_amount?: AmountString; } +export interface BankAccountConfirmWithdrawalRequest { + + // Selected amount to be transferred. Optional if the + // backend already knows the amount. + // @since **v6** + amount?: AmountString; +} + + export interface BankAccountCreateWithdrawalResponse { // ID of the withdrawal, can be used to view/modify the withdrawal operation. withdrawal_id: string; @@ -232,6 +249,7 @@ export interface RegisterAccountRequest { // Legal name of the account owner name: string; + // Make this account visible to anyone? // Defaults to false. is_public?: boolean; @@ -667,6 +685,8 @@ export const codecForCoreBankConfig = (): Codec<TalerCorebankConfigResponse> => ) .property("wire_type", codecOptionalDefault(codecForString(), "iban")) .property("wire_transfer_fees", codecOptional(codecForAmountString())) + .property("min_wire_transfer_amount", codecOptional(codecForAmountString())) + .property("max_wire_transfer_amount", codecOptional(codecForAmountString())) .build("TalerCorebankApi.Config"); const codecForBalance = (): Codec<Balance> => @@ -773,6 +793,7 @@ export const codecForWithdrawalPublicInfo = (): Codec<WithdrawalPublicInfo> => ), ) .property("amount", codecOptional(codecForAmountString())) + .property("suggested_amount", codecOptional(codecForAmountString())) .property("username", codecForString()) .property("selected_reserve_pub", codecOptional(codecForString())) .property("selected_exchange_account", codecOptional(codecForPaytoString())) diff --git a/packages/taler-util/src/types-taler-exchange.ts b/packages/taler-util/src/types-taler-exchange.ts index 0cd722239..55c88e29a 100644 --- a/packages/taler-util/src/types-taler-exchange.ts +++ b/packages/taler-util/src/types-taler-exchange.ts @@ -454,6 +454,21 @@ export interface ExchangeKeysJson { // Optional option, if not given there is no limit. // Currency must match currency. wallet_balance_limit_without_kyc?: AmountString[]; + + // Array of limits that apply to all accounts. + // All of the given limits will be hard limits. + // Wallets and merchants are expected to obey them + // and not even allow the user to cross them. + // Since protocol **v21**. + hard_limits?: AccountLimit[]; + + // Array of limits with a soft threshold of zero + // that apply to all accounts without KYC. + // Wallets and merchants are expected to trigger + // a KYC process before attempting any zero-limited + // operations. + // Since protocol **v21**. + zero_limits?: ZeroLimitedOperation[]; } export interface ExchangeMeltRequest { @@ -573,11 +588,6 @@ export interface DenomGroupCommon { // Fee charged by the exchange for refunding a coin of this denomination. fee_refund: AmountString; - - // XOR of all the SHA-512 hash values of the denominations' public keys - // in this group. Note that for hashing, the binary format of the - // public keys is used, and not their base32 encoding. - hash: HashCodeString; } export interface DenomCommon { @@ -882,6 +892,14 @@ export const codecForExchangeKeysJson = (): Codec<ExchangeKeysJson> => .property("global_fees", codecForList(codecForGlobalFees())) .property("accounts", codecForList(codecForExchangeWireAccount())) .property("wire_fees", codecForMap(codecForList(codecForWireFeesJson()))) + .property( + "zero_limits", + codecOptional(codecForList(codecForZeroLimitedOperation())), + ) + .property( + "hard_limits", + codecOptional(codecForList(codecForAccountLimit())), + ) .property("denominations", codecForList(codecForNgDenominations)) .property( "wallet_balance_limit_without_kyc", @@ -933,18 +951,18 @@ export namespace DenomKeyType { } } -export interface RsaBlindedDenominationSignature { - cipher: DenomKeyType.Rsa; - blinded_rsa_signature: string; -} +// export interface RsaBlindedDenominationSignature { +// cipher: DenomKeyType.Rsa; +// blinded_rsa_signature: string; +// } -export interface CSBlindedDenominationSignature { - cipher: DenomKeyType.ClauseSchnorr; -} +// export interface CSBlindedDenominationSignature { +// cipher: DenomKeyType.ClauseSchnorr; +// } -export type BlindedDenominationSignature = - | RsaBlindedDenominationSignature - | CSBlindedDenominationSignature; +// export type BlindedDenominationSignature = +// | RsaBlindedDenominationSignature +// | CSBlindedDenominationSignature; export const codecForRsaBlindedDenominationSignature = () => buildCodecForObject<RsaBlindedDenominationSignature>() @@ -1339,6 +1357,10 @@ export interface ExchangeBatchDepositRequest { // The merchant's account details. merchant_payto_uri: string; + // Merchant's signature over the h_contract_terms. + // @since v22 + merchant_sig: EddsaSignatureString; + // The salt is used to hide the ``payto_uri`` from customers // when computing the ``h_wire`` of the merchant. wire_salt: WireSalt; @@ -1417,6 +1439,25 @@ export interface MeasureInformation { // Context for the check. Optional. context?: Object; + + // Operation that this measure relates to. + // NULL if unknown. Useful as a hint to the + // user if there are many (voluntary) measures + // and some related to unlocking certain operations. + // (and due to zero-amount thresholds, no measure + // was actually specifically triggered). + // + // Must be one of "WITHDRAW", "DEPOSIT", + // (p2p) "MERGE", (wallet) "BALANCE", + // (reserve) "CLOSE", "AGGREGATE", + // "TRANSACTION" or "REFUND". + // New in protocol **v21**. + operation_type?: string; + + // Can this measure be undertaken voluntarily? + // Optional, default is false. + // Since protocol **vATTEST**. + voluntary?: boolean; } export interface AmlProgramRequirement { @@ -1602,6 +1643,8 @@ export interface LegitimizationNeededResponse { // Hash of the payto:// account URI for which KYC // is required. + // The account holder can uses the /kyc-check/$H_PAYTO + // endpoint to check the KYC status or initiate the KYC process. h_payto: PaytoHash; // Public key associated with the account. The client must sign @@ -1616,12 +1659,20 @@ export interface LegitimizationNeededResponse { account_pub?: EddsaPublicKeyString; // Identifies a set of measures that were triggered and that are - // now preventing this operation from proceeding. Gives the - // account holder a starting point for understanding why the - // transaction was blocked and how to lift it. The account holder - // should use the number to check for the account's AML/KYC status - // using the /kyc-check/$REQUIREMENT_ROW endpoint. + // now preventing this operation from proceeding. Gives developers + // a starting point for understanding why the transaction was + // blocked and how to lift it. + // Can be zero (which means there is no requirement row), + // especially if bad_kyc_auth is set. requirement_row: Integer; + + // True if the operation was denied because the + // KYC auth key does not match the merchant public + // key. In this case, a KYC auth wire transfer + // with the merchant public key must be performed + // first. + // Since exchange protocol **v21**. + bad_kyc_auth?: boolean; } export interface AccountKycStatus { @@ -1663,11 +1714,20 @@ export interface AccountKycStatus { // request that would cause it to exceed hard limits). limits?: AccountLimit[]; } + +export type LimitOperationType = + | "WITHDRAW" + | "DEPOSIT" + | "MERGE" + | "AGGREGATE" + | "BALANCE" + | "REFUND" + | "CLOSE" + | "TRANSACTION"; + export interface AccountLimit { // Operation that is limited. - // Must be one of "WITHDRAW", "DEPOSIT", "P2P-RECEIVE" - // or "WALLET-BALANCE". - operation_type: "WITHDRAW" | "DEPOSIT" | "P2P-RECEIVE" | "WALLET-BALANCE"; + operation_type: LimitOperationType; // Timeframe during which the limit applies. timeframe: RelativeTime; @@ -1683,7 +1743,8 @@ export interface AccountLimit { // Clients that are aware of hard limits *should* // inform users about the hard limit and prevent flows // in the UI that would cause violations of hard limits. - soft_limit: boolean; + // Made optional in **v21** with a default of 'false' if missing. + soft_limit?: boolean; } export interface KycProcessClientInformation { @@ -1708,13 +1769,17 @@ export interface KycRequirementInformation { // Which form should be used? Common values include "INFO" // (to just show the descriptions but allow no action), // "LINK" (to enable the user to obtain a link via - // /kyc-start/) or any build-in form name supported + // /kyc-start/) or any built-in form name supported // by the SPA. form: "LINK" | "INFO" | KycBuiltInFromId; // English description of the requirement. description: string; + // Object with arbitrary additional context, completely depends on + // the specific form. + context?: Object; + // Map from IETF BCP 47 language tags to localized // description texts. description_i18n?: { [lang_tag: string]: string }; @@ -1851,6 +1916,12 @@ export interface AmlDecisionRequest { // Identifies a GNU Taler wallet or an affected bank account. h_payto: PaytoHash; + // Payto address of the account the decision is about. + // Optional. Must be given if the account is not yet + // known to the exchange. If given, must match h_payto. + // New since protocol **v21**. + payto_uri?: string; + // What are the new rules? // New since protocol **v20**. new_rules: LegitimizationRuleSet; @@ -1859,14 +1930,14 @@ export interface AmlDecisionRequest { // New since protocol **v20**. properties: AccountProperties; - // New measure to apply immediately to the account. + // Space-separated list of measures to trigger + // immediately on the account. + // Prefixed with a "+" to indicate that the + // measures should be ANDed. // Should typically be used to give the user some // information or request additional information. - // Use "verboten" to communicate to the customer - // that there is no KYC check that could be passed - // to modify the new_rules. - // New since protocol **v20**. - new_measure?: string; + // New since protocol **v21**. + new_measures?: string; // True if the account should remain under investigation by AML staff. // New since protocol **v20**. @@ -1952,6 +2023,8 @@ export enum AmlState { pending = 1, frozen = 2, } +type Float = number; + export interface ExchangeKeysResponse { // libtool-style representation of the Exchange protocol version, see // https://www.gnu.org/software/libtool/manual/html_node/Versioning.html#Versioning @@ -1964,105 +2037,121 @@ export interface ExchangeKeysResponse { // The exchange's currency or asset unit. currency: string; - /** - * FIXME: PARTIALLY IMPLEMENTED!! - */ - // How wallets should render this currency. - // currency_specification: CurrencySpecification; - - // // Absolute cost offset for the STEFAN curve used - // // to (over) approximate fees payable by amount. - // stefan_abs: AmountString; - - // // Factor to multiply the logarithm of the amount - // // with to (over) approximate fees payable by amount. - // // Note that the total to be paid is first to be - // // divided by the smallest denomination to obtain - // // the value that the logarithm is to be taken of. - // stefan_log: AmountString; - - // // Linear cost factor for the STEFAN curve used - // // to (over) approximate fees payable by amount. - // // - // // Note that this is a scalar, as it is multiplied - // // with the actual amount. - // stefan_lin: Float; - - // // Type of the asset. "fiat", "crypto", "regional" - // // or "stock". Wallets should adjust their UI/UX - // // based on this value. - // asset_type: string; - - // // Array of wire accounts operated by the exchange for - // // incoming wire transfers. - // accounts: WireAccount[]; - - // // Object mapping names of wire methods (i.e. "iban" or "x-taler-bank") - // // to wire fees. - // wire_fees: { method: AggregateTransferFee[] }; - - // // List of exchanges that this exchange is partnering - // // with to enable wallet-to-wallet transfers. - // wads: ExchangePartner[]; - - // // Set to true if this exchange allows the use - // // of reserves for rewards. - // // @deprecated in protocol v18. - // rewards_allowed: false; - - // // EdDSA master public key of the exchange, used to sign entries - // // in denoms and signkeys. - // master_public_key: EddsaPublicKey; - - // // Relative duration until inactive reserves are closed; - // // not signed (!), can change without notice. - // reserve_closing_delay: RelativeTime; - - // // Threshold amounts beyond which wallet should - // // trigger the KYC process of the issuing - // // exchange. Optional option, if not given there is no limit. - // // Currency must match currency. - // wallet_balance_limit_without_kyc?: AmountString[]; - - // // Denominations offered by this exchange - // denominations: DenomGroup[]; - - // // Compact EdDSA signature (binary-only) over the - // // contatentation of all of the master_sigs (in reverse - // // chronological order by group) in the arrays under - // // "denominations". Signature of TALER_ExchangeKeySetPS - // exchange_sig: EddsaSignature; - - // // Public EdDSA key of the exchange that was used to generate the signature. - // // Should match one of the exchange's signing keys from signkeys. It is given - // // explicitly as the client might otherwise be confused by clock skew as to - // // which signing key was used for the exchange_sig. - // exchange_pub: EddsaPublicKey; - - // // Denominations for which the exchange currently offers/requests recoup. - // recoup: Recoup[]; - - // // Array of globally applicable fees by time range. - // global_fees: GlobalFees[]; - - // // The date when the denomination keys were last updated. - // list_issue_date: Timestamp; - - // // Auditors of the exchange. - // auditors: AuditorKeys[]; - - // // The exchange's signing keys. - // signkeys: SignKey[]; - - // // Optional field with a dictionary of (name, object) pairs defining the - // // supported and enabled extensions, such as age_restriction. - // extensions?: { name: ExtensionManifest }; - - // // Signature by the exchange master key of the SHA-256 hash of the - // // normalized JSON-object of field extensions, if it was set. - // // The signature has purpose TALER_SIGNATURE_MASTER_EXTENSIONS. - // extensions_sig?: EddsaSignature; + currency_specification: CurrencySpecification; + + // Absolute cost offset for the STEFAN curve used + // to (over) approximate fees payable by amount. + stefan_abs: AmountString; + + // Factor to multiply the logarithm of the amount + // with to (over) approximate fees payable by amount. + // Note that the total to be paid is first to be + // divided by the smallest denomination to obtain + // the value that the logarithm is to be taken of. + stefan_log: AmountString; + + // Linear cost factor for the STEFAN curve used + // to (over) approximate fees payable by amount. + // + // Note that this is a scalar, as it is multiplied + // with the actual amount. + stefan_lin: Float; + + // Type of the asset. "fiat", "crypto", "regional" + // or "stock". Wallets should adjust their UI/UX + // based on this value. + asset_type: string; + + // Array of wire accounts operated by the exchange for + // incoming wire transfers. + accounts: WireAccount[]; + + // Object mapping names of wire methods (i.e. "iban" or "x-taler-bank") + // to wire fees. + wire_fees: { method: AggregateTransferFee[] }; + + // List of exchanges that this exchange is partnering + // with to enable wallet-to-wallet transfers. + wads: ExchangePartnerListEntry[]; + + // EdDSA master public key of the exchange, used to sign entries + // in denoms and signkeys. + master_public_key: EddsaPublicKey; + + // Relative duration until inactive reserves are closed; + // not signed (!), can change without notice. + reserve_closing_delay: RelativeTime; + + // Threshold amounts beyond which wallet should + // trigger the KYC process of the issuing exchange. + // Optional option, if not given there is no limit. + // Currency must match currency. + wallet_balance_limit_without_kyc?: AmountString[]; + + // Array of limits that apply to all accounts. + // All of the given limits will be hard limits. + // Wallets and merchants are expected to obey them + // and not even allow the user to cross them. + // Since protocol **v21**. + hard_limits: AccountLimit[]; + + // Array of limits with a soft threshold of zero + // that apply to all accounts without KYC. + // Wallets and merchants are expected to trigger + // a KYC process before attempting any zero-limited + // operations. + // Since protocol **v21**. + zero_limits: ZeroLimitedOperation[]; + + // Denominations offered by this exchange + denominations: DenomGroup[]; + + // Compact EdDSA signature (binary-only) over the + // contatentation of all of the master_sigs (in reverse + // chronological order by group) in the arrays under + // "denominations". Signature of TALER_ExchangeKeySetPS + exchange_sig: EddsaSignature; + + // Public EdDSA key of the exchange that was used to generate the signature. + // Should match one of the exchange's signing keys from signkeys. It is given + // explicitly as the client might otherwise be confused by clock skew as to + // which signing key was used for the exchange_sig. + exchange_pub: EddsaPublicKey; + + // Denominations for which the exchange currently offers/requests recoup. + recoup: Recoup[]; + + // Array of globally applicable fees by time range. + global_fees: GlobalFees[]; + + // The date when the denomination keys were last updated. + list_issue_date: Timestamp; + + // Auditors of the exchange. + auditors: AuditorKeys[]; + + // The exchange's signing keys. + signkeys: SignKey[]; + + // Optional field with a dictionary of (name, object) pairs defining the + // supported and enabled extensions, such as age_restriction. + extensions?: { name: ExtensionManifest }; + + // Signature by the exchange master key of the SHA-256 hash of the + // normalized JSON-object of field extensions, if it was set. + // The signature has purpose TALER_SIGNATURE_MASTER_EXTENSIONS. + extensions_sig?: EddsaSignature; +} + +export interface ZeroLimitedOperation { + // Operation that is limited to an amount of + // zero until the client has passed some KYC check. + // Must be one of "WITHDRAW", "DEPOSIT", + // (p2p) "MERGE", (wallet) "BALANCE", + // (reserve) "CLOSE", "AGGREGATE", + // "TRANSACTION" or "REFUND". + operation_type: string; } interface ExtensionManifest { @@ -2198,7 +2287,7 @@ export interface AggregateTransferFee { sig: EddsaSignatureString; } -interface ExchangePartner { +interface ExchangePartnerListEntry { // Base URL of the partner exchange. partner_base_url: string; @@ -2268,11 +2357,36 @@ export const codecForExchangeConfig = (): Codec<ExchangeVersionResponse> => .property("currency_specification", codecForCurrencySpecificiation()) .property("supported_kyc_requirements", codecForList(codecForString())) .build("TalerExchangeApi.ExchangeVersionResponse"); + +// FIXME: complete the codec to check for valid exchange response export const codecForExchangeKeys = (): Codec<ExchangeKeysResponse> => buildCodecForObject<ExchangeKeysResponse>() .property("version", codecForString()) .property("base_url", codecForString()) .property("currency", codecForString()) + .property("accounts", codecForAny()) + .property("asset_type", codecForAny()) + .property("auditors", codecForAny()) + .property("currency_specification", codecForAny()) + .property("zero_limits", codecForAny()) + .property("hard_limits", codecForAny()) + .property("denominations", codecForAny()) + .property("exchange_pub", codecForAny()) + .property("exchange_sig", codecForAny()) + .property("extensions", codecForAny()) + .property("extensions_sig", codecForAny()) + .property("global_fees", codecForAny()) + .property("list_issue_date", codecForAny()) + .property("master_public_key", codecForAny()) + .property("recoup", codecForAny()) + .property("reserve_closing_delay", codecForAny()) + .property("signkeys", codecForAny()) + .property("stefan_abs", codecForAny()) + .property("stefan_lin", codecForAny()) + .property("stefan_log", codecForAny()) + .property("wads", codecForAny()) + .property("wallet_balance_limit_without_kyc", codecForAny()) + .property("wire_fees", codecForAny()) .build("TalerExchangeApi.ExchangeKeysResponse"); export const codecForEventCounter = (): Codec<EventCounter> => @@ -2314,6 +2428,8 @@ export const codecForMeasureInformation = (): Codec<MeasureInformation> => .property("prog_name", codecForString()) .property("check_name", codecForString()) .property("context", codecForAny()) + .property("operation_type", codecOptional(codecForString())) + .property("voluntary", codecOptional(codecForBoolean())) .build("TalerExchangeApi.MeasureInformation"); // export const codecForAmlDecisionDetails = (): Codec<AmlDecisionDetails> => @@ -2345,7 +2461,7 @@ export const codecForAmlDecision = (): Codec<AmlDecision> => .property("rowid", codecForNumber()) .property("justification", codecOptional(codecForString())) .property("decision_time", codecForTimestamp) - .property("properties", codecForAccountProperties()) + .property("properties", codecOptional(codecForAccountProperties())) .property("limits", codecForLegitimizationRuleSet()) .property("to_investigate", codecForBoolean()) .property("is_active", codecForBoolean()) @@ -2359,6 +2475,7 @@ export const codecForAccountProperties = (): Codec<AccountProperties> => .property("business_domain", codecOptional(codecForString())) .property("is_frozen", codecOptional(codecForBoolean())) .property("was_reported", codecOptional(codecForBoolean())) + .allowExtra() .build("TalerExchangeApi.AccountProperties"); export const codecForLegitimizationRuleSet = (): Codec<LegitimizationRuleSet> => @@ -2409,6 +2526,7 @@ export const codecForLegitimizationNeededResponse = .property("h_payto", codecForString()) .property("account_pub", codecOptional(codecForString())) .property("requirement_row", codecForNumber()) + .property("bad_kyc_auth", codecOptional(codecForBoolean())) .build("TalerExchangeApi.LegitimizationNeededResponse"); export const codecForAccountKycStatus = (): Codec<AccountKycStatus> => @@ -2418,22 +2536,30 @@ export const codecForAccountKycStatus = (): Codec<AccountKycStatus> => .property("limits", codecOptional(codecForList(codecForAccountLimit()))) .build("TalerExchangeApi.AccountKycStatus"); +export const codecForOperationType = codecForEither( + codecForConstString("WITHDRAW"), + codecForConstString("DEPOSIT"), + codecForConstString("MERGE"), + codecForConstString("BALANCE"), + codecForConstString("CLOSE"), + codecForConstString("AGGREGATE"), + codecForConstString("TRANSACTION"), + codecForConstString("REFUND"), +); + export const codecForAccountLimit = (): Codec<AccountLimit> => buildCodecForObject<AccountLimit>() - .property( - "operation_type", - codecForEither( - codecForConstString("WITHDRAW"), - codecForConstString("DEPOSIT"), - codecForConstString("P2P-RECEIVE"), - codecForConstString("WALLET-BALANCE"), - ), - ) + .property("operation_type", codecForOperationType) .property("timeframe", codecForDuration) .property("threshold", codecForAmountString()) - .property("soft_limit", codecForBoolean()) + .property("soft_limit", codecOptional(codecForBoolean())) .build("TalerExchangeApi.AccountLimit"); +export const codecForZeroLimitedOperation = (): Codec<ZeroLimitedOperation> => + buildCodecForObject<ZeroLimitedOperation>() + .property("operation_type", codecForOperationType) + .build("TalerExchangeApi.ZeroLimitedOperation"); + export const codecForKycCheckPublicInformation = (): Codec<KycCheckPublicInformation> => buildCodecForObject<KycCheckPublicInformation>() @@ -2459,6 +2585,7 @@ export const codecForKycRequirementInformation = ), ) .property("description", codecForString()) + .property("context", codecOptional(codecForAny())) .property( "description_i18n", codecOptional(codecForInternationalizedString()), @@ -2493,3 +2620,325 @@ export const codecForKycProcessStartInformation = buildCodecForObject<KycProcessStartInformation>() .property("redirect_url", codecForURLString()) .build("TalerExchangeApi.KycProcessStartInformation"); + +export interface BatchWithdrawResponse { + // Array of blinded signatures, in the same order as was + // given in the request. + ev_sigs: WithdrawResponse[]; +} +export interface WithdrawResponse { + // The blinded signature over the 'coin_ev', affirms the coin's + // validity after unblinding. + ev_sig: BlindedDenominationSignature; +} +export type BlindedDenominationSignature = + | RsaBlindedDenominationSignature + | CSBlindedDenominationSignature; + +export interface RsaBlindedDenominationSignature { + cipher: DenomKeyType.Rsa; + + // (blinded) RSA signature + blinded_rsa_signature: BlindedRsaSignature; +} + +export interface CSBlindedDenominationSignature { + cipher: DenomKeyType.ClauseSchnorr; + + // Signer chosen bit value, 0 or 1, used + // in Clause Blind Schnorr to make the + // ROS problem harder. + b: Integer; + + // Blinded scalar calculated from c_b. + s: Cs25519Scalar; +} + +type BlindedRsaSignature = string; +type Cs25519Scalar = string; +type HashCode = string; +type EddsaSignature = string; +type EddsaPublicKey = string; +type Amount = AmountString; +type Base32 = string; + +export interface WithdrawError { + // Text describing the error. + hint: string; + + // Detailed error code. + code: Integer; + + // Amount left in the reserve. + balance: AmountString; + + // History of the reserve's activity, in the same format + // as returned by /reserve/$RID/history. + history: TransactionHistoryItem[]; +} +export type TransactionHistoryItem = + | AccountSetupTransaction + | ReserveWithdrawTransaction + | ReserveAgeWithdrawTransaction + | ReserveCreditTransaction + | ReserveClosingTransaction + | ReserveOpenRequestTransaction + | ReserveCloseRequestTransaction + | PurseMergeTransaction; + +enum TransactionHistoryType { + setup = "SETUP", + withdraw = "WITHDRAW", + ageWithdraw = "AGEWITHDRAW", + credit = "CREDIT", + closing = "CLOSING", + open = "OPEN", + close = "CLOSE", + merge = "MERGE", +} +interface AccountSetupTransaction { + type: TransactionHistoryType.setup; + + // Offset of this entry in the reserve history. + // Useful to request incremental histories via + // the "start" query parameter. + history_offset: Integer; + + // KYC fee agreed to by the reserve owner. + kyc_fee: AmountString; + + // Time when the KYC was triggered. + kyc_timestamp: Timestamp; + + // Hash of the wire details of the account. + // Note that this hash is unsalted and potentially + // private (as it could be inverted), hence access + // to this endpoint must be authorized using the + // private key of the reserve. + h_wire: HashCode; + + // Signature created with the reserve's private key. + // Must be of purpose TALER_SIGNATURE_ACCOUNT_SETUP_REQUEST over + // a TALER_AccountSetupRequestSignaturePS. + reserve_sig: EddsaSignature; +} +interface ReserveWithdrawTransaction { + type: "WITHDRAW"; + + // Offset of this entry in the reserve history. + // Useful to request incremental histories via + // the "start" query parameter. + history_offset: Integer; + + // Amount withdrawn. + amount: Amount; + + // Hash of the denomination public key of the coin. + h_denom_pub: HashCode; + + // Hash of the blinded coin to be signed. + h_coin_envelope: HashCode; + + // Signature over a TALER_WithdrawRequestPS + // with purpose TALER_SIGNATURE_WALLET_RESERVE_WITHDRAW + // created with the reserve's private key. + reserve_sig: EddsaSignature; + + // Fee that is charged for withdraw. + withdraw_fee: Amount; +} +interface ReserveAgeWithdrawTransaction { + type: "AGEWITHDRAW"; + + // Offset of this entry in the reserve history. + // Useful to request incremental histories via + // the "start" query parameter. + history_offset: Integer; + + // Total Amount withdrawn. + amount: Amount; + + // Commitment of all n*kappa blinded coins. + h_commitment: HashCode; + + // Signature over a TALER_AgeWithdrawRequestPS + // with purpose TALER_SIGNATURE_WALLET_RESERVE_AGE_WITHDRAW + // created with the reserve's private key. + reserve_sig: EddsaSignature; + + // Fee that is charged for withdraw. + withdraw_fee: Amount; +} +interface ReserveCreditTransaction { + type: "CREDIT"; + + // Offset of this entry in the reserve history. + // Useful to request incremental histories via + // the "start" query parameter. + history_offset: Integer; + + // Amount deposited. + amount: Amount; + + // Sender account payto:// URL. + sender_account_url: string; + + // Opaque identifier internal to the exchange that + // uniquely identifies the wire transfer that credited the reserve. + wire_reference: Integer; + + // Timestamp of the incoming wire transfer. + timestamp: Timestamp; +} +interface ReserveClosingTransaction { + type: "CLOSING"; + + // Offset of this entry in the reserve history. + // Useful to request incremental histories via + // the "start" query parameter. + history_offset: Integer; + + // Closing balance. + amount: Amount; + + // Closing fee charged by the exchange. + closing_fee: Amount; + + // Wire transfer subject. + wtid: Base32; + + // payto:// URI of the wire account into which the funds were returned to. + receiver_account_details: string; + + // This is a signature over a + // struct TALER_ReserveCloseConfirmationPS with purpose + // TALER_SIGNATURE_EXCHANGE_RESERVE_CLOSED. + exchange_sig: EddsaSignature; + + // Public key used to create 'exchange_sig'. + exchange_pub: EddsaPublicKey; + + // Time when the reserve was closed. + timestamp: Timestamp; +} +interface ReserveOpenRequestTransaction { + type: "OPEN"; + + // Offset of this entry in the reserve history. + // Useful to request incremental histories via + // the "start" query parameter. + history_offset: Integer; + + // Open fee paid from the reserve. + open_fee: Amount; + + // This is a signature over + // a struct TALER_ReserveOpenPS with purpose + // TALER_SIGNATURE_WALLET_RESERVE_OPEN. + reserve_sig: EddsaSignature; + + // Timestamp of the open request. + request_timestamp: Timestamp; + + // Requested expiration. + requested_expiration: Timestamp; + + // Requested number of free open purses. + requested_min_purses: Integer; +} +interface ReserveCloseRequestTransaction { + type: "CLOSE"; + + // Offset of this entry in the reserve history. + // Useful to request incremental histories via + // the "start" query parameter. + history_offset: Integer; + + // This is a signature over + // a struct TALER_ReserveClosePS with purpose + // TALER_SIGNATURE_WALLET_RESERVE_CLOSE. + reserve_sig: EddsaSignature; + + // Target account payto://, optional. + h_payto?: PaytoHash; + + // Timestamp of the close request. + request_timestamp: Timestamp; +} +interface PurseMergeTransaction { + type: "MERGE"; + + // Offset of this entry in the reserve history. + // Useful to request incremental histories via + // the "start" query parameter. + history_offset: Integer; + + // SHA-512 hash of the contact of the purse. + h_contract_terms: HashCode; + + // EdDSA public key used to approve merges of this purse. + merge_pub: EddsaPublicKey; + + // Minimum age required for all coins deposited into the purse. + min_age: Integer; + + // Number that identifies who created the purse + // and how it was paid for. + flags: Integer; + + // Purse public key. + purse_pub: EddsaPublicKey; + + // EdDSA signature of the account/reserve affirming the merge + // over a TALER_AccountMergeSignaturePS. + // Must be of purpose TALER_SIGNATURE_ACCOUNT_MERGE + reserve_sig: EddsaSignature; + + // Client-side timestamp of when the merge request was made. + merge_timestamp: Timestamp; + + // Indicative time by which the purse should expire + // if it has not been merged into an account. At this + // point, all of the deposits made should be + // auto-refunded. + purse_expiration: Timestamp; + + // Purse fee the reserve owner paid for the purse creation. + purse_fee: Amount; + + // Total amount merged into the reserve. + // (excludes fees). + amount: Amount; + + // True if the purse was actually merged. + // If false, only the purse_fee has an impact + // on the reserve balance! + merged: boolean; +} + +interface DenominationExpiredMessage { + // Taler error code. Note that beyond + // expiration this message format is also + // used if the key is not yet valid, or + // has been revoked. + code: number; + + // Signature by the exchange over a + // TALER_DenominationExpiredAffirmationPS. + // Must have purpose TALER_SIGNATURE_EXCHANGE_AFFIRM_DENOM_EXPIRED. + exchange_sig: EddsaSignature; + + // Public key of the exchange used to create + // the 'exchange_sig. + exchange_pub: EddsaPublicKey; + + // Hash of the denomination public key that is unknown. + h_denom_pub: HashCode; + + // When was the signature created. + timestamp: Timestamp; + + // What kind of operation was requested that now + // failed? + oper: string; +} diff --git a/packages/taler-util/src/types-taler-kyc-aml.ts b/packages/taler-util/src/types-taler-kyc-aml.ts new file mode 100644 index 000000000..d7be15408 --- /dev/null +++ b/packages/taler-util/src/types-taler-kyc-aml.ts @@ -0,0 +1,333 @@ +/* + This file is part of GNU Taler + (C) 2022-2024 Taler Systems S.A. + + GNU Taler is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ + +import { + buildCodecForObject, + Codec, + codecForAccountProperties, + codecForAny, + codecForList, +} from "./index.js"; +import { + AmountString, + Integer, + RelativeTime, + Timestamp, +} from "./types-taler-common.js"; + +// https://docs.taler.net/taler-kyc-manual.html#implementing-your-own-aml-programs + +export type AmlProgram = ( + input: AmlProgramInput | undefined, + config: string | undefined, +) => AmlOutcome; + +export type KycConverter = ( + input: object | undefined, + config: string | undefined, +) => object; + +export type AmlProgramParams = { + name: string; + debug?: boolean; + showVersion?: boolean; + showRequiredContext?: boolean; + showRequiredAttributes?: boolean; + showHelp?: boolean; + config?: string; +}; + +export type KycConverterParams = { + name: string; + debug?: boolean; + showVersion?: boolean; + showOutputs?: boolean; + showHelp?: boolean; + config?: string; +}; + +export type KycConverterDefinition = { + name: string; + logic: KycConverter; + outputs: string[]; +}; + +export type AmlProgramDefinition = { + name: string; + requiredContext: string[]; + requiredAttributes: string[]; + logic: AmlProgram; +}; + +export interface AmlProgramInput { + // JSON object that was provided as + // part of the *measure*. This JSON object is + // provided under "context" in the main JSON object + // input to the AML program. This "context" should + // satify both the REQUIRES clause of the respective + // check and the output of "-r" from the + // AML program's command-line option. + context?: any; + + // JSON object that captures the + // output of a [kyc-provider-] or (HTML) FORM. + // In the case of KYC data provided by providers, + // the keys in the JSON object will be the attribute + // names and the values must be strings representing + // the data. In the case of file uploads, the data + // MUST be base64-encoded. + // In the case of KYC data provided by HTML FORMs, the + // keys will match the HTML FORM field names and + // the values will use the KycStructuredFormData + // encoding. + attributes: any; + + // JSON array with the results of historic + // AML desisions about the account. + aml_history: AmlHistoryEntry[]; + + // JSON array with the results of historic + // KYC data about the account. + kyc_history: KycHistoryEntry[]; +} + +export interface AmlHistoryEntry { + // When was the AML decision taken. + decision_time: Timestamp; + + // What was the justification given for the decision. + justification: string; + + // Public key of the AML officer taking the decision. + decider_pub: string; + + // Properties associated with the account by the decision. + properties: Object; + + // New set of legitimization rules that was put in place. + new_rules: LegitimizationRuleSet; + + // True if the account was flagged for (further) + // investigation. + to_investigate: boolean; + + // True if this is the currently active decision. + is_active: boolean; +} +export interface KycHistoryEntry { + // Name of the provider + // which was used to collect the attributes. NULL if they were + // just uploaded via a form by the account owner. + provider_name?: string; + + // True if the KYC process completed. + finished: boolean; + + // Numeric error code, if the + // KYC process did not succeed; 0 on success. + code: number; + + // Human-readable description of code. Optional. + hint?: string; + + // Optional detail given when the KYC process failed. + error_message?: string; + + // Identifier of the user at the KYC provider. Optional. + provider_user_id?: string; + + // Identifier of the KYC process at the KYC provider. Optional. + provider_legitimization_id?: string; + + // The collected KYC data. + // NULL if the attribute data could not + // be decrypted or was not yet collected. + attributes?: Object; + + // Time when the KYC data was collected + collection_time: Timestamp; + + // Time when the KYC data will expire. + expiration_time: Timestamp; +} + +export interface AmlOutcome { + // Should the client's account be investigated + // by AML staff? + // Defaults to false. + to_investigate?: boolean; + + // Free-form properties about the account. + // Can be used to store properties such as PEP, + // risk category, type of business, hits on + // sanctions lists, etc. + properties?: AccountProperties; + + // Types of events to add to the KYC events table. + // (for statistics). + events?: string[]; + + // KYC rules to apply. Note that this + // overrides *all* of the default rules + // until the expiration_time and specifies + // the successor measure to apply after the + // expiration time. + new_rules: LegitimizationRuleSet; +} + +// All fields in this object are optional. The actual +// properties collected depend fully on the discretion +// of the exchange operator; +// however, some common fields are standardized +// and thus described here. +export interface AccountProperties { + // True if this is a politically exposed account. + // Rules for classifying accounts as politically + // exposed are country-dependent. + pep?: boolean; + + // True if this is a sanctioned account. + // Rules for classifying accounts as sanctioned + // are country-dependent. + sanctioned?: boolean; + + // True if this is a high-risk account. + // Rules for classifying accounts as at-risk + // are exchange operator-dependent. + high_risk?: boolean; + + // Business domain of the account owner. + // The list of possible business domains is + // operator- or country-dependent. + business_domain?: string; + + // Is the client's account currently frozen? + is_frozen?: boolean; + + // Was the client's account reported to the authorities? + was_reported?: boolean; + + [key: string]: string | boolean | number | undefined; +} + +export interface LegitimizationRuleSet { + // When does this set of rules expire and + // we automatically transition to the successor + // measure? + expiration_time: Timestamp; + + // Name of the measure to apply when the expiration time is + // reached. If not set, we refer to the default + // set of rules (and the default account state). + successor_measure?: string; + + // Legitimization rules that are to be applied + // to this account. + rules: KycRule[]; + + // Custom measures that KYC rules and the + new_check?: string; + // successor_measure may refer to. + custom_measures: { [measure: string]: MeasureInformation }; +} + +export interface KycRule { + // Type of operation to which the rule applies. + // + // Must be one of "WITHDRAW", "DEPOSIT", + // (p2p) "MERGE", (wallet) "BALANCE", + // (reserve) "CLOSE", "AGGREGATE", + // "TRANSACTION" or "REFUND". + operation_type: string; + + // The measures will be taken if the given + // threshold is crossed over the given timeframe. + threshold: AmountString; + + // Over which duration should the threshold be + // computed. All amounts of the respective + // operation_type will be added up for this + // duration and the sum compared to the threshold. + timeframe: RelativeTime; + + // Array of names of measures to apply. + // Names listed can be original measures or + // custom measures from the AmlOutcome. + // A special measure "verboten" is used if the + // threshold may never be crossed. + measures: string[]; + + // If multiple rules apply to the same account + // at the same time, the number with the highest + // rule determines which set of measures will + // be activated and thus become visible for the + // user. + display_priority: Integer; + + // True if the rule (specifically, operation_type, + // threshold, timeframe) and the general nature of + // the measures (verboten or approval required) + // should be exposed to the client. + // Defaults to "false" if not set. + exposed?: boolean; + + // True if all the measures will eventually need to + // be satisfied, false if any of the measures should + // do. Primarily used by the SPA to indicate how + // the measures apply when showing them to the user; + // in the end, AML programs will decide after each + // measure what to do next. + // Default (if missing) is false. + is_and_combinator?: boolean; +} + +export interface MeasureInformation { + // Name of a KYC check. + check_name: string; + + // Name of an AML program. + prog_name: string; + + // Context for the check. Optional. + context?: Object; + + // Operation that this measure relates to. + // NULL if unknown. Useful as a hint to the + // user if there are many (voluntary) measures + // and some related to unlocking certain operations. + // (and due to zero-amount thresholds, no measure + // was actually specifically triggered). + // + // Must be one of "WITHDRAW", "DEPOSIT", + // (p2p) "MERGE", (wallet) "BALANCE", + // (reserve) "CLOSE", "AGGREGATE", + // "TRANSACTION" or "REFUND". + // New in protocol **v21**. + operation_type?: string; + + // Can this measure be undertaken voluntarily? + // Optional, default is false. + // Since protocol **vATTEST**. + voluntary?: boolean; +} + +export const codecForAmlProgramInput = (): Codec<AmlProgramInput> => + buildCodecForObject<AmlProgramInput>() + .property("aml_history", codecForList(codecForAny())) + .property("kyc_history", codecForList(codecForAny())) + .property("attributes", codecForAccountProperties()) + .property("context", codecForAny()) + .build("AmlProgramInput"); diff --git a/packages/taler-util/src/types-taler-merchant.ts b/packages/taler-util/src/types-taler-merchant.ts index 58cac5e58..8931eba75 100644 --- a/packages/taler-util/src/types-taler-merchant.ts +++ b/packages/taler-util/src/types-taler-merchant.ts @@ -29,10 +29,12 @@ import { } from "./codec.js"; import { AccessToken, + AccountLimit, CoinEnvelope, ExchangeWireAccount, PaytoString, buildCodecForUnion, + codecForAccountLimit, codecForConstNumber, codecForConstString, codecForEither, @@ -67,6 +69,7 @@ import { RsaSignature, Timestamp, WireTransferIdentifierRawP, + codecForAccessToken, codecForCurrencySpecificiation, codecForInternationalizedString, codecForURLString, @@ -333,18 +336,6 @@ export interface MerchantAbortPayRefundSuccessStatus { exchange_pub: string; } -/** - * Information about an exchange as stored inside a - * merchant's contract terms. - */ -export interface ExchangeHandle { - // The exchange's base URL. - url: string; - - // Master public key of the exchange. - master_pub: EddsaPublicKeyString; -} - export interface AuditorHandle { /** * Official name of the auditor. @@ -529,7 +520,7 @@ export interface MerchantContractTerms { delivery_location?: Location; // Exchanges that the merchant accepts even if it does not accept any auditors that audit them. - exchanges: ExchangeHandle[]; + exchanges: Exchange[]; // List of products that are part of the purchase (see Product). products?: Product[]; @@ -665,12 +656,6 @@ export interface MerchantBlindSigWrapperV1 { blind_sig: string; } -export const codecForExchangeHandle = (): Codec<ExchangeHandle> => - buildCodecForObject<ExchangeHandle>() - .property("master_pub", codecForString()) - .property("url", codecForString()) - .build("ExchangeHandle"); - export const codecForAuditorHandle = (): Codec<AuditorHandle> => buildCodecForObject<AuditorHandle>() .property("name", codecForString()) @@ -725,7 +710,7 @@ export const codecForMerchantContractTerms = (): Codec<MerchantContractTerms> => .property("max_fee", codecForAmountString()) .property("merchant", codecForMerchantInfo()) .property("merchant_pub", codecForString()) - .property("exchanges", codecForList(codecForExchangeHandle())) + .property("exchanges", codecForList(codecForExchange())) .property("products", codecOptional(codecForList(codecForProduct()))) .property("extra", codecForAny()) .property("minimum_age", codecOptional(codecForNumber())) @@ -812,6 +797,13 @@ export interface PaymentResponse { // payment. pos_confirmation?: string; } +export interface PaymentDeniedLegallyResponse { + // Base URL of the exchanges that denied the payment. + // The wallet should refresh the coins from these + // exchanges, but may try to pay with coins from + // other exchanges. + exchange_base_urls: string[]; +} export interface PaymentStatusRequestParams { // Hash of the order’s contract terms (this is used to @@ -1321,31 +1313,73 @@ export interface QueryInstancesResponse { method: "external" | "token"; }; } - -export interface AccountKycRedirects { - // Array of pending KYCs. - pending_kycs: MerchantAccountKycRedirect[]; - - // Array of exchanges with no reply. - timeout_kycs: ExchangeKycTimeout[]; +export interface MerchantAccountKycRedirectsResponse { + // Array of KYC status information for + // the exchanges and bank accounts selected + // by the query. + kyc_data: MerchantAccountKycRedirect[]; } export interface MerchantAccountKycRedirect { - // URL that the user should open in a browser to - // proceed with the KYC process (as returned - // by the exchange's /kyc-check/ endpoint). - // Optional, missing if the account is blocked - // due to AML and not due to KYC. - kyc_url?: string; - - // AML status of the account. - aml_status: Integer; + // Our bank wire account this is about. + payto_uri: string; // Base URL of the exchange this is about. exchange_url: string; - // Our bank wire account this is about. - payto_uri: PaytoString; + // HTTP status code returned by the exchange when we asked for + // information about the KYC status. + // Since protocol **v17**. + exchange_http_status: number; + + // Set to true if we did not get a /keys response from + // the exchange and thus cannot do certain checks, such as + // determining default account limits or account eligibility. + no_keys: boolean; + + // Set to true if the given account cannot to KYC at the + // given exchange because no wire method exists that could + // be used to do the KYC auth wire transfer. + auth_conflict: boolean; + + // Numeric error code indicating errors the exchange + // returned, or TALER_EC_INVALID for none. + // Optional (as there may not always have + // been an error code). Since protocol **v17**. + exchange_code?: number; + + // Access token needed to open the KYC SPA and/or + // access the /kyc-info/ endpoint. + access_token?: AccessToken; + + // Array with limitations that currently apply to this + // account and that may be increased or lifted if the + // KYC check is passed. + // Note that additional limits *may* exist and not be + // communicated to the client. If such limits are + // reached, this *may* be indicated by the account + // going into aml_review state. However, it is + // also possible that the exchange may legally have + // to deny operations without being allowed to provide + // any justification. + // The limits should be used by the client to + // possibly structure their operations (e.g. withdraw + // what is possible below the limit, ask the user to + // pass KYC checks or withdraw the rest after the time + // limit is passed, warn the user to not withdraw too + // much or even prevent the user from generating a + // request that would cause it to exceed hard limits). + limits?: AccountLimit[]; + + // Array of wire transfer instructions (including + // optional amount and subject) for a KYC auth wire + // transfer. Set only if this is required + // to get the given exchange working. + // Array because the exchange may have multiple + // bank accounts, in which case any of these + // accounts will do. + // Optional. Since protocol **v17**. + payto_kycauths?: string[]; } export interface ExchangeKycTimeout { @@ -1380,7 +1414,8 @@ export interface AccountAddDetails { export type FacadeCredentials = | NoFacadeCredentials - | BasicAuthFacadeCredentials; + | BasicAuthFacadeCredentials + | BearerAuthFacadeCredentials; export interface NoFacadeCredentials { type: "none"; @@ -1396,6 +1431,13 @@ export interface BasicAuthFacadeCredentials { password: string; } +export interface BearerAuthFacadeCredentials { + type: "bearer"; + + // token to use to authenticate + token: string; +} + export interface AccountAddResponse { // Hash over the wire details (including over the salt). h_wire: HashCode; @@ -1491,7 +1533,6 @@ export interface CategoryProductList { export interface ProductSummary { // Product ID to use. product_id: string; - } export interface CategoryCreateRequest { @@ -2648,6 +2689,7 @@ export interface Tax { // Amount paid in tax. tax: AmountString; } + export interface Merchant { // The merchant's legal name of business. name: string; @@ -2668,6 +2710,7 @@ export interface Merchant { // Some of the typical fields for a location (such as a street address) may be absent. jurisdiction?: Location; } + // Delivery location, loosely modeled as a subset of // ISO20022's PostalAddress25. export interface Location { @@ -2702,16 +2745,7 @@ export interface Location { // Free-form address lines, should not exceed 7 elements. address_lines?: string[]; } -interface Auditor { - // Official name. - name: string; - - // Auditor's public key. - auditor_pub: EddsaPublicKey; - // Base URL of the auditor. - url: string; -} export interface Exchange { // The exchange's base URL. url: string; @@ -2823,6 +2857,12 @@ export const codecForPaymentResponse = (): Codec<PaymentResponse> => .property("sig", codecForString()) .build("TalerMerchantApi.PaymentResponse"); +export const codecForPaymentDeniedLegallyResponse = + (): Codec<PaymentDeniedLegallyResponse> => + buildCodecForObject<PaymentDeniedLegallyResponse>() + .property("exchange_base_urls", codecForList(codecForString())) + .build("TalerMerchantApi.PaymentDeniedLegallyResponse"); + export const codecForStatusPaid = (): Codec<StatusPaid> => buildCodecForObject<StatusPaid>() .property("refund_amount", codecForAmountString()) @@ -2955,23 +2995,25 @@ export const codecForQueryInstancesResponse = ) .build("TalerMerchantApi.QueryInstancesResponse"); -export const codecForAccountKycRedirects = (): Codec<AccountKycRedirects> => - buildCodecForObject<AccountKycRedirects>() - .property( - "pending_kycs", - codecForList(codecForMerchantAccountKycRedirect()), - ) - .property("timeout_kycs", codecForList(codecForExchangeKycTimeout())) +export const codecForAccountKycRedirects = + (): Codec<MerchantAccountKycRedirectsResponse> => + buildCodecForObject<MerchantAccountKycRedirectsResponse>() + .property("kyc_data", codecForList(codecForMerchantAccountKycRedirect())) - .build("TalerMerchantApi.AccountKycRedirects"); + .build("TalerMerchantApi.MerchantAccountKycRedirectsResponse"); export const codecForMerchantAccountKycRedirect = (): Codec<MerchantAccountKycRedirect> => buildCodecForObject<MerchantAccountKycRedirect>() - .property("kyc_url", codecForURLString()) - .property("aml_status", codecForNumber()) - .property("exchange_url", codecForURLString()) .property("payto_uri", codecForPaytoString()) + .property("exchange_url", codecForURLString()) + .property("exchange_http_status", codecForNumber()) + .property("no_keys", codecForBoolean()) + .property("auth_conflict", codecForBoolean()) + .property("exchange_code", codecOptional(codecForNumber())) + .property("access_token", codecOptional(codecForAccessToken())) + .property("limits", codecOptional(codecForList(codecForAccountLimit()))) + .property("payto_kycauths", codecOptional(codecForList(codecForString()))) .build("TalerMerchantApi.MerchantAccountKycRedirect"); export const codecForExchangeKycTimeout = (): Codec<ExchangeKycTimeout> => diff --git a/packages/taler-util/src/types-taler-revenue.ts b/packages/taler-util/src/types-taler-revenue.ts index 772871d19..89fb0f224 100644 --- a/packages/taler-util/src/types-taler-revenue.ts +++ b/packages/taler-util/src/types-taler-revenue.ts @@ -17,7 +17,15 @@ */ import { codecForAmountString } from "./amounts.js"; -import { Codec, buildCodecForObject, codecForConstString, codecForList, codecForNumber, codecForString, codecOptional } from "./codec.js"; +import { + Codec, + buildCodecForObject, + codecForConstString, + codecForList, + codecForNumber, + codecForString, + codecOptional, +} from "./codec.js"; import { codecForPaytoString } from "./payto.js"; import { codecForTimestamp } from "./time.js"; import { AmountString, SafeUint64, Timestamp } from "./types-taler-common.js"; @@ -87,9 +95,9 @@ export const codecForRevenueIncomingHistory = export const codecForRevenueIncomingBankTransaction = (): Codec<RevenueIncomingBankTransaction> => buildCodecForObject<RevenueIncomingBankTransaction>() - .property("amount", codecForAmountString()) + .property("row_id", codecForNumber()) .property("date", codecForTimestamp) + .property("amount", codecForAmountString()) .property("debit_account", codecForPaytoString()) - .property("row_id", codecForNumber()) .property("subject", codecForString()) .build("TalerRevenueApi.RevenueIncomingBankTransaction"); diff --git a/packages/taler-util/src/types-taler-wallet-transactions.ts b/packages/taler-util/src/types-taler-wallet-transactions.ts index 018c3a041..67f03ba17 100644 --- a/packages/taler-util/src/types-taler-wallet-transactions.ts +++ b/packages/taler-util/src/types-taler-wallet-transactions.ts @@ -34,6 +34,7 @@ import { codecForConstString, codecForEither, codecForList, + codecForNumber, codecForString, codecOptional, } from "./codec.js"; @@ -41,6 +42,7 @@ import { TalerPreciseTimestamp, TalerProtocolDuration, TalerProtocolTimestamp, + codecForPreciseTimestamp, } from "./time.js"; import { AmountString, @@ -98,6 +100,58 @@ export interface TransactionsRequest { filterByState?: TransactionStateFilter; } +export interface GetTransactionsV2Request { + /** + * Return only transactions in the given currency. + */ + currency?: string; + + /** + * Return only transactions in the given scopeInfo + */ + scopeInfo?: ScopeInfo; + + /** + * If true, include all refreshes in the transactions list. + */ + includeRefreshes?: boolean; + + /** + * Only return transactions before/after this offset. + */ + offsetTransactionId?: TransactionIdStr; + + /** + * Only return transactions before/after the transaction with this + * timestamp. + * + * Used as a fallback if the offsetTransactionId was deleted. + */ + offsetTimestamp?: TalerPreciseTimestamp; + + /** + * Number of transactions to return. + * + * When the limit is positive, results are returned + * in ascending order of their timestamp. If no offset is specified, + * the result list begins with the first transaction. + * If an offset is specified, transactions after the offset are returned. + * + * When the limit is negative, results are returned + * in descending order of their timestamp. If no offset is specified, + * the result list begins with with the last transaction. + * If an offset is specified, transactions before the offset are returned. + */ + limit?: number; + + /** + * Filter transactions by their state / state category. + * + * If not specified, all transactions are returned. + */ + filterByState?: "final" | "nonfinal" | "done"; +} + export interface TransactionState { major: TransactionMajorState; minor?: TransactionMinorState; @@ -129,6 +183,8 @@ export enum TransactionMinorState { KycRequired = "kyc", MergeKycRequired = "merge-kyc", BalanceKycRequired = "balance-kyc", + BalanceKycInit = "balance-kyc-init", + KycAuthRequired = "kyc-auth", Track = "track", SubmitPayment = "submit-payment", RebindSession = "rebind-session", @@ -217,6 +273,10 @@ export interface TransactionCommon { error?: TalerErrorDetail; + abortReason?: TalerErrorDetail; + + failReason?: TalerErrorDetail; + /** * If the transaction minor state is in KycRequired this field is going to * have the location where the user need to go to complete KYC information. @@ -232,6 +292,28 @@ export interface TransactionCommon { * KYC access token. Useful for testing, not so useful for UIs. */ kycAccessToken?: string; + + kycAuthTransferInfo?: KycAuthTransferInfo; +} + +export interface KycAuthTransferInfo { + /** + * Payto URI of the account that must make the transfer. + * + * The KYC auth transfer will *not* work if it originates + * from a different account. + */ + debitPaytoUri: string; + + /** + * Account public key that must be included in the subject. + */ + accountPub: string; + + /** + * Possible target payto URIs. + */ + creditPaytoUris: string[]; } export type Transaction = @@ -765,6 +847,30 @@ export const codecForTransactionByIdRequest = .property("transactionId", codecForString()) .build("TransactionByIdRequest"); +export const codecForGetTransactionsV2Request = + (): Codec<GetTransactionsV2Request> => + buildCodecForObject<GetTransactionsV2Request>() + .property("currency", codecOptional(codecForString())) + .property("scopeInfo", codecOptional(codecForScopeInfo())) + .property( + "offsetTransactionId", + codecOptional(codecForString() as Codec<TransactionIdStr>), + ) + .property("offsetTimestamp", codecOptional(codecForPreciseTimestamp)) + .property("limit", codecOptional(codecForNumber())) + .property( + "filterByState", + codecOptional( + codecForEither( + codecForConstString("final"), + codecForConstString("nonfinal"), + codecForConstString("done"), + ), + ), + ) + .property("includeRefreshes", codecOptional(codecForBoolean())) + .build("GetTransactionsV2Request"); + export const codecForTransactionsRequest = (): Codec<TransactionsRequest> => buildCodecForObject<TransactionsRequest>() .property("currency", codecOptional(codecForString())) diff --git a/packages/taler-util/src/types-taler-wallet.ts b/packages/taler-util/src/types-taler-wallet.ts index 31ade3d3d..8a4de2b32 100644 --- a/packages/taler-util/src/types-taler-wallet.ts +++ b/packages/taler-util/src/types-taler-wallet.ts @@ -57,7 +57,6 @@ import { WithdrawalOperationStatus, canonicalizeBaseUrl, } from "./index.js"; -import { VersionMatchResult } from "./libtool-version.js"; import { PaytoString, PaytoUri, codecForPaytoString } from "./payto.js"; import { QrCodeSpec } from "./qr.js"; import { AgeCommitmentProof } from "./taler-crypto.js"; @@ -90,11 +89,7 @@ import { codecForMerchantContractTerms, } from "./types-taler-merchant.js"; import { BackupRecovery } from "./types-taler-sync.js"; -import { - OrderShortInfo, - TransactionState, - TransactionType, -} from "./types-taler-wallet-transactions.js"; +import { TransactionState } from "./types-taler-wallet-transactions.js"; /** * Identifier for a transaction in the wallet. @@ -177,6 +172,14 @@ export function codecForCanonBaseUrl(): Codec<string> { }; } +export const codecForScopeInfo = (): Codec<ScopeInfo> => + buildCodecForUnion<ScopeInfo>() + .discriminateOn("type") + .alternative(ScopeType.Global, codecForScopeInfoGlobal()) + .alternative(ScopeType.Exchange, codecForScopeInfoExchange()) + .alternative(ScopeType.Auditor, codecForScopeInfoAuditor()) + .build("ScopeInfo"); + /** * Response for the create reserve request to the wallet. */ @@ -215,22 +218,6 @@ export enum TransactionAmountMode { Raw = "raw", } -export type GetPlanForOperationRequest = - | GetPlanForWithdrawRequest - | GetPlanForDepositRequest; -// | GetPlanForPushDebitRequest -// | GetPlanForPullCreditRequest -// | GetPlanForPaymentRequest -// | GetPlanForTipRequest -// | GetPlanForRefundRequest -// | GetPlanForPullDebitRequest -// | GetPlanForPushCreditRequest; - -interface GetPlanForWalletInitiatedOperation { - instructedAmount: AmountString; - mode: TransactionAmountMode; -} - export interface ConvertAmountRequest { amount: AmountString; type: TransactionAmountMode; @@ -250,148 +237,45 @@ export const codecForConvertAmountRequest = ) .build("ConvertAmountRequest"); -export interface GetAmountRequest { +export interface GetMaxDepositAmountRequest { currency: string; + depositPaytoUri?: string; } -export const codecForGetAmountRequest = buildCodecForObject<GetAmountRequest>() - .property("currency", codecForString()) - .build("GetAmountRequest"); - -interface GetPlanToCompleteOperation { - instructedAmount: AmountString; -} - -const codecForGetPlanForWalletInitiatedOperation = < - T extends GetPlanForWalletInitiatedOperation, ->() => - buildCodecForObject<T>() - .property( - "mode", - codecForEither( - codecForConstString(TransactionAmountMode.Raw), - codecForConstString(TransactionAmountMode.Effective), - ), - ) - .property("instructedAmount", codecForAmountString()); - -interface GetPlanForWithdrawRequest extends GetPlanForWalletInitiatedOperation { - type: TransactionType.Withdrawal; - exchangeUrl?: string; -} -interface GetPlanForDepositRequest extends GetPlanForWalletInitiatedOperation { - type: TransactionType.Deposit; - account: string; //payto string -} -interface GetPlanForPushDebitRequest - extends GetPlanForWalletInitiatedOperation { - type: TransactionType.PeerPushDebit; -} - -interface GetPlanForPullCreditRequest - extends GetPlanForWalletInitiatedOperation { - type: TransactionType.PeerPullCredit; - exchangeUrl: string; -} - -const codecForGetPlanForWithdrawRequest = - codecForGetPlanForWalletInitiatedOperation<GetPlanForWithdrawRequest>() - .property("type", codecForConstString(TransactionType.Withdrawal)) - .property("exchangeUrl", codecOptional(codecForString())) - .build("GetPlanForWithdrawRequest"); - -const codecForGetPlanForDepositRequest = - codecForGetPlanForWalletInitiatedOperation<GetPlanForDepositRequest>() - .property("type", codecForConstString(TransactionType.Deposit)) - .property("account", codecForString()) - .build("GetPlanForDepositRequest"); - -const codecForGetPlanForPushDebitRequest = - codecForGetPlanForWalletInitiatedOperation<GetPlanForPushDebitRequest>() - .property("type", codecForConstString(TransactionType.PeerPushDebit)) - .build("GetPlanForPushDebitRequest"); - -const codecForGetPlanForPullCreditRequest = - codecForGetPlanForWalletInitiatedOperation<GetPlanForPullCreditRequest>() - .property("type", codecForConstString(TransactionType.PeerPullCredit)) - .property("exchangeUrl", codecForString()) - .build("GetPlanForPullCreditRequest"); +export const codecForGetMaxDepositAmountRequest = + buildCodecForObject<GetMaxDepositAmountRequest>() + .property("currency", codecForString()) + .property("depositPaytoUri", codecOptional(codecForString())) + .build("GetAmountRequest"); -interface GetPlanForPaymentRequest extends GetPlanToCompleteOperation { - type: TransactionType.Payment; - wireMethod: string; - ageRestriction: number; - maxDepositFee: AmountString; +export interface GetMaxPeerPushDebitAmountRequest { + currency: string; + /** + * Preferred exchange to use for the p2p payment. + */ + exchangeBaseUrl?: string; + restrictScope?: ScopeInfo; } -interface GetPlanForPullDebitRequest extends GetPlanToCompleteOperation { - type: TransactionType.PeerPullDebit; -} +export const codecForGetMaxPeerPushDebitAmountRequest = + (): Codec<GetMaxPeerPushDebitAmountRequest> => + buildCodecForObject<GetMaxPeerPushDebitAmountRequest>() + .property("currency", codecForString()) + .property("exchangeBaseUrl", codecOptional(codecForString())) + .property("restrictScope", codecOptional(codecForScopeInfo())) + .build("GetMaxPeerPushDebitRequest"); -interface GetPlanForPushCreditRequest extends GetPlanToCompleteOperation { - type: TransactionType.PeerPushCredit; +export interface GetMaxDepositAmountResponse { + effectiveAmount: AmountString; + rawAmount: AmountString; } -const codecForGetPlanForPaymentRequest = - buildCodecForObject<GetPlanForPaymentRequest>() - .property("type", codecForConstString(TransactionType.Payment)) - .property("maxDepositFee", codecForAmountString()) - .build("GetPlanForPaymentRequest"); - -const codecForGetPlanForPullDebitRequest = - buildCodecForObject<GetPlanForPullDebitRequest>() - .property("type", codecForConstString(TransactionType.PeerPullDebit)) - .build("GetPlanForPullDebitRequest"); - -const codecForGetPlanForPushCreditRequest = - buildCodecForObject<GetPlanForPushCreditRequest>() - .property("type", codecForConstString(TransactionType.PeerPushCredit)) - .build("GetPlanForPushCreditRequest"); - -export const codecForGetPlanForOperationRequest = - (): Codec<GetPlanForOperationRequest> => - buildCodecForUnion<GetPlanForOperationRequest>() - .discriminateOn("type") - .alternative( - TransactionType.Withdrawal, - codecForGetPlanForWithdrawRequest, - ) - .alternative(TransactionType.Deposit, codecForGetPlanForDepositRequest) - // .alternative( - // TransactionType.PeerPushDebit, - // codecForGetPlanForPushDebitRequest, - // ) - // .alternative( - // TransactionType.PeerPullCredit, - // codecForGetPlanForPullCreditRequest, - // ) - // .alternative(TransactionType.Payment, codecForGetPlanForPaymentRequest) - // .alternative( - // TransactionType.PeerPullDebit, - // codecForGetPlanForPullDebitRequest, - // ) - // .alternative( - // TransactionType.PeerPushCredit, - // codecForGetPlanForPushCreditRequest, - // ) - .build("GetPlanForOperationRequest"); - -export interface GetPlanForOperationResponse { +export interface GetMaxPeerPushDebitAmountResponse { effectiveAmount: AmountString; rawAmount: AmountString; - counterPartyAmount?: AmountString; - details: any; + exchangeBaseUrl?: string; } -export const codecForGetPlanForOperationResponse = - (): Codec<GetPlanForOperationResponse> => - buildCodecForObject<GetPlanForOperationResponse>() - .property("effectiveAmount", codecForAmountString()) - .property("rawAmount", codecForAmountString()) - .property("details", codecForAny()) - .property("counterPartyAmount", codecOptional(codecForAmountString())) - .build("GetPlanForOperationResponse"); - export interface AmountResponse { effectiveAmount: AmountString; rawAmount: AmountString; @@ -454,14 +338,6 @@ export const codecForScopeInfoAuditor = (): Codec<ScopeInfoAuditor> => .property("url", codecForString()) .build("ScopeInfoAuditor"); -export const codecForScopeInfo = (): Codec<ScopeInfo> => - buildCodecForUnion<ScopeInfo>() - .discriminateOn("type") - .alternative(ScopeType.Global, codecForScopeInfoGlobal()) - .alternative(ScopeType.Exchange, codecForScopeInfoExchange()) - .alternative(ScopeType.Auditor, codecForScopeInfoAuditor()) - .build("ScopeInfo"); - export interface GetCurrencySpecificationRequest { scope: ScopeInfo; } @@ -472,16 +348,6 @@ export const codecForGetCurrencyInfoRequest = .property("scope", codecForScopeInfo()) .build("GetCurrencySpecificationRequest"); -export interface ListExchangesForScopedCurrencyRequest { - scope: ScopeInfo; -} - -export const codecForListExchangesForScopedCurrencyRequest = - (): Codec<ListExchangesForScopedCurrencyRequest> => - buildCodecForObject<ListExchangesForScopedCurrencyRequest>() - .property("scope", codecForScopeInfo()) - .build("ListExchangesForScopedCurrencyRequest"); - export interface GetCurrencySpecificationResponse { currencySpecification: CurrencySpecification; } @@ -836,39 +702,6 @@ export interface SenderWireInfos { senderWires: string[]; } -/** - * Request to mark a reserve as confirmed. - */ -export interface ConfirmReserveRequest { - /** - * Public key of then reserve that should be marked - * as confirmed. - */ - reservePub: string; -} - -export const codecForConfirmReserveRequest = (): Codec<ConfirmReserveRequest> => - buildCodecForObject<ConfirmReserveRequest>() - .property("reservePub", codecForString()) - .build("ConfirmReserveRequest"); - -export interface PrepareRefundResult { - proposalId: string; - - effectivePaid: AmountString; - gone: AmountString; - granted: AmountString; - pending: boolean; - awaiting: AmountString; - - info: OrderShortInfo; -} - -export interface BenchmarkResult { - time: { [s: string]: number }; - repetitions: number; -} - export enum PreparePayResultType { PaymentPossible = "payment-possible", InsufficientBalance = "insufficient-balance", @@ -882,8 +715,8 @@ export const codecForPreparePayResultPaymentPossible = .property("amountRaw", codecForAmountString()) .property("contractTerms", codecForMerchantContractTerms()) .property("transactionId", codecForTransactionIdStr()) - .property("proposalId", codecForString()) .property("contractTermsHash", codecForString()) + .property("scopes", codecForList(codecForScopeInfo())) .property("talerUri", codecForString()) .property( "status", @@ -973,12 +806,12 @@ export const codecForPreparePayResultInsufficientBalance = .property("amountRaw", codecForAmountString()) .property("contractTerms", codecForAny()) .property("talerUri", codecForString()) - .property("proposalId", codecForString()) .property("transactionId", codecForTransactionIdStr()) .property( "status", codecForConstString(PreparePayResultType.InsufficientBalance), ) + .property("scopes", codecForList(codecForScopeInfo())) .property( "balanceDetails", codecForPayMerchantInsufficientBalanceDetails(), @@ -994,12 +827,12 @@ export const codecForPreparePayResultAlreadyConfirmed = ) .property("amountEffective", codecOptional(codecForAmountString())) .property("amountRaw", codecForAmountString()) + .property("scopes", codecForList(codecForScopeInfo())) .property("paid", codecForBoolean()) .property("talerUri", codecForString()) .property("contractTerms", codecForAny()) .property("contractTermsHash", codecForString()) .property("transactionId", codecForTransactionIdStr()) - .property("proposalId", codecForString()) .build("PreparePayResultAlreadyConfirmed"); export const codecForPreparePayResult = (): Codec<PreparePayResult> => @@ -1032,43 +865,72 @@ export type PreparePayResult = */ export interface PreparePayResultPaymentPossible { status: PreparePayResultType.PaymentPossible; + transactionId: TransactionIdStr; + + contractTerms: MerchantContractTerms; + /** - * @deprecated use transactionId instead + * Scopes involved in this transaction. */ - proposalId: string; - contractTerms: MerchantContractTerms; - contractTermsHash: string; + scopes: ScopeInfo[]; + amountRaw: AmountString; + amountEffective: AmountString; + + /** + * FIXME: Unclear why this is needed. Remove? + */ + contractTermsHash: string; + + /** + * FIXME: Unclear why this is needed! Remove? + */ talerUri: string; } export interface PreparePayResultInsufficientBalance { status: PreparePayResultType.InsufficientBalance; transactionId: TransactionIdStr; + /** - * @deprecated use transactionId + * Scopes involved in this transaction. + * + * For the insufficient balance response, contains scopes + * of *possible* payment providers. */ - proposalId: string; + scopes: ScopeInfo[]; + contractTerms: MerchantContractTerms; + amountRaw: AmountString; + talerUri: string; + balanceDetails: PaymentInsufficientBalanceDetails; } export interface PreparePayResultAlreadyConfirmed { status: PreparePayResultType.AlreadyConfirmed; + transactionId: TransactionIdStr; + contractTerms: MerchantContractTerms; + paid: boolean; + amountRaw: AmountString; + amountEffective: AmountString | undefined; - contractTermsHash: string; + /** - * @deprecated use transactionId + * Scopes involved in this transaction. */ - proposalId: string; + scopes: ScopeInfo[]; + + contractTermsHash: string; + talerUri: string; } @@ -1212,6 +1074,24 @@ export interface ExchangesListResponse { exchanges: ExchangeListItem[]; } +export interface ListExchangesRequest { + /** + * Filter results to only include exchanges in the given scope. + */ + filterByScope?: ScopeInfo; + + filterByExchangeEntryStatus?: ExchangeEntryStatus; +} + +export const codecForListExchangesRequest = (): Codec<ListExchangesRequest> => + buildCodecForObject<ListExchangesRequest>() + .property("filterByScope", codecOptional(codecForScopeInfo())) + .property( + "filterByExchangeEntryStatus", + codecOptional(codecForExchangeEntryStatus()), + ) + .build("ListExchangesRequest"); + export interface ExchangeDetailedResponse { exchange: ExchangeFullDetails; } @@ -1435,6 +1315,13 @@ export enum ExchangeEntryStatus { Used = "used", } +export const codecForExchangeEntryStatus = (): Codec<ExchangeEntryStatus> => + codecForEither( + codecForConstString(ExchangeEntryStatus.Ephemeral), + codecForConstString(ExchangeEntryStatus.Preset), + codecForConstString(ExchangeEntryStatus.Used), + ); + export enum ExchangeUpdateStatus { Initial = "initial", InitialUpdate = "initial-update", @@ -1604,12 +1491,9 @@ export interface AcceptManualWithdrawalResult { export interface WithdrawalDetailsForAmount { /** - * Did the user accept the current version of the exchange's - * terms of service? - * - * @deprecated the client should query the exchange entry instead + * Exchange base URL for the withdrawal. */ - tosAccepted: boolean; + exchangeBaseUrl: string; /** * Amount that the user will transfer to the exchange. @@ -1629,13 +1513,6 @@ export interface WithdrawalDetailsForAmount { numCoins: number; /** - * Ways to pay the exchange. - * - * @deprecated in favor of withdrawalAccountsList - */ - paytoUris: string[]; - - /** * Ways to pay the exchange, including accounts that require currency conversion. */ withdrawalAccountsList: WithdrawalExchangeAccountDetails[]; @@ -1650,6 +1527,35 @@ export interface WithdrawalDetailsForAmount { * Scope info of the currency withdrawn. */ scopeInfo: ScopeInfo; + + /** + * KYC soft limit. + * + * Withdrawals over that amount will require KYC. + */ + kycSoftLimit?: AmountString; + + /** + * KYC soft limits. + * + * Withdrawals over that amount will be denied. + */ + kycHardLimit?: AmountString; + + /** + * Ways to pay the exchange. + * + * @deprecated in favor of withdrawalAccountsList + */ + paytoUris: string[]; + + /** + * Did the user accept the current version of the exchange's + * terms of service? + * + * @deprecated the client should query the exchange entry instead + */ + tosAccepted: boolean; } export interface DenomSelItem { @@ -1663,13 +1569,12 @@ export interface DenomSelItem { } /** - * Selected denominations withn some extra info. + * Selected denominations with some extra info. */ export interface DenomSelectionState { totalCoinValue: AmountString; totalWithdrawCost: AmountString; selectedDenoms: DenomSelItem[]; - earliestDepositExpiration: TalerProtocolTimestamp; hasDenomWithAgeRestriction: boolean; } @@ -1699,30 +1604,6 @@ export interface ExchangeWithdrawalDetails { termsOfServiceAccepted: boolean; /** - * The earliest deposit expiration of the selected coins. - */ - earliestDepositExpiration: TalerProtocolTimestamp; - - /** - * Result of checking the wallet's version - * against the exchange's version. - * - * Older exchanges don't return version information. - */ - versionMatch: VersionMatchResult | undefined; - - /** - * Libtool-style version string for the exchange or "unknown" - * for older exchanges. - */ - exchangeVersion: string; - - /** - * Libtool-style version string for the wallet. - */ - walletVersion: string; - - /** * Amount that will be subtracted from the reserve's balance. */ withdrawalAmountRaw: AmountString; @@ -1740,6 +1621,20 @@ export interface ExchangeWithdrawalDetails { ageRestrictionOptions?: number[]; scopeInfo: ScopeInfo; + + /** + * KYC soft limit. + * + * Withdrawals over that amount will require KYC. + */ + kycSoftLimit?: AmountString; + + /** + * KYC soft limits. + * + * Withdrawals over that amount will be denied. + */ + kycHardLimit?: AmountString; } export interface GetExchangeTosResult { @@ -1942,8 +1837,17 @@ export const codecForAcceptManualWithdrawalRequest = .build("AcceptManualWithdrawalRequest"); export interface GetWithdrawalDetailsForAmountRequest { - exchangeBaseUrl: string; + exchangeBaseUrl?: string; + + /** + * Specify currency scope for the withdrawal. + * + * May only be used when exchangeBaseUrl is not specified. + */ + restrictScope?: ScopeInfo; + amount: AmountString; + restrictAge?: number; /** @@ -2020,7 +1924,8 @@ export const codecForAcceptBankIntegratedWithdrawalRequest = export const codecForGetWithdrawalDetailsForAmountRequest = (): Codec<GetWithdrawalDetailsForAmountRequest> => buildCodecForObject<GetWithdrawalDetailsForAmountRequest>() - .property("exchangeBaseUrl", codecForCanonBaseUrl()) + .property("exchangeBaseUrl", codecOptional(codecForCanonBaseUrl())) + .property("restrictScope", codecOptional(codecForScopeInfo())) .property("amount", codecForAmountString()) .property("restrictAge", codecOptional(codecForNumber())) .property("clientCancellationId", codecOptional(codecForString())) @@ -2113,26 +2018,14 @@ export const codecForForgetKnownBankAccounts = .property("payto", codecForString()) .build("ForgetKnownBankAccountsRequest"); -export interface AbortProposalRequest { - proposalId: string; -} - -export const codecForAbortProposalRequest = (): Codec<AbortProposalRequest> => - buildCodecForObject<AbortProposalRequest>() - .property("proposalId", codecForString()) - .build("AbortProposalRequest"); - export interface GetContractTermsDetailsRequest { - // @deprecated use transaction id - proposalId?: string; - transactionId?: string; + transactionId: string; } export const codecForGetContractTermsDetails = (): Codec<GetContractTermsDetailsRequest> => buildCodecForObject<GetContractTermsDetailsRequest>() - .property("proposalId", codecOptional(codecForString())) - .property("transactionId", codecOptional(codecForString())) + .property("transactionId", codecForString()) .build("GetContractTermsDetails"); export interface PreparePayRequest { @@ -2190,19 +2083,14 @@ export const codecForPreparePayTemplateRequest = .build("PreparePayTemplate"); export interface ConfirmPayRequest { - /** - * @deprecated use transactionId instead - */ - proposalId?: string; - transactionId?: TransactionIdStr; + transactionId: TransactionIdStr; sessionId?: string; forcedCoinSel?: ForcedCoinSel; } export const codecForConfirmPayRequest = (): Codec<ConfirmPayRequest> => buildCodecForObject<ConfirmPayRequest>() - .property("proposalId", codecOptional(codecForString())) - .property("transactionId", codecOptional(codecForTransactionIdStr())) + .property("transactionId", codecForTransactionIdStr()) .property("sessionId", codecOptional(codecForString())) .property("forcedCoinSel", codecForAny()) .build("ConfirmPay"); @@ -2437,7 +2325,7 @@ export interface CreateDepositGroupRequest { amount: AmountString; } -export interface PrepareDepositRequest { +export interface CheckDepositRequest { /** * Payto URI to identify the (bank) account that the exchange will wire * the money to. @@ -2465,17 +2353,25 @@ export interface PrepareDepositRequest { clientCancellationId?: string; } -export const codecForPrepareDepositRequest = (): Codec<PrepareDepositRequest> => - buildCodecForObject<PrepareDepositRequest>() +export const codecForCheckDepositRequest = (): Codec<CheckDepositRequest> => + buildCodecForObject<CheckDepositRequest>() .property("amount", codecForAmountString()) .property("depositPaytoUri", codecForString()) .property("clientCancellationId", codecOptional(codecForString())) - .build("PrepareDepositRequest"); + .build("CheckDepositRequest"); -export interface PrepareDepositResponse { +export interface CheckDepositResponse { totalDepositCost: AmountString; effectiveDepositAmount: AmountString; fees: DepositGroupFees; + + kycSoftLimit?: AmountString; + kycHardLimit?: AmountString; + + /** + * Base URL of exchanges that would likely require soft KYC. + */ + kycExchanges?: string[]; } export const codecForCreateDepositGroupRequest = @@ -2861,6 +2757,11 @@ export interface PayCoinSelection { * How much of the deposit fees is the customer paying? */ customerDepositFees: AmountString; + + /** + * How much of the deposit fees does the exchange charge in total? + */ + totalDepositFees: AmountString; } export interface ProspectivePayCoinSelection { @@ -2891,6 +2792,12 @@ export interface CheckPeerPushDebitRequest { amount: AmountString; /** + * Restrict the scope of funds that can be spent via the given + * scope info. + */ + restrictScope?: ScopeInfo; + + /** * ID provided by the client to cancel the request. * * If the same request is made again with the same clientCancellationId, @@ -2908,14 +2815,21 @@ export const codecForCheckPeerPushDebitRequest = (): Codec<CheckPeerPushDebitRequest> => buildCodecForObject<CheckPeerPushDebitRequest>() .property("exchangeBaseUrl", codecOptional(codecForCanonBaseUrl())) + .property("restrictScope", codecOptional(codecForScopeInfo())) .property("amount", codecForAmountString()) .property("clientCancellationId", codecOptional(codecForString())) .build("CheckPeerPushDebitRequest"); export interface CheckPeerPushDebitResponse { amountRaw: AmountString; + amountEffective: AmountString; + + /** + * Exchange base URL. + */ exchangeBaseUrl: string; + /** * Maximum expiration date, based on how close the coins * used for the payment are to expiry. @@ -2930,6 +2844,13 @@ export interface CheckPeerPushDebitResponse { export interface InitiatePeerPushDebitRequest { exchangeBaseUrl?: string; + + /** + * Restrict the scope of funds that can be spent via the given + * scope info. + */ + restrictScope?: ScopeInfo; + partialContractTerms: PeerContractTerms; } @@ -2964,10 +2885,7 @@ export interface PreparePeerPushCreditResponse { exchangeBaseUrl: string; - /** - * @deprecated use transaction ID instead. - */ - peerPushCreditId: string; + scopeInfo: ScopeInfo; /** * @deprecated @@ -2977,17 +2895,20 @@ export interface PreparePeerPushCreditResponse { export interface PreparePeerPullDebitResponse { contractTerms: PeerContractTerms; - /** - * @deprecated Redundant field with bad name, will be removed soon. - */ - amount: AmountString; amountRaw: AmountString; amountEffective: AmountString; - peerPullDebitId: string; - transactionId: TransactionIdStr; + + exchangeBaseUrl: string; + + scopeInfo: ScopeInfo; + + /** + * @deprecated Redundant field with bad name, will be removed soon. + */ + amount: AmountString; } export const codecForPreparePeerPushCreditRequest = @@ -3040,7 +2961,13 @@ export const codecForAcceptPeerPullPaymentRequest = .build("ConfirmPeerPullDebitRequest"); export interface CheckPeerPullCreditRequest { + /** + * Require using this particular exchange for this operation. + */ exchangeBaseUrl?: string; + + restrictScope?: ScopeInfo; + amount: AmountString; /** @@ -3062,6 +2989,7 @@ export const codecForPreparePeerPullPaymentRequest = buildCodecForObject<CheckPeerPullCreditRequest>() .property("amount", codecForAmountString()) .property("exchangeBaseUrl", codecOptional(codecForCanonBaseUrl())) + .property("restrictScope", codecOptional(codecForScopeInfo())) .property("clientCancellationId", codecOptional(codecForString())) .build("CheckPeerPullCreditRequest"); @@ -3231,7 +3159,7 @@ export interface TestingWaitExchangeStateRequest { export interface TestingWaitTransactionRequest { transactionId: TransactionIdStr; - txState: TransactionState; + txState: TransactionState | TransactionState[]; } export interface TestingGetReserveHistoryRequest { @@ -3565,7 +3493,25 @@ export const codecForGetDepositWireTypesForCurrencyRequest = * enter their payment information. */ export interface GetDepositWireTypesForCurrencyResponse { + /** + * @deprecated, use wireTypeDetails instead. + */ wireTypes: string[]; + + /** + * Details for each wire type. + */ + wireTypeDetails: WireTypeDetails[]; +} + +export interface WireTypeDetails { + paymentTargetType: string; + + /** + * Allowed hostnames for the deposit payto URI. + * Only applicable to x-taler-bank. + */ + talerBankHostnames?: string[]; } export interface GetQrCodesForPaytoRequest { diff --git a/packages/taler-util/src/types-taler-wire-gateway.ts b/packages/taler-util/src/types-taler-wire-gateway.ts index fd1eb7263..2c0333409 100644 --- a/packages/taler-util/src/types-taler-wire-gateway.ts +++ b/packages/taler-util/src/types-taler-wire-gateway.ts @@ -23,9 +23,12 @@ import { buildCodecForUnion, codecForAmountString, codecForConstString, + codecForEither, codecForList, codecForNumber, codecForString, + codecForStringURL, + codecOptional, } from "./index.js"; import { PaytoString, codecForPaytoString } from "./payto.js"; import { codecForTimestamp } from "./time.js"; @@ -55,7 +58,7 @@ export interface TransferResponse { export interface TransferRequest { // Nonce to make the request idempotent. Requests with the same - // transaction_uid that differ in any of the other fields + // request_uid that differ in any of the other fields // are rejected. request_uid: HashCode; @@ -90,6 +93,7 @@ export interface IncomingHistory { // Union discriminated by the "type" field. export type IncomingBankTransaction = + | IncomingKycAuthTransaction | IncomingReserveTransaction | IncomingWadTransaction; @@ -112,6 +116,25 @@ export interface IncomingReserveTransaction { reserve_pub: EddsaPublicKey; } +export interface IncomingKycAuthTransaction { + type: "KYCAUTH"; + + // Opaque identifier of the returned record. + row_id: SafeUint64; + + // Date of the transaction. + date: Timestamp; + + // Amount transferred. + amount: AmountString; + + // Payto URI to identify the sender of funds. + debit_account: PaytoString; + + // The reserve public key extracted from the transaction details. + account_pub: EddsaPublicKey; +} + export interface IncomingWadTransaction { type: "WAD"; @@ -124,10 +147,6 @@ export interface IncomingWadTransaction { // Amount transferred. amount: AmountString; - // Payto URI to identify the receiver of funds. - // This must be one of the exchange's bank accounts. - credit_account: PaytoString; - // Payto URI to identify the sender of funds. debit_account: PaytoString; @@ -186,6 +205,22 @@ export interface AddIncomingRequest { debit_account: PaytoString; } +export interface AddKycauthRequest { + // Amount to transfer. + amount: AmountString; + + // Account public key that is included in the wire transfer details + // to associate this key with the originating bank account. + account_pub: EddsaPublicKey; + + // Account (as payto URI) that makes the wire transfer to the exchange. + // Usually this account must be created by the test harness before this + // API is used. An exception is the "fakebank", where any debit account + // can be specified, as it is automatically created. + debit_account: string; +} + + export interface AddIncomingResponse { // Timestamp that indicates when the wire transfer will be executed. // In cases where the wire transfer gateway is unable to know when @@ -200,6 +235,87 @@ export interface AddIncomingResponse { row_id: SafeUint64; } +export interface BankWireTransferList { + // Array of initiated transfers. + transfers: BankWireTransferListStatus[]; + + // Payto URI to identify the sender of funds. + // This must be one of the exchange's bank accounts. + // Credit account is shared by all incoming transactions + // as per the nature of the request. + debit_account: string; +} + +export type WireTransferStatus = + | "pending" + | "transient_failure" + | "permanent_failure" + | "success"; + +export interface BankWireTransferListStatus { + // Opaque ID of the wire transfer initiation performed by the bank. + // It is different from the /history endpoints row_id. + row_id: SafeUint64; + + // Current status of the transfer + // pending: the transfer is in progress + // transient_failure: the transfer has failed but may succeed later + // permanent_failure: the transfer has failed permanently and will never appear in the outgoing history + // success: the transfer has succeeded and appears in the outgoing history + status: WireTransferStatus; + + // Amount to transfer. + amount: AmountString; + + // The recipient's account identifier as a payto URI. + credit_account: string; + + // Timestamp that indicates when the wire transfer was executed. + // In cases where the wire transfer gateway is unable to know when + // the wire transfer will be executed, the time at which the request + // has been received and stored will be returned. + // The purpose of this field is for debugging (humans trying to find + // the transaction) as well as for taxation (determining which + // time period a transaction belongs to). + timestamp: Timestamp; +} + +export interface BankWireTransferStatus { + // Current status of the transfer + // pending: the transfer is in progress + // transient_failure: the transfer has failed but may succeed later + // permanent_failure: the transfer has failed permanently and will never appear in the outgoing history + // success: the transfer has succeeded and appears in the outgoing history + status: WireTransferStatus; + + // Optional unstructured messages about the transfer's status. Can be used to document the reasons for failure or the state of progress. + status_msg?: string; + + // Amount to transfer. + amount: AmountString; + + // Base URL of the exchange. Shall be included by the bank gateway + // in the appropriate section of the wire transfer details. + exchange_base_url: string; + + // Wire transfer identifier chosen by the exchange, + // used by the merchant to identify the Taler order(s) + // associated with this wire transfer. + wtid: ShortHashCode; + + // The recipient's account identifier as a payto URI. + credit_account: string; + + // Timestamp that indicates when the wire transfer was executed. + // In cases where the wire transfer gateway is unable to know when + // the wire transfer will be executed, the time at which the request + // has been received and stored will be returned. + // The purpose of this field is for debugging (humans trying to find + // the transaction) as well as for taxation (determining which + // time period a transaction belongs to). + timestamp: Timestamp; +} + export const codecForTransferResponse = (): Codec<TalerWireGatewayApi.TransferResponse> => buildCodecForObject<TalerWireGatewayApi.TransferResponse>() @@ -222,6 +338,7 @@ export const codecForIncomingBankTransaction = buildCodecForUnion<TalerWireGatewayApi.IncomingBankTransaction>() .discriminateOn("type") .alternative("RESERVE", codecForIncomingReserveTransaction()) + .alternative("KYCAUTH", codecForIncomingKycAuthTransaction()) .alternative("WAD", codecForIncomingWadTransaction()) .build("TalerWireGatewayApi.IncomingBankTransaction"); @@ -236,11 +353,21 @@ export const codecForIncomingReserveTransaction = .property("type", codecForConstString("RESERVE")) .build("TalerWireGatewayApi.IncomingReserveTransaction"); +export const codecForIncomingKycAuthTransaction = + (): Codec<TalerWireGatewayApi.IncomingKycAuthTransaction> => + buildCodecForObject<TalerWireGatewayApi.IncomingKycAuthTransaction>() + .property("amount", codecForAmountString()) + .property("date", codecForTimestamp) + .property("debit_account", codecForPaytoString()) + .property("account_pub", codecForString()) + .property("row_id", codecForNumber()) + .property("type", codecForConstString("KYCAUTH")) + .build("TalerWireGatewayApi.IncomingKycAuthTransaction"); + export const codecForIncomingWadTransaction = (): Codec<TalerWireGatewayApi.IncomingWadTransaction> => buildCodecForObject<TalerWireGatewayApi.IncomingWadTransaction>() .property("amount", codecForAmountString()) - .property("credit_account", codecForPaytoString()) .property("date", codecForTimestamp) .property("debit_account", codecForPaytoString()) .property("origin_exchange_url", codecForString()) @@ -262,12 +389,12 @@ export const codecForOutgoingHistory = export const codecForOutgoingBankTransaction = (): Codec<TalerWireGatewayApi.OutgoingBankTransaction> => buildCodecForObject<TalerWireGatewayApi.OutgoingBankTransaction>() + .property("row_id", codecForNumber()) + .property("date", codecForTimestamp) .property("amount", codecForAmountString()) .property("credit_account", codecForPaytoString()) - .property("date", codecForTimestamp) - .property("exchange_base_url", codecForString()) - .property("row_id", codecForNumber()) .property("wtid", codecForString()) + .property("exchange_base_url", codecForString()) .build("TalerWireGatewayApi.OutgoingBankTransaction"); export const codecForAddIncomingResponse = @@ -276,3 +403,48 @@ export const codecForAddIncomingResponse = .property("row_id", codecForNumber()) .property("timestamp", codecForTimestamp) .build("TalerWireGatewayApi.AddIncomingResponse"); + +export const codecForBankWireTransferList = + (): Codec<TalerWireGatewayApi.BankWireTransferList> => + buildCodecForObject<TalerWireGatewayApi.BankWireTransferList>() + .property("debit_account", codecForPaytoString()) + .property("transfers", codecForList(codecForBankWireTransferListStatus())) + .build("TalerWireGatewayApi.BankWireTransferList"); + +export const codecForBankWireTransferStatus = + (): Codec<TalerWireGatewayApi.BankWireTransferStatus> => + buildCodecForObject<TalerWireGatewayApi.BankWireTransferStatus>() + .property( + "status", + codecForEither( + codecForConstString("pending"), + codecForConstString("transient_failure"), + codecForConstString("permanent_failure"), + codecForConstString("success"), + ), + ) + .property("status_msg", codecOptional(codecForString())) + .property("amount", codecForAmountString()) + .property("exchange_base_url", codecForStringURL()) + .property("wtid", codecForString()) + .property("credit_account", codecForPaytoString()) + .property("timestamp", codecForTimestamp) + .build("TalerWireGatewayApi.BankWireTransferStatus"); + +export const codecForBankWireTransferListStatus = + (): Codec<TalerWireGatewayApi.BankWireTransferListStatus> => + buildCodecForObject<TalerWireGatewayApi.BankWireTransferListStatus>() + .property("row_id", codecForNumber()) + .property( + "status", + codecForEither( + codecForConstString("pending"), + codecForConstString("transient_failure"), + codecForConstString("permanent_failure"), + codecForConstString("success"), + ), + ) + .property("amount", codecForAmountString()) + .property("credit_account", codecForPaytoString()) + .property("timestamp", codecForTimestamp) + .build("TalerWireGatewayApi.BankWireTransferListStatus"); diff --git a/packages/taler-util/src/types.test.ts b/packages/taler-util/src/types.test.ts index ed55fd16c..bea352128 100644 --- a/packages/taler-util/src/types.test.ts +++ b/packages/taler-util/src/types.test.ts @@ -15,15 +15,14 @@ */ import test from "ava"; -import { codecForContractTerms } from "./index.js"; +import { codecForContractTerms, MerchantContractTerms } from "./index.js"; test("contract terms validation", (t) => { const c = { nonce: "123123123", h_wire: "123", amount: "EUR:1.5", - auditors: [], - exchanges: [{ master_pub: "foo", url: "foo" }], + exchanges: [{ master_pub: "foo", priority: 1, url: "foo" }], fulfillment_url: "foo", max_fee: "EUR:1.5", merchant_pub: "12345", @@ -37,7 +36,7 @@ test("contract terms validation", (t) => { summary: "hello", timestamp: { t_s: 42 }, wire_method: "test", - }; + } satisfies MerchantContractTerms; codecForContractTerms().decode(c); @@ -59,8 +58,7 @@ test("contract terms validation (locations)", (t) => { nonce: "123123123", h_wire: "123", amount: "EUR:1.5", - auditors: [], - exchanges: [{ master_pub: "foo", url: "foo" }], + exchanges: [{ master_pub: "foo", priority: 1, url: "foo" }], fulfillment_url: "foo", max_fee: "EUR:1.5", merchant_pub: "12345", @@ -83,7 +81,7 @@ test("contract terms validation (locations)", (t) => { country: "FR", town: "Rennes", }, - }; + } satisfies MerchantContractTerms; const r = codecForContractTerms().decode(c); |