@chevre/domain 21.34.0-alpha.1 → 21.34.0-alpha.10
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/{deleteOwnershipInfosByWebApplication.ts → deleteOwnershipInfosByOwnedThrough.ts} +21 -22
- package/example/src/chevre/findCheckAction.ts +2 -5
- package/example/src/chevre/migrateCheckMovieTicketRecipes.ts +127 -0
- package/example/src/chevre/migratePayCreditCardRecipes.ts +9 -3
- package/example/src/chevre/migratePayMovieTicketRecipes.ts +13 -3
- package/example/src/chevre/migrateTransactionObjectPaymentMethods.ts +8 -1
- package/example/src/chevre/saveRecipe.ts +54 -0
- package/example/src/chevre/searchCheckMovieTicketResultYkknInfo.ts +22 -22
- package/example/src/chevre/unsetUnnecessaryFields.ts +26 -14
- package/lib/chevre/repo/action.d.ts +34 -42
- package/lib/chevre/repo/action.js +190 -88
- package/lib/chevre/repo/mongoose/schemas/actionRecipe.js +2 -1
- package/lib/chevre/service/assetTransaction/cancelReservationCOA/factory.d.ts +14 -0
- package/lib/chevre/service/assetTransaction/cancelReservationCOA/factory.js +31 -0
- package/lib/chevre/service/assetTransaction/cancelReservationCOA.d.ts +10 -0
- package/lib/chevre/service/assetTransaction/cancelReservationCOA.js +54 -0
- package/lib/chevre/service/assetTransaction/pay.js +1 -3
- package/lib/chevre/service/assetTransaction/reserveCOA/factory.d.ts +0 -4
- package/lib/chevre/service/assetTransaction/reserveCOA/factory.js +1 -2
- package/lib/chevre/service/offer/event/authorize.js +1 -1
- package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4coa.d.ts +4 -1
- package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4coa.js +48 -53
- package/lib/chevre/service/offer/event/voidTransaction.js +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer/factory.d.ts +0 -4
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer/factory.js +1 -2
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.js +24 -39
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.d.ts +7 -1
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +4 -2
- package/lib/chevre/service/offer/eventServiceByCOA/authorizeByAcceptAction.d.ts +30 -0
- package/lib/chevre/service/offer/eventServiceByCOA/authorizeByAcceptAction.js +96 -0
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +14 -4
- package/lib/chevre/service/offer/eventServiceByCOA/factory.d.ts +3 -0
- package/lib/chevre/service/offer/eventServiceByCOA/factory.js +1 -0
- package/lib/chevre/service/offer/eventServiceByCOA.d.ts +2 -5
- package/lib/chevre/service/offer/eventServiceByCOA.js +3 -10
- package/lib/chevre/service/payment/any.d.ts +2 -8
- package/lib/chevre/service/payment/any.js +5 -22
- package/lib/chevre/service/payment/creditCard/factory.d.ts +0 -8
- package/lib/chevre/service/payment/creditCard/factory.js +2 -4
- package/lib/chevre/service/payment/creditCard/payCreditCard.js +4 -3
- package/lib/chevre/service/payment/creditCard/refundCreditCard.js +2 -3
- package/lib/chevre/service/payment/movieTicket/checkMovieTicket.js +10 -20
- package/lib/chevre/service/payment/movieTicket/factory.d.ts +1 -13
- package/lib/chevre/service/payment/movieTicket/factory.js +9 -13
- package/lib/chevre/service/payment/movieTicket/payMovieTicket.js +15 -10
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket.js +43 -16
- package/lib/chevre/service/payment/movieTicket/validation.js +18 -6
- package/lib/chevre/service/task/confirmReserveTransaction.d.ts +7 -3
- package/lib/chevre/service/task/confirmReserveTransaction.js +19 -15
- package/lib/chevre/service/task/refund.js +1 -1
- package/lib/chevre/service/task/returnReserveTransaction.d.ts +2 -2
- package/lib/chevre/service/task/returnReserveTransaction.js +25 -41
- package/lib/chevre/service/task.js +2 -0
- package/package.json +2 -2
- package/example/src/chevre/transaction/acceptCOAOffer.ts +0 -78
- package/lib/chevre/service/offer/eventServiceByCOA/cancel.d.ts +0 -42
- package/lib/chevre/service/offer/eventServiceByCOA/cancel.js +0 -65
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// tslint:disable:no-console
|
|
2
|
+
import * as moment from 'moment';
|
|
2
3
|
import * as mongoose from 'mongoose';
|
|
3
4
|
|
|
4
5
|
import { chevre } from '../../../lib/index';
|
|
@@ -11,9 +12,15 @@ async function main() {
|
|
|
11
12
|
|
|
12
13
|
const ownershipInfoRepo = await chevre.repository.OwnershipInfo.createInstance(mongoose.connection);
|
|
13
14
|
|
|
15
|
+
const ownedThroughLt = moment()
|
|
16
|
+
.add(-1, 'year')
|
|
17
|
+
.toDate();
|
|
14
18
|
const cursor = ownershipInfoRepo.getCursor(
|
|
15
19
|
{
|
|
16
|
-
|
|
20
|
+
ownedThrough: {
|
|
21
|
+
$exists: true,
|
|
22
|
+
$lt: ownedThroughLt
|
|
23
|
+
}
|
|
17
24
|
},
|
|
18
25
|
{
|
|
19
26
|
}
|
|
@@ -31,42 +38,34 @@ async function main() {
|
|
|
31
38
|
|
|
32
39
|
let noNeedToDelete = true;
|
|
33
40
|
let ownedById: string | undefined;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
ownedById = ownershipInfo.ownedBy[0].id;
|
|
40
|
-
}
|
|
41
|
-
} else {
|
|
42
|
-
ownedByTypeOf = ownershipInfo.ownedBy.typeOf;
|
|
43
|
-
if (ownershipInfo.ownedBy.typeOf === chevre.factory.creativeWorkType.WebApplication) {
|
|
44
|
-
noNeedToDelete = false;
|
|
45
|
-
ownedById = ownershipInfo.ownedBy.id;
|
|
46
|
-
}
|
|
41
|
+
if (ownershipInfo.ownedThrough instanceof Date
|
|
42
|
+
&& moment(ownedThroughLt)
|
|
43
|
+
.isAfter(moment(ownershipInfo.ownedThrough))) {
|
|
44
|
+
noNeedToDelete = false;
|
|
45
|
+
ownedById = (Array.isArray(ownershipInfo.ownedBy)) ? ownershipInfo.ownedBy[0].id : ownershipInfo.ownedBy.id;
|
|
47
46
|
}
|
|
48
47
|
|
|
49
48
|
if (noNeedToDelete) {
|
|
50
49
|
console.log(
|
|
51
50
|
'noNeedToDelete.',
|
|
52
|
-
ownershipInfo.project.id, ownershipInfo.identifier, ownershipInfo.id,
|
|
51
|
+
ownershipInfo.project.id, ownershipInfo.identifier, ownershipInfo.id, ownershipInfo.ownedFrom, ownershipInfo.ownedThrough,
|
|
53
52
|
i, updateCount);
|
|
54
53
|
} else {
|
|
55
54
|
console.log(
|
|
56
55
|
'deleting...',
|
|
57
|
-
ownershipInfo.project.id, ownershipInfo.identifier, ownershipInfo.id,
|
|
56
|
+
ownershipInfo.project.id, ownershipInfo.identifier, ownershipInfo.id, ownershipInfo.ownedFrom, ownershipInfo.ownedThrough,
|
|
58
57
|
i, updateCount);
|
|
59
58
|
if (typeof ownedById === 'string') {
|
|
60
|
-
await ownershipInfoRepo.deleteByIdAndOwnedById({
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
});
|
|
59
|
+
// await ownershipInfoRepo.deleteByIdAndOwnedById({
|
|
60
|
+
// project: { id: ownershipInfo.project.id },
|
|
61
|
+
// id: ownershipInfo.id,
|
|
62
|
+
// ownedBy: { id: ownedById }
|
|
63
|
+
// });
|
|
65
64
|
}
|
|
66
65
|
updateCount += 1;
|
|
67
66
|
console.log(
|
|
68
67
|
'deleted.',
|
|
69
|
-
ownershipInfo.project.id, ownershipInfo.identifier, ownershipInfo.id,
|
|
68
|
+
ownershipInfo.project.id, ownershipInfo.identifier, ownershipInfo.id, ownershipInfo.ownedFrom, ownershipInfo.ownedThrough,
|
|
70
69
|
i, updateCount);
|
|
71
70
|
}
|
|
72
71
|
});
|
|
@@ -16,13 +16,10 @@ async function main() {
|
|
|
16
16
|
id: project.id
|
|
17
17
|
},
|
|
18
18
|
sameAs: {
|
|
19
|
-
id: '
|
|
19
|
+
id: '666627d5e7fdb1e29d985675'
|
|
20
20
|
},
|
|
21
21
|
purpose: {
|
|
22
|
-
id: '
|
|
23
|
-
},
|
|
24
|
-
options: {
|
|
25
|
-
minimize: true
|
|
22
|
+
id: '666627c6e7fdb1e29d985646'
|
|
26
23
|
}
|
|
27
24
|
})({
|
|
28
25
|
action: actionRepo,
|
|
@@ -0,0 +1,127 @@
|
|
|
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 cursor = actionRepo.getCursor(
|
|
13
|
+
{
|
|
14
|
+
// _id: { $eq: '665c886886e0ee8ff5f7b3c5' },
|
|
15
|
+
typeOf: { $eq: chevre.factory.actionType.CheckAction },
|
|
16
|
+
actionStatus: { $eq: chevre.factory.actionStatusType.CompletedActionStatus },
|
|
17
|
+
startDate: {
|
|
18
|
+
// $lte: moment()
|
|
19
|
+
// // tslint:disable-next-line:no-magic-numbers
|
|
20
|
+
// .add(-29, 'days'),
|
|
21
|
+
$gte: moment()
|
|
22
|
+
// tslint:disable-next-line:no-magic-numbers
|
|
23
|
+
.add(-180, 'days')
|
|
24
|
+
},
|
|
25
|
+
'object.typeOf': { $exists: true, $eq: chevre.factory.service.paymentService.PaymentServiceType.MovieTicket }
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
__id: 1, startDate: 1, endDate: 1, result: 1, project: 1, typeOf: 1, actionStatus: 1, instrument: 1
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
console.log('actions found');
|
|
32
|
+
|
|
33
|
+
let i = 0;
|
|
34
|
+
let updateCount = 0;
|
|
35
|
+
let saveRecipeCount = 0;
|
|
36
|
+
await cursor.eachAsync(async (doc) => {
|
|
37
|
+
i += 1;
|
|
38
|
+
const checkAction = <Pick<
|
|
39
|
+
chevre.factory.action.check.paymentMethod.movieTicket.IAction,
|
|
40
|
+
'id' | 'startDate' | 'endDate' | 'result' | 'project' | 'typeOf' | 'actionStatus' | 'instrument'
|
|
41
|
+
>>doc.toObject();
|
|
42
|
+
const actionRecipe = await actionRepo.findRecipeByAction<chevre.factory.recipe.RecipeCategory.checkMovieTicket>({
|
|
43
|
+
project: { id: checkAction.project.id },
|
|
44
|
+
recipeFor: { id: checkAction.id }
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const purchaseNumberAuthInByCheckAction = (<any>checkAction.result)?.purchaseNumberAuthIn;
|
|
48
|
+
const purchaseNumberAuthResultByCheckAction = (<any>checkAction.result)?.purchaseNumberAuthResult;
|
|
49
|
+
|
|
50
|
+
if (actionRecipe !== null) {
|
|
51
|
+
console.log(
|
|
52
|
+
'actionRecipe already exists. step:',
|
|
53
|
+
actionRecipe.step.length, checkAction.project.id, checkAction.id, checkAction.startDate, i);
|
|
54
|
+
|
|
55
|
+
// optimize action.result
|
|
56
|
+
if (purchaseNumberAuthInByCheckAction !== undefined || purchaseNumberAuthResultByCheckAction !== undefined) {
|
|
57
|
+
const unsetResult = await actionRepo.unsetUnnecessaryFields({
|
|
58
|
+
filter: { _id: { $eq: checkAction.id } },
|
|
59
|
+
$unset: {
|
|
60
|
+
'result.purchaseNumberAuthIn': 1,
|
|
61
|
+
'result.purchaseNumberAuthResult': 1
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
updateCount += 1;
|
|
65
|
+
console.log(
|
|
66
|
+
'result unset. unsetResult:', unsetResult,
|
|
67
|
+
actionRecipe.step.length, checkAction.project.id, checkAction.id, checkAction.startDate, i);
|
|
68
|
+
}
|
|
69
|
+
} else {
|
|
70
|
+
console.log(
|
|
71
|
+
'creating recipe by alterTranResultByPayAction',
|
|
72
|
+
purchaseNumberAuthInByCheckAction?.stCd,
|
|
73
|
+
purchaseNumberAuthResultByCheckAction?.resultInfo.status,
|
|
74
|
+
checkAction.project.id, checkAction.id, checkAction.startDate, i);
|
|
75
|
+
if (purchaseNumberAuthInByCheckAction === undefined) {
|
|
76
|
+
throw new Error('purchaseNumberAuthInByCheckAction undefined');
|
|
77
|
+
}
|
|
78
|
+
if (purchaseNumberAuthResultByCheckAction === undefined) {
|
|
79
|
+
throw new Error('purchaseNumberAuthResultByCheckAction undefined');
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const recipe: chevre.factory.action.check.paymentMethod.movieTicket.IRecipe & {
|
|
83
|
+
recipeFor: { id: string; typeOf: chevre.factory.actionType };
|
|
84
|
+
dateCreated: Date;
|
|
85
|
+
dateModified: Date;
|
|
86
|
+
} = {
|
|
87
|
+
project: { id: checkAction.project.id, typeOf: chevre.factory.organizationType.Project },
|
|
88
|
+
typeOf: 'Recipe',
|
|
89
|
+
recipeCategory: chevre.factory.recipe.RecipeCategory.checkMovieTicket,
|
|
90
|
+
recipeFor: { id: checkAction.id, typeOf: checkAction.typeOf },
|
|
91
|
+
step: [{
|
|
92
|
+
typeOf: 'HowToSection',
|
|
93
|
+
itemListElement: [
|
|
94
|
+
{
|
|
95
|
+
typeOf: 'HowToStep',
|
|
96
|
+
identifier: chevre.factory.recipe.StepIdentifier.purchaseNumberAuth,
|
|
97
|
+
itemListElement: [{
|
|
98
|
+
typeOf: 'HowToDirection',
|
|
99
|
+
beforeMedia: purchaseNumberAuthInByCheckAction,
|
|
100
|
+
afterMedia: purchaseNumberAuthResultByCheckAction
|
|
101
|
+
}]
|
|
102
|
+
}
|
|
103
|
+
]
|
|
104
|
+
}],
|
|
105
|
+
dateCreated: moment(checkAction.endDate)
|
|
106
|
+
.toDate(),
|
|
107
|
+
dateModified: moment(checkAction.endDate)
|
|
108
|
+
.toDate()
|
|
109
|
+
};
|
|
110
|
+
console.log(
|
|
111
|
+
'saving recipe...',
|
|
112
|
+
checkAction.project.id, checkAction.id, checkAction.startDate, i);
|
|
113
|
+
// console.dir(recipe, { depth: null });
|
|
114
|
+
await actionRepo.saveRecipeWithDateCreated(recipe);
|
|
115
|
+
saveRecipeCount += 1;
|
|
116
|
+
console.log('recipe saved.', checkAction.project.id, checkAction.id, checkAction.startDate, i);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
console.log(i, 'actions checked');
|
|
121
|
+
console.log(updateCount, 'actions updated');
|
|
122
|
+
console.log(saveRecipeCount, 'recipe saved');
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
main()
|
|
126
|
+
.then()
|
|
127
|
+
.catch(console.error);
|
|
@@ -15,7 +15,7 @@ async function main() {
|
|
|
15
15
|
startDate: {
|
|
16
16
|
$gte: moment()
|
|
17
17
|
// tslint:disable-next-line:no-magic-numbers
|
|
18
|
-
.add(-
|
|
18
|
+
.add(-30, 'days')
|
|
19
19
|
},
|
|
20
20
|
'object.typeOf': { $exists: true, $eq: chevre.factory.service.paymentService.PaymentServiceType.CreditCard }
|
|
21
21
|
},
|
|
@@ -44,7 +44,7 @@ async function main() {
|
|
|
44
44
|
'actionRecipe already exists. step:',
|
|
45
45
|
actionRecipe.step.length, payAction.project.id, payAction.id, payAction.startDate, i);
|
|
46
46
|
} else {
|
|
47
|
-
const alterTranResultByPayAction = payAction.result?.creditCardSales?.[0];
|
|
47
|
+
const alterTranResultByPayAction = (<any>payAction.result)?.creditCardSales?.[0];
|
|
48
48
|
console.log(
|
|
49
49
|
'creating recipe by alterTranResultByPayAction',
|
|
50
50
|
alterTranResultByPayAction?.tranId,
|
|
@@ -53,7 +53,11 @@ async function main() {
|
|
|
53
53
|
throw new Error('alterTranResultByPayAction undefined');
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
const recipe: chevre.factory.action.trade.pay.IPayCreditCardRecipe & {
|
|
56
|
+
const recipe: chevre.factory.action.trade.pay.IPayCreditCardRecipe & {
|
|
57
|
+
recipeFor: { id: string; typeOf: chevre.factory.actionType };
|
|
58
|
+
dateCreated: Date;
|
|
59
|
+
dateModified: Date;
|
|
60
|
+
} = {
|
|
57
61
|
project: { id: payAction.project.id, typeOf: chevre.factory.organizationType.Project },
|
|
58
62
|
typeOf: 'Recipe',
|
|
59
63
|
recipeCategory: chevre.factory.recipe.RecipeCategory.payCreditCard,
|
|
@@ -82,6 +86,8 @@ async function main() {
|
|
|
82
86
|
]
|
|
83
87
|
}],
|
|
84
88
|
dateCreated: moment(payAction.endDate)
|
|
89
|
+
.toDate(),
|
|
90
|
+
dateModified: moment(payAction.endDate)
|
|
85
91
|
.toDate()
|
|
86
92
|
};
|
|
87
93
|
console.log(
|
|
@@ -10,9 +10,13 @@ async function main() {
|
|
|
10
10
|
const actionRepo = await chevre.repository.Action.createInstance(mongoose.connection);
|
|
11
11
|
const cursor = actionRepo.getCursor(
|
|
12
12
|
{
|
|
13
|
+
// _id: { $eq: '665c886886e0ee8ff5f7b3c5' },
|
|
13
14
|
typeOf: { $eq: chevre.factory.actionType.PayAction },
|
|
14
15
|
actionStatus: { $eq: chevre.factory.actionStatusType.CompletedActionStatus },
|
|
15
16
|
startDate: {
|
|
17
|
+
$lte: moment()
|
|
18
|
+
// tslint:disable-next-line:no-magic-numbers
|
|
19
|
+
.add(-29, 'days'),
|
|
16
20
|
$gte: moment()
|
|
17
21
|
// tslint:disable-next-line:no-magic-numbers
|
|
18
22
|
.add(-180, 'days')
|
|
@@ -44,8 +48,8 @@ async function main() {
|
|
|
44
48
|
'actionRecipe already exists. step:',
|
|
45
49
|
actionRecipe.step.length, payAction.project.id, payAction.id, payAction.startDate, i);
|
|
46
50
|
} else {
|
|
47
|
-
const seatInfoSyncInByPayAction = payAction.instrument?.seatInfoSyncIn;
|
|
48
|
-
const seatInfoSyncResultByPayAction = payAction.result?.seatInfoSyncResult;
|
|
51
|
+
const seatInfoSyncInByPayAction = (<any>payAction.instrument)?.seatInfoSyncIn;
|
|
52
|
+
const seatInfoSyncResultByPayAction = (<any>payAction.result)?.seatInfoSyncResult;
|
|
49
53
|
console.log(
|
|
50
54
|
'creating recipe by alterTranResultByPayAction',
|
|
51
55
|
seatInfoSyncInByPayAction?.stCd,
|
|
@@ -58,7 +62,11 @@ async function main() {
|
|
|
58
62
|
throw new Error('seatInfoSyncResultByPayAction undefined');
|
|
59
63
|
}
|
|
60
64
|
|
|
61
|
-
const recipe: chevre.factory.action.trade.pay.IPayMovieTicketRecipe & {
|
|
65
|
+
const recipe: chevre.factory.action.trade.pay.IPayMovieTicketRecipe & {
|
|
66
|
+
recipeFor: { id: string; typeOf: chevre.factory.actionType };
|
|
67
|
+
dateCreated: Date;
|
|
68
|
+
dateModified: Date;
|
|
69
|
+
} = {
|
|
62
70
|
project: { id: payAction.project.id, typeOf: chevre.factory.organizationType.Project },
|
|
63
71
|
typeOf: 'Recipe',
|
|
64
72
|
recipeCategory: chevre.factory.recipe.RecipeCategory.payMovieTicket,
|
|
@@ -78,6 +86,8 @@ async function main() {
|
|
|
78
86
|
]
|
|
79
87
|
}],
|
|
80
88
|
dateCreated: moment(payAction.endDate)
|
|
89
|
+
.toDate(),
|
|
90
|
+
dateModified: moment(payAction.endDate)
|
|
81
91
|
.toDate()
|
|
82
92
|
};
|
|
83
93
|
console.log(
|
|
@@ -38,6 +38,7 @@ async function main() {
|
|
|
38
38
|
let i = 0;
|
|
39
39
|
let updateCount = 0;
|
|
40
40
|
let saveRecipeCount = 0;
|
|
41
|
+
// tslint:disable-next-line:max-func-body-length
|
|
41
42
|
await cursor.eachAsync(async (doc) => {
|
|
42
43
|
i += 1;
|
|
43
44
|
const placeOrder: Pick<
|
|
@@ -92,7 +93,11 @@ async function main() {
|
|
|
92
93
|
updateCount += 1;
|
|
93
94
|
}
|
|
94
95
|
} else {
|
|
95
|
-
const recipe: chevre.factory.action.accept.pay.IRecipe & {
|
|
96
|
+
const recipe: chevre.factory.action.accept.pay.IRecipe & {
|
|
97
|
+
recipeFor: { id: string; typeOf: chevre.factory.actionType };
|
|
98
|
+
dateCreated: Date;
|
|
99
|
+
dateModified: Date;
|
|
100
|
+
} = {
|
|
96
101
|
project: { id: placeOrder.project.id, typeOf: chevre.factory.organizationType.Project },
|
|
97
102
|
typeOf: 'Recipe',
|
|
98
103
|
recipeCategory: chevre.factory.recipe.RecipeCategory.publishPaymentUrl,
|
|
@@ -121,6 +126,8 @@ async function main() {
|
|
|
121
126
|
]
|
|
122
127
|
}],
|
|
123
128
|
dateCreated: moment(acceptPayAction.endDate)
|
|
129
|
+
.toDate(),
|
|
130
|
+
dateModified: moment(acceptPayAction.endDate)
|
|
124
131
|
.toDate()
|
|
125
132
|
};
|
|
126
133
|
console.log(
|
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
const project = { id: String(process.env.PROJECT_ID) };
|
|
8
|
+
|
|
9
|
+
async function main() {
|
|
10
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
11
|
+
|
|
12
|
+
const now = new Date();
|
|
13
|
+
const actionRepo = await chevre.repository.Action.createInstance(mongoose.connection);
|
|
14
|
+
const recipe: chevre.factory.action.trade.pay.IPayCreditCardRecipe & {
|
|
15
|
+
recipeFor: { id: string; typeOf: chevre.factory.actionType };
|
|
16
|
+
dateCreated: Date;
|
|
17
|
+
dateModified: Date;
|
|
18
|
+
} = {
|
|
19
|
+
project: { id: project.id, typeOf: chevre.factory.organizationType.Project },
|
|
20
|
+
typeOf: 'Recipe',
|
|
21
|
+
recipeCategory: chevre.factory.recipe.RecipeCategory.payCreditCard,
|
|
22
|
+
recipeFor: { id: 'xxxx', typeOf: chevre.factory.actionType.PayAction },
|
|
23
|
+
step: [{
|
|
24
|
+
typeOf: 'HowToSection',
|
|
25
|
+
itemListElement: [
|
|
26
|
+
{
|
|
27
|
+
typeOf: 'HowToStep',
|
|
28
|
+
identifier: chevre.factory.recipe.StepIdentifier.searchTrade,
|
|
29
|
+
itemListElement: [{
|
|
30
|
+
typeOf: 'HowToDirection'
|
|
31
|
+
// beforeMedia: (<any>paymentMethodsByTransaction).entryTranArgs,
|
|
32
|
+
// afterMedia: (<any>paymentMethodsByTransaction).entryTranResult
|
|
33
|
+
}]
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
typeOf: 'HowToStep',
|
|
37
|
+
identifier: chevre.factory.recipe.StepIdentifier.alterTran,
|
|
38
|
+
itemListElement: [{
|
|
39
|
+
typeOf: 'HowToDirection'
|
|
40
|
+
// beforeMedia: (<any>paymentMethodsByTransaction).execTranArgs,
|
|
41
|
+
}]
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
}],
|
|
45
|
+
dateCreated: now,
|
|
46
|
+
dateModified: now
|
|
47
|
+
};
|
|
48
|
+
const result = await actionRepo.saveRecipeWithDateCreated(recipe);
|
|
49
|
+
console.log(result);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
main()
|
|
53
|
+
.then()
|
|
54
|
+
.catch(console.error);
|
|
@@ -10,7 +10,17 @@ async function main() {
|
|
|
10
10
|
|
|
11
11
|
const actionRepo = await chevre.repository.Action.createInstance(mongoose.connection);
|
|
12
12
|
|
|
13
|
-
let mkknInfos = await actionRepo.searchMkknInfoByCheckMovieTicketResult({
|
|
13
|
+
// let mkknInfos = await actionRepo.searchMkknInfoByCheckMovieTicketResult({
|
|
14
|
+
// limit: 10,
|
|
15
|
+
// page: 1,
|
|
16
|
+
// id: '666171386c7acb70fd9a44ec',
|
|
17
|
+
// project: { id: project.id },
|
|
18
|
+
// purpose: { id: '6661712a6c7acb70fd9a44a8' }
|
|
19
|
+
// });
|
|
20
|
+
// console.log('mkknInfos found', mkknInfos);
|
|
21
|
+
// console.log(mkknInfos.length, 'infos found');
|
|
22
|
+
|
|
23
|
+
const mkknInfos = await actionRepo.searchMkknInfoByCheckRecipe({
|
|
14
24
|
limit: 10,
|
|
15
25
|
page: 1,
|
|
16
26
|
id: '666171386c7acb70fd9a44ec',
|
|
@@ -20,27 +30,17 @@ async function main() {
|
|
|
20
30
|
console.log('mkknInfos found', mkknInfos);
|
|
21
31
|
console.log(mkknInfos.length, 'infos found');
|
|
22
32
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
});
|
|
30
|
-
console.log('
|
|
31
|
-
console.log(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
limit: 10,
|
|
35
|
-
page: 1,
|
|
36
|
-
id: '666171386c7acb70fd9a44ec',
|
|
37
|
-
project: { id: project.id },
|
|
38
|
-
purpose: { id: '6661712a6c7acb70fd9a44a8' }
|
|
39
|
-
});
|
|
40
|
-
console.log('ykknInfos found', ykknInfos);
|
|
41
|
-
console.log(ykknInfos.length, 'infos found');
|
|
42
|
-
|
|
43
|
-
ykknInfos = await actionRepo.searchYkknInfoByCheckRecipe({
|
|
33
|
+
// let ykknInfos = await actionRepo.searchYkknInfoByCheckMovieTicketResult({
|
|
34
|
+
// limit: 10,
|
|
35
|
+
// page: 1,
|
|
36
|
+
// id: '666171386c7acb70fd9a44ec',
|
|
37
|
+
// project: { id: project.id },
|
|
38
|
+
// purpose: { id: '6661712a6c7acb70fd9a44a8' }
|
|
39
|
+
// });
|
|
40
|
+
// console.log('ykknInfos found', ykknInfos);
|
|
41
|
+
// console.log(ykknInfos.length, 'infos found');
|
|
42
|
+
|
|
43
|
+
const ykknInfos = await actionRepo.searchYkknInfoByCheckRecipe({
|
|
44
44
|
limit: 10,
|
|
45
45
|
page: 1,
|
|
46
46
|
id: '666171386c7acb70fd9a44ec',
|
|
@@ -4,28 +4,40 @@ import * as mongoose from 'mongoose';
|
|
|
4
4
|
|
|
5
5
|
import { chevre } from '../../../lib/index';
|
|
6
6
|
|
|
7
|
+
const DAYS = 180;
|
|
7
8
|
async function main() {
|
|
8
9
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
9
10
|
|
|
11
|
+
const now = new Date();
|
|
10
12
|
let updateResult: any;
|
|
11
13
|
|
|
12
14
|
const assetTransactionRepo = await chevre.repository.AssetTransaction.createInstance(mongoose.connection);
|
|
13
15
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
// tslint:disable-next-line:no-magic-numbers
|
|
17
|
+
const hours = DAYS * 24;
|
|
18
|
+
// tslint:disable-next-line:no-increment-decrement no-magic-numbers
|
|
19
|
+
for (let index = 0; index < hours; index++) {
|
|
20
|
+
updateResult = await assetTransactionRepo.unsetUnnecessaryFields({
|
|
21
|
+
filter: {
|
|
22
|
+
startDate: {
|
|
23
|
+
$gte: moment(now)
|
|
24
|
+
.add(-(index + 1), 'hours')
|
|
25
|
+
.toDate(),
|
|
26
|
+
$lt: moment(now)
|
|
27
|
+
.add(-index, 'hours')
|
|
28
|
+
.toDate()
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
$unset: {
|
|
32
|
+
__v: 1,
|
|
33
|
+
createdAt: 1,
|
|
34
|
+
updatedAt: 1
|
|
20
35
|
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
console.log('unset processed.', updateResult);
|
|
36
|
+
});
|
|
37
|
+
console.log('unset processed.', updateResult, -(index + 1), 'hours', -index, 'hours');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
console.log(DAYS, 'days processed');
|
|
29
41
|
}
|
|
30
42
|
|
|
31
43
|
main()
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
/// <reference types="mongoose/types/virtuals" />
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
import { factory as surfrockFactory } from '@surfrock/sdk';
|
|
26
|
-
import { Connection, FilterQuery } from 'mongoose';
|
|
26
|
+
import { Connection, FilterQuery, QueryOptions } from 'mongoose';
|
|
27
27
|
import * as factory from '../factory';
|
|
28
28
|
export type IAction<T extends factory.actionType> = T extends factory.actionType.OrderAction ? factory.action.trade.order.IAction : T extends factory.actionType.AuthorizeAction ? factory.action.authorize.IAction<factory.action.authorize.IAttributes<any, any>> : factory.action.IAction<factory.action.IAttributes<T, any, any>>;
|
|
29
29
|
export type IPayAction = factory.action.trade.pay.IAction;
|
|
@@ -60,6 +60,18 @@ export interface ICancelActionAction {
|
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
62
|
export type IActionRecipe<T extends factory.recipe.RecipeCategory> = T extends factory.recipe.RecipeCategory.checkMovieTicket ? factory.action.check.paymentMethod.movieTicket.IRecipe : T extends factory.recipe.RecipeCategory.payCreditCard ? factory.action.trade.pay.IPayCreditCardRecipe : T extends factory.recipe.RecipeCategory.payMovieTicket ? factory.action.trade.pay.IPayMovieTicketRecipe : T extends factory.recipe.RecipeCategory.publishPaymentUrl ? factory.action.accept.pay.IRecipe : T extends factory.recipe.RecipeCategory.refundCreditCard ? factory.action.trade.refund.IRefundCreditCardRecipe : T extends factory.recipe.RecipeCategory.refundMovieTicket ? factory.action.trade.refund.IRefundMovieTicketRecipe : T extends factory.recipe.RecipeCategory.acceptCOAOffer ? factory.action.accept.coaOffer.IRecipe : T extends factory.recipe.RecipeCategory.confirmCOAReserve ? factory.action.interact.confirm.reservation.IConfirmCOAReserveRecipe : never;
|
|
63
|
+
export type IRecipeAsDocument = factory.recipe.IRecipe & {
|
|
64
|
+
recipeFor: {
|
|
65
|
+
id: string;
|
|
66
|
+
typeOf: factory.actionType;
|
|
67
|
+
};
|
|
68
|
+
dateCreated: Date;
|
|
69
|
+
dateModified?: Date;
|
|
70
|
+
};
|
|
71
|
+
export type IRecipeAsActionAttributes = Pick<factory.recipe.IRecipe, 'project' | 'recipeCategory' | 'step' | 'typeOf'>;
|
|
72
|
+
export type IMinimizedPurchaseNumberAuthResult = Pick<factory.action.check.paymentMethod.movieTicket.IPurchaseNumberAuthResult, 'mkknmiNumSum' | 'resultInfo' | 'ykknmiNumSum'> & {
|
|
73
|
+
knyknrNoInfoOut: Omit<factory.action.check.paymentMethod.movieTicket.IPurchaseNumberInfo, 'ykknInfo' | 'mkknInfo'>[] | null;
|
|
74
|
+
};
|
|
63
75
|
/**
|
|
64
76
|
* アクションリポジトリ
|
|
65
77
|
*/
|
|
@@ -75,7 +87,9 @@ export declare class MongoRepository {
|
|
|
75
87
|
/**
|
|
76
88
|
* アクション開始
|
|
77
89
|
*/
|
|
78
|
-
start<T extends factory.actionType>(attributes: factory.action.IAttributes<T, any, any
|
|
90
|
+
start<T extends factory.actionType>(attributes: factory.action.IAttributes<T, any, any>, options?: {
|
|
91
|
+
recipe?: IRecipeAsActionAttributes;
|
|
92
|
+
}): Promise<IAction<T>>;
|
|
79
93
|
/**
|
|
80
94
|
* アクション完了
|
|
81
95
|
*/
|
|
@@ -83,13 +97,13 @@ export declare class MongoRepository {
|
|
|
83
97
|
typeOf: T;
|
|
84
98
|
id: string;
|
|
85
99
|
result: any;
|
|
86
|
-
recipe?:
|
|
100
|
+
recipe?: IRecipeAsActionAttributes;
|
|
87
101
|
}): Promise<IAction<T>>;
|
|
88
102
|
completeWithVoid(params: {
|
|
89
103
|
typeOf: factory.actionType;
|
|
90
104
|
id: string;
|
|
91
105
|
result: any;
|
|
92
|
-
recipe?:
|
|
106
|
+
recipe?: IRecipeAsActionAttributes;
|
|
93
107
|
}): Promise<void>;
|
|
94
108
|
/**
|
|
95
109
|
* アクション取消
|
|
@@ -119,7 +133,9 @@ export declare class MongoRepository {
|
|
|
119
133
|
* アクション再開
|
|
120
134
|
*/
|
|
121
135
|
reStart(params: {
|
|
136
|
+
typeOf: factory.actionType;
|
|
122
137
|
id: string;
|
|
138
|
+
recipe?: IRecipeAsActionAttributes;
|
|
123
139
|
}): Promise<void>;
|
|
124
140
|
/**
|
|
125
141
|
* 一定期間ActiveActionStatusのアクションをFailedActionStatusにする
|
|
@@ -204,7 +220,7 @@ export declare class MongoRepository {
|
|
|
204
220
|
updateAuthorizeEventOfferAction(params: {
|
|
205
221
|
id: string;
|
|
206
222
|
object: factory.action.authorize.offer.eventService.IObject<factory.service.webAPI.Identifier.COA>;
|
|
207
|
-
result: factory.action.authorize.offer.eventService.IResult
|
|
223
|
+
result: factory.action.authorize.offer.eventService.IResult;
|
|
208
224
|
}): Promise<factory.action.authorize.offer.eventService.IAction<factory.service.webAPI.Identifier.COA>>;
|
|
209
225
|
updateById(params: {
|
|
210
226
|
id: string;
|
|
@@ -223,38 +239,6 @@ export declare class MongoRepository {
|
|
|
223
239
|
};
|
|
224
240
|
entranceGateIdentifier: string;
|
|
225
241
|
}): Promise<IUseActionCountByOffer[]>;
|
|
226
|
-
searchYkknInfoByCheckMovieTicketResult(filter: {
|
|
227
|
-
limit: number;
|
|
228
|
-
page: number;
|
|
229
|
-
/**
|
|
230
|
-
* 認証アクションID
|
|
231
|
-
*/
|
|
232
|
-
id: string;
|
|
233
|
-
project: {
|
|
234
|
-
id: string;
|
|
235
|
-
};
|
|
236
|
-
purpose: {
|
|
237
|
-
id: string;
|
|
238
|
-
};
|
|
239
|
-
}): Promise<(surfrockFactory.service.auth.purchaseNumberAuth.IValidTicket & {
|
|
240
|
-
knyknrNo: string;
|
|
241
|
-
})[]>;
|
|
242
|
-
searchMkknInfoByCheckMovieTicketResult(filter: {
|
|
243
|
-
limit: number;
|
|
244
|
-
page: number;
|
|
245
|
-
/**
|
|
246
|
-
* 認証アクションID
|
|
247
|
-
*/
|
|
248
|
-
id: string;
|
|
249
|
-
project: {
|
|
250
|
-
id: string;
|
|
251
|
-
};
|
|
252
|
-
purpose: {
|
|
253
|
-
id: string;
|
|
254
|
-
};
|
|
255
|
-
}): Promise<(surfrockFactory.service.auth.purchaseNumberAuth.INvalidTicket & {
|
|
256
|
-
knyknrNo: string;
|
|
257
|
-
})[]>;
|
|
258
242
|
searchYkknInfoByCheckRecipe(filter: {
|
|
259
243
|
limit: number;
|
|
260
244
|
page: number;
|
|
@@ -316,9 +300,9 @@ export declare class MongoRepository {
|
|
|
316
300
|
}): Promise<{
|
|
317
301
|
deletedCount?: number;
|
|
318
302
|
} | null>;
|
|
319
|
-
saveRecipeWithDateCreated(savingRecipe:
|
|
320
|
-
|
|
321
|
-
}): Promise<import("mongodb").
|
|
303
|
+
saveRecipeWithDateCreated(savingRecipe: IRecipeAsDocument & {
|
|
304
|
+
dateModified: Date;
|
|
305
|
+
}): Promise<import("mongodb").UpdateResult>;
|
|
322
306
|
findRecipeByAction<T extends factory.recipe.RecipeCategory>(params: {
|
|
323
307
|
project: {
|
|
324
308
|
id: string;
|
|
@@ -327,6 +311,14 @@ export declare class MongoRepository {
|
|
|
327
311
|
id: string;
|
|
328
312
|
};
|
|
329
313
|
}): Promise<Pick<IActionRecipe<T>, 'step' | 'recipeCategory'> | null>;
|
|
314
|
+
findIMinimizedPurchaseNumberAuthResultByCheckMovieTicketRecipe(params: {
|
|
315
|
+
project: {
|
|
316
|
+
id: string;
|
|
317
|
+
};
|
|
318
|
+
recipeFor: {
|
|
319
|
+
id: string;
|
|
320
|
+
};
|
|
321
|
+
}): Promise<IMinimizedPurchaseNumberAuthResult | undefined>;
|
|
330
322
|
aggregateAuthorizeEventServiceOfferAction(params: {
|
|
331
323
|
project?: {
|
|
332
324
|
id?: {
|
|
@@ -397,7 +389,7 @@ export declare class MongoRepository {
|
|
|
397
389
|
startFrom: Date;
|
|
398
390
|
startThrough: Date;
|
|
399
391
|
}): Promise<IAggregateAction>;
|
|
400
|
-
getCursor(conditions: any, projection: any): import("mongoose").Cursor<any,
|
|
392
|
+
getCursor(conditions: any, projection: any): import("mongoose").Cursor<any, QueryOptions<any>>;
|
|
401
393
|
unsetUnnecessaryFields(params: {
|
|
402
394
|
filter: FilterQuery<factory.action.IAction<factory.action.IAttributes<factory.actionType, any, any>>>;
|
|
403
395
|
$unset: any;
|
|
@@ -417,6 +409,6 @@ export declare class MongoRepository {
|
|
|
417
409
|
};
|
|
418
410
|
}): Promise<void>;
|
|
419
411
|
private agggregateByStatus;
|
|
420
|
-
private
|
|
412
|
+
private upsertRecipe;
|
|
421
413
|
}
|
|
422
414
|
export {};
|