washday-sdk 0.0.150 → 0.0.152

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.
@@ -15,7 +15,7 @@ export const getCashierboxesByStoreId = function (storeId, queryParams) {
15
15
  const config = {
16
16
  headers: { Authorization: `Bearer ${this.apiToken}` }
17
17
  };
18
- const response = yield axiosInstance.get(`${GET_SET_CASHIER_BOX(storeId)}?${queryParams}`, config);
18
+ const response = yield axiosInstance.get(`${GET_SET_CASHIER_BOX(storeId)}?${queryParams || ''}`, config);
19
19
  return response;
20
20
  }
21
21
  catch (error) {
package/dist/api/index.js CHANGED
@@ -102,6 +102,7 @@ const WashdayClient = function WashdayClient(apiToken) {
102
102
  sendEmailReceipt: ordersEndpoints.postModule.sendEmailReceipt,
103
103
  createOrderCustomersApp: ordersEndpoints.postModule.createOrderCustomersApp,
104
104
  createOrderUsersApp: ordersEndpoints.postModule.createOrderUsersApp,
105
+ bulkCreatePaymentLines: ordersEndpoints.postModule.bulkCreatePaymentLines,
105
106
  deletePaymentLineById: ordersEndpoints.deleteModule.deletePaymentLineById,
106
107
  getListCustomersApp: ordersEndpoints.getModule.getListCustomersApp,
107
108
  getByIdCustomersApp: ordersEndpoints.getModule.getByIdCustomersApp,
@@ -109,7 +110,8 @@ const WashdayClient = function WashdayClient(apiToken) {
109
110
  getRequestedOrdersSummary: ordersEndpoints.getModule.getRequestedOrdersSummary,
110
111
  bulkCancel: ordersEndpoints.putModule.bulkCancel,
111
112
  bulkClean: ordersEndpoints.putModule.bulkClean,
112
- bulkCollect: ordersEndpoints.putModule.bulkCollect
113
+ bulkCollect: ordersEndpoints.putModule.bulkCollect,
114
+ cancelOrderByIdCustomersApp: ordersEndpoints.deleteModule.cancelOrderByIdCustomersApp
113
115
  });
114
116
  this.customers = bindMethods(this, {
115
117
  getCustomers: customersEndpoints.getModule.getList,
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import axiosInstance from "../axiosInstance";
11
11
  const GET_SET_ORDER_PAYMENTLINES = (orderId) => `/api/v2/order/${orderId}/paymentLines`;
12
+ const GET_SET_ORDER_CUSTOMERS_APP = 'api/v2/washdayapp/orders';
12
13
  export const deletePaymentLineById = function (orderId, id) {
13
14
  return __awaiter(this, void 0, void 0, function* () {
14
15
  try {
@@ -23,3 +24,17 @@ export const deletePaymentLineById = function (orderId, id) {
23
24
  }
24
25
  });
25
26
  };
27
+ export const cancelOrderByIdCustomersApp = function (id) {
28
+ return __awaiter(this, void 0, void 0, function* () {
29
+ try {
30
+ const config = {
31
+ headers: { Authorization: `Bearer ${this.apiToken}` }
32
+ };
33
+ return yield axiosInstance.delete(`${GET_SET_ORDER_CUSTOMERS_APP}/${id}`, config);
34
+ }
35
+ catch (error) {
36
+ console.error('Error fetching cancelOrderByIdCustomersApp:', error);
37
+ throw error;
38
+ }
39
+ });
40
+ };
@@ -67,3 +67,17 @@ export const createOrderUsersApp = function (data) {
67
67
  }
68
68
  });
69
69
  };
70
+ export const bulkCreatePaymentLines = function (storeId, body) {
71
+ return __awaiter(this, void 0, void 0, function* () {
72
+ try {
73
+ const config = {
74
+ headers: { Authorization: `Bearer ${this.apiToken}` }
75
+ };
76
+ return yield axiosInstance.post(`${GET_SET_ORDER}/${storeId}/bulkPaymentLines`, body, config);
77
+ }
78
+ catch (error) {
79
+ console.error('Error fetching bulkCreatePaymentLines:', error);
80
+ throw error;
81
+ }
82
+ });
83
+ };
@@ -11,3 +11,10 @@ export var BuyAndGetConditionsTypes;
11
11
  BuyAndGetConditionsTypes["PERCENTAGE"] = "percentage";
12
12
  BuyAndGetConditionsTypes["FREE"] = "free";
13
13
  })(BuyAndGetConditionsTypes || (BuyAndGetConditionsTypes = {}));
