@chevre/domain 21.20.0-alpha.59 → 21.20.0-alpha.60
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/migrateOrderAcceptedOfferSerialNumber.ts +1 -1
- package/lib/chevre/service/event.js +7 -17
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.js +66 -55
- package/lib/chevre/service/task/confirmReserveTransaction.js +16 -15
- package/lib/chevre/settings.d.ts +0 -2
- package/lib/chevre/settings.js +3 -3
- package/package.json +2 -2
|
@@ -18,7 +18,7 @@ async function main() {
|
|
|
18
18
|
// 'acceptedOffers.serialNumber': { $exists: false },
|
|
19
19
|
'acceptedOffers.itemOffered.reservationNumber': { $exists: true },
|
|
20
20
|
// 'project.id': { $eq: project.id },
|
|
21
|
-
// orderNumber: { $eq: '
|
|
21
|
+
// orderNumber: { $eq: 'KOB1-3749861-4732433' },
|
|
22
22
|
orderDate: {
|
|
23
23
|
$gte: moment()
|
|
24
24
|
// tslint:disable-next-line:no-magic-numbers
|
|
@@ -583,6 +583,12 @@ function createScreeningEventSeriesFromCOA(params) {
|
|
|
583
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
584
|
unacceptedPaymentMethod.push(...unavailablePaymentMethodTypes.map((c) => c.codeValue));
|
|
585
585
|
}
|
|
586
|
+
const workPerformed = Object.assign({ id: `${params.movieTheater.branchCode}-${params.filmFromCOA.titleCode}`, identifier: params.filmFromCOA.titleCode, name: {
|
|
587
|
+
ja: params.filmFromCOA.titleNameOrig
|
|
588
|
+
}, duration: moment.duration(params.filmFromCOA.showTime, 'm')
|
|
589
|
+
.toISOString(), contentRating: params.eirinKubuns.filter((kubun) => kubun.kubunCode === params.filmFromCOA.kbnEirin)[0], typeOf: factory.creativeWorkType.Movie }, (typeof params.filmFromCOA.titleBranchNum === 'string' && params.filmFromCOA.titleBranchNum.length > 0)
|
|
590
|
+
? { version: params.filmFromCOA.titleBranchNum } // add version(2024-01-31~)
|
|
591
|
+
: undefined);
|
|
586
592
|
return {
|
|
587
593
|
project: { typeOf: params.project.typeOf, id: params.project.id },
|
|
588
594
|
typeOf: factory.eventType.ScreeningEventSeries,
|
|
@@ -596,8 +602,6 @@ function createScreeningEventSeriesFromCOA(params) {
|
|
|
596
602
|
kanaName: params.filmFromCOA.titleNameKana,
|
|
597
603
|
alternativeHeadline: params.filmFromCOA.titleNameShort,
|
|
598
604
|
location: {
|
|
599
|
-
// 不要なので廃止(2022-12-19~)
|
|
600
|
-
// project: { typeOf: params.project.typeOf, id: params.project.id },
|
|
601
605
|
id: (params.movieTheater.id !== undefined) ? params.movieTheater.id : '',
|
|
602
606
|
branchCode: params.movieTheater.branchCode,
|
|
603
607
|
name: params.movieTheater.name,
|
|
@@ -608,21 +612,7 @@ function createScreeningEventSeriesFromCOA(params) {
|
|
|
608
612
|
organizer: { id: params.seller.id },
|
|
609
613
|
videoFormat: params.eizouKubuns.filter((kubun) => kubun.kubunCode === params.filmFromCOA.kbnEizou)[0],
|
|
610
614
|
soundFormat: [],
|
|
611
|
-
workPerformed
|
|
612
|
-
// 不要なので廃止(2022-12-19~)
|
|
613
|
-
// project: { typeOf: params.project.typeOf, id: params.project.id },
|
|
614
|
-
id: `${params.movieTheater.branchCode}-${params.filmFromCOA.titleCode}`,
|
|
615
|
-
identifier: params.filmFromCOA.titleCode,
|
|
616
|
-
// 多言語化(2022-07-26~)
|
|
617
|
-
// name: params.filmFromCOA.titleNameOrig,
|
|
618
|
-
name: {
|
|
619
|
-
ja: params.filmFromCOA.titleNameOrig
|
|
620
|
-
},
|
|
621
|
-
duration: moment.duration(params.filmFromCOA.showTime, 'm')
|
|
622
|
-
.toISOString(),
|
|
623
|
-
contentRating: params.eirinKubuns.filter((kubun) => kubun.kubunCode === params.filmFromCOA.kbnEirin)[0],
|
|
624
|
-
typeOf: factory.creativeWorkType.Movie
|
|
625
|
-
},
|
|
615
|
+
workPerformed,
|
|
626
616
|
duration: moment.duration(params.filmFromCOA.showTime, 'm')
|
|
627
617
|
.toISOString(),
|
|
628
618
|
endDate: endDate,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// import * as COA from '@motionpicture/coa-service';
|
|
3
|
+
// import { PhoneNumberFormat, PhoneNumberUtil } from 'google-libphonenumber';
|
|
4
|
+
// import { format } from 'util';
|
|
2
5
|
var _a;
|
|
3
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
7
|
exports.createConfirmReservationActionObject4COAByOrder = exports.createConfirmReservationActionObject4ChevreByOrder = exports.createInformTasks = void 0;
|
|
5
|
-
const google_libphonenumber_1 = require("google-libphonenumber");
|
|
6
|
-
const util_1 = require("util");
|
|
7
8
|
const factory = require("../../../../factory");
|
|
8
9
|
const order_1 = require("../../../../factory/order");
|
|
9
10
|
const reservedAgentIdentifireNames_1 = require("../../../../factory/reservedAgentIdentifireNames");
|
|
@@ -106,64 +107,74 @@ function createConfirmReservationActionObject4COAByOrder(params) {
|
|
|
106
107
|
.map((o) => {
|
|
107
108
|
return o.itemOffered.reservationNumber;
|
|
108
109
|
}))];
|
|
109
|
-
const customer = params.order.customer;
|
|
110
|
-
// 電話番号のフォーマットを日本人にリーダブルに調整(COAではこのフォーマットで扱うので)
|
|
111
|
-
const phoneUtil =
|
|
112
|
-
const phoneNumber = phoneUtil.parse(customer.telephone, 'JP');
|
|
113
|
-
let telNum = phoneUtil.format(phoneNumber,
|
|
114
|
-
// COAでは数字のみ受け付けるので数字以外を除去
|
|
115
|
-
telNum = telNum.replace(/[^\d]/g, '');
|
|
116
|
-
const mailAddr = customer.email;
|
|
117
|
-
if (mailAddr === undefined) {
|
|
118
|
-
|
|
119
|
-
}
|
|
110
|
+
// const customer = params.order.customer;
|
|
111
|
+
// // 電話番号のフォーマットを日本人にリーダブルに調整(COAではこのフォーマットで扱うので)
|
|
112
|
+
// const phoneUtil = PhoneNumberUtil.getInstance();
|
|
113
|
+
// const phoneNumber = phoneUtil.parse(customer.telephone, 'JP');
|
|
114
|
+
// let telNum = phoneUtil.format(phoneNumber, PhoneNumberFormat.NATIONAL);
|
|
115
|
+
// // COAでは数字のみ受け付けるので数字以外を除去
|
|
116
|
+
// telNum = telNum.replace(/[^\d]/g, '');
|
|
117
|
+
// const mailAddr = customer.email;
|
|
118
|
+
// if (mailAddr === undefined) {
|
|
119
|
+
// throw new factory.errors.Argument('order', 'order.customer.email undefined');
|
|
120
|
+
// }
|
|
120
121
|
return coaReservationNumbers.map((reservationNumber) => {
|
|
121
|
-
|
|
122
|
-
.filter((o) => o.itemOffered.reservationNumber === reservationNumber)
|
|
123
|
-
.map((o) => {
|
|
124
|
-
return o.itemOffered;
|
|
125
|
-
});
|
|
126
|
-
const coaReservation = coaReservations[0];
|
|
127
|
-
const reservationForCOAInfo = coaReservation.reservationFor.coaInfo;
|
|
128
|
-
if (reservationForCOAInfo === undefined) {
|
|
129
|
-
throw new factory.errors.NotFound('reservationFor.coaInfo');
|
|
130
|
-
}
|
|
131
|
-
const totalPrice = coaReservation.reservedTicket.coaReserveAmount;
|
|
132
|
-
if (totalPrice === undefined) {
|
|
133
|
-
throw new factory.errors.NotFound('reservedTicket.coaReserveAmount');
|
|
134
|
-
}
|
|
135
|
-
const listTicket = coaReservations.map((r) => {
|
|
136
|
-
var _a;
|
|
137
|
-
if (typeof ((_a = r.reservedTicket.coaTicketInfo) === null || _a === void 0 ? void 0 : _a.ticketCode) !== 'string') {
|
|
138
|
-
throw new factory.errors.NotFound('reservedTicket.coaTicketInfo');
|
|
139
|
-
}
|
|
140
|
-
// 冗長な属性を排除(2023-03-20~)
|
|
141
|
-
const { ticketCode, stdPrice, addPrice, spseatAdd1, spseatAdd2, disPrice, salePrice, mvtkAppPrice, ticketCount, spseatKbn, seatNum, addGlasses, kbnEisyahousiki, mvtkNum, mvtkKbnDenshiken, mvtkKbnMaeuriken, mvtkKbnKensyu, mvtkSalesPrice, kbnMgtk } = r.reservedTicket.coaTicketInfo;
|
|
142
|
-
return {
|
|
143
|
-
ticketCode, stdPrice, addPrice, spseatAdd1, spseatAdd2,
|
|
144
|
-
disPrice, salePrice, mvtkAppPrice, ticketCount, spseatKbn,
|
|
145
|
-
seatNum, addGlasses, kbnEisyahousiki, mvtkNum, mvtkKbnDenshiken,
|
|
146
|
-
mvtkKbnMaeuriken, mvtkKbnKensyu, mvtkSalesPrice, kbnMgtk
|
|
147
|
-
};
|
|
148
|
-
});
|
|
122
|
+
// 完全に最適化(2024-01-31~)
|
|
149
123
|
return {
|
|
150
|
-
|
|
151
|
-
dateJouei: reservationForCOAInfo.dateJouei,
|
|
152
|
-
titleCode: reservationForCOAInfo.titleCode,
|
|
153
|
-
titleBranchNum: reservationForCOAInfo.titleBranchNum,
|
|
154
|
-
timeBegin: reservationForCOAInfo.timeBegin,
|
|
155
|
-
tmpReserveNum: reservationNumber,
|
|
156
|
-
// tslint:disable-next-line:no-irregular-whitespace
|
|
157
|
-
reserveName: (0, util_1.format)('%s %s', customer.familyName, customer.givenName),
|
|
158
|
-
// tslint:disable-next-line:no-irregular-whitespace
|
|
159
|
-
reserveNameJkana: (0, util_1.format)('%s %s', customer.familyName, customer.givenName),
|
|
160
|
-
telNum: telNum,
|
|
161
|
-
mailAddr: mailAddr,
|
|
162
|
-
reserveAmount: totalPrice,
|
|
163
|
-
listTicket,
|
|
124
|
+
optimized: true,
|
|
164
125
|
transactionNumber: reservationNumber,
|
|
165
126
|
typeOf: 'COAReserveTransaction'
|
|
166
127
|
};
|
|
128
|
+
// const coaReservations = coaReservationOffers
|
|
129
|
+
// .filter((o) => (<factory.order.IEventReservation>o.itemOffered).reservationNumber === reservationNumber)
|
|
130
|
+
// .map((o) => {
|
|
131
|
+
// return <factory.order.IEventReservation>o.itemOffered;
|
|
132
|
+
// });
|
|
133
|
+
// const coaReservation = coaReservations[0];
|
|
134
|
+
// const reservationForCOAInfo = coaReservation.reservationFor.coaInfo;
|
|
135
|
+
// if (reservationForCOAInfo === undefined) {
|
|
136
|
+
// throw new factory.errors.NotFound('reservationFor.coaInfo');
|
|
137
|
+
// }
|
|
138
|
+
// const totalPrice = coaReservation.reservedTicket.coaReserveAmount;
|
|
139
|
+
// if (totalPrice === undefined) {
|
|
140
|
+
// throw new factory.errors.NotFound('reservedTicket.coaReserveAmount');
|
|
141
|
+
// }
|
|
142
|
+
// const listTicket: COA.factory.reserve.IUpdReserveTicket[] = coaReservations.map((r) => {
|
|
143
|
+
// if (typeof r.reservedTicket.coaTicketInfo?.ticketCode !== 'string') {
|
|
144
|
+
// throw new factory.errors.NotFound('reservedTicket.coaTicketInfo');
|
|
145
|
+
// }
|
|
146
|
+
// // 冗長な属性を排除(2023-03-20~)
|
|
147
|
+
// const {
|
|
148
|
+
// ticketCode, stdPrice, addPrice, spseatAdd1, spseatAdd2,
|
|
149
|
+
// disPrice, salePrice, mvtkAppPrice, ticketCount, spseatKbn,
|
|
150
|
+
// seatNum, addGlasses, kbnEisyahousiki, mvtkNum, mvtkKbnDenshiken,
|
|
151
|
+
// mvtkKbnMaeuriken, mvtkKbnKensyu, mvtkSalesPrice, kbnMgtk
|
|
152
|
+
// } = r.reservedTicket.coaTicketInfo;
|
|
153
|
+
// return {
|
|
154
|
+
// ticketCode, stdPrice, addPrice, spseatAdd1, spseatAdd2,
|
|
155
|
+
// disPrice, salePrice, mvtkAppPrice, ticketCount, spseatKbn,
|
|
156
|
+
// seatNum, addGlasses, kbnEisyahousiki, mvtkNum, mvtkKbnDenshiken,
|
|
157
|
+
// mvtkKbnMaeuriken, mvtkKbnKensyu, mvtkSalesPrice, kbnMgtk
|
|
158
|
+
// };
|
|
159
|
+
// });
|
|
160
|
+
// return {
|
|
161
|
+
// theaterCode: reservationForCOAInfo.theaterCode,
|
|
162
|
+
// dateJouei: reservationForCOAInfo.dateJouei,
|
|
163
|
+
// titleCode: reservationForCOAInfo.titleCode,
|
|
164
|
+
// titleBranchNum: reservationForCOAInfo.titleBranchNum,
|
|
165
|
+
// timeBegin: reservationForCOAInfo.timeBegin,
|
|
166
|
+
// tmpReserveNum: reservationNumber,
|
|
167
|
+
// tslint:disable-next-line:no-irregular-whitespace
|
|
168
|
+
// reserveName: format('%s %s', customer.familyName, customer.givenName),
|
|
169
|
+
// tslint:disable-next-line:no-irregular-whitespace
|
|
170
|
+
// reserveNameJkana: format('%s %s', customer.familyName, customer.givenName),
|
|
171
|
+
// telNum: telNum,
|
|
172
|
+
// mailAddr: mailAddr,
|
|
173
|
+
// reserveAmount: totalPrice, // デフォルトのpriceCurrencyがJPYなのでこれでよし
|
|
174
|
+
// listTicket,
|
|
175
|
+
// transactionNumber: reservationNumber,
|
|
176
|
+
// typeOf: 'COAReserveTransaction'
|
|
177
|
+
// };
|
|
167
178
|
});
|
|
168
179
|
}
|
|
169
180
|
exports.createConfirmReservationActionObject4COAByOrder = createConfirmReservationActionObject4COAByOrder;
|
|
@@ -14,7 +14,7 @@ const createDebug = require("debug");
|
|
|
14
14
|
const google_libphonenumber_1 = require("google-libphonenumber");
|
|
15
15
|
const util_1 = require("util");
|
|
16
16
|
const factory = require("../../factory");
|
|
17
|
-
|
|
17
|
+
// import { USE_OPTIMIZED_CONFIRM_RESERVE_COA_TASK_VERIFY } from '../../settings';
|
|
18
18
|
const acceptedOffer_1 = require("../../repo/acceptedOffer");
|
|
19
19
|
const action_1 = require("../../repo/action");
|
|
20
20
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
@@ -146,20 +146,21 @@ function confirmReserveTransaction(params, options) {
|
|
|
146
146
|
const updReserveArgs = createConfirmObject4COAByOrder({ order, reservationNumber: params.object.transactionNumber });
|
|
147
147
|
debug('confirming coa reserve transaction...', order, updReserveArgs);
|
|
148
148
|
const object4coa = Object.assign(Object.assign({}, updReserveArgs), { transactionNumber: params.object.transactionNumber, typeOf: 'COAReserveTransaction' });
|
|
149
|
-
if (
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
149
|
+
// if (USE_OPTIMIZED_CONFIRM_RESERVE_COA_TASK_VERIFY) {
|
|
150
|
+
// const isValidObject = JSON.stringify(object4coa) === JSON.stringify(params.object);
|
|
151
|
+
// debug('confirmActionObject === params.object?', isValidObject);
|
|
152
|
+
// if (!isValidObject) {
|
|
153
|
+
// throw new factory.errors.Argument('object', 'object4coa !== params.object');
|
|
154
|
+
// }
|
|
155
|
+
// }
|
|
156
|
+
// 上書き
|
|
157
|
+
confirmActionObject = object4coa;
|
|
158
|
+
// if (USE_OPTIMIZED_CONFIRM_RESERVE_COA_TASK) {
|
|
159
|
+
// // 上書き
|
|
160
|
+
// confirmActionObject = object4coa;
|
|
161
|
+
// } else {
|
|
162
|
+
// confirmActionObject = <factory.action.interact.confirm.reservation.IObject4COA>params.object;
|
|
163
|
+
// }
|
|
163
164
|
break;
|
|
164
165
|
default:
|
|
165
166
|
confirmActionObject = params.object;
|
package/lib/chevre/settings.d.ts
CHANGED
|
@@ -43,8 +43,6 @@ export declare const USE_SEND_EMAIL_MESSAGE_ON_ORDER_PROCESSING: boolean;
|
|
|
43
43
|
export declare const USE_VERIFY_ACCEPTED_OFFERS: boolean;
|
|
44
44
|
export declare const USE_MINIMIZED_PAY_TASK: boolean;
|
|
45
45
|
export declare const USE_KANA_NAME_IN_ACCEPTED_OFFER: boolean;
|
|
46
|
-
export declare const USE_OPTIMIZED_CONFIRM_RESERVE_COA_TASK: boolean;
|
|
47
|
-
export declare const USE_OPTIMIZED_CONFIRM_RESERVE_COA_TASK_VERIFY: boolean;
|
|
48
46
|
export declare const MONGO_MAX_TIME_MS: number;
|
|
49
47
|
export declare const MONGO_READ_PREFERENCE: string;
|
|
50
48
|
export declare const MONGO_AUTO_INDEX: boolean;
|
package/lib/chevre/settings.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.settings = exports.DELIVER_ORDER_LIMIT = exports.MONGO_AUTO_INDEX = exports.MONGO_READ_PREFERENCE = exports.MONGO_MAX_TIME_MS = exports.
|
|
3
|
+
exports.settings = exports.DELIVER_ORDER_LIMIT = exports.MONGO_AUTO_INDEX = exports.MONGO_READ_PREFERENCE = exports.MONGO_MAX_TIME_MS = exports.USE_KANA_NAME_IN_ACCEPTED_OFFER = exports.USE_MINIMIZED_PAY_TASK = exports.USE_VERIFY_ACCEPTED_OFFERS = exports.USE_SEND_EMAIL_MESSAGE_ON_ORDER_PROCESSING = exports.USE_INFORM_ORDER_IN_TRANSIT = exports.USE_FETCH_API = exports.USE_OPTIMIZE_TICKET_OFFER = exports.USE_DELETE_EVENT_BY_ORDER = exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = exports.DEFAULT_TASKS_EXPORT_AGENT_NAME = exports.DEFAULT_SENDER_EMAIL = exports.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS = exports.TRANSACTION_CONFIRMED_STORAGE_PERIOD_IN_DAYS = exports.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS = exports.MAX_NUM_CREDIT_CARD_PAYMENT_METHOD = exports.ABORTED_TASKS_WITHOUT_REPORT = exports.TRIGGER_WEBHOOK_RETRY_INTERVAL_IN_MS = exports.TRIGGER_WEBHOOK_MAX_RETRY_COUNT = void 0;
|
|
4
4
|
const factory = require("./factory");
|
|
5
5
|
const transactionWebhookUrls = (typeof process.env.INFORM_TRANSACTION_URL === 'string')
|
|
6
6
|
? process.env.INFORM_TRANSACTION_URL.split(' ')
|
|
@@ -67,8 +67,8 @@ exports.USE_SEND_EMAIL_MESSAGE_ON_ORDER_PROCESSING = process.env.USE_SEND_EMAIL_
|
|
|
67
67
|
exports.USE_VERIFY_ACCEPTED_OFFERS = process.env.USE_VERIFY_ACCEPTED_OFFERS === '1';
|
|
68
68
|
exports.USE_MINIMIZED_PAY_TASK = process.env.USE_MINIMIZED_PAY_TASK === '1';
|
|
69
69
|
exports.USE_KANA_NAME_IN_ACCEPTED_OFFER = process.env.USE_KANA_NAME_IN_ACCEPTED_OFFER === '1';
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
// export const USE_OPTIMIZED_CONFIRM_RESERVE_COA_TASK = process.env.USE_OPTIMIZED_CONFIRM_RESERVE_COA_TASK === '1';
|
|
71
|
+
// export const USE_OPTIMIZED_CONFIRM_RESERVE_COA_TASK_VERIFY = process.env.USE_OPTIMIZED_CONFIRM_RESERVE_COA_TASK_VERIFY === '1';
|
|
72
72
|
exports.MONGO_MAX_TIME_MS = (typeof process.env.MONGO_MAX_TIME_MS === 'string')
|
|
73
73
|
? Number(process.env.MONGO_MAX_TIME_MS)
|
|
74
74
|
// tslint:disable-next-line:no-magic-numbers
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/credential-providers": "3.433.0",
|
|
13
|
-
"@chevre/factory": "4.352.0-alpha.
|
|
13
|
+
"@chevre/factory": "4.352.0-alpha.16",
|
|
14
14
|
"@cinerino/sdk": "5.9.0-alpha.2",
|
|
15
15
|
"@motionpicture/coa-service": "9.3.0-alpha.4",
|
|
16
16
|
"@motionpicture/gmo-service": "5.3.0-alpha.2",
|
|
@@ -111,5 +111,5 @@
|
|
|
111
111
|
"postversion": "git push origin --tags",
|
|
112
112
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
113
113
|
},
|
|
114
|
-
"version": "21.20.0-alpha.
|
|
114
|
+
"version": "21.20.0-alpha.60"
|
|
115
115
|
}
|