@chevre/domain 21.8.0-alpha.9 → 21.9.0-alpha.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/countOffers.ts +32 -0
- package/example/src/chevre/findItemListElementByCatalogId.ts +30 -0
- package/example/src/chevre/importOffersFromCOA.ts +7 -1
- package/example/src/chevre/migrateOrderPaymentMethodIdentifier.ts +81 -0
- package/example/src/chevre/migratePayTransactionPaymentMethodId.ts +72 -0
- package/example/src/chevre/migratePayTransactionPaymentMethodIdentifier.ts +78 -0
- package/example/src/chevre/optimizeCatalogs.ts +54 -0
- package/example/src/chevre/processPay.ts +3 -4
- package/example/src/chevre/publishPermitOwnershipInfoToken.ts +56 -0
- package/example/src/chevre/pullAddOnsFromOffer.ts +26 -0
- package/example/src/chevre/pushIncludedInDataCatalog.ts +47 -0
- package/example/src/chevre/searchAggregateOffers.ts +48 -0
- package/example/src/chevre/searchAvaialbleAppliesToMovieTicketByOfferCatalogId.ts +26 -0
- package/example/src/chevre/searchEventTicketOffers.ts +5 -1
- package/example/src/chevre/searchEvents.ts +9 -7
- package/example/src/chevre/searchOfferCatalogs.ts +7 -3
- package/example/src/chevre/searchOffers.ts +5 -2
- package/example/src/chevre/searchOffersByCatalog.ts +15 -9
- package/example/src/chevre/searchOffersFromAggregateOffer.ts +168 -0
- package/example/src/chevre/searchOrders.ts +9 -7
- package/example/src/chevre/syncCatalogs2aggregateOffers.ts +85 -0
- package/lib/chevre/emailMessageBuilder.js +6 -5
- package/lib/chevre/repo/aggregateOffer.d.ts +62 -0
- package/lib/chevre/repo/aggregateOffer.js +562 -0
- package/lib/chevre/repo/assetTransaction.d.ts +16 -1
- package/lib/chevre/repo/assetTransaction.js +54 -2
- package/lib/chevre/repo/mongoose/schemas/aggregateOffer.d.ts +74 -0
- package/lib/chevre/repo/mongoose/schemas/aggregateOffer.js +189 -0
- package/lib/chevre/repo/mongoose/schemas/authorization.d.ts +3 -3
- package/lib/chevre/repo/mongoose/schemas/creativeWork.d.ts +3 -3
- package/lib/chevre/repo/mongoose/schemas/event.d.ts +3 -3
- package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +3 -0
- package/lib/chevre/repo/mongoose/schemas/offerCatalog.js +10 -1
- package/lib/chevre/repo/mongoose/schemas/order.d.ts +3 -0
- package/lib/chevre/repo/mongoose/schemas/order.js +7 -0
- package/lib/chevre/repo/mongoose/schemas/priceSpecification.d.ts +9 -9
- package/lib/chevre/repo/mongoose/schemas/product.d.ts +3 -3
- package/lib/chevre/repo/mongoose/schemas/project.d.ts +3 -3
- package/lib/chevre/repo/mongoose/schemas/task.d.ts +3 -0
- package/lib/chevre/repo/mongoose/schemas/task.js +8 -0
- package/lib/chevre/repo/offer.d.ts +106 -51
- package/lib/chevre/repo/offer.js +555 -283
- package/lib/chevre/repo/offerCatalog.d.ts +32 -3
- package/lib/chevre/repo/offerCatalog.js +97 -10
- package/lib/chevre/repo/order.d.ts +15 -0
- package/lib/chevre/repo/order.js +58 -26
- package/lib/chevre/repo/task.d.ts +6 -2
- package/lib/chevre/repo/task.js +58 -4
- package/lib/chevre/repository.d.ts +3 -0
- package/lib/chevre/repository.js +5 -1
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +3 -41
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.d.ts +2 -0
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +2 -40
- package/lib/chevre/service/aggregation/event/findEventOffers.d.ts +16 -0
- package/lib/chevre/service/aggregation/event/findEventOffers.js +58 -0
- package/lib/chevre/service/assetTransaction/pay/account/validation.js +2 -2
- package/lib/chevre/service/assetTransaction/pay/factory.js +26 -18
- package/lib/chevre/service/assetTransaction/pay/potentialActions.js +3 -3
- package/lib/chevre/service/assetTransaction/pay.js +65 -46
- package/lib/chevre/service/assetTransaction/refund/factory.js +8 -2
- package/lib/chevre/service/assetTransaction/registerService.js +2 -1
- package/lib/chevre/service/assetTransaction/reserve.js +111 -35
- package/lib/chevre/service/offer/event/authorize.js +39 -35
- package/lib/chevre/service/offer/event/factory.d.ts +1 -1
- package/lib/chevre/service/offer/event/factory.js +8 -8
- package/lib/chevre/service/offer/event/importFromCOA.d.ts +2 -0
- package/lib/chevre/service/offer/event/searchEventTicketOffers.d.ts +3 -0
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +48 -17
- package/lib/chevre/service/offer/event/voidTransaction.js +57 -36
- package/lib/chevre/service/offer/eventServiceByCOA/factory.d.ts +2 -1
- package/lib/chevre/service/offer/eventServiceByCOA/factory.js +7 -11
- package/lib/chevre/service/offer/eventServiceByCOA.js +55 -27
- package/lib/chevre/service/offer/factory.d.ts +12 -4
- package/lib/chevre/service/offer/factory.js +9 -11
- package/lib/chevre/service/offer/product/searchProductOffers.d.ts +10 -1
- package/lib/chevre/service/offer/product/searchProductOffers.js +51 -12
- package/lib/chevre/service/offer/product.d.ts +2 -0
- package/lib/chevre/service/offer/product.js +3 -2
- package/lib/chevre/service/offer.d.ts +1 -0
- package/lib/chevre/service/offer.js +7 -1
- package/lib/chevre/service/order/confirmPayTransaction.d.ts +0 -2
- package/lib/chevre/service/order/confirmPayTransaction.js +20 -46
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +27 -0
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +226 -0
- package/lib/chevre/service/order/onOrderStatusChanged/factory.d.ts +8 -6
- package/lib/chevre/service/order/onOrderStatusChanged/factory.js +80 -57
- package/lib/chevre/service/order/onOrderStatusChanged.js +49 -9
- package/lib/chevre/service/order/payOrder.js +4 -45
- package/lib/chevre/service/order/placeOrder.js +11 -24
- package/lib/chevre/service/order.d.ts +3 -1
- package/lib/chevre/service/order.js +6 -2
- package/lib/chevre/service/payment/any/factory.js +33 -8
- package/lib/chevre/service/payment/any.js +30 -21
- package/lib/chevre/service/payment/creditCard.js +12 -12
- package/lib/chevre/service/payment/movieTicket/validation.js +2 -2
- package/lib/chevre/service/payment/movieTicket.js +10 -11
- package/lib/chevre/service/payment/paymentCard.js +9 -12
- package/lib/chevre/service/project.js +1 -1
- package/lib/chevre/service/reserve/checkInReservation.d.ts +8 -0
- package/lib/chevre/service/reserve/checkInReservation.js +3 -2
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +3 -0
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +4 -5
- package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.d.ts +8 -0
- package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +16 -11
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +2 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.d.ts +3 -0
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +3 -5
- package/lib/chevre/service/task/aggregateUseActionsOnEvent.js +2 -0
- package/lib/chevre/service/task/confirmPayTransaction.js +1 -3
- package/lib/chevre/service/task/importOffersFromCOA.js +3 -0
- package/lib/chevre/service/task/onAssetTransactionStatusChanged.d.ts +6 -0
- package/lib/chevre/service/task/onAssetTransactionStatusChanged.js +37 -0
- package/lib/chevre/service/task/onAuthorizationCreated.js +5 -1
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.d.ts +2 -0
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +7 -0
- package/lib/chevre/service/task/onResourceUpdated/syncOfferCatalog.d.ts +17 -0
- package/lib/chevre/service/task/onResourceUpdated/syncOfferCatalog.js +78 -0
- package/lib/chevre/service/task/onResourceUpdated.js +12 -0
- package/lib/chevre/service/task/returnPayTransaction.js +8 -3
- package/lib/chevre/service/transaction/placeOrderInProgress/result.js +32 -16
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.js +13 -11
- package/lib/chevre/service/transaction/placeOrderInProgress/validation.js +53 -17
- package/lib/chevre/service/transaction/placeOrderInProgress.js +4 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +7 -6
- package/lib/chevre/service/transaction/returnOrder.js +5 -1
- package/lib/chevre/settings.d.ts +3 -3
- package/lib/chevre/settings.js +4 -12
- package/package.json +3 -3
- package/example/src/chevre/migrateAuthorizePaymentActionResult.ts +0 -83
- package/example/src/chevre/migrateEventOrganizer.ts +0 -154
- package/lib/chevre/repo/mongoose/schemas/offer.d.ts +0 -149
- package/lib/chevre/repo/mongoose/schemas/offer.js +0 -210
|
@@ -26,6 +26,7 @@ exports.WebAPIIdentifier = factory.service.webAPI.Identifier;
|
|
|
26
26
|
*/
|
|
27
27
|
function voidTransaction(params) {
|
|
28
28
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
var _a, _b;
|
|
29
30
|
const transaction = yield repos.transaction.findById({
|
|
30
31
|
typeOf: params.purpose.typeOf,
|
|
31
32
|
id: params.purpose.id,
|
|
@@ -46,8 +47,12 @@ function voidTransaction(params) {
|
|
|
46
47
|
throw new factory.errors.NotImplemented(`${transaction.status} not implemented`);
|
|
47
48
|
// 確定取引に対応(2023-05-07~)
|
|
48
49
|
case factory.transactionStatusType.Confirmed:
|
|
49
|
-
//
|
|
50
|
-
|
|
50
|
+
// OrderCancelledを考慮(2023-08-30~)
|
|
51
|
+
const orderCancelled = ((_b = (_a = params.purpose.result) === null || _a === void 0 ? void 0 : _a.order) === null || _b === void 0 ? void 0 : _b.orderStatus) === factory.orderStatus.OrderCancelled;
|
|
52
|
+
if (!orderCancelled) {
|
|
53
|
+
// 取り消すべきアクションに絞る
|
|
54
|
+
authorizeActions = authorizeActions.filter((a) => a.actionStatus !== factory.actionStatusType.CompletedActionStatus);
|
|
55
|
+
}
|
|
51
56
|
break;
|
|
52
57
|
default:
|
|
53
58
|
// no op
|
|
@@ -71,44 +76,60 @@ function voidTransaction(params) {
|
|
|
71
76
|
}
|
|
72
77
|
exports.voidTransaction = voidTransaction;
|
|
73
78
|
function processVoidTransaction4coa(params) {
|
|
79
|
+
var _a, _b;
|
|
74
80
|
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
81
|
+
// COAの場合、objectあるいはresultに連携内容情報が記録されているので、その情報を元に仮予約を取り消す
|
|
82
|
+
let delTmpReserveParams;
|
|
83
|
+
// objectに進行中取引情報があれば利用する(2023-09-11~)
|
|
84
|
+
const pendingTransaction = params.action.object.pendingTransaction;
|
|
85
|
+
if (typeof (pendingTransaction === null || pendingTransaction === void 0 ? void 0 : pendingTransaction.typeOf) === 'string') {
|
|
86
|
+
delTmpReserveParams = {
|
|
87
|
+
theaterCode: pendingTransaction.theaterCode,
|
|
88
|
+
dateJouei: pendingTransaction.dateJouei,
|
|
89
|
+
titleCode: pendingTransaction.titleCode,
|
|
90
|
+
titleBranchNum: pendingTransaction.titleBranchNum,
|
|
91
|
+
timeBegin: pendingTransaction.timeBegin,
|
|
92
|
+
tmpReserveNum: pendingTransaction.tmpReserveNum
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
const coaRequestBody = (_a = params.action.result) === null || _a === void 0 ? void 0 : _a.requestBody;
|
|
97
|
+
const coaResponseBody = (_b = params.action.result) === null || _b === void 0 ? void 0 : _b.responseBody;
|
|
80
98
|
if (coaRequestBody !== undefined && coaResponseBody !== undefined) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
99
|
+
delTmpReserveParams = {
|
|
100
|
+
theaterCode: coaRequestBody.theaterCode,
|
|
101
|
+
dateJouei: coaRequestBody.dateJouei,
|
|
102
|
+
titleCode: coaRequestBody.titleCode,
|
|
103
|
+
titleBranchNum: coaRequestBody.titleBranchNum,
|
|
104
|
+
timeBegin: coaRequestBody.timeBegin,
|
|
105
|
+
tmpReserveNum: coaResponseBody.tmpReserveNum
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (delTmpReserveParams !== undefined) {
|
|
110
|
+
// COAで仮予約取消
|
|
111
|
+
try {
|
|
112
|
+
const reserveService = new COA.service.Reserve({
|
|
113
|
+
endpoint: credentials_1.credentials.coa.endpoint,
|
|
114
|
+
auth: coaAuthClient
|
|
115
|
+
}, { timeout: credentials_1.credentials.coa.timeout });
|
|
116
|
+
yield reserveService.delTmpReserve(delTmpReserveParams);
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
let deleted = false;
|
|
120
|
+
// COAサービスエラーの場合ハンドリング
|
|
121
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
122
|
+
/* istanbul ignore if */
|
|
123
|
+
if (error.name === 'COAServiceError') {
|
|
124
|
+
if (Number.isInteger(error.code) && error.code < http_status_1.INTERNAL_SERVER_ERROR) {
|
|
125
|
+
// すでに取消済の場合こうなるので、okとする
|
|
126
|
+
if (error.message === '座席取消失敗') {
|
|
127
|
+
deleted = true;
|
|
107
128
|
}
|
|
108
129
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
130
|
+
}
|
|
131
|
+
if (!deleted) {
|
|
132
|
+
throw error;
|
|
112
133
|
}
|
|
113
134
|
}
|
|
114
135
|
}
|
|
@@ -4,8 +4,9 @@ export import WebAPIIdentifier = factory.service.webAPI.Identifier;
|
|
|
4
4
|
export type IAcceptedOffer4COA = factory.action.authorize.offer.seatReservation.IAcceptedOffer<factory.service.webAPI.Identifier.COA>;
|
|
5
5
|
export declare function createAuthorizeSeatReservationActionAttributes(params: {
|
|
6
6
|
acceptedOffers: factory.action.authorize.offer.seatReservation.IAcceptedOffer<factory.service.webAPI.Identifier.COA>[];
|
|
7
|
-
event: IMinimizedIndividualEvent<factory.eventType.ScreeningEvent>;
|
|
7
|
+
event: Pick<IMinimizedIndividualEvent<factory.eventType.ScreeningEvent>, 'id' | 'typeOf'>;
|
|
8
8
|
transaction: factory.transaction.ITransaction<factory.transactionType.PlaceOrder>;
|
|
9
|
+
pendingTransaction: factory.action.authorize.offer.seatReservation.ICOAPendingTransaction;
|
|
9
10
|
}): factory.action.authorize.offer.seatReservation.IAttributes<WebAPIIdentifier.COA>;
|
|
10
11
|
/**
|
|
11
12
|
* 供給情報から承認アクションの価格を導き出す
|
|
@@ -17,20 +17,18 @@ function createAuthorizeSeatReservationActionAttributes(params) {
|
|
|
17
17
|
typeOf: 'WebAPI'
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
|
-
// ↓不要なので廃止(少なくともapiレスポンスにはevent自体含んでいない)(2022-08-19~)
|
|
21
|
-
// superEvent: params.event.superEvent,
|
|
22
20
|
typeOf: params.event.typeOf
|
|
23
21
|
};
|
|
22
|
+
const authorizeObject = {
|
|
23
|
+
typeOf: factory.action.authorize.offer.seatReservation.ObjectType.SeatReservation,
|
|
24
|
+
acceptedOffer: params.acceptedOffers,
|
|
25
|
+
event: authorizeObjectEvent,
|
|
26
|
+
pendingTransaction: params.pendingTransaction
|
|
27
|
+
};
|
|
24
28
|
return {
|
|
25
29
|
project: transaction.project,
|
|
26
30
|
typeOf: factory.actionType.AuthorizeAction,
|
|
27
|
-
object:
|
|
28
|
-
typeOf: factory.action.authorize.offer.seatReservation.ObjectType.SeatReservation,
|
|
29
|
-
acceptedOffer: params.acceptedOffers,
|
|
30
|
-
event: authorizeObjectEvent
|
|
31
|
-
// 不要なので廃止(2022-07-29~)
|
|
32
|
-
// ...{ offers: params.acceptedOffers } // 互換性維持のため
|
|
33
|
-
},
|
|
31
|
+
object: authorizeObject,
|
|
34
32
|
agent: {
|
|
35
33
|
id: transaction.seller.id,
|
|
36
34
|
typeOf: transaction.seller.typeOf,
|
|
@@ -41,8 +39,6 @@ function createAuthorizeSeatReservationActionAttributes(params) {
|
|
|
41
39
|
recipient: {
|
|
42
40
|
typeOf: transaction.agent.typeOf,
|
|
43
41
|
id: transaction.agent.id
|
|
44
|
-
// ↓不要なので廃止(2022-08-19~)
|
|
45
|
-
// ...(transaction.agent.identifier !== undefined) ? { identifier: transaction.agent.identifier } : undefined
|
|
46
42
|
},
|
|
47
43
|
purpose: { typeOf: transaction.typeOf, id: transaction.id },
|
|
48
44
|
instrument: { typeOf: 'WebAPI', identifier: factory.service.webAPI.Identifier.COA }
|
|
@@ -18,8 +18,8 @@ exports.WebAPIIdentifier = factory.service.webAPI.Identifier;
|
|
|
18
18
|
/**
|
|
19
19
|
* COA興行オファー承認
|
|
20
20
|
*/
|
|
21
|
-
// tslint:disable-next-line:max-func-body-length
|
|
22
21
|
function authorize(params) {
|
|
22
|
+
// tslint:disable-next-line:max-func-body-length
|
|
23
23
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
24
24
|
const transaction = yield repos.transaction.findInProgressById({
|
|
25
25
|
typeOf: factory.transactionType.PlaceOrder,
|
|
@@ -28,34 +28,64 @@ function authorize(params) {
|
|
|
28
28
|
if (transaction.agent.id !== params.agent.id) {
|
|
29
29
|
throw new factory.errors.Forbidden('Transaction not yours');
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
seatingTypes
|
|
52
|
-
|
|
53
|
-
|
|
31
|
+
let screeningEvent;
|
|
32
|
+
let acceptedOffers;
|
|
33
|
+
const pendingTransaction = {
|
|
34
|
+
theaterCode: params.result.requestBody.theaterCode,
|
|
35
|
+
dateJouei: params.result.requestBody.dateJouei,
|
|
36
|
+
titleCode: params.result.requestBody.titleCode,
|
|
37
|
+
titleBranchNum: params.result.requestBody.titleBranchNum,
|
|
38
|
+
timeBegin: params.result.requestBody.timeBegin,
|
|
39
|
+
tmpReserveNum: params.result.responseBody.tmpReserveNum,
|
|
40
|
+
transactionNumber: params.result.responseBody.tmpReserveNum,
|
|
41
|
+
typeOf: 'COAReserveTransaction'
|
|
42
|
+
};
|
|
43
|
+
try {
|
|
44
|
+
// イベント取得属性最適化(2023-01-23~)
|
|
45
|
+
screeningEvent =
|
|
46
|
+
yield repos.event.findMinimizedIndividualEventById({ id: params.object.event.id });
|
|
47
|
+
const availablePaymentMethodTypes = yield repos.categoryCode.search({
|
|
48
|
+
project: { id: { $eq: transaction.project.id } },
|
|
49
|
+
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.PaymentMethodType } }
|
|
50
|
+
}, [], []);
|
|
51
|
+
const seatingTypes = yield repos.categoryCode.search({
|
|
52
|
+
project: { id: { $eq: transaction.project.id } },
|
|
53
|
+
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.SeatingType } }
|
|
54
|
+
}, [], []);
|
|
55
|
+
const videoFormatTypes = yield repos.categoryCode.search({
|
|
56
|
+
project: { id: { $eq: transaction.project.id } },
|
|
57
|
+
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.VideoFormatType } }
|
|
58
|
+
}, [], []);
|
|
59
|
+
// COA仮予約後にリクエストが来る前提
|
|
60
|
+
const validateAcceptedOffersResult = yield (0, validateAcceptedOffers_1.validateAcceptedOffers)({
|
|
61
|
+
object: params.object,
|
|
62
|
+
project: { id: transaction.project.id },
|
|
63
|
+
screeningEvent,
|
|
64
|
+
availablePaymentMethodTypes,
|
|
65
|
+
seatingTypes,
|
|
66
|
+
videoFormatTypes
|
|
67
|
+
})(repos);
|
|
68
|
+
acceptedOffers = validateAcceptedOffersResult.acceptedOffers;
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
// アクション開始前に例外がthrowされてもCOA仮予約を取り消す機会をつくるためにFailedアクションを作成する(2023-09-12~)
|
|
72
|
+
const failedActionAttributes = (0, factory_1.createAuthorizeSeatReservationActionAttributes)({
|
|
73
|
+
acceptedOffers: [],
|
|
74
|
+
event: { id: params.object.event.id, typeOf: factory.eventType.ScreeningEvent },
|
|
75
|
+
transaction,
|
|
76
|
+
pendingTransaction
|
|
77
|
+
});
|
|
78
|
+
const failedAction = yield repos.action.start(failedActionAttributes);
|
|
79
|
+
const actionError = Object.assign(Object.assign({}, error), { message: error.message, name: error.name });
|
|
80
|
+
yield repos.action.giveUp({ typeOf: failedAction.typeOf, id: failedAction.id, error: actionError });
|
|
81
|
+
throw error;
|
|
82
|
+
}
|
|
54
83
|
// 承認アクションを開始
|
|
55
84
|
const actionAttributes = (0, factory_1.createAuthorizeSeatReservationActionAttributes)({
|
|
56
85
|
acceptedOffers,
|
|
57
86
|
event: screeningEvent,
|
|
58
|
-
transaction
|
|
87
|
+
transaction,
|
|
88
|
+
pendingTransaction
|
|
59
89
|
});
|
|
60
90
|
const action = yield repos.action.start(actionAttributes);
|
|
61
91
|
try {
|
|
@@ -97,8 +127,6 @@ function authorize(params) {
|
|
|
97
127
|
requestBody: params.result.requestBody,
|
|
98
128
|
responseBody: params.result.responseBody,
|
|
99
129
|
acceptedOffers: acceptedOffers4result
|
|
100
|
-
// 不要なので廃止(2023-03-27~)
|
|
101
|
-
// ...{ updTmpReserveSeatArgs, updTmpReserveSeatResult } // 互換性維持のため
|
|
102
130
|
};
|
|
103
131
|
return yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: result });
|
|
104
132
|
});
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
import * as factory from '../../factory';
|
|
2
2
|
type IMovieTicketTypeChargeSpecification = factory.priceSpecification.IPriceSpecification<factory.priceSpecificationType.MovieTicketTypeChargeSpecification>;
|
|
3
3
|
type ICategoryCodeChargeSpecification = factory.priceSpecification.IPriceSpecification<factory.priceSpecificationType.CategoryCodeChargeSpecification>;
|
|
4
|
+
type ITicketOffer = factory.product.ITicketOffer & {
|
|
5
|
+
parentOffer?: {
|
|
6
|
+
id: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
4
9
|
declare function createCompoundPriceSpec4event(params: {
|
|
5
10
|
eligibleQuantity: factory.quantitativeValue.IQuantitativeValue<factory.unitCode.C62>;
|
|
6
|
-
offer: factory.unitPriceOffer.IUnitPriceOffer
|
|
11
|
+
offer: factory.unitPriceOffer.IUnitPriceOffer & {
|
|
12
|
+
offerIndex?: number;
|
|
13
|
+
parentOffer?: {
|
|
14
|
+
id: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
7
17
|
movieTicketTypeChargeSpecs: IMovieTicketTypeChargeSpecification[];
|
|
8
18
|
videoFormatChargeSpecs: ICategoryCodeChargeSpecification[];
|
|
9
19
|
soundFormatChargeSpecs: ICategoryCodeChargeSpecification[];
|
|
@@ -11,7 +21,5 @@ declare function createCompoundPriceSpec4event(params: {
|
|
|
11
21
|
availability?: factory.itemAvailability;
|
|
12
22
|
addOn: factory.product.IMinimizedTicketAddOn[];
|
|
13
23
|
sortIndex?: number;
|
|
14
|
-
}):
|
|
15
|
-
sortIndex?: number;
|
|
16
|
-
};
|
|
24
|
+
}): ITicketOffer;
|
|
17
25
|
export { createCompoundPriceSpec4event };
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createCompoundPriceSpec4event = void 0;
|
|
4
4
|
const factory = require("../../factory");
|
|
5
|
+
const settings_1 = require("../../settings");
|
|
5
6
|
function categoryCodeChargePriceSpec2component(params) {
|
|
6
7
|
var _a;
|
|
7
8
|
return Object.assign({ id: params.id, typeOf: params.typeOf, name: params.name, price: params.price, priceCurrency: params.priceCurrency, valueAddedTaxIncluded: params.valueAddedTaxIncluded, appliesToCategoryCode: params.appliesToCategoryCode }, (typeof ((_a = params.accounting) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? { accounting: params.accounting } : undefined);
|
|
@@ -69,25 +70,22 @@ function createCompoundPriceSpec4event(params) {
|
|
|
69
70
|
...mvtkPriceComponents
|
|
70
71
|
];
|
|
71
72
|
const compoundPriceSpecification = {
|
|
72
|
-
// 不要な属性を除外(2022-11-02~)
|
|
73
|
-
// project: params.offer.project,
|
|
74
73
|
typeOf: factory.priceSpecificationType.CompoundPriceSpecification,
|
|
75
74
|
priceCurrency: factory.priceCurrency.JPY,
|
|
76
75
|
valueAddedTaxIncluded: true,
|
|
77
76
|
priceComponent
|
|
78
77
|
};
|
|
79
78
|
// 必要な属性のみに限定(2023-02-24~)
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
availability, availableAtOrFrom, category, eligibleMembershipType, eligibleSeatingType, eligibleMonetaryAmount, eligibleSubReservation, priceCurrency, validFrom, validThrough, validRateLimit, additionalProperty, identifier, itemOffered } = params.offer;
|
|
84
|
-
return Object.assign(Object.assign({ name, description, alternateName, color, typeOf, id,
|
|
85
|
-
// addOn,
|
|
86
|
-
// availability,
|
|
87
|
-
availableAtOrFrom, category,
|
|
79
|
+
const { name, description, alternateName, color, typeOf, id, availability, availableAtOrFrom, category, eligibleMembershipType, eligibleSeatingType, eligibleMonetaryAmount, eligibleSubReservation, priceCurrency, validFrom, validThrough, validRateLimit, additionalProperty, identifier, itemOffered, offerIndex, parentOffer } = params.offer;
|
|
80
|
+
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ name, description, alternateName, color, typeOf, id,
|
|
81
|
+
category,
|
|
88
82
|
eligibleMembershipType, eligibleSeatingType, eligibleMonetaryAmount, eligibleSubReservation,
|
|
89
83
|
priceCurrency,
|
|
90
84
|
validFrom, validThrough, validRateLimit, additionalProperty,
|
|
91
|
-
identifier, itemOffered, addOn: params.addOn, eligibleQuantity: params.eligibleQuantity, priceSpecification: compoundPriceSpecification }, (
|
|
85
|
+
identifier, itemOffered, addOn: params.addOn, eligibleQuantity: params.eligibleQuantity, priceSpecification: compoundPriceSpecification }, (!settings_1.USE_OPTIMIZE_TICKET_OFFER)
|
|
86
|
+
? {
|
|
87
|
+
availableAtOrFrom // 最適化(2023-09-10~)
|
|
88
|
+
}
|
|
89
|
+
: undefined), (typeof params.availability === 'string') ? { availability: params.availability } : { availability }), (typeof params.sortIndex === 'number') ? { sortIndex: params.sortIndex } : undefined), (typeof offerIndex === 'number') ? { offerIndex } : undefined), (typeof (parentOffer === null || parentOffer === void 0 ? void 0 : parentOffer.id) === 'string') ? { parentOffer: { id: parentOffer.id } } : undefined);
|
|
92
90
|
}
|
|
93
91
|
exports.createCompoundPriceSpec4event = createCompoundPriceSpec4event;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import * as factory from '../../../factory';
|
|
2
2
|
import { MongoRepository as OfferRepo } from '../../../repo/offer';
|
|
3
|
+
import { MongoRepository as OfferCatalogRepo } from '../../../repo/offerCatalog';
|
|
3
4
|
import { MongoRepository as ProductRepo } from '../../../repo/product';
|
|
5
|
+
type ITicketOffer = factory.product.ITicketOffer & {
|
|
6
|
+
parentOffer?: {
|
|
7
|
+
id: string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
4
10
|
/**
|
|
5
11
|
* プロダクトオファーを検索する
|
|
6
12
|
*/
|
|
@@ -17,9 +23,12 @@ export declare function searchProductOffers(params: {
|
|
|
17
23
|
};
|
|
18
24
|
onlyValid: boolean;
|
|
19
25
|
addSortIndex: boolean;
|
|
26
|
+
useIncludeInDataCatalog: boolean;
|
|
20
27
|
limit?: number;
|
|
21
28
|
page?: number;
|
|
22
29
|
}): (repos: {
|
|
23
30
|
offer: OfferRepo;
|
|
31
|
+
offerCatalog: OfferCatalogRepo;
|
|
24
32
|
product: ProductRepo;
|
|
25
|
-
}) => Promise<
|
|
33
|
+
}) => Promise<ITicketOffer[]>;
|
|
34
|
+
export {};
|
|
@@ -11,9 +11,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.searchProductOffers = void 0;
|
|
13
13
|
const factory = require("../../../factory");
|
|
14
|
+
const settings_1 = require("../../../settings");
|
|
14
15
|
/**
|
|
15
16
|
* プロダクトオファーを検索する
|
|
16
17
|
*/
|
|
18
|
+
// tslint:disable-next-line:max-func-body-length
|
|
17
19
|
function searchProductOffers(params) {
|
|
18
20
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
19
21
|
var _a;
|
|
@@ -23,20 +25,53 @@ function searchProductOffers(params) {
|
|
|
23
25
|
if (typeof offerCatalogId !== 'string') {
|
|
24
26
|
return [];
|
|
25
27
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
// サブカタログIDを決定
|
|
29
|
+
let subOfferCatalogId = offerCatalogId;
|
|
30
|
+
const offerCatalogFirstElement = yield repos.offerCatalog.findFirstItemListElementById({ id: offerCatalogId });
|
|
31
|
+
if (offerCatalogFirstElement.typeOf === 'OfferCatalog') {
|
|
32
|
+
subOfferCatalogId = offerCatalogFirstElement.id;
|
|
33
|
+
}
|
|
34
|
+
let offers;
|
|
35
|
+
let sortedOfferIds;
|
|
36
|
+
if (params.addSortIndex) {
|
|
37
|
+
// addSortIndexの場合はid指定廃止(2023-09-13~)
|
|
38
|
+
if (Array.isArray(params.ids)) {
|
|
39
|
+
throw new factory.errors.NotImplemented('id specification on addSortIndex not implemented');
|
|
40
|
+
}
|
|
41
|
+
const searchByOfferCatalogIdResult = yield repos.offer.searchByOfferCatalogIdWithSortIndex({
|
|
42
|
+
// ids: params.ids,
|
|
43
|
+
subOfferCatalog: { id: subOfferCatalogId },
|
|
44
|
+
excludeAppliesToMovieTicket: false,
|
|
45
|
+
limit: params.limit,
|
|
46
|
+
page: params.page,
|
|
47
|
+
onlyValid: params.onlyValid === true,
|
|
48
|
+
availableAtOrFrom: params.availableAt,
|
|
49
|
+
useIncludeInDataCatalog: params.useIncludeInDataCatalog
|
|
50
|
+
});
|
|
51
|
+
offers = searchByOfferCatalogIdResult.offers;
|
|
52
|
+
sortedOfferIds = searchByOfferCatalogIdResult.sortedOfferIds;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
// addSortIndexの場合はid指定廃止(2023-09-13~)
|
|
56
|
+
if (!Array.isArray(params.ids)) {
|
|
57
|
+
throw new factory.errors.ArgumentNull('ids', 'ids must be specified');
|
|
58
|
+
}
|
|
59
|
+
const searchByOfferCatalogIdResult = yield repos.offer.searchByIdsAndOfferCatalogId({
|
|
60
|
+
ids: params.ids,
|
|
61
|
+
subOfferCatalog: { id: subOfferCatalogId },
|
|
62
|
+
excludeAppliesToMovieTicket: false,
|
|
63
|
+
limit: params.limit,
|
|
64
|
+
page: params.page,
|
|
65
|
+
onlyValid: params.onlyValid === true,
|
|
66
|
+
availableAtOrFrom: params.availableAt
|
|
67
|
+
});
|
|
68
|
+
offers = searchByOfferCatalogIdResult.offers;
|
|
69
|
+
}
|
|
36
70
|
return offers.map((o) => {
|
|
71
|
+
var _a;
|
|
37
72
|
let sortIndex;
|
|
38
73
|
if (params.addSortIndex) {
|
|
39
|
-
sortIndex = sortedOfferIds.indexOf(String(o.id));
|
|
74
|
+
sortIndex = sortedOfferIds === null || sortedOfferIds === void 0 ? void 0 : sortedOfferIds.indexOf(String(o.id));
|
|
40
75
|
}
|
|
41
76
|
const unitSpec = o.priceSpecification;
|
|
42
77
|
const compoundPriceSpecification = {
|
|
@@ -47,7 +82,11 @@ function searchProductOffers(params) {
|
|
|
47
82
|
...(unitSpec !== undefined) ? [unitSpec] : []
|
|
48
83
|
]
|
|
49
84
|
};
|
|
50
|
-
return Object.assign(Object.assign(Object.assign({ additionalProperty: (Array.isArray(o.additionalProperty)) ? o.additionalProperty : [], alternateName: o.alternateName, availability: o.availability,
|
|
85
|
+
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ additionalProperty: (Array.isArray(o.additionalProperty)) ? o.additionalProperty : [], alternateName: o.alternateName, availability: o.availability, color: o.color, description: o.description, id: o.id, identifier: o.identifier, itemOffered: o.itemOffered, name: o.name, priceCurrency: o.priceCurrency, typeOf: o.typeOf, priceSpecification: compoundPriceSpecification }, (!settings_1.USE_OPTIMIZE_TICKET_OFFER)
|
|
86
|
+
? {
|
|
87
|
+
availableAtOrFrom: o.availableAtOrFrom // 最適化(2023-09-10~)
|
|
88
|
+
}
|
|
89
|
+
: undefined), (o.validFrom instanceof Date) ? { validFrom: o.validFrom } : undefined), (o.validThrough instanceof Date) ? { validThrough: o.validThrough } : undefined), (typeof sortIndex === 'number') ? { sortIndex } : undefined), (typeof o.offerIndex === 'number') ? { offerIndex: o.offerIndex } : undefined), (typeof ((_a = o.parentOffer) === null || _a === void 0 ? void 0 : _a.id) === 'string') ? { parentOffer: { id: o.parentOffer.id } } : undefined);
|
|
51
90
|
});
|
|
52
91
|
});
|
|
53
92
|
}
|
|
@@ -55,8 +55,10 @@ export declare function search(params: {
|
|
|
55
55
|
limit?: number;
|
|
56
56
|
page?: number;
|
|
57
57
|
addSortIndex: boolean;
|
|
58
|
+
useIncludeInDataCatalog: boolean;
|
|
58
59
|
}): (repos: {
|
|
59
60
|
offer: OfferRepo;
|
|
61
|
+
offerCatalog: OfferCatalogRepo;
|
|
60
62
|
product: ProductRepo;
|
|
61
63
|
}) => Promise<{
|
|
62
64
|
offers: factory.product.ITicketOffer[];
|
|
@@ -66,7 +66,8 @@ function search(params) {
|
|
|
66
66
|
itemOffered: { id: params.itemOffered.id },
|
|
67
67
|
availableAt: params.availableAt,
|
|
68
68
|
onlyValid: params.onlyValid,
|
|
69
|
-
addSortIndex: params.addSortIndex
|
|
69
|
+
addSortIndex: params.addSortIndex,
|
|
70
|
+
useIncludeInDataCatalog: params.useIncludeInDataCatalog
|
|
70
71
|
})(repos);
|
|
71
72
|
return { offers, product };
|
|
72
73
|
// Mongoへ移行(2023-03-01~)
|
|
@@ -211,7 +212,7 @@ function fixProductAndOffers(params) {
|
|
|
211
212
|
if (product === undefined) {
|
|
212
213
|
throw new factory.errors.NotFound('Product');
|
|
213
214
|
}
|
|
214
|
-
const { offers } = yield search(Object.assign({ ids: params.object.map((o) => String(o.id)), project: { id: params.project.id }, itemOffered: { id: String(product.id) }, onlyValid: true, addSortIndex: false }, (typeof ((_c = params.location) === null || _c === void 0 ? void 0 : _c.id) === 'string') ? { availableAt: { id: params.location.id } } : undefined))(repos);
|
|
215
|
+
const { offers } = yield search(Object.assign({ ids: params.object.map((o) => String(o.id)), project: { id: params.project.id }, itemOffered: { id: String(product.id) }, onlyValid: true, addSortIndex: false, useIncludeInDataCatalog: false }, (typeof ((_c = params.location) === null || _c === void 0 ? void 0 : _c.id) === 'string') ? { availableAt: { id: params.location.id } } : undefined))(repos);
|
|
215
216
|
return { product, availableOffers: offers };
|
|
216
217
|
});
|
|
217
218
|
}
|
|
@@ -135,7 +135,8 @@ function onEventChanged(params) {
|
|
|
135
135
|
return { id };
|
|
136
136
|
}),
|
|
137
137
|
// 新規作成の場合は強制的に集計
|
|
138
|
-
force: params.isNew
|
|
138
|
+
force: params.isNew,
|
|
139
|
+
identifier: `onEventChanged`
|
|
139
140
|
})(repos);
|
|
140
141
|
}
|
|
141
142
|
// 通知タスク作成(2023-06-08~)
|
|
@@ -184,9 +185,12 @@ function createAggregateScreeningEventIfNotExist(params) {
|
|
|
184
185
|
const project = {
|
|
185
186
|
id: params.project.id, typeOf: factory.organizationType.Project
|
|
186
187
|
};
|
|
188
|
+
const nowInMilliseconds = Date.now();
|
|
187
189
|
if (params.force) {
|
|
188
190
|
aggregateTasks = params.reservationFor.map((reservationFor) => {
|
|
191
|
+
const taskIdentifier = `${params.project.id}:${factory.taskName.AggregateScreeningEvent}:${reservationFor.id}:${params.identifier}:${nowInMilliseconds}`;
|
|
189
192
|
return {
|
|
193
|
+
identifier: taskIdentifier,
|
|
190
194
|
project,
|
|
191
195
|
name: factory.taskName.AggregateScreeningEvent,
|
|
192
196
|
status: factory.taskStatus.Ready,
|
|
@@ -209,7 +213,9 @@ function createAggregateScreeningEventIfNotExist(params) {
|
|
|
209
213
|
}, { _id: 1 })
|
|
210
214
|
.exec();
|
|
211
215
|
if (readyAggregateScreeningEventTaskDoc === null) {
|
|
216
|
+
const taskIdentifier = `${params.project.id}:${factory.taskName.AggregateScreeningEvent}:${reservationFor.id}:${params.identifier}:${nowInMilliseconds}`;
|
|
212
217
|
aggregateTasks.push({
|
|
218
|
+
identifier: taskIdentifier,
|
|
213
219
|
project,
|
|
214
220
|
name: factory.taskName.AggregateScreeningEvent,
|
|
215
221
|
status: factory.taskStatus.Ready,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as factory from '../../factory';
|
|
2
2
|
import { MongoRepository as AccountingReportRepo } from '../../repo/accountingReport';
|
|
3
3
|
import { MongoRepository as ActionRepo } from '../../repo/action';
|
|
4
|
-
import { RedisRepository as RegisterServiceInProgressRepo } from '../../repo/action/registerServiceInProgress';
|
|
5
4
|
import { MongoRepository as AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
6
5
|
import { MongoRepository as EventRepo } from '../../repo/event';
|
|
7
6
|
import { MongoRepository as OrderRepo } from '../../repo/order';
|
|
@@ -21,6 +20,5 @@ declare function confirmPayTransaction(data: factory.task.IData<factory.taskName
|
|
|
21
20
|
seller: SellerRepo;
|
|
22
21
|
task: TaskRepo;
|
|
23
22
|
transaction: TransactionRepo;
|
|
24
|
-
registerServiceInProgress: RegisterServiceInProgressRepo;
|
|
25
23
|
}) => Promise<void>;
|
|
26
24
|
export { confirmPayTransaction };
|