@chevre/domain 20.10.0 → 20.11.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.
- package/example/src/chevre/importCategoryCodesFromCOA.ts +35 -0
- package/lib/chevre/repo/categoryCode.d.ts +4 -0
- package/lib/chevre/repo/categoryCode.js +33 -0
- package/lib/chevre/service/offer/event/importFromCOA.d.ts +12 -0
- package/lib/chevre/service/offer/event/importFromCOA.js +70 -1
- package/lib/chevre/service/offer/event.d.ts +2 -2
- package/lib/chevre/service/offer/event.js +2 -1
- package/lib/chevre/service/offer/eventServiceByCOA/validateAcceptedOffers.d.ts +3 -1
- package/lib/chevre/service/offer/eventServiceByCOA/validateAcceptedOffers.js +38 -12
- package/lib/chevre/service/offer/eventServiceByCOA.d.ts +3 -3
- package/lib/chevre/service/offer/eventServiceByCOA.js +26 -2
- package/package.json +2 -2
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
// import * as redis from 'redis';
|
|
3
|
+
import * as mongoose from 'mongoose';
|
|
4
|
+
|
|
5
|
+
import { chevre } from '../../../lib/index';
|
|
6
|
+
|
|
7
|
+
const project = { id: String(process.env.PROJECT_ID) };
|
|
8
|
+
|
|
9
|
+
const coaAuthClient = new chevre.COA.auth.RefreshToken({
|
|
10
|
+
endpoint: chevre.credentials.coa.endpoint,
|
|
11
|
+
refreshToken: chevre.credentials.coa.refreshToken
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
async function main() {
|
|
15
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
16
|
+
|
|
17
|
+
const categoryCodeRepo = new chevre.repository.CategoryCode(mongoose.connection);
|
|
18
|
+
const masterService = new chevre.COA.service.Master(
|
|
19
|
+
{
|
|
20
|
+
endpoint: chevre.credentials.coa.endpoint,
|
|
21
|
+
auth: coaAuthClient
|
|
22
|
+
},
|
|
23
|
+
{ timeout: chevre.credentials.coa.timeout }
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
await chevre.service.offer.event.importCategoryCodesFromCOA({
|
|
27
|
+
project,
|
|
28
|
+
theaterCode: '120'
|
|
29
|
+
})({ categoryCode: categoryCodeRepo, masterService });
|
|
30
|
+
console.log('imported');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
main()
|
|
34
|
+
.then(console.log)
|
|
35
|
+
.catch(console.error);
|
|
@@ -19,6 +19,10 @@ export declare class MongoRepository {
|
|
|
19
19
|
id?: string;
|
|
20
20
|
attributes: factory.categoryCode.ICategoryCode;
|
|
21
21
|
}): Promise<factory.categoryCode.ICategoryCode>;
|
|
22
|
+
saveManyByCodeValue(params: {
|
|
23
|
+
attributes: factory.categoryCode.ICategoryCode;
|
|
24
|
+
upsert?: boolean;
|
|
25
|
+
}[]): Promise<void>;
|
|
22
26
|
/**
|
|
23
27
|
* 削除する
|
|
24
28
|
*/
|
|
@@ -217,6 +217,39 @@ class MongoRepository {
|
|
|
217
217
|
return doc.toObject();
|
|
218
218
|
});
|
|
219
219
|
}
|
|
220
|
+
saveManyByCodeValue(params) {
|
|
221
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
222
|
+
const bulkWriteOps = [];
|
|
223
|
+
if (Array.isArray(params)) {
|
|
224
|
+
params.forEach((p) => {
|
|
225
|
+
const $set = Object.assign({}, p.attributes);
|
|
226
|
+
if (typeof $set.id === 'string') {
|
|
227
|
+
delete $set.id;
|
|
228
|
+
}
|
|
229
|
+
bulkWriteOps.push({
|
|
230
|
+
updateOne: {
|
|
231
|
+
filter: {
|
|
232
|
+
'project.id': { $eq: p.attributes.project.id },
|
|
233
|
+
codeValue: { $eq: p.attributes.codeValue },
|
|
234
|
+
'inCodeSet.identifier': {
|
|
235
|
+
$exists: true,
|
|
236
|
+
$eq: p.attributes.inCodeSet.identifier
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
update: {
|
|
240
|
+
$set
|
|
241
|
+
// $setOnInsert: {}
|
|
242
|
+
},
|
|
243
|
+
upsert: (p.upsert !== undefined) ? p.upsert : false
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
if (bulkWriteOps.length > 0) {
|
|
249
|
+
yield this.categoryCodeModel.bulkWrite(bulkWriteOps, { ordered: false });
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
}
|
|
220
253
|
/**
|
|
221
254
|
* 削除する
|
|
222
255
|
*/
|
|
@@ -11,3 +11,15 @@ export declare function importFromCOA(params: {
|
|
|
11
11
|
offer: OfferRepo;
|
|
12
12
|
masterService: COA.service.Master;
|
|
13
13
|
}) => Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* 区分をインポートする
|
|
16
|
+
*/
|
|
17
|
+
export declare function importCategoryCodesFromCOA(params: {
|
|
18
|
+
project: {
|
|
19
|
+
id: string;
|
|
20
|
+
};
|
|
21
|
+
theaterCode: string;
|
|
22
|
+
}): (repos: {
|
|
23
|
+
categoryCode: CategoryCodeRepo;
|
|
24
|
+
masterService: COA.service.Master;
|
|
25
|
+
}) => Promise<void>;
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.importFromCOA = void 0;
|
|
12
|
+
exports.importCategoryCodesFromCOA = exports.importFromCOA = void 0;
|
|
13
13
|
const factory = require("../../../factory");
|
|
14
14
|
const factory_1 = require("./factory");
|
|
15
15
|
function importFromCOA(params) {
|
|
@@ -62,3 +62,72 @@ function importFromCOA(params) {
|
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
64
|
exports.importFromCOA = importFromCOA;
|
|
65
|
+
/**
|
|
66
|
+
* 区分をインポートする
|
|
67
|
+
*/
|
|
68
|
+
function importCategoryCodesFromCOA(params) {
|
|
69
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
70
|
+
try {
|
|
71
|
+
const joueihousikiKubuns = yield repos.masterService.kubunName({
|
|
72
|
+
theaterCode: params.theaterCode,
|
|
73
|
+
kubunClass: '045'
|
|
74
|
+
});
|
|
75
|
+
const seatKubuns = yield repos.masterService.kubunName({
|
|
76
|
+
theaterCode: params.theaterCode,
|
|
77
|
+
kubunClass: '050'
|
|
78
|
+
});
|
|
79
|
+
const saveParams = [];
|
|
80
|
+
joueihousikiKubuns.forEach((kubun) => {
|
|
81
|
+
saveParams.push({
|
|
82
|
+
attributes: kubun2categoryCode({
|
|
83
|
+
kubun,
|
|
84
|
+
project: params.project,
|
|
85
|
+
inCodeSet: { identifier: factory.categoryCode.CategorySetIdentifier.VideoFormatType }
|
|
86
|
+
}),
|
|
87
|
+
upsert: true
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
seatKubuns.forEach((kubun) => {
|
|
91
|
+
saveParams.push({
|
|
92
|
+
attributes: kubun2categoryCode({
|
|
93
|
+
kubun,
|
|
94
|
+
project: params.project,
|
|
95
|
+
inCodeSet: { identifier: factory.categoryCode.CategorySetIdentifier.SeatingType }
|
|
96
|
+
}),
|
|
97
|
+
upsert: true
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
yield repos.categoryCode.saveManyByCodeValue(saveParams);
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
let throwsError = true;
|
|
104
|
+
// "name": "COAServiceError",
|
|
105
|
+
// "code": 500,
|
|
106
|
+
// "status": "",
|
|
107
|
+
// "message": "ESOCKETTIMEDOUT",
|
|
108
|
+
if (error.name === 'COAServiceError') {
|
|
109
|
+
if (error.message === 'ESOCKETTIMEDOUT') {
|
|
110
|
+
throwsError = false;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (throwsError) {
|
|
114
|
+
throw error;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
exports.importCategoryCodesFromCOA = importCategoryCodesFromCOA;
|
|
120
|
+
function kubun2categoryCode(params) {
|
|
121
|
+
return {
|
|
122
|
+
additionalProperty: [
|
|
123
|
+
...(typeof params.kubun.kubunAddPrice === 'number')
|
|
124
|
+
? [{ name: 'kubunAddPrice', value: String(params.kubun.kubunAddPrice) }]
|
|
125
|
+
: []
|
|
126
|
+
],
|
|
127
|
+
project: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
128
|
+
typeOf: 'CategoryCode',
|
|
129
|
+
codeValue: params.kubun.kubunCode,
|
|
130
|
+
inCodeSet: { identifier: params.inCodeSet.identifier, typeOf: 'CategoryCodeSet' },
|
|
131
|
+
name: Object.assign({ ja: String(params.kubun.kubunName) }, (typeof params.kubun.kubunNameEng === 'string') ? { en: params.kubun.kubunNameEng } : undefined)
|
|
132
|
+
};
|
|
133
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { authorize } from './event/authorize';
|
|
2
2
|
import { cancel } from './event/cancel';
|
|
3
|
-
import { importFromCOA } from './event/importFromCOA';
|
|
3
|
+
import { importCategoryCodesFromCOA, importFromCOA } from './event/importFromCOA';
|
|
4
4
|
import { searchEventTicketOffers } from './event/searchEventTicketOffers';
|
|
5
5
|
import { voidTransaction } from './event/voidTransaction';
|
|
6
|
-
export { authorize, cancel, importFromCOA, voidTransaction, searchEventTicketOffers };
|
|
6
|
+
export { authorize, cancel, importCategoryCodesFromCOA, importFromCOA, voidTransaction, searchEventTicketOffers };
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.searchEventTicketOffers = exports.voidTransaction = exports.importFromCOA = exports.cancel = exports.authorize = void 0;
|
|
3
|
+
exports.searchEventTicketOffers = exports.voidTransaction = exports.importFromCOA = exports.importCategoryCodesFromCOA = exports.cancel = exports.authorize = void 0;
|
|
4
4
|
const authorize_1 = require("./event/authorize");
|
|
5
5
|
Object.defineProperty(exports, "authorize", { enumerable: true, get: function () { return authorize_1.authorize; } });
|
|
6
6
|
const cancel_1 = require("./event/cancel");
|
|
7
7
|
Object.defineProperty(exports, "cancel", { enumerable: true, get: function () { return cancel_1.cancel; } });
|
|
8
8
|
const importFromCOA_1 = require("./event/importFromCOA");
|
|
9
|
+
Object.defineProperty(exports, "importCategoryCodesFromCOA", { enumerable: true, get: function () { return importFromCOA_1.importCategoryCodesFromCOA; } });
|
|
9
10
|
Object.defineProperty(exports, "importFromCOA", { enumerable: true, get: function () { return importFromCOA_1.importFromCOA; } });
|
|
10
11
|
const searchEventTicketOffers_1 = require("./event/searchEventTicketOffers");
|
|
11
12
|
Object.defineProperty(exports, "searchEventTicketOffers", { enumerable: true, get: function () { return searchEventTicketOffers_1.searchEventTicketOffers; } });
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import * as factory from '../../../factory';
|
|
2
2
|
import { MongoRepository as OfferRepo } from '../../../repo/offer';
|
|
3
3
|
import { IAcceptedOffer4COA } from './factory';
|
|
4
|
+
export declare type IAcceptedOfferBeforeAuthorize4COA = factory.action.authorize.offer.seatReservation.IAcceptedOfferBeforeAuthorize4COA;
|
|
4
5
|
/**
|
|
5
6
|
* 受け入れらたオファーの内容を検証
|
|
6
7
|
*/
|
|
7
8
|
declare function validateAcceptedOffers(params: {
|
|
8
9
|
object: {
|
|
9
|
-
acceptedOffer:
|
|
10
|
+
acceptedOffer: IAcceptedOfferBeforeAuthorize4COA[];
|
|
10
11
|
event: {
|
|
11
12
|
id: string;
|
|
12
13
|
};
|
|
@@ -16,6 +17,7 @@ declare function validateAcceptedOffers(params: {
|
|
|
16
17
|
};
|
|
17
18
|
availablePaymentMethodTypes: factory.categoryCode.ICategoryCode[];
|
|
18
19
|
screeningEvent: Pick<factory.event.screeningEvent.IEvent, 'id' | 'superEvent'>;
|
|
20
|
+
seatingTypes: factory.categoryCode.ICategoryCode[];
|
|
19
21
|
}): (repos: {
|
|
20
22
|
offer: OfferRepo;
|
|
21
23
|
}) => Promise<{
|
|
@@ -135,8 +135,10 @@ function createPriceComponent(params) {
|
|
|
135
135
|
name: {
|
|
136
136
|
en: (typeof (kbnJoueihousiki === null || kbnJoueihousiki === void 0 ? void 0 : kbnJoueihousiki.kubunNameEng) === 'string')
|
|
137
137
|
? kbnJoueihousiki.kubunNameEng
|
|
138
|
-
:
|
|
139
|
-
ja: (typeof (kbnJoueihousiki === null || kbnJoueihousiki === void 0 ? void 0 : kbnJoueihousiki.kubunName) === 'string')
|
|
138
|
+
: String(kbnJoueihousiki === null || kbnJoueihousiki === void 0 ? void 0 : kbnJoueihousiki.kubunCode),
|
|
139
|
+
ja: (typeof (kbnJoueihousiki === null || kbnJoueihousiki === void 0 ? void 0 : kbnJoueihousiki.kubunName) === 'string')
|
|
140
|
+
? `${kbnJoueihousiki.kubunName}加算料金`
|
|
141
|
+
: '加算単価'
|
|
140
142
|
},
|
|
141
143
|
price: ticketInfo.addPrice,
|
|
142
144
|
priceCurrency: factory.priceCurrency.JPY,
|
|
@@ -155,10 +157,15 @@ function createPriceComponent(params) {
|
|
|
155
157
|
}
|
|
156
158
|
}
|
|
157
159
|
if (ticketInfo.spseatAdd1 > 0) {
|
|
160
|
+
const existingSeatingType = params.seatingTypes.find((seatingType) => seatingType.codeValue === ticketInfo.spseatKbn);
|
|
158
161
|
categoryCodeChargeSpecs.push({
|
|
159
162
|
name: {
|
|
160
|
-
en:
|
|
161
|
-
|
|
163
|
+
en: (typeof (existingSeatingType === null || existingSeatingType === void 0 ? void 0 : existingSeatingType.name.en) === 'string')
|
|
164
|
+
? `${existingSeatingType.name.en}`
|
|
165
|
+
: ticketInfo.spseatKbn,
|
|
166
|
+
ja: (typeof (existingSeatingType === null || existingSeatingType === void 0 ? void 0 : existingSeatingType.name.ja) === 'string')
|
|
167
|
+
? `${existingSeatingType.name.ja}加算料金`
|
|
168
|
+
: '特別席加算額'
|
|
162
169
|
},
|
|
163
170
|
price: ticketInfo.spseatAdd1,
|
|
164
171
|
priceCurrency: factory.priceCurrency.JPY,
|
|
@@ -256,27 +263,46 @@ function validateAcceptedOffers(params) {
|
|
|
256
263
|
var _a, _b, _c, _d, _e, _f;
|
|
257
264
|
const availableUnitPriceOffer = availableUnitPriceOffers.find((unitPriceOffer) => unitPriceOffer.id === acceptedOffer.id);
|
|
258
265
|
if (availableUnitPriceOffer === undefined) {
|
|
259
|
-
throw new factory.errors.NotFound(factory.offerType.Offer, `${acceptedOffer.
|
|
260
|
-
}
|
|
261
|
-
const { additionalProperty, itemOffered, name, price, priceSpecification, ticketInfo } = acceptedOffer;
|
|
262
|
-
if (priceSpecification === undefined) {
|
|
263
|
-
throw new factory.errors.NotFound('priceSpecification');
|
|
266
|
+
throw new factory.errors.NotFound(factory.offerType.Offer, `${acceptedOffer.id} not found`);
|
|
264
267
|
}
|
|
268
|
+
const { additionalProperty, itemOffered, name, ticketInfo } = acceptedOffer;
|
|
269
|
+
// if (priceSpecification === undefined) {
|
|
270
|
+
// throw new factory.errors.NotFound('priceSpecification');
|
|
271
|
+
// }
|
|
265
272
|
// priceComponentを再生成(2023-03-14~)
|
|
266
273
|
const { priceComponent, eligibleMonetaryAmount } = createPriceComponent({
|
|
267
274
|
project: { id: params.project.id },
|
|
268
275
|
availablePaymentMethodTypes: params.availablePaymentMethodTypes,
|
|
276
|
+
seatingTypes: params.seatingTypes,
|
|
269
277
|
acceptedOffer,
|
|
270
278
|
availableUnitPriceOffer,
|
|
271
279
|
screeningEvent: params.screeningEvent
|
|
272
280
|
});
|
|
273
|
-
priceSpecification
|
|
281
|
+
const priceSpecification = {
|
|
282
|
+
typeOf: factory.priceSpecificationType.CompoundPriceSpecification,
|
|
283
|
+
priceCurrency: factory.priceCurrency.JPY,
|
|
284
|
+
priceComponent,
|
|
285
|
+
valueAddedTaxIncluded: true
|
|
286
|
+
};
|
|
287
|
+
// 実際の発生金額を算出
|
|
288
|
+
const price = [
|
|
289
|
+
ticketInfo.salesTicketSalePrice,
|
|
290
|
+
ticketInfo.addGlasses,
|
|
291
|
+
ticketInfo.spseatAdd1,
|
|
292
|
+
ticketInfo.spseatAdd2
|
|
293
|
+
].reduce((a, b) => a + b, 0);
|
|
294
|
+
// COAに渡す販売金額については、特別席加算額は興収部分のみ加算
|
|
295
|
+
const salePrice = [
|
|
296
|
+
ticketInfo.salesTicketSalePrice,
|
|
297
|
+
ticketInfo.addGlasses,
|
|
298
|
+
ticketInfo.spseatAdd1
|
|
299
|
+
].reduce((a, b) => a + b, 0);
|
|
274
300
|
return Object.assign(Object.assign({ additionalProperty,
|
|
275
301
|
itemOffered,
|
|
276
302
|
name,
|
|
277
303
|
price,
|
|
278
|
-
priceSpecification,
|
|
279
|
-
|
|
304
|
+
priceSpecification, ticketInfo: Object.assign(Object.assign({}, ticketInfo), { salePrice // COAに渡す販売金額を上書き(2023-03-20~)
|
|
305
|
+
}),
|
|
280
306
|
// 以下属性については単価オファーから読む(2023-03-09~)
|
|
281
307
|
priceCurrency: availableUnitPriceOffer.priceCurrency, id: String(availableUnitPriceOffer.id), identifier: String(availableUnitPriceOffer.identifier), typeOf: availableUnitPriceOffer.typeOf }, (Array.isArray(eligibleMonetaryAmount)) ? { eligibleMonetaryAmount } : undefined), {
|
|
282
308
|
// tslint:disable-next-line:no-suspicious-comment
|
|
@@ -3,7 +3,7 @@ import { MongoRepository as CategoryCodeRepo } from '../../repo/categoryCode';
|
|
|
3
3
|
import { MongoRepository as EventRepo } from '../../repo/event';
|
|
4
4
|
import { MongoRepository as OfferRepo } from '../../repo/offer';
|
|
5
5
|
import { MongoRepository as TransactionRepo } from '../../repo/transaction';
|
|
6
|
-
import {
|
|
6
|
+
import { IAcceptedOfferBeforeAuthorize4COA } from './eventServiceByCOA/validateAcceptedOffers';
|
|
7
7
|
import * as factory from '../../factory';
|
|
8
8
|
export import WebAPIIdentifier = factory.service.webAPI.Identifier;
|
|
9
9
|
interface IAuthorizeRepos {
|
|
@@ -20,7 +20,7 @@ export declare type IAuthorizeOfferAction = factory.action.authorize.offer.seatR
|
|
|
20
20
|
*/
|
|
21
21
|
export declare function authorize(params: {
|
|
22
22
|
object: {
|
|
23
|
-
acceptedOffer:
|
|
23
|
+
acceptedOffer: IAcceptedOfferBeforeAuthorize4COA[];
|
|
24
24
|
event: {
|
|
25
25
|
id: string;
|
|
26
26
|
};
|
|
@@ -74,7 +74,7 @@ export declare function cancel(params: {
|
|
|
74
74
|
export declare function changeOffers(params: {
|
|
75
75
|
id: string;
|
|
76
76
|
object: {
|
|
77
|
-
acceptedOffer:
|
|
77
|
+
acceptedOffer: IAcceptedOfferBeforeAuthorize4COA[];
|
|
78
78
|
event: {
|
|
79
79
|
id: string;
|
|
80
80
|
};
|
|
@@ -36,6 +36,10 @@ function authorize(params) {
|
|
|
36
36
|
project: { id: { $eq: transaction.project.id } },
|
|
37
37
|
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.PaymentMethodType } }
|
|
38
38
|
});
|
|
39
|
+
const seatingTypes = yield repos.categoryCode.search({
|
|
40
|
+
project: { id: { $eq: transaction.project.id } },
|
|
41
|
+
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.SeatingType } }
|
|
42
|
+
});
|
|
39
43
|
// COA仮予約後にリクエストが来る前提
|
|
40
44
|
// validate acceptedOffer(2023-03-09~)
|
|
41
45
|
// const acceptedOffer = params.object.acceptedOffer;
|
|
@@ -43,7 +47,8 @@ function authorize(params) {
|
|
|
43
47
|
object: params.object,
|
|
44
48
|
project: { id: transaction.project.id },
|
|
45
49
|
availablePaymentMethodTypes,
|
|
46
|
-
screeningEvent
|
|
50
|
+
screeningEvent,
|
|
51
|
+
seatingTypes
|
|
47
52
|
})(repos);
|
|
48
53
|
const updTmpReserveSeatArgs = params.result.requestBody;
|
|
49
54
|
const updTmpReserveSeatResult = params.result.responseBody;
|
|
@@ -149,6 +154,20 @@ function changeOffers(params) {
|
|
|
149
154
|
throw new factory.errors.Argument('Transaction', 'Action not found in the transaction');
|
|
150
155
|
}
|
|
151
156
|
validate4changeOffer({ action: authorizeAction, object: params.object });
|
|
157
|
+
// 座席情報に関しては元のacceptedOffersで自動補完する(リクエストでは正しく指定されないので注意)(2023-03-20~)
|
|
158
|
+
params.object.acceptedOffer = params.object.acceptedOffer.map((offer) => {
|
|
159
|
+
const originalAcceptedOfferBySeatNumber = authorizeAction.object.acceptedOffer.find((originalOffer) => {
|
|
160
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
161
|
+
return ((_d = (_c = (_b = (_a = originalOffer.itemOffered) === null || _a === void 0 ? void 0 : _a.serviceOutput) === null || _b === void 0 ? void 0 : _b.reservedTicket) === null || _c === void 0 ? void 0 : _c.ticketedSeat) === null || _d === void 0 ? void 0 : _d.seatSection)
|
|
162
|
+
=== ((_g = (_f = (_e = offer.itemOffered.serviceOutput) === null || _e === void 0 ? void 0 : _e.reservedTicket) === null || _f === void 0 ? void 0 : _f.ticketedSeat) === null || _g === void 0 ? void 0 : _g.seatSection)
|
|
163
|
+
&& ((_k = (_j = (_h = originalOffer.itemOffered.serviceOutput) === null || _h === void 0 ? void 0 : _h.reservedTicket) === null || _j === void 0 ? void 0 : _j.ticketedSeat) === null || _k === void 0 ? void 0 : _k.seatNumber)
|
|
164
|
+
=== ((_o = (_m = (_l = offer.itemOffered.serviceOutput) === null || _l === void 0 ? void 0 : _l.reservedTicket) === null || _m === void 0 ? void 0 : _m.ticketedSeat) === null || _o === void 0 ? void 0 : _o.seatNumber);
|
|
165
|
+
});
|
|
166
|
+
if (originalAcceptedOfferBySeatNumber === undefined) {
|
|
167
|
+
throw new factory.errors.Argument('offers', 'seatSection or seatNumber not matched.');
|
|
168
|
+
}
|
|
169
|
+
return Object.assign(Object.assign({}, offer), { ticketInfo: Object.assign(Object.assign({}, offer.ticketInfo), { spseatAdd1: originalAcceptedOfferBySeatNumber.ticketInfo.spseatAdd1, spseatAdd2: originalAcceptedOfferBySeatNumber.ticketInfo.spseatAdd2, spseatKbn: originalAcceptedOfferBySeatNumber.ticketInfo.spseatKbn }) });
|
|
170
|
+
});
|
|
152
171
|
// イベント取得属性最適化(2023-01-23~)
|
|
153
172
|
const screeningEvent = yield repos.event.findMinimizedIndividualEventById({
|
|
154
173
|
id: params.object.event.id
|
|
@@ -157,6 +176,10 @@ function changeOffers(params) {
|
|
|
157
176
|
project: { id: { $eq: transaction.project.id } },
|
|
158
177
|
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.PaymentMethodType } }
|
|
159
178
|
});
|
|
179
|
+
const seatingTypes = yield repos.categoryCode.search({
|
|
180
|
+
project: { id: { $eq: transaction.project.id } },
|
|
181
|
+
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.SeatingType } }
|
|
182
|
+
});
|
|
160
183
|
// COA仮予約後にリクエストが来る前提
|
|
161
184
|
// validate acceptedOffer(2023-03-09~)
|
|
162
185
|
// const acceptedOffer = params.object.acceptedOffer;
|
|
@@ -164,7 +187,8 @@ function changeOffers(params) {
|
|
|
164
187
|
object: params.object,
|
|
165
188
|
project: { id: transaction.project.id },
|
|
166
189
|
availablePaymentMethodTypes,
|
|
167
|
-
screeningEvent
|
|
190
|
+
screeningEvent,
|
|
191
|
+
seatingTypes
|
|
168
192
|
})(repos);
|
|
169
193
|
// 供給情報と価格を変更してからDB更新
|
|
170
194
|
authorizeAction.object.acceptedOffer = acceptedOffers;
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.
|
|
12
|
+
"@chevre/factory": "4.304.0",
|
|
13
13
|
"@cinerino/sdk": "3.150.0",
|
|
14
14
|
"@motionpicture/coa-service": "9.2.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.2.0",
|
|
@@ -120,5 +120,5 @@
|
|
|
120
120
|
"postversion": "git push origin --tags",
|
|
121
121
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
122
122
|
},
|
|
123
|
-
"version": "20.
|
|
123
|
+
"version": "20.11.0-alpha.0"
|
|
124
124
|
}
|