@chevre/domain 21.37.0-alpha.8 → 21.37.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/processOrder.ts +87 -0
- package/example/src/chevre/transaction/processPlaceOrder.ts +17 -143
- package/lib/chevre/factory/reservedAgentIdentifireNames.js +2 -1
- package/lib/chevre/factory/transaction.d.ts +1 -4
- package/lib/chevre/repo/passport.d.ts +39 -0
- package/lib/chevre/repo/passport.js +134 -0
- package/lib/chevre/repo/task.d.ts +9 -0
- package/lib/chevre/repo/task.js +23 -2
- package/lib/chevre/repository.d.ts +5 -0
- package/lib/chevre/repository.js +15 -2
- package/lib/chevre/service/accountTransaction/deposit.js +0 -1
- package/lib/chevre/service/accountTransaction/transfer.js +0 -1
- package/lib/chevre/service/accountTransaction/withdraw.js +0 -1
- package/lib/chevre/service/assetTransaction/reserve/cancel.d.ts +22 -0
- package/lib/chevre/service/assetTransaction/reserve/cancel.js +41 -0
- package/lib/chevre/service/assetTransaction/reserve/confirm/factory.d.ts +8 -0
- package/lib/chevre/service/assetTransaction/reserve/confirm/factory.js +94 -0
- package/lib/chevre/service/assetTransaction/reserve/confirm.d.ts +19 -0
- package/lib/chevre/service/assetTransaction/reserve/confirm.js +93 -0
- package/lib/chevre/service/assetTransaction/reserve/exportTasksById.d.ts +15 -0
- package/lib/chevre/service/assetTransaction/reserve/exportTasksById.js +99 -0
- package/lib/chevre/service/assetTransaction/reserve/start/createSubReservations.d.ts +28 -0
- package/lib/chevre/service/assetTransaction/reserve/start/createSubReservations.js +405 -0
- package/lib/chevre/service/assetTransaction/reserve/start/factory/createPointAward.d.ts +15 -0
- package/lib/chevre/service/assetTransaction/reserve/start/factory/createPointAward.js +40 -0
- package/lib/chevre/service/assetTransaction/reserve/start/factory/createReservation.d.ts +54 -0
- package/lib/chevre/service/assetTransaction/reserve/{factory.js → start/factory/createReservation.js} +3 -222
- package/lib/chevre/service/assetTransaction/reserve/start/factory/createStartParams.d.ts +22 -0
- package/lib/chevre/service/assetTransaction/reserve/start/factory/createStartParams.js +90 -0
- package/lib/chevre/service/assetTransaction/reserve/{factory → start/factory}/price.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/reserve/{factory → start/factory}/price.js +1 -1
- package/lib/chevre/service/assetTransaction/reserve/start.d.ts +74 -0
- package/lib/chevre/service/assetTransaction/reserve/start.js +570 -0
- package/lib/chevre/service/assetTransaction/reserve.d.ts +6 -128
- package/lib/chevre/service/assetTransaction/reserve.js +9 -1047
- package/lib/chevre/service/offer/event/{defaultOffer.d.ts → authorize/defaultOffer.d.ts} +1 -1
- package/lib/chevre/service/offer/event/{defaultOffer.js → authorize/defaultOffer.js} +1 -1
- package/lib/chevre/service/offer/event/{factory.d.ts → authorize/factory.d.ts} +13 -20
- package/lib/chevre/service/offer/event/{factory.js → authorize/factory.js} +72 -146
- package/lib/chevre/service/offer/event/{processStartReserve4chevre.d.ts → authorize/processStartReserve4chevre.d.ts} +19 -19
- package/lib/chevre/service/offer/event/{processStartReserve4chevre.js → authorize/processStartReserve4chevre.js} +8 -13
- package/lib/chevre/service/offer/event/authorize.d.ts +1 -1
- package/lib/chevre/service/offer/event/authorize.js +104 -128
- package/lib/chevre/service/offer/event/importFromCOA/factory.d.ts +9 -0
- package/lib/chevre/service/offer/event/importFromCOA/factory.js +67 -0
- package/lib/chevre/service/offer/event/importFromCOA.js +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +0 -3
- package/lib/chevre/service/offer/eventServiceByCOA/factory.d.ts +3 -3
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.d.ts +4 -4
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/processOrder.d.ts +16 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/processOrder.js +168 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.d.ts +4 -5
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +4 -135
- package/lib/chevre/service/order/onOrderStatusChanged.d.ts +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged.js +2 -1
- package/lib/chevre/service/order.d.ts +2 -2
- package/lib/chevre/service/order.js +2 -1
- package/lib/chevre/service/transaction/moneyTransfer.d.ts +3 -2
- package/lib/chevre/service/transaction/moneyTransfer.js +1 -2
- package/lib/chevre/service/transaction/placeOrderInProgress/start/factory.d.ts +10 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/start/factory.js +36 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/start.d.ts +6 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/start.js +26 -12
- package/lib/chevre/service/validation/validateOrder.js +1 -1
- package/lib/chevre/settings.d.ts +1 -0
- package/lib/chevre/settings.js +5 -1
- package/package.json +3 -3
- package/example/src/chevre/migrateAuthorizeEventServiceOfferResult.ts +0 -163
- package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +0 -96
- package/lib/chevre/service/transaction/placeOrderInProgress/factory.d.ts +0 -2
- package/lib/chevre/service/transaction/placeOrderInProgress/factory.js +0 -29
- package/lib/chevre/service/transaction/validation.d.ts +0 -14
- package/lib/chevre/service/transaction/validation.js +0 -101
|
@@ -8,80 +8,53 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
-
var t = {};
|
|
13
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
-
t[p] = s[p];
|
|
15
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
-
t[p[i]] = s[p[i]];
|
|
19
|
-
}
|
|
20
|
-
return t;
|
|
21
|
-
};
|
|
22
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
12
|
exports.authorize = void 0;
|
|
24
13
|
const factory = require("../../../factory");
|
|
25
14
|
const any_1 = require("../any");
|
|
26
|
-
const defaultOffer_1 = require("./defaultOffer");
|
|
27
|
-
const
|
|
15
|
+
const defaultOffer_1 = require("./authorize/defaultOffer");
|
|
16
|
+
const factory_1 = require("./authorize/factory");
|
|
17
|
+
const processStartReserve4chevre_1 = require("./authorize/processStartReserve4chevre");
|
|
28
18
|
const searchEventTicketOffers_1 = require("./searchEventTicketOffers");
|
|
29
|
-
const factory_1 = require("./factory");
|
|
30
19
|
/**
|
|
31
20
|
* 興行オファー承認
|
|
32
21
|
*/
|
|
33
22
|
function authorize(params) {
|
|
34
|
-
// tslint:disable-next-line:max-func-body-length
|
|
35
23
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
36
24
|
var _a;
|
|
37
25
|
const noOfferSpecified = params.noOfferSpecified === true;
|
|
38
|
-
const { transaction, event
|
|
26
|
+
const { transaction, event } = yield validateCreateRequest(params)(repos);
|
|
39
27
|
const { acceptedOffers, ticketOffers, unitPriceOffers } = yield validateAcceptedOffers({
|
|
40
28
|
object: params.object,
|
|
41
29
|
event,
|
|
42
|
-
seller: { typeOf: transaction.seller.typeOf, id:
|
|
30
|
+
seller: { typeOf: transaction.seller.typeOf, id: transaction.seller.id },
|
|
43
31
|
transaction,
|
|
44
32
|
store: params.store,
|
|
45
33
|
noOfferSpecified
|
|
46
34
|
})(repos);
|
|
47
35
|
let acceptedOffers4result = [];
|
|
48
|
-
//
|
|
36
|
+
// まず取引番号発行
|
|
49
37
|
const { transactionNumber } = yield repos.transactionNumber.publishByTimestamp({ startDate: new Date() });
|
|
50
|
-
// 承認アクションを開始
|
|
51
38
|
const actionAttributes = (0, factory_1.createAuthorizeSeatReservationActionAttributes)({
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
transaction: transaction,
|
|
55
|
-
instrument: { transactionNumber },
|
|
56
|
-
broker: params.object.broker
|
|
39
|
+
event, transaction,
|
|
40
|
+
instrument: { transactionNumber }
|
|
57
41
|
});
|
|
58
42
|
const action = yield repos.action.start(actionAttributes);
|
|
59
43
|
try {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
//
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
// if (params.options.useCreateOrderOnOfferAccepted) {
|
|
75
|
-
yield (0, any_1.acceptOffer)({
|
|
76
|
-
project: transaction.project,
|
|
77
|
-
purpose: { id: transaction.id },
|
|
78
|
-
acceptedOffers: acceptedOffers4result
|
|
79
|
-
})(repos);
|
|
80
|
-
// }
|
|
81
|
-
}
|
|
82
|
-
break;
|
|
83
|
-
default:
|
|
84
|
-
throw new factory.errors.Argument('Event', `Unknown booking service '${bookingServiceIdentifire}'`);
|
|
44
|
+
const processStartReserveResult = yield (0, processStartReserve4chevre_1.processStartReserve4chevre)(Object.assign({ acceptedOffers, event,
|
|
45
|
+
transactionNumber, transaction, availableAtOrFrom: { id: params.store.id }, ticketOffers, unitPriceOffers, validateEvent: params.validateEvent === true, validateEventOfferPeriod: params.validateEventOfferPeriod === true,
|
|
46
|
+
// useHoldStockByTransactionNumber: params.useHoldStockByTransactionNumber, // discontinue(2024-07-02~)
|
|
47
|
+
stockHoldUntilDaysAfterEventEnd: params.stockHoldUntilDaysAfterEventEnd }, (typeof ((_a = params.object.broker) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? { broker: params.object.broker } : undefined))(repos);
|
|
48
|
+
acceptedOffers4result = processStartReserveResult.acceptedOffers4result;
|
|
49
|
+
// add orderInTransaction(2024-01-15~)
|
|
50
|
+
if (!noOfferSpecified) {
|
|
51
|
+
// if (params.options.useCreateOrderOnOfferAccepted) {
|
|
52
|
+
yield (0, any_1.acceptOffer)({
|
|
53
|
+
project: transaction.project,
|
|
54
|
+
purpose: { id: transaction.id },
|
|
55
|
+
acceptedOffers: acceptedOffers4result
|
|
56
|
+
})(repos);
|
|
57
|
+
// }
|
|
85
58
|
}
|
|
86
59
|
}
|
|
87
60
|
catch (error) {
|
|
@@ -91,25 +64,16 @@ function authorize(params) {
|
|
|
91
64
|
catch (__) {
|
|
92
65
|
// no op
|
|
93
66
|
}
|
|
94
|
-
switch (bookingServiceIdentifire) {
|
|
95
|
-
case factory.service.webAPI.Identifier.COA:
|
|
96
|
-
// error = handleCOAReserveTemporarilyError(error);
|
|
97
|
-
break;
|
|
98
|
-
case factory.service.webAPI.Identifier.Chevre:
|
|
99
|
-
// error = handleChevreError(error);
|
|
100
|
-
break;
|
|
101
|
-
default:
|
|
102
|
-
}
|
|
103
67
|
throw error;
|
|
104
68
|
}
|
|
105
|
-
const result = (0, factory_1.acceptedOffers2authorizeResult)({ acceptedOffers, acceptedOffers4result, noOfferSpecified });
|
|
69
|
+
const result = (0, factory_1.acceptedOffers2authorizeResult)({ acceptedOffers, acceptedOffers4result, noOfferSpecified, ticketOffers });
|
|
106
70
|
return yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: result });
|
|
107
71
|
});
|
|
108
72
|
}
|
|
109
73
|
exports.authorize = authorize;
|
|
110
74
|
function validateCreateRequest(params) {
|
|
111
75
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
112
|
-
var _a, _b
|
|
76
|
+
var _a, _b;
|
|
113
77
|
const transaction = yield repos.transaction.findInProgressById({
|
|
114
78
|
typeOf: factory.transactionType.PlaceOrder,
|
|
115
79
|
id: params.transaction.id
|
|
@@ -118,9 +82,6 @@ function validateCreateRequest(params) {
|
|
|
118
82
|
throw new factory.errors.Forbidden('Transaction not yours');
|
|
119
83
|
}
|
|
120
84
|
// クライアント検証(2024-02-07~)
|
|
121
|
-
// if (transaction.object.clientUser?.client_id !== params.store.id) {
|
|
122
|
-
// throw new factory.errors.Forbidden('client not match that of the transaction');
|
|
123
|
-
// }
|
|
124
85
|
const instrumentId = (_a = transaction.instrument) === null || _a === void 0 ? void 0 : _a.id;
|
|
125
86
|
if (typeof instrumentId === 'string' && instrumentId !== params.store.id) {
|
|
126
87
|
throw new factory.errors.Forbidden('client not match that of the transaction');
|
|
@@ -133,12 +94,12 @@ function validateCreateRequest(params) {
|
|
|
133
94
|
const event = yield repos.event.findMinimizedIndividualEventById({
|
|
134
95
|
id: params.object.reservationFor.id
|
|
135
96
|
});
|
|
136
|
-
let offeredThrough =
|
|
137
|
-
if (offeredThrough === undefined) {
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
const bookingServiceIdentifire = offeredThrough.identifier;
|
|
141
|
-
return { transaction, event
|
|
97
|
+
// let offeredThrough = event.offers?.offeredThrough;
|
|
98
|
+
// if (offeredThrough === undefined) {
|
|
99
|
+
// offeredThrough = { typeOf: 'WebAPI', identifier: factory.service.webAPI.Identifier.Chevre };
|
|
100
|
+
// }
|
|
101
|
+
// const bookingServiceIdentifire = offeredThrough.identifier;
|
|
102
|
+
return { transaction, event };
|
|
142
103
|
});
|
|
143
104
|
}
|
|
144
105
|
/**
|
|
@@ -193,53 +154,64 @@ function validateAcceptedOffers(params) {
|
|
|
193
154
|
return acceptedOfferWithoutDetail2acceptedOffer({
|
|
194
155
|
availableTicketOffers: ticketOffers,
|
|
195
156
|
offerWithoutDetail,
|
|
196
|
-
event: params.event,
|
|
157
|
+
// event: params.event,
|
|
197
158
|
transaction: params.transaction,
|
|
198
159
|
seller: params.seller
|
|
199
160
|
})();
|
|
200
161
|
})))
|
|
201
162
|
: [];
|
|
163
|
+
// reserveTransaction.startへ処理を移行(2024-07-03~)
|
|
202
164
|
// オファーIDごとにオファー適用条件を確認
|
|
203
|
-
offerIds.forEach((offerId) => {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
}
|
|
165
|
+
// offerIds.forEach((offerId) => {
|
|
166
|
+
// const acceptedOffersByOfferId = acceptedOffers.filter((o) => o.id === offerId);
|
|
167
|
+
// const numAcceptedOffersByOfferId = acceptedOffersByOfferId.length;
|
|
168
|
+
// let referenceQuantityValue = 1;
|
|
169
|
+
// // 単価仕様を取り出す
|
|
170
|
+
// const unitPriceSpec = acceptedOffersByOfferId[0].priceSpecification.priceComponent.find(
|
|
171
|
+
// (spec) => spec.typeOf === factory.priceSpecificationType.UnitPriceSpecification && (!Array.isArray(spec.appliesToAddOn))
|
|
172
|
+
// );
|
|
173
|
+
// // 単価仕様は必ず存在するはず
|
|
174
|
+
// if (unitPriceSpec?.typeOf !== factory.priceSpecificationType.UnitPriceSpecification) {
|
|
175
|
+
// throw new factory.errors.Internal(`unitPriceSpec of the offer '${offerId}' not found`);
|
|
176
|
+
// }
|
|
177
|
+
// const unitPriceSpecReferenceQuantityValue = unitPriceSpec.referenceQuantity?.value;
|
|
178
|
+
// if (typeof unitPriceSpecReferenceQuantityValue === 'number') {
|
|
179
|
+
// referenceQuantityValue = unitPriceSpecReferenceQuantityValue;
|
|
180
|
+
// }
|
|
181
|
+
// // アイテム数が適用単位要件を満たしていなければエラー
|
|
182
|
+
// if (numAcceptedOffersByOfferId % referenceQuantityValue !== 0) {
|
|
183
|
+
// throw new factory.errors.Argument(
|
|
184
|
+
// 'acceptedOffers',
|
|
185
|
+
// `Offer ${offerId} requires reference quantity value ${referenceQuantityValue}`
|
|
186
|
+
// );
|
|
187
|
+
// }
|
|
188
|
+
// // 適用数量要件を満たしていなければエラー
|
|
189
|
+
// const maxValue = unitPriceSpec.eligibleQuantity?.maxValue;
|
|
190
|
+
// if (typeof maxValue === 'number') {
|
|
191
|
+
// if (numAcceptedOffersByOfferId > maxValue) {
|
|
192
|
+
// throw new factory.errors.Argument(
|
|
193
|
+
// 'acceptedOffers',
|
|
194
|
+
// `Number of offer:${offerId} must be less than or equal to ${maxValue}`
|
|
195
|
+
// );
|
|
196
|
+
// }
|
|
197
|
+
// }
|
|
198
|
+
// const minValue = unitPriceSpec.eligibleQuantity?.minValue;
|
|
199
|
+
// if (typeof minValue === 'number') {
|
|
200
|
+
// if (numAcceptedOffersByOfferId < minValue) {
|
|
201
|
+
// throw new factory.errors.Argument(
|
|
202
|
+
// 'acceptedOffers',
|
|
203
|
+
// `Number of offer:${offerId} must be more than or equal to ${minValue}`
|
|
204
|
+
// );
|
|
205
|
+
// }
|
|
206
|
+
// }
|
|
207
|
+
// });
|
|
236
208
|
return { acceptedOffers, ticketOffers, unitPriceOffers };
|
|
237
209
|
});
|
|
238
210
|
}
|
|
239
211
|
function acceptedOfferWithoutDetail2acceptedOffer(params) {
|
|
240
212
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
241
213
|
return () => __awaiter(this, void 0, void 0, function* () {
|
|
242
|
-
var _a, _b, _c
|
|
214
|
+
var _a, _b, _c;
|
|
243
215
|
const availableTicketOffers = params.availableTicketOffers;
|
|
244
216
|
const offerWithoutDetail = params.offerWithoutDetail;
|
|
245
217
|
const offer = availableTicketOffers.find((o) => o.id === offerWithoutDetail.id);
|
|
@@ -253,13 +225,21 @@ function acceptedOfferWithoutDetail2acceptedOffer(params) {
|
|
|
253
225
|
});
|
|
254
226
|
const acceptedAppliesToMovieTicket = (_a = offerWithoutDetail.priceSpecification) === null || _a === void 0 ? void 0 : _a.appliesToMovieTicket;
|
|
255
227
|
// 承認アクションオブジェクトのacceptedOfferにappliesToMovieTicketを連携する(2022-08-02~)
|
|
256
|
-
const priceSpecification =
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
228
|
+
// const priceSpecification: IAcceptedOfferPriceSpecification = {
|
|
229
|
+
// // 必要な属性のみに最適化(2024-04-09~)
|
|
230
|
+
// // ...offer.priceSpecification,
|
|
231
|
+
// typeOf: offer.priceSpecification.typeOf,
|
|
232
|
+
// priceCurrency: offer.priceSpecification.priceCurrency,
|
|
233
|
+
// // valueAddedTaxIncluded: offer.priceSpecification.valueAddedTaxIncluded,
|
|
234
|
+
// priceComponent: offer.priceSpecification.priceComponent.map(({
|
|
235
|
+
// name, accounting, id, priceCurrency, valueAddedTaxIncluded, ...necessaryComponentFields
|
|
236
|
+
// }) => necessaryComponentFields),
|
|
237
|
+
// // appliesToMovieTicket.identifierを連携する
|
|
238
|
+
// ...(Array.isArray(acceptedAppliesToMovieTicket) || typeof acceptedAppliesToMovieTicket?.identifier === 'string')
|
|
239
|
+
// ? { appliesToMovieTicket: acceptedAppliesToMovieTicket }
|
|
240
|
+
// : undefined
|
|
241
|
+
// };
|
|
242
|
+
const priceSpecification = Object.assign({}, (Array.isArray(acceptedAppliesToMovieTicket) || typeof (acceptedAppliesToMovieTicket === null || acceptedAppliesToMovieTicket === void 0 ? void 0 : acceptedAppliesToMovieTicket.identifier) === 'string')
|
|
263
243
|
? { appliesToMovieTicket: acceptedAppliesToMovieTicket }
|
|
264
244
|
: undefined);
|
|
265
245
|
const acceptedAddOns = (Array.isArray(offerWithoutDetail.addOn))
|
|
@@ -302,28 +282,24 @@ function acceptedOfferWithoutDetail2acceptedOffer(params) {
|
|
|
302
282
|
// no op
|
|
303
283
|
}
|
|
304
284
|
}
|
|
305
|
-
|
|
285
|
+
return {
|
|
306
286
|
// オファーの中身を最適化する(必要最低限の情報のみに)
|
|
307
|
-
id: String(offer.id),
|
|
287
|
+
id: String(offer.id),
|
|
288
|
+
// identifier: offer.identifier,
|
|
289
|
+
priceSpecification,
|
|
290
|
+
// typeOf: offer.typeOf,
|
|
291
|
+
// priceCurrency: offer.priceCurrency,
|
|
292
|
+
itemOffered: Object.assign(Object.assign({}, (itemOfferedServiceOutput !== undefined) ? { serviceOutput: itemOfferedServiceOutput } : undefined), (pointAward !== undefined) ? { pointAward } : undefined),
|
|
293
|
+
addOn: acceptedAddOns,
|
|
308
294
|
// 追加属性をマージ
|
|
309
295
|
additionalProperty: [
|
|
310
296
|
...(Array.isArray(offerWithoutDetail.additionalProperty)) ? offerWithoutDetail.additionalProperty : [],
|
|
311
297
|
...(Array.isArray(offer.additionalProperty)) ? offer.additionalProperty : []
|
|
312
|
-
]
|
|
313
|
-
|
|
314
|
-
:
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
offeredThrough = { typeOf: 'WebAPI', identifier: factory.service.webAPI.Identifier.Chevre };
|
|
318
|
-
}
|
|
319
|
-
switch (offeredThrough.identifier) {
|
|
320
|
-
case factory.service.webAPI.Identifier.COA:
|
|
321
|
-
// 実質使用する予定なしなので廃止(2022-05-12~)
|
|
322
|
-
throw new factory.errors.NotImplemented(`booking service '${offeredThrough.identifier}' not implemented`);
|
|
323
|
-
default:
|
|
324
|
-
// no op
|
|
325
|
-
}
|
|
326
|
-
return acceptedOffer;
|
|
298
|
+
]
|
|
299
|
+
// ...(Array.isArray(offer.acceptedPaymentMethod)) // discontinue(2024-07-03~)
|
|
300
|
+
// ? { acceptedPaymentMethod: offer.acceptedPaymentMethod }
|
|
301
|
+
// : undefined
|
|
302
|
+
};
|
|
327
303
|
});
|
|
328
304
|
}
|
|
329
305
|
function createPointAwardByOfferWithoutDetail(params) {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as COA from '@motionpicture/coa-service';
|
|
2
|
+
import * as factory from '../../../../factory';
|
|
3
|
+
declare function coaTicket2offer(params: {
|
|
4
|
+
theaterCode: string;
|
|
5
|
+
ticketResult: COA.factory.master.ITicketResult;
|
|
6
|
+
defaultCurrencyType?: factory.categoryCode.ICategoryCode;
|
|
7
|
+
defaultMembershipType?: factory.categoryCode.ICategoryCode;
|
|
8
|
+
}): factory.aggregateOffer.ISubOffer;
|
|
9
|
+
export { coaTicket2offer };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.coaTicket2offer = void 0;
|
|
4
|
+
const COA = require("@motionpicture/coa-service");
|
|
5
|
+
const util_1 = require("util");
|
|
6
|
+
const factory = require("../../../../factory");
|
|
7
|
+
// tslint:disable-next-line:max-func-body-length
|
|
8
|
+
function coaTicket2offer(params) {
|
|
9
|
+
var _a, _b;
|
|
10
|
+
// 適用通貨区分
|
|
11
|
+
const eligibleMonetaryAmount = (typeof params.ticketResult.usePoint === 'number' && params.ticketResult.usePoint > 0
|
|
12
|
+
&& typeof ((_a = params.defaultCurrencyType) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string')
|
|
13
|
+
? [{
|
|
14
|
+
typeOf: 'MonetaryAmount',
|
|
15
|
+
currency: params.defaultCurrencyType.codeValue,
|
|
16
|
+
value: Number(params.ticketResult.usePoint)
|
|
17
|
+
}]
|
|
18
|
+
: undefined;
|
|
19
|
+
// 適用メンバーシップ区分
|
|
20
|
+
const eligibleMembershipType = (params.ticketResult.flgMember === COA.factory.master.FlgMember.Member
|
|
21
|
+
&& typeof ((_b = params.defaultMembershipType) === null || _b === void 0 ? void 0 : _b.typeOf) === 'string')
|
|
22
|
+
? [{
|
|
23
|
+
typeOf: params.defaultMembershipType.typeOf,
|
|
24
|
+
id: params.defaultMembershipType.id,
|
|
25
|
+
codeValue: params.defaultMembershipType.codeValue,
|
|
26
|
+
inCodeSet: params.defaultMembershipType.inCodeSet
|
|
27
|
+
}]
|
|
28
|
+
: undefined;
|
|
29
|
+
const unitPriceSpec = {
|
|
30
|
+
typeOf: factory.priceSpecificationType.UnitPriceSpecification,
|
|
31
|
+
price: 0,
|
|
32
|
+
priceCurrency: factory.priceCurrency.JPY,
|
|
33
|
+
valueAddedTaxIncluded: true,
|
|
34
|
+
referenceQuantity: {
|
|
35
|
+
typeOf: 'QuantitativeValue',
|
|
36
|
+
unitCode: factory.unitCode.C62,
|
|
37
|
+
value: 1
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const identifier = (0, util_1.format)('%s-%s-%s', factory.service.webAPI.Identifier.COA, params.theaterCode, params.ticketResult.ticketCode);
|
|
41
|
+
const offerName = {
|
|
42
|
+
ja: params.ticketResult.ticketName,
|
|
43
|
+
en: (typeof params.ticketResult.ticketNameEng === 'string')
|
|
44
|
+
? params.ticketResult.ticketNameEng
|
|
45
|
+
: ''
|
|
46
|
+
};
|
|
47
|
+
return Object.assign(Object.assign(Object.assign({ typeOf: factory.offerType.Offer, priceCurrency: factory.priceCurrency.JPY,
|
|
48
|
+
// id: '',
|
|
49
|
+
identifier: identifier, name: offerName, description: {
|
|
50
|
+
ja: '',
|
|
51
|
+
en: ''
|
|
52
|
+
}, alternateName: {
|
|
53
|
+
ja: params.ticketResult.ticketName,
|
|
54
|
+
en: (typeof params.ticketResult.ticketNameEng === 'string')
|
|
55
|
+
? params.ticketResult.ticketNameEng
|
|
56
|
+
: ''
|
|
57
|
+
}, availability: factory.itemAvailability.InStock, itemOffered: {
|
|
58
|
+
typeOf: factory.product.ProductType.EventService
|
|
59
|
+
}, priceSpecification: unitPriceSpec }, (Array.isArray(eligibleMembershipType)) ? { eligibleMembershipType } : undefined), (Array.isArray(eligibleMonetaryAmount)) ? { eligibleMonetaryAmount } : undefined), { additionalProperty: [
|
|
60
|
+
{ name: 'theaterCode', value: params.theaterCode },
|
|
61
|
+
...Object.keys(params.ticketResult)
|
|
62
|
+
.map((key) => {
|
|
63
|
+
return { name: String(key), value: String(params.ticketResult[key]) };
|
|
64
|
+
})
|
|
65
|
+
] });
|
|
66
|
+
}
|
|
67
|
+
exports.coaTicket2offer = coaTicket2offer;
|
|
@@ -11,7 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.importCategoryCodesFromCOA = exports.importFromCOA = void 0;
|
|
13
13
|
const factory = require("../../../factory");
|
|
14
|
-
const factory_1 = require("./factory");
|
|
14
|
+
const factory_1 = require("./importFromCOA/factory");
|
|
15
15
|
function importFromCOA(params) {
|
|
16
16
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
17
17
|
// 通貨区分検索
|
|
@@ -31,9 +31,6 @@ function authorize(params) {
|
|
|
31
31
|
throw new factory.errors.Forbidden('Transaction not yours');
|
|
32
32
|
}
|
|
33
33
|
// クライアント検証(2024-02-07~)
|
|
34
|
-
// if (transaction.object.clientUser?.client_id !== params.store.id) {
|
|
35
|
-
// throw new factory.errors.Forbidden('client not match that of the transaction');
|
|
36
|
-
// }
|
|
37
34
|
const instrumentId = (_a = transaction.instrument) === null || _a === void 0 ? void 0 : _a.id;
|
|
38
35
|
if (typeof instrumentId === 'string' && instrumentId !== params.store.id) {
|
|
39
36
|
throw new factory.errors.Forbidden('client not match that of the transaction');
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as factory from '../../../factory';
|
|
2
2
|
import { IMinimizedIndividualEvent } from '../../../factory/event';
|
|
3
3
|
export import WebAPIIdentifier = factory.service.webAPI.Identifier;
|
|
4
|
-
export type IAcceptedOffer4COA = factory.action.authorize.offer.eventService.
|
|
4
|
+
export type IAcceptedOffer4COA = factory.action.authorize.offer.eventService.IAcceptedOffer4COA;
|
|
5
5
|
export declare function createAuthorizeSeatReservationActionAttributes(params: {
|
|
6
6
|
acceptAction: {
|
|
7
7
|
id: string;
|
|
8
8
|
};
|
|
9
|
-
acceptedOffers: factory.action.authorize.offer.eventService.
|
|
9
|
+
acceptedOffers: factory.action.authorize.offer.eventService.IAcceptedOffer4COA[];
|
|
10
10
|
event: Pick<IMinimizedIndividualEvent<factory.eventType.ScreeningEvent>, 'id' | 'typeOf'>;
|
|
11
11
|
transaction: Pick<factory.transaction.ITransaction<factory.transactionType.PlaceOrder>, 'agent' | 'id' | 'project' | 'seller' | 'typeOf'>;
|
|
12
12
|
pendingTransaction: factory.action.authorize.offer.eventService.ICOAPendingTransaction;
|
|
@@ -24,7 +24,7 @@ type IResultAcceptedOffer = factory.action.authorize.offer.eventService.IResultA
|
|
|
24
24
|
*/
|
|
25
25
|
export declare function responseBody2acceptedOffers4result(params: {
|
|
26
26
|
responseBody: factory.action.authorize.offer.eventService.IResponseBody<factory.service.webAPI.Identifier.COA>;
|
|
27
|
-
acceptedOffer: factory.action.authorize.offer.eventService.
|
|
27
|
+
acceptedOffer: factory.action.authorize.offer.eventService.IAcceptedOffer4COA[];
|
|
28
28
|
event: IMinimizedIndividualEvent<factory.eventType.ScreeningEvent>;
|
|
29
29
|
seller: Pick<factory.transaction.placeOrder.ISeller, 'typeOf' | 'name'>;
|
|
30
30
|
bookingTime: Date;
|
|
@@ -5,15 +5,15 @@ type IProcessingOrder = factory.order.IOrder & {
|
|
|
5
5
|
};
|
|
6
6
|
declare function createInformTasks(order: IProcessingOrder): factory.task.IAttributes<factory.taskName.TriggerWebhook>[];
|
|
7
7
|
declare function createConfirmReservationActionObject4ChevreByOrder(params: {
|
|
8
|
-
order: factory.order.IOrder & {
|
|
8
|
+
order: Pick<factory.order.IOrder, 'confirmationNumber' | 'orderNumber'> & {
|
|
9
9
|
serialNumbers: string[];
|
|
10
10
|
};
|
|
11
11
|
}): factory.action.interact.confirm.reservation.IObject<factory.service.webAPI.Identifier.Chevre>[];
|
|
12
12
|
declare function createConfirmReservationActionObject4COAByOrder(params: {
|
|
13
|
-
order:
|
|
13
|
+
order: {
|
|
14
14
|
serialNumbers: string[];
|
|
15
15
|
};
|
|
16
16
|
}): factory.task.confirmReserveTransaction.IObject4COAOptimized[];
|
|
17
17
|
type IExternalOrder = Pick<factory.order.IOrder, 'project' | 'typeOf' | 'seller' | 'customer' | 'confirmationNumber' | 'orderNumber' | 'price' | 'priceCurrency' | 'orderDate' | 'name' | 'orderStatus' | 'orderedItem' | 'paymentMethods'>;
|
|
18
|
-
declare function createCheckResourceTask(order: IProcessingOrder): factory.task.checkResource.IAttributes;
|
|
19
|
-
export { IExternalOrder, createInformTasks, createCheckResourceTask, createConfirmReservationActionObject4ChevreByOrder, createConfirmReservationActionObject4COAByOrder };
|
|
18
|
+
declare function createCheckResourceTask(order: Pick<IProcessingOrder, 'orderNumber' | 'project' | 'typeOf'>): factory.task.checkResource.IAttributes;
|
|
19
|
+
export { IExternalOrder, IProcessingOrder, createInformTasks, createCheckResourceTask, createConfirmReservationActionObject4ChevreByOrder, createConfirmReservationActionObject4COAByOrder };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { MongoRepository as TaskRepo } from '../../../../repo/task';
|
|
2
|
+
import * as factory from '../../../../factory';
|
|
3
|
+
import { IProcessingOrder } from './factory';
|
|
4
|
+
declare function processOrder(params: {
|
|
5
|
+
order: Pick<IProcessingOrder, 'confirmationNumber' | 'orderDate' | 'orderNumber' | 'project' | 'typeOf'> & {
|
|
6
|
+
itemOfferedTypeOf: factory.order.IItemOffered['typeOf'];
|
|
7
|
+
serialNumbers: string[];
|
|
8
|
+
offeredThroughIdentifier?: factory.service.webAPI.Identifier;
|
|
9
|
+
};
|
|
10
|
+
options: {
|
|
11
|
+
force: boolean;
|
|
12
|
+
};
|
|
13
|
+
}): (repos: {
|
|
14
|
+
task: TaskRepo;
|
|
15
|
+
}) => Promise<void>;
|
|
16
|
+
export { processOrder };
|