@chevre/domain 21.35.0-alpha.28 → 21.35.0-alpha.29
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/notification.d.ts +5 -1
- package/lib/chevre/service/notification.js +6 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/createSendEmailMessageTaskIfNotExist.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +1 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.js +18 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +1 -1
- package/lib/chevre/service/task/sendEmailMessage.d.ts +2 -2
- package/lib/chevre/service/task/sendEmailMessage.js +3 -2
- package/lib/chevre/service/task.js +1 -0
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +1 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.d.ts +3 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.js +14 -27
- package/package.json +2 -2
|
@@ -9,7 +9,11 @@ type ILineNotifyOperation<T> = (repos: {
|
|
|
9
9
|
* Eメールメッセージを送信する
|
|
10
10
|
* https://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/errors.html
|
|
11
11
|
*/
|
|
12
|
-
declare function sendEmailMessage(params: factory.
|
|
12
|
+
declare function sendEmailMessage(params: factory.task.sendEmailMessage.IActionAttributes & {
|
|
13
|
+
sameAs?: {
|
|
14
|
+
id: string;
|
|
15
|
+
};
|
|
16
|
+
}): (repos: {
|
|
13
17
|
action: ActionRepo;
|
|
14
18
|
message: MessageRepo;
|
|
15
19
|
project: ProjectRepo;
|
|
@@ -17,6 +17,11 @@ const util = require("util");
|
|
|
17
17
|
const credentials_1 = require("../credentials");
|
|
18
18
|
const settings_1 = require("../settings");
|
|
19
19
|
const factory = require("../factory");
|
|
20
|
+
function createSendEmailMessageActionAttributes(params) {
|
|
21
|
+
var _a;
|
|
22
|
+
const { agent, object, project, purpose, recipient, typeOf } = params;
|
|
23
|
+
return Object.assign({ agent, object, project, purpose, recipient, typeOf }, (typeof ((_a = params.sameAs) === null || _a === void 0 ? void 0 : _a.id) === 'string') ? { sameAs: { id: params.sameAs.id, typeOf: 'Task' } } : undefined);
|
|
24
|
+
}
|
|
20
25
|
/**
|
|
21
26
|
* Eメールメッセージを送信する
|
|
22
27
|
* https://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/errors.html
|
|
@@ -30,8 +35,7 @@ function sendEmailMessage(params) {
|
|
|
30
35
|
inclusion: ['_id', 'settings'],
|
|
31
36
|
exclusion: []
|
|
32
37
|
});
|
|
33
|
-
|
|
34
|
-
const action = yield repos.action.start(params);
|
|
38
|
+
const action = yield repos.action.start(createSendEmailMessageActionAttributes(params));
|
|
35
39
|
let result = {};
|
|
36
40
|
try {
|
|
37
41
|
let apiKey = credentials_1.credentials.sendGrid.apiKey;
|
|
@@ -33,7 +33,7 @@ function createSendEmailMessageTaskIfNotExist(params) {
|
|
|
33
33
|
object: sendEmailMessageAction.object,
|
|
34
34
|
agent: params.order.project,
|
|
35
35
|
recipient: { typeOf: params.order.customer.typeOf, id: params.order.customer.id },
|
|
36
|
-
potentialActions: {},
|
|
36
|
+
// potentialActions: {}, // discontinue(2024-06-25~)
|
|
37
37
|
purpose: simpleOrder
|
|
38
38
|
};
|
|
39
39
|
const sendEmailMessageTask = {
|
|
@@ -5,6 +5,7 @@ declare function createInformTasks(order: IReturnedOrder): factory.task.IAttribu
|
|
|
5
5
|
* 注文返品後のアクション
|
|
6
6
|
*/
|
|
7
7
|
declare function createOnOrderReturnedTasksByTransaction(params: {
|
|
8
|
+
order: Pick<factory.order.IOrder, 'project' | 'typeOf' | 'orderNumber' | 'customer' | 'price' | 'priceCurrency' | 'orderDate'>;
|
|
8
9
|
potentialActions?: factory.action.transfer.returnAction.order.IPotentialActions;
|
|
9
10
|
}): (import("@chevre/factory/lib/task/confirmReserveTransaction").IAttributes | import("@chevre/factory/lib/task").IAttributes | import("@chevre/factory/lib/task/confirmMoneyTransfer").IAttributes | import("@chevre/factory/lib/task/confirmRegisterService").IAttributes | import("@chevre/factory/lib/task/confirmPayTransaction").IAttributes | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/createAccountingReport").IAttributes | import("@chevre/factory/lib/task/createEvent").IAttributes | import("@chevre/factory/lib/task/deleteTransaction").IAttributes | import("@chevre/factory/lib/task/givePointAward").IAttributes | import("@chevre/factory/lib/task/onAssetTransactionStatusChanged").IAttributes | import("@chevre/factory/lib/task/onAuthorizationCreated").IAttributes | import("@chevre/factory/lib/task/onEventChanged").IAttributes | import("@chevre/factory/lib/task/onResourceUpdated").IAttributes | import("@chevre/factory/lib/task/onOrderPaymentCompleted").IAttributes | import("@chevre/factory/lib/task/placeOrder").IAttributes | import("@chevre/factory/lib/task/returnOrder").IAttributes | import("@chevre/factory/lib/task/returnMoneyTransfer").IAttributes | import("@chevre/factory/lib/task/returnPayTransaction").IAttributes | import("@chevre/factory/lib/task/returnPointAward").IAttributes | import("@chevre/factory/lib/task/returnReserveTransaction").IAttributes | import("@chevre/factory/lib/task/sendEmailMessage").IAttributes | import("@chevre/factory/lib/task/sendOrder").IAttributes | import("@chevre/factory/lib/task/triggerWebhook").IAttributes | import("@chevre/factory/lib/task/useReservation").IAttributes | import("@chevre/factory/lib/task/voidMoneyTransferTransaction").IAttributes | import("@chevre/factory/lib/task/voidPayTransaction").IAttributes | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/voidReserveTransaction").IAttributes)[];
|
|
10
11
|
export { createInformTasks, createOnOrderReturnedTasksByTransaction };
|
|
@@ -92,9 +92,25 @@ function createOnOrderReturnedTasksByTransaction(params) {
|
|
|
92
92
|
}
|
|
93
93
|
const sendEmailMessageAttributes = potentialActions === null || potentialActions === void 0 ? void 0 : potentialActions.sendEmailMessage;
|
|
94
94
|
if (Array.isArray(sendEmailMessageAttributes)) {
|
|
95
|
+
const simpleOrder = {
|
|
96
|
+
typeOf: params.order.typeOf,
|
|
97
|
+
orderNumber: params.order.orderNumber,
|
|
98
|
+
price: params.order.price,
|
|
99
|
+
priceCurrency: params.order.priceCurrency,
|
|
100
|
+
orderDate: params.order.orderDate
|
|
101
|
+
};
|
|
95
102
|
sendEmailMessageAttributes.forEach((s) => {
|
|
103
|
+
const actionAttributes = {
|
|
104
|
+
project: params.order.project,
|
|
105
|
+
typeOf: factory.actionType.SendAction,
|
|
106
|
+
object: s.object,
|
|
107
|
+
agent: params.order.project,
|
|
108
|
+
recipient: { typeOf: params.order.customer.typeOf, id: params.order.customer.id },
|
|
109
|
+
// potentialActions: {}, // discontinue(2024-06-25~)
|
|
110
|
+
purpose: simpleOrder
|
|
111
|
+
};
|
|
96
112
|
const sendEmailMessageTask = {
|
|
97
|
-
project:
|
|
113
|
+
project: params.order.project,
|
|
98
114
|
name: factory.taskName.SendEmailMessage,
|
|
99
115
|
status: factory.taskStatus.Ready,
|
|
100
116
|
runsAt: now,
|
|
@@ -102,7 +118,7 @@ function createOnOrderReturnedTasksByTransaction(params) {
|
|
|
102
118
|
numberOfTried: 0,
|
|
103
119
|
executionResults: [],
|
|
104
120
|
data: {
|
|
105
|
-
actionAttributes
|
|
121
|
+
actionAttributes
|
|
106
122
|
}
|
|
107
123
|
};
|
|
108
124
|
taskAttributes.push(sendEmailMessageTask);
|
|
@@ -56,7 +56,7 @@ function onOrderReturned(params) {
|
|
|
56
56
|
// 決済取引返却タスクを作成(2022-06-09~)
|
|
57
57
|
...createReturnPayTransactionTasks({ orderNumber: params.order.orderNumber, project: params.order.project }, params.returnOrderTransaction),
|
|
58
58
|
// 取引のpotentialActionsを適用(2023-08-19~)
|
|
59
|
-
...(0, factory_1.createOnOrderReturnedTasksByTransaction)({ potentialActions: potentialActionsByTransaction }),
|
|
59
|
+
...(0, factory_1.createOnOrderReturnedTasksByTransaction)({ order: params.order, potentialActions: potentialActionsByTransaction }),
|
|
60
60
|
...(itemOfferedTypeOfs[0] === factory.actionType.MoneyTransfer)
|
|
61
61
|
? createReturnMoneyTransferTasks(Object.assign(Object.assign({}, params.order), { serialNumbers }), simpleOrder)
|
|
62
62
|
: []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { IOperationExecute } from '../task';
|
|
1
|
+
import type { ICallResult, IExecutableTaskKeys, IOperationExecute } from '../task';
|
|
2
2
|
import * as factory from '../../factory';
|
|
3
3
|
/**
|
|
4
4
|
* タスク実行関数
|
|
5
5
|
*/
|
|
6
|
-
export declare function call(
|
|
6
|
+
export declare function call(params: Pick<factory.task.sendEmailMessage.ITask, IExecutableTaskKeys>): IOperationExecute<ICallResult>;
|
|
@@ -17,9 +17,10 @@ const NotificationService = require("../notification");
|
|
|
17
17
|
/**
|
|
18
18
|
* タスク実行関数
|
|
19
19
|
*/
|
|
20
|
-
function call(
|
|
20
|
+
function call(params) {
|
|
21
21
|
return (settings) => __awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
yield NotificationService.sendEmailMessage(data.actionAttributes)(
|
|
22
|
+
yield NotificationService.sendEmailMessage(Object.assign(Object.assign({}, params.data.actionAttributes), { sameAs: { id: params.id } // タスクIDを関連付け(2024-06-25~)
|
|
23
|
+
}))({
|
|
23
24
|
action: new action_1.MongoRepository(settings.connection),
|
|
24
25
|
message: new message_1.MessageRepo(settings.connection),
|
|
25
26
|
project: new project_1.MongoRepository(settings.connection)
|
|
@@ -115,6 +115,7 @@ function execute(task) {
|
|
|
115
115
|
case factory.taskName.ConfirmReserveTransaction:
|
|
116
116
|
case factory.taskName.ReturnPayTransaction:
|
|
117
117
|
case factory.taskName.ReturnReserveTransaction:
|
|
118
|
+
case factory.taskName.SendEmailMessage:
|
|
118
119
|
callResult = yield call(task)(settings, options);
|
|
119
120
|
break;
|
|
120
121
|
default:
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as factory from '../../../../factory';
|
|
2
|
+
type IPotentialSendEmailMessageAction = factory.action.transfer.returnAction.order.IPotentialSendEmailMessageAction;
|
|
2
3
|
export declare function createSendEmailMessaegActionsOnReturn(params: {
|
|
3
4
|
order: factory.order.IOrder;
|
|
4
5
|
returnOrderActionParams?: factory.transaction.returnOrder.IReturnOrderActionParams;
|
|
5
6
|
emailMessageOnOrderReturned?: factory.creativeWork.message.email.ICreativeWork;
|
|
6
|
-
}): Promise<
|
|
7
|
+
}): Promise<IPotentialSendEmailMessageAction[]>;
|
|
8
|
+
export {};
|
|
@@ -11,26 +11,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.createSendEmailMessaegActionsOnReturn = void 0;
|
|
13
13
|
const emailMessageBuilder = require("../../../../emailMessageBuilder");
|
|
14
|
-
const factory = require("../../../../factory");
|
|
15
|
-
// import { createMaskedCustomer } from '../../../../factory/order';
|
|
16
14
|
function createSendEmailMessaegActionsOnReturn(params) {
|
|
17
15
|
var _a, _b;
|
|
18
16
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19
17
|
const order = params.order;
|
|
20
|
-
const sendActionPurpose = {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
// mask
|
|
28
|
-
// customer: createMaskedCustomer(order, { noProfile: true }), // 廃止(2024-03-06~)
|
|
29
|
-
orderNumber: order.orderNumber,
|
|
30
|
-
price: order.price,
|
|
31
|
-
priceCurrency: order.priceCurrency,
|
|
32
|
-
orderDate: order.orderDate
|
|
33
|
-
};
|
|
18
|
+
// const sendActionPurpose: factory.action.transfer.send.message.email.IPurpose = {
|
|
19
|
+
// typeOf: order.typeOf,
|
|
20
|
+
// orderNumber: order.orderNumber,
|
|
21
|
+
// price: order.price,
|
|
22
|
+
// priceCurrency: order.priceCurrency,
|
|
23
|
+
// orderDate: order.orderDate
|
|
24
|
+
// };
|
|
34
25
|
// 返品後のEメール送信アクション
|
|
35
26
|
const sendEmailMessaegActionsOnReturn = [];
|
|
36
27
|
const sendEmailMessage = (_b = (_a = params.returnOrderActionParams) === null || _a === void 0 ? void 0 : _a.potentialActions) === null || _b === void 0 ? void 0 : _b.sendEmailMessage;
|
|
@@ -40,17 +31,13 @@ function createSendEmailMessaegActionsOnReturn(params) {
|
|
|
40
31
|
? { emailMessage: params.emailMessageOnOrderReturned }
|
|
41
32
|
: undefined));
|
|
42
33
|
return {
|
|
43
|
-
project: order.project,
|
|
44
|
-
typeOf: factory.actionType.SendAction,
|
|
45
|
-
object: emailMessage
|
|
46
|
-
agent: order.project,
|
|
47
|
-
recipient: {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
// name: String(order.customer.name)
|
|
51
|
-
},
|
|
52
|
-
potentialActions: {},
|
|
53
|
-
purpose: sendActionPurpose
|
|
34
|
+
// project: order.project, // optimize(2024-06-25~)
|
|
35
|
+
// typeOf: factory.actionType.SendAction, // optimize(2024-06-25~)
|
|
36
|
+
object: emailMessage
|
|
37
|
+
// agent: order.project, // optimize(2024-06-25~)
|
|
38
|
+
// recipient: { typeOf: order.customer.typeOf, id: order.customer.id }, // optimize(2024-06-25~)
|
|
39
|
+
// potentialActions: {} // optimize(2024-06-25~)
|
|
40
|
+
// purpose: sendActionPurpose // optimize(2024-06-25~)
|
|
54
41
|
};
|
|
55
42
|
}))));
|
|
56
43
|
}
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/credential-providers": "3.433.0",
|
|
13
|
-
"@chevre/factory": "4.375.0-alpha.
|
|
13
|
+
"@chevre/factory": "4.375.0-alpha.21",
|
|
14
14
|
"@cinerino/sdk": "7.3.0-alpha.2",
|
|
15
15
|
"@motionpicture/coa-service": "9.4.0",
|
|
16
16
|
"@motionpicture/gmo-service": "5.3.0",
|
|
@@ -110,5 +110,5 @@
|
|
|
110
110
|
"postversion": "git push origin --tags",
|
|
111
111
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
112
112
|
},
|
|
113
|
-
"version": "21.35.0-alpha.
|
|
113
|
+
"version": "21.35.0-alpha.29"
|
|
114
114
|
}
|