@chevre/domain 22.5.0-alpha.30 → 22.5.0-alpha.32
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/aggregateAllEvents2.ts +7 -1
- package/lib/chevre/service/offer.d.ts +6 -0
- package/lib/chevre/service/offer.js +12 -15
- package/lib/chevre/service/reserve/factory.d.ts +2 -61
- package/lib/chevre/service/reserve/factory.js +0 -11
- package/lib/chevre/service/task/handleNotification.d.ts +3 -0
- package/lib/chevre/service/task/handleNotification.js +43 -0
- package/lib/chevre/service/task.d.ts +1 -0
- package/lib/chevre/service/task.js +1 -0
- package/package.json +3 -3
|
@@ -41,7 +41,13 @@ export async function aggregateScreeningEvent() {
|
|
|
41
41
|
connection: mongoose.connection,
|
|
42
42
|
redisClient,
|
|
43
43
|
credentials: {
|
|
44
|
-
sendGrid: await chevre.credentials.SendGrid.createInstance({ apiKey: 'xxx' })
|
|
44
|
+
sendGrid: await chevre.credentials.SendGrid.createInstance({ apiKey: 'xxx' }),
|
|
45
|
+
lineNotify: await chevre.credentials.LINENotify.createInstance({
|
|
46
|
+
url: 'xxx',
|
|
47
|
+
accessToken: 'xxx',
|
|
48
|
+
accessTokenAlert: 'xxx',
|
|
49
|
+
accessTokenInfo: 'xxx'
|
|
50
|
+
})
|
|
45
51
|
},
|
|
46
52
|
settings: new chevre.settings.Settings({
|
|
47
53
|
onEventChanged: {
|
|
@@ -39,6 +39,12 @@ export declare function searchEventSeatOffersWithPaging(params: {
|
|
|
39
39
|
id: string;
|
|
40
40
|
};
|
|
41
41
|
$projection?: factory.place.seat.IProjection;
|
|
42
|
+
options: {
|
|
43
|
+
/**
|
|
44
|
+
* add option(2024-10-23~)
|
|
45
|
+
*/
|
|
46
|
+
excludePriceSpecification: boolean;
|
|
47
|
+
};
|
|
42
48
|
}): (repos: {
|
|
43
49
|
event: EventRepo;
|
|
44
50
|
priceSpecification: PriceSpecificationRepo;
|
|
@@ -10,7 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.searchEventSeatOffersWithPaging = exports.addOffers2Seat = exports.product = exports.moneyTransfer = exports.eventServiceByCOA = exports.event = void 0;
|
|
13
|
-
const createDebug = require("debug");
|
|
14
13
|
const moment = require("moment");
|
|
15
14
|
const factory = require("../factory");
|
|
16
15
|
const EventOfferService = require("./offer/event");
|
|
@@ -21,7 +20,6 @@ const MoneyTransferOfferService = require("./offer/moneyTransfer");
|
|
|
21
20
|
exports.moneyTransfer = MoneyTransferOfferService;
|
|
22
21
|
const ProductOfferService = require("./offer/product");
|
|
23
22
|
exports.product = ProductOfferService;
|
|
24
|
-
const debug = createDebug('chevre-domain:service:offer');
|
|
25
23
|
/**
|
|
26
24
|
* 座席にオファー情報を付加する
|
|
27
25
|
*/
|
|
@@ -38,7 +36,6 @@ function addOffers2Seat(params) {
|
|
|
38
36
|
.map(({ appliesToCategoryCode, name, price, priceCurrency, typeOf, valueAddedTaxIncluded }) => {
|
|
39
37
|
return {
|
|
40
38
|
// optimize appliesToCategoryCode(2024-08-02~)
|
|
41
|
-
// appliesToCategoryCode,
|
|
42
39
|
appliesToCategoryCode: appliesToCategoryCode.map(({ codeValue, inCodeSet }) => ({ codeValue, inCodeSet, typeOf: 'CategoryCode' })),
|
|
43
40
|
name, price, priceCurrency, typeOf, valueAddedTaxIncluded
|
|
44
41
|
};
|
|
@@ -63,6 +60,7 @@ function searchEventSeatOffersWithPaging(params) {
|
|
|
63
60
|
// tslint:disable-next-line:max-func-body-length
|
|
64
61
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
65
62
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
63
|
+
const { excludePriceSpecification } = params.options;
|
|
66
64
|
let offers = [];
|
|
67
65
|
// optimize(2024-07-18~)
|
|
68
66
|
const event = yield repos.event.projectEventFieldsById({ id: params.event.id }, ['project', 'startDate', 'offers.itemOffered']);
|
|
@@ -110,24 +108,23 @@ function searchEventSeatOffersWithPaging(params) {
|
|
|
110
108
|
}
|
|
111
109
|
}
|
|
112
110
|
});
|
|
113
|
-
debug('searchEventSeatOffersWithPaging: uniqueSeatingTypes:', uniqueSeatingTypes, event.project.id, roomBranchCode, movieTheaterBranchCode);
|
|
114
111
|
// 座席タイプ価格仕様を検索
|
|
115
112
|
let priceSpecs = [];
|
|
116
|
-
if (
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
113
|
+
if (!excludePriceSpecification) {
|
|
114
|
+
if (Array.isArray(uniqueSeatingTypes) && uniqueSeatingTypes.length > 0) {
|
|
115
|
+
priceSpecs = yield repos.priceSpecification.search({
|
|
116
|
+
project: { id: { $eq: event.project.id } },
|
|
117
|
+
typeOf: factory.priceSpecificationType.CategoryCodeChargeSpecification,
|
|
118
|
+
appliesToCategoryCode: {
|
|
119
|
+
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.SeatingType } },
|
|
120
|
+
codeValue: { $in: uniqueSeatingTypes } // ルームに含まれる座席区分のみ加算料金を検索(2024-08-05~)
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
}
|
|
125
124
|
}
|
|
126
125
|
offers = seats.map((seat, index) => {
|
|
127
126
|
return addOffers2Seat({
|
|
128
127
|
seat,
|
|
129
|
-
// unavailableOffers: [],
|
|
130
|
-
// availability: availabilities[index].availability,
|
|
131
128
|
availability: (typeof availabilities[index] === 'string')
|
|
132
129
|
? factory.itemAvailability.OutOfStock // ホルダーが存在すればOutOfStock
|
|
133
130
|
: factory.itemAvailability.InStock,
|
|
@@ -1,67 +1,9 @@
|
|
|
1
1
|
import * as factory from '../../factory';
|
|
2
|
-
type IEventReservation = factory.reservation.IReservation<factory.reservationType.EventReservation>;
|
|
3
|
-
type IMaskedUnderName = Pick<factory.reservation.IUnderName<factory.reservationType.EventReservation>, 'id' | 'typeOf'>;
|
|
4
2
|
export declare function optimizeUnderName4inform(params: {
|
|
5
3
|
underName: factory.reservation.IUnderName<factory.reservationType.EventReservation>;
|
|
6
|
-
}): IMaskedUnderName;
|
|
7
|
-
interface IProject {
|
|
8
|
-
id: string;
|
|
9
|
-
typeOf: factory.organizationType.Project;
|
|
10
|
-
}
|
|
11
|
-
export type ISubReservation4inform = Pick<IEventReservation, 'additionalProperty' | 'additionalTicketText' | 'attended' | 'bookingTime' | 'checkedIn' | 'id' | 'modifiedTime' | 'numSeats' | 'price' | 'programMembershipUsed' | 'reservedTicket' | 'subReservation' | 'typeOf'>;
|
|
12
|
-
/**
|
|
13
|
-
* 確定予約通知
|
|
14
|
-
*/
|
|
15
|
-
export interface IReservationPackage4informConfirmed {
|
|
16
|
-
issuedThrough: factory.reservation.eventReservation.IIssuedThrough;
|
|
17
|
-
project: IProject;
|
|
18
|
-
provider: factory.reservation.IProvider;
|
|
19
|
-
reservationFor: factory.reservation.IReservationFor<factory.reservationType.EventReservation>;
|
|
20
|
-
reservationNumber: string;
|
|
21
|
-
reservationStatus: factory.reservationStatusType;
|
|
22
|
-
subReservation: ISubReservation4inform[];
|
|
23
|
-
underName?: IMaskedUnderName;
|
|
24
|
-
typeOf: factory.reservationType.ReservationPackage;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* 予約取消通知
|
|
28
|
-
*/
|
|
29
|
-
export interface IReservation4informCanceled {
|
|
30
|
-
typeOf: factory.reservationType.BusReservation | factory.reservationType.EventReservation;
|
|
31
|
-
project: IProject;
|
|
32
|
-
id: string;
|
|
33
|
-
reservationStatus: factory.reservationStatusType.ReservationCancelled;
|
|
34
|
-
modifiedTime?: Date;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* 予約発券通知
|
|
38
|
-
* IDあるいは予約番号で発券
|
|
39
|
-
*/
|
|
40
|
-
export interface IReservation4informCheckedIn {
|
|
41
|
-
typeOf: factory.reservationType.EventReservation;
|
|
42
|
-
project: IProject;
|
|
43
|
-
id?: string;
|
|
44
|
-
reservationNumber?: string;
|
|
45
|
-
checkedIn: boolean;
|
|
46
|
-
modifiedTime?: Date;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* 予約使用通知
|
|
50
|
-
*/
|
|
51
|
-
export interface IReservation4informUsed {
|
|
52
|
-
typeOf: factory.reservationType.EventReservation;
|
|
53
|
-
project: IProject;
|
|
54
|
-
id: string;
|
|
55
|
-
attended: boolean;
|
|
56
|
-
modifiedTime?: Date;
|
|
57
|
-
reservedTicket: {
|
|
58
|
-
dateUsed?: Date;
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
export type IReservation4inform = IReservationPackage4informConfirmed | IReservation4informCanceled | IReservation4informCheckedIn | IReservation4informUsed;
|
|
62
|
-
export type IInformObject = IReservation4inform[];
|
|
4
|
+
}): factory.notification.reservation.IMaskedUnderName;
|
|
63
5
|
export interface IPotentialInformReservationAction extends factory.task.triggerWebhook.IPotentialInformAction {
|
|
64
|
-
object:
|
|
6
|
+
object: factory.notification.reservation.IReservation4inform[];
|
|
65
7
|
}
|
|
66
8
|
export declare const NUM_TRY_INFORM_RESERVATION: number;
|
|
67
9
|
export declare function createMoneyTransferActions(params: {
|
|
@@ -79,4 +21,3 @@ export interface IPotentialCancelAction extends factory.action.cancel.reservatio
|
|
|
79
21
|
export declare function createCancelPendingReservationAction(params: {
|
|
80
22
|
transaction: factory.assetTransaction.ITransaction<factory.assetTransactionType.Reserve>;
|
|
81
23
|
}): IPotentialCancelAction | undefined;
|
|
82
|
-
export {};
|
|
@@ -3,17 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createCancelPendingReservationAction = exports.createMoneyTransferActions = exports.NUM_TRY_INFORM_RESERVATION = exports.optimizeUnderName4inform = void 0;
|
|
4
4
|
const factory = require("../../factory");
|
|
5
5
|
function optimizeUnderName4inform(params) {
|
|
6
|
-
// ReservationPackage通知アクションのobject.underNameを最小化(2024-03-19~)
|
|
7
|
-
// ? {
|
|
8
|
-
// ...reservation.underName,
|
|
9
|
-
// email: MASKED_PROFILE,
|
|
10
|
-
// telephone: MASKED_PROFILE,
|
|
11
|
-
// name: MASKED_PROFILE,
|
|
12
|
-
// familyName: MASKED_PROFILE,
|
|
13
|
-
// givenName: MASKED_PROFILE,
|
|
14
|
-
// // identifierも隠蔽(2022-12-27~)
|
|
15
|
-
// identifier: []
|
|
16
|
-
// }
|
|
17
6
|
return { id: params.underName.id, typeOf: params.underName.typeOf };
|
|
18
7
|
}
|
|
19
8
|
exports.optimizeUnderName4inform = optimizeUnderName4inform;
|
|
@@ -0,0 +1,43 @@
|
|
|
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.call = void 0;
|
|
13
|
+
const util = require("util");
|
|
14
|
+
let notification;
|
|
15
|
+
function call(params) {
|
|
16
|
+
return ({ credentials, settings }) => __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
var _a, _b;
|
|
18
|
+
const { data } = params;
|
|
19
|
+
let message = `projectId: ${(Array.isArray(data)) ? (_b = (_a = data.at(0)) === null || _a === void 0 ? void 0 : _a.project) === null || _b === void 0 ? void 0 : _b.id : data === null || data === void 0 ? void 0 : data.project.id}
|
|
20
|
+
${util.inspect(data, { depth: 0 })}
|
|
21
|
+
|
|
22
|
+
taskId: ${params.id}
|
|
23
|
+
`;
|
|
24
|
+
// 最大 1000文字
|
|
25
|
+
// tslint:disable-next-line:no-magic-numbers
|
|
26
|
+
message = `${message.slice(0, 900)}...`;
|
|
27
|
+
try {
|
|
28
|
+
if (notification === undefined) {
|
|
29
|
+
notification = yield Promise.resolve().then(() => require('../notification'));
|
|
30
|
+
}
|
|
31
|
+
yield notification.lineNotify({
|
|
32
|
+
subject: 'Message from handleNotification',
|
|
33
|
+
content: message,
|
|
34
|
+
logLevel: 'log'
|
|
35
|
+
}, { timeout: settings.notification.timeout, useFetchAPI: settings.notification.useFetchAPI })({}, credentials);
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
// tslint:disable-next-line:no-console
|
|
39
|
+
console.error('handleNotification: lineNotify failed.', error);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
exports.call = call;
|
|
@@ -97,6 +97,7 @@ function execute(task) {
|
|
|
97
97
|
case factory.taskName.AuthorizePayment:
|
|
98
98
|
case factory.taskName.CheckMovieTicket:
|
|
99
99
|
case factory.taskName.DeletePerson:
|
|
100
|
+
case factory.taskName.HandleNotification:
|
|
100
101
|
case factory.taskName.Pay:
|
|
101
102
|
case factory.taskName.PublishPaymentUrl:
|
|
102
103
|
case factory.taskName.Refund:
|
package/package.json
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/client-cognito-identity-provider": "3.600.0",
|
|
13
13
|
"@aws-sdk/credential-providers": "3.600.0",
|
|
14
|
-
"@chevre/factory": "4.
|
|
15
|
-
"@cinerino/sdk": "10.
|
|
14
|
+
"@chevre/factory": "4.388.0-alpha.0",
|
|
15
|
+
"@cinerino/sdk": "10.15.0",
|
|
16
16
|
"@motionpicture/coa-service": "9.5.0",
|
|
17
17
|
"@motionpicture/gmo-service": "5.3.0",
|
|
18
18
|
"@sendgrid/mail": "6.4.0",
|
|
@@ -108,5 +108,5 @@
|
|
|
108
108
|
"postversion": "git push origin --tags",
|
|
109
109
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
110
110
|
},
|
|
111
|
-
"version": "22.5.0-alpha.
|
|
111
|
+
"version": "22.5.0-alpha.32"
|
|
112
112
|
}
|