aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-util
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-util')
-rw-r--r--packages/taler-util/src/http-client/merchant.ts26
1 files changed, 21 insertions, 5 deletions
diff --git a/packages/taler-util/src/http-client/merchant.ts b/packages/taler-util/src/http-client/merchant.ts
index b7fe3e62c..7efa90a5f 100644
--- a/packages/taler-util/src/http-client/merchant.ts
+++ b/packages/taler-util/src/http-client/merchant.ts
@@ -16,9 +16,11 @@
import {
AccessToken,
+ FailCasesByMethod,
HttpStatusCode,
LibtoolVersion,
PaginationParams,
+ ResultByMethod,
TalerMerchantApi,
codecForAbortResponse,
codecForAccountAddResponse,
@@ -69,6 +71,13 @@ import {
nullEvictor,
} from "./utils.js";
+export type TalerMerchantInstanceResultByMethod<
+ prop extends keyof TalerMerchantInstanceHttpClient,
+> = ResultByMethod<TalerMerchantInstanceHttpClient, prop>;
+export type TalerMerchantInstanceErrorsByMethod<
+ prop extends keyof TalerMerchantInstanceHttpClient,
+> = FailCasesByMethod<TalerMerchantInstanceHttpClient, prop>;
+
export enum TalerMerchantInstanceCacheEviction {
CREATE_ORDER,
}
@@ -398,7 +407,7 @@ export class TalerMerchantInstanceHttpClient {
* https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCE]-private
*
*/
- async getCurrentInstance(token: AccessToken) {
+ async getCurrentInstanceDetails(token: AccessToken) {
const url = new URL(`private`, this.baseUrl);
const headers: Record<string, string> = {}
@@ -456,7 +465,7 @@ export class TalerMerchantInstanceHttpClient {
*/
async getCurrentIntanceKycStatus(
token: AccessToken | undefined,
- params: TalerMerchantApi.GetKycStatusRequestParams,
+ params: TalerMerchantApi.GetKycStatusRequestParams = {},
) {
const url = new URL(`private/kyc`, this.baseUrl);
@@ -485,10 +494,10 @@ export class TalerMerchantInstanceHttpClient {
case HttpStatusCode.NoContent:
return opEmptySuccess(resp);
case HttpStatusCode.BadGateway:
- return opKnownHttpFailure(resp.status, resp);
+ return opKnownAlternativeFailure(resp, resp.status, codecForAccountKycRedirects())
case HttpStatusCode.ServiceUnavailable:
return opKnownHttpFailure(resp.status, resp);
- case HttpStatusCode.Conflict:
+ case HttpStatusCode.GatewayTimeout:
return opKnownHttpFailure(resp.status, resp);
default:
return opUnknownFailure(resp, await resp.text());
@@ -1725,6 +1734,13 @@ export class TalerMerchantInstanceHttpClient {
}
+export type TalerMerchantManagementResultByMethod<
+ prop extends keyof TalerMerchantManagementHttpClient,
+> = ResultByMethod<TalerMerchantManagementHttpClient, prop>;
+export type TalerMerchantManagementErrorsByMethod<
+ prop extends keyof TalerMerchantManagementHttpClient,
+> = FailCasesByMethod<TalerMerchantManagementHttpClient, prop>;
+
export class TalerMerchantManagementHttpClient extends TalerMerchantInstanceHttpClient {
readonly cacheManagementEvictor: CacheEvictor<TalerMerchantManagementCacheEviction>;
constructor(
@@ -1860,7 +1876,7 @@ export class TalerMerchantManagementHttpClient extends TalerMerchantInstanceHttp
* https://docs.taler.net/core/api-merchant.html#get--management-instances-$INSTANCE
*
*/
- async getInstance(token: AccessToken | undefined, instanceId: string) {
+ async getInstanceDetails(token: AccessToken | undefined, instanceId: string) {
const url = new URL(`management/instances/${instanceId}`, this.baseUrl);
const headers: Record<string, string> = {}