@chevre/domain 20.6.0 → 20.7.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.
|
@@ -12,6 +12,7 @@ export declare function createAuthorizeSeatReservationActionAttributes(params: {
|
|
|
12
12
|
export declare function offers2resultPrice(offers: factory.action.authorize.offer.seatReservation.IAcceptedOffer<WebAPIIdentifier.COA>[]): {
|
|
13
13
|
price: number;
|
|
14
14
|
requiredPoint: number;
|
|
15
|
+
eligibleMonetaryAmount: factory.offer.IEligibleMonetaryAmount[];
|
|
15
16
|
};
|
|
16
17
|
declare type IResultAcceptedOffer = factory.action.authorize.offer.seatReservation.IResultAcceptedOffer;
|
|
17
18
|
/**
|
|
@@ -55,7 +55,15 @@ exports.createAuthorizeSeatReservationActionAttributes = createAuthorizeSeatRese
|
|
|
55
55
|
function offers2resultPrice(offers) {
|
|
56
56
|
const price = offers.reduce((a, b) => a + b.price, 0);
|
|
57
57
|
const requiredPoint = offers.reduce((a, b) => a + b.ticketInfo.usePoint, 0);
|
|
58
|
-
|
|
58
|
+
const eligibleMonetaryAmount = offers.reduce((a, b) => {
|
|
59
|
+
if (Array.isArray(b.eligibleMonetaryAmount)) {
|
|
60
|
+
return [...a, ...b.eligibleMonetaryAmount];
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
return a;
|
|
64
|
+
}
|
|
65
|
+
}, []);
|
|
66
|
+
return { price, requiredPoint, eligibleMonetaryAmount };
|
|
59
67
|
}
|
|
60
68
|
exports.offers2resultPrice = offers2resultPrice;
|
|
61
69
|
/**
|
|
@@ -100,8 +108,6 @@ function responseBody2acceptedOffers4result(params) {
|
|
|
100
108
|
const reservationNumber = String(updTmpReserveSeatResult.tmpReserveNum);
|
|
101
109
|
const reservationId = `${reservationNumber}-${index.toString()}`;
|
|
102
110
|
const workPerformed = {
|
|
103
|
-
// 不要なので廃止(2022-12-19~)
|
|
104
|
-
// project: event.superEvent.workPerformed.project,
|
|
105
111
|
id: event.superEvent.workPerformed.id,
|
|
106
112
|
identifier: event.superEvent.workPerformed.identifier,
|
|
107
113
|
name: event.superEvent.workPerformed.name,
|
|
@@ -114,24 +120,12 @@ function responseBody2acceptedOffers4result(params) {
|
|
|
114
120
|
.toDate()
|
|
115
121
|
}
|
|
116
122
|
: undefined), { endDate: moment(event.endDate)
|
|
117
|
-
.toDate(),
|
|
118
|
-
// 不要なので廃止(2022-12-19~)
|
|
119
|
-
// eventStatus: event.eventStatus,
|
|
120
|
-
identifier: event.identifier, location: {
|
|
121
|
-
// 不要なので廃止(2022-12-19~)
|
|
122
|
-
// project: event.location.project,
|
|
123
|
+
.toDate(), identifier: event.identifier, location: {
|
|
123
124
|
typeOf: event.location.typeOf,
|
|
124
125
|
branchCode: event.location.branchCode,
|
|
125
126
|
name: event.location.name
|
|
126
|
-
}, name: event.name,
|
|
127
|
-
|
|
128
|
-
// project: event.project,
|
|
129
|
-
startDate: moment(event.startDate)
|
|
130
|
-
.toDate(),
|
|
131
|
-
// 最適化(2022-05-31~)
|
|
132
|
-
superEvent: {
|
|
133
|
-
// 不要なので廃止(2022-12-19~)
|
|
134
|
-
// project: event.superEvent.project,
|
|
127
|
+
}, name: event.name, startDate: moment(event.startDate)
|
|
128
|
+
.toDate(), superEvent: {
|
|
135
129
|
typeOf: event.superEvent.typeOf,
|
|
136
130
|
id: event.superEvent.id,
|
|
137
131
|
identifier: event.superEvent.identifier,
|
|
@@ -160,14 +154,10 @@ function responseBody2acceptedOffers4result(params) {
|
|
|
160
154
|
ticketNumber: ticketToken,
|
|
161
155
|
ticketToken: ticketToken,
|
|
162
156
|
ticketType: {
|
|
163
|
-
// 不要なので廃止(2022-12-17~)
|
|
164
|
-
// project: { typeOf: event.project.typeOf, id: event.project.id },
|
|
165
157
|
typeOf: factory.offerType.Offer,
|
|
166
158
|
id: requestedOffer.id,
|
|
167
159
|
identifier: String(requestedOffer.identifier),
|
|
168
160
|
name: requestedOffer.name
|
|
169
|
-
// 不要なので廃止(2022-12-17~)
|
|
170
|
-
// priceCurrency: factory.priceCurrency.JPY
|
|
171
161
|
}
|
|
172
162
|
};
|
|
173
163
|
const additionalProperty = (_c = (_b = requestedOffer.itemOffered) === null || _b === void 0 ? void 0 : _b.serviceOutput) === null || _c === void 0 ? void 0 : _c.additionalProperty;
|
|
@@ -203,7 +193,6 @@ function responseBody2acceptedOffers4result(params) {
|
|
|
203
193
|
priceComponent: requestedOffer.priceSpecification.priceComponent
|
|
204
194
|
};
|
|
205
195
|
return {
|
|
206
|
-
// project: { typeOf: event.project.typeOf, id: event.project.id },
|
|
207
196
|
typeOf: factory.offerType.Offer,
|
|
208
197
|
id: requestedOffer.id,
|
|
209
198
|
name: requestedOffer.name,
|
|
@@ -212,7 +201,6 @@ function responseBody2acceptedOffers4result(params) {
|
|
|
212
201
|
priceSpecification,
|
|
213
202
|
priceCurrency: factory.priceCurrency.JPY,
|
|
214
203
|
seller: {
|
|
215
|
-
// project: { typeOf: event.project.typeOf, id: event.project.id },
|
|
216
204
|
typeOf: params.seller.typeOf,
|
|
217
205
|
name: params.seller.name
|
|
218
206
|
}
|
|
@@ -32,24 +32,6 @@ function authorize(params) {
|
|
|
32
32
|
const screeningEvent = yield repos.event.findMinimizedIndividualEventById({
|
|
33
33
|
id: params.object.event.id
|
|
34
34
|
});
|
|
35
|
-
// 必ず定義されている前提
|
|
36
|
-
// const coaInfo = <factory.event.screeningEvent.ICOAInfo>screeningEvent.coaInfo;
|
|
37
|
-
// const acceptedOffersWithoutDetails = await createAcceptedOffersWithoutDetails({
|
|
38
|
-
// object: params.object,
|
|
39
|
-
// coaInfo
|
|
40
|
-
// })({ reserveService: repos.reserveService });
|
|
41
|
-
// const acceptedOffer = await validateOffers(
|
|
42
|
-
// { id: transaction.project.id },
|
|
43
|
-
// (transaction.agent.typeOf === factory.personType.Person),
|
|
44
|
-
// // 必ず定義されている前提
|
|
45
|
-
// coaInfo,
|
|
46
|
-
// acceptedOffersWithoutDetails
|
|
47
|
-
// )({
|
|
48
|
-
// categoryCode: repos.categoryCode,
|
|
49
|
-
// offer: repos.offer,
|
|
50
|
-
// reserveService: repos.reserveService,
|
|
51
|
-
// masterService: repos.masterService
|
|
52
|
-
// });
|
|
53
35
|
// COA仮予約後にリクエストが来る前提
|
|
54
36
|
const acceptedOffer = params.object.acceptedOffer;
|
|
55
37
|
const updTmpReserveSeatArgs = params.result.requestBody;
|
|
@@ -75,7 +57,7 @@ function authorize(params) {
|
|
|
75
57
|
throw error;
|
|
76
58
|
}
|
|
77
59
|
// 座席仮予約からオファー情報を生成する
|
|
78
|
-
const { price,
|
|
60
|
+
const { price, eligibleMonetaryAmount } = (0, factory_1.offers2resultPrice)(acceptedOffer);
|
|
79
61
|
const acceptedOffers4result = (0, factory_1.responseBody2acceptedOffers4result)({
|
|
80
62
|
responseBody: updTmpReserveSeatResult,
|
|
81
63
|
object: action.object,
|
|
@@ -85,13 +67,16 @@ function authorize(params) {
|
|
|
85
67
|
.toDate(),
|
|
86
68
|
totalPrice: price
|
|
87
69
|
});
|
|
88
|
-
const result = Object.assign({ price: price, priceCurrency: factory.priceCurrency.JPY,
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
70
|
+
const result = Object.assign({ price: price, priceCurrency: factory.priceCurrency.JPY,
|
|
71
|
+
// eligibleMonetaryAmountを使用(2023-03-08~)
|
|
72
|
+
// amount: (requiredPoint > 0)
|
|
73
|
+
// ? [{
|
|
74
|
+
// typeOf: 'MonetaryAmount',
|
|
75
|
+
// currency: 'Point',
|
|
76
|
+
// value: requiredPoint
|
|
77
|
+
// }]
|
|
78
|
+
// : [],
|
|
79
|
+
amount: eligibleMonetaryAmount, requestBody: updTmpReserveSeatArgs, responseBody: updTmpReserveSeatResult, acceptedOffers: acceptedOffers4result }, { updTmpReserveSeatArgs, updTmpReserveSeatResult } // 互換性維持のため
|
|
95
80
|
);
|
|
96
81
|
return yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: result });
|
|
97
82
|
});
|
|
@@ -169,44 +154,13 @@ function changeOffers(params) {
|
|
|
169
154
|
});
|
|
170
155
|
// COA仮予約後にリクエストが来る前提
|
|
171
156
|
const acceptedOffer = params.object.acceptedOffer;
|
|
172
|
-
// 座席区分加算料金などを補完
|
|
173
|
-
// acceptedOffer = acceptedOffer.map((offer) => {
|
|
174
|
-
// const originalOffer = authorizeAction.object.acceptedOffer.find((o) => {
|
|
175
|
-
// return o.itemOffered?.serviceOutput?.reservedTicket?.ticketedSeat?.seatSection === offer.seatSection
|
|
176
|
-
// && o.itemOffered.serviceOutput.reservedTicket.ticketedSeat.seatNumber === offer.seatNumber;
|
|
177
|
-
// });
|
|
178
|
-
// if (originalOffer === undefined) {
|
|
179
|
-
// throw new factory.errors.Argument('offers', 'seatSection or seatNumber not matched.');
|
|
180
|
-
// }
|
|
181
|
-
// return {
|
|
182
|
-
// ...offer,
|
|
183
|
-
// ticketInfo: {
|
|
184
|
-
// ...offer.ticketInfo,
|
|
185
|
-
// spseatAdd1: originalOffer.ticketInfo.spseatAdd1,
|
|
186
|
-
// spseatAdd2: originalOffer.ticketInfo.spseatAdd2,
|
|
187
|
-
// spseatKbn: originalOffer.ticketInfo.spseatKbn
|
|
188
|
-
// }
|
|
189
|
-
// };
|
|
190
|
-
// });
|
|
191
|
-
// const acceptedOffer = await validateOffers(
|
|
192
|
-
// { id: transaction.project.id },
|
|
193
|
-
// (transaction.agent.typeOf === factory.personType.Person),
|
|
194
|
-
// // 必ず定義されている前提
|
|
195
|
-
// <factory.event.screeningEvent.ICOAInfo>screeningEvent.coaInfo,
|
|
196
|
-
// acceptedOffersWithoutDetails
|
|
197
|
-
// )({
|
|
198
|
-
// categoryCode: repos.categoryCode,
|
|
199
|
-
// offer: repos.offer,
|
|
200
|
-
// reserveService: repos.reserveService,
|
|
201
|
-
// masterService: repos.masterService
|
|
202
|
-
// });
|
|
203
157
|
// 供給情報と価格を変更してからDB更新
|
|
204
158
|
authorizeAction.object.acceptedOffer = acceptedOffer;
|
|
205
159
|
const updTmpReserveSeatResult = (_a = authorizeAction.result) === null || _a === void 0 ? void 0 : _a.responseBody;
|
|
206
160
|
if (updTmpReserveSeatResult === undefined) {
|
|
207
161
|
throw new factory.errors.NotFound('action.result.responseBody');
|
|
208
162
|
}
|
|
209
|
-
const { price,
|
|
163
|
+
const { price, eligibleMonetaryAmount } = (0, factory_1.offers2resultPrice)(acceptedOffer);
|
|
210
164
|
const acceptedOffers4result = (0, factory_1.responseBody2acceptedOffers4result)({
|
|
211
165
|
responseBody: updTmpReserveSeatResult,
|
|
212
166
|
object: authorizeAction.object,
|
|
@@ -216,13 +170,16 @@ function changeOffers(params) {
|
|
|
216
170
|
.toDate(),
|
|
217
171
|
totalPrice: price
|
|
218
172
|
});
|
|
219
|
-
const actionResult = Object.assign(Object.assign({}, authorizeAction.result), { price: price,
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
173
|
+
const actionResult = Object.assign(Object.assign({}, authorizeAction.result), { price: price,
|
|
174
|
+
// eligibleMonetaryAmountを使用(2023-03-08~)
|
|
175
|
+
// amount: (requiredPoint > 0)
|
|
176
|
+
// ? [{
|
|
177
|
+
// typeOf: 'MonetaryAmount',
|
|
178
|
+
// currency: 'Point',
|
|
179
|
+
// value: requiredPoint
|
|
180
|
+
// }]
|
|
181
|
+
// : [],
|
|
182
|
+
amount: eligibleMonetaryAmount, acceptedOffers: acceptedOffers4result });
|
|
226
183
|
// 座席予約承認アクションの供給情報を変更する
|
|
227
184
|
return repos.action.updateAuthorizeEventOfferAction({
|
|
228
185
|
id: params.id,
|
package/package.json
CHANGED