washday-sdk 0.0.124 → 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.
@@ -11,6 +11,7 @@ import axiosInstance from "../axiosInstance";
11
11
  const GET_SET_DISCOUNT_CODES = 'api/v2/discountCodes';
12
12
  const GET_SET_AUTOMATIC_DISCOUNTS = 'api/discounts';
13
13
  const GET_AVAILABLE_AUTOMATIC_DISCOUNTS = 'api/availableDiscounts';
14
+ const GET_DISCOUNT_CODES_CUSTOMER_APP = 'api/v2/washdayapp/discountCodes';
14
15
  export const getDiscountCodes = function (storeId, params) {
15
16
  return __awaiter(this, void 0, void 0, function* () {
16
17
  try {
@@ -84,7 +85,21 @@ export const verifyDiscountCode = function (storeId, code) {
84
85
  return yield axiosInstance.get(`${GET_SET_DISCOUNT_CODES}/${storeId}/${code}/verify`, config);
85
86
  }
86
87
  catch (error) {
87
- 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);
88
103
  throw error;
89
104
  }
90
105
  });
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, getAvailableAutomaticDiscounts, 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,6 +200,7 @@ 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
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "0.0.124",
3
+ "version": "0.0.125",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -4,6 +4,7 @@ import axiosInstance from "../axiosInstance";
4
4
  const GET_SET_DISCOUNT_CODES = 'api/v2/discountCodes';
5
5
  const GET_SET_AUTOMATIC_DISCOUNTS = 'api/discounts';
6
6
  const GET_AVAILABLE_AUTOMATIC_DISCOUNTS = 'api/availableDiscounts';
7
+ const GET_DISCOUNT_CODES_CUSTOMER_APP = 'api/v2/washdayapp/discountCodes';
7
8
 
8
9
  export const getDiscountCodes = async function (this: WashdayClientInstance, storeId: string, params?: string): Promise<any> {
9
10
  try {
@@ -68,7 +69,19 @@ export const verifyDiscountCode = async function (this: WashdayClientInstance, s
68
69
  };
69
70
  return await axiosInstance.get(`${GET_SET_DISCOUNT_CODES}/${storeId}/${code}/verify`, config);
70
71
  } catch (error) {
71
- 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);
72
85
  throw error;
73
86
  }
74
87
  };
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, getAvailableAutomaticDiscounts, 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,6 +206,7 @@ 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
  });
@@ -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, getAvailableAutomaticDiscounts, 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,6 +192,7 @@ 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
  };