@chevre/domain 25.2.0-alpha.5 → 25.2.0-alpha.51
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/lib/chevre/eventEmitter/task.d.ts +2 -1
- package/lib/chevre/factory/customerTelephone2COATelNum.d.ts +3 -0
- package/lib/chevre/factory/customerTelephone2COATelNum.js +22 -0
- package/lib/chevre/repo/action/acceptPay.d.ts +15 -0
- package/lib/chevre/repo/action/acceptPay.js +47 -19
- package/lib/chevre/repo/action/actionProcess.js +57 -57
- package/lib/chevre/repo/action.d.ts +16 -9
- package/lib/chevre/repo/action.js +99 -180
- package/lib/chevre/repo/aggregateOffer.d.ts +3 -14
- package/lib/chevre/repo/aggregateOffer.js +16 -125
- package/lib/chevre/repo/asyncAction.d.ts +69 -0
- package/lib/chevre/repo/asyncAction.js +237 -0
- package/lib/chevre/repo/concurrentLock.d.ts +3 -1
- package/lib/chevre/repo/creativeWork.d.ts +2 -3
- package/lib/chevre/repo/credentials.d.ts +2 -1
- package/lib/chevre/repo/customerType.d.ts +2 -3
- package/lib/chevre/repo/event.d.ts +10 -11
- package/lib/chevre/repo/eventOffer.d.ts +4 -5
- package/lib/chevre/repo/eventSellerMakesOffer.d.ts +2 -3
- package/lib/chevre/repo/eventSeries.d.ts +4 -5
- package/lib/chevre/repo/message.d.ts +1 -1
- package/lib/chevre/repo/message.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/action.js +67 -66
- package/lib/chevre/repo/mongoose/schemas/asyncAction.d.ts +11 -0
- package/lib/chevre/repo/mongoose/schemas/asyncAction.js +89 -0
- package/lib/chevre/repo/mongoose/schemas/order.d.ts +4 -0
- package/lib/chevre/repo/mongoose/schemas/order.js +10 -0
- package/lib/chevre/repo/mongoose/schemas/setting.d.ts +4 -0
- package/lib/chevre/repo/mongoose/schemas/task.js +12 -12
- package/lib/chevre/repo/note.d.ts +3 -4
- package/lib/chevre/repo/noteAboutOrder.d.ts +2 -3
- package/lib/chevre/repo/offer/offerInCatalogReadOnly.d.ts +2 -2
- package/lib/chevre/repo/offer/unitPriceInCatalog.d.ts +2 -2
- package/lib/chevre/repo/offer/unitPriceInCatalog.js +59 -11
- package/lib/chevre/repo/offerCatalog.d.ts +2 -3
- package/lib/chevre/repo/offerCatalogItem.d.ts +2 -3
- package/lib/chevre/repo/order.d.ts +2 -0
- package/lib/chevre/repo/order.js +14 -14
- package/lib/chevre/repo/orderInTransaction.d.ts +68 -1
- package/lib/chevre/repo/orderInTransaction.js +181 -3
- package/lib/chevre/repo/passport.d.ts +2 -1
- package/lib/chevre/repo/person.d.ts +0 -15
- package/lib/chevre/repo/person.js +122 -108
- package/lib/chevre/repo/place/entranceGate.d.ts +4 -5
- package/lib/chevre/repo/place/movieTheater.d.ts +3 -4
- package/lib/chevre/repo/place/screeningRoom.d.ts +4 -5
- package/lib/chevre/repo/place/seat.d.ts +4 -5
- package/lib/chevre/repo/place/section.d.ts +3 -4
- package/lib/chevre/repo/priceSpecification.d.ts +4 -4
- package/lib/chevre/repo/product.d.ts +3 -4
- package/lib/chevre/repo/rateLimit/offer.d.ts +3 -1
- package/lib/chevre/repo/rateLimit/offer.js +0 -12
- package/lib/chevre/repo/reservation.d.ts +2 -3
- package/lib/chevre/repo/sellerMakesOffer.d.ts +3 -4
- package/lib/chevre/repo/stockHolder.d.ts +1 -1
- package/lib/chevre/repo/stockHolder.js +0 -146
- package/lib/chevre/repo/transaction/placeOrder.d.ts +2 -45
- package/lib/chevre/repo/transaction/placeOrder.js +43 -83
- package/lib/chevre/repo/transaction.d.ts +2 -2
- package/lib/chevre/repo/transactionNumberCounter.js +0 -34
- package/lib/chevre/repo/transactionProcess.d.ts +2 -1
- package/lib/chevre/repo/transactionProcess.js +0 -13
- package/lib/chevre/repository.d.ts +5 -0
- package/lib/chevre/repository.js +12 -1
- package/lib/chevre/service/assetTransaction/pay/publishPaymentUrl.js +1 -1
- package/lib/chevre/service/assetTransaction/pay/start/factory.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/pay/start/factory.js +3 -4
- package/lib/chevre/service/assetTransaction/pay/start.d.ts +1 -1
- package/lib/chevre/service/asyncAction.d.ts +16 -0
- package/lib/chevre/service/asyncAction.js +36 -0
- package/lib/chevre/service/asyncActionHandler/onOperationFailed.d.ts +15 -0
- package/lib/chevre/service/asyncActionHandler/onOperationFailed.js +42 -0
- package/lib/chevre/service/asyncActionHandler.d.ts +13 -0
- package/lib/chevre/service/asyncActionHandler.js +89 -0
- package/lib/chevre/service/notification/factory.d.ts +2 -4
- package/lib/chevre/service/notification/factory.js +26 -24
- package/lib/chevre/service/notification/notifyAbortedTasksByEmail.d.ts +11 -5
- package/lib/chevre/service/notification/notifyAbortedTasksByEmail.js +11 -3
- package/lib/chevre/service/offer/event/authorize/factory.d.ts +3 -5
- package/lib/chevre/service/offer/event/authorize/factory.js +93 -75
- package/lib/chevre/service/offer/event/authorize.d.ts +0 -4
- package/lib/chevre/service/offer/event/authorize.js +2 -2
- package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.d.ts +6 -7
- package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.js +10 -10
- package/lib/chevre/service/offer/eventServiceByCOA/authorize/validateAcceptedOffers.js +2 -1
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.d.ts +0 -5
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +15 -12
- package/lib/chevre/service/offer/eventServiceByCOA/authorizeByAcceptAction.d.ts +0 -5
- package/lib/chevre/service/offer/eventServiceByCOA/authorizeByAcceptAction.js +2 -2
- package/lib/chevre/service/offer/eventServiceByCOA/findAcceptAction.d.ts +4 -0
- package/lib/chevre/service/offer/eventServiceByCOA/findAcceptAction.js +22 -9
- package/lib/chevre/service/order/deleteOrder.d.ts +5 -1
- package/lib/chevre/service/order/deleteOrder.js +8 -1
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionCanceled.js +19 -11
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionConfirmed.d.ts +2 -0
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/paymentDue2Processing.d.ts +2 -2
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/paymentDue2Processing.js +1 -7
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +2 -0
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +2 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/createSendEmailMessageTaskIfNotExist.d.ts +5 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/createSendEmailMessageTaskIfNotExist.js +95 -33
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.d.ts +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +4 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +2 -6
- package/lib/chevre/service/order/payOrder.d.ts +2 -0
- package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.d.ts +2 -1
- package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.js +13 -58
- package/lib/chevre/service/order/placeOrder/factory.js +3 -21
- package/lib/chevre/service/order/placeOrder.d.ts +4 -5
- package/lib/chevre/service/order/placeOrder.js +20 -31
- package/lib/chevre/service/payment/any/authorize/fixOrderAsNeeded.js +1 -2
- package/lib/chevre/service/payment/any/authorize/fixTransactionNumber.d.ts +3 -2
- package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.d.ts +4 -3
- package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.js +3 -31
- package/lib/chevre/service/payment/any/authorize.js +13 -37
- package/lib/chevre/service/payment/any/factory.d.ts +7 -7
- package/lib/chevre/service/payment/any/factory.js +19 -22
- package/lib/chevre/service/payment/any/findAcceptAction.d.ts +3 -1
- package/lib/chevre/service/payment/any/findAcceptAction.js +14 -6
- package/lib/chevre/service/payment/any/invalidatePaymentUrl.d.ts +2 -0
- package/lib/chevre/service/payment/any/invalidatePaymentUrl.js +4 -66
- package/lib/chevre/service/payment/any/publishPaymentUrl.d.ts +4 -0
- package/lib/chevre/service/payment/any/publishPaymentUrl.js +4 -18
- package/lib/chevre/service/payment/any/voidPayTransaction.d.ts +2 -0
- package/lib/chevre/service/payment/any/voidPayTransaction.js +1 -23
- package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard.d.ts +1 -1
- package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard.js +5 -9
- package/lib/chevre/service/reserve/adminFindReservations.d.ts +15 -0
- package/lib/chevre/service/reserve/adminFindReservations.js +35 -0
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +17 -8
- package/lib/chevre/service/reserve/searchByOrder.js +2 -6
- package/lib/chevre/service/reserve.d.ts +2 -2
- package/lib/chevre/service/reserve.js +3 -3
- package/lib/chevre/service/task/aggregateOffers.d.ts +2 -2
- package/lib/chevre/service/task/aggregateOffers.js +2 -1
- package/lib/chevre/service/task/aggregateScreeningEvent.d.ts +2 -2
- package/lib/chevre/service/task/aggregateScreeningEvent.js +2 -1
- package/lib/chevre/service/task/authorizePayment.js +3 -1
- package/lib/chevre/service/task/cancelReservation.d.ts +2 -2
- package/lib/chevre/service/task/cancelReservation.js +2 -1
- package/lib/chevre/service/task/confirmPayTransaction.js +0 -1
- package/lib/chevre/service/task/confirmReserveTransaction.js +2 -7
- package/lib/chevre/service/task/deleteTransaction.d.ts +2 -2
- package/lib/chevre/service/task/deleteTransaction.js +2 -1
- package/lib/chevre/service/task/onAssetTransactionStatusChanged.d.ts +2 -2
- package/lib/chevre/service/task/onAssetTransactionStatusChanged.js +4 -3
- package/lib/chevre/service/task/onEventChanged.d.ts +2 -2
- package/lib/chevre/service/task/onEventChanged.js +2 -1
- package/lib/chevre/service/task/onOrderPaymentCompleted.d.ts +2 -2
- package/lib/chevre/service/task/onOrderPaymentCompleted.js +4 -1
- package/lib/chevre/service/task/onResourceUpdated/onAggregateOfferUpdated.js +1 -1
- package/lib/chevre/service/task/onResourceUpdated.d.ts +2 -2
- package/lib/chevre/service/task/onResourceUpdated.js +2 -1
- package/lib/chevre/service/task/placeOrder.d.ts +2 -2
- package/lib/chevre/service/task/placeOrder.js +6 -3
- package/lib/chevre/service/task/publishPaymentUrl.js +7 -3
- package/lib/chevre/service/task/refund.d.ts +2 -2
- package/lib/chevre/service/task/refund.js +4 -10
- package/lib/chevre/service/task/reserve.d.ts +2 -2
- package/lib/chevre/service/task/reserve.js +2 -1
- package/lib/chevre/service/task/returnOrder.d.ts +2 -2
- package/lib/chevre/service/task/returnOrder.js +2 -1
- package/lib/chevre/service/task/sendOrder.d.ts +2 -2
- package/lib/chevre/service/task/sendOrder.js +2 -1
- package/lib/chevre/service/task/voidPayTransaction.js +3 -7
- package/lib/chevre/service/task/voidPayment.d.ts +2 -2
- package/lib/chevre/service/task/voidPayment.js +2 -1
- package/lib/chevre/service/taskHandler/onOperationFailed.js +1 -1
- package/lib/chevre/service/taskHandler.d.ts +2 -2
- package/lib/chevre/service/taskHandler.js +36 -37
- package/lib/chevre/service/transaction/deleteTransaction/deletePayTransactionsByPlaceOrder.d.ts +15 -0
- package/lib/chevre/service/transaction/deleteTransaction/deletePayTransactionsByPlaceOrder.js +51 -0
- package/lib/chevre/service/transaction/deleteTransaction/deleteReservationsByPlaceOrder.d.ts +23 -0
- package/lib/chevre/service/transaction/deleteTransaction/deleteReservationsByPlaceOrder.js +64 -0
- package/lib/chevre/service/transaction/deleteTransaction.js +15 -152
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.d.ts +28 -2
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.js +11 -12
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.d.ts +4 -2
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.js +6 -7
- package/lib/chevre/service/transaction/placeOrder/confirm/prepareUnitPriceOfferConditions.d.ts +35 -2
- package/lib/chevre/service/transaction/placeOrder/confirm/prepareUnitPriceOfferConditions.js +15 -11
- package/lib/chevre/service/transaction/placeOrder/confirm/validation/factory.d.ts +5 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.d.ts +11 -2
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +53 -32
- package/lib/chevre/service/transaction/placeOrder/confirm.d.ts +6 -5
- package/lib/chevre/service/transaction/placeOrder/confirm.js +33 -78
- package/lib/chevre/service/transaction/placeOrder/publishConfirmationNumberIfNotExist.d.ts +4 -7
- package/lib/chevre/service/transaction/placeOrder/publishConfirmationNumberIfNotExist.js +33 -15
- package/lib/chevre/service/transaction/placeOrder/start.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrder/updateAgent/fixCustomer.d.ts +20 -0
- package/lib/chevre/service/transaction/placeOrder/updateAgent/fixCustomer.js +63 -0
- package/lib/chevre/service/transaction/placeOrder/updateAgent.d.ts +0 -1
- package/lib/chevre/service/transaction/placeOrder/updateAgent.js +17 -86
- package/lib/chevre/service/transaction/returnOrder/preStart.js +1 -1
- package/lib/chevre/service.d.ts +4 -0
- package/lib/chevre/service.js +12 -1
- package/lib/chevre/taskSettings.d.ts +1 -3
- package/package.json +8 -11
- package/lib/chevre/service/order/findConfirmedPlaceOrder.d.ts +0 -13
- package/lib/chevre/service/order/findConfirmedPlaceOrder.js +0 -32
- package/lib/chevre/service/reserve/findReservations.d.ts +0 -33
- package/lib/chevre/service/reserve/findReservations.js +0 -61
|
@@ -82,7 +82,8 @@ function createStartParams(params, options) {
|
|
|
82
82
|
break;
|
|
83
83
|
}
|
|
84
84
|
default:
|
|
85
|
-
|
|
85
|
+
// no op
|
|
86
|
+
throw new factory_1.factory.errors.NotImplemented(`paymentServiceType: ${params.paymentServiceType} not implemented`);
|
|
86
87
|
}
|
|
87
88
|
// const informPaymentParams = createInformPaymentParams({
|
|
88
89
|
// paymentService: <factory.service.paymentService.IService | undefined>params.paymentService
|
|
@@ -122,12 +123,10 @@ function createStartParams(params, options) {
|
|
|
122
123
|
: paymentMethodType,
|
|
123
124
|
amount: paymentMethodAmount, // MonetaryAmount対応(2023-08-14~)
|
|
124
125
|
identifier: paymentMethodType, // 追加(2023-08-29~)
|
|
126
|
+
totalPaymentDue,
|
|
125
127
|
...(typeof params.object.paymentMethod?.description === 'string')
|
|
126
128
|
? { description: params.object.paymentMethod?.description }
|
|
127
129
|
: undefined,
|
|
128
|
-
...(totalPaymentDue !== undefined)
|
|
129
|
-
? { totalPaymentDue: totalPaymentDue }
|
|
130
|
-
: undefined,
|
|
131
130
|
...(typeof accountId === 'string') ? { accountId: accountId } : undefined,
|
|
132
131
|
...(typeof params.object.paymentMethod?.method === 'string')
|
|
133
132
|
? { method: params.object.paymentMethod?.method }
|
|
@@ -44,7 +44,7 @@ export { IPaymentAgencyTransaction };
|
|
|
44
44
|
* 取引開始
|
|
45
45
|
*/
|
|
46
46
|
export declare function start(params: factory.assetTransaction.pay.IStartParamsWithoutDetail & {
|
|
47
|
-
instrument: factory.action.trade.pay.
|
|
47
|
+
instrument: factory.action.trade.pay.IPayTransactionInstrument[];
|
|
48
48
|
}, options: {
|
|
49
49
|
pendingPaymentAgencyTransaction?: IPaymentAgencyTransaction;
|
|
50
50
|
/**
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { IExecuteSettings as IMinimumExecuteSettings, INextFunction } from '../eventEmitter/task';
|
|
2
|
+
type IExecuteSettings = IMinimumExecuteSettings;
|
|
3
|
+
type IOperation<T> = (settings: IExecuteSettings) => Promise<T>;
|
|
4
|
+
declare function executeAsyncActionById(params: {
|
|
5
|
+
/**
|
|
6
|
+
* タスクID
|
|
7
|
+
*/
|
|
8
|
+
id: string;
|
|
9
|
+
executor: {
|
|
10
|
+
/**
|
|
11
|
+
* タスク実行者名称
|
|
12
|
+
*/
|
|
13
|
+
name: string;
|
|
14
|
+
};
|
|
15
|
+
}, next?: INextFunction): IOperation<void>;
|
|
16
|
+
export { executeAsyncActionById };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.executeAsyncActionById = executeAsyncActionById;
|
|
7
|
+
/**
|
|
8
|
+
* 非同期アクションサービス
|
|
9
|
+
*/
|
|
10
|
+
const debug_1 = __importDefault(require("debug"));
|
|
11
|
+
const asyncActionHandler_1 = require("./asyncActionHandler");
|
|
12
|
+
const debug = (0, debug_1.default)('chevre-domain:service:task');
|
|
13
|
+
function executeAsyncActionById(params, next) {
|
|
14
|
+
return async (settings) => {
|
|
15
|
+
const asyncActionRepo = new (await import('../repo/asyncAction.js')).AsyncActionRepo(settings.connection);
|
|
16
|
+
const { id, executor } = params;
|
|
17
|
+
let task = null;
|
|
18
|
+
try {
|
|
19
|
+
task = await asyncActionRepo.executeAsyncActionById({
|
|
20
|
+
id,
|
|
21
|
+
executor: { name: executor.name }
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
/* istanbul ignore next */
|
|
26
|
+
debug('service.asyncAction.executeAsyncActionById error:', error);
|
|
27
|
+
}
|
|
28
|
+
// タスクがなければ終了
|
|
29
|
+
if (task !== null) {
|
|
30
|
+
await (0, asyncActionHandler_1.executeAsyncAction)(task, (typeof next === 'function') ? next : undefined)(settings, {
|
|
31
|
+
executeById: true,
|
|
32
|
+
executeByName: false
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { IExecutedTask } from '../../eventEmitter/task';
|
|
2
|
+
import type { AsyncActionRepo, IExecutableAsyncAction } from '../../repo/asyncAction';
|
|
3
|
+
/**
|
|
4
|
+
* タスク実行失敗時処理
|
|
5
|
+
*/
|
|
6
|
+
declare function onOperationFailed(params: {
|
|
7
|
+
task: IExecutableAsyncAction;
|
|
8
|
+
now: Date;
|
|
9
|
+
error: any;
|
|
10
|
+
}): (repos: {
|
|
11
|
+
asyncAction: AsyncActionRepo;
|
|
12
|
+
}) => Promise<{
|
|
13
|
+
executedTask: IExecutedTask;
|
|
14
|
+
}>;
|
|
15
|
+
export { onOperationFailed };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.onOperationFailed = onOperationFailed;
|
|
4
|
+
const factory_1 = require("../../factory");
|
|
5
|
+
/**
|
|
6
|
+
* タスク実行失敗時処理
|
|
7
|
+
*/
|
|
8
|
+
function onOperationFailed(params) {
|
|
9
|
+
return async (repos) => {
|
|
10
|
+
let error = params.error;
|
|
11
|
+
const { task, now } = params;
|
|
12
|
+
if (error === null || typeof error !== 'object') {
|
|
13
|
+
error = { message: String(error) };
|
|
14
|
+
}
|
|
15
|
+
const endDate = new Date();
|
|
16
|
+
// 非同期アクションはワンタイムタスクなのでリトライはありえない
|
|
17
|
+
// ワンタイムタスクは分析連携しない
|
|
18
|
+
const result = {
|
|
19
|
+
executedAt: now,
|
|
20
|
+
endDate,
|
|
21
|
+
error: {
|
|
22
|
+
...error,
|
|
23
|
+
code: error.code,
|
|
24
|
+
message: error.message,
|
|
25
|
+
name: error.name,
|
|
26
|
+
stack: error.stack
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
await repos.asyncAction.setExecutionResultAndStatus({ id: task.id }, {
|
|
30
|
+
status: factory_1.factory.taskStatus.Aborted,
|
|
31
|
+
executionResult: result
|
|
32
|
+
});
|
|
33
|
+
const executedTask = {
|
|
34
|
+
id: task.id,
|
|
35
|
+
remainingNumberOfTries: 0,
|
|
36
|
+
name: task.name,
|
|
37
|
+
status: factory_1.factory.taskStatus.Aborted,
|
|
38
|
+
executionResult: result
|
|
39
|
+
};
|
|
40
|
+
return { executedTask };
|
|
41
|
+
};
|
|
42
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { INextFunction } from '../eventEmitter/task';
|
|
2
|
+
import type { ICallResult, ICallableTaskOperation, IExecutableTaskKeys, IOperationExecute } from '../taskSettings';
|
|
3
|
+
import type { IExecutableAsyncAction } from '../repo/asyncAction';
|
|
4
|
+
export declare const taskLoader: {
|
|
5
|
+
load: (taskName: string) => Promise<{
|
|
6
|
+
call: ICallableTaskOperation;
|
|
7
|
+
}>;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* 非同期アクションを実行する
|
|
11
|
+
*/
|
|
12
|
+
declare function executeAsyncAction(task: IExecutableAsyncAction, next?: INextFunction): IOperationExecute<void>;
|
|
13
|
+
export { ICallableTaskOperation, ICallResult, IExecutableTaskKeys, IOperationExecute, executeAsyncAction };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.taskLoader = void 0;
|
|
7
|
+
exports.executeAsyncAction = executeAsyncAction;
|
|
8
|
+
const debug_1 = __importDefault(require("debug"));
|
|
9
|
+
const moment_1 = __importDefault(require("moment"));
|
|
10
|
+
const factory_1 = require("../factory");
|
|
11
|
+
const onOperationFailed_1 = require("./asyncActionHandler/onOperationFailed");
|
|
12
|
+
const debug = (0, debug_1.default)('chevre-domain:service:asyncActionHandler');
|
|
13
|
+
exports.taskLoader = {
|
|
14
|
+
load: (taskName) => {
|
|
15
|
+
return import(`./task/${taskName}.js`);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* 非同期アクションを実行する
|
|
20
|
+
*/
|
|
21
|
+
function executeAsyncAction(task, next) {
|
|
22
|
+
const now = new Date();
|
|
23
|
+
debug('executing an executableTask...', task, now);
|
|
24
|
+
return async (settings, options) => {
|
|
25
|
+
const asyncActionRepo = new (await import('../repo/asyncAction.js')).AsyncActionRepo(settings.connection);
|
|
26
|
+
let executedTask;
|
|
27
|
+
try {
|
|
28
|
+
// 期限検証(2024-04-23~)
|
|
29
|
+
if (task.expires instanceof Date) {
|
|
30
|
+
const taskExpired = (0, moment_1.default)(now)
|
|
31
|
+
.isAfter(task.expires);
|
|
32
|
+
if (taskExpired) {
|
|
33
|
+
throw new factory_1.factory.errors.Internal(`task expired [expires:${task.expires}]`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
// remainingNumberOfTriesは存在しないので検証不要
|
|
37
|
+
// remainingNumberOfTries<0ならcallを実行しない(2025-08-04~)
|
|
38
|
+
// タスク名の関数が定義されていなければ、TypeErrorとなる
|
|
39
|
+
const { call } = await exports.taskLoader.load(task.name); // testが書きづらいのでtaskLoader経由で呼ぶ
|
|
40
|
+
const callResult = await call({
|
|
41
|
+
...task,
|
|
42
|
+
numberOfTried: 1, // ひとまず固定でok(2026-07-26~)
|
|
43
|
+
remainingNumberOfTries: 0 // ひとまず固定でok(2026-07-26~)
|
|
44
|
+
})(settings, options);
|
|
45
|
+
const result = {
|
|
46
|
+
executedAt: now,
|
|
47
|
+
endDate: new Date(),
|
|
48
|
+
// enable overwriting task.executionResults.error on Executed(2024-05-29~)
|
|
49
|
+
error: (callResult?.error instanceof Error)
|
|
50
|
+
? {
|
|
51
|
+
...callResult.error,
|
|
52
|
+
message: callResult.error.message
|
|
53
|
+
}
|
|
54
|
+
: ''
|
|
55
|
+
};
|
|
56
|
+
await asyncActionRepo.setExecutionResultAndStatus({ id: task.id }, {
|
|
57
|
+
status: factory_1.factory.taskStatus.Executed,
|
|
58
|
+
executionResult: result
|
|
59
|
+
});
|
|
60
|
+
executedTask = {
|
|
61
|
+
id: task.id,
|
|
62
|
+
remainingNumberOfTries: 0, // one timeの前提なのでひとまず固定で0
|
|
63
|
+
name: task.name,
|
|
64
|
+
status: factory_1.factory.taskStatus.Executed,
|
|
65
|
+
executionResult: result
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
const onOperationFailedResult = await (0, onOperationFailed_1.onOperationFailed)({
|
|
70
|
+
task, now, error,
|
|
71
|
+
})({ asyncAction: asyncActionRepo });
|
|
72
|
+
executedTask = onOperationFailedResult.executedTask;
|
|
73
|
+
}
|
|
74
|
+
finally {
|
|
75
|
+
if (typeof next === 'function') {
|
|
76
|
+
if (executedTask === undefined) {
|
|
77
|
+
executedTask = {
|
|
78
|
+
id: task.id,
|
|
79
|
+
remainingNumberOfTries: 0, // one timeの前提なのでひとまず固定で0
|
|
80
|
+
name: task.name,
|
|
81
|
+
status: factory_1.factory.taskStatus.Aborted,
|
|
82
|
+
executionResult: {} // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
await next(executedTask)(settings);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
}
|
|
@@ -5,11 +5,9 @@ export interface ILineNotifyMessage {
|
|
|
5
5
|
subject: string;
|
|
6
6
|
content: string;
|
|
7
7
|
}
|
|
8
|
-
export declare function task2lineNotify(params: {
|
|
9
|
-
task: factory.task.ITask<factory.taskName>;
|
|
10
|
-
}): ILineNotifyMessage;
|
|
11
8
|
export declare function tasks2lineNotify(params: {
|
|
12
|
-
tasks: factory.task.ITask<factory.taskName>[];
|
|
9
|
+
tasks: Pick<factory.task.ITask<factory.taskName>, 'id' | 'executionResults' | 'project' | 'name' | 'runsAt'>[];
|
|
10
|
+
limit: number;
|
|
13
11
|
}): ILineNotifyMessage;
|
|
14
12
|
export declare function createSendEmailMessageRecipe(params: {
|
|
15
13
|
mailData?: MailData;
|
|
@@ -4,37 +4,39 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ABORT_REPORT_SUBJECT = void 0;
|
|
7
|
-
exports.task2lineNotify = task2lineNotify;
|
|
8
7
|
exports.tasks2lineNotify = tasks2lineNotify;
|
|
9
8
|
exports.createSendEmailMessageRecipe = createSendEmailMessageRecipe;
|
|
10
9
|
const moment_1 = __importDefault(require("moment"));
|
|
11
10
|
const factory_1 = require("../../factory");
|
|
12
11
|
exports.ABORT_REPORT_SUBJECT = 'tasks aborted';
|
|
13
|
-
function task2lineNotify(params
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
12
|
+
// function task2lineNotify(params: {
|
|
13
|
+
// task: factory.task.ITask<factory.taskName>;
|
|
14
|
+
// }): ILineNotifyMessage {
|
|
15
|
+
// const task = params.task;
|
|
16
|
+
// const lastExecutionResult = (task.executionResults.length > 0) ? task.executionResults.slice(-1)[0] : undefined;
|
|
17
|
+
// let lastError = lastExecutionResult?.error;
|
|
18
|
+
// if (typeof lastError === 'string') {
|
|
19
|
+
// lastError = { message: lastError, name: 'Error' };
|
|
20
|
+
// }
|
|
21
|
+
// const lastMessage = `${String(lastError?.name)} ${String(lastError?.message)}`;
|
|
22
|
+
// const content = `project:${task.project?.id}
|
|
23
|
+
// id:${task.id}
|
|
24
|
+
// name:${task.name}
|
|
25
|
+
// runsAt:${moment(task.runsAt)
|
|
26
|
+
// .toISOString()}
|
|
27
|
+
// lastTriedAt:${moment((task.lastTriedAt as Date))
|
|
28
|
+
// .toISOString()}
|
|
29
|
+
// numberOfTried:${task.numberOfTried}
|
|
30
|
+
// lastMessage:${lastMessage}`;
|
|
31
|
+
// return {
|
|
32
|
+
// subject: ABORT_REPORT_SUBJECT,
|
|
33
|
+
// content: content
|
|
34
|
+
// };
|
|
35
|
+
// }
|
|
35
36
|
const MAX_LAST_MESSAGE_LENGTH = 60;
|
|
36
37
|
function tasks2lineNotify(params) {
|
|
37
|
-
const
|
|
38
|
+
const abortedTasksCount = (params.tasks.length >= params.limit) ? `over ${params.tasks.length}` : params.tasks.length;
|
|
39
|
+
const subject = `${abortedTasksCount} ${exports.ABORT_REPORT_SUBJECT}`;
|
|
38
40
|
let content;
|
|
39
41
|
// あまりに通知タスク数が多いケースに対応
|
|
40
42
|
if (params.tasks.length > 10) {
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import type { TaskRepo } from '../../repo/task';
|
|
2
2
|
import type { IntegrationSettingRepo } from '../../repo/setting/integration';
|
|
3
|
+
interface INotifyAbortedTasksRepos {
|
|
4
|
+
task: TaskRepo;
|
|
5
|
+
integrationSetting: IntegrationSettingRepo;
|
|
6
|
+
}
|
|
3
7
|
/**
|
|
4
8
|
* 中止されたタスクリストをEメールで通知する
|
|
5
9
|
* add(2025-03-13~)
|
|
6
10
|
*/
|
|
7
11
|
declare function notifyAbortedTasksByEmail(params: {
|
|
8
12
|
dateAbortedGte: Date;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
dateAbortedLte: Date;
|
|
14
|
+
/**
|
|
15
|
+
* 中止タスクがあまりに多いと性能に影響するので、現実的にタスク数を制限する
|
|
16
|
+
*/
|
|
17
|
+
limit: number;
|
|
18
|
+
}): (repos: INotifyAbortedTasksRepos) => Promise<void>;
|
|
19
|
+
export { notifyAbortedTasksByEmail, INotifyAbortedTasksRepos };
|
|
@@ -17,16 +17,24 @@ function notifyAbortedTasksByEmail(params) {
|
|
|
17
17
|
return async (repos) => {
|
|
18
18
|
const abortedTasksWithoutReport = await repos.integrationSetting.getByKey('abortedTasksWithoutReport');
|
|
19
19
|
const abortedTasks = await repos.task.projectFields({
|
|
20
|
+
limit: params.limit,
|
|
21
|
+
page: 1,
|
|
20
22
|
status: { $eq: factory_1.factory.taskStatus.Aborted },
|
|
21
|
-
dateAborted: {
|
|
23
|
+
dateAborted: {
|
|
24
|
+
$gte: params.dateAbortedGte,
|
|
25
|
+
$lte: params.dateAbortedLte,
|
|
26
|
+
},
|
|
22
27
|
// 中止を報告しないタスク以外にフィルター
|
|
23
28
|
...(abortedTasksWithoutReport.length > 0)
|
|
24
29
|
? { name: { $nin: abortedTasksWithoutReport } }
|
|
25
30
|
: undefined
|
|
26
|
-
}, []);
|
|
31
|
+
}, ['executionResults', 'name', 'project', 'runsAt']);
|
|
27
32
|
if (abortedTasks.length > 0) {
|
|
28
33
|
// 開発者へ報告
|
|
29
|
-
const message = (0, factory_2.tasks2lineNotify)({
|
|
34
|
+
const message = (0, factory_2.tasks2lineNotify)({
|
|
35
|
+
tasks: abortedTasks,
|
|
36
|
+
limit: params.limit
|
|
37
|
+
});
|
|
30
38
|
const notifyResult = await (0, notifyByEmail_1.notifyByEmail)({
|
|
31
39
|
subject: message.subject, content: message.content,
|
|
32
40
|
logLevel: 'error'
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { factory } from '../../../../factory';
|
|
2
|
-
import { IMinimizedIndividualEvent } from '../../../../factory/event';
|
|
3
2
|
declare function createReserveTransactionStartParams(params: {
|
|
4
3
|
project: {
|
|
5
4
|
id: string;
|
|
@@ -13,7 +12,6 @@ declare function createReserveTransactionStartParams(params: {
|
|
|
13
12
|
transactionNumber: string;
|
|
14
13
|
}): factory.assetTransaction.reserve.IStartParamsWithoutDetail;
|
|
15
14
|
declare function createAuthorizeSeatReservationActionAttributes(params: {
|
|
16
|
-
event: Pick<IMinimizedIndividualEvent, 'id'>;
|
|
17
15
|
instrument: {
|
|
18
16
|
/**
|
|
19
17
|
* 予約取引番号
|
|
@@ -21,8 +19,6 @@ declare function createAuthorizeSeatReservationActionAttributes(params: {
|
|
|
21
19
|
transactionNumber: string;
|
|
22
20
|
};
|
|
23
21
|
transaction: Pick<factory.transaction.ITransaction<factory.transactionType.PlaceOrder>, 'agent' | 'id' | 'project' | 'seller' | 'typeOf'>;
|
|
24
|
-
}, options: {
|
|
25
|
-
useLegacyAuthorizeOfferObject: boolean;
|
|
26
22
|
}): factory.action.authorize.offer.eventService.IAttributes;
|
|
27
23
|
declare function acceptedOffers2amount(params: {
|
|
28
24
|
acceptedOffers: Pick<IResultAcceptedOffer, 'priceSpecification' | 'id'>[];
|
|
@@ -31,7 +27,9 @@ declare function acceptedOffers2authorizeResult(params: {
|
|
|
31
27
|
acceptedOffers4result: IResultAcceptedOffer[];
|
|
32
28
|
noOfferSpecified: boolean;
|
|
33
29
|
ticketOffers: factory.product.ITicketOffer[];
|
|
34
|
-
}): factory.action.authorize.offer.eventService.IResult
|
|
30
|
+
}): factory.action.authorize.offer.eventService.IResult & {
|
|
31
|
+
onlyPrice?: boolean;
|
|
32
|
+
};
|
|
35
33
|
type IObjectSubReservation = factory.assetTransaction.reserve.IObjectSubReservation;
|
|
36
34
|
export type IResultAcceptedOffer = Omit<factory.order.IOptimizedAcceptedOffer, 'priceSpecification'> & {
|
|
37
35
|
itemOffered: factory.order.IEventReservation;
|
|
@@ -80,16 +80,16 @@ function createReserveTransactionStartParams(params) {
|
|
|
80
80
|
.toDate() // 余裕を持って
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
|
-
function createAuthorizeSeatReservationActionAttributes(params
|
|
84
|
-
const { useLegacyAuthorizeOfferObject } = options;
|
|
85
|
-
const {
|
|
86
|
-
const authorizeObjectEvent = {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
};
|
|
83
|
+
function createAuthorizeSeatReservationActionAttributes(params) {
|
|
84
|
+
// const { useLegacyAuthorizeOfferObject } = options;
|
|
85
|
+
const { transaction } = params;
|
|
86
|
+
// const authorizeObjectEvent: factory.action.authorize.offer.eventService.IEventInObject = {
|
|
87
|
+
// id: event.id,
|
|
88
|
+
// typeOf: factory.eventType.ScreeningEvent // fix(2024-07-17~)
|
|
89
|
+
// };
|
|
90
90
|
const object = {
|
|
91
91
|
typeOf: factory_1.factory.action.authorize.offer.eventService.ObjectType.SeatReservation,
|
|
92
|
-
...((useLegacyAuthorizeOfferObject) && { event: authorizeObjectEvent })
|
|
92
|
+
// ...((useLegacyAuthorizeOfferObject) && { event: authorizeObjectEvent })
|
|
93
93
|
};
|
|
94
94
|
const instrument = {
|
|
95
95
|
typeOf: factory_1.factory.assetTransactionType.Reserve, // 変更(2024-03-08~)
|
|
@@ -144,82 +144,100 @@ function acceptedOffers2amount(params) {
|
|
|
144
144
|
});
|
|
145
145
|
return amount;
|
|
146
146
|
}
|
|
147
|
-
function acceptedOffers2programMembershipUsed(params
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}
|
|
147
|
+
// function acceptedOffers2programMembershipUsed(params: {
|
|
148
|
+
// acceptedOffers: IResultAcceptedOffer[];
|
|
149
|
+
// }): factory.action.authorize.offer.eventService.IAggregateProgramMembershipUsed {
|
|
150
|
+
// const programMembershipUsed: factory.action.authorize.offer.eventService.IAggregateProgramMembershipUsed = [];
|
|
151
|
+
// const permitIdentifiers: string[] = [];
|
|
152
|
+
// params.acceptedOffers.forEach(
|
|
153
|
+
// ({ itemOffered }) => {
|
|
154
|
+
// if (itemOffered.programMembershipUsed?.typeOf === factory.programMembership.ProgramMembershipType.ProgramMembership) {
|
|
155
|
+
// // メンバーシップコードに対してユニークに集計
|
|
156
|
+
// if (!permitIdentifiers.includes(itemOffered.programMembershipUsed.identifier)) {
|
|
157
|
+
// permitIdentifiers.push(itemOffered.programMembershipUsed.identifier);
|
|
158
|
+
// const issuedThroughTypeOf = itemOffered.programMembershipUsed.issuedThrough.typeOf;
|
|
159
|
+
// if (issuedThroughTypeOf === factory.service.paymentService.PaymentServiceType.FaceToFace) {
|
|
160
|
+
// programMembershipUsed.push({
|
|
161
|
+
// typeOf: factory.permit.PermitType.Permit,
|
|
162
|
+
// identifier: itemOffered.programMembershipUsed.identifier,
|
|
163
|
+
// issuedThrough: { typeOf: issuedThroughTypeOf }
|
|
164
|
+
// });
|
|
165
|
+
// } else {
|
|
166
|
+
// programMembershipUsed.push({
|
|
167
|
+
// typeOf: factory.permit.PermitType.Permit,
|
|
168
|
+
// identifier: itemOffered.programMembershipUsed.identifier,
|
|
169
|
+
// issuedThrough: { typeOf: issuedThroughTypeOf, id: itemOffered.programMembershipUsed.issuedThrough.id }
|
|
170
|
+
// });
|
|
171
|
+
// }
|
|
172
|
+
// }
|
|
173
|
+
// }
|
|
174
|
+
// }
|
|
175
|
+
// );
|
|
176
|
+
// return programMembershipUsed;
|
|
177
|
+
// }
|
|
175
178
|
function acceptedOffers2authorizeResult(params) {
|
|
176
|
-
const { acceptedOffers4result, noOfferSpecified,
|
|
177
|
-
//
|
|
178
|
-
|
|
179
|
+
const { acceptedOffers4result, noOfferSpecified,
|
|
180
|
+
// ticketOffers
|
|
181
|
+
} = params;
|
|
182
|
+
// let offers: factory.action.authorize.offer.eventService.IAcceptedOfferInResult[] | undefined;
|
|
179
183
|
let price;
|
|
180
|
-
let programMembershipUsed = [];
|
|
184
|
+
// let programMembershipUsed: factory.action.authorize.offer.eventService.IAggregateProgramMembershipUsed = [];
|
|
181
185
|
if (!noOfferSpecified) {
|
|
182
186
|
price = acceptedOffers2amount({ acceptedOffers: acceptedOffers4result }); // オファー指定の場合のみ金額計算(2023-11-27~)
|
|
183
|
-
programMembershipUsed = acceptedOffers2programMembershipUsed({ acceptedOffers: acceptedOffers4result });
|
|
187
|
+
// programMembershipUsed = acceptedOffers2programMembershipUsed({ acceptedOffers: acceptedOffers4result });
|
|
184
188
|
// オファーIDごとに集計
|
|
185
|
-
const offerIds = [...new Set(acceptedOffers4result.map((o) => String(o.id)))];
|
|
186
|
-
//
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
});
|
|
189
|
+
// const offerIds = [...new Set(acceptedOffers4result.map((o) => String(o.id)))];
|
|
190
|
+
// offers = offerIds.map<factory.action.authorize.offer.eventService.IAcceptedOfferInResult>((offerId) => {
|
|
191
|
+
// const acceptedOffer = ticketOffers.find(({ id }) => id === offerId);
|
|
192
|
+
// if (acceptedOffer === undefined) {
|
|
193
|
+
// throw new factory.errors.Internal(`acceptedOffer not found [id:${offerId}]`);
|
|
194
|
+
// }
|
|
195
|
+
// const amountOfThisGood: number = acceptedOffers4result.filter(({ id }) => id === offerId).length;
|
|
196
|
+
// // const amountOfThisGood: number = acceptedOffers.filter(({ id }) => id === offerId).length;
|
|
197
|
+
// const { acceptedPaymentMethod, priceSpecification } = acceptedOffer;
|
|
198
|
+
// const unitPriceSpec = priceSpecification.priceComponent.find(
|
|
199
|
+
// (spec) => spec.typeOf === factory.priceSpecificationType.UnitPriceSpecification
|
|
200
|
+
// && (!Array.isArray(spec.appliesToAddOn)) // アドオン単価ではない
|
|
201
|
+
// ) as IUnitPriceSpecification | undefined;
|
|
202
|
+
// if (unitPriceSpec === undefined) {
|
|
203
|
+
// throw new factory.errors.Internal(`unitPriceSpec not found [id:${offerId}]`);
|
|
204
|
+
// }
|
|
205
|
+
// const { eligibleQuantity } = unitPriceSpec;
|
|
206
|
+
// return {
|
|
207
|
+
// id: offerId,
|
|
208
|
+
// includesObject: { amountOfThisGood },
|
|
209
|
+
// typeOf: factory.offerType.Offer,
|
|
210
|
+
// priceSpecification: {
|
|
211
|
+
// ...(eligibleQuantity !== undefined) ? { eligibleQuantity } : undefined,
|
|
212
|
+
// // ...(eligibleTransactionVolume !== undefined) ? { eligibleTransactionVolume } : undefined // discontinue(2026-07-05~)
|
|
213
|
+
// },
|
|
214
|
+
// ...(acceptedPaymentMethod !== undefined) ? { acceptedPaymentMethod } : undefined
|
|
215
|
+
// };
|
|
216
|
+
// });
|
|
213
217
|
}
|
|
218
|
+
// discontinue useLegacyAuthorizeOfferResult(2026-07-18~)
|
|
219
|
+
// if (useLegacyAuthorizeOfferResult) {
|
|
220
|
+
// return {
|
|
221
|
+
// typeOf: factory.offerType.AggregateOffer,
|
|
222
|
+
// // priceCurrency, // discontinue(2026-07-06~)
|
|
223
|
+
// // amount: [], // discontinue(2026-07-06~)
|
|
224
|
+
// itemOffered: {
|
|
225
|
+
// serviceOutput: { programMembershipUsed } // add programMembershipUsed required(2024-08-15~)
|
|
226
|
+
// },
|
|
227
|
+
// ...(typeof price === 'number') ? { price } : undefined,
|
|
228
|
+
// ...(Array.isArray(offers)) ? { offers } : undefined
|
|
229
|
+
// };
|
|
230
|
+
// } else {
|
|
231
|
+
// return {
|
|
232
|
+
// typeOf: factory.offerType.AggregateOffer,
|
|
233
|
+
// onlyPrice: true,
|
|
234
|
+
// ...(typeof price === 'number') ? { price } : undefined,
|
|
235
|
+
// };
|
|
236
|
+
// }
|
|
214
237
|
return {
|
|
215
238
|
typeOf: factory_1.factory.offerType.AggregateOffer,
|
|
216
|
-
|
|
217
|
-
// amount: [], // discontinue(2026-07-06~)
|
|
218
|
-
itemOffered: {
|
|
219
|
-
serviceOutput: { programMembershipUsed } // add programMembershipUsed required(2024-08-15~)
|
|
220
|
-
},
|
|
239
|
+
onlyPrice: true,
|
|
221
240
|
...(typeof price === 'number') ? { price } : undefined,
|
|
222
|
-
...(Array.isArray(offers)) ? { offers } : undefined
|
|
223
241
|
};
|
|
224
242
|
}
|
|
225
243
|
function responseBody2acceptedOffers4result(params) {
|
|
@@ -32,9 +32,9 @@ function authorize(params, options) {
|
|
|
32
32
|
// まず取引番号発行
|
|
33
33
|
const { transactionNumber } = await repos.transactionNumber.publishByTimestamp({ startDate: now });
|
|
34
34
|
const actionAttributes = (0, factory_2.createAuthorizeSeatReservationActionAttributes)({
|
|
35
|
-
|
|
35
|
+
transaction,
|
|
36
36
|
instrument: { transactionNumber }
|
|
37
|
-
}
|
|
37
|
+
});
|
|
38
38
|
const action = await repos.authorizeOfferAction.start(actionAttributes);
|
|
39
39
|
try {
|
|
40
40
|
const processStartReserveResult = await (0, processStartReserve4chevre_1.processStartReserve4chevre)({
|