@chevre/domain 25.0.0-alpha.2 → 25.0.0-alpha.4
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/emailMessage.d.ts +18 -9
- package/lib/chevre/repo/emailMessage.js +26 -36
- package/lib/chevre/repo/mongoose/schemas/emailMessages.d.ts +9 -1
- package/lib/chevre/repo/mongoose/schemas/emailMessages.js +5 -20
- package/lib/chevre/repo/transaction.d.ts +5 -1
- package/lib/chevre/repo/transaction.js +4 -0
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.d.ts +0 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.js +2 -21
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.d.ts +0 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.js +1 -6
- package/lib/chevre/service/transaction/placeOrder/confirm.d.ts +0 -2
- package/lib/chevre/service/transaction/placeOrder/confirm.js +13 -12
- package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.d.ts +0 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.js +3 -18
- package/lib/chevre/service/transaction/returnOrder/potentialActions.d.ts +0 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions.js +0 -4
- package/lib/chevre/service/transaction/returnOrder.d.ts +0 -2
- package/lib/chevre/service/transaction/returnOrder.js +13 -12
- package/package.json +1 -1
|
@@ -1,21 +1,33 @@
|
|
|
1
|
-
import type { Connection } from 'mongoose';
|
|
1
|
+
import type { Connection, FilterQuery } from 'mongoose';
|
|
2
|
+
import { IDocType } from './mongoose/schemas/emailMessages';
|
|
2
3
|
import { factory } from '../factory';
|
|
3
|
-
export type IEmailMessage =
|
|
4
|
+
export type IEmailMessage = IDocType & {
|
|
5
|
+
id: string;
|
|
6
|
+
};
|
|
4
7
|
export interface ISearchConditions {
|
|
5
8
|
limit?: number;
|
|
6
9
|
page?: number;
|
|
7
|
-
sort?:
|
|
10
|
+
sort?: {
|
|
11
|
+
identifier?: factory.sortType;
|
|
12
|
+
};
|
|
8
13
|
project?: {
|
|
9
14
|
id?: {
|
|
10
15
|
$eq?: string;
|
|
11
16
|
};
|
|
12
17
|
};
|
|
18
|
+
id?: {
|
|
19
|
+
$eq?: string;
|
|
20
|
+
};
|
|
13
21
|
identifier?: {
|
|
14
22
|
$eq?: string;
|
|
15
23
|
};
|
|
16
24
|
about?: {
|
|
17
25
|
identifier?: {
|
|
18
|
-
|
|
26
|
+
/**
|
|
27
|
+
* 現時点でOnEventStatusChangedしかサポートしていない
|
|
28
|
+
* 2026-06-18
|
|
29
|
+
*/
|
|
30
|
+
$eq?: factory.creativeWork.message.email.AboutIdentifier.OnEventStatusChanged;
|
|
19
31
|
};
|
|
20
32
|
};
|
|
21
33
|
}
|
|
@@ -25,12 +37,9 @@ export interface ISearchConditions {
|
|
|
25
37
|
export declare class EmailMessageRepo {
|
|
26
38
|
private readonly emailMessageModel;
|
|
27
39
|
constructor(connection: Connection);
|
|
28
|
-
static CREATE_MONGO_CONDITIONS(params: ISearchConditions):
|
|
40
|
+
static CREATE_MONGO_CONDITIONS(params: ISearchConditions): FilterQuery<IDocType>[];
|
|
29
41
|
save(params: IEmailMessage): Promise<any>;
|
|
30
|
-
|
|
31
|
-
id: string;
|
|
32
|
-
}): Promise<IEmailMessage>;
|
|
33
|
-
search(params: ISearchConditions): Promise<IEmailMessage[]>;
|
|
42
|
+
findEmailMessages(params: ISearchConditions): Promise<IEmailMessage[]>;
|
|
34
43
|
deleteById(params: {
|
|
35
44
|
id: string;
|
|
36
45
|
}): Promise<void>;
|
|
@@ -4,6 +4,17 @@ exports.EmailMessageRepo = void 0;
|
|
|
4
4
|
const emailMessages_1 = require("./mongoose/schemas/emailMessages");
|
|
5
5
|
const factory_1 = require("../factory");
|
|
6
6
|
const settings_1 = require("../settings");
|
|
7
|
+
const DEFAULT_PROJECTION = {
|
|
8
|
+
_id: 0,
|
|
9
|
+
id: { $toString: '$_id' },
|
|
10
|
+
project: 1,
|
|
11
|
+
typeOf: 1,
|
|
12
|
+
identifier: 1,
|
|
13
|
+
name: 1,
|
|
14
|
+
about: 1,
|
|
15
|
+
sender: 1,
|
|
16
|
+
text: 1,
|
|
17
|
+
};
|
|
7
18
|
/**
|
|
8
19
|
* Eメールメッセージリポジトリ
|
|
9
20
|
*/
|
|
@@ -13,28 +24,24 @@ class EmailMessageRepo {
|
|
|
13
24
|
this.emailMessageModel = connection.model(emailMessages_1.modelName, (0, emailMessages_1.createSchema)());
|
|
14
25
|
}
|
|
15
26
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
16
|
-
|
|
17
|
-
|
|
27
|
+
const andConditions = [
|
|
28
|
+
// { typeOf: factory.creativeWorkType.EmailMessage }
|
|
29
|
+
];
|
|
18
30
|
const projectIdEq = params.project?.id?.$eq;
|
|
19
31
|
if (typeof projectIdEq === 'string') {
|
|
20
|
-
andConditions.push({
|
|
21
|
-
|
|
22
|
-
|
|
32
|
+
andConditions.push({ 'project.id': { $eq: projectIdEq } });
|
|
33
|
+
}
|
|
34
|
+
const idEq = params.id?.$eq;
|
|
35
|
+
if (typeof idEq === 'string') {
|
|
36
|
+
andConditions.push({ _id: { $eq: idEq } });
|
|
23
37
|
}
|
|
24
38
|
const identifierEq = params.identifier?.$eq;
|
|
25
39
|
if (typeof identifierEq === 'string') {
|
|
26
|
-
andConditions.push({
|
|
27
|
-
identifier: { $eq: identifierEq }
|
|
28
|
-
});
|
|
40
|
+
andConditions.push({ identifier: { $eq: identifierEq } });
|
|
29
41
|
}
|
|
30
42
|
const aboutIdentifierEq = params.about?.identifier?.$eq;
|
|
31
43
|
if (typeof aboutIdentifierEq === 'string') {
|
|
32
|
-
andConditions.push({
|
|
33
|
-
'about.identifier': {
|
|
34
|
-
$exists: true,
|
|
35
|
-
$eq: aboutIdentifierEq
|
|
36
|
-
}
|
|
37
|
-
});
|
|
44
|
+
andConditions.push({ 'about.identifier': { $exists: true, $eq: aboutIdentifierEq } });
|
|
38
45
|
}
|
|
39
46
|
return andConditions;
|
|
40
47
|
}
|
|
@@ -45,7 +52,7 @@ class EmailMessageRepo {
|
|
|
45
52
|
}
|
|
46
53
|
else {
|
|
47
54
|
// 上書き禁止属性を除外(2022-08-24~)
|
|
48
|
-
const { id, identifier, project, typeOf, ...updateFields } = params;
|
|
55
|
+
const { id: _id, identifier: _identifier, project: _project, typeOf: _typeOf, ...updateFields } = params;
|
|
49
56
|
doc = await this.emailMessageModel.findOneAndUpdate({ _id: params.id }, updateFields, { upsert: false, new: true })
|
|
50
57
|
.exec();
|
|
51
58
|
}
|
|
@@ -54,37 +61,20 @@ class EmailMessageRepo {
|
|
|
54
61
|
}
|
|
55
62
|
return doc.toObject();
|
|
56
63
|
}
|
|
57
|
-
async
|
|
58
|
-
const doc = await this.emailMessageModel.findOne({ _id: params.id }, {
|
|
59
|
-
__v: 0,
|
|
60
|
-
createdAt: 0,
|
|
61
|
-
updatedAt: 0
|
|
62
|
-
})
|
|
63
|
-
.exec();
|
|
64
|
-
if (doc === null) {
|
|
65
|
-
throw new factory_1.factory.errors.NotFound(this.emailMessageModel.modelName);
|
|
66
|
-
}
|
|
67
|
-
return doc.toObject();
|
|
68
|
-
}
|
|
69
|
-
async search(params) {
|
|
64
|
+
async findEmailMessages(params) {
|
|
70
65
|
const conditions = EmailMessageRepo.CREATE_MONGO_CONDITIONS(params);
|
|
71
|
-
const query = this.emailMessageModel.find({ $and: conditions },
|
|
72
|
-
__v: 0,
|
|
73
|
-
createdAt: 0,
|
|
74
|
-
updatedAt: 0
|
|
75
|
-
});
|
|
66
|
+
const query = this.emailMessageModel.find({ $and: conditions }, DEFAULT_PROJECTION);
|
|
76
67
|
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
77
68
|
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
78
69
|
query.limit(params.limit)
|
|
79
70
|
.skip(params.limit * (page - 1));
|
|
80
71
|
}
|
|
81
|
-
/* istanbul ignore else */
|
|
82
72
|
if (params.sort !== undefined) {
|
|
83
73
|
query.sort(params.sort);
|
|
84
74
|
}
|
|
85
75
|
return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
86
|
-
.
|
|
87
|
-
.
|
|
76
|
+
.lean()
|
|
77
|
+
.exec();
|
|
88
78
|
}
|
|
89
79
|
async deleteById(params) {
|
|
90
80
|
await this.emailMessageModel.findOneAndDelete({ _id: { $eq: params.id } }, { projection: { _id: 1 } })
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
|
|
2
2
|
import { IVirtuals } from '../virtuals';
|
|
3
3
|
import { factory } from '../../../factory';
|
|
4
|
-
type IDocType = factory.creativeWork.message.email.ICreativeWork
|
|
4
|
+
type IDocType = Pick<factory.creativeWork.message.email.ICreativeWork, 'identifier' | 'name' | 'project' | 'sender' | 'text' | 'typeOf'> & {
|
|
5
|
+
about: Pick<factory.creativeWork.message.email.IAbout, 'name' | 'typeOf'> & {
|
|
6
|
+
/**
|
|
7
|
+
* 現時点でOnEventStatusChangedしかサポートしていない
|
|
8
|
+
* 2026-06-18
|
|
9
|
+
*/
|
|
10
|
+
identifier: factory.creativeWork.message.email.AboutIdentifier.OnEventStatusChanged;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
5
13
|
type IModel = Model<IDocType, Record<string, never>, Record<string, never>, IVirtuals>;
|
|
6
14
|
type ISchemaDefinition = SchemaDefinition<IDocType>;
|
|
7
15
|
type ISchema = Schema<IDocType, IModel, Record<string, never>, Record<string, never>, IVirtuals, Record<string, never>, ISchemaDefinition, IDocType>;
|
|
@@ -8,12 +8,9 @@ const settings_1 = require("../../../settings");
|
|
|
8
8
|
const modelName = 'EmailMessage';
|
|
9
9
|
exports.modelName = modelName;
|
|
10
10
|
const schemaDefinition = {
|
|
11
|
-
project: mongoose_1.SchemaTypes.Mixed,
|
|
12
|
-
typeOf: {
|
|
13
|
-
|
|
14
|
-
required: true
|
|
15
|
-
},
|
|
16
|
-
identifier: String,
|
|
11
|
+
project: { type: mongoose_1.SchemaTypes.Mixed, required: true },
|
|
12
|
+
typeOf: { type: String, required: true },
|
|
13
|
+
identifier: { type: String, required: true },
|
|
17
14
|
name: mongoose_1.SchemaTypes.Mixed,
|
|
18
15
|
about: mongoose_1.SchemaTypes.Mixed,
|
|
19
16
|
sender: mongoose_1.SchemaTypes.Mixed,
|
|
@@ -54,25 +51,13 @@ function createSchema() {
|
|
|
54
51
|
return schema;
|
|
55
52
|
}
|
|
56
53
|
const indexes = [
|
|
57
|
-
// [ // discontinue(2024-08-07~)
|
|
58
|
-
// { createdAt: 1 },
|
|
59
|
-
// { name: 'searchByCreatedAt' }
|
|
60
|
-
// ],
|
|
61
|
-
// [
|
|
62
|
-
// { updatedAt: 1 },
|
|
63
|
-
// { name: 'searchByUpdatedAt' }
|
|
64
|
-
// ],
|
|
65
54
|
[
|
|
66
55
|
{ identifier: 1 },
|
|
67
|
-
{
|
|
68
|
-
name: 'searchByIdentifier'
|
|
69
|
-
}
|
|
56
|
+
{ name: 'searchByIdentifier' }
|
|
70
57
|
],
|
|
71
58
|
[
|
|
72
59
|
{ 'project.id': 1, identifier: 1 },
|
|
73
|
-
{
|
|
74
|
-
name: 'searchByProjectId'
|
|
75
|
-
}
|
|
60
|
+
{ name: 'searchByProjectId' }
|
|
76
61
|
]
|
|
77
62
|
];
|
|
78
63
|
exports.indexes = indexes;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Connection } from 'mongoose';
|
|
1
|
+
import type { Connection, UpdateQuery } from 'mongoose';
|
|
2
2
|
import { factory } from '../factory';
|
|
3
3
|
import { IDocType } from './mongoose/schemas/transaction';
|
|
4
4
|
interface IAggregationByStatus {
|
|
@@ -116,6 +116,10 @@ export declare class TransactionRepo {
|
|
|
116
116
|
filter: any;
|
|
117
117
|
$unset: any;
|
|
118
118
|
}): Promise<import("mongoose").UpdateWriteOpResult>;
|
|
119
|
+
updateById4migration(params: {
|
|
120
|
+
id: string;
|
|
121
|
+
update: UpdateQuery<IDocType>;
|
|
122
|
+
}): Promise<import("mongoose").UpdateWriteOpResult>;
|
|
119
123
|
/**
|
|
120
124
|
* 終了日時を一定期間過ぎたアクションを削除する
|
|
121
125
|
*/
|
|
@@ -297,6 +297,10 @@ class TransactionRepo {
|
|
|
297
297
|
return this.transactionModel.updateMany(params.filter, { $unset: params.$unset }, { timestamps: false })
|
|
298
298
|
.exec();
|
|
299
299
|
}
|
|
300
|
+
async updateById4migration(params) {
|
|
301
|
+
return this.transactionModel.updateOne({ _id: { $eq: params.id } }, params.update)
|
|
302
|
+
.exec();
|
|
303
|
+
}
|
|
300
304
|
/**
|
|
301
305
|
* 終了日時を一定期間過ぎたアクションを削除する
|
|
302
306
|
*/
|
package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.d.ts
CHANGED
|
@@ -12,7 +12,6 @@ export declare function createSendEmailMessageActions(params: {
|
|
|
12
12
|
seller: factory.order.ISeller;
|
|
13
13
|
paymentMethods: factory.order.IReferencedInvoice[];
|
|
14
14
|
potentialActions?: factory.transaction.placeOrder.IPotentialActionsParams;
|
|
15
|
-
emailMessage?: factory.creativeWork.message.email.ICreativeWork;
|
|
16
15
|
}, setting: Pick<ISetting, 'defaultSenderEmail'>): Promise<{
|
|
17
16
|
emailMessages: factory.action.transfer.send.message.email.IObjectAsEmailMessage[];
|
|
18
17
|
sendEmailMessageActions: factory.transaction.placeOrder.IPotentialSendEmailMessageAction[];
|
package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.js
CHANGED
|
@@ -3,20 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createSendEmailMessageActions = createSendEmailMessageActions;
|
|
4
4
|
const emailMessageBuilder_1 = require("../../../../../emailMessageBuilder");
|
|
5
5
|
const factory_1 = require("../../../../../factory");
|
|
6
|
-
async function createSendEmailMessageActions(params,
|
|
7
|
-
// settings: Settings
|
|
8
|
-
setting) {
|
|
6
|
+
async function createSendEmailMessageActions(params, setting) {
|
|
9
7
|
// 注文配送メール送信設定
|
|
10
8
|
const emailMessages = [];
|
|
11
|
-
// const sendEmailMessageActions: factory.action.transfer.send.message.email.IAttributes[] = [];
|
|
12
9
|
const sendEmailMessageActions = [];
|
|
13
|
-
// const sendActionPurpose: factory.action.transfer.send.message.email.IPurpose = {
|
|
14
|
-
// typeOf: params.order.typeOf,
|
|
15
|
-
// orderNumber: params.order.orderNumber,
|
|
16
|
-
// price: params.order.price,
|
|
17
|
-
// priceCurrency: params.order.priceCurrency,
|
|
18
|
-
// orderDate: params.order.orderDate
|
|
19
|
-
// };
|
|
20
10
|
const sendEmailMessageOnOrderSentParams = params.potentialActions?.order?.potentialActions?.sendOrder?.potentialActions?.sendEmailMessage;
|
|
21
11
|
if (Array.isArray(sendEmailMessageOnOrderSentParams)) {
|
|
22
12
|
const orderAsCreateEmailParams = {
|
|
@@ -30,7 +20,7 @@ setting) {
|
|
|
30
20
|
order: orderAsCreateEmailParams,
|
|
31
21
|
index,
|
|
32
22
|
...(s.object !== undefined) ? { email: s.object } : undefined,
|
|
33
|
-
...(params.emailMessage !== undefined) ? { emailMessage: params.emailMessage } : undefined
|
|
23
|
+
// ...(params.emailMessage !== undefined) ? { emailMessage: params.emailMessage } : undefined
|
|
34
24
|
}, setting);
|
|
35
25
|
emailMessages.push(emailMessage);
|
|
36
26
|
// 送信アクション最適化に対応(2024-04-29~)
|
|
@@ -40,16 +30,7 @@ setting) {
|
|
|
40
30
|
};
|
|
41
31
|
// optimize(2024-05-07~)
|
|
42
32
|
sendEmailMessageActions.push({
|
|
43
|
-
// project: params.order.project,
|
|
44
|
-
// typeOf: factory.actionType.SendAction,
|
|
45
33
|
object: sendEmailMessageActionObject
|
|
46
|
-
// agent: params.order.project,
|
|
47
|
-
// recipient: {
|
|
48
|
-
// typeOf: params.order.customer.typeOf,
|
|
49
|
-
// id: params.order.customer.id
|
|
50
|
-
// },
|
|
51
|
-
// potentialActions: {},
|
|
52
|
-
// purpose: sendActionPurpose
|
|
53
34
|
});
|
|
54
35
|
}));
|
|
55
36
|
}
|
|
@@ -15,7 +15,6 @@ export declare function createPotentialActions(params: {
|
|
|
15
15
|
seller: factory.order.ISeller;
|
|
16
16
|
paymentMethods: factory.order.IReferencedInvoice[];
|
|
17
17
|
potentialActions?: factory.transaction.placeOrder.IPotentialActionsParams;
|
|
18
|
-
emailMessage?: factory.creativeWork.message.email.ICreativeWork;
|
|
19
18
|
}, setting: Pick<ISetting, 'defaultSenderEmail'>): Promise<{
|
|
20
19
|
potentialActions: factory.transaction.placeOrder.IPotentialActions;
|
|
21
20
|
emailMessages: factory.creativeWork.message.email.ICreativeWork[];
|
|
@@ -5,14 +5,9 @@ const sendEmailMessage_1 = require("./potentialActions/sendEmailMessage");
|
|
|
5
5
|
/**
|
|
6
6
|
* 取引のポストアクションを作成する
|
|
7
7
|
*/
|
|
8
|
-
async function createPotentialActions(params,
|
|
9
|
-
// settings: Settings
|
|
10
|
-
setting) {
|
|
8
|
+
async function createPotentialActions(params, setting) {
|
|
11
9
|
// 注文処理開始メール送信設定
|
|
12
10
|
const { emailMessages, sendEmailMessageActions } = await (0, sendEmailMessage_1.createSendEmailMessageActions)(params, setting);
|
|
13
|
-
// const sendOrderActionAttributes: factory.transaction.placeOrder.IPotentialSendOrderAction = {
|
|
14
|
-
// potentialActions: { sendEmailMessage: sendEmailMessageActions }
|
|
15
|
-
// };
|
|
16
11
|
return {
|
|
17
12
|
emailMessages,
|
|
18
13
|
potentialActions: {
|
|
@@ -4,7 +4,6 @@ import type { AuthorizeOfferActionRepo } from '../../../repo/action/authorizeOff
|
|
|
4
4
|
import type { AssetTransactionRepo } from '../../../repo/assetTransaction';
|
|
5
5
|
import type { AuthorizationRepo } from '../../../repo/authorization';
|
|
6
6
|
import type { ConfirmationNumberRepo } from '../../../repo/confirmationNumber';
|
|
7
|
-
import type { EmailMessageRepo } from '../../../repo/emailMessage';
|
|
8
7
|
import type { MessageRepo } from '../../../repo/message';
|
|
9
8
|
import type { OrderInTransactionRepo } from '../../../repo/orderInTransaction';
|
|
10
9
|
import type { ProjectRepo } from '../../../repo/project';
|
|
@@ -18,7 +17,6 @@ interface IConfirmOperationRepos {
|
|
|
18
17
|
authorizeOfferAction: AuthorizeOfferActionRepo;
|
|
19
18
|
assetTransaction: AssetTransactionRepo;
|
|
20
19
|
authorization: AuthorizationRepo;
|
|
21
|
-
emailMessage?: EmailMessageRepo;
|
|
22
20
|
message: MessageRepo;
|
|
23
21
|
project: ProjectRepo;
|
|
24
22
|
placeOrder: PlaceOrderRepo;
|
|
@@ -136,17 +136,18 @@ function confirm(params, options) {
|
|
|
136
136
|
acceptedOffers, payTransactions, customer,
|
|
137
137
|
...(typeof code === 'string') ? { code } : undefined
|
|
138
138
|
}, options);
|
|
139
|
-
//
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
139
|
+
// discontinue emailMessageRepo
|
|
140
|
+
// // デフォルトEメールメッセージを検索
|
|
141
|
+
// let emailMessageOnOrderSent: factory.creativeWork.message.email.ICreativeWork | undefined;
|
|
142
|
+
// if (repos.emailMessage !== undefined) {
|
|
143
|
+
// const searchEmailMessagesResult = await repos.emailMessage.search({
|
|
144
|
+
// limit: 1,
|
|
145
|
+
// page: 1,
|
|
146
|
+
// project: { id: { $eq: transaction.project.id } },
|
|
147
|
+
// about: { identifier: { $eq: factory.creativeWork.message.email.AboutIdentifier.OnOrderSent } }
|
|
148
|
+
// });
|
|
149
|
+
// emailMessageOnOrderSent = searchEmailMessagesResult.shift();
|
|
150
|
+
// }
|
|
150
151
|
// ポストアクションを作成
|
|
151
152
|
const setting = await repos.setting.findOne({ project: { id: { $eq: '*' } } }, ['defaultSenderEmail']);
|
|
152
153
|
if (typeof setting?.defaultSenderEmail !== 'string') {
|
|
@@ -160,7 +161,7 @@ function confirm(params, options) {
|
|
|
160
161
|
// order: orderWithAcceptedOffers, // 現時点でcreateEmailMessageでorder.acceptedOffersを使用している(2024-02-06~)
|
|
161
162
|
// transaction: transaction,
|
|
162
163
|
...(params.potentialActions !== undefined) ? { potentialActions: params.potentialActions } : undefined,
|
|
163
|
-
...(emailMessageOnOrderSent !== undefined) ? { emailMessage: emailMessageOnOrderSent } : undefined
|
|
164
|
+
// ...(emailMessageOnOrderSent !== undefined) ? { emailMessage: emailMessageOnOrderSent } : undefined
|
|
164
165
|
},
|
|
165
166
|
// settings
|
|
166
167
|
setting);
|
|
@@ -4,7 +4,6 @@ type IPotentialSendEmailMessageAction = factory.action.transfer.returnAction.ord
|
|
|
4
4
|
export declare function createSendEmailMessaegActionsOnReturn(params: {
|
|
5
5
|
order: Pick<factory.order.IOrder, 'confirmationNumber' | 'customer' | 'orderDate' | 'orderNumber' | 'orderStatus' | 'orderedItem' | 'paymentMethods' | 'price' | 'priceCurrency' | 'seller' | 'typeOf'>;
|
|
6
6
|
returnOrderActionParams?: factory.transaction.returnOrder.IReturnOrderActionParams;
|
|
7
|
-
emailMessageOnOrderReturned?: factory.creativeWork.message.email.ICreativeWork;
|
|
8
7
|
}, setting: Pick<ISetting, 'defaultSenderEmail'>): Promise<{
|
|
9
8
|
emailMessagesOnReturn: factory.action.transfer.send.message.email.IObjectAsEmailMessage[];
|
|
10
9
|
sendEmailMessaegActionsOnReturn: IPotentialSendEmailMessageAction[];
|
|
@@ -7,13 +7,6 @@ async function createSendEmailMessaegActionsOnReturn(params,
|
|
|
7
7
|
// settings: Settings
|
|
8
8
|
setting) {
|
|
9
9
|
const order = params.order;
|
|
10
|
-
// const sendActionPurpose: factory.action.transfer.send.message.email.IPurpose = {
|
|
11
|
-
// typeOf: order.typeOf,
|
|
12
|
-
// orderNumber: order.orderNumber,
|
|
13
|
-
// price: order.price,
|
|
14
|
-
// priceCurrency: order.priceCurrency,
|
|
15
|
-
// orderDate: order.orderDate
|
|
16
|
-
// };
|
|
17
10
|
// 返品後のEメール送信アクション
|
|
18
11
|
const emailMessagesOnReturn = [];
|
|
19
12
|
const sendEmailMessaegActionsOnReturn = [];
|
|
@@ -24,24 +17,16 @@ setting) {
|
|
|
24
17
|
order,
|
|
25
18
|
index,
|
|
26
19
|
...(sendEmailMessageParams.object !== undefined) ? { email: sendEmailMessageParams.object } : undefined,
|
|
27
|
-
...(params.emailMessageOnOrderReturned !== undefined)
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
// ...(params.emailMessageOnOrderReturned !== undefined)
|
|
21
|
+
// ? { emailMessage: params.emailMessageOnOrderReturned }
|
|
22
|
+
// : undefined
|
|
30
23
|
}, setting);
|
|
31
24
|
emailMessagesOnReturn.push(emailMessage);
|
|
32
25
|
return {
|
|
33
|
-
// project: order.project, // optimize(2024-06-25~)
|
|
34
|
-
// typeOf: factory.actionType.SendAction, // optimize(2024-06-25~)
|
|
35
|
-
// standardize object(2024-06-27~)
|
|
36
|
-
// object: emailMessage
|
|
37
26
|
object: {
|
|
38
27
|
identifier: emailMessage.identifier,
|
|
39
28
|
typeOf: factory_1.factory.creativeWorkType.EmailMessage
|
|
40
29
|
}
|
|
41
|
-
// agent: order.project, // optimize(2024-06-25~)
|
|
42
|
-
// recipient: { typeOf: order.customer.typeOf, id: order.customer.id }, // optimize(2024-06-25~)
|
|
43
|
-
// potentialActions: {} // optimize(2024-06-25~)
|
|
44
|
-
// purpose: sendActionPurpose // optimize(2024-06-25~)
|
|
45
30
|
};
|
|
46
31
|
})));
|
|
47
32
|
}
|
|
@@ -6,7 +6,6 @@ declare function createPotentialActions(params: {
|
|
|
6
6
|
orders: IReturningOrder4potentialActions[];
|
|
7
7
|
potentialActions?: factory.transaction.returnOrder.IPotentialActionsParams;
|
|
8
8
|
transaction: Pick<factory.transaction.returnOrder.ITransaction, 'agent' | 'object'>;
|
|
9
|
-
emailMessageOnOrderReturned?: factory.creativeWork.message.email.ICreativeWork;
|
|
10
9
|
}, setting: Pick<ISetting, 'defaultSenderEmail'>): Promise<{
|
|
11
10
|
emailMessages: factory.action.transfer.send.message.email.IObjectAsEmailMessage[];
|
|
12
11
|
potentialActions: factory.transaction.returnOrder.IPotentialActions;
|
|
@@ -22,9 +22,6 @@ setting) {
|
|
|
22
22
|
...(returnOrderActionParams !== undefined) ? { returnOrderActionParams } : undefined
|
|
23
23
|
}, setting);
|
|
24
24
|
emailMessages.push(...emailMessagesOnReturnInvoice);
|
|
25
|
-
// discontinue(2026-04-18~)
|
|
26
|
-
// // ポイント特典の数だけ、返却アクションを作成
|
|
27
|
-
// const returnPointAwardActions = await createReturnPointAwardActions({ ...params, order });
|
|
28
25
|
// 返品後のEメール送信アクション
|
|
29
26
|
const { emailMessagesOnReturn, sendEmailMessaegActionsOnReturn } = await (0, sendEmailMessage_1.createSendEmailMessaegActionsOnReturn)({
|
|
30
27
|
...params,
|
|
@@ -34,7 +31,6 @@ setting) {
|
|
|
34
31
|
emailMessages.push(...emailMessagesOnReturn);
|
|
35
32
|
const potentialActionsOnReturnOrder = {
|
|
36
33
|
returnPaymentMethod: returnPaymentMethodActions,
|
|
37
|
-
// returnPointAward: returnPointAwardActions, // discontinue(2026-04-18~)
|
|
38
34
|
sendEmailMessage: sendEmailMessaegActionsOnReturn
|
|
39
35
|
};
|
|
40
36
|
const returnOrderObject = {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { factory } from '../../factory';
|
|
2
2
|
import type { AcceptedOfferRepo } from '../../repo/acceptedOffer';
|
|
3
|
-
import type { EmailMessageRepo } from '../../repo/emailMessage';
|
|
4
3
|
import type { EventRepo } from '../../repo/event';
|
|
5
4
|
import type { MerchantReturnPolicyRepo } from '../../repo/merchantReturnPolicy';
|
|
6
5
|
import type { MessageRepo } from '../../repo/message';
|
|
@@ -41,7 +40,6 @@ type ITaskAndTransactionOperation<T> = (repos: IExportTasksByIdRepos) => Promise
|
|
|
41
40
|
declare function start(params: factory.transaction.returnOrder.IStartParamsWithoutDetail): IStartOperation<IStartedTransaction>;
|
|
42
41
|
interface IConfirmRepos {
|
|
43
42
|
acceptedOffer: AcceptedOfferRepo;
|
|
44
|
-
emailMessage?: EmailMessageRepo;
|
|
45
43
|
message: MessageRepo;
|
|
46
44
|
order: OrderRepo;
|
|
47
45
|
setting: SettingRepo;
|
|
@@ -112,17 +112,18 @@ function confirm(params) {
|
|
|
112
112
|
'orderedItem', 'paymentMethods', 'price', 'priceCurrency', 'project', 'seller', 'typeOf'
|
|
113
113
|
]
|
|
114
114
|
});
|
|
115
|
-
//
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
115
|
+
// discontinue emailMessageRepo
|
|
116
|
+
// // デフォルトEメールメッセージを検索
|
|
117
|
+
// let emailMessageOnOrderReturned: factory.creativeWork.message.email.ICreativeWork | undefined;
|
|
118
|
+
// if (repos.emailMessage !== undefined) {
|
|
119
|
+
// const searchEmailMessagesResult = await repos.emailMessage.search({
|
|
120
|
+
// limit: 1,
|
|
121
|
+
// page: 1,
|
|
122
|
+
// project: { id: { $eq: transaction.project.id } },
|
|
123
|
+
// about: { identifier: { $eq: factory.creativeWork.message.email.AboutIdentifier.OnOrderReturned } }
|
|
124
|
+
// });
|
|
125
|
+
// emailMessageOnOrderReturned = searchEmailMessagesResult.shift();
|
|
126
|
+
// }
|
|
126
127
|
const setting = await repos.setting.findOne({ project: { id: { $eq: '*' } } }, ['defaultSenderEmail']);
|
|
127
128
|
if (typeof setting?.defaultSenderEmail !== 'string') {
|
|
128
129
|
throw new factory_1.factory.errors.NotFound('setting.defaultSenderEmail');
|
|
@@ -133,7 +134,7 @@ function confirm(params) {
|
|
|
133
134
|
orders: returningOrders,
|
|
134
135
|
transaction: transaction,
|
|
135
136
|
...(params.potentialActions !== undefined) ? { potentialActions: params.potentialActions } : undefined,
|
|
136
|
-
...(emailMessageOnOrderReturned !== undefined) ? { emailMessageOnOrderReturned } : undefined
|
|
137
|
+
// ...(emailMessageOnOrderReturned !== undefined) ? { emailMessageOnOrderReturned } : undefined
|
|
137
138
|
},
|
|
138
139
|
// settings
|
|
139
140
|
setting);
|
package/package.json
CHANGED