@chevre/domain 22.1.0-alpha.2 → 22.1.0-alpha.3
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/example/src/chevre/{searchOrders.ts → projectOrderFields.ts} +9 -24
- package/lib/chevre/repo/order.d.ts +8 -6
- package/lib/chevre/repo/order.js +79 -41
- package/lib/chevre/service/assetTransaction/pay.js +2 -2
- package/lib/chevre/service/assetTransaction/reserve/confirm.js +2 -2
- package/lib/chevre/service/order/deleteOrder.js +4 -2
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +2 -2
- package/lib/chevre/service/payment.js +4 -4
- package/lib/chevre/service/reserve/searchByOrder.js +2 -2
- package/lib/chevre/service/task/confirmReserveTransaction.js +2 -2
- package/lib/chevre/service/task/returnPayTransaction.js +2 -2
- package/lib/chevre/service/transaction/moneyTransfer.js +6 -6
- package/lib/chevre/service/transaction/returnOrder/preStart.js +5 -5
- package/lib/chevre/service/transaction/returnOrder.js +5 -5
- package/package.json +1 -1
|
@@ -19,9 +19,11 @@ async function main() {
|
|
|
19
19
|
|
|
20
20
|
const orderRepo = await chevre.repository.Order.createInstance(mongoose.connection);
|
|
21
21
|
|
|
22
|
-
const orders = await orderRepo.
|
|
22
|
+
const orders = await orderRepo.projectFields(
|
|
23
23
|
{
|
|
24
|
-
limit:
|
|
24
|
+
limit: 3,
|
|
25
|
+
page: 1,
|
|
26
|
+
sort: { orderDate: -1 },
|
|
25
27
|
project: { id: { $eq: project.id } },
|
|
26
28
|
acceptedOffers: {
|
|
27
29
|
// itemOffered: {
|
|
@@ -34,30 +36,13 @@ async function main() {
|
|
|
34
36
|
// issuedThrough: { typeOf: { $eq: chevre.factory.product.ProductType.MembershipService } }
|
|
35
37
|
// }
|
|
36
38
|
}
|
|
37
|
-
// orderedItem: {
|
|
38
|
-
// $size: 3
|
|
39
|
-
// }
|
|
40
|
-
// paymentMethods: {
|
|
41
|
-
// paymentMethod: { identifier: { $in: ['Cash'] } }
|
|
42
|
-
// additionalProperty: {
|
|
43
|
-
// $in: [
|
|
44
|
-
// { name: 'orderId', value: '0102022031518442020' },
|
|
45
|
-
// { name: 'orderId', value: '0102022031518423030' }
|
|
46
|
-
// ]
|
|
47
|
-
// }
|
|
48
|
-
// }
|
|
49
39
|
},
|
|
50
40
|
{
|
|
51
|
-
inclusion:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
// paymentMethods: 1,
|
|
57
|
-
price: 1, priceCurrency: 1, project: 1,
|
|
58
|
-
// seller: 1,
|
|
59
|
-
typeOf: 1
|
|
60
|
-
}
|
|
41
|
+
inclusion: [
|
|
42
|
+
'orderNumber', 'orderDate'
|
|
43
|
+
, 'paymentMethods.name'
|
|
44
|
+
// , 'confirmationNumber', 'identifier', 'orderDate', 'orderStatus', 'price', 'typeOf'
|
|
45
|
+
]
|
|
61
46
|
}
|
|
62
47
|
);
|
|
63
48
|
// tslint:disable-next-line:no-null-keyword
|
|
@@ -55,7 +55,7 @@ export type IOrderOnStatusChanged = Pick<IOrderWithoutAcceptedOffers & {
|
|
|
55
55
|
export declare class OrderRepo {
|
|
56
56
|
private readonly orderModel;
|
|
57
57
|
constructor(connection: Connection);
|
|
58
|
-
static CREATE_MONGO_CONDITIONS(params: factory.order.ISearchConditions): FilterQuery<factory.order.IOrder>[];
|
|
58
|
+
static CREATE_MONGO_CONDITIONS(params: Omit<factory.order.ISearchConditions, 'limit' | 'page' | 'sort'>): FilterQuery<factory.order.IOrder>[];
|
|
59
59
|
/**
|
|
60
60
|
* なければ作成する
|
|
61
61
|
*/
|
|
@@ -149,12 +149,14 @@ export declare class OrderRepo {
|
|
|
149
149
|
}): Promise<void>;
|
|
150
150
|
count(params: factory.order.ISearchConditions): Promise<number>;
|
|
151
151
|
/**
|
|
152
|
-
* 注文を検索する
|
|
152
|
+
* 注文を検索する(inclusion projection)
|
|
153
|
+
* redefine from search(2024-07-31~)
|
|
153
154
|
*/
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
155
|
+
projectFields(params: factory.order.ISearchConditions & {
|
|
156
|
+
limit: number;
|
|
157
|
+
page: number;
|
|
158
|
+
}, options: {
|
|
159
|
+
inclusion: IKeyOfProjection[];
|
|
158
160
|
}): Promise<(IOrderWithoutAcceptedOffers & {
|
|
159
161
|
id: string;
|
|
160
162
|
})[]>;
|
package/lib/chevre/repo/order.js
CHANGED
|
@@ -988,51 +988,96 @@ class OrderRepo {
|
|
|
988
988
|
.exec();
|
|
989
989
|
});
|
|
990
990
|
}
|
|
991
|
+
// migrate to projectFields(2024-07-31~)
|
|
992
|
+
// public async search(
|
|
993
|
+
// params: factory.order.ISearchConditions,
|
|
994
|
+
// // projection: { [key in IKeyOfProjection]?: 0 | 1 } // exclusion+inclusion(2024-07-26~)
|
|
995
|
+
// options: {
|
|
996
|
+
// inclusion: { [key in IKeyOfProjection]?: 1 };
|
|
997
|
+
// // exclusion: { [key in IKeyOfProjection]?: 0 }; // discontinue(2024-07-31~)
|
|
998
|
+
// }
|
|
999
|
+
// ): Promise<(IOrderWithoutAcceptedOffers & { id: string })[]> {
|
|
1000
|
+
// const { inclusion } = options;
|
|
1001
|
+
// const conditions = OrderRepo.CREATE_MONGO_CONDITIONS(params);
|
|
1002
|
+
// let useInclusionProjection: boolean = false;
|
|
1003
|
+
// let projectStage: { [field: string]: AnyExpression } = {};
|
|
1004
|
+
// const positiveProjectionFields: string[] = (inclusion !== undefined && inclusion !== null)
|
|
1005
|
+
// ? Object.keys(inclusion)
|
|
1006
|
+
// .filter((key) => {
|
|
1007
|
+
// // return inclusion[<IKeyOfProjection>key] === 1
|
|
1008
|
+
// // && key !== 'acceptedOffers' // defaultで隠蔽(2023-12-06~)
|
|
1009
|
+
// // && key !== '_id'
|
|
1010
|
+
// // && key !== 'id';
|
|
1011
|
+
// return inclusion[<IKeyOfProjection>key] === 1
|
|
1012
|
+
// && AVAILABLE_PROJECT_FIELDS.includes(<IKeyOfProjection>key);
|
|
1013
|
+
// })
|
|
1014
|
+
// : [];
|
|
1015
|
+
// if (Array.isArray(positiveProjectionFields) && positiveProjectionFields.length > 0) {
|
|
1016
|
+
// useInclusionProjection = true;
|
|
1017
|
+
// projectStage = {
|
|
1018
|
+
// _id: 0, // hide _id(2024-07-25~)
|
|
1019
|
+
// id: { $toString: '$_id' }
|
|
1020
|
+
// };
|
|
1021
|
+
// positiveProjectionFields.forEach((field) => {
|
|
1022
|
+
// projectStage[field] = 1;
|
|
1023
|
+
// });
|
|
1024
|
+
// } else {
|
|
1025
|
+
// throw new factory.errors.ArgumentNull('inclusion', 'inclusion must be specified');
|
|
1026
|
+
// // projectStage = {
|
|
1027
|
+
// // __v: 0,
|
|
1028
|
+
// // createdAt: 0,
|
|
1029
|
+
// // updatedAt: 0,
|
|
1030
|
+
// // acceptedOffers: 0, // defaultで隠蔽(2023-12-06~)
|
|
1031
|
+
// // ...exclusion
|
|
1032
|
+
// // };
|
|
1033
|
+
// }
|
|
1034
|
+
// const query = this.orderModel.find<HydratedDocument<IOrderWithoutAcceptedOffers & { id: string }>>(
|
|
1035
|
+
// (conditions.length > 0) ? { $and: conditions } : {},
|
|
1036
|
+
// projectStage
|
|
1037
|
+
// );
|
|
1038
|
+
// // .select(projectStage);
|
|
1039
|
+
// if (typeof params.limit === 'number' && params.limit > 0) {
|
|
1040
|
+
// const page: number = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
1041
|
+
// query.limit(params.limit)
|
|
1042
|
+
// .skip(params.limit * (page - 1));
|
|
1043
|
+
// }
|
|
1044
|
+
// // tslint:disable-next-line:no-single-line-block-comment
|
|
1045
|
+
// /* istanbul ignore else */
|
|
1046
|
+
// if (params.sort?.orderDate !== undefined) {
|
|
1047
|
+
// query.sort({ orderDate: params.sort.orderDate });
|
|
1048
|
+
// }
|
|
1049
|
+
// // const explainResult = await (<any>query).explain();
|
|
1050
|
+
// // console.log(explainResult[0].executionStats.allPlansExecution.map((e: any) => e.executionStages.inputStage));
|
|
1051
|
+
// if (useInclusionProjection) {
|
|
1052
|
+
// return query.setOptions({ maxTimeMS: MONGO_MAX_TIME_MS })
|
|
1053
|
+
// .lean<(IOrderWithoutAcceptedOffers & { id: string })[]>() // lean(2024-07-25~)
|
|
1054
|
+
// .exec();
|
|
1055
|
+
// } else {
|
|
1056
|
+
// return query.setOptions({ maxTimeMS: MONGO_MAX_TIME_MS })
|
|
1057
|
+
// .exec()
|
|
1058
|
+
// .then((docs) => docs.map((doc) => doc.toObject()));
|
|
1059
|
+
// }
|
|
1060
|
+
// }
|
|
991
1061
|
/**
|
|
992
|
-
* 注文を検索する
|
|
1062
|
+
* 注文を検索する(inclusion projection)
|
|
1063
|
+
* redefine from search(2024-07-31~)
|
|
993
1064
|
*/
|
|
994
|
-
|
|
995
|
-
// projection: { [key in IKeyOfProjection]?: 0 | 1 } // exclusion+inclusion(2024-07-26~)
|
|
996
|
-
options) {
|
|
1065
|
+
projectFields(params, options) {
|
|
997
1066
|
var _a;
|
|
998
1067
|
return __awaiter(this, void 0, void 0, function* () {
|
|
999
1068
|
const { inclusion } = options;
|
|
1000
1069
|
const conditions = OrderRepo.CREATE_MONGO_CONDITIONS(params);
|
|
1001
|
-
let useInclusionProjection = false;
|
|
1002
1070
|
let projectStage = {};
|
|
1003
|
-
const positiveProjectionFields = (inclusion
|
|
1004
|
-
?
|
|
1005
|
-
.filter((key) => {
|
|
1006
|
-
// return inclusion[<IKeyOfProjection>key] === 1
|
|
1007
|
-
// && key !== 'acceptedOffers' // defaultで隠蔽(2023-12-06~)
|
|
1008
|
-
// && key !== '_id'
|
|
1009
|
-
// && key !== 'id';
|
|
1010
|
-
return inclusion[key] === 1
|
|
1011
|
-
&& AVAILABLE_PROJECT_FIELDS.includes(key);
|
|
1012
|
-
})
|
|
1071
|
+
const positiveProjectionFields = (Array.isArray(inclusion))
|
|
1072
|
+
? inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key))
|
|
1013
1073
|
: [];
|
|
1014
1074
|
if (Array.isArray(positiveProjectionFields) && positiveProjectionFields.length > 0) {
|
|
1015
|
-
|
|
1016
|
-
projectStage = {
|
|
1017
|
-
_id: 0,
|
|
1018
|
-
id: { $toString: '$_id' }
|
|
1019
|
-
};
|
|
1020
|
-
positiveProjectionFields.forEach((field) => {
|
|
1021
|
-
projectStage[field] = 1;
|
|
1022
|
-
});
|
|
1075
|
+
projectStage = Object.assign({ _id: 0, id: { $toString: '$_id' } }, Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1]))));
|
|
1023
1076
|
}
|
|
1024
1077
|
else {
|
|
1025
1078
|
throw new factory.errors.ArgumentNull('inclusion', 'inclusion must be specified');
|
|
1026
|
-
// projectStage = {
|
|
1027
|
-
// __v: 0,
|
|
1028
|
-
// createdAt: 0,
|
|
1029
|
-
// updatedAt: 0,
|
|
1030
|
-
// acceptedOffers: 0, // defaultで隠蔽(2023-12-06~)
|
|
1031
|
-
// ...exclusion
|
|
1032
|
-
// };
|
|
1033
1079
|
}
|
|
1034
1080
|
const query = this.orderModel.find((conditions.length > 0) ? { $and: conditions } : {}, projectStage);
|
|
1035
|
-
// .select(projectStage);
|
|
1036
1081
|
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
1037
1082
|
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
1038
1083
|
query.limit(params.limit)
|
|
@@ -1045,16 +1090,9 @@ class OrderRepo {
|
|
|
1045
1090
|
}
|
|
1046
1091
|
// const explainResult = await (<any>query).explain();
|
|
1047
1092
|
// console.log(explainResult[0].executionStats.allPlansExecution.map((e: any) => e.executionStages.inputStage));
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
.exec();
|
|
1052
|
-
}
|
|
1053
|
-
else {
|
|
1054
|
-
return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
1055
|
-
.exec()
|
|
1056
|
-
.then((docs) => docs.map((doc) => doc.toObject()));
|
|
1057
|
-
}
|
|
1093
|
+
return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
1094
|
+
.lean() // lean(2024-07-25~)
|
|
1095
|
+
.exec();
|
|
1058
1096
|
});
|
|
1059
1097
|
}
|
|
1060
1098
|
getCursor(conditions, projection) {
|
|
@@ -463,13 +463,13 @@ function confirm(params) {
|
|
|
463
463
|
}
|
|
464
464
|
let potentialActions;
|
|
465
465
|
// 注文検証
|
|
466
|
-
const existingOrders = yield repos.order.
|
|
466
|
+
const existingOrders = yield repos.order.projectFields({
|
|
467
467
|
limit: 1,
|
|
468
468
|
page: 1,
|
|
469
469
|
project: { id: { $eq: transaction.project.id } },
|
|
470
470
|
confirmationNumbers: [confirmationNumber],
|
|
471
471
|
orderNumbers: [orderNumber]
|
|
472
|
-
}, { inclusion:
|
|
472
|
+
}, { inclusion: ['orderNumber'] });
|
|
473
473
|
if (existingOrders.length === 0) {
|
|
474
474
|
throw new factory.errors.NotFound(factory.order.OrderType.Order);
|
|
475
475
|
}
|
|
@@ -75,13 +75,13 @@ function fixOrderAsPurpose(params, transaction) {
|
|
|
75
75
|
&& payPurposeConfirmationNumber.length > 0
|
|
76
76
|
&& typeof payPurposeOrderNumber === 'string'
|
|
77
77
|
&& payPurposeOrderNumber.length > 0) {
|
|
78
|
-
const orders = yield repos.order.
|
|
78
|
+
const orders = yield repos.order.projectFields({
|
|
79
79
|
limit: 1,
|
|
80
80
|
page: 1,
|
|
81
81
|
project: { id: { $eq: transaction.project.id } },
|
|
82
82
|
confirmationNumbers: [payPurposeConfirmationNumber],
|
|
83
83
|
orderNumbers: [payPurposeOrderNumber]
|
|
84
|
-
}, { inclusion:
|
|
84
|
+
}, { inclusion: ['customer', 'orderNumber', 'typeOf'] });
|
|
85
85
|
order = orders.shift();
|
|
86
86
|
if (order === undefined) {
|
|
87
87
|
throw new factory.errors.NotFound('Order as purpose');
|
|
@@ -18,9 +18,11 @@ const factory = require("../../factory");
|
|
|
18
18
|
*/
|
|
19
19
|
function deleteOrder(params) {
|
|
20
20
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
21
|
-
const orders = yield repos.order.
|
|
21
|
+
const orders = yield repos.order.projectFields({
|
|
22
|
+
limit: 1,
|
|
23
|
+
page: 1,
|
|
22
24
|
orderNumbers: [params.object.orderNumber]
|
|
23
|
-
}, { inclusion:
|
|
25
|
+
}, { inclusion: ['orderDate', 'project', 'customer', 'orderNumber', 'seller'] });
|
|
24
26
|
const order = orders.shift();
|
|
25
27
|
if (order === undefined) {
|
|
26
28
|
// すでに削除済
|
|
@@ -274,14 +274,14 @@ function cancelOrderIfExist(params) {
|
|
|
274
274
|
return;
|
|
275
275
|
}
|
|
276
276
|
// 注文のpaymentMethodIdを取得
|
|
277
|
-
const ordersByPaymentMethodId = yield repos.order.
|
|
277
|
+
const ordersByPaymentMethodId = yield repos.order.projectFields({
|
|
278
278
|
limit: 1,
|
|
279
279
|
page: 1,
|
|
280
280
|
paymentMethods: {
|
|
281
281
|
paymentMethodIds: [params.paymentMethodId]
|
|
282
282
|
},
|
|
283
283
|
project: { id: { $eq: params.project.id } }
|
|
284
|
-
}, { inclusion:
|
|
284
|
+
}, { inclusion: ['confirmationNumber', 'orderNumber'] });
|
|
285
285
|
const orderByPaymentMethodId = ordersByPaymentMethodId.shift();
|
|
286
286
|
if (orderByPaymentMethodId !== undefined) {
|
|
287
287
|
const placeOrderTransaction = yield (0, findPlaceOrderTransaction_1.findPlaceOrderTransaction)({
|
|
@@ -21,13 +21,13 @@ function fixOrderAsPurpose(params, transaction) {
|
|
|
21
21
|
var _a;
|
|
22
22
|
const payPurposeConfirmationNumber = params.potentialActions.pay.purpose.confirmationNumber;
|
|
23
23
|
const payPurposeOrderNumber = (_a = params.potentialActions.pay.purpose) === null || _a === void 0 ? void 0 : _a.orderNumber;
|
|
24
|
-
const ordersWithoutAcceptedOffers = yield repos.order.
|
|
24
|
+
const ordersWithoutAcceptedOffers = yield repos.order.projectFields({
|
|
25
25
|
limit: 1,
|
|
26
26
|
page: 1,
|
|
27
27
|
project: { id: { $eq: transaction.project.id } },
|
|
28
28
|
confirmationNumbers: [payPurposeConfirmationNumber],
|
|
29
29
|
orderNumbers: [payPurposeOrderNumber]
|
|
30
|
-
}, { inclusion:
|
|
30
|
+
}, { inclusion: ['typeOf', 'confirmationNumber', 'orderNumber'] });
|
|
31
31
|
const orderWithoutAcceptedOffers = ordersWithoutAcceptedOffers.shift();
|
|
32
32
|
if (orderWithoutAcceptedOffers === undefined) {
|
|
33
33
|
throw new factory.errors.NotFound('Order as purpose');
|
|
@@ -61,11 +61,11 @@ function payTask2payActionAttributes(params) {
|
|
|
61
61
|
const { object, potentialActions, purpose, typeOf } = params;
|
|
62
62
|
if (typeOf === factory.actionType.PayAction) {
|
|
63
63
|
// 返金手数料決済の場合
|
|
64
|
-
const order = (yield repos.order.
|
|
64
|
+
const order = (yield repos.order.projectFields({
|
|
65
65
|
limit: 1,
|
|
66
66
|
page: 1,
|
|
67
67
|
orderNumbers: [params.purpose.object.orderNumber]
|
|
68
|
-
}, { inclusion:
|
|
68
|
+
}, { inclusion: ['seller', 'project'] })).shift();
|
|
69
69
|
if (order === undefined) {
|
|
70
70
|
throw new factory.errors.NotFound(factory.order.OrderType.Order);
|
|
71
71
|
}
|
|
@@ -40,11 +40,11 @@ function searchByOrder(params) {
|
|
|
40
40
|
switch (offeredThroughIdentifier) {
|
|
41
41
|
// COA対応
|
|
42
42
|
case factory.service.webAPI.Identifier.COA:
|
|
43
|
-
const order = (yield repos.order.
|
|
43
|
+
const order = (yield repos.order.projectFields({
|
|
44
44
|
limit: 1,
|
|
45
45
|
page: 1,
|
|
46
46
|
orderNumbers: [params.orderNumber]
|
|
47
|
-
}, { inclusion:
|
|
47
|
+
}, { inclusion: ['customer'] })).shift();
|
|
48
48
|
if (order === undefined) {
|
|
49
49
|
throw new factory.errors.NotFound(factory.order.OrderType.Order);
|
|
50
50
|
}
|
|
@@ -117,12 +117,12 @@ function fixOrderAsPurpose(params) {
|
|
|
117
117
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
118
118
|
let order;
|
|
119
119
|
const purposeOrderNumber = params.purpose.orderNumber;
|
|
120
|
-
const orders = yield repos.order.
|
|
120
|
+
const orders = yield repos.order.projectFields({
|
|
121
121
|
limit: 1,
|
|
122
122
|
page: 1,
|
|
123
123
|
project: { id: { $eq: params.project.id } },
|
|
124
124
|
orderNumbers: [purposeOrderNumber]
|
|
125
|
-
}, { inclusion:
|
|
125
|
+
}, { inclusion: ['customer', 'orderNumber', 'typeOf'] });
|
|
126
126
|
order = orders.shift();
|
|
127
127
|
if (order === undefined) {
|
|
128
128
|
throw new factory.errors.NotFound('Order as purpose');
|
|
@@ -66,11 +66,11 @@ function fixOrderAndTransaction(params) {
|
|
|
66
66
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
67
67
|
const paymentMethodId = params.object.paymentMethodId;
|
|
68
68
|
// objectから注文を特定する(2024-06-19~)
|
|
69
|
-
const orderByPaymentMethodId = (yield repos.order.
|
|
69
|
+
const orderByPaymentMethodId = (yield repos.order.projectFields({
|
|
70
70
|
limit: 1,
|
|
71
71
|
page: 1,
|
|
72
72
|
paymentMethods: { paymentMethodIds: [paymentMethodId] }
|
|
73
|
-
}, { inclusion:
|
|
73
|
+
}, { inclusion: ['orderNumber'] })).shift();
|
|
74
74
|
if (orderByPaymentMethodId === undefined) {
|
|
75
75
|
throw new factory.errors.NotFound(factory.order.OrderType.Order);
|
|
76
76
|
}
|
|
@@ -400,14 +400,14 @@ function validateFromLocation(project, fromLocationBeforeStart, issuedThrough) {
|
|
|
400
400
|
if (fromLocation.typeOf === factory.order.OrderType.Order) {
|
|
401
401
|
fromLocation = fromLocation;
|
|
402
402
|
// 注文検索
|
|
403
|
-
const orders = yield repos.order.
|
|
403
|
+
const orders = yield repos.order.projectFields({
|
|
404
404
|
limit: 1,
|
|
405
405
|
page: 1,
|
|
406
406
|
project: { id: { $eq: project.id } },
|
|
407
407
|
orderNumbers: [String(fromLocation.orderNumber)],
|
|
408
408
|
confirmationNumbers: [String(fromLocation.confirmationNumber)]
|
|
409
409
|
}, {
|
|
410
|
-
inclusion:
|
|
410
|
+
inclusion: ['identifier', 'orderStatus']
|
|
411
411
|
});
|
|
412
412
|
const order = orders.shift();
|
|
413
413
|
if (order === undefined) {
|
|
@@ -454,16 +454,16 @@ function validateToLocation(project, toLocationBeforeStart, issuedThrough) {
|
|
|
454
454
|
if (toLocation.typeOf === factory.order.OrderType.Order) {
|
|
455
455
|
toLocation = toLocation;
|
|
456
456
|
// 注文検索
|
|
457
|
-
const orders = yield repos.order.
|
|
457
|
+
const orders = yield repos.order.projectFields({
|
|
458
458
|
limit: 1,
|
|
459
459
|
page: 1,
|
|
460
460
|
project: { id: { $eq: project.id } },
|
|
461
461
|
orderNumbers: [String(toLocation.orderNumber)],
|
|
462
462
|
confirmationNumbers: [String(toLocation.confirmationNumber)]
|
|
463
463
|
}, {
|
|
464
|
-
inclusion:
|
|
465
|
-
identifier
|
|
466
|
-
|
|
464
|
+
inclusion: [
|
|
465
|
+
'identifier'
|
|
466
|
+
]
|
|
467
467
|
});
|
|
468
468
|
const order = orders.shift();
|
|
469
469
|
if (order === undefined) {
|
|
@@ -119,7 +119,7 @@ function fixOrders(params) {
|
|
|
119
119
|
throw new factory.errors.Argument('object.order', 'number of orders must be 1');
|
|
120
120
|
}
|
|
121
121
|
// 注文数を1に限定であれば、findByConfirmationNumberに変更できる(2022-04-28~)
|
|
122
|
-
const orders = yield repos.order.
|
|
122
|
+
const orders = yield repos.order.projectFields({
|
|
123
123
|
limit: 1,
|
|
124
124
|
page: 1,
|
|
125
125
|
project: { id: { $eq: params.project.id } },
|
|
@@ -128,10 +128,10 @@ function fixOrders(params) {
|
|
|
128
128
|
},
|
|
129
129
|
// positive projectionで検索(2023-12-08~)
|
|
130
130
|
{
|
|
131
|
-
inclusion:
|
|
132
|
-
confirmationNumber
|
|
133
|
-
paymentMethods
|
|
134
|
-
|
|
131
|
+
inclusion: [
|
|
132
|
+
'confirmationNumber', 'dateReturned', 'orderDate', 'orderNumber', 'orderStatus',
|
|
133
|
+
'paymentMethods', 'price', 'project', 'seller', 'typeOf'
|
|
134
|
+
]
|
|
135
135
|
}
|
|
136
136
|
// {
|
|
137
137
|
// // acceptedOffers: 0, // カスタム返品ポリシーに必要
|
|
@@ -101,17 +101,17 @@ function confirm(params) {
|
|
|
101
101
|
if (transaction.object.order.length !== 1) {
|
|
102
102
|
throw new factory.errors.Argument('object.order', 'number of orders must be 1');
|
|
103
103
|
}
|
|
104
|
-
const returningOrders = yield repos.order.
|
|
104
|
+
const returningOrders = yield repos.order.projectFields({
|
|
105
105
|
limit: 1,
|
|
106
106
|
page: 1,
|
|
107
107
|
project: { id: { $eq: transaction.project.id } },
|
|
108
108
|
confirmationNumbers: [transaction.object.order[0].confirmationNumber],
|
|
109
109
|
orderNumbers: [transaction.object.order[0].orderNumber]
|
|
110
110
|
}, {
|
|
111
|
-
inclusion:
|
|
112
|
-
confirmationNumber
|
|
113
|
-
orderedItem
|
|
114
|
-
|
|
111
|
+
inclusion: [
|
|
112
|
+
'confirmationNumber', 'customer', 'identifier', 'orderDate', 'orderNumber', 'orderStatus',
|
|
113
|
+
'orderedItem', 'paymentMethods', 'price', 'priceCurrency', 'project', 'seller', 'typeOf'
|
|
114
|
+
]
|
|
115
115
|
});
|
|
116
116
|
// デフォルトEメールメッセージを検索
|
|
117
117
|
let emailMessageOnOrderReturned;
|
package/package.json
CHANGED