@chevre/domain 24.0.0-alpha.26 → 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 +4 -0
- package/lib/chevre/repo/action/acceptPay.js +40 -52
- 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.js +9 -47
- 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/creditCard/voidTransaction.d.ts +9 -8
- package/lib/chevre/service/payment/creditCard/voidTransaction.js +15 -7
- 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,16 +1,17 @@
|
|
|
1
1
|
import * as factory from '../../../factory';
|
|
2
2
|
import { Settings } from '../../../settings';
|
|
3
|
-
import type {
|
|
3
|
+
import type { AuthorizeInvoiceActionRepo } from '../../../repo/action/authorizeInvoice';
|
|
4
4
|
import type { PaymentServiceRepo } from '../../../repo/paymentService';
|
|
5
5
|
import type { PaymentServiceProviderRepo } from '../../../repo/paymentServiceProvider';
|
|
6
6
|
import type { SellerPaymentAcceptedRepo } from '../../../repo/sellerPaymentAccepted';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
*/
|
|
10
|
-
declare function voidTransaction(params: factory.task.voidPayment.IData): (repos: {
|
|
11
|
-
action: ActionRepo;
|
|
7
|
+
interface IVoidTransactionRepos {
|
|
8
|
+
authorizeInvoiceAction: AuthorizeInvoiceActionRepo;
|
|
12
9
|
paymentAccepted: SellerPaymentAcceptedRepo;
|
|
13
10
|
paymentService: PaymentServiceRepo;
|
|
14
11
|
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
15
|
-
}
|
|
16
|
-
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* クレジットカード決済中止
|
|
15
|
+
*/
|
|
16
|
+
declare function voidTransaction(params: factory.task.voidPayment.IData): (repos: IVoidTransactionRepos, settings: Settings) => Promise<void>;
|
|
17
|
+
export { IVoidTransactionRepos, voidTransaction };
|
|
@@ -57,12 +57,20 @@ function voidTransaction(params) {
|
|
|
57
57
|
requirePaymentAccepted: false
|
|
58
58
|
})(repos);
|
|
59
59
|
// authorizeInvoiceActionが存在すれば取消(2024-06-13~)
|
|
60
|
-
const authorizeInvoiceAction = (
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
// const authorizeInvoiceAction = (<Pick<factory.action.authorize.invoice.IAction, 'id' | 'typeOf' | 'project'>[]>
|
|
61
|
+
// await repos.action.search(
|
|
62
|
+
// {
|
|
63
|
+
// limit: 1,
|
|
64
|
+
// page: 1,
|
|
65
|
+
// typeOf: { $eq: factory.actionType.AuthorizeAction },
|
|
66
|
+
// object: { paymentMethodId: { $eq: paymentMethodId } },
|
|
67
|
+
// sameAs: { id: { $eq: transaction.id } }
|
|
68
|
+
// },
|
|
69
|
+
// ['id', 'typeOf', 'project']
|
|
70
|
+
// )).shift();
|
|
71
|
+
const authorizeInvoiceAction = (await repos.authorizeInvoiceAction.findAuthorizeInvoiceActionsByPayTransaction({
|
|
72
|
+
paymentMethodId,
|
|
73
|
+
payTransactionId: transaction.id
|
|
66
74
|
}, ['id', 'typeOf', 'project'])).shift();
|
|
67
75
|
if (authorizeInvoiceAction !== undefined) {
|
|
68
76
|
const cancelAction = {
|
|
@@ -70,7 +78,7 @@ function voidTransaction(params) {
|
|
|
70
78
|
agent: { id: authorizeInvoiceAction.project.id, typeOf: factory.organizationType.Project }
|
|
71
79
|
// ...(typeof params.sameAs?.id === 'string') ? { sameAs: { id: params.sameAs.id, typeOf: 'Task' } } : undefined
|
|
72
80
|
};
|
|
73
|
-
await repos.
|
|
81
|
+
await repos.authorizeInvoiceAction.cancelWithVoid({ typeOf: authorizeInvoiceAction.typeOf, id: authorizeInvoiceAction.id, cancelAction });
|
|
74
82
|
}
|
|
75
83
|
const creditCardService = new GMO.service.Credit({
|
|
76
84
|
endpoint: String(availableChannel.serviceUrl),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AccountingReportRepo } from '../../../repo/accountingReport';
|
|
2
2
|
import type { ActionRepo } from '../../../repo/action';
|
|
3
|
+
import type { AuthorizeInvoiceActionRepo } from '../../../repo/action/authorizeInvoice';
|
|
3
4
|
import type { CredentialsRepo } from '../../../repo/credentials';
|
|
4
5
|
import type { PaymentServiceRepo } from '../../../repo/paymentService';
|
|
5
6
|
import type { PaymentServiceProviderRepo } from '../../../repo/paymentServiceProvider';
|
|
@@ -11,6 +12,7 @@ import * as factory from '../../../factory';
|
|
|
11
12
|
import { Settings } from '../../../settings';
|
|
12
13
|
declare function voidPaymentByTask(params: factory.task.voidPayment.IData): (repos: {
|
|
13
14
|
action: ActionRepo;
|
|
15
|
+
authorizeInvoiceAction: AuthorizeInvoiceActionRepo;
|
|
14
16
|
accountingReport: AccountingReportRepo;
|
|
15
17
|
credentials: CredentialsRepo;
|
|
16
18
|
paymentAccepted: SellerPaymentAcceptedRepo;
|
|
@@ -27,6 +27,7 @@ exports.call = call;
|
|
|
27
27
|
const factory = __importStar(require("../../factory"));
|
|
28
28
|
const accountingReport_1 = require("../../repo/accountingReport");
|
|
29
29
|
const action_1 = require("../../repo/action");
|
|
30
|
+
const authorizeInvoice_1 = require("../../repo/action/authorizeInvoice");
|
|
30
31
|
const credentials_1 = require("../../repo/credentials");
|
|
31
32
|
const paymentService_1 = require("../../repo/paymentService");
|
|
32
33
|
const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
|
|
@@ -50,6 +51,7 @@ function call(data) {
|
|
|
50
51
|
await (0, voidPaymentByTask_1.voidPaymentByTask)(data)({
|
|
51
52
|
accountingReport: new accountingReport_1.AccountingReportRepo(connection),
|
|
52
53
|
action: new action_1.ActionRepo(connection),
|
|
54
|
+
authorizeInvoiceAction: new authorizeInvoice_1.AuthorizeInvoiceActionRepo(connection),
|
|
53
55
|
credentials: new credentials_1.CredentialsRepo(redisClient, {
|
|
54
56
|
scope: `${factory.service.paymentService.PaymentServiceType.MovieTicket}:${paymentServiceId}`,
|
|
55
57
|
expireInSeconds: (useCredentialsRepo) ? credentialsExpireInSeconds : 0
|
package/package.json
CHANGED