@chevre/domain 25.2.0-alpha.53 → 25.2.0-alpha.55
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/repo/adminTask.d.ts +37 -0
- package/lib/chevre/repo/adminTask.js +163 -0
- package/lib/chevre/repo/aggregateTask.d.ts +38 -0
- package/lib/chevre/repo/aggregateTask.js +136 -0
- package/lib/chevre/repo/asyncAction.d.ts +3 -3
- package/lib/chevre/repo/mongoose/schemas/asyncAction.d.ts +3 -1
- package/lib/chevre/repo/mongoose/schemas/task.d.ts +6 -1
- package/lib/chevre/repo/task.d.ts +27 -65
- package/lib/chevre/repo/task.js +49 -333
- package/lib/chevre/repository.d.ts +10 -0
- package/lib/chevre/repository.js +24 -2
- package/lib/chevre/service/aggregation/system.d.ts +2 -2
- package/lib/chevre/service/aggregation/system.js +1 -1
- package/lib/chevre/service/notification/notifyAbortedTasksByEmail.d.ts +2 -2
- package/lib/chevre/service/notification/notifyAbortedTasksByEmail.js +1 -1
- package/lib/chevre/service/offer/event/voidTransaction.d.ts +1 -1
- package/lib/chevre/service/offer/event/voidTransactionByActionId.d.ts +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/findAcceptAction.js +2 -4
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled/factory.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.d.ts +0 -3
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.js +72 -43
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +1 -1
- package/lib/chevre/service/payment/any/findAcceptAction.js +2 -4
- package/lib/chevre/service/payment/any/findAuthorizeAction.js +2 -4
- package/lib/chevre/service/payment/any/findCheckAction.js +2 -4
- package/lib/chevre/service/task/voidReserveTransaction.d.ts +1 -1
- package/lib/chevre/service/transaction/deleteTransaction.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.d.ts +1 -1
- package/lib/chevre/taskSettings.d.ts +2 -1
- package/package.json +2 -2
package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts
CHANGED
|
@@ -18,5 +18,5 @@ declare function createInformTasks(params: {
|
|
|
18
18
|
}, setting: Pick<ISetting, 'onOrderStatusChanged'> | null): factory.task.IAttributes<factory.taskName.TriggerWebhook>[];
|
|
19
19
|
declare function createNextSendOrderTasks(params: {
|
|
20
20
|
order: IInTransitOrder;
|
|
21
|
-
}): (import("@chevre/factory/lib/chevre/task").ITaskAttributes | import("@chevre/factory/lib/chevre/task/confirmPayTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/confirmReserveTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/createAccountingReport").IAttributes | import("@chevre/factory/lib/chevre/task/
|
|
21
|
+
}): (import("@chevre/factory/lib/chevre/task").ITaskAttributes | import("@chevre/factory/lib/chevre/task/confirmPayTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/confirmReserveTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/createAccountingReport").IAttributes | import("@chevre/factory/lib/chevre/task/onAssetTransactionStatusChanged").IAttributes | import("@chevre/factory/lib/chevre/task/onAuthorizationCreated").IAttributes | import("@chevre/factory/lib/chevre/task/onEventChanged").IAttributes | import("@chevre/factory/lib/chevre/task/onResourceDeleted").IAttributes | import("@chevre/factory/lib/chevre/task/onResourceUpdated").IAttributes | import("@chevre/factory/lib/chevre/task/onOrderPaymentCompleted").IAttributes | import("@chevre/factory/lib/chevre/task/placeOrder").IAttributes | import("@chevre/factory/lib/chevre/task/returnOrder").IAttributes | import("@chevre/factory/lib/chevre/task/returnPayTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/returnReserveTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/sendEmailMessage").IAttributes | import("@chevre/factory/lib/chevre/task/sendOrder").IAttributes | import("@chevre/factory/lib/chevre/task/triggerWebhook").IAttributes | import("@chevre/factory/lib/chevre/task/useReservation").IAttributes | import("@chevre/factory/lib/chevre/task/voidPayTransaction").IAttributes)[];
|
|
22
22
|
export { createInformTasks, createNextSendOrderTasks, IInTransitOrder };
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.onOrderPaymentDue = onOrderPaymentDue;
|
|
4
|
+
/**
|
|
5
|
+
* 注文決済時処理
|
|
6
|
+
*/
|
|
7
|
+
const util_1 = require("util");
|
|
4
8
|
const factory_1 = require("../../../factory");
|
|
5
9
|
function onOrderPaymentDue(params) {
|
|
6
10
|
return async (repos) => {
|
|
@@ -13,8 +17,9 @@ function onOrderPaymentDue(params) {
|
|
|
13
17
|
switch (params.order.orderStatus) {
|
|
14
18
|
// OrderPaymentDueを追加(2023-08-23~)
|
|
15
19
|
case factory_1.factory.orderStatus.OrderPaymentDue:
|
|
20
|
+
await createConfirmPayTransactionTasks(params.order, simpleOrder)(repos);
|
|
16
21
|
tasks = [
|
|
17
|
-
...await createConfirmPayTransactionTasks(params.order, simpleOrder)(repos),
|
|
22
|
+
// ...await createConfirmPayTransactionTasks(params.order, simpleOrder)(repos),
|
|
18
23
|
...createCreateAccountingReportTask(params.order) // 経理レポート作成タスク(2024-02-02~)
|
|
19
24
|
];
|
|
20
25
|
break;
|
|
@@ -27,55 +32,79 @@ function onOrderPaymentDue(params) {
|
|
|
27
32
|
function createConfirmPayTransactionTasks(order, simpleOrder) {
|
|
28
33
|
return async (repos) => {
|
|
29
34
|
const taskRunsAt = new Date();
|
|
30
|
-
const tasks = [];
|
|
35
|
+
// const tasks: factory.task.IAttributes<factory.taskName.ConfirmPayTransaction>[] = [];
|
|
31
36
|
await Promise.all(order.paymentMethods.map(async (invoice) => {
|
|
32
37
|
// PaymentAutomaticallyAppliedであれば、自動決済処理を実行(2023-08-24~)
|
|
33
38
|
if (invoice.paymentStatus !== factory_1.factory.paymentStatusType.PaymentAutomaticallyApplied) {
|
|
34
39
|
return;
|
|
35
40
|
}
|
|
36
|
-
//
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
+
// 識別子指定でタスク作成(2026-07-30~)
|
|
42
|
+
const data = {
|
|
43
|
+
project: order.project,
|
|
44
|
+
typeOf: factory_1.factory.actionType.ConfirmAction,
|
|
45
|
+
object: [{ typeOf: factory_1.factory.assetTransactionType.Pay, transactionNumber: invoice.paymentMethodId }],
|
|
46
|
+
agent: order.project,
|
|
47
|
+
purpose: {
|
|
48
|
+
...simpleOrder,
|
|
49
|
+
confirmationNumber: order.confirmationNumber
|
|
50
|
+
},
|
|
51
|
+
processOrder: order.orderStatus === factory_1.factory.orderStatus.OrderPaymentDue, // OrderPaymentDueの場合、processOrderを実行する
|
|
52
|
+
useOnOrderStatusChanged: true
|
|
53
|
+
};
|
|
54
|
+
const taskIdentifier = (0, util_1.format)('%s:%s:%s:%s:%s:%s', order.project.id, factory_1.factory.taskName.ConfirmPayTransaction, data.purpose.typeOf, data.purpose.orderNumber, factory_1.factory.assetTransactionType.Pay, invoice.paymentMethodId);
|
|
55
|
+
const confirmPayTransactionTask = {
|
|
56
|
+
alternateName: taskIdentifier,
|
|
57
|
+
identifier: taskIdentifier,
|
|
58
|
+
project: order.project,
|
|
41
59
|
name: factory_1.factory.taskName.ConfirmPayTransaction,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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
|
-
}
|
|
60
|
+
status: factory_1.factory.taskStatus.Ready,
|
|
61
|
+
runsAt: taskRunsAt,
|
|
62
|
+
remainingNumberOfTries: 10,
|
|
63
|
+
numberOfTried: 0,
|
|
64
|
+
executionResults: [],
|
|
65
|
+
data
|
|
66
|
+
};
|
|
67
|
+
await repos.task.createIfNotExistByAlternateName(confirmPayTransactionTask, { emitImmediately: true });
|
|
68
|
+
// 冗長なタスク作成を回避
|
|
69
|
+
// const existingTasks = await repos.task.projectFields(
|
|
70
|
+
// {
|
|
71
|
+
// limit: 1,
|
|
72
|
+
// page: 1,
|
|
73
|
+
// project: { id: { $eq: order.project.id } },
|
|
74
|
+
// name: factory.taskName.ConfirmPayTransaction,
|
|
75
|
+
// data: {
|
|
76
|
+
// object: { transactionNumber: { $eq: invoice.paymentMethodId } },
|
|
77
|
+
// purpose: { orderNumber: { $eq: order.orderNumber } }
|
|
78
|
+
// }
|
|
79
|
+
// },
|
|
80
|
+
// ['id']
|
|
81
|
+
// ) as { id: string }[];
|
|
82
|
+
// if (existingTasks.length === 0) {
|
|
83
|
+
// const data: factory.task.IData<factory.taskName.ConfirmPayTransaction> = {
|
|
84
|
+
// project: order.project,
|
|
85
|
+
// typeOf: factory.actionType.ConfirmAction,
|
|
86
|
+
// object: [{ typeOf: factory.assetTransactionType.Pay, transactionNumber: invoice.paymentMethodId }],
|
|
87
|
+
// agent: order.project,
|
|
88
|
+
// purpose: {
|
|
89
|
+
// ...simpleOrder,
|
|
90
|
+
// confirmationNumber: order.confirmationNumber
|
|
91
|
+
// },
|
|
92
|
+
// processOrder: order.orderStatus === factory.orderStatus.OrderPaymentDue, // OrderPaymentDueの場合、processOrderを実行する
|
|
93
|
+
// useOnOrderStatusChanged: true
|
|
94
|
+
// };
|
|
95
|
+
// tasks.push({
|
|
96
|
+
// project: order.project,
|
|
97
|
+
// name: factory.taskName.ConfirmPayTransaction,
|
|
98
|
+
// status: factory.taskStatus.Ready,
|
|
99
|
+
// runsAt: taskRunsAt,
|
|
100
|
+
// remainingNumberOfTries: 10,
|
|
101
|
+
// numberOfTried: 0,
|
|
102
|
+
// executionResults: [],
|
|
103
|
+
// data
|
|
104
|
+
// });
|
|
105
|
+
// }
|
|
77
106
|
}));
|
|
78
|
-
return tasks;
|
|
107
|
+
// return tasks;
|
|
79
108
|
};
|
|
80
109
|
}
|
|
81
110
|
function createCreateAccountingReportTask(order) {
|
|
@@ -11,5 +11,5 @@ declare function createInformTasks(order: IReturnedOrder, returnOrderAction: IRe
|
|
|
11
11
|
declare function createOnOrderReturnedTasksByTransaction(params: {
|
|
12
12
|
order: Pick<factory.order.IOrder, 'project' | 'typeOf' | 'orderNumber' | 'customer' | 'price' | 'priceCurrency' | 'orderDate'>;
|
|
13
13
|
potentialActions?: factory.action.transfer.returnAction.order.IPotentialActions;
|
|
14
|
-
}): (import("@chevre/factory/lib/chevre/task").ITaskAttributes | import("@chevre/factory/lib/chevre/task/confirmPayTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/confirmReserveTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/createAccountingReport").IAttributes | import("@chevre/factory/lib/chevre/task/
|
|
14
|
+
}): (import("@chevre/factory/lib/chevre/task").ITaskAttributes | import("@chevre/factory/lib/chevre/task/confirmPayTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/confirmReserveTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/createAccountingReport").IAttributes | import("@chevre/factory/lib/chevre/task/onAssetTransactionStatusChanged").IAttributes | import("@chevre/factory/lib/chevre/task/onAuthorizationCreated").IAttributes | import("@chevre/factory/lib/chevre/task/onEventChanged").IAttributes | import("@chevre/factory/lib/chevre/task/onResourceDeleted").IAttributes | import("@chevre/factory/lib/chevre/task/onResourceUpdated").IAttributes | import("@chevre/factory/lib/chevre/task/onOrderPaymentCompleted").IAttributes | import("@chevre/factory/lib/chevre/task/placeOrder").IAttributes | import("@chevre/factory/lib/chevre/task/returnOrder").IAttributes | import("@chevre/factory/lib/chevre/task/returnPayTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/returnReserveTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/sendEmailMessage").IAttributes | import("@chevre/factory/lib/chevre/task/sendOrder").IAttributes | import("@chevre/factory/lib/chevre/task/triggerWebhook").IAttributes | import("@chevre/factory/lib/chevre/task/useReservation").IAttributes | import("@chevre/factory/lib/chevre/task/voidPayTransaction").IAttributes)[];
|
|
15
15
|
export { createInformTasks, createOnOrderReturnedTasksByTransaction, IReturnAction };
|
|
@@ -17,13 +17,11 @@ function findAcceptAction(params, options) {
|
|
|
17
17
|
}
|
|
18
18
|
// 非同期アクションが存在しなければタスクを参照
|
|
19
19
|
if (task === undefined) {
|
|
20
|
-
task =
|
|
21
|
-
limit: 1,
|
|
22
|
-
page: 1,
|
|
20
|
+
task = await repos.task.findTaskById({
|
|
23
21
|
id: { $eq: params.sameAs.id },
|
|
24
22
|
project: { id: { $eq: params.project.id } },
|
|
25
23
|
name: factory_1.factory.taskName.PublishPaymentUrl
|
|
26
|
-
}, ['status', 'executionResults'])
|
|
24
|
+
}, ['status', 'executionResults']);
|
|
27
25
|
}
|
|
28
26
|
if (task === undefined) {
|
|
29
27
|
throw new factory_1.factory.errors.NotFound(factory_1.factory.taskName.PublishPaymentUrl);
|
|
@@ -17,13 +17,11 @@ function findAuthorizeAction(params, options) {
|
|
|
17
17
|
}
|
|
18
18
|
// 非同期アクションが存在しなければタスクを参照
|
|
19
19
|
if (task === undefined) {
|
|
20
|
-
task =
|
|
21
|
-
limit: 1,
|
|
22
|
-
page: 1,
|
|
20
|
+
task = await repos.task.findTaskById({
|
|
23
21
|
id: { $eq: params.sameAs.id },
|
|
24
22
|
project: { id: { $eq: params.project.id } },
|
|
25
23
|
name: factory_1.factory.taskName.AuthorizePayment
|
|
26
|
-
}, ['status', 'executionResults'])
|
|
24
|
+
}, ['status', 'executionResults']);
|
|
27
25
|
}
|
|
28
26
|
if (task === undefined) {
|
|
29
27
|
throw new factory_1.factory.errors.NotFound(factory_1.factory.taskName.AuthorizePayment);
|
|
@@ -17,13 +17,11 @@ function findCheckAction(params, options) {
|
|
|
17
17
|
}
|
|
18
18
|
// 非同期アクションが存在しなければタスクを参照
|
|
19
19
|
if (task === undefined) {
|
|
20
|
-
task =
|
|
21
|
-
limit: 1,
|
|
22
|
-
page: 1,
|
|
20
|
+
task = await repos.task.findTaskById({
|
|
23
21
|
id: { $eq: params.sameAs.id },
|
|
24
22
|
project: { id: { $eq: params.project.id } },
|
|
25
23
|
name: factory_1.factory.taskName.CheckMovieTicket
|
|
26
|
-
}, ['status', 'executionResults'])
|
|
24
|
+
}, ['status', 'executionResults']);
|
|
27
25
|
}
|
|
28
26
|
if (task === undefined) {
|
|
29
27
|
throw new factory_1.factory.errors.NotFound(factory_1.factory.taskName.CheckMovieTicket);
|
|
@@ -3,4 +3,4 @@ import type { ICallResult, IExecutableTaskKeys, IOperationExecute } from '../tas
|
|
|
3
3
|
/**
|
|
4
4
|
* タスク実行関数
|
|
5
5
|
*/
|
|
6
|
-
export declare function call(params: Pick<factory.task.ITask
|
|
6
|
+
export declare function call(params: Pick<factory.task.voidReserveTransaction.ITask, IExecutableTaskKeys>): IOperationExecute<ICallResult>;
|
|
@@ -25,5 +25,5 @@ interface IDeleteTransactionRepos {
|
|
|
25
25
|
* 取引に関わるリソースを削除する
|
|
26
26
|
* 冪等性を確保すること
|
|
27
27
|
*/
|
|
28
|
-
export declare function deleteTransaction(params: factory.task.IData
|
|
28
|
+
export declare function deleteTransaction(params: factory.task.deleteTransaction.IData): (repos: IDeleteTransactionRepos) => Promise<void>;
|
|
29
29
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { factory } from '../../../../factory';
|
|
2
2
|
import type { ISetting } from '../../../../repo/setting';
|
|
3
|
-
type IPlaceOrderPotentialTask = factory.task.IAttributes<factory.taskName.PlaceOrder> | factory.task.IAttributes
|
|
3
|
+
type IPlaceOrderPotentialTask = factory.task.IAttributes<factory.taskName.PlaceOrder> | factory.task.deleteTransaction.IAttributes | factory.task.IAttributes<factory.taskName.VoidPayTransaction> | factory.task.voidReserveTransaction.IAttributes;
|
|
4
4
|
/**
|
|
5
5
|
* 取引のタスクを作成する
|
|
6
6
|
*/
|
|
@@ -27,8 +27,9 @@ interface IExecuteOptions {
|
|
|
27
27
|
type IOperationExecute<T> = (settings: IExecuteSettings, options: IExecuteOptions) => Promise<T>;
|
|
28
28
|
type ICallResult = void | Pick<factory.task.IExecutionResult, 'error'>;
|
|
29
29
|
type ICallableTaskOperation = (task: IExecutableTask<factory.taskName>) => IOperationExecute<ICallResult>;
|
|
30
|
-
type IExecutableTaskKeys = 'data' | 'id' | 'name' | 'status' | 'numberOfTried' | 'project' | 'remainingNumberOfTries' | 'runsAt'
|
|
30
|
+
type IExecutableTaskKeys = 'data' | 'id' | 'name' | 'status' | 'numberOfTried' | 'project' | 'remainingNumberOfTries' | 'runsAt';
|
|
31
31
|
type IExecutableTask<T extends factory.taskName> = Pick<factory.task.ITask<T>, IExecutableTaskKeys> & {
|
|
32
|
+
expires?: Date;
|
|
32
33
|
status: factory.taskStatus.Running;
|
|
33
34
|
};
|
|
34
35
|
export { ICallableTaskOperation, ICallResult, IExecutableTask, IExecutableTaskKeys, IExecuteSettings, IExecuteOptions, IOperationExecute, AggregationSettings };
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/client-cognito-identity-provider": "3.1090.0",
|
|
13
13
|
"@aws-sdk/credential-providers": "3.1090.0",
|
|
14
|
-
"@chevre/factory": "10.1.0-alpha.
|
|
14
|
+
"@chevre/factory": "10.1.0-alpha.2",
|
|
15
15
|
"@motionpicture/coa-service": "10.0.0",
|
|
16
16
|
"@motionpicture/gmo-service": "6.1.0-alpha.0",
|
|
17
17
|
"@sendgrid/client": "8.1.4",
|
|
@@ -88,5 +88,5 @@
|
|
|
88
88
|
"postversion": "git push origin --tags",
|
|
89
89
|
"prepublishOnly": "npm run clean && npm run build"
|
|
90
90
|
},
|
|
91
|
-
"version": "25.2.0-alpha.
|
|
91
|
+
"version": "25.2.0-alpha.55"
|
|
92
92
|
}
|