washday-sdk 0.0.23 → 0.0.25
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/babel.config.js +7 -7
- package/dist/api/axiosInstance.js +2 -1
- package/dist/api/index.js +8 -2
- package/dist/api/products/get.js +7 -0
- package/dist/api/products/post.js +7 -0
- package/dist/api/products/put.js +36 -0
- package/dist/api/stores/post.js +37 -0
- package/dist/utils/receipt/generateReceiptHTML.js +157 -0
- package/dist/utils/util.js +46 -0
- package/package.json +29 -28
- package/src/api/axiosInstance.ts +47 -46
- package/src/api/customers/get.ts +32 -32
- package/src/api/index.ts +37 -29
- package/src/api/products/get.ts +9 -0
- package/src/api/products/post.ts +11 -0
- package/src/api/products/put.ts +21 -0
- package/src/api/stores/get.ts +36 -36
- package/src/api/stores/post.ts +23 -0
- package/src/api/stores/put.ts +20 -20
- package/src/enum/index.ts +10 -10
- package/src/index.ts +4 -4
- package/src/interfaces/Api.ts +2 -2
- package/src/interfaces/Customer.ts +51 -51
- package/src/interfaces/Order.ts +95 -95
- package/src/interfaces/Permission.ts +24 -24
- package/src/interfaces/Product.ts +58 -58
- package/src/interfaces/Section.ts +14 -14
- package/src/interfaces/Store.ts +350 -350
- package/src/interfaces/StoreImage.ts +9 -9
- package/src/interfaces/User.ts +42 -42
- package/src/utils/index.ts +1 -1
- package/src/utils/orders/calculateOrderTotal.test.js +399 -399
- package/src/utils/orders/calculateOrderTotal.ts +60 -60
- package/src/utils/orders/calculateTotalTaxesIncluded.ts +75 -75
- package/src/utils/orders/calculateTotalTaxesOverPrice.ts +82 -82
- package/src/utils/orders/helpers.ts +73 -73
- package/src/utils/orders/index.ts +4 -4
- package/src/utils/receipt/generateReceiptHTML.ts +163 -0
- package/src/utils/util.ts +47 -0
- package/tsconfig.json +9 -9
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
|
+
import { IStore } from "../../interfaces/Store";
|
|
3
|
+
import axiosInstance from "../axiosInstance";
|
|
4
|
+
const GET_SET_PRODUCTS = 'api/product';
|
|
5
|
+
const REQUEST_PARAMS = {
|
|
6
|
+
token: 'LOGGED_USER_TOKEN',
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
export const bulkUpdate = async function (this: WashdayClientInstance, storeId: string, data: IStore): Promise<any> {
|
|
11
|
+
try {
|
|
12
|
+
const config = {
|
|
13
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
14
|
+
};
|
|
15
|
+
const response = await axiosInstance.put(`${GET_SET_PRODUCTS}/${storeId}/bulk`, data, config);
|
|
16
|
+
return response.data || {}
|
|
17
|
+
} catch (error) {
|
|
18
|
+
console.error('Error fetching getStoreById:', error);
|
|
19
|
+
throw error;
|
|
20
|
+
}
|
|
21
|
+
};
|
package/src/api/stores/get.ts
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
|
-
import { IStore } from "../../interfaces/Store";
|
|
3
|
-
import axiosInstance from "../axiosInstance";
|
|
4
|
-
|
|
5
|
-
const GET_SET_STORES = 'api/store';
|
|
6
|
-
const REQUEST_PARAMS = {
|
|
7
|
-
token: 'LOGGED_USER_TOKEN',
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export const getStores = async function (this: WashdayClientInstance, params: {
|
|
11
|
-
isActive?: string
|
|
12
|
-
}): Promise<{ stores: IStore[] }> {
|
|
13
|
-
try {
|
|
14
|
-
REQUEST_PARAMS.token = this.apiToken;
|
|
15
|
-
let queryParams = '';
|
|
16
|
-
if (params.isActive) {
|
|
17
|
-
queryParams += `isActive=${params.isActive}`
|
|
18
|
-
}
|
|
19
|
-
const response = await axiosInstance.get(`${GET_SET_STORES}?${queryParams}`, { params: { ...REQUEST_PARAMS } });
|
|
20
|
-
return response.data?.data?.stores || [];
|
|
21
|
-
} catch (error) {
|
|
22
|
-
console.error('Error fetching getStores:', error);
|
|
23
|
-
throw error;
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
export const getStoreById = async function (this: WashdayClientInstance, storeId: string): Promise<{ store: IStore }> {
|
|
29
|
-
try {
|
|
30
|
-
REQUEST_PARAMS.token = this.apiToken;
|
|
31
|
-
const response = await axiosInstance.get(`${GET_SET_STORES}/${storeId}`, { params: { ...REQUEST_PARAMS } });
|
|
32
|
-
return response.data?.data || {}
|
|
33
|
-
} catch (error) {
|
|
34
|
-
console.error('Error fetching getStoreById:', error);
|
|
35
|
-
throw error;
|
|
36
|
-
}
|
|
1
|
+
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
|
+
import { IStore } from "../../interfaces/Store";
|
|
3
|
+
import axiosInstance from "../axiosInstance";
|
|
4
|
+
|
|
5
|
+
const GET_SET_STORES = 'api/store';
|
|
6
|
+
const REQUEST_PARAMS = {
|
|
7
|
+
token: 'LOGGED_USER_TOKEN',
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const getStores = async function (this: WashdayClientInstance, params: {
|
|
11
|
+
isActive?: string
|
|
12
|
+
}): Promise<{ stores: IStore[] }> {
|
|
13
|
+
try {
|
|
14
|
+
REQUEST_PARAMS.token = this.apiToken;
|
|
15
|
+
let queryParams = '';
|
|
16
|
+
if (params.isActive) {
|
|
17
|
+
queryParams += `isActive=${params.isActive}`
|
|
18
|
+
}
|
|
19
|
+
const response = await axiosInstance.get(`${GET_SET_STORES}?${queryParams}`, { params: { ...REQUEST_PARAMS } });
|
|
20
|
+
return response.data?.data?.stores || [];
|
|
21
|
+
} catch (error) {
|
|
22
|
+
console.error('Error fetching getStores:', error);
|
|
23
|
+
throw error;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
export const getStoreById = async function (this: WashdayClientInstance, storeId: string): Promise<{ store: IStore }> {
|
|
29
|
+
try {
|
|
30
|
+
REQUEST_PARAMS.token = this.apiToken;
|
|
31
|
+
const response = await axiosInstance.get(`${GET_SET_STORES}/${storeId}`, { params: { ...REQUEST_PARAMS } });
|
|
32
|
+
return response.data?.data || {}
|
|
33
|
+
} catch (error) {
|
|
34
|
+
console.error('Error fetching getStoreById:', error);
|
|
35
|
+
throw error;
|
|
36
|
+
}
|
|
37
37
|
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
|
+
import { IStore } from "../../interfaces/Store";
|
|
3
|
+
import axiosInstance from "../axiosInstance";
|
|
4
|
+
|
|
5
|
+
const GET_SET_STORES = 'api/store';
|
|
6
|
+
const GET_SET_STORE_IMAGE = 'api/store-image';
|
|
7
|
+
|
|
8
|
+
const REQUEST_PARAMS = {
|
|
9
|
+
token: 'LOGGED_USER_TOKEN',
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const createStoreImage = async function (this: WashdayClientInstance, data: any): Promise<any> {
|
|
13
|
+
try {
|
|
14
|
+
const config = {
|
|
15
|
+
headers: { Authorization: `Bearer ${this.apiToken}`, contentType: 'multipart/form-data' }
|
|
16
|
+
};
|
|
17
|
+
const response = await axiosInstance.post(`${GET_SET_STORE_IMAGE}`, data, config);
|
|
18
|
+
return response;
|
|
19
|
+
} catch (error) {
|
|
20
|
+
console.error('Error fetching createStoreImage:', error);
|
|
21
|
+
throw error;
|
|
22
|
+
}
|
|
23
|
+
};
|
package/src/api/stores/put.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
|
-
import { IStore } from "../../interfaces/Store";
|
|
3
|
-
import axiosInstance from "../axiosInstance";
|
|
4
|
-
const GET_SET_STORES = 'api/store';
|
|
5
|
-
const REQUEST_PARAMS = {
|
|
6
|
-
token: 'LOGGED_USER_TOKEN',
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export const updateStoreById = async function (this: WashdayClientInstance, storeId: string, data: IStore): Promise<{ store: IStore }> {
|
|
11
|
-
try {
|
|
12
|
-
const config = {
|
|
13
|
-
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
14
|
-
};
|
|
15
|
-
const response = await axiosInstance.put(`${GET_SET_STORES}/${storeId}`, data, config);
|
|
16
|
-
return response.data || {}
|
|
17
|
-
} catch (error) {
|
|
18
|
-
console.error('Error fetching getStoreById:', error);
|
|
19
|
-
throw error;
|
|
20
|
-
}
|
|
1
|
+
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
|
+
import { IStore } from "../../interfaces/Store";
|
|
3
|
+
import axiosInstance from "../axiosInstance";
|
|
4
|
+
const GET_SET_STORES = 'api/store';
|
|
5
|
+
const REQUEST_PARAMS = {
|
|
6
|
+
token: 'LOGGED_USER_TOKEN',
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
export const updateStoreById = async function (this: WashdayClientInstance, storeId: string, data: IStore): Promise<{ store: IStore }> {
|
|
11
|
+
try {
|
|
12
|
+
const config = {
|
|
13
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
14
|
+
};
|
|
15
|
+
const response = await axiosInstance.put(`${GET_SET_STORES}/${storeId}`, data, config);
|
|
16
|
+
return response.data || {}
|
|
17
|
+
} catch (error) {
|
|
18
|
+
console.error('Error fetching getStoreById:', error);
|
|
19
|
+
throw error;
|
|
20
|
+
}
|
|
21
21
|
};
|
package/src/enum/index.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export enum DiscountCodeTypes {
|
|
2
|
-
PERCENTAGE = 'percentage',
|
|
3
|
-
NUMBER = 'number',
|
|
4
|
-
FREE_DELIVERY = 'freeDelivery',
|
|
5
|
-
BUY_X_GET_Y = 'buyXGetY'
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export enum BuyAndGetConditionsTypes {
|
|
9
|
-
PERCENTAGE = 'percentage',
|
|
10
|
-
FREE = 'free'
|
|
1
|
+
export enum DiscountCodeTypes {
|
|
2
|
+
PERCENTAGE = 'percentage',
|
|
3
|
+
NUMBER = 'number',
|
|
4
|
+
FREE_DELIVERY = 'freeDelivery',
|
|
5
|
+
BUY_X_GET_Y = 'buyXGetY'
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export enum BuyAndGetConditionsTypes {
|
|
9
|
+
PERCENTAGE = 'percentage',
|
|
10
|
+
FREE = 'free'
|
|
11
11
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as utils from './utils';
|
|
2
|
-
import WashdayClient from './api';
|
|
3
|
-
|
|
4
|
-
export { WashdayClient, utils };
|
|
1
|
+
import * as utils from './utils';
|
|
2
|
+
import WashdayClient from './api';
|
|
3
|
+
|
|
4
|
+
export { WashdayClient, utils };
|
package/src/interfaces/Api.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type WashdayClientInstance = {
|
|
2
|
-
apiToken: string;
|
|
1
|
+
export type WashdayClientInstance = {
|
|
2
|
+
apiToken: string;
|
|
3
3
|
};
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import { IStore } from './Store'
|
|
2
|
-
import { IUser } from "./User"
|
|
3
|
-
|
|
4
|
-
interface IInvoiceInfo {
|
|
5
|
-
legal_name: string,
|
|
6
|
-
tax_system: string,
|
|
7
|
-
zipCode: string
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
interface IAddresses {
|
|
11
|
-
addressString: string,
|
|
12
|
-
addressName: string,
|
|
13
|
-
location: {
|
|
14
|
-
latitude: string,
|
|
15
|
-
longitude: string
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
interface IPaymentMethod {
|
|
20
|
-
stripeId: string,
|
|
21
|
-
brand: string,
|
|
22
|
-
exp_month: string,
|
|
23
|
-
exp_year: string,
|
|
24
|
-
last4: string,
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface ICustomer {
|
|
28
|
-
name: string,
|
|
29
|
-
phone: string,
|
|
30
|
-
address: string,
|
|
31
|
-
rfc?: string,
|
|
32
|
-
email: string,
|
|
33
|
-
notes?: string,
|
|
34
|
-
privateNotes?: string,
|
|
35
|
-
discount: number,
|
|
36
|
-
credit: number,
|
|
37
|
-
isActive: boolean,
|
|
38
|
-
createdIn: IStore | string,
|
|
39
|
-
createdBy: IUser | string,
|
|
40
|
-
// company: ICompany | string,
|
|
41
|
-
createdDate: Date,
|
|
42
|
-
password?: string,
|
|
43
|
-
google?: boolean,
|
|
44
|
-
facebook?: boolean,
|
|
45
|
-
apple?: boolean,
|
|
46
|
-
useStoreApp?: boolean,
|
|
47
|
-
addresses?: [IAddresses],
|
|
48
|
-
paymentMethods?: [IPaymentMethod],
|
|
49
|
-
stripeCustomerId?: string,
|
|
50
|
-
invoiceInfo?: IInvoiceInfo,
|
|
51
|
-
}
|
|
1
|
+
import { IStore } from './Store'
|
|
2
|
+
import { IUser } from "./User"
|
|
3
|
+
|
|
4
|
+
interface IInvoiceInfo {
|
|
5
|
+
legal_name: string,
|
|
6
|
+
tax_system: string,
|
|
7
|
+
zipCode: string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface IAddresses {
|
|
11
|
+
addressString: string,
|
|
12
|
+
addressName: string,
|
|
13
|
+
location: {
|
|
14
|
+
latitude: string,
|
|
15
|
+
longitude: string
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface IPaymentMethod {
|
|
20
|
+
stripeId: string,
|
|
21
|
+
brand: string,
|
|
22
|
+
exp_month: string,
|
|
23
|
+
exp_year: string,
|
|
24
|
+
last4: string,
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface ICustomer {
|
|
28
|
+
name: string,
|
|
29
|
+
phone: string,
|
|
30
|
+
address: string,
|
|
31
|
+
rfc?: string,
|
|
32
|
+
email: string,
|
|
33
|
+
notes?: string,
|
|
34
|
+
privateNotes?: string,
|
|
35
|
+
discount: number,
|
|
36
|
+
credit: number,
|
|
37
|
+
isActive: boolean,
|
|
38
|
+
createdIn: IStore | string,
|
|
39
|
+
createdBy: IUser | string,
|
|
40
|
+
// company: ICompany | string,
|
|
41
|
+
createdDate: Date,
|
|
42
|
+
password?: string,
|
|
43
|
+
google?: boolean,
|
|
44
|
+
facebook?: boolean,
|
|
45
|
+
apple?: boolean,
|
|
46
|
+
useStoreApp?: boolean,
|
|
47
|
+
addresses?: [IAddresses],
|
|
48
|
+
paymentMethods?: [IPaymentMethod],
|
|
49
|
+
stripeCustomerId?: string,
|
|
50
|
+
invoiceInfo?: IInvoiceInfo,
|
|
51
|
+
}
|
package/src/interfaces/Order.ts
CHANGED
|
@@ -1,96 +1,96 @@
|
|
|
1
|
-
import { ICustomer } from "./Customer";
|
|
2
|
-
import { IOrderProduct, IProduct } from "./Product";
|
|
3
|
-
import { ICashierBox, IStore, ITaxConfig } from "./Store";
|
|
4
|
-
import { IUser } from "./User";
|
|
5
|
-
|
|
6
|
-
interface IDeliveryInfo {
|
|
7
|
-
date: Date,
|
|
8
|
-
fromTime: string,
|
|
9
|
-
toTime: string
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
interface IPickupInfo {
|
|
13
|
-
date: Date,
|
|
14
|
-
fromTime: string,
|
|
15
|
-
toTime: string
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface IOrderPaymentLines {
|
|
19
|
-
_id?: any,
|
|
20
|
-
amountPaid: number,
|
|
21
|
-
isOnACashUpReport: Boolean,
|
|
22
|
-
cashierBox: ICashierBox | string
|
|
23
|
-
paymentDate: Date,
|
|
24
|
-
paymentMethod: string,
|
|
25
|
-
description: string,
|
|
26
|
-
createdBy: IUser | string,
|
|
27
|
-
facturapiPaymentInvoiceID?: string | null,
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface IOrder {
|
|
31
|
-
delivery: boolean,
|
|
32
|
-
pickup: boolean,
|
|
33
|
-
express: boolean,
|
|
34
|
-
deliveryInfo: IDeliveryInfo,
|
|
35
|
-
pickupInfo?: IPickupInfo,
|
|
36
|
-
phone: string,
|
|
37
|
-
email?: string,
|
|
38
|
-
address: string,
|
|
39
|
-
notes?: string,
|
|
40
|
-
privateNotes?: string,
|
|
41
|
-
isActive: boolean,
|
|
42
|
-
taxesType: string,
|
|
43
|
-
products: Array<IOrderProduct> | Array<string>,
|
|
44
|
-
buyAndGetProducts: Array<IOrderProduct> | Array<string>,
|
|
45
|
-
taxOne?: ITaxConfig,
|
|
46
|
-
taxTwo?: ITaxConfig,
|
|
47
|
-
taxThree?: ITaxConfig,
|
|
48
|
-
creditApplied: number,
|
|
49
|
-
taxesTotal: number,
|
|
50
|
-
total: number,
|
|
51
|
-
totalQuantity: number,
|
|
52
|
-
productTotal: number,
|
|
53
|
-
productTotalWithoutDiscount: number,
|
|
54
|
-
shippingServiceTotal: number,
|
|
55
|
-
totalDiscountAmount: number,
|
|
56
|
-
amountPaid: number,
|
|
57
|
-
prepaidAmount: number | null,
|
|
58
|
-
createdIn: IStore | string,
|
|
59
|
-
createdBy: IUser | string,
|
|
60
|
-
customer: ICustomer | string,
|
|
61
|
-
customerDiscount?: number | null,
|
|
62
|
-
createdDate: Date,
|
|
63
|
-
pickingUpDateTime: Date | null,
|
|
64
|
-
cleanedDateTime: Date | null,
|
|
65
|
-
readyDateTime: Date | null,
|
|
66
|
-
deliveringDateTime: Date | null,
|
|
67
|
-
collectedDateTime: Date | null,
|
|
68
|
-
cancelledDateTime: Date | null,
|
|
69
|
-
paidDateTime: Date | null,
|
|
70
|
-
paymentMethod: string | null
|
|
71
|
-
prepaidPaymentMethod: string | null
|
|
72
|
-
status: string,
|
|
73
|
-
pickupRoute: string | null,
|
|
74
|
-
deliveryRoute: string | null,
|
|
75
|
-
sequence?: string | null,
|
|
76
|
-
notifyBy: string,
|
|
77
|
-
stripePaymentIntentId?: string | null,
|
|
78
|
-
markedCleanedBy: IUser | string,
|
|
79
|
-
markedCollectedBy: IUser | string,
|
|
80
|
-
markedCancelledBy: IUser | string,
|
|
81
|
-
appliedStoreDiscounts: Array<string> | null,
|
|
82
|
-
appliedDiscountCodes: Array<string> | null,
|
|
83
|
-
paymentLines: Array<IOrderPaymentLines> | Array<string> | any,
|
|
84
|
-
facturapiInvoiceID?: string | null,
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
export interface IOrderInfo {
|
|
89
|
-
topProducts: IProduct[];
|
|
90
|
-
sales: number;
|
|
91
|
-
totalOrderQuantities: number;
|
|
92
|
-
paidFromCredit: number;
|
|
93
|
-
paid: number;
|
|
94
|
-
unpaid: number;
|
|
95
|
-
lastOrderDate: Date;
|
|
1
|
+
import { ICustomer } from "./Customer";
|
|
2
|
+
import { IOrderProduct, IProduct } from "./Product";
|
|
3
|
+
import { ICashierBox, IStore, ITaxConfig } from "./Store";
|
|
4
|
+
import { IUser } from "./User";
|
|
5
|
+
|
|
6
|
+
interface IDeliveryInfo {
|
|
7
|
+
date: Date,
|
|
8
|
+
fromTime: string,
|
|
9
|
+
toTime: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface IPickupInfo {
|
|
13
|
+
date: Date,
|
|
14
|
+
fromTime: string,
|
|
15
|
+
toTime: string
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface IOrderPaymentLines {
|
|
19
|
+
_id?: any,
|
|
20
|
+
amountPaid: number,
|
|
21
|
+
isOnACashUpReport: Boolean,
|
|
22
|
+
cashierBox: ICashierBox | string
|
|
23
|
+
paymentDate: Date,
|
|
24
|
+
paymentMethod: string,
|
|
25
|
+
description: string,
|
|
26
|
+
createdBy: IUser | string,
|
|
27
|
+
facturapiPaymentInvoiceID?: string | null,
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface IOrder {
|
|
31
|
+
delivery: boolean,
|
|
32
|
+
pickup: boolean,
|
|
33
|
+
express: boolean,
|
|
34
|
+
deliveryInfo: IDeliveryInfo,
|
|
35
|
+
pickupInfo?: IPickupInfo,
|
|
36
|
+
phone: string,
|
|
37
|
+
email?: string,
|
|
38
|
+
address: string,
|
|
39
|
+
notes?: string,
|
|
40
|
+
privateNotes?: string,
|
|
41
|
+
isActive: boolean,
|
|
42
|
+
taxesType: string,
|
|
43
|
+
products: Array<IOrderProduct> | Array<string>,
|
|
44
|
+
buyAndGetProducts: Array<IOrderProduct> | Array<string>,
|
|
45
|
+
taxOne?: ITaxConfig,
|
|
46
|
+
taxTwo?: ITaxConfig,
|
|
47
|
+
taxThree?: ITaxConfig,
|
|
48
|
+
creditApplied: number,
|
|
49
|
+
taxesTotal: number,
|
|
50
|
+
total: number,
|
|
51
|
+
totalQuantity: number,
|
|
52
|
+
productTotal: number,
|
|
53
|
+
productTotalWithoutDiscount: number,
|
|
54
|
+
shippingServiceTotal: number,
|
|
55
|
+
totalDiscountAmount: number,
|
|
56
|
+
amountPaid: number,
|
|
57
|
+
prepaidAmount: number | null,
|
|
58
|
+
createdIn: IStore | string,
|
|
59
|
+
createdBy: IUser | string,
|
|
60
|
+
customer: ICustomer | string,
|
|
61
|
+
customerDiscount?: number | null,
|
|
62
|
+
createdDate: Date,
|
|
63
|
+
pickingUpDateTime: Date | null,
|
|
64
|
+
cleanedDateTime: Date | null,
|
|
65
|
+
readyDateTime: Date | null,
|
|
66
|
+
deliveringDateTime: Date | null,
|
|
67
|
+
collectedDateTime: Date | null,
|
|
68
|
+
cancelledDateTime: Date | null,
|
|
69
|
+
paidDateTime: Date | null,
|
|
70
|
+
paymentMethod: string | null
|
|
71
|
+
prepaidPaymentMethod: string | null
|
|
72
|
+
status: string,
|
|
73
|
+
pickupRoute: string | null,
|
|
74
|
+
deliveryRoute: string | null,
|
|
75
|
+
sequence?: string | null,
|
|
76
|
+
notifyBy: string,
|
|
77
|
+
stripePaymentIntentId?: string | null,
|
|
78
|
+
markedCleanedBy: IUser | string,
|
|
79
|
+
markedCollectedBy: IUser | string,
|
|
80
|
+
markedCancelledBy: IUser | string,
|
|
81
|
+
appliedStoreDiscounts: Array<string> | null,
|
|
82
|
+
appliedDiscountCodes: Array<string> | null,
|
|
83
|
+
paymentLines: Array<IOrderPaymentLines> | Array<string> | any,
|
|
84
|
+
facturapiInvoiceID?: string | null,
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
export interface IOrderInfo {
|
|
89
|
+
topProducts: IProduct[];
|
|
90
|
+
sales: number;
|
|
91
|
+
totalOrderQuantities: number;
|
|
92
|
+
paidFromCredit: number;
|
|
93
|
+
paid: number;
|
|
94
|
+
unpaid: number;
|
|
95
|
+
lastOrderDate: Date;
|
|
96
96
|
}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
export interface IPermissionType {
|
|
3
|
-
canView: Boolean,
|
|
4
|
-
canMutate: Boolean
|
|
5
|
-
}
|
|
6
|
-
export interface IPermissionViewType {
|
|
7
|
-
canView: Boolean,
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface IPermission {
|
|
11
|
-
product: IPermissionType,
|
|
12
|
-
section: IPermissionType,
|
|
13
|
-
auth: IPermissionType,
|
|
14
|
-
staff: IPermissionType,
|
|
15
|
-
company: IPermissionType,
|
|
16
|
-
store: IPermissionType,
|
|
17
|
-
settings: IPermissionViewType,
|
|
18
|
-
cashierBoxes: IPermissionType,
|
|
19
|
-
reports: IPermissionViewType,
|
|
20
|
-
customers: IPermissionType,
|
|
21
|
-
discounts: IPermissionType,
|
|
22
|
-
reviews: IPermissionViewType,
|
|
23
|
-
inventory: IPermissionType,
|
|
24
|
-
}
|
|
1
|
+
|
|
2
|
+
export interface IPermissionType {
|
|
3
|
+
canView: Boolean,
|
|
4
|
+
canMutate: Boolean
|
|
5
|
+
}
|
|
6
|
+
export interface IPermissionViewType {
|
|
7
|
+
canView: Boolean,
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface IPermission {
|
|
11
|
+
product: IPermissionType,
|
|
12
|
+
section: IPermissionType,
|
|
13
|
+
auth: IPermissionType,
|
|
14
|
+
staff: IPermissionType,
|
|
15
|
+
company: IPermissionType,
|
|
16
|
+
store: IPermissionType,
|
|
17
|
+
settings: IPermissionViewType,
|
|
18
|
+
cashierBoxes: IPermissionType,
|
|
19
|
+
reports: IPermissionViewType,
|
|
20
|
+
customers: IPermissionType,
|
|
21
|
+
discounts: IPermissionType,
|
|
22
|
+
reviews: IPermissionViewType,
|
|
23
|
+
inventory: IPermissionType,
|
|
24
|
+
}
|
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
import { IStore } from "./Store"
|
|
2
|
-
import { IStoreImage } from "./StoreImage"
|
|
3
|
-
import { IUser } from "./User"
|
|
4
|
-
|
|
5
|
-
export interface ProductLineTotals {
|
|
6
|
-
product: IOrderProduct,
|
|
7
|
-
qty: number,
|
|
8
|
-
productLineImportTotal: number,
|
|
9
|
-
productLineTotalWithDiscount: number,
|
|
10
|
-
productLineTaxesTotal: number,
|
|
11
|
-
lineDiscountAmount: number
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export interface IProduct {
|
|
16
|
-
_id?: string
|
|
17
|
-
name: string,
|
|
18
|
-
price: number,
|
|
19
|
-
expressPrice: number,
|
|
20
|
-
extraAmount?: number,
|
|
21
|
-
image?: IStoreImage | string,
|
|
22
|
-
overlayText: string,
|
|
23
|
-
sku: string,
|
|
24
|
-
pieces: String,
|
|
25
|
-
taxExemptOne: boolean,
|
|
26
|
-
taxExemptTwo: boolean,
|
|
27
|
-
taxExemptThree: boolean,
|
|
28
|
-
type: String,
|
|
29
|
-
isActive: boolean,
|
|
30
|
-
showInApp: boolean,
|
|
31
|
-
owner: IUser | string,
|
|
32
|
-
store: IStore | string,
|
|
33
|
-
order: number,
|
|
34
|
-
productSupplies?: [IProductSupplies],
|
|
35
|
-
invoice_description?: string,
|
|
36
|
-
invoice_product_key?: string,
|
|
37
|
-
invoice_product_unit_key?: string,
|
|
38
|
-
invoice_product_unit_name?: string
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export interface IProductSupplies {
|
|
42
|
-
supplyId: String,
|
|
43
|
-
// supplyName: String,
|
|
44
|
-
// supplyUsageUnit: String,
|
|
45
|
-
usageAmount: number,
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export interface IStoreProduct extends IProduct { }
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
export interface IOrderProduct extends IProduct {
|
|
52
|
-
extraAmount: number,
|
|
53
|
-
properties: Array<string>,
|
|
54
|
-
quantity: number,
|
|
55
|
-
discountAmount: number,
|
|
56
|
-
isBuyAndGetProduct: boolean,
|
|
57
|
-
storeProductId: IStoreProduct | string
|
|
58
|
-
qty?: number
|
|
1
|
+
import { IStore } from "./Store"
|
|
2
|
+
import { IStoreImage } from "./StoreImage"
|
|
3
|
+
import { IUser } from "./User"
|
|
4
|
+
|
|
5
|
+
export interface ProductLineTotals {
|
|
6
|
+
product: IOrderProduct,
|
|
7
|
+
qty: number,
|
|
8
|
+
productLineImportTotal: number,
|
|
9
|
+
productLineTotalWithDiscount: number,
|
|
10
|
+
productLineTaxesTotal: number,
|
|
11
|
+
lineDiscountAmount: number
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
export interface IProduct {
|
|
16
|
+
_id?: string
|
|
17
|
+
name: string,
|
|
18
|
+
price: number,
|
|
19
|
+
expressPrice: number,
|
|
20
|
+
extraAmount?: number,
|
|
21
|
+
image?: IStoreImage | string,
|
|
22
|
+
overlayText: string,
|
|
23
|
+
sku: string,
|
|
24
|
+
pieces: String,
|
|
25
|
+
taxExemptOne: boolean,
|
|
26
|
+
taxExemptTwo: boolean,
|
|
27
|
+
taxExemptThree: boolean,
|
|
28
|
+
type: String,
|
|
29
|
+
isActive: boolean,
|
|
30
|
+
showInApp: boolean,
|
|
31
|
+
owner: IUser | string,
|
|
32
|
+
store: IStore | string,
|
|
33
|
+
order: number,
|
|
34
|
+
productSupplies?: [IProductSupplies],
|
|
35
|
+
invoice_description?: string,
|
|
36
|
+
invoice_product_key?: string,
|
|
37
|
+
invoice_product_unit_key?: string,
|
|
38
|
+
invoice_product_unit_name?: string
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface IProductSupplies {
|
|
42
|
+
supplyId: String,
|
|
43
|
+
// supplyName: String,
|
|
44
|
+
// supplyUsageUnit: String,
|
|
45
|
+
usageAmount: number,
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface IStoreProduct extends IProduct { }
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
export interface IOrderProduct extends IProduct {
|
|
52
|
+
extraAmount: number,
|
|
53
|
+
properties: Array<string>,
|
|
54
|
+
quantity: number,
|
|
55
|
+
discountAmount: number,
|
|
56
|
+
isBuyAndGetProduct: boolean,
|
|
57
|
+
storeProductId: IStoreProduct | string
|
|
58
|
+
qty?: number
|
|
59
59
|
}
|