washday-sdk 1.6.3 → 1.6.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.
@@ -294,6 +294,32 @@ export const exportPaymentLinesReport = function (storeId, params) {
294
294
  }
295
295
  });
296
296
  };
297
+ export const exportCashUpReportsByDateRange = function (storeId, params) {
298
+ return __awaiter(this, void 0, void 0, function* () {
299
+ try {
300
+ const config = {
301
+ headers: {
302
+ Authorization: `Bearer ${this.apiToken}`,
303
+ 'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
304
+ 'Content-disposition': 'attachment; filename=[file.csv]'
305
+ },
306
+ params: {
307
+ responseType: 'blob'
308
+ }
309
+ };
310
+ const queryParams = generateQueryParamsStr([
311
+ 'fromDate',
312
+ 'toDate',
313
+ 'cashierBoxId',
314
+ ], params);
315
+ return yield this.axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/cashups/export?${queryParams}`, config);
316
+ }
317
+ catch (error) {
318
+ console.error('Error fetching exportCashUpReportsByDateRange:', error);
319
+ throw error;
320
+ }
321
+ });
322
+ };
297
323
  export const exportUnpaidOrdersReportCSV = function (storeId, params) {
298
324
  return __awaiter(this, void 0, void 0, function* () {
299
325
  try {
package/dist/api/index.js CHANGED
@@ -285,11 +285,13 @@ const WashdayClient = function WashdayClient(apiToken, env = 'PROD', clientId, c
285
285
  exportPaymentLinesReport: csvExportEndpoints.getModule.exportPaymentLinesReport,
286
286
  exportUnpaidOrdersReportCSV: csvExportEndpoints.getModule.exportUnpaidOrdersReportCSV,
287
287
  exportAttendanceReport: csvExportEndpoints.getModule.exportAttendanceReport,
288
+ exportCashUpReportsByDateRange: csvExportEndpoints.getModule.exportCashUpReportsByDateRange,
288
289
  });
289
290
  this.pdf = bindMethods(this, {
290
291
  exportUnpaidOrdersReportPDF: pdfExportEndpoints.getModule.exportUnpaidOrdersReportPDF,
291
292
  });
292
293
  this.reports = bindMethods(this, {
294
+ getCashUpReportsByDateRange: reportsExportEndpoints.getModule.getCashUpReportsByDateRange,
293
295
  getCleanedOrdersReport: reportsExportEndpoints.getModule.getCleanedOrdersReport,
294
296
  getCleanedOrdersGraphDataReport: reportsExportEndpoints.getModule.getCleanedOrdersGraphDataReport,
295
297
  getSalesReport: reportsExportEndpoints.getModule.getSalesReport,
@@ -300,3 +300,22 @@ export const getPopularDaysStatistics = function (storeId, params) {
300
300
  }
301
301
  });
302
302
  };
303
+ export const getCashUpReportsByDateRange = function (storeId, params) {
304
+ return __awaiter(this, void 0, void 0, function* () {
305
+ try {
306
+ const config = {
307
+ headers: { Authorization: `Bearer ${this.apiToken}` }
308
+ };
309
+ const queryParams = generateQueryParamsStr([
310
+ 'fromDate',
311
+ 'toDate',
312
+ 'cashierBoxId',
313
+ ], params);
314
+ return yield this.axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/cashups?${queryParams}`, config);
315
+ }
316
+ catch (error) {
317
+ console.error('Error fetching getCashUpReportsByDateRange:', error);
318
+ throw error;
319
+ }
320
+ });
321
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "1.6.3",
3
+ "version": "1.6.4",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -321,6 +321,34 @@ export const exportPaymentLinesReport = async function (this: WashdayClientInsta
321
321
  }
322
322
  };
323
323
 
