@chevre/domain 21.8.0-alpha.6 → 21.8.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/countOffers.ts +32 -0
- package/example/src/chevre/findItemListElementByCatalogId.ts +23 -0
- package/example/src/chevre/importOffersFromCOA.ts +7 -1
- package/example/src/chevre/migrateAggregateOffers.ts +89 -0
- 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/processPay.ts +3 -4
- package/example/src/chevre/publishPermitOwnershipInfoToken.ts +56 -0
- package/example/src/chevre/pullAddOnsFromOffer.ts +26 -0
- package/example/src/chevre/searchAggregateOffers.ts +48 -0
- package/example/src/chevre/searchEventTicketOffers.ts +3 -1
- package/example/src/chevre/searchEvents.ts +9 -7
- package/example/src/chevre/searchOffersByCatalog.ts +9 -5
- package/example/src/chevre/searchOffersFromAggregateOffer.ts +168 -0
- package/example/src/chevre/searchOrders.ts +9 -7
- package/example/src/chevre/sync2aggregateOffer.ts +27 -0
- package/example/src/chevre/syncAggregateOffer.ts +25 -0
- package/lib/chevre/emailMessageBuilder.js +6 -5
- package/lib/chevre/repo/aggregateOffer.d.ts +62 -0
- package/lib/chevre/repo/aggregateOffer.js +534 -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 +177 -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/offer.d.ts +24 -33
- package/lib/chevre/repo/mongoose/schemas/offer.js +4 -3
- 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 +82 -47
- package/lib/chevre/repo/offer.js +1279 -289
- package/lib/chevre/repo/offerCatalog.d.ts +6 -0
- package/lib/chevre/repo/offerCatalog.js +13 -0
- package/lib/chevre/repo/order.d.ts +15 -0
- package/lib/chevre/repo/order.js +58 -26
- package/lib/chevre/repo/task.d.ts +7 -1
- package/lib/chevre/repo/task.js +100 -0
- package/lib/chevre/repository.d.ts +3 -0
- package/lib/chevre/repository.js +5 -1
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +2 -1
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +2 -1
- 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/delivery.js +17 -0
- 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 +1 -0
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +6 -3
- 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 +8 -1
- package/lib/chevre/service/offer/product/searchProductOffers.js +10 -3
- package/lib/chevre/service/offer/product.d.ts +1 -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 +29 -40
- 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 +81 -54
- package/lib/chevre/service/order/payOrder.d.ts +2 -10
- package/lib/chevre/service/order/payOrder.js +4 -45
- package/lib/chevre/service/order/placeOrder.js +11 -13
- 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/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/onOrderPaymentCompleted.d.ts +6 -0
- package/lib/chevre/service/task/onOrderPaymentCompleted.js +35 -0
- 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 +60 -0
- package/lib/chevre/service/task/onResourceUpdated.js +12 -0
- package/lib/chevre/service/task/returnPayTransaction.js +8 -3
- package/lib/chevre/service/task/syncAggregateOffer.d.ts +7 -0
- package/lib/chevre/service/task/syncAggregateOffer.js +23 -0
- 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 +5 -3
- package/lib/chevre/settings.js +6 -6
- package/package.json +3 -3
- package/example/src/chevre/migrateAuthorizePaymentActionResult.ts +0 -83
- package/example/src/chevre/migrateEventOrganizer.ts +0 -154
|
@@ -12,8 +12,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.searchGMOTrade = exports.exportTasksById = exports.cancel = exports.confirm = exports.start = exports.check = exports.invalidatePaymentUrl = exports.publishPaymentUrl = void 0;
|
|
13
13
|
const moment = require("moment");
|
|
14
14
|
const factory = require("../../factory");
|
|
15
|
-
const settings_1 = require("../../settings");
|
|
16
|
-
const payment_1 = require("../payment");
|
|
17
15
|
const CreditCardPayment = require("../payment/creditCard");
|
|
18
16
|
const MovieTicketPayment = require("../payment/movieTicket");
|
|
19
17
|
const PaymentCardPayment = require("../payment/paymentCard");
|
|
@@ -205,7 +203,7 @@ function fixPaymentService(params) {
|
|
|
205
203
|
}
|
|
206
204
|
function validateSeller(params) {
|
|
207
205
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
208
|
-
var _a, _b, _c;
|
|
206
|
+
var _a, _b, _c, _d;
|
|
209
207
|
const sellerId = (_a = params.recipient) === null || _a === void 0 ? void 0 : _a.id;
|
|
210
208
|
if (typeof sellerId !== 'string') {
|
|
211
209
|
throw new factory.errors.ArgumentNull('recipient.id');
|
|
@@ -219,14 +217,26 @@ function validateSeller(params) {
|
|
|
219
217
|
if (seller === undefined) {
|
|
220
218
|
throw new factory.errors.NotFound(factory.organizationType.Corporation);
|
|
221
219
|
}
|
|
222
|
-
const paymentMethodType = (_b = params.object.paymentMethod) === null || _b === void 0 ? void 0 : _b.
|
|
220
|
+
const paymentMethodType = (_b = params.object.paymentMethod) === null || _b === void 0 ? void 0 : _b.identifier;
|
|
223
221
|
if (typeof paymentMethodType !== 'string') {
|
|
224
|
-
throw new factory.errors.ArgumentNull('object.paymentMethod.
|
|
222
|
+
throw new factory.errors.ArgumentNull('object.paymentMethod.identifier');
|
|
225
223
|
}
|
|
226
|
-
//
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
224
|
+
// FaceToFaceの場合、決済方法区分未指定に対応(2023-08-29~)
|
|
225
|
+
if (params.object.typeOf === factory.service.paymentService.PaymentServiceType.FaceToFace) {
|
|
226
|
+
if (paymentMethodType.length > 0) {
|
|
227
|
+
// 販売者の対応決済方法かどうか確認
|
|
228
|
+
const paymentAccepted = (_c = seller.paymentAccepted) === null || _c === void 0 ? void 0 : _c.some((a) => a.paymentMethodType === paymentMethodType);
|
|
229
|
+
if (paymentAccepted !== true) {
|
|
230
|
+
throw new factory.errors.Argument('object.paymentMethod.identifier', `payment not accepted`);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
// 販売者の対応決済方法かどうか確認
|
|
236
|
+
const paymentAccepted = (_d = seller.paymentAccepted) === null || _d === void 0 ? void 0 : _d.some((a) => a.paymentMethodType === paymentMethodType);
|
|
237
|
+
if (paymentAccepted !== true) {
|
|
238
|
+
throw new factory.errors.Argument('object.paymentMethod.identifier', `payment not accepted`);
|
|
239
|
+
}
|
|
230
240
|
}
|
|
231
241
|
});
|
|
232
242
|
}
|
|
@@ -301,6 +311,7 @@ function saveAuthorizeResult(params) {
|
|
|
301
311
|
*/
|
|
302
312
|
function confirm(params) {
|
|
303
313
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
314
|
+
var _a, _b;
|
|
304
315
|
let transaction;
|
|
305
316
|
// 取引存在確認
|
|
306
317
|
if (typeof params.id === 'string') {
|
|
@@ -318,29 +329,24 @@ function confirm(params) {
|
|
|
318
329
|
else {
|
|
319
330
|
throw new factory.errors.ArgumentNull('Transaction ID or Transaction Number');
|
|
320
331
|
}
|
|
332
|
+
let overwritingPaymentMethodIdentifier;
|
|
333
|
+
if (transaction.object.typeOf === factory.service.paymentService.PaymentServiceType.FaceToFace) {
|
|
334
|
+
const specifiedPaymentMethodIdentifire = (_b = (_a = params.object) === null || _a === void 0 ? void 0 : _a.paymentMethod) === null || _b === void 0 ? void 0 : _b.identifier;
|
|
335
|
+
if (typeof specifiedPaymentMethodIdentifire === 'string' && specifiedPaymentMethodIdentifire.length > 0) {
|
|
336
|
+
overwritingPaymentMethodIdentifier = specifiedPaymentMethodIdentifire;
|
|
337
|
+
transaction.object.paymentMethod.identifier = overwritingPaymentMethodIdentifier;
|
|
338
|
+
// transaction.object.paymentMethod.typeOf = overwritingPaymentMethodIdentifier;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
321
341
|
const order = yield fixOrderAsPurpose(params, transaction)(repos);
|
|
322
342
|
const potentialActions = (0, potentialActions_1.createPotentialActions)({
|
|
323
343
|
transaction: transaction,
|
|
324
344
|
potentialActions: params.potentialActions,
|
|
325
345
|
order
|
|
326
346
|
});
|
|
327
|
-
yield repos.assetTransaction.confirm({
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
result: {},
|
|
331
|
-
// sync対応(2023-01-14~)
|
|
332
|
-
potentialActions: (settings_1.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING)
|
|
333
|
-
? { pay: [] }
|
|
334
|
-
: potentialActions
|
|
335
|
-
});
|
|
336
|
-
// sync対応(2023-01-14~)
|
|
337
|
-
if (settings_1.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING) {
|
|
338
|
-
if (Array.isArray(potentialActions.pay)) {
|
|
339
|
-
for (const payAction of potentialActions.pay) {
|
|
340
|
-
yield (0, payment_1.pay)(payAction)(repos);
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
}
|
|
347
|
+
yield repos.assetTransaction.confirm(Object.assign({ typeOf: factory.assetTransactionType.Pay, id: transaction.id, result: {}, potentialActions: potentialActions }, (typeof overwritingPaymentMethodIdentifier === 'string')
|
|
348
|
+
? { object: { paymentMethod: { identifier: overwritingPaymentMethodIdentifier } } }
|
|
349
|
+
: undefined));
|
|
344
350
|
});
|
|
345
351
|
}
|
|
346
352
|
exports.confirm = confirm;
|
|
@@ -373,23 +379,11 @@ function fixOrderAsPurpose(params, transaction) {
|
|
|
373
379
|
*/
|
|
374
380
|
function cancel(params) {
|
|
375
381
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
376
|
-
|
|
382
|
+
yield repos.assetTransaction.cancel({
|
|
377
383
|
typeOf: factory.assetTransactionType.Pay,
|
|
378
384
|
id: params.id,
|
|
379
385
|
transactionNumber: params.transactionNumber
|
|
380
386
|
});
|
|
381
|
-
// sync対応(2023-01-14~)
|
|
382
|
-
if (settings_1.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING) {
|
|
383
|
-
const payTransactionAsObject = {
|
|
384
|
-
project: transaction.project,
|
|
385
|
-
typeOf: transaction.typeOf,
|
|
386
|
-
id: transaction.id,
|
|
387
|
-
transactionNumber: transaction.transactionNumber,
|
|
388
|
-
object: transaction.object,
|
|
389
|
-
recipient: transaction.recipient
|
|
390
|
-
};
|
|
391
|
-
yield (0, payment_1.voidPayment)({ object: payTransactionAsObject })(repos);
|
|
392
|
-
}
|
|
393
387
|
});
|
|
394
388
|
}
|
|
395
389
|
exports.cancel = cancel;
|
|
@@ -404,6 +398,9 @@ function exportTasksById(params) {
|
|
|
404
398
|
id: params.id
|
|
405
399
|
});
|
|
406
400
|
const potentialActions = transaction.potentialActions;
|
|
401
|
+
if (transaction.status === factory.transactionStatusType.InProgress) {
|
|
402
|
+
throw new factory.errors.NotImplemented(`Transaction status "${transaction.status}" not implemented.`);
|
|
403
|
+
}
|
|
407
404
|
const taskAttributes = [];
|
|
408
405
|
// タスク実行日時バッファの指定があれば調整
|
|
409
406
|
let taskRunsAt = new Date();
|
|
@@ -430,6 +427,31 @@ function exportTasksById(params) {
|
|
|
430
427
|
executionResults: [],
|
|
431
428
|
data: { object: payTransactionAsObject }
|
|
432
429
|
};
|
|
430
|
+
// OnAssetTransactionStatusChangedを追加(2023-08-30~)
|
|
431
|
+
const onAssetTransactionStatusChangedTaskData = {
|
|
432
|
+
project: transaction.project,
|
|
433
|
+
object: {
|
|
434
|
+
typeOf: factory.assetTransactionType.Pay,
|
|
435
|
+
transactionNumber: transaction.transactionNumber,
|
|
436
|
+
status: transaction.status
|
|
437
|
+
},
|
|
438
|
+
purpose: {
|
|
439
|
+
confirmationNumber: '',
|
|
440
|
+
orderNumber: '',
|
|
441
|
+
typeOf: 'Order'
|
|
442
|
+
},
|
|
443
|
+
useOnOrderStatusChanged: true
|
|
444
|
+
};
|
|
445
|
+
const onAssetTransactionStatusChangedTask = {
|
|
446
|
+
project: transaction.project,
|
|
447
|
+
name: factory.taskName.OnAssetTransactionStatusChanged,
|
|
448
|
+
status: factory.taskStatus.Ready,
|
|
449
|
+
runsAt: taskRunsAt,
|
|
450
|
+
remainingNumberOfTries: 10,
|
|
451
|
+
numberOfTried: 0,
|
|
452
|
+
executionResults: [],
|
|
453
|
+
data: onAssetTransactionStatusChangedTaskData
|
|
454
|
+
};
|
|
433
455
|
switch (transaction.status) {
|
|
434
456
|
case factory.transactionStatusType.Confirmed:
|
|
435
457
|
const payActions = potentialActions === null || potentialActions === void 0 ? void 0 : potentialActions.pay;
|
|
@@ -450,13 +472,10 @@ function exportTasksById(params) {
|
|
|
450
472
|
}
|
|
451
473
|
break;
|
|
452
474
|
case factory.transactionStatusType.Canceled:
|
|
453
|
-
|
|
454
|
-
if (!settings_1.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING) {
|
|
455
|
-
taskAttributes.push(voidPaymentTasks);
|
|
456
|
-
}
|
|
475
|
+
taskAttributes.push(voidPaymentTasks, onAssetTransactionStatusChangedTask);
|
|
457
476
|
break;
|
|
458
477
|
case factory.transactionStatusType.Expired:
|
|
459
|
-
taskAttributes.push(voidPaymentTasks);
|
|
478
|
+
taskAttributes.push(voidPaymentTasks, onAssetTransactionStatusChangedTask);
|
|
460
479
|
break;
|
|
461
480
|
default:
|
|
462
481
|
throw new factory.errors.NotImplemented(`Transaction status "${transaction.status}" not implemented.`);
|
|
@@ -482,9 +501,9 @@ function searchGMOTrade(params) {
|
|
|
482
501
|
// throw new factory.errors.Argument('transactionNumber', 'must be confirmed');
|
|
483
502
|
// }
|
|
484
503
|
// CreditCard系統の決済方法タイプは動的
|
|
485
|
-
const paymentMethodType = (_a = assetTransaction.object.paymentMethod) === null || _a === void 0 ? void 0 : _a.
|
|
504
|
+
const paymentMethodType = (_a = assetTransaction.object.paymentMethod) === null || _a === void 0 ? void 0 : _a.identifier;
|
|
486
505
|
if (typeof paymentMethodType !== 'string') {
|
|
487
|
-
throw new factory.errors.ArgumentNull('object.paymentMethod.
|
|
506
|
+
throw new factory.errors.ArgumentNull('object.paymentMethod.identifier');
|
|
488
507
|
}
|
|
489
508
|
const paymentServiceId = String(assetTransaction.object.id);
|
|
490
509
|
const availableChannel = yield repos.product.findAvailableChannel({
|
|
@@ -6,7 +6,7 @@ exports.createStartParams = void 0;
|
|
|
6
6
|
*/
|
|
7
7
|
const factory = require("../../../factory");
|
|
8
8
|
function createStartParams(params) {
|
|
9
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j
|
|
9
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
10
10
|
const paymentMethodType = (_a = params.object.paymentMethod) === null || _a === void 0 ? void 0 : _a.typeOf;
|
|
11
11
|
if (typeof paymentMethodType !== 'string') {
|
|
12
12
|
throw new factory.errors.ArgumentNull('object.paymentMethod.typeOf');
|
|
@@ -23,7 +23,13 @@ function createStartParams(params) {
|
|
|
23
23
|
let refundFee;
|
|
24
24
|
if (((_g = params.paymentService) === null || _g === void 0 ? void 0 : _g.typeOf) === factory.service.paymentService.PaymentServiceType.CreditCard) {
|
|
25
25
|
// カード通貨区分の存在する決済サービスを考慮(2023-08-09~)
|
|
26
|
-
const
|
|
26
|
+
const invoiceAsServiceOutput = (Array.isArray(params.paymentService.serviceOutput))
|
|
27
|
+
? params.paymentService.serviceOutput.find((output) => output.typeOf === 'Invoice')
|
|
28
|
+
: params.paymentService.serviceOutput;
|
|
29
|
+
let paymentServiceOutputAmountCurrency;
|
|
30
|
+
if ((invoiceAsServiceOutput === null || invoiceAsServiceOutput === void 0 ? void 0 : invoiceAsServiceOutput.typeOf) === 'Invoice') {
|
|
31
|
+
paymentServiceOutputAmountCurrency = (_j = (_h = invoiceAsServiceOutput === null || invoiceAsServiceOutput === void 0 ? void 0 : invoiceAsServiceOutput.paymentMethod) === null || _h === void 0 ? void 0 : _h.amount) === null || _j === void 0 ? void 0 : _j.currency;
|
|
32
|
+
}
|
|
27
33
|
if (typeof paymentServiceOutputAmountCurrency !== 'string') {
|
|
28
34
|
if (typeof params.object.refundFee === 'number') {
|
|
29
35
|
refundFee = params.object.refundFee;
|
|
@@ -94,7 +94,8 @@ function createTransactionObject(params) {
|
|
|
94
94
|
ids: params.acceptedOffers.map((o) => o.id),
|
|
95
95
|
itemOffered: { id: String(params.product.id) },
|
|
96
96
|
onlyValid: true,
|
|
97
|
-
addSortIndex: false
|
|
97
|
+
addSortIndex: false,
|
|
98
|
+
useOffersAsPrimaryForcible: false
|
|
98
99
|
})(repos);
|
|
99
100
|
const transactionObject = [];
|
|
100
101
|
for (const acceptedOffer of params.acceptedOffers) {
|
|
@@ -120,7 +120,8 @@ function addReservations(params) {
|
|
|
120
120
|
store: { id: (_a = params.availableAtOrFrom) === null || _a === void 0 ? void 0 : _a.id },
|
|
121
121
|
onlyValid: true,
|
|
122
122
|
addSortIndex: false,
|
|
123
|
-
validateOfferRateLimit: true
|
|
123
|
+
validateOfferRateLimit: true,
|
|
124
|
+
useOffersAsPrimaryForcible: false
|
|
124
125
|
})(repos);
|
|
125
126
|
ticketOffers = searchEventTicketOffersResult.ticketOffers;
|
|
126
127
|
availableOffers = searchEventTicketOffersResult.unitPriceOffers;
|
|
@@ -181,7 +182,7 @@ function addReservations(params) {
|
|
|
181
182
|
// await repos.reservation.createMany({ reservationFor, reservations: objectSubReservations });
|
|
182
183
|
// }
|
|
183
184
|
// ストックホルダー処理(stockHolderで残席数を集計しているので必要)
|
|
184
|
-
yield onReservationsCreated({ event })(repos);
|
|
185
|
+
yield onReservationsCreated({ event, transaction: { transactionNumber: transaction.transactionNumber } })(repos);
|
|
185
186
|
return { transaction, objectSubReservations, issuedThrough };
|
|
186
187
|
});
|
|
187
188
|
}
|
|
@@ -386,21 +387,62 @@ function createReservations4transactionObject(params) {
|
|
|
386
387
|
}
|
|
387
388
|
}
|
|
388
389
|
// 指定されたアドオンがオファーに存在すれば、アドオンの単価仕様作成
|
|
389
|
-
|
|
390
|
+
const acceptedAddOns = [];
|
|
390
391
|
let availableAddOns;
|
|
391
|
-
const
|
|
392
|
-
if (Array.isArray(
|
|
392
|
+
const acceptedAddOnsParams = acceptedOffer.addOn;
|
|
393
|
+
if (Array.isArray(acceptedAddOnsParams) && acceptedAddOnsParams.length > 0) {
|
|
393
394
|
// アドオンオファー検索(2023-03-02~)
|
|
394
395
|
availableAddOns = yield searchAvailableAddOns({
|
|
395
|
-
ids:
|
|
396
|
+
ids: acceptedAddOnsParams.map((acceptedAddOn) => String(acceptedAddOn.id)),
|
|
396
397
|
project: { id: params.transaction.project.id },
|
|
397
398
|
ticketOffer,
|
|
398
399
|
availableAtOrFrom: params.availableAtOrFrom
|
|
399
400
|
})(repos);
|
|
400
401
|
}
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
402
|
+
if (Array.isArray(availableAddOns) && Array.isArray(acceptedAddOnsParams)) {
|
|
403
|
+
acceptedAddOnsParams.forEach((acceptedAddOnParams) => {
|
|
404
|
+
var _a, _b, _c;
|
|
405
|
+
const availableAddOn = availableAddOns === null || availableAddOns === void 0 ? void 0 : availableAddOns.find((addOn) => addOn.id === acceptedAddOnParams.id);
|
|
406
|
+
if (availableAddOn !== undefined) {
|
|
407
|
+
// acceptedAddOnsの重複を避ける(単価オファーIDに対して)
|
|
408
|
+
if (!acceptedAddOns.some((addOn) => addOn.id === availableAddOn.id)) {
|
|
409
|
+
const availableAddOnReferenceQuantityValue = availableAddOn.priceSpecification.referenceQuantity.value;
|
|
410
|
+
if (typeof availableAddOnReferenceQuantityValue !== 'number') {
|
|
411
|
+
throw new factory.errors.NotImplemented('addOn.priceSpecification.referenceQuantity.value must be number');
|
|
412
|
+
}
|
|
413
|
+
// 受入数量はデフォルトで単価オファーの基準数量
|
|
414
|
+
let referenceQuantityValueAccepted = availableAddOnReferenceQuantityValue;
|
|
415
|
+
// 数量指定を検証(2023-08-31~)
|
|
416
|
+
const specifiedReferencedQuantityValue = (_b = (_a = acceptedAddOnParams.priceSpecification) === null || _a === void 0 ? void 0 : _a.referenceQuantity) === null || _b === void 0 ? void 0 : _b.value;
|
|
417
|
+
if (typeof specifiedReferencedQuantityValue === 'number') {
|
|
418
|
+
if (specifiedReferencedQuantityValue < 1) {
|
|
419
|
+
throw new factory.errors.Argument('addOn.priceSpecification.referenceQuantity.value must be > 0');
|
|
420
|
+
}
|
|
421
|
+
// 数量が適用単位要件を満たしていなければエラー
|
|
422
|
+
if (specifiedReferencedQuantityValue % availableAddOnReferenceQuantityValue !== 0) {
|
|
423
|
+
throw new factory.errors.Argument('addOn.priceSpecification.referenceQuantity.value', `Offer ${availableAddOn.id} requires reference quantity value ${specifiedReferencedQuantityValue}`);
|
|
424
|
+
}
|
|
425
|
+
// 基準数量上書き
|
|
426
|
+
referenceQuantityValueAccepted = specifiedReferencedQuantityValue;
|
|
427
|
+
}
|
|
428
|
+
const priceAccepted = availableAddOn.priceSpecification.price *
|
|
429
|
+
(referenceQuantityValueAccepted / availableAddOnReferenceQuantityValue);
|
|
430
|
+
const accountsReceivableAccepted = (typeof ((_c = availableAddOn.priceSpecification.accounting) === null || _c === void 0 ? void 0 : _c.accountsReceivable) === 'number')
|
|
431
|
+
? availableAddOn.priceSpecification.accounting.accountsReceivable *
|
|
432
|
+
(referenceQuantityValueAccepted / availableAddOnReferenceQuantityValue)
|
|
433
|
+
: undefined;
|
|
434
|
+
const acceptedAddOn = Object.assign(Object.assign({}, availableAddOn), { priceSpecification: Object.assign(Object.assign(Object.assign({}, availableAddOn.priceSpecification), (typeof accountsReceivableAccepted === 'number')
|
|
435
|
+
? {
|
|
436
|
+
accounting: Object.assign(Object.assign({}, availableAddOn.priceSpecification.accounting), { accountsReceivable: accountsReceivableAccepted, typeOf: 'Accounting' })
|
|
437
|
+
}
|
|
438
|
+
: undefined), { price: priceAccepted, referenceQuantity: Object.assign(Object.assign({}, availableAddOn.priceSpecification.referenceQuantity), { value: referenceQuantityValueAccepted }) }) });
|
|
439
|
+
acceptedAddOns.push(acceptedAddOn);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
});
|
|
443
|
+
// acceptedAddOns = availableAddOns.filter(
|
|
444
|
+
// (availableAddOn) => acceptedAddOnsParams.some((acceptedAddOn) => availableAddOn.id === acceptedAddOn.id)
|
|
445
|
+
// );
|
|
404
446
|
}
|
|
405
447
|
const subReservation = (_j = (_h = acceptedOffer.itemOffered) === null || _h === void 0 ? void 0 : _h.serviceOutput) === null || _j === void 0 ? void 0 : _j.subReservation;
|
|
406
448
|
const reservationId = `${reservationNumber}-${reservationIndex}`;
|
|
@@ -435,7 +477,7 @@ function searchAvailableAddOns(params) {
|
|
|
435
477
|
if (Array.isArray(params.ticketOffer.addOn)) {
|
|
436
478
|
const addOnProductIds = [...new Set(params.ticketOffer.addOn.map((o) => String(o.itemOffered.id)))];
|
|
437
479
|
for (const addOnProductId of addOnProductIds) {
|
|
438
|
-
const { offers, product } = yield OfferService.product.search(Object.assign({ ids: params.ids, project: { id: params.project.id }, itemOffered: { id: addOnProductId }, onlyValid: true, addSortIndex: false }, (typeof ((_a = params.availableAtOrFrom) === null || _a === void 0 ? void 0 : _a.id) === 'string')
|
|
480
|
+
const { offers, product } = yield OfferService.product.search(Object.assign({ ids: params.ids, project: { id: params.project.id }, itemOffered: { id: addOnProductId }, onlyValid: true, addSortIndex: false, useOffersAsPrimaryForcible: false }, (typeof ((_a = params.availableAtOrFrom) === null || _a === void 0 ? void 0 : _a.id) === 'string')
|
|
439
481
|
? { availableAt: { id: params.availableAtOrFrom.id } }
|
|
440
482
|
: undefined))(repos);
|
|
441
483
|
availableAddOns.push(...offers.map((o) => {
|
|
@@ -530,31 +572,64 @@ function validateProgramMembershipUsed(params) {
|
|
|
530
572
|
if (typeof issuedThroughId !== 'string' || issuedThroughId.length === 0) {
|
|
531
573
|
throw new factory.errors.ArgumentNull('acceptedOffer.itemOffered.serviceOutput.programMembershipUsed.issuedThrough.id');
|
|
532
574
|
}
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
575
|
+
const permitIssuedThrough = yield repos.product.findById({ id: issuedThroughId }, ['_id', 'typeOf', 'project', 'serviceType', 'serviceOutput'], []);
|
|
576
|
+
switch (permitIssuedThrough.typeOf) {
|
|
577
|
+
// 発行サービスがCreditCardのケースに対応(2023-09-01~)
|
|
578
|
+
case factory.service.paymentService.PaymentServiceType.CreditCard:
|
|
579
|
+
// 決済サービスのserviceOutputにPermitが存在すれば、設定されたメンバーシップ区分のPermitをprogramMembershipUsedとして適用する
|
|
580
|
+
let issuedThroughServiceType;
|
|
581
|
+
if (Array.isArray(permitIssuedThrough.serviceOutput)) {
|
|
582
|
+
const serviceOutputAsPermit = permitIssuedThrough.serviceOutput.find((output) => output.typeOf === factory.permit.PermitType.Permit);
|
|
583
|
+
if ((serviceOutputAsPermit === null || serviceOutputAsPermit === void 0 ? void 0 : serviceOutputAsPermit.typeOf) === factory.permit.PermitType.Permit) {
|
|
584
|
+
issuedThroughServiceType = serviceOutputAsPermit.issuedThrough.serviceType;
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
if ((issuedThroughServiceType === null || issuedThroughServiceType === void 0 ? void 0 : issuedThroughServiceType.typeOf) === 'CategoryCode') {
|
|
588
|
+
programMembershipUsed = {
|
|
589
|
+
project: permitIssuedThrough.project,
|
|
590
|
+
typeOf: factory.permit.PermitType.Permit,
|
|
591
|
+
identifier: programMembershipUsedIdentifier,
|
|
592
|
+
issuedThrough: {
|
|
593
|
+
id: permitIssuedThrough.id,
|
|
594
|
+
serviceType: issuedThroughServiceType,
|
|
595
|
+
typeOf: permitIssuedThrough.typeOf
|
|
596
|
+
}
|
|
597
|
+
};
|
|
598
|
+
}
|
|
599
|
+
else {
|
|
600
|
+
throw new factory.errors.Argument('acceptedOffer.itemOffered.serviceOutput.programMembershipUsed', 'issuedThrough has no serviceOutput as Permit');
|
|
601
|
+
}
|
|
602
|
+
break;
|
|
603
|
+
case factory.product.ProductType.MembershipService:
|
|
604
|
+
// requestedProgramMembershipUsedの発行サービスIDから外部連携設定を取得する
|
|
605
|
+
const permitService = yield createPermitService({ issuedThrough: { id: issuedThroughId } })(repos);
|
|
606
|
+
// メンバーシップの存在確認
|
|
607
|
+
const serviceOutput = yield permitService.findByIdentifier({
|
|
608
|
+
project: { id: params.project.id },
|
|
609
|
+
identifier: programMembershipUsedIdentifier,
|
|
610
|
+
issuedThrough: { typeOf: factory.product.ProductType.MembershipService }
|
|
611
|
+
});
|
|
612
|
+
// 有効期間のチェック
|
|
613
|
+
if (serviceOutput.validFrom === undefined || serviceOutput.validFrom === null
|
|
614
|
+
|| serviceOutput.validUntil === undefined || serviceOutput.validUntil === null) {
|
|
615
|
+
throw new factory.errors.Argument('acceptedOffer.itemOffered.serviceOutput.programMembershipUsed', 'not valid programMembership');
|
|
616
|
+
}
|
|
617
|
+
if (moment(serviceOutput.validFrom)
|
|
618
|
+
.isAfter(moment(now))
|
|
619
|
+
|| moment(serviceOutput.validUntil)
|
|
620
|
+
.isBefore(moment(now))) {
|
|
621
|
+
throw new factory.errors.Argument('acceptedOffer.itemOffered.serviceOutput.programMembershipUsed', 'unavailable programMembership');
|
|
622
|
+
}
|
|
623
|
+
programMembershipUsed = {
|
|
624
|
+
project: serviceOutput.project,
|
|
625
|
+
typeOf: serviceOutput.typeOf,
|
|
626
|
+
identifier: serviceOutput.identifier,
|
|
627
|
+
issuedThrough: serviceOutput.issuedThrough
|
|
628
|
+
};
|
|
629
|
+
break;
|
|
630
|
+
default:
|
|
631
|
+
throw new factory.errors.Argument('acceptedOffer.itemOffered.serviceOutput.programMembershipUsed', `${permitIssuedThrough.typeOf} not implemented`);
|
|
551
632
|
}
|
|
552
|
-
programMembershipUsed = {
|
|
553
|
-
project: serviceOutput.project,
|
|
554
|
-
typeOf: serviceOutput.typeOf,
|
|
555
|
-
identifier: serviceOutput.identifier,
|
|
556
|
-
issuedThrough: serviceOutput.issuedThrough
|
|
557
|
-
};
|
|
558
633
|
}
|
|
559
634
|
return programMembershipUsed;
|
|
560
635
|
});
|
|
@@ -729,7 +804,8 @@ function onReservationsCreated(params) {
|
|
|
729
804
|
yield OfferService.createAggregateScreeningEventIfNotExist({
|
|
730
805
|
project: params.event.project,
|
|
731
806
|
reservationFor: [{ id: params.event.id }],
|
|
732
|
-
force: false
|
|
807
|
+
force: false,
|
|
808
|
+
identifier: `onReservationsCreated:${params.transaction.transactionNumber}`
|
|
733
809
|
})({ task: repos.task });
|
|
734
810
|
});
|
|
735
811
|
}
|
|
@@ -29,6 +29,23 @@ const accountTransactionIdentifier_1 = require("../factory/accountTransactionIde
|
|
|
29
29
|
*/
|
|
30
30
|
function givePointAward(params) {
|
|
31
31
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
// 入金識別子が存在する場合、冪等性の確保(2023-08-24~)
|
|
33
|
+
const pendingTransactionIdentifier = params.object.identifier;
|
|
34
|
+
if (typeof pendingTransactionIdentifier === 'string' && pendingTransactionIdentifier.length > 0) {
|
|
35
|
+
// すでにConfirmedのMoneyTransfer取引が存在すれば何もしない
|
|
36
|
+
const assetTransactions = yield repos.assetTransaction.search({
|
|
37
|
+
limit: 1,
|
|
38
|
+
project: { id: { $eq: params.project.id } },
|
|
39
|
+
typeOf: factory.assetTransactionType.MoneyTransfer,
|
|
40
|
+
statuses: [factory.transactionStatusType.Confirmed],
|
|
41
|
+
object: {
|
|
42
|
+
pendingTransaction: { identifier: { $eq: pendingTransactionIdentifier } }
|
|
43
|
+
}
|
|
44
|
+
}, ['_id']);
|
|
45
|
+
if (assetTransactions.length > 0) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
32
49
|
// アクション開始
|
|
33
50
|
const action = yield repos.action.start(params);
|
|
34
51
|
try {
|
|
@@ -188,6 +188,7 @@ function validateObjectWithoutDetail(params) {
|
|
|
188
188
|
var _a, _b, _c, _d;
|
|
189
189
|
const objectWithoutDetail = params.object;
|
|
190
190
|
if (Array.isArray(objectWithoutDetail.acceptedOffer)) {
|
|
191
|
+
const validatedAcceptedOffersWithoutDetail = [];
|
|
191
192
|
for (let acceptedOffer of objectWithoutDetail.acceptedOffer) {
|
|
192
193
|
let programMembershipUsed = (_b = (_a = acceptedOffer.itemOffered) === null || _a === void 0 ? void 0 : _a.serviceOutput) === null || _b === void 0 ? void 0 : _b.programMembershipUsed;
|
|
193
194
|
// トークン化されたメンバーシップがリクエストされた場合、実メンバーシップ情報へ変換する
|
|
@@ -214,7 +215,9 @@ function validateObjectWithoutDetail(params) {
|
|
|
214
215
|
};
|
|
215
216
|
acceptedOffer = Object.assign(Object.assign({}, acceptedOffer), { itemOffered: Object.assign(Object.assign({}, acceptedOffer.itemOffered), { serviceOutput: Object.assign(Object.assign({}, (_d = acceptedOffer.itemOffered) === null || _d === void 0 ? void 0 : _d.serviceOutput), { typeOf: factory.reservationType.EventReservation, programMembershipUsed }) }) });
|
|
216
217
|
}
|
|
218
|
+
validatedAcceptedOffersWithoutDetail.push(acceptedOffer);
|
|
217
219
|
}
|
|
220
|
+
objectWithoutDetail.acceptedOffer = validatedAcceptedOffersWithoutDetail;
|
|
218
221
|
}
|
|
219
222
|
return objectWithoutDetail;
|
|
220
223
|
});
|
|
@@ -236,7 +239,8 @@ function validateAcceptedOffers(params) {
|
|
|
236
239
|
store: params.store,
|
|
237
240
|
onlyValid: true,
|
|
238
241
|
addSortIndex: false,
|
|
239
|
-
validateOfferRateLimit: true
|
|
242
|
+
validateOfferRateLimit: true,
|
|
243
|
+
useOffersAsPrimaryForcible: false
|
|
240
244
|
})(repos);
|
|
241
245
|
// 利用可能なチケットオファーであれば受け入れる
|
|
242
246
|
const acceptedOffers = (Array.isArray(acceptedOffersWithoutDetail))
|
|
@@ -252,31 +256,35 @@ function validateAcceptedOffers(params) {
|
|
|
252
256
|
: [];
|
|
253
257
|
// オファーIDごとにオファー適用条件を確認
|
|
254
258
|
offerIds.forEach((offerId) => {
|
|
255
|
-
var _a;
|
|
259
|
+
var _a, _b, _c;
|
|
256
260
|
const acceptedOffersByOfferId = acceptedOffers.filter((o) => o.id === offerId);
|
|
261
|
+
const numAcceptedOffersByOfferId = acceptedOffersByOfferId.length;
|
|
257
262
|
let referenceQuantityValue = 1;
|
|
258
|
-
|
|
259
|
-
const
|
|
263
|
+
// 単価仕様を取り出す
|
|
264
|
+
const unitPriceSpec = acceptedOffersByOfferId[0].priceSpecification.priceComponent.find((spec) => spec.typeOf === factory.priceSpecificationType.UnitPriceSpecification && (!Array.isArray(spec.appliesToAddOn)));
|
|
265
|
+
// 単価仕様は必ず存在するはず
|
|
266
|
+
if ((unitPriceSpec === null || unitPriceSpec === void 0 ? void 0 : unitPriceSpec.typeOf) !== factory.priceSpecificationType.UnitPriceSpecification) {
|
|
267
|
+
throw new factory.errors.ServiceUnavailable(`unitPriceSpec of the offer '${offerId}' not found`);
|
|
268
|
+
}
|
|
269
|
+
const unitPriceSpecReferenceQuantityValue = (_a = unitPriceSpec.referenceQuantity) === null || _a === void 0 ? void 0 : _a.value;
|
|
260
270
|
if (typeof unitPriceSpecReferenceQuantityValue === 'number') {
|
|
261
271
|
referenceQuantityValue = unitPriceSpecReferenceQuantityValue;
|
|
262
272
|
}
|
|
263
273
|
// アイテム数が適用単位要件を満たしていなければエラー
|
|
264
|
-
if (
|
|
274
|
+
if (numAcceptedOffersByOfferId % referenceQuantityValue !== 0) {
|
|
265
275
|
throw new factory.errors.Argument('acceptedOffers', `Offer ${offerId} requires reference quantity value ${referenceQuantityValue}`);
|
|
266
276
|
}
|
|
267
277
|
// 適用アイテム数要件を満たしていなければエラー
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
if (
|
|
271
|
-
|
|
272
|
-
throw new factory.errors.Argument('acceptedOffers', `Number of offer:${offerId} must be less than or equal to ${maxValue}`);
|
|
273
|
-
}
|
|
278
|
+
const maxValue = (_b = unitPriceSpec.eligibleQuantity) === null || _b === void 0 ? void 0 : _b.maxValue;
|
|
279
|
+
if (typeof maxValue === 'number') {
|
|
280
|
+
if (numAcceptedOffersByOfferId > maxValue) {
|
|
281
|
+
throw new factory.errors.Argument('acceptedOffers', `Number of offer:${offerId} must be less than or equal to ${maxValue}`);
|
|
274
282
|
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
}
|
|
283
|
+
}
|
|
284
|
+
const minValue = (_c = unitPriceSpec.eligibleQuantity) === null || _c === void 0 ? void 0 : _c.minValue;
|
|
285
|
+
if (typeof minValue === 'number') {
|
|
286
|
+
if (numAcceptedOffersByOfferId < minValue) {
|
|
287
|
+
throw new factory.errors.Argument('acceptedOffers', `Number of offer:${offerId} must be more than or equal to ${minValue}`);
|
|
280
288
|
}
|
|
281
289
|
}
|
|
282
290
|
});
|
|
@@ -298,44 +306,40 @@ function acceptedOfferWithoutDetail2acceptedOffer(params) {
|
|
|
298
306
|
transaction: params.transaction
|
|
299
307
|
});
|
|
300
308
|
const acceptedAppliesToMovieTicket = (_a = offerWithoutDetail.priceSpecification) === null || _a === void 0 ? void 0 : _a.appliesToMovieTicket;
|
|
301
|
-
// let movieTicketIdentifire: string | undefined;
|
|
302
|
-
// if (Array.isArray(acceptedAppliesToMovieTicket)) {
|
|
303
|
-
// // throw new factory.errors.NotImplemented('multiple appliesToMovieTicket not implemented');
|
|
304
|
-
// // no op
|
|
305
|
-
// } else if (typeof acceptedAppliesToMovieTicket?.identifier === 'string') {
|
|
306
|
-
// movieTicketIdentifire = acceptedAppliesToMovieTicket.identifier;
|
|
307
|
-
// }
|
|
308
309
|
// 承認アクションオブジェクトのacceptedOfferにappliesToMovieTicketを連携する(2022-08-02~)
|
|
309
310
|
const priceSpecification = Object.assign(Object.assign({}, offer.priceSpecification), (Array.isArray(acceptedAppliesToMovieTicket) || typeof (acceptedAppliesToMovieTicket === null || acceptedAppliesToMovieTicket === void 0 ? void 0 : acceptedAppliesToMovieTicket.identifier) === 'string')
|
|
310
311
|
? { appliesToMovieTicket: acceptedAppliesToMovieTicket }
|
|
311
312
|
: undefined);
|
|
313
|
+
const acceptedAddOns = (Array.isArray(offerWithoutDetail.addOn))
|
|
314
|
+
? offerWithoutDetail.addOn.map((acceptedAddOnOffer) => {
|
|
315
|
+
var _a, _b;
|
|
316
|
+
if (typeof acceptedAddOnOffer.id !== 'string' || acceptedAddOnOffer.id.length === 0) {
|
|
317
|
+
throw new factory.errors.ArgumentNull('object.acceptedOffer.addOn.id');
|
|
318
|
+
}
|
|
319
|
+
const addOnOfferReferenceQuantityValue = (_b = (_a = acceptedAddOnOffer.priceSpecification) === null || _a === void 0 ? void 0 : _a.referenceQuantity) === null || _b === void 0 ? void 0 : _b.value;
|
|
320
|
+
return Object.assign({
|
|
321
|
+
// typeOf: <factory.offerType.Offer>factory.offerType.Offer,
|
|
322
|
+
id: acceptedAddOnOffer.id }, (typeof addOnOfferReferenceQuantityValue === 'number')
|
|
323
|
+
? { priceSpecification: { referenceQuantity: { value: addOnOfferReferenceQuantityValue } } }
|
|
324
|
+
: undefined);
|
|
325
|
+
})
|
|
326
|
+
: [];
|
|
312
327
|
const acceptedOffer = {
|
|
313
328
|
// オファーの中身を最適化する(必要最低限の情報のみに)
|
|
314
329
|
id: String(offer.id),
|
|
315
330
|
identifier: offer.identifier,
|
|
316
331
|
priceSpecification,
|
|
317
|
-
// project: offer.project,
|
|
318
332
|
typeOf: offer.typeOf,
|
|
319
333
|
priceCurrency: offer.priceCurrency,
|
|
320
334
|
itemOffered: Object.assign({ typeOf: factory.product.ProductType.EventService, serviceOutput: (offerWithoutDetail.itemOffered !== undefined && offerWithoutDetail.itemOffered !== null)
|
|
321
335
|
? offerWithoutDetail.itemOffered.serviceOutput
|
|
322
336
|
: undefined }, (pointAward !== undefined) ? { pointAward } : undefined),
|
|
323
|
-
addOn:
|
|
324
|
-
? offerWithoutDetail.addOn.map((a) => {
|
|
325
|
-
return {
|
|
326
|
-
typeOf: factory.offerType.Offer,
|
|
327
|
-
id: String(a.id),
|
|
328
|
-
priceCurrency: offer.priceCurrency
|
|
329
|
-
};
|
|
330
|
-
})
|
|
331
|
-
: [],
|
|
337
|
+
addOn: acceptedAddOns,
|
|
332
338
|
// 追加属性をマージ
|
|
333
339
|
additionalProperty: [
|
|
334
340
|
...(Array.isArray(offerWithoutDetail.additionalProperty)) ? offerWithoutDetail.additionalProperty : [],
|
|
335
341
|
...(Array.isArray(offer.additionalProperty)) ? offer.additionalProperty : []
|
|
336
342
|
]
|
|
337
|
-
// movieTicketIdentifireの不要を確認後に廃止(2022-09-09以降)(2022-11-02+)
|
|
338
|
-
// ...(typeof movieTicketIdentifire === 'string') ? { movieTicketIdentifire } : undefined
|
|
339
343
|
};
|
|
340
344
|
let offeredThrough = (_b = params.event.offers) === null || _b === void 0 ? void 0 : _b.offeredThrough;
|
|
341
345
|
if (typeof (offeredThrough === null || offeredThrough === void 0 ? void 0 : offeredThrough.typeOf) !== 'string') {
|
|
@@ -16,7 +16,7 @@ export declare function createReserveTransactionStartParams(params: {
|
|
|
16
16
|
export declare function createAuthorizeSeatReservationActionAttributes(params: {
|
|
17
17
|
acceptedOffers: factory.action.authorize.offer.seatReservation.IAcceptedOffer4chevre[];
|
|
18
18
|
event: IMinimizedIndividualEvent<factory.eventType.ScreeningEvent>;
|
|
19
|
-
pendingTransaction?: factory.action.authorize.offer.seatReservation.
|
|
19
|
+
pendingTransaction?: factory.action.authorize.offer.seatReservation.IChevrePendingTransaction | undefined;
|
|
20
20
|
transaction: factory.transaction.ITransaction<factory.transactionType.PlaceOrder>;
|
|
21
21
|
broker?: factory.reservation.IBroker<factory.reservationType.EventReservation>;
|
|
22
22
|
}): factory.action.authorize.offer.seatReservation.IAttributes<factory.service.webAPI.Identifier.Chevre>;
|