washday-sdk 1.6.12 → 1.6.15
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/api/index.js +5 -1
- package/dist/api/order/post.js +24 -0
- package/dist/api/staff/put.js +15 -0
- package/dist/api/users/get.js +24 -0
- package/package.json +1 -1
- package/src/api/index.ts +5 -1
- package/src/api/order/post.ts +37 -0
- package/src/api/staff/put.ts +14 -0
- package/src/api/users/get.ts +15 -0
- package/src/interfaces/Api.ts +5 -1
package/dist/api/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import { deleteAutomaticDiscountById, deleteDiscountCodeById, updateAutomaticDis
|
|
|
12
12
|
import { deleteStoreStaffById } from "./staff/delete";
|
|
13
13
|
import { getStoreStaff, getStoreStaffById } from "./staff/get";
|
|
14
14
|
import { createStoreStaff } from "./staff/post";
|
|
15
|
-
import { updateStoreStaffById } from "./staff/put";
|
|
15
|
+
import { updateStoreStaffById, updateStoreStaffStores } from "./staff/put";
|
|
16
16
|
import { getOrderSequence, getPaymentFees, getStoreById, getStoreImages, getStoreReviewLink, getStores, getStoresByIdCustomersApp, getStoresByName } from "./stores/get";
|
|
17
17
|
import { copyStore, createStore, createStoreImage } from "./stores/post";
|
|
18
18
|
import { deleteStoreById, setOrderSequence, updatePaymentFees, updateStoreById } from "./stores/put";
|
|
@@ -22,6 +22,7 @@ import { getSupplies, getSupplyById, getSupplyHistory } from "./supplies/get";
|
|
|
22
22
|
import { createSupply } from "./supplies/post";
|
|
23
23
|
import { addSupplyStock, updateSupplyById } from "./supplies/put";
|
|
24
24
|
import { updateUserById } from "./users/put";
|
|
25
|
+
import { getUserStoreAccess } from "./users/get";
|
|
25
26
|
import * as inventoryEndpoints from './inventory';
|
|
26
27
|
import * as sectionsEndpoints from './sections';
|
|
27
28
|
import * as productsEndpoints from './products';
|
|
@@ -136,6 +137,7 @@ const WashdayClient = function WashdayClient(apiToken, env = 'PROD', clientId, c
|
|
|
136
137
|
createOrderEvidence: ordersEndpoints.postModule.createOrderEvidence,
|
|
137
138
|
getRedeemPointsPreview: ordersEndpoints.postModule.getRedeemPointsPreview,
|
|
138
139
|
setOrderUncollected: ordersEndpoints.postModule.setOrderUncollected,
|
|
140
|
+
payAndCollect: ordersEndpoints.postModule.payAndCollect,
|
|
139
141
|
deletePaymentLineById: ordersEndpoints.deleteModule.deletePaymentLineById,
|
|
140
142
|
getListCustomersApp: ordersEndpoints.getModule.getListCustomersApp,
|
|
141
143
|
getByIdCustomersApp: ordersEndpoints.getModule.getByIdCustomersApp,
|
|
@@ -193,6 +195,7 @@ const WashdayClient = function WashdayClient(apiToken, env = 'PROD', clientId, c
|
|
|
193
195
|
});
|
|
194
196
|
this.users = bindMethods(this, {
|
|
195
197
|
updateUserById: updateUserById,
|
|
198
|
+
getUserStoreAccess: getUserStoreAccess,
|
|
196
199
|
deleteUserById: deleteUserById,
|
|
197
200
|
validateUserPin: validateUserPin,
|
|
198
201
|
});
|
|
@@ -257,6 +260,7 @@ const WashdayClient = function WashdayClient(apiToken, env = 'PROD', clientId, c
|
|
|
257
260
|
getStoreStaff: getStoreStaff,
|
|
258
261
|
getStoreStaffById: getStoreStaffById,
|
|
259
262
|
updateStoreStaffById: updateStoreStaffById,
|
|
263
|
+
updateStoreStaffStores: updateStoreStaffStores,
|
|
260
264
|
createStoreStaff: createStoreStaff,
|
|
261
265
|
deleteStoreStaffById: deleteStoreStaffById,
|
|
262
266
|
});
|
package/dist/api/order/post.js
CHANGED
|
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
const GET_SET_ORDER_PAYMENTLINES = (orderId) => `/api/v2/order/${orderId}/paymentLines`;
|
|
11
11
|
const GET_SET_ORDER = 'api/v2/order';
|
|
12
12
|
const GET_SET_ORDER_CUSTOMERS_APP = 'api/v2/washdayapp/orders';
|
|
13
|
+
const PAY_AND_COLLECT = (sequence, storeId) => `/api/v2/order/${sequence}/${storeId}/pay-and-collect`;
|
|
13
14
|
export const createPaymentLine = function (id, data) {
|
|
14
15
|
return __awaiter(this, void 0, void 0, function* () {
|
|
15
16
|
try {
|
|
@@ -126,3 +127,26 @@ export const setOrderUncollected = function (data) {
|
|
|
126
127
|
}
|
|
127
128
|
});
|
|
128
129
|
};
|
|
130
|
+
export const payAndCollect = function (params) {
|
|
131
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
132
|
+
try {
|
|
133
|
+
const config = {
|
|
134
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
135
|
+
};
|
|
136
|
+
return yield this.axiosInstance.post(PAY_AND_COLLECT(params.sequence, params.storeId), {
|
|
137
|
+
paymentMethod: params.paymentMethod,
|
|
138
|
+
cashierBoxId: params.cashierBoxId,
|
|
139
|
+
amount: params.amount,
|
|
140
|
+
paymentDate: params.paymentDate,
|
|
141
|
+
collectedDateTime: params.collectedDateTime,
|
|
142
|
+
collectWithAmountDue: params.collectWithAmountDue,
|
|
143
|
+
pinUserId: params.pinUserId,
|
|
144
|
+
attemptId: params.attemptId,
|
|
145
|
+
}, config);
|
|
146
|
+
}
|
|
147
|
+
catch (error) {
|
|
148
|
+
console.error('Error fetching payAndCollect:', error);
|
|
149
|
+
throw error;
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
};
|
package/dist/api/staff/put.js
CHANGED
|
@@ -23,3 +23,18 @@ export const updateStoreStaffById = function (storeId, staffId, data) {
|
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
25
|
};
|
|
26
|
+
export const updateStoreStaffStores = function (storeId, staffId, allowedStoreIds) {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
try {
|
|
29
|
+
const config = {
|
|
30
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
31
|
+
};
|
|
32
|
+
const response = yield this.axiosInstance.put(`${GET_SET_STAFF(storeId)}/${staffId}/stores`, { allowedStoreIds }, config);
|
|
33
|
+
return response;
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
console.error('Error fetching updateStoreStaffStores:', error);
|
|
37
|
+
throw error;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
const GET_USER_STORE_ACCESS = (userId) => `api/users/${userId}/store-access`;
|
|
11
|
+
export const getUserStoreAccess = function (userId) {
|
|
12
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
13
|
+
try {
|
|
14
|
+
const config = {
|
|
15
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
16
|
+
};
|
|
17
|
+
return yield this.axiosInstance.get(GET_USER_STORE_ACCESS(userId), config);
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
console.error('Error fetching getUserStoreAccess:', error);
|
|
21
|
+
throw error;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
};
|
package/package.json
CHANGED
package/src/api/index.ts
CHANGED
|
@@ -13,7 +13,7 @@ import { deleteAutomaticDiscountById, deleteDiscountCodeById, updateAutomaticDis
|
|
|
13
13
|
import { deleteStoreStaffById } from "./staff/delete";
|
|
14
14
|
import { getStoreStaff, getStoreStaffById } from "./staff/get";
|
|
15
15
|
import { createStoreStaff } from "./staff/post";
|
|
16
|
-
import { updateStoreStaffById } from "./staff/put";
|
|
16
|
+
import { updateStoreStaffById, updateStoreStaffStores } from "./staff/put";
|
|
17
17
|
import { getOrderSequence, getPaymentFees, getStoreById, getStoreImages, getStoreReviewLink, getStores, getStoresByIdCustomersApp, getStoresByName } from "./stores/get";
|
|
18
18
|
import { copyStore, createStore, createStoreImage } from "./stores/post";
|
|
19
19
|
import { deleteStoreById, setOrderSequence, updatePaymentFees, updateStoreById } from "./stores/put";
|
|
@@ -23,6 +23,7 @@ import { getSupplies, getSupplyById, getSupplyHistory } from "./supplies/get";
|
|
|
23
23
|
import { createSupply } from "./supplies/post";
|
|
24
24
|
import { addSupplyStock, updateSupplyById } from "./supplies/put";
|
|
25
25
|
import { updateUserById } from "./users/put";
|
|
26
|
+
import { getUserStoreAccess } from "./users/get";
|
|
26
27
|
import * as inventoryEndpoints from './inventory';
|
|
27
28
|
import * as sectionsEndpoints from './sections';
|
|
28
29
|
import * as productsEndpoints from './products';
|
|
@@ -143,6 +144,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
143
144
|
createOrderEvidence: ordersEndpoints.postModule.createOrderEvidence,
|
|
144
145
|
getRedeemPointsPreview: ordersEndpoints.postModule.getRedeemPointsPreview,
|
|
145
146
|
setOrderUncollected: ordersEndpoints.postModule.setOrderUncollected,
|
|
147
|
+
payAndCollect: ordersEndpoints.postModule.payAndCollect,
|
|
146
148
|
deletePaymentLineById: ordersEndpoints.deleteModule.deletePaymentLineById,
|
|
147
149
|
getListCustomersApp: ordersEndpoints.getModule.getListCustomersApp,
|
|
148
150
|
getByIdCustomersApp: ordersEndpoints.getModule.getByIdCustomersApp,
|
|
@@ -200,6 +202,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
200
202
|
});
|
|
201
203
|
this.users = bindMethods(this, {
|
|
202
204
|
updateUserById: updateUserById,
|
|
205
|
+
getUserStoreAccess: getUserStoreAccess,
|
|
203
206
|
deleteUserById: deleteUserById,
|
|
204
207
|
validateUserPin: validateUserPin,
|
|
205
208
|
});
|
|
@@ -264,6 +267,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
264
267
|
getStoreStaff: getStoreStaff,
|
|
265
268
|
getStoreStaffById: getStoreStaffById,
|
|
266
269
|
updateStoreStaffById: updateStoreStaffById,
|
|
270
|
+
updateStoreStaffStores: updateStoreStaffStores,
|
|
267
271
|
createStoreStaff: createStoreStaff,
|
|
268
272
|
deleteStoreStaffById: deleteStoreStaffById,
|
|
269
273
|
});
|
package/src/api/order/post.ts
CHANGED
|
@@ -6,6 +6,7 @@ import axiosInstance from "../axiosInstance";
|
|
|
6
6
|
const GET_SET_ORDER_PAYMENTLINES = (orderId: string) => `/api/v2/order/${orderId}/paymentLines`;
|
|
7
7
|
const GET_SET_ORDER = 'api/v2/order';
|
|
8
8
|
const GET_SET_ORDER_CUSTOMERS_APP = 'api/v2/washdayapp/orders';
|
|
9
|
+
const PAY_AND_COLLECT = (sequence: string, storeId: string) => `/api/v2/order/${sequence}/${storeId}/pay-and-collect`;
|
|
9
10
|
|
|
10
11
|
export const createPaymentLine = async function (this: WashdayClientInstance, id: string, data: {
|
|
11
12
|
amountPaid: number,
|
|
@@ -132,4 +133,40 @@ export const setOrderUncollected = async function (this: WashdayClientInstance,
|
|
|
132
133
|
console.error('Error fetching setOrderUncollected:', error);
|
|
133
134
|
throw error;
|
|
134
135
|
}
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
export const payAndCollect = async function (this: WashdayClientInstance, params: {
|
|
139
|
+
sequence: string;
|
|
140
|
+
storeId: string;
|
|
141
|
+
paymentMethod: string;
|
|
142
|
+
cashierBoxId?: string;
|
|
143
|
+
amount?: number;
|
|
144
|
+
paymentDate?: string | Date;
|
|
145
|
+
collectedDateTime?: string | Date;
|
|
146
|
+
collectWithAmountDue?: boolean;
|
|
147
|
+
pinUserId?: string;
|
|
148
|
+
attemptId?: string;
|
|
149
|
+
}): Promise<AxiosResponse<any, any>> {
|
|
150
|
+
try {
|
|
151
|
+
const config = {
|
|
152
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
153
|
+
};
|
|
154
|
+
return await this.axiosInstance.post(
|
|
155
|
+
PAY_AND_COLLECT(params.sequence, params.storeId),
|
|
156
|
+
{
|
|
157
|
+
paymentMethod: params.paymentMethod,
|
|
158
|
+
cashierBoxId: params.cashierBoxId,
|
|
159
|
+
amount: params.amount,
|
|
160
|
+
paymentDate: params.paymentDate,
|
|
161
|
+
collectedDateTime: params.collectedDateTime,
|
|
162
|
+
collectWithAmountDue: params.collectWithAmountDue,
|
|
163
|
+
pinUserId: params.pinUserId,
|
|
164
|
+
attemptId: params.attemptId,
|
|
165
|
+
},
|
|
166
|
+
config
|
|
167
|
+
);
|
|
168
|
+
} catch (error) {
|
|
169
|
+
console.error('Error fetching payAndCollect:', error);
|
|
170
|
+
throw error;
|
|
171
|
+
}
|
|
135
172
|
};
|
package/src/api/staff/put.ts
CHANGED
|
@@ -15,3 +15,17 @@ export const updateStoreStaffById = async function (this: WashdayClientInstance,
|
|
|
15
15
|
throw error;
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
|
+
|
|
19
|
+
export const updateStoreStaffStores = async function (this: WashdayClientInstance, storeId: string, staffId: string, allowedStoreIds: string[]): Promise<any> {
|
|
20
|
+
try {
|
|
21
|
+
const config = {
|
|
22
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
23
|
+
};
|
|
24
|
+
const response = await this.axiosInstance.put(`${GET_SET_STAFF(storeId)}/${staffId}/stores`, { allowedStoreIds }, config);
|
|
25
|
+
return response;
|
|
26
|
+
} catch (error) {
|
|
27
|
+
console.error('Error fetching updateStoreStaffStores:', error);
|
|
28
|
+
throw error;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
|
+
|
|
3
|
+
const GET_USER_STORE_ACCESS = (userId: string) => `api/users/${userId}/store-access`;
|
|
4
|
+
|
|
5
|
+
export const getUserStoreAccess = async function (this: WashdayClientInstance, userId: string): Promise<any> {
|
|
6
|
+
try {
|
|
7
|
+
const config = {
|
|
8
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
9
|
+
};
|
|
10
|
+
return await this.axiosInstance.get(GET_USER_STORE_ACCESS(userId), config);
|
|
11
|
+
} catch (error) {
|
|
12
|
+
console.error('Error fetching getUserStoreAccess:', error);
|
|
13
|
+
throw error;
|
|
14
|
+
}
|
|
15
|
+
};
|
package/src/interfaces/Api.ts
CHANGED
|
@@ -12,7 +12,7 @@ import { deleteAutomaticDiscountById, deleteDiscountCodeById, updateAutomaticDis
|
|
|
12
12
|
import { deleteStoreStaffById } from "../api/staff/delete";
|
|
13
13
|
import { getStoreStaff, getStoreStaffById } from "../api/staff/get";
|
|
14
14
|
import { createStoreStaff } from "../api/staff/post";
|
|
15
|
-
import { updateStoreStaffById } from "../api/staff/put";
|
|
15
|
+
import { updateStoreStaffById, updateStoreStaffStores } from "../api/staff/put";
|
|
16
16
|
import { getOrderSequence, getPaymentFees, getStoreById, getStoreImages, getStoreReviewLink, getStores, getStoresByIdCustomersApp, getStoresByName } from "../api/stores/get";
|
|
17
17
|
import { copyStore, createStore, createStoreImage } from "../api/stores/post";
|
|
18
18
|
import { deleteStoreById, setOrderSequence, updatePaymentFees, updateStoreById } from "../api/stores/put";
|
|
@@ -22,6 +22,7 @@ import { getSupplies, getSupplyById, getSupplyHistory } from "../api/supplies/ge
|
|
|
22
22
|
import { createSupply } from "../api/supplies/post";
|
|
23
23
|
import { addSupplyStock, updateSupplyById } from "../api/supplies/put";
|
|
24
24
|
import { updateUserById } from "../api/users/put";
|
|
25
|
+
import { getUserStoreAccess } from "../api/users/get";
|
|
25
26
|
import * as inventoryEndpoints from '../api/inventory';
|
|
26
27
|
import * as sectionsEndpoints from '../api/sections';
|
|
27
28
|
import * as productsEndpoints from '../api/products';
|
|
@@ -128,6 +129,7 @@ export interface WashdayClientInstance {
|
|
|
128
129
|
createOrderEvidence: typeof ordersEndpoints.postModule.createOrderEvidence,
|
|
129
130
|
getRedeemPointsPreview: typeof ordersEndpoints.postModule.getRedeemPointsPreview,
|
|
130
131
|
setOrderUncollected: typeof ordersEndpoints.postModule.setOrderUncollected,
|
|
132
|
+
payAndCollect: typeof ordersEndpoints.postModule.payAndCollect,
|
|
131
133
|
deletePaymentLineById: typeof ordersEndpoints.deleteModule.deletePaymentLineById;
|
|
132
134
|
getListCustomersApp: typeof ordersEndpoints.getModule.getListCustomersApp;
|
|
133
135
|
getByIdCustomersApp: typeof ordersEndpoints.getModule.getByIdCustomersApp;
|
|
@@ -185,6 +187,7 @@ export interface WashdayClientInstance {
|
|
|
185
187
|
};
|
|
186
188
|
users: {
|
|
187
189
|
updateUserById: typeof updateUserById;
|
|
190
|
+
getUserStoreAccess: typeof getUserStoreAccess;
|
|
188
191
|
deleteUserById: typeof deleteUserById;
|
|
189
192
|
validateUserPin: typeof validateUserPin;
|
|
190
193
|
};
|
|
@@ -249,6 +252,7 @@ export interface WashdayClientInstance {
|
|
|
249
252
|
getStoreStaff: typeof getStoreStaff;
|
|
250
253
|
getStoreStaffById: typeof getStoreStaffById;
|
|
251
254
|
updateStoreStaffById: typeof updateStoreStaffById;
|
|
255
|
+
updateStoreStaffStores: typeof updateStoreStaffStores;
|
|
252
256
|
createStoreStaff: typeof createStoreStaff;
|
|
253
257
|
deleteStoreStaffById: typeof deleteStoreStaffById;
|
|
254
258
|
};
|