summaryrefslogtreecommitdiff
path: root/packages/taler-util/src/http-client/merchant.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-util/src/http-client/merchant.ts')
-rw-r--r--packages/taler-util/src/http-client/merchant.ts31
1 files changed, 30 insertions, 1 deletions
diff --git a/packages/taler-util/src/http-client/merchant.ts b/packages/taler-util/src/http-client/merchant.ts
index d682dcfa0..892971fee 100644
--- a/packages/taler-util/src/http-client/merchant.ts
+++ b/packages/taler-util/src/http-client/merchant.ts
@@ -32,6 +32,7 @@ import {
codecForInventorySummaryResponse,
codecForMerchantConfig,
codecForMerchantOrderPrivateStatusResponse,
+ codecForMerchantPosProductDetail,
codecForMerchantRefundResponse,
codecForOrderHistory,
codecForOtpDeviceDetails,
@@ -122,7 +123,7 @@ export enum TalerMerchantManagementCacheEviction {
* Uses libtool's current:revision:age versioning.
*/
export class TalerMerchantInstanceHttpClient {
- public readonly PROTOCOL_VERSION = "10:0:6";
+ public readonly PROTOCOL_VERSION = "15:0:0";
readonly httpLib: HttpRequestLibrary;
readonly cacheEvictor: CacheEvictor<TalerMerchantInstanceCacheEviction>;
@@ -859,6 +860,32 @@ export class TalerMerchantInstanceHttpClient {
}
/**
+ * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCE]-private-pos
+ */
+ async getPointOfSaleInventory(token: AccessToken | undefined) {
+ const url = new URL(`private/pos`, this.baseUrl);
+
+ const headers: Record<string, string> = {};
+ if (token) {
+ headers.Authorization = makeBearerTokenAuthHeader(token);
+ }
+ const resp = await this.httpLib.fetch(url.href, {
+ method: "GET",
+ headers,
+ });
+
+ switch (resp.status) {
+ case HttpStatusCode.Ok:
+ return opSuccessFromHttp(resp, codecForMerchantPosProductDetail());
+ case HttpStatusCode.NotFound:
+ return opKnownHttpFailure(resp.status, resp);
+ default:
+ return opUnknownFailure(resp, await readTalerErrorResponse(resp));
+ }
+
+ }
+
+ /**
* https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCE]-private-products-$PRODUCT_ID
*/
async getProductDetails(token: AccessToken | undefined, productId: string) {
@@ -1611,6 +1638,8 @@ export class TalerMerchantInstanceHttpClient {
) {
const url = new URL(`private/templates`, this.baseUrl);
+ addMerchantPaginationParams(url, params);
+
const headers: Record<string, string> = {};
if (token) {
headers.Authorization = makeBearerTokenAuthHeader(token);