324
+ export const exportCashUpReportsByDateRange = async function (this: WashdayClientInstance, storeId: string, params: {
325
+ fromDate?: string
326
+ toDate?: string
327
+ cashierBoxId?: string
328
+ }): Promise<any> {
329
+ try {
330
+ const config = {
331
+ headers: {
332
+ Authorization: `Bearer ${this.apiToken}`,
333
+ 'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
334
+ 'Content-disposition': 'attachment; filename=[file.csv]'
335
+ },
336
+ params: {
337
+ responseType: 'blob'
338
+ }
339
+ };
340
+ const queryParams = generateQueryParamsStr([
341
+ 'fromDate',
342
+ 'toDate',
343
+ 'cashierBoxId',
344
+ ], params);
345
+ return await this.axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/cashups/export?${queryParams}`, config);
346
+ } catch (error) {
347
+ console.error('Error fetching exportCashUpReportsByDateRange:', error);
348
+ throw error;
349
+ }
350
+ };
351
+
324
352
  export const exportUnpaidOrdersReportCSV = async function (this: WashdayClientInstance, storeId: string, params: {
325
353
  fromDate?: string
326
354
  toDate?: string
package/src/api/index.ts CHANGED
@@ -292,11 +292,13 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
292
292
  exportPaymentLinesReport: csvExportEndpoints.getModule.exportPaymentLinesReport,
293
293
  exportUnpaidOrdersReportCSV: csvExportEndpoints.getModule.exportUnpaidOrdersReportCSV,
294
294
  exportAttendanceReport: csvExportEndpoints.getModule.exportAttendanceReport,
295
+ exportCashUpReportsByDateRange: csvExportEndpoints.getModule.exportCashUpReportsByDateRange,
295
296
  });
296
297
  this.pdf = bindMethods(this, {
297
298
  exportUnpaidOrdersReportPDF: pdfExportEndpoints.getModule.exportUnpaidOrdersReportPDF,
298
299
  });
299
300
  this.reports = bindMethods(this, {
301
+ getCashUpReportsByDateRange: reportsExportEndpoints.getModule.getCashUpReportsByDateRange,
300
302
  getCleanedOrdersReport: reportsExportEndpoints.getModule.getCleanedOrdersReport,
301
303
  getCleanedOrdersGraphDataReport: reportsExportEndpoints.getModule.getCleanedOrdersGraphDataReport,
302
304
  getSalesReport: reportsExportEndpoints.getModule.getSalesReport,
@@ -326,4 +326,25 @@ export const getPopularDaysStatistics = async function (this: WashdayClientInsta
326
326
  console.error('Error fetching getPopularDaysStatistics :', error);
327
327
  throw error;
328
328
  }
329
+ };
330
+
331
+ export const getCashUpReportsByDateRange = async function (this: WashdayClientInstance, storeId: string, params: {
332
+ fromDate?: string
333
+ toDate?: string
334
+ cashierBoxId?: string
335
+ }): Promise<any> {
336
+ try {
337
+ const config = {
338
+ headers: { Authorization: `Bearer ${this.apiToken}` }
339
+ };
340
+ const queryParams = generateQueryParamsStr([
341
+ 'fromDate',
342
+ 'toDate',
343
+ 'cashierBoxId',
344
+ ], params);
345
+ return await this.axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/cashups?${queryParams}`, config);
346
+ } catch (error) {
347
+ console.error('Error fetching getCashUpReportsByDateRange:', error);
348
+ throw error;
349
+ }
329
350
  };
@@ -271,6 +271,7 @@ export interface WashdayClientInstance {
271
271
  exportProductSalesReport: typeof csvExportEndpoints.getModule.exportProductSalesReport;
272
272
  exportPaymentLinesReport: typeof csvExportEndpoints.getModule.exportPaymentLinesReport;
273
273
  exportUnpaidOrdersReportCSV: typeof csvExportEndpoints.getModule.exportUnpaidOrdersReportCSV;
274
+ exportCashUpReportsByDateRange: typeof csvExportEndpoints.getModule.exportCashUpReportsByDateRange;
274
275
  exportOrdersList: typeof csvExportEndpoints.getModule.exportOrdersList,
275
276
  exportProductsList: typeof csvExportEndpoints.getModule.exportProductsList,
276
277
  exportCleanedOrdersReport: typeof csvExportEndpoints.getModule.exportCleanedOrdersReport,
@@ -282,6 +283,7 @@ export interface WashdayClientInstance {
282
283
  exportUnpaidOrdersReportPDF: typeof pdfExportEndpoints.getModule.exportUnpaidOrdersReportPDF;
283
284
  };
284
285
  reports: {
286
+ getCashUpReportsByDateRange: typeof reportsExportEndpoints.getModule.getCashUpReportsByDateRange;
285
287
  getCleanedOrdersReport: typeof reportsExportEndpoints.getModule.getCleanedOrdersReport;
286
288
  getCleanedOrdersGraphDataReport: typeof reportsExportEndpoints.getModule.getCleanedOrdersGraphDataReport;
287
289
  getSalesReport: typeof reportsExportEndpoints.getModule.getSalesReport;