@chevre/domain 25.2.0-alpha.39 → 25.2.0-alpha.40
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/service/order/onAssetTransactionStatusChanged/onPayTransactionCanceled.js +19 -11
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/paymentDue2Processing.d.ts +0 -2
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/paymentDue2Processing.js +1 -7
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +2 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.d.ts +0 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +1 -0
- 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/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/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 +2 -1
- 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 +2 -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 +2 -1
- 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/voidPayment.d.ts +2 -2
- package/lib/chevre/service/task/voidPayment.js +2 -1
- package/lib/chevre/service/taskHandler.d.ts +2 -2
- package/lib/chevre/service/taskHandler.js +36 -37
- package/lib/chevre/taskSettings.d.ts +1 -3
- package/package.json +1 -1
- package/lib/chevre/service/order/findConfirmedPlaceOrder.d.ts +0 -13
- package/lib/chevre/service/order/findConfirmedPlaceOrder.js +0 -32
package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionCanceled.js
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.onPayTransactionCanceled = onPayTransactionCanceled;
|
|
4
|
-
const findConfirmedPlaceOrder_1 = require("../findConfirmedPlaceOrder");
|
|
5
4
|
const onOrderStatusChanged_1 = require("../onOrderStatusChanged");
|
|
6
5
|
const factory_1 = require("../../../factory");
|
|
7
6
|
function onPayTransactionCanceled(params) {
|
|
8
|
-
return async (repos
|
|
9
|
-
// settings: Settings
|
|
10
|
-
) => {
|
|
7
|
+
return async (repos) => {
|
|
11
8
|
if (typeof params.useOnOrderStatusChanged !== 'boolean') {
|
|
12
9
|
throw new factory_1.factory.errors.Argument('useOnOrderStatusChanged', 'must be boolean');
|
|
13
10
|
}
|
|
14
|
-
//
|
|
11
|
+
// 中止された決済取引に依存した注文ドキュメントがもし存在すればキャンセル(2023-08-30~)
|
|
15
12
|
await cancelOrderIfExist({
|
|
16
13
|
project: { id: params.project.id },
|
|
17
14
|
paymentMethodId: params.object.transactionNumber,
|
|
@@ -32,14 +29,25 @@ function cancelOrderIfExist(params) {
|
|
|
32
29
|
paymentMethodIds: [params.paymentMethodId]
|
|
33
30
|
},
|
|
34
31
|
project: { id: { $eq: params.project.id } }
|
|
35
|
-
}, { inclusion: ['
|
|
32
|
+
}, { inclusion: ['orderNumber'] });
|
|
36
33
|
const orderByPaymentMethodId = ordersByPaymentMethodId.shift();
|
|
37
34
|
if (orderByPaymentMethodId !== undefined) {
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
35
|
+
const placeOrderTransactions = await repos.placeOrder.findPlaceOrderTransactions({
|
|
36
|
+
limit: 1,
|
|
37
|
+
page: 1,
|
|
38
|
+
project: { id: { $eq: params.project.id } },
|
|
39
|
+
typeOf: factory_1.factory.transactionType.PlaceOrder,
|
|
40
|
+
statuses: [factory_1.factory.transactionStatusType.Confirmed],
|
|
41
|
+
// resultではなくobjectで参照するように変更(2026-06-16~)
|
|
42
|
+
object: {
|
|
43
|
+
orderNumber: { $eq: orderByPaymentMethodId.orderNumber },
|
|
44
|
+
},
|
|
45
|
+
inclusion: ['project', 'typeOf']
|
|
46
|
+
});
|
|
47
|
+
const placeOrderTransaction = placeOrderTransactions.shift();
|
|
48
|
+
if (placeOrderTransaction === undefined) {
|
|
49
|
+
throw new factory_1.factory.errors.NotFound(factory_1.factory.transactionType.PlaceOrder);
|
|
50
|
+
}
|
|
43
51
|
const order = await repos.order.changeStatus({
|
|
44
52
|
project: { id: params.project.id },
|
|
45
53
|
orderNumber: orderByPaymentMethodId.orderNumber,
|
|
@@ -3,7 +3,6 @@ import type { MessageRepo } from '../../../repo/message';
|
|
|
3
3
|
import type { OrderRepo } from '../../../repo/order';
|
|
4
4
|
import type { SettingRepo } from '../../../repo/setting';
|
|
5
5
|
import type { TaskRepo } from '../../../repo/task';
|
|
6
|
-
import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
|
|
7
6
|
import type { IntegrationSettingRepo as Settings } from '../../../repo/setting/integration';
|
|
8
7
|
interface IPaymentDue2ProcessingRepos {
|
|
9
8
|
acceptedOffer: AcceptedOfferRepo;
|
|
@@ -11,7 +10,6 @@ interface IPaymentDue2ProcessingRepos {
|
|
|
11
10
|
order: OrderRepo;
|
|
12
11
|
setting: SettingRepo;
|
|
13
12
|
task: TaskRepo;
|
|
14
|
-
placeOrder: PlaceOrderRepo;
|
|
15
13
|
}
|
|
16
14
|
/**
|
|
17
15
|
* 全決済取引確定を完了した注文に関して、アイテムを処理する
|
|
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.paymentDue2Processing = paymentDue2Processing;
|
|
7
7
|
const debug_1 = __importDefault(require("debug"));
|
|
8
|
-
const findConfirmedPlaceOrder_1 = require("../findConfirmedPlaceOrder");
|
|
9
8
|
const onOrderStatusChanged_1 = require("../onOrderStatusChanged");
|
|
10
9
|
const factory_1 = require("../../../factory");
|
|
11
10
|
const debug = (0, debug_1.default)('chevre-domain:service:order');
|
|
@@ -14,11 +13,6 @@ const debug = (0, debug_1.default)('chevre-domain:service:order');
|
|
|
14
13
|
*/
|
|
15
14
|
function paymentDue2Processing(params) {
|
|
16
15
|
return async (repos, settings) => {
|
|
17
|
-
const placeOrderTransaction = await (0, findConfirmedPlaceOrder_1.findConfirmedPlaceOrder)({
|
|
18
|
-
project: { id: params.project.id },
|
|
19
|
-
confirmationNumber: params.confirmationNumber,
|
|
20
|
-
orderNumber: params.orderNumber
|
|
21
|
-
})(repos);
|
|
22
16
|
let order;
|
|
23
17
|
try {
|
|
24
18
|
order = await repos.order.changeStatus({
|
|
@@ -74,7 +68,7 @@ function paymentDue2Processing(params) {
|
|
|
74
68
|
offeredThroughIdentifier,
|
|
75
69
|
orderStatus: factory_1.factory.orderStatus.OrderProcessing // 強制的にOrderProcessingとして処理する
|
|
76
70
|
},
|
|
77
|
-
placeOrderTransaction
|
|
71
|
+
// placeOrderTransaction
|
|
78
72
|
})(repos, settings);
|
|
79
73
|
}
|
|
80
74
|
};
|
|
@@ -12,7 +12,9 @@ Object.defineProperty(exports, "processing2inTransit", { enumerable: true, get:
|
|
|
12
12
|
const factory_1 = require("../../factory");
|
|
13
13
|
function onAssetTransactionStatusChanged(params) {
|
|
14
14
|
return async (repos, settings) => {
|
|
15
|
+
/* istanbul ignore else -- @preserve */
|
|
15
16
|
if (typeof params.useOnOrderStatusChanged !== 'boolean') {
|
|
17
|
+
/* istanbul ignore next -- @preserve */
|
|
16
18
|
throw new factory_1.factory.errors.Argument('useOnOrderStatusChanged', 'must be boolean');
|
|
17
19
|
}
|
|
18
20
|
switch (params.object.status) {
|
|
@@ -5,14 +5,12 @@ import { factory } from '../../../factory';
|
|
|
5
5
|
import type { IntegrationSettingRepo as Settings } from '../../../repo/setting/integration';
|
|
6
6
|
import { IExternalOrder, IProcessingOrder } from './onOrderProcessing/factory';
|
|
7
7
|
import { processOrder } from './onOrderProcessing/processOrder';
|
|
8
|
-
type IPlaceOrderTransaction = Pick<factory.transaction.placeOrder.ITransaction, 'id' | 'typeOf' | 'potentialActions'>;
|
|
9
8
|
declare function onOrderProcessing(params: {
|
|
10
9
|
order: IProcessingOrder & {
|
|
11
10
|
itemOfferedTypeOf: factory.order.IItemOffered['typeOf'];
|
|
12
11
|
serialNumbers: string[];
|
|
13
12
|
offeredThroughIdentifier?: factory.service.webAPI.Identifier;
|
|
14
13
|
};
|
|
15
|
-
placeOrderTransaction?: IPlaceOrderTransaction;
|
|
16
14
|
}): (repos: {
|
|
17
15
|
message: MessageRepo;
|
|
18
16
|
setting: SettingRepo;
|
|
@@ -15,6 +15,7 @@ const factory_2 = require("./onOrderProcessing/factory");
|
|
|
15
15
|
const processOrder_1 = require("./onOrderProcessing/processOrder");
|
|
16
16
|
Object.defineProperty(exports, "processOrder", { enumerable: true, get: function () { return processOrder_1.processOrder; } });
|
|
17
17
|
const debug = (0, debug_1.default)('chevre-domain:service:order');
|
|
18
|
+
// type IPlaceOrderTransaction = Pick<factory.transaction.placeOrder.ITransaction, 'id' | 'typeOf'>;
|
|
18
19
|
function onOrderProcessing(params) {
|
|
19
20
|
return async (repos, settings) => {
|
|
20
21
|
const setting = await repos.setting.findOne({ project: { id: { $eq: '*' } } }, ['onOrderStatusChanged']);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { factory } from '../../factory';
|
|
2
|
-
import type { IOperationExecute } from '../taskHandler';
|
|
2
|
+
import type { ICallResult, IExecutableTaskKeys, IOperationExecute } from '../taskHandler';
|
|
3
3
|
/**
|
|
4
4
|
* タスク実行関数
|
|
5
5
|
*/
|
|
6
|
-
export declare function call(
|
|
6
|
+
export declare function call(params: Pick<factory.task.aggregateOffers.ITask, IExecutableTaskKeys>): IOperationExecute<ICallResult>;
|
|
@@ -15,8 +15,9 @@ const aggregateOffers_1 = require("../aggregation/event/aggregateOffers");
|
|
|
15
15
|
/**
|
|
16
16
|
* タスク実行関数
|
|
17
17
|
*/
|
|
18
|
-
function call(
|
|
18
|
+
function call(params) {
|
|
19
19
|
return async ({ redisClient, connection }) => {
|
|
20
|
+
const { data } = params;
|
|
20
21
|
if (redisClient === undefined) {
|
|
21
22
|
throw new factory_1.factory.errors.Argument('settings', 'redisClient required');
|
|
22
23
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { factory } from '../../factory';
|
|
2
|
-
import type { IOperationExecute } from '../taskHandler';
|
|
2
|
+
import type { ICallResult, IExecutableTaskKeys, IOperationExecute } from '../taskHandler';
|
|
3
3
|
/**
|
|
4
4
|
* タスク実行関数
|
|
5
5
|
*/
|
|
6
|
-
export declare function call(
|
|
6
|
+
export declare function call(params: Pick<factory.task.aggregateScreeningEvent.ITask, IExecutableTaskKeys>): IOperationExecute<ICallResult>;
|
|
@@ -49,8 +49,9 @@ const AggregationService = __importStar(require("../aggregation"));
|
|
|
49
49
|
/**
|
|
50
50
|
* タスク実行関数
|
|
51
51
|
*/
|
|
52
|
-
function call(
|
|
52
|
+
function call(params) {
|
|
53
53
|
return async ({ connection, redisClient }) => {
|
|
54
|
+
const { data } = params;
|
|
54
55
|
if (redisClient === undefined) {
|
|
55
56
|
throw new factory_1.factory.errors.Argument('settings', 'redisClient required');
|
|
56
57
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { factory } from '../../factory';
|
|
2
|
-
import type { IOperationExecute } from '../taskHandler';
|
|
2
|
+
import type { ICallResult, IExecutableTaskKeys, IOperationExecute } from '../taskHandler';
|
|
3
3
|
/**
|
|
4
4
|
* タスク実行関数
|
|
5
5
|
*/
|
|
6
|
-
export declare function call(
|
|
6
|
+
export declare function call(params: Pick<factory.task.cancelReservation.ITask, IExecutableTaskKeys>): IOperationExecute<ICallResult>;
|
|
@@ -13,8 +13,9 @@ const cancelReservation_1 = require("../reserve/cancelReservation");
|
|
|
13
13
|
/**
|
|
14
14
|
* タスク実行関数
|
|
15
15
|
*/
|
|
16
|
-
function call(
|
|
16
|
+
function call(params) {
|
|
17
17
|
return async ({ connection, redisClient }) => {
|
|
18
|
+
const { data } = params;
|
|
18
19
|
if (redisClient === undefined) {
|
|
19
20
|
throw new factory_1.factory.errors.Argument('settings', 'redisClient required');
|
|
20
21
|
}
|
|
@@ -15,7 +15,6 @@ const confirmPayTransaction_1 = require("../order/confirmPayTransaction");
|
|
|
15
15
|
* タスク実行関数
|
|
16
16
|
*/
|
|
17
17
|
function call(params) {
|
|
18
|
-
// export function call(data: factory.task.IData<factory.taskName.ConfirmPayTransaction>): IOperationExecute<void> {
|
|
19
18
|
return async ({ connection }) => {
|
|
20
19
|
await (0, confirmPayTransaction_1.confirmPayTransaction)({
|
|
21
20
|
...params.data,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { IOperationExecute } from '../taskHandler';
|
|
1
|
+
import type { ICallResult, IExecutableTaskKeys, IOperationExecute } from '../taskHandler';
|
|
2
2
|
import { factory } from '../../factory';
|
|
3
3
|
/**
|
|
4
4
|
* タスク実行関数
|
|
5
5
|
*/
|
|
6
|
-
export declare function call(
|
|
6
|
+
export declare function call(params: Pick<factory.task.deleteTransaction.ITask, IExecutableTaskKeys>): IOperationExecute<ICallResult>;
|
|
@@ -49,8 +49,9 @@ const TransactionService = __importStar(require("../transaction"));
|
|
|
49
49
|
/**
|
|
50
50
|
* タスク実行関数
|
|
51
51
|
*/
|
|
52
|
-
function call(
|
|
52
|
+
function call(params) {
|
|
53
53
|
return async ({ connection }) => {
|
|
54
|
+
const { data } = params;
|
|
54
55
|
await TransactionService.deleteTransaction(data)({
|
|
55
56
|
acceptedOffer: new acceptedOffer_1.AcceptedOfferRepo(connection),
|
|
56
57
|
accountingReport: new accountingReport_1.AccountingReportRepo(connection),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { IOperationExecute } from '../taskHandler';
|
|
1
|
+
import type { ICallResult, IExecutableTaskKeys, IOperationExecute } from '../taskHandler';
|
|
2
2
|
import { factory } from '../../factory';
|
|
3
3
|
/**
|
|
4
4
|
* タスク実行関数
|
|
5
5
|
*/
|
|
6
|
-
export declare function call(
|
|
6
|
+
export declare function call(params: Pick<factory.task.onAssetTransactionStatusChanged.ITask, IExecutableTaskKeys>): IOperationExecute<ICallResult>;
|
|
@@ -13,8 +13,9 @@ const onAssetTransactionStatusChanged_1 = require("../order/onAssetTransactionSt
|
|
|
13
13
|
/**
|
|
14
14
|
* タスク実行関数
|
|
15
15
|
*/
|
|
16
|
-
function call(
|
|
16
|
+
function call(params) {
|
|
17
17
|
return async ({ connection }) => {
|
|
18
|
+
const { data } = params;
|
|
18
19
|
const settings = new integration_1.IntegrationSettingRepo({ connection });
|
|
19
20
|
await (0, onAssetTransactionStatusChanged_1.onAssetTransactionStatusChanged)(data)({
|
|
20
21
|
acceptedOffer: new acceptedOffer_1.AcceptedOfferRepo(connection),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { factory } from '../../factory';
|
|
2
|
-
import type { IOperationExecute } from '../taskHandler';
|
|
2
|
+
import type { ICallResult, IExecutableTaskKeys, IOperationExecute } from '../taskHandler';
|
|
3
3
|
/**
|
|
4
4
|
* タスク実行関数
|
|
5
5
|
*/
|
|
6
|
-
export declare function call(
|
|
6
|
+
export declare function call(params: Pick<factory.task.onEventChanged.ITask, IExecutableTaskKeys>): IOperationExecute<ICallResult>;
|
|
@@ -11,8 +11,9 @@ const onEventChanged_1 = require("../offer/onEventChanged");
|
|
|
11
11
|
/**
|
|
12
12
|
* タスク実行関数
|
|
13
13
|
*/
|
|
14
|
-
function call(
|
|
14
|
+
function call(params) {
|
|
15
15
|
return async ({ connection }) => {
|
|
16
|
+
const { data } = params;
|
|
16
17
|
await (0, onEventChanged_1.onEventChanged)(data)({
|
|
17
18
|
event: new event_1.EventRepo(connection),
|
|
18
19
|
eventSeries: new eventSeries_1.EventSeriesRepo(connection),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { IOperationExecute } from '../taskHandler';
|
|
1
|
+
import type { ICallResult, IExecutableTaskKeys, IOperationExecute } from '../taskHandler';
|
|
2
2
|
import { factory } from '../../factory';
|
|
3
3
|
/**
|
|
4
4
|
* タスク実行関数
|
|
5
5
|
*/
|
|
6
|
-
export declare function call(
|
|
6
|
+
export declare function call(params: Pick<factory.task.ITask<factory.taskName.OnOrderPaymentCompleted>, IExecutableTaskKeys>): IOperationExecute<ICallResult>;
|
|
@@ -12,8 +12,9 @@ const payOrder_1 = require("../order/payOrder");
|
|
|
12
12
|
/**
|
|
13
13
|
* タスク実行関数
|
|
14
14
|
*/
|
|
15
|
-
function call(
|
|
15
|
+
function call(params) {
|
|
16
16
|
return async ({ connection }) => {
|
|
17
|
+
const { data } = params;
|
|
17
18
|
const settings = new integration_1.IntegrationSettingRepo({ connection });
|
|
18
19
|
await (0, payOrder_1.payOrder)(data)({
|
|
19
20
|
acceptedOffer: new acceptedOffer_1.AcceptedOfferRepo(connection),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { factory } from '../../factory';
|
|
2
|
-
import type { IOperationExecute } from '../taskHandler';
|
|
2
|
+
import type { ICallResult, IExecutableTaskKeys, IOperationExecute } from '../taskHandler';
|
|
3
3
|
/**
|
|
4
4
|
* タスク実行関数
|
|
5
5
|
*/
|
|
6
|
-
export declare function call(
|
|
6
|
+
export declare function call(params: Pick<factory.task.onResourceUpdated.ITask, IExecutableTaskKeys>): IOperationExecute<ICallResult>;
|
|
@@ -29,8 +29,9 @@ const onOfferCatalogUpdated_1 = require("./onResourceUpdated/onOfferCatalogUpdat
|
|
|
29
29
|
/**
|
|
30
30
|
* タスク実行関数
|
|
31
31
|
*/
|
|
32
|
-
function call(
|
|
32
|
+
function call(params) {
|
|
33
33
|
return async ({ connection }) => {
|
|
34
|
+
const { data } = params;
|
|
34
35
|
await onResourceUpdated(data)({
|
|
35
36
|
accountTitle: new accountTitle_1.AccountTitleRepo(connection),
|
|
36
37
|
action: new action_1.ActionRepo(connection),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { IOperationExecute } from '../taskHandler';
|
|
1
|
+
import type { ICallResult, IExecutableTaskKeys, IOperationExecute } from '../taskHandler';
|
|
2
2
|
import { factory } from '../../factory';
|
|
3
3
|
/**
|
|
4
4
|
* タスク実行関数
|
|
5
5
|
*/
|
|
6
|
-
export declare function call(
|
|
6
|
+
export declare function call(params: Pick<factory.task.ITask<factory.taskName.PlaceOrder>, IExecutableTaskKeys>): IOperationExecute<ICallResult>;
|
|
@@ -18,8 +18,9 @@ const placeOrder_2 = require("../order/placeOrder");
|
|
|
18
18
|
/**
|
|
19
19
|
* タスク実行関数
|
|
20
20
|
*/
|
|
21
|
-
function call(
|
|
21
|
+
function call(params) {
|
|
22
22
|
return async ({ connection }) => {
|
|
23
|
+
const { data } = params;
|
|
23
24
|
const settings = new integration_1.IntegrationSettingRepo({ connection });
|
|
24
25
|
await (0, placeOrder_2.placeOrder)({
|
|
25
26
|
...data,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { IExecutableTaskKeys, IOperationExecute } from '../taskHandler';
|
|
1
|
+
import type { ICallResult, IExecutableTaskKeys, IOperationExecute } from '../taskHandler';
|
|
2
2
|
import { factory } from '../../factory';
|
|
3
3
|
/**
|
|
4
4
|
* タスク実行関数
|
|
5
5
|
*/
|
|
6
|
-
export declare function call(params:
|
|
6
|
+
export declare function call(params: Pick<factory.task.refund.ITask, IExecutableTaskKeys>): IOperationExecute<ICallResult>;
|
|
@@ -26,16 +26,10 @@ function call(params) {
|
|
|
26
26
|
throw new factory_1.factory.errors.Argument('settings', 'redisClient required');
|
|
27
27
|
}
|
|
28
28
|
const settings = new integration_1.IntegrationSettingRepo({ connection });
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
sameAs: { id: params.id } // タスクIDを関連付け(2024-04-20~)
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
data = params;
|
|
38
|
-
}
|
|
29
|
+
const data = {
|
|
30
|
+
...params.data,
|
|
31
|
+
sameAs: { id: params.id } // タスクIDを関連付け(2024-04-20~)
|
|
32
|
+
};
|
|
39
33
|
const paymentServiceId = data.object.at(0)?.id;
|
|
40
34
|
const credentialsExpireInSeconds = (await settings.getByKey('movieticketReserve')).credentialsExpireInSeconds;
|
|
41
35
|
const useCredentialsRepo = typeof paymentServiceId === 'string' && paymentServiceId !== ''
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { factory } from '../../factory';
|
|
2
|
-
import type { IOperationExecute } from '../taskHandler';
|
|
2
|
+
import type { ICallResult, IExecutableTaskKeys, IOperationExecute } from '../taskHandler';
|
|
3
3
|
/**
|
|
4
4
|
* タスク実行関数
|
|
5
5
|
*/
|
|
6
|
-
export declare function call(
|
|
6
|
+
export declare function call(params: Pick<factory.task.reserve.ITask, IExecutableTaskKeys>): IOperationExecute<ICallResult>;
|
|
@@ -11,8 +11,9 @@ const confirmReservation_1 = require("../reserve/confirmReservation");
|
|
|
11
11
|
/**
|
|
12
12
|
* タスク実行関数
|
|
13
13
|
*/
|
|
14
|
-
function call(
|
|
14
|
+
function call(params) {
|
|
15
15
|
return async ({ connection }) => {
|
|
16
|
+
const { data } = params;
|
|
16
17
|
await (0, confirmReservation_1.confirmReservation)({
|
|
17
18
|
// actionAttributesList: data.actionAttributes,
|
|
18
19
|
potentialReserveAction: data, // optimize(2024-07-01~)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { IOperationExecute } from '../taskHandler';
|
|
1
|
+
import type { ICallResult, IExecutableTaskKeys, IOperationExecute } from '../taskHandler';
|
|
2
2
|
import { factory } from '../../factory';
|
|
3
3
|
/**
|
|
4
4
|
* タスク実行関数
|
|
5
5
|
*/
|
|
6
|
-
export declare function call(
|
|
6
|
+
export declare function call(params: Pick<factory.task.ITask<factory.taskName.ReturnOrder>, IExecutableTaskKeys>): IOperationExecute<ICallResult>;
|
|
@@ -12,8 +12,9 @@ const returnOrder_2 = require("../order/returnOrder");
|
|
|
12
12
|
/**
|
|
13
13
|
* タスク実行関数
|
|
14
14
|
*/
|
|
15
|
-
function call(
|
|
15
|
+
function call(params) {
|
|
16
16
|
return async ({ connection }) => {
|
|
17
|
+
const { data } = params;
|
|
17
18
|
await (0, returnOrder_2.returnOrder)({
|
|
18
19
|
...data,
|
|
19
20
|
useOnOrderStatusChanged: true
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { IOperationExecute } from '../taskHandler';
|
|
1
|
+
import type { ICallResult, IExecutableTaskKeys, IOperationExecute } from '../taskHandler';
|
|
2
2
|
import { factory } from '../../factory';
|
|
3
3
|
/**
|
|
4
4
|
* タスク実行関数
|
|
5
5
|
*/
|
|
6
|
-
export declare function call(
|
|
6
|
+
export declare function call(params: Pick<factory.task.ITask<factory.taskName.SendOrder>, IExecutableTaskKeys>): IOperationExecute<ICallResult>;
|
|
@@ -13,8 +13,9 @@ const sendOrder_1 = require("../order/sendOrder");
|
|
|
13
13
|
/**
|
|
14
14
|
* タスク実行関数
|
|
15
15
|
*/
|
|
16
|
-
function call(
|
|
16
|
+
function call(params) {
|
|
17
17
|
return async ({ connection }) => {
|
|
18
|
+
const { data } = params;
|
|
18
19
|
await (0, sendOrder_1.sendOrder)({
|
|
19
20
|
...data,
|
|
20
21
|
object: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { IOperationExecute } from '../taskHandler';
|
|
1
|
+
import type { ICallResult, IExecutableTaskKeys, IOperationExecute } from '../taskHandler';
|
|
2
2
|
import { factory } from '../../factory';
|
|
3
3
|
/**
|
|
4
4
|
* タスク実行関数
|
|
5
5
|
*/
|
|
6
|
-
export declare function call(
|
|
6
|
+
export declare function call(params: Pick<factory.task.voidPayment.ITask, IExecutableTaskKeys>): IOperationExecute<ICallResult>;
|
|
@@ -19,8 +19,9 @@ const voidPaymentByTask_1 = require("./payment/voidPaymentByTask");
|
|
|
19
19
|
/**
|
|
20
20
|
* タスク実行関数
|
|
21
21
|
*/
|
|
22
|
-
function call(
|
|
22
|
+
function call(params) {
|
|
23
23
|
return async ({ connection, redisClient }) => {
|
|
24
|
+
const { data } = params;
|
|
24
25
|
if (redisClient === undefined) {
|
|
25
26
|
throw new factory_1.factory.errors.Argument('settings', 'redisClient required');
|
|
26
27
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { INextFunction } from '../eventEmitter/task';
|
|
2
2
|
import { factory } from '../factory';
|
|
3
|
-
import type { ICallResult, ICallableTaskOperation,
|
|
3
|
+
import type { ICallResult, ICallableTaskOperation, IExecutableTask, IExecutableTaskKeys, IOperationExecute } from '../taskSettings';
|
|
4
4
|
export declare const taskLoader: {
|
|
5
5
|
load: (taskName: string) => Promise<{
|
|
6
|
-
call:
|
|
6
|
+
call: ICallableTaskOperation;
|
|
7
7
|
}>;
|
|
8
8
|
};
|
|
9
9
|
/**
|
|
@@ -41,44 +41,43 @@ function executeTask(task, next) {
|
|
|
41
41
|
throw new factory_1.factory.errors.Internal(`task remainingNumberOfTries < 0 [remainingNumberOfTries:${remainingNumberOfTries}]`);
|
|
42
42
|
}
|
|
43
43
|
// タスク名の関数が定義されていなければ、TypeErrorとなる
|
|
44
|
-
let callResult;
|
|
45
|
-
// const { call } = await import(`./task/${task.name}.js`) as {
|
|
46
|
-
// call: ICallableTaskOperationSimple | ICallableTaskOperation;
|
|
47
|
-
// };
|
|
48
44
|
const { call } = await exports.taskLoader.load(task.name); // testが書きづらいのでtaskLoader経由で呼ぶ
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
45
|
+
const callResult = await call(task)(settings, options);
|
|
46
|
+
// ICallableTaskOperationSimpleを廃止(2026-07-22~)
|
|
47
|
+
// let callResult: ICallResult | undefined;
|
|
48
|
+
// switch (task.name) {
|
|
49
|
+
// case factory.taskName.AcceptCOAOffer:
|
|
50
|
+
// case factory.taskName.AggregateOnSystem:
|
|
51
|
+
// case factory.taskName.AuthorizePayment:
|
|
52
|
+
// case factory.taskName.CancelPendingReservation:
|
|
53
|
+
// case factory.taskName.CheckMovieTicket:
|
|
54
|
+
// case factory.taskName.CheckResource:
|
|
55
|
+
// case factory.taskName.CreateAccountingReport:
|
|
56
|
+
// case factory.taskName.HandleNotification:
|
|
57
|
+
// case factory.taskName.ImportEventCapacitiesFromCOA:
|
|
58
|
+
// case factory.taskName.ImportEventsFromCOA:
|
|
59
|
+
// case factory.taskName.ImportOffersFromCOA:
|
|
60
|
+
// case factory.taskName.InvalidatePaymentUrl:
|
|
61
|
+
// case factory.taskName.OnAuthorizationCreated:
|
|
62
|
+
// case factory.taskName.OnResourceDeleted:
|
|
63
|
+
// case factory.taskName.Pay:
|
|
64
|
+
// case factory.taskName.PublishPaymentUrl:
|
|
65
|
+
// case factory.taskName.Refund:
|
|
66
|
+
// case factory.taskName.VoidPayTransaction:
|
|
67
|
+
// case factory.taskName.VoidReserveTransaction:
|
|
68
|
+
// case factory.taskName.ConfirmPayTransaction:
|
|
69
|
+
// case factory.taskName.ConfirmReserveTransaction:
|
|
70
|
+
// case factory.taskName.ReturnPayTransaction:
|
|
71
|
+
// case factory.taskName.ReturnReserveTransaction:
|
|
72
|
+
// case factory.taskName.SendEmailMessage:
|
|
73
|
+
// case factory.taskName.SyncResourcesFromCOA:
|
|
74
|
+
// case factory.taskName.TriggerWebhook:
|
|
75
|
+
// case factory.taskName.UseReservation:
|
|
76
|
+
// callResult = await (call as ICallableTaskOperation)(task)(settings, options);
|
|
77
|
+
// break;
|
|
78
|
+
// default:
|
|
79
|
+
// await (call as ICallableTaskOperationSimple)(task.data)(settings); // TODO discontinue
|
|
80
|
+
// }
|
|
82
81
|
const result = {
|
|
83
82
|
executedAt: now,
|
|
84
83
|
endDate: new Date(),
|
|
@@ -24,13 +24,11 @@ interface IExecuteOptions {
|
|
|
24
24
|
executeById: boolean;
|
|
25
25
|
executeByName: boolean;
|
|
26
26
|
}
|
|
27
|
-
type IOperation<T> = (settings: IExecuteSettings) => Promise<T>;
|
|
28
27
|
type IOperationExecute<T> = (settings: IExecuteSettings, options: IExecuteOptions) => Promise<T>;
|
|
29
28
|
type ICallResult = void | Pick<factory.task.IExecutionResult, 'error'>;
|
|
30
|
-
type ICallableTaskOperationSimple = (taskData: factory.task.IData<factory.taskName>) => IOperation<void>;
|
|
31
29
|
type ICallableTaskOperation = (task: IExecutableTask<factory.taskName>) => IOperationExecute<ICallResult>;
|
|
32
30
|
type IExecutableTaskKeys = 'data' | 'id' | 'name' | 'status' | 'numberOfTried' | 'project' | 'remainingNumberOfTries' | 'runsAt' | 'expires';
|
|
33
31
|
type IExecutableTask<T extends factory.taskName> = Pick<factory.task.ITask<T>, IExecutableTaskKeys> & {
|
|
34
32
|
status: factory.taskStatus.Running;
|
|
35
33
|
};
|
|
36
|
-
export { ICallableTaskOperation,
|
|
34
|
+
export { ICallableTaskOperation, ICallResult, IExecutableTask, IExecutableTaskKeys, IExecuteSettings, IExecuteOptions, IOperationExecute, AggregationSettings };
|
package/package.json
CHANGED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { PlaceOrderRepo } from '../../repo/transaction/placeOrder';
|
|
2
|
-
import { factory } from '../../factory';
|
|
3
|
-
type ITransaction = Pick<factory.transaction.placeOrder.ITransaction, 'id' | 'potentialActions' | 'project' | 'typeOf'>;
|
|
4
|
-
export declare function findConfirmedPlaceOrder(params: {
|
|
5
|
-
project: {
|
|
6
|
-
id: string;
|
|
7
|
-
};
|
|
8
|
-
confirmationNumber: string;
|
|
9
|
-
orderNumber: string;
|
|
10
|
-
}): (repos: {
|
|
11
|
-
placeOrder: PlaceOrderRepo;
|
|
12
|
-
}) => Promise<ITransaction>;
|
|
13
|
-
export {};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.findConfirmedPlaceOrder = findConfirmedPlaceOrder;
|
|
4
|
-
const factory_1 = require("../../factory");
|
|
5
|
-
function findConfirmedPlaceOrder(params) {
|
|
6
|
-
return async (repos) => {
|
|
7
|
-
const placeOrderTransactions = await repos.placeOrder.findPlaceOrderTransactions({
|
|
8
|
-
limit: 1,
|
|
9
|
-
page: 1,
|
|
10
|
-
project: { id: { $eq: params.project.id } },
|
|
11
|
-
typeOf: factory_1.factory.transactionType.PlaceOrder,
|
|
12
|
-
statuses: [factory_1.factory.transactionStatusType.Confirmed],
|
|
13
|
-
// resultではなくobjectで参照するように変更(2026-06-16~)
|
|
14
|
-
object: {
|
|
15
|
-
confirmationNumber: { $eq: params.confirmationNumber },
|
|
16
|
-
orderNumber: { $eq: params.orderNumber },
|
|
17
|
-
},
|
|
18
|
-
// result: {
|
|
19
|
-
// order: {
|
|
20
|
-
// confirmationNumber: { $eq: params.confirmationNumber },
|
|
21
|
-
// orderNumbers: [params.orderNumber]
|
|
22
|
-
// }
|
|
23
|
-
// },
|
|
24
|
-
inclusion: ['potentialActions', 'project', 'typeOf']
|
|
25
|
-
});
|
|
26
|
-
const placeOrderTransaction = placeOrderTransactions.shift();
|
|
27
|
-
if (placeOrderTransaction === undefined) {
|
|
28
|
-
throw new factory_1.factory.errors.NotFound(factory_1.factory.transactionType.PlaceOrder);
|
|
29
|
-
}
|
|
30
|
-
return placeOrderTransaction;
|
|
31
|
-
};
|
|
32
|
-
}
|