@b2y/ecommerce-common 1.0.3 → 1.0.4
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/constants/StatusMessageConstants.js +0 -3
- package/model/Address.js +1 -1
- package/model/Store.js +1 -1
- package/model/Tenant.js +1 -1
- package/model/User.js +1 -1
- package/package.json +1 -1
- package/utility/QueryUtil.js +16 -35
- package/.idea/ecommerce-common.iml +0 -12
- package/.idea/modules.xml +0 -8
- package/.idea/vcs.xml +0 -6
|
@@ -11,9 +11,6 @@ const StatusMessageConstants = {
|
|
|
11
11
|
INVALID_END_DATE: "Invalid endDate",
|
|
12
12
|
INVALID_START_DATE: "Invalid startDate",
|
|
13
13
|
INVALID_ISACTIVE_STATUS: "IsActive must be either true or false",
|
|
14
|
-
PAYMENT_STATUS_INVALID: "PaymentStatus is invalid",
|
|
15
|
-
PAYMENT_TYPE_INVALID: "PaymentType is invalid",
|
|
16
|
-
PAYMENT_METHOD_INVALID: "PaymentMethod is invalid",
|
|
17
14
|
ORDER_CREATION_FAILED:"Order creation failed",
|
|
18
15
|
PAYMENT_SIGNATURE_VERIFICATION_FAILED:"Payment signature verification failed",
|
|
19
16
|
PAYMENT_VERIFICATION_FAILED:"Payment verification failed"
|
package/model/Address.js
CHANGED
package/model/Store.js
CHANGED
package/model/Tenant.js
CHANGED
package/model/User.js
CHANGED
package/package.json
CHANGED
package/utility/QueryUtil.js
CHANGED
|
@@ -2,9 +2,6 @@
|
|
|
2
2
|
const AppUtil = require('../utility/AppUtil');
|
|
3
3
|
const StatusMessage = require('../constants/StatusMessageConstants');
|
|
4
4
|
const DateUtil = require('../utility/DateUtil');
|
|
5
|
-
const PaymentStatusEnum = require('../enum/PaymentStatusEnum');
|
|
6
|
-
const PaymentTypeEnum = require('../enum/PaymentTypeEnum');
|
|
7
|
-
const PaymentMethodEnum = require('../enum/PaymentMethodEnum');
|
|
8
5
|
const {Sequelize} = require('sequelize');
|
|
9
6
|
class QueryUtil {
|
|
10
7
|
static parseId(idParam) {
|
|
@@ -61,7 +58,7 @@ class QueryUtil {
|
|
|
61
58
|
return storeWhereClause;
|
|
62
59
|
}
|
|
63
60
|
static orderWhereClause(filters, tenantID, logger) {
|
|
64
|
-
const { startDate, endDate, searchText,
|
|
61
|
+
const { startDate, endDate, searchText, paymentStatusId, storeId } = filters;
|
|
65
62
|
let orderWhereClause = {};
|
|
66
63
|
let paymentStatusWhere = {};
|
|
67
64
|
let storeWhereClause = {};
|
|
@@ -80,13 +77,9 @@ class QueryUtil {
|
|
|
80
77
|
{ "$Customer.FirstName$": { [Sequelize.Op.iLike]: `%${searchText}%` } },
|
|
81
78
|
];
|
|
82
79
|
}
|
|
83
|
-
if (
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
logger.warn("invalid payment status")
|
|
87
|
-
throw new Error(StatusMessage.INVALID_PAYMENT_STATUS);
|
|
88
|
-
}
|
|
89
|
-
paymentStatusWhere.PaymentStatusName = paymentStatus;
|
|
80
|
+
if (paymentStatusId) {
|
|
81
|
+
const paymentStatusIDs = this.parseId(paymentStatusId);
|
|
82
|
+
paymentStatusWhere.PaymentStatusID = {[Sequelize.Op.in] : paymentStatusIDs};
|
|
90
83
|
}
|
|
91
84
|
if(storeId) {
|
|
92
85
|
const storeIDs = this.parseId(storeId);
|
|
@@ -105,10 +98,10 @@ class QueryUtil {
|
|
|
105
98
|
}
|
|
106
99
|
static paymentWhereClause(filters, tenantID, logger) {
|
|
107
100
|
const {
|
|
108
|
-
|
|
101
|
+
paymentStatusId,
|
|
109
102
|
searchText,
|
|
110
|
-
|
|
111
|
-
|
|
103
|
+
paymentTypeId,
|
|
104
|
+
paymentMethodId,
|
|
112
105
|
storeId,
|
|
113
106
|
startDate,
|
|
114
107
|
endDate,
|
|
@@ -133,29 +126,17 @@ class QueryUtil {
|
|
|
133
126
|
{ PaymentRefID: { [Sequelize.Op.iLike]: `%${searchText}%` } },
|
|
134
127
|
];
|
|
135
128
|
}
|
|
136
|
-
if (
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
logger.warn("invalid payment status");
|
|
140
|
-
throw new Error(StatusMessage.PAYMENT_STATUS_INVALID);
|
|
141
|
-
}
|
|
142
|
-
paymentStatusWhere.PaymentStatusName = paymentStatus;
|
|
129
|
+
if (paymentStatusId) {
|
|
130
|
+
const paymentStatusIDs = this.parseId(paymentStatusId)
|
|
131
|
+
paymentStatusWhere.PaymentStatusID = {[Sequelize.Op.in] : paymentStatusIDs};
|
|
143
132
|
}
|
|
144
|
-
if (
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
logger.warn("invalid payment type");
|
|
148
|
-
throw new Error(StatusMessage.PAYMENT_TYPE_INVALID);
|
|
149
|
-
}
|
|
150
|
-
paymentTypeWhere.PaymentTypeName = paymentType;
|
|
133
|
+
if (paymentTypeId) {
|
|
134
|
+
const paymentTypeIDs = this.parseId(paymentTypeId)
|
|
135
|
+
paymentTypeWhere.PaymentTypeID = {[Sequelize.Op.in] : paymentTypeIDs};
|
|
151
136
|
}
|
|
152
|
-
if (
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
logger.warn("invalid payment method")
|
|
156
|
-
throw new Error(StatusMessage.PAYMENT_METHOD_INVALID);
|
|
157
|
-
}
|
|
158
|
-
paymentMethodWhere.PaymentMethodName = paymentMethod;
|
|
137
|
+
if (paymentMethodId) {
|
|
138
|
+
const paymentMethodIDs = this.parseId(paymentMethodId);
|
|
139
|
+
paymentMethodWhere.PaymentMethodID = {[Sequelize.Op.in] : paymentMethodIDs};
|
|
159
140
|
}
|
|
160
141
|
if(storeId) {
|
|
161
142
|
const storeIDs = this.parseId(storeId);
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<module type="WEB_MODULE" version="4">
|
|
3
|
-
<component name="NewModuleRootManager">
|
|
4
|
-
<content url="file://$MODULE_DIR$">
|
|
5
|
-
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
|
6
|
-
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
|
7
|
-
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
|
8
|
-
</content>
|
|
9
|
-
<orderEntry type="inheritedJdk" />
|
|
10
|
-
<orderEntry type="sourceFolder" forTests="false" />
|
|
11
|
-
</component>
|
|
12
|
-
</module>
|
package/.idea/modules.xml
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="ProjectModuleManager">
|
|
4
|
-
<modules>
|
|
5
|
-
<module fileurl="file://$PROJECT_DIR$/.idea/ecommerce-common.iml" filepath="$PROJECT_DIR$/.idea/ecommerce-common.iml" />
|
|
6
|
-
</modules>
|
|
7
|
-
</component>
|
|
8
|
-
</project>
|