@chevre/domain 21.34.0-alpha.0 → 21.34.0-alpha.2
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/migratePayCreditCardRecipes.ts +8 -2
- package/example/src/chevre/migratePayMovieTicketRecipes.ts +8 -2
- package/example/src/chevre/migrateTransactionObjectPaymentMethods.ts +8 -1
- package/example/src/chevre/saveRecipe.ts +54 -0
- package/example/src/chevre/unsetUnnecessaryFields.ts +26 -14
- package/lib/chevre/repo/action.d.ts +22 -9
- package/lib/chevre/repo/action.js +72 -15
- package/lib/chevre/repo/mongoose/schemas/actionRecipe.js +2 -1
- package/lib/chevre/service/assetTransaction/pay.js +1 -3
- package/lib/chevre/service/assetTransaction/reserveCOA/factory.d.ts +15 -0
- package/lib/chevre/service/assetTransaction/reserveCOA/factory.js +31 -0
- package/lib/chevre/service/assetTransaction/reserveCOA.d.ts +2 -5
- package/lib/chevre/service/assetTransaction/reserveCOA.js +15 -4
- 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 +1 -2
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +1 -1
- 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 +1 -2
- package/lib/chevre/service/payment/creditCard/refundCreditCard.js +1 -2
- package/lib/chevre/service/payment/movieTicket/checkMovieTicket.js +1 -2
- package/lib/chevre/service/payment/movieTicket/factory.d.ts +0 -12
- package/lib/chevre/service/payment/movieTicket/factory.js +3 -7
- package/lib/chevre/service/payment/movieTicket/payMovieTicket.js +6 -4
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket.js +3 -2
- package/lib/chevre/service/task/confirmReserveTransaction.js +11 -26
- package/package.json +2 -2
|
@@ -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
|
});
|
|
@@ -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
|
},
|
|
@@ -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(
|
|
@@ -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.MovieTicket }
|
|
21
21
|
},
|
|
@@ -58,7 +58,11 @@ async function main() {
|
|
|
58
58
|
throw new Error('seatInfoSyncResultByPayAction undefined');
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
const recipe: chevre.factory.action.trade.pay.IPayMovieTicketRecipe & {
|
|
61
|
+
const recipe: chevre.factory.action.trade.pay.IPayMovieTicketRecipe & {
|
|
62
|
+
recipeFor: { id: string; typeOf: chevre.factory.actionType };
|
|
63
|
+
dateCreated: Date;
|
|
64
|
+
dateModified: Date;
|
|
65
|
+
} = {
|
|
62
66
|
project: { id: payAction.project.id, typeOf: chevre.factory.organizationType.Project },
|
|
63
67
|
typeOf: 'Recipe',
|
|
64
68
|
recipeCategory: chevre.factory.recipe.RecipeCategory.payMovieTicket,
|
|
@@ -78,6 +82,8 @@ async function main() {
|
|
|
78
82
|
]
|
|
79
83
|
}],
|
|
80
84
|
dateCreated: moment(payAction.endDate)
|
|
85
|
+
.toDate(),
|
|
86
|
+
dateModified: moment(payAction.endDate)
|
|
81
87
|
.toDate()
|
|
82
88
|
};
|
|
83
89
|
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);
|
|
@@ -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,15 @@ 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'>;
|
|
63
72
|
/**
|
|
64
73
|
* アクションリポジトリ
|
|
65
74
|
*/
|
|
@@ -75,7 +84,9 @@ export declare class MongoRepository {
|
|
|
75
84
|
/**
|
|
76
85
|
* アクション開始
|
|
77
86
|
*/
|
|
78
|
-
start<T extends factory.actionType>(attributes: factory.action.IAttributes<T, any, any
|
|
87
|
+
start<T extends factory.actionType>(attributes: factory.action.IAttributes<T, any, any>, options?: {
|
|
88
|
+
recipe?: IRecipeAsActionAttributes;
|
|
89
|
+
}): Promise<IAction<T>>;
|
|
79
90
|
/**
|
|
80
91
|
* アクション完了
|
|
81
92
|
*/
|
|
@@ -83,13 +94,13 @@ export declare class MongoRepository {
|
|
|
83
94
|
typeOf: T;
|
|
84
95
|
id: string;
|
|
85
96
|
result: any;
|
|
86
|
-
recipe?:
|
|
97
|
+
recipe?: IRecipeAsActionAttributes;
|
|
87
98
|
}): Promise<IAction<T>>;
|
|
88
99
|
completeWithVoid(params: {
|
|
89
100
|
typeOf: factory.actionType;
|
|
90
101
|
id: string;
|
|
91
102
|
result: any;
|
|
92
|
-
recipe?:
|
|
103
|
+
recipe?: IRecipeAsActionAttributes;
|
|
93
104
|
}): Promise<void>;
|
|
94
105
|
/**
|
|
95
106
|
* アクション取消
|
|
@@ -119,7 +130,9 @@ export declare class MongoRepository {
|
|
|
119
130
|
* アクション再開
|
|
120
131
|
*/
|
|
121
132
|
reStart(params: {
|
|
133
|
+
typeOf: factory.actionType;
|
|
122
134
|
id: string;
|
|
135
|
+
recipe?: IRecipeAsActionAttributes;
|
|
123
136
|
}): Promise<void>;
|
|
124
137
|
/**
|
|
125
138
|
* 一定期間ActiveActionStatusのアクションをFailedActionStatusにする
|
|
@@ -316,9 +329,9 @@ export declare class MongoRepository {
|
|
|
316
329
|
}): Promise<{
|
|
317
330
|
deletedCount?: number;
|
|
318
331
|
} | null>;
|
|
319
|
-
saveRecipeWithDateCreated(savingRecipe:
|
|
320
|
-
|
|
321
|
-
}): Promise<import("mongodb").
|
|
332
|
+
saveRecipeWithDateCreated(savingRecipe: IRecipeAsDocument & {
|
|
333
|
+
dateModified: Date;
|
|
334
|
+
}): Promise<import("mongodb").UpdateResult>;
|
|
322
335
|
findRecipeByAction<T extends factory.recipe.RecipeCategory>(params: {
|
|
323
336
|
project: {
|
|
324
337
|
id: string;
|
|
@@ -397,7 +410,7 @@ export declare class MongoRepository {
|
|
|
397
410
|
startFrom: Date;
|
|
398
411
|
startThrough: Date;
|
|
399
412
|
}): Promise<IAggregateAction>;
|
|
400
|
-
getCursor(conditions: any, projection: any): import("mongoose").Cursor<any,
|
|
413
|
+
getCursor(conditions: any, projection: any): import("mongoose").Cursor<any, QueryOptions<any>>;
|
|
401
414
|
unsetUnnecessaryFields(params: {
|
|
402
415
|
filter: FilterQuery<factory.action.IAction<factory.action.IAttributes<factory.actionType, any, any>>>;
|
|
403
416
|
$unset: any;
|
|
@@ -417,6 +430,6 @@ export declare class MongoRepository {
|
|
|
417
430
|
};
|
|
418
431
|
}): Promise<void>;
|
|
419
432
|
private agggregateByStatus;
|
|
420
|
-
private
|
|
433
|
+
private upsertRecipe;
|
|
421
434
|
}
|
|
422
435
|
export {};
|
|
@@ -459,10 +459,16 @@ class MongoRepository {
|
|
|
459
459
|
/**
|
|
460
460
|
* アクション開始
|
|
461
461
|
*/
|
|
462
|
-
start(attributes) {
|
|
462
|
+
start(attributes, options) {
|
|
463
463
|
return __awaiter(this, void 0, void 0, function* () {
|
|
464
|
-
|
|
464
|
+
const startedAction = yield this.actionModel.create(Object.assign(Object.assign({}, attributes), { actionStatus: factory.actionStatusType.ActiveActionStatus, startDate: new Date() }))
|
|
465
465
|
.then((doc) => doc.toObject());
|
|
466
|
+
// add recipe(2024-06-09~)
|
|
467
|
+
const savingRecipe = options === null || options === void 0 ? void 0 : options.recipe;
|
|
468
|
+
if ((savingRecipe === null || savingRecipe === void 0 ? void 0 : savingRecipe.typeOf) === 'Recipe') {
|
|
469
|
+
yield this.upsertRecipe(Object.assign(Object.assign({}, savingRecipe), { recipeFor: { id: startedAction.id, typeOf: startedAction.typeOf } }));
|
|
470
|
+
}
|
|
471
|
+
return startedAction;
|
|
466
472
|
});
|
|
467
473
|
}
|
|
468
474
|
/**
|
|
@@ -472,15 +478,17 @@ class MongoRepository {
|
|
|
472
478
|
var _a;
|
|
473
479
|
return __awaiter(this, void 0, void 0, function* () {
|
|
474
480
|
if (((_a = params.recipe) === null || _a === void 0 ? void 0 : _a.typeOf) === 'Recipe') {
|
|
475
|
-
yield this.
|
|
481
|
+
yield this.upsertRecipe(Object.assign(Object.assign({}, params.recipe), { recipeFor: { id: params.id, typeOf: params.typeOf } }));
|
|
476
482
|
}
|
|
477
483
|
const doc = yield this.actionModel.findOneAndUpdate({
|
|
478
|
-
typeOf: params.typeOf,
|
|
479
|
-
_id: params.id
|
|
484
|
+
typeOf: { $eq: params.typeOf },
|
|
485
|
+
_id: { $eq: params.id }
|
|
480
486
|
}, {
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
487
|
+
$set: {
|
|
488
|
+
actionStatus: factory.actionStatusType.CompletedActionStatus,
|
|
489
|
+
result: params.result,
|
|
490
|
+
endDate: new Date()
|
|
491
|
+
}
|
|
484
492
|
}, { new: true })
|
|
485
493
|
.select({ __v: 0, createdAt: 0, updatedAt: 0 })
|
|
486
494
|
.exec();
|
|
@@ -494,15 +502,17 @@ class MongoRepository {
|
|
|
494
502
|
var _a;
|
|
495
503
|
return __awaiter(this, void 0, void 0, function* () {
|
|
496
504
|
if (((_a = params.recipe) === null || _a === void 0 ? void 0 : _a.typeOf) === 'Recipe') {
|
|
497
|
-
yield this.
|
|
505
|
+
yield this.upsertRecipe(Object.assign(Object.assign({}, params.recipe), { recipeFor: { id: params.id, typeOf: params.typeOf } }));
|
|
498
506
|
}
|
|
499
507
|
const doc = yield this.actionModel.findOneAndUpdate({
|
|
500
508
|
_id: { $eq: params.id },
|
|
501
509
|
typeOf: { $eq: params.typeOf }
|
|
502
510
|
}, {
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
511
|
+
$set: {
|
|
512
|
+
actionStatus: factory.actionStatusType.CompletedActionStatus,
|
|
513
|
+
result: params.result,
|
|
514
|
+
endDate: new Date()
|
|
515
|
+
}
|
|
506
516
|
}, { new: false, projection: { _id: 1 } })
|
|
507
517
|
.exec();
|
|
508
518
|
if (doc === null) {
|
|
@@ -597,9 +607,11 @@ class MongoRepository {
|
|
|
597
607
|
* アクション再開
|
|
598
608
|
*/
|
|
599
609
|
reStart(params) {
|
|
610
|
+
var _a;
|
|
600
611
|
return __awaiter(this, void 0, void 0, function* () {
|
|
601
612
|
const doc = yield this.actionModel.findOneAndUpdate({
|
|
602
613
|
_id: { $eq: params.id },
|
|
614
|
+
typeOf: { $eq: params.typeOf },
|
|
603
615
|
actionStatus: { $eq: factory.actionStatusType.CompletedActionStatus }
|
|
604
616
|
}, {
|
|
605
617
|
$set: {
|
|
@@ -612,6 +624,10 @@ class MongoRepository {
|
|
|
612
624
|
if (doc === null) {
|
|
613
625
|
throw new factory.errors.NotFound(this.actionModel.modelName);
|
|
614
626
|
}
|
|
627
|
+
// add recipe(2024-06-09~)
|
|
628
|
+
if (((_a = params.recipe) === null || _a === void 0 ? void 0 : _a.typeOf) === 'Recipe') {
|
|
629
|
+
yield this.upsertRecipe(Object.assign(Object.assign({}, params.recipe), { recipeFor: { id: params.id, typeOf: params.typeOf } }));
|
|
630
|
+
}
|
|
615
631
|
});
|
|
616
632
|
}
|
|
617
633
|
/**
|
|
@@ -1056,7 +1072,22 @@ class MongoRepository {
|
|
|
1056
1072
|
}
|
|
1057
1073
|
saveRecipeWithDateCreated(savingRecipe) {
|
|
1058
1074
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1059
|
-
|
|
1075
|
+
const { typeOf, project, recipeCategory, recipeFor, step, dateCreated, dateModified } = savingRecipe;
|
|
1076
|
+
const filter = {
|
|
1077
|
+
'recipeFor.id': { $eq: recipeFor.id }
|
|
1078
|
+
};
|
|
1079
|
+
const setOnInsert = { project, typeOf, recipeCategory, recipeFor, dateCreated };
|
|
1080
|
+
const setKeys = { step, dateModified };
|
|
1081
|
+
const update = {
|
|
1082
|
+
$setOnInsert: setOnInsert,
|
|
1083
|
+
$set: setKeys
|
|
1084
|
+
};
|
|
1085
|
+
const options = {
|
|
1086
|
+
upsert: true,
|
|
1087
|
+
rawResult: true
|
|
1088
|
+
};
|
|
1089
|
+
return this.actionRecipeModel.updateOne(filter, update, options)
|
|
1090
|
+
.exec();
|
|
1060
1091
|
});
|
|
1061
1092
|
}
|
|
1062
1093
|
findRecipeByAction(params) {
|
|
@@ -1366,9 +1397,35 @@ class MongoRepository {
|
|
|
1366
1397
|
};
|
|
1367
1398
|
});
|
|
1368
1399
|
}
|
|
1369
|
-
|
|
1400
|
+
upsertRecipe(savingRecipe) {
|
|
1370
1401
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1371
|
-
|
|
1402
|
+
const dateModified = new Date();
|
|
1403
|
+
const { typeOf, project, recipeCategory, recipeFor, step } = savingRecipe;
|
|
1404
|
+
const filter = {
|
|
1405
|
+
'recipeFor.id': { $eq: recipeFor.id }
|
|
1406
|
+
};
|
|
1407
|
+
const setOnInsert = {
|
|
1408
|
+
project, typeOf, recipeCategory, recipeFor,
|
|
1409
|
+
dateCreated: dateModified
|
|
1410
|
+
};
|
|
1411
|
+
const setKeys = { step, dateModified };
|
|
1412
|
+
const update = {
|
|
1413
|
+
$setOnInsert: setOnInsert,
|
|
1414
|
+
$set: setKeys
|
|
1415
|
+
};
|
|
1416
|
+
const options = {
|
|
1417
|
+
upsert: true,
|
|
1418
|
+
rawResult: true
|
|
1419
|
+
};
|
|
1420
|
+
return this.actionRecipeModel.updateOne(filter, update, options)
|
|
1421
|
+
.exec();
|
|
1422
|
+
// return this.actionRecipeModel.insertMany<factory.recipe.IRecipe & { dateCreated: Date }>(
|
|
1423
|
+
// {
|
|
1424
|
+
// ...savingRecipe,
|
|
1425
|
+
// dateCreated: new Date()
|
|
1426
|
+
// },
|
|
1427
|
+
// { rawResult: true }
|
|
1428
|
+
// );
|
|
1372
1429
|
// const result = await this.actionRecipeModel.insertMany<IRecipe>(savingRecipe, { rawResult: true });
|
|
1373
1430
|
// const id = result.insertedIds?.[0]?.toHexString();
|
|
1374
1431
|
// if (typeof id !== 'string') {
|
|
@@ -20,12 +20,11 @@ const validation_1 = require("./pay/account/validation");
|
|
|
20
20
|
const factory_1 = require("./pay/factory");
|
|
21
21
|
const debug = createDebug('chevre-domain:service:assetTransaction');
|
|
22
22
|
function publishPaymentUrlResult2recipe(params) {
|
|
23
|
-
const { project,
|
|
23
|
+
const { project, result } = params;
|
|
24
24
|
return {
|
|
25
25
|
project: { id: project.id, typeOf: factory.organizationType.Project },
|
|
26
26
|
typeOf: 'Recipe',
|
|
27
27
|
recipeCategory: factory.recipe.RecipeCategory.publishPaymentUrl,
|
|
28
|
-
recipeFor: { id: action.id, typeOf: action.typeOf },
|
|
29
28
|
step: [{
|
|
30
29
|
typeOf: 'HowToSection',
|
|
31
30
|
itemListElement: [
|
|
@@ -116,7 +115,6 @@ function publishPaymentUrl(params, options) {
|
|
|
116
115
|
// create recipe(2024-06-02~)
|
|
117
116
|
recipe = publishPaymentUrlResult2recipe({
|
|
118
117
|
project: { id: params.project.id },
|
|
119
|
-
action: { id: action.id, typeOf: action.typeOf },
|
|
120
118
|
result
|
|
121
119
|
});
|
|
122
120
|
break;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type * as COA from '@motionpicture/coa-service';
|
|
2
|
+
import * as factory from '../../../factory';
|
|
3
|
+
interface IProcessConfirmCOAReserveResult {
|
|
4
|
+
stateReserveArgs?: COA.factory.reserve.IStateReserveArgs;
|
|
5
|
+
stateReserveResult?: COA.factory.reserve.IStateReserveResult | null;
|
|
6
|
+
updReserveArgs?: COA.factory.reserve.IUpdReserveArgs;
|
|
7
|
+
updReserveResult?: COA.factory.reserve.IUpdReserveResult;
|
|
8
|
+
}
|
|
9
|
+
declare function processConfirmCOAReserveResult2recipe(params: {
|
|
10
|
+
processConfirmCOAReserveResult: IProcessConfirmCOAReserveResult;
|
|
11
|
+
project: {
|
|
12
|
+
id: string;
|
|
13
|
+
};
|
|
14
|
+
}): factory.action.interact.confirm.reservation.IConfirmCOAReserveRecipe;
|
|
15
|
+
export { IProcessConfirmCOAReserveResult, processConfirmCOAReserveResult2recipe };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.processConfirmCOAReserveResult2recipe = void 0;
|
|
4
|
+
const factory = require("../../../factory");
|
|
5
|
+
function processConfirmCOAReserveResult2recipe(params) {
|
|
6
|
+
const { processConfirmCOAReserveResult, project } = params;
|
|
7
|
+
const { stateReserveArgs, stateReserveResult, updReserveArgs, updReserveResult } = processConfirmCOAReserveResult;
|
|
8
|
+
return {
|
|
9
|
+
project: { id: project.id, typeOf: factory.organizationType.Project },
|
|
10
|
+
typeOf: 'Recipe',
|
|
11
|
+
recipeCategory: factory.recipe.RecipeCategory.confirmCOAReserve,
|
|
12
|
+
step: [{
|
|
13
|
+
typeOf: 'HowToSection',
|
|
14
|
+
itemListElement: [
|
|
15
|
+
{
|
|
16
|
+
typeOf: 'HowToStep',
|
|
17
|
+
identifier: factory.recipe.StepIdentifier.stateReserve,
|
|
18
|
+
itemListElement: [Object.assign(Object.assign({ typeOf: 'HowToDirection' }, (stateReserveArgs !== undefined) ? { beforeMedia: stateReserveArgs } : undefined), (stateReserveResult !== undefined && stateReserveResult !== null)
|
|
19
|
+
? { afterMedia: stateReserveResult }
|
|
20
|
+
: undefined)]
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
typeOf: 'HowToStep',
|
|
24
|
+
identifier: factory.recipe.StepIdentifier.updReserve,
|
|
25
|
+
itemListElement: [Object.assign(Object.assign({ typeOf: 'HowToDirection' }, (updReserveArgs !== undefined) ? { beforeMedia: updReserveArgs } : undefined), (updReserveResult !== undefined) ? { afterMedia: updReserveResult } : undefined)]
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}]
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
exports.processConfirmCOAReserveResult2recipe = processConfirmCOAReserveResult2recipe;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* COA予約取引サービス
|
|
3
|
-
*/
|
|
4
|
-
import * as COA from '@motionpicture/coa-service';
|
|
5
1
|
import * as factory from '../../factory';
|
|
2
|
+
import { IProcessConfirmCOAReserveResult } from './reserveCOA/factory';
|
|
6
3
|
interface IConfirmRepo {
|
|
7
4
|
}
|
|
8
5
|
type IConfirmOperation<T> = (repos: IConfirmRepo) => Promise<T>;
|
|
@@ -15,5 +12,5 @@ declare function confirm(params: {
|
|
|
15
12
|
};
|
|
16
13
|
object: factory.action.interact.confirm.reservation.IObject4COA;
|
|
17
14
|
purpose: factory.action.interact.confirm.reservation.IPurpose;
|
|
18
|
-
}): IConfirmOperation<
|
|
15
|
+
}): IConfirmOperation<IProcessConfirmCOAReserveResult>;
|
|
19
16
|
export { confirm };
|
|
@@ -25,6 +25,10 @@ const coaAuthClient = new COA.auth.RefreshToken({
|
|
|
25
25
|
*/
|
|
26
26
|
function confirm(params) {
|
|
27
27
|
return (__) => __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
let stateReserveArgs;
|
|
29
|
+
let stateReserveResult;
|
|
30
|
+
let updReserveArgs;
|
|
31
|
+
let updReserveResult;
|
|
28
32
|
// 未本予約であれば実行(COA本予約は一度成功すると成功できない)
|
|
29
33
|
// リトライ可能な前提でつくる必要があるので、要注意
|
|
30
34
|
// すでに本予約済みかどうか確認
|
|
@@ -32,15 +36,22 @@ function confirm(params) {
|
|
|
32
36
|
endpoint: credentials_1.credentials.coa.endpoint,
|
|
33
37
|
auth: coaAuthClient
|
|
34
38
|
}, { timeout: credentials_1.credentials.coa.timeout });
|
|
35
|
-
|
|
39
|
+
stateReserveArgs = {
|
|
36
40
|
theaterCode: params.object.theaterCode,
|
|
37
41
|
reserveNum: params.object.tmpReserveNum,
|
|
38
42
|
telNum: params.object.telNum
|
|
39
|
-
}
|
|
43
|
+
};
|
|
44
|
+
stateReserveResult = yield reserveService.stateReserve(stateReserveArgs);
|
|
40
45
|
if (stateReserveResult === null) {
|
|
41
|
-
|
|
46
|
+
updReserveArgs = params.object;
|
|
47
|
+
updReserveResult = yield reserveService.updReserve(updReserveArgs);
|
|
42
48
|
}
|
|
43
|
-
return
|
|
49
|
+
return {
|
|
50
|
+
stateReserveArgs,
|
|
51
|
+
stateReserveResult,
|
|
52
|
+
updReserveArgs,
|
|
53
|
+
updReserveResult
|
|
54
|
+
};
|
|
44
55
|
});
|
|
45
56
|
}
|
|
46
57
|
exports.confirm = confirm;
|
|
@@ -19,9 +19,5 @@ declare function processUpdTmpReserveSeatResult2recipe(params: {
|
|
|
19
19
|
project: {
|
|
20
20
|
id: string;
|
|
21
21
|
};
|
|
22
|
-
action: {
|
|
23
|
-
id: string;
|
|
24
|
-
typeOf: factory.actionType;
|
|
25
|
-
};
|
|
26
22
|
}): factory.action.accept.coaOffer.IRecipe;
|
|
27
23
|
export { IAcceptedOfferWithoutDetail, createUpdTmpReserveSeatArgs, processUpdTmpReserveSeatResult2recipe };
|
|
@@ -20,13 +20,12 @@ function createUpdTmpReserveSeatArgs(params) {
|
|
|
20
20
|
}
|
|
21
21
|
exports.createUpdTmpReserveSeatArgs = createUpdTmpReserveSeatArgs;
|
|
22
22
|
function processUpdTmpReserveSeatResult2recipe(params) {
|
|
23
|
-
const { processUpdTmpReserveSeatResult, project
|
|
23
|
+
const { processUpdTmpReserveSeatResult, project } = params;
|
|
24
24
|
const { updTmpReserveSeatArgs, updTmpReserveSeatResult } = processUpdTmpReserveSeatResult;
|
|
25
25
|
return {
|
|
26
26
|
project: { id: project.id, typeOf: factory.organizationType.Project },
|
|
27
27
|
typeOf: 'Recipe',
|
|
28
28
|
recipeCategory: factory.recipe.RecipeCategory.acceptCOAOffer,
|
|
29
|
-
recipeFor: { id: action.id, typeOf: action.typeOf },
|
|
30
29
|
step: [{
|
|
31
30
|
typeOf: 'HowToSection',
|
|
32
31
|
itemListElement: [
|
|
@@ -101,8 +101,7 @@ function acceptOffer(params) {
|
|
|
101
101
|
updTmpReserveSeatArgs: requestBody,
|
|
102
102
|
updTmpReserveSeatResult: responseBody
|
|
103
103
|
},
|
|
104
|
-
project: { id: transaction.project.id }
|
|
105
|
-
action: { id: action.id, typeOf: action.typeOf }
|
|
104
|
+
project: { id: transaction.project.id }
|
|
106
105
|
});
|
|
107
106
|
const result = {
|
|
108
107
|
object: {
|
|
@@ -99,7 +99,7 @@ function changeOffers(params) {
|
|
|
99
99
|
});
|
|
100
100
|
const actionResult = Object.assign(Object.assign({}, authorizeAction.result), { price: price, amount: eligibleMonetaryAmount, acceptedOffers: [] });
|
|
101
101
|
// ActiveActionStatus->CompletedActionStatusで再実装(2024-01-15~)
|
|
102
|
-
yield repos.action.reStart({ id: authorizeAction.id });
|
|
102
|
+
yield repos.action.reStart({ id: authorizeAction.id, typeOf: authorizeAction.typeOf });
|
|
103
103
|
try {
|
|
104
104
|
// まずvoidAcceptedOffer
|
|
105
105
|
// const orderNumberByTransaction = transaction.object.orderNumber;
|
|
@@ -17,19 +17,11 @@ declare function processAlterTranResult2payRecipe(params: {
|
|
|
17
17
|
project: {
|
|
18
18
|
id: string;
|
|
19
19
|
};
|
|
20
|
-
action: {
|
|
21
|
-
id: string;
|
|
22
|
-
typeOf: factory.actionType;
|
|
23
|
-
};
|
|
24
20
|
}): factory.action.trade.pay.IPayCreditCardRecipe;
|
|
25
21
|
declare function processAlterTranResult2refundRecipe(params: {
|
|
26
22
|
processAlterTranResult: IProcessAlterTranResult4refund;
|
|
27
23
|
project: {
|
|
28
24
|
id: string;
|
|
29
25
|
};
|
|
30
|
-
action: {
|
|
31
|
-
id: string;
|
|
32
|
-
typeOf: factory.actionType;
|
|
33
|
-
};
|
|
34
26
|
}): factory.action.trade.refund.IRefundCreditCardRecipe;
|
|
35
27
|
export { IProcessAlterTranResult, IProcessAlterTranResult4refund, processAlterTranResult2payRecipe, processAlterTranResult2refundRecipe };
|
|
@@ -3,12 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.processAlterTranResult2refundRecipe = exports.processAlterTranResult2payRecipe = void 0;
|
|
4
4
|
const factory = require("../../../factory");
|
|
5
5
|
function processAlterTranResult2payRecipe(params) {
|
|
6
|
-
const { processAlterTranResults, project
|
|
6
|
+
const { processAlterTranResults, project } = params;
|
|
7
7
|
return {
|
|
8
8
|
project: { id: project.id, typeOf: factory.organizationType.Project },
|
|
9
9
|
typeOf: 'Recipe',
|
|
10
10
|
recipeCategory: factory.recipe.RecipeCategory.payCreditCard,
|
|
11
|
-
recipeFor: { id: action.id, typeOf: action.typeOf },
|
|
12
11
|
step: processAlterTranResults.map(({ searchTradeArgs, searchTradeResult, alterTranArgs, alterTranResult }) => {
|
|
13
12
|
return {
|
|
14
13
|
typeOf: 'HowToSection',
|
|
@@ -30,13 +29,12 @@ function processAlterTranResult2payRecipe(params) {
|
|
|
30
29
|
}
|
|
31
30
|
exports.processAlterTranResult2payRecipe = processAlterTranResult2payRecipe;
|
|
32
31
|
function processAlterTranResult2refundRecipe(params) {
|
|
33
|
-
const { processAlterTranResult, project
|
|
32
|
+
const { processAlterTranResult, project } = params;
|
|
34
33
|
const { searchTradeArgs, searchTradeResult, alterTranResult, alterTranArgs } = processAlterTranResult;
|
|
35
34
|
return {
|
|
36
35
|
project: { id: project.id, typeOf: factory.organizationType.Project },
|
|
37
36
|
typeOf: 'Recipe',
|
|
38
37
|
recipeCategory: factory.recipe.RecipeCategory.refundCreditCard,
|
|
39
|
-
recipeFor: { id: action.id, typeOf: action.typeOf },
|
|
40
38
|
step: [{
|
|
41
39
|
typeOf: 'HowToSection',
|
|
42
40
|
itemListElement: [
|
|
@@ -67,8 +67,7 @@ function payCreditCard(params) {
|
|
|
67
67
|
// add recipe(2024-06-03~)
|
|
68
68
|
recipe = (0, factory_1.processAlterTranResult2payRecipe)({
|
|
69
69
|
processAlterTranResults,
|
|
70
|
-
project: { id: params.project.id }
|
|
71
|
-
action: { id: action.id, typeOf: action.typeOf }
|
|
70
|
+
project: { id: params.project.id }
|
|
72
71
|
});
|
|
73
72
|
}
|
|
74
73
|
catch (error) {
|
|
@@ -93,8 +93,7 @@ function refundCreditCard(params, options) {
|
|
|
93
93
|
// add recipe(2024-06-04~)
|
|
94
94
|
recipe = (0, factory_1.processAlterTranResult2refundRecipe)({
|
|
95
95
|
processAlterTranResult,
|
|
96
|
-
project: { id: params.project.id }
|
|
97
|
-
action: { id: action.id, typeOf: action.typeOf }
|
|
96
|
+
project: { id: params.project.id }
|
|
98
97
|
});
|
|
99
98
|
}
|
|
100
99
|
catch (error) {
|
|
@@ -82,8 +82,7 @@ function checkMovieTicket(params) {
|
|
|
82
82
|
// add recipe(2024-06-07~)
|
|
83
83
|
recipe = (0, factory_1.processPurchaseNumberAuthResult2checkRecipe)({
|
|
84
84
|
processPurchaseNumberAuthResult,
|
|
85
|
-
project: { id: params.project.id }
|
|
86
|
-
action: { id: action.id, typeOf: action.typeOf }
|
|
85
|
+
project: { id: params.project.id }
|
|
87
86
|
});
|
|
88
87
|
}
|
|
89
88
|
catch (error) {
|
|
@@ -30,20 +30,12 @@ declare function processPurchaseNumberAuthResult2checkRecipe(params: {
|
|
|
30
30
|
project: {
|
|
31
31
|
id: string;
|
|
32
32
|
};
|
|
33
|
-
action: {
|
|
34
|
-
id: string;
|
|
35
|
-
typeOf: factory.actionType;
|
|
36
|
-
};
|
|
37
33
|
}): factory.action.check.paymentMethod.movieTicket.IRecipe;
|
|
38
34
|
declare function processSeatInfoSyncResult2payRecipe(params: {
|
|
39
35
|
processSeatInfoSyncResult: IProcessSeatInfoSyncResult;
|
|
40
36
|
project: {
|
|
41
37
|
id: string;
|
|
42
38
|
};
|
|
43
|
-
action: {
|
|
44
|
-
id: string;
|
|
45
|
-
typeOf: factory.actionType;
|
|
46
|
-
};
|
|
47
39
|
}): factory.action.trade.pay.IPayMovieTicketRecipe;
|
|
48
40
|
declare function processSeatInfoSyncResult2refundRecipe(params: {
|
|
49
41
|
processSeatInfoSyncResult?: IProcessSeatInfoSyncResult;
|
|
@@ -51,10 +43,6 @@ declare function processSeatInfoSyncResult2refundRecipe(params: {
|
|
|
51
43
|
project: {
|
|
52
44
|
id: string;
|
|
53
45
|
};
|
|
54
|
-
action: {
|
|
55
|
-
id: string;
|
|
56
|
-
typeOf: factory.actionType;
|
|
57
|
-
};
|
|
58
46
|
}): factory.action.trade.refund.IRefundMovieTicketRecipe;
|
|
59
47
|
declare enum MovieticketReserveRequestErrorMessage {
|
|
60
48
|
AlreadyPaid = "\u65E2\u306B\u5B58\u5728\u3059\u308B\u8208\u884C\u30B7\u30B9\u30C6\u30E0\u5EA7\u5E2D\u4E88\u7D04\u756A\u53F7\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F\u3002",
|
|
@@ -92,13 +92,12 @@ function createStartingPayAction(params, seatInfoSyncIn) {
|
|
|
92
92
|
}
|
|
93
93
|
exports.createStartingPayAction = createStartingPayAction;
|
|
94
94
|
function processPurchaseNumberAuthResult2checkRecipe(params) {
|
|
95
|
-
const { processPurchaseNumberAuthResult, project
|
|
95
|
+
const { processPurchaseNumberAuthResult, project } = params;
|
|
96
96
|
const { purchaseNumberAuthIn, purchaseNumberAuthResult } = processPurchaseNumberAuthResult;
|
|
97
97
|
return {
|
|
98
98
|
project: { id: project.id, typeOf: factory.organizationType.Project },
|
|
99
99
|
typeOf: 'Recipe',
|
|
100
100
|
recipeCategory: factory.recipe.RecipeCategory.checkMovieTicket,
|
|
101
|
-
recipeFor: { id: action.id, typeOf: action.typeOf },
|
|
102
101
|
step: [{
|
|
103
102
|
typeOf: 'HowToSection',
|
|
104
103
|
itemListElement: [
|
|
@@ -113,13 +112,12 @@ function processPurchaseNumberAuthResult2checkRecipe(params) {
|
|
|
113
112
|
}
|
|
114
113
|
exports.processPurchaseNumberAuthResult2checkRecipe = processPurchaseNumberAuthResult2checkRecipe;
|
|
115
114
|
function processSeatInfoSyncResult2payRecipe(params) {
|
|
116
|
-
const { processSeatInfoSyncResult, project
|
|
115
|
+
const { processSeatInfoSyncResult, project } = params;
|
|
117
116
|
const { seatInfoSyncIn, seatInfoSyncResult } = processSeatInfoSyncResult;
|
|
118
117
|
return {
|
|
119
118
|
project: { id: project.id, typeOf: factory.organizationType.Project },
|
|
120
119
|
typeOf: 'Recipe',
|
|
121
120
|
recipeCategory: factory.recipe.RecipeCategory.payMovieTicket,
|
|
122
|
-
recipeFor: { id: action.id, typeOf: action.typeOf },
|
|
123
121
|
step: [{
|
|
124
122
|
typeOf: 'HowToSection',
|
|
125
123
|
itemListElement: [
|
|
@@ -134,14 +132,13 @@ function processSeatInfoSyncResult2payRecipe(params) {
|
|
|
134
132
|
}
|
|
135
133
|
exports.processSeatInfoSyncResult2payRecipe = processSeatInfoSyncResult2payRecipe;
|
|
136
134
|
function processSeatInfoSyncResult2refundRecipe(params) {
|
|
137
|
-
const { processSeatInfoSyncResult, processSeatInfoSyncCancelResult, project
|
|
135
|
+
const { processSeatInfoSyncResult, processSeatInfoSyncCancelResult, project } = params;
|
|
138
136
|
if (processSeatInfoSyncResult !== undefined) {
|
|
139
137
|
const { seatInfoSyncIn, seatInfoSyncResult } = processSeatInfoSyncResult;
|
|
140
138
|
return {
|
|
141
139
|
project: { id: project.id, typeOf: factory.organizationType.Project },
|
|
142
140
|
typeOf: 'Recipe',
|
|
143
141
|
recipeCategory: factory.recipe.RecipeCategory.refundMovieTicket,
|
|
144
|
-
recipeFor: { id: action.id, typeOf: action.typeOf },
|
|
145
142
|
step: [{
|
|
146
143
|
typeOf: 'HowToSection',
|
|
147
144
|
itemListElement: [
|
|
@@ -160,7 +157,6 @@ function processSeatInfoSyncResult2refundRecipe(params) {
|
|
|
160
157
|
project: { id: project.id, typeOf: factory.organizationType.Project },
|
|
161
158
|
typeOf: 'Recipe',
|
|
162
159
|
recipeCategory: factory.recipe.RecipeCategory.refundMovieTicket,
|
|
163
|
-
recipeFor: { id: action.id, typeOf: action.typeOf },
|
|
164
160
|
step: [{
|
|
165
161
|
typeOf: 'HowToSection',
|
|
166
162
|
itemListElement: [
|
|
@@ -28,9 +28,12 @@ function payMovieTicket(params) {
|
|
|
28
28
|
const paymentServiceId = (_b = params.object[0]) === null || _b === void 0 ? void 0 : _b.id;
|
|
29
29
|
const seatInfoSyncIn = yield payActionParams2seatInfoSyncIn(params)(repos);
|
|
30
30
|
const startingAction = (0, factory_1.createStartingPayAction)(params, seatInfoSyncIn);
|
|
31
|
-
let
|
|
31
|
+
let recipe = (0, factory_1.processSeatInfoSyncResult2payRecipe)({
|
|
32
|
+
processSeatInfoSyncResult: { seatInfoSyncIn },
|
|
33
|
+
project: { id: params.project.id }
|
|
34
|
+
});
|
|
35
|
+
let action = yield repos.action.start(startingAction, { recipe });
|
|
32
36
|
let processSeatInfoSyncResult;
|
|
33
|
-
let recipe;
|
|
34
37
|
try {
|
|
35
38
|
// 着券済に対する冪等性を確保する必要はあるが、
|
|
36
39
|
// その他のアクションとしての振る舞いは実行される必要もある
|
|
@@ -67,8 +70,7 @@ function payMovieTicket(params) {
|
|
|
67
70
|
// add recipe(2024-06-03~)
|
|
68
71
|
recipe = (0, factory_1.processSeatInfoSyncResult2payRecipe)({
|
|
69
72
|
processSeatInfoSyncResult,
|
|
70
|
-
project: { id: params.project.id }
|
|
71
|
-
action: { id: action.id, typeOf: action.typeOf }
|
|
73
|
+
project: { id: params.project.id }
|
|
72
74
|
});
|
|
73
75
|
}
|
|
74
76
|
catch (error) {
|
|
@@ -55,8 +55,9 @@ function refundMovieTicket(params) {
|
|
|
55
55
|
})({ action: repos.action });
|
|
56
56
|
}
|
|
57
57
|
const instrument = Object.assign(Object.assign({ typeOf: factory.service.paymentService.PaymentServiceType.MovieTicket }, (seatInfoSyncIn !== undefined) ? { seatInfoSyncIn } : undefined), (seatInfoSyncCancelIn !== undefined) ? { seatInfoSyncCancelIn } : undefined);
|
|
58
|
+
let recipe = (0, factory_1.processSeatInfoSyncResult2refundRecipe)(Object.assign(Object.assign({ project: { id: params.project.id } }, (seatInfoSyncIn !== undefined) ? { processSeatInfoSyncResult: { seatInfoSyncIn } } : undefined), (seatInfoSyncCancelIn !== undefined) ? { processSeatInfoSyncCancelResult: { seatInfoSyncCancelIn } } : undefined));
|
|
58
59
|
let action = yield repos.action.start(Object.assign(Object.assign(Object.assign({}, params), (typeof ((_g = params.sameAs) === null || _g === void 0 ? void 0 : _g.id) === 'string') ? { sameAs: { id: params.sameAs.id, typeOf: 'Task' } } : undefined), { instrument // instrumentをセット(2024-04-30~)
|
|
59
|
-
}));
|
|
60
|
+
}), { recipe });
|
|
60
61
|
let processSeatInfoSyncCancelResult;
|
|
61
62
|
let processSeatInfoSyncResult;
|
|
62
63
|
try {
|
|
@@ -95,7 +96,7 @@ function refundMovieTicket(params) {
|
|
|
95
96
|
}
|
|
96
97
|
else {
|
|
97
98
|
// add recipe(2024-06-04~)
|
|
98
|
-
|
|
99
|
+
recipe = (0, factory_1.processSeatInfoSyncResult2refundRecipe)(Object.assign(Object.assign({ project: { id: params.project.id } }, (processSeatInfoSyncResult !== undefined) ? { processSeatInfoSyncResult } : undefined), (processSeatInfoSyncCancelResult !== undefined) ? { processSeatInfoSyncCancelResult } : undefined));
|
|
99
100
|
const actionResult = Object.assign(Object.assign({}, ((processSeatInfoSyncResult === null || processSeatInfoSyncResult === void 0 ? void 0 : processSeatInfoSyncResult.seatInfoSyncResult) !== undefined)
|
|
100
101
|
? { seatInfoSyncResult: processSeatInfoSyncResult.seatInfoSyncResult }
|
|
101
102
|
: undefined), ((processSeatInfoSyncCancelResult === null || processSeatInfoSyncCancelResult === void 0 ? void 0 : processSeatInfoSyncCancelResult.seatInfoSyncCancelResult) !== undefined)
|
|
@@ -14,7 +14,7 @@ const createDebug = require("debug");
|
|
|
14
14
|
const google_libphonenumber_1 = require("google-libphonenumber");
|
|
15
15
|
const util_1 = require("util");
|
|
16
16
|
const factory = require("../../factory");
|
|
17
|
-
|
|
17
|
+
const settings_1 = require("../../settings");
|
|
18
18
|
const acceptedOffer_1 = require("../../repo/acceptedOffer");
|
|
19
19
|
const action_1 = require("../../repo/action");
|
|
20
20
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
@@ -23,6 +23,7 @@ const reservation_1 = require("../../repo/reservation");
|
|
|
23
23
|
const task_1 = require("../../repo/task");
|
|
24
24
|
const ReserveTransactionService = require("../assetTransaction/reserve");
|
|
25
25
|
const COAReserveService = require("../assetTransaction/reserveCOA");
|
|
26
|
+
const factory_1 = require("../assetTransaction/reserveCOA/factory");
|
|
26
27
|
const debug = createDebug('chevre-domain:service:task');
|
|
27
28
|
/**
|
|
28
29
|
* タスク実行関数
|
|
@@ -104,8 +105,6 @@ function createConfirmObject4COAByOrder(params) {
|
|
|
104
105
|
mailAddr: mailAddr,
|
|
105
106
|
reserveAmount: totalPrice,
|
|
106
107
|
listTicket
|
|
107
|
-
// transactionNumber: reservationNumber,
|
|
108
|
-
// typeOf: 'COAReserveTransaction'
|
|
109
108
|
};
|
|
110
109
|
}
|
|
111
110
|
function fixOrderAsPurpose(params) {
|
|
@@ -116,7 +115,6 @@ function fixOrderAsPurpose(params) {
|
|
|
116
115
|
limit: 1,
|
|
117
116
|
page: 1,
|
|
118
117
|
project: { id: { $eq: params.project.id } },
|
|
119
|
-
// confirmationNumbers: [payPurposeConfirmationNumber],
|
|
120
118
|
orderNumbers: [purposeOrderNumber]
|
|
121
119
|
}, { customer: 1, orderNumber: 1, typeOf: 1 });
|
|
122
120
|
order = orders.shift();
|
|
@@ -137,9 +135,7 @@ function confirmReserveTransaction(params, options) {
|
|
|
137
135
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
138
136
|
let confirmActionObject;
|
|
139
137
|
switch (params.object.typeOf) {
|
|
140
|
-
// switch (params.instrument.identifier) {
|
|
141
138
|
case 'COAReserveTransaction':
|
|
142
|
-
// case factory.service.webAPI.Identifier.COA:
|
|
143
139
|
// 最適化されたタスクに対応するため、ここでIObject4COAを注文から生成する(2024-01-24~)
|
|
144
140
|
const order = yield fixOrderAsPurpose({
|
|
145
141
|
project: { id: params.project.id },
|
|
@@ -148,41 +144,30 @@ function confirmReserveTransaction(params, options) {
|
|
|
148
144
|
const updReserveArgs = createConfirmObject4COAByOrder({ order, reservationNumber: params.object.transactionNumber });
|
|
149
145
|
debug('confirming coa reserve transaction...', order, updReserveArgs);
|
|
150
146
|
const object4coa = Object.assign(Object.assign({}, updReserveArgs), { transactionNumber: params.object.transactionNumber, typeOf: 'COAReserveTransaction' });
|
|
151
|
-
// if (USE_OPTIMIZED_CONFIRM_RESERVE_COA_TASK_VERIFY) {
|
|
152
|
-
// const isValidObject = JSON.stringify(object4coa) === JSON.stringify(params.object);
|
|
153
|
-
// debug('confirmActionObject === params.object?', isValidObject);
|
|
154
|
-
// if (!isValidObject) {
|
|
155
|
-
// throw new factory.errors.Argument('object', 'object4coa !== params.object');
|
|
156
|
-
// }
|
|
157
|
-
// }
|
|
158
|
-
// 上書き
|
|
159
147
|
confirmActionObject = object4coa;
|
|
160
|
-
// if (USE_OPTIMIZED_CONFIRM_RESERVE_COA_TASK) {
|
|
161
|
-
// // 上書き
|
|
162
|
-
// confirmActionObject = object4coa;
|
|
163
|
-
// } else {
|
|
164
|
-
// confirmActionObject = <factory.action.interact.confirm.reservation.IObject4COA>params.object;
|
|
165
|
-
// }
|
|
166
148
|
break;
|
|
167
149
|
default:
|
|
168
150
|
confirmActionObject = params.object;
|
|
169
151
|
}
|
|
170
|
-
// アクション開始
|
|
171
152
|
const confirmActionAttributes = Object.assign(Object.assign({}, params), { object: confirmActionObject });
|
|
172
153
|
const action = yield repos.action.start(confirmActionAttributes);
|
|
173
154
|
let updReserveResult;
|
|
155
|
+
let recipe;
|
|
174
156
|
try {
|
|
175
157
|
const object = confirmActionAttributes.object;
|
|
176
158
|
switch (object.typeOf) {
|
|
177
|
-
// switch (params.instrument.identifier) {
|
|
178
159
|
case 'COAReserveTransaction':
|
|
179
|
-
// case factory.service.webAPI.Identifier.COA:
|
|
180
160
|
// COA本予約
|
|
181
|
-
|
|
161
|
+
const processConfirmCOAReserveResult = yield COAReserveService.confirm({
|
|
182
162
|
project: { id: confirmActionAttributes.project.id },
|
|
183
163
|
object: object,
|
|
184
164
|
purpose: confirmActionAttributes.purpose
|
|
185
165
|
})({});
|
|
166
|
+
updReserveResult = processConfirmCOAReserveResult.updReserveResult;
|
|
167
|
+
recipe = (0, factory_1.processConfirmCOAReserveResult2recipe)({
|
|
168
|
+
processConfirmCOAReserveResult,
|
|
169
|
+
project: { id: confirmActionAttributes.project.id }
|
|
170
|
+
});
|
|
186
171
|
break;
|
|
187
172
|
default:
|
|
188
173
|
// 予約取引確定
|
|
@@ -201,9 +186,9 @@ function confirmReserveTransaction(params, options) {
|
|
|
201
186
|
}
|
|
202
187
|
throw error;
|
|
203
188
|
}
|
|
204
|
-
// アクション完了
|
|
205
189
|
const result = { updReserveResult };
|
|
206
|
-
yield repos.action.completeWithVoid({ typeOf: confirmActionAttributes.typeOf, id: action.id, result: result })
|
|
190
|
+
yield repos.action.completeWithVoid(Object.assign({ typeOf: confirmActionAttributes.typeOf, id: action.id, result: result }, (settings_1.USE_EXPERIMENTAL_FEATURE && recipe !== undefined) ? { recipe } : undefined // add recipe(2024-06-08~)
|
|
191
|
+
));
|
|
207
192
|
// sendOrder連携(2024-01-11~)
|
|
208
193
|
yield onConfirmed(confirmActionAttributes, options)({
|
|
209
194
|
task: repos.task
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/credential-providers": "3.433.0",
|
|
13
|
-
"@chevre/factory": "4.374.0-alpha.
|
|
13
|
+
"@chevre/factory": "4.374.0-alpha.10",
|
|
14
14
|
"@cinerino/sdk": "7.1.0",
|
|
15
15
|
"@motionpicture/coa-service": "9.4.0",
|
|
16
16
|
"@motionpicture/gmo-service": "5.3.0",
|
|
@@ -110,5 +110,5 @@
|
|
|
110
110
|
"postversion": "git push origin --tags",
|
|
111
111
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
112
112
|
},
|
|
113
|
-
"version": "21.34.0-alpha.
|
|
113
|
+
"version": "21.34.0-alpha.2"
|
|
114
114
|
}
|