@chevre/domain 24.0.0-alpha.19 → 24.0.0-alpha.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/chevre/repo/action/checkMovieTicket.d.ts +38 -0
- package/lib/chevre/repo/action/checkMovieTicket.js +55 -0
- package/lib/chevre/service/assetTransaction/pay/start/processAuthorize.d.ts +2 -0
- package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeMovieTicket.d.ts +2 -0
- package/lib/chevre/service/assetTransaction/pay/start.d.ts +2 -0
- package/lib/chevre/service/payment/any/authorize.d.ts +2 -0
- package/lib/chevre/service/payment/movieTicket/authorize.d.ts +2 -0
- package/lib/chevre/service/payment/movieTicket/validation.d.ts +11 -10
- package/lib/chevre/service/payment/movieTicket/validation.js +18 -15
- package/lib/chevre/service/task/authorizePayment.js +2 -0
- package/package.json +1 -1
|
@@ -52,4 +52,42 @@ export declare class CheckMovieTicketActionRepo extends ActionProcessRepo<ICheck
|
|
|
52
52
|
}): Promise<(surfrockFactory.service.auth.purchaseNumberAuth.INvalidTicket & {
|
|
53
53
|
knyknrNo: string;
|
|
54
54
|
})[]>;
|
|
55
|
+
/**
|
|
56
|
+
* 認証済アクション参照
|
|
57
|
+
*/
|
|
58
|
+
findCompletedCheckActions(params: Pick<factory.action.ISearchConditions, 'sort'> & {
|
|
59
|
+
/**
|
|
60
|
+
* アクションID
|
|
61
|
+
*/
|
|
62
|
+
id?: string;
|
|
63
|
+
purpose?: {
|
|
64
|
+
/**
|
|
65
|
+
* 注文取引ID
|
|
66
|
+
*/
|
|
67
|
+
id?: string;
|
|
68
|
+
};
|
|
69
|
+
object?: {
|
|
70
|
+
/**
|
|
71
|
+
* 決済サービス
|
|
72
|
+
*/
|
|
73
|
+
id?: {
|
|
74
|
+
$eq?: string;
|
|
75
|
+
};
|
|
76
|
+
movieTickets?: {
|
|
77
|
+
identifier?: {
|
|
78
|
+
$eq?: string;
|
|
79
|
+
};
|
|
80
|
+
serviceOutput?: {
|
|
81
|
+
reservationFor?: {
|
|
82
|
+
id?: {
|
|
83
|
+
$eq?: string;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
typeOf?: {
|
|
89
|
+
$eq?: factory.service.paymentService.PaymentServiceType.MovieTicket;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
}): Promise<Pick<ICheckMovieTicketAction, 'id'>[]>;
|
|
55
93
|
}
|
|
@@ -141,5 +141,60 @@ class CheckMovieTicketActionRepo extends actionProcess_1.ActionProcessRepo {
|
|
|
141
141
|
.option({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
142
142
|
.exec();
|
|
143
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* 認証済アクション参照
|
|
146
|
+
*/
|
|
147
|
+
async findCompletedCheckActions(params) {
|
|
148
|
+
const andConditions = [
|
|
149
|
+
...(typeof params.id === 'string') ? [{ _id: { $eq: params.id } }] : [],
|
|
150
|
+
{ typeOf: { $eq: factory.actionType.CheckAction } },
|
|
151
|
+
{ actionStatus: { $eq: factory.actionStatusType.CompletedActionStatus } }
|
|
152
|
+
];
|
|
153
|
+
const objectMovieTicketsIdentifierEq = params.object?.movieTickets?.identifier?.$eq;
|
|
154
|
+
if (typeof objectMovieTicketsIdentifierEq === 'string') {
|
|
155
|
+
andConditions.push({
|
|
156
|
+
'object.movieTickets.identifier': { $exists: true, $eq: objectMovieTicketsIdentifierEq }
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
const objectMovieTicketsServiceOutputReservationForIdEq = params.object?.movieTickets?.serviceOutput?.reservationFor?.id?.$eq;
|
|
160
|
+
if (typeof objectMovieTicketsServiceOutputReservationForIdEq === 'string') {
|
|
161
|
+
andConditions.push({
|
|
162
|
+
'object.movieTickets.serviceOutput.reservationFor.id': { $exists: true, $eq: objectMovieTicketsServiceOutputReservationForIdEq }
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
const objectTypeOfEq = params.object?.typeOf?.$eq;
|
|
166
|
+
if (typeof objectTypeOfEq === 'string') {
|
|
167
|
+
andConditions.push({
|
|
168
|
+
'object.typeOf': { $exists: true, $eq: objectTypeOfEq }
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
const objectIdEq = params.object?.id?.$eq;
|
|
172
|
+
if (typeof objectIdEq === 'string') {
|
|
173
|
+
andConditions.push({
|
|
174
|
+
'object.id': { $exists: true, $eq: objectIdEq }
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
const purposeIdEq = params.purpose?.id;
|
|
178
|
+
if (typeof purposeIdEq === 'string') {
|
|
179
|
+
andConditions.push({
|
|
180
|
+
'purpose.id': { $exists: true, $eq: purposeIdEq }
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
const projection = {
|
|
184
|
+
_id: 0,
|
|
185
|
+
id: { $toString: '$_id' },
|
|
186
|
+
};
|
|
187
|
+
const query = this.actionModel.find({ $and: andConditions }, projection);
|
|
188
|
+
query.limit(1);
|
|
189
|
+
/* istanbul ignore else */
|
|
190
|
+
if (params.sort?.startDate !== undefined) {
|
|
191
|
+
query.sort({ startDate: params.sort.startDate });
|
|
192
|
+
}
|
|
193
|
+
// const explainResult = await (<any>query).explain();
|
|
194
|
+
// console.log(explainResult[0].executionStats.allPlansExecution.map((e: any) => e.executionStages.inputStage));
|
|
195
|
+
return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
196
|
+
.lean() // 2024-08-26~
|
|
197
|
+
.exec();
|
|
198
|
+
}
|
|
144
199
|
}
|
|
145
200
|
exports.CheckMovieTicketActionRepo = CheckMovieTicketActionRepo;
|
|
@@ -2,6 +2,7 @@ import * as factory from '../../../../factory';
|
|
|
2
2
|
import { Settings } from '../../../../settings';
|
|
3
3
|
import type { AccountingReportRepo } from '../../../../repo/accountingReport';
|
|
4
4
|
import type { ActionRepo } from '../../../../repo/action';
|
|
5
|
+
import type { CheckMovieTicketActionRepo } from '../../../../repo/action/checkMovieTicket';
|
|
5
6
|
import type { AssetTransactionRepo } from '../../../../repo/assetTransaction';
|
|
6
7
|
import type { CredentialsRepo } from '../../../../repo/credentials';
|
|
7
8
|
import type { EventRepo } from '../../../../repo/event';
|
|
@@ -14,6 +15,7 @@ import { IPaymentAgencyTransaction } from '../../../payment/creditCard';
|
|
|
14
15
|
export interface IProcessAuthorizeOperationRepos {
|
|
15
16
|
accountingReport: AccountingReportRepo;
|
|
16
17
|
action: ActionRepo;
|
|
18
|
+
checkMovieTicketAction: CheckMovieTicketActionRepo;
|
|
17
19
|
credentials: CredentialsRepo;
|
|
18
20
|
event: EventRepo;
|
|
19
21
|
paymentAccepted: SellerPaymentAcceptedRepo;
|
|
@@ -2,6 +2,7 @@ import * as factory from '../../../../factory';
|
|
|
2
2
|
import { Settings } from '../../../../settings';
|
|
3
3
|
import type { AccountingReportRepo } from '../../../../repo/accountingReport';
|
|
4
4
|
import type { ActionRepo } from '../../../../repo/action';
|
|
5
|
+
import type { CheckMovieTicketActionRepo } from '../../../../repo/action/checkMovieTicket';
|
|
5
6
|
import type { AssetTransactionRepo } from '../../../../repo/assetTransaction';
|
|
6
7
|
import type { CredentialsRepo } from '../../../../repo/credentials';
|
|
7
8
|
import type { EventRepo } from '../../../../repo/event';
|
|
@@ -32,6 +33,7 @@ export declare function processAuthorizeMovieTicket(params: factory.assetTransac
|
|
|
32
33
|
}): (repos: {
|
|
33
34
|
accountingReport: AccountingReportRepo;
|
|
34
35
|
action: ActionRepo;
|
|
36
|
+
checkMovieTicketAction: CheckMovieTicketActionRepo;
|
|
35
37
|
credentials: CredentialsRepo;
|
|
36
38
|
event: EventRepo;
|
|
37
39
|
paymentAccepted: SellerPaymentAcceptedRepo;
|
|
@@ -3,6 +3,7 @@ import { Settings } from '../../../settings';
|
|
|
3
3
|
import type { AcceptedPaymentMethodRepo } from '../../../repo/acceptedPaymentMethod';
|
|
4
4
|
import type { AccountingReportRepo } from '../../../repo/accountingReport';
|
|
5
5
|
import type { ActionRepo } from '../../../repo/action';
|
|
6
|
+
import type { CheckMovieTicketActionRepo } from '../../../repo/action/checkMovieTicket';
|
|
6
7
|
import type { AssetTransactionRepo } from '../../../repo/assetTransaction';
|
|
7
8
|
import type { CredentialsRepo } from '../../../repo/credentials';
|
|
8
9
|
import type { EventRepo } from '../../../repo/event';
|
|
@@ -18,6 +19,7 @@ export interface IStartOperationRepos {
|
|
|
18
19
|
acceptedPaymentMethod: AcceptedPaymentMethodRepo;
|
|
19
20
|
accountingReport: AccountingReportRepo;
|
|
20
21
|
action: ActionRepo;
|
|
22
|
+
checkMovieTicketAction: CheckMovieTicketActionRepo;
|
|
21
23
|
credentials: CredentialsRepo;
|
|
22
24
|
event: EventRepo;
|
|
23
25
|
eventSeries: EventSeriesRepo;
|
|
@@ -3,6 +3,7 @@ import { Settings } from '../../../settings';
|
|
|
3
3
|
import type { AcceptedPaymentMethodRepo } from '../../../repo/acceptedPaymentMethod';
|
|
4
4
|
import type { AccountingReportRepo } from '../../../repo/accountingReport';
|
|
5
5
|
import type { ActionRepo } from '../../../repo/action';
|
|
6
|
+
import type { CheckMovieTicketActionRepo } from '../../../repo/action/checkMovieTicket';
|
|
6
7
|
import type { AssetTransactionRepo } from '../../../repo/assetTransaction';
|
|
7
8
|
import type { AuthorizationRepo } from '../../../repo/authorization';
|
|
8
9
|
import type { ConfirmationNumberRepo } from '../../../repo/confirmationNumber';
|
|
@@ -24,6 +25,7 @@ interface IAuthorizeRepos {
|
|
|
24
25
|
acceptedPaymentMethod: AcceptedPaymentMethodRepo;
|
|
25
26
|
accountingReport: AccountingReportRepo;
|
|
26
27
|
action: ActionRepo;
|
|
28
|
+
checkMovieTicketAction: CheckMovieTicketActionRepo;
|
|
27
29
|
assetTransaction: AssetTransactionRepo;
|
|
28
30
|
authorization: AuthorizationRepo;
|
|
29
31
|
confirmationNumber: ConfirmationNumberRepo;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AccountingReportRepo } from '../../../repo/accountingReport';
|
|
2
2
|
import type { ActionRepo } from '../../../repo/action';
|
|
3
|
+
import type { CheckMovieTicketActionRepo } from '../../../repo/action/checkMovieTicket';
|
|
3
4
|
import type { CredentialsRepo } from '../../../repo/credentials';
|
|
4
5
|
import type { EventRepo } from '../../../repo/event';
|
|
5
6
|
import type { PaymentServiceRepo } from '../../../repo/paymentService';
|
|
@@ -38,6 +39,7 @@ declare function authorize(params: factory.assetTransaction.pay.IStartParamsWith
|
|
|
38
39
|
};
|
|
39
40
|
}): (repos: {
|
|
40
41
|
action: ActionRepo;
|
|
42
|
+
checkMovieTicketAction: CheckMovieTicketActionRepo;
|
|
41
43
|
accountingReport: AccountingReportRepo;
|
|
42
44
|
credentials: CredentialsRepo;
|
|
43
45
|
event: EventRepo;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CheckMovieTicketActionRepo } from '../../../repo/action/checkMovieTicket';
|
|
2
2
|
import type { CredentialsRepo } from '../../../repo/credentials';
|
|
3
3
|
import type { EventRepo } from '../../../repo/event';
|
|
4
4
|
import type { PaymentServiceRepo } from '../../../repo/paymentService';
|
|
@@ -7,6 +7,15 @@ import type { SellerPaymentAcceptedRepo } from '../../../repo/sellerPaymentAccep
|
|
|
7
7
|
import type { TaskRepo } from '../../../repo/task';
|
|
8
8
|
import * as factory from '../../../factory';
|
|
9
9
|
import { Settings } from '../../../settings';
|
|
10
|
+
export interface IValidateMovieTicketRepos {
|
|
11
|
+
checkMovieTicketAction: CheckMovieTicketActionRepo;
|
|
12
|
+
credentials: CredentialsRepo;
|
|
13
|
+
event: EventRepo;
|
|
14
|
+
paymentAccepted: SellerPaymentAcceptedRepo;
|
|
15
|
+
paymentService: PaymentServiceRepo;
|
|
16
|
+
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
17
|
+
task: TaskRepo;
|
|
18
|
+
}
|
|
10
19
|
export declare function validateMovieTicket(params: factory.assetTransaction.pay.IStartParamsWithoutDetail, paymentServiceId: string, checkedAction: {
|
|
11
20
|
id: string;
|
|
12
21
|
}, purpose: {
|
|
@@ -14,14 +23,6 @@ export declare function validateMovieTicket(params: factory.assetTransaction.pay
|
|
|
14
23
|
* placeOrder ID
|
|
15
24
|
*/
|
|
16
25
|
id?: string;
|
|
17
|
-
}): (repos: {
|
|
18
|
-
action: ActionRepo;
|
|
19
|
-
credentials: CredentialsRepo;
|
|
20
|
-
event: EventRepo;
|
|
21
|
-
paymentAccepted: SellerPaymentAcceptedRepo;
|
|
22
|
-
paymentService: PaymentServiceRepo;
|
|
23
|
-
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
24
|
-
task: TaskRepo;
|
|
25
|
-
}, settings: Settings) => Promise<{
|
|
26
|
+
}): (repos: IValidateMovieTicketRepos, settings: Settings) => Promise<{
|
|
26
27
|
accountsReceivablesByServiceType: factory.assetTransaction.pay.IAccountsReceivableByServiceType[];
|
|
27
28
|
}>;
|
|
@@ -139,24 +139,26 @@ function checkByIdentifierIfNotYet(params) {
|
|
|
139
139
|
}
|
|
140
140
|
const specifiedCheckedActionId = params.checkedAction?.id;
|
|
141
141
|
if (typeof specifiedCheckedActionId === 'string' && specifiedCheckedActionId !== '') {
|
|
142
|
-
alreadyCheckedAction = (await repos.
|
|
143
|
-
limit: 1,
|
|
144
|
-
page: 1,
|
|
145
|
-
id: { $in: [specifiedCheckedActionId] },
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
142
|
+
alreadyCheckedAction = (await repos.checkMovieTicketAction.findCompletedCheckActions({
|
|
143
|
+
// limit: 1,
|
|
144
|
+
// page: 1,
|
|
145
|
+
// id: { $in: [specifiedCheckedActionId] },
|
|
146
|
+
id: specifiedCheckedActionId,
|
|
147
|
+
// actionStatus: { $in: [factory.actionStatusType.CompletedActionStatus] },
|
|
148
|
+
// ...(typeof placeOrderId === 'string') ? { purpose: { id: { $in: [placeOrderId] } } } : undefined
|
|
149
|
+
...(typeof placeOrderId === 'string') ? { purpose: { id: placeOrderId } } : undefined
|
|
150
|
+
})).shift();
|
|
149
151
|
if (alreadyCheckedAction === undefined) {
|
|
150
152
|
throw new factory.errors.NotFound(factory.actionType.CheckAction);
|
|
151
153
|
}
|
|
152
154
|
}
|
|
153
155
|
else {
|
|
154
|
-
alreadyCheckedAction = (await repos.
|
|
155
|
-
limit: 1,
|
|
156
|
-
page: 1,
|
|
156
|
+
alreadyCheckedAction = (await repos.checkMovieTicketAction.findCompletedCheckActions({
|
|
157
|
+
// limit: 1,
|
|
158
|
+
// page: 1,
|
|
157
159
|
sort: { startDate: factory.sortType.Descending },
|
|
158
|
-
typeOf: { $eq: factory.actionType.CheckAction },
|
|
159
|
-
actionStatus: { $in: [factory.actionStatusType.CompletedActionStatus] },
|
|
160
|
+
// typeOf: { $eq: factory.actionType.CheckAction },
|
|
161
|
+
// actionStatus: { $in: [factory.actionStatusType.CompletedActionStatus] },
|
|
160
162
|
object: {
|
|
161
163
|
typeOf: { $eq: factory.service.paymentService.PaymentServiceType.MovieTicket },
|
|
162
164
|
id: { $eq: params.paymentServiceId }, // 指定の決済サービスにおいて
|
|
@@ -167,11 +169,12 @@ function checkByIdentifierIfNotYet(params) {
|
|
|
167
169
|
}
|
|
168
170
|
}
|
|
169
171
|
},
|
|
170
|
-
...(typeof placeOrderId === 'string') ? { purpose: { id: { $in: [placeOrderId] } } } : undefined
|
|
171
|
-
|
|
172
|
+
// ...(typeof placeOrderId === 'string') ? { purpose: { id: { $in: [placeOrderId] } } } : undefined
|
|
173
|
+
...(typeof placeOrderId === 'string') ? { purpose: { id: placeOrderId } } : undefined
|
|
174
|
+
})).shift();
|
|
172
175
|
}
|
|
173
176
|
if (alreadyCheckedAction !== undefined) {
|
|
174
|
-
const recipe = await repos.
|
|
177
|
+
const recipe = await repos.checkMovieTicketAction.findRecipeByAction({
|
|
175
178
|
project: { id: params.screeningEvent.project.id },
|
|
176
179
|
recipeFor: { id: alreadyCheckedAction.id }
|
|
177
180
|
});
|
|
@@ -28,6 +28,7 @@ const factory = __importStar(require("../../factory"));
|
|
|
28
28
|
const acceptedPaymentMethod_1 = require("../../repo/acceptedPaymentMethod");
|
|
29
29
|
const accountingReport_1 = require("../../repo/accountingReport");
|
|
30
30
|
const action_1 = require("../../repo/action");
|
|
31
|
+
const checkMovieTicket_1 = require("../../repo/action/checkMovieTicket");
|
|
31
32
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
32
33
|
const authorization_1 = require("../../repo/authorization");
|
|
33
34
|
const confirmationNumber_1 = require("../../repo/confirmationNumber");
|
|
@@ -76,6 +77,7 @@ function call(params) {
|
|
|
76
77
|
acceptedPaymentMethod: new acceptedPaymentMethod_1.AcceptedPaymentMethodRepo(connection),
|
|
77
78
|
accountingReport: new accountingReport_1.AccountingReportRepo(connection),
|
|
78
79
|
action: actionRepo,
|
|
80
|
+
checkMovieTicketAction: new checkMovieTicket_1.CheckMovieTicketActionRepo(connection),
|
|
79
81
|
assetTransaction: new assetTransaction_1.AssetTransactionRepo(connection),
|
|
80
82
|
authorization: new authorization_1.AuthorizationRepo(connection),
|
|
81
83
|
confirmationNumber: new confirmationNumber_1.ConfirmationNumberRepo({ connection }),
|
package/package.json
CHANGED