@chevre/domain 28.2.0-alpha.0 → 28.2.0-alpha.2

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.
@@ -1,8 +1,7 @@
1
1
  import { factory } from '../../../../factory';
2
- declare function createPotentialActions(params: {
2
+ declare function createUnderName(params: {
3
3
  order?: Pick<factory.order.IOrder, 'orderNumber' | 'customer' | 'typeOf'>;
4
4
  }): {
5
- potentialActions: factory.assetTransaction.reserve.IPotentialActions;
6
5
  underName?: factory.assetTransaction.reserve.IUnderName;
7
6
  };
8
- export { createPotentialActions };
7
+ export { createUnderName };
@@ -1,67 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createPotentialActions = createPotentialActions;
4
- function createPotentialActions(params) {
5
- // const transaction = params.transaction;
6
- // const reservationFor = transaction.object.reservationFor;
7
- // if (reservationFor === undefined) {
8
- // throw new factory.errors.NotFound('transaction.object.reservationFor');
9
- // }
10
- // discontinue(2024-07-01~)
11
- // const useOptimizeReservation: boolean = !USE_OPTIMIZE_RESERVATION_EXCEPTIONS.includes(transaction.project.id);
12
- // 予約アクション属性作成
13
- // const pendingReservations = (Array.isArray(transaction.object.subReservation)) ? transaction.object.subReservation : [];
14
- // let reserveActionAttributes: factory.action.reserve.IAttributes[] = [];
15
- // let reservationPackage: factory.action.reserve.IObject | undefined;
3
+ exports.createUnderName = createUnderName;
4
+ function createUnderName(params) {
16
5
  let underName;
17
6
  // purpose:Orderの指定があれば、underName,issuedByを調整(2022-05-23~)
18
7
  if (typeof params.order?.typeOf === 'string') {
19
8
  const ordre2reservationUnderNameResult = ordre2reservationUnderName({ order: params.order });
20
9
  underName = ordre2reservationUnderNameResult.underName;
21
10
  }
22
- // if (pendingReservations.length > 0) {
23
- // const moneyTransferActions: factory.action.transfer.moneyTransfer.IAttributes[] = [];
24
- // pendingReservations.forEach((reservation) => {
25
- // const acceptedOffer4reservation = transaction.object.acceptedOffer?.find(
26
- // (o) => o.itemOffered?.serviceOutput?.id === reservation.id
27
- // );
28
- // moneyTransferActions.push(...createMoneyTransferActions({
29
- // acceptedOffer: acceptedOffer4reservation,
30
- // reservation,
31
- // transaction: params.transaction,
32
- // underName
33
- // }));
34
- // });
35
- // reservationPackage = {
36
- // reservationFor: {
37
- // id: String(reservationFor.id),
38
- // typeOf: reservationFor.typeOf,
39
- // optimized: true
40
- // }, // optimize(2024-01-24~)
41
- // reservationNumber: transaction.object.reservationNumber,
42
- // reservationStatus: (typeof params.transaction.object.reservationStatus === 'string')
43
- // ? params.transaction.object.reservationStatus
44
- // : factory.reservationStatusType.ReservationPending,
45
- // typeOf: factory.reservationType.ReservationPackage
46
- // };
47
- // reserveActionAttributes = [{
48
- // project: transaction.project,
49
- // typeOf: <factory.actionType.ReserveAction>factory.actionType.ReserveAction,
50
- // object: reservationPackage,
51
- // agent: transaction.project,
52
- // potentialActions: {
53
- // moneyTransfer: moneyTransferActions
54
- // },
55
- // purpose: { typeOf: transaction.typeOf, id: transaction.id }
56
- // }];
57
- // }
58
- return {
59
- potentialActions: {
60
- // reserve: reserveActionAttributes // discontinue(2024-07-01~)
61
- },
62
- // reservationPackage,
63
- underName
64
- };
11
+ return { underName };
65
12
  }
66
13
  /**
67
14
  * 予約のunderName.identifierを決定する
@@ -69,9 +16,6 @@ function createPotentialActions(params) {
69
16
  function createReservationUnderNameIdentifier(params) {
70
17
  // 必要最低限の識別子のみ継承する(2024-03-16~)
71
18
  let identifiersFromCustomer = (Array.isArray(params.order.customer.identifier)) ? params.order.customer.identifier : [];
72
- // if (params.useOptimizeReservation) {
73
- // identifiersFromCustomer = identifiersFromCustomer.filter(({ name }) => name === 'clientId');
74
- // }
75
19
  identifiersFromCustomer = identifiersFromCustomer.filter(({ name }) => name === 'clientId');
76
20
  return [
77
21
  { name: 'orderNumber', value: params.order.orderNumber },
@@ -83,15 +27,16 @@ function createReservationUnderName(params) {
83
27
  identifier: createReservationUnderNameIdentifier({ order: params.order }),
84
28
  name: String(params.order.customer.name),
85
29
  typeOf: params.order.customer.typeOf,
86
- ...(typeof params.order.customer.address === 'string') ? { address: params.order.customer.address } : undefined,
87
- ...(typeof params.order.customer.age === 'string') ? { age: params.order.customer.age } : undefined,
88
30
  ...(typeof params.order.customer.email === 'string') ? { email: params.order.customer.email } : undefined,
89
31
  ...(typeof params.order.customer.familyName === 'string') ? { familyName: params.order.customer.familyName } : undefined,
90
- ...(typeof params.order.customer.gender === 'string') ? { gender: params.order.customer.gender } : undefined,
91
32
  ...(typeof params.order.customer.givenName === 'string') ? { givenName: params.order.customer.givenName } : undefined,
92
33
  ...(typeof params.order.customer.id === 'string') ? { id: params.order.customer.id } : undefined,
93
34
  ...(typeof params.order.customer.telephone === 'string') ? { telephone: params.order.customer.telephone } : undefined,
94
- ...(typeof params.order.customer.url === 'string') ? { url: params.order.customer.url } : undefined
35
+ // 以下廃止(2026-11-11~)
36
+ // ...(typeof params.order.customer.address === 'string') ? { address: params.order.customer.address } : undefined,
37
+ // ...(typeof params.order.customer.age === 'string') ? { age: params.order.customer.age } : undefined,
38
+ // ...(typeof params.order.customer.gender === 'string') ? { gender: params.order.customer.gender } : undefined,
39
+ // ...(typeof params.order.customer.url === 'string') ? { url: params.order.customer.url } : undefined,
95
40
  };
96
41
  }
97
42
  /**
@@ -29,11 +29,7 @@ function confirm(params) {
29
29
  throw new factory_1.factory.errors.ArgumentNull('Transaction ID or Transaction Number');
30
30
  }
31
31
  const order = await fixOrderAsPurpose(params, transaction)(repos);
32
- const { potentialActions, underName } = (0, factory_2.createPotentialActions)({
33
- // ...params,
34
- // transaction,
35
- order
36
- });
32
+ const { underName } = (0, factory_2.createUnderName)({ order });
37
33
  // 取引確定
38
34
  const result = {};
39
35
  await repos.assetTransaction.confirm({
@@ -43,7 +39,7 @@ function confirm(params) {
43
39
  // potentialActions: (USE_ASSET_TRANSACTION_SYNC_PROCESSING)
44
40
  // ? { reserve: [] }
45
41
  // : potentialActions, // discontinue(2024-07-01~)
46
- potentialActions,
42
+ potentialActions: {},
47
43
  ...(typeof underName?.typeOf === 'string')
48
44
  ? { object: { underName } }
49
45
  : undefined
@@ -305,11 +305,12 @@ function acceptedOfferWithoutDetail2acceptedOffer(params) {
305
305
  ...(itemOfferedServiceOutput !== undefined) ? { serviceOutput: itemOfferedServiceOutput } : undefined,
306
306
  },
307
307
  addOn: acceptedAddOns,
308
- // 追加属性をマージ
309
- additionalProperty: [
310
- ...(Array.isArray(offerWithoutDetail.additionalProperty)) ? offerWithoutDetail.additionalProperty : [],
311
- ...(Array.isArray(offer.additionalProperty)) ? offer.additionalProperty : []
312
- ]
308
+ // discontinue additionalProperty(2026-11-11~)
309
+ // // 追加属性をマージ
310
+ // additionalProperty: [
311
+ // ...(Array.isArray(offerWithoutDetail.additionalProperty)) ? offerWithoutDetail.additionalProperty : [],
312
+ // ...(Array.isArray(offer.additionalProperty)) ? offer.additionalProperty : []
313
+ // ]
313
314
  };
314
315
  };
315
316
  }
@@ -1,11 +1,12 @@
1
1
  import { factory } from '../../factory';
2
2
  import type { AcceptedOfferRepo } from '../../repo/acceptedOffer';
3
3
  import type { AuthorizationRepo } from '../../repo/authorization';
4
+ import type { OfferRepo } from '../../repo/offer/unitPriceInCatalog';
4
5
  import type { OrderRepo } from '../../repo/order';
5
6
  import type { ReservationRepo } from '../../repo/reservation';
6
7
  type IReservationResult = Pick<factory.reservation.eventReservation.IReservation, 'id' | 'additionalTicketText' | 'checkedIn' | 'reservationStatus'> & {
7
8
  reservedTicket: {
8
- ticketType: Pick<factory.assetTransaction.reserve.ITicketType, 'identifier'> & {
9
+ ticketType?: Pick<factory.assetTransaction.reserve.ITicketType, 'identifier'> & {
9
10
  name: {
10
11
  ja?: string;
11
12
  };
@@ -30,6 +31,7 @@ declare function findByCode(params: {
30
31
  }): (repos: {
31
32
  acceptedOffer: AcceptedOfferRepo;
32
33
  authorization: AuthorizationRepo;
34
+ offer: OfferRepo;
33
35
  order: OrderRepo;
34
36
  reservation: ReservationRepo;
35
37
  }) => Promise<{
@@ -46,10 +46,22 @@ function findByCode(params) {
46
46
  if (acceptedOffer.itemOffered.typeOf !== factory_1.factory.reservationType.EventReservation) {
47
47
  throw new factory_1.factory.errors.Argument('id', `itemOffered.typeOf must be ${factory_1.factory.reservationType.EventReservation}`);
48
48
  }
49
- ticketType = {
50
- identifier: acceptedOffer.itemOffered.reservedTicket.ticketType.identifier,
51
- name: { ja: acceptedOffer.itemOffered.reservedTicket.ticketType.name?.ja }
52
- };
49
+ // acceptedOffer.itemOffered.reservedTicket.ticketType廃止につき、単価オファー情報を参照(2026-11-11~)
50
+ const unitPriceOffer = (await repos.offer.findUnitPriceOffers({
51
+ id: { $eq: String(acceptedOffer.id) },
52
+ project: { id: { $eq: params.project.id } }
53
+ }, { identifier: 1, name: 1 })).shift();
54
+ // console.log('findByCode: unitPriceOffer found.', unitPriceOffer);
55
+ if (unitPriceOffer !== undefined) {
56
+ ticketType = {
57
+ identifier: unitPriceOffer.identifier,
58
+ name: { ja: unitPriceOffer.name?.ja }
59
+ };
60
+ }
61
+ // ticketType = {
62
+ // identifier: acceptedOffer.itemOffered.reservedTicket.ticketType.identifier,
63
+ // name: { ja: acceptedOffer.itemOffered.reservedTicket.ticketType.name?.ja }
64
+ // };
53
65
  }
54
66
  else {
55
67
  throw new factory_1.factory.errors.NotFound('orderNumber');
@@ -61,21 +73,13 @@ function findByCode(params) {
61
73
  }
62
74
  const reservationFromRepo = await repos.reservation.findReservationById({
63
75
  id: reservationId,
64
- inclusion: [
65
- 'additionalTicketText', 'checkedIn', 'reservationStatus',
66
- // 'reservedTicket'
67
- ]
76
+ inclusion: ['additionalTicketText', 'checkedIn', 'reservationStatus']
68
77
  });
69
78
  const { id, additionalTicketText, checkedIn, reservationStatus } = reservationFromRepo;
70
79
  const reservation = {
71
80
  id, reservationStatus,
72
81
  reservedTicket: {
73
- // ticketTypeは注文を参照する(2026-03-25~)
74
- // ticketType: {
75
- // identifier: reservedTicket.ticketType.identifier,
76
- // name: { ja: reservedTicket.ticketType.name?.ja }
77
- // },
78
- ticketType
82
+ ...((ticketType !== undefined) && { ticketType })
79
83
  },
80
84
  ...(typeof additionalTicketText === 'string') ? { additionalTicketText } : undefined,
81
85
  ...(typeof checkedIn === 'boolean') ? { checkedIn } : undefined
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "dependencies": {
12
12
  "@aws-sdk/client-cognito-identity-provider": "3.1090.0",
13
13
  "@aws-sdk/credential-providers": "3.1090.0",
14
- "@chevre/factory": "11.2.0-alpha.2",
14
+ "@chevre/factory": "11.2.0-alpha.3",
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",
@@ -46,7 +46,7 @@
46
46
  "csvtojson": "^2.0.10",
47
47
  "dependency-cruiser": "17.3.8",
48
48
  "eslint": "9.39.2",
49
- "mongoose": "8.23.0",
49
+ "mongoose": "8.24.8",
50
50
  "rimraf": "6.1.3",
51
51
  "size-limit": "12.0.0",
52
52
  "typescript": "5.9.3",
@@ -55,7 +55,7 @@
55
55
  },
56
56
  "peerDependencies": {
57
57
  "@redis/client": "^6.2.1",
58
- "mongoose": "^8.23.0"
58
+ "mongoose": "^8.24.8"
59
59
  },
60
60
  "engines": {
61
61
  "node": ">=22.0.0",
@@ -89,5 +89,5 @@
89
89
  "postversion": "git push origin --tags",
90
90
  "prepublishOnly": "npm run clean && npm run build"
91
91
  },
92
- "version": "28.2.0-alpha.0"
92
+ "version": "28.2.0-alpha.2"
93
93
  }