washday-sdk 0.0.123 → 0.0.125

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.
@@ -10,6 +10,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  import axiosInstance from "../axiosInstance";
11
11
  const GET_SET_DISCOUNT_CODES = 'api/v2/discountCodes';
12
12
  const GET_SET_AUTOMATIC_DISCOUNTS = 'api/discounts';
13
+ const GET_AVAILABLE_AUTOMATIC_DISCOUNTS = 'api/availableDiscounts';
14
+ const GET_DISCOUNT_CODES_CUSTOMER_APP = 'api/v2/washdayapp/discountCodes';
13
15
  export const getDiscountCodes = function (storeId, params) {
14
16
  return __awaiter(this, void 0, void 0, function* () {
15
17
  try {
@@ -83,7 +85,35 @@ export const verifyDiscountCode = function (storeId, code) {
83
85
  return yield axiosInstance.get(`${GET_SET_DISCOUNT_CODES}/${storeId}/${code}/verify`, config);
84
86
  }
85
87
  catch (error) {
86
- console.error('Error fetching getDiscountCodeById:', error);
88
+ console.error('Error fetching verifyDiscountCode:', error);
89
+ throw error;
90
+ }
91
+ });
92
+ };
93
+ export const verifyDiscountCodeCustomersApp = function (storeId, code) {
94
+ return __awaiter(this, void 0, void 0, function* () {
95
+ try {
96
+ const config = {
97
+ headers: { Authorization: `Bearer ${this.apiToken}` }
98
+ };
99
+ return yield axiosInstance.get(`${GET_DISCOUNT_CODES_CUSTOMER_APP}/${storeId}/${code}/verify`, config);
100
+ }
101
+ catch (error) {
102
+ console.error('Error fetching verifyDiscountCodeCustomersApp:', error);
103
+ throw error;
104
+ }
105
+ });
106
+ };
107
+ export const getAvailableAutomaticDiscounts = function (storeId, date) {
108
+ return __awaiter(this, void 0, void 0, function* () {
109
+ try {
110
+ const config = {
111
+ headers: { Authorization: `Bearer ${this.apiToken}` }
112
+ };
113
+ return yield axiosInstance.get(`${GET_AVAILABLE_AUTOMATIC_DISCOUNTS}/${storeId}?currentDate=${date}`, config);
114
+ }
115
+ catch (error) {
116
+ console.error('Error fetching getAvailableAutomaticDiscounts:', error);
87
117
  throw error;
88
118
  }
89
119
  });
package/dist/api/index.js CHANGED
@@ -6,7 +6,7 @@ import { getCompanyById } from "./companies/get";
6
6
  import { updateCFDIOrgLogo, updateCompanyTaxInfoCertificates } from "./companies/post";
7
7
  import { updateCompanyById, updateCompanyLogoById, updateCompanyTaxInfoById } from "./companies/put";
8
8
  import { getCountries } from "./countries/get";
9
- import { getAutomaticDiscountById, getAutomaticDiscounts, getDiscountCodeById, getDiscountCodes, verifyDiscountCode } from './discounts/get';
9
+ import { getAutomaticDiscountById, getAutomaticDiscounts, getAvailableAutomaticDiscounts, getDiscountCodeById, getDiscountCodes, verifyDiscountCode, verifyDiscountCodeCustomersApp } from './discounts/get';
10
10
  import { createAutomaticDiscount, createDiscountCode } from "./discounts/post";
11
11
  import { deleteAutomaticDiscountById, deleteDiscountCodeById } from "./discounts/put";
12
12
  import { deleteStoreStaffById } from "./staff/delete";
@@ -200,11 +200,13 @@ const WashdayClient = function WashdayClient(apiToken) {
200
200
  getDiscountCodes: getDiscountCodes,
201
201
  getDiscountCodeById: getDiscountCodeById,
202
202
  verifyDiscountCode: verifyDiscountCode,
203
+ verifyDiscountCodeCustomersApp: verifyDiscountCodeCustomersApp,
203
204
  createDiscountCode: createDiscountCode,
204
205
  deleteDiscountCodeById: deleteDiscountCodeById,
205
206
  });
206
207
  this.automaticDiscount = bindMethods(this, {
207
208
  getAutomaticDiscounts: getAutomaticDiscounts,
209
+ getAvailableAutomaticDiscounts: getAvailableAutomaticDiscounts,
208
210
  getAutomaticDiscountById: getAutomaticDiscountById,
209
211
  createAutomaticDiscount: createAutomaticDiscount,
210
212
  deleteAutomaticDiscountById: deleteAutomaticDiscountById,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "0.0.123",
3
+ "version": "0.0.125",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -3,6 +3,8 @@ import axiosInstance from "../axiosInstance";
3
3
 
4
4
  const GET_SET_DISCOUNT_CODES = 'api/v2/discountCodes';
5
5
  const GET_SET_AUTOMATIC_DISCOUNTS = 'api/discounts';
6
+ const GET_AVAILABLE_AUTOMATIC_DISCOUNTS = 'api/availableDiscounts';
7
+ const GET_DISCOUNT_CODES_CUSTOMER_APP = 'api/v2/washdayapp/discountCodes';
6
8
 
7
9
  export const getDiscountCodes = async function (this: WashdayClientInstance, storeId: string, params?: string): Promise<any> {
8
10
  try {
@@ -67,7 +69,31 @@ export const verifyDiscountCode = async function (this: WashdayClientInstance, s
67
69
  };
68
70
  return await axiosInstance.get(`${GET_SET_DISCOUNT_CODES}/${storeId}/${code}/verify`, config);
69
71
  } catch (error) {
70
- console.error('Error fetching getDiscountCodeById:', error);
72
+ console.error('Error fetching verifyDiscountCode:', error);
73
+ throw error;
74
+ }
75
+ };
76
+
77
+ export const verifyDiscountCodeCustomersApp = async function (this: WashdayClientInstance, storeId: string, code: string,): Promise<any> {
78
+ try {
79
+ const config = {
80
+ headers: { Authorization: `Bearer ${this.apiToken}` }
81
+ };
82
+ return await axiosInstance.get(`${GET_DISCOUNT_CODES_CUSTOMER_APP}/${storeId}/${code}/verify`, config);
83
+ } catch (error) {
84
+ console.error('Error fetching verifyDiscountCodeCustomersApp:', error);
85
+ throw error;
86
+ }
87
+ };
88
+
89
+ export const getAvailableAutomaticDiscounts = async function (this: WashdayClientInstance, storeId: string, date: string): Promise<any> {
90
+ try {
91
+ const config = {
92
+ headers: { Authorization: `Bearer ${this.apiToken}` }
93
+ };
94
+ return await axiosInstance.get(`${GET_AVAILABLE_AUTOMATIC_DISCOUNTS}/${storeId}?currentDate=${date}`, config);
95
+ } catch (error) {
96
+ console.error('Error fetching getAvailableAutomaticDiscounts:', error);
71
97
  throw error;
72
98
  }
73
99
  };
package/src/api/index.ts CHANGED
@@ -7,7 +7,7 @@ import { getCompanyById } from "./companies/get";
7
7
  import { updateCFDIOrgLogo, updateCompanyTaxInfoCertificates } from "./companies/post";
8
8
  import { updateCompanyById, updateCompanyLogoById, updateCompanyTaxInfoById } from "./companies/put";
9
9
  import { getCountries } from "./countries/get";
10
- import { getAutomaticDiscountById, getAutomaticDiscounts, getDiscountCodeById, getDiscountCodes, verifyDiscountCode } from './discounts/get';
10
+ import { getAutomaticDiscountById, getAutomaticDiscounts, getAvailableAutomaticDiscounts, getDiscountCodeById, getDiscountCodes, verifyDiscountCode, verifyDiscountCodeCustomersApp } from './discounts/get';
11
11
  import { createAutomaticDiscount, createDiscountCode } from "./discounts/post";
12
12
  import { deleteAutomaticDiscountById, deleteDiscountCodeById } from "./discounts/put";
13
13
  import { deleteStoreStaffById } from "./staff/delete";
@@ -206,11 +206,13 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
206
206
  getDiscountCodes: getDiscountCodes,
207
207
  getDiscountCodeById: getDiscountCodeById,
208
208
  verifyDiscountCode: verifyDiscountCode,
209
+ verifyDiscountCodeCustomersApp: verifyDiscountCodeCustomersApp,
209
210
  createDiscountCode: createDiscountCode,
210
211
  deleteDiscountCodeById: deleteDiscountCodeById,
211
212
  });
212
213
  this.automaticDiscount = bindMethods(this, {
213
214
  getAutomaticDiscounts: getAutomaticDiscounts,
215
+ getAvailableAutomaticDiscounts: getAvailableAutomaticDiscounts,
214
216
  getAutomaticDiscountById: getAutomaticDiscountById,
215
217
  createAutomaticDiscount: createAutomaticDiscount,
216
218
  deleteAutomaticDiscountById: deleteAutomaticDiscountById,
@@ -6,7 +6,7 @@ import { getCompanyById } from "../api/companies/get";
6
6
  import { updateCFDIOrgLogo, updateCompanyTaxInfoCertificates } from "../api/companies/post";
7
7
  import { updateCompanyById, updateCompanyLogoById, updateCompanyTaxInfoById } from "../api/companies/put";
8
8
  import { getCountries } from "../api/countries/get";
9
- import { getAutomaticDiscountById, getAutomaticDiscounts, getDiscountCodeById, getDiscountCodes, verifyDiscountCode } from '../api/discounts/get';
9
+ import { getAutomaticDiscountById, getAutomaticDiscounts, getAvailableAutomaticDiscounts, getDiscountCodeById, getDiscountCodes, verifyDiscountCode, verifyDiscountCodeCustomersApp } from '../api/discounts/get';
10
10
  import { createAutomaticDiscount, createDiscountCode } from "../api/discounts/post";
11
11
  import { deleteAutomaticDiscountById, deleteDiscountCodeById } from "../api/discounts/put";
12
12
  import { deleteStoreStaffById } from "../api/staff/delete";
@@ -192,11 +192,13 @@ export interface WashdayClientInstance {
192
192
  getDiscountCodes: typeof getDiscountCodes;
193
193
  getDiscountCodeById: typeof getDiscountCodeById;
194
194
  verifyDiscountCode: typeof verifyDiscountCode;
195
+ verifyDiscountCodeCustomersApp: typeof verifyDiscountCodeCustomersApp;
195
196
  createDiscountCode: typeof createDiscountCode;
196
197
  deleteDiscountCodeById: typeof deleteDiscountCodeById;
197
198
  };
198
199
  automaticDiscount: {
199
200
  getAutomaticDiscounts: typeof getAutomaticDiscounts;
201
+ getAvailableAutomaticDiscounts: typeof getAvailableAutomaticDiscounts,
200
202
  getAutomaticDiscountById: typeof getAutomaticDiscountById;
201
203
  createAutomaticDiscount: typeof createAutomaticDiscount;
202
204
  deleteAutomaticDiscountById: typeof deleteAutomaticDiscountById;