washday-sdk 0.0.70 → 0.0.72
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/axiosInstance.d.ts +2 -0
- package/dist/api/axiosInstance.js +4 -8
- package/dist/api/cashierbox/delete.d.ts +2 -0
- package/dist/api/cashierbox/delete.js +3 -10
- package/dist/api/cashierbox/get.d.ts +7 -0
- package/dist/api/cashierbox/get.js +7 -16
- package/dist/api/cashierbox/post.d.ts +11 -0
- package/dist/api/cashierbox/post.js +5 -13
- package/dist/api/cashierbox/put.d.ts +4 -0
- package/dist/api/cashierbox/put.js +3 -10
- package/dist/api/companies/get.d.ts +2 -0
- package/dist/api/companies/get.js +3 -10
- package/dist/api/companies/post.d.ts +3 -0
- package/dist/api/companies/post.js +5 -13
- package/dist/api/companies/put.d.ts +4 -0
- package/dist/api/companies/put.js +7 -16
- package/dist/api/countries/get.d.ts +2 -0
- package/dist/api/countries/get.js +3 -10
- package/dist/api/countries/post.d.ts +0 -0
- package/dist/api/countries/put.d.ts +0 -0
- package/dist/api/csv/get.d.ts +11 -0
- package/dist/api/csv/get.js +5 -12
- package/dist/api/csv/index.d.ts +1 -0
- package/dist/api/csv/index.js +1 -27
- package/dist/api/customers/delete.d.ts +2 -0
- package/dist/api/customers/delete.js +3 -10
- package/dist/api/customers/get.d.ts +28 -0
- package/dist/api/customers/get.js +12 -21
- package/dist/api/customers/index.d.ts +4 -0
- package/dist/api/customers/index.js +4 -30
- package/dist/api/customers/post.d.ts +18 -0
- package/dist/api/customers/post.js +3 -10
- package/dist/api/customers/put.d.ts +18 -0
- package/dist/api/customers/put.js +3 -10
- package/dist/api/discounts/get.d.ts +6 -0
- package/dist/api/discounts/get.js +11 -22
- package/dist/api/discounts/post.d.ts +3 -0
- package/dist/api/discounts/post.js +5 -13
- package/dist/api/discounts/put.d.ts +3 -0
- package/dist/api/discounts/put.js +5 -13
- package/dist/api/index.d.ts +7 -0
- package/dist/api/index.js +78 -103
- package/dist/api/inventory/delete.d.ts +2 -0
- package/dist/api/inventory/delete.js +3 -10
- package/dist/api/inventory/get.d.ts +7 -0
- package/dist/api/inventory/get.js +7 -16
- package/dist/api/inventory/index.d.ts +4 -0
- package/dist/api/inventory/index.js +4 -30
- package/dist/api/inventory/post.d.ts +7 -0
- package/dist/api/inventory/post.js +3 -10
- package/dist/api/inventory/put.d.ts +8 -0
- package/dist/api/inventory/put.js +5 -13
- package/dist/api/products/delete.d.ts +3 -0
- package/dist/api/products/delete.js +5 -13
- package/dist/api/products/get.d.ts +2 -0
- package/dist/api/products/get.js +3 -10
- package/dist/api/products/index.d.ts +4 -0
- package/dist/api/products/index.js +4 -30
- package/dist/api/products/post.d.ts +27 -0
- package/dist/api/products/post.js +5 -13
- package/dist/api/products/put.d.ts +21 -0
- package/dist/api/products/put.js +5 -13
- package/dist/api/sections/delete.d.ts +2 -0
- package/dist/api/sections/delete.js +3 -10
- package/dist/api/sections/get.d.ts +7 -0
- package/dist/api/sections/get.js +5 -13
- package/dist/api/sections/index.d.ts +4 -0
- package/dist/api/sections/index.js +4 -30
- package/dist/api/sections/post.d.ts +7 -0
- package/dist/api/sections/post.js +3 -10
- package/dist/api/sections/put.d.ts +8 -0
- package/dist/api/sections/put.js +3 -10
- package/dist/api/staff/delete.d.ts +2 -0
- package/dist/api/staff/delete.js +3 -10
- package/dist/api/staff/get.d.ts +3 -0
- package/dist/api/staff/get.js +5 -13
- package/dist/api/staff/post.d.ts +2 -0
- package/dist/api/staff/post.js +3 -10
- package/dist/api/staff/put.d.ts +2 -0
- package/dist/api/staff/put.js +3 -10
- package/dist/api/stores/get.d.ts +12 -0
- package/dist/api/stores/get.js +9 -19
- package/dist/api/stores/post.d.ts +4 -0
- package/dist/api/stores/post.js +7 -16
- package/dist/api/stores/put.d.ts +6 -0
- package/dist/api/stores/put.js +5 -13
- package/dist/api/stripe/get.d.ts +0 -0
- package/dist/api/stripe/post.d.ts +6 -0
- package/dist/api/stripe/post.js +7 -16
- package/dist/api/stripe/put.d.ts +0 -0
- package/dist/api/supplies/delete.d.ts +2 -0
- package/dist/api/supplies/delete.js +3 -10
- package/dist/api/supplies/get.d.ts +7 -0
- package/dist/api/supplies/get.js +7 -16
- package/dist/api/supplies/post.d.ts +11 -0
- package/dist/api/supplies/post.js +3 -10
- package/dist/api/supplies/put.d.ts +6 -0
- package/dist/api/supplies/put.js +5 -13
- package/dist/api/users/put.d.ts +10 -0
- package/dist/api/users/put.js +3 -10
- package/dist/enum/index.d.ts +10 -0
- package/dist/enum/index.js +4 -7
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -33
- package/dist/interfaces/Api.d.ts +3 -0
- package/dist/interfaces/Api.js +1 -2
- package/dist/interfaces/Company.d.ts +0 -0
- package/dist/interfaces/Customer.d.ts +47 -0
- package/dist/interfaces/Customer.js +1 -2
- package/dist/interfaces/Order.d.ts +91 -0
- package/dist/interfaces/Order.js +1 -2
- package/dist/interfaces/Permission.d.ts +22 -0
- package/dist/interfaces/Permission.js +1 -2
- package/dist/interfaces/Product.d.ts +51 -0
- package/dist/interfaces/Product.js +1 -2
- package/dist/interfaces/Section.d.ts +13 -0
- package/dist/interfaces/Section.js +1 -2
- package/dist/interfaces/Store.d.ts +323 -0
- package/dist/interfaces/Store.js +1 -2
- package/dist/interfaces/StoreImage.d.ts +8 -0
- package/dist/interfaces/StoreImage.js +1 -2
- package/dist/interfaces/User.d.ts +38 -0
- package/dist/interfaces/User.js +1 -2
- package/dist/utils/apiUtils.d.ts +3 -0
- package/dist/utils/apiUtils.js +2 -6
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -17
- package/dist/utils/orders/calculateOrderTotal.d.ts +5 -0
- package/dist/utils/orders/calculateOrderTotal.js +10 -14
- package/dist/utils/orders/calculateTotalTaxesIncluded.d.ts +9 -0
- package/dist/utils/orders/calculateTotalTaxesIncluded.js +3 -7
- package/dist/utils/orders/calculateTotalTaxesOverPrice.d.ts +8 -0
- package/dist/utils/orders/calculateTotalTaxesOverPrice.js +7 -11
- package/dist/utils/orders/helpers.d.ts +15 -0
- package/dist/utils/orders/helpers.js +6 -13
- package/dist/utils/orders/index.d.ts +2 -0
- package/dist/utils/orders/index.js +2 -5
- package/dist/utils/receipt/generateReceiptHTML.d.ts +0 -0
- package/dist/utils/util.d.ts +0 -0
- package/package.json +2 -1
- package/src/api/axiosInstance.ts +1 -0
- package/src/api/customers/get.ts +3 -2
- package/src/api/index.ts +0 -10
- package/src/utils/apiUtils.ts +1 -1
- package/tsconfig.json +10 -9
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,22 +7,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.getCustomerOrders = exports.getCustomerHighlightsById = exports.getCustomerById = exports.getList = void 0;
|
|
16
|
-
const apiUtils_1 = require("../../utils/apiUtils");
|
|
17
|
-
const axiosInstance_1 = __importDefault(require("../axiosInstance"));
|
|
10
|
+
import { generateQueryParamsStr } from "../../utils/apiUtils";
|
|
11
|
+
import axiosInstance from "../axiosInstance";
|
|
18
12
|
const GET_SET_CUSTOMERS = 'api/customer';
|
|
19
|
-
const getList = function (params) {
|
|
13
|
+
export const getList = function (params) {
|
|
20
14
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21
15
|
try {
|
|
22
16
|
const config = {
|
|
23
17
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
24
18
|
};
|
|
25
|
-
const queryParams =
|
|
26
|
-
return yield
|
|
19
|
+
const queryParams = generateQueryParamsStr(['searchTerm', 'name', 'phone', 'email', 'fromDate', 'toDate', 'limit', 'pageNum'], params);
|
|
20
|
+
return yield axiosInstance.get(`${GET_SET_CUSTOMERS}?${queryParams}`, config);
|
|
27
21
|
}
|
|
28
22
|
catch (error) {
|
|
29
23
|
console.error('Error fetching getStoreStaff:', error);
|
|
@@ -31,14 +25,13 @@ const getList = function (params) {
|
|
|
31
25
|
}
|
|
32
26
|
});
|
|
33
27
|
};
|
|
34
|
-
|
|
35
|
-
const getCustomerById = function (customerId) {
|
|
28
|
+
export const getCustomerById = function (customerId) {
|
|
36
29
|
return __awaiter(this, void 0, void 0, function* () {
|
|
37
30
|
try {
|
|
38
31
|
const config = {
|
|
39
32
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
40
33
|
};
|
|
41
|
-
const response = yield
|
|
34
|
+
const response = yield axiosInstance.get(`${GET_SET_CUSTOMERS}/${customerId}`, config);
|
|
42
35
|
return response.data;
|
|
43
36
|
}
|
|
44
37
|
catch (error) {
|
|
@@ -47,14 +40,13 @@ const getCustomerById = function (customerId) {
|
|
|
47
40
|
}
|
|
48
41
|
});
|
|
49
42
|
};
|
|
50
|
-
|
|
51
|
-
const getCustomerHighlightsById = function (customerId) {
|
|
43
|
+
export const getCustomerHighlightsById = function (customerId) {
|
|
52
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53
45
|
try {
|
|
54
46
|
const config = {
|
|
55
47
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
56
48
|
};
|
|
57
|
-
const response = yield
|
|
49
|
+
const response = yield axiosInstance.get(`${GET_SET_CUSTOMERS}/${customerId}/highlights`, config);
|
|
58
50
|
return response.data;
|
|
59
51
|
}
|
|
60
52
|
catch (error) {
|
|
@@ -63,14 +55,14 @@ const getCustomerHighlightsById = function (customerId) {
|
|
|
63
55
|
}
|
|
64
56
|
});
|
|
65
57
|
};
|
|
66
|
-
|
|
67
|
-
const getCustomerOrders = function (customerId, params) {
|
|
58
|
+
export const getCustomerOrders = function (customerId, params) {
|
|
68
59
|
return __awaiter(this, void 0, void 0, function* () {
|
|
69
60
|
try {
|
|
70
61
|
const config = {
|
|
71
62
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
72
63
|
};
|
|
73
|
-
|
|
64
|
+
const queryParams = generateQueryParamsStr(['limit', 'pageNum'], params);
|
|
65
|
+
return yield axiosInstance.get(`${GET_SET_CUSTOMERS}/${customerId}/orders?${queryParams}`, config);
|
|
74
66
|
}
|
|
75
67
|
catch (error) {
|
|
76
68
|
console.error('Error fetching getCustomerHighlightsById:', error);
|
|
@@ -78,4 +70,3 @@ const getCustomerOrders = function (customerId, params) {
|
|
|
78
70
|
}
|
|
79
71
|
});
|
|
80
72
|
};
|
|
81
|
-
exports.getCustomerOrders = getCustomerOrders;
|
|
@@ -1,30 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.putModule = exports.postModule = exports.getModule = exports.deleteModule = void 0;
|
|
27
|
-
exports.deleteModule = __importStar(require("./delete"));
|
|
28
|
-
exports.getModule = __importStar(require("./get"));
|
|
29
|
-
exports.postModule = __importStar(require("./post"));
|
|
30
|
-
exports.putModule = __importStar(require("./put"));
|
|
1
|
+
export * as deleteModule from './delete';
|
|
2
|
+
export * as getModule from './get';
|
|
3
|
+
export * as postModule from './post';
|
|
4
|
+
export * as putModule from './put';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
|
+
export declare const create: (this: WashdayClientInstance, data: {
|
|
3
|
+
name: string;
|
|
4
|
+
phone?: string;
|
|
5
|
+
email?: string;
|
|
6
|
+
address?: string;
|
|
7
|
+
notes?: string;
|
|
8
|
+
privateNotes?: string;
|
|
9
|
+
discount: number;
|
|
10
|
+
credit: number;
|
|
11
|
+
rfc?: string;
|
|
12
|
+
invoiceInfo?: {
|
|
13
|
+
legal_name?: string;
|
|
14
|
+
tax_system?: string;
|
|
15
|
+
zipCode?: string;
|
|
16
|
+
};
|
|
17
|
+
isActive: boolean;
|
|
18
|
+
}) => Promise<any>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,20 +7,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.create = void 0;
|
|
16
|
-
const axiosInstance_1 = __importDefault(require("../axiosInstance"));
|
|
10
|
+
import axiosInstance from "../axiosInstance";
|
|
17
11
|
const GET_SET_CUSTOMERS = 'api/customer';
|
|
18
|
-
const create = function (data) {
|
|
12
|
+
export const create = function (data) {
|
|
19
13
|
return __awaiter(this, void 0, void 0, function* () {
|
|
20
14
|
try {
|
|
21
15
|
const config = {
|
|
22
16
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
23
17
|
};
|
|
24
|
-
const response = yield
|
|
18
|
+
const response = yield axiosInstance.post(`${GET_SET_CUSTOMERS}`, data, config);
|
|
25
19
|
return response;
|
|
26
20
|
}
|
|
27
21
|
catch (error) {
|
|
@@ -30,4 +24,3 @@ const create = function (data) {
|
|
|
30
24
|
}
|
|
31
25
|
});
|
|
32
26
|
};
|
|
33
|
-
exports.create = create;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
|
+
export declare const updateById: (this: WashdayClientInstance, id: string, data: {
|
|
3
|
+
name?: string;
|
|
4
|
+
phone?: string;
|
|
5
|
+
email?: string;
|
|
6
|
+
address?: string;
|
|
7
|
+
notes?: string;
|
|
8
|
+
privateNotes?: string;
|
|
9
|
+
discount?: number;
|
|
10
|
+
credit?: number;
|
|
11
|
+
rfc?: string;
|
|
12
|
+
invoiceInfo?: {
|
|
13
|
+
legal_name?: string;
|
|
14
|
+
tax_system?: string;
|
|
15
|
+
zipCode?: string;
|
|
16
|
+
};
|
|
17
|
+
isActive?: boolean;
|
|
18
|
+
}) => Promise<any>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,12 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.updateById = void 0;
|
|
16
|
-
const axiosInstance_1 = __importDefault(require("../axiosInstance"));
|
|
10
|
+
import axiosInstance from "../axiosInstance";
|
|
17
11
|
const GET_SET_CUSTOMERS = 'api/customer';
|
|
18
12
|
// export const bulkUpdate = async function (this: WashdayClientInstance, storeId: string, data: any): Promise<any> {
|
|
19
13
|
// try {
|
|
@@ -27,13 +21,13 @@ const GET_SET_CUSTOMERS = 'api/customer';
|
|
|
27
21
|
// throw error;
|
|
28
22
|
// }
|
|
29
23
|
// };
|
|
30
|
-
const updateById = function (id, data) {
|
|
24
|
+
export const updateById = function (id, data) {
|
|
31
25
|
return __awaiter(this, void 0, void 0, function* () {
|
|
32
26
|
try {
|
|
33
27
|
const config = {
|
|
34
28
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
35
29
|
};
|
|
36
|
-
return yield
|
|
30
|
+
return yield axiosInstance.put(`${GET_SET_CUSTOMERS}/${id}`, data, config);
|
|
37
31
|
}
|
|
38
32
|
catch (error) {
|
|
39
33
|
console.error('Error fetching updateById:', error);
|
|
@@ -41,4 +35,3 @@ const updateById = function (id, data) {
|
|
|
41
35
|
}
|
|
42
36
|
});
|
|
43
37
|
};
|
|
44
|
-
exports.updateById = updateById;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
|
+
export declare const getDiscountCodes: (this: WashdayClientInstance, storeId: string, params?: string) => Promise<any>;
|
|
3
|
+
export declare const getAutomaticDiscounts: (this: WashdayClientInstance, storeId: string, params?: string) => Promise<any>;
|
|
4
|
+
export declare const getDiscountCodeById: (this: WashdayClientInstance, storeId: string, discountId: string) => Promise<any>;
|
|
5
|
+
export declare const getAutomaticDiscountById: (this: WashdayClientInstance, storeId: string, discountId: string) => Promise<any>;
|
|
6
|
+
export declare const verifyDiscountCode: (this: WashdayClientInstance, storeId: string, code: string) => Promise<any>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,15 +7,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.verifyDiscountCode = exports.getAutomaticDiscountById = exports.getDiscountCodeById = exports.getAutomaticDiscounts = exports.getDiscountCodes = void 0;
|
|
16
|
-
const axiosInstance_1 = __importDefault(require("../axiosInstance"));
|
|
10
|
+
import axiosInstance from "../axiosInstance";
|
|
17
11
|
const GET_SET_DISCOUNT_CODES = 'api/v2/discountCodes';
|
|
18
12
|
const GET_SET_AUTOMATIC_DISCOUNTS = 'api/discounts';
|
|
19
|
-
const getDiscountCodes = function (storeId, params) {
|
|
13
|
+
export const getDiscountCodes = function (storeId, params) {
|
|
20
14
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21
15
|
try {
|
|
22
16
|
let queryParams = '';
|
|
@@ -26,7 +20,7 @@ const getDiscountCodes = function (storeId, params) {
|
|
|
26
20
|
const config = {
|
|
27
21
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
28
22
|
};
|
|
29
|
-
return yield
|
|
23
|
+
return yield axiosInstance.get(`${GET_SET_DISCOUNT_CODES}/${storeId}?${queryParams}`, config);
|
|
30
24
|
}
|
|
31
25
|
catch (error) {
|
|
32
26
|
console.error('Error fetching getStores:', error);
|
|
@@ -34,8 +28,7 @@ const getDiscountCodes = function (storeId, params) {
|
|
|
34
28
|
}
|
|
35
29
|
});
|
|
36
30
|
};
|
|
37
|
-
|
|
38
|
-
const getAutomaticDiscounts = function (storeId, params) {
|
|
31
|
+
export const getAutomaticDiscounts = function (storeId, params) {
|
|
39
32
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40
33
|
try {
|
|
41
34
|
let queryParams = '';
|
|
@@ -45,7 +38,7 @@ const getAutomaticDiscounts = function (storeId, params) {
|
|
|
45
38
|
const config = {
|
|
46
39
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
47
40
|
};
|
|
48
|
-
return yield
|
|
41
|
+
return yield axiosInstance.get(`${GET_SET_AUTOMATIC_DISCOUNTS}/${storeId}?${queryParams}`, config);
|
|
49
42
|
}
|
|
50
43
|
catch (error) {
|
|
51
44
|
console.error('Error fetching getStores:', error);
|
|
@@ -53,14 +46,13 @@ const getAutomaticDiscounts = function (storeId, params) {
|
|
|
53
46
|
}
|
|
54
47
|
});
|
|
55
48
|
};
|
|
56
|
-
|
|
57
|
-
const getDiscountCodeById = function (storeId, discountId) {
|
|
49
|
+
export const getDiscountCodeById = function (storeId, discountId) {
|
|
58
50
|
return __awaiter(this, void 0, void 0, function* () {
|
|
59
51
|
try {
|
|
60
52
|
const config = {
|
|
61
53
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
62
54
|
};
|
|
63
|
-
return yield
|
|
55
|
+
return yield axiosInstance.get(`${GET_SET_DISCOUNT_CODES}/${storeId}/${discountId}`, config);
|
|
64
56
|
}
|
|
65
57
|
catch (error) {
|
|
66
58
|
console.error('Error fetching getDiscountCodeById:', error);
|
|
@@ -68,14 +60,13 @@ const getDiscountCodeById = function (storeId, discountId) {
|
|
|
68
60
|
}
|
|
69
61
|
});
|
|
70
62
|
};
|
|
71
|
-
|
|
72
|
-
const getAutomaticDiscountById = function (storeId, discountId) {
|
|
63
|
+
export const getAutomaticDiscountById = function (storeId, discountId) {
|
|
73
64
|
return __awaiter(this, void 0, void 0, function* () {
|
|
74
65
|
try {
|
|
75
66
|
const config = {
|
|
76
67
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
77
68
|
};
|
|
78
|
-
return yield
|
|
69
|
+
return yield axiosInstance.get(`${GET_SET_AUTOMATIC_DISCOUNTS}/${storeId}/${discountId}`, config);
|
|
79
70
|
}
|
|
80
71
|
catch (error) {
|
|
81
72
|
console.error('Error fetching getDiscountCodeById:', error);
|
|
@@ -83,14 +74,13 @@ const getAutomaticDiscountById = function (storeId, discountId) {
|
|
|
83
74
|
}
|
|
84
75
|
});
|
|
85
76
|
};
|
|
86
|
-
|
|
87
|
-
const verifyDiscountCode = function (storeId, code) {
|
|
77
|
+
export const verifyDiscountCode = function (storeId, code) {
|
|
88
78
|
return __awaiter(this, void 0, void 0, function* () {
|
|
89
79
|
try {
|
|
90
80
|
const config = {
|
|
91
81
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
92
82
|
};
|
|
93
|
-
return yield
|
|
83
|
+
return yield axiosInstance.get(`${GET_SET_DISCOUNT_CODES}/${storeId}/${code}/verify`, config);
|
|
94
84
|
}
|
|
95
85
|
catch (error) {
|
|
96
86
|
console.error('Error fetching getDiscountCodeById:', error);
|
|
@@ -98,4 +88,3 @@ const verifyDiscountCode = function (storeId, code) {
|
|
|
98
88
|
}
|
|
99
89
|
});
|
|
100
90
|
};
|
|
101
|
-
exports.verifyDiscountCode = verifyDiscountCode;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
|
+
export declare const createAutomaticDiscount: (this: WashdayClientInstance, storeId: string, data: any) => Promise<any>;
|
|
3
|
+
export declare const createDiscountCode: (this: WashdayClientInstance, storeId: string, data: any) => Promise<any>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,21 +7,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.createDiscountCode = exports.createAutomaticDiscount = void 0;
|
|
16
|
-
const axiosInstance_1 = __importDefault(require("../axiosInstance"));
|
|
10
|
+
import axiosInstance from "../axiosInstance";
|
|
17
11
|
const GET_SET_DISCOUNT_CODES = 'api/v2/discountCodes';
|
|
18
12
|
const GET_SET_AUTOMATIC_DISCOUNTS = 'api/discounts';
|
|
19
|
-
const createAutomaticDiscount = function (storeId, data) {
|
|
13
|
+
export const createAutomaticDiscount = function (storeId, data) {
|
|
20
14
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21
15
|
try {
|
|
22
16
|
const config = {
|
|
23
17
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
24
18
|
};
|
|
25
|
-
return yield
|
|
19
|
+
return yield axiosInstance.post(`${GET_SET_AUTOMATIC_DISCOUNTS}/${storeId}`, data, config);
|
|
26
20
|
}
|
|
27
21
|
catch (error) {
|
|
28
22
|
console.error('Error fetching createAutomaticDiscount:', error);
|
|
@@ -30,14 +24,13 @@ const createAutomaticDiscount = function (storeId, data) {
|
|
|
30
24
|
}
|
|
31
25
|
});
|
|
32
26
|
};
|
|
33
|
-
|
|
34
|
-
const createDiscountCode = function (storeId, data) {
|
|
27
|
+
export const createDiscountCode = function (storeId, data) {
|
|
35
28
|
return __awaiter(this, void 0, void 0, function* () {
|
|
36
29
|
try {
|
|
37
30
|
const config = {
|
|
38
31
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
39
32
|
};
|
|
40
|
-
return yield
|
|
33
|
+
return yield axiosInstance.post(`${GET_SET_DISCOUNT_CODES}/${storeId}`, data, config);
|
|
41
34
|
}
|
|
42
35
|
catch (error) {
|
|
43
36
|
console.error('Error fetching createAutomaticDiscount:', error);
|
|
@@ -45,4 +38,3 @@ const createDiscountCode = function (storeId, data) {
|
|
|
45
38
|
}
|
|
46
39
|
});
|
|
47
40
|
};
|
|
48
|
-
exports.createDiscountCode = createDiscountCode;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
|
+
export declare const deleteDiscountCodeById: (this: WashdayClientInstance, storeId: string, discountId: string) => Promise<any>;
|
|
3
|
+
export declare const deleteAutomaticDiscountById: (this: WashdayClientInstance, storeId: string, discountId: string) => Promise<any>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,21 +7,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.deleteAutomaticDiscountById = exports.deleteDiscountCodeById = void 0;
|
|
16
|
-
const axiosInstance_1 = __importDefault(require("../axiosInstance"));
|
|
10
|
+
import axiosInstance from "../axiosInstance";
|
|
17
11
|
const GET_SET_DISCOUNT_CODES = 'api/v2/discountCodes';
|
|
18
12
|
const GET_SET_AUTOMATIC_DISCOUNTS = 'api/discounts';
|
|
19
|
-
const deleteDiscountCodeById = function (storeId, discountId) {
|
|
13
|
+
export const deleteDiscountCodeById = function (storeId, discountId) {
|
|
20
14
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21
15
|
try {
|
|
22
16
|
const config = {
|
|
23
17
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
24
18
|
};
|
|
25
|
-
return yield
|
|
19
|
+
return yield axiosInstance.delete(`${GET_SET_DISCOUNT_CODES}/${storeId}/${discountId}`, config);
|
|
26
20
|
}
|
|
27
21
|
catch (error) {
|
|
28
22
|
console.error('Error fetching deleteDiscountCodeById:', error);
|
|
@@ -30,14 +24,13 @@ const deleteDiscountCodeById = function (storeId, discountId) {
|
|
|
30
24
|
}
|
|
31
25
|
});
|
|
32
26
|
};
|
|
33
|
-
|
|
34
|
-
const deleteAutomaticDiscountById = function (storeId, discountId) {
|
|
27
|
+
export const deleteAutomaticDiscountById = function (storeId, discountId) {
|
|
35
28
|
return __awaiter(this, void 0, void 0, function* () {
|
|
36
29
|
try {
|
|
37
30
|
const config = {
|
|
38
31
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
39
32
|
};
|
|
40
|
-
return yield
|
|
33
|
+
return yield axiosInstance.delete(`${GET_SET_AUTOMATIC_DISCOUNTS}/${storeId}/${discountId}`, config);
|
|
41
34
|
}
|
|
42
35
|
catch (error) {
|
|
43
36
|
console.error('Error fetching deleteAutomaticDiscountById:', error);
|
|
@@ -45,4 +38,3 @@ const deleteAutomaticDiscountById = function (storeId, discountId) {
|
|
|
45
38
|
}
|
|
46
39
|
});
|
|
47
40
|
};
|
|
48
|
-
exports.deleteAutomaticDiscountById = deleteAutomaticDiscountById;
|