@chevre/domain 26.0.0 → 26.1.0-alpha.0

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.
Files changed (51) hide show
  1. package/lib/chevre/repo/action/acceptCOAOffer.d.ts +8 -0
  2. package/lib/chevre/repo/action/acceptCOAOffer.js +17 -0
  3. package/lib/chevre/repo/action/acceptPay.d.ts +8 -0
  4. package/lib/chevre/repo/action/acceptPay.js +19 -2
  5. package/lib/chevre/repo/action/anyAction/actionProcess.d.ts +12 -21
  6. package/lib/chevre/repo/action/anyAction/actionProcess.js +4 -360
  7. package/lib/chevre/repo/action/anyAction/actionRecipe.d.ts +1 -1
  8. package/lib/chevre/repo/action/authorizeInvoice.js +1 -1
  9. package/lib/chevre/repo/action/authorizeOffer.js +1 -5
  10. package/lib/chevre/repo/action/authorizePaymentMethod.d.ts +8 -0
  11. package/lib/chevre/repo/action/authorizePaymentMethod.js +18 -1
  12. package/lib/chevre/repo/action/checkMovieTicket.d.ts +8 -0
  13. package/lib/chevre/repo/action/checkMovieTicket.js +17 -0
  14. package/lib/chevre/repo/action/dedicatedAction/dedicatedActionProcess.d.ts +46 -0
  15. package/lib/chevre/repo/action/dedicatedAction/dedicatedActionProcess.js +92 -0
  16. package/lib/chevre/repo/action/inform.d.ts +2 -1
  17. package/lib/chevre/repo/action/inform.js +14 -45
  18. package/lib/chevre/repo/action/pay.js +1 -1
  19. package/lib/chevre/repo/action/update.d.ts +8 -6
  20. package/lib/chevre/repo/action/update.js +14 -51
  21. package/lib/chevre/repo/action/use.d.ts +2 -1
  22. package/lib/chevre/repo/action/use.js +14 -45
  23. package/lib/chevre/repo/adminAction.d.ts +1 -1
  24. package/lib/chevre/repo/adminAction.js +27 -1
  25. package/lib/chevre/repo/factory/action/createMongoConditions.d.ts +4 -0
  26. package/lib/chevre/repo/factory/action/createMongoConditions.js +335 -0
  27. package/lib/chevre/repo/mongoose/schemas/action/abstractAction.d.ts +5 -0
  28. package/lib/chevre/repo/mongoose/schemas/action/abstractAction.js +2 -0
  29. package/lib/chevre/service/assetTransaction/pay/check.d.ts +3 -1
  30. package/lib/chevre/service/assetTransaction/pay/start/processAuthorize.d.ts +1 -1
  31. package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeMovieTicket.d.ts +1 -1
  32. package/lib/chevre/service/assetTransaction/pay/start.d.ts +1 -1
  33. package/lib/chevre/service/offer/eventServiceByCOA/findAcceptAction.js +4 -5
  34. package/lib/chevre/service/payment/any/authorize.d.ts +1 -1
  35. package/lib/chevre/service/payment/any/findAcceptAction.js +4 -5
  36. package/lib/chevre/service/payment/any/findAuthorizeAction.js +4 -5
  37. package/lib/chevre/service/payment/any/findCheckAction.d.ts +3 -1
  38. package/lib/chevre/service/payment/any/findCheckAction.js +5 -6
  39. package/lib/chevre/service/payment/movieTicket/authorize.d.ts +1 -1
  40. package/lib/chevre/service/payment/movieTicket/checkMovieTicket.d.ts +3 -1
  41. package/lib/chevre/service/payment/movieTicket/checkMovieTicket.js +3 -3
  42. package/lib/chevre/service/payment/movieTicket/validation.d.ts +3 -1
  43. package/lib/chevre/service/payment/movieTicket/validation.js +2 -2
  44. package/lib/chevre/service/task/acceptCOAOffer.js +4 -5
  45. package/lib/chevre/service/task/authorizePayment.js +5 -6
  46. package/lib/chevre/service/task/checkMovieTicket.js +7 -6
  47. package/lib/chevre/service/task/pay.js +3 -2
  48. package/lib/chevre/service/task/payment/payByTask.d.ts +3 -1
  49. package/lib/chevre/service/task/payment/payByTask.js +1 -1
  50. package/lib/chevre/service/task/publishPaymentUrl.js +4 -5
  51. package/package.json +1 -1
@@ -0,0 +1,335 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createMongoConditions = createMongoConditions;
4
+ function createMongoConditions(params) {
5
+ const andConditions = [];
6
+ const idIn = params.id?.$in;
7
+ if (Array.isArray(idIn)) {
8
+ andConditions.push({ _id: { $in: idIn } });
9
+ }
10
+ const idNin = params.id?.$nin;
11
+ if (Array.isArray(idNin)) {
12
+ andConditions.push({ _id: { $nin: idNin } });
13
+ }
14
+ const projectIdEq = params.project?.id?.$eq;
15
+ if (typeof projectIdEq === 'string') {
16
+ andConditions.push({
17
+ 'project.id': {
18
+ $eq: projectIdEq
19
+ }
20
+ });
21
+ }
22
+ const agentTypeOfIn = params.agent?.typeOf?.$in;
23
+ if (Array.isArray(agentTypeOfIn)) {
24
+ andConditions.push({
25
+ 'agent.typeOf': {
26
+ $exists: true,
27
+ $in: agentTypeOfIn
28
+ }
29
+ });
30
+ }
31
+ const agentIdIn = params.agent?.id?.$in;
32
+ if (Array.isArray(agentIdIn)) {
33
+ andConditions.push({
34
+ 'agent.id': {
35
+ $exists: true,
36
+ $in: agentIdIn
37
+ }
38
+ });
39
+ }
40
+ const instrumentTransactionNumberEq = params.instrument?.transactionNumber?.$eq;
41
+ if (typeof instrumentTransactionNumberEq === 'string') {
42
+ andConditions.push({ 'instrument.transactionNumber': { $exists: true, $eq: instrumentTransactionNumberEq } });
43
+ }
44
+ const instrumentTypeOfEq = params.instrument?.typeOf?.$eq;
45
+ if (typeof instrumentTypeOfEq === 'string') {
46
+ andConditions.push({ 'instrument.typeOf': { $exists: true, $eq: instrumentTypeOfEq } });
47
+ }
48
+ const instrumentIdentifierEq = params.instrument?.identifier?.$eq;
49
+ if (typeof instrumentIdentifierEq === 'string') {
50
+ andConditions.push({ 'instrument.identifier': { $exists: true, $eq: instrumentIdentifierEq } });
51
+ }
52
+ const instrumentIdEq = params.instrument?.id?.$eq;
53
+ if (typeof instrumentIdEq === 'string') {
54
+ andConditions.push({ 'instrument.id': { $exists: true, $eq: instrumentIdEq } });
55
+ }
56
+ const instrumentOrderNumberEq = params.instrument?.orderNumber?.$eq;
57
+ if (typeof instrumentOrderNumberEq === 'string') {
58
+ andConditions.push({ 'instrument.orderNumber': { $exists: true, $eq: instrumentOrderNumberEq } });
59
+ }
60
+ const locationIdEq = params.location?.id?.$eq;
61
+ if (typeof locationIdEq === 'string') {
62
+ andConditions.push({
63
+ 'location.id': {
64
+ $exists: true,
65
+ $eq: locationIdEq
66
+ }
67
+ });
68
+ }
69
+ const locationIdentifierEq = params.location?.identifier?.$eq;
70
+ if (typeof locationIdentifierEq === 'string') {
71
+ andConditions.push({
72
+ 'location.identifier': {
73
+ $exists: true,
74
+ $eq: locationIdentifierEq
75
+ }
76
+ });
77
+ }
78
+ const objectMovieTicketsIdentifierEq = params.object?.movieTickets?.identifier?.$eq;
79
+ if (typeof objectMovieTicketsIdentifierEq === 'string') {
80
+ andConditions.push({
81
+ 'object.movieTickets.identifier': {
82
+ $exists: true,
83
+ $eq: objectMovieTicketsIdentifierEq
84
+ }
85
+ });
86
+ }
87
+ const objectMovieTicketsServiceOutputReservationForIdEq = params.object?.movieTickets?.serviceOutput?.reservationFor?.id?.$eq;
88
+ if (typeof objectMovieTicketsServiceOutputReservationForIdEq === 'string') {
89
+ andConditions.push({
90
+ 'object.movieTickets.serviceOutput.reservationFor.id': {
91
+ $exists: true,
92
+ $eq: objectMovieTicketsServiceOutputReservationForIdEq
93
+ }
94
+ });
95
+ }
96
+ const objectPaymentMethodIdEq = params.object?.paymentMethodId?.$eq;
97
+ if (typeof objectPaymentMethodIdEq === 'string') {
98
+ andConditions.push({
99
+ 'object.paymentMethodId': {
100
+ $exists: true,
101
+ $eq: objectPaymentMethodIdEq
102
+ }
103
+ });
104
+ }
105
+ const objectObjectPaymentMethodIdEq = params.object?.object?.paymentMethodId?.$eq;
106
+ if (typeof objectObjectPaymentMethodIdEq === 'string') {
107
+ andConditions.push({
108
+ 'object.object.paymentMethodId': {
109
+ $exists: true,
110
+ $eq: objectObjectPaymentMethodIdEq
111
+ }
112
+ });
113
+ }
114
+ const objectReservationForIdEq = params.object?.reservationFor?.id?.$eq;
115
+ if (typeof objectReservationForIdEq === 'string') {
116
+ andConditions.push({
117
+ 'object.reservationFor.id': {
118
+ $exists: true,
119
+ $eq: objectReservationForIdEq
120
+ }
121
+ });
122
+ }
123
+ const objectReservationNumberEq = params.object?.reservationNumber?.$eq;
124
+ if (typeof objectReservationNumberEq === 'string') {
125
+ andConditions.push({
126
+ 'object.reservationNumber': {
127
+ $exists: true,
128
+ $eq: objectReservationNumberEq
129
+ }
130
+ });
131
+ }
132
+ const objectReservationNumberIn = params.object?.reservationNumber?.$in;
133
+ if (Array.isArray(objectReservationNumberIn)) {
134
+ andConditions.push({
135
+ 'object.reservationNumber': {
136
+ $exists: true,
137
+ $in: objectReservationNumberIn
138
+ }
139
+ });
140
+ }
141
+ const objectPaymentMethodAccountIdEq = params.object?.paymentMethod?.accountId?.$eq;
142
+ if (typeof objectPaymentMethodAccountIdEq === 'string') {
143
+ andConditions.push({
144
+ 'object.paymentMethod.accountId': {
145
+ $exists: true,
146
+ $eq: objectPaymentMethodAccountIdEq
147
+ }
148
+ });
149
+ }
150
+ const objectPaymentMethodPaymentMethodIdEq = params.object?.paymentMethod?.paymentMethodId?.$eq;
151
+ if (typeof objectPaymentMethodPaymentMethodIdEq === 'string') {
152
+ andConditions.push({
153
+ 'object.paymentMethod.paymentMethodId': {
154
+ $exists: true,
155
+ $eq: objectPaymentMethodPaymentMethodIdEq
156
+ }
157
+ });
158
+ }
159
+ const objectPaymentMethodPaymentMethodIdIn = params.object?.paymentMethod?.paymentMethodId?.$in;
160
+ if (Array.isArray(objectPaymentMethodPaymentMethodIdIn)) {
161
+ andConditions.push({
162
+ 'object.paymentMethod.paymentMethodId': {
163
+ $exists: true,
164
+ $in: objectPaymentMethodPaymentMethodIdIn
165
+ }
166
+ });
167
+ }
168
+ const objectPaymentMethodTypeOfEq = params.object?.paymentMethod?.typeOf?.$eq;
169
+ if (typeof objectPaymentMethodTypeOfEq === 'string') {
170
+ andConditions.push({
171
+ 'object.paymentMethod.typeOf': {
172
+ $exists: true,
173
+ $eq: objectPaymentMethodTypeOfEq
174
+ }
175
+ });
176
+ }
177
+ const objectTypeOfEq = params.object?.typeOf?.$eq;
178
+ if (typeof objectTypeOfEq === 'string') {
179
+ andConditions.push({
180
+ 'object.typeOf': {
181
+ $exists: true,
182
+ $eq: objectTypeOfEq
183
+ }
184
+ });
185
+ }
186
+ const objectTypeOfIn = params.object?.typeOf?.$in;
187
+ if (Array.isArray(objectTypeOfIn)) {
188
+ andConditions.push({
189
+ 'object.typeOf': {
190
+ $exists: true,
191
+ $in: objectTypeOfIn
192
+ }
193
+ });
194
+ }
195
+ const objectIdEq = params.object?.id?.$eq;
196
+ if (typeof objectIdEq === 'string') {
197
+ andConditions.push({
198
+ 'object.id': {
199
+ $exists: true,
200
+ $eq: objectIdEq
201
+ }
202
+ });
203
+ }
204
+ const objectIdIn = params.object?.id?.$in;
205
+ if (Array.isArray(objectIdIn)) {
206
+ andConditions.push({
207
+ 'object.id': {
208
+ $exists: true,
209
+ $in: objectIdIn
210
+ }
211
+ });
212
+ }
213
+ const objectOrderNumberIn = params.object?.orderNumber?.$in;
214
+ if (Array.isArray(objectOrderNumberIn)) {
215
+ andConditions.push({
216
+ 'object.orderNumber': {
217
+ $exists: true,
218
+ $in: objectOrderNumberIn
219
+ }
220
+ });
221
+ }
222
+ const objectTransactionNumberEq = params.object?.transactionNumber?.$eq;
223
+ if (typeof objectTransactionNumberEq === 'string') {
224
+ andConditions.push({ 'object.transactionNumber': { $exists: true, $eq: objectTransactionNumberEq } });
225
+ }
226
+ if (typeof params.typeOf === 'string') {
227
+ andConditions.push({
228
+ typeOf: params.typeOf
229
+ });
230
+ }
231
+ else {
232
+ const typeOfEq = params.typeOf?.$eq;
233
+ if (typeof typeOfEq === 'string') {
234
+ andConditions.push({
235
+ typeOf: { $eq: typeOfEq }
236
+ });
237
+ }
238
+ }
239
+ const actionStatusIn = params.actionStatus?.$in;
240
+ if (Array.isArray(actionStatusIn)) {
241
+ andConditions.push({
242
+ actionStatus: { $in: actionStatusIn }
243
+ });
244
+ }
245
+ if (Array.isArray(params.actionStatusTypes)) {
246
+ andConditions.push({
247
+ actionStatus: { $in: params.actionStatusTypes }
248
+ });
249
+ }
250
+ const startDateGte = params.startFrom;
251
+ if (startDateGte instanceof Date) {
252
+ andConditions.push({
253
+ startDate: { $gte: startDateGte }
254
+ });
255
+ }
256
+ const startDateLte = params.startThrough;
257
+ if (startDateLte instanceof Date) {
258
+ andConditions.push({
259
+ startDate: { $lte: startDateLte }
260
+ });
261
+ }
262
+ const purposeTypeOfIn = params.purpose?.typeOf?.$in;
263
+ if (Array.isArray(purposeTypeOfIn)) {
264
+ andConditions.push({
265
+ 'purpose.typeOf': {
266
+ $exists: true,
267
+ $in: purposeTypeOfIn
268
+ }
269
+ });
270
+ }
271
+ const purposeIdIn = params.purpose?.id?.$in;
272
+ if (Array.isArray(purposeIdIn)) {
273
+ andConditions.push({
274
+ 'purpose.id': {
275
+ $exists: true,
276
+ $in: purposeIdIn
277
+ }
278
+ });
279
+ }
280
+ const purposeOrderNumberIn = params.purpose?.orderNumber?.$in;
281
+ if (Array.isArray(purposeOrderNumberIn)) {
282
+ andConditions.push({
283
+ 'purpose.orderNumber': {
284
+ $exists: true,
285
+ $in: purposeOrderNumberIn
286
+ }
287
+ });
288
+ }
289
+ const resultTypeOfIn = params.result?.typeOf?.$in;
290
+ if (Array.isArray(resultTypeOfIn)) {
291
+ andConditions.push({
292
+ 'result.typeOf': {
293
+ $exists: true,
294
+ $in: resultTypeOfIn
295
+ }
296
+ });
297
+ }
298
+ const resultIdIn = params.result?.id?.$in;
299
+ if (Array.isArray(resultIdIn)) {
300
+ andConditions.push({
301
+ 'result.id': {
302
+ $exists: true,
303
+ $in: resultIdIn
304
+ }
305
+ });
306
+ }
307
+ const resultOrderNumberIn = params.result?.orderNumber?.$in;
308
+ if (Array.isArray(resultOrderNumberIn)) {
309
+ andConditions.push({
310
+ 'result.orderNumber': {
311
+ $exists: true,
312
+ $in: resultOrderNumberIn
313
+ }
314
+ });
315
+ }
316
+ const resultCodeIn = params.result?.code?.$in;
317
+ if (Array.isArray(resultCodeIn)) {
318
+ andConditions.push({
319
+ 'result.code': {
320
+ $exists: true,
321
+ $in: resultCodeIn
322
+ }
323
+ });
324
+ }
325
+ // sameAs(2024-04-23~)
326
+ const sameAsIdEq = params.sameAs?.id?.$eq;
327
+ if (typeof sameAsIdEq === 'string') {
328
+ andConditions.push({ 'sameAs.id': { $exists: true, $eq: sameAsIdEq } });
329
+ }
330
+ const aboutOrderNumberEq = params.about?.orderNumber?.$eq;
331
+ if (typeof aboutOrderNumberEq === 'string') {
332
+ andConditions.push({ 'about.orderNumber': { $exists: true, $eq: aboutOrderNumberEq } });
333
+ }
334
+ return andConditions;
335
+ }
@@ -0,0 +1,5 @@
1
+ import type { Model } from 'mongoose';
2
+ import type { IVirtuals } from '../../virtuals';
3
+ type IAbstractActionDocType = any;
4
+ type IAbstractActionModel = Model<IAbstractActionDocType, Record<string, never>, Record<string, never>, IVirtuals>;
5
+ export { IAbstractActionDocType, IAbstractActionModel };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -8,7 +8,9 @@ import type { PaymentServiceProviderRepo } from '../../../repo/paymentServicePro
8
8
  import type { SellerPaymentAcceptedRepo } from '../../../repo/sellerPaymentAccepted';
9
9
  import * as MovieTicketPayment from '../../payment/movieTicket';
10
10
  export interface ICheckRepos {
11
- checkMovieTicketAction: CheckMovieTicketActionRepo;
11
+ actions: {
12
+ checkMovieTicket: CheckMovieTicketActionRepo;
13
+ };
12
14
  credentials: CredentialsRepo;
13
15
  event: EventRepo;
14
16
  paymentAccepted: SellerPaymentAcceptedRepo;
@@ -19,8 +19,8 @@ export interface IProcessAuthorizeOperationRepos {
19
19
  actions: {
20
20
  pay: PayActionRepo;
21
21
  refund: RefundActionRepo;
22
+ checkMovieTicket: CheckMovieTicketActionRepo;
22
23
  };
23
- checkMovieTicketAction: CheckMovieTicketActionRepo;
24
24
  authorizeInvoiceAction: AuthorizeInvoiceActionRepo;
25
25
  credentials: CredentialsRepo;
26
26
  event: EventRepo;
@@ -36,8 +36,8 @@ export declare function processAuthorizeMovieTicket(params: factory.assetTransac
36
36
  actions: {
37
37
  pay: PayActionRepo;
38
38
  refund: RefundActionRepo;
39
+ checkMovieTicket: CheckMovieTicketActionRepo;
39
40
  };
40
- checkMovieTicketAction: CheckMovieTicketActionRepo;
41
41
  credentials: CredentialsRepo;
42
42
  event: EventRepo;
43
43
  paymentAccepted: SellerPaymentAcceptedRepo;
@@ -22,8 +22,8 @@ export interface IStartOperationRepos {
22
22
  actions: {
23
23
  pay: PayActionRepo;
24
24
  refund: RefundActionRepo;
25
+ checkMovieTicket: CheckMovieTicketActionRepo;
25
26
  };
26
- checkMovieTicketAction: CheckMovieTicketActionRepo;
27
27
  authorizeInvoiceAction: AuthorizeInvoiceActionRepo;
28
28
  credentials: CredentialsRepo;
29
29
  event: EventRepo;
@@ -43,12 +43,11 @@ function findAcceptAction(params) {
43
43
  break;
44
44
  default: {
45
45
  // タスクがReadyでなければアクション検索
46
- const acceptAction = (await repos.action.searchBySameAs({
47
- sameAs: { id: { $eq: task.id } },
48
- typeOf: { $eq: factory_1.factory.actionType.AcceptAction }
46
+ const acceptAction = (await repos.action.findActionBySameAs({
47
+ sameAs: { id: task.id }
49
48
  // purpose: { id: { $eq: String(params.purpose.id) } }
50
- })).shift();
51
- if (acceptAction !== undefined) {
49
+ }));
50
+ if (typeof acceptAction?.id === 'string') {
52
51
  // purpose検証
53
52
  if (acceptAction.purpose?.id !== params.purpose.id) {
54
53
  throw new factory_1.factory.errors.NotFound('Action');
@@ -31,8 +31,8 @@ interface IAuthorizeRepos {
31
31
  actions: {
32
32
  pay: PayActionRepo;
33
33
  refund: RefundActionRepo;
34
+ checkMovieTicket: CheckMovieTicketActionRepo;
34
35
  };
35
- checkMovieTicketAction: CheckMovieTicketActionRepo;
36
36
  acceptPayAction: AcceptPayActionRepo;
37
37
  authorizeInvoiceAction: AuthorizeInvoiceActionRepo;
38
38
  authorizePaymentMethodAction: AuthorizePaymentMethodActionRepo;
@@ -43,12 +43,11 @@ function findAcceptAction(params) {
43
43
  break;
44
44
  default: {
45
45
  // タスクがReadyでなければアクション検索
46
- const acceptAction = (await repos.acceptPayAction.searchBySameAs({
47
- sameAs: { id: { $eq: task.id } },
48
- typeOf: { $eq: factory_1.factory.actionType.AcceptAction }
46
+ const acceptAction = (await repos.acceptPayAction.findActionBySameAs({
47
+ sameAs: { id: task.id }
49
48
  // purpose: { id: { $eq: String(params.purpose.id) } }
50
- })).shift();
51
- if (acceptAction !== undefined) {
49
+ }));
50
+ if (typeof acceptAction?.id === 'string') {
52
51
  // purpose検証
53
52
  if (acceptAction.purpose?.id !== params.purpose.id) {
54
53
  throw new factory_1.factory.errors.NotFound('Action');
@@ -43,12 +43,11 @@ function findAuthorizeAction(params) {
43
43
  break;
44
44
  default: {
45
45
  // タスクがReadyでなければアクション検索
46
- const authorizeAction = (await repos.authorizePaymentMethodAction.searchBySameAs({
47
- sameAs: { id: { $eq: task.id } },
48
- typeOf: { $eq: factory_1.factory.actionType.AuthorizeAction }
46
+ const authorizeAction = (await repos.authorizePaymentMethodAction.findActionBySameAs({
47
+ sameAs: { id: task.id }
49
48
  // purpose: { id: { $eq: String(params.purpose.id) } }
50
- })).shift();
51
- if (authorizeAction !== undefined) {
49
+ }));
50
+ if (typeof authorizeAction?.id === 'string') {
52
51
  // purpose検証
53
52
  if (authorizeAction.purpose?.id !== params.purpose.id) {
54
53
  throw new factory_1.factory.errors.NotFound('Action');
@@ -2,7 +2,9 @@ import { factory } from '../../../factory';
2
2
  import type { CheckMovieTicketActionRepo, IMinimizedPurchaseNumberAuthResult } from '../../../repo/action/checkMovieTicket';
3
3
  import type { AsyncActionRepo } from '../../../repo/asyncAction';
4
4
  interface IFindCheckActionRepos {
5
- checkMovieTicketAction: CheckMovieTicketActionRepo;
5
+ actions: {
6
+ checkMovieTicket: CheckMovieTicketActionRepo;
7
+ };
6
8
  asyncAction: AsyncActionRepo;
7
9
  }
8
10
  interface IFindCheckActionResult {
@@ -43,18 +43,17 @@ function findCheckAction(params) {
43
43
  break;
44
44
  default: {
45
45
  // タスクがReadyでなければアクション検索
46
- const authorizeAction = (await repos.checkMovieTicketAction.searchBySameAs({
47
- sameAs: { id: { $eq: task.id } },
48
- typeOf: { $eq: factory_1.factory.actionType.CheckAction }
46
+ const authorizeAction = (await repos.actions.checkMovieTicket.findActionBySameAs({
47
+ sameAs: { id: task.id }
49
48
  // purpose: { id: { $eq: String(params.purpose.id) } }
50
- })).shift();
51
- if (authorizeAction !== undefined) {
49
+ }));
50
+ if (typeof authorizeAction?.id === 'string') {
52
51
  // purpose検証
53
52
  if (authorizeAction.purpose?.id !== params.purpose.id) {
54
53
  throw new factory_1.factory.errors.NotFound('Action');
55
54
  }
56
55
  // result from recipe(2024-06-10~)
57
- const purchaseNumberAuthResult = await repos.checkMovieTicketAction.findIMinimizedPurchaseNumberAuthResultByCheckMovieTicketRecipe({
56
+ const purchaseNumberAuthResult = await repos.actions.checkMovieTicket.findIMinimizedPurchaseNumberAuthResultByCheckMovieTicketRecipe({
58
57
  project: { id: params.project.id },
59
58
  recipeFor: { id: authorizeAction.id }
60
59
  });
@@ -42,8 +42,8 @@ declare function authorize(params: factory.assetTransaction.pay.IStartParamsWith
42
42
  actions: {
43
43
  pay: PayActionRepo;
44
44
  refund: RefundActionRepo;
45
+ checkMovieTicket: CheckMovieTicketActionRepo;
45
46
  };
46
- checkMovieTicketAction: CheckMovieTicketActionRepo;
47
47
  accountingReport: AccountingReportRepo;
48
48
  credentials: CredentialsRepo;
49
49
  event: EventRepo;
@@ -8,7 +8,9 @@ import { factory } from '../../../factory';
8
8
  import type { IntegrationSettingRepo as Settings } from '../../../repo/setting/integration';
9
9
  import { ICheckResult } from './processPurchaseNumberAuth';
10
10
  interface ICheckOperationRepos {
11
- checkMovieTicketAction: CheckMovieTicketActionRepo;
11
+ actions: {
12
+ checkMovieTicket: CheckMovieTicketActionRepo;
13
+ };
12
14
  credentials: CredentialsRepo;
13
15
  event: EventRepo;
14
16
  paymentAccepted: SellerPaymentAcceptedRepo;
@@ -42,7 +42,7 @@ function checkMovieTicket(params) {
42
42
  ? { sameAs: { id: params.sameAs.id, typeOf: 'Task' } } // タスク関連付け(2024-05-21~)
43
43
  : undefined
44
44
  };
45
- const action = await repos.checkMovieTicketAction.start(actionAttributes);
45
+ const action = await repos.actions.checkMovieTicket.start(actionAttributes);
46
46
  let processPurchaseNumberAuthResult;
47
47
  let recipe;
48
48
  try {
@@ -76,7 +76,7 @@ function checkMovieTicket(params) {
76
76
  // アクション保管用のエラーと両方保管(2024-05-22~)
77
77
  const errors = [(0, errorHandler_1.handleMvtkReserveError)(error), error];
78
78
  try {
79
- await repos.checkMovieTicketAction.giveUp({ typeOf: actionAttributes.typeOf, id: action.id, error: errors });
79
+ await repos.actions.checkMovieTicket.giveUp({ typeOf: actionAttributes.typeOf, id: action.id, error: errors });
80
80
  }
81
81
  catch (__) {
82
82
  // 失敗したら仕方ない
@@ -84,7 +84,7 @@ function checkMovieTicket(params) {
84
84
  throw errors[0];
85
85
  }
86
86
  const result = {};
87
- await repos.checkMovieTicketAction.completeWithVoid({ typeOf: actionAttributes.typeOf, id: action.id, result, recipe });
87
+ await repos.actions.checkMovieTicket.completeWithVoid({ typeOf: actionAttributes.typeOf, id: action.id, result, recipe });
88
88
  return { result: processPurchaseNumberAuthResult };
89
89
  };
90
90
  }
@@ -7,7 +7,9 @@ import type { SellerPaymentAcceptedRepo } from '../../../repo/sellerPaymentAccep
7
7
  import type { TaskRepo } from '../../../repo/task';
8
8
  import { factory } from '../../../factory';
9
9
  export interface IValidateMovieTicketRepos {
10
- checkMovieTicketAction: CheckMovieTicketActionRepo;
10
+ actions: {
11
+ checkMovieTicket: CheckMovieTicketActionRepo;
12
+ };
11
13
  credentials: CredentialsRepo;
12
14
  event: EventRepo;
13
15
  paymentAccepted: SellerPaymentAcceptedRepo;
@@ -121,7 +121,7 @@ function checkByIdentifierIfNotYet(params) {
121
121
  }
122
122
  const specifiedCheckedActionId = params.checkedAction?.id;
123
123
  if (typeof specifiedCheckedActionId === 'string' && specifiedCheckedActionId !== '') {
124
- alreadyCheckedAction = (await repos.checkMovieTicketAction.findCompletedCheckActions({
124
+ alreadyCheckedAction = (await repos.actions.checkMovieTicket.findCompletedCheckActions({
125
125
  // limit: 1,
126
126
  // page: 1,
127
127
  // id: { $in: [specifiedCheckedActionId] },
@@ -163,7 +163,7 @@ function checkByIdentifierIfNotYet(params) {
163
163
  }
164
164
  debug('checkByIdentifierIfNotYet: alreadyCheckedAction:', JSON.stringify(alreadyCheckedAction), 'params:', JSON.stringify(params));
165
165
  if (alreadyCheckedAction !== undefined) {
166
- const recipe = await repos.checkMovieTicketAction.findRecipeByAction({
166
+ const recipe = await repos.actions.checkMovieTicket.findRecipeByAction({
167
167
  project: { id: params.screeningEvent.project.id },
168
168
  recipeFor: { id: alreadyCheckedAction.id }
169
169
  });
@@ -103,11 +103,10 @@ function call(params) {
103
103
  catch (error) {
104
104
  let throwsError = true;
105
105
  // アクションが存在すればタスクを実行済扱いにする
106
- const action = (await actionRepo.searchBySameAs({
107
- sameAs: { id: { $eq: params.id } },
108
- purpose: { id: { $eq: params.data.purpose.id } },
109
- typeOf: { $eq: factory_1.factory.actionType.AcceptAction }
110
- })).shift();
106
+ const action = (await actionRepo.findActionBySameAs({
107
+ sameAs: { id: params.id },
108
+ purpose: { id: params.data.purpose.id }
109
+ }));
111
110
  if (typeof action?.id === 'string') {
112
111
  throwsError = false;
113
112
  }
@@ -57,8 +57,8 @@ function call(params) {
57
57
  actions: {
58
58
  pay: new pay_1.PayActionRepo(connection),
59
59
  refund: new refund_1.RefundActionRepo(connection),
60
+ checkMovieTicket: new checkMovieTicket_1.CheckMovieTicketActionRepo(connection),
60
61
  },
61
- checkMovieTicketAction: new checkMovieTicket_1.CheckMovieTicketActionRepo(connection),
62
62
  acceptPayAction: new acceptPay_1.AcceptPayActionRepo(connection),
63
63
  authorizeInvoiceAction: new authorizeInvoice_1.AuthorizeInvoiceActionRepo(connection),
64
64
  authorizePaymentMethodAction: authorizePaymentMethodActionRepo,
@@ -89,11 +89,10 @@ function call(params) {
89
89
  catch (error) {
90
90
  let throwsError = true;
91
91
  // アクションが存在すればタスクを実行済扱いにする
92
- const action = (await authorizePaymentMethodActionRepo.searchBySameAs({
93
- sameAs: { id: { $eq: params.id } },
94
- purpose: { id: { $eq: params.data.purpose.id } },
95
- typeOf: { $eq: factory_1.factory.actionType.AuthorizeAction }
96
- })).shift();
92
+ const action = (await authorizePaymentMethodActionRepo.findActionBySameAs({
93
+ sameAs: { id: params.id },
94
+ purpose: { id: params.data.purpose.id }
95
+ }));
97
96
  if (typeof action?.id === 'string') {
98
97
  throwsError = false;
99
98
  }
@@ -29,7 +29,9 @@ function call(params) {
29
29
  ...params.data,
30
30
  sameAs: { id: params.id, typeOf: 'Task' }
31
31
  })({
32
- checkMovieTicketAction: actionRepo,
32
+ actions: {
33
+ checkMovieTicket: actionRepo,
34
+ },
33
35
  credentials: new credentials_1.CredentialsRepo(redisClient, {
34
36
  scope: `${factory_1.factory.service.paymentService.PaymentServiceType.MovieTicket}:${paymentServiceId}`,
35
37
  expireInSeconds: (useCredentialsRepo) ? credentialsExpireInSeconds : 0
@@ -43,13 +45,12 @@ function call(params) {
43
45
  catch (error) {
44
46
  let throwsError = true;
45
47
  // アクションが存在すればタスクを実行済扱いにする
46
- const action = (await actionRepo.searchBySameAs({
47
- sameAs: { id: { $eq: params.id } },
48
- typeOf: { $eq: factory_1.factory.actionType.CheckAction },
48
+ const action = (await actionRepo.findActionBySameAs({
49
+ sameAs: { id: params.id },
49
50
  ...(typeof params.data.purpose?.id === 'string')
50
- ? { purpose: { id: { $eq: params.data.purpose.id } } }
51
+ ? { purpose: { id: params.data.purpose.id } }
51
52
  : undefined
52
- })).shift();
53
+ }));
53
54
  if (typeof action?.id === 'string') {
54
55
  throwsError = false;
55
56
  }
@@ -32,8 +32,9 @@ function call(params) {
32
32
  ...params.data,
33
33
  sameAs: { id: params.id, typeOf: 'Task' } // タスクIDを関連付け(2024-04-20~)
34
34
  })({
35
- // action: new ActionRepo(connection),
36
- checkMovieTicketAction: new checkMovieTicket_1.CheckMovieTicketActionRepo(connection),
35
+ actions: {
36
+ checkMovieTicket: new checkMovieTicket_1.CheckMovieTicketActionRepo(connection),
37
+ },
37
38
  acceptedOffer: new acceptedOffer_1.AcceptedOfferRepo(connection),
38
39
  assetTransaction: new assetTransaction_1.AssetTransactionRepo(connection),
39
40
  order: new order_1.OrderRepo(connection)