@chevre/domain 22.2.0-alpha.23 → 22.2.0-alpha.25
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/projectFields.ts +15 -5
- package/example/src/chevre/projectFieldsById.ts +7 -7
- package/lib/chevre/repo/action.d.ts +12 -6
- package/lib/chevre/repo/action.js +95 -40
- package/lib/chevre/service/event.js +1 -1
- package/lib/chevre/service/offer/event/authorize.d.ts +1 -1
- package/lib/chevre/service/offer/event/authorize.js +2 -1
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer/authorize.js +41 -4
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.js +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.d.ts +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +2 -1
- package/lib/chevre/service/offer/eventServiceByCOA/authorizeByAcceptAction.d.ts +1 -1
- package/lib/chevre/service/offer/product.d.ts +1 -1
- package/lib/chevre/service/offer/product.js +2 -2
- package/lib/chevre/service/order/placeOrder.js +1 -1
- package/lib/chevre/service/payment/any/factory.d.ts +1 -1
- package/lib/chevre/service/payment/any/onPaid.d.ts +1 -1
- package/lib/chevre/service/payment/any/onRefund.d.ts +1 -1
- package/lib/chevre/service/payment/creditCard/payCreditCard.js +11 -4
- package/lib/chevre/service/payment/creditCard/refundCreditCard.js +13 -3
- package/lib/chevre/service/payment/creditCard/voidTransaction.js +1 -1
- package/lib/chevre/service/payment/faceToFace.js +26 -8
- package/lib/chevre/service/payment/movieTicket/payMovieTicket.js +11 -3
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket.js +15 -4
- package/lib/chevre/service/payment/movieTicket/validation.js +1 -1
- package/lib/chevre/service/payment/paymentCard.js +22 -7
- package/lib/chevre/service/reserve/cancelReservation.js +1 -1
- package/lib/chevre/service/reserve/confirmReservation.js +1 -1
- package/package.json +4 -4
- package/example/src/chevre/searchActions.ts +0 -40
|
@@ -12,19 +12,29 @@ mongoose.Model.on('index', (...args) => {
|
|
|
12
12
|
async function main() {
|
|
13
13
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
14
14
|
|
|
15
|
-
const
|
|
15
|
+
const actionRepo = await chevre.repository.Action.createInstance(mongoose.connection);
|
|
16
16
|
|
|
17
|
-
const docs = await
|
|
17
|
+
const docs = await actionRepo.search(
|
|
18
18
|
{
|
|
19
19
|
limit: 1,
|
|
20
20
|
page: 1,
|
|
21
|
-
typeOf: chevre.factory.
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
typeOf: { $eq: chevre.factory.actionType.AuthorizeAction }
|
|
22
|
+
},
|
|
23
|
+
['id', 'typeOf', 'actionStatus'],
|
|
24
|
+
['result', 'cancelAction', 'instrument', 'object']
|
|
24
25
|
);
|
|
25
26
|
// tslint:disable-next-line:no-null-keyword
|
|
26
27
|
console.dir(docs, { depth: null });
|
|
27
28
|
console.log(docs.length, 'docs found');
|
|
29
|
+
|
|
30
|
+
const actions = await actionRepo.searchByOrderNumber(
|
|
31
|
+
{
|
|
32
|
+
orderNumber: 'CIN9-4893721-9248784'
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
// tslint:disable-next-line:no-null-keyword
|
|
36
|
+
console.dir(actions, { depth: null });
|
|
37
|
+
console.log(actions.length, 'actions found');
|
|
28
38
|
}
|
|
29
39
|
|
|
30
40
|
main()
|
|
@@ -11,18 +11,18 @@ console.log(`importing chevre took ${diff[0]} seconds and ${diff[1]} nanoseconds
|
|
|
11
11
|
async function main() {
|
|
12
12
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
13
13
|
|
|
14
|
-
const
|
|
14
|
+
const actionRepo = await chevre.repository.Action.createInstance(mongoose.connection);
|
|
15
15
|
|
|
16
|
-
const
|
|
16
|
+
const doc = await actionRepo.findById(
|
|
17
17
|
{
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
typeOf: chevre.factory.transactionType.PlaceOrder
|
|
18
|
+
id: '66cc6030fe3d4df76011aa75',
|
|
19
|
+
typeOf: chevre.factory.actionType.DeleteAction
|
|
21
20
|
},
|
|
22
|
-
['
|
|
21
|
+
['id', 'actionStatus'],
|
|
22
|
+
[]
|
|
23
23
|
);
|
|
24
24
|
// tslint:disable-next-line:no-null-keyword
|
|
25
|
-
console.dir(
|
|
25
|
+
console.dir(doc, { depth: null });
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
main()
|
|
@@ -25,13 +25,16 @@
|
|
|
25
25
|
import { factory as surfrockFactory } from '@surfrock/sdk';
|
|
26
26
|
import { Connection, Document, FilterQuery, QueryOptions, UpdateQuery } from 'mongoose';
|
|
27
27
|
import * as factory from '../factory';
|
|
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>>
|
|
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>> & {
|
|
29
|
+
cancelAction?: any;
|
|
30
|
+
} : T extends factory.actionType.MoneyTransfer ? factory.action.transfer.moneyTransfer.IAction : T extends factory.actionType.ReplaceAction ? factory.action.update.replace.IAction<factory.action.update.replace.IAttributes<any, any>> & {
|
|
31
|
+
targetCollection?: any;
|
|
32
|
+
} : factory.action.IAction<factory.action.IAttributes<T, any, any>>;
|
|
29
33
|
export type IPayAction = factory.action.trade.pay.IAction;
|
|
30
34
|
export interface IUseActionCountByOffer {
|
|
31
35
|
_id: string[];
|
|
32
36
|
useActionCount?: number;
|
|
33
37
|
}
|
|
34
|
-
type KeyOfAction = keyof factory.action.IAction<factory.action.IAttributes<factory.actionType, any, any>> | '_id';
|
|
35
38
|
interface IAggregationByStatus {
|
|
36
39
|
actionCount: number;
|
|
37
40
|
avgDuration: number;
|
|
@@ -72,6 +75,7 @@ export type IRecipeAsActionAttributes = Pick<factory.recipe.IRecipe, 'project' |
|
|
|
72
75
|
export type IMinimizedPurchaseNumberAuthResult = Pick<factory.action.check.paymentMethod.movieTicket.IPurchaseNumberAuthResult, 'mkknmiNumSum' | 'resultInfo' | 'ykknmiNumSum'> & {
|
|
73
76
|
knyknrNoInfoOut: Omit<factory.action.check.paymentMethod.movieTicket.IPurchaseNumberInfo, 'ykknInfo' | 'mkknInfo'>[] | null;
|
|
74
77
|
};
|
|
78
|
+
type IKeyOfProjection = keyof IAction<factory.actionType> | keyof IAction<factory.actionType.AuthorizeAction> | keyof IAction<factory.actionType.MoneyTransfer> | keyof IAction<factory.actionType.ReplaceAction>;
|
|
75
79
|
/**
|
|
76
80
|
* アクションリポジトリ
|
|
77
81
|
*/
|
|
@@ -83,7 +87,7 @@ export declare class ActionRepo {
|
|
|
83
87
|
/**
|
|
84
88
|
* アクション検索
|
|
85
89
|
*/
|
|
86
|
-
search<T extends factory.actionType>(params: factory.action.ISearchConditions, inclusion:
|
|
90
|
+
search<T extends factory.actionType>(params: factory.action.ISearchConditions, inclusion: IKeyOfProjection[], exclusion: IKeyOfProjection[]): Promise<IAction<T>[]>;
|
|
87
91
|
/**
|
|
88
92
|
* アクション開始
|
|
89
93
|
*/
|
|
@@ -92,8 +96,9 @@ export declare class ActionRepo {
|
|
|
92
96
|
}): Promise<IAction<T>>;
|
|
93
97
|
/**
|
|
94
98
|
* アクション完了
|
|
99
|
+
* @deprecated use completeWithVoid
|
|
95
100
|
*/
|
|
96
|
-
|
|
101
|
+
completeDeprecated<T extends factory.actionType>(params: {
|
|
97
102
|
typeOf: T;
|
|
98
103
|
id: string;
|
|
99
104
|
result: any;
|
|
@@ -115,8 +120,9 @@ export declare class ActionRepo {
|
|
|
115
120
|
}): Promise<void>;
|
|
116
121
|
/**
|
|
117
122
|
* アクション失敗
|
|
123
|
+
* @deprecated use giveUp
|
|
118
124
|
*/
|
|
119
|
-
|
|
125
|
+
giveUpWithObjectDeprecated(params: {
|
|
120
126
|
typeOf: factory.actionType;
|
|
121
127
|
id: string;
|
|
122
128
|
error: Error | Error[];
|
|
@@ -153,7 +159,7 @@ export declare class ActionRepo {
|
|
|
153
159
|
findById<T extends factory.actionType>(params: {
|
|
154
160
|
typeOf: T;
|
|
155
161
|
id: string;
|
|
156
|
-
}, inclusion?:
|
|
162
|
+
}, inclusion?: IKeyOfProjection[], exclusion?: IKeyOfProjection[]): Promise<IAction<T>>;
|
|
157
163
|
findPayAction(params: {
|
|
158
164
|
project: {
|
|
159
165
|
id: string;
|
|
@@ -25,6 +25,30 @@ const factory = require("../factory");
|
|
|
25
25
|
const settings_1 = require("../settings");
|
|
26
26
|
const action_1 = require("./mongoose/schemas/action");
|
|
27
27
|
const actionRecipe_1 = require("./mongoose/schemas/actionRecipe");
|
|
28
|
+
const AVAILABLE_PROJECT_FIELDS = [
|
|
29
|
+
'project',
|
|
30
|
+
'actionStatus',
|
|
31
|
+
'typeOf',
|
|
32
|
+
'description',
|
|
33
|
+
'agent',
|
|
34
|
+
'recipient',
|
|
35
|
+
'result',
|
|
36
|
+
'error',
|
|
37
|
+
'object',
|
|
38
|
+
'startDate',
|
|
39
|
+
'endDate',
|
|
40
|
+
'purpose',
|
|
41
|
+
'potentialActions',
|
|
42
|
+
'amount',
|
|
43
|
+
'fromLocation',
|
|
44
|
+
'toLocation',
|
|
45
|
+
'instrument',
|
|
46
|
+
'location',
|
|
47
|
+
'replacer',
|
|
48
|
+
'targetCollection',
|
|
49
|
+
'sameAs',
|
|
50
|
+
'cancelAction'
|
|
51
|
+
];
|
|
28
52
|
/**
|
|
29
53
|
* アクションリポジトリ
|
|
30
54
|
*/
|
|
@@ -432,24 +456,33 @@ class ActionRepo {
|
|
|
432
456
|
var _a;
|
|
433
457
|
return __awaiter(this, void 0, void 0, function* () {
|
|
434
458
|
const conditions = ActionRepo.CREATE_MONGO_CONDITIONS(params);
|
|
435
|
-
let
|
|
459
|
+
let positiveProjectionFields = AVAILABLE_PROJECT_FIELDS;
|
|
436
460
|
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
437
|
-
inclusion.
|
|
438
|
-
projection[field] = 1;
|
|
439
|
-
});
|
|
461
|
+
positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
|
|
440
462
|
}
|
|
441
463
|
else {
|
|
442
|
-
projection = {
|
|
443
|
-
__v: 0,
|
|
444
|
-
createdAt: 0,
|
|
445
|
-
updatedAt: 0
|
|
446
|
-
};
|
|
447
464
|
if (Array.isArray(exclusion) && exclusion.length > 0) {
|
|
448
|
-
|
|
449
|
-
projection[field] = 0;
|
|
450
|
-
});
|
|
465
|
+
positiveProjectionFields = positiveProjectionFields.filter((key) => !exclusion.includes(key));
|
|
451
466
|
}
|
|
452
467
|
}
|
|
468
|
+
const projection = Object.assign({ _id: 0, id: { $toString: '$_id' } }, Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1]))));
|
|
469
|
+
// let projection: { [key: string]: number } = {};
|
|
470
|
+
// if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
471
|
+
// inclusion.forEach((field) => {
|
|
472
|
+
// projection[field] = 1;
|
|
473
|
+
// });
|
|
474
|
+
// } else {
|
|
475
|
+
// projection = {
|
|
476
|
+
// __v: 0,
|
|
477
|
+
// createdAt: 0,
|
|
478
|
+
// updatedAt: 0
|
|
479
|
+
// };
|
|
480
|
+
// if (Array.isArray(exclusion) && exclusion.length > 0) {
|
|
481
|
+
// exclusion.forEach((field) => {
|
|
482
|
+
// projection[field] = 0;
|
|
483
|
+
// });
|
|
484
|
+
// }
|
|
485
|
+
// }
|
|
453
486
|
const query = this.actionModel.find((conditions.length > 0) ? { $and: conditions } : {}, projection);
|
|
454
487
|
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
455
488
|
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
@@ -464,8 +497,8 @@ class ActionRepo {
|
|
|
464
497
|
// const explainResult = await (<any>query).explain();
|
|
465
498
|
// console.log(explainResult[0].executionStats.allPlansExecution.map((e: any) => e.executionStages.inputStage));
|
|
466
499
|
return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
467
|
-
.
|
|
468
|
-
.
|
|
500
|
+
.lean() // 2024-08-26~
|
|
501
|
+
.exec();
|
|
469
502
|
});
|
|
470
503
|
}
|
|
471
504
|
/**
|
|
@@ -485,8 +518,9 @@ class ActionRepo {
|
|
|
485
518
|
}
|
|
486
519
|
/**
|
|
487
520
|
* アクション完了
|
|
521
|
+
* @deprecated use completeWithVoid
|
|
488
522
|
*/
|
|
489
|
-
|
|
523
|
+
completeDeprecated(params) {
|
|
490
524
|
var _a;
|
|
491
525
|
return __awaiter(this, void 0, void 0, function* () {
|
|
492
526
|
if (((_a = params.recipe) === null || _a === void 0 ? void 0 : _a.typeOf) === 'Recipe') {
|
|
@@ -566,8 +600,9 @@ class ActionRepo {
|
|
|
566
600
|
}
|
|
567
601
|
/**
|
|
568
602
|
* アクション失敗
|
|
603
|
+
* @deprecated use giveUp
|
|
569
604
|
*/
|
|
570
|
-
|
|
605
|
+
giveUpWithObjectDeprecated(params) {
|
|
571
606
|
return __awaiter(this, void 0, void 0, function* () {
|
|
572
607
|
const actionError = (Array.isArray(params.error))
|
|
573
608
|
? params.error.map((e) => (Object.assign(Object.assign({}, e), { message: e.message, name: e.name })))
|
|
@@ -664,33 +699,43 @@ class ActionRepo {
|
|
|
664
699
|
}
|
|
665
700
|
findById(params, inclusion, exclusion) {
|
|
666
701
|
return __awaiter(this, void 0, void 0, function* () {
|
|
667
|
-
let
|
|
702
|
+
let positiveProjectionFields = AVAILABLE_PROJECT_FIELDS;
|
|
668
703
|
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
669
|
-
inclusion.
|
|
670
|
-
projection[field] = 1;
|
|
671
|
-
});
|
|
704
|
+
positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
|
|
672
705
|
}
|
|
673
706
|
else {
|
|
674
|
-
projection = {
|
|
675
|
-
__v: 0,
|
|
676
|
-
createdAt: 0,
|
|
677
|
-
updatedAt: 0
|
|
678
|
-
};
|
|
679
707
|
if (Array.isArray(exclusion) && exclusion.length > 0) {
|
|
680
|
-
|
|
681
|
-
projection[field] = 0;
|
|
682
|
-
});
|
|
708
|
+
positiveProjectionFields = positiveProjectionFields.filter((key) => !exclusion.includes(key));
|
|
683
709
|
}
|
|
684
710
|
}
|
|
711
|
+
const projection = Object.assign({ _id: 0, id: { $toString: '$_id' } }, Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1]))));
|
|
712
|
+
// let projection: { [key: string]: number } = {};
|
|
713
|
+
// if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
714
|
+
// inclusion.forEach((field) => {
|
|
715
|
+
// projection[field] = 1;
|
|
716
|
+
// });
|
|
717
|
+
// } else {
|
|
718
|
+
// projection = {
|
|
719
|
+
// __v: 0,
|
|
720
|
+
// createdAt: 0,
|
|
721
|
+
// updatedAt: 0
|
|
722
|
+
// };
|
|
723
|
+
// if (Array.isArray(exclusion) && exclusion.length > 0) {
|
|
724
|
+
// exclusion.forEach((field) => {
|
|
725
|
+
// projection[field] = 0;
|
|
726
|
+
// });
|
|
727
|
+
// }
|
|
728
|
+
// }
|
|
685
729
|
const doc = yield this.actionModel.findOne({
|
|
686
730
|
typeOf: { $eq: params.typeOf },
|
|
687
731
|
_id: { $eq: params.id }
|
|
688
732
|
}, projection)
|
|
733
|
+
.lean() // 2024-08-26~
|
|
689
734
|
.exec();
|
|
690
735
|
if (doc === null) {
|
|
691
736
|
throw new factory.errors.NotFound(this.actionModel.modelName);
|
|
692
737
|
}
|
|
693
|
-
return doc
|
|
738
|
+
return doc;
|
|
694
739
|
});
|
|
695
740
|
}
|
|
696
741
|
findPayAction(params) {
|
|
@@ -731,33 +776,43 @@ class ActionRepo {
|
|
|
731
776
|
searchByOrderNumber(params) {
|
|
732
777
|
var _a;
|
|
733
778
|
return __awaiter(this, void 0, void 0, function* () {
|
|
734
|
-
const
|
|
779
|
+
const filter = {
|
|
735
780
|
$or: [
|
|
736
|
-
{ 'object.orderNumber': params.orderNumber },
|
|
737
|
-
{ 'purpose.orderNumber': params.orderNumber }
|
|
781
|
+
{ 'object.orderNumber': { $eq: params.orderNumber } },
|
|
782
|
+
{ 'purpose.orderNumber': { $eq: params.orderNumber } }
|
|
738
783
|
]
|
|
739
784
|
};
|
|
740
|
-
const
|
|
741
|
-
|
|
785
|
+
const projection = Object.assign({ _id: 0, id: { $toString: '$_id' } }, Object.fromEntries(AVAILABLE_PROJECT_FIELDS.map((key) => ([key, 1]))));
|
|
786
|
+
const query = this.actionModel.find(filter, projection);
|
|
787
|
+
// .select({ __v: 0, createdAt: 0, updatedAt: 0 });
|
|
742
788
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
743
789
|
/* istanbul ignore else */
|
|
744
790
|
if (((_a = params.sort) === null || _a === void 0 ? void 0 : _a.startDate) !== undefined) {
|
|
745
791
|
query.sort({ startDate: params.sort.startDate });
|
|
746
792
|
}
|
|
747
|
-
return query
|
|
748
|
-
.
|
|
793
|
+
return query
|
|
794
|
+
.lean() // 2024-08-26~
|
|
795
|
+
.exec();
|
|
749
796
|
});
|
|
750
797
|
}
|
|
751
798
|
searchBySameAs(params) {
|
|
752
799
|
var _a;
|
|
753
800
|
return __awaiter(this, void 0, void 0, function* () {
|
|
801
|
+
const projection = {
|
|
802
|
+
_id: 0,
|
|
803
|
+
id: { $toString: '$_id' },
|
|
804
|
+
actionStatus: 1,
|
|
805
|
+
error: 1,
|
|
806
|
+
purpose: 1
|
|
807
|
+
};
|
|
754
808
|
const query = this.actionModel.find(Object.assign({ typeOf: { $eq: params.typeOf.$eq }, 'sameAs.id': { $exists: true, $eq: params.sameAs.id.$eq } }, (typeof ((_a = params.purpose) === null || _a === void 0 ? void 0 : _a.id.$eq) === 'string')
|
|
755
809
|
? { 'purpose.id': { $exists: true, $eq: params.purpose.id.$eq } }
|
|
756
|
-
: undefined))
|
|
757
|
-
.select({ _id: 1, actionStatus: 1, error: 1, purpose: 1 })
|
|
810
|
+
: undefined), projection)
|
|
811
|
+
// .select({ _id: 1, actionStatus: 1, error: 1, purpose: 1 })
|
|
758
812
|
.limit(1);
|
|
759
|
-
return query
|
|
760
|
-
.
|
|
813
|
+
return query
|
|
814
|
+
.lean() // 2024-08-26~
|
|
815
|
+
.exec();
|
|
761
816
|
});
|
|
762
817
|
}
|
|
763
818
|
deleteByProject(params) {
|
|
@@ -608,7 +608,7 @@ function createScreeningEventSeriesFromCOA(params) {
|
|
|
608
608
|
};
|
|
609
609
|
}
|
|
610
610
|
function createScreeningEventSeriesAdditionalPropertyFromCOA(params) {
|
|
611
|
-
const coaInfo = Object.assign(Object.assign({ titleBranchNum: params.filmFromCOA.titleBranchNum, kbnEirin: params.eirinKubuns.filter((k) => k.kubunCode === params.filmFromCOA.kbnEirin)[0], kbnEizou: params.eizouKubuns.filter((k) => k.kubunCode === params.filmFromCOA.kbnEizou)[0], kbnJoueihousiki: params.joueihousikiKubuns.filter((k) => k.kubunCode === params.filmFromCOA.kbnJoueihousiki)[0], kbnJimakufukikae: params.jimakufukikaeKubuns.filter((k) => k.kubunCode === params.filmFromCOA.kbnJimakufukikae)[0], flgMvtkUse: params.filmFromCOA.flgMvtkUse, dateMvtkBegin: params.filmFromCOA.dateMvtkBegin }, (typeof params.filmFromCOA.flgMgtkUse === 'string') ? { flgMgtkUse: params.filmFromCOA.flgMgtkUse } : undefined), (typeof params.filmFromCOA.dateMgtkBegin === 'string') ? { dateMgtkBegin: params.filmFromCOA.dateMgtkBegin } : undefined);
|
|
611
|
+
const coaInfo = Object.assign(Object.assign(Object.assign({ titleBranchNum: params.filmFromCOA.titleBranchNum, kbnEirin: params.eirinKubuns.filter((k) => k.kubunCode === params.filmFromCOA.kbnEirin)[0], kbnEizou: params.eizouKubuns.filter((k) => k.kubunCode === params.filmFromCOA.kbnEizou)[0], kbnJoueihousiki: params.joueihousikiKubuns.filter((k) => k.kubunCode === params.filmFromCOA.kbnJoueihousiki)[0], kbnJimakufukikae: params.jimakufukikaeKubuns.filter((k) => k.kubunCode === params.filmFromCOA.kbnJimakufukikae)[0], flgMvtkUse: params.filmFromCOA.flgMvtkUse, dateMvtkBegin: params.filmFromCOA.dateMvtkBegin }, (typeof params.filmFromCOA.flgMgtkUse === 'string') ? { flgMgtkUse: params.filmFromCOA.flgMgtkUse } : undefined), (typeof params.filmFromCOA.dateMgtkBegin === 'string') ? { dateMgtkBegin: params.filmFromCOA.dateMgtkBegin } : undefined), (typeof params.filmFromCOA.flgNotDiscount === 'string') ? { flgNotDiscount: params.filmFromCOA.flgNotDiscount } : undefined);
|
|
612
612
|
return {
|
|
613
613
|
coaInfo,
|
|
614
614
|
additionalProperty: [
|
|
@@ -67,7 +67,8 @@ function authorize(params, options) {
|
|
|
67
67
|
throw error;
|
|
68
68
|
}
|
|
69
69
|
const result = (0, factory_1.acceptedOffers2authorizeResult)({ acceptedOffers, acceptedOffers4result, noOfferSpecified, ticketOffers });
|
|
70
|
-
|
|
70
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: result });
|
|
71
|
+
return { id: action.id };
|
|
71
72
|
});
|
|
72
73
|
}
|
|
73
74
|
exports.authorize = authorize;
|
|
@@ -35,8 +35,11 @@ function createAcceptedOffersWithoutDetails(params) {
|
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
exports.createAcceptedOffersWithoutDetails = createAcceptedOffersWithoutDetails;
|
|
38
|
+
/**
|
|
39
|
+
* 受入オファーをCOA販売チケットへ変換する
|
|
40
|
+
*/
|
|
38
41
|
function offer2availableSalesTicket(params) {
|
|
39
|
-
// tslint:disable-next-line:max-func-body-length
|
|
42
|
+
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
40
43
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
41
44
|
let availableSalesTicket;
|
|
42
45
|
const offers = params.offers;
|
|
@@ -45,6 +48,7 @@ function offer2availableSalesTicket(params) {
|
|
|
45
48
|
const availableSalesTickets = params.availableSalesTickets;
|
|
46
49
|
const coaInfo = params.coaInfo;
|
|
47
50
|
const isMvtkOrMG = typeof offer.ticketInfo.mvtkNum === 'string' && offer.ticketInfo.mvtkNum.length > 0;
|
|
51
|
+
const couponCode = offer.ticketInfo.couponCode; // 2024-08-27~
|
|
48
52
|
// ポイント消費鑑賞券の場合
|
|
49
53
|
if (typeof offer.ticketInfo.usePoint === 'number' && offer.ticketInfo.usePoint > 0) {
|
|
50
54
|
// COA側のマスタ構成で、
|
|
@@ -107,7 +111,36 @@ function offer2availableSalesTicket(params) {
|
|
|
107
111
|
}
|
|
108
112
|
}
|
|
109
113
|
else {
|
|
110
|
-
|
|
114
|
+
if (typeof couponCode === 'string') {
|
|
115
|
+
// クーポンコード指定の場合クーポンチケット検索結果から販売チケットをfix(2024-08-27~)
|
|
116
|
+
try {
|
|
117
|
+
const couponTicketResult = yield repos.reserveService.couponTicket({
|
|
118
|
+
theaterCode: coaInfo.theaterCode,
|
|
119
|
+
couponCode,
|
|
120
|
+
titleCode: coaInfo.titleCode,
|
|
121
|
+
titleBranchNum: coaInfo.titleBranchNum,
|
|
122
|
+
dateJouei: coaInfo.dateJouei,
|
|
123
|
+
timeBegin: coaInfo.timeBegin,
|
|
124
|
+
flgMember: (params.isMember) ? COA.factory.reserve.FlgMember.Member : COA.factory.reserve.FlgMember.NonMember
|
|
125
|
+
});
|
|
126
|
+
availableSalesTicket = couponTicketResult.listTicket.find((t) => t.ticketCode === offer.ticketInfo.ticketCode);
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
// COAサービスエラーの場合ハンドリング
|
|
130
|
+
if (error.name === 'COAServiceError') {
|
|
131
|
+
// COAはクライアントエラーかサーバーエラーかに関わらずステータスコード200 or 500を返却する。
|
|
132
|
+
// 500未満であればクライアントエラーとみなす
|
|
133
|
+
if (typeof error.code === 'number'
|
|
134
|
+
&& error.code < http_status_1.INTERNAL_SERVER_ERROR) {
|
|
135
|
+
throw new factory.errors.NotFound(`offers.${offerIndex}`, `couponTicket ${offer.ticketInfo.ticketCode} not found. ${error.message}`);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
throw error;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
availableSalesTicket = availableSalesTickets.find((t) => t.ticketCode === offer.ticketInfo.ticketCode);
|
|
143
|
+
}
|
|
111
144
|
// 利用可能な券種が見つからなければエラー
|
|
112
145
|
if (availableSalesTicket === undefined) {
|
|
113
146
|
throw new factory.errors.NotFound(`offers.${offerIndex}`, `ticketCode ${offer.ticketInfo.ticketCode} not found.`);
|
|
@@ -243,8 +276,12 @@ flgMember) {
|
|
|
243
276
|
offer: offer,
|
|
244
277
|
offerIndex: offerIndex,
|
|
245
278
|
availableSalesTickets: availableSalesTickets,
|
|
246
|
-
coaInfo: coaInfo
|
|
247
|
-
|
|
279
|
+
coaInfo: coaInfo,
|
|
280
|
+
isMember: (flgMember === COA.factory.reserve.FlgMember.Member)
|
|
281
|
+
})({
|
|
282
|
+
masterService: repos.masterService,
|
|
283
|
+
reserveService: repos.reserveService
|
|
284
|
+
});
|
|
248
285
|
return availableSalesTicket2offerWithDetails({
|
|
249
286
|
availableSalesTicket,
|
|
250
287
|
offer,
|
|
@@ -127,7 +127,7 @@ function reAcceptOffer(params) {
|
|
|
127
127
|
}, ['project', 'agent', 'typeOf']);
|
|
128
128
|
const coaInfo = yield findCOAInfo({ id: params.object.event.id, project: { id: transaction.project.id } })(repos);
|
|
129
129
|
// 承認アクション存在検証
|
|
130
|
-
yield repos.action.findById({ id: params.potentialActions.id, typeOf: factory.actionType.AuthorizeAction }, ['
|
|
130
|
+
yield repos.action.findById({ id: params.potentialActions.id, typeOf: factory.actionType.AuthorizeAction }, ['id'], []);
|
|
131
131
|
const actionAttributes = {
|
|
132
132
|
project: transaction.project,
|
|
133
133
|
typeOf: factory.actionType.AcceptAction,
|
|
@@ -139,7 +139,8 @@ function authorize(params) {
|
|
|
139
139
|
}
|
|
140
140
|
throw error;
|
|
141
141
|
}
|
|
142
|
-
|
|
142
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result });
|
|
143
|
+
return { id: action.id };
|
|
143
144
|
});
|
|
144
145
|
}
|
|
145
146
|
exports.authorize = authorize;
|
|
@@ -93,7 +93,7 @@ export declare function authorize(params: {
|
|
|
93
93
|
transaction: {
|
|
94
94
|
id: string;
|
|
95
95
|
};
|
|
96
|
-
}): IAuthorizeOperation<IAuthorizeOfferAction
|
|
96
|
+
}): IAuthorizeOperation<Pick<IAuthorizeOfferAction, 'id'>>;
|
|
97
97
|
export declare function voidTransaction(params: factory.task.IData<factory.taskName.VoidRegisterServiceTransaction>): (repos: {
|
|
98
98
|
action: ActionRepo;
|
|
99
99
|
assetTransaction: AssetTransactionRepo;
|
|
@@ -127,7 +127,6 @@ function authorize(params) {
|
|
|
127
127
|
const { transactionNumber } = yield repos.transactionNumber.publishByTimestamp({
|
|
128
128
|
startDate: new Date()
|
|
129
129
|
});
|
|
130
|
-
// 承認アクション開始
|
|
131
130
|
const actionAttributes = (0, factory_1.createActionAttributes)({
|
|
132
131
|
acceptedOffer: acceptedOffer,
|
|
133
132
|
transaction: transaction,
|
|
@@ -164,7 +163,8 @@ function authorize(params) {
|
|
|
164
163
|
}
|
|
165
164
|
throw error;
|
|
166
165
|
}
|
|
167
|
-
|
|
166
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: result });
|
|
167
|
+
return { id: action.id };
|
|
168
168
|
});
|
|
169
169
|
}
|
|
170
170
|
exports.authorize = authorize;
|
|
@@ -70,7 +70,7 @@ function placeOrder(params) {
|
|
|
70
70
|
id: { $in: [orderActionPurpose.id] },
|
|
71
71
|
typeOf: { $in: [orderActionPurpose.typeOf] }
|
|
72
72
|
}
|
|
73
|
-
}, ['
|
|
73
|
+
}, ['id'], []);
|
|
74
74
|
if (completedActions.length === 0) {
|
|
75
75
|
const action = yield repos.action.start(orderActionAttributes);
|
|
76
76
|
try {
|
|
@@ -33,4 +33,4 @@ export declare function createAuthorizeResult(params: {
|
|
|
33
33
|
/**
|
|
34
34
|
* 通知対象としてのアクションを最適化
|
|
35
35
|
*/
|
|
36
|
-
export declare function optimizeAction4inform(action: factory.action.trade.pay.IAction | factory.action.trade.refund.IAction): IOnPaymentStatusChangedParams;
|
|
36
|
+
export declare function optimizeAction4inform(action: Pick<factory.action.trade.pay.IAction, 'id' | 'object' | 'project' | 'typeOf'> | Pick<factory.action.trade.refund.IAction, 'id' | 'object' | 'project' | 'typeOf'>): IOnPaymentStatusChangedParams;
|
|
@@ -8,7 +8,7 @@ import type { TaskRepo } from '../../../repo/task';
|
|
|
8
8
|
/**
|
|
9
9
|
* 決済後のアクション
|
|
10
10
|
*/
|
|
11
|
-
declare function onPaid(payAction: factory.action.trade.pay.IAction): (repos: {
|
|
11
|
+
declare function onPaid(payAction: Pick<factory.action.trade.pay.IAction, 'actionStatus' | 'id' | 'object' | 'potentialActions' | 'project' | 'purpose' | 'typeOf'>): (repos: {
|
|
12
12
|
action: ActionRepo;
|
|
13
13
|
accountingReport: AccountingReportRepo;
|
|
14
14
|
task: TaskRepo;
|
|
@@ -8,7 +8,7 @@ import type { TaskRepo } from '../../../repo/task';
|
|
|
8
8
|
/**
|
|
9
9
|
* 返金後のアクション
|
|
10
10
|
*/
|
|
11
|
-
declare function onRefund(refundAction: factory.action.trade.refund.IAction): (repos: {
|
|
11
|
+
declare function onRefund(refundAction: Pick<factory.action.trade.refund.IAction, 'actionStatus' | 'id' | 'object' | 'potentialActions' | 'project' | 'purpose' | 'typeOf'>): (repos: {
|
|
12
12
|
action: ActionRepo;
|
|
13
13
|
accountingReport: AccountingReportRepo;
|
|
14
14
|
task: TaskRepo;
|
|
@@ -38,8 +38,7 @@ function payCreditCard(params) {
|
|
|
38
38
|
throw new factory.errors.ArgumentNull('recipient.id');
|
|
39
39
|
}
|
|
40
40
|
const { shopId, shopPass } = yield (0, getGMOInfoFromSeller_1.getGMOInfoFromSeller)({ paymentMethodType, seller: { id: sellerId }, paymentServiceId })(repos);
|
|
41
|
-
|
|
42
|
-
let action = yield repos.action.start(params);
|
|
41
|
+
const action = yield repos.action.start(params);
|
|
43
42
|
const alterTranResults = [];
|
|
44
43
|
const processAlterTranResults = [];
|
|
45
44
|
let recipe;
|
|
@@ -80,8 +79,16 @@ function payCreditCard(params) {
|
|
|
80
79
|
const actionResult = {
|
|
81
80
|
// creditCardSales: alterTranResults // discontinue(2024-06-10~)
|
|
82
81
|
};
|
|
83
|
-
|
|
84
|
-
yield (0, onPaid_1.onPaid)(
|
|
82
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult, recipe });
|
|
83
|
+
yield (0, onPaid_1.onPaid)({
|
|
84
|
+
actionStatus: factory.actionStatusType.CompletedActionStatus,
|
|
85
|
+
id: action.id,
|
|
86
|
+
object: action.object,
|
|
87
|
+
potentialActions: action.potentialActions,
|
|
88
|
+
project: action.project,
|
|
89
|
+
purpose: action.purpose,
|
|
90
|
+
typeOf: action.typeOf
|
|
91
|
+
})(repos);
|
|
85
92
|
return action;
|
|
86
93
|
});
|
|
87
94
|
}
|
|
@@ -29,6 +29,7 @@ const getGMOInfoFromSeller_1 = require("./getGMOInfoFromSeller");
|
|
|
29
29
|
/**
|
|
30
30
|
* クレジットカード返金
|
|
31
31
|
*/
|
|
32
|
+
// tslint:disable-next-line:max-func-body-length
|
|
32
33
|
function refundCreditCard(params, options) {
|
|
33
34
|
return (repos, settings) => __awaiter(this, void 0, void 0, function* () {
|
|
34
35
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
@@ -59,7 +60,7 @@ function refundCreditCard(params, options) {
|
|
|
59
60
|
id: paymentServiceId
|
|
60
61
|
});
|
|
61
62
|
const { sameAs } = params, startingActionParams = __rest(params, ["sameAs"]);
|
|
62
|
-
|
|
63
|
+
const action = yield repos.action.start(Object.assign(Object.assign({}, startingActionParams), (typeof ((_g = params.sameAs) === null || _g === void 0 ? void 0 : _g.id) === 'string') ? { sameAs: { id: params.sameAs.id, typeOf: 'Task' } } : undefined));
|
|
63
64
|
const alterTranResult = [];
|
|
64
65
|
let processAlterTranResult;
|
|
65
66
|
let recipe;
|
|
@@ -97,8 +98,17 @@ function refundCreditCard(params, options) {
|
|
|
97
98
|
throw error;
|
|
98
99
|
}
|
|
99
100
|
const actionResult = {}; // optimize(2024-06-10~)
|
|
100
|
-
|
|
101
|
-
yield (
|
|
101
|
+
// add recipe(2024-06-04~)
|
|
102
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult, recipe });
|
|
103
|
+
yield (0, onRefund_1.onRefund)({
|
|
104
|
+
actionStatus: factory.actionStatusType.CompletedActionStatus,
|
|
105
|
+
id: action.id,
|
|
106
|
+
object: action.object,
|
|
107
|
+
potentialActions: action.potentialActions,
|
|
108
|
+
project: action.project,
|
|
109
|
+
purpose: action.purpose,
|
|
110
|
+
typeOf: action.typeOf
|
|
111
|
+
})(repos);
|
|
102
112
|
// return action;
|
|
103
113
|
});
|
|
104
114
|
}
|
|
@@ -49,7 +49,7 @@ function voidTransaction(params) {
|
|
|
49
49
|
typeOf: { $eq: factory.actionType.AuthorizeAction },
|
|
50
50
|
object: { paymentMethodId: { $eq: paymentMethodId } },
|
|
51
51
|
sameAs: { id: { $eq: transaction.id } }
|
|
52
|
-
}, ['
|
|
52
|
+
}, ['id', 'typeOf', 'project'], [])).shift();
|
|
53
53
|
if (authorizeInvoiceAction !== undefined) {
|
|
54
54
|
const cancelAction = {
|
|
55
55
|
startTime: new Date(),
|
|
@@ -10,6 +10,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.voidTransaction = exports.refundFaceToFace = exports.payFaceToFace = void 0;
|
|
13
|
+
/**
|
|
14
|
+
* 対面決済サービス
|
|
15
|
+
*/
|
|
16
|
+
const factory = require("../../factory");
|
|
13
17
|
const onPaid_1 = require("./any/onPaid");
|
|
14
18
|
const onRefund_1 = require("./any/onRefund");
|
|
15
19
|
function voidTransaction(__) {
|
|
@@ -20,8 +24,7 @@ function voidTransaction(__) {
|
|
|
20
24
|
exports.voidTransaction = voidTransaction;
|
|
21
25
|
function payFaceToFace(params) {
|
|
22
26
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
|
|
24
|
-
let action = yield repos.action.start(params);
|
|
27
|
+
const action = yield repos.action.start(params);
|
|
25
28
|
try {
|
|
26
29
|
// no op
|
|
27
30
|
}
|
|
@@ -34,17 +37,24 @@ function payFaceToFace(params) {
|
|
|
34
37
|
}
|
|
35
38
|
throw error;
|
|
36
39
|
}
|
|
37
|
-
// アクション完了
|
|
38
40
|
const actionResult = {};
|
|
39
|
-
|
|
40
|
-
yield (0, onPaid_1.onPaid)(
|
|
41
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
42
|
+
yield (0, onPaid_1.onPaid)({
|
|
43
|
+
actionStatus: factory.actionStatusType.CompletedActionStatus,
|
|
44
|
+
id: action.id,
|
|
45
|
+
object: action.object,
|
|
46
|
+
potentialActions: action.potentialActions,
|
|
47
|
+
project: action.project,
|
|
48
|
+
purpose: action.purpose,
|
|
49
|
+
typeOf: action.typeOf
|
|
50
|
+
})(repos);
|
|
41
51
|
return action;
|
|
42
52
|
});
|
|
43
53
|
}
|
|
44
54
|
exports.payFaceToFace = payFaceToFace;
|
|
45
55
|
function refundFaceToFace(params) {
|
|
46
56
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
47
|
-
|
|
57
|
+
const action = yield repos.action.start(params);
|
|
48
58
|
try {
|
|
49
59
|
// no op
|
|
50
60
|
}
|
|
@@ -58,8 +68,16 @@ function refundFaceToFace(params) {
|
|
|
58
68
|
throw error;
|
|
59
69
|
}
|
|
60
70
|
const actionResult = {};
|
|
61
|
-
|
|
62
|
-
yield (0, onRefund_1.onRefund)(
|
|
71
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
72
|
+
yield (0, onRefund_1.onRefund)({
|
|
73
|
+
actionStatus: factory.actionStatusType.CompletedActionStatus,
|
|
74
|
+
id: action.id,
|
|
75
|
+
object: action.object,
|
|
76
|
+
potentialActions: action.potentialActions,
|
|
77
|
+
project: action.project,
|
|
78
|
+
purpose: action.purpose,
|
|
79
|
+
typeOf: action.typeOf
|
|
80
|
+
})(repos);
|
|
63
81
|
return action;
|
|
64
82
|
});
|
|
65
83
|
}
|
|
@@ -31,7 +31,7 @@ function payMovieTicket(params) {
|
|
|
31
31
|
processSeatInfoSyncResult: { seatInfoSyncIn },
|
|
32
32
|
project: { id: params.project.id }
|
|
33
33
|
});
|
|
34
|
-
|
|
34
|
+
const action = yield repos.action.start(startingAction, { recipe });
|
|
35
35
|
let processSeatInfoSyncResult;
|
|
36
36
|
try {
|
|
37
37
|
// 着券済に対する冪等性を確保する必要はあるが、
|
|
@@ -91,8 +91,16 @@ function payMovieTicket(params) {
|
|
|
91
91
|
// ? { seatInfoSyncResult: <factory.action.trade.pay.ISeatInfoSyncResult>seatInfoSyncResult }
|
|
92
92
|
// : undefined
|
|
93
93
|
};
|
|
94
|
-
|
|
95
|
-
yield (0, onPaid_1.onPaid)(
|
|
94
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result, recipe });
|
|
95
|
+
yield (0, onPaid_1.onPaid)({
|
|
96
|
+
actionStatus: factory.actionStatusType.CompletedActionStatus,
|
|
97
|
+
id: action.id,
|
|
98
|
+
object: action.object,
|
|
99
|
+
potentialActions: action.potentialActions,
|
|
100
|
+
project: action.project,
|
|
101
|
+
purpose: action.purpose,
|
|
102
|
+
typeOf: action.typeOf
|
|
103
|
+
})(repos);
|
|
96
104
|
return action;
|
|
97
105
|
});
|
|
98
106
|
}
|
|
@@ -58,7 +58,7 @@ function refundMovieTicket(params) {
|
|
|
58
58
|
const refundActionAttributes = Object.assign({ agent, object, potentialActions, project, purpose, recipient, typeOf }, (typeof (sameAs === null || sameAs === void 0 ? void 0 : sameAs.id) === 'string') ? { sameAs: { id: sameAs.id, typeOf: 'Task' } } : undefined
|
|
59
59
|
// instrument // discontinue(2024-06-10~)
|
|
60
60
|
);
|
|
61
|
-
|
|
61
|
+
const action = yield repos.action.start(refundActionAttributes, { recipe });
|
|
62
62
|
let processSeatInfoSyncCancelResult;
|
|
63
63
|
let processSeatInfoSyncResult;
|
|
64
64
|
try {
|
|
@@ -92,8 +92,10 @@ function refundMovieTicket(params) {
|
|
|
92
92
|
}
|
|
93
93
|
// アクションとしてはFailedだが後続処理を実行するケースに対応(2024-03-21~)
|
|
94
94
|
const seatInfoSyncResultAsError = processSeatInfoSyncResult === null || processSeatInfoSyncResult === void 0 ? void 0 : processSeatInfoSyncResult.seatInfoSyncResultAsError;
|
|
95
|
+
let actionStatus;
|
|
95
96
|
if (seatInfoSyncResultAsError !== undefined) {
|
|
96
|
-
|
|
97
|
+
yield repos.action.giveUp({ typeOf: action.typeOf, id: action.id, error: seatInfoSyncResultAsError });
|
|
98
|
+
actionStatus = factory.actionStatusType.FailedActionStatus;
|
|
97
99
|
}
|
|
98
100
|
else {
|
|
99
101
|
// add recipe(2024-06-04~)
|
|
@@ -107,9 +109,18 @@ function refundMovieTicket(params) {
|
|
|
107
109
|
// ? { seatInfoSyncCancelResult: processSeatInfoSyncCancelResult.seatInfoSyncCancelResult }
|
|
108
110
|
// : undefined
|
|
109
111
|
};
|
|
110
|
-
|
|
112
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult, recipe });
|
|
113
|
+
actionStatus = factory.actionStatusType.CompletedActionStatus;
|
|
111
114
|
}
|
|
112
|
-
yield (0, onRefund_1.onRefund)(
|
|
115
|
+
yield (0, onRefund_1.onRefund)({
|
|
116
|
+
actionStatus,
|
|
117
|
+
id: action.id,
|
|
118
|
+
object: action.object,
|
|
119
|
+
potentialActions: action.potentialActions,
|
|
120
|
+
project: action.project,
|
|
121
|
+
purpose: action.purpose,
|
|
122
|
+
typeOf: action.typeOf
|
|
123
|
+
})(repos);
|
|
113
124
|
});
|
|
114
125
|
}
|
|
115
126
|
exports.refundMovieTicket = refundMovieTicket;
|
|
@@ -150,7 +150,7 @@ function checkByIdentifierIfNotYet(params) {
|
|
|
150
150
|
reservationFor: { id: { $eq: params.screeningEvent.id } } // 指定のイベントにおいて
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
|
-
} }, (typeof placeOrderId === 'string') ? { purpose: { id: { $in: [placeOrderId] } } } : undefined), ['
|
|
153
|
+
} }, (typeof placeOrderId === 'string') ? { purpose: { id: { $in: [placeOrderId] } } } : undefined), ['id'], [])).shift();
|
|
154
154
|
debug('alreadyCheckedAction:', JSON.stringify(alreadyCheckedAction), 'placeOrderId:', placeOrderId);
|
|
155
155
|
if (alreadyCheckedAction !== undefined) {
|
|
156
156
|
const recipe = yield repos.action.findRecipeByAction({
|
|
@@ -233,8 +233,7 @@ function payPaymentCard(params) {
|
|
|
233
233
|
var _a, _b, _c;
|
|
234
234
|
const payObject = params.object;
|
|
235
235
|
const paymentServiceId = payObject[0].id;
|
|
236
|
-
|
|
237
|
-
let action = yield repos.action.start(params);
|
|
236
|
+
const action = yield repos.action.start(params);
|
|
238
237
|
try {
|
|
239
238
|
const transactionNumber = payObject[0].paymentMethod.paymentMethodId;
|
|
240
239
|
const availableChannel = yield repos.product.findAvailableChannel({
|
|
@@ -265,8 +264,16 @@ function payPaymentCard(params) {
|
|
|
265
264
|
}
|
|
266
265
|
// アクション完了
|
|
267
266
|
const actionResult = {};
|
|
268
|
-
|
|
269
|
-
yield (0, onPaid_1.onPaid)(
|
|
267
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
268
|
+
yield (0, onPaid_1.onPaid)({
|
|
269
|
+
actionStatus: factory.actionStatusType.CompletedActionStatus,
|
|
270
|
+
id: action.id,
|
|
271
|
+
object: action.object,
|
|
272
|
+
potentialActions: action.potentialActions,
|
|
273
|
+
project: action.project,
|
|
274
|
+
purpose: action.purpose,
|
|
275
|
+
typeOf: action.typeOf
|
|
276
|
+
})(repos);
|
|
270
277
|
return action;
|
|
271
278
|
});
|
|
272
279
|
}
|
|
@@ -287,7 +294,7 @@ function refundPaymentCard(params) {
|
|
|
287
294
|
if (typeof accountNumber !== 'string') {
|
|
288
295
|
throw new factory.errors.ArgumentNull('serviceOutput.paymentAccount.accountNumber');
|
|
289
296
|
}
|
|
290
|
-
|
|
297
|
+
const action = yield repos.action.start(params);
|
|
291
298
|
let accountTransactionNumber4refund;
|
|
292
299
|
try {
|
|
293
300
|
const availableChannel = yield repos.product.findAvailableChannel({
|
|
@@ -379,8 +386,16 @@ function refundPaymentCard(params) {
|
|
|
379
386
|
const result = {
|
|
380
387
|
accountTransaction: { transactionNumber: accountTransactionNumber4refund }
|
|
381
388
|
};
|
|
382
|
-
|
|
383
|
-
yield (0, onRefund_1.onRefund)(
|
|
389
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result });
|
|
390
|
+
yield (0, onRefund_1.onRefund)({
|
|
391
|
+
actionStatus: factory.actionStatusType.CompletedActionStatus,
|
|
392
|
+
id: action.id,
|
|
393
|
+
object: action.object,
|
|
394
|
+
potentialActions: action.potentialActions,
|
|
395
|
+
project: action.project,
|
|
396
|
+
purpose: action.purpose,
|
|
397
|
+
typeOf: action.typeOf
|
|
398
|
+
})(repos);
|
|
384
399
|
return action;
|
|
385
400
|
});
|
|
386
401
|
}
|
|
@@ -61,7 +61,7 @@ function cancelPengindIfNotYet(params) {
|
|
|
61
61
|
id: { $in: [params.purpose.id] },
|
|
62
62
|
typeOf: { $in: [params.purpose.typeOf] }
|
|
63
63
|
}
|
|
64
|
-
}, ['
|
|
64
|
+
}, ['id'], []);
|
|
65
65
|
if (completedActions.length === 0) {
|
|
66
66
|
const actionAttributes = (0, factory_1.createCancelPendingReservationAction)({ transaction: reserveTransaction });
|
|
67
67
|
if (actionAttributes !== undefined) {
|
|
@@ -133,7 +133,7 @@ params, options) {
|
|
|
133
133
|
id: { $in: [actionAttributes.purpose.id] },
|
|
134
134
|
typeOf: { $in: [actionAttributes.purpose.typeOf] }
|
|
135
135
|
}
|
|
136
|
-
}, ['
|
|
136
|
+
}, ['id'], []);
|
|
137
137
|
debug(completedActions.length, 'completed reserveAction found. byTask:', options === null || options === void 0 ? void 0 : options.byTask, 'reservationNumber:', reservationPackage.reservationNumber);
|
|
138
138
|
if (completedActions.length === 0) {
|
|
139
139
|
const action = yield repos.action.start(actionAttributes);
|
package/package.json
CHANGED
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.
|
|
13
|
-
"@cinerino/sdk": "10.
|
|
14
|
-
"@motionpicture/coa-service": "9.
|
|
12
|
+
"@chevre/factory": "4.382.0-alpha.1",
|
|
13
|
+
"@cinerino/sdk": "10.8.0-alpha.1",
|
|
14
|
+
"@motionpicture/coa-service": "9.5.0-alpha.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.3.0",
|
|
16
16
|
"@sendgrid/mail": "6.4.0",
|
|
17
17
|
"@surfrock/sdk": "1.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": "22.2.0-alpha.
|
|
113
|
+
"version": "22.2.0-alpha.25"
|
|
114
114
|
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-implicit-dependencies no-console
|
|
2
|
-
import { chevre } from '../../../lib/index';
|
|
3
|
-
|
|
4
|
-
import * as mongoose from 'mongoose';
|
|
5
|
-
|
|
6
|
-
// const project = { id: String(process.env.PROJECT_ID) };
|
|
7
|
-
|
|
8
|
-
mongoose.Model.on('index', (...args) => {
|
|
9
|
-
console.error('******** index event emitted. ********\n', args);
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
async function main() {
|
|
13
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
14
|
-
|
|
15
|
-
const actionRepo = await chevre.repository.Action.createInstance(mongoose.connection);
|
|
16
|
-
const actions = await actionRepo.search(
|
|
17
|
-
{
|
|
18
|
-
limit: 1,
|
|
19
|
-
// typeOf: { $eq: chevre.factory.actionType.CheckAction },
|
|
20
|
-
// project: { id: { $eq: project.id } },
|
|
21
|
-
// object: {
|
|
22
|
-
// movieTickets: {
|
|
23
|
-
// identifier: { $eq: '0947524082' },
|
|
24
|
-
// serviceOutput: { reservationFor: { id: { $eq: 'clhvvbpyn' } } }
|
|
25
|
-
// }
|
|
26
|
-
// }
|
|
27
|
-
// instrument: { transactionNumber: { $eq: 'x' } },
|
|
28
|
-
sameAs: { id: { $eq: '66275034ae5d4c3e8997808c' } }
|
|
29
|
-
},
|
|
30
|
-
['_id'],
|
|
31
|
-
[]
|
|
32
|
-
);
|
|
33
|
-
console.log('actions:', actions);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
main()
|
|
37
|
-
.then(() => {
|
|
38
|
-
console.log('success!');
|
|
39
|
-
})
|
|
40
|
-
.catch(console.error);
|