@chevre/domain 24.0.0-alpha.52 → 24.0.0-alpha.53

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.
@@ -7,6 +7,9 @@ export interface IUpdatePartiallyParams {
7
7
  }
8
8
  export type ICancelResult = UpdateWriteOpResult;
9
9
  export type ICheckedInResult = UpdateWriteOpResult;
10
+ /**
11
+ * ドキュメントとして保管する予約
12
+ */
10
13
  export type ICreatingReservation = Omit<factory.reservation.eventReservation.IReservation, 'id' | 'price' | 'reservedTicket'> & {
11
14
  _id: string;
12
15
  /**
@@ -28,6 +28,7 @@ const reservation_1 = require("./mongoose/schemas/reservation");
28
28
  const factory = __importStar(require("../factory"));
29
29
  const createMongoConditions_1 = require("./factory/reservation/createMongoConditions");
30
30
  const settings_1 = require("../settings");
31
+ const USE_DISCONTINUED_RESERVATION_PRICE = process.env.USE_DISCONTINUED_RESERVATION_PRICE === '1';
31
32
  /**
32
33
  * 予約リポジトリ
33
34
  */
@@ -136,30 +137,27 @@ class ReservationRepo {
136
137
  const bulkWriteOps = [];
137
138
  if (Array.isArray(params.subReservation)) {
138
139
  params.subReservation.forEach((subReservation) => {
139
- let setOnInsert;
140
- switch (subReservation.typeOf) {
141
- case factory.reservationType.EventReservation:
142
- setOnInsert = {
143
- ...subReservation,
144
- _id: subReservation.id,
145
- bookingTime: params.bookingTime,
146
- checkedIn: false,
147
- attended: false,
148
- issuedThrough: params.issuedThrough,
149
- project: { id: params.project.id, typeOf: factory.organizationType.Project },
150
- reservationFor: params.reservationFor,
151
- reservationNumber: params.reservationNumber,
152
- reservationStatus: factory.reservationStatusType.ReservationConfirmed,
153
- modifiedTime,
154
- // providerを追加(2023-07-19~)
155
- provider: params.provider,
156
- ...(params.underName !== undefined) ? { underName: params.underName } : undefined,
157
- ...(typeof params.broker?.typeOf === 'string') ? { broker: params.broker } : undefined
158
- };
159
- break;
160
- default:
161
- throw new factory.errors.NotImplemented(`${subReservation.typeOf} not implemented`);
162
- }
140
+ const { price, reservedTicket, ...subReservationWithoutPrice } = subReservation;
141
+ // const { ticketType, ...reservedTicketWithoutTicketType } = reservedTicket;
142
+ const setOnInsert = {
143
+ ...subReservationWithoutPrice,
144
+ typeOf: factory.reservationType.EventReservation,
145
+ _id: subReservation.id,
146
+ bookingTime: params.bookingTime,
147
+ checkedIn: false,
148
+ attended: false,
149
+ issuedThrough: params.issuedThrough,
150
+ project: { id: params.project.id, typeOf: factory.organizationType.Project },
151
+ reservationFor: params.reservationFor,
152
+ reservationNumber: params.reservationNumber,
153
+ reservationStatus: factory.reservationStatusType.ReservationConfirmed,
154
+ modifiedTime,
155
+ provider: params.provider,
156
+ reservedTicket,
157
+ ...(params.underName !== undefined) ? { underName: params.underName } : undefined,
158
+ ...(typeof params.broker?.typeOf === 'string') ? { broker: params.broker } : undefined,
159
+ ...((USE_DISCONTINUED_RESERVATION_PRICE) && { price }) // discontinue price(2026-03-31~)
160
+ };
163
161
  bulkWriteOps.push({
164
162
  updateOne: {
165
163
  filter: { _id: { $eq: subReservation.id } },
@@ -95,7 +95,7 @@ function validateAcceptedPaymentMethodIfNeeded(params
95
95
  // 対面決済ではひとまず対応決済方法検証なし
96
96
  }
97
97
  debug('validateAcceptedPaymentMethodIfNeeded: checkingEventIds:', checkingEventIds, paymentServiceType);
98
- if (Array.isArray(checkingEventIds) && paymentService !== undefined) {
98
+ if (Array.isArray(checkingEventIds)) {
99
99
  // 検証対象のイベントIDが存在する場合、その数が0ということはありえない
100
100
  if (checkingEventIds.length === 0) {
101
101
  throw new factory.errors.ArgumentNull('object.serviceOutput.referencesOrder.orderedItem');
@@ -113,15 +113,17 @@ function validateAcceptedPaymentMethodIfNeeded(params
113
113
  const uniqueEventSeriesIds = [...new Set(eventSeriesIds)];
114
114
  debug('validateAcceptedPaymentMethodIfNeeded: eventSeries with AggregateOffer?', uniqueEventSeriesIds);
115
115
  // 決済方法に設定されたカスタム検証URLに依存する場合はこちら↓
116
- const customValidationUrl = paymentService.availableChannel?.customValidationUrl;
117
- if (typeof customValidationUrl === 'string' && customValidationUrl !== '') {
118
- await validateByCustomUrl({
119
- customValidationUrl,
120
- eventSeriesIds: uniqueEventSeriesIds,
121
- paymentMethodType: paymentService.serviceType.codeValue,
122
- // amount: number,
123
- now
124
- });
116
+ if (paymentService !== undefined) {
117
+ const customValidationUrl = paymentService.availableChannel?.customValidationUrl;
118
+ if (typeof customValidationUrl === 'string' && customValidationUrl !== '') {
119
+ await validateByCustomUrl({
120
+ customValidationUrl,
121
+ eventSeriesIds: uniqueEventSeriesIds,
122
+ paymentMethodType: paymentService.serviceType.codeValue,
123
+ // amount: number,
124
+ now
125
+ });
126
+ }
125
127
  }
126
128
  // トークンで検証する場合はこち↓
127
129
  // // 指定された全トークンを抽出
package/package.json CHANGED
@@ -99,5 +99,5 @@
99
99
  "postversion": "git push origin --tags",
100
100
  "prepublishOnly": "npm run clean && npm run build"
101
101
  },
102
- "version": "24.0.0-alpha.52"
102
+ "version": "24.0.0-alpha.53"
103
103
  }