@chevre/domain 20.4.0-alpha.14 → 20.4.0-alpha.16
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/aggregateEventReservation.ts +1 -1
- package/example/src/chevre/deleteMovieTicketCategoryChargePriceSpecs.ts +21 -0
- package/example/src/chevre/searchEventTicketOffers.ts +1 -1
- package/example/src/chevre/unsetUnnecessaryFields.ts +16 -10
- package/lib/chevre/repo/event.d.ts +5 -4
- package/lib/chevre/repo/event.js +2 -11
- package/lib/chevre/repo/priceSpecification.d.ts +10 -0
- package/lib/chevre/repo/priceSpecification.js +9 -0
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +43 -82
- package/lib/chevre/service/assetTransaction/pay.js +2 -3
- package/lib/chevre/service/payment/movieTicket.d.ts +7 -2
- package/lib/chevre/service/payment/movieTicket.js +17 -8
- package/lib/chevre/settings.d.ts +3 -0
- package/lib/chevre/settings.js +5 -1
- package/package.json +3 -3
|
@@ -16,7 +16,7 @@ async function main() {
|
|
|
16
16
|
|
|
17
17
|
// const now = new Date();
|
|
18
18
|
await chevre.service.aggregation.event.aggregateScreeningEvent({
|
|
19
|
-
id: '
|
|
19
|
+
id: 'blaqxj0ak'
|
|
20
20
|
})({
|
|
21
21
|
event: new chevre.repository.Event(mongoose.connection),
|
|
22
22
|
eventAvailability: new chevre.repository.itemAvailability.ScreeningEvent(client),
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as mongoose from 'mongoose';
|
|
3
|
+
|
|
4
|
+
import { chevre } from '../../../lib/index';
|
|
5
|
+
|
|
6
|
+
// const project = { id: String(process.env.PROJECT_ID) };
|
|
7
|
+
|
|
8
|
+
async function main() {
|
|
9
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
10
|
+
|
|
11
|
+
const priceSpecificationRepo = new chevre.repository.PriceSpecification(mongoose.connection);
|
|
12
|
+
|
|
13
|
+
const result = await priceSpecificationRepo.deleteUnnecessaryMovieTicketTypeChargePriceSpecs({
|
|
14
|
+
// project: { id: 'cinerino' }
|
|
15
|
+
});
|
|
16
|
+
console.log('deleted', result);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
main()
|
|
20
|
+
.then()
|
|
21
|
+
.catch(console.error);
|
|
@@ -22,7 +22,7 @@ async function main() {
|
|
|
22
22
|
const productRepo = new chevre.repository.Product(mongoose.connection);
|
|
23
23
|
|
|
24
24
|
const { ticketOffers } = await chevre.service.offer.event.searchEventTicketOffers({
|
|
25
|
-
event: { id: '
|
|
25
|
+
event: { id: 'ale5c99n2' },
|
|
26
26
|
onlyValid: true,
|
|
27
27
|
sort: false,
|
|
28
28
|
validateOfferRateLimit: true,
|
|
@@ -7,7 +7,8 @@ async function main() {
|
|
|
7
7
|
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
8
8
|
|
|
9
9
|
// const accountRepo = new chevre.repository.Account(mongoose.connection);
|
|
10
|
-
const permitRepo = new chevre.repository.ServiceOutput(mongoose.connection);
|
|
10
|
+
// const permitRepo = new chevre.repository.ServiceOutput(mongoose.connection);
|
|
11
|
+
const eventRepo = new chevre.repository.Event(mongoose.connection);
|
|
11
12
|
|
|
12
13
|
let updateResult: any;
|
|
13
14
|
// updateResult = await accountRepo.unsetUnnecessaryFields({
|
|
@@ -15,16 +16,21 @@ async function main() {
|
|
|
15
16
|
// $unset: { status: 1 }
|
|
16
17
|
// });
|
|
17
18
|
// console.log('accounts unset.', updateResult);
|
|
18
|
-
updateResult = await permitRepo.unsetUnnecessaryFields({
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
});
|
|
22
|
-
console.log('permits unset', updateResult);
|
|
23
|
-
updateResult = await permitRepo.unsetUnnecessaryFields({
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
// updateResult = await permitRepo.unsetUnnecessaryFields({
|
|
20
|
+
// filter: { 'paymentAccount.project': { $exists: true } },
|
|
21
|
+
// $unset: { 'paymentAccount.project': 1 }
|
|
22
|
+
// });
|
|
23
|
+
// console.log('permits unset', updateResult);
|
|
24
|
+
// updateResult = await permitRepo.unsetUnnecessaryFields({
|
|
25
|
+
// filter: { 'issuedThrough.project': { $exists: true } },
|
|
26
|
+
// $unset: { 'issuedThrough.project': 1 }
|
|
27
|
+
// });
|
|
28
|
+
// console.log('permits unset', updateResult);
|
|
29
|
+
updateResult = await eventRepo.unsetUnnecessaryFields({
|
|
30
|
+
filter: { hasOfferCatalog: { $exists: true } },
|
|
31
|
+
$unset: { hasOfferCatalog: 1 }
|
|
26
32
|
});
|
|
27
|
-
console.log('
|
|
33
|
+
console.log('events unset', updateResult);
|
|
28
34
|
}
|
|
29
35
|
|
|
30
36
|
main()
|
|
@@ -10,7 +10,7 @@ export interface IUpdateAggregateReservationParams {
|
|
|
10
10
|
$set: {
|
|
11
11
|
updatedAt: Date;
|
|
12
12
|
aggregateReservation: factory.event.screeningEvent.IAggregateReservation;
|
|
13
|
-
aggregateOffer
|
|
13
|
+
aggregateOffer?: factory.event.screeningEvent.IAggregateOffer;
|
|
14
14
|
maximumAttendeeCapacity?: number;
|
|
15
15
|
remainingAttendeeCapacity?: number;
|
|
16
16
|
checkInCount?: number;
|
|
@@ -141,9 +141,10 @@ export declare class MongoRepository {
|
|
|
141
141
|
}, update: IUpdateAggregateReservationParams | IUpdateAggregateUseActionsParams): Promise<factory.event.IEvent<T>>;
|
|
142
142
|
bulkWrite(bulkWriteOps: any[]): Promise<BulkWriteOpResultObject>;
|
|
143
143
|
getCursor(conditions: any, projection: any): import("mongoose").QueryCursor<any>;
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
144
|
+
unsetUnnecessaryFields(params: {
|
|
145
|
+
filter: any;
|
|
146
|
+
$unset: any;
|
|
147
|
+
}): Promise<import("mongoose").UpdateWriteOpResult>;
|
|
147
148
|
aggregateEvent(params: {
|
|
148
149
|
project?: {
|
|
149
150
|
id?: {
|
package/lib/chevre/repo/event.js
CHANGED
|
@@ -751,18 +751,9 @@ class MongoRepository {
|
|
|
751
751
|
.sort({ startDate: factory.sortType.Descending })
|
|
752
752
|
.cursor();
|
|
753
753
|
}
|
|
754
|
-
|
|
754
|
+
unsetUnnecessaryFields(params) {
|
|
755
755
|
return __awaiter(this, void 0, void 0, function* () {
|
|
756
|
-
|
|
757
|
-
_id: { $eq: params.id }
|
|
758
|
-
}, {
|
|
759
|
-
$unset: {
|
|
760
|
-
'location.project': 1,
|
|
761
|
-
'workPerformed.project': 1,
|
|
762
|
-
'superEvent.location.project': 1,
|
|
763
|
-
'superEvent.workPerformed.project': 1
|
|
764
|
-
}
|
|
765
|
-
})
|
|
756
|
+
return this.eventModel.updateMany(params.filter, { $unset: params.$unset })
|
|
766
757
|
.exec();
|
|
767
758
|
});
|
|
768
759
|
}
|
|
@@ -30,5 +30,15 @@ export declare class MongoRepository {
|
|
|
30
30
|
id: string;
|
|
31
31
|
};
|
|
32
32
|
}): Promise<void>;
|
|
33
|
+
deleteUnnecessaryMovieTicketTypeChargePriceSpecs(params: {
|
|
34
|
+
project?: {
|
|
35
|
+
id?: string;
|
|
36
|
+
};
|
|
37
|
+
}): Promise<{
|
|
38
|
+
ok?: number | undefined;
|
|
39
|
+
n?: number | undefined;
|
|
40
|
+
} & {
|
|
41
|
+
deletedCount?: number | undefined;
|
|
42
|
+
}>;
|
|
33
43
|
getCursor(conditions: any, projection: any): import("mongoose").QueryCursor<any>;
|
|
34
44
|
}
|
|
@@ -277,6 +277,15 @@ class MongoRepository {
|
|
|
277
277
|
.exec();
|
|
278
278
|
});
|
|
279
279
|
}
|
|
280
|
+
deleteUnnecessaryMovieTicketTypeChargePriceSpecs(params) {
|
|
281
|
+
var _a;
|
|
282
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
283
|
+
return this.priceSpecificationModel.deleteMany(Object.assign({ typeOf: { $eq: factory.priceSpecificationType.MovieTicketTypeChargeSpecification }, price: { $eq: 0 } }, (typeof ((_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === 'string')
|
|
284
|
+
? { 'project.id': { $eq: params.project.id } }
|
|
285
|
+
: undefined))
|
|
286
|
+
.exec();
|
|
287
|
+
});
|
|
288
|
+
}
|
|
280
289
|
getCursor(conditions, projection) {
|
|
281
290
|
return this.priceSpecificationModel.find(conditions, projection)
|
|
282
291
|
.sort({ price: factory.sortType.Ascending })
|
|
@@ -17,6 +17,7 @@ const createDebug = require("debug");
|
|
|
17
17
|
const moment = require("moment-timezone");
|
|
18
18
|
const event_1 = require("../../../repo/event");
|
|
19
19
|
const factory = require("../../../factory");
|
|
20
|
+
const settings_1 = require("../../../settings");
|
|
20
21
|
const debug = createDebug('chevre-domain:service');
|
|
21
22
|
/**
|
|
22
23
|
* イベントデータをID指定で集計する
|
|
@@ -28,31 +29,34 @@ function aggregateScreeningEvent(params) {
|
|
|
28
29
|
// const event = await repos.event.findById<factory.eventType.ScreeningEvent | factory.eventType.Event>(params);
|
|
29
30
|
const event = yield repos.event.findMinimizedIndividualEventById(params);
|
|
30
31
|
let aggregatingEvents = [event];
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
32
|
+
// プロジェクト限定(2023-02-22~)
|
|
33
|
+
if (settings_1.settings.useOfferRateLimitProjects.includes(event.project.id)) {
|
|
34
|
+
const availableOffers = yield findOffers({ event })(repos);
|
|
35
|
+
const offerRateLimitExists = availableOffers.some((o) => { var _a; return typeof ((_a = o.validRateLimit) === null || _a === void 0 ? void 0 : _a.scope) === 'string'; });
|
|
36
|
+
if (offerRateLimitExists) {
|
|
37
|
+
// 同location、かつ同時間帯、のイベントに関しても集計する(ttts暫定対応)
|
|
38
|
+
const startFrom = moment(event.startDate)
|
|
39
|
+
.startOf('hour')
|
|
40
|
+
.toDate();
|
|
41
|
+
const startThrough = moment(startFrom)
|
|
42
|
+
.add(1, 'hour')
|
|
43
|
+
.add(-1, 'second')
|
|
44
|
+
.toDate();
|
|
45
|
+
// 取得属性最適化(2023-01-25~)
|
|
46
|
+
aggregatingEvents = yield repos.event.search({
|
|
47
|
+
limit: 100,
|
|
48
|
+
page: 1,
|
|
49
|
+
project: { id: { $eq: event.project.id } },
|
|
50
|
+
typeOf: event.typeOf,
|
|
51
|
+
eventStatuses: [factory.eventStatusType.EventScheduled],
|
|
52
|
+
startFrom: startFrom,
|
|
53
|
+
startThrough: startThrough,
|
|
54
|
+
location: { branchCode: { $eq: event.location.branchCode } }
|
|
55
|
+
}, event_1.PROJECTION_MINIMIZED_EVENT);
|
|
56
|
+
// ID指定されたイベントについてはEventScheduledでなくても集計したいので、集計対象を調整
|
|
57
|
+
aggregatingEvents = aggregatingEvents.filter((e) => e.id !== event.id);
|
|
58
|
+
aggregatingEvents = [event, ...aggregatingEvents];
|
|
59
|
+
}
|
|
56
60
|
}
|
|
57
61
|
debug(aggregatingEvents.length, 'aggregatingEvents found', aggregatingEvents.map((e) => e.id));
|
|
58
62
|
for (const aggregatingEvent of aggregatingEvents) {
|
|
@@ -79,41 +83,29 @@ function aggregateByEvent(params) {
|
|
|
79
83
|
branchCode: { $eq: event.location.branchCode },
|
|
80
84
|
containedInPlace: { id: { $eq: movieTheaterId } }
|
|
81
85
|
});
|
|
82
|
-
// 施設取得
|
|
83
|
-
// const movieTheater = await findLocation(params)(repos);
|
|
84
|
-
// // 万が一施設が存在しなければ処理終了
|
|
85
|
-
// if (movieTheater === undefined) {
|
|
86
|
-
// return;
|
|
87
|
-
// }
|
|
88
|
-
// const screeningRoom = <factory.place.screeningRoom.IPlace | undefined>
|
|
89
|
-
// movieTheater.containsPlace.find((p) => p.branchCode === event.location.branchCode);
|
|
90
|
-
// if (screeningRoom === undefined) {
|
|
91
|
-
// // 基本的にありえないはずだが、万が一スクリーンが見つからなければcapacityは0のまま
|
|
92
|
-
// // tslint:disable-next-line:no-console
|
|
93
|
-
// console.error(new Error(`Screening room not found. branchCode: ${event.location.branchCode}`));
|
|
94
|
-
// return;
|
|
95
|
-
// }
|
|
96
86
|
// 予約集計
|
|
97
87
|
const { maximumAttendeeCapacity, remainingAttendeeCapacity, aggregateReservation } = yield aggregateReservationByEvent({
|
|
98
88
|
aggregateDate: now,
|
|
99
89
|
event: event,
|
|
100
90
|
screeningRoom: screeningRoom
|
|
101
91
|
})(repos);
|
|
92
|
+
// プロジェクト限定(2023-02-22~)
|
|
102
93
|
// オファーごとの集計
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
94
|
+
let aggregateOffer;
|
|
95
|
+
if (settings_1.settings.useAggregateOfferProjects.includes(event.project.id)) {
|
|
96
|
+
aggregateOffer = yield aggregateOfferByEvent({
|
|
97
|
+
aggregateDate: now,
|
|
98
|
+
event: Object.assign(Object.assign({}, event), { maximumAttendeeCapacity,
|
|
99
|
+
remainingAttendeeCapacity }),
|
|
100
|
+
screeningRoom: screeningRoom
|
|
101
|
+
})(repos);
|
|
102
|
+
debug('offers aggregated', aggregateOffer);
|
|
103
|
+
}
|
|
110
104
|
// 値がundefinedの場合に更新しないように注意
|
|
111
105
|
const update = {
|
|
112
|
-
$set: Object.assign(Object.assign(Object.assign(Object.assign({ updatedAt: new Date(), // $setオブジェクトが空だとMongoエラーになるので
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
aggregateOffer }, (maximumAttendeeCapacity !== undefined) ? { maximumAttendeeCapacity: maximumAttendeeCapacity } : undefined), (remainingAttendeeCapacity !== undefined) ? { remainingAttendeeCapacity: remainingAttendeeCapacity } : undefined), (aggregateReservation.checkInCount !== undefined) ? { checkInCount: aggregateReservation.checkInCount } : undefined), (aggregateReservation.attendeeCount !== undefined) ? { attendeeCount: aggregateReservation.attendeeCount } : undefined),
|
|
116
|
-
$unset: Object.assign(Object.assign({ noExistingAttributeName: 1 }, (maximumAttendeeCapacity === undefined) ? { maximumAttendeeCapacity: '' } : undefined), (remainingAttendeeCapacity === undefined) ? { remainingAttendeeCapacity: '' } : undefined)
|
|
106
|
+
$set: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ updatedAt: new Date(), // $setオブジェクトが空だとMongoエラーになるので
|
|
107
|
+
aggregateReservation }, (typeof (aggregateOffer === null || aggregateOffer === void 0 ? void 0 : aggregateOffer.typeOf) === 'string') ? { aggregateOffer: aggregateOffer } : undefined), (maximumAttendeeCapacity !== undefined) ? { maximumAttendeeCapacity: maximumAttendeeCapacity } : undefined), (remainingAttendeeCapacity !== undefined) ? { remainingAttendeeCapacity: remainingAttendeeCapacity } : undefined), (aggregateReservation.checkInCount !== undefined) ? { checkInCount: aggregateReservation.checkInCount } : undefined), (aggregateReservation.attendeeCount !== undefined) ? { attendeeCount: aggregateReservation.attendeeCount } : undefined),
|
|
108
|
+
$unset: Object.assign(Object.assign(Object.assign({ noExistingAttributeName: 1 }, (typeof (aggregateOffer === null || aggregateOffer === void 0 ? void 0 : aggregateOffer.typeOf) !== 'string') ? { aggregateOffer: '' } : undefined), (maximumAttendeeCapacity === undefined) ? { maximumAttendeeCapacity: '' } : undefined), (remainingAttendeeCapacity === undefined) ? { remainingAttendeeCapacity: '' } : undefined)
|
|
117
109
|
};
|
|
118
110
|
debug('update:', update);
|
|
119
111
|
// 保管
|
|
@@ -125,37 +117,6 @@ function aggregateByEvent(params) {
|
|
|
125
117
|
});
|
|
126
118
|
}
|
|
127
119
|
exports.aggregateByEvent = aggregateByEvent;
|
|
128
|
-
/**
|
|
129
|
-
* イベントロケーション取得
|
|
130
|
-
* NotFoundエラーをハンドリングする
|
|
131
|
-
*/
|
|
132
|
-
// function findLocation(params: {
|
|
133
|
-
// event: factory.event.screeningEvent.IEvent | factory.event.event.IEvent;
|
|
134
|
-
// }) {
|
|
135
|
-
// return async (repos: {
|
|
136
|
-
// place: PlaceRepo;
|
|
137
|
-
// }): Promise<factory.place.movieTheater.IPlace | undefined> => {
|
|
138
|
-
// let movieTheater: factory.place.movieTheater.IPlace | undefined;
|
|
139
|
-
// try {
|
|
140
|
-
// if (params.event.typeOf === factory.eventType.ScreeningEvent) {
|
|
141
|
-
// movieTheater = await repos.place.findById({ id: params.event.superEvent.location.id });
|
|
142
|
-
// } else {
|
|
143
|
-
// const movieTheaterId: string =
|
|
144
|
-
// String(params.event.offers?.itemOffered.availableChannel.serviceLocation.containedInPlace.id);
|
|
145
|
-
// movieTheater = await repos.place.findById({ id: movieTheaterId });
|
|
146
|
-
// }
|
|
147
|
-
// } catch (error) {
|
|
148
|
-
// let throwsError = true;
|
|
149
|
-
// if (error instanceof factory.errors.NotFound) {
|
|
150
|
-
// throwsError = false;
|
|
151
|
-
// }
|
|
152
|
-
// if (throwsError) {
|
|
153
|
-
// throw error;
|
|
154
|
-
// }
|
|
155
|
-
// }
|
|
156
|
-
// return movieTheater;
|
|
157
|
-
// };
|
|
158
|
-
// }
|
|
159
120
|
/**
|
|
160
121
|
* 集計後アクション
|
|
161
122
|
*/
|
|
@@ -269,11 +269,10 @@ function processAuthorizeCreditCard(params, transaction, paymentServiceId) {
|
|
|
269
269
|
}
|
|
270
270
|
function processAuthorizeMovieTicket(params, transaction, paymentServiceId) {
|
|
271
271
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
272
|
-
|
|
273
|
-
const authorizeResult = yield MovieTicketPayment.authorize(params, transaction, paymentServiceId)(repos);
|
|
272
|
+
const { accountId, checkResult, payAction } = yield MovieTicketPayment.authorize(params, transaction, paymentServiceId)(repos);
|
|
274
273
|
return saveAuthorizeResult({
|
|
275
274
|
id: transaction.id,
|
|
276
|
-
update: Object.assign({ 'object.accountId':
|
|
275
|
+
update: Object.assign({ 'object.accountId': accountId, 'object.paymentMethod.accountId': accountId, 'object.payAction': payAction }, (checkResult !== undefined) ? { 'object.checkResult': checkResult } : undefined)
|
|
277
276
|
})(repos);
|
|
278
277
|
});
|
|
279
278
|
}
|
|
@@ -57,9 +57,14 @@ declare function checkByIdentifier(params: {
|
|
|
57
57
|
project: ProjectRepo;
|
|
58
58
|
}) => Promise<ICheckResult>;
|
|
59
59
|
interface IAuthorizeResult {
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
accountId: string;
|
|
61
|
+
checkResult?: ICheckResult;
|
|
62
|
+
payAction: factory.action.trade.pay.IAction;
|
|
62
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* MovieTicket承認
|
|
66
|
+
* オーソリサービスが存在するわけではないので、実質着券する
|
|
67
|
+
*/
|
|
63
68
|
declare function authorize(params: factory.assetTransaction.pay.IStartParamsWithoutDetail, transaction: factory.assetTransaction.pay.ITransaction, paymentServiceId: string): (repos: {
|
|
64
69
|
action: ActionRepo;
|
|
65
70
|
accountingReport: AccountingReportRepo;
|
|
@@ -17,6 +17,7 @@ const surfrock = require("@surfrock/sdk");
|
|
|
17
17
|
const moment = require("moment-timezone");
|
|
18
18
|
const credentials_1 = require("../../credentials");
|
|
19
19
|
const factory = require("../../factory");
|
|
20
|
+
const settings_1 = require("../../settings");
|
|
20
21
|
const factory_1 = require("./movieTicket/factory");
|
|
21
22
|
const validation_1 = require("../assetTransaction/pay/movieTicket/validation");
|
|
22
23
|
const errorHandler_1 = require("../../errorHandler");
|
|
@@ -258,14 +259,22 @@ function purchaseNumberAuthResult2movieTickets(params) {
|
|
|
258
259
|
}
|
|
259
260
|
return movieTickets;
|
|
260
261
|
}
|
|
262
|
+
/**
|
|
263
|
+
* MovieTicket承認
|
|
264
|
+
* オーソリサービスが存在するわけではないので、実質着券する
|
|
265
|
+
*/
|
|
261
266
|
function authorize(params, transaction, paymentServiceId) {
|
|
262
267
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
263
268
|
var _a, _b;
|
|
269
|
+
let accountId;
|
|
264
270
|
let checkResult;
|
|
265
271
|
let payAction;
|
|
266
272
|
try {
|
|
267
|
-
//
|
|
268
|
-
|
|
273
|
+
// オプション追加(2023-02-24~)
|
|
274
|
+
if (settings_1.settings.useCheckMovieTicketBeforePay) {
|
|
275
|
+
// MovieTicket決済の場合、認証
|
|
276
|
+
checkResult = yield (0, validation_1.validateMovieTicket)(params, paymentServiceId)(repos);
|
|
277
|
+
}
|
|
269
278
|
const paymentMethod = transaction.object.paymentMethod;
|
|
270
279
|
const paymentMethodType = String(paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.typeOf);
|
|
271
280
|
const additionalProperty = paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.additionalProperty;
|
|
@@ -273,7 +282,10 @@ function authorize(params, transaction, paymentServiceId) {
|
|
|
273
282
|
? paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.paymentMethodId
|
|
274
283
|
: transaction.id;
|
|
275
284
|
const paymentMethodName = (typeof (paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.name) === 'string') ? paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.name : paymentMethodType;
|
|
276
|
-
|
|
285
|
+
accountId = (Array.isArray(paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.movieTickets)) ? (_a = paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.movieTickets[0]) === null || _a === void 0 ? void 0 : _a.identifier : undefined;
|
|
286
|
+
if (typeof accountId !== 'string' || accountId.length === 0) {
|
|
287
|
+
throw new factory.errors.ArgumentNull('object.paymentMethod.movieTickets.identifier');
|
|
288
|
+
}
|
|
277
289
|
const payObject = {
|
|
278
290
|
typeOf: factory.service.paymentService.PaymentServiceType.MovieTicket,
|
|
279
291
|
id: paymentServiceId,
|
|
@@ -284,10 +296,7 @@ function authorize(params, transaction, paymentServiceId) {
|
|
|
284
296
|
}, typeOf: paymentMethodType }, (typeof accountId === 'string') ? { accountId } : undefined),
|
|
285
297
|
movieTickets: paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.movieTickets
|
|
286
298
|
};
|
|
287
|
-
const payActionAttributes = Object.assign({ project: transaction.project, typeOf: factory.actionType.PayAction, object: [payObject],
|
|
288
|
-
// agent:Projectに変更(2022-05-19~)
|
|
289
|
-
// agent: transaction.agent,
|
|
290
|
-
agent: transaction.project, recipient: transaction.recipient }, (params.purpose !== undefined)
|
|
299
|
+
const payActionAttributes = Object.assign({ project: transaction.project, typeOf: factory.actionType.PayAction, object: [payObject], agent: transaction.project, recipient: transaction.recipient }, (params.purpose !== undefined)
|
|
291
300
|
? { purpose: params.purpose }
|
|
292
301
|
: { purpose: { typeOf: transaction.typeOf, transactionNumber: transaction.transactionNumber, id: transaction.id } });
|
|
293
302
|
// 着券させざるをえないが、informPaymentはしない(注文がまだ存在しないため)
|
|
@@ -296,7 +305,7 @@ function authorize(params, transaction, paymentServiceId) {
|
|
|
296
305
|
catch (error) {
|
|
297
306
|
throw (0, errorHandler_1.handleMvtkReserveError)(error);
|
|
298
307
|
}
|
|
299
|
-
return
|
|
308
|
+
return { accountId, checkResult, payAction };
|
|
300
309
|
});
|
|
301
310
|
}
|
|
302
311
|
exports.authorize = authorize;
|
package/lib/chevre/settings.d.ts
CHANGED
|
@@ -24,6 +24,9 @@ export declare type ISettings = factory.project.ISettings & {
|
|
|
24
24
|
useEventWorkPerformed: boolean;
|
|
25
25
|
useOffersAppliedToMovieTicketWithoutChargeSpecification: boolean;
|
|
26
26
|
useAggregateEntranceGateProjects: string[];
|
|
27
|
+
useAggregateOfferProjects: string[];
|
|
28
|
+
useOfferRateLimitProjects: string[];
|
|
29
|
+
useCheckMovieTicketBeforePay: boolean;
|
|
27
30
|
};
|
|
28
31
|
export declare const DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD: string;
|
|
29
32
|
export declare const USE_ASSET_TRANSACTION_SYNC_PROCESSING: boolean;
|
package/lib/chevre/settings.js
CHANGED
|
@@ -96,4 +96,8 @@ exports.settings = Object.assign(Object.assign({ transactionWebhookUrls, onOrder
|
|
|
96
96
|
? { maxNumCreditCardPaymentMethod: MAX_NUM_CREDIT_CARD_PAYMENT_METHOD }
|
|
97
97
|
: undefined), { useEventWorkPerformed: process.env.USE_EVENT_WORK_PERFORMED === '1', useOffersAppliedToMovieTicketWithoutChargeSpecification: process.env.USE_OFFERS_APPLIED_TO_MOVIE_TICKET_WITHOUT_PRICE_SPEC === '1', useAggregateEntranceGateProjects: (typeof process.env.USE_AGGREGATE_ENTRANCE_GATE_PROJECTS === 'string')
|
|
98
98
|
? process.env.USE_AGGREGATE_ENTRANCE_GATE_PROJECTS.split(',')
|
|
99
|
-
: []
|
|
99
|
+
: [], useAggregateOfferProjects: (typeof process.env.USE_AGGREGATE_OFFER_PROJECTS === 'string')
|
|
100
|
+
? process.env.USE_AGGREGATE_OFFER_PROJECTS.split(',')
|
|
101
|
+
: [], useOfferRateLimitProjects: (typeof process.env.USE_OFFER_RATE_LIMIT_PROJECTS === 'string')
|
|
102
|
+
? process.env.USE_OFFER_RATE_LIMIT_PROJECTS.split(',')
|
|
103
|
+
: [], useCheckMovieTicketBeforePay: process.env.USE_CHECK_MOVIE_TICKET_BEFORE_PAY === '1' });
|
package/package.json
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.289.0-alpha.
|
|
13
|
-
"@cinerino/sdk": "3.140.0-alpha.
|
|
12
|
+
"@chevre/factory": "4.289.0-alpha.12",
|
|
13
|
+
"@cinerino/sdk": "3.140.0-alpha.14",
|
|
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.4.0-alpha.
|
|
123
|
+
"version": "20.4.0-alpha.16"
|
|
124
124
|
}
|