washday-sdk 1.6.58 → 1.6.60
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/companies/get.js +16 -0
- package/dist/api/companies/post.js +30 -0
- package/dist/api/index.js +7 -3
- package/dist/api/stripe/post.js +1 -0
- package/dist/api/users/put.js +16 -0
- package/package.json +1 -1
- package/src/api/companies/get.ts +18 -0
- package/src/api/companies/post.ts +34 -1
- package/src/api/index.ts +7 -3
- package/src/api/stripe/post.ts +1 -0
- package/src/api/users/put.ts +21 -0
- package/src/interfaces/Api.ts +7 -3
- package/src/interfaces/Company.ts +28 -0
- package/src/interfaces/User.ts +3 -1
- package/test/companies.cfdiBillingAddon.test.ts +54 -0
- package/test/users.driverPushToken.test.ts +44 -0
|
@@ -8,6 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
const GET_SET_COMPANIES = 'api/company';
|
|
11
|
+
const GET_SET_BILLING = 'api/billing';
|
|
11
12
|
export const getCompanyById = function (companyId) {
|
|
12
13
|
return __awaiter(this, void 0, void 0, function* () {
|
|
13
14
|
try {
|
|
@@ -53,3 +54,18 @@ export const getGarmentAttributeCatalogs = function (companyId) {
|
|
|
53
54
|
}
|
|
54
55
|
});
|
|
55
56
|
};
|
|
57
|
+
export const getCFDIAddonStatus = function (data) {
|
|
58
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
try {
|
|
60
|
+
const config = {
|
|
61
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
62
|
+
};
|
|
63
|
+
const response = yield this.axiosInstance.get(`${GET_SET_BILLING}/cfdi/status?companyId=${encodeURIComponent(data.companyId)}`, config);
|
|
64
|
+
return response;
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
console.error('Error fetching getCFDIAddonStatus:', error);
|
|
68
|
+
throw error;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
};
|
|
@@ -69,3 +69,33 @@ export const disableBillingOverage = function (data) {
|
|
|
69
69
|
}
|
|
70
70
|
});
|
|
71
71
|
};
|
|
72
|
+
export const enableCFDIAddon = function (data) {
|
|
73
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
try {
|
|
75
|
+
const config = {
|
|
76
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
77
|
+
};
|
|
78
|
+
const response = yield this.axiosInstance.post(`${GET_SET_BILLING}/cfdi/enable`, data, config);
|
|
79
|
+
return response;
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
console.error('Error fetching enableCFDIAddon:', error);
|
|
83
|
+
throw error;
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
export const disableCFDIAddon = function (data) {
|
|
88
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
89
|
+
try {
|
|
90
|
+
const config = {
|
|
91
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
92
|
+
};
|
|
93
|
+
const response = yield this.axiosInstance.post(`${GET_SET_BILLING}/cfdi/disable`, data, config);
|
|
94
|
+
return response;
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
console.error('Error fetching disableCFDIAddon:', error);
|
|
98
|
+
throw error;
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
};
|
package/dist/api/index.js
CHANGED
|
@@ -2,8 +2,8 @@ import { deleteCashierBoxById, deleteCashierBoxMovementById } from "./cashierbox
|
|
|
2
2
|
import { getCashierBoxMovementsHistory, getCashierboxesById, getCashierboxesByStoreId } from "./cashierbox/get";
|
|
3
3
|
import { addCashierBoxMovement, createCashierBox } from "./cashierbox/post";
|
|
4
4
|
import { updateCashierBoxById, updateCashierBoxMovementById } from "./cashierbox/put";
|
|
5
|
-
import { getCompanyById, getCompanyOrdersMetrics, getGarmentAttributeCatalogs } from "./companies/get";
|
|
6
|
-
import { disableBillingOverage, enableBillingOverage, updateCFDIOrgLogo, updateCompanyTaxInfoCertificates } from "./companies/post";
|
|
5
|
+
import { getCFDIAddonStatus, getCompanyById, getCompanyOrdersMetrics, getGarmentAttributeCatalogs } from "./companies/get";
|
|
6
|
+
import { disableBillingOverage, disableCFDIAddon, enableBillingOverage, enableCFDIAddon, updateCFDIOrgLogo, updateCompanyTaxInfoCertificates } from "./companies/post";
|
|
7
7
|
import { updateCompanyById, updateCompanyLogoById, updateCompanySubscriptionBillingInfoById, updateCompanyTaxInfoById, updateGarmentAttributeCatalogsById } from "./companies/put";
|
|
8
8
|
import { getCountries } from "./countries/get";
|
|
9
9
|
import * as configEndpoints from "./config";
|
|
@@ -22,7 +22,7 @@ import { deleteSupplyById } from "./supplies/delete";
|
|
|
22
22
|
import { getSupplies, getSupplyById, getSupplyHistory } from "./supplies/get";
|
|
23
23
|
import { createSupply } from "./supplies/post";
|
|
24
24
|
import { addSupplyStock, updateSupplyById } from "./supplies/put";
|
|
25
|
-
import { updateUserById } from "./users/put";
|
|
25
|
+
import { updatePushNotificationTokenDriversApp, updateUserById } from "./users/put";
|
|
26
26
|
import { getUserStoreAccess } from "./users/get";
|
|
27
27
|
import * as inventoryEndpoints from './inventory';
|
|
28
28
|
import * as sectionsEndpoints from './sections';
|
|
@@ -214,6 +214,7 @@ const WashdayClient = function WashdayClient(apiToken, env = 'PROD', clientId, c
|
|
|
214
214
|
});
|
|
215
215
|
this.users = bindMethods(this, {
|
|
216
216
|
updateUserById: updateUserById,
|
|
217
|
+
updatePushNotificationTokenDriversApp: updatePushNotificationTokenDriversApp,
|
|
217
218
|
getUserStoreAccess: getUserStoreAccess,
|
|
218
219
|
deleteUserById: deleteUserById,
|
|
219
220
|
validateUserPin: validateUserPin,
|
|
@@ -284,6 +285,9 @@ const WashdayClient = function WashdayClient(apiToken, env = 'PROD', clientId, c
|
|
|
284
285
|
updateCFDIOrgLogo: updateCFDIOrgLogo,
|
|
285
286
|
enableBillingOverage: enableBillingOverage,
|
|
286
287
|
disableBillingOverage: disableBillingOverage,
|
|
288
|
+
enableCFDIAddon: enableCFDIAddon,
|
|
289
|
+
disableCFDIAddon: disableCFDIAddon,
|
|
290
|
+
getCFDIAddonStatus: getCFDIAddonStatus,
|
|
287
291
|
});
|
|
288
292
|
this.stripe = bindMethods(this, {
|
|
289
293
|
createCreateSuscriptionCheckoutSession: createCreateSuscriptionCheckoutSession,
|
package/dist/api/stripe/post.js
CHANGED
|
@@ -39,6 +39,7 @@ export const createCustomerPortalSession = function (data) {
|
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
41
|
};
|
|
42
|
+
/** @deprecated Legacy standalone CFDI checkout. New activations use companies.enableCFDIAddon. */
|
|
42
43
|
export const createCFDISuscrptionCheckoutSession = function (data) {
|
|
43
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
44
45
|
try {
|
package/dist/api/users/put.js
CHANGED
|
@@ -8,6 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
const GET_SET_USER = 'api/user';
|
|
11
|
+
const DRIVERS_APP_PUSH_TOKEN_ENDPOINT = 'api/driversapp/users/me/push-token';
|
|
11
12
|
const REQUEST_PARAMS = {
|
|
12
13
|
token: 'LOGGED_USER_TOKEN',
|
|
13
14
|
};
|
|
@@ -26,3 +27,18 @@ export const updateUserById = function (userId, data) {
|
|
|
26
27
|
}
|
|
27
28
|
});
|
|
28
29
|
};
|
|
30
|
+
export const updatePushNotificationTokenDriversApp = function (data) {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
try {
|
|
33
|
+
const config = {
|
|
34
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
35
|
+
};
|
|
36
|
+
const response = yield this.axiosInstance.put(DRIVERS_APP_PUSH_TOKEN_ENDPOINT, data, config);
|
|
37
|
+
return response.data || {};
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
console.error('Error updating drivers app push notification token:', error);
|
|
41
|
+
throw error;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
};
|
package/package.json
CHANGED
package/src/api/companies/get.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
|
+
import { GetCFDIAddonStatusRequest } from "../../interfaces/Company";
|
|
2
3
|
|
|
3
4
|
const GET_SET_COMPANIES = 'api/company';
|
|
5
|
+
const GET_SET_BILLING = 'api/billing';
|
|
4
6
|
|
|
5
7
|
export const getCompanyById = async function (this: WashdayClientInstance, companyId: string): Promise<any> {
|
|
6
8
|
try {
|
|
@@ -40,3 +42,19 @@ export const getGarmentAttributeCatalogs = async function (this: WashdayClientIn
|
|
|
40
42
|
throw error;
|
|
41
43
|
}
|
|
42
44
|
};
|
|
45
|
+
|
|
46
|
+
export const getCFDIAddonStatus = async function (
|
|
47
|
+
this: WashdayClientInstance,
|
|
48
|
+
data: GetCFDIAddonStatusRequest,
|
|
49
|
+
): Promise<any> {
|
|
50
|
+
try {
|
|
51
|
+
const config = {
|
|
52
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
53
|
+
};
|
|
54
|
+
const response = await this.axiosInstance.get(`${GET_SET_BILLING}/cfdi/status?companyId=${encodeURIComponent(data.companyId)}`, config);
|
|
55
|
+
return response;
|
|
56
|
+
} catch (error) {
|
|
57
|
+
console.error('Error fetching getCFDIAddonStatus:', error);
|
|
58
|
+
throw error;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
|
+
import { CFDIAddonToggleRequest } from "../../interfaces/Company";
|
|
2
3
|
import axiosInstance from "../axiosInstance";
|
|
3
4
|
const GET_SET_COMPANIES = 'api/company';
|
|
4
5
|
const GET_SET_BILLING = 'api/billing';
|
|
@@ -57,4 +58,36 @@ export const disableBillingOverage = async function (this: WashdayClientInstance
|
|
|
57
58
|
console.error('Error fetching disableBillingOverage:', error);
|
|
58
59
|
throw error;
|
|
59
60
|
}
|
|
60
|
-
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export const enableCFDIAddon = async function (
|
|
64
|
+
this: WashdayClientInstance,
|
|
65
|
+
data: CFDIAddonToggleRequest
|
|
66
|
+
): Promise<any> {
|
|
67
|
+
try {
|
|
68
|
+
const config = {
|
|
69
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
70
|
+
};
|
|
71
|
+
const response = await this.axiosInstance.post(`${GET_SET_BILLING}/cfdi/enable`, data, config);
|
|
72
|
+
return response;
|
|
73
|
+
} catch (error) {
|
|
74
|
+
console.error('Error fetching enableCFDIAddon:', error);
|
|
75
|
+
throw error;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export const disableCFDIAddon = async function (
|
|
80
|
+
this: WashdayClientInstance,
|
|
81
|
+
data: CFDIAddonToggleRequest
|
|
82
|
+
): Promise<any> {
|
|
83
|
+
try {
|
|
84
|
+
const config = {
|
|
85
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
86
|
+
};
|
|
87
|
+
const response = await this.axiosInstance.post(`${GET_SET_BILLING}/cfdi/disable`, data, config);
|
|
88
|
+
return response;
|
|
89
|
+
} catch (error) {
|
|
90
|
+
console.error('Error fetching disableCFDIAddon:', error);
|
|
91
|
+
throw error;
|
|
92
|
+
}
|
|
93
|
+
}
|
package/src/api/index.ts
CHANGED
|
@@ -3,8 +3,8 @@ import { deleteCashierBoxById, deleteCashierBoxMovementById } from "./cashierbox
|
|
|
3
3
|
import { getCashierBoxMovementsHistory, getCashierboxesById, getCashierboxesByStoreId } from "./cashierbox/get";
|
|
4
4
|
import { addCashierBoxMovement, createCashierBox } from "./cashierbox/post";
|
|
5
5
|
import { updateCashierBoxById, updateCashierBoxMovementById } from "./cashierbox/put";
|
|
6
|
-
import { getCompanyById, getCompanyOrdersMetrics, getGarmentAttributeCatalogs } from "./companies/get";
|
|
7
|
-
import { disableBillingOverage, enableBillingOverage, updateCFDIOrgLogo, updateCompanyTaxInfoCertificates } from "./companies/post";
|
|
6
|
+
import { getCFDIAddonStatus, getCompanyById, getCompanyOrdersMetrics, getGarmentAttributeCatalogs } from "./companies/get";
|
|
7
|
+
import { disableBillingOverage, disableCFDIAddon, enableBillingOverage, enableCFDIAddon, updateCFDIOrgLogo, updateCompanyTaxInfoCertificates } from "./companies/post";
|
|
8
8
|
import { updateCompanyById, updateCompanyLogoById, updateCompanySubscriptionBillingInfoById, updateCompanyTaxInfoById, updateGarmentAttributeCatalogsById } from "./companies/put";
|
|
9
9
|
import { getCountries } from "./countries/get";
|
|
10
10
|
import * as configEndpoints from "./config";
|
|
@@ -23,7 +23,7 @@ import { deleteSupplyById } from "./supplies/delete";
|
|
|
23
23
|
import { getSupplies, getSupplyById, getSupplyHistory } from "./supplies/get";
|
|
24
24
|
import { createSupply } from "./supplies/post";
|
|
25
25
|
import { addSupplyStock, updateSupplyById } from "./supplies/put";
|
|
26
|
-
import { updateUserById } from "./users/put";
|
|
26
|
+
import { updatePushNotificationTokenDriversApp, updateUserById } from "./users/put";
|
|
27
27
|
import { getUserStoreAccess } from "./users/get";
|
|
28
28
|
import * as inventoryEndpoints from './inventory';
|
|
29
29
|
import * as sectionsEndpoints from './sections';
|
|
@@ -221,6 +221,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
221
221
|
});
|
|
222
222
|
this.users = bindMethods(this, {
|
|
223
223
|
updateUserById: updateUserById,
|
|
224
|
+
updatePushNotificationTokenDriversApp: updatePushNotificationTokenDriversApp,
|
|
224
225
|
getUserStoreAccess: getUserStoreAccess,
|
|
225
226
|
deleteUserById: deleteUserById,
|
|
226
227
|
validateUserPin: validateUserPin,
|
|
@@ -291,6 +292,9 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
291
292
|
updateCFDIOrgLogo: updateCFDIOrgLogo,
|
|
292
293
|
enableBillingOverage: enableBillingOverage,
|
|
293
294
|
disableBillingOverage: disableBillingOverage,
|
|
295
|
+
enableCFDIAddon: enableCFDIAddon,
|
|
296
|
+
disableCFDIAddon: disableCFDIAddon,
|
|
297
|
+
getCFDIAddonStatus: getCFDIAddonStatus,
|
|
294
298
|
});
|
|
295
299
|
this.stripe = bindMethods(this, {
|
|
296
300
|
createCreateSuscriptionCheckoutSession: createCreateSuscriptionCheckoutSession,
|
package/src/api/stripe/post.ts
CHANGED
|
@@ -48,6 +48,7 @@ export const createCustomerPortalSession = async function (
|
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
+
/** @deprecated Legacy standalone CFDI checkout. New activations use companies.enableCFDIAddon. */
|
|
51
52
|
export const createCFDISuscrptionCheckoutSession = async function (
|
|
52
53
|
this: WashdayClientInstance,
|
|
53
54
|
data?: CreateCFDISubscriptionCheckoutSessionRequest
|
package/src/api/users/put.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { IStore } from "../../interfaces/Store";
|
|
|
3
3
|
import { IUser } from "../../interfaces/User";
|
|
4
4
|
import axiosInstance from "../axiosInstance";
|
|
5
5
|
const GET_SET_USER = 'api/user';
|
|
6
|
+
const DRIVERS_APP_PUSH_TOKEN_ENDPOINT = 'api/driversapp/users/me/push-token';
|
|
6
7
|
const REQUEST_PARAMS = {
|
|
7
8
|
token: 'LOGGED_USER_TOKEN',
|
|
8
9
|
};
|
|
@@ -22,6 +23,10 @@ interface userDTO {
|
|
|
22
23
|
confirmNewPassword?: string;
|
|
23
24
|
}
|
|
24
25
|
|
|
26
|
+
export interface updatePushNotificationTokenDriversAppDTO {
|
|
27
|
+
driversAppPushNotificationToken: string | null;
|
|
28
|
+
}
|
|
29
|
+
|
|
25
30
|
export const updateUserById = async function (this: WashdayClientInstance, userId: string, data: userDTO): Promise<any> {
|
|
26
31
|
try {
|
|
27
32
|
const config = {
|
|
@@ -34,3 +39,19 @@ export const updateUserById = async function (this: WashdayClientInstance, userI
|
|
|
34
39
|
throw error;
|
|
35
40
|
}
|
|
36
41
|
};
|
|
42
|
+
|
|
43
|
+
export const updatePushNotificationTokenDriversApp = async function (
|
|
44
|
+
this: WashdayClientInstance,
|
|
45
|
+
data: updatePushNotificationTokenDriversAppDTO
|
|
46
|
+
): Promise<any> {
|
|
47
|
+
try {
|
|
48
|
+
const config = {
|
|
49
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
50
|
+
};
|
|
51
|
+
const response = await this.axiosInstance.put(DRIVERS_APP_PUSH_TOKEN_ENDPOINT, data, config);
|
|
52
|
+
return response.data || {}
|
|
53
|
+
} catch (error) {
|
|
54
|
+
console.error('Error updating drivers app push notification token:', error);
|
|
55
|
+
throw error;
|
|
56
|
+
}
|
|
57
|
+
};
|
package/src/interfaces/Api.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { deleteCashierBoxById, deleteCashierBoxMovementById } from "../api/cashi
|
|
|
2
2
|
import { getCashierBoxMovementsHistory, getCashierboxesById, getCashierboxesByStoreId } from "../api/cashierbox/get";
|
|
3
3
|
import { addCashierBoxMovement, createCashierBox } from "../api/cashierbox/post";
|
|
4
4
|
import { updateCashierBoxById, updateCashierBoxMovementById } from "../api/cashierbox/put";
|
|
5
|
-
import { getCompanyById, getCompanyOrdersMetrics, getGarmentAttributeCatalogs } from "../api/companies/get";
|
|
6
|
-
import { disableBillingOverage, enableBillingOverage, updateCFDIOrgLogo, updateCompanyTaxInfoCertificates } from "../api/companies/post";
|
|
5
|
+
import { getCFDIAddonStatus, getCompanyById, getCompanyOrdersMetrics, getGarmentAttributeCatalogs } from "../api/companies/get";
|
|
6
|
+
import { disableBillingOverage, disableCFDIAddon, enableBillingOverage, enableCFDIAddon, updateCFDIOrgLogo, updateCompanyTaxInfoCertificates } from "../api/companies/post";
|
|
7
7
|
import { updateCompanyById, updateCompanyLogoById, updateCompanySubscriptionBillingInfoById, updateCompanyTaxInfoById, updateGarmentAttributeCatalogsById } from "../api/companies/put";
|
|
8
8
|
import { getCountries } from "../api/countries/get";
|
|
9
9
|
import * as configEndpoints from "../api/config";
|
|
@@ -22,7 +22,7 @@ import { deleteSupplyById } from "../api/supplies/delete";
|
|
|
22
22
|
import { getSupplies, getSupplyById, getSupplyHistory } from "../api/supplies/get";
|
|
23
23
|
import { createSupply } from "../api/supplies/post";
|
|
24
24
|
import { addSupplyStock, updateSupplyById } from "../api/supplies/put";
|
|
25
|
-
import { updateUserById } from "../api/users/put";
|
|
25
|
+
import { updatePushNotificationTokenDriversApp, updateUserById } from "../api/users/put";
|
|
26
26
|
import { getUserStoreAccess } from "../api/users/get";
|
|
27
27
|
import * as inventoryEndpoints from '../api/inventory';
|
|
28
28
|
import * as sectionsEndpoints from '../api/sections';
|
|
@@ -206,6 +206,7 @@ export interface WashdayClientInstance {
|
|
|
206
206
|
};
|
|
207
207
|
users: {
|
|
208
208
|
updateUserById: typeof updateUserById;
|
|
209
|
+
updatePushNotificationTokenDriversApp: typeof updatePushNotificationTokenDriversApp;
|
|
209
210
|
getUserStoreAccess: typeof getUserStoreAccess;
|
|
210
211
|
deleteUserById: typeof deleteUserById;
|
|
211
212
|
validateUserPin: typeof validateUserPin;
|
|
@@ -276,6 +277,9 @@ export interface WashdayClientInstance {
|
|
|
276
277
|
updateCFDIOrgLogo: typeof updateCFDIOrgLogo;
|
|
277
278
|
enableBillingOverage: typeof enableBillingOverage;
|
|
278
279
|
disableBillingOverage: typeof disableBillingOverage;
|
|
280
|
+
enableCFDIAddon: typeof enableCFDIAddon;
|
|
281
|
+
disableCFDIAddon: typeof disableCFDIAddon;
|
|
282
|
+
getCFDIAddonStatus: typeof getCFDIAddonStatus;
|
|
279
283
|
};
|
|
280
284
|
stripe: {
|
|
281
285
|
createCreateSuscriptionCheckoutSession: typeof createCreateSuscriptionCheckoutSession;
|
|
@@ -31,6 +31,34 @@ export interface UpdateCompanySubscriptionBillingInfoPayload {
|
|
|
31
31
|
subscriptionBillingInfo: ISubscriptionBillingInfo;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
export type CFDIBillingMode = "none" | "separate_subscription" | "main_subscription_item";
|
|
35
|
+
export type CFDIMigrationStatus = "none" | "pending_cycle_end" | "migrated";
|
|
36
|
+
|
|
37
|
+
export interface CFDIAddonStatus {
|
|
38
|
+
enabled: boolean;
|
|
39
|
+
billingMode: CFDIBillingMode;
|
|
40
|
+
migrationStatus: CFDIMigrationStatus;
|
|
41
|
+
isLegacy: boolean;
|
|
42
|
+
canToggleFromUI: boolean;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface CFDIAddonToggleRequest {
|
|
46
|
+
companyId: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface GetCFDIAddonStatusRequest {
|
|
50
|
+
companyId: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface IStripeSettings {
|
|
54
|
+
stripeCFDISubID: string | null;
|
|
55
|
+
stripeCFDISubItemID: string | null;
|
|
56
|
+
cfdiBillingMode?: CFDIBillingMode;
|
|
57
|
+
cfdiMigrationStatus?: CFDIMigrationStatus;
|
|
58
|
+
legacyStripeCFDISubID?: string | null;
|
|
59
|
+
legacyStripeCFDISubItemID?: string | null;
|
|
60
|
+
}
|
|
61
|
+
|
|
34
62
|
export interface ICompanyTaxInfo {
|
|
35
63
|
name?: string;
|
|
36
64
|
legal_name?: string;
|
package/src/interfaces/User.ts
CHANGED
|
@@ -20,6 +20,8 @@ export interface IUser {
|
|
|
20
20
|
verified: boolean,
|
|
21
21
|
cashierBox?: ICashierBox | string | null,
|
|
22
22
|
printer?: IPrinterConfig,
|
|
23
|
+
pushNotificationToken?: string,
|
|
24
|
+
driversAppPushNotificationToken?: string,
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
export interface ISecretCode {
|
|
@@ -40,4 +42,4 @@ export interface ISuperAdmin extends IUser {
|
|
|
40
42
|
export interface IStaff extends IUser {
|
|
41
43
|
store: IStore | string,
|
|
42
44
|
cashierBox: ICashierBox | string,
|
|
43
|
-
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import {
|
|
2
|
+
disableCFDIAddon,
|
|
3
|
+
enableCFDIAddon,
|
|
4
|
+
} from "../src/api/companies/post";
|
|
5
|
+
import { getCFDIAddonStatus } from "../src/api/companies/get";
|
|
6
|
+
|
|
7
|
+
describe("CFDI billing add-on company endpoints", () => {
|
|
8
|
+
it("enables the CFDI add-on through the billing endpoint", async () => {
|
|
9
|
+
const post = jest.fn().mockResolvedValue({ data: { data: { enabled: true } } });
|
|
10
|
+
const client = {
|
|
11
|
+
apiToken: "token-1",
|
|
12
|
+
axiosInstance: { post },
|
|
13
|
+
} as any;
|
|
14
|
+
|
|
15
|
+
await enableCFDIAddon.call(client, { companyId: "company-1" });
|
|
16
|
+
|
|
17
|
+
expect(post).toHaveBeenCalledWith(
|
|
18
|
+
"api/billing/cfdi/enable",
|
|
19
|
+
{ companyId: "company-1" },
|
|
20
|
+
{ headers: { Authorization: "Bearer token-1" } },
|
|
21
|
+
);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it("disables the CFDI add-on through the billing endpoint", async () => {
|
|
25
|
+
const post = jest.fn().mockResolvedValue({ data: { data: { enabled: false } } });
|
|
26
|
+
const client = {
|
|
27
|
+
apiToken: "token-1",
|
|
28
|
+
axiosInstance: { post },
|
|
29
|
+
} as any;
|
|
30
|
+
|
|
31
|
+
await disableCFDIAddon.call(client, { companyId: "company-1" });
|
|
32
|
+
|
|
33
|
+
expect(post).toHaveBeenCalledWith(
|
|
34
|
+
"api/billing/cfdi/disable",
|
|
35
|
+
{ companyId: "company-1" },
|
|
36
|
+
{ headers: { Authorization: "Bearer token-1" } },
|
|
37
|
+
);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it("fetches CFDI add-on status without exposing Stripe IDs in the request", async () => {
|
|
41
|
+
const get = jest.fn().mockResolvedValue({ data: { data: { enabled: false } } });
|
|
42
|
+
const client = {
|
|
43
|
+
apiToken: "token-1",
|
|
44
|
+
axiosInstance: { get },
|
|
45
|
+
} as any;
|
|
46
|
+
|
|
47
|
+
await getCFDIAddonStatus.call(client, { companyId: "company-1" });
|
|
48
|
+
|
|
49
|
+
expect(get).toHaveBeenCalledWith(
|
|
50
|
+
"api/billing/cfdi/status?companyId=company-1",
|
|
51
|
+
{ headers: { Authorization: "Bearer token-1" } },
|
|
52
|
+
);
|
|
53
|
+
});
|
|
54
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { WashdayClient } from "../src";
|
|
2
|
+
import { updatePushNotificationTokenDriversApp } from "../src/api/users/put";
|
|
3
|
+
|
|
4
|
+
describe("driver app user push token api", () => {
|
|
5
|
+
it("updates the driver app push token through the driver-scoped endpoint", async () => {
|
|
6
|
+
const put = jest.fn().mockResolvedValue({ data: { data: { ok: true } } });
|
|
7
|
+
const client = {
|
|
8
|
+
apiToken: "token-123",
|
|
9
|
+
axiosInstance: { put },
|
|
10
|
+
} as any;
|
|
11
|
+
|
|
12
|
+
await updatePushNotificationTokenDriversApp.call(client, {
|
|
13
|
+
driversAppPushNotificationToken: "ExponentPushToken[driver]",
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
expect(put).toHaveBeenCalledWith(
|
|
17
|
+
"api/driversapp/users/me/push-token",
|
|
18
|
+
{ driversAppPushNotificationToken: "ExponentPushToken[driver]" },
|
|
19
|
+
{
|
|
20
|
+
headers: { Authorization: "Bearer token-123" },
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("exposes updatePushNotificationTokenDriversApp through the users module", async () => {
|
|
26
|
+
const put = jest.fn().mockResolvedValue({ data: { data: { ok: true } } });
|
|
27
|
+
const client = new WashdayClient("token-123", "DEV") as any;
|
|
28
|
+
client.axiosInstance = { put };
|
|
29
|
+
|
|
30
|
+
expect(typeof client.users.updatePushNotificationTokenDriversApp).toBe("function");
|
|
31
|
+
|
|
32
|
+
await client.users.updatePushNotificationTokenDriversApp({
|
|
33
|
+
driversAppPushNotificationToken: null,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
expect(put).toHaveBeenCalledWith(
|
|
37
|
+
"api/driversapp/users/me/push-token",
|
|
38
|
+
{ driversAppPushNotificationToken: null },
|
|
39
|
+
{
|
|
40
|
+
headers: { Authorization: "Bearer token-123" },
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
});
|
|
44
|
+
});
|