@chevre/domain 20.6.0 → 20.7.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.
- package/example/src/chevre/{migrateOfferAdditionalProperties.ts → migrateMovieAdditionalProperties.ts} +18 -18
- package/lib/chevre/service/offer/eventServiceByCOA/factory.d.ts +3 -2
- package/lib/chevre/service/offer/eventServiceByCOA/factory.js +12 -25
- package/lib/chevre/service/offer/eventServiceByCOA/validateAcceptedOffers.d.ts +21 -0
- package/lib/chevre/service/offer/eventServiceByCOA/validateAcceptedOffers.js +61 -0
- package/lib/chevre/service/offer/eventServiceByCOA.d.ts +5 -2
- package/lib/chevre/service/offer/eventServiceByCOA.js +37 -78
- package/lib/chevre/service/payment/movieTicket/validation.js +3 -1
- package/lib/chevre/service/payment/movieTicket.js +2 -3
- package/package.json +3 -3
|
@@ -12,9 +12,9 @@ async function main() {
|
|
|
12
12
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
13
13
|
|
|
14
14
|
const additionalPropertyRepo = new chevre.repository.AdditionalProperty(mongoose.connection);
|
|
15
|
-
const
|
|
15
|
+
const creativeWorkRepo = new chevre.repository.CreativeWork(mongoose.connection);
|
|
16
16
|
|
|
17
|
-
const cursor =
|
|
17
|
+
const cursor = creativeWorkRepo.getCursor(
|
|
18
18
|
{
|
|
19
19
|
// 'project.id': { $eq: project.id },
|
|
20
20
|
'project.id': { $ne: EXCLUDED_PROJECT_ID }
|
|
@@ -23,7 +23,7 @@ async function main() {
|
|
|
23
23
|
// _id: 1,
|
|
24
24
|
}
|
|
25
25
|
);
|
|
26
|
-
console.log('
|
|
26
|
+
console.log('movies found');
|
|
27
27
|
|
|
28
28
|
const additionalPropertyNames: string[] = [];
|
|
29
29
|
const projectIds: string[] = [];
|
|
@@ -33,64 +33,64 @@ async function main() {
|
|
|
33
33
|
let updateCount = 0;
|
|
34
34
|
await cursor.eachAsync(async (doc) => {
|
|
35
35
|
i += 1;
|
|
36
|
-
const
|
|
36
|
+
const movie: chevre.factory.creativeWork.movie.ICreativeWork = doc.toObject();
|
|
37
37
|
|
|
38
|
-
const additionalPropertyNamesOnEvent =
|
|
38
|
+
const additionalPropertyNamesOnEvent = movie.additionalProperty?.map((p) => p.name);
|
|
39
39
|
if (Array.isArray(additionalPropertyNamesOnEvent) && additionalPropertyNamesOnEvent.length > 0) {
|
|
40
40
|
console.log(
|
|
41
41
|
additionalPropertyNamesOnEvent.length,
|
|
42
42
|
'additionalPropertyNamesOnEvent found',
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
movie.project.id,
|
|
44
|
+
movie.id
|
|
45
45
|
);
|
|
46
46
|
additionalPropertyNames.push(...additionalPropertyNamesOnEvent);
|
|
47
|
-
projectIds.push(
|
|
47
|
+
projectIds.push(movie.project.id);
|
|
48
48
|
additionalPropertyNamesOnEvent.forEach((name) => {
|
|
49
49
|
if (!name.match(/^[a-zA-Z]*$/)) {
|
|
50
50
|
// throw new Error(`not matched ${creativeWork.project.id} ${creativeWork.id}`);
|
|
51
|
-
unexpextedprojectIds.push(
|
|
51
|
+
unexpextedprojectIds.push(movie.project.id);
|
|
52
52
|
}
|
|
53
53
|
// tslint:disable-next-line:no-magic-numbers
|
|
54
54
|
if (name.length < 5) {
|
|
55
55
|
// throw new Error(`length matched ${creativeWork.project.id} ${creativeWork.id} ${name}`);
|
|
56
|
-
unexpextedprojectIds.push(
|
|
56
|
+
unexpextedprojectIds.push(movie.project.id);
|
|
57
57
|
}
|
|
58
58
|
});
|
|
59
59
|
|
|
60
60
|
for (const additionalPropertyNameOnEvent of additionalPropertyNamesOnEvent) {
|
|
61
61
|
const existings = await additionalPropertyRepo.search({
|
|
62
|
-
project: { id: { $eq:
|
|
62
|
+
project: { id: { $eq: movie.project.id } },
|
|
63
63
|
limit: 1,
|
|
64
64
|
page: 1,
|
|
65
65
|
name: { $regex: `^${additionalPropertyNameOnEvent}$` }
|
|
66
66
|
});
|
|
67
67
|
if (existings.length > 0) {
|
|
68
|
-
console.log('already existed', additionalPropertyNameOnEvent,
|
|
68
|
+
console.log('already existed', additionalPropertyNameOnEvent, movie.id, movie.project.id);
|
|
69
69
|
} else {
|
|
70
70
|
updateCount += 1;
|
|
71
71
|
const newAdditionalProperty: chevre.factory.additionalProperty.IAdditionalProperty = {
|
|
72
|
-
project:
|
|
72
|
+
project: movie.project,
|
|
73
73
|
typeOf: 'CategoryCode',
|
|
74
74
|
codeValue: additionalPropertyNameOnEvent,
|
|
75
75
|
inCodeSet: {
|
|
76
76
|
typeOf: 'CategoryCodeSet',
|
|
77
|
-
identifier: <
|
|
77
|
+
identifier: <chevre.factory.creativeWorkType.Movie>movie.typeOf
|
|
78
78
|
},
|
|
79
79
|
name: { ja: additionalPropertyNameOnEvent }
|
|
80
80
|
};
|
|
81
81
|
await additionalPropertyRepo.save({
|
|
82
82
|
attributes: newAdditionalProperty
|
|
83
83
|
});
|
|
84
|
-
console.log('created', additionalPropertyNameOnEvent,
|
|
84
|
+
console.log('created', additionalPropertyNameOnEvent, movie.id, movie.project.id);
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
});
|
|
89
89
|
console.log(i, 'events checked');
|
|
90
90
|
console.log(updateCount, 'properties updated');
|
|
91
|
-
console.log([...new Set(additionalPropertyNames)]);
|
|
92
|
-
console.log([...new Set(projectIds)]);
|
|
93
|
-
console.log([...new Set(unexpextedprojectIds)]);
|
|
91
|
+
console.log('additionalPropertyNames:', [...new Set(additionalPropertyNames)]);
|
|
92
|
+
console.log('projectIds:', [...new Set(projectIds)]);
|
|
93
|
+
console.log('unexpextedprojectIds:', [...new Set(unexpextedprojectIds)]);
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
main()
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as factory from '../../../factory';
|
|
2
2
|
import { IMinimizedIndividualEvent } from '../../../factory/event';
|
|
3
3
|
export import WebAPIIdentifier = factory.service.webAPI.Identifier;
|
|
4
|
+
export declare type IAcceptedOffer4COA = factory.action.authorize.offer.seatReservation.IAcceptedOffer<factory.service.webAPI.Identifier.COA>;
|
|
4
5
|
export declare function createAuthorizeSeatReservationActionAttributes(params: {
|
|
5
6
|
acceptedOffers: factory.action.authorize.offer.seatReservation.IAcceptedOffer<factory.service.webAPI.Identifier.COA>[];
|
|
6
7
|
event: factory.event.IEvent<factory.eventType.ScreeningEvent>;
|
|
@@ -9,9 +10,9 @@ export declare function createAuthorizeSeatReservationActionAttributes(params: {
|
|
|
9
10
|
/**
|
|
10
11
|
* 供給情報から承認アクションの価格を導き出す
|
|
11
12
|
*/
|
|
12
|
-
export declare function offers2resultPrice(offers:
|
|
13
|
+
export declare function offers2resultPrice(offers: IAcceptedOffer4COA[]): {
|
|
13
14
|
price: number;
|
|
14
|
-
|
|
15
|
+
eligibleMonetaryAmount: factory.offer.IEligibleMonetaryAmount[];
|
|
15
16
|
};
|
|
16
17
|
declare type IResultAcceptedOffer = factory.action.authorize.offer.seatReservation.IResultAcceptedOffer;
|
|
17
18
|
/**
|
|
@@ -54,8 +54,15 @@ exports.createAuthorizeSeatReservationActionAttributes = createAuthorizeSeatRese
|
|
|
54
54
|
*/
|
|
55
55
|
function offers2resultPrice(offers) {
|
|
56
56
|
const price = offers.reduce((a, b) => a + b.price, 0);
|
|
57
|
-
const
|
|
58
|
-
|
|
57
|
+
const eligibleMonetaryAmount = offers.reduce((a, b) => {
|
|
58
|
+
if (Array.isArray(b.eligibleMonetaryAmount)) {
|
|
59
|
+
return [...a, ...b.eligibleMonetaryAmount];
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
return a;
|
|
63
|
+
}
|
|
64
|
+
}, []);
|
|
65
|
+
return { price, eligibleMonetaryAmount };
|
|
59
66
|
}
|
|
60
67
|
exports.offers2resultPrice = offers2resultPrice;
|
|
61
68
|
/**
|
|
@@ -100,8 +107,6 @@ function responseBody2acceptedOffers4result(params) {
|
|
|
100
107
|
const reservationNumber = String(updTmpReserveSeatResult.tmpReserveNum);
|
|
101
108
|
const reservationId = `${reservationNumber}-${index.toString()}`;
|
|
102
109
|
const workPerformed = {
|
|
103
|
-
// 不要なので廃止(2022-12-19~)
|
|
104
|
-
// project: event.superEvent.workPerformed.project,
|
|
105
110
|
id: event.superEvent.workPerformed.id,
|
|
106
111
|
identifier: event.superEvent.workPerformed.identifier,
|
|
107
112
|
name: event.superEvent.workPerformed.name,
|
|
@@ -114,24 +119,12 @@ function responseBody2acceptedOffers4result(params) {
|
|
|
114
119
|
.toDate()
|
|
115
120
|
}
|
|
116
121
|
: 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,
|
|
122
|
+
.toDate(), identifier: event.identifier, location: {
|
|
123
123
|
typeOf: event.location.typeOf,
|
|
124
124
|
branchCode: event.location.branchCode,
|
|
125
125
|
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,
|
|
126
|
+
}, name: event.name, startDate: moment(event.startDate)
|
|
127
|
+
.toDate(), superEvent: {
|
|
135
128
|
typeOf: event.superEvent.typeOf,
|
|
136
129
|
id: event.superEvent.id,
|
|
137
130
|
identifier: event.superEvent.identifier,
|
|
@@ -160,14 +153,10 @@ function responseBody2acceptedOffers4result(params) {
|
|
|
160
153
|
ticketNumber: ticketToken,
|
|
161
154
|
ticketToken: ticketToken,
|
|
162
155
|
ticketType: {
|
|
163
|
-
// 不要なので廃止(2022-12-17~)
|
|
164
|
-
// project: { typeOf: event.project.typeOf, id: event.project.id },
|
|
165
156
|
typeOf: factory.offerType.Offer,
|
|
166
157
|
id: requestedOffer.id,
|
|
167
158
|
identifier: String(requestedOffer.identifier),
|
|
168
159
|
name: requestedOffer.name
|
|
169
|
-
// 不要なので廃止(2022-12-17~)
|
|
170
|
-
// priceCurrency: factory.priceCurrency.JPY
|
|
171
160
|
}
|
|
172
161
|
};
|
|
173
162
|
const additionalProperty = (_c = (_b = requestedOffer.itemOffered) === null || _b === void 0 ? void 0 : _b.serviceOutput) === null || _c === void 0 ? void 0 : _c.additionalProperty;
|
|
@@ -203,7 +192,6 @@ function responseBody2acceptedOffers4result(params) {
|
|
|
203
192
|
priceComponent: requestedOffer.priceSpecification.priceComponent
|
|
204
193
|
};
|
|
205
194
|
return {
|
|
206
|
-
// project: { typeOf: event.project.typeOf, id: event.project.id },
|
|
207
195
|
typeOf: factory.offerType.Offer,
|
|
208
196
|
id: requestedOffer.id,
|
|
209
197
|
name: requestedOffer.name,
|
|
@@ -212,7 +200,6 @@ function responseBody2acceptedOffers4result(params) {
|
|
|
212
200
|
priceSpecification,
|
|
213
201
|
priceCurrency: factory.priceCurrency.JPY,
|
|
214
202
|
seller: {
|
|
215
|
-
// project: { typeOf: event.project.typeOf, id: event.project.id },
|
|
216
203
|
typeOf: params.seller.typeOf,
|
|
217
204
|
name: params.seller.name
|
|
218
205
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { MongoRepository as OfferRepo } from '../../../repo/offer';
|
|
2
|
+
import { IAcceptedOffer4COA } from './factory';
|
|
3
|
+
/**
|
|
4
|
+
* 受け入れらたオファーの内容を検証
|
|
5
|
+
*/
|
|
6
|
+
declare function validateAcceptedOffers(params: {
|
|
7
|
+
object: {
|
|
8
|
+
acceptedOffer: IAcceptedOffer4COA[];
|
|
9
|
+
event: {
|
|
10
|
+
id: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
project: {
|
|
14
|
+
id: string;
|
|
15
|
+
};
|
|
16
|
+
}): (repos: {
|
|
17
|
+
offer: OfferRepo;
|
|
18
|
+
}) => Promise<{
|
|
19
|
+
acceptedOffers: IAcceptedOffer4COA[];
|
|
20
|
+
}>;
|
|
21
|
+
export { validateAcceptedOffers };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.validateAcceptedOffers = void 0;
|
|
13
|
+
const factory = require("../../../factory");
|
|
14
|
+
/**
|
|
15
|
+
* 受け入れらたオファーの内容を検証
|
|
16
|
+
*/
|
|
17
|
+
function validateAcceptedOffers(params) {
|
|
18
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
const offerIds = (Array.isArray(params.object.acceptedOffer))
|
|
20
|
+
? [...new Set(params.object.acceptedOffer.map((o) => o.id))]
|
|
21
|
+
: [];
|
|
22
|
+
let availableUnitPriceOffers = [];
|
|
23
|
+
// 指定された単価オファーを検索
|
|
24
|
+
if (offerIds.length > 0) {
|
|
25
|
+
availableUnitPriceOffers = yield repos.offer.search({
|
|
26
|
+
id: { $in: offerIds },
|
|
27
|
+
project: { id: { $eq: params.project.id } }
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
// 利用可能なチケットオファーであれば受け入れる
|
|
31
|
+
const acceptedOffers = params.object.acceptedOffer.map((acceptedOffer) => {
|
|
32
|
+
const availableUnitPriceOffer = availableUnitPriceOffers.find((unitPriceOffer) => unitPriceOffer.id === acceptedOffer.id);
|
|
33
|
+
if (availableUnitPriceOffer === undefined) {
|
|
34
|
+
throw new factory.errors.NotFound(factory.offerType.Offer, `${acceptedOffer.identifier} not found`);
|
|
35
|
+
}
|
|
36
|
+
const { additionalProperty, itemOffered, name, price, priceSpecification, ticketInfo } = acceptedOffer;
|
|
37
|
+
return Object.assign({ additionalProperty,
|
|
38
|
+
itemOffered,
|
|
39
|
+
name,
|
|
40
|
+
price,
|
|
41
|
+
priceSpecification,
|
|
42
|
+
ticketInfo,
|
|
43
|
+
// 以下属性については単価オファーから読む(2023-03-09~)
|
|
44
|
+
priceCurrency: availableUnitPriceOffer.priceCurrency, id: String(availableUnitPriceOffer.id), identifier: String(availableUnitPriceOffer.identifier), typeOf: availableUnitPriceOffer.typeOf }, (Array.isArray(availableUnitPriceOffer.eligibleMonetaryAmount))
|
|
45
|
+
? { eligibleMonetaryAmount: availableUnitPriceOffer.eligibleMonetaryAmount }
|
|
46
|
+
: undefined
|
|
47
|
+
// ↓互換性維持対応として
|
|
48
|
+
// ...{
|
|
49
|
+
// tslint:disable-next-line:no-suspicious-comment
|
|
50
|
+
// TODO itemOfferedに完全置き換え
|
|
51
|
+
// seatNumber: offer.seatNumber,
|
|
52
|
+
// tslint:disable-next-line:no-suspicious-comment
|
|
53
|
+
// TODO itemOfferedに完全置き換え
|
|
54
|
+
// seatSection: offer.seatSection
|
|
55
|
+
// }
|
|
56
|
+
);
|
|
57
|
+
});
|
|
58
|
+
return { acceptedOffers };
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
exports.validateAcceptedOffers = validateAcceptedOffers;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { MongoRepository as ActionRepo } from '../../repo/action';
|
|
2
2
|
import { MongoRepository as EventRepo } from '../../repo/event';
|
|
3
|
+
import { MongoRepository as OfferRepo } from '../../repo/offer';
|
|
3
4
|
import { MongoRepository as TransactionRepo } from '../../repo/transaction';
|
|
5
|
+
import { IAcceptedOffer4COA } from './eventServiceByCOA/factory';
|
|
4
6
|
import * as factory from '../../factory';
|
|
5
7
|
export import WebAPIIdentifier = factory.service.webAPI.Identifier;
|
|
6
8
|
export declare type IAuthorizeOperation<T> = (repos: {
|
|
7
9
|
action: ActionRepo;
|
|
8
10
|
event: EventRepo;
|
|
11
|
+
offer: OfferRepo;
|
|
9
12
|
transaction: TransactionRepo;
|
|
10
13
|
}) => Promise<T>;
|
|
11
14
|
export declare type IAuthorizeOfferAction = factory.action.authorize.offer.seatReservation.IAction<WebAPIIdentifier.COA>;
|
|
@@ -14,7 +17,7 @@ export declare type IAuthorizeOfferAction = factory.action.authorize.offer.seatR
|
|
|
14
17
|
*/
|
|
15
18
|
export declare function authorize(params: {
|
|
16
19
|
object: {
|
|
17
|
-
acceptedOffer:
|
|
20
|
+
acceptedOffer: IAcceptedOffer4COA[];
|
|
18
21
|
event: {
|
|
19
22
|
id: string;
|
|
20
23
|
};
|
|
@@ -68,7 +71,7 @@ export declare function cancel(params: {
|
|
|
68
71
|
export declare function changeOffers(params: {
|
|
69
72
|
id: string;
|
|
70
73
|
object: {
|
|
71
|
-
acceptedOffer:
|
|
74
|
+
acceptedOffer: IAcceptedOffer4COA[];
|
|
72
75
|
event: {
|
|
73
76
|
id: string;
|
|
74
77
|
};
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.changeOffers = exports.cancel = exports.authorize = exports.WebAPIIdentifier = void 0;
|
|
13
13
|
const moment = require("moment");
|
|
14
14
|
const factory_1 = require("./eventServiceByCOA/factory");
|
|
15
|
+
const validateAcceptedOffers_1 = require("./eventServiceByCOA/validateAcceptedOffers");
|
|
15
16
|
const factory = require("../../factory");
|
|
16
17
|
exports.WebAPIIdentifier = factory.service.webAPI.Identifier;
|
|
17
18
|
/**
|
|
@@ -32,31 +33,18 @@ function authorize(params) {
|
|
|
32
33
|
const screeningEvent = yield repos.event.findMinimizedIndividualEventById({
|
|
33
34
|
id: params.object.event.id
|
|
34
35
|
});
|
|
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
36
|
// COA仮予約後にリクエストが来る前提
|
|
54
|
-
|
|
37
|
+
// validate acceptedOffer(2023-03-09~)
|
|
38
|
+
// const acceptedOffer = params.object.acceptedOffer;
|
|
39
|
+
const { acceptedOffers } = yield (0, validateAcceptedOffers_1.validateAcceptedOffers)({
|
|
40
|
+
object: params.object,
|
|
41
|
+
project: { id: transaction.project.id }
|
|
42
|
+
})(repos);
|
|
55
43
|
const updTmpReserveSeatArgs = params.result.requestBody;
|
|
56
44
|
const updTmpReserveSeatResult = params.result.responseBody;
|
|
57
45
|
// 承認アクションを開始
|
|
58
46
|
const actionAttributes = (0, factory_1.createAuthorizeSeatReservationActionAttributes)({
|
|
59
|
-
acceptedOffers
|
|
47
|
+
acceptedOffers,
|
|
60
48
|
event: screeningEvent,
|
|
61
49
|
transaction: transaction
|
|
62
50
|
});
|
|
@@ -75,7 +63,7 @@ function authorize(params) {
|
|
|
75
63
|
throw error;
|
|
76
64
|
}
|
|
77
65
|
// 座席仮予約からオファー情報を生成する
|
|
78
|
-
const { price,
|
|
66
|
+
const { price, eligibleMonetaryAmount } = (0, factory_1.offers2resultPrice)(acceptedOffers);
|
|
79
67
|
const acceptedOffers4result = (0, factory_1.responseBody2acceptedOffers4result)({
|
|
80
68
|
responseBody: updTmpReserveSeatResult,
|
|
81
69
|
object: action.object,
|
|
@@ -85,13 +73,16 @@ function authorize(params) {
|
|
|
85
73
|
.toDate(),
|
|
86
74
|
totalPrice: price
|
|
87
75
|
});
|
|
88
|
-
const result = Object.assign({ price: price, priceCurrency: factory.priceCurrency.JPY,
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
76
|
+
const result = Object.assign({ price: price, priceCurrency: factory.priceCurrency.JPY,
|
|
77
|
+
// eligibleMonetaryAmountを使用(2023-03-08~)
|
|
78
|
+
// amount: (requiredPoint > 0)
|
|
79
|
+
// ? [{
|
|
80
|
+
// typeOf: 'MonetaryAmount',
|
|
81
|
+
// currency: 'Point',
|
|
82
|
+
// value: requiredPoint
|
|
83
|
+
// }]
|
|
84
|
+
// : [],
|
|
85
|
+
amount: eligibleMonetaryAmount, requestBody: updTmpReserveSeatArgs, responseBody: updTmpReserveSeatResult, acceptedOffers: acceptedOffers4result }, { updTmpReserveSeatArgs, updTmpReserveSeatResult } // 互換性維持のため
|
|
95
86
|
);
|
|
96
87
|
return yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: result });
|
|
97
88
|
});
|
|
@@ -128,15 +119,6 @@ function cancel(params) {
|
|
|
128
119
|
timeBegin: actionResult.requestBody.timeBegin,
|
|
129
120
|
tmpReserveNum: actionResult.responseBody.tmpReserveNum
|
|
130
121
|
};
|
|
131
|
-
// 座席仮予約削除
|
|
132
|
-
// await repos.reserveService.delTmpReserve({
|
|
133
|
-
// theaterCode: actionResult.requestBody.theaterCode,
|
|
134
|
-
// dateJouei: actionResult.requestBody.dateJouei,
|
|
135
|
-
// titleCode: actionResult.requestBody.titleCode,
|
|
136
|
-
// titleBranchNum: actionResult.requestBody.titleBranchNum,
|
|
137
|
-
// timeBegin: actionResult.requestBody.timeBegin,
|
|
138
|
-
// tmpReserveNum: actionResult.responseBody.tmpReserveNum
|
|
139
|
-
// });
|
|
140
122
|
}
|
|
141
123
|
return cancelResult;
|
|
142
124
|
});
|
|
@@ -168,45 +150,19 @@ function changeOffers(params) {
|
|
|
168
150
|
id: params.object.event.id
|
|
169
151
|
});
|
|
170
152
|
// COA仮予約後にリクエストが来る前提
|
|
171
|
-
|
|
172
|
-
//
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
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
|
-
// });
|
|
153
|
+
// validate acceptedOffer(2023-03-09~)
|
|
154
|
+
// const acceptedOffer = params.object.acceptedOffer;
|
|
155
|
+
const { acceptedOffers } = yield (0, validateAcceptedOffers_1.validateAcceptedOffers)({
|
|
156
|
+
object: params.object,
|
|
157
|
+
project: { id: transaction.project.id }
|
|
158
|
+
})(repos);
|
|
203
159
|
// 供給情報と価格を変更してからDB更新
|
|
204
|
-
authorizeAction.object.acceptedOffer =
|
|
160
|
+
authorizeAction.object.acceptedOffer = acceptedOffers;
|
|
205
161
|
const updTmpReserveSeatResult = (_a = authorizeAction.result) === null || _a === void 0 ? void 0 : _a.responseBody;
|
|
206
162
|
if (updTmpReserveSeatResult === undefined) {
|
|
207
163
|
throw new factory.errors.NotFound('action.result.responseBody');
|
|
208
164
|
}
|
|
209
|
-
const { price,
|
|
165
|
+
const { price, eligibleMonetaryAmount } = (0, factory_1.offers2resultPrice)(acceptedOffers);
|
|
210
166
|
const acceptedOffers4result = (0, factory_1.responseBody2acceptedOffers4result)({
|
|
211
167
|
responseBody: updTmpReserveSeatResult,
|
|
212
168
|
object: authorizeAction.object,
|
|
@@ -216,13 +172,16 @@ function changeOffers(params) {
|
|
|
216
172
|
.toDate(),
|
|
217
173
|
totalPrice: price
|
|
218
174
|
});
|
|
219
|
-
const actionResult = Object.assign(Object.assign({}, authorizeAction.result), { price: price,
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
175
|
+
const actionResult = Object.assign(Object.assign({}, authorizeAction.result), { price: price,
|
|
176
|
+
// eligibleMonetaryAmountを使用(2023-03-08~)
|
|
177
|
+
// amount: (requiredPoint > 0)
|
|
178
|
+
// ? [{
|
|
179
|
+
// typeOf: 'MonetaryAmount',
|
|
180
|
+
// currency: 'Point',
|
|
181
|
+
// value: requiredPoint
|
|
182
|
+
// }]
|
|
183
|
+
// : [],
|
|
184
|
+
amount: eligibleMonetaryAmount, acceptedOffers: acceptedOffers4result });
|
|
226
185
|
// 座席予約承認アクションの供給情報を変更する
|
|
227
186
|
return repos.action.updateAuthorizeEventOfferAction({
|
|
228
187
|
id: params.id,
|
|
@@ -78,7 +78,9 @@ function validateMovieTicket(params, paymentServiceId) {
|
|
|
78
78
|
throw new factory.errors.Argument('movieTickets', `${shortNumber} movie tickets by service type ${serviceType} short`);
|
|
79
79
|
}
|
|
80
80
|
});
|
|
81
|
-
|
|
81
|
+
// checkはするが保管は保留(2023-03-09~)
|
|
82
|
+
return;
|
|
83
|
+
// return checkResult;
|
|
82
84
|
});
|
|
83
85
|
}
|
|
84
86
|
exports.validateMovieTicket = validateMovieTicket;
|
|
@@ -69,9 +69,8 @@ function checkMovieTicket(params) {
|
|
|
69
69
|
paymentServiceId
|
|
70
70
|
})(repos);
|
|
71
71
|
// 一度認証されたMovieTicketをDBに記録する(後で検索しやすいように)→一旦保留
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
})));
|
|
72
|
+
// await Promise.all(checkResult.movieTickets.map(async (__) => {
|
|
73
|
+
// }));
|
|
75
74
|
}
|
|
76
75
|
catch (error) {
|
|
77
76
|
// actionにエラー結果を追加
|
package/package.json
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.
|
|
13
|
-
"@cinerino/sdk": "3.
|
|
12
|
+
"@chevre/factory": "4.299.0",
|
|
13
|
+
"@cinerino/sdk": "3.148.0",
|
|
14
14
|
"@motionpicture/coa-service": "9.2.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.2.0",
|
|
16
16
|
"@sendgrid/mail": "6.4.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.7.0-alpha.1"
|
|
124
124
|
}
|