@kiminix/tp-client 2.8.2 → 2.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/enum.d.ts CHANGED
@@ -44,3 +44,9 @@ export declare enum VoucherStatus {
44
44
  Succeeded = "succeeded",
45
45
  Failed = "failed"
46
46
  }
47
+ export declare enum OrderStatus {
48
+ Pending = "pending",
49
+ InProgress = "in_progress",
50
+ Completed = "completed",
51
+ Canceled = "canceled"
52
+ }
package/dist/enum.js CHANGED
@@ -52,3 +52,10 @@ export var VoucherStatus;
52
52
  VoucherStatus["Succeeded"] = "succeeded";
53
53
  VoucherStatus["Failed"] = "failed";
54
54
  })(VoucherStatus || (VoucherStatus = {}));
55
+ export var OrderStatus;
56
+ (function (OrderStatus) {
57
+ OrderStatus["Pending"] = "pending";
58
+ OrderStatus["InProgress"] = "in_progress";
59
+ OrderStatus["Completed"] = "completed";
60
+ OrderStatus["Canceled"] = "canceled";
61
+ })(OrderStatus || (OrderStatus = {}));
@@ -1,4 +1,5 @@
1
1
  export * from "./user/types/get-menu-response";
2
2
  export * from './user/types/get-qrcode-response';
3
3
  export * from "./user/types/post-order";
4
+ export * from "./user/types/get-orders";
4
5
  export { MenuGuestAPIs } from './user/guest-apis';
@@ -2,6 +2,7 @@
2
2
  export * from "./user/types/get-menu-response";
3
3
  export * from './user/types/get-qrcode-response';
4
4
  export * from "./user/types/post-order";
5
+ export * from "./user/types/get-orders";
5
6
  export { MenuGuestAPIs } from './user/guest-apis';
6
7
  // admin module
7
8
  // shared module
@@ -1,7 +1,9 @@
1
1
  import { OrderRequest, OrderResponse } from "./types/post-order";
2
2
  import { QrCode } from "./types/get-qrcode-response";
3
3
  import { Menu } from "./types/get-menu-response";
4
+ import { Order } from "./types/get-orders";
4
5
  export declare class MenuGuestAPIs {
6
+ static getOrders(businessId: string, deviceId: string, timestamp: number, page?: number, size?: number): Promise<Order[]>;
5
7
  /**
6
8
  *
7
9
  * @param props
@@ -41,6 +41,29 @@ import { RequestUtils } from "../../utils/request-utils";
41
41
  var MenuGuestAPIs = /** @class */ (function () {
42
42
  function MenuGuestAPIs() {
43
43
  }
44
+ MenuGuestAPIs.getOrders = function (businessId, deviceId, timestamp, page, size) {
45
+ if (page === void 0) { page = 1; }
46
+ if (size === void 0) { size = 12; }
47
+ return __awaiter(this, void 0, void 0, function () {
48
+ return __generator(this, function (_a) {
49
+ return [2 /*return*/, RequestUtils.send(function () {
50
+ var queryParams = [
51
+ "timestamp=".concat(timestamp),
52
+ "page=".concat(page),
53
+ "size=".concat(size),
54
+ "business_id=".concat(businessId),
55
+ "device_id=".concat(deviceId),
56
+ ]
57
+ .filter(function (value) { return value; })
58
+ .join("&");
59
+ return axios.get(base + "/menus/guest/orders?".concat(queryParams), {
60
+ headers: {}
61
+ })
62
+ .then(function (response) { return response.data; });
63
+ })];
64
+ });
65
+ });
66
+ };
44
67
  /**
45
68
  *
46
69
  * @param props
@@ -52,7 +75,7 @@ var MenuGuestAPIs = /** @class */ (function () {
52
75
  return __awaiter(this, void 0, void 0, function () {
53
76
  return __generator(this, function (_a) {
54
77
  return [2 /*return*/, RequestUtils.send(function () {
55
- return axios.post(base + "/menus/guest/order", props, {
78
+ return axios.post(base + "/menus/guest/orders", props, {
56
79
  headers: {
57
80
  'Content-Type': 'application/json'
58
81
  }
@@ -0,0 +1,17 @@
1
+ import { OrderStatus } from "../../../enum";
2
+ export interface Order {
3
+ qrCodeLabel: string;
4
+ deviceId: string;
5
+ status: OrderStatus;
6
+ price: number;
7
+ createdAt: string;
8
+ items: {
9
+ productId: string;
10
+ productLabel: string;
11
+ variantId: string;
12
+ variantLabel?: string;
13
+ quantity: number;
14
+ price: number;
15
+ discount?: number;
16
+ }[];
17
+ }
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiminix/tp-client",
3
- "version": "2.8.2",
3
+ "version": "2.8.4",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [