@chevre/domain 25.2.0-alpha.0 → 25.2.0-alpha.1

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.
@@ -272,23 +272,13 @@ class ActionProcessRepo {
272
272
  }
273
273
  });
274
274
  }
275
- const objectEventIdIn = params.object?.event?.id?.$in;
276
- if (Array.isArray(objectEventIdIn)) {
277
- andConditions.push({
278
- 'object.event.id': {
279
- $exists: true,
280
- $in: objectEventIdIn
281
- }
282
- });
283
- }
284
- // discontinue(2024-06-18~)
285
- // const objectAcceptedOfferSeatNumberIn =
286
- // params.object?.acceptedOffer?.itemOffered?.serviceOutput?.reservedTicket?.ticketedSeat?.seatNumber?.$in;
287
- // if (Array.isArray(objectAcceptedOfferSeatNumberIn)) {
275
+ // 承認アクションのobject.event廃止につき検索条件も廃止(2026-07-04~)
276
+ // const objectEventIdIn = params.object?.event?.id?.$in;
277
+ // if (Array.isArray(objectEventIdIn)) {
288
278
  // andConditions.push({
289
- // 'object.acceptedOffer.itemOffered.serviceOutput.reservedTicket.ticketedSeat.seatNumber': {
279
+ // 'object.event.id': {
290
280
  // $exists: true,
291
- // $in: objectAcceptedOfferSeatNumberIn
281
+ // $in: objectEventIdIn
292
282
  // }
293
283
  // });
294
284
  // }
@@ -21,6 +21,8 @@ declare function createAuthorizeSeatReservationActionAttributes(params: {
21
21
  transactionNumber: string;
22
22
  };
23
23
  transaction: Pick<factory.transaction.ITransaction<factory.transactionType.PlaceOrder>, 'agent' | 'id' | 'project' | 'seller' | 'typeOf'>;
24
+ }, options: {
25
+ useLegacyAuthorizeOfferObject: boolean;
24
26
  }): factory.action.authorize.offer.eventService.IAttributes;
