washday-sdk 0.0.141 → 0.0.143
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/auth/post.js +17 -5
- package/dist/api/index.js +2 -0
- package/dist/api/order/post.js +14 -0
- package/package.json +1 -1
- package/src/api/auth/post.ts +17 -5
- package/src/api/index.ts +2 -0
- package/src/api/order/post.ts +12 -0
- package/src/api/users/put.ts +1 -0
- package/src/interfaces/Api.ts +2 -0
- package/src/utils/orders/calculateTotalTaxesOverPrice.ts +0 -2
package/dist/api/auth/post.js
CHANGED
|
@@ -8,13 +8,25 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import axiosInstance from "../axiosInstance";
|
|
11
|
-
const
|
|
11
|
+
const CUSTOMERSAPP_GET_AUTH = "api/v2/washdayapp/auth";
|
|
12
12
|
const REGULAR_USER_AUTH = "api/auth";
|
|
13
|
+
export const customerLoginToken = function (params) {
|
|
14
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
15
|
+
try {
|
|
16
|
+
const config = {};
|
|
17
|
+
return yield axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/tokenLogin`, params, config);
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
console.error('Error fetching customerLoginToken:', error);
|
|
21
|
+
throw error;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
};
|
|
13
25
|
export const appleLogin = function (params) {
|
|
14
26
|
return __awaiter(this, void 0, void 0, function* () {
|
|
15
27
|
try {
|
|
16
28
|
const config = {};
|
|
17
|
-
return yield axiosInstance.post(`${
|
|
29
|
+
return yield axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/apple`, params, config);
|
|
18
30
|
}
|
|
19
31
|
catch (error) {
|
|
20
32
|
console.error('Error fetching appleLogin:', error);
|
|
@@ -26,7 +38,7 @@ export const customerRegularLogin = function (params) {
|
|
|
26
38
|
return __awaiter(this, void 0, void 0, function* () {
|
|
27
39
|
try {
|
|
28
40
|
const config = {};
|
|
29
|
-
return yield axiosInstance.post(`${
|
|
41
|
+
return yield axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/login`, params, config);
|
|
30
42
|
}
|
|
31
43
|
catch (error) {
|
|
32
44
|
console.error('Error fetching customerRegularLogin:', error);
|
|
@@ -38,7 +50,7 @@ export const customerSignUp = function (params) {
|
|
|
38
50
|
return __awaiter(this, void 0, void 0, function* () {
|
|
39
51
|
try {
|
|
40
52
|
const config = {};
|
|
41
|
-
return yield axiosInstance.post(`${
|
|
53
|
+
return yield axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/signUp`, params, config);
|
|
42
54
|
}
|
|
43
55
|
catch (error) {
|
|
44
56
|
console.error('Error fetching customerSignUp:', error);
|
|
@@ -50,7 +62,7 @@ export const googleLogin = function (params) {
|
|
|
50
62
|
return __awaiter(this, void 0, void 0, function* () {
|
|
51
63
|
try {
|
|
52
64
|
const config = {};
|
|
53
|
-
return yield axiosInstance.post(`${
|
|
65
|
+
return yield axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/google`, params, config);
|
|
54
66
|
}
|
|
55
67
|
catch (error) {
|
|
56
68
|
console.error('Error fetching googleLogin:', error);
|
package/dist/api/index.js
CHANGED
|
@@ -75,6 +75,7 @@ const WashdayClient = function WashdayClient(apiToken) {
|
|
|
75
75
|
closeStoreRoutes: routesEndpoints.putModule.closeStoreRoutes,
|
|
76
76
|
});
|
|
77
77
|
this.auth = bindMethods(this, {
|
|
78
|
+
customerLoginToken: authEndpoints.postModule.customerLoginToken,
|
|
78
79
|
googleLogin: authEndpoints.postModule.googleLogin,
|
|
79
80
|
appleLogin: authEndpoints.postModule.appleLogin,
|
|
80
81
|
customerRegularLogin: authEndpoints.postModule.customerRegularLogin,
|
|
@@ -100,6 +101,7 @@ const WashdayClient = function WashdayClient(apiToken) {
|
|
|
100
101
|
createPaymentLine: ordersEndpoints.postModule.createPaymentLine,
|
|
101
102
|
sendEmailReceipt: ordersEndpoints.postModule.sendEmailReceipt,
|
|
102
103
|
createOrderCustomersApp: ordersEndpoints.postModule.createOrderCustomersApp,
|
|
104
|
+
createOrderUsersApp: ordersEndpoints.postModule.createOrderUsersApp,
|
|
103
105
|
deletePaymentLineById: ordersEndpoints.deleteModule.deletePaymentLineById,
|
|
104
106
|
getListCustomersApp: ordersEndpoints.getModule.getListCustomersApp,
|
|
105
107
|
getByIdCustomersApp: ordersEndpoints.getModule.getByIdCustomersApp,
|
package/dist/api/order/post.js
CHANGED
|
@@ -53,3 +53,17 @@ export const createOrderCustomersApp = function (data) {
|
|
|
53
53
|
}
|
|
54
54
|
});
|
|
55
55
|
};
|
|
56
|
+
export const createOrderUsersApp = function (data) {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
try {
|
|
59
|
+
const config = {
|
|
60
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
61
|
+
};
|
|
62
|
+
return yield axiosInstance.post(`${GET_SET_ORDER}`, data, config);
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
console.error('Error fetching createOrderUsersApp:', error);
|
|
66
|
+
throw error;
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
};
|
package/package.json
CHANGED
package/src/api/auth/post.ts
CHANGED
|
@@ -2,9 +2,21 @@
|
|
|
2
2
|
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
3
3
|
import { AppleAuthenticationCredential } from "../../interfaces/Apple";
|
|
4
4
|
import axiosInstance from "../axiosInstance";
|
|
5
|
-
const
|
|
5
|
+
const CUSTOMERSAPP_GET_AUTH = "api/v2/washdayapp/auth"
|
|
6
6
|
const REGULAR_USER_AUTH = "api/auth"
|
|
7
7
|
|
|
8
|
+
export const customerLoginToken = async function (this: WashdayClientInstance, params: {
|
|
9
|
+
token: string;
|
|
10
|
+
}): Promise<any> {
|
|
11
|
+
try {
|
|
12
|
+
const config = {};
|
|
13
|
+
return await axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/tokenLogin`, params, config);
|
|
14
|
+
} catch (error) {
|
|
15
|
+
console.error('Error fetching customerLoginToken:', error);
|
|
16
|
+
throw error;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
8
20
|
export const appleLogin = async function (this: WashdayClientInstance, params: {
|
|
9
21
|
companyId: string;
|
|
10
22
|
storeId: string;
|
|
@@ -12,7 +24,7 @@ export const appleLogin = async function (this: WashdayClientInstance, params: {
|
|
|
12
24
|
}): Promise<any> {
|
|
13
25
|
try {
|
|
14
26
|
const config = {};
|
|
15
|
-
return await axiosInstance.post(`${
|
|
27
|
+
return await axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/apple`, params, config);
|
|
16
28
|
} catch (error) {
|
|
17
29
|
console.error('Error fetching appleLogin:', error);
|
|
18
30
|
throw error;
|
|
@@ -27,7 +39,7 @@ export const customerRegularLogin = async function (this: WashdayClientInstance,
|
|
|
27
39
|
}): Promise<any> {
|
|
28
40
|
try {
|
|
29
41
|
const config = {};
|
|
30
|
-
return await axiosInstance.post(`${
|
|
42
|
+
return await axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/login`, params, config);
|
|
31
43
|
} catch (error) {
|
|
32
44
|
console.error('Error fetching customerRegularLogin:', error);
|
|
33
45
|
throw error;
|
|
@@ -44,7 +56,7 @@ export const customerSignUp = async function (this: WashdayClientInstance, param
|
|
|
44
56
|
}): Promise<any> {
|
|
45
57
|
try {
|
|
46
58
|
const config = {};
|
|
47
|
-
return await axiosInstance.post(`${
|
|
59
|
+
return await axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/signUp`, params, config);
|
|
48
60
|
} catch (error) {
|
|
49
61
|
console.error('Error fetching customerSignUp:', error);
|
|
50
62
|
throw error;
|
|
@@ -64,7 +76,7 @@ export const googleLogin = async function (this: WashdayClientInstance, params:
|
|
|
64
76
|
}): Promise<any> {
|
|
65
77
|
try {
|
|
66
78
|
const config = {};
|
|
67
|
-
return await axiosInstance.post(`${
|
|
79
|
+
return await axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/google`, params, config);
|
|
68
80
|
} catch (error) {
|
|
69
81
|
console.error('Error fetching googleLogin:', error);
|
|
70
82
|
throw error;
|
package/src/api/index.ts
CHANGED
|
@@ -81,6 +81,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
81
81
|
closeStoreRoutes: routesEndpoints.putModule.closeStoreRoutes,
|
|
82
82
|
});
|
|
83
83
|
this.auth = bindMethods(this, {
|
|
84
|
+
customerLoginToken: authEndpoints.postModule.customerLoginToken,
|
|
84
85
|
googleLogin: authEndpoints.postModule.googleLogin,
|
|
85
86
|
appleLogin: authEndpoints.postModule.appleLogin,
|
|
86
87
|
customerRegularLogin: authEndpoints.postModule.customerRegularLogin,
|
|
@@ -106,6 +107,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
106
107
|
createPaymentLine: ordersEndpoints.postModule.createPaymentLine,
|
|
107
108
|
sendEmailReceipt: ordersEndpoints.postModule.sendEmailReceipt,
|
|
108
109
|
createOrderCustomersApp: ordersEndpoints.postModule.createOrderCustomersApp,
|
|
110
|
+
createOrderUsersApp: ordersEndpoints.postModule.createOrderUsersApp,
|
|
109
111
|
deletePaymentLineById: ordersEndpoints.deleteModule.deletePaymentLineById,
|
|
110
112
|
getListCustomersApp: ordersEndpoints.getModule.getListCustomersApp,
|
|
111
113
|
getByIdCustomersApp: ordersEndpoints.getModule.getByIdCustomersApp,
|
package/src/api/order/post.ts
CHANGED
|
@@ -45,4 +45,16 @@ export const createOrderCustomersApp = async function (this: WashdayClientInstan
|
|
|
45
45
|
console.error('Error fetching createOrderCustomersApp:', error);
|
|
46
46
|
throw error;
|
|
47
47
|
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const createOrderUsersApp = async function (this: WashdayClientInstance, data: OrderDto): Promise<any> {
|
|
51
|
+
try {
|
|
52
|
+
const config = {
|
|
53
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
54
|
+
};
|
|
55
|
+
return await axiosInstance.post(`${GET_SET_ORDER}`, data, config);
|
|
56
|
+
} catch (error) {
|
|
57
|
+
console.error('Error fetching createOrderUsersApp:', error);
|
|
58
|
+
throw error;
|
|
59
|
+
}
|
|
48
60
|
};
|
package/src/api/users/put.ts
CHANGED
package/src/interfaces/Api.ts
CHANGED
|
@@ -57,6 +57,7 @@ export interface WashdayClientInstance {
|
|
|
57
57
|
cancelCFDI: typeof cfdiEndpoints.deleteModule.cancelCFDI
|
|
58
58
|
}
|
|
59
59
|
auth: {
|
|
60
|
+
customerLoginToken: typeof authEndpoints.postModule.customerLoginToken;
|
|
60
61
|
googleLogin: typeof authEndpoints.postModule.googleLogin;
|
|
61
62
|
appleLogin: typeof authEndpoints.postModule.appleLogin;
|
|
62
63
|
customerRegularLogin: typeof authEndpoints.postModule.customerRegularLogin;
|
|
@@ -92,6 +93,7 @@ export interface WashdayClientInstance {
|
|
|
92
93
|
setOrdeDeliveredBySequence: typeof ordersEndpoints.putModule.setOrdeDeliveredBySequence,
|
|
93
94
|
createPaymentLine: typeof ordersEndpoints.postModule.createPaymentLine;
|
|
94
95
|
createOrderCustomersApp: typeof ordersEndpoints.postModule.createOrderCustomersApp,
|
|
96
|
+
createOrderUsersApp: typeof ordersEndpoints.postModule.createOrderUsersApp,
|
|
95
97
|
deletePaymentLineById: typeof ordersEndpoints.deleteModule.deletePaymentLineById;
|
|
96
98
|
getListCustomersApp: typeof ordersEndpoints.getModule.getListCustomersApp;
|
|
97
99
|
getByIdCustomersApp: typeof ordersEndpoints.getModule.getByIdCustomersApp;
|
|
@@ -8,8 +8,6 @@ export const calculateTotalTaxesOverPrice = (
|
|
|
8
8
|
storeDiscounts: any[],
|
|
9
9
|
appliedOrderDiscounts: any,
|
|
10
10
|
discountCodeObj: any | null
|
|
11
|
-
|
|
12
|
-
|
|
13
11
|
) => {
|
|
14
12
|
const productTableImports = [...order.products, ...order.buyAndGetProducts].map((current) => {
|
|
15
13
|
let discPercentageInteger = 0;
|