summaryrefslogtreecommitdiff
path: root/bank/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'bank/index.js')
-rw-r--r--bank/index.js310
1 files changed, 161 insertions, 149 deletions
diff --git a/bank/index.js b/bank/index.js
index 080c97a90..12b751512 100644
--- a/bank/index.js
+++ b/bank/index.js
@@ -9880,6 +9880,16 @@ function codecOptional(innerCodec) {
}
};
}
+function codecOptionalDefault(innerCodec, def) {
+ return {
+ decode(x5, c4) {
+ if (x5 === void 0 || x5 === null) {
+ return def;
+ }
+ return innerCodec.decode(x5, c4);
+ }
+ };
+}
function codecForEither(...alts) {
return {
decode(x5, c4) {
@@ -9898,6 +9908,9 @@ function codecForEither(...alts) {
};
}
+// ../taler-util/lib/taler-crypto.js
+var import_big_integer = __toESM(require_BigInteger(), 1);
+
// ../taler-util/lib/sha256.js
var digestLength = 32;
var blockSize = 64;
@@ -10182,9 +10195,6 @@ function hmacSha256(key, message) {
return hmac(sha256, 64, key, message);
}
-// ../taler-util/lib/taler-crypto.js
-var import_big_integer = __toESM(require_BigInteger(), 1);
-
// ../taler-util/lib/time.js
var opaque_AbsoluteTime = Symbol("opaque_AbsoluteTime");
var TalerPreciseTimestamp;
@@ -10918,6 +10928,7 @@ var TalerSignaturePurpose;
(function(TalerSignaturePurpose2) {
TalerSignaturePurpose2[TalerSignaturePurpose2["MERCHANT_TRACK_TRANSACTION"] = 1103] = "MERCHANT_TRACK_TRANSACTION";
TalerSignaturePurpose2[TalerSignaturePurpose2["WALLET_RESERVE_WITHDRAW"] = 1200] = "WALLET_RESERVE_WITHDRAW";
+ TalerSignaturePurpose2[TalerSignaturePurpose2["WALLET_RESERVE_HISTORY"] = 1208] = "WALLET_RESERVE_HISTORY";
TalerSignaturePurpose2[TalerSignaturePurpose2["WALLET_COIN_DEPOSIT"] = 1201] = "WALLET_COIN_DEPOSIT";
TalerSignaturePurpose2[TalerSignaturePurpose2["GLOBAL_FEES"] = 1022] = "GLOBAL_FEES";
TalerSignaturePurpose2[TalerSignaturePurpose2["MASTER_DENOMINATION_KEY_VALIDITY"] = 1025] = "MASTER_DENOMINATION_KEY_VALIDITY";
@@ -12059,8 +12070,7 @@ function parsePayTemplateUri(uriString) {
return {
type: TalerUriAction.PayTemplate,
merchantBaseUrl,
- templateId,
- templateParams: params
+ templateId
};
}
function parsePayPushUri(s5) {
@@ -12116,7 +12126,10 @@ function parseWithdrawExchangeUri(s5) {
return void 0;
}
const host = parts[0].toLowerCase();
- const exchangePub = parts.length > 1 ? parts[parts.length - 1] : void 0;
+ const lastPathComponent = parts.length > 1 ? parts[parts.length - 1] : void 0;
+ if (lastPathComponent) {
+ return void 0;
+ }
const pathSegments = parts.slice(1, parts.length - 1);
const hostAndSegments = [host, ...pathSegments].join("/");
const exchangeBaseUrl = canonicalizeBaseUrl(`${pi.innerProto}://${hostAndSegments}/`);
@@ -12125,7 +12138,6 @@ function parseWithdrawExchangeUri(s5) {
return {
type: TalerUriAction.WithdrawExchange,
exchangeBaseUrl,
- exchangePub: exchangePub != "" ? exchangePub : void 0,
amount
};
}
@@ -12206,11 +12218,11 @@ function stringifyRestoreUri({ providers, walletRootPriv }) {
const list = providers.map((url) => `${encodeURIComponent(new URL2(url).href)}`).join(",");
return `taler://restore/${walletRootPriv}/${list}`;
}
-function stringifyWithdrawExchange({ exchangeBaseUrl, exchangePub, amount }) {
+function stringifyWithdrawExchange({ exchangeBaseUrl, amount }) {
const { proto, path, query } = getUrlInfo(exchangeBaseUrl, {
a: amount
});
- return `${proto}://withdraw-exchange/${path}${exchangePub ?? ""}${query}`;
+ return `${proto}://withdraw-exchange/${path}${query}`;
}
function stringifyAddExchange({ exchangeBaseUrl }) {
const { proto, path } = getUrlInfo(exchangeBaseUrl);
@@ -12219,8 +12231,8 @@ function stringifyAddExchange({ exchangeBaseUrl }) {
function stringifyDevExperimentUri({ devExperimentId }) {
return `taler://dev-experiment/${devExperimentId}`;
}
-function stringifyPayTemplateUri({ merchantBaseUrl, templateId, templateParams }) {
- const { proto, path, query } = getUrlInfo(merchantBaseUrl, templateParams);
+function stringifyPayTemplateUri({ merchantBaseUrl, templateId }) {
+ const { proto, path, query } = getUrlInfo(merchantBaseUrl);
return `${proto}://pay-template/${path}${templateId}${query}`;
}
function stringifyRefundUri({ merchantBaseUrl, orderId }) {
@@ -12271,7 +12283,7 @@ var codecForAccessToken = codecForString;
var codecForTokenSuccessResponse = () => buildCodecForObject().property("access_token", codecForAccessToken()).property("expiration", codecForTimestamp).build("TalerAuthentication.TokenSuccessResponse");
var codecForTokenSuccessResponseMerchant = () => buildCodecForObject().property("token", codecForAccessToken()).property("expiration", codecForTimestamp).build("TalerAuthentication.TokenSuccessResponseMerchant");
var codecForCurrencySpecificiation = () => buildCodecForObject().property("name", codecForString()).property("num_fractional_input_digits", codecForNumber()).property("num_fractional_normal_digits", codecForNumber()).property("num_fractional_trailing_zero_digits", codecForNumber()).property("alt_unit_names", codecForMap(codecForString())).build("CurrencySpecification");
-var codecForCoreBankConfig = () => buildCodecForObject().property("name", codecForConstString("libeufin-bank")).property("version", codecForString()).property("bank_name", codecForString()).property("base_url", codecForString()).property("allow_conversion", codecForBoolean()).property("allow_registrations", codecForBoolean()).property("allow_deletions", codecForBoolean()).property("allow_edit_name", codecForBoolean()).property("allow_edit_cashout_payto_uri", codecForBoolean()).property("default_debit_threshold", codecForAmountString()).property("currency", codecForString()).property("currency_specification", codecForCurrencySpecificiation()).property("supported_tan_channels", codecForList(codecForEither(codecForConstString(TalerCorebankApi.TanChannel.SMS), codecForConstString(TalerCorebankApi.TanChannel.EMAIL)))).property("wire_type", codecForString()).build("TalerCorebankApi.Config");
+var codecForCoreBankConfig = () => buildCodecForObject().property("name", codecForConstString("libeufin-bank")).property("version", codecForString()).property("bank_name", codecForString()).property("base_url", codecOptional(codecForString())).property("allow_conversion", codecForBoolean()).property("allow_registrations", codecForBoolean()).property("allow_deletions", codecForBoolean()).property("allow_edit_name", codecForBoolean()).property("allow_edit_cashout_payto_uri", codecForBoolean()).property("default_debit_threshold", codecForAmountString()).property("currency", codecForString()).property("currency_specification", codecForCurrencySpecificiation()).property("supported_tan_channels", codecForList(codecForEither(codecForConstString(TalerCorebankApi.TanChannel.SMS), codecForConstString(TalerCorebankApi.TanChannel.EMAIL)))).property("wire_type", codecOptionalDefault(codecForString(), "iban")).build("TalerCorebankApi.Config");
var codecForBalance = () => buildCodecForObject().property("amount", codecForAmountString()).property("credit_debit_indicator", codecForEither(codecForConstString("credit"), codecForConstString("debit"))).build("TalerCorebankApi.Balance");
var codecForPublicAccount = () => buildCodecForObject().property("username", codecForString()).property("balance", codecForBalance()).property("payto_uri", codecForPaytoString()).property("is_taler_exchange", codecForBoolean()).property("row_id", codecOptional(codecForNumber())).build("TalerCorebankApi.PublicAccount");
var codecForPublicAccountsResponse = () => buildCodecForObject().property("public_accounts", codecForList(codecForPublicAccount())).build("TalerCorebankApi.PublicAccountsResponse");
@@ -12860,6 +12872,127 @@ var fnutil;
fnutil2.any = any;
})(fnutil || (fnutil = {}));
+// ../taler-util/lib/http-client/utils.js
+function makeBearerTokenAuthHeader(token) {
+ return `Bearer ${token}`;
+}
+function addPaginationParams(url, pagination) {
+ 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);
+ url.searchParams.set("delta", String(order * limit));
+}
+function addLongPollingParam(url, param) {
+ if (!param)
+ return;
+ if (param.timeoutMs) {
+ url.searchParams.set("long_poll_ms", String(param.timeoutMs));
+ }
+}
+var nullEvictor = {
+ notifySuccess: () => Promise.resolve()
+};
+var IdempotencyRetry = class _IdempotencyRetry {
+ constructor(timesLeft, maxTimesLeft) {
+ this.timesLeft = timesLeft;
+ this.maxTries = maxTimesLeft;
+ this.uid = encodeCrock(getRandomBytes(32));
+ }
+ static tryFiveTimes() {
+ return new _IdempotencyRetry(5, 5);
+ }
+ next() {
+ const left = this.timesLeft - 1;
+ if (left <= 0) {
+ return void 0;
+ }
+ return new _IdempotencyRetry(left, this.maxTries);
+ }
+};
+
+// ../taler-util/lib/http-client/authentication.js
+var TalerAuthenticationHttpClient = class {
+ constructor(baseUrl, httpClient) {
+ this.baseUrl = baseUrl;
+ this.PROTOCOL_VERSION = "0:0:0";
+ this.httpLib = httpClient ?? createPlatformHttpLib();
+ }
+ isCompatible(version) {
+ const compare2 = LibtoolVersion.compare(this.PROTOCOL_VERSION, version);
+ return compare2?.compatible ?? false;
+ }
+ /**
+ * https://docs.taler.net/core/api-corebank.html#post--accounts-$USERNAME-token
+ *
+ * @returns
+ */
+ async createAccessTokenBasic(username, password, body) {
+ const url = new URL(`token`, this.baseUrl);
+ const resp = await this.httpLib.fetch(url.href, {
+ method: "POST",
+ headers: {
+ Authorization: makeBasicAuthHeader(username, password)
+ },
+ body
+ });
+ switch (resp.status) {
+ case HttpStatusCode.Ok:
+ return opSuccessFromHttp(resp, codecForTokenSuccessResponse());
+ 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, body) {
+ 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, codecForTokenSuccessResponseMerchant());
+ case HttpStatusCode.Unauthorized:
+ return opKnownHttpFailure(resp.status, resp);
+ case HttpStatusCode.NotFound:
+ return opKnownHttpFailure(resp.status, resp);
+ default:
+ return opUnknownFailure(resp, await readTalerErrorResponse(resp));
+ }
+ }
+ async deleteAccessToken(token) {
+ const url = new URL(`token`, this.baseUrl);
+ const resp = await this.httpLib.fetch(url.href, {
+ method: "DELETE",
+ headers: {
+ Authorization: makeBearerTokenAuthHeader(token)
+ }
+ });
+ switch (resp.status) {
+ case HttpStatusCode.Ok:
+ return opEmptySuccess(resp);
+ case HttpStatusCode.NotFound:
+ return opKnownHttpFailure(resp.status, resp);
+ default:
+ return opUnknownFailure(resp, await readTalerErrorResponse(resp));
+ }
+ }
+};
+
// ../taler-util/lib/transactions-types.js
var TransactionMajorState;
(function(TransactionMajorState2) {
@@ -13095,48 +13228,6 @@ var ProviderPaymentType;
ProviderPaymentType2["TermsChanged"] = "terms-changed";
})(ProviderPaymentType || (ProviderPaymentType = {}));
-// ../taler-util/lib/http-client/utils.js
-function makeBearerTokenAuthHeader(token) {
- return `Bearer ${token}`;
-}
-function addPaginationParams(url, pagination) {
- 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);
- url.searchParams.set("delta", String(order * limit));
-}
-function addLongPollingParam(url, param) {
- if (!param)
- return;
- if (param.timeoutMs) {
- url.searchParams.set("long_poll_ms", String(param.timeoutMs));
- }
-}
-var nullEvictor = {
- notifySuccess: () => Promise.resolve()
-};
-var IdempotencyRetry = class _IdempotencyRetry {
- constructor(timesLeft, maxTimesLeft) {
- this.timesLeft = timesLeft;
- this.maxTries = maxTimesLeft;
- this.uid = encodeCrock(getRandomBytes(32));
- }
- static tryFiveTimes() {
- return new _IdempotencyRetry(5, 5);
- }
- next() {
- const left = this.timesLeft - 1;
- if (left <= 0) {
- return void 0;
- }
- return new _IdempotencyRetry(left, this.maxTries);
- }
-};
-
// ../taler-util/lib/http-client/bank-conversion.js
var TalerBankConversionCacheEviction;
(function(TalerBankConversionCacheEviction2) {
@@ -13279,85 +13370,6 @@ var TalerBankConversionHttpClient = class {
}
};
-// ../taler-util/lib/http-client/authentication.js
-var TalerAuthenticationHttpClient = class {
- constructor(baseUrl, httpClient) {
- this.baseUrl = baseUrl;
- this.PROTOCOL_VERSION = "0:0:0";
- this.httpLib = httpClient ?? createPlatformHttpLib();
- }
- isCompatible(version) {
- const compare2 = LibtoolVersion.compare(this.PROTOCOL_VERSION, version);
- return compare2?.compatible ?? false;
- }
- /**
- * https://docs.taler.net/core/api-corebank.html#post--accounts-$USERNAME-token
- *
- * @returns
- */
- async createAccessTokenBasic(username, password, body) {
- const url = new URL(`token`, this.baseUrl);
- const resp = await this.httpLib.fetch(url.href, {
- method: "POST",
- headers: {
- Authorization: makeBasicAuthHeader(username, password)
- },
- body
- });
- switch (resp.status) {
- case HttpStatusCode.Ok:
- return opSuccessFromHttp(resp, codecForTokenSuccessResponse());
- 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, body) {
- 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, codecForTokenSuccessResponseMerchant());
- case HttpStatusCode.Unauthorized:
- return opKnownHttpFailure(resp.status, resp);
- case HttpStatusCode.NotFound:
- return opKnownHttpFailure(resp.status, resp);
- default:
- return opUnknownFailure(resp, await readTalerErrorResponse(resp));
- }
- }
- async deleteAccessToken(token) {
- const url = new URL(`token`, this.baseUrl);
- const resp = await this.httpLib.fetch(url.href, {
- method: "DELETE",
- headers: {
- Authorization: makeBearerTokenAuthHeader(token)
- }
- });
- switch (resp.status) {
- case HttpStatusCode.Ok:
- return opEmptySuccess(resp);
- case HttpStatusCode.NotFound:
- return opKnownHttpFailure(resp.status, resp);
- default:
- return opUnknownFailure(resp, await readTalerErrorResponse(resp));
- }
- }
-};
-
// ../taler-util/lib/http-client/bank-core.js
var TalerCoreBankCacheEviction;
(function(TalerCoreBankCacheEviction2) {
@@ -14148,6 +14160,18 @@ var TalerCoreBankHttpClient = class {
}
};
+// ../taler-util/lib/http-client/challenger.js
+var ChallengerCacheEviction;
+(function(ChallengerCacheEviction2) {
+ ChallengerCacheEviction2[ChallengerCacheEviction2["CREATE_CHALLENGE"] = 0] = "CREATE_CHALLENGE";
+})(ChallengerCacheEviction || (ChallengerCacheEviction = {}));
+
+// ../taler-util/lib/http-client/exchange.js
+var TalerExchangeCacheEviction;
+(function(TalerExchangeCacheEviction2) {
+ TalerExchangeCacheEviction2[TalerExchangeCacheEviction2["CREATE_DESCISION"] = 0] = "CREATE_DESCISION";
+})(TalerExchangeCacheEviction || (TalerExchangeCacheEviction = {}));
+
// ../taler-util/lib/http-client/merchant.js
var TalerMerchantInstanceCacheEviction;
(function(TalerMerchantInstanceCacheEviction2) {
@@ -14185,18 +14209,6 @@ var TalerMerchantManagementCacheEviction;
TalerMerchantManagementCacheEviction2[TalerMerchantManagementCacheEviction2["DELETE_INSTANCE"] = 28] = "DELETE_INSTANCE";
})(TalerMerchantManagementCacheEviction || (TalerMerchantManagementCacheEviction = {}));
-// ../taler-util/lib/http-client/challenger.js
-var ChallengerCacheEviction;
-(function(ChallengerCacheEviction2) {
- ChallengerCacheEviction2[ChallengerCacheEviction2["CREATE_CHALLENGE"] = 0] = "CREATE_CHALLENGE";
-})(ChallengerCacheEviction || (ChallengerCacheEviction = {}));
-
-// ../taler-util/lib/http-client/exchange.js
-var TalerExchangeCacheEviction;
-(function(TalerExchangeCacheEviction2) {
- TalerExchangeCacheEviction2[TalerExchangeCacheEviction2["CREATE_DESCISION"] = 0] = "CREATE_DESCISION";
-})(TalerExchangeCacheEviction || (TalerExchangeCacheEviction = {}));
-
// ../taler-util/lib/i18n.js
var jedLib = __toESM(require_jed(), 1);
var logger9 = new Logger("i18n/index.ts");
@@ -28393,7 +28405,7 @@ function RegistrationForm({
case TalerErrorCode.BANK_NON_ADMIN_PATCH_DEBT_LIMIT:
return i18n2.str`Only admin is allow to set debt limit.`;
case TalerErrorCode.BANK_NON_ADMIN_SET_MIN_CASHOUT:
- return i18n2.str`Only the administrator can change the minimun cashout limit.`;
+ return i18n2.str`Only the administrator can change the minimum cashout limit.`;
case TalerErrorCode.BANK_NON_ADMIN_SET_TAN_CHANNEL:
return i18n2.str`Only admin can create accounts with second factor authentication.`;
}
@@ -32627,7 +32639,7 @@ var AccountPage = utils_exports.compose(
// src/pages/BankFrame.tsx
init_preact_module();
init_hooks_module();
-var GIT_HASH = true ? "6fd830ad57fe12ce6acac453f523dcf00f71a5bb" : void 0;
+var GIT_HASH = true ? "1cdef9cbf18e0d2c36e334b664fbd18fad2e1602" : void 0;
var VERSION = true ? "0.10.7" : void 0;
function BankFrame({
children,
@@ -35484,7 +35496,7 @@ function ShowAccountDetails({
case TalerErrorCode.BANK_NON_ADMIN_SET_MIN_CASHOUT: {
return notify2({
type: "error",
- title: i18n2.str`Only the administrator can change the minimun cashout limit.`,
+ title: i18n2.str`Only the administrator can change the minimum cashout limit.`,
description: resp.detail.hint,
debug: resp.detail,
when: AbsoluteTime.now()
@@ -36639,7 +36651,7 @@ function CreateNewAccount({
case TalerErrorCode.BANK_NON_ADMIN_SET_MIN_CASHOUT: {
return notify2({
type: "error",
- title: i18n2.str`Only the administrator can change the minimun cashout limit.`,
+ title: i18n2.str`Only the administrator can change the minimum cashout limit.`,
description: resp.detail.hint,
debug: resp.detail,
when: AbsoluteTime.now()