washday-sdk 1.0.2 → 1.1.1
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/README.md +127 -0
- package/babel.config.js +8 -0
- package/dist/api/attendance/delete.js +2 -0
- package/dist/api/attendance/get.js +89 -0
- package/dist/api/attendance/index.js +4 -0
- package/dist/api/attendance/post.js +39 -0
- package/dist/api/attendance/put.js +25 -0
- package/dist/api/auth/index.js +3 -0
- package/dist/api/auth/post.js +170 -0
- package/dist/api/axiosInstance.js +15 -11
- package/dist/api/cashierbox/delete.js +40 -0
- package/dist/api/cashierbox/get.js +63 -0
- package/dist/api/cashierbox/post.js +42 -0
- package/dist/api/cashierbox/put.js +42 -0
- package/dist/api/cashups/delete.js +25 -0
- package/dist/api/cashups/get.js +60 -0
- package/dist/api/cashups/index.js +4 -0
- package/dist/api/cashups/post.js +25 -0
- package/dist/api/cashups/put.js +52 -0
- package/dist/api/cfdi/delete.js +25 -0
- package/dist/api/cfdi/get.js +126 -0
- package/dist/api/cfdi/index.js +4 -0
- package/dist/api/cfdi/post.js +41 -0
- package/dist/api/cfdi/put.js +52 -0
- package/dist/api/companies/get.js +29 -0
- package/dist/api/companies/post.js +41 -0
- package/dist/api/companies/put.js +57 -0
- package/dist/api/countries/get.js +29 -0
- package/dist/api/countries/post.js +1 -0
- package/dist/api/countries/put.js +1 -0
- package/dist/api/csv/get.js +325 -0
- package/dist/api/csv/index.js +1 -0
- package/dist/api/customers/delete.js +40 -0
- package/dist/api/customers/get.js +75 -20
- package/dist/api/customers/index.js +4 -1
- package/dist/api/customers/post.js +41 -0
- package/dist/api/customers/put.js +52 -0
- package/dist/api/discounts/get.js +120 -0
- package/dist/api/discounts/post.js +40 -0
- package/dist/api/discounts/put.js +68 -0
- package/dist/api/index.js +316 -8
- package/dist/api/inventory/delete.js +26 -0
- package/dist/api/inventory/get.js +62 -0
- package/dist/api/inventory/index.js +4 -0
- package/dist/api/inventory/post.js +26 -0
- package/dist/api/inventory/put.js +41 -0
- package/dist/api/order/delete.js +40 -0
- package/dist/api/order/get.js +181 -0
- package/dist/api/order/index.js +4 -0
- package/dist/api/order/post.js +115 -0
- package/dist/api/order/put.js +202 -0
- package/dist/api/outsourcedOrders/delete.js +25 -0
- package/dist/api/outsourcedOrders/get.js +62 -0
- package/dist/api/outsourcedOrders/index.js +4 -0
- package/dist/api/outsourcedOrders/post.js +25 -0
- package/dist/api/outsourcedOrders/put.js +25 -0
- package/dist/api/partners/delete.js +25 -0
- package/dist/api/partners/get.js +40 -0
- package/dist/api/partners/index.js +4 -0
- package/dist/api/partners/post.js +25 -0
- package/dist/api/partners/put.js +25 -0
- package/dist/api/pdf/get.js +43 -0
- package/dist/api/pdf/index.js +1 -0
- package/dist/api/products/delete.js +40 -0
- package/dist/api/products/get.js +25 -0
- package/dist/api/products/index.js +4 -0
- package/dist/api/products/post.js +60 -0
- package/dist/api/products/put.js +40 -0
- package/dist/api/publics/get.js +26 -0
- package/dist/api/publics/index.js +1 -0
- package/dist/api/reports/get.js +303 -0
- package/dist/api/reports/index.js +1 -0
- package/dist/api/reviews/delete.js +15 -0
- package/dist/api/reviews/get.js +41 -0
- package/dist/api/reviews/index.js +4 -0
- package/dist/api/reviews/post.js +20 -0
- package/dist/api/reviews/put.js +52 -0
- package/dist/api/routes/delete.js +25 -0
- package/dist/api/routes/get.js +95 -0
- package/dist/api/routes/index.js +4 -0
- package/dist/api/routes/post.js +67 -0
- package/dist/api/routes/put.js +54 -0
- package/dist/api/sections/delete.js +25 -0
- package/dist/api/sections/get.js +71 -0
- package/dist/api/sections/index.js +4 -0
- package/dist/api/sections/post.js +26 -0
- package/dist/api/sections/put.js +25 -0
- package/dist/api/staff/delete.js +26 -0
- package/dist/api/staff/get.js +40 -0
- package/dist/api/staff/post.js +26 -0
- package/dist/api/staff/put.js +26 -0
- package/dist/api/stores/get.js +110 -0
- package/dist/api/stores/post.js +61 -0
- package/dist/api/stores/put.js +44 -0
- package/dist/api/stripe/get.js +1 -0
- package/dist/api/stripe/post.js +71 -0
- package/dist/api/stripe/put.js +1 -0
- package/dist/api/supplies/delete.js +26 -0
- package/dist/api/supplies/get.js +62 -0
- package/dist/api/supplies/post.js +26 -0
- package/dist/api/supplies/put.js +41 -0
- package/dist/api/users/delete.js +26 -0
- package/dist/api/users/post.js +25 -0
- package/dist/api/users/put.js +29 -0
- package/dist/enum/index.js +12 -7
- package/dist/index.js +3 -33
- package/dist/interfaces/Api.js +1 -3
- package/dist/interfaces/Apple.js +16 -0
- package/dist/interfaces/Attendance.js +1 -0
- package/dist/interfaces/Customer.js +1 -2
- package/dist/interfaces/Order.js +1 -2
- package/dist/interfaces/Permission.js +1 -2
- package/dist/interfaces/Product.js +1 -2
- package/dist/interfaces/Section.js +1 -2
- package/dist/interfaces/Store.js +1 -2
- package/dist/interfaces/StoreImage.js +1 -2
- package/dist/interfaces/User.js +1 -2
- package/dist/utils/apiUtils.js +9 -0
- package/dist/utils/index.js +2 -17
- package/dist/utils/orders/calculateOrderTotal.js +30 -21
- package/dist/utils/orders/calculateTotalTaxesIncluded.js +55 -29
- package/dist/utils/orders/calculateTotalTaxesOverPrice.js +56 -45
- package/dist/utils/orders/helpers.js +126 -17
- package/dist/utils/orders/index.js +3 -5
- package/dist/utils/receipt/generateReceiptHTML.js +157 -0
- package/dist/utils/util.js +63 -0
- package/docs/README.md +67 -0
- package/docs/examples/common-use-cases.md +487 -0
- package/docs/getting-started.md +237 -0
- package/docs/modules/attendance.md +404 -0
- package/jest.config.js +0 -0
- package/package.json +12 -4
- package/src/api/attendance/delete.ts +1 -0
- package/src/api/attendance/get.ts +88 -0
- package/src/api/attendance/index.ts +4 -0
- package/src/api/attendance/post.ts +38 -0
- package/src/api/attendance/put.ts +20 -0
- package/src/api/auth/index.ts +3 -0
- package/src/api/auth/post.ts +198 -0
- package/src/api/axiosInstance.ts +13 -3
- package/src/api/cashierbox/delete.ts +28 -0
- package/src/api/cashierbox/get.ts +53 -0
- package/src/api/cashierbox/post.ts +39 -0
- package/src/api/cashierbox/put.ts +32 -0
- package/src/api/cashups/delete.ts +15 -0
- package/src/api/cashups/get.ts +52 -0
- package/src/api/cashups/index.ts +4 -0
- package/src/api/cashups/post.ts +23 -0
- package/src/api/cashups/put.ts +53 -0
- package/src/api/cfdi/delete.ts +21 -0
- package/src/api/cfdi/get.ts +119 -0
- package/src/api/cfdi/index.ts +4 -0
- package/src/api/cfdi/post.ts +60 -0
- package/src/api/cfdi/put.ts +53 -0
- package/src/api/companies/get.ts +23 -0
- package/src/api/companies/post.ts +29 -0
- package/src/api/companies/put.ts +43 -0
- package/src/api/countries/get.ts +23 -0
- package/src/api/countries/post.ts +0 -0
- package/src/api/countries/put.ts +0 -0
- package/src/api/csv/get.ts +354 -0
- package/src/api/csv/index.ts +1 -0
- package/src/api/customers/delete.ts +29 -0
- package/src/api/customers/get.ts +80 -8
- package/src/api/customers/index.ts +4 -0
- package/src/api/customers/post.ts +48 -0
- package/src/api/customers/put.ts +68 -0
- package/src/api/discounts/get.ts +100 -0
- package/src/api/discounts/post.ts +35 -0
- package/src/api/discounts/put.ts +66 -0
- package/src/api/index.ts +318 -11
- package/src/api/inventory/delete.ts +16 -0
- package/src/api/inventory/get.ts +53 -0
- package/src/api/inventory/index.ts +4 -0
- package/src/api/inventory/post.ts +22 -0
- package/src/api/inventory/put.ts +35 -0
- package/src/api/order/delete.ts +29 -0
- package/src/api/order/get.ts +207 -0
- package/src/api/order/index.ts +4 -0
- package/src/api/order/post.ts +118 -0
- package/src/api/order/put.ts +224 -0
- package/src/api/outsourcedOrders/delete.ts +15 -0
- package/src/api/outsourcedOrders/get.ts +54 -0
- package/src/api/outsourcedOrders/index.ts +4 -0
- package/src/api/outsourcedOrders/post.ts +24 -0
- package/src/api/outsourcedOrders/put.ts +21 -0
- package/src/api/partners/delete.ts +15 -0
- package/src/api/partners/get.ts +28 -0
- package/src/api/partners/index.ts +4 -0
- package/src/api/partners/post.ts +21 -0
- package/src/api/partners/put.ts +21 -0
- package/src/api/pdf/get.ts +43 -0
- package/src/api/pdf/index.ts +1 -0
- package/src/api/products/delete.ts +28 -0
- package/src/api/products/get.ts +16 -0
- package/src/api/products/index.ts +4 -0
- package/src/api/products/post.ts +73 -0
- package/src/api/products/put.ts +49 -0
- package/src/api/publics/get.ts +16 -0
- package/src/api/publics/index.ts +1 -0
- package/src/api/reports/get.ts +329 -0
- package/src/api/reports/index.ts +1 -0
- package/src/api/reviews/delete.ts +15 -0
- package/src/api/reviews/get.ts +31 -0
- package/src/api/reviews/index.ts +4 -0
- package/src/api/reviews/post.ts +20 -0
- package/src/api/reviews/put.ts +53 -0
- package/src/api/routes/delete.ts +15 -0
- package/src/api/routes/get.ts +86 -0
- package/src/api/routes/index.ts +4 -0
- package/src/api/routes/post.ts +60 -0
- package/src/api/routes/put.ts +44 -0
- package/src/api/sections/delete.ts +15 -0
- package/src/api/sections/get.ts +67 -0
- package/src/api/sections/index.ts +4 -0
- package/src/api/sections/post.ts +22 -0
- package/src/api/sections/put.ts +23 -0
- package/src/api/staff/delete.ts +16 -0
- package/src/api/staff/get.ts +29 -0
- package/src/api/staff/post.ts +17 -0
- package/src/api/staff/put.ts +17 -0
- package/src/api/stores/get.ts +93 -0
- package/src/api/stores/post.ts +49 -0
- package/src/api/stores/put.ts +35 -0
- package/src/api/stripe/get.ts +0 -0
- package/src/api/stripe/post.ts +59 -0
- package/src/api/stripe/put.ts +0 -0
- package/src/api/supplies/delete.ts +16 -0
- package/src/api/supplies/get.ts +53 -0
- package/src/api/supplies/post.ts +26 -0
- package/src/api/supplies/put.ts +33 -0
- package/src/api/users/delete.ts +16 -0
- package/src/api/users/post.ts +18 -0
- package/src/api/users/put.ts +36 -0
- package/src/enum/index.ts +9 -1
- package/src/index.ts +1 -4
- package/src/interfaces/Api.ts +307 -2
- package/src/interfaces/Apple.ts +74 -0
- package/src/interfaces/Attendance.ts +45 -0
- package/src/interfaces/Customer.ts +15 -11
- package/src/interfaces/Order.ts +38 -1
- package/src/interfaces/Product.ts +1 -0
- package/src/interfaces/Store.ts +41 -0
- package/src/utils/apiUtils.ts +11 -0
- package/src/utils/index.ts +6 -1
- package/src/utils/orders/calculateOrderTotal.test.js +930 -0
- package/src/utils/orders/calculateOrderTotal.ts +60 -15
- package/src/utils/orders/calculateTotalTaxesIncluded.ts +57 -25
- package/src/utils/orders/calculateTotalTaxesOverPrice.ts +57 -41
- package/src/utils/orders/helpers.ts +195 -47
- package/src/utils/orders/index.ts +3 -1
- package/src/utils/receipt/generateReceiptHTML.ts +163 -0
- package/src/utils/util.ts +65 -0
- package/tsconfig.json +13 -9
|
@@ -1,36 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const enum_1 = require("../../enum");
|
|
5
|
-
const helpers_1 = require("./helpers");
|
|
6
|
-
const calculateTotalTaxesOverPrice = (order, selectedCustomer, storeSettings, storeDiscounts, appliedOrderDiscounts, discountCodeObj) => {
|
|
1
|
+
import { BuyAndGetConditionsTypes, DiscountCodeTypes } from "../../enum";
|
|
2
|
+
import { getProductTaxesPercentage } from "./helpers";
|
|
3
|
+
export const calculateTotalTaxesOverPrice = (order, selectedCustomer, storeSettings, storeDiscounts, appliedOrderDiscounts, discountCodeObj) => {
|
|
7
4
|
const productTableImports = [...order.products, ...order.buyAndGetProducts].map((current) => {
|
|
8
5
|
var _a;
|
|
9
6
|
let discPercentageInteger = 0;
|
|
10
7
|
let productPercentageDiscount = 0;
|
|
11
8
|
let customerDiscount = 0;
|
|
12
|
-
|
|
13
|
-
//
|
|
14
|
-
const
|
|
15
|
-
|
|
9
|
+
const qty = current.qty || current.quantity; // cantidad
|
|
10
|
+
// Precio base sin impuestos (en modo over_price el precio es neto)
|
|
11
|
+
const productBasePrice = order.express ? current.expressPrice : current.price;
|
|
12
|
+
// === NUEVO: Considerar extraAmount en el precio a descontar ===
|
|
13
|
+
// extraAmount es el ajuste total para la línea; se reparte por unidad
|
|
14
|
+
const extraAmount = current.extraAmount || 0;
|
|
15
|
+
const unitExtra = qty > 0 ? extraAmount / qty : 0;
|
|
16
|
+
// Precio ajustado: suma del precio base y el extra por unidad
|
|
17
|
+
const adjustedPrice = productBasePrice + unitExtra;
|
|
18
|
+
// Cálculo de descuento sobre el precio ajustado
|
|
16
19
|
if (!order.discountCode) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
if (next.type === 'percentage') {
|
|
24
|
-
// for now we just sum percetange type discounts
|
|
25
|
-
return prev + next.value;
|
|
20
|
+
const discountsToApply = storeDiscounts.filter((discount) => discount.isActive && discount.products.some((p) => {
|
|
21
|
+
if (typeof p === 'string') {
|
|
22
|
+
return p === current._id;
|
|
23
|
+
}
|
|
24
|
+
else if (typeof p === 'object') {
|
|
25
|
+
return p._id === current._id;
|
|
26
26
|
}
|
|
27
|
-
return
|
|
27
|
+
return false;
|
|
28
|
+
}));
|
|
29
|
+
customerDiscount = ((_a = selectedCustomer === null || selectedCustomer === void 0 ? void 0 : selectedCustomer.customer) === null || _a === void 0 ? void 0 : _a.discount) || 0;
|
|
30
|
+
productPercentageDiscount = discountsToApply.reduce((acc, discount) => {
|
|
31
|
+
return discount.type === 'percentage' ? acc + discount.value : acc;
|
|
28
32
|
}, 0);
|
|
29
33
|
discPercentageInteger = +((productPercentageDiscount + customerDiscount) / 100).toFixed(2);
|
|
30
|
-
discountsToApply.forEach((discount) => (appliedOrderDiscounts[discount._id] = discount));
|
|
34
|
+
discountsToApply.forEach((discount) => (appliedOrderDiscounts[discount._id] = discount));
|
|
31
35
|
}
|
|
32
36
|
else {
|
|
33
|
-
if (discountCodeObj.type ===
|
|
37
|
+
if (discountCodeObj.type === DiscountCodeTypes.PERCENTAGE) {
|
|
34
38
|
discPercentageInteger = +(discountCodeObj.value / 100).toFixed(2);
|
|
35
39
|
if (!discountCodeObj.applyToAllProducts) {
|
|
36
40
|
discPercentageInteger = discountCodeObj.products.includes(current._id)
|
|
@@ -38,37 +42,44 @@ const calculateTotalTaxesOverPrice = (order, selectedCustomer, storeSettings, st
|
|
|
38
42
|
: 0;
|
|
39
43
|
}
|
|
40
44
|
}
|
|
41
|
-
if (discountCodeObj.type ===
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
discPercentageInteger = +(discountValue / 100).toFixed(2);
|
|
45
|
+
else if (discountCodeObj.type === DiscountCodeTypes.BUY_X_GET_Y) {
|
|
46
|
+
const condition = discountCodeObj.buyAndGetConditions[0];
|
|
47
|
+
if (condition.getDiscountType === BuyAndGetConditionsTypes.PERCENTAGE && current.isBuyAndGetProduct) {
|
|
48
|
+
discPercentageInteger = +(condition.discountValue / 100).toFixed(2);
|
|
46
49
|
}
|
|
50
|
+
if (condition.getDiscountType === BuyAndGetConditionsTypes.FREE && current.isBuyAndGetProduct) {
|
|
51
|
+
discPercentageInteger = 1;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
else if (discountCodeObj.type === DiscountCodeTypes.FREE_ITEM && current.isFreeItem) {
|
|
55
|
+
discPercentageInteger = 1;
|
|
47
56
|
}
|
|
48
57
|
}
|
|
49
|
-
//
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
const
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
let prodLinePriceWithDiscount = +(qty * prodPriceWithDiscountPerUnit).toFixed(2);
|
|
58
|
+
// Calcular el descuento por unidad sobre el precio ajustado
|
|
59
|
+
const productDiscount = adjustedPrice * discPercentageInteger;
|
|
60
|
+
const discountedAdjustedPrice = adjustedPrice - productDiscount;
|
|
61
|
+
// Subtotal para la línea (precio descontado por unidad * cantidad) SIN impuestos
|
|
62
|
+
const subtotal = discountedAdjustedPrice * qty;
|
|
63
|
+
// Calcular impuestos sobre el subtotal
|
|
64
|
+
const taxPercentage = getProductTaxesPercentage(current, storeSettings) / 100;
|
|
65
|
+
const taxes = subtotal * taxPercentage;
|
|
66
|
+
// Resultados finales:
|
|
67
|
+
const totalTaxesApplied = +taxes.toFixed(2);
|
|
68
|
+
const lineDiscount = +(productDiscount * qty).toFixed(2);
|
|
69
|
+
// Precio total con descuento, reaplicando impuestos
|
|
70
|
+
const prodLinePriceWithDiscount = +((subtotal * (1 + taxPercentage))).toFixed(2);
|
|
63
71
|
return {
|
|
64
72
|
product: current,
|
|
65
|
-
qty
|
|
66
|
-
|
|
73
|
+
qty,
|
|
74
|
+
// Total bruto original sin descuento: (precio base * cantidad) + extraAmount
|
|
75
|
+
productLineImportTotal: (productBasePrice * qty) + extraAmount,
|
|
76
|
+
// Total final con descuento, con impuestos incluidos
|
|
67
77
|
productLineTotalWithDiscount: prodLinePriceWithDiscount,
|
|
68
78
|
productLineTaxesTotal: totalTaxesApplied,
|
|
69
|
-
lineDiscountAmount: lineDiscount
|
|
79
|
+
lineDiscountAmount: lineDiscount,
|
|
80
|
+
// Subtotal neto (sin impuestos) con descuento aplicado
|
|
81
|
+
productLineSubtotal: subtotal
|
|
70
82
|
};
|
|
71
83
|
});
|
|
72
84
|
return productTableImports;
|
|
73
85
|
};
|
|
74
|
-
exports.calculateTotalTaxesOverPrice = calculateTotalTaxesOverPrice;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.getCreditApplied = exports.getShippingCost = exports.getProductLineTotals = exports.getProductTaxesPercentage = void 0;
|
|
4
|
-
const enum_1 = require("../../enum");
|
|
5
|
-
const getProductTaxesPercentage = (productObj, store) => {
|
|
1
|
+
import { BuyAndGetConditionsTypes, DiscountCodeTypes } from "../../enum";
|
|
2
|
+
export const getProductTaxesPercentage = (productObj, store) => {
|
|
6
3
|
const getTaxValue = (tax, isTaxExempt) => {
|
|
7
4
|
if (!tax) {
|
|
8
5
|
// If no store tax configured, always return 0
|
|
@@ -15,13 +12,12 @@ const getProductTaxesPercentage = (productObj, store) => {
|
|
|
15
12
|
// If store tax configured and taxExempt is false, return store tax
|
|
16
13
|
return tax.value;
|
|
17
14
|
};
|
|
18
|
-
const tax1 = getTaxValue(store.taxOne,
|
|
19
|
-
const tax2 = getTaxValue(store.taxTwo,
|
|
20
|
-
const tax3 = getTaxValue(store.taxThree,
|
|
15
|
+
const tax1 = getTaxValue(store.taxOne, productObj.taxExemptOne);
|
|
16
|
+
const tax2 = getTaxValue(store.taxTwo, productObj.taxExemptTwo);
|
|
17
|
+
const tax3 = getTaxValue(store.taxThree, productObj.taxExemptThree);
|
|
21
18
|
return tax1 + tax2 + tax3;
|
|
22
19
|
};
|
|
23
|
-
|
|
24
|
-
const getProductLineTotals = (productLinesTotals) => {
|
|
20
|
+
export const getProductLineTotals = (productLinesTotals) => {
|
|
25
21
|
const totalQuantity = +productLinesTotals.reduce((acum, line) => acum + line.qty, 0).toFixed(2);
|
|
26
22
|
const totalImportWithDiscount = +productLinesTotals
|
|
27
23
|
.reduce((acum, line) => acum + line.productLineTotalWithDiscount, 0)
|
|
@@ -35,25 +31,27 @@ const getProductLineTotals = (productLinesTotals) => {
|
|
|
35
31
|
const totalDiscountAmount = +productLinesTotals
|
|
36
32
|
.reduce((acum, line) => acum + line.lineDiscountAmount, 0)
|
|
37
33
|
.toFixed(2);
|
|
34
|
+
const totalSubtotalAmount = +productLinesTotals
|
|
35
|
+
.reduce((acum, line) => acum + line.productLineSubtotal, 0)
|
|
36
|
+
.toFixed(2);
|
|
38
37
|
return {
|
|
39
38
|
totalQuantity,
|
|
40
39
|
totalImportWithDiscount,
|
|
41
40
|
totalImportWithoutDiscount,
|
|
42
41
|
totalImporTaxes,
|
|
43
|
-
totalDiscountAmount
|
|
42
|
+
totalDiscountAmount,
|
|
43
|
+
totalSubtotalAmount
|
|
44
44
|
};
|
|
45
45
|
};
|
|
46
|
-
|
|
47
|
-
const getShippingCost = (discountObject, requireShippingService, store) => {
|
|
46
|
+
export const getShippingCost = (discountObject, requireShippingService, store) => {
|
|
48
47
|
var _a, _b;
|
|
49
48
|
const shippingCost = requireShippingService ? (_b = (_a = store === null || store === void 0 ? void 0 : store.orderPageConfig) === null || _a === void 0 ? void 0 : _a.shippingServiceCost) !== null && _b !== void 0 ? _b : 0 : 0;
|
|
50
|
-
if ((discountObject === null || discountObject === void 0 ? void 0 : discountObject.type) ===
|
|
49
|
+
if ((discountObject === null || discountObject === void 0 ? void 0 : discountObject.type) === DiscountCodeTypes.FREE_DELIVERY) {
|
|
51
50
|
return 0;
|
|
52
51
|
}
|
|
53
52
|
return shippingCost;
|
|
54
53
|
};
|
|
55
|
-
|
|
56
|
-
const getCreditApplied = (selectedCustomer, orderTotal) => {
|
|
54
|
+
export const getCreditApplied = (selectedCustomer, orderTotal) => {
|
|
57
55
|
var _a, _b;
|
|
58
56
|
const customerCredit = (_b = (_a = selectedCustomer === null || selectedCustomer === void 0 ? void 0 : selectedCustomer.customer) === null || _a === void 0 ? void 0 : _a.credit) !== null && _b !== void 0 ? _b : 0;
|
|
59
57
|
if (customerCredit === 0 || !selectedCustomer) {
|
|
@@ -61,4 +59,115 @@ const getCreditApplied = (selectedCustomer, orderTotal) => {
|
|
|
61
59
|
}
|
|
62
60
|
return Math.min(customerCredit, orderTotal);
|
|
63
61
|
};
|
|
64
|
-
|
|
62
|
+
export const applyDiscountToProducts = (discountCode, productsArr, isExpress, storeDiscounts = [], selectedCustomer = { discount: 0 }) => {
|
|
63
|
+
if (!discountCode) {
|
|
64
|
+
// Caso sin discountCode: se aplican descuentos automáticos solo sobre el precio del producto
|
|
65
|
+
return {
|
|
66
|
+
newOrderProds: productsArr.map((prod) => {
|
|
67
|
+
const discountsToApply = storeDiscounts.filter((discount) => discount.isActive && discount.products.some((p) => {
|
|
68
|
+
if (typeof p === 'string') {
|
|
69
|
+
return p === prod._id;
|
|
70
|
+
}
|
|
71
|
+
else if (typeof p === 'object') {
|
|
72
|
+
return p._id === prod._id;
|
|
73
|
+
}
|
|
74
|
+
return false;
|
|
75
|
+
}));
|
|
76
|
+
const customerDiscount = (selectedCustomer === null || selectedCustomer === void 0 ? void 0 : selectedCustomer.discount) / 100 || 0;
|
|
77
|
+
const productPercentageDiscount = discountsToApply.reduce((prev, next) => {
|
|
78
|
+
if (next.type === 'percentage') {
|
|
79
|
+
return prev + next.value / 100;
|
|
80
|
+
}
|
|
81
|
+
return prev;
|
|
82
|
+
}, 0);
|
|
83
|
+
const prodPrice = isExpress ? prod.expressPrice : prod.price;
|
|
84
|
+
// Se remueve el extraAmountPerUnit para que el descuento se aplique solo sobre prodPrice
|
|
85
|
+
const discountAmount = +((productPercentageDiscount + customerDiscount) * prodPrice).toFixed(2);
|
|
86
|
+
return Object.assign(Object.assign({}, prod), { discountAmount: discountAmount });
|
|
87
|
+
}),
|
|
88
|
+
buyAndGetProds: []
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
// Reiniciar los descuentos en los productos
|
|
92
|
+
let newOrderProds = productsArr.map((prod) => (Object.assign(Object.assign({}, prod), { discountAmount: 0 })));
|
|
93
|
+
// Array para productos de descuento BUY_X_GET_Y o FREE_ITEM
|
|
94
|
+
const buyAndGetProds = [];
|
|
95
|
+
if (discountCode && discountCode.type === DiscountCodeTypes.PERCENTAGE) {
|
|
96
|
+
const percentageDiscount = discountCode.value / 100;
|
|
97
|
+
if (discountCode.applyToAllProducts) {
|
|
98
|
+
newOrderProds = newOrderProds.map((prod) => {
|
|
99
|
+
const prodPrice = isExpress ? prod.expressPrice : prod.price;
|
|
100
|
+
// Aplica descuento solo sobre prodPrice (no se incluye extraAmountPerUnit)
|
|
101
|
+
const discountAmount = +(percentageDiscount * prodPrice).toFixed(2);
|
|
102
|
+
return Object.assign(Object.assign({}, prod), { discountAmount: discountAmount });
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
for (let discountProduct of discountCode.products) {
|
|
107
|
+
const prodIdx = newOrderProds.findIndex((prod) => prod._id === discountProduct);
|
|
108
|
+
if (prodIdx !== -1) {
|
|
109
|
+
let prodObj = newOrderProds[prodIdx];
|
|
110
|
+
const prodPrice = isExpress ? prodObj.expressPrice : prodObj.price;
|
|
111
|
+
const discountAmount = +(percentageDiscount * prodPrice).toFixed(2);
|
|
112
|
+
prodObj.discountAmount = discountAmount;
|
|
113
|
+
newOrderProds[prodIdx] = prodObj;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (discountCode && discountCode.type === DiscountCodeTypes.NUMBER) {
|
|
119
|
+
const discountAmount = discountCode.value;
|
|
120
|
+
if (!discountCode.applyOnceOnOrder) {
|
|
121
|
+
if (discountCode.applyToAllProducts) {
|
|
122
|
+
newOrderProds = newOrderProds.map((prod) => (Object.assign(Object.assign({}, prod), { discountAmount: discountAmount })));
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
for (let discountProduct of discountCode.products) {
|
|
126
|
+
const prodIdx = newOrderProds.findIndex((prod) => prod._id === discountProduct);
|
|
127
|
+
if (prodIdx !== -1) {
|
|
128
|
+
let prodObj = newOrderProds[prodIdx];
|
|
129
|
+
prodObj.discountAmount = discountAmount;
|
|
130
|
+
newOrderProds[prodIdx] = prodObj;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
if (discountCode.buyAndGetConditions && discountCode.type === DiscountCodeTypes.BUY_X_GET_Y) {
|
|
137
|
+
const buyConditions = discountCode.buyAndGetConditions[0].buyConditions;
|
|
138
|
+
const getConditions = discountCode.buyAndGetConditions[0].getConditions;
|
|
139
|
+
const discountType = discountCode.buyAndGetConditions[0].getDiscountType;
|
|
140
|
+
const discountValue = discountCode.buyAndGetConditions[0].discountValue;
|
|
141
|
+
let buyConditionFulfilledCounter = 0;
|
|
142
|
+
for (let prodCondition of buyConditions) {
|
|
143
|
+
const orderProd = productsArr.find((ordProd) => ordProd._id === prodCondition.buyProduct._id);
|
|
144
|
+
// Nota: Aquí solo se verifica una condición de producto
|
|
145
|
+
if (orderProd) {
|
|
146
|
+
let qty = orderProd.qty || orderProd.quantity;
|
|
147
|
+
buyConditionFulfilledCounter = Math.floor(qty / prodCondition.qty);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (buyConditionFulfilledCounter) {
|
|
151
|
+
for (let prodCondition of getConditions) {
|
|
152
|
+
// Se utiliza solo el precio del producto (sin extraAmount) para calcular el descuento
|
|
153
|
+
const prodPrice = isExpress
|
|
154
|
+
? prodCondition.getProduct.expressPrice
|
|
155
|
+
: prodCondition.getProduct.price;
|
|
156
|
+
const percentageDiscount = discountValue / 100;
|
|
157
|
+
const discountAmount = discountType === BuyAndGetConditionsTypes.FREE
|
|
158
|
+
? prodPrice
|
|
159
|
+
: +(percentageDiscount * prodPrice).toFixed(2);
|
|
160
|
+
buyAndGetProds.push(Object.assign(Object.assign({}, prodCondition.getProduct), { qty: buyConditionFulfilledCounter * prodCondition.qty, quantity: buyConditionFulfilledCounter * prodCondition.qty, discountAmount: discountAmount, isBuyAndGetProduct: true }));
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
else if (discountCode.type === DiscountCodeTypes.FREE_ITEM) {
|
|
165
|
+
const freeProductsSettinggs = discountCode.freeProductSetting[0];
|
|
166
|
+
const freeProduct = freeProductsSettinggs.product;
|
|
167
|
+
const prodPrice = isExpress ? freeProduct.expressPrice : freeProduct.price;
|
|
168
|
+
// Para free item, se asume que el producto es gratuito, es decir, se descuenta el precio del producto
|
|
169
|
+
const discountAmount = prodPrice;
|
|
170
|
+
buyAndGetProds.push(Object.assign(Object.assign({}, freeProduct), { qty: freeProductsSettinggs.qty, quantity: freeProductsSettinggs.qty, discountAmount: discountAmount, isBuyAndGetProduct: true, isFreeItem: true }));
|
|
171
|
+
}
|
|
172
|
+
return { newOrderProds, buyAndGetProds };
|
|
173
|
+
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const calculateOrderTotal_1 = require("./calculateOrderTotal");
|
|
5
|
-
Object.defineProperty(exports, "calculateOrderTotal", { enumerable: true, get: function () { return calculateOrderTotal_1.calculateOrderTotal; } });
|
|
1
|
+
import { calculateOrderTotal } from './calculateOrderTotal';
|
|
2
|
+
import { applyDiscountToProducts } from './helpers';
|
|
3
|
+
export { calculateOrderTotal, applyDiscountToProducts };
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// import moment from "moment";
|
|
3
|
+
// import { formatMoneyString, truncateOrFill } from "../util";
|
|
4
|
+
// export const generateReceiptThermalPrinter = (order, storeSettings, ticketStructure, charsPerLine = 32) => {
|
|
5
|
+
// //THIS STRING IS FORMED WITH THE EXPECTED USE OF react-native-thermal-receipt-printer PACKAGE
|
|
6
|
+
// const PAPER_LINE_LENGTH = charsPerLine;
|
|
7
|
+
// const orderProducts = order?.products || [];
|
|
8
|
+
// const orderBuyAndGerProducts = order?.buyAndGetProducts || [];
|
|
9
|
+
// const orderAllProducts = [...orderProducts, ...orderBuyAndGerProducts];
|
|
10
|
+
// console.log('PAPER_LINE_LENGTH', PAPER_LINE_LENGTH);
|
|
11
|
+
// const paymentLinesTotal =
|
|
12
|
+
// order.paymentLines?.reduce((prev, next) => {
|
|
13
|
+
// return prev + (next?.amountPaid || 0);
|
|
14
|
+
// }, 0) || 0;
|
|
15
|
+
// let headers = `
|
|
16
|
+
// ${ticketStructure.showStoreName ? `<CM>${storeSettings.name}</CM>` : ''}
|
|
17
|
+
// ${ticketStructure.showStorePhone ? `Tel: ${storeSettings.phone}` : ''}
|
|
18
|
+
// ${'-'.repeat(PAPER_LINE_LENGTH)}
|
|
19
|
+
// ${ticketStructure.showEmisionDate
|
|
20
|
+
// ? `Fecha emision: ${moment(order?.createdDate).format('DD/MM/YYYY')}`
|
|
21
|
+
// : ''
|
|
22
|
+
// }
|
|
23
|
+
// ${ticketStructure.showEmisionTime
|
|
24
|
+
// ? `Hora emision: ${moment(order?.createdDate).format('hh:mm a')}`
|
|
25
|
+
// : ''
|
|
26
|
+
// }
|
|
27
|
+
// ${ticketStructure.showCreatedByName ? `Atendio: ${order.createdBy.name}` : ''}
|
|
28
|
+
// Pedido: WD-${order.sequence}
|
|
29
|
+
// ${ticketStructure.showCustomerName ? `Cliente: ${order.customer.name}` : ''}
|
|
30
|
+
// ${ticketStructure.showDeliveryDate
|
|
31
|
+
// ? `Entrega: ${moment(order?.deliveryInfo?.date).format('DD/MM/YYYY')} ${ticketStructure.showDeliveryTime
|
|
32
|
+
// ? moment(order?.deliveryInfo?.fromTime).format('HH:mm')
|
|
33
|
+
// : ''
|
|
34
|
+
// }`
|
|
35
|
+
// : ''
|
|
36
|
+
// }
|
|
37
|
+
// ${ticketStructure.showTotalPieces ? `Piezas: ${orderAllProducts?.reduce((prev, curr) => {
|
|
38
|
+
// return prev + +curr.pieces * curr.quantity;
|
|
39
|
+
// }, 0)}` : ''}
|
|
40
|
+
// ${ticketStructure.showOrderNotes && order.notes ? `${order.notes}` : ''}
|
|
41
|
+
// `;
|
|
42
|
+
// let middle = '';
|
|
43
|
+
// //Add order products
|
|
44
|
+
// orderAllProducts.forEach(prod => {
|
|
45
|
+
// //CHARS PER LINE: 32 in 58MM PAPER
|
|
46
|
+
// const quantityFixed = truncateOrFill(
|
|
47
|
+
// `x${prod.quantity.toString()}`,
|
|
48
|
+
// 3,
|
|
49
|
+
// 'right',
|
|
50
|
+
// );
|
|
51
|
+
// const prodNameFixed = truncateOrFill(
|
|
52
|
+
// prod.name,
|
|
53
|
+
// PAPER_LINE_LENGTH - 3 - 7 - 7 - 3,
|
|
54
|
+
// 'right',
|
|
55
|
+
// );
|
|
56
|
+
// const unitPriceFixed = truncateOrFill(
|
|
57
|
+
// formatMoneyString(
|
|
58
|
+
// (order?.express ? +prod.expressPrice : +prod.price) +
|
|
59
|
+
// (+prod.extraAmount / +prod.quantity || 0),
|
|
60
|
+
// ),
|
|
61
|
+
// 7,
|
|
62
|
+
// 'left',
|
|
63
|
+
// );
|
|
64
|
+
// const totalPriceFixed = truncateOrFill(
|
|
65
|
+
// formatMoneyString(
|
|
66
|
+
// (order?.express ? +prod.expressPrice : +prod.price) * +prod.quantity +
|
|
67
|
+
// (+prod.extraAmount || 0),
|
|
68
|
+
// ),
|
|
69
|
+
// 7,
|
|
70
|
+
// 'left',
|
|
71
|
+
// );
|
|
72
|
+
// middle =
|
|
73
|
+
// middle +
|
|
74
|
+
// `${quantityFixed} ${prodNameFixed} ${unitPriceFixed} ${totalPriceFixed}\n`;
|
|
75
|
+
// });
|
|
76
|
+
// let footer = '';
|
|
77
|
+
// footer =
|
|
78
|
+
// footer +
|
|
79
|
+
// `\n${truncateOrFill(
|
|
80
|
+
// 'Subtotal: ' +
|
|
81
|
+
// formatMoneyString(order.productTotalWithoutDiscount || 0),
|
|
82
|
+
// PAPER_LINE_LENGTH,
|
|
83
|
+
// 'left',
|
|
84
|
+
// )}`;
|
|
85
|
+
// if (ticketStructure.showDiscounts) {
|
|
86
|
+
// footer =
|
|
87
|
+
// footer +
|
|
88
|
+
// `\n${truncateOrFill(
|
|
89
|
+
// 'Descuento: ' + formatMoneyString(order.totalDiscountAmount || 0),
|
|
90
|
+
// PAPER_LINE_LENGTH,
|
|
91
|
+
// 'left',
|
|
92
|
+
// )}`;
|
|
93
|
+
// }
|
|
94
|
+
// if (ticketStructure.showCredit) {
|
|
95
|
+
// footer =
|
|
96
|
+
// footer +
|
|
97
|
+
// `\n${truncateOrFill(
|
|
98
|
+
// 'Credito: ' + formatMoneyString(order.creditApplied || 0),
|
|
99
|
+
// PAPER_LINE_LENGTH,
|
|
100
|
+
// 'left',
|
|
101
|
+
// )}`;
|
|
102
|
+
// }
|
|
103
|
+
// if (ticketStructure.showTaxes) {
|
|
104
|
+
// footer =
|
|
105
|
+
// footer +
|
|
106
|
+
// `\n${truncateOrFill(
|
|
107
|
+
// 'Impuestos: ' + formatMoneyString(order.taxesTotal || 0),
|
|
108
|
+
// PAPER_LINE_LENGTH,
|
|
109
|
+
// 'left',
|
|
110
|
+
// )}`;
|
|
111
|
+
// }
|
|
112
|
+
// footer =
|
|
113
|
+
// footer +
|
|
114
|
+
// `${order.delivery || order.pickup
|
|
115
|
+
// ? `\n${truncateOrFill(
|
|
116
|
+
// 'Servicio a domicilio: ' +
|
|
117
|
+
// formatMoneyString(order.shippingServiceTotal || 0),
|
|
118
|
+
// PAPER_LINE_LENGTH,
|
|
119
|
+
// 'left',
|
|
120
|
+
// )}`
|
|
121
|
+
// : ''
|
|
122
|
+
// }`;
|
|
123
|
+
// footer =
|
|
124
|
+
// footer +
|
|
125
|
+
// '\n' +
|
|
126
|
+
// `${truncateOrFill(
|
|
127
|
+
// 'Total: ' + formatMoneyString(order.total || 0),
|
|
128
|
+
// PAPER_LINE_LENGTH,
|
|
129
|
+
// 'left',
|
|
130
|
+
// )}`;
|
|
131
|
+
// footer =
|
|
132
|
+
// footer +
|
|
133
|
+
// '\n' +
|
|
134
|
+
// `${truncateOrFill(
|
|
135
|
+
// 'Pago: ' + formatMoneyString(paymentLinesTotal),
|
|
136
|
+
// PAPER_LINE_LENGTH,
|
|
137
|
+
// 'left',
|
|
138
|
+
// )}`;
|
|
139
|
+
// footer =
|
|
140
|
+
// footer +
|
|
141
|
+
// '\n' +
|
|
142
|
+
// `${truncateOrFill(
|
|
143
|
+
// 'Debe: ' + ((order.total || 0) - paymentLinesTotal).toFixed(2),
|
|
144
|
+
// PAPER_LINE_LENGTH,
|
|
145
|
+
// 'left',
|
|
146
|
+
// )}`;
|
|
147
|
+
// footer = footer + `\n${'-'.repeat(PAPER_LINE_LENGTH)}\n`;
|
|
148
|
+
// // footer = footer + `${ticketStructure.showPaymentMethod ? `<C>${translatePaymentType(order.paymentMethod)}</C>\n` : ''}`
|
|
149
|
+
// footer =
|
|
150
|
+
// footer +
|
|
151
|
+
// `${ticketStructure.showLegend
|
|
152
|
+
// ? `<C>${ticketStructure.ticketLegendText}</C>`
|
|
153
|
+
// : ''
|
|
154
|
+
// }`;
|
|
155
|
+
// const ticket = headers + '\n' + middle + '\n' + footer;
|
|
156
|
+
// return ticket;
|
|
157
|
+
// }
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// export function truncateOrFill(str: string, n: number, side: string = 'right') {
|
|
2
|
+
// let needSpacesQty = n - str.length;
|
|
3
|
+
// let whiteSpace = '';
|
|
4
|
+
// if (needSpacesQty > 0) {
|
|
5
|
+
// for (let i = 0; i < needSpacesQty; i++) {
|
|
6
|
+
// whiteSpace += ' ';
|
|
7
|
+
// }
|
|
8
|
+
// }
|
|
9
|
+
// return str.length > n
|
|
10
|
+
// ? str.substr(0, n - 3) + '...'
|
|
11
|
+
// : side === 'right'
|
|
12
|
+
// ? str + whiteSpace
|
|
13
|
+
// : whiteSpace + str;
|
|
14
|
+
// }
|
|
15
|
+
// export const formatMoneyString = (
|
|
16
|
+
// amount: string | number = 0,
|
|
17
|
+
// decimalCount: number = 2,
|
|
18
|
+
// decimal = '.',
|
|
19
|
+
// thousands = ',',
|
|
20
|
+
// currencySymbol = '$',
|
|
21
|
+
// ) => {
|
|
22
|
+
// try {
|
|
23
|
+
// decimalCount = Math.abs(decimalCount);
|
|
24
|
+
// decimalCount = isNaN(decimalCount) ? 2 : decimalCount;
|
|
25
|
+
// const negativeSign = amount < 0 ? '-' : '';
|
|
26
|
+
// let i = parseInt(
|
|
27
|
+
// (amount = Math.abs(Number(amount) || 0).toFixed(decimalCount)),
|
|
28
|
+
// ).toString();
|
|
29
|
+
// let j = i.length > 3 ? i.length % 3 : 0;
|
|
30
|
+
// return (
|
|
31
|
+
// currencySymbol +
|
|
32
|
+
// negativeSign +
|
|
33
|
+
// (j ? i.substr(0, j) + thousands : '') +
|
|
34
|
+
// i.substr(j).replace(/(\d{3})(?=\d)/g, '$1' + thousands) +
|
|
35
|
+
// (decimalCount
|
|
36
|
+
// ? decimal +
|
|
37
|
+
// Math.abs(amount - i)
|
|
38
|
+
// .toFixed(decimalCount)
|
|
39
|
+
// .slice(2)
|
|
40
|
+
// : '')
|
|
41
|
+
// );
|
|
42
|
+
// } catch (e) {
|
|
43
|
+
// console.log(e);
|
|
44
|
+
// }
|
|
45
|
+
// };
|
|
46
|
+
// Function to get a formatted address
|
|
47
|
+
export function getFormattedAddress(address) {
|
|
48
|
+
const { street, neighborhood, postalCode, city, state, country } = address;
|
|
49
|
+
let formatted = '';
|
|
50
|
+
if (street)
|
|
51
|
+
formatted += street;
|
|
52
|
+
if (neighborhood)
|
|
53
|
+
formatted += `, ${neighborhood}`;
|
|
54
|
+
if (city)
|
|
55
|
+
formatted += `, ${city}`;
|
|
56
|
+
if (state)
|
|
57
|
+
formatted += `, ${state}`;
|
|
58
|
+
if (postalCode)
|
|
59
|
+
formatted += `, ${postalCode}`;
|
|
60
|
+
if (country)
|
|
61
|
+
formatted += `, ${country}`;
|
|
62
|
+
return formatted.trim();
|
|
63
|
+
}
|
package/docs/README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# 📚 Washday SDK Documentation
|
|
2
|
+
|
|
3
|
+
Welcome to the Washday SDK documentation! This folder contains comprehensive guides and API references for all modules.
|
|
4
|
+
|
|
5
|
+
## 📖 Getting Started
|
|
6
|
+
|
|
7
|
+
- [Installation and Setup](./getting-started.md)
|
|
8
|
+
- [Authentication](./authentication.md)
|
|
9
|
+
- [Error Handling](./error-handling.md)
|
|
10
|
+
|
|
11
|
+
## 🔧 API Modules
|
|
12
|
+
|
|
13
|
+
### Core Modules
|
|
14
|
+
- [**Attendance**](./modules/attendance.md) - Employee time tracking and clock-in/out
|
|
15
|
+
- [**Orders**](./modules/orders.md) - Order management and processing
|
|
16
|
+
- [**Customers**](./modules/customers.md) - Customer data and management
|
|
17
|
+
- [**Products**](./modules/products.md) - Product catalog and inventory
|
|
18
|
+
|
|
19
|
+
### Store Management
|
|
20
|
+
- [**Stores**](./modules/stores.md) - Store configuration and settings
|
|
21
|
+
- [**Staff**](./modules/staff.md) - Staff management and permissions
|
|
22
|
+
- [**Inventory**](./modules/inventory.md) - Stock management and tracking
|
|
23
|
+
- [**Supplies**](./modules/supplies.md) - Supply management
|
|
24
|
+
|
|
25
|
+
### Financial
|
|
26
|
+
- [**Cash-ups**](./modules/cashups.md) - Cash register management
|
|
27
|
+
- [**CFDI**](./modules/cfdi.md) - Mexican tax invoicing
|
|
28
|
+
- [**Payments**](./modules/payments.md) - Payment processing
|
|
29
|
+
|
|
30
|
+
### Reporting & Analytics
|
|
31
|
+
- [**Reports**](./modules/reports.md) - Business analytics and reports
|
|
32
|
+
- [**CSV Exports**](./modules/csv-exports.md) - Data export functionality
|
|
33
|
+
- [**PDF Exports**](./modules/pdf-exports.md) - Document generation
|
|
34
|
+
|
|
35
|
+
### Additional Services
|
|
36
|
+
- [**Routes**](./modules/routes.md) - Delivery route management
|
|
37
|
+
- [**Reviews**](./modules/reviews.md) - Customer feedback system
|
|
38
|
+
- [**Partners**](./modules/partners.md) - Third-party integrations
|
|
39
|
+
- [**Authentication**](./modules/auth.md) - User authentication flows
|
|
40
|
+
|
|
41
|
+
## 📋 Examples
|
|
42
|
+
|
|
43
|
+
- [**Common Use Cases**](./examples/common-use-cases.md)
|
|
44
|
+
- [**Error Handling Examples**](./examples/error-handling.md)
|
|
45
|
+
- [**TypeScript Integration**](./examples/typescript.md)
|
|
46
|
+
|
|
47
|
+
## 🆕 What's New
|
|
48
|
+
|
|
49
|
+
- **v1.1.1**: 🐛 Fixed missing parameters in attendance endpoints (`userId` in getHistory/getStatus, `storeId` in clockOut)
|
|
50
|
+
- **v1.1.0**: Added Attendance module with clock-in/out functionality
|
|
51
|
+
- **v1.0.2**: Enhanced order management features
|
|
52
|
+
|
|
53
|
+
## 🤝 Contributing
|
|
54
|
+
|
|
55
|
+
When adding new modules or updating existing ones:
|
|
56
|
+
|
|
57
|
+
1. Create module documentation in `docs/modules/[module-name].md`
|
|
58
|
+
2. Update this main README with the new module link
|
|
59
|
+
3. Add practical examples in `docs/examples/`
|
|
60
|
+
4. Update the version changelog
|
|
61
|
+
|
|
62
|
+
## 📞 Support
|
|
63
|
+
|
|
64
|
+
For questions or issues:
|
|
65
|
+
- Check the module-specific documentation first
|
|
66
|
+
- Review the examples section
|
|
67
|
+
- Contact the development team
|