25
27
  declare function acceptedOffers2amount(params: {
26
28
  acceptedOffers: Pick<IResultAcceptedOffer, 'priceSpecification' | 'id'>[];
@@ -80,29 +80,19 @@ function createReserveTransactionStartParams(params) {
80
80
  .toDate() // 余裕を持って
81
81
  };
82
82
  }
83
- function createAuthorizeSeatReservationActionAttributes(params) {
83
+ function createAuthorizeSeatReservationActionAttributes(params, options) {
84
+ const { useLegacyAuthorizeOfferObject } = options;
84
85
  const { event, transaction } = params;
85
86
  const authorizeObjectEvent = {
86
87
  id: event.id,
87
- // offers: { // discontinue(2024-06-22~)
88
- // offeredThrough: {
89
- // identifier: factory.service.webAPI.Identifier.Chevre,
90
- // typeOf: 'WebAPI'
91
- // }
92
- // },
93
- // typeOf: event.typeOf
94
88
  typeOf: factory_1.factory.eventType.ScreeningEvent // fix(2024-07-17~)
95
89
  };
96
90
  const object = {
97
91
  typeOf: factory_1.factory.action.authorize.offer.eventService.ObjectType.SeatReservation,
98
- event: authorizeObjectEvent
99
- // pendingTransaction: params.pendingTransaction, // discontinue(2024-06-22~)
100
- // ...(params.broker !== undefined) ? { broker: params.broker } : undefined // discontinue(2024-06-24~)
92
+ ...((useLegacyAuthorizeOfferObject) && { event: authorizeObjectEvent })
101
93
  };
102
94
  const instrument = {
103
- // typeOf: 'WebAPI',
104
95
  typeOf: factory_1.factory.assetTransactionType.Reserve, // 変更(2024-03-08~)
105
- // identifier: factory.service.webAPI.Identifier.Chevre, // discontinue(2025-01-02~)
106
96
  transactionNumber: params.instrument.transactionNumber
107
97
  };
108
98
  const agent = {
@@ -63,6 +63,10 @@ interface IAuthorizeOptions {
63
63
  * 最大n日前から予約可能
64
64
  */
65
65
  maxReservationGracePeriodInDays: number;
66
+ /**
67
+ * 2026-07-04~
68
+ */
69
+ useLegacyAuthorizeOfferObject: boolean;
66
70
  }
67
71
  /**
68
72
  * 興行オファー承認
@@ -34,7 +34,7 @@ function authorize(params, options) {
34
34
  const actionAttributes = (0, factory_2.createAuthorizeSeatReservationActionAttributes)({
35
35
  event, transaction,
36
36
  instrument: { transactionNumber }
37
- });
37
+ }, options);
38
38
  const action = await repos.authorizeOfferAction.start(actionAttributes);
39
39
  try {
40
40
  const processStartReserveResult = await (0, processStartReserve4chevre_1.processStartReserve4chevre)({
@@ -139,10 +139,6 @@ function validateCreateRequest(params) {
139
139
  const event = {
140
140
  id: params.object.reservationFor.id,
141
141
  typeOf: factory_1.factory.eventType.ScreeningEvent // ひとまずfix(2024-07-17~)
142
- // offers: {
143
- // ...(typeof validForMemberTier?.token === 'string') ? { validForMemberTier } : undefined,
144
- // ...(typeof eventOfferIdentifier === 'string') ? { identifier: eventOfferIdentifier } : undefined
145
- // }
146
142
  };
147
143
  return { transaction, event };
148
144
  };
@@ -14,7 +14,7 @@ function processVoidTransaction4coa(params, options) {
14
14
  throw new factory_1.factory.errors.NotFound('action.object.id');
15
15
  }
16
16
  const acceptAction = await repos.acceptCOAOfferAction.findById({ id: acceptActionId, typeOf: factory_1.factory.actionType.AcceptAction });
17
- console.log('processVoidTransaction4coa processing...', params.action.id, params.action.purpose.id, acceptAction);
17
+ // console.log('processVoidTransaction4coa processing...', params.action.id, params.action.purpose.id, acceptAction);
18
18
  await (0, cancel_1.cancelByAcceptAction)({ action: acceptAction }, options)(repos);
19
19
  };
20
20
  }
@@ -14,6 +14,8 @@ export declare function createAuthorizeSeatReservationActionAttributes(params: {
14
14
  };
15
15
  transaction: Pick<factory.transaction.ITransaction<factory.transactionType.PlaceOrder>, 'agent' | 'id' | 'project' | 'seller' | 'typeOf'>;
16
16
  pendingTransaction: factory.action.authorize.offer.eventService.ICOAPendingTransaction;
17
+ }, options: {
18
+ useLegacyAuthorizeOfferObject: boolean;
17
19
  }): factory.action.authorize.offer.eventService.IAttributes;
18
20
  /**
19
21
  * 供給情報から承認アクションの価格を導き出す
@@ -9,30 +9,23 @@ exports.responseBody2acceptedOffers4result = responseBody2acceptedOffers4result;
9
9
  const moment_1 = __importDefault(require("moment"));
10
10
  const util_1 = require("util");
11
11
  const factory_1 = require("../../../../factory");
12
- function createAuthorizeSeatReservationActionAttributes(params) {
12
+ function createAuthorizeSeatReservationActionAttributes(params, options) {
13
+ const { useLegacyAuthorizeOfferObject } = options;
13
14
  const transaction = params.transaction;
14
- // 最適化(2022-06-07~)
15
15
  const authorizeObjectEvent = {
16
16
  id: params.event.id,
17
- // イベント提供サービスを識別できるようにするために追加(2022-06-04~)
18
- // offers: { // discontinue(2024-06-22~)
19
- // offeredThrough: {
20
- // identifier: factory.service.webAPI.Identifier.COA,
21
- // typeOf: 'WebAPI'
22
- // }
23
- // },
24
17
  typeOf: params.event.typeOf
25
18
  };
26
19
  const authorizeObject = {
27
20
  typeOf: factory_1.factory.action.authorize.offer.eventService.ObjectType.SeatReservation,
28
21
  id: params.acceptAction.id,
29
- event: authorizeObjectEvent,
30
- pendingTransaction: params.pendingTransaction
22
+ ...((useLegacyAuthorizeOfferObject) && {
23
+ event: authorizeObjectEvent,
24
+ pendingTransaction: params.pendingTransaction
25
+ })
31
26
  };
32
27
  const instrument = {
33
- // typeOf: 'WebAPI',
34
28
  typeOf: factory_1.factory.assetTransactionType.COAReserveTransaction, // 変更(2024-03-08~)
35
- // identifier: factory.service.webAPI.Identifier.COA,// discontinue(2025-01-02~)
36
29
  transactionNumber: params.pendingTransaction.transactionNumber
37
30
  };
38
31
  return {
@@ -53,7 +53,11 @@ export declare function authorize(params: {
53
53
  requestBody: IRequestBody;
54
54
  responseBody: IResponseBody;
55
55
  };
56
- options: Record<string, never>;
56
+ }, options: {
57
+ /**
58
+ * 2026-07-04~
59
+ */
60
+ useLegacyAuthorizeOfferObject: boolean;
57
61
  }): IAuthorizeOperation<Pick<IAuthorizeOfferAction, 'id' | 'instrument'> & {
58
62
  result: IAuthorizeOfferAction['result'];
59
63
  }>;
@@ -12,7 +12,7 @@ const factory_2 = require("../../../factory");
12
12
  /**
13
13
  * COA興行オファー承認
14
14
  */
15
- function authorize(params) {
15
+ function authorize(params, options) {
16
16
  return async (repos) => {
17
17
  const transaction = await repos.placeOrder.findPlaceOrderInProgressById({
18
18
  typeOf: factory_2.factory.transactionType.PlaceOrder,
@@ -71,11 +71,10 @@ function authorize(params) {
71
71
  // アクション開始前に例外がthrowされてもCOA仮予約を取り消す機会をつくるためにFailedアクションを作成する(2023-09-12~)
72
72
  const failedActionAttributes = (0, factory_1.createAuthorizeSeatReservationActionAttributes)({
73
73
  acceptAction: params.object.acceptAction,
74
- // acceptedOffers: [],
75
74
  event: { id: params.object.event.id, typeOf: factory_2.factory.eventType.ScreeningEvent },
76
75
  transaction,
77
76
  pendingTransaction
78
- });
77
+ }, options);
79
78
  const failedAction = await repos.action.start(failedActionAttributes);
80
79
  await repos.action.giveUp({ typeOf: failedAction.typeOf, id: failedAction.id, error });
81
80
  throw error;
@@ -89,11 +88,10 @@ function authorize(params) {
89
88
  // 承認アクションを開始
90
89
  const actionAttributes = (0, factory_1.createAuthorizeSeatReservationActionAttributes)({
91
90
  acceptAction: params.object.acceptAction,
92
- // acceptedOffers,
93
91
  event: { id: screeningEvent.id, typeOf: screeningEvent.typeOf },
94
92
  transaction,
95
93
  pendingTransaction
96
- });
94
+ }, options);
97
95
  const action = await repos.action.start(actionAttributes);
98
96
  try {
99
97
  // 座席仮予約からオファー情報を生成する
@@ -114,14 +112,11 @@ function authorize(params) {
114
112
  priceCurrency: factory_2.factory.priceCurrency.JPY,
115
113
  amount: []
116
114
  };
117
- // add orderInTransaction(2024-01-15~)
118
- // if (params.options.useCreateOrderOnOfferAccepted) {
119
115
  await (0, any_1.acceptOffer)({
120
116
  project: transaction.project,
121
117
  placeOrderId: params.transaction.id,
122
118
  acceptedOffers: acceptedOffers4result
123
119
  })(repos);
124
- // }
125
120
  }
126
121
  catch (error) {
127
122
  try {
@@ -26,6 +26,11 @@ export declare function authorizeByAcceptAction(params: {
26
26
  */
27
27
  id: string;
28
28
  };
29
+ }, options: {
30
+ /**
31
+ * 2026-07-04~
32
+ */
33
+ useLegacyAuthorizeOfferObject: boolean;
29
34
  }): IAuthorizeOperation<Pick<IAuthorizeOfferAction, 'id' | 'instrument'> & {
30
35
  result: IAuthorizeOfferAction['result'];
31
36
  }>;
@@ -7,23 +7,8 @@ const factory_1 = require("../../../factory");
7
7
  /**
8
8
  * 採用アクションからCOA興行オファー承認
9
9
  */
10
- function authorizeByAcceptAction(params) {
10
+ function authorizeByAcceptAction(params, options) {
11
11
  return async (repos) => {
12
- // const acceptAction = (<IAcceptAction[]>await repos.action.search(
13
- // {
14
- // limit: 1,
15
- // page: 1,
16
- // project: { id: { $eq: params.project.id } },
17
- // id: { $in: [params.object.id] },
18
- // typeOf: { $eq: factory.actionType.AcceptAction },
19
- // purpose: { id: { $in: [params.purpose.id] } },
20
- // actionStatus: { $in: [factory.actionStatusType.CompletedActionStatus] }
21
- // },
22
- // ['result', 'object', 'potentialActions']
23
- // )).shift();
24
- // if (acceptAction === undefined) {
25
- // throw new factory.errors.NotFound(factory.actionType.AcceptAction);
26
- // }
27
12
  const acceptAction = await repos.accpetCOAOfferAction.findCompletedById({
28
13
  project: { id: params.project.id },
29
14
  id: params.object.id,
@@ -44,9 +29,6 @@ function authorizeByAcceptAction(params) {
44
29
  agent: { id: params.agent.id },
45
30
  transaction: { id: params.purpose.id },
46
31
  id: acceptAction.potentialActions.id,
47
- options: {
48
- // useCreateOrderOnOfferAccepted: USE_CREATE_ORDER_ON_OFFER_ACCEPTED // discontinue(2024-05-28~)
49
- }
50
32
  };
51
33
  action = await (0, changeOffers_1.changeOffers)(changeOfferParams)(repos);
52
34
  }
@@ -64,14 +46,6 @@ function authorizeByAcceptAction(params) {
64
46
  if (responseBody === undefined) {
65
47
  throw new factory_1.factory.errors.NotFound('afterMedia by recipe');
66
48
  }
67
- // const requestBody = acceptAction.instrument.requestBody;
68
- // if (requestBody === undefined) {
69
- // throw new chevre.factory.errors.NotFound(`${chevre.factory.actionType.AcceptAction}.result.requestBody`);
70
- // }
71
- // const responseBody = acceptResult.result?.responseBody;
72
- // if (responseBody === undefined) {
73
- // throw new chevre.factory.errors.NotFound(`${chevre.factory.actionType.AcceptAction}.result.responseBody`);
74
- // }
75
49
  const authorizeParams = {
76
50
  object: {
77
51
  acceptAction: { id: params.object.id },
@@ -81,12 +55,9 @@ function authorizeByAcceptAction(params) {
81
55
  agent: { id: params.agent.id },
82
56
  transaction: { id: params.purpose.id },
83
57
  store: { id: params.store.id },
84
- result: { requestBody, responseBody },
85
- options: {
86
- // useCreateOrderOnOfferAccepted: USE_CREATE_ORDER_ON_OFFER_ACCEPTED // discontinue(2024-05-28~)
87
- }
58
+ result: { requestBody, responseBody }
88
59
  };
89
- action = await (0, authorize_1.authorize)(authorizeParams)(repos);
60
+ action = await (0, authorize_1.authorize)(authorizeParams, options)(repos);
90
61
  }
91
62
  return action;
92
63
  };
@@ -17,7 +17,6 @@ export declare function changeOffers(params: {
17
17
  transaction: {
18
18
  id: string;
19
19
  };
20
- options: Record<string, never>;
21
20
  }): IAuthorizeOperation<Pick<IAuthorizeOfferAction, 'id' | 'instrument'> & {
22
21
  result: IAuthorizeOfferAction['result'];
23
22
  }>;
@@ -9,7 +9,6 @@ const any_1 = require("../any");
9
9
  const factory_1 = require("./authorize/factory");
10
10
  const validateAcceptedOffers_1 = require("./authorize/validateAcceptedOffers");
11
11
  const factory_2 = require("../../../factory");
12
- // type IAcceptAction = Pick<factory.action.accept.coaOffer.IAction, 'result'>;
13
12
  /**
14
13
  * COA興行オファー承認のオファーを変更
15
14
  */
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "dependencies": {
12
12
  "@aws-sdk/client-cognito-identity-provider": "3.600.0",
13
13
  "@aws-sdk/credential-providers": "3.600.0",
14
- "@chevre/factory": "9.5.0-alpha.0",
14
+ "@chevre/factory": "9.5.0-alpha.1",
15
15
  "@motionpicture/coa-service": "10.0.0",
16
16
  "@motionpicture/gmo-service": "6.1.0-alpha.0",
17
17
  "@sendgrid/client": "8.1.4",
@@ -91,5 +91,5 @@
91
91
  "postversion": "git push origin --tags",
92
92
  "prepublishOnly": "npm run clean && npm run build"
93
93
  },
94
- "version": "25.2.0-alpha.0"
94
+ "version": "25.2.0-alpha.1"
95
95
  }