@chevre/domain 21.25.0-alpha.8 → 21.25.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/migrateDeleteTransactionTasks.ts +2 -2
- package/example/src/chevre/migrateScreeningEventSeriesOffers.ts +87 -0
- package/example/src/chevre/searchScreeningEventSeries.ts +35 -0
- package/example/src/chevre/unsetUnnecessaryFields.ts +7 -8
- package/example/src/chevre/upsertScreeningEventSeriesByVersion.ts +0 -2
- package/lib/chevre/emailMessageBuilder.d.ts +0 -1
- package/lib/chevre/factory/event.js +7 -4
- package/lib/chevre/factory/order.d.ts +0 -8
- package/lib/chevre/factory/order.js +1 -26
- package/lib/chevre/repo/event.d.ts +3 -3
- package/lib/chevre/repo/mongoose/schemas/event.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/event.js +18 -15
- package/lib/chevre/service/aggregation/event/findEventOffers.d.ts +1 -1
- package/lib/chevre/service/aggregation/event/findEventOffers.js +1 -1
- package/lib/chevre/service/assetTransaction/reserve/factory/price.js +1 -1
- package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/reserve.js +1 -6
- package/lib/chevre/service/delivery.js +9 -18
- package/lib/chevre/service/event/createEvent.js +2 -1
- package/lib/chevre/service/event.js +33 -24
- package/lib/chevre/service/offer/event/authorize.d.ts +3 -2
- package/lib/chevre/service/offer/event/authorize.js +10 -20
- package/lib/chevre/service/offer/event/cancel.d.ts +1 -1
- package/lib/chevre/service/offer/event/cancel.js +1 -1
- package/lib/chevre/service/offer/event/factory.d.ts +6 -5
- package/lib/chevre/service/offer/event/factory.js +22 -36
- package/lib/chevre/service/offer/event/processStartReserve4chevre.d.ts +3 -3
- package/lib/chevre/service/offer/event/processStartReserve4chevre.js +6 -13
- package/lib/chevre/service/offer/event/voidTransaction.d.ts +1 -1
- package/lib/chevre/service/offer/event/voidTransaction.js +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.d.ts +1 -0
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +7 -4
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.d.ts +1 -0
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +3 -2
- package/lib/chevre/service/offer/eventServiceByCOA/factory.d.ts +2 -1
- package/lib/chevre/service/offer/eventServiceByCOA/factory.js +19 -10
- package/lib/chevre/service/offer/product/factory.js +11 -13
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.js +8 -8
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.js +8 -8
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.js +8 -8
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.js +18 -116
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +8 -8
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +8 -8
- package/lib/chevre/service/order/placeOrder.js +14 -15
- package/lib/chevre/service/order/returnOrder.js +7 -7
- package/lib/chevre/service/order/sendOrder.js +8 -8
- package/lib/chevre/service/payment/any/factory.js +11 -10
- package/lib/chevre/service/task/createAccountingReport.js +6 -6
- package/lib/chevre/service/task/returnPayTransaction.js +7 -7
- package/lib/chevre/service/task/returnReserveTransaction.js +3 -4
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/givePointAward.js +13 -8
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/sendEmailMessage.js +8 -8
- package/lib/chevre/service/transaction/placeOrderInProgress/result/orderedItem.d.ts +10 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/result/orderedItem.js +112 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/result.js +2 -16
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +41 -26
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPointAward.js +10 -11
- package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.js +7 -7
- package/lib/chevre/service/transaction/returnOrder/potentialActions.js +7 -7
- package/lib/chevre/settings.d.ts +0 -1
- package/lib/chevre/settings.js +1 -2
- package/package.json +4 -4
- package/example/src/chevre/migrateMovieAvailabilityStarts.ts +0 -83
- package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.d.ts +0 -16
- package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +0 -144
|
@@ -20,11 +20,11 @@ async function main() {
|
|
|
20
20
|
runsAt: {
|
|
21
21
|
$gte: moment()
|
|
22
22
|
// tslint:disable-next-line:no-magic-numbers
|
|
23
|
-
.add(
|
|
23
|
+
.add(299, 'days')
|
|
24
24
|
.toDate(),
|
|
25
25
|
$lte: moment()
|
|
26
26
|
// tslint:disable-next-line:no-magic-numbers
|
|
27
|
-
.add(
|
|
27
|
+
.add(330, 'days')
|
|
28
28
|
.toDate()
|
|
29
29
|
}
|
|
30
30
|
// _id: { $eq: '64aba5f37b8b8ef9eca60be5' }
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as moment from 'moment';
|
|
3
|
+
import * as mongoose from 'mongoose';
|
|
4
|
+
|
|
5
|
+
import { chevre } from '../../../lib/index';
|
|
6
|
+
|
|
7
|
+
// const project = { id: String(process.env.PROJECT_ID) };
|
|
8
|
+
const EXCLUDED_PROJECT_ID = process.env.EXCLUDED_PROJECT_ID;
|
|
9
|
+
|
|
10
|
+
// tslint:disable-next-line:max-func-body-length
|
|
11
|
+
async function main() {
|
|
12
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
13
|
+
|
|
14
|
+
const eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
|
|
15
|
+
|
|
16
|
+
const cursor = eventRepo.getCursor(
|
|
17
|
+
{
|
|
18
|
+
typeOf: { $eq: chevre.factory.eventType.ScreeningEventSeries },
|
|
19
|
+
// typeOf: { $eq: chevre.factory.eventType.ScreeningEvent },
|
|
20
|
+
'project.id': { $ne: EXCLUDED_PROJECT_ID }
|
|
21
|
+
// 'offers.availabilityEnds': { $exists: true }
|
|
22
|
+
},
|
|
23
|
+
{}
|
|
24
|
+
);
|
|
25
|
+
console.log('events found');
|
|
26
|
+
|
|
27
|
+
let i = 0;
|
|
28
|
+
let updateCount = 0;
|
|
29
|
+
const projectIds: string[] = [];
|
|
30
|
+
let createdAtLatest: Date | undefined;
|
|
31
|
+
let updatedAtLatest: Date | undefined;
|
|
32
|
+
await cursor.eachAsync(async (doc) => {
|
|
33
|
+
i += 1;
|
|
34
|
+
const event: chevre.factory.event.screeningEventSeries.IEvent = doc.toObject();
|
|
35
|
+
|
|
36
|
+
const unacceptedPaymentMethod = event.offers?.unacceptedPaymentMethod;
|
|
37
|
+
const alreadyMigrated =
|
|
38
|
+
(!Array.isArray(unacceptedPaymentMethod))
|
|
39
|
+
|| (Array.isArray(unacceptedPaymentMethod) && unacceptedPaymentMethod.length === 0)
|
|
40
|
+
|| (Array.isArray(unacceptedPaymentMethod) && unacceptedPaymentMethod.length === 1 && unacceptedPaymentMethod[0] === 'MovieTicket');
|
|
41
|
+
|
|
42
|
+
if (alreadyMigrated) {
|
|
43
|
+
console.log(
|
|
44
|
+
'already migrated.', event.project.id, event.id, event.startDate, i);
|
|
45
|
+
} else {
|
|
46
|
+
projectIds.push(event.project.id);
|
|
47
|
+
if (createdAtLatest instanceof Date) {
|
|
48
|
+
if (moment(createdAtLatest)
|
|
49
|
+
.isBefore(moment((<any>event).createdAt))) {
|
|
50
|
+
createdAtLatest = (<any>event).createdAt;
|
|
51
|
+
}
|
|
52
|
+
} else {
|
|
53
|
+
createdAtLatest = (<any>event).createdAt;
|
|
54
|
+
}
|
|
55
|
+
if (updatedAtLatest instanceof Date) {
|
|
56
|
+
if (moment(updatedAtLatest)
|
|
57
|
+
.isBefore(moment((<any>event).updatedAt))) {
|
|
58
|
+
updatedAtLatest = (<any>event).updatedAt;
|
|
59
|
+
}
|
|
60
|
+
} else {
|
|
61
|
+
updatedAtLatest = (<any>event).updatedAt;
|
|
62
|
+
}
|
|
63
|
+
console.log(
|
|
64
|
+
'updating event...', event.project.id, event.id, event.startDate, unacceptedPaymentMethod,
|
|
65
|
+
(<any>event).createdAt,
|
|
66
|
+
(<any>event).updatedAt,
|
|
67
|
+
i
|
|
68
|
+
);
|
|
69
|
+
// await creativeWorkRepo.saveMovie(<any>{
|
|
70
|
+
// id: String(movie.id),
|
|
71
|
+
// 'offers.availabilityStarts': availabilityStarts
|
|
72
|
+
// });
|
|
73
|
+
updateCount += 1;
|
|
74
|
+
console.log('updated.', event.project.id, event.id, event.startDate, i);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
console.log(i, 'events checked');
|
|
79
|
+
console.log(updateCount, 'events updated');
|
|
80
|
+
console.log('projectIds:', [...new Set(projectIds)]);
|
|
81
|
+
console.log('createdAtLatest:', createdAtLatest);
|
|
82
|
+
console.log('updatedAtLatest:', updatedAtLatest);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
main()
|
|
86
|
+
.then()
|
|
87
|
+
.catch(console.error);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as mongoose from 'mongoose';
|
|
3
|
+
|
|
4
|
+
const startTime = process.hrtime();
|
|
5
|
+
import { chevre } from '../../../lib/index';
|
|
6
|
+
const diff = process.hrtime(startTime);
|
|
7
|
+
console.log(`importing chevre took ${diff[0]} seconds and ${diff[1]} nanoseconds.`);
|
|
8
|
+
|
|
9
|
+
const PROJECT_ID = process.env.PROJECT_ID;
|
|
10
|
+
|
|
11
|
+
async function main() {
|
|
12
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
13
|
+
|
|
14
|
+
const eventRepo: chevre.repository.Event = await chevre.repository.Event.createInstance(mongoose.connection);
|
|
15
|
+
|
|
16
|
+
const events = await eventRepo.search(
|
|
17
|
+
{
|
|
18
|
+
limit: 100,
|
|
19
|
+
page: 1,
|
|
20
|
+
// sort: { startDate: 1 },
|
|
21
|
+
// typeOf: chevre.factory.eventType.ScreeningEvent,
|
|
22
|
+
project: { id: { $eq: PROJECT_ID } },
|
|
23
|
+
// id: { $eq: 'al6aff83y' },
|
|
24
|
+
typeOfIn: [chevre.factory.eventType.ScreeningEventSeries]
|
|
25
|
+
},
|
|
26
|
+
[],
|
|
27
|
+
[]
|
|
28
|
+
);
|
|
29
|
+
console.log(events);
|
|
30
|
+
console.log(events.length, 'events found');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
main()
|
|
34
|
+
.then(console.log)
|
|
35
|
+
.catch(console.error);
|
|
@@ -8,19 +8,18 @@ async function main() {
|
|
|
8
8
|
|
|
9
9
|
let updateResult: any;
|
|
10
10
|
|
|
11
|
-
const
|
|
12
|
-
updateResult = await
|
|
11
|
+
const eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
|
|
12
|
+
updateResult = await eventRepo.unsetUnnecessaryFields({
|
|
13
13
|
filter: {
|
|
14
14
|
typeOf: {
|
|
15
15
|
$in: [
|
|
16
|
-
chevre.factory.
|
|
17
|
-
chevre.factory.service.paymentService.PaymentServiceType.MovieTicket
|
|
16
|
+
chevre.factory.eventType.ScreeningEventSeries
|
|
18
17
|
]
|
|
19
|
-
}
|
|
20
|
-
'provider.name': { $exists: true }
|
|
18
|
+
}
|
|
21
19
|
},
|
|
22
|
-
$unset: {
|
|
23
|
-
|
|
20
|
+
$unset: <any>{
|
|
21
|
+
checkInCount: 1,
|
|
22
|
+
attendeeCount: 1
|
|
24
23
|
}
|
|
25
24
|
});
|
|
26
25
|
console.log('unset processed.', updateResult);
|
|
@@ -36,7 +36,6 @@ async function main() {
|
|
|
36
36
|
location: {
|
|
37
37
|
branchCode: '118',
|
|
38
38
|
id: '5bfb841d5a78d7948369979a',
|
|
39
|
-
kanaName: 'シネモーションアカサカ',
|
|
40
39
|
name: { ja: 'シネモーション赤坂 ', en: 'CineMotion Akasaka' },
|
|
41
40
|
typeOf: chevre.factory.placeType.MovieTheater
|
|
42
41
|
},
|
|
@@ -77,7 +76,6 @@ async function main() {
|
|
|
77
76
|
location: {
|
|
78
77
|
branchCode: '118',
|
|
79
78
|
id: '5bfb841d5a78d7948369979a',
|
|
80
|
-
kanaName: 'シネモーションアカサカ',
|
|
81
79
|
name: { ja: 'シネモーション赤坂 ', en: 'CineMotion Akasaka' },
|
|
82
80
|
typeOf: chevre.factory.placeType.MovieTheater
|
|
83
81
|
},
|
|
@@ -20,6 +20,5 @@ export declare function createReturnOrderMessage(params: {
|
|
|
20
20
|
*/
|
|
21
21
|
export declare function createRefundMessage(params: {
|
|
22
22
|
order: factory.order.IOrder;
|
|
23
|
-
paymentMethods: factory.order.IReferencedInvoice[];
|
|
24
23
|
email?: factory.creativeWork.message.email.ICustomization;
|
|
25
24
|
}): Promise<factory.creativeWork.message.email.ICreativeWork>;
|
|
@@ -15,11 +15,14 @@ function minimizeSuperEvent(params) {
|
|
|
15
15
|
: undefined), (typeof params.superEventFromDB.workPerformed.contentRating === 'string')
|
|
16
16
|
? { contentRating: params.superEventFromDB.workPerformed.contentRating }
|
|
17
17
|
: undefined);
|
|
18
|
-
const location = Object.assign(
|
|
18
|
+
const location = Object.assign({ typeOf: factory.placeType.MovieTheater, id: params.superEventFromDB.location.id, branchCode: params.superEventFromDB.location.branchCode }, (params.superEventFromDB.location.name !== undefined)
|
|
19
19
|
? { name: params.superEventFromDB.location.name }
|
|
20
|
-
: undefined
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
: undefined
|
|
21
|
+
// 廃止(2024-03-05~)
|
|
22
|
+
// ...(typeof params.superEventFromDB.location.kanaName === 'string')
|
|
23
|
+
// ? { kanaName: params.superEventFromDB.location.kanaName }
|
|
24
|
+
// : undefined
|
|
25
|
+
);
|
|
23
26
|
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ typeOf: factory.eventType.ScreeningEventSeries,
|
|
24
27
|
// 不要なので廃止(2023-06-09~)
|
|
25
28
|
// project: { typeOf: chevre.factory.organizationType.Project, id: params.project.id },
|
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
import * as factory from '../factory';
|
|
2
1
|
export declare const POINT_AWARD_IDENTIFIER_NAME = "pointAwardIdentifiers";
|
|
3
2
|
export declare const AWARD_ACCOUNTS_IDENTIFIER_NAME = "awardAccounts";
|
|
4
|
-
export type IMaskedCustomer = factory.order.ICustomer | Pick<factory.order.ICustomer, 'id' | 'typeOf'>;
|
|
5
|
-
/**
|
|
6
|
-
* 個人情報のマスクされたカスタマーを作成する
|
|
7
|
-
*/
|
|
8
|
-
export declare function createMaskedCustomer(order: Pick<factory.order.IOrder, 'customer'>, options: {
|
|
9
|
-
noProfile: boolean;
|
|
10
|
-
}): IMaskedCustomer;
|
|
@@ -1,30 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.AWARD_ACCOUNTS_IDENTIFIER_NAME = exports.POINT_AWARD_IDENTIFIER_NAME = void 0;
|
|
4
4
|
exports.POINT_AWARD_IDENTIFIER_NAME = 'pointAwardIdentifiers';
|
|
5
5
|
exports.AWARD_ACCOUNTS_IDENTIFIER_NAME = 'awardAccounts';
|
|
6
|
-
const MASKED_PROFILE = '****';
|
|
7
|
-
/**
|
|
8
|
-
* 個人情報のマスクされたカスタマーを作成する
|
|
9
|
-
*/
|
|
10
|
-
function createMaskedCustomer(order, options) {
|
|
11
|
-
// noProfileに対応する(2023-07-03~)
|
|
12
|
-
if ((options === null || options === void 0 ? void 0 : options.noProfile) === true) {
|
|
13
|
-
return {
|
|
14
|
-
id: order.customer.id,
|
|
15
|
-
typeOf: order.customer.typeOf
|
|
16
|
-
// ↓identifierも隠蔽
|
|
17
|
-
// identifier: [],
|
|
18
|
-
// ↓additionalPropertyも隠蔽
|
|
19
|
-
// additionalProperty: [],
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
return Object.assign(Object.assign({}, order.customer), {
|
|
24
|
-
// ↓identifierも隠蔽
|
|
25
|
-
identifier: [],
|
|
26
|
-
// ↓additionalPropertyも隠蔽
|
|
27
|
-
additionalProperty: [], email: MASKED_PROFILE, telephone: MASKED_PROFILE, name: MASKED_PROFILE, familyName: MASKED_PROFILE, givenName: MASKED_PROFILE });
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
exports.createMaskedCustomer = createMaskedCustomer;
|
|
@@ -318,9 +318,9 @@ export declare class MongoRepository {
|
|
|
318
318
|
};
|
|
319
319
|
};
|
|
320
320
|
}): Promise<any>;
|
|
321
|
-
unsetUnnecessaryFields(params: {
|
|
322
|
-
filter: FilterQuery<
|
|
323
|
-
$unset: IUnset<
|
|
321
|
+
unsetUnnecessaryFields<T extends factory.eventType>(params: {
|
|
322
|
+
filter: FilterQuery<factory.event.IEvent<T>>;
|
|
323
|
+
$unset: IUnset<T>;
|
|
324
324
|
}): Promise<import("mongodb").UpdateResult>;
|
|
325
325
|
/**
|
|
326
326
|
* 既存施設コンテンツの最大バージョンを集計する
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IndexDefinition, IndexOptions, Schema } from 'mongoose';
|
|
2
2
|
declare const modelName = "Event";
|
|
3
|
-
declare function createSchema(): Schema;
|
|
4
3
|
declare const indexes: [d: IndexDefinition, o: IndexOptions][];
|
|
4
|
+
declare function createSchema(): Schema;
|
|
5
5
|
export { modelName, indexes, createSchema };
|
|
@@ -41,13 +41,11 @@ const schemaDefinition = {
|
|
|
41
41
|
subtitleLanguage: mongoose_1.SchemaTypes.Mixed,
|
|
42
42
|
dubLanguage: mongoose_1.SchemaTypes.Mixed,
|
|
43
43
|
kanaName: String,
|
|
44
|
-
// 不要なので廃止(2023-01-23~)
|
|
45
|
-
// hasOfferCatalog: SchemaTypes.Mixed,
|
|
46
44
|
offers: mongoose_1.SchemaTypes.Mixed,
|
|
47
45
|
maximumAttendeeCapacity: { type: Number },
|
|
48
46
|
remainingAttendeeCapacity: { type: Number },
|
|
49
|
-
checkInCount: { type: Number
|
|
50
|
-
attendeeCount: { type: Number
|
|
47
|
+
checkInCount: { type: Number },
|
|
48
|
+
attendeeCount: { type: Number },
|
|
51
49
|
aggregateEntranceGate: mongoose_1.SchemaTypes.Mixed,
|
|
52
50
|
aggregateReservation: mongoose_1.SchemaTypes.Mixed,
|
|
53
51
|
aggregateOffer: mongoose_1.SchemaTypes.Mixed,
|
|
@@ -79,17 +77,6 @@ const schemaOptions = {
|
|
|
79
77
|
versionKey: false
|
|
80
78
|
}
|
|
81
79
|
};
|
|
82
|
-
/**
|
|
83
|
-
* イベントスキーマ
|
|
84
|
-
*/
|
|
85
|
-
let schema;
|
|
86
|
-
function createSchema() {
|
|
87
|
-
if (schema === undefined) {
|
|
88
|
-
schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
|
|
89
|
-
}
|
|
90
|
-
return schema;
|
|
91
|
-
}
|
|
92
|
-
exports.createSchema = createSchema;
|
|
93
80
|
const indexes = [
|
|
94
81
|
[
|
|
95
82
|
{ createdAt: 1 },
|
|
@@ -380,3 +367,19 @@ const indexes = [
|
|
|
380
367
|
]
|
|
381
368
|
];
|
|
382
369
|
exports.indexes = indexes;
|
|
370
|
+
/**
|
|
371
|
+
* イベントスキーマ
|
|
372
|
+
*/
|
|
373
|
+
let schema;
|
|
374
|
+
function createSchema() {
|
|
375
|
+
if (schema === undefined) {
|
|
376
|
+
schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
|
|
377
|
+
if (settings_1.MONGO_AUTO_INDEX) {
|
|
378
|
+
indexes.forEach((indexParams) => {
|
|
379
|
+
schema === null || schema === void 0 ? void 0 : schema.index(...indexParams);
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
return schema;
|
|
384
|
+
}
|
|
385
|
+
exports.createSchema = createSchema;
|
|
@@ -4,7 +4,7 @@ import type { MongoRepository as OfferCatalogRepo } from '../../../repo/offerCat
|
|
|
4
4
|
import type { MongoRepository as ProductRepo } from '../../../repo/product';
|
|
5
5
|
import * as factory from '../../../factory';
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* 興行オファー検索
|
|
8
8
|
* NotFoundエラーをハンドリングする
|
|
9
9
|
*/
|
|
10
10
|
export declare function findEventOffers(params: {
|
|
@@ -85,7 +85,7 @@ export declare function createPotentialActions(params: factory.assetTransaction.
|
|
|
85
85
|
order?: Pick<factory.order.IOrder, 'orderNumber' | 'customer' | 'typeOf'>;
|
|
86
86
|
}): {
|
|
87
87
|
potentialActions: factory.assetTransaction.reserve.IPotentialActions;
|
|
88
|
-
reservationPackage?: factory.action.reserve.
|
|
88
|
+
reservationPackage?: factory.action.reserve.IObject;
|
|
89
89
|
underName?: factory.reservation.IUnderName<factory.reservationType.EventReservation>;
|
|
90
90
|
};
|
|
91
91
|
export declare function createCancelPendingReservationAction(params: {
|
|
@@ -112,7 +112,7 @@ function addReservations(params) {
|
|
|
112
112
|
availableOffers = params.preSearchedUnitPriceOffers;
|
|
113
113
|
}
|
|
114
114
|
else {
|
|
115
|
-
//
|
|
115
|
+
// 興行オファー検索
|
|
116
116
|
const searchEventTicketOffersResult = yield OfferService.event.searchEventTicketOffers({
|
|
117
117
|
ids: acceptedOfferIds,
|
|
118
118
|
event: { id: event.id },
|
|
@@ -178,11 +178,6 @@ function addReservations(params) {
|
|
|
178
178
|
},
|
|
179
179
|
stockHoldUntilDaysAfterEventEnd: params.stockHoldUntilDaysAfterEventEnd
|
|
180
180
|
})(repos);
|
|
181
|
-
// 完全廃止(2023-07-19~)
|
|
182
|
-
// if (transaction.object.disablePendingReservations !== true) {
|
|
183
|
-
// // 予約作成(insertManyで実装)
|
|
184
|
-
// await repos.reservation.createMany({ reservationFor, reservations: objectSubReservations });
|
|
185
|
-
// }
|
|
186
181
|
// ストックホルダー処理(stockHolderで残席数を集計しているので必要)
|
|
187
182
|
yield onReservationsCreated({ event, transaction: { transactionNumber: transaction.transactionNumber } })(repos);
|
|
188
183
|
return { transaction, objectSubReservations, issuedThrough };
|
|
@@ -71,9 +71,9 @@ function createGivePointAwardStartParams4moneyTransfer(params, transactionNumber
|
|
|
71
71
|
var _a;
|
|
72
72
|
// Sellerに変更(2022-05-30~)
|
|
73
73
|
const agent = {
|
|
74
|
-
typeOf: params.
|
|
75
|
-
id:
|
|
76
|
-
name: String(params.
|
|
74
|
+
typeOf: params.agent.typeOf,
|
|
75
|
+
id: params.agent.id,
|
|
76
|
+
name: String(params.agent.name)
|
|
77
77
|
};
|
|
78
78
|
const recipient
|
|
79
79
|
// tslint:disable-next-line:no-object-literal-type-assertion
|
|
@@ -146,7 +146,6 @@ function returnPointAward(params) {
|
|
|
146
146
|
exports.returnPointAward = returnPointAward;
|
|
147
147
|
function processReturnPointAwardByTransactionIdentifier(params) {
|
|
148
148
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
149
|
-
const order = params.purpose;
|
|
150
149
|
let moneyTransferTransaction;
|
|
151
150
|
const moenyTransferAssetTransactionIdentifier = params.object.identifier;
|
|
152
151
|
const assetTransactions = yield repos.assetTransaction.search({
|
|
@@ -184,11 +183,10 @@ function processReturnPointAwardByTransactionIdentifier(params) {
|
|
|
184
183
|
.toDate(),
|
|
185
184
|
// Sellerに変更(2022-05-30~)
|
|
186
185
|
agent: {
|
|
187
|
-
typeOf:
|
|
188
|
-
id:
|
|
189
|
-
name:
|
|
186
|
+
typeOf: params.recipient.typeOf,
|
|
187
|
+
id: params.recipient.id,
|
|
188
|
+
name: String(params.recipient.name)
|
|
190
189
|
},
|
|
191
|
-
// agent: depositTransaction.recipient, // 入金と逆
|
|
192
190
|
recipient: depositTransaction.agent,
|
|
193
191
|
object: {
|
|
194
192
|
amount: depositTransaction.object.amount,
|
|
@@ -213,7 +211,6 @@ function processReturnPointAwardByTransactionIdentifier(params) {
|
|
|
213
211
|
function processReturnPointAwardByTransactionFromLocationIdentifier(params) {
|
|
214
212
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
215
213
|
var _a, _b;
|
|
216
|
-
const order = params.purpose;
|
|
217
214
|
const moneyTransferTransactions = [];
|
|
218
215
|
const moenyTransferAssetTransactionFromLocationIdentifier = (_b = (_a = params.object
|
|
219
216
|
.object) === null || _a === void 0 ? void 0 : _a.fromLocation) === null || _b === void 0 ? void 0 : _b.identifier;
|
|
@@ -261,20 +258,14 @@ function processReturnPointAwardByTransactionFromLocationIdentifier(params) {
|
|
|
261
258
|
.toDate(),
|
|
262
259
|
// Sellerに変更(2022-05-30~)
|
|
263
260
|
agent: {
|
|
264
|
-
typeOf:
|
|
265
|
-
id:
|
|
266
|
-
name:
|
|
261
|
+
typeOf: params.recipient.typeOf,
|
|
262
|
+
id: params.recipient.id,
|
|
263
|
+
name: String(params.recipient.name)
|
|
267
264
|
},
|
|
268
|
-
// agent: returningTransaction.recipient, // 入金と逆
|
|
269
265
|
recipient: returningTransaction.agent,
|
|
270
266
|
object: {
|
|
271
267
|
amount: returningTransaction.object.amount,
|
|
272
268
|
fromLocation,
|
|
273
|
-
// toLocation: {
|
|
274
|
-
// typeOf: order.typeOf,
|
|
275
|
-
// confirmationNumber: order.confirmationNumber,
|
|
276
|
-
// orderNumber: order.orderNumber
|
|
277
|
-
// },
|
|
278
269
|
toLocation,
|
|
279
270
|
description: `[Return Award]${returningTransaction.object.description}`,
|
|
280
271
|
pendingTransaction: {
|
|
@@ -42,7 +42,8 @@ function createEvent(params) {
|
|
|
42
42
|
const location = {
|
|
43
43
|
branchCode: movieTheater.branchCode,
|
|
44
44
|
id: movieTheater.id,
|
|
45
|
-
|
|
45
|
+
// 廃止(2024-03-05~)
|
|
46
|
+
// kanaName: movieTheater.kanaName,
|
|
46
47
|
name: movieTheater.name,
|
|
47
48
|
typeOf: factory.placeType.MovieTheater
|
|
48
49
|
};
|
|
@@ -232,7 +232,7 @@ function saveScreeningEventSeries(params) {
|
|
|
232
232
|
const availablePaymentMethodTypes = yield repos.categoryCode.search({
|
|
233
233
|
project: { id: { $eq: params.project.id } },
|
|
234
234
|
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.PaymentMethodType } }
|
|
235
|
-
}, [], []);
|
|
235
|
+
}, ['additionalProperty', 'codeValue'], []);
|
|
236
236
|
const screeningEventSerieses = filmsFromCOA.map((filmFromCOA) => {
|
|
237
237
|
return createScreeningEventSeriesFromCOA({
|
|
238
238
|
project: project,
|
|
@@ -570,19 +570,7 @@ function createScreeningEventSeriesFromCOA(params) {
|
|
|
570
570
|
titleBranchNum: params.filmFromCOA.titleBranchNum
|
|
571
571
|
});
|
|
572
572
|
const { additionalProperty, coaInfo } = createScreeningEventSeriesAdditionalPropertyFromCOA(params);
|
|
573
|
-
|
|
574
|
-
// flgMvtkUseはムビチケ、MGチケットの両方に適用される
|
|
575
|
-
if (coaInfo.flgMvtkUse === '1') {
|
|
576
|
-
// no op
|
|
577
|
-
}
|
|
578
|
-
else {
|
|
579
|
-
if (!Array.isArray(unacceptedPaymentMethod)) {
|
|
580
|
-
unacceptedPaymentMethod = [];
|
|
581
|
-
}
|
|
582
|
-
// flgMvtkUseで決済方法区分から動的に
|
|
583
|
-
const unavailablePaymentMethodTypes = params.availablePaymentMethodTypes.filter((categoryCode) => { var _a, _b; return ((_b = (_a = categoryCode.additionalProperty) === null || _a === void 0 ? void 0 : _a.find((property) => property.name === 'flgMvtkUse')) === null || _b === void 0 ? void 0 : _b.value) === '1'; });
|
|
584
|
-
unacceptedPaymentMethod.push(...unavailablePaymentMethodTypes.map((c) => c.codeValue));
|
|
585
|
-
}
|
|
573
|
+
const { unacceptedPaymentMethod } = createScreeningEventSeriesUnacceptedPaymentMethodFromCOA(params);
|
|
586
574
|
const workPerformed = Object.assign({ id: `${params.movieTheater.branchCode}-${params.filmFromCOA.titleCode}`, identifier: params.filmFromCOA.titleCode, name: {
|
|
587
575
|
ja: params.filmFromCOA.titleNameOrig
|
|
588
576
|
}, duration: moment.duration(params.filmFromCOA.showTime, 'm')
|
|
@@ -605,7 +593,8 @@ function createScreeningEventSeriesFromCOA(params) {
|
|
|
605
593
|
id: (params.movieTheater.id !== undefined) ? params.movieTheater.id : '',
|
|
606
594
|
branchCode: params.movieTheater.branchCode,
|
|
607
595
|
name: params.movieTheater.name,
|
|
608
|
-
|
|
596
|
+
// 廃止(2024-03-05~)
|
|
597
|
+
// kanaName: params.movieTheater.kanaName,
|
|
609
598
|
typeOf: params.movieTheater.typeOf
|
|
610
599
|
},
|
|
611
600
|
// 必須化(2023-07-12~)
|
|
@@ -623,15 +612,7 @@ function createScreeningEventSeriesFromCOA(params) {
|
|
|
623
612
|
};
|
|
624
613
|
}
|
|
625
614
|
function createScreeningEventSeriesAdditionalPropertyFromCOA(params) {
|
|
626
|
-
const coaInfo = {
|
|
627
|
-
titleBranchNum: params.filmFromCOA.titleBranchNum,
|
|
628
|
-
kbnEirin: params.eirinKubuns.filter((k) => k.kubunCode === params.filmFromCOA.kbnEirin)[0],
|
|
629
|
-
kbnEizou: params.eizouKubuns.filter((k) => k.kubunCode === params.filmFromCOA.kbnEizou)[0],
|
|
630
|
-
kbnJoueihousiki: params.joueihousikiKubuns.filter((k) => k.kubunCode === params.filmFromCOA.kbnJoueihousiki)[0],
|
|
631
|
-
kbnJimakufukikae: params.jimakufukikaeKubuns.filter((k) => k.kubunCode === params.filmFromCOA.kbnJimakufukikae)[0],
|
|
632
|
-
flgMvtkUse: params.filmFromCOA.flgMvtkUse,
|
|
633
|
-
dateMvtkBegin: params.filmFromCOA.dateMvtkBegin
|
|
634
|
-
};
|
|
615
|
+
const coaInfo = Object.assign(Object.assign({ titleBranchNum: params.filmFromCOA.titleBranchNum, kbnEirin: params.eirinKubuns.filter((k) => k.kubunCode === params.filmFromCOA.kbnEirin)[0], kbnEizou: params.eizouKubuns.filter((k) => k.kubunCode === params.filmFromCOA.kbnEizou)[0], kbnJoueihousiki: params.joueihousikiKubuns.filter((k) => k.kubunCode === params.filmFromCOA.kbnJoueihousiki)[0], kbnJimakufukikae: params.jimakufukikaeKubuns.filter((k) => k.kubunCode === params.filmFromCOA.kbnJimakufukikae)[0], flgMvtkUse: params.filmFromCOA.flgMvtkUse, dateMvtkBegin: params.filmFromCOA.dateMvtkBegin }, (typeof params.filmFromCOA.flgMgtkUse === 'string') ? { flgMgtkUse: params.filmFromCOA.flgMgtkUse } : undefined), (typeof params.filmFromCOA.dateMgtkBegin === 'string') ? { dateMgtkBegin: params.filmFromCOA.dateMgtkBegin } : undefined);
|
|
635
616
|
return {
|
|
636
617
|
coaInfo,
|
|
637
618
|
additionalProperty: [
|
|
@@ -640,6 +621,34 @@ function createScreeningEventSeriesAdditionalPropertyFromCOA(params) {
|
|
|
640
621
|
]
|
|
641
622
|
};
|
|
642
623
|
}
|
|
624
|
+
function createScreeningEventSeriesUnacceptedPaymentMethodFromCOA(params) {
|
|
625
|
+
let unacceptedPaymentMethod;
|
|
626
|
+
// flgMvtkUseはムビチケ、MGチケットの両方に適用される(<-flgMgtkUseが追加されるまで)(~2024-03-05)
|
|
627
|
+
if (params.filmFromCOA.flgMvtkUse === '1') {
|
|
628
|
+
// no op
|
|
629
|
+
}
|
|
630
|
+
else {
|
|
631
|
+
if (!Array.isArray(unacceptedPaymentMethod)) {
|
|
632
|
+
unacceptedPaymentMethod = [];
|
|
633
|
+
}
|
|
634
|
+
// flgMvtkUseで決済方法区分から動的に
|
|
635
|
+
unacceptedPaymentMethod.push(...params.availablePaymentMethodTypes.filter(({ additionalProperty }) => { var _a; return ((_a = additionalProperty === null || additionalProperty === void 0 ? void 0 : additionalProperty.find(({ name }) => name === 'flgMvtkUse')) === null || _a === void 0 ? void 0 : _a.value) === '1'; })
|
|
636
|
+
.map(({ codeValue }) => codeValue));
|
|
637
|
+
}
|
|
638
|
+
if (params.filmFromCOA.flgMgtkUse === '0') {
|
|
639
|
+
if (!Array.isArray(unacceptedPaymentMethod)) {
|
|
640
|
+
unacceptedPaymentMethod = [];
|
|
641
|
+
}
|
|
642
|
+
// flgMgtkUseで決済方法区分から動的に
|
|
643
|
+
unacceptedPaymentMethod.push(...params.availablePaymentMethodTypes.filter(({ additionalProperty }) => { var _a; return ((_a = additionalProperty === null || additionalProperty === void 0 ? void 0 : additionalProperty.find(({ name }) => name === 'flgMgtkUse')) === null || _a === void 0 ? void 0 : _a.value) === '1'; })
|
|
644
|
+
.map(({ codeValue }) => codeValue));
|
|
645
|
+
}
|
|
646
|
+
if (Array.isArray(unacceptedPaymentMethod)) {
|
|
647
|
+
// 重複排除
|
|
648
|
+
unacceptedPaymentMethod = [...new Set(unacceptedPaymentMethod)];
|
|
649
|
+
}
|
|
650
|
+
return { unacceptedPaymentMethod };
|
|
651
|
+
}
|
|
643
652
|
/**
|
|
644
653
|
* COA情報からイベントIDを作成する
|
|
645
654
|
*/
|
|
@@ -19,7 +19,6 @@ import type { StockHolderRepository as StockHolderRepo } from '../../../repo/sto
|
|
|
19
19
|
import type { MongoRepository as TaskRepo } from '../../../repo/task';
|
|
20
20
|
import type { MongoRepository as TransactionRepo } from '../../../repo/transaction';
|
|
21
21
|
import type { RedisRepository as TransactionNumberRepo } from '../../../repo/transactionNumber';
|
|
22
|
-
import { IObjectWithoutDetail } from './factory';
|
|
23
22
|
interface IAuthorizeRepos {
|
|
24
23
|
action: ActionRepo;
|
|
25
24
|
assetTransaction: AssetTransactionRepo;
|
|
@@ -44,8 +43,9 @@ interface IAuthorizeRepos {
|
|
|
44
43
|
}
|
|
45
44
|
type IAuthorizeOperation<T> = (repos: IAuthorizeRepos) => Promise<T>;
|
|
46
45
|
type IAuthorizeOfferAction = factory.action.authorize.offer.eventService.IAction<factory.service.webAPI.Identifier>;
|
|
46
|
+
type IObjectWithoutDetail = factory.action.authorize.offer.eventService.IObjectWithoutDetail4chevre;
|
|
47
47
|
/**
|
|
48
|
-
*
|
|
48
|
+
* 興行オファー承認
|
|
49
49
|
*/
|
|
50
50
|
declare function authorize(params: {
|
|
51
51
|
project: {
|
|
@@ -75,6 +75,7 @@ declare function authorize(params: {
|
|
|
75
75
|
noOfferSpecified: boolean;
|
|
76
76
|
options: {
|
|
77
77
|
useCreateOrderOnOfferAccepted: boolean;
|
|
78
|
+
useResultAcceptedOffers: boolean;
|
|
78
79
|
};
|
|
79
80
|
}): IAuthorizeOperation<IAuthorizeOfferAction>;
|
|
80
81
|
export { authorize };
|