@webresto/graphql 1.3.6 → 1.3.8
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/.gitattributes +2 -0
- package/.gitlab-ci.yml +18 -0
- package/.vscode/extensions.json +5 -0
- package/docs/actions.md +25 -0
- package/docs/authorization.md +215 -0
- package/docs/captcha.md +71 -0
- package/docs/device-id.md +30 -0
- package/docs/messages.md +10 -0
- package/docs/user.md +54 -0
- package/index.d.ts +0 -1
- package/index.js +6 -2
- package/index.ts +2 -2
- package/lib/afterHook.js +8 -0
- package/lib/afterHook.ts +9 -0
- package/lib/bindTranslations.d.ts +1 -0
- package/lib/bindTranslations.js +40 -0
- package/lib/bindTranslations.ts +39 -0
- package/lib/defaults.d.ts +1 -0
- package/lib/defaults.js +49 -10
- package/lib/defaults.ts +55 -0
- package/lib/eventHelper.d.ts +14 -5
- package/lib/eventHelper.js +28 -9
- package/lib/eventHelper.ts +41 -8
- package/lib/getRecomended.d.ts +1 -0
- package/lib/getRecomended.js +29 -0
- package/lib/getRecomended.ts +31 -0
- package/lib/graphqlHelper.d.ts +3 -4
- package/lib/graphqlHelper.js +184 -73
- package/lib/graphqlHelper.ts +329 -186
- package/lib/jwt.d.ts +10 -0
- package/lib/jwt.js +43 -0
- package/lib/jwt.ts +61 -0
- package/package.json +13 -6
- package/src/additionalResolvers.d.ts +72 -9
- package/src/additionalResolvers.js +93 -24
- package/src/additionalResolvers.ts +105 -34
- package/src/graphql.d.ts +5 -3
- package/src/graphql.js +170 -37
- package/src/graphql.ts +210 -60
- package/src/resolvers/bonusProgram.d.ts +32 -0
- package/src/resolvers/bonusProgram.js +65 -0
- package/src/resolvers/bonusProgram.ts +79 -0
- package/src/resolvers/captcha.d.ts +11 -0
- package/src/resolvers/captcha.js +19 -0
- package/src/resolvers/captcha.ts +16 -0
- package/src/resolvers/checkout.d.ts +43 -14
- package/src/resolvers/checkout.js +172 -122
- package/src/resolvers/checkout.ts +218 -142
- package/src/resolvers/dishAndModifier.js +8 -4
- package/src/resolvers/dishAndModifier.ts +4 -0
- package/src/resolvers/error.d.ts +9 -0
- package/src/resolvers/error.js +21 -0
- package/src/resolvers/error.ts +21 -0
- package/src/resolvers/menu.d.ts +9 -0
- package/src/resolvers/menu.js +12 -0
- package/src/resolvers/menu.ts +10 -0
- package/src/resolvers/order.d.ts +527 -0
- package/src/resolvers/order.js +349 -0
- package/src/resolvers/order.ts +435 -0
- package/src/resolvers/paymentMethod.js +7 -3
- package/src/resolvers/paymentMethod.ts +9 -5
- package/src/resolvers/pickupPoint.d.ts +1 -0
- package/src/resolvers/pickupPoint.js +24 -0
- package/src/resolvers/pickupPoint.ts +23 -0
- package/src/resolvers/recomended.d.ts +13 -0
- package/src/resolvers/recomended.js +80 -0
- package/src/resolvers/recomended.ts +86 -0
- package/src/resolvers/restrictions.d.ts +37 -1
- package/src/resolvers/restrictions.js +100 -15
- package/src/resolvers/restrictions.ts +106 -14
- package/src/resolvers/streets.d.ts +1 -1
- package/src/resolvers/streets.js +1 -4
- package/src/resolvers/streets.ts +1 -3
- package/src/resolvers/subscriptions.d.ts +4 -4
- package/src/resolvers/subscriptions.js +49 -12
- package/src/resolvers/subscriptions.ts +59 -14
- package/src/resolvers/telemetry.d.ts +14 -0
- package/src/resolvers/telemetry.js +25 -0
- package/src/resolvers/telemetry.ts +24 -0
- package/src/resolvers/user.d.ts +82 -0
- package/src/resolvers/user.js +416 -0
- package/src/resolvers/user.ts +621 -0
- package/src/resolvers/userLocation.d.ts +53 -0
- package/src/resolvers/userLocation.js +74 -0
- package/src/resolvers/userLocation.ts +125 -0
- package/src/resolvers/userOTPrequest.d.ts +21 -0
- package/src/resolvers/userOTPrequest.js +57 -0
- package/src/resolvers/userOTPrequest.ts +75 -0
- package/test/e2e_helper.js +157 -0
- package/test/e2e_helper.ts +212 -0
- package/test/fixture/config/i18n.js +7 -20
- package/test/fixture/config/locales/de.json +1 -0
- package/test/fixture/config/locales/en.json +10 -0
- package/test/fixture/config/locales/es.json +3 -0
- package/test/fixture/config/locales/fr.json +1 -0
- package/test/fixture/config/log.js +1 -1
- package/test/fixture/package.json +5 -6
- package/test/fixture/patches/rttc+10.0.1.patch +17 -0
- package/test/integration/captcha.test.js +20 -0
- package/test/integration/captcha.test.ts +25 -0
- package/test/integration/dish.test.js +35 -0
- package/test/integration/dish.test.ts +43 -0
- package/test/integration/graphql.test.js +5 -2
- package/test/integration/graphql.test.ts +2 -4
- package/test/integration/images.test.js +35 -0
- package/test/integration/images.test.ts +40 -0
- package/test/integration/locale.test.js +26 -0
- package/test/integration/locale.test.ts +32 -0
- package/test/integration/order.test.js +56 -43
- package/test/integration/order.test.ts +59 -59
- package/test/integration/subscriptions.test.js +136 -0
- package/test/integration/subscriptions.test.ts +162 -0
- package/test/integration/user.test.js +249 -0
- package/test/integration/user.test.ts +299 -0
- package/test/unit/first.test.js +4 -2
- package/test/unit/first.test.ts +1 -1
- package/test/unit/get-recomended.test.js +56 -0
- package/test/unit/get-recomended.test.ts +63 -0
- package/translations/de.json +2 -0
- package/translations/en.json +3 -0
- package/translations/es.json +3 -0
- package/translations/fr.json +2 -0
- package/translations/ru.json +36 -0
- package/tsconfig.json +20 -5
- package/types/global.d.ts +30 -0
- package/types/global.js +2 -0
- package/types/global.ts +31 -0
- package/types/primitives.d.ts +19 -0
- package/types/references.d.ts +1 -0
- package/types/restoGraphQLConfig.d.ts +13 -0
- package/lib/afterHook.ts___graphql-transport-ws +0 -138
- package/lib/afterHook.ts___graphql-ws +0 -133
- package/lib/errorWrapper.d.ts +0 -4
- package/lib/errorWrapper.js +0 -13
- package/lib/errorWrapper.ts +0 -12
- package/notes.md +0 -1976
- package/src/resolvers/cart.d.ts +0 -343
- package/src/resolvers/cart.js +0 -196
- package/src/resolvers/cart.ts +0 -277
- package/test/fixture/config/connections.js +0 -9
- package/test/integration/sails_not_crash.test.js +0 -3
- package/test/integration/sails_not_crash.test.ts +0 -3
|
@@ -1,13 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const eventHelper = require("../../lib/eventHelper");
|
|
4
|
-
const
|
|
4
|
+
const graphqlHelper_1 = require("../../lib/graphqlHelper");
|
|
5
|
+
const jwt_1 = require("../../lib/jwt");
|
|
6
|
+
graphqlHelper_1.default.addType(`#graphql
|
|
7
|
+
input InputOrderCheckout {
|
|
8
|
+
orderId: String!
|
|
9
|
+
paymentMethodId: String!
|
|
10
|
+
customer: Customer!
|
|
11
|
+
spendBonus: InputSpendBonus
|
|
12
|
+
selfService: Boolean
|
|
13
|
+
pickupPointId: String
|
|
14
|
+
locationId: String
|
|
15
|
+
address: Address
|
|
16
|
+
date: String
|
|
17
|
+
comment: String
|
|
18
|
+
personsCount: Int
|
|
19
|
+
customData: Json
|
|
20
|
+
}
|
|
21
|
+
`);
|
|
22
|
+
graphqlHelper_1.default.addType(`#graphql
|
|
23
|
+
input InputSpendBonus {
|
|
24
|
+
bonusProgramId: String!
|
|
25
|
+
amount: Int!
|
|
26
|
+
adapter: String!
|
|
27
|
+
bonusProgramName: String!
|
|
28
|
+
}
|
|
29
|
+
`);
|
|
5
30
|
exports.default = {
|
|
6
31
|
Mutation: {
|
|
7
32
|
checkOrder: {
|
|
8
|
-
def:
|
|
33
|
+
def: `#graphql
|
|
34
|
+
checkOrder(orderCheckout: InputOrderCheckout): CheckResponse`,
|
|
9
35
|
fn: async function (parent, args, context) {
|
|
10
|
-
let data = args;
|
|
36
|
+
let data = args.orderCheckout;
|
|
37
|
+
if (!context.connectionParams.deviceId) {
|
|
38
|
+
throw `Missed deviceId`;
|
|
39
|
+
}
|
|
11
40
|
// if (data.date) {
|
|
12
41
|
// let date = moment(data.date)
|
|
13
42
|
// if(!date.isValid()){
|
|
@@ -17,209 +46,230 @@ exports.default = {
|
|
|
17
46
|
// }
|
|
18
47
|
// }
|
|
19
48
|
let isSelfService;
|
|
20
|
-
|
|
21
|
-
if (data.selfService || data.selfDelivery) {
|
|
22
|
-
isSelfService = true;
|
|
23
|
-
}
|
|
49
|
+
let message;
|
|
24
50
|
try {
|
|
25
51
|
var order = await Order.findOne(data.orderId);
|
|
52
|
+
const shouldSendSucessMessage = order.state !== "CHECKOUT";
|
|
26
53
|
if (!order) {
|
|
27
|
-
|
|
54
|
+
message = eventHelper.sendMessage({
|
|
55
|
+
deviceId: context.connectionParams.deviceId,
|
|
28
56
|
type: "error",
|
|
29
|
-
title: "Order not found",
|
|
30
|
-
message:
|
|
57
|
+
title: context.i18n.__("Order not found"),
|
|
58
|
+
message: context.i18n.__("Order with id %s not found", data.orderId),
|
|
31
59
|
});
|
|
32
60
|
}
|
|
61
|
+
//@ts-ignore
|
|
62
|
+
if (data.selfService) {
|
|
63
|
+
isSelfService = true;
|
|
64
|
+
order.pickupPoint = data.pickupPointId;
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
order.pickupPoint = null;
|
|
68
|
+
if (!data.address && !data.locationId)
|
|
69
|
+
throw `Address is required for non self service orders`;
|
|
70
|
+
}
|
|
33
71
|
if (order.state === "ORDER") {
|
|
34
|
-
|
|
72
|
+
message = eventHelper.sendMessage({
|
|
73
|
+
deviceId: context.connectionParams.deviceId,
|
|
35
74
|
type: "error",
|
|
36
|
-
title: "
|
|
37
|
-
message: "
|
|
75
|
+
title: context.i18n.__("Error"),
|
|
76
|
+
message: context.i18n.__("Cart was ordered"),
|
|
38
77
|
});
|
|
39
78
|
}
|
|
40
79
|
if (data.paymentMethodId) {
|
|
41
80
|
if (!PaymentMethod.checkAvailable(data.paymentMethodId)) {
|
|
42
|
-
|
|
81
|
+
message = eventHelper.sendMessage({
|
|
82
|
+
deviceId: context.connectionParams.deviceId,
|
|
43
83
|
type: "error",
|
|
44
|
-
title: "
|
|
45
|
-
message: "
|
|
84
|
+
title: context.i18n.__("Error"),
|
|
85
|
+
message: context.i18n.__("Checking the payment system ended in failure"),
|
|
46
86
|
});
|
|
47
87
|
}
|
|
48
88
|
}
|
|
49
|
-
if (data.
|
|
50
|
-
|
|
51
|
-
|
|
89
|
+
if (data.locationId) {
|
|
90
|
+
var address = await UserLocation.findOne({ id: data.locationId });
|
|
91
|
+
if (!address)
|
|
92
|
+
throw `locationId not found`;
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
if (data.address) {
|
|
96
|
+
var address = data.address;
|
|
97
|
+
}
|
|
52
98
|
}
|
|
53
|
-
|
|
99
|
+
address = {
|
|
100
|
+
city: address.city || await Settings.use("city"),
|
|
101
|
+
street: address.street,
|
|
102
|
+
...address.streetId && { streetId: address.streetId },
|
|
103
|
+
home: address.home,
|
|
104
|
+
...address.housing && { housing: address.housing },
|
|
105
|
+
...address.apartment && { apartment: address.apartment },
|
|
106
|
+
...address.index && { index: address.index },
|
|
107
|
+
...address.entrance && { entrance: address.entrance },
|
|
108
|
+
...address.floor && { floor: address.floor },
|
|
109
|
+
...address.apartment && { apartment: address.apartment },
|
|
110
|
+
...address.comment && { comment: address.comment },
|
|
111
|
+
};
|
|
112
|
+
order.personsCount = data.personsCount ? data.personsCount + "" : "";
|
|
54
113
|
if (data.comment)
|
|
55
114
|
order.comment = data.comment;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
// callback: boolean - перезвонить для уточнения деталей
|
|
115
|
+
order.date = data.date;
|
|
116
|
+
// callback: boolean -call back to clarify details
|
|
59
117
|
if (data.customData && data.customData.callback) {
|
|
60
118
|
if (!order.customData)
|
|
61
119
|
order.customData = {};
|
|
62
120
|
order.customData.callback = data.customData.callback;
|
|
63
121
|
}
|
|
64
122
|
await Order.update({ id: order.id }, order).fetch();
|
|
65
|
-
|
|
123
|
+
let userId = null;
|
|
124
|
+
if (context && context.connectionParams.authorization) {
|
|
125
|
+
userId = (await jwt_1.JWTAuth.verify(context.connectionParams.authorization)).userId;
|
|
126
|
+
}
|
|
127
|
+
await Order.check({ id: order.id }, data.customer, isSelfService, data.address, data.paymentMethodId, userId, data.spendBonus !== undefined && userId !== null ? data.spendBonus : null);
|
|
66
128
|
order = await Order.findOne(data.orderId);
|
|
67
|
-
|
|
68
|
-
if (order.state === "CHECKOUT") {
|
|
129
|
+
if (order.state === "CHECKOUT" && shouldSendSucessMessage) {
|
|
69
130
|
message = {
|
|
131
|
+
deviceId: context.connectionParams.deviceId,
|
|
70
132
|
type: "info",
|
|
71
|
-
title: "
|
|
133
|
+
title: context.i18n.__("Attention"),
|
|
72
134
|
message: order.message
|
|
73
|
-
? order.message
|
|
74
|
-
: "
|
|
135
|
+
? context.i18n.__(order.message)
|
|
136
|
+
: context.i18n.__("Ready for order"),
|
|
75
137
|
};
|
|
76
138
|
}
|
|
77
139
|
else {
|
|
78
140
|
if (order.message) {
|
|
79
141
|
message = {
|
|
142
|
+
deviceId: context.connectionParams.deviceId,
|
|
80
143
|
type: "error",
|
|
81
|
-
title: "
|
|
144
|
+
title: "Attention",
|
|
82
145
|
message: order.message
|
|
83
|
-
? order.message
|
|
84
|
-
: "
|
|
146
|
+
? context.i18n.__(order.message)
|
|
147
|
+
: context.i18n.__("It was not possible to check the order"),
|
|
85
148
|
};
|
|
86
149
|
}
|
|
87
150
|
}
|
|
88
|
-
|
|
89
|
-
|
|
151
|
+
if (message) {
|
|
152
|
+
eventHelper.sendMessage(message);
|
|
153
|
+
}
|
|
154
|
+
return {
|
|
155
|
+
order: order,
|
|
156
|
+
...message && { message: message }
|
|
157
|
+
};
|
|
90
158
|
}
|
|
91
159
|
catch (e) {
|
|
92
160
|
let message = {
|
|
93
161
|
type: "error",
|
|
94
|
-
title: "
|
|
162
|
+
title: context.i18n.__("Error"),
|
|
95
163
|
message: "",
|
|
96
164
|
};
|
|
97
165
|
if (e.code === 1) {
|
|
98
|
-
message.message = "
|
|
166
|
+
message.message = context.i18n.__("Enter the name of the customer");
|
|
99
167
|
}
|
|
100
168
|
else if (e.code === 2) {
|
|
101
|
-
message.message = "
|
|
169
|
+
message.message = context.i18n.__("Enter the customer's phone");
|
|
102
170
|
}
|
|
103
171
|
else if (e.code === 3) {
|
|
104
|
-
message.message = "
|
|
172
|
+
message.message = context.i18n.__("The wrong format of the name of the customer");
|
|
105
173
|
}
|
|
106
174
|
else if (e.code === 4) {
|
|
107
|
-
message.message = "
|
|
175
|
+
message.message = context.i18n.__("The wrong format of the customer number");
|
|
108
176
|
}
|
|
109
177
|
else if (e.code === 5) {
|
|
110
|
-
message.message = "
|
|
178
|
+
message.message = context.i18n.__("No point of Street");
|
|
111
179
|
}
|
|
112
180
|
else if (e.code === 6) {
|
|
113
|
-
message.message = "
|
|
181
|
+
message.message = context.i18n.__("Not indicated the house number");
|
|
114
182
|
}
|
|
115
183
|
else if (e.code === 7) {
|
|
116
|
-
message.message = "
|
|
184
|
+
message.message = context.i18n.__("The city is not indicated");
|
|
117
185
|
}
|
|
118
186
|
else if (e.code === 8) {
|
|
119
|
-
message.message = "
|
|
187
|
+
message.message = context.i18n.__("The payment system is not available");
|
|
188
|
+
}
|
|
189
|
+
else if (e.code === 11) {
|
|
190
|
+
message.message = context.i18n.__(order.delivery.message);
|
|
120
191
|
}
|
|
121
192
|
else if (e.code === 10) {
|
|
122
|
-
message.message = "
|
|
193
|
+
message.message = context.i18n.__("The date of execution of the order is not true");
|
|
194
|
+
}
|
|
195
|
+
else if (e.code === 15) {
|
|
196
|
+
message.message = context.i18n.__("Ordering for a date in the past is not possible");
|
|
123
197
|
}
|
|
124
198
|
else {
|
|
125
199
|
message.message = e.error
|
|
126
200
|
? e.error
|
|
127
|
-
:
|
|
201
|
+
: context.i18n.__(`Problem when checking the order: %s`, e);
|
|
128
202
|
}
|
|
129
|
-
|
|
203
|
+
order = await Order.findOne(data.orderId);
|
|
130
204
|
sails.log.error(e);
|
|
131
|
-
|
|
205
|
+
eventHelper.sendMessage(message);
|
|
206
|
+
return {
|
|
207
|
+
order: order,
|
|
208
|
+
message: message
|
|
209
|
+
};
|
|
132
210
|
}
|
|
133
211
|
},
|
|
134
212
|
},
|
|
135
213
|
sendOrder: {
|
|
136
214
|
def: "sendOrder(orderId: String!): CheckResponse",
|
|
137
215
|
fn: async function (parent, args, context) {
|
|
216
|
+
if (!context.connectionParams.deviceId) {
|
|
217
|
+
throw `Missed deviceId`;
|
|
218
|
+
}
|
|
138
219
|
let data = args;
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
220
|
+
var order = await Order.findOne({ id: data.orderId });
|
|
221
|
+
if (!order) {
|
|
222
|
+
const errorMessage = context.i18n.__(`Order with id %s not found`, data.orderId);
|
|
223
|
+
eventHelper.sendMessage({
|
|
224
|
+
deviceId: context.connectionParams.deviceId,
|
|
225
|
+
type: "error",
|
|
226
|
+
title: context.i18n.__("Order not found"),
|
|
227
|
+
message: errorMessage,
|
|
228
|
+
});
|
|
229
|
+
sails.log.error(`${errorMessage}`);
|
|
230
|
+
throw new Error(errorMessage);
|
|
231
|
+
}
|
|
232
|
+
if (!order.isPaymentPromise) {
|
|
233
|
+
try {
|
|
234
|
+
let paymentResponse = await Order.payment({ id: order.id });
|
|
235
|
+
const action = {
|
|
236
|
+
deviceId: context.connectionParams.deviceId,
|
|
237
|
+
type: "Redirect",
|
|
238
|
+
data: {
|
|
239
|
+
link: paymentResponse.redirectLink,
|
|
240
|
+
},
|
|
241
|
+
};
|
|
242
|
+
eventHelper.sendAction(action);
|
|
243
|
+
order = await Order.populate({ id: order.id });
|
|
244
|
+
return { order: order, action: action };
|
|
245
|
+
}
|
|
246
|
+
catch (e) {
|
|
247
|
+
eventHelper.sendMessage({
|
|
248
|
+
deviceId: context.connectionParams.deviceId,
|
|
152
249
|
type: "error",
|
|
153
|
-
title: "
|
|
154
|
-
message:
|
|
250
|
+
title: context.i18n.__("Error"),
|
|
251
|
+
message: context.i18n.__("The payment of the payment has ended unsuccessfully"),
|
|
155
252
|
});
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
// order.id,
|
|
164
|
-
// null,
|
|
165
|
-
// null,
|
|
166
|
-
// null,
|
|
167
|
-
// data.paymentMethodId
|
|
168
|
-
// );
|
|
169
|
-
// order = await Order.findOne({ id: data.orderId });
|
|
170
|
-
// }
|
|
171
|
-
// }
|
|
172
|
-
// if (order.paymentMethod) {
|
|
173
|
-
// if (!(await PaymentMethod.checkAvailable(order.paymentMethod))) {
|
|
174
|
-
// let errorMessage = `Проверка платежной системы завершилась неудачно`;
|
|
175
|
-
// eventHelper.sendMessage(args.orderId, {
|
|
176
|
-
// type: "error",
|
|
177
|
-
// title: "Ошибка",
|
|
178
|
-
// message: errorMessage,
|
|
179
|
-
// });
|
|
180
|
-
// sails.log.error(`${errorMessage}`)
|
|
181
|
-
// throw new Error(0,errorMessage);
|
|
182
|
-
// }
|
|
183
|
-
// if (!(await PaymentMethod.isPaymentPromise(data.paymentMethodId))) {
|
|
184
|
-
// try {
|
|
185
|
-
// let paymentResponse = await order.payment();
|
|
186
|
-
// const action = {
|
|
187
|
-
// type: "PaymentRedirect",
|
|
188
|
-
// data: {
|
|
189
|
-
// redirectLink: paymentResponse.redirectLink,
|
|
190
|
-
// },
|
|
191
|
-
// };
|
|
192
|
-
// eventHelper.sendAction(args.orderId, action);
|
|
193
|
-
// return { order: order, action: action };
|
|
194
|
-
// } catch (e) {
|
|
195
|
-
// eventHelper.sendMessage(args.orderId, {
|
|
196
|
-
// type: "error",
|
|
197
|
-
// title: "Ошибка",
|
|
198
|
-
// message: "Попытка регистрации платежа завершилась неудачно",
|
|
199
|
-
// });
|
|
200
|
-
// sails.log.error(e);
|
|
201
|
-
// throw new Error(0, JSON.stringify(e));
|
|
202
|
-
// }
|
|
203
|
-
// }
|
|
204
|
-
// }
|
|
205
|
-
await Order.order(order.id);
|
|
253
|
+
const error = `External payment: ${e}`;
|
|
254
|
+
sails.log.error(error);
|
|
255
|
+
throw new Error(error);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
try {
|
|
259
|
+
await Order.order({ id: order.id });
|
|
206
260
|
order = await Order.findOne({ id: data.orderId });
|
|
207
261
|
const message = {
|
|
208
262
|
type: "info",
|
|
209
|
-
title: "
|
|
210
|
-
message: "
|
|
263
|
+
title: context.i18n.__("Successfully"),
|
|
264
|
+
message: context.i18n.__("Your order is accepted for processing"),
|
|
211
265
|
};
|
|
212
|
-
eventHelper.sendMessage(
|
|
266
|
+
// eventHelper.sendMessage(message);
|
|
213
267
|
return { order: order, message: message };
|
|
214
268
|
}
|
|
215
269
|
catch (e) {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
message: e,
|
|
220
|
-
});
|
|
221
|
-
sails.log.error("sendOrder error :", e);
|
|
222
|
-
throw new errorWrapper_1.Error(0, `${e}`);
|
|
270
|
+
const error = `Order finalize error:, ${e}`;
|
|
271
|
+
sails.log.error(error);
|
|
272
|
+
throw new Error(error);
|
|
223
273
|
}
|
|
224
274
|
},
|
|
225
275
|
},
|