@chevre/domain 22.7.0-alpha.9 → 22.7.0
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/aggregateOfferCatalogItemList.ts +36 -0
- package/example/src/chevre/aggregation/aggregateOffersOnEvent.ts +1 -1
- package/example/src/chevre/aggregation/searchAggregateReservations.ts +1 -1
- package/example/src/chevre/deleteDiscontinuedPeople.ts +153 -0
- package/example/src/chevre/deleteDiscontinuedPeopleByFetch.ts +38 -0
- package/example/src/chevre/findJWTSetting.ts +19 -0
- package/example/src/chevre/person/checkUserPoolClients.ts +119 -0
- package/example/src/chevre/person/cleanUpCognitoUsers.ts +73 -23
- package/example/src/chevre/person/cleanUpCognitoUsersByFetch.ts +162 -0
- package/example/src/chevre/person/cleanUpCreditCard.ts +113 -0
- package/example/src/chevre/unsetUnnecessaryFields.ts +3 -29
- package/example/src/chevre/upsertManyEventsByAdditionalProperty.ts +152 -150
- package/lib/chevre/credentials.d.ts +0 -5
- package/lib/chevre/credentials.js +0 -13
- package/lib/chevre/repo/action.d.ts +4 -20
- package/lib/chevre/repo/action.js +61 -160
- package/lib/chevre/repo/additionalProperty.js +1 -1
- package/lib/chevre/repo/aggregateOffer.js +1 -1
- package/lib/chevre/repo/aggregateReservation.d.ts +2 -2
- package/lib/chevre/repo/aggregateReservation.js +1 -1
- package/lib/chevre/repo/categoryCode.d.ts +6 -2
- package/lib/chevre/repo/categoryCode.js +15 -8
- package/lib/chevre/repo/comment.js +1 -1
- package/lib/chevre/repo/creativeWork.js +1 -1
- package/lib/chevre/repo/customer.js +1 -1
- package/lib/chevre/repo/emailMessage.js +1 -1
- package/lib/chevre/repo/event.d.ts +10 -7
- package/lib/chevre/repo/event.js +40 -80
- package/lib/chevre/repo/mongoose/schemas/account.js +4 -12
- package/lib/chevre/repo/mongoose/schemas/accountTransaction.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/accountTransaction.js +18 -23
- package/lib/chevre/repo/mongoose/schemas/aggregateReservation.d.ts +0 -1
- package/lib/chevre/repo/mongoose/schemas/aggregateReservation.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/event.js +0 -1
- package/lib/chevre/repo/mongoose/schemas/setting.d.ts +26 -0
- package/lib/chevre/repo/mongoose/schemas/setting.js +1 -0
- package/lib/chevre/repo/offerCatalog.d.ts +9 -0
- package/lib/chevre/repo/offerCatalog.js +37 -3
- package/lib/chevre/repo/offerCatalogItem.d.ts +9 -0
- package/lib/chevre/repo/offerCatalogItem.js +37 -1
- package/lib/chevre/repo/offerItemCondition.js +1 -1
- package/lib/chevre/repo/ownershipInfo.js +1 -1
- package/lib/chevre/repo/person.d.ts +5 -3
- package/lib/chevre/repo/person.js +0 -1
- package/lib/chevre/repo/priceSpecification.js +1 -1
- package/lib/chevre/repo/seller.js +1 -1
- package/lib/chevre/repo/setting/jwt.d.ts +10 -0
- package/lib/chevre/repo/setting/jwt.js +65 -0
- package/lib/chevre/repo/task.js +1 -1
- package/lib/chevre/repository.d.ts +7 -0
- package/lib/chevre/repository.js +17 -1
- package/lib/chevre/service/aggregation/event.d.ts +1 -2
- package/lib/chevre/service/aggregation/event.js +1 -3
- package/lib/chevre/service/assetTransaction/pay.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/pay.js +12 -17
- package/lib/chevre/service/assetTransaction/reserve/start/factory/price.js +8 -19
- package/lib/chevre/service/code.d.ts +3 -34
- package/lib/chevre/service/code.js +18 -136
- package/lib/chevre/service/offer/event/authorize/factory.js +19 -14
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre/requestedProgramMembershipUsed2permit.d.ts +0 -5
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre/requestedProgramMembershipUsed2permit.js +43 -39
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +1 -4
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.js +12 -4
- package/lib/chevre/service/offer/event/authorize.d.ts +1 -4
- package/lib/chevre/service/offer/event/authorize.js +6 -2
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.d.ts +2 -1
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.js +10 -4
- package/lib/chevre/service/offer/factory.js +22 -5
- package/lib/chevre/service/offer.d.ts +7 -9
- package/lib/chevre/service/offer.js +25 -24
- package/lib/chevre/service/order/deleteOrder.d.ts +4 -0
- package/lib/chevre/service/order/deleteOrder.js +48 -5
- package/lib/chevre/service/payment/any/factory.d.ts +1 -1
- package/lib/chevre/service/payment/any.d.ts +1 -4
- package/lib/chevre/service/payment/any.js +35 -22
- package/lib/chevre/service/payment/factory/createPayObjectServiceOutput.js +32 -26
- package/lib/chevre/service/payment/movieTicket/validation.js +1 -22
- package/lib/chevre/service/report/telemetry.js +3 -3
- package/lib/chevre/service/reserve/verifyToken4reservation.js +1 -16
- package/lib/chevre/service/task/acceptCOAOffer.js +24 -14
- package/lib/chevre/service/task/authorizePayment.js +7 -5
- package/lib/chevre/service/task/createEvent/createEventSeries.js +5 -2
- package/lib/chevre/service/task/deletePerson.js +57 -56
- package/lib/chevre/service/task/deleteTransaction.js +2 -0
- package/lib/chevre/service/task.d.ts +0 -2
- package/lib/chevre/service/transaction/deleteTransaction.d.ts +2 -0
- package/lib/chevre/service/transaction/moneyTransfer.d.ts +1 -6
- package/lib/chevre/service/transaction/moneyTransfer.js +57 -36
- package/package.json +9 -5
- package/example/src/chevre/findValidAuthorization.ts +0 -56
- package/example/src/chevre/saveAggregateReservation.ts +0 -43
- package/lib/chevre/credentials/jwt.d.ts +0 -23
- package/lib/chevre/credentials/jwt.js +0 -18
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.d.ts +0 -19
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +0 -145
- package/lib/chevre/service/task/aggregateUseActionsOnEvent.d.ts +0 -6
- package/lib/chevre/service/task/aggregateUseActionsOnEvent.js +0 -37
|
@@ -15,7 +15,6 @@ exports.publishPaymentUrl = exports.processVoidPayTransaction = exports.person2u
|
|
|
15
15
|
*/
|
|
16
16
|
const factory = require("../../factory");
|
|
17
17
|
const PayTransactionService = require("../assetTransaction/pay");
|
|
18
|
-
const code_1 = require("../code");
|
|
19
18
|
const factory_1 = require("./any/factory");
|
|
20
19
|
const fixConfirmationNumberAsNeeded_1 = require("./any/fixConfirmationNumberAsNeeded");
|
|
21
20
|
const handlePrePublishedPaymentMethodIdOnAuthorizing_1 = require("./any/handlePrePublishedPaymentMethodIdOnAuthorizing");
|
|
@@ -313,7 +312,11 @@ function minimizeObjectIncludingPaymentMethodDetails(authorizeObjectIncludingPay
|
|
|
313
312
|
*/
|
|
314
313
|
function authorize(params) {
|
|
315
314
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
316
|
-
return (repos, settings
|
|
315
|
+
return (repos, settings
|
|
316
|
+
// credentials: {
|
|
317
|
+
// jwt: JWTCredentials;
|
|
318
|
+
// }
|
|
319
|
+
) => __awaiter(this, void 0, void 0, function* () {
|
|
317
320
|
var _a, _b;
|
|
318
321
|
const { paymentServiceType, purpose, project } = params;
|
|
319
322
|
if (purpose.typeOf !== factory.transactionType.PlaceOrder) {
|
|
@@ -380,7 +383,7 @@ function authorize(params) {
|
|
|
380
383
|
const movieTickets = (Array.isArray(params.object.movieTickets)) ? params.object.movieTickets.map(factory_1.createMovieTicket) : undefined;
|
|
381
384
|
const { accountId } = yield fixAccountIdIfPossible({
|
|
382
385
|
object: params.object, project: { id: transaction.project.id }
|
|
383
|
-
})(
|
|
386
|
+
})();
|
|
384
387
|
const authorizeObjectIncludingPaymentMethodDetails = Object.assign(Object.assign(Object.assign(Object.assign({}, params.object), { accountId, paymentMethodId: transactionNumber, typeOf: factory.action.authorize.paymentMethod.any.ResultType.Payment }), (creditCard !== undefined) ? { creditCard } : undefined), (Array.isArray(movieTickets)) ? { movieTickets } : undefined);
|
|
385
388
|
const { authorizeObject } = minimizeObjectIncludingPaymentMethodDetails(authorizeObjectIncludingPaymentMethodDetails);
|
|
386
389
|
// 承認アクションを開始する
|
|
@@ -458,30 +461,40 @@ exports.authorize = authorize;
|
|
|
458
461
|
* 承認しようとしているobjectからaccountIdを決定する
|
|
459
462
|
*/
|
|
460
463
|
function fixAccountIdIfPossible(params) {
|
|
461
|
-
return (
|
|
464
|
+
return (
|
|
465
|
+
// repos: {
|
|
466
|
+
// action: ActionRepo;
|
|
467
|
+
// authorization: AuthorizationRepo;
|
|
468
|
+
// ticket: TicketRepo;
|
|
469
|
+
// }
|
|
470
|
+
// credentials: {
|
|
471
|
+
// jwt: JWTCredentials;
|
|
472
|
+
// }
|
|
473
|
+
) => __awaiter(this, void 0, void 0, function* () {
|
|
462
474
|
var _a, _b;
|
|
463
|
-
// let accountId = params.object?.accountId;
|
|
464
475
|
let accountId = '';
|
|
465
476
|
const fromLocation = (_a = params.object) === null || _a === void 0 ? void 0 : _a.fromLocation;
|
|
466
477
|
const movieTickets = (_b = params.object) === null || _b === void 0 ? void 0 : _b.movieTickets;
|
|
467
|
-
//
|
|
478
|
+
// discontinue token as fromLocation(ticketTokenへ移行するべき)(2024-12-18~)
|
|
468
479
|
if (typeof fromLocation === 'string') {
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
480
|
+
throw new factory.errors.NotImplemented('object.fromLocation as string not implemented');
|
|
481
|
+
// トークン化されたペイメントカード情報でリクエストされた場合、実ペイメントカード情報へ変換する
|
|
482
|
+
// const { authorizedObject } = await verifyToken({
|
|
483
|
+
// project: { id: params.project.id },
|
|
484
|
+
// agent: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
485
|
+
// token: fromLocation
|
|
486
|
+
// })(repos);
|
|
487
|
+
// const paymentCardOwnershipInfo = authorizedObject;
|
|
488
|
+
// if (Array.isArray(paymentCardOwnershipInfo)) {
|
|
489
|
+
// throw new factory.errors.NotImplemented('fromLocation as an array not implemented');
|
|
490
|
+
// }
|
|
491
|
+
// if (paymentCardOwnershipInfo.typeOf !== 'OwnershipInfo') {
|
|
492
|
+
// throw new factory.errors.Argument('fromLocation', 'must be OwnershipInfo');
|
|
493
|
+
// }
|
|
494
|
+
// if (paymentCardOwnershipInfo.typeOfGood.typeOf !== factory.permit.PermitType.Permit) {
|
|
495
|
+
// throw new factory.errors.Argument('fromLocation', 'must be Permit');
|
|
496
|
+
// }
|
|
497
|
+
// accountId = paymentCardOwnershipInfo.typeOfGood.identifier;
|
|
485
498
|
}
|
|
486
499
|
// 購入番号管理番号をaccountIdにセット(2024-03-24~)
|
|
487
500
|
if (Array.isArray(movieTickets) && movieTickets.length > 0) {
|
|
@@ -22,9 +22,9 @@ function createPayObjectServiceOutput(params) {
|
|
|
22
22
|
if (Array.isArray(movieTickets)) {
|
|
23
23
|
paymentServiceOutput = movieTickets.map((movieTicket) => {
|
|
24
24
|
var _a;
|
|
25
|
-
const amount =
|
|
25
|
+
const { amount, additionalProperty } = checkResult2movieTicket(movieTicket, params.checkResult);
|
|
26
26
|
const reservation4invoice = movieTicket2reservation4invoice(movieTicket, order, String(paymentMethodType), transaction.transactionNumber);
|
|
27
|
-
return Object.assign(Object.assign({ identifier: movieTicket.identifier }, (typeof (amount === null || amount === void 0 ? void 0 : amount.value) === 'number') ? { amount } : undefined), (typeof ((_a = reservation4invoice.priceSpecification) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string')
|
|
27
|
+
return Object.assign(Object.assign({ identifier: movieTicket.identifier, additionalProperty }, (typeof (amount === null || amount === void 0 ? void 0 : amount.value) === 'number') ? { amount } : undefined), (typeof ((_a = reservation4invoice.priceSpecification) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string')
|
|
28
28
|
? { serviceOutput: reservation4invoice }
|
|
29
29
|
: undefined);
|
|
30
30
|
});
|
|
@@ -36,32 +36,38 @@ function createPayObjectServiceOutput(params) {
|
|
|
36
36
|
return paymentServiceOutput;
|
|
37
37
|
}
|
|
38
38
|
exports.createPayObjectServiceOutput = createPayObjectServiceOutput;
|
|
39
|
-
function
|
|
40
|
-
|
|
39
|
+
function checkResult2movieTicket(
|
|
40
|
+
// transaction: Pick<factory.assetTransaction.ITransaction<factory.assetTransactionType.Pay>, 'object'>,
|
|
41
|
+
movieTicket, checkResult) {
|
|
42
|
+
var _a, _b;
|
|
43
|
+
const additionalProperty = [];
|
|
41
44
|
let amount;
|
|
42
|
-
// accountsReceivablesByServiceTypeへの依存をactionRecipe
|
|
43
|
-
const
|
|
44
|
-
const ykknInfoOfServiceType =
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
// value: Number(accountsReceivableByResponse)
|
|
52
|
-
// };
|
|
45
|
+
// accountsReceivablesByServiceTypeへの依存をactionRecipeへ移行(2024-12-16~)
|
|
46
|
+
const purchaseNumberInfo = (_a = checkResult === null || checkResult === void 0 ? void 0 : checkResult.purchaseNumberAuthResult.knyknrNoInfoOut) === null || _a === void 0 ? void 0 : _a.find(({ knyknrNo }) => knyknrNo === movieTicket.identifier);
|
|
47
|
+
const ykknInfoOfServiceType = (_b = purchaseNumberInfo === null || purchaseNumberInfo === void 0 ? void 0 : purchaseNumberInfo.ykknInfo) === null || _b === void 0 ? void 0 : _b.find((ykknInfo) => ykknInfo.ykknshTyp === movieTicket.serviceType);
|
|
48
|
+
const kijUnip = ykknInfoOfServiceType === null || ykknInfoOfServiceType === void 0 ? void 0 : ykknInfoOfServiceType.kijUnip;
|
|
49
|
+
if (typeof kijUnip === 'string') {
|
|
50
|
+
amount = {
|
|
51
|
+
typeOf: 'MonetaryAmount',
|
|
52
|
+
value: Number(kijUnip)
|
|
53
|
+
};
|
|
53
54
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
55
|
+
additionalProperty.push(...(typeof kijUnip === 'string') ? [{ name: 'kijUnip', value: kijUnip }] : [], ...(typeof (purchaseNumberInfo === null || purchaseNumberInfo === void 0 ? void 0 : purchaseNumberInfo.dnshKmTyp) === 'string') ? [{ name: 'dnshKmTyp', value: purchaseNumberInfo.dnshKmTyp }] : []
|
|
56
|
+
// ...(typeof purchaseNumberInfo?.znkkkytsknGkjknTyp === 'string')
|
|
57
|
+
// ? [{ name: 'znkkkytsknGkjknTyp', value: purchaseNumberInfo.znkkkytsknGkjknTyp }]
|
|
58
|
+
// : []
|
|
59
|
+
);
|
|
60
|
+
// const accountsReceivables = transaction.object.accountsReceivablesByServiceType;
|
|
61
|
+
// if (Array.isArray(accountsReceivables)) {
|
|
62
|
+
// const accountsReceivable = accountsReceivables.find((a) => a.serviceType === movieTicket.serviceType)?.accountsReceivable;
|
|
63
|
+
// if (typeof accountsReceivable === 'number') {
|
|
64
|
+
// amount = {
|
|
65
|
+
// typeOf: 'MonetaryAmount',
|
|
66
|
+
// value: accountsReceivable
|
|
67
|
+
// };
|
|
68
|
+
// }
|
|
69
|
+
// }
|
|
70
|
+
return { additionalProperty, amount };
|
|
65
71
|
}
|
|
66
72
|
function reservationPriceComponent2invoicePriceComponent(component) {
|
|
67
73
|
var _a;
|
|
@@ -12,7 +12,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.validateMovieTicket = void 0;
|
|
13
13
|
const createDebug = require("debug");
|
|
14
14
|
const factory = require("../../../factory");
|
|
15
|
-
const taskIdentifier_1 = require("../../../factory/taskIdentifier");
|
|
16
15
|
const processPurchaseNumberAuth_1 = require("./processPurchaseNumberAuth");
|
|
17
16
|
const debug = createDebug('chevre-domain:service:payment');
|
|
18
17
|
function validateMovieTicket(params, paymentServiceId,
|
|
@@ -119,28 +118,9 @@ function checkByIdentifierIfNotYet(params) {
|
|
|
119
118
|
var _a, _b, _c;
|
|
120
119
|
let checkResult;
|
|
121
120
|
let alreadyCheckedAction; // すでにCheckActionが存在すれば認証しない(2023-06-06~)
|
|
122
|
-
// search from checkMovieTicketTask(2024-06-26~)
|
|
123
121
|
const placeOrderId = params.purpose.id;
|
|
124
122
|
if (typeof placeOrderId === 'string') {
|
|
125
|
-
|
|
126
|
-
const taskIdentifier = (0, taskIdentifier_1.createCheckMovieTicketTaskIdentifier)({
|
|
127
|
-
project: { id: params.screeningEvent.project.id },
|
|
128
|
-
purpose: { id: placeOrderId },
|
|
129
|
-
object: {
|
|
130
|
-
id: params.paymentServiceId,
|
|
131
|
-
movieTicket: {
|
|
132
|
-
identifier: params.movieTicketIdentifier,
|
|
133
|
-
serviceOutput: { reservationFor: { id: params.screeningEvent.id } }
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
const existingCheckMovieTicketTask = yield repos.task.findByIdentifier({
|
|
138
|
-
project: { id: params.screeningEvent.project.id },
|
|
139
|
-
name: factory.taskName.CheckMovieTicket,
|
|
140
|
-
identifier: taskIdentifier
|
|
141
|
-
});
|
|
142
|
-
debug('existingCheckMovieTicketTask:', JSON.stringify(existingCheckMovieTicketTask), 'placeOrderId:', placeOrderId);
|
|
143
|
-
}
|
|
123
|
+
// no op
|
|
144
124
|
}
|
|
145
125
|
const specifiedCheckedActionId = (_a = params.checkedAction) === null || _a === void 0 ? void 0 : _a.id;
|
|
146
126
|
if (typeof specifiedCheckedActionId === 'string' && specifiedCheckedActionId !== '') {
|
|
@@ -160,7 +140,6 @@ function checkByIdentifierIfNotYet(params) {
|
|
|
160
140
|
}
|
|
161
141
|
}
|
|
162
142
|
} }, (typeof placeOrderId === 'string') ? { purpose: { id: { $in: [placeOrderId] } } } : undefined), ['id'])).shift();
|
|
163
|
-
debug('alreadyCheckedAction:', JSON.stringify(alreadyCheckedAction), 'placeOrderId:', placeOrderId);
|
|
164
143
|
}
|
|
165
144
|
if (alreadyCheckedAction !== undefined) {
|
|
166
145
|
const recipe = yield repos.action.findRecipeByAction({
|
|
@@ -349,7 +349,7 @@ function createGlobalFlow(measuredFrom, measuredThrough) {
|
|
|
349
349
|
const targetTaskNames = Object.keys(factory.taskName)
|
|
350
350
|
.map((k) => factory.taskName[k]);
|
|
351
351
|
const taskResults = yield Promise.all(targetTaskNames.map((taskName) => __awaiter(this, void 0, void 0, function* () {
|
|
352
|
-
const numberOfTasksCreated = yield repos.task.taskModel.
|
|
352
|
+
const numberOfTasksCreated = yield repos.task.taskModel.countDocuments({
|
|
353
353
|
name: taskName,
|
|
354
354
|
createdAt: {
|
|
355
355
|
$gte: measuredFrom,
|
|
@@ -359,7 +359,7 @@ function createGlobalFlow(measuredFrom, measuredThrough) {
|
|
|
359
359
|
.exec();
|
|
360
360
|
debug('numberOfTasksCreated:', numberOfTasksCreated);
|
|
361
361
|
// 実行中止ステータスで、最終試行日時が範囲にあるものを実行タスク数とする
|
|
362
|
-
const numberOfTasksAborted = yield repos.task.taskModel.
|
|
362
|
+
const numberOfTasksAborted = yield repos.task.taskModel.countDocuments({
|
|
363
363
|
name: taskName,
|
|
364
364
|
lastTriedAt: {
|
|
365
365
|
$type: 'date',
|
|
@@ -423,7 +423,7 @@ function createGlobalStock(measuredAt) {
|
|
|
423
423
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
424
424
|
// 待機状態のタスク数を算出
|
|
425
425
|
debug('counting waiting tasks globally...');
|
|
426
|
-
const numberOfTasksUnexecuted = yield repos.task.taskModel.
|
|
426
|
+
const numberOfTasksUnexecuted = yield repos.task.taskModel.countDocuments({
|
|
427
427
|
runsAt: { $lt: measuredAt },
|
|
428
428
|
status: { $in: [factory.taskStatus.Ready, factory.taskStatus.Running] }
|
|
429
429
|
})
|
|
@@ -10,29 +10,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.verifyToken4reservation = void 0;
|
|
13
|
-
// import type { JWTCredentials } from '../../credentials/jwt';
|
|
14
13
|
const factory = require("../../factory");
|
|
15
|
-
// import { verifyToken } from '../code';
|
|
16
14
|
/**
|
|
17
15
|
* 予約使用のためのチケットトークンを検証する
|
|
18
16
|
*/
|
|
19
17
|
function verifyToken4reservation(params) {
|
|
20
|
-
return (repos
|
|
21
|
-
// credentials: {
|
|
22
|
-
// jwt: JWTCredentials;
|
|
23
|
-
// }
|
|
24
|
-
) => __awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
// JWTと承認コードの両方に対応する(2024-02-28~)
|
|
18
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
26
19
|
const { ticketToken } = params.ticket;
|
|
27
20
|
let payload;
|
|
28
|
-
// if (typeof token === 'string' && token.length > 0) {
|
|
29
|
-
// const { authorizedObject } = await verifyToken({
|
|
30
|
-
// project: params.project,
|
|
31
|
-
// agent: params.agent,
|
|
32
|
-
// token
|
|
33
|
-
// })(repos, credentials);
|
|
34
|
-
// payload = authorizedObject;
|
|
35
|
-
// } else
|
|
36
21
|
if (typeof ticketToken === 'string' && ticketToken.length > 0) {
|
|
37
22
|
const findValidOneByCodeResult = yield repos.authorization.findValidOneByCode({
|
|
38
23
|
project: { id: params.project.id },
|
|
@@ -26,7 +26,7 @@ let coaAuthClient;
|
|
|
26
26
|
function call(params) {
|
|
27
27
|
// tslint:disable-next-line:max-func-body-length
|
|
28
28
|
return ({ connection, redisClient, settings }, options) => __awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
var _a, _b, _c;
|
|
29
|
+
var _a, _b, _c, _d;
|
|
30
30
|
if (redisClient === undefined) {
|
|
31
31
|
throw new factory.errors.Argument('settings', 'redisClient required');
|
|
32
32
|
}
|
|
@@ -34,18 +34,22 @@ function call(params) {
|
|
|
34
34
|
if (!options.executeById) {
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
|
+
const interfaceRepo = new interface_1.InterfaceRepo(connection);
|
|
38
|
+
const coaAPI = yield interfaceRepo.findOne({ project: { id: { $eq: params.project.id } } });
|
|
39
|
+
if (typeof (coaAPI === null || coaAPI === void 0 ? void 0 : coaAPI.id) !== 'string') {
|
|
40
|
+
throw new factory.errors.NotFound('WebAPI');
|
|
41
|
+
}
|
|
42
|
+
const credentials = (_a = coaAPI.availableChannel) === null || _a === void 0 ? void 0 : _a.credentials;
|
|
43
|
+
const memberClients = (_b = coaAPI.availableChannel) === null || _b === void 0 ? void 0 : _b.memberClients;
|
|
44
|
+
if (typeof (credentials === null || credentials === void 0 ? void 0 : credentials.refreshToken) !== 'string') {
|
|
45
|
+
throw new factory.errors.NotFound('WebAPI');
|
|
46
|
+
}
|
|
47
|
+
if (!Array.isArray(memberClients)) {
|
|
48
|
+
throw new factory.errors.NotFound('WebAPI.availableChannel.memberClients');
|
|
49
|
+
}
|
|
37
50
|
if (coaAuthClient === undefined) {
|
|
38
|
-
const interfaceRepo = new interface_1.InterfaceRepo(connection);
|
|
39
|
-
const coaAPI = yield interfaceRepo.findOne({ project: { id: { $eq: params.project.id } } });
|
|
40
|
-
const credentials = (_a = coaAPI === null || coaAPI === void 0 ? void 0 : coaAPI.availableChannel) === null || _a === void 0 ? void 0 : _a.credentials;
|
|
41
|
-
if (typeof (credentials === null || credentials === void 0 ? void 0 : credentials.refreshToken) !== 'string') {
|
|
42
|
-
throw new factory.errors.NotFound('WebAPI');
|
|
43
|
-
}
|
|
44
|
-
if (typeof (coaAPI === null || coaAPI === void 0 ? void 0 : coaAPI.id) !== 'string') {
|
|
45
|
-
throw new factory.errors.NotFound('WebAPI');
|
|
46
|
-
}
|
|
47
51
|
let credentialsRepo;
|
|
48
|
-
const credentialsExpireInSeconds = (
|
|
52
|
+
const credentialsExpireInSeconds = (_d = (_c = coaAPI.availableChannel) === null || _c === void 0 ? void 0 : _c.credentials) === null || _d === void 0 ? void 0 : _d.expireInSeconds;
|
|
49
53
|
if (typeof credentialsExpireInSeconds === 'number') {
|
|
50
54
|
// set credentialsRepo(2024-11-20~)
|
|
51
55
|
credentialsRepo = new credentials_1.CredentialsRepo(redisClient, {
|
|
@@ -66,13 +70,17 @@ function call(params) {
|
|
|
66
70
|
endpoint: coaAuthClient.options.endpoint,
|
|
67
71
|
auth: coaAuthClient
|
|
68
72
|
}, { timeout: settings.coa.timeout });
|
|
69
|
-
const { object, potentialActions, purpose } = params.data;
|
|
73
|
+
const { agent, object, potentialActions, purpose } = params.data;
|
|
74
|
+
// agent.idからflgMemberを自動セット(2024-12-16~)
|
|
75
|
+
const isMember = memberClients.includes(agent.id);
|
|
70
76
|
if (typeof potentialActions.id === 'string') {
|
|
71
77
|
yield (0, acceptOffer_1.reAcceptOffer)({
|
|
78
|
+
agent,
|
|
72
79
|
object,
|
|
73
80
|
purpose,
|
|
74
81
|
potentialActions: Object.assign(Object.assign({}, potentialActions), { id: potentialActions.id }),
|
|
75
|
-
sameAs: { id: params.id }
|
|
82
|
+
sameAs: { id: params.id },
|
|
83
|
+
isMember
|
|
76
84
|
})({
|
|
77
85
|
action: actionRepo,
|
|
78
86
|
event: new event_1.EventRepo(connection),
|
|
@@ -83,10 +91,12 @@ function call(params) {
|
|
|
83
91
|
}
|
|
84
92
|
else {
|
|
85
93
|
yield (0, acceptOffer_1.acceptOffer)({
|
|
94
|
+
agent,
|
|
86
95
|
object,
|
|
87
96
|
potentialActions,
|
|
88
97
|
purpose,
|
|
89
|
-
sameAs: { id: params.id }
|
|
98
|
+
sameAs: { id: params.id },
|
|
99
|
+
isMember
|
|
90
100
|
})({
|
|
91
101
|
action: actionRepo,
|
|
92
102
|
event: new event_1.EventRepo(connection),
|
|
@@ -32,13 +32,13 @@ const any_1 = require("../payment/any");
|
|
|
32
32
|
* タスク実行関数
|
|
33
33
|
*/
|
|
34
34
|
function call(params) {
|
|
35
|
-
return ({ connection, redisClient,
|
|
35
|
+
return ({ connection, redisClient, settings }, options) => __awaiter(this, void 0, void 0, function* () {
|
|
36
36
|
if (redisClient === undefined) {
|
|
37
37
|
throw new factory.errors.Argument('settings', 'redisClient required');
|
|
38
38
|
}
|
|
39
|
-
if (credentials.jwt === undefined) {
|
|
40
|
-
|
|
41
|
-
}
|
|
39
|
+
// if (credentials.jwt === undefined) {
|
|
40
|
+
// throw new factory.errors.Argument('settings', 'jwtCredentials required');
|
|
41
|
+
// }
|
|
42
42
|
// 遅延実行(executeByName)には対応しない
|
|
43
43
|
if (!options.executeById) {
|
|
44
44
|
return;
|
|
@@ -72,7 +72,9 @@ function call(params) {
|
|
|
72
72
|
transaction: new transaction_1.TransactionRepo(connection),
|
|
73
73
|
transactionNumber: new transactionNumber_1.TransactionNumberRepo(redisClient),
|
|
74
74
|
transactionProcess: transactionProcessRepo
|
|
75
|
-
}, settings
|
|
75
|
+
}, settings
|
|
76
|
+
// { jwt: credentials.jwt }
|
|
77
|
+
);
|
|
76
78
|
}
|
|
77
79
|
catch (error) {
|
|
78
80
|
let throwsError = true;
|
|
@@ -62,8 +62,11 @@ function createEventSeries(params) {
|
|
|
62
62
|
const bulkWriteResult = yield repos.eventSeries.createIfNotExistByWorkPerformed(creatingEventParams);
|
|
63
63
|
let upsertedIds;
|
|
64
64
|
if (bulkWriteResult !== undefined) {
|
|
65
|
-
upsertedIds
|
|
66
|
-
|
|
65
|
+
// BulkWriteResult -> upsertedIds: { '0': '7iri6p4m54k0r3g' }
|
|
66
|
+
upsertedIds = Object.values(bulkWriteResult.upsertedIds)
|
|
67
|
+
.map(String);
|
|
68
|
+
// upsertedIds = bulkWriteResult.getUpsertedIds()
|
|
69
|
+
// .map((doc) => doc._id.toString());
|
|
67
70
|
}
|
|
68
71
|
eventIds = (Array.isArray(upsertedIds)) ? upsertedIds : [];
|
|
69
72
|
eventType = factory.eventType.ScreeningEventSeries;
|
|
@@ -11,8 +11,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.call = void 0;
|
|
13
13
|
const GMO = require("@motionpicture/gmo-service");
|
|
14
|
+
const createDebug = require("debug");
|
|
14
15
|
const factory = require("../../factory");
|
|
15
|
-
// import { Settings } from '../../settings';
|
|
16
16
|
const person2username_1 = require("../payment/any/person2username");
|
|
17
17
|
const account_1 = require("../../repo/account");
|
|
18
18
|
const action_1 = require("../../repo/action");
|
|
@@ -20,10 +20,11 @@ const ownershipInfo_1 = require("../../repo/ownershipInfo");
|
|
|
20
20
|
const creditCard_1 = require("../../repo/paymentMethod/creditCard");
|
|
21
21
|
const paymentService_1 = require("../../repo/paymentService");
|
|
22
22
|
const person_1 = require("../../repo/person");
|
|
23
|
-
|
|
23
|
+
// import { ProjectRepo } from '../../repo/project';
|
|
24
24
|
const setting_1 = require("../../repo/setting");
|
|
25
25
|
const task_1 = require("../../repo/task");
|
|
26
|
-
const
|
|
26
|
+
const debug = createDebug('chevre-domain:service:task:deletePerson');
|
|
27
|
+
const ADMIN_PROVIDER_NAME = 'Google';
|
|
27
28
|
let cognitoIdentityServiceProvider;
|
|
28
29
|
/**
|
|
29
30
|
* タスク実行関数
|
|
@@ -54,24 +55,27 @@ function call(params) {
|
|
|
54
55
|
cognitoIdentityServiceProvider
|
|
55
56
|
});
|
|
56
57
|
const paymentServiceRepo = new paymentService_1.PaymentServiceRepo(connection);
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
58
|
+
let creditCardRepo;
|
|
59
|
+
if (typeof params.data.paymentMethodType4creditCard === 'string' && params.data.paymentMethodType4creditCard.length > 0) {
|
|
60
|
+
const credentials = yield getCreditCardPaymentServiceChannel({
|
|
61
|
+
project: { id: params.project.id },
|
|
62
|
+
paymentMethodType: params.data.paymentMethodType4creditCard
|
|
63
|
+
})({ paymentService: paymentServiceRepo });
|
|
64
|
+
creditCardRepo = new creditCard_1.CreditCardRepo({
|
|
65
|
+
siteId: credentials.siteId,
|
|
66
|
+
sitePass: credentials.sitePass,
|
|
67
|
+
cardService: new GMO.service.Card({
|
|
68
|
+
endpoint: credentials.endpoint,
|
|
69
|
+
useFetch: settings.gmo.useFetch
|
|
70
|
+
}, {
|
|
71
|
+
timeout: (params.data.executeBackground)
|
|
72
|
+
? settings.gmo.timeout
|
|
73
|
+
// tslint:disable-next-line:no-magic-numbers
|
|
74
|
+
: 20000 // cronで実行の場合は長めに(2024-10-05~)
|
|
75
|
+
})
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
yield deleteById(Object.assign(Object.assign({}, params.data), { project: { id: params.project.id } }), setting)({
|
|
75
79
|
account: new account_1.AccountRepo(connection),
|
|
76
80
|
action: new action_1.ActionRepo(connection),
|
|
77
81
|
creditCard: creditCardRepo,
|
|
@@ -79,7 +83,7 @@ function call(params) {
|
|
|
79
83
|
paymentService: paymentServiceRepo,
|
|
80
84
|
newPerson: newPersonRepo,
|
|
81
85
|
oldPerson: oldPersonRepo,
|
|
82
|
-
project: new
|
|
86
|
+
// project: new ProjectRepo(connection),
|
|
83
87
|
task: new task_1.TaskRepo(connection),
|
|
84
88
|
cognitoIdentityServiceProvider
|
|
85
89
|
}
|
|
@@ -96,6 +100,7 @@ function deleteById(params, setting) {
|
|
|
96
100
|
return (repos
|
|
97
101
|
// settings: Settings
|
|
98
102
|
) => __awaiter(this, void 0, void 0, function* () {
|
|
103
|
+
var _a;
|
|
99
104
|
const deleteMemberAction = {
|
|
100
105
|
agent: params.agent,
|
|
101
106
|
object: Object.assign({ id: params.id, typeOf: factory.personType.Person, migrate: params.migrate, physically: params.physically }, (typeof params.migratePersonRecipientUrl === 'string')
|
|
@@ -106,16 +111,22 @@ function deleteById(params, setting) {
|
|
|
106
111
|
const action = yield repos.action.start(deleteMemberAction);
|
|
107
112
|
let existingPeople;
|
|
108
113
|
try {
|
|
109
|
-
const project =
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
+
// const project = <Pick<factory.project.IProject, 'settings' | 'id'>>await repos.project.findById({
|
|
115
|
+
// id: params.project.id,
|
|
116
|
+
// inclusion: ['settings']
|
|
117
|
+
// });
|
|
118
|
+
existingPeople = yield repos.newPerson.search({ id: params.id });
|
|
119
|
+
// exclude ADMIN_PROVIDER_NAME
|
|
120
|
+
const username = (_a = existingPeople.at(0)) === null || _a === void 0 ? void 0 : _a.Username;
|
|
121
|
+
const isAdminPerson = typeof username === 'string' && username.startsWith(ADMIN_PROVIDER_NAME, 0);
|
|
122
|
+
if (isAdminPerson) {
|
|
123
|
+
throw new factory.errors.Argument('id', `${ADMIN_PROVIDER_NAME} people cannot be deleted`);
|
|
124
|
+
}
|
|
114
125
|
// 移行の場合、全所有権情報通知タスクを作成
|
|
115
126
|
if (params.migrate && typeof params.migratePersonRecipientUrl === 'string') {
|
|
116
127
|
yield createInformTask({
|
|
117
128
|
id: params.id,
|
|
118
|
-
project: { id: project.id },
|
|
129
|
+
project: { id: params.project.id },
|
|
119
130
|
now: action.startDate,
|
|
120
131
|
migratePersonRecipientUrl: params.migratePersonRecipientUrl
|
|
121
132
|
})(repos);
|
|
@@ -124,38 +135,33 @@ function deleteById(params, setting) {
|
|
|
124
135
|
// 移行でなければDeleteTransactionタスクを作成(2023-07-03~)
|
|
125
136
|
yield createDeleteTransactionTask({
|
|
126
137
|
id: params.id,
|
|
127
|
-
project: { id: project.id },
|
|
138
|
+
project: { id: params.project.id },
|
|
128
139
|
now: action.startDate
|
|
129
140
|
})({ task: repos.task });
|
|
130
141
|
}
|
|
131
|
-
existingPeople = yield repos.newPerson.search({ id: params.id });
|
|
132
|
-
// tslint:disable-next-line:no-console
|
|
133
|
-
console.log('admin:people:deleteById: existingPeople:', JSON.stringify(existingPeople));
|
|
134
142
|
if (existingPeople.length > 0) {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
+
if (repos.creditCard !== undefined) {
|
|
144
|
+
// クレジットカード削除
|
|
145
|
+
yield deleteCreditCardsById({
|
|
146
|
+
id: params.id,
|
|
147
|
+
useUsernameAsGMOMemberId: params.useUsernameAsGMOMemberId
|
|
148
|
+
}, setting)({
|
|
149
|
+
person: repos.newPerson,
|
|
150
|
+
creditCard: repos.creditCard,
|
|
151
|
+
cognitoIdentityServiceProvider: repos.cognitoIdentityServiceProvider
|
|
152
|
+
});
|
|
143
153
|
}
|
|
144
|
-
// settings
|
|
145
|
-
);
|
|
146
154
|
}
|
|
147
155
|
// 所有権削除
|
|
148
|
-
|
|
149
|
-
console.log('admin:people:deleteById: deleteOwnershipInfosById processing... personId:', params.id);
|
|
156
|
+
debug('task:deletePerson:deleteById: deleteOwnershipInfosById processing... personId:', params.id);
|
|
150
157
|
yield deleteOwnershipInfosById({
|
|
151
158
|
id: params.id,
|
|
152
|
-
project: { id: project.id }
|
|
159
|
+
project: { id: params.project.id }
|
|
153
160
|
})({ ownershipInfo: repos.ownershipInfo });
|
|
154
161
|
if (existingPeople.length > 0) {
|
|
155
162
|
// 会員削除
|
|
156
163
|
if (params.physically === true) {
|
|
157
|
-
|
|
158
|
-
console.log('admin:people:deleteById: deleteById processing...userId:', params.id);
|
|
164
|
+
debug('task:deletePerson:deleteById: deleteById processing...userId:', params.id);
|
|
159
165
|
yield repos.newPerson.deleteById({ userId: params.id });
|
|
160
166
|
}
|
|
161
167
|
else {
|
|
@@ -376,9 +382,7 @@ function sleep(waitTime) {
|
|
|
376
382
|
const DELETE_CREDIT_CARD_MAX_RETRY_COUNT = 2;
|
|
377
383
|
const DELETE_CREDIT_CARD_RETRY_INTERVAL_IN_MS = 1000;
|
|
378
384
|
function deleteCreditCardsById(params, setting) {
|
|
379
|
-
return (repos
|
|
380
|
-
// settings: Settings
|
|
381
|
-
) => __awaiter(this, void 0, void 0, function* () {
|
|
385
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
382
386
|
let retry = true;
|
|
383
387
|
let numberOfTry = 0;
|
|
384
388
|
while (numberOfTry >= 0) {
|
|
@@ -404,8 +408,7 @@ function deleteCreditCardsById(params, setting) {
|
|
|
404
408
|
let throwsPerson2usernameError = true;
|
|
405
409
|
// oldUserが存在しないケースをハンドル
|
|
406
410
|
if (error instanceof factory.errors.NotFound && error.entityName === 'User') {
|
|
407
|
-
|
|
408
|
-
console.log('admin:people:deleteById: deleteCreditCardsById oldUsername not found', 'personId:', params.id, 'numberOfTry:', numberOfTry);
|
|
411
|
+
debug('task:deletePerson:deleteById: deleteCreditCardsById oldUsername not found', 'personId:', params.id, 'numberOfTry:', numberOfTry);
|
|
409
412
|
throwsPerson2usernameError = false;
|
|
410
413
|
}
|
|
411
414
|
if (throwsPerson2usernameError) {
|
|
@@ -413,16 +416,14 @@ function deleteCreditCardsById(params, setting) {
|
|
|
413
416
|
}
|
|
414
417
|
}
|
|
415
418
|
if (typeof oldUsername === 'string') {
|
|
416
|
-
|
|
417
|
-
console.log('admin:people:deleteById: deleteCreditCardsById processing... oldUsername:', oldUsername, 'personId:', params.id, 'numberOfTry:', numberOfTry);
|
|
419
|
+
debug('task:deletePerson:deleteById: deleteCreditCardsById processing... oldUsername:', oldUsername, 'personId:', params.id, 'numberOfTry:', numberOfTry);
|
|
418
420
|
yield repos.creditCard.deleteAll({ personId: oldUsername });
|
|
419
421
|
}
|
|
420
422
|
}
|
|
421
423
|
else {
|
|
422
424
|
yield repos.creditCard.deleteAll({ personId: params.id });
|
|
423
425
|
}
|
|
424
|
-
|
|
425
|
-
console.log('admin:people:deleteById: deleteCreditCardsById processed. personId:', params.id, 'numberOfTry:', numberOfTry);
|
|
426
|
+
debug('task:deletePerson:deleteById: deleteCreditCardsById processed. personId:', params.id, 'numberOfTry:', numberOfTry);
|
|
426
427
|
break;
|
|
427
428
|
}
|
|
428
429
|
catch (error) {
|
|
@@ -20,6 +20,7 @@ const note_1 = require("../../repo/note");
|
|
|
20
20
|
const order_1 = require("../../repo/order");
|
|
21
21
|
const ownershipInfo_1 = require("../../repo/ownershipInfo");
|
|
22
22
|
const reservation_1 = require("../../repo/reservation");
|
|
23
|
+
const setting_1 = require("../../repo/setting");
|
|
23
24
|
const task_1 = require("../../repo/task");
|
|
24
25
|
const transaction_1 = require("../../repo/transaction");
|
|
25
26
|
const TransactionService = require("../transaction");
|
|
@@ -39,6 +40,7 @@ function call(data) {
|
|
|
39
40
|
order: new order_1.OrderRepo(connection),
|
|
40
41
|
ownershipInfo: new ownershipInfo_1.OwnershipInfoRepo(connection),
|
|
41
42
|
reservation: new reservation_1.ReservationRepo(connection),
|
|
43
|
+
setting: new setting_1.SettingRepo(connection),
|
|
42
44
|
task: new task_1.TaskRepo(connection),
|
|
43
45
|
transaction: new transaction_1.TransactionRepo(connection)
|
|
44
46
|
});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { Connection } from 'mongoose';
|
|
2
2
|
import type { RedisClientType } from 'redis';
|
|
3
|
-
import { JWTCredentials } from '../credentials/jwt';
|
|
4
3
|
import { LINENotifyCredentials } from '../credentials/lineNotify';
|
|
5
4
|
import { SendGridCredentials } from '../credentials/sendGrid';
|
|
6
5
|
import * as factory from '../factory';
|
|
@@ -9,7 +8,6 @@ import type { IExecutableTask, IExecutableTaskKeys, TaskRepo } from '../repo/tas
|
|
|
9
8
|
import { Settings } from '../settings';
|
|
10
9
|
import { AggregationSettings } from '../settings/aggregation';
|
|
11
10
|
interface ICredentialSettings {
|
|
12
|
-
jwt?: JWTCredentials;
|
|
13
11
|
sendGrid: SendGridCredentials;
|
|
14
12
|
}
|
|
15
13
|
interface IExecuteSettings {
|