@chevre/domain 22.5.0-alpha.25 → 22.5.0-alpha.26
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/action.d.ts +1 -1
- package/lib/chevre/repo/action.js +5 -39
- package/lib/chevre/repo/categoryCode.d.ts +1 -5
- package/lib/chevre/repo/categoryCode.js +4 -8
- package/lib/chevre/repo/customer.d.ts +1 -1
- package/lib/chevre/repo/customer.js +4 -4
- package/lib/chevre/repo/mongoose/schemas/aggregateReservation.js +0 -3
- package/lib/chevre/repo/mongoose/schemas/assetTransaction.js +0 -3
- package/lib/chevre/repo/mongoose/schemas/categoryCode.js +0 -3
- package/lib/chevre/repo/mongoose/schemas/creativeWork.js +0 -3
- package/lib/chevre/repo/mongoose/schemas/customer.js +0 -3
- package/lib/chevre/repo/mongoose/schemas/member.js +0 -3
- package/lib/chevre/repo/mongoose/schemas/ownershipInfo.js +0 -3
- package/lib/chevre/repo/mongoose/schemas/paymentService.js +0 -3
- package/lib/chevre/repo/mongoose/schemas/priceSpecification.js +0 -3
- package/lib/chevre/repo/mongoose/schemas/productModel.js +0 -3
- package/lib/chevre/repo/mongoose/schemas/project.js +0 -3
- package/lib/chevre/repo/mongoose/schemas/reservation.js +0 -3
- package/lib/chevre/repo/mongoose/schemas/seller.js +0 -3
- package/lib/chevre/repo/mongoose/schemas/trip.js +0 -3
- package/lib/chevre/repo/place/movieTheater.js +0 -22
- package/lib/chevre/repo/project.js +1 -6
- package/lib/chevre/repo/role.js +0 -7
- package/lib/chevre/repo/seller.js +0 -4
- package/lib/chevre/service/event.js +1 -1
- package/lib/chevre/service/offer/event/importFromCOA.js +2 -2
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +3 -3
- package/lib/chevre/service/offer/eventServiceByCOA/authorizeByAcceptAction.js +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +4 -4
- package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.js +2 -2
- package/lib/chevre/service/order/placeOrder.js +1 -1
- package/lib/chevre/service/payment/any/handlePrePublishedPaymentMethodIdOnAuthorizing.js +1 -1
- package/lib/chevre/service/payment/any.js +1 -1
- package/lib/chevre/service/payment/creditCard/voidTransaction.js +1 -1
- package/lib/chevre/service/payment/movieTicket/validation.js +1 -1
- package/lib/chevre/service/report/telemetry.js +1 -1
- package/lib/chevre/service/reserve/cancelReservation.js +1 -1
- package/lib/chevre/service/reserve/confirmReservation.js +1 -1
- package/lib/chevre/service/task/onResourceUpdated/syncCategoryCode.js +1 -1
- package/lib/chevre/service/task/onResourceUpdated.js +1 -1
- package/package.json +1 -1
- package/example/src/chevre/migratePayTransactionRecipes.ts +0 -252
|
@@ -84,7 +84,7 @@ export declare class ActionRepo {
|
|
|
84
84
|
/**
|
|
85
85
|
* アクション検索
|
|
86
86
|
*/
|
|
87
|
-
search<T extends factory.actionType>(params: factory.action.ISearchConditions, inclusion: IKeyOfProjection[]
|
|
87
|
+
search<T extends factory.actionType>(params: factory.action.ISearchConditions, inclusion: IKeyOfProjection[]): Promise<IAction<T>[]>;
|
|
88
88
|
/**
|
|
89
89
|
* アクション開始
|
|
90
90
|
*/
|
|
@@ -452,7 +452,7 @@ class ActionRepo {
|
|
|
452
452
|
/**
|
|
453
453
|
* アクション検索
|
|
454
454
|
*/
|
|
455
|
-
search(params, inclusion
|
|
455
|
+
search(params, inclusion) {
|
|
456
456
|
var _a;
|
|
457
457
|
return __awaiter(this, void 0, void 0, function* () {
|
|
458
458
|
const conditions = ActionRepo.CREATE_MONGO_CONDITIONS(params);
|
|
@@ -461,28 +461,11 @@ class ActionRepo {
|
|
|
461
461
|
positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
|
|
462
462
|
}
|
|
463
463
|
else {
|
|
464
|
-
if (Array.isArray(exclusion) && exclusion.length > 0) {
|
|
465
|
-
|
|
466
|
-
}
|
|
464
|
+
// if (Array.isArray(exclusion) && exclusion.length > 0) {
|
|
465
|
+
// positiveProjectionFields = positiveProjectionFields.filter((key) => !exclusion.includes(key));
|
|
466
|
+
// }
|
|
467
467
|
}
|
|
468
468
|
const projection = Object.assign({ _id: 0, id: { $toString: '$_id' } }, Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1]))));
|
|
469
|
-
// let projection: { [key: string]: number } = {};
|
|
470
|
-
// if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
471
|
-
// inclusion.forEach((field) => {
|
|
472
|
-
// projection[field] = 1;
|
|
473
|
-
// });
|
|
474
|
-
// } else {
|
|
475
|
-
// projection = {
|
|
476
|
-
// __v: 0,
|
|
477
|
-
// createdAt: 0,
|
|
478
|
-
// updatedAt: 0
|
|
479
|
-
// };
|
|
480
|
-
// if (Array.isArray(exclusion) && exclusion.length > 0) {
|
|
481
|
-
// exclusion.forEach((field) => {
|
|
482
|
-
// projection[field] = 0;
|
|
483
|
-
// });
|
|
484
|
-
// }
|
|
485
|
-
// }
|
|
486
469
|
const query = this.actionModel.find((conditions.length > 0) ? { $and: conditions } : {}, projection);
|
|
487
470
|
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
488
471
|
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
@@ -664,23 +647,6 @@ class ActionRepo {
|
|
|
664
647
|
}
|
|
665
648
|
}
|
|
666
649
|
const projection = Object.assign({ _id: 0, id: { $toString: '$_id' } }, Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1]))));
|
|
667
|
-
// let projection: { [key: string]: number } = {};
|
|
668
|
-
// if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
669
|
-
// inclusion.forEach((field) => {
|
|
670
|
-
// projection[field] = 1;
|
|
671
|
-
// });
|
|
672
|
-
// } else {
|
|
673
|
-
// projection = {
|
|
674
|
-
// __v: 0,
|
|
675
|
-
// createdAt: 0,
|
|
676
|
-
// updatedAt: 0
|
|
677
|
-
// };
|
|
678
|
-
// if (Array.isArray(exclusion) && exclusion.length > 0) {
|
|
679
|
-
// exclusion.forEach((field) => {
|
|
680
|
-
// projection[field] = 0;
|
|
681
|
-
// });
|
|
682
|
-
// }
|
|
683
|
-
// }
|
|
684
650
|
const doc = yield this.actionModel.findOne({
|
|
685
651
|
typeOf: { $eq: params.typeOf },
|
|
686
652
|
_id: { $eq: params.id }
|
|
@@ -705,7 +671,7 @@ class ActionRepo {
|
|
|
705
671
|
project: { id: { $eq: params.project.id } },
|
|
706
672
|
typeOf: { $eq: factory.actionType.PayAction },
|
|
707
673
|
object: { paymentMethod: { paymentMethodId: { $eq: params.paymentMethodId } } }
|
|
708
|
-
}, []
|
|
674
|
+
}, []);
|
|
709
675
|
return payActions.shift();
|
|
710
676
|
});
|
|
711
677
|
}
|
|
@@ -49,11 +49,7 @@ export declare class CategoryCodeRepo {
|
|
|
49
49
|
/**
|
|
50
50
|
* 空の場合無効
|
|
51
51
|
*/
|
|
52
|
-
inclusion: IKeyOfProjection[]
|
|
53
|
-
/**
|
|
54
|
-
* 空の場合無効
|
|
55
|
-
*/
|
|
56
|
-
exclusion: IKeyOfProjection[]): Promise<(factory.categoryCode.ICategoryCode & {
|
|
52
|
+
inclusion: IKeyOfProjection[]): Promise<(factory.categoryCode.ICategoryCode & {
|
|
57
53
|
id: string;
|
|
58
54
|
})[]>;
|
|
59
55
|
save(params: {
|
|
@@ -207,11 +207,7 @@ class CategoryCodeRepo {
|
|
|
207
207
|
/**
|
|
208
208
|
* 空の場合無効
|
|
209
209
|
*/
|
|
210
|
-
inclusion
|
|
211
|
-
/**
|
|
212
|
-
* 空の場合無効
|
|
213
|
-
*/
|
|
214
|
-
exclusion) {
|
|
210
|
+
inclusion) {
|
|
215
211
|
return __awaiter(this, void 0, void 0, function* () {
|
|
216
212
|
const conditions = CategoryCodeRepo.CREATE_MONGO_CONDITIONS(params);
|
|
217
213
|
let positiveProjectionFields = AVAILABLE_PROJECT_FIELDS;
|
|
@@ -219,9 +215,9 @@ class CategoryCodeRepo {
|
|
|
219
215
|
positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
|
|
220
216
|
}
|
|
221
217
|
else {
|
|
222
|
-
if (Array.isArray(exclusion) && exclusion.length > 0) {
|
|
223
|
-
|
|
224
|
-
}
|
|
218
|
+
// if (Array.isArray(exclusion) && exclusion.length > 0) {
|
|
219
|
+
// positiveProjectionFields = positiveProjectionFields.filter((key) => !exclusion.includes(key));
|
|
220
|
+
// }
|
|
225
221
|
}
|
|
226
222
|
const projection = Object.assign({ _id: 0, id: { $toString: '$_id' } }, Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1]))));
|
|
227
223
|
const query = this.categoryCodeModel.find((conditions.length > 0) ? { $and: conditions } : {}, projection);
|
|
@@ -47,7 +47,7 @@ export declare class CustomerRepo {
|
|
|
47
47
|
/**
|
|
48
48
|
* 顧客検索
|
|
49
49
|
*/
|
|
50
|
-
projectFields(conditions: factory.customer.ISearchConditions, inclusion: IKeyOfProjection[]
|
|
50
|
+
projectFields(conditions: factory.customer.ISearchConditions, inclusion: IKeyOfProjection[]): Promise<factory.customer.ICustomer[]>;
|
|
51
51
|
deleteById(params: {
|
|
52
52
|
id: string;
|
|
53
53
|
}): Promise<void>;
|
|
@@ -106,7 +106,7 @@ class CustomerRepo {
|
|
|
106
106
|
/**
|
|
107
107
|
* 顧客検索
|
|
108
108
|
*/
|
|
109
|
-
projectFields(conditions, inclusion
|
|
109
|
+
projectFields(conditions, inclusion) {
|
|
110
110
|
var _a;
|
|
111
111
|
return __awaiter(this, void 0, void 0, function* () {
|
|
112
112
|
const andConditions = CustomerRepo.CREATE_MONGO_CONDITIONS(conditions);
|
|
@@ -115,9 +115,9 @@ class CustomerRepo {
|
|
|
115
115
|
positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
|
|
116
116
|
}
|
|
117
117
|
else {
|
|
118
|
-
if (Array.isArray(exclusion) && exclusion.length > 0) {
|
|
119
|
-
|
|
120
|
-
}
|
|
118
|
+
// if (Array.isArray(exclusion) && exclusion.length > 0) {
|
|
119
|
+
// positiveProjectionFields = positiveProjectionFields.filter((key) => !exclusion.includes(key));
|
|
120
|
+
// }
|
|
121
121
|
}
|
|
122
122
|
const projection = Object.assign({ _id: 0, id: { $toString: '$_id' } }, Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1]))));
|
|
123
123
|
const query = this.customerModel.find((andConditions.length > 0) ? { $and: andConditions } : {}, projection);
|
|
@@ -12,9 +12,6 @@ const schemaDefinition = {
|
|
|
12
12
|
reservationFor: { type: mongoose_1.SchemaTypes.Mixed, required: true },
|
|
13
13
|
aggregateEntranceGate: mongoose_1.SchemaTypes.Mixed,
|
|
14
14
|
aggregateOffer: mongoose_1.SchemaTypes.Mixed
|
|
15
|
-
// createdAt: SchemaTypes.Mixed,
|
|
16
|
-
// updatedAt: SchemaTypes.Mixed,
|
|
17
|
-
// __v: SchemaTypes.Mixed
|
|
18
15
|
};
|
|
19
16
|
const schemaOptions = {
|
|
20
17
|
autoIndex: settings_1.MONGO_AUTO_INDEX,
|
|
@@ -7,9 +7,6 @@ const settings_1 = require("../../../settings");
|
|
|
7
7
|
const modelName = 'AssetTransaction';
|
|
8
8
|
exports.modelName = modelName;
|
|
9
9
|
const schemaDefinition = {
|
|
10
|
-
// __v: SchemaTypes.Mixed,
|
|
11
|
-
// createdAt: SchemaTypes.Mixed,
|
|
12
|
-
// updatedAt: SchemaTypes.Mixed,
|
|
13
10
|
project: { type: mongoose_1.SchemaTypes.Mixed, required: true },
|
|
14
11
|
status: { type: String, required: true },
|
|
15
12
|
typeOf: { type: String, required: true },
|
|
@@ -22,9 +22,6 @@ const schemaDefinition = {
|
|
|
22
22
|
inCodeSet: mongoose_1.SchemaTypes.Mixed,
|
|
23
23
|
name: mongoose_1.SchemaTypes.Mixed,
|
|
24
24
|
paymentMethod: mongoose_1.SchemaTypes.Mixed
|
|
25
|
-
// createdAt: SchemaTypes.Mixed,
|
|
26
|
-
// updatedAt: SchemaTypes.Mixed,
|
|
27
|
-
// __v: SchemaTypes.Mixed
|
|
28
25
|
};
|
|
29
26
|
const schemaOptions = {
|
|
30
27
|
autoIndex: settings_1.MONGO_AUTO_INDEX,
|
|
@@ -28,9 +28,6 @@ const schemaDefinition = {
|
|
|
28
28
|
contentRating: String,
|
|
29
29
|
offers: mongoose_1.SchemaTypes.Mixed,
|
|
30
30
|
additionalProperty: mongoose_1.SchemaTypes.Mixed
|
|
31
|
-
// createdAt: SchemaTypes.Mixed,
|
|
32
|
-
// updatedAt: SchemaTypes.Mixed,
|
|
33
|
-
// __v: SchemaTypes.Mixed
|
|
34
31
|
};
|
|
35
32
|
const schemaOptions = {
|
|
36
33
|
autoIndex: settings_1.MONGO_AUTO_INDEX,
|
|
@@ -19,9 +19,6 @@ const schemaDefinition = {
|
|
|
19
19
|
type: mongoose_1.SchemaTypes.Mixed,
|
|
20
20
|
required: true
|
|
21
21
|
}
|
|
22
|
-
// __v: SchemaTypes.Mixed,
|
|
23
|
-
// createdAt: SchemaTypes.Mixed,
|
|
24
|
-
// updatedAt: SchemaTypes.Mixed
|
|
25
22
|
};
|
|
26
23
|
const schemaOptions = {
|
|
27
24
|
autoIndex: settings_1.MONGO_AUTO_INDEX,
|
|
@@ -22,9 +22,6 @@ const schemaDefinition = {
|
|
|
22
22
|
ownedFrom: Date,
|
|
23
23
|
ownedThrough: Date,
|
|
24
24
|
typeOfGood: mongoose_1.SchemaTypes.Mixed
|
|
25
|
-
// __v: SchemaTypes.Mixed,
|
|
26
|
-
// createdAt: SchemaTypes.Mixed,
|
|
27
|
-
// updatedAt: SchemaTypes.Mixed
|
|
28
25
|
};
|
|
29
26
|
const schemaOptions = {
|
|
30
27
|
autoIndex: settings_1.MONGO_AUTO_INDEX,
|
|
@@ -17,9 +17,6 @@ const schemaDefinition = {
|
|
|
17
17
|
provider: [mongoose_1.SchemaTypes.Mixed],
|
|
18
18
|
serviceOutput: mongoose_1.SchemaTypes.Mixed,
|
|
19
19
|
serviceType: mongoose_1.SchemaTypes.Mixed
|
|
20
|
-
// __v: SchemaTypes.Mixed,
|
|
21
|
-
// createdAt: SchemaTypes.Mixed,
|
|
22
|
-
// updatedAt: SchemaTypes.Mixed
|
|
23
20
|
};
|
|
24
21
|
const schemaOptions = {
|
|
25
22
|
autoIndex: settings_1.MONGO_AUTO_INDEX,
|
|
@@ -20,9 +20,6 @@ const schemaDefinition = {
|
|
|
20
20
|
appliesToCategoryCode: mongoose_1.SchemaTypes.Mixed,
|
|
21
21
|
appliesToMovieTicket: mongoose_1.SchemaTypes.Mixed,
|
|
22
22
|
appliesToVideoFormat: String
|
|
23
|
-
// createdAt: SchemaTypes.Mixed,
|
|
24
|
-
// updatedAt: SchemaTypes.Mixed,
|
|
25
|
-
// __v: SchemaTypes.Mixed
|
|
26
23
|
};
|
|
27
24
|
const schemaOptions = {
|
|
28
25
|
autoIndex: settings_1.MONGO_AUTO_INDEX,
|
|
@@ -12,9 +12,6 @@ const schemaDefinition = {
|
|
|
12
12
|
category: mongoose_1.SchemaTypes.Mixed,
|
|
13
13
|
name: mongoose_1.SchemaTypes.Mixed,
|
|
14
14
|
offers: mongoose_1.SchemaTypes.Mixed
|
|
15
|
-
// createdAt: SchemaTypes.Mixed,
|
|
16
|
-
// updatedAt: SchemaTypes.Mixed,
|
|
17
|
-
// __v: SchemaTypes.Mixed
|
|
18
15
|
};
|
|
19
16
|
const schemaOptions = {
|
|
20
17
|
autoIndex: settings_1.MONGO_AUTO_INDEX,
|
|
@@ -50,9 +50,6 @@ const schemaDefinition = {
|
|
|
50
50
|
attended: { type: Boolean, default: false },
|
|
51
51
|
additionalProperty: mongoose_1.SchemaTypes.Mixed,
|
|
52
52
|
issuedThrough: mongoose_1.SchemaTypes.Mixed
|
|
53
|
-
// createdAt: SchemaTypes.Mixed,
|
|
54
|
-
// updatedAt: SchemaTypes.Mixed,
|
|
55
|
-
// __v: SchemaTypes.Mixed
|
|
56
53
|
};
|
|
57
54
|
const schemaOptions = {
|
|
58
55
|
autoIndex: settings_1.MONGO_AUTO_INDEX,
|
|
@@ -177,28 +177,6 @@ class MovieTheaterRepo {
|
|
|
177
177
|
var _a;
|
|
178
178
|
return __awaiter(this, void 0, void 0, function* () {
|
|
179
179
|
const conditions = MovieTheaterRepo.CREATE_MOVIE_THEATER_MONGO_CONDITIONS(params);
|
|
180
|
-
// let projection: { [key: string]: number } = {};
|
|
181
|
-
// if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
182
|
-
// inclusion.forEach((field) => {
|
|
183
|
-
// if (String(field) !== 'containsPlace' && String(field) !== 'hasPOS') { // 除外(2023-10-26~)
|
|
184
|
-
// projection[field] = 1;
|
|
185
|
-
// }
|
|
186
|
-
// });
|
|
187
|
-
// } else {
|
|
188
|
-
// projection = {
|
|
189
|
-
// __v: 0,
|
|
190
|
-
// createdAt: 0,
|
|
191
|
-
// updatedAt: 0,
|
|
192
|
-
// // containsPlaceを含めるとデータサイズが大きくなるので、検索結果には含めない
|
|
193
|
-
// containsPlace: 0,
|
|
194
|
-
// hasPOS: 0 // 除外(2023-10-26~)
|
|
195
|
-
// };
|
|
196
|
-
// if (Array.isArray(exclusion) && exclusion.length > 0) {
|
|
197
|
-
// exclusion.forEach((field) => {
|
|
198
|
-
// projection[field] = 0;
|
|
199
|
-
// });
|
|
200
|
-
// }
|
|
201
|
-
// }
|
|
202
180
|
let positiveProjectionFields = AVAILABLE_PROJECT_FIELDS;
|
|
203
181
|
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
204
182
|
positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
|
|
@@ -69,9 +69,7 @@ class ProjectRepo {
|
|
|
69
69
|
limit: 1,
|
|
70
70
|
page: 1,
|
|
71
71
|
id: { $eq: params.id }
|
|
72
|
-
}, params.inclusion
|
|
73
|
-
// params.exclusion
|
|
74
|
-
)).shift();
|
|
72
|
+
}, params.inclusion)).shift();
|
|
75
73
|
if (project === undefined) {
|
|
76
74
|
throw new factory.errors.NotFound(this.projectModel.modelName);
|
|
77
75
|
}
|
|
@@ -103,9 +101,6 @@ class ProjectRepo {
|
|
|
103
101
|
else {
|
|
104
102
|
// discontinue(2024-10-09~)
|
|
105
103
|
throw new factory.errors.ArgumentNull('inclusion', 'inclusion must be specified');
|
|
106
|
-
// if (Array.isArray(exclusion) && exclusion.length > 0) {
|
|
107
|
-
// positiveProjectionFields = positiveProjectionFields.filter((key) => !exclusion.includes(key));
|
|
108
|
-
// }
|
|
109
104
|
}
|
|
110
105
|
const projection = Object.assign({ _id: 0, id: { $toString: '$_id' } }, Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1]))));
|
|
111
106
|
const query = this.projectModel.find((andConditions.length > 0) ? { $and: andConditions } : {}, projection);
|
package/lib/chevre/repo/role.js
CHANGED
|
@@ -44,13 +44,6 @@ class RoleRepo {
|
|
|
44
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
45
|
const conditions = RoleRepo.CREATE_MONGO_CONDITIONS(params);
|
|
46
46
|
const positiveProjectionFields = AVAILABLE_PROJECT_FIELDS;
|
|
47
|
-
// if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
48
|
-
// positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
|
|
49
|
-
// } else {
|
|
50
|
-
// if (Array.isArray(exclusion) && exclusion.length > 0) {
|
|
51
|
-
// positiveProjectionFields = positiveProjectionFields.filter((key) => !exclusion.includes(key));
|
|
52
|
-
// }
|
|
53
|
-
// }
|
|
54
47
|
const projection = Object.assign({ _id: 0 }, Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1]))));
|
|
55
48
|
const query = this.roleModel.find((conditions.length > 0) ? { $and: conditions } : {}, projection);
|
|
56
49
|
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
@@ -256,7 +256,6 @@ class SellerRepo {
|
|
|
256
256
|
return __awaiter(this, void 0, void 0, function* () {
|
|
257
257
|
const matchStages = SellerRepo.CREATE_MONGO_CONDITIONS(conditions)
|
|
258
258
|
.map((c) => ({ $match: c }));
|
|
259
|
-
// const projectStage = SellerRepo.CREATE_AGGREGATE_SELLERS_PROJECTION(inclusion, exclusion);
|
|
260
259
|
const projectStage = SellerRepo.CREATE_AGGREGATE_SELLERS_PROJECTION(exclusion);
|
|
261
260
|
const sortByBranchCode = (_a = conditions.sort) === null || _a === void 0 ? void 0 : _a.branchCode;
|
|
262
261
|
const aggregate = this.sellerModel.aggregate([
|
|
@@ -289,9 +288,6 @@ class SellerRepo {
|
|
|
289
288
|
}
|
|
290
289
|
else {
|
|
291
290
|
// discontinue(2024-10-19~)
|
|
292
|
-
// if (Array.isArray(exclusion) && exclusion.length > 0) {
|
|
293
|
-
// positiveProjectionFields = positiveProjectionFields.filter((key) => !exclusion.includes(key));
|
|
294
|
-
// }
|
|
295
291
|
}
|
|
296
292
|
const projection = Object.assign({ _id: 0, id: { $toString: '$_id' } }, Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1]))));
|
|
297
293
|
const query = this.sellerModel.find((andConditions.length > 0) ? { $and: andConditions } : {}, projection);
|
|
@@ -243,7 +243,7 @@ function saveScreeningEventSeries(params) {
|
|
|
243
243
|
const availablePaymentMethodTypes = yield repos.categoryCode.projectFields({
|
|
244
244
|
project: { id: { $eq: params.project.id } },
|
|
245
245
|
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.PaymentMethodType } }
|
|
246
|
-
}, ['additionalProperty', 'codeValue']
|
|
246
|
+
}, ['additionalProperty', 'codeValue']);
|
|
247
247
|
const screeningEventSerieses = filmsFromCOA.map((filmFromCOA) => {
|
|
248
248
|
return createScreeningEventSeriesFromCOA({
|
|
249
249
|
project: project,
|
|
@@ -20,7 +20,7 @@ function importFromCOA(params) {
|
|
|
20
20
|
page: 1,
|
|
21
21
|
project: { id: { $eq: params.project.id } },
|
|
22
22
|
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.CurrencyType } }
|
|
23
|
-
}, []
|
|
23
|
+
}, []);
|
|
24
24
|
const defaultCurrencyType = currencyTypes.shift();
|
|
25
25
|
// メンバーシップ区分検索
|
|
26
26
|
const membershipTypes = yield repos.categoryCode.projectFields({
|
|
@@ -28,7 +28,7 @@ function importFromCOA(params) {
|
|
|
28
28
|
page: 1,
|
|
29
29
|
project: { id: { $eq: params.project.id } },
|
|
30
30
|
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.MembershipType } }
|
|
31
|
-
}, []
|
|
31
|
+
}, []);
|
|
32
32
|
const defaultMembershipType = membershipTypes.shift();
|
|
33
33
|
try {
|
|
34
34
|
const ticketResults = yield repos.masterService.ticket({ theaterCode: params.theaterCode });
|
|
@@ -56,15 +56,15 @@ function authorize(params) {
|
|
|
56
56
|
const availablePaymentMethodTypes = yield repos.categoryCode.projectFields({
|
|
57
57
|
project: { id: { $eq: transaction.project.id } },
|
|
58
58
|
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.PaymentMethodType } }
|
|
59
|
-
}, []
|
|
59
|
+
}, []);
|
|
60
60
|
const seatingTypes = yield repos.categoryCode.projectFields({
|
|
61
61
|
project: { id: { $eq: transaction.project.id } },
|
|
62
62
|
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.SeatingType } }
|
|
63
|
-
}, []
|
|
63
|
+
}, []);
|
|
64
64
|
const videoFormatTypes = yield repos.categoryCode.projectFields({
|
|
65
65
|
project: { id: { $eq: transaction.project.id } },
|
|
66
66
|
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.VideoFormatType } }
|
|
67
|
-
}, []
|
|
67
|
+
}, []);
|
|
68
68
|
// COA仮予約後にリクエストが来る前提
|
|
69
69
|
const validateAcceptedOffersResult = yield (0, validateAcceptedOffers_1.validateAcceptedOffers)({
|
|
70
70
|
object: params.object,
|
|
@@ -27,7 +27,7 @@ function authorizeByAcceptAction(params) {
|
|
|
27
27
|
typeOf: { $eq: factory.actionType.AcceptAction },
|
|
28
28
|
purpose: { id: { $in: [params.purpose.id] } },
|
|
29
29
|
actionStatus: { $in: [factory.actionStatusType.CompletedActionStatus] }
|
|
30
|
-
}, ['result', 'object', 'potentialActions']
|
|
30
|
+
}, ['result', 'object', 'potentialActions'])).shift();
|
|
31
31
|
if (acceptAction === undefined) {
|
|
32
32
|
throw new factory.errors.NotFound(factory.actionType.AcceptAction);
|
|
33
33
|
}
|
|
@@ -53,7 +53,7 @@ function changeOffers(params) {
|
|
|
53
53
|
project: { id: { $eq: authorizeAction.project.id } },
|
|
54
54
|
id: { $in: [originalAcceptActionId] },
|
|
55
55
|
typeOf: { $eq: factory.actionType.AcceptAction }
|
|
56
|
-
}, ['result']
|
|
56
|
+
}, ['result'])).shift()) === null || _a === void 0 ? void 0 : _a.result;
|
|
57
57
|
if (originalAcceptResult === undefined) {
|
|
58
58
|
throw new factory.errors.NotFound(`${factory.actionType.AcceptAction}.result`);
|
|
59
59
|
}
|
|
@@ -83,15 +83,15 @@ function changeOffers(params) {
|
|
|
83
83
|
const availablePaymentMethodTypes = yield repos.categoryCode.projectFields({
|
|
84
84
|
project: { id: { $eq: transaction.project.id } },
|
|
85
85
|
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.PaymentMethodType } }
|
|
86
|
-
}, []
|
|
86
|
+
}, []);
|
|
87
87
|
const seatingTypes = yield repos.categoryCode.projectFields({
|
|
88
88
|
project: { id: { $eq: transaction.project.id } },
|
|
89
89
|
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.SeatingType } }
|
|
90
|
-
}, []
|
|
90
|
+
}, []);
|
|
91
91
|
const videoFormatTypes = yield repos.categoryCode.projectFields({
|
|
92
92
|
project: { id: { $eq: transaction.project.id } },
|
|
93
93
|
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.VideoFormatType } }
|
|
94
|
-
}, []
|
|
94
|
+
}, []);
|
|
95
95
|
// COA仮予約後にリクエストが来る前提
|
|
96
96
|
const { acceptedOffers } = yield (0, validateAcceptedOffers_1.validateAcceptedOffers)({
|
|
97
97
|
object: params.object,
|
|
@@ -51,7 +51,7 @@ function createPlacingOrderFromExistingTransaction(params) {
|
|
|
51
51
|
},
|
|
52
52
|
object: { typeOf: { $eq: factory.action.authorize.paymentMethod.any.ResultType.Payment } },
|
|
53
53
|
id: { $in: completedAuthorizeActionIds }
|
|
54
|
-
}, ['result']
|
|
54
|
+
}, ['result']));
|
|
55
55
|
authorizeOfferActionsWithInstrument = (yield repos.action.search({
|
|
56
56
|
typeOf: factory.actionType.AuthorizeAction,
|
|
57
57
|
purpose: {
|
|
@@ -67,7 +67,7 @@ function createPlacingOrderFromExistingTransaction(params) {
|
|
|
67
67
|
}
|
|
68
68
|
},
|
|
69
69
|
id: { $in: completedAuthorizeActionIds }
|
|
70
|
-
}, ['instrument']
|
|
70
|
+
}, ['instrument']));
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
// orderedItem生成のためにacceptedOffersを取得
|
|
@@ -70,7 +70,7 @@ function placeOrder(params) {
|
|
|
70
70
|
id: { $in: [orderActionPurpose.id] },
|
|
71
71
|
typeOf: { $in: [orderActionPurpose.typeOf] }
|
|
72
72
|
}
|
|
73
|
-
}, ['id']
|
|
73
|
+
}, ['id']);
|
|
74
74
|
if (completedActions.length === 0) {
|
|
75
75
|
const action = yield repos.action.start(orderActionAttributes);
|
|
76
76
|
try {
|
|
@@ -68,7 +68,7 @@ function handlePrePublishedPaymentMethodIdOnAuthorizing(params) {
|
|
|
68
68
|
transactionNumber: { $eq: params.prePublishedPaymentMethodId },
|
|
69
69
|
typeOf: { $eq: factory.assetTransactionType.Pay }
|
|
70
70
|
}
|
|
71
|
-
}, ['object', 'result']
|
|
71
|
+
}, ['object', 'result'])).shift();
|
|
72
72
|
if (acceptPayAction === undefined) {
|
|
73
73
|
throw new factory.errors.NotFound(factory.actionType.AcceptAction);
|
|
74
74
|
}
|
|
@@ -84,7 +84,7 @@ function invalidatePaymentUrl(params) {
|
|
|
84
84
|
transactionNumber: { $eq: paymentMethodIdByPaymentUrl },
|
|
85
85
|
typeOf: { $eq: factory.assetTransactionType.Pay }
|
|
86
86
|
}
|
|
87
|
-
}, ['object']
|
|
87
|
+
}, ['object'])).shift();
|
|
88
88
|
if (acceptPayAction !== undefined) {
|
|
89
89
|
// const paymentMethodType = transaction.object.paymentMethods?.typeOf;
|
|
90
90
|
const paymentMethodType = acceptPayAction.object.object.paymentMethod.identifier;
|
|
@@ -49,7 +49,7 @@ function voidTransaction(params) {
|
|
|
49
49
|
typeOf: { $eq: factory.actionType.AuthorizeAction },
|
|
50
50
|
object: { paymentMethodId: { $eq: paymentMethodId } },
|
|
51
51
|
sameAs: { id: { $eq: transaction.id } }
|
|
52
|
-
}, ['id', 'typeOf', 'project']
|
|
52
|
+
}, ['id', 'typeOf', 'project'])).shift();
|
|
53
53
|
if (authorizeInvoiceAction !== undefined) {
|
|
54
54
|
const cancelAction = {
|
|
55
55
|
startTime: new Date(),
|
|
@@ -150,7 +150,7 @@ function checkByIdentifierIfNotYet(params) {
|
|
|
150
150
|
reservationFor: { id: { $eq: params.screeningEvent.id } } // 指定のイベントにおいて
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
|
-
} }, (typeof placeOrderId === 'string') ? { purpose: { id: { $in: [placeOrderId] } } } : undefined), ['id']
|
|
153
|
+
} }, (typeof placeOrderId === 'string') ? { purpose: { id: { $in: [placeOrderId] } } } : undefined), ['id'])).shift();
|
|
154
154
|
debug('alreadyCheckedAction:', JSON.stringify(alreadyCheckedAction), 'placeOrderId:', placeOrderId);
|
|
155
155
|
if (alreadyCheckedAction !== undefined) {
|
|
156
156
|
const recipe = yield repos.action.findRecipeByAction({
|
|
@@ -181,7 +181,7 @@ function createSellerFlow(measuredFrom, measuredThrough, sellerId) {
|
|
|
181
181
|
const actionsOnExpiredTransactions = yield repos.action.search({
|
|
182
182
|
typeOf: { $eq: factory.actionType.AuthorizeAction },
|
|
183
183
|
purpose: { id: { $in: expiredTransactionIds } }
|
|
184
|
-
}, []
|
|
184
|
+
}, []);
|
|
185
185
|
debug(actionsOnExpiredTransactions.length, 'actionsOnExpiredTransactions found.');
|
|
186
186
|
const numbersOfActionsOnExpired = expiredTransactionIds.map((transactionId) => {
|
|
187
187
|
return actionsOnExpiredTransactions.filter((action) => { var _a; return ((_a = action.purpose) === null || _a === void 0 ? void 0 : _a.id) === transactionId; }).length;
|
|
@@ -61,7 +61,7 @@ function cancelPengindIfNotYet(params) {
|
|
|
61
61
|
id: { $in: [params.purpose.id] },
|
|
62
62
|
typeOf: { $in: [params.purpose.typeOf] }
|
|
63
63
|
}
|
|
64
|
-
}, ['id']
|
|
64
|
+
}, ['id']);
|
|
65
65
|
if (completedActions.length === 0) {
|
|
66
66
|
const actionAttributes = (0, factory_1.createCancelPendingReservationAction)({ transaction: reserveTransaction });
|
|
67
67
|
if (actionAttributes !== undefined) {
|
|
@@ -133,7 +133,7 @@ params, options) {
|
|
|
133
133
|
id: { $in: [actionAttributes.purpose.id] },
|
|
134
134
|
typeOf: { $in: [actionAttributes.purpose.typeOf] }
|
|
135
135
|
}
|
|
136
|
-
}, ['id']
|
|
136
|
+
}, ['id']);
|
|
137
137
|
debug(completedActions.length, 'completed reserveAction found. byTask:', options === null || options === void 0 ? void 0 : options.byTask, 'reservationNumber:', reservationPackage.reservationNumber);
|
|
138
138
|
if (completedActions.length === 0) {
|
|
139
139
|
const action = yield repos.action.start(actionAttributes);
|
|
@@ -34,7 +34,7 @@ function syncCategoryCode(params) {
|
|
|
34
34
|
page: 1,
|
|
35
35
|
project: { id: { $eq: params.project.id } },
|
|
36
36
|
id: { $eq: categoryCodeId }
|
|
37
|
-
}, ['codeValue', 'inCodeSet', 'name', 'project', 'id']
|
|
37
|
+
}, ['codeValue', 'inCodeSet', 'name', 'project', 'id'])).shift();
|
|
38
38
|
if (syncingCategoryCode !== undefined) {
|
|
39
39
|
switch (syncingCategoryCode.inCodeSet.identifier) {
|
|
40
40
|
case factory.categoryCode.CategorySetIdentifier.SeatingType:
|
|
@@ -326,7 +326,7 @@ function createInformCategoryCodeTasks(params) {
|
|
|
326
326
|
id: { $in: params.ids },
|
|
327
327
|
// ひとまずDistributorTypeのみ
|
|
328
328
|
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.DistributorType } }
|
|
329
|
-
}, ['name', 'additionalProperty', 'project', 'typeOf', 'codeValue', 'inCodeSet']
|
|
329
|
+
}, ['name', 'additionalProperty', 'project', 'typeOf', 'codeValue', 'inCodeSet']);
|
|
330
330
|
const informResources = settings.onResourceUpdated.informResource;
|
|
331
331
|
if (categoryCodes4inform.length > 0) {
|
|
332
332
|
const taskRunsAt = new Date();
|
package/package.json
CHANGED
|
@@ -1,252 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import * as moment from 'moment';
|
|
3
|
-
import * as mongoose from 'mongoose';
|
|
4
|
-
|
|
5
|
-
import { chevre } from '../../../lib/index';
|
|
6
|
-
|
|
7
|
-
// tslint:disable-next-line:max-func-body-length
|
|
8
|
-
async function main() {
|
|
9
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
10
|
-
|
|
11
|
-
const actionRepo = await chevre.repository.Action.createInstance(mongoose.connection);
|
|
12
|
-
const assetTransactionRepo = await chevre.repository.AssetTransaction.createInstance(mongoose.connection);
|
|
13
|
-
const cursor = assetTransactionRepo.getCursor(
|
|
14
|
-
{
|
|
15
|
-
// transactionNumber: { $eq: '792921546706869' },
|
|
16
|
-
typeOf: { $eq: chevre.factory.assetTransactionType.Pay },
|
|
17
|
-
status: { $eq: chevre.factory.transactionStatusType.Confirmed },
|
|
18
|
-
startDate: {
|
|
19
|
-
// $lte: moment()
|
|
20
|
-
// // tslint:disable-next-line:no-magic-numbers
|
|
21
|
-
// .add(-28, 'days'),
|
|
22
|
-
$gte: moment()
|
|
23
|
-
// tslint:disable-next-line:no-magic-numbers
|
|
24
|
-
.add(-180, 'days')
|
|
25
|
-
},
|
|
26
|
-
'object.typeOf': { $exists: true, $eq: chevre.factory.service.paymentService.PaymentServiceType.CreditCard }
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
__id: 1, startDate: 1, object: 1, project: 1, typeOf: 1, status: 1, transactionNumber: 1
|
|
30
|
-
}
|
|
31
|
-
);
|
|
32
|
-
console.log('transactions found');
|
|
33
|
-
|
|
34
|
-
let i = 0;
|
|
35
|
-
let updateCount = 0;
|
|
36
|
-
let saveRecipeCount = 0;
|
|
37
|
-
let saveActionCount = 0;
|
|
38
|
-
// tslint:disable-next-line:max-func-body-length
|
|
39
|
-
await cursor.eachAsync(async (doc) => {
|
|
40
|
-
i += 1;
|
|
41
|
-
const payTransaction = <Pick<
|
|
42
|
-
chevre.factory.assetTransaction.pay.ITransaction,
|
|
43
|
-
'id' | 'startDate' | 'object' | 'project' | 'typeOf' | 'status' | 'transactionNumber'
|
|
44
|
-
>>doc.toObject();
|
|
45
|
-
let authorizeInvoiceAction: chevre.factory.action.authorize.invoice.IAction | undefined;
|
|
46
|
-
authorizeInvoiceAction = (<chevre.factory.action.authorize.invoice.IAction[]>await actionRepo.search(
|
|
47
|
-
{
|
|
48
|
-
limit: 1,
|
|
49
|
-
page: 1,
|
|
50
|
-
project: { id: { $eq: payTransaction.project.id } },
|
|
51
|
-
sameAs: { id: { $eq: payTransaction.id } },
|
|
52
|
-
object: {
|
|
53
|
-
typeOf: { $eq: 'Invoice' },
|
|
54
|
-
paymentMethodId: { $eq: payTransaction.transactionNumber }
|
|
55
|
-
},
|
|
56
|
-
typeOf: { $eq: chevre.factory.actionType.AuthorizeAction }
|
|
57
|
-
},
|
|
58
|
-
[],
|
|
59
|
-
[]
|
|
60
|
-
)).shift();
|
|
61
|
-
// authorizeInvoiceAction = undefined;
|
|
62
|
-
|
|
63
|
-
const entryTranArgs: chevre.factory.action.authorize.invoice.IEntryTranArgs = (<any>payTransaction.object).entryTranArgs;
|
|
64
|
-
const entryTranResult: chevre.factory.action.authorize.invoice.IEntryTranResult = (<any>payTransaction.object).entryTranResult;
|
|
65
|
-
const execTranArgs: chevre.factory.action.authorize.invoice.IExecTranArgs = (<any>payTransaction.object).execTranArgs;
|
|
66
|
-
const execTranResult: chevre.factory.action.authorize.invoice.IExecTranResult = (<any>payTransaction.object).execTranResult;
|
|
67
|
-
const secureTran2Result: chevre.factory.action.authorize.invoice.ISecureTran2Result =
|
|
68
|
-
(<any>payTransaction.object).secureTran2Result;
|
|
69
|
-
|
|
70
|
-
if (authorizeInvoiceAction !== undefined) {
|
|
71
|
-
console.log(
|
|
72
|
-
'authorizeInvoiceAction already exists. step:',
|
|
73
|
-
authorizeInvoiceAction.object.paymentMethodId,
|
|
74
|
-
payTransaction.project.id, payTransaction.transactionNumber, payTransaction.startDate, i,
|
|
75
|
-
updateCount, saveRecipeCount, saveActionCount
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
const actionRecipe = await actionRepo.findRecipeByAction<chevre.factory.recipe.RecipeCategory.checkMovieTicket>({
|
|
79
|
-
project: { id: authorizeInvoiceAction.project.id },
|
|
80
|
-
recipeFor: { id: authorizeInvoiceAction.id }
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
if (actionRecipe !== null) {
|
|
84
|
-
console.log(
|
|
85
|
-
'actionRecipe already exists. step:',
|
|
86
|
-
payTransaction.project.id, payTransaction.transactionNumber, payTransaction.startDate, i,
|
|
87
|
-
updateCount, saveRecipeCount, saveActionCount
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
// optimize payTransaction.object
|
|
91
|
-
let unsetResult: any;
|
|
92
|
-
if (secureTran2Result !== undefined) {
|
|
93
|
-
unsetResult = await assetTransactionRepo.unsetUnnecessaryFields({
|
|
94
|
-
filter: { _id: { $eq: payTransaction.id } },
|
|
95
|
-
$unset: {
|
|
96
|
-
'object.entryTranArgs': 1,
|
|
97
|
-
'object.entryTranResult': 1,
|
|
98
|
-
'object.execTranArgs': 1,
|
|
99
|
-
'object.execTranResult': 1,
|
|
100
|
-
'object.secureTran2Result': 1
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
updateCount += 1;
|
|
104
|
-
} else if (entryTranArgs !== undefined && execTranResult !== undefined) {
|
|
105
|
-
unsetResult = await assetTransactionRepo.unsetUnnecessaryFields({
|
|
106
|
-
filter: { _id: { $eq: payTransaction.id } },
|
|
107
|
-
$unset: {
|
|
108
|
-
'object.entryTranArgs': 1,
|
|
109
|
-
'object.entryTranResult': 1,
|
|
110
|
-
'object.execTranArgs': 1,
|
|
111
|
-
'object.execTranResult': 1
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
updateCount += 1;
|
|
115
|
-
}
|
|
116
|
-
console.log(
|
|
117
|
-
'result unset. unsetResult:', unsetResult,
|
|
118
|
-
actionRecipe.step.length,
|
|
119
|
-
payTransaction.project.id, payTransaction.transactionNumber, payTransaction.startDate, i
|
|
120
|
-
);
|
|
121
|
-
} else {
|
|
122
|
-
console.log(
|
|
123
|
-
'creating recipe...',
|
|
124
|
-
payTransaction.project.id, payTransaction.transactionNumber, payTransaction.startDate, i
|
|
125
|
-
);
|
|
126
|
-
if (entryTranArgs === undefined) {
|
|
127
|
-
throw new Error('entryTranArgs undefined');
|
|
128
|
-
}
|
|
129
|
-
if (entryTranResult === undefined) {
|
|
130
|
-
throw new Error('entryTranResult undefined');
|
|
131
|
-
}
|
|
132
|
-
if (execTranArgs === undefined) {
|
|
133
|
-
throw new Error('execTranArgs undefined');
|
|
134
|
-
}
|
|
135
|
-
if (execTranResult === undefined) {
|
|
136
|
-
throw new Error('execTranResult undefined');
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
let recipe: (chevre.factory.action.authorize.invoice.IAuthorizeInvoiceRecipe
|
|
140
|
-
| chevre.factory.action.authorize.invoice.IAuthorizeInvoice3dsRecipe) & {
|
|
141
|
-
recipeFor: { id: string; typeOf: chevre.factory.actionType };
|
|
142
|
-
dateCreated: Date;
|
|
143
|
-
dateModified: Date;
|
|
144
|
-
};
|
|
145
|
-
if (secureTran2Result !== undefined) {
|
|
146
|
-
recipe = {
|
|
147
|
-
project: { id: payTransaction.project.id, typeOf: chevre.factory.organizationType.Project },
|
|
148
|
-
typeOf: 'Recipe',
|
|
149
|
-
recipeCategory: chevre.factory.recipe.RecipeCategory.authorizeInvoice3ds,
|
|
150
|
-
recipeFor: { id: authorizeInvoiceAction.id, typeOf: authorizeInvoiceAction.typeOf },
|
|
151
|
-
step: [{
|
|
152
|
-
typeOf: 'HowToSection',
|
|
153
|
-
itemListElement: [
|
|
154
|
-
{
|
|
155
|
-
typeOf: 'HowToStep',
|
|
156
|
-
identifier: chevre.factory.recipe.StepIdentifier.secureTran2,
|
|
157
|
-
itemListElement: [{
|
|
158
|
-
typeOf: 'HowToDirection',
|
|
159
|
-
afterMedia: secureTran2Result
|
|
160
|
-
}]
|
|
161
|
-
}
|
|
162
|
-
]
|
|
163
|
-
}],
|
|
164
|
-
dateCreated: moment(authorizeInvoiceAction.endDate)
|
|
165
|
-
.toDate(),
|
|
166
|
-
dateModified: moment(authorizeInvoiceAction.endDate)
|
|
167
|
-
.toDate()
|
|
168
|
-
};
|
|
169
|
-
} else {
|
|
170
|
-
recipe = {
|
|
171
|
-
project: { id: payTransaction.project.id, typeOf: chevre.factory.organizationType.Project },
|
|
172
|
-
typeOf: 'Recipe',
|
|
173
|
-
recipeCategory: chevre.factory.recipe.RecipeCategory.authorizeInvoice,
|
|
174
|
-
recipeFor: { id: authorizeInvoiceAction.id, typeOf: authorizeInvoiceAction.typeOf },
|
|
175
|
-
step: [{
|
|
176
|
-
typeOf: 'HowToSection',
|
|
177
|
-
itemListElement: [
|
|
178
|
-
{
|
|
179
|
-
typeOf: 'HowToStep',
|
|
180
|
-
identifier: chevre.factory.recipe.StepIdentifier.entryTran,
|
|
181
|
-
itemListElement: [{
|
|
182
|
-
typeOf: 'HowToDirection',
|
|
183
|
-
beforeMedia: entryTranArgs,
|
|
184
|
-
afterMedia: entryTranResult
|
|
185
|
-
}]
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
typeOf: 'HowToStep',
|
|
189
|
-
identifier: chevre.factory.recipe.StepIdentifier.execTran,
|
|
190
|
-
itemListElement: [{
|
|
191
|
-
typeOf: 'HowToDirection',
|
|
192
|
-
beforeMedia: execTranArgs,
|
|
193
|
-
afterMedia: execTranResult
|
|
194
|
-
}]
|
|
195
|
-
}
|
|
196
|
-
]
|
|
197
|
-
}],
|
|
198
|
-
dateCreated: moment(authorizeInvoiceAction.endDate)
|
|
199
|
-
.toDate(),
|
|
200
|
-
dateModified: moment(authorizeInvoiceAction.endDate)
|
|
201
|
-
.toDate()
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
console.log(
|
|
205
|
-
'saving recipe...',
|
|
206
|
-
payTransaction.project.id, payTransaction.transactionNumber, payTransaction.startDate, i);
|
|
207
|
-
// tslint:disable-next-line:no-null-keyword
|
|
208
|
-
console.dir(recipe, { depth: null });
|
|
209
|
-
await actionRepo.saveRecipeWithDateCreated(recipe);
|
|
210
|
-
saveRecipeCount += 1;
|
|
211
|
-
console.log('recipe saved.', payTransaction.project.id, payTransaction.transactionNumber, payTransaction.startDate, i);
|
|
212
|
-
}
|
|
213
|
-
} else {
|
|
214
|
-
const creatingAction: Omit<chevre.factory.action.authorize.invoice.IAction, 'id'> = {
|
|
215
|
-
project: { id: payTransaction.project.id, typeOf: chevre.factory.organizationType.Project },
|
|
216
|
-
typeOf: chevre.factory.actionType.AuthorizeAction,
|
|
217
|
-
agent: { id: payTransaction.project.id, typeOf: chevre.factory.organizationType.Project },
|
|
218
|
-
object: {
|
|
219
|
-
typeOf: 'Invoice',
|
|
220
|
-
paymentMethodId: payTransaction.transactionNumber
|
|
221
|
-
},
|
|
222
|
-
startDate: moment(payTransaction.startDate)
|
|
223
|
-
.toDate(),
|
|
224
|
-
endDate: moment(payTransaction.startDate)
|
|
225
|
-
.toDate(),
|
|
226
|
-
actionStatus: chevre.factory.actionStatusType.CompletedActionStatus,
|
|
227
|
-
result: {},
|
|
228
|
-
sameAs: { id: payTransaction.id, typeOf: payTransaction.typeOf }
|
|
229
|
-
};
|
|
230
|
-
console.log(
|
|
231
|
-
'creating action...',
|
|
232
|
-
payTransaction.project.id, payTransaction.transactionNumber, payTransaction.startDate, i
|
|
233
|
-
);
|
|
234
|
-
// tslint:disable-next-line:no-null-keyword
|
|
235
|
-
console.dir(creatingAction, { depth: null });
|
|
236
|
-
const saveActionResult = await actionRepo.saveActionWithEndDate(creatingAction);
|
|
237
|
-
saveActionCount += 1;
|
|
238
|
-
console.log(
|
|
239
|
-
'action saved.', saveActionResult,
|
|
240
|
-
payTransaction.project.id, payTransaction.transactionNumber, payTransaction.startDate, i);
|
|
241
|
-
}
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
console.log(i, 'transactions checked');
|
|
245
|
-
console.log(updateCount, 'transactions updated');
|
|
246
|
-
console.log(saveRecipeCount, 'recipe saved');
|
|
247
|
-
console.log(saveActionCount, 'action saved');
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
main()
|
|
251
|
-
.then()
|
|
252
|
-
.catch(console.error);
|