@chevre/domain 24.0.0-alpha.25 → 24.0.0-alpha.27
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/lib/chevre/repo/action/acceptPay.d.ts +18 -0
- package/lib/chevre/repo/action/acceptPay.js +45 -30
- package/lib/chevre/repo/action/actionProcess.d.ts +30 -0
- package/lib/chevre/repo/action/actionProcess.js +496 -1
- package/lib/chevre/repo/action/authorizeInvoice.d.ts +14 -1
- package/lib/chevre/repo/action/authorizeInvoice.js +36 -0
- package/lib/chevre/repo/action/authorizePaymentMethod.d.ts +10 -1
- package/lib/chevre/repo/action/authorizePaymentMethod.js +10 -48
- package/lib/chevre/repo/action.d.ts +0 -1
- package/lib/chevre/repo/action.js +3 -509
- package/lib/chevre/service/order/sendOrder.js +0 -1
- package/lib/chevre/service/payment/any/authorize/fixTransactionNumber.d.ts +5 -2
- package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.d.ts +12 -8
- package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.js +33 -16
- package/lib/chevre/service/payment/any/authorize.d.ts +2 -0
- package/lib/chevre/service/payment/any/authorize.js +8 -1
- package/lib/chevre/service/payment/creditCard/voidTransaction.d.ts +9 -8
- package/lib/chevre/service/payment/creditCard/voidTransaction.js +15 -7
- package/lib/chevre/service/task/authorizePayment.js +2 -0
- package/lib/chevre/service/task/payment/voidPaymentByTask.d.ts +2 -0
- package/lib/chevre/service/task/voidPayment.js +2 -0
- package/package.json +1 -1
|
@@ -29,7 +29,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
exports.ActionRepo = void 0;
|
|
30
30
|
const moment_1 = __importDefault(require("moment"));
|
|
31
31
|
const factory = __importStar(require("../factory"));
|
|
32
|
-
|
|
32
|
+
// import { MONGO_MAX_TIME_MS } from '../settings';
|
|
33
33
|
// import { createSchema, IModel as IActionModel, modelName } from './mongoose/schemas/action';
|
|
34
34
|
// import { createSchema as createRecipeSchema, IModel as IActionRecipeModel, modelName as recipeModelName } from './mongoose/schemas/actionRecipe';
|
|
35
35
|
const actionProcess_1 = require("./action/actionProcess");
|
|
@@ -43,441 +43,11 @@ class ActionRepo extends actionProcess_1.ActionProcessRepo {
|
|
|
43
43
|
// this.actionModel = connection.model(modelName, createSchema());
|
|
44
44
|
// this.actionRecipeModel = connection.model(recipeModelName, createRecipeSchema());
|
|
45
45
|
// }
|
|
46
|
-
static CREATE_MONGO_CONDITIONS(params) {
|
|
47
|
-
const andConditions = [];
|
|
48
|
-
const idIn = params.id?.$in;
|
|
49
|
-
if (Array.isArray(idIn)) {
|
|
50
|
-
andConditions.push({ _id: { $in: idIn } });
|
|
51
|
-
}
|
|
52
|
-
const idNin = params.id?.$nin;
|
|
53
|
-
if (Array.isArray(idNin)) {
|
|
54
|
-
andConditions.push({ _id: { $nin: idNin } });
|
|
55
|
-
}
|
|
56
|
-
const projectIdEq = params.project?.id?.$eq;
|
|
57
|
-
if (typeof projectIdEq === 'string') {
|
|
58
|
-
andConditions.push({
|
|
59
|
-
'project.id': {
|
|
60
|
-
$eq: projectIdEq
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
const agentTypeOfIn = params.agent?.typeOf?.$in;
|
|
65
|
-
if (Array.isArray(agentTypeOfIn)) {
|
|
66
|
-
andConditions.push({
|
|
67
|
-
'agent.typeOf': {
|
|
68
|
-
$exists: true,
|
|
69
|
-
$in: agentTypeOfIn
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
const agentIdIn = params.agent?.id?.$in;
|
|
74
|
-
if (Array.isArray(agentIdIn)) {
|
|
75
|
-
andConditions.push({
|
|
76
|
-
'agent.id': {
|
|
77
|
-
$exists: true,
|
|
78
|
-
$in: agentIdIn
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
const instrumentTransactionNumberEq = params.instrument?.transactionNumber?.$eq;
|
|
83
|
-
if (typeof instrumentTransactionNumberEq === 'string') {
|
|
84
|
-
andConditions.push({ 'instrument.transactionNumber': { $exists: true, $eq: instrumentTransactionNumberEq } });
|
|
85
|
-
}
|
|
86
|
-
const instrumentTypeOfEq = params.instrument?.typeOf?.$eq;
|
|
87
|
-
if (typeof instrumentTypeOfEq === 'string') {
|
|
88
|
-
andConditions.push({ 'instrument.typeOf': { $exists: true, $eq: instrumentTypeOfEq } });
|
|
89
|
-
}
|
|
90
|
-
const instrumentIdentifierEq = params.instrument?.identifier?.$eq;
|
|
91
|
-
if (typeof instrumentIdentifierEq === 'string') {
|
|
92
|
-
andConditions.push({ 'instrument.identifier': { $exists: true, $eq: instrumentIdentifierEq } });
|
|
93
|
-
}
|
|
94
|
-
const instrumentIdEq = params.instrument?.id?.$eq;
|
|
95
|
-
if (typeof instrumentIdEq === 'string') {
|
|
96
|
-
andConditions.push({ 'instrument.id': { $exists: true, $eq: instrumentIdEq } });
|
|
97
|
-
}
|
|
98
|
-
const instrumentOrderNumberEq = params.instrument?.orderNumber?.$eq;
|
|
99
|
-
if (typeof instrumentOrderNumberEq === 'string') {
|
|
100
|
-
andConditions.push({ 'instrument.orderNumber': { $exists: true, $eq: instrumentOrderNumberEq } });
|
|
101
|
-
}
|
|
102
|
-
const locationIdEq = params.location?.id?.$eq;
|
|
103
|
-
if (typeof locationIdEq === 'string') {
|
|
104
|
-
andConditions.push({
|
|
105
|
-
'location.id': {
|
|
106
|
-
$exists: true,
|
|
107
|
-
$eq: locationIdEq
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
const locationIdentifierEq = params.location?.identifier?.$eq;
|
|
112
|
-
if (typeof locationIdentifierEq === 'string') {
|
|
113
|
-
andConditions.push({
|
|
114
|
-
'location.identifier': {
|
|
115
|
-
$exists: true,
|
|
116
|
-
$eq: locationIdentifierEq
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
const objectMovieTicketsIdentifierEq = params.object?.movieTickets?.identifier?.$eq;
|
|
121
|
-
if (typeof objectMovieTicketsIdentifierEq === 'string') {
|
|
122
|
-
andConditions.push({
|
|
123
|
-
'object.movieTickets.identifier': {
|
|
124
|
-
$exists: true,
|
|
125
|
-
$eq: objectMovieTicketsIdentifierEq
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
const objectMovieTicketsServiceOutputReservationForIdEq = params.object?.movieTickets?.serviceOutput?.reservationFor?.id?.$eq;
|
|
130
|
-
if (typeof objectMovieTicketsServiceOutputReservationForIdEq === 'string') {
|
|
131
|
-
andConditions.push({
|
|
132
|
-
'object.movieTickets.serviceOutput.reservationFor.id': {
|
|
133
|
-
$exists: true,
|
|
134
|
-
$eq: objectMovieTicketsServiceOutputReservationForIdEq
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
const objectPaymentMethodIdEq = params.object?.paymentMethodId?.$eq;
|
|
139
|
-
if (typeof objectPaymentMethodIdEq === 'string') {
|
|
140
|
-
andConditions.push({
|
|
141
|
-
'object.paymentMethodId': {
|
|
142
|
-
$exists: true,
|
|
143
|
-
$eq: objectPaymentMethodIdEq
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
const objectObjectPaymentMethodIdEq = params.object?.object?.paymentMethodId?.$eq;
|
|
148
|
-
if (typeof objectObjectPaymentMethodIdEq === 'string') {
|
|
149
|
-
andConditions.push({
|
|
150
|
-
'object.object.paymentMethodId': {
|
|
151
|
-
$exists: true,
|
|
152
|
-
$eq: objectObjectPaymentMethodIdEq
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
const objectReservationForIdEq = params.object?.reservationFor?.id?.$eq;
|
|
157
|
-
if (typeof objectReservationForIdEq === 'string') {
|
|
158
|
-
andConditions.push({
|
|
159
|
-
'object.reservationFor.id': {
|
|
160
|
-
$exists: true,
|
|
161
|
-
$eq: objectReservationForIdEq
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
const objectReservationNumberEq = params.object?.reservationNumber?.$eq;
|
|
166
|
-
if (typeof objectReservationNumberEq === 'string') {
|
|
167
|
-
andConditions.push({
|
|
168
|
-
'object.reservationNumber': {
|
|
169
|
-
$exists: true,
|
|
170
|
-
$eq: objectReservationNumberEq
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
const objectReservationNumberIn = params.object?.reservationNumber?.$in;
|
|
175
|
-
if (Array.isArray(objectReservationNumberIn)) {
|
|
176
|
-
andConditions.push({
|
|
177
|
-
'object.reservationNumber': {
|
|
178
|
-
$exists: true,
|
|
179
|
-
$in: objectReservationNumberIn
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
const objectPaymentMethodAccountIdEq = params.object?.paymentMethod?.accountId?.$eq;
|
|
184
|
-
if (typeof objectPaymentMethodAccountIdEq === 'string') {
|
|
185
|
-
andConditions.push({
|
|
186
|
-
'object.paymentMethod.accountId': {
|
|
187
|
-
$exists: true,
|
|
188
|
-
$eq: objectPaymentMethodAccountIdEq
|
|
189
|
-
}
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
const objectPaymentMethodPaymentMethodIdEq = params.object?.paymentMethod?.paymentMethodId?.$eq;
|
|
193
|
-
if (typeof objectPaymentMethodPaymentMethodIdEq === 'string') {
|
|
194
|
-
andConditions.push({
|
|
195
|
-
'object.paymentMethod.paymentMethodId': {
|
|
196
|
-
$exists: true,
|
|
197
|
-
$eq: objectPaymentMethodPaymentMethodIdEq
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
const objectPaymentMethodPaymentMethodIdIn = params.object?.paymentMethod?.paymentMethodId?.$in;
|
|
202
|
-
if (Array.isArray(objectPaymentMethodPaymentMethodIdIn)) {
|
|
203
|
-
andConditions.push({
|
|
204
|
-
'object.paymentMethod.paymentMethodId': {
|
|
205
|
-
$exists: true,
|
|
206
|
-
$in: objectPaymentMethodPaymentMethodIdIn
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
const objectPaymentMethodTypeOfEq = params.object?.paymentMethod?.typeOf?.$eq;
|
|
211
|
-
if (typeof objectPaymentMethodTypeOfEq === 'string') {
|
|
212
|
-
andConditions.push({
|
|
213
|
-
'object.paymentMethod.typeOf': {
|
|
214
|
-
$exists: true,
|
|
215
|
-
$eq: objectPaymentMethodTypeOfEq
|
|
216
|
-
}
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
const objectTypeOfEq = params.object?.typeOf?.$eq;
|
|
220
|
-
if (typeof objectTypeOfEq === 'string') {
|
|
221
|
-
andConditions.push({
|
|
222
|
-
'object.typeOf': {
|
|
223
|
-
$exists: true,
|
|
224
|
-
$eq: objectTypeOfEq
|
|
225
|
-
}
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
const objectTypeOfIn = params.object?.typeOf?.$in;
|
|
229
|
-
if (Array.isArray(objectTypeOfIn)) {
|
|
230
|
-
andConditions.push({
|
|
231
|
-
'object.typeOf': {
|
|
232
|
-
$exists: true,
|
|
233
|
-
$in: objectTypeOfIn
|
|
234
|
-
}
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
const objectIdEq = params.object?.id?.$eq;
|
|
238
|
-
if (typeof objectIdEq === 'string') {
|
|
239
|
-
andConditions.push({
|
|
240
|
-
'object.id': {
|
|
241
|
-
$exists: true,
|
|
242
|
-
$eq: objectIdEq
|
|
243
|
-
}
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
const objectIdIn = params.object?.id?.$in;
|
|
247
|
-
if (Array.isArray(objectIdIn)) {
|
|
248
|
-
andConditions.push({
|
|
249
|
-
'object.id': {
|
|
250
|
-
$exists: true,
|
|
251
|
-
$in: objectIdIn
|
|
252
|
-
}
|
|
253
|
-
});
|
|
254
|
-
}
|
|
255
|
-
const objectOrderNumberIn = params.object?.orderNumber?.$in;
|
|
256
|
-
if (Array.isArray(objectOrderNumberIn)) {
|
|
257
|
-
andConditions.push({
|
|
258
|
-
'object.orderNumber': {
|
|
259
|
-
$exists: true,
|
|
260
|
-
$in: objectOrderNumberIn
|
|
261
|
-
}
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
const objectEventIdIn = params.object?.event?.id?.$in;
|
|
265
|
-
if (Array.isArray(objectEventIdIn)) {
|
|
266
|
-
andConditions.push({
|
|
267
|
-
'object.event.id': {
|
|
268
|
-
$exists: true,
|
|
269
|
-
$in: objectEventIdIn
|
|
270
|
-
}
|
|
271
|
-
});
|
|
272
|
-
}
|
|
273
|
-
// discontinue(2024-06-18~)
|
|
274
|
-
// const objectAcceptedOfferSeatNumberIn =
|
|
275
|
-
// params.object?.acceptedOffer?.itemOffered?.serviceOutput?.reservedTicket?.ticketedSeat?.seatNumber?.$in;
|
|
276
|
-
// if (Array.isArray(objectAcceptedOfferSeatNumberIn)) {
|
|
277
|
-
// andConditions.push({
|
|
278
|
-
// 'object.acceptedOffer.itemOffered.serviceOutput.reservedTicket.ticketedSeat.seatNumber': {
|
|
279
|
-
// $exists: true,
|
|
280
|
-
// $in: objectAcceptedOfferSeatNumberIn
|
|
281
|
-
// }
|
|
282
|
-
// });
|
|
283
|
-
// }
|
|
284
|
-
const objectTransactionNumberEq = params.object?.transactionNumber?.$eq;
|
|
285
|
-
if (typeof objectTransactionNumberEq === 'string') {
|
|
286
|
-
andConditions.push({ 'object.transactionNumber': { $exists: true, $eq: objectTransactionNumberEq } });
|
|
287
|
-
}
|
|
288
|
-
if (typeof params.typeOf === 'string') {
|
|
289
|
-
andConditions.push({
|
|
290
|
-
typeOf: params.typeOf
|
|
291
|
-
});
|
|
292
|
-
}
|
|
293
|
-
else {
|
|
294
|
-
const typeOfEq = params.typeOf?.$eq;
|
|
295
|
-
if (typeof typeOfEq === 'string') {
|
|
296
|
-
andConditions.push({
|
|
297
|
-
typeOf: { $eq: typeOfEq }
|
|
298
|
-
});
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
const actionStatusIn = params.actionStatus?.$in;
|
|
302
|
-
if (Array.isArray(actionStatusIn)) {
|
|
303
|
-
andConditions.push({
|
|
304
|
-
actionStatus: { $in: actionStatusIn }
|
|
305
|
-
});
|
|
306
|
-
}
|
|
307
|
-
if (Array.isArray(params.actionStatusTypes)) {
|
|
308
|
-
andConditions.push({
|
|
309
|
-
actionStatus: { $in: params.actionStatusTypes }
|
|
310
|
-
});
|
|
311
|
-
}
|
|
312
|
-
const startDateGte = params.startFrom;
|
|
313
|
-
if (startDateGte instanceof Date) {
|
|
314
|
-
andConditions.push({
|
|
315
|
-
startDate: { $gte: startDateGte }
|
|
316
|
-
});
|
|
317
|
-
}
|
|
318
|
-
const startDateLte = params.startThrough;
|
|
319
|
-
if (startDateLte instanceof Date) {
|
|
320
|
-
andConditions.push({
|
|
321
|
-
startDate: { $lte: startDateLte }
|
|
322
|
-
});
|
|
323
|
-
}
|
|
324
|
-
const fromLocationTypeOfIn = params.fromLocation?.typeOf?.$in;
|
|
325
|
-
if (Array.isArray(fromLocationTypeOfIn)) {
|
|
326
|
-
andConditions.push({
|
|
327
|
-
'fromLocation.typeOf': {
|
|
328
|
-
$exists: true,
|
|
329
|
-
$in: fromLocationTypeOfIn
|
|
330
|
-
}
|
|
331
|
-
});
|
|
332
|
-
}
|
|
333
|
-
const fromLocationAccountNumberIn = params.fromLocation?.accountNumber?.$in;
|
|
334
|
-
if (Array.isArray(fromLocationAccountNumberIn)) {
|
|
335
|
-
andConditions.push({
|
|
336
|
-
'fromLocation.accountNumber': {
|
|
337
|
-
$exists: true,
|
|
338
|
-
$in: fromLocationAccountNumberIn
|
|
339
|
-
}
|
|
340
|
-
});
|
|
341
|
-
}
|
|
342
|
-
const fromLocationAccountTypeIn = params.fromLocation?.accountType?.$in;
|
|
343
|
-
if (Array.isArray(fromLocationAccountTypeIn)) {
|
|
344
|
-
andConditions.push({
|
|
345
|
-
'fromLocation.accountType': {
|
|
346
|
-
$exists: true,
|
|
347
|
-
$in: fromLocationAccountTypeIn
|
|
348
|
-
}
|
|
349
|
-
});
|
|
350
|
-
}
|
|
351
|
-
const toLocationTypeOfIn = params.toLocation?.typeOf?.$in;
|
|
352
|
-
if (Array.isArray(toLocationTypeOfIn)) {
|
|
353
|
-
andConditions.push({
|
|
354
|
-
'toLocation.typeOf': {
|
|
355
|
-
$exists: true,
|
|
356
|
-
$in: toLocationTypeOfIn
|
|
357
|
-
}
|
|
358
|
-
});
|
|
359
|
-
}
|
|
360
|
-
const toLocationAccountNumberIn = params.toLocation?.accountNumber?.$in;
|
|
361
|
-
if (Array.isArray(toLocationAccountNumberIn)) {
|
|
362
|
-
andConditions.push({
|
|
363
|
-
'toLocation.accountNumber': {
|
|
364
|
-
$exists: true,
|
|
365
|
-
$in: toLocationAccountNumberIn
|
|
366
|
-
}
|
|
367
|
-
});
|
|
368
|
-
}
|
|
369
|
-
const toLocationAccountTypeIn = params.toLocation?.accountType?.$in;
|
|
370
|
-
if (Array.isArray(toLocationAccountTypeIn)) {
|
|
371
|
-
andConditions.push({
|
|
372
|
-
'toLocation.accountType': {
|
|
373
|
-
$exists: true,
|
|
374
|
-
$in: toLocationAccountTypeIn
|
|
375
|
-
}
|
|
376
|
-
});
|
|
377
|
-
}
|
|
378
|
-
const purposeTypeOfIn = params.purpose?.typeOf?.$in;
|
|
379
|
-
if (Array.isArray(purposeTypeOfIn)) {
|
|
380
|
-
andConditions.push({
|
|
381
|
-
'purpose.typeOf': {
|
|
382
|
-
$exists: true,
|
|
383
|
-
$in: purposeTypeOfIn
|
|
384
|
-
}
|
|
385
|
-
});
|
|
386
|
-
}
|
|
387
|
-
const purposeIdIn = params.purpose?.id?.$in;
|
|
388
|
-
if (Array.isArray(purposeIdIn)) {
|
|
389
|
-
andConditions.push({
|
|
390
|
-
'purpose.id': {
|
|
391
|
-
$exists: true,
|
|
392
|
-
$in: purposeIdIn
|
|
393
|
-
}
|
|
394
|
-
});
|
|
395
|
-
}
|
|
396
|
-
const purposeOrderNumberIn = params.purpose?.orderNumber?.$in;
|
|
397
|
-
if (Array.isArray(purposeOrderNumberIn)) {
|
|
398
|
-
andConditions.push({
|
|
399
|
-
'purpose.orderNumber': {
|
|
400
|
-
$exists: true,
|
|
401
|
-
$in: purposeOrderNumberIn
|
|
402
|
-
}
|
|
403
|
-
});
|
|
404
|
-
}
|
|
405
|
-
const resultTypeOfIn = params.result?.typeOf?.$in;
|
|
406
|
-
if (Array.isArray(resultTypeOfIn)) {
|
|
407
|
-
andConditions.push({
|
|
408
|
-
'result.typeOf': {
|
|
409
|
-
$exists: true,
|
|
410
|
-
$in: resultTypeOfIn
|
|
411
|
-
}
|
|
412
|
-
});
|
|
413
|
-
}
|
|
414
|
-
const resultIdIn = params.result?.id?.$in;
|
|
415
|
-
if (Array.isArray(resultIdIn)) {
|
|
416
|
-
andConditions.push({
|
|
417
|
-
'result.id': {
|
|
418
|
-
$exists: true,
|
|
419
|
-
$in: resultIdIn
|
|
420
|
-
}
|
|
421
|
-
});
|
|
422
|
-
}
|
|
423
|
-
const resultOrderNumberIn = params.result?.orderNumber?.$in;
|
|
424
|
-
if (Array.isArray(resultOrderNumberIn)) {
|
|
425
|
-
andConditions.push({
|
|
426
|
-
'result.orderNumber': {
|
|
427
|
-
$exists: true,
|
|
428
|
-
$in: resultOrderNumberIn
|
|
429
|
-
}
|
|
430
|
-
});
|
|
431
|
-
}
|
|
432
|
-
const resultCodeIn = params.result?.code?.$in;
|
|
433
|
-
if (Array.isArray(resultCodeIn)) {
|
|
434
|
-
andConditions.push({
|
|
435
|
-
'result.code': {
|
|
436
|
-
$exists: true,
|
|
437
|
-
$in: resultCodeIn
|
|
438
|
-
}
|
|
439
|
-
});
|
|
440
|
-
}
|
|
441
|
-
// sameAs(2024-04-23~)
|
|
442
|
-
const sameAsIdEq = params.sameAs?.id?.$eq;
|
|
443
|
-
if (typeof sameAsIdEq === 'string') {
|
|
444
|
-
andConditions.push({ 'sameAs.id': { $exists: true, $eq: sameAsIdEq } });
|
|
445
|
-
}
|
|
446
|
-
const aboutOrderNumberEq = params.about?.orderNumber?.$eq;
|
|
447
|
-
if (typeof aboutOrderNumberEq === 'string') {
|
|
448
|
-
andConditions.push({ 'about.orderNumber': { $exists: true, $eq: aboutOrderNumberEq } });
|
|
449
|
-
}
|
|
450
|
-
return andConditions;
|
|
451
|
-
}
|
|
452
46
|
/**
|
|
453
47
|
* アクション検索
|
|
454
48
|
*/
|
|
455
49
|
async search(params, inclusion) {
|
|
456
|
-
|
|
457
|
-
let positiveProjectionFields = actionProcess_1.AVAILABLE_PROJECT_FIELDS;
|
|
458
|
-
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
459
|
-
positiveProjectionFields = inclusion.filter((key) => actionProcess_1.AVAILABLE_PROJECT_FIELDS.includes(key));
|
|
460
|
-
}
|
|
461
|
-
const projection = {
|
|
462
|
-
_id: 0,
|
|
463
|
-
id: { $toString: '$_id' },
|
|
464
|
-
...Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1])))
|
|
465
|
-
};
|
|
466
|
-
const query = this.actionModel.find((conditions.length > 0) ? { $and: conditions } : {}, projection);
|
|
467
|
-
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
468
|
-
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
469
|
-
query.limit(params.limit)
|
|
470
|
-
.skip(params.limit * (page - 1));
|
|
471
|
-
}
|
|
472
|
-
/* istanbul ignore else */
|
|
473
|
-
if (params.sort?.startDate !== undefined) {
|
|
474
|
-
query.sort({ startDate: params.sort.startDate });
|
|
475
|
-
}
|
|
476
|
-
// const explainResult = await (<any>query).explain();
|
|
477
|
-
// console.log(explainResult[0].executionStats.allPlansExecution.map((e: any) => e.executionStages.inputStage));
|
|
478
|
-
return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
479
|
-
.lean() // 2024-08-26~
|
|
480
|
-
.exec();
|
|
50
|
+
return (this.findAnyActions(params, inclusion));
|
|
481
51
|
}
|
|
482
52
|
// /**
|
|
483
53
|
// * アクション開始
|
|
@@ -729,83 +299,7 @@ class ActionRepo extends actionProcess_1.ActionProcessRepo {
|
|
|
729
299
|
* 取引に対するアクションを検索する
|
|
730
300
|
*/
|
|
731
301
|
async searchByPurpose(params) {
|
|
732
|
-
|
|
733
|
-
{ 'purpose.typeOf': { $exists: true, $eq: params.purpose.typeOf } },
|
|
734
|
-
{ 'purpose.id': { $exists: true, $eq: params.purpose.id } }
|
|
735
|
-
];
|
|
736
|
-
// const idNin = params.id?.$nin;
|
|
737
|
-
// if (Array.isArray(idNin)) {
|
|
738
|
-
// andConditions.push({ _id: { $nin: idNin } });
|
|
739
|
-
// }
|
|
740
|
-
const objectPaymentMethodIdEq = params.object?.paymentMethodId?.$eq;
|
|
741
|
-
if (typeof objectPaymentMethodIdEq === 'string') {
|
|
742
|
-
andConditions.push({ 'object.paymentMethodId': { $exists: true, $eq: objectPaymentMethodIdEq } });
|
|
743
|
-
}
|
|
744
|
-
const objectTypeOfEq = params.object?.typeOf?.$eq;
|
|
745
|
-
if (typeof objectTypeOfEq === 'string') {
|
|
746
|
-
andConditions.push({ 'object.typeOf': { $exists: true, $eq: objectTypeOfEq } });
|
|
747
|
-
}
|
|
748
|
-
if (typeof params.typeOf === 'string') {
|
|
749
|
-
andConditions.push({ typeOf: { $eq: params.typeOf } });
|
|
750
|
-
}
|
|
751
|
-
const actionStatusEq = params.actionStatus?.$eq;
|
|
752
|
-
if (typeof actionStatusEq === 'string') {
|
|
753
|
-
andConditions.push({ actionStatus: { $eq: actionStatusEq } });
|
|
754
|
-
}
|
|
755
|
-
const positiveProjectionFields = [
|
|
756
|
-
'project',
|
|
757
|
-
'actionStatus',
|
|
758
|
-
'typeOf',
|
|
759
|
-
'description',
|
|
760
|
-
'agent',
|
|
761
|
-
'recipient',
|
|
762
|
-
'result',
|
|
763
|
-
'error',
|
|
764
|
-
'object',
|
|
765
|
-
'startDate',
|
|
766
|
-
'endDate',
|
|
767
|
-
'purpose',
|
|
768
|
-
'potentialActions',
|
|
769
|
-
'instrument',
|
|
770
|
-
'location',
|
|
771
|
-
'sameAs',
|
|
772
|
-
'cancelAction',
|
|
773
|
-
'identifier'
|
|
774
|
-
];
|
|
775
|
-
const projection = {
|
|
776
|
-
_id: 0,
|
|
777
|
-
id: { $toString: '$_id' },
|
|
778
|
-
...Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1])))
|
|
779
|
-
};
|
|
780
|
-
const query = this.actionModel.find((andConditions.length > 0) ? { $and: andConditions } : {}, projection);
|
|
781
|
-
if (typeof params.sort?.startDate === 'number') {
|
|
782
|
-
query.sort({ startDate: params.sort.startDate });
|
|
783
|
-
}
|
|
784
|
-
return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
785
|
-
.lean()
|
|
786
|
-
.exec();
|
|
787
|
-
// return <Promise<IAction4transaction<T>[]>><Promise<unknown[]>>this.search<T>(
|
|
788
|
-
// {
|
|
789
|
-
// purpose: {
|
|
790
|
-
// id: { $in: [params.purpose.id] },
|
|
791
|
-
// typeOf: { $in: [params.purpose.typeOf] }
|
|
792
|
-
// },
|
|
793
|
-
// object: {
|
|
794
|
-
// ...(typeof params.object?.typeOf?.$eq === 'string')
|
|
795
|
-
// ? { typeOf: { $eq: params.object.typeOf.$eq } }
|
|
796
|
-
// : undefined,
|
|
797
|
-
// ...(typeof params.object?.paymentMethodId?.$eq === 'string')
|
|
798
|
-
// ? { paymentMethodId: { $eq: params.object.paymentMethodId.$eq } }
|
|
799
|
-
// : undefined
|
|
800
|
-
// },
|
|
801
|
-
// ...(typeof params.actionStatus?.$eq === 'string') ? { actionStatus: { $in: [params.actionStatus.$eq] } } : undefined,
|
|
802
|
-
// ...(typeof params.typeOf === 'string') ? { typeOf: { $eq: params.typeOf } } : undefined,
|
|
803
|
-
// ...(Array.isArray(params.id?.$nin)) ? { id: { $nin: params.id?.$nin } } : undefined,
|
|
804
|
-
// ...(typeof params.sort?.startDate === 'number') ? { sort: params.sort } : undefined
|
|
805
|
-
// },
|
|
806
|
-
// [],
|
|
807
|
-
// []
|
|
808
|
-
// );
|
|
302
|
+
return (this.findAnyActionsByPurpose(params));
|
|
809
303
|
}
|
|
810
304
|
/**
|
|
811
305
|
* 注文番号から、注文に対するアクションを検索する
|
|
@@ -128,7 +128,6 @@ function sendOrder(params) {
|
|
|
128
128
|
});
|
|
129
129
|
acceptedOffers = searchSlicedAcceptedOffersResult.acceptedOffers;
|
|
130
130
|
debug('delivering...', order.orderNumber, acceptedOffers.map((offer) => `${offer.itemOffered.id}`), params.object.acceptedOffers, 'offerIndexBase:', offerIndexBase);
|
|
131
|
-
console.log('createOwnerships:', createOwnerships);
|
|
132
131
|
// 所有権作成
|
|
133
132
|
if (createOwnerships) {
|
|
134
133
|
creatingOwnershipInfos = (0, factory_1.createOwnershipInfosFromOrder)({
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as factory from '../../../../factory';
|
|
2
|
-
import type {
|
|
2
|
+
import type { AcceptPayActionRepo } from '../../../../repo/action/acceptPay';
|
|
3
|
+
import type { AuthorizePaymentMethodActionRepo } from '../../../../repo/action/authorizePaymentMethod';
|
|
3
4
|
import type { AuthorizationRepo } from '../../../../repo/authorization';
|
|
4
5
|
import type { TicketRepo } from '../../../../repo/ticket';
|
|
5
6
|
import type { ITransactionInProgress, PlaceOrderRepo } from '../../../../repo/transaction/placeOrder';
|
|
@@ -7,7 +8,9 @@ import type { TransactionNumberRepo } from '../../../../repo/transactionNumber';
|
|
|
7
8
|
import * as PayTransactionService from '../../../assetTransaction/pay';
|
|
8
9
|
import { IInvoiceByTicketToken } from '../factory';
|
|
9
10
|
interface IFixTransactionNumberRepos {
|
|
10
|
-
action
|
|
11
|
+
action?: never;
|
|
12
|
+
acceptPayAction: AcceptPayActionRepo;
|
|
13
|
+
authorizePaymentMethodAction: AuthorizePaymentMethodActionRepo;
|
|
11
14
|
authorization: AuthorizationRepo;
|
|
12
15
|
ticket: TicketRepo;
|
|
13
16
|
placeOrder: PlaceOrderRepo;
|
package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as factory from '../../../../factory';
|
|
2
|
-
import type {
|
|
2
|
+
import type { AcceptPayActionRepo } from '../../../../repo/action/acceptPay';
|
|
3
|
+
import type { AuthorizePaymentMethodActionRepo } from '../../../../repo/action/authorizePaymentMethod';
|
|
3
4
|
import type { AuthorizationRepo } from '../../../../repo/authorization';
|
|
4
5
|
import type { TicketRepo } from '../../../../repo/ticket';
|
|
5
6
|
import type { ITransactionInProgress, PlaceOrderRepo } from '../../../../repo/transaction/placeOrder';
|
|
@@ -10,6 +11,14 @@ interface IAcceptAction2ticketResult {
|
|
|
10
11
|
invoiceByTicketToken: IInvoiceByTicketToken;
|
|
11
12
|
ticketToken: string;
|
|
12
13
|
}
|
|
14
|
+
interface IHandlePrePublishedPaymentMethodIdOnAuthorizingRepos {
|
|
15
|
+
action?: never;
|
|
16
|
+
acceptPayAction: AcceptPayActionRepo;
|
|
17
|
+
authorizePaymentMethodAction: AuthorizePaymentMethodActionRepo;
|
|
18
|
+
authorization: AuthorizationRepo;
|
|
19
|
+
ticket: TicketRepo;
|
|
20
|
+
placeOrder: PlaceOrderRepo;
|
|
21
|
+
}
|
|
13
22
|
/**
|
|
14
23
|
* 決済承認前の決済採用アクションを参照する
|
|
15
24
|
*/
|
|
@@ -17,12 +26,7 @@ declare function handlePrePublishedPaymentMethodIdOnAuthorizing(params: {
|
|
|
17
26
|
object: Pick<IObjectWithoutDetail, 'amount' | 'issuedThrough' | 'paymentMethod' | 'referencesOrder'>;
|
|
18
27
|
prePublishedPaymentMethodId: string;
|
|
19
28
|
transaction: Pick<ITransactionInProgress, 'agent' | 'expires' | 'id' | 'typeOf' | 'project' | 'seller'>;
|
|
20
|
-
}): (repos: {
|
|
21
|
-
action: ActionRepo;
|
|
22
|
-
authorization: AuthorizationRepo;
|
|
23
|
-
ticket: TicketRepo;
|
|
24
|
-
placeOrder: PlaceOrderRepo;
|
|
25
|
-
}) => Promise<{
|
|
29
|
+
}): (repos: IHandlePrePublishedPaymentMethodIdOnAuthorizingRepos) => Promise<{
|
|
26
30
|
authorizeParams?: {
|
|
27
31
|
creditCard: factory.action.authorize.paymentMethod.any.ICreditCard;
|
|
28
32
|
paymentMethodByTransaction: factory.transaction.placeOrder.IPaymentMethodByPaymentUrl;
|
|
@@ -37,4 +41,4 @@ declare function handlePrePublishedPaymentMethodIdOnAuthorizing(params: {
|
|
|
37
41
|
authorizeParams?: never;
|
|
38
42
|
acceptAction2ticketResult?: never;
|
|
39
43
|
}>;
|
|
40
|
-
export { handlePrePublishedPaymentMethodIdOnAuthorizing };
|
|
44
|
+
export { IHandlePrePublishedPaymentMethodIdOnAuthorizingRepos, handlePrePublishedPaymentMethodIdOnAuthorizing };
|
package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.js
CHANGED
|
@@ -125,24 +125,32 @@ function handlePrePublishedPaymentMethodIdOnAuthorizing(params) {
|
|
|
125
125
|
const paymentMethodByTransaction = await repos.placeOrder.findInProgressPaymentMethodId({ id: params.transaction.id });
|
|
126
126
|
if (params.prePublishedPaymentMethodId === paymentMethodByTransaction?.paymentMethodId) {
|
|
127
127
|
// check existence of acceptAction when authorizing payment(2024-06-01~)
|
|
128
|
-
acceptPayAction = (await repos.action.search(
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
128
|
+
// acceptPayAction = (<Pick<IAcceptPayAction, 'object' | 'result' | 'id' | 'instrument'>[]>await repos.action.search<factory.actionType.AcceptAction>(
|
|
129
|
+
// {
|
|
130
|
+
// limit: 1,
|
|
131
|
+
// page: 1,
|
|
132
|
+
// project: { id: { $eq: params.transaction.project.id } },
|
|
133
|
+
// typeOf: { $eq: factory.actionType.AcceptAction },
|
|
134
|
+
// actionStatus: { $in: [factory.actionStatusType.CompletedActionStatus] },
|
|
135
|
+
// purpose: { id: { $in: [params.transaction.id] } },
|
|
136
|
+
// object: {
|
|
137
|
+
// transactionNumber: { $eq: params.prePublishedPaymentMethodId },
|
|
138
|
+
// typeOf: { $eq: factory.assetTransactionType.Pay }
|
|
139
|
+
// }
|
|
140
|
+
// },
|
|
141
|
+
// ['object', 'result', 'instrument']
|
|
142
|
+
// )).shift();
|
|
143
|
+
acceptPayAction = (await repos.acceptPayAction.findCompletedAcceptActionsByTransactionNumber({
|
|
144
|
+
project: { id: params.transaction.project.id },
|
|
145
|
+
purpose: { id: params.transaction.id },
|
|
146
|
+
object: { transactionNumber: params.prePublishedPaymentMethodId }
|
|
139
147
|
}, ['object', 'result', 'instrument'])).shift();
|
|
140
148
|
if (acceptPayAction === undefined) {
|
|
141
149
|
throw new factory.errors.NotFound(factory.actionType.AcceptAction);
|
|
142
150
|
}
|
|
143
151
|
debug('acceptPayAction found:', acceptPayAction.id);
|
|
144
152
|
// find recipe(2024-06-02~)
|
|
145
|
-
const actionRecipe = await repos.
|
|
153
|
+
const actionRecipe = await repos.acceptPayAction.findRecipeByAction({
|
|
146
154
|
project: { id: params.transaction.project.id },
|
|
147
155
|
recipeFor: { id: acceptPayAction.id }
|
|
148
156
|
});
|
|
@@ -169,13 +177,22 @@ function handlePrePublishedPaymentMethodIdOnAuthorizing(params) {
|
|
|
169
177
|
throw new factory.errors.Argument('paymentMethodId', 'pendingPaymentAgencyTransaction not found');
|
|
170
178
|
}
|
|
171
179
|
// 既に承認済であれば何もしない(2023-05-15~)
|
|
172
|
-
const existingCompletedAuthorizeActions =
|
|
173
|
-
|
|
180
|
+
// const existingCompletedAuthorizeActions = <IAuthorizePaymentAction[]>
|
|
181
|
+
// await repos.action.searchByPurpose<factory.actionType.AuthorizeAction>({
|
|
182
|
+
// typeOf: factory.actionType.AuthorizeAction,
|
|
183
|
+
// purpose: { id: params.transaction.id, typeOf: params.transaction.typeOf },
|
|
184
|
+
// actionStatus: { $eq: factory.actionStatusType.CompletedActionStatus },
|
|
185
|
+
// object: {
|
|
186
|
+
// paymentMethodId: { $eq: params.prePublishedPaymentMethodId },
|
|
187
|
+
// typeOf: { $eq: factory.action.authorize.paymentMethod.any.ResultType.Payment }
|
|
188
|
+
// },
|
|
189
|
+
// sort: { startDate: factory.sortType.Ascending }
|
|
190
|
+
// });
|
|
191
|
+
const existingCompletedAuthorizeActions = await repos.authorizePaymentMethodAction.findAuthorizePaymentMethodActionsByPurpose({
|
|
174
192
|
purpose: { id: params.transaction.id, typeOf: params.transaction.typeOf },
|
|
175
193
|
actionStatus: { $eq: factory.actionStatusType.CompletedActionStatus },
|
|
176
194
|
object: {
|
|
177
|
-
paymentMethodId: { $eq: params.prePublishedPaymentMethodId }
|
|
178
|
-
typeOf: { $eq: factory.action.authorize.paymentMethod.any.ResultType.Payment }
|
|
195
|
+
paymentMethodId: { $eq: params.prePublishedPaymentMethodId }
|
|
179
196
|
},
|
|
180
197
|
sort: { startDate: factory.sortType.Ascending }
|
|
181
198
|
});
|