14
+ export var PaymentMethodsEnum;
15
+ (function (PaymentMethodsEnum) {
16
+ PaymentMethodsEnum["Cash"] = "cash";
17
+ PaymentMethodsEnum["Card"] = "card";
18
+ PaymentMethodsEnum["Delivery"] = "delivery";
19
+ PaymentMethodsEnum["Transfer"] = "transfer";
20
+ })(PaymentMethodsEnum || (PaymentMethodsEnum = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "0.0.150",
3
+ "version": "0.0.152",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -8,7 +8,7 @@ export const getCashierboxesByStoreId = async function (this: WashdayClientInsta
8
8
  const config = {
9
9
  headers: { Authorization: `Bearer ${this.apiToken}` }
10
10
  };
11
- const response = await axiosInstance.get(`${GET_SET_CASHIER_BOX(storeId)}?${queryParams}`, config);
11
+ const response = await axiosInstance.get(`${GET_SET_CASHIER_BOX(storeId)}?${queryParams || ''}`, config);
12
12
  return response;
13
13
  } catch (error) {
14
14
  console.error('Error fetching getCashierboxesByStoreId:', error);
package/src/api/index.ts CHANGED
@@ -108,6 +108,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
108
108
  sendEmailReceipt: ordersEndpoints.postModule.sendEmailReceipt,
109
109
  createOrderCustomersApp: ordersEndpoints.postModule.createOrderCustomersApp,
110
110
  createOrderUsersApp: ordersEndpoints.postModule.createOrderUsersApp,
111
+ bulkCreatePaymentLines: ordersEndpoints.postModule.bulkCreatePaymentLines,
111
112
  deletePaymentLineById: ordersEndpoints.deleteModule.deletePaymentLineById,
112
113
  getListCustomersApp: ordersEndpoints.getModule.getListCustomersApp,
113
114
  getByIdCustomersApp: ordersEndpoints.getModule.getByIdCustomersApp,
@@ -115,7 +116,8 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
115
116
  getRequestedOrdersSummary: ordersEndpoints.getModule.getRequestedOrdersSummary,
116
117
  bulkCancel: ordersEndpoints.putModule.bulkCancel,
117
118
  bulkClean: ordersEndpoints.putModule.bulkClean,
118
- bulkCollect: ordersEndpoints.putModule.bulkCollect
119
+ bulkCollect: ordersEndpoints.putModule.bulkCollect,
120
+ cancelOrderByIdCustomersApp: ordersEndpoints.deleteModule.cancelOrderByIdCustomersApp
119
121
  });
120
122
  this.customers = bindMethods(this, {
121
123
  getCustomers: customersEndpoints.getModule.getList,
@@ -1,6 +1,7 @@
1
1
  import { WashdayClientInstance } from "../../interfaces/Api";
2
2
  import axiosInstance from "../axiosInstance";
3
3
  const GET_SET_ORDER_PAYMENTLINES = (orderId: string) => `/api/v2/order/${orderId}/paymentLines`;
4
+ const GET_SET_ORDER_CUSTOMERS_APP = 'api/v2/washdayapp/orders';
4
5
 
5
6
  export const deletePaymentLineById = async function (this: WashdayClientInstance, orderId: string, id: string): Promise<any> {
6
7
  try {
@@ -13,3 +14,16 @@ export const deletePaymentLineById = async function (this: WashdayClientInstance
13
14
  throw error;
14
15
  }
15
16
  };
17
+
18
+
19
+ export const cancelOrderByIdCustomersApp = async function (this: WashdayClientInstance, id: string): Promise<any> {
20
+ try {
21
+ const config = {
22
+ headers: { Authorization: `Bearer ${this.apiToken}` }
23
+ };
24
+ return await axiosInstance.delete(`${GET_SET_ORDER_CUSTOMERS_APP}/${id}`, config);
25
+ } catch (error) {
26
+ console.error('Error fetching cancelOrderByIdCustomersApp:', error);
27
+ throw error;
28
+ }
29
+ };
@@ -1,3 +1,5 @@
1
+ import { AxiosResponse } from "axios";
2
+ import { PaymentMethodsEnum } from "../../enum";
1
3
  import { WashdayClientInstance } from "../../interfaces/Api";
2
4
  import { OrderDto } from "../../interfaces/Order";
3
5
  import axiosInstance from "../axiosInstance";
@@ -57,4 +59,25 @@ export const createOrderUsersApp = async function (this: WashdayClientInstance,
57
59
  console.error('Error fetching createOrderUsersApp:', error);
58
60
  throw error;
59
61
  }
62
+ };
63
+
64
+ export const bulkCreatePaymentLines = async function (this: WashdayClientInstance, storeId: string, body: {
65
+ paymentLines: {
66
+ sequence: string;
67
+ orderId: string
68
+ paymentMethod: PaymentMethodsEnum;
69
+ amount: number;
70
+ cashierBoxId: string;
71
+ paymentDate: Date;
72
+ }[],
73
+ }): Promise<AxiosResponse<any, any>> {
74
+ try {
75
+ const config = {
76
+ headers: { Authorization: `Bearer ${this.apiToken}` }
77
+ };
78
+ return await axiosInstance.post(`${GET_SET_ORDER}/${storeId}/bulkPaymentLines`, body, config);
79
+ } catch (error) {
80
+ console.error('Error fetching bulkCreatePaymentLines:', error);
81
+ throw error;
82
+ }
60
83
  };
package/src/enum/index.ts CHANGED
@@ -9,4 +9,11 @@ export enum DiscountCodeTypes {
9
9
  export enum BuyAndGetConditionsTypes {
10
10
  PERCENTAGE = 'percentage',
11
11
  FREE = 'free'
12
+ }
13
+
14
+ export enum PaymentMethodsEnum {
15
+ Cash = "cash",
16
+ Card = "card",
17
+ Delivery = "delivery",
18
+ Transfer = "transfer",
12
19
  }
@@ -94,6 +94,7 @@ export interface WashdayClientInstance {
94
94
  createPaymentLine: typeof ordersEndpoints.postModule.createPaymentLine;
95
95
  createOrderCustomersApp: typeof ordersEndpoints.postModule.createOrderCustomersApp,
96
96
  createOrderUsersApp: typeof ordersEndpoints.postModule.createOrderUsersApp,
97
+ bulkCreatePaymentLines: typeof ordersEndpoints.postModule.bulkCreatePaymentLines,
97
98
  deletePaymentLineById: typeof ordersEndpoints.deleteModule.deletePaymentLineById;
98
99
  getListCustomersApp: typeof ordersEndpoints.getModule.getListCustomersApp;
99
100
  getByIdCustomersApp: typeof ordersEndpoints.getModule.getByIdCustomersApp;
@@ -101,7 +102,8 @@ export interface WashdayClientInstance {
101
102
  getRequestedOrdersSummary: typeof ordersEndpoints.getModule.getRequestedOrdersSummary;
102
103
  bulkCancel: typeof ordersEndpoints.putModule.bulkCancel,
103
104
  bulkClean: typeof ordersEndpoints.putModule.bulkClean,
104
- bulkCollect: typeof ordersEndpoints.putModule.bulkCollect
105
+ bulkCollect: typeof ordersEndpoints.putModule.bulkCollect,
106
+ cancelOrderByIdCustomersApp: typeof ordersEndpoints.deleteModule.cancelOrderByIdCustomersApp;
105
107
  };
106
108
  customers: {
107
109
  getCustomers: typeof customersEndpoints.getModule.getList;