washday-sdk 0.0.123 → 0.0.124
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/discounts/get.js +15 -0
- package/dist/api/index.js +2 -1
- package/package.json +1 -1
- package/src/api/discounts/get.ts +13 -0
- package/src/api/index.ts +2 -1
- package/src/interfaces/Api.ts +2 -1
|
@@ -10,6 +10,7 @@ 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';
|
|
13
14
|
export const getDiscountCodes = function (storeId, params) {
|
|
14
15
|
return __awaiter(this, void 0, void 0, function* () {
|
|
15
16
|
try {
|
|
@@ -88,3 +89,17 @@ export const verifyDiscountCode = function (storeId, code) {
|
|
|
88
89
|
}
|
|
89
90
|
});
|
|
90
91
|
};
|
|
92
|
+
export const getAvailableAutomaticDiscounts = function (storeId, date) {
|
|
93
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
+
try {
|
|
95
|
+
const config = {
|
|
96
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
97
|
+
};
|
|
98
|
+
return yield axiosInstance.get(`${GET_AVAILABLE_AUTOMATIC_DISCOUNTS}/${storeId}?currentDate=${date}`, config);
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
console.error('Error fetching getAvailableAutomaticDiscounts:', error);
|
|
102
|
+
throw error;
|
|
103
|
+
}
|
|
104
|
+
});
|
|
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, getDiscountCodeById, getDiscountCodes, verifyDiscountCode } from './discounts/get';
|
|
9
|
+
import { getAutomaticDiscountById, getAutomaticDiscounts, getAvailableAutomaticDiscounts, getDiscountCodeById, getDiscountCodes, verifyDiscountCode } 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";
|
|
@@ -205,6 +205,7 @@ const WashdayClient = function WashdayClient(apiToken) {
|
|
|
205
205
|
});
|
|
206
206
|
this.automaticDiscount = bindMethods(this, {
|
|
207
207
|
getAutomaticDiscounts: getAutomaticDiscounts,
|
|
208
|
+
getAvailableAutomaticDiscounts: getAvailableAutomaticDiscounts,
|
|
208
209
|
getAutomaticDiscountById: getAutomaticDiscountById,
|
|
209
210
|
createAutomaticDiscount: createAutomaticDiscount,
|
|
210
211
|
deleteAutomaticDiscountById: deleteAutomaticDiscountById,
|
package/package.json
CHANGED
package/src/api/discounts/get.ts
CHANGED
|
@@ -3,6 +3,7 @@ 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';
|
|
6
7
|
|
|
7
8
|
export const getDiscountCodes = async function (this: WashdayClientInstance, storeId: string, params?: string): Promise<any> {
|
|
8
9
|
try {
|
|
@@ -71,3 +72,15 @@ export const verifyDiscountCode = async function (this: WashdayClientInstance, s
|
|
|
71
72
|
throw error;
|
|
72
73
|
}
|
|
73
74
|
};
|
|
75
|
+
|
|
76
|
+
export const getAvailableAutomaticDiscounts = async function (this: WashdayClientInstance, storeId: string, date: string): Promise<any> {
|
|
77
|
+
try {
|
|
78
|
+
const config = {
|
|
79
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
80
|
+
};
|
|
81
|
+
return await axiosInstance.get(`${GET_AVAILABLE_AUTOMATIC_DISCOUNTS}/${storeId}?currentDate=${date}`, config);
|
|
82
|
+
} catch (error) {
|
|
83
|
+
console.error('Error fetching getAvailableAutomaticDiscounts:', error);
|
|
84
|
+
throw error;
|
|
85
|
+
}
|
|
86
|
+
};
|
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 } 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";
|
|
@@ -211,6 +211,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
211
211
|
});
|
|
212
212
|
this.automaticDiscount = bindMethods(this, {
|
|
213
213
|
getAutomaticDiscounts: getAutomaticDiscounts,
|
|
214
|
+
getAvailableAutomaticDiscounts: getAvailableAutomaticDiscounts,
|
|
214
215
|
getAutomaticDiscountById: getAutomaticDiscountById,
|
|
215
216
|
createAutomaticDiscount: createAutomaticDiscount,
|
|
216
217
|
deleteAutomaticDiscountById: deleteAutomaticDiscountById,
|
package/src/interfaces/Api.ts
CHANGED
|
@@ -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 } 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";
|
|
@@ -197,6 +197,7 @@ export interface WashdayClientInstance {
|
|
|
197
197
|
};
|
|
198
198
|
automaticDiscount: {
|
|
199
199
|
getAutomaticDiscounts: typeof getAutomaticDiscounts;
|
|
200
|
+
getAvailableAutomaticDiscounts: typeof getAvailableAutomaticDiscounts,
|
|
200
201
|
getAutomaticDiscountById: typeof getAutomaticDiscountById;
|
|
201
202
|
createAutomaticDiscount: typeof createAutomaticDiscount;
|
|
202
203
|
deleteAutomaticDiscountById: typeof deleteAutomaticDiscountById;
|