@chevre/domain 21.33.0 → 21.34.0-alpha.1
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/migratePayCreditCardRecipes.ts +1 -1
- package/example/src/chevre/migratePayMovieTicketRecipes.ts +1 -1
- package/example/src/chevre/migrateTransactionObjectPaymentMethods.ts +1 -1
- package/lib/chevre/repo/action.d.ts +6 -3
- package/lib/chevre/repo/action.js +20 -7
- package/lib/chevre/service/assetTransaction/pay.js +4 -4
- package/lib/chevre/service/assetTransaction/reserveCOA/factory.d.ts +19 -0
- package/lib/chevre/service/assetTransaction/reserveCOA/factory.js +32 -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 +16 -4
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer/factory.js +23 -1
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.js +10 -1
- package/lib/chevre/service/payment/creditCard/payCreditCard.js +4 -3
- package/lib/chevre/service/payment/creditCard/refundCreditCard.js +4 -3
- package/lib/chevre/service/payment/movieTicket/checkMovieTicket.js +7 -8
- package/lib/chevre/service/payment/movieTicket/payMovieTicket.js +4 -3
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket.js +2 -2
- package/lib/chevre/service/task/confirmReserveTransaction.js +12 -26
- package/package.json +2 -2
|
@@ -88,7 +88,7 @@ async function main() {
|
|
|
88
88
|
'saving recipe...',
|
|
89
89
|
payAction.project.id, payAction.id, payAction.startDate, i);
|
|
90
90
|
// console.dir(recipe, { depth: null });
|
|
91
|
-
await actionRepo.
|
|
91
|
+
await actionRepo.saveRecipeWithDateCreated(recipe);
|
|
92
92
|
saveRecipeCount += 1;
|
|
93
93
|
console.log('recipe saved.', payAction.project.id, payAction.id, payAction.startDate, i);
|
|
94
94
|
}
|
|
@@ -84,7 +84,7 @@ async function main() {
|
|
|
84
84
|
'saving recipe...',
|
|
85
85
|
payAction.project.id, payAction.id, payAction.startDate, i);
|
|
86
86
|
// console.dir(recipe, { depth: null });
|
|
87
|
-
await actionRepo.
|
|
87
|
+
await actionRepo.saveRecipeWithDateCreated(recipe);
|
|
88
88
|
saveRecipeCount += 1;
|
|
89
89
|
console.log('recipe saved.', payAction.project.id, payAction.id, payAction.startDate, i);
|
|
90
90
|
}
|
|
@@ -127,7 +127,7 @@ async function main() {
|
|
|
127
127
|
'saving recipe...',
|
|
128
128
|
placeOrder.project.id, placeOrder.id, placeOrder.startDate, i);
|
|
129
129
|
// console.dir(recipe, { depth: null });
|
|
130
|
-
await actionRepo.
|
|
130
|
+
await actionRepo.saveRecipeWithDateCreated(recipe);
|
|
131
131
|
saveRecipeCount += 1;
|
|
132
132
|
console.log('recipe saved.', placeOrder.project.id, placeOrder.id, placeOrder.startDate, i);
|
|
133
133
|
}
|
|
@@ -59,7 +59,7 @@ export interface ICancelActionAction {
|
|
|
59
59
|
typeOf: 'Task';
|
|
60
60
|
};
|
|
61
61
|
}
|
|
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 : never;
|
|
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
63
|
/**
|
|
64
64
|
* アクションリポジトリ
|
|
65
65
|
*/
|
|
@@ -83,11 +83,13 @@ export declare class MongoRepository {
|
|
|
83
83
|
typeOf: T;
|
|
84
84
|
id: string;
|
|
85
85
|
result: any;
|
|
86
|
+
recipe?: factory.recipe.IRecipe;
|
|
86
87
|
}): Promise<IAction<T>>;
|
|
87
88
|
completeWithVoid(params: {
|
|
88
89
|
typeOf: factory.actionType;
|
|
89
90
|
id: string;
|
|
90
91
|
result: any;
|
|
92
|
+
recipe?: factory.recipe.IRecipe;
|
|
91
93
|
}): Promise<void>;
|
|
92
94
|
/**
|
|
93
95
|
* アクション取消
|
|
@@ -314,8 +316,8 @@ export declare class MongoRepository {
|
|
|
314
316
|
}): Promise<{
|
|
315
317
|
deletedCount?: number;
|
|
316
318
|
} | null>;
|
|
317
|
-
|
|
318
|
-
dateCreated
|
|
319
|
+
saveRecipeWithDateCreated(savingRecipe: factory.recipe.IRecipe & {
|
|
320
|
+
dateCreated: Date;
|
|
319
321
|
}): Promise<import("mongodb").InsertManyResult<any>>;
|
|
320
322
|
findRecipeByAction<T extends factory.recipe.RecipeCategory>(params: {
|
|
321
323
|
project: {
|
|
@@ -415,5 +417,6 @@ export declare class MongoRepository {
|
|
|
415
417
|
};
|
|
416
418
|
}): Promise<void>;
|
|
417
419
|
private agggregateByStatus;
|
|
420
|
+
private saveRecipe;
|
|
418
421
|
}
|
|
419
422
|
export {};
|
|
@@ -469,7 +469,11 @@ class MongoRepository {
|
|
|
469
469
|
* アクション完了
|
|
470
470
|
*/
|
|
471
471
|
complete(params) {
|
|
472
|
+
var _a;
|
|
472
473
|
return __awaiter(this, void 0, void 0, function* () {
|
|
474
|
+
if (((_a = params.recipe) === null || _a === void 0 ? void 0 : _a.typeOf) === 'Recipe') {
|
|
475
|
+
yield this.saveRecipe(params.recipe);
|
|
476
|
+
}
|
|
473
477
|
const doc = yield this.actionModel.findOneAndUpdate({
|
|
474
478
|
typeOf: params.typeOf,
|
|
475
479
|
_id: params.id
|
|
@@ -487,7 +491,11 @@ class MongoRepository {
|
|
|
487
491
|
});
|
|
488
492
|
}
|
|
489
493
|
completeWithVoid(params) {
|
|
494
|
+
var _a;
|
|
490
495
|
return __awaiter(this, void 0, void 0, function* () {
|
|
496
|
+
if (((_a = params.recipe) === null || _a === void 0 ? void 0 : _a.typeOf) === 'Recipe') {
|
|
497
|
+
yield this.saveRecipe(params.recipe);
|
|
498
|
+
}
|
|
491
499
|
const doc = yield this.actionModel.findOneAndUpdate({
|
|
492
500
|
_id: { $eq: params.id },
|
|
493
501
|
typeOf: { $eq: params.typeOf }
|
|
@@ -1046,15 +1054,9 @@ class MongoRepository {
|
|
|
1046
1054
|
});
|
|
1047
1055
|
});
|
|
1048
1056
|
}
|
|
1049
|
-
|
|
1057
|
+
saveRecipeWithDateCreated(savingRecipe) {
|
|
1050
1058
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1051
1059
|
return this.actionRecipeModel.insertMany(Object.assign(Object.assign({}, savingRecipe), { dateCreated: (savingRecipe.dateCreated instanceof Date) ? savingRecipe.dateCreated : new Date() }), { rawResult: true });
|
|
1052
|
-
// const result = await this.actionRecipeModel.insertMany<IRecipe>(savingRecipe, { rawResult: true });
|
|
1053
|
-
// const id = result.insertedIds?.[0]?.toHexString();
|
|
1054
|
-
// if (typeof id !== 'string') {
|
|
1055
|
-
// throw new factory.errors.ServiceUnavailable('recipe not saved');
|
|
1056
|
-
// }
|
|
1057
|
-
// return { id };
|
|
1058
1060
|
});
|
|
1059
1061
|
}
|
|
1060
1062
|
findRecipeByAction(params) {
|
|
@@ -1364,5 +1366,16 @@ class MongoRepository {
|
|
|
1364
1366
|
};
|
|
1365
1367
|
});
|
|
1366
1368
|
}
|
|
1369
|
+
saveRecipe(savingRecipe) {
|
|
1370
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1371
|
+
return this.actionRecipeModel.insertMany(Object.assign(Object.assign({}, savingRecipe), { dateCreated: new Date() }), { rawResult: true });
|
|
1372
|
+
// const result = await this.actionRecipeModel.insertMany<IRecipe>(savingRecipe, { rawResult: true });
|
|
1373
|
+
// const id = result.insertedIds?.[0]?.toHexString();
|
|
1374
|
+
// if (typeof id !== 'string') {
|
|
1375
|
+
// throw new factory.errors.ServiceUnavailable('recipe not saved');
|
|
1376
|
+
// }
|
|
1377
|
+
// return { id };
|
|
1378
|
+
});
|
|
1379
|
+
}
|
|
1367
1380
|
}
|
|
1368
1381
|
exports.MongoRepository = MongoRepository;
|
|
@@ -85,6 +85,7 @@ function publishPaymentUrl(params, options) {
|
|
|
85
85
|
: undefined);
|
|
86
86
|
const action = yield repos.action.start(actionAttributes);
|
|
87
87
|
let result;
|
|
88
|
+
let recipe;
|
|
88
89
|
try {
|
|
89
90
|
switch (paymentServiceType) {
|
|
90
91
|
case factory.service.paymentService.PaymentServiceType.CreditCard:
|
|
@@ -113,12 +114,11 @@ function publishPaymentUrl(params, options) {
|
|
|
113
114
|
execTranResult: authorizeResult.execTranResult
|
|
114
115
|
};
|
|
115
116
|
// create recipe(2024-06-02~)
|
|
116
|
-
|
|
117
|
+
recipe = publishPaymentUrlResult2recipe({
|
|
117
118
|
project: { id: params.project.id },
|
|
118
119
|
action: { id: action.id, typeOf: action.typeOf },
|
|
119
120
|
result
|
|
120
|
-
})
|
|
121
|
-
debug('publishPaymentUrl: recipe saved.', JSON.stringify(saveRecipeResult));
|
|
121
|
+
});
|
|
122
122
|
break;
|
|
123
123
|
default:
|
|
124
124
|
throw new factory.errors.NotImplemented(`Payment service '${paymentServiceType}' not implemented`);
|
|
@@ -137,7 +137,7 @@ function publishPaymentUrl(params, options) {
|
|
|
137
137
|
paymentMethodId: result.paymentMethodId,
|
|
138
138
|
paymentUrl: result.paymentUrl
|
|
139
139
|
};
|
|
140
|
-
yield repos.action.completeWithVoid({ typeOf: actionAttributes.typeOf, id: action.id, result: actionResult });
|
|
140
|
+
yield repos.action.completeWithVoid({ typeOf: actionAttributes.typeOf, id: action.id, result: actionResult, recipe });
|
|
141
141
|
return result;
|
|
142
142
|
});
|
|
143
143
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
action: {
|
|
15
|
+
id: string;
|
|
16
|
+
typeOf: factory.actionType;
|
|
17
|
+
};
|
|
18
|
+
}): factory.action.interact.confirm.reservation.IConfirmCOAReserveRecipe;
|
|
19
|
+
export { IProcessConfirmCOAReserveResult, processConfirmCOAReserveResult2recipe };
|
|
@@ -0,0 +1,32 @@
|
|
|
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, action } = 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
|
+
recipeFor: { id: action.id, typeOf: action.typeOf },
|
|
13
|
+
step: [{
|
|
14
|
+
typeOf: 'HowToSection',
|
|
15
|
+
itemListElement: [
|
|
16
|
+
{
|
|
17
|
+
typeOf: 'HowToStep',
|
|
18
|
+
identifier: factory.recipe.StepIdentifier.stateReserve,
|
|
19
|
+
itemListElement: [Object.assign(Object.assign({ typeOf: 'HowToDirection' }, (stateReserveArgs !== undefined) ? { beforeMedia: stateReserveArgs } : undefined), (stateReserveResult !== undefined && stateReserveResult !== null)
|
|
20
|
+
? { afterMedia: stateReserveResult }
|
|
21
|
+
: undefined)]
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
typeOf: 'HowToStep',
|
|
25
|
+
identifier: factory.recipe.StepIdentifier.updReserve,
|
|
26
|
+
itemListElement: [Object.assign(Object.assign({ typeOf: 'HowToDirection' }, (updReserveArgs !== undefined) ? { beforeMedia: updReserveArgs } : undefined), (updReserveResult !== undefined) ? { afterMedia: updReserveResult } : undefined)]
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}]
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
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;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as COA from '@motionpicture/coa-service';
|
|
1
|
+
import * as factory from '../../../../factory';
|
|
3
2
|
type IAcceptedOfferWithoutDetail = factory.action.authorize.offer.eventService.IAcceptedOfferWithoutDetail<factory.service.webAPI.Identifier.COA> & {
|
|
4
3
|
additionalProperty?: factory.propertyValue.IPropertyValue<string>[];
|
|
5
4
|
ticketInfo: factory.action.authorize.offer.eventService.ICOATicketInfo & {
|
|
@@ -11,5 +10,18 @@ type IAcceptedOfferWithoutDetail = factory.action.authorize.offer.eventService.I
|
|
|
11
10
|
declare function createUpdTmpReserveSeatArgs(params: {
|
|
12
11
|
object: factory.action.authorize.offer.eventService.IObjectWithoutDetail<factory.service.webAPI.Identifier.COA>;
|
|
13
12
|
coaInfo: Pick<factory.event.screeningEvent.ICOAInfo, 'dateJouei' | 'screenCode' | 'theaterCode' | 'timeBegin' | 'timeEnd' | 'titleBranchNum' | 'titleCode'>;
|
|
14
|
-
}):
|
|
15
|
-
|
|
13
|
+
}): factory.action.accept.coaOffer.IUpdTmpReserveSeatArgs;
|
|
14
|
+
declare function processUpdTmpReserveSeatResult2recipe(params: {
|
|
15
|
+
processUpdTmpReserveSeatResult: {
|
|
16
|
+
updTmpReserveSeatArgs?: factory.action.accept.coaOffer.IUpdTmpReserveSeatArgs;
|
|
17
|
+
updTmpReserveSeatResult?: factory.action.accept.coaOffer.IUpdTmpReserveSeatResult;
|
|
18
|
+
};
|
|
19
|
+
project: {
|
|
20
|
+
id: string;
|
|
21
|
+
};
|
|
22
|
+
action: {
|
|
23
|
+
id: string;
|
|
24
|
+
typeOf: factory.actionType;
|
|
25
|
+
};
|
|
26
|
+
}): factory.action.accept.coaOffer.IRecipe;
|
|
27
|
+
export { IAcceptedOfferWithoutDetail, createUpdTmpReserveSeatArgs, processUpdTmpReserveSeatResult2recipe };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createUpdTmpReserveSeatArgs = void 0;
|
|
3
|
+
exports.processUpdTmpReserveSeatResult2recipe = exports.createUpdTmpReserveSeatArgs = void 0;
|
|
4
|
+
const factory = require("../../../../factory");
|
|
4
5
|
function createUpdTmpReserveSeatArgs(params) {
|
|
5
6
|
return {
|
|
6
7
|
theaterCode: params.coaInfo.theaterCode,
|
|
@@ -18,3 +19,24 @@ function createUpdTmpReserveSeatArgs(params) {
|
|
|
18
19
|
};
|
|
19
20
|
}
|
|
20
21
|
exports.createUpdTmpReserveSeatArgs = createUpdTmpReserveSeatArgs;
|
|
22
|
+
function processUpdTmpReserveSeatResult2recipe(params) {
|
|
23
|
+
const { processUpdTmpReserveSeatResult, project, action } = params;
|
|
24
|
+
const { updTmpReserveSeatArgs, updTmpReserveSeatResult } = processUpdTmpReserveSeatResult;
|
|
25
|
+
return {
|
|
26
|
+
project: { id: project.id, typeOf: factory.organizationType.Project },
|
|
27
|
+
typeOf: 'Recipe',
|
|
28
|
+
recipeCategory: factory.recipe.RecipeCategory.acceptCOAOffer,
|
|
29
|
+
recipeFor: { id: action.id, typeOf: action.typeOf },
|
|
30
|
+
step: [{
|
|
31
|
+
typeOf: 'HowToSection',
|
|
32
|
+
itemListElement: [
|
|
33
|
+
{
|
|
34
|
+
typeOf: 'HowToStep',
|
|
35
|
+
identifier: factory.recipe.StepIdentifier.updTmpReserveSeat,
|
|
36
|
+
itemListElement: [Object.assign(Object.assign({ typeOf: 'HowToDirection' }, (updTmpReserveSeatArgs !== undefined) ? { beforeMedia: updTmpReserveSeatArgs } : undefined), (updTmpReserveSeatResult !== undefined) ? { afterMedia: updTmpReserveSeatResult } : undefined)]
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
}]
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
exports.processUpdTmpReserveSeatResult2recipe = processUpdTmpReserveSeatResult2recipe;
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.reAcceptOffer = exports.acceptOffer = void 0;
|
|
13
13
|
const errorHandler_1 = require("../../../errorHandler");
|
|
14
14
|
const factory = require("../../../factory");
|
|
15
|
+
const settings_1 = require("../../../settings");
|
|
15
16
|
const authorize_1 = require("./acceptOffer/authorize");
|
|
16
17
|
const factory_1 = require("./acceptOffer/factory");
|
|
17
18
|
function findCOAInfo(params) {
|
|
@@ -95,6 +96,14 @@ function acceptOffer(params) {
|
|
|
95
96
|
}
|
|
96
97
|
throw error;
|
|
97
98
|
}
|
|
99
|
+
const recipe = (0, factory_1.processUpdTmpReserveSeatResult2recipe)({
|
|
100
|
+
processUpdTmpReserveSeatResult: {
|
|
101
|
+
updTmpReserveSeatArgs: requestBody,
|
|
102
|
+
updTmpReserveSeatResult: responseBody
|
|
103
|
+
},
|
|
104
|
+
project: { id: transaction.project.id },
|
|
105
|
+
action: { id: action.id, typeOf: action.typeOf }
|
|
106
|
+
});
|
|
98
107
|
const result = {
|
|
99
108
|
object: {
|
|
100
109
|
acceptedOffer,
|
|
@@ -103,7 +112,7 @@ function acceptOffer(params) {
|
|
|
103
112
|
result: { responseBody },
|
|
104
113
|
typeOf: factory.actionType.AuthorizeAction
|
|
105
114
|
};
|
|
106
|
-
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result });
|
|
115
|
+
yield repos.action.completeWithVoid(Object.assign({ typeOf: action.typeOf, id: action.id, result }, (settings_1.USE_EXPERIMENTAL_FEATURE) ? { recipe } : undefined));
|
|
107
116
|
});
|
|
108
117
|
}
|
|
109
118
|
exports.acceptOffer = acceptOffer;
|
|
@@ -43,6 +43,7 @@ function payCreditCard(params) {
|
|
|
43
43
|
let action = yield repos.action.start(params);
|
|
44
44
|
const alterTranResults = [];
|
|
45
45
|
const processAlterTranResults = [];
|
|
46
|
+
let recipe;
|
|
46
47
|
try {
|
|
47
48
|
const creditService = new GMO.service.Credit({
|
|
48
49
|
endpoint: String(availableChannel.serviceUrl),
|
|
@@ -64,11 +65,11 @@ function payCreditCard(params) {
|
|
|
64
65
|
}
|
|
65
66
|
})));
|
|
66
67
|
// add recipe(2024-06-03~)
|
|
67
|
-
|
|
68
|
+
recipe = (0, factory_1.processAlterTranResult2payRecipe)({
|
|
68
69
|
processAlterTranResults,
|
|
69
70
|
project: { id: params.project.id },
|
|
70
71
|
action: { id: action.id, typeOf: action.typeOf }
|
|
71
|
-
})
|
|
72
|
+
});
|
|
72
73
|
}
|
|
73
74
|
catch (error) {
|
|
74
75
|
try {
|
|
@@ -80,7 +81,7 @@ function payCreditCard(params) {
|
|
|
80
81
|
throw error;
|
|
81
82
|
}
|
|
82
83
|
const actionResult = { creditCardSales: alterTranResults };
|
|
83
|
-
action = (yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: actionResult }));
|
|
84
|
+
action = (yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: actionResult, recipe }));
|
|
84
85
|
yield (0, onPaid_1.onPaid)(action)(repos);
|
|
85
86
|
return action;
|
|
86
87
|
});
|
|
@@ -66,6 +66,7 @@ function refundCreditCard(params, options) {
|
|
|
66
66
|
let action = yield repos.action.start(Object.assign(Object.assign({}, startingActionParams), (typeof ((_h = params.sameAs) === null || _h === void 0 ? void 0 : _h.id) === 'string') ? { sameAs: { id: params.sameAs.id, typeOf: 'Task' } } : undefined));
|
|
67
67
|
const alterTranResult = [];
|
|
68
68
|
let processAlterTranResult;
|
|
69
|
+
let recipe;
|
|
69
70
|
try {
|
|
70
71
|
const creditService = new GMO.service.Credit({
|
|
71
72
|
endpoint: String(availableChannel.serviceUrl),
|
|
@@ -90,11 +91,11 @@ function refundCreditCard(params, options) {
|
|
|
90
91
|
throw processAlterTranResult.processAlterTranError;
|
|
91
92
|
}
|
|
92
93
|
// add recipe(2024-06-04~)
|
|
93
|
-
|
|
94
|
+
recipe = (0, factory_1.processAlterTranResult2refundRecipe)({
|
|
94
95
|
processAlterTranResult,
|
|
95
96
|
project: { id: params.project.id },
|
|
96
97
|
action: { id: action.id, typeOf: action.typeOf }
|
|
97
|
-
})
|
|
98
|
+
});
|
|
98
99
|
}
|
|
99
100
|
catch (error) {
|
|
100
101
|
try {
|
|
@@ -106,7 +107,7 @@ function refundCreditCard(params, options) {
|
|
|
106
107
|
throw error;
|
|
107
108
|
}
|
|
108
109
|
const actionResult = { alterTranResult };
|
|
109
|
-
action = (yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: actionResult }));
|
|
110
|
+
action = (yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: actionResult, recipe }));
|
|
110
111
|
yield (0, onRefund_1.onRefund)(action)(repos);
|
|
111
112
|
return action;
|
|
112
113
|
});
|
|
@@ -52,6 +52,7 @@ function checkMovieTicket(params) {
|
|
|
52
52
|
: undefined);
|
|
53
53
|
const action = yield repos.action.start(actionAttributes);
|
|
54
54
|
let processPurchaseNumberAuthResult;
|
|
55
|
+
let recipe;
|
|
55
56
|
try {
|
|
56
57
|
const eventIds = [...new Set(optimizedCheckObject.reduce((a, b) => [
|
|
57
58
|
...a,
|
|
@@ -79,13 +80,11 @@ function checkMovieTicket(params) {
|
|
|
79
80
|
paymentServiceId
|
|
80
81
|
})(repos);
|
|
81
82
|
// add recipe(2024-06-07~)
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}));
|
|
88
|
-
}
|
|
83
|
+
recipe = (0, factory_1.processPurchaseNumberAuthResult2checkRecipe)({
|
|
84
|
+
processPurchaseNumberAuthResult,
|
|
85
|
+
project: { id: params.project.id },
|
|
86
|
+
action: { id: action.id, typeOf: action.typeOf }
|
|
87
|
+
});
|
|
89
88
|
}
|
|
90
89
|
catch (error) {
|
|
91
90
|
// アクション保管用のエラーと両方保管(2024-05-22~)
|
|
@@ -102,7 +101,7 @@ function checkMovieTicket(params) {
|
|
|
102
101
|
purchaseNumberAuthIn: processPurchaseNumberAuthResult.purchaseNumberAuthIn,
|
|
103
102
|
purchaseNumberAuthResult: processPurchaseNumberAuthResult.purchaseNumberAuthResult
|
|
104
103
|
};
|
|
105
|
-
yield repos.action.completeWithVoid({ typeOf: actionAttributes.typeOf, id: action.id, result });
|
|
104
|
+
yield repos.action.completeWithVoid(Object.assign({ typeOf: actionAttributes.typeOf, id: action.id, result }, (settings_1.USE_EXPERIMENTAL_FEATURE) ? { recipe } : undefined));
|
|
106
105
|
return { result: processPurchaseNumberAuthResult };
|
|
107
106
|
});
|
|
108
107
|
}
|
|
@@ -30,6 +30,7 @@ function payMovieTicket(params) {
|
|
|
30
30
|
const startingAction = (0, factory_1.createStartingPayAction)(params, seatInfoSyncIn);
|
|
31
31
|
let action = yield repos.action.start(startingAction);
|
|
32
32
|
let processSeatInfoSyncResult;
|
|
33
|
+
let recipe;
|
|
33
34
|
try {
|
|
34
35
|
// 着券済に対する冪等性を確保する必要はあるが、
|
|
35
36
|
// その他のアクションとしての振る舞いは実行される必要もある
|
|
@@ -64,11 +65,11 @@ function payMovieTicket(params) {
|
|
|
64
65
|
processSeatInfoSyncResult = yield processSeatInfoSync({ seatInfoSyncIn })({ seatService });
|
|
65
66
|
}
|
|
66
67
|
// add recipe(2024-06-03~)
|
|
67
|
-
|
|
68
|
+
recipe = (0, factory_1.processSeatInfoSyncResult2payRecipe)({
|
|
68
69
|
processSeatInfoSyncResult,
|
|
69
70
|
project: { id: params.project.id },
|
|
70
71
|
action: { id: action.id, typeOf: action.typeOf }
|
|
71
|
-
})
|
|
72
|
+
});
|
|
72
73
|
}
|
|
73
74
|
catch (error) {
|
|
74
75
|
// アクション保管用のエラーと両方保管(2024-05-22~)
|
|
@@ -86,7 +87,7 @@ function payMovieTicket(params) {
|
|
|
86
87
|
&& seatInfoSyncResult.zskyykResult !== undefined)
|
|
87
88
|
? { seatInfoSyncResult: seatInfoSyncResult }
|
|
88
89
|
: undefined);
|
|
89
|
-
action = (yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result }));
|
|
90
|
+
action = (yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result, recipe }));
|
|
90
91
|
yield (0, onPaid_1.onPaid)(action)(repos);
|
|
91
92
|
return action;
|
|
92
93
|
});
|
|
@@ -95,13 +95,13 @@ function refundMovieTicket(params) {
|
|
|
95
95
|
}
|
|
96
96
|
else {
|
|
97
97
|
// add recipe(2024-06-04~)
|
|
98
|
-
|
|
98
|
+
const recipe = (0, factory_1.processSeatInfoSyncResult2refundRecipe)(Object.assign(Object.assign({ project: { id: params.project.id }, action: { id: action.id, typeOf: action.typeOf } }, (processSeatInfoSyncResult !== undefined) ? { processSeatInfoSyncResult } : undefined), (processSeatInfoSyncCancelResult !== undefined) ? { processSeatInfoSyncCancelResult } : undefined));
|
|
99
99
|
const actionResult = Object.assign(Object.assign({}, ((processSeatInfoSyncResult === null || processSeatInfoSyncResult === void 0 ? void 0 : processSeatInfoSyncResult.seatInfoSyncResult) !== undefined)
|
|
100
100
|
? { seatInfoSyncResult: processSeatInfoSyncResult.seatInfoSyncResult }
|
|
101
101
|
: undefined), ((processSeatInfoSyncCancelResult === null || processSeatInfoSyncCancelResult === void 0 ? void 0 : processSeatInfoSyncCancelResult.seatInfoSyncCancelResult) !== undefined)
|
|
102
102
|
? { seatInfoSyncCancelResult: processSeatInfoSyncCancelResult.seatInfoSyncCancelResult }
|
|
103
103
|
: undefined);
|
|
104
|
-
action = (yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: actionResult }));
|
|
104
|
+
action = (yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: actionResult, recipe }));
|
|
105
105
|
}
|
|
106
106
|
yield (0, onRefund_1.onRefund)(action)(repos);
|
|
107
107
|
});
|
|
@@ -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,31 @@ 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
|
+
action: { id: action.id, typeOf: action.typeOf }
|
|
171
|
+
});
|
|
186
172
|
break;
|
|
187
173
|
default:
|
|
188
174
|
// 予約取引確定
|
|
@@ -201,9 +187,9 @@ function confirmReserveTransaction(params, options) {
|
|
|
201
187
|
}
|
|
202
188
|
throw error;
|
|
203
189
|
}
|
|
204
|
-
// アクション完了
|
|
205
190
|
const result = { updReserveResult };
|
|
206
|
-
yield repos.action.completeWithVoid({ typeOf: confirmActionAttributes.typeOf, id: action.id, result: result })
|
|
191
|
+
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~)
|
|
192
|
+
));
|
|
207
193
|
// sendOrder連携(2024-01-11~)
|
|
208
194
|
yield onConfirmed(confirmActionAttributes, options)({
|
|
209
195
|
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.9",
|
|
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.
|
|
113
|
+
"version": "21.34.0-alpha.1"
|
|
114
114
|
}
|