@chevre/domain 21.2.0-alpha.6 → 21.2.0-alpha.60
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/aggregation/aggregateSystem.ts +58 -31
- package/example/src/chevre/countDelayedTasks.ts +17 -0
- package/example/src/chevre/countDelayedTransactions.ts +60 -0
- package/example/src/chevre/countMoneyTransferTransaction.ts +36 -0
- package/example/src/chevre/createManyEventsIfNotExist.ts +4 -1
- package/example/src/chevre/deleteTasksByName.ts +2 -1
- package/example/src/chevre/importEventsFromCOA.ts +3 -4
- package/example/src/chevre/migrateOrderAdditionalProperties.ts +85 -0
- package/example/src/chevre/migrateStockHolderKeys.ts +89 -0
- package/example/src/chevre/saveTasks.ts +13 -10
- package/example/src/chevre/searchAbortedTasks.ts +36 -0
- package/example/src/chevre/searchSendEmailActions.ts +44 -0
- package/example/src/chevre/task/executeTasks.ts +26 -0
- package/example/src/chevre/transaction/findCreditCard.ts +1 -1
- package/example/src/chevre/transaction/orderMembershipService.ts +1 -1
- package/example/src/chevre/transaction/startExportTasks.ts +20 -0
- package/example/src/chevre/updateTransaction.ts +1 -1
- package/lib/chevre/credentials.d.ts +1 -0
- package/lib/chevre/credentials.js +2 -1
- package/lib/chevre/eventEmitter/assetTransaction.d.ts +21 -0
- package/lib/chevre/eventEmitter/assetTransaction.js +25 -0
- package/lib/chevre/eventEmitter/task.d.ts +18 -0
- package/lib/chevre/eventEmitter/task.js +25 -0
- package/lib/chevre/eventEmitter/transaction.d.ts +21 -0
- package/lib/chevre/eventEmitter/transaction.js +25 -0
- package/lib/chevre/eventEmitter.d.ts +4 -0
- package/lib/chevre/eventEmitter.js +9 -0
- package/lib/chevre/index.d.ts +3 -2
- package/lib/chevre/index.js +5 -3
- package/lib/chevre/repo/account.js +0 -4
- package/lib/chevre/repo/accountTitle.js +0 -4
- package/lib/chevre/repo/accountTransaction.d.ts +3 -11
- package/lib/chevre/repo/accountTransaction.js +1 -58
- package/lib/chevre/repo/accountingReport.js +0 -4
- package/lib/chevre/repo/action.d.ts +29 -1
- package/lib/chevre/repo/action.js +32 -29
- package/lib/chevre/repo/additionalProperty.js +0 -4
- package/lib/chevre/repo/aggregation.js +0 -4
- package/lib/chevre/repo/assetTransaction.d.ts +23 -8
- package/lib/chevre/repo/assetTransaction.js +207 -68
- package/lib/chevre/repo/categoryCode.js +0 -4
- package/lib/chevre/repo/code.js +0 -4
- package/lib/chevre/repo/comment.d.ts +4 -1
- package/lib/chevre/repo/comment.js +20 -9
- package/lib/chevre/repo/confirmationNumber.d.ts +0 -1
- package/lib/chevre/repo/confirmationNumber.js +3 -15
- package/lib/chevre/repo/creativeWork.d.ts +1 -3
- package/lib/chevre/repo/creativeWork.js +0 -4
- package/lib/chevre/repo/customer.js +0 -4
- package/lib/chevre/repo/emailMessage.d.ts +1 -27
- package/lib/chevre/repo/emailMessage.js +0 -4
- package/lib/chevre/repo/event.d.ts +5 -1
- package/lib/chevre/repo/event.js +0 -4
- package/lib/chevre/repo/member.js +0 -4
- package/lib/chevre/repo/merchantReturnPolicy.d.ts +1 -3
- package/lib/chevre/repo/merchantReturnPolicy.js +0 -4
- package/lib/chevre/repo/mongoose/schemas/account.d.ts +5 -2
- package/lib/chevre/repo/mongoose/schemas/account.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/accountTitle.d.ts +30 -3
- package/lib/chevre/repo/mongoose/schemas/accountTitle.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/accountTransaction.d.ts +32 -3
- package/lib/chevre/repo/mongoose/schemas/accountTransaction.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/accountingReport.d.ts +14 -3
- package/lib/chevre/repo/mongoose/schemas/accountingReport.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/action.d.ts +44 -3
- package/lib/chevre/repo/mongoose/schemas/action.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/additionalProperty.d.ts +18 -3
- package/lib/chevre/repo/mongoose/schemas/additionalProperty.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/aggregation.d.ts +5 -2
- package/lib/chevre/repo/mongoose/schemas/aggregation.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/assetTransaction.d.ts +45 -3
- package/lib/chevre/repo/mongoose/schemas/assetTransaction.js +3 -1
- package/lib/chevre/repo/mongoose/schemas/authorization.d.ts +20 -3
- package/lib/chevre/repo/mongoose/schemas/authorization.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/categoryCode.d.ts +26 -3
- package/lib/chevre/repo/mongoose/schemas/categoryCode.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/comments.d.ts +28 -3
- package/lib/chevre/repo/mongoose/schemas/comments.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/creativeWork.d.ts +44 -3
- package/lib/chevre/repo/mongoose/schemas/creativeWork.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/customer.d.ts +26 -3
- package/lib/chevre/repo/mongoose/schemas/customer.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/emailMessages.d.ts +22 -3
- package/lib/chevre/repo/mongoose/schemas/emailMessages.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/event.d.ts +72 -3
- package/lib/chevre/repo/mongoose/schemas/event.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/member.d.ts +14 -3
- package/lib/chevre/repo/mongoose/schemas/member.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.d.ts +22 -3
- package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/offer.d.ts +66 -3
- package/lib/chevre/repo/mongoose/schemas/offer.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +28 -3
- package/lib/chevre/repo/mongoose/schemas/offerCatalog.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/offerItemCondition.d.ts +74 -0
- package/lib/chevre/repo/mongoose/schemas/offerItemCondition.js +45 -0
- package/lib/chevre/repo/mongoose/schemas/order.d.ts +52 -3
- package/lib/chevre/repo/mongoose/schemas/order.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/ownershipInfo.d.ts +26 -3
- package/lib/chevre/repo/mongoose/schemas/ownershipInfo.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/place.d.ts +50 -3
- package/lib/chevre/repo/mongoose/schemas/place.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/priceSpecification.d.ts +30 -3
- package/lib/chevre/repo/mongoose/schemas/priceSpecification.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/product.d.ts +32 -3
- package/lib/chevre/repo/mongoose/schemas/product.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/project.d.ts +24 -3
- package/lib/chevre/repo/mongoose/schemas/project.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +62 -3
- package/lib/chevre/repo/mongoose/schemas/reservation.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/role.d.ts +12 -3
- package/lib/chevre/repo/mongoose/schemas/role.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/seller.d.ts +32 -3
- package/lib/chevre/repo/mongoose/schemas/seller.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/serviceOutput.d.ts +12 -3
- package/lib/chevre/repo/mongoose/schemas/serviceOutput.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/task.d.ts +31 -3
- package/lib/chevre/repo/mongoose/schemas/task.js +3 -1
- package/lib/chevre/repo/mongoose/schemas/telemetry.d.ts +22 -3
- package/lib/chevre/repo/mongoose/schemas/telemetry.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/transaction.d.ts +41 -3
- package/lib/chevre/repo/mongoose/schemas/transaction.js +3 -1
- package/lib/chevre/repo/mongoose/schemas/trip.d.ts +12 -3
- package/lib/chevre/repo/mongoose/schemas/trip.js +1 -0
- package/lib/chevre/repo/offer.js +0 -5
- package/lib/chevre/repo/offerCatalog.js +0 -4
- package/lib/chevre/repo/offerItemCondition.d.ts +39 -0
- package/lib/chevre/repo/offerItemCondition.js +112 -0
- package/lib/chevre/repo/order.d.ts +25 -0
- package/lib/chevre/repo/order.js +5 -4
- package/lib/chevre/repo/ownershipInfo.js +0 -4
- package/lib/chevre/repo/permit.js +0 -4
- package/lib/chevre/repo/place.js +0 -4
- package/lib/chevre/repo/priceSpecification.js +0 -4
- package/lib/chevre/repo/product.js +0 -4
- package/lib/chevre/repo/project.js +0 -4
- package/lib/chevre/repo/reservation.js +0 -4
- package/lib/chevre/repo/role.js +0 -4
- package/lib/chevre/repo/seller.js +0 -4
- package/lib/chevre/repo/serviceOutput.js +0 -4
- package/lib/chevre/repo/stockHolder.js +30 -0
- package/lib/chevre/repo/task.d.ts +41 -2
- package/lib/chevre/repo/task.js +97 -12
- package/lib/chevre/repo/telemetry.js +0 -4
- package/lib/chevre/repo/transaction.d.ts +23 -3
- package/lib/chevre/repo/transaction.js +174 -58
- package/lib/chevre/repo/trip.js +0 -4
- package/lib/chevre/repository.d.ts +5 -2
- package/lib/chevre/repository.js +8 -4
- package/lib/chevre/service/aggregation/system.d.ts +67 -22
- package/lib/chevre/service/aggregation/system.js +101 -89
- package/lib/chevre/service/assetTransaction/cancelReservation.js +23 -25
- package/lib/chevre/service/assetTransaction/moneyTransfer.js +23 -21
- package/lib/chevre/service/assetTransaction/pay/potentialActions.js +17 -1
- package/lib/chevre/service/assetTransaction/pay.js +32 -24
- package/lib/chevre/service/assetTransaction/refund.js +23 -21
- package/lib/chevre/service/assetTransaction/registerService.js +23 -22
- package/lib/chevre/service/assetTransaction/reserve.js +23 -21
- package/lib/chevre/service/assetTransaction.d.ts +6 -2
- package/lib/chevre/service/assetTransaction.js +9 -5
- package/lib/chevre/service/event.js +3 -1
- package/lib/chevre/service/notification/factory.js +2 -2
- package/lib/chevre/service/notification.d.ts +3 -1
- package/lib/chevre/service/notification.js +41 -7
- package/lib/chevre/service/offer/event/voidTransaction.d.ts +2 -0
- package/lib/chevre/service/offer/event/voidTransaction.js +17 -1
- package/lib/chevre/service/offer.js +1 -1
- package/lib/chevre/service/order/deleteOrder.js +8 -8
- package/lib/chevre/service/order/onOrderStatusChanged/factory.js +25 -36
- package/lib/chevre/service/order/onOrderStatusChanged.js +1 -1
- package/lib/chevre/service/order/placeOrder.js +1 -1
- package/lib/chevre/service/order/returnOrder.js +1 -5
- package/lib/chevre/service/order/sendOrder.js +1 -1
- package/lib/chevre/service/payment/any/onPaid.js +1 -1
- package/lib/chevre/service/payment/any/onRefund.js +1 -1
- package/lib/chevre/service/payment/any.js +60 -10
- package/lib/chevre/service/payment/movieTicket/validation.d.ts +3 -2
- package/lib/chevre/service/payment/movieTicket/validation.js +12 -25
- package/lib/chevre/service/payment/movieTicket.d.ts +1 -1
- package/lib/chevre/service/payment/movieTicket.js +4 -3
- package/lib/chevre/service/product.js +1 -5
- package/lib/chevre/service/report/telemetry.d.ts +0 -11
- package/lib/chevre/service/report/telemetry.js +21 -24
- package/lib/chevre/service/reserve/cancelReservation.js +0 -2
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +0 -3
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +20 -20
- package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +2 -3
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +2 -31
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +2 -3
- package/lib/chevre/service/reserve/useReservation.js +1 -8
- package/lib/chevre/service/task/confirmRegisterServiceTransaction.js +1 -1
- package/lib/chevre/service/task/deleteTransaction.js +10 -8
- package/lib/chevre/service/task/importOffersFromCOA.js +4 -0
- package/lib/chevre/service/task/returnPayTransaction.js +2 -12
- package/lib/chevre/service/task/voidReserveTransaction.js +3 -1
- package/lib/chevre/service/task.d.ts +9 -0
- package/lib/chevre/service/task.js +43 -4
- package/lib/chevre/service/transaction/deleteTransaction.d.ts +21 -0
- package/lib/chevre/service/transaction/deleteTransaction.js +226 -0
- package/lib/chevre/service/transaction/moneyTransfer/exportTasks/factory.js +11 -1
- package/lib/chevre/service/transaction/moneyTransfer/factory.js +3 -1
- package/lib/chevre/service/transaction/moneyTransfer/potentialActions.d.ts +1 -0
- package/lib/chevre/service/transaction/moneyTransfer/potentialActions.js +1 -1
- package/lib/chevre/service/transaction/moneyTransfer.js +9 -12
- package/lib/chevre/service/transaction/orderProgramMembership.js +2 -1
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +42 -30
- package/lib/chevre/service/transaction/placeOrder.js +1 -5
- package/lib/chevre/service/transaction/placeOrderInProgress/factory.js +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.d.ts +1 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.js +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.d.ts +1 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.d.ts +1 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.d.ts +3 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +7 -3
- package/lib/chevre/service/transaction/placeOrderInProgress/result.d.ts +1 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/result.js +2 -2
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.js +2 -2
- package/lib/chevre/service/transaction/placeOrderInProgress/validation.d.ts +2 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/validation.js +23 -17
- package/lib/chevre/service/transaction/placeOrderInProgress.d.ts +1 -3
- package/lib/chevre/service/transaction/placeOrderInProgress.js +22 -11
- package/lib/chevre/service/transaction/returnOrder/exportTasks/factory.js +10 -1
- package/lib/chevre/service/transaction/returnOrder.js +1 -5
- package/lib/chevre/service/transaction.d.ts +8 -13
- package/lib/chevre/service/transaction.js +12 -145
- package/lib/chevre/settings.d.ts +6 -1
- package/lib/chevre/settings.js +17 -5
- package/package.json +5 -5
- package/example/src/chevre/migrateMoneyTransferPendingTransactionIdentifier.ts +0 -96
- package/example/src/chevre/migrateMovieAdditionalProperties.ts +0 -98
|
@@ -7,6 +7,7 @@ const settings_1 = require("../../../../settings");
|
|
|
7
7
|
/**
|
|
8
8
|
* 取引のタスクを作成する
|
|
9
9
|
*/
|
|
10
|
+
// tslint:disable-next-line:max-func-body-length
|
|
10
11
|
function createTasks(params) {
|
|
11
12
|
const taskAttributes = [];
|
|
12
13
|
const transaction = params.transaction;
|
|
@@ -35,7 +36,16 @@ function createTasks(params) {
|
|
|
35
36
|
numberOfTried: 0,
|
|
36
37
|
executionResults: [],
|
|
37
38
|
data: {
|
|
38
|
-
object:
|
|
39
|
+
object: {
|
|
40
|
+
endDate: transaction.endDate,
|
|
41
|
+
id: transaction.id,
|
|
42
|
+
object: Object.assign({}, (transaction.object.pendingTransaction !== undefined)
|
|
43
|
+
? { pendingTransaction: transaction.object.pendingTransaction }
|
|
44
|
+
: undefined),
|
|
45
|
+
project: transaction.project,
|
|
46
|
+
startDate: transaction.startDate,
|
|
47
|
+
typeOf: transaction.typeOf
|
|
48
|
+
}
|
|
39
49
|
}
|
|
40
50
|
};
|
|
41
51
|
taskAttributes.push(deleteTransactionTask);
|
|
@@ -17,7 +17,9 @@ function createStartParams(params, passport, seller, amount, fromLocation, toLoc
|
|
|
17
17
|
// ↓最適化(2022-05-24~)
|
|
18
18
|
// ...{ project: seller.project }
|
|
19
19
|
},
|
|
20
|
-
object: Object.assign(Object.assign({ amount: amount, fromLocation: fromLocation, toLocation: toLocation,
|
|
20
|
+
object: Object.assign(Object.assign({ amount: amount, fromLocation: fromLocation, toLocation: toLocation,
|
|
21
|
+
// authorizeActions: [],
|
|
22
|
+
pendingTransaction: Object.assign({ transactionNumber }, (typeof ((_a = params.object.pendingTransaction) === null || _a === void 0 ? void 0 : _a.identifier) === 'string')
|
|
21
23
|
? { identifier: params.object.pendingTransaction.identifier }
|
|
22
24
|
: undefined) }, (passport !== undefined) ? { passport } : undefined), (typeof params.object.description === 'string') ? { description: params.object.description } : undefined),
|
|
23
25
|
expires: params.expires
|
|
@@ -4,5 +4,6 @@ export type IAuthorizeMoneyTransferOffer = factory.action.authorize.offer.moneyT
|
|
|
4
4
|
* 取引のポストアクションを作成する
|
|
5
5
|
*/
|
|
6
6
|
export declare function createPotentialActions(params: {
|
|
7
|
+
authorizeActions: factory.action.authorize.IAction<factory.action.authorize.IAttributes<any, any>>[];
|
|
7
8
|
transaction: factory.transaction.ITransaction<factory.transactionType.MoneyTransfer>;
|
|
8
9
|
}): Promise<factory.transaction.IPotentialActions<factory.transactionType.MoneyTransfer>>;
|
|
@@ -13,7 +13,7 @@ exports.createPotentialActions = void 0;
|
|
|
13
13
|
const factory = require("../../../factory");
|
|
14
14
|
function createMoneyTransferActions(params) {
|
|
15
15
|
const moneyTransferActions = [];
|
|
16
|
-
const authorizeMoneyTransferActions = params.
|
|
16
|
+
const authorizeMoneyTransferActions = params.authorizeActions
|
|
17
17
|
.filter((a) => a.actionStatus === factory.actionStatusType.CompletedActionStatus)
|
|
18
18
|
.filter((a) => a.object.typeOf === factory.offerType.Offer)
|
|
19
19
|
.filter((a) => { var _a; return ((_a = a.object.itemOffered) === null || _a === void 0 ? void 0 : _a.typeOf) === factory.actionType.MoneyTransfer; });
|
|
@@ -519,19 +519,17 @@ function confirm(params) {
|
|
|
519
519
|
// throw new factory.errors.Forbidden('Transaction not yours');
|
|
520
520
|
// }
|
|
521
521
|
// 取引に対する全ての承認アクションをマージ
|
|
522
|
-
|
|
522
|
+
const authorizeActions = yield searchAuthorizeActions({
|
|
523
523
|
transaction: transaction,
|
|
524
524
|
now: now
|
|
525
525
|
})(repos);
|
|
526
526
|
// ポストアクションを作成
|
|
527
|
-
const potentialActions = yield (0, potentialActions_1.createPotentialActions)({
|
|
528
|
-
transaction: transaction
|
|
529
|
-
});
|
|
527
|
+
const potentialActions = yield (0, potentialActions_1.createPotentialActions)({ authorizeActions, transaction });
|
|
530
528
|
// 取引確定
|
|
531
529
|
yield repos.transaction.confirm({
|
|
532
530
|
typeOf: factory.transactionType.MoneyTransfer,
|
|
533
531
|
id: transaction.id,
|
|
534
|
-
authorizeActions:
|
|
532
|
+
authorizeActions: [],
|
|
535
533
|
result: {},
|
|
536
534
|
potentialActions: potentialActions
|
|
537
535
|
});
|
|
@@ -545,13 +543,14 @@ function searchAuthorizeActions(params) {
|
|
|
545
543
|
purpose: {
|
|
546
544
|
typeOf: params.transaction.typeOf,
|
|
547
545
|
id: params.transaction.id
|
|
548
|
-
}
|
|
546
|
+
},
|
|
547
|
+
// Completedに絞る(2023-05-16~)
|
|
548
|
+
actionStatus: { $eq: factory.actionStatusType.CompletedActionStatus }
|
|
549
549
|
});
|
|
550
550
|
// 万が一このプロセス中に他処理が発生してもそれらを無視するように、endDateでフィルタリング
|
|
551
551
|
authorizeActions = authorizeActions.filter((a) => {
|
|
552
|
-
return a.endDate
|
|
553
|
-
|
|
554
|
-
.toDate() < params.now;
|
|
552
|
+
return (a.endDate instanceof Date) && moment(a.endDate)
|
|
553
|
+
.isBefore(moment(params.now));
|
|
555
554
|
});
|
|
556
555
|
return authorizeActions;
|
|
557
556
|
});
|
|
@@ -576,9 +575,7 @@ function exportTasksById(params) {
|
|
|
576
575
|
transaction,
|
|
577
576
|
runsAt: taskRunsAt
|
|
578
577
|
});
|
|
579
|
-
|
|
580
|
-
yield repos.task.saveMany(taskAttributes);
|
|
581
|
-
// await Promise.all(taskAttributes.map(async (a) => repos.task.save(a)));
|
|
578
|
+
yield repos.task.saveMany(taskAttributes, { emitImmediately: true });
|
|
582
579
|
});
|
|
583
580
|
}
|
|
584
581
|
exports.exportTasksById = exportTasksById;
|
|
@@ -75,10 +75,49 @@ function createTasks(params) {
|
|
|
75
75
|
numberOfTried: 0,
|
|
76
76
|
executionResults: [],
|
|
77
77
|
data: {
|
|
78
|
-
object:
|
|
78
|
+
object: {
|
|
79
|
+
endDate: transaction.endDate,
|
|
80
|
+
id: transaction.id,
|
|
81
|
+
object: Object.assign(Object.assign({}, (typeof transaction.object.confirmationNumber === 'string')
|
|
82
|
+
? { confirmationNumber: transaction.object.confirmationNumber }
|
|
83
|
+
: undefined), (typeof transaction.object.orderNumber === 'string')
|
|
84
|
+
? { orderNumber: transaction.object.orderNumber }
|
|
85
|
+
: undefined),
|
|
86
|
+
project: transaction.project,
|
|
87
|
+
startDate: transaction.startDate,
|
|
88
|
+
typeOf: transaction.typeOf
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
// 確定取引にも決済承認中止タスクを追加(2023-05-03~)
|
|
93
|
+
const voidPaymentTaskAttributes = {
|
|
94
|
+
project: transaction.project,
|
|
95
|
+
name: factory.taskName.VoidPayTransaction,
|
|
96
|
+
status: factory.taskStatus.Ready,
|
|
97
|
+
runsAt: taskRunsAt,
|
|
98
|
+
remainingNumberOfTries: 10,
|
|
99
|
+
numberOfTried: 0,
|
|
100
|
+
executionResults: [],
|
|
101
|
+
data: {
|
|
102
|
+
project: transaction.project,
|
|
103
|
+
purpose: { typeOf: transaction.typeOf, id: transaction.id }
|
|
79
104
|
}
|
|
80
105
|
};
|
|
81
|
-
|
|
106
|
+
// 確定取引にも興行オファー承認中止タスクを追加(2023-05-09~)
|
|
107
|
+
const voidReserveTaskAttributes = {
|
|
108
|
+
project: transaction.project,
|
|
109
|
+
name: factory.taskName.VoidReserveTransaction,
|
|
110
|
+
status: factory.taskStatus.Ready,
|
|
111
|
+
runsAt: taskRunsAt,
|
|
112
|
+
remainingNumberOfTries: 10,
|
|
113
|
+
numberOfTried: 0,
|
|
114
|
+
executionResults: [],
|
|
115
|
+
data: {
|
|
116
|
+
project: transaction.project,
|
|
117
|
+
purpose: { typeOf: transaction.typeOf, id: transaction.id }
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
taskAttributes.push(...triggerWebhookTaskAttributes, deleteTransactionTask, voidPaymentTaskAttributes, voidReserveTaskAttributes);
|
|
82
121
|
switch (transaction.status) {
|
|
83
122
|
case factory.transactionStatusType.Confirmed:
|
|
84
123
|
const potentialActions = transaction.potentialActions;
|
|
@@ -107,22 +146,8 @@ function createTasks(params) {
|
|
|
107
146
|
};
|
|
108
147
|
taskAttributes.push(placeOrderTaskAttributes);
|
|
109
148
|
break;
|
|
110
|
-
// 期限切れor中止の場合は、タスクリストを作成する
|
|
111
149
|
case factory.transactionStatusType.Canceled:
|
|
112
150
|
case factory.transactionStatusType.Expired:
|
|
113
|
-
const voidReserveTaskAttributes = {
|
|
114
|
-
project: transaction.project,
|
|
115
|
-
name: factory.taskName.VoidReserveTransaction,
|
|
116
|
-
status: factory.taskStatus.Ready,
|
|
117
|
-
runsAt: taskRunsAt,
|
|
118
|
-
remainingNumberOfTries: 10,
|
|
119
|
-
numberOfTried: 0,
|
|
120
|
-
executionResults: [],
|
|
121
|
-
data: {
|
|
122
|
-
project: transaction.project,
|
|
123
|
-
purpose: { typeOf: transaction.typeOf, id: transaction.id }
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
151
|
const voidRegisterServiceTaskAttributes = {
|
|
127
152
|
project: transaction.project,
|
|
128
153
|
name: factory.taskName.VoidRegisterServiceTransaction,
|
|
@@ -136,19 +161,6 @@ function createTasks(params) {
|
|
|
136
161
|
purpose: { typeOf: transaction.typeOf, id: transaction.id }
|
|
137
162
|
}
|
|
138
163
|
};
|
|
139
|
-
const voidPaymentTaskAttributes = {
|
|
140
|
-
project: transaction.project,
|
|
141
|
-
name: factory.taskName.VoidPayTransaction,
|
|
142
|
-
status: factory.taskStatus.Ready,
|
|
143
|
-
runsAt: taskRunsAt,
|
|
144
|
-
remainingNumberOfTries: 10,
|
|
145
|
-
numberOfTried: 0,
|
|
146
|
-
executionResults: [],
|
|
147
|
-
data: {
|
|
148
|
-
project: transaction.project,
|
|
149
|
-
purpose: { typeOf: transaction.typeOf, id: transaction.id }
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
164
|
const voidMoneyTransferTaskAttributes = {
|
|
153
165
|
project: transaction.project,
|
|
154
166
|
name: factory.taskName.VoidMoneyTransferTransaction,
|
|
@@ -162,7 +174,7 @@ function createTasks(params) {
|
|
|
162
174
|
purpose: { typeOf: transaction.typeOf, id: transaction.id }
|
|
163
175
|
}
|
|
164
176
|
};
|
|
165
|
-
taskAttributes.push(
|
|
177
|
+
taskAttributes.push(voidRegisterServiceTaskAttributes, voidMoneyTransferTaskAttributes);
|
|
166
178
|
break;
|
|
167
179
|
default:
|
|
168
180
|
throw new factory.errors.NotImplemented(`Transaction status "${transaction.status}" not implemented.`);
|
|
@@ -36,11 +36,7 @@ function exportTasksById(params) {
|
|
|
36
36
|
transaction,
|
|
37
37
|
runsAt: taskRunsAt
|
|
38
38
|
});
|
|
39
|
-
|
|
40
|
-
yield repos.task.saveMany(taskAttributes);
|
|
41
|
-
// await Promise.all(taskAttributes.map(async (taskAttribute) => {
|
|
42
|
-
// await repos.task.save(taskAttribute);
|
|
43
|
-
// }));
|
|
39
|
+
yield repos.task.saveMany(taskAttributes, { emitImmediately: true });
|
|
44
40
|
});
|
|
45
41
|
}
|
|
46
42
|
exports.exportTasksById = exportTasksById;
|
|
@@ -4,7 +4,7 @@ exports.createStartParams = void 0;
|
|
|
4
4
|
const factory = require("../../../factory");
|
|
5
5
|
function createStartParams(params, passport, seller, broker) {
|
|
6
6
|
var _a, _b, _c, _d;
|
|
7
|
-
const transactionObject = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ passportToken: (typeof ((_a = params.object.passport) === null || _a === void 0 ? void 0 : _a.token) === 'string') ? params.object.passport.token : undefined
|
|
7
|
+
const transactionObject = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ passportToken: (typeof ((_a = params.object.passport) === null || _a === void 0 ? void 0 : _a.token) === 'string') ? params.object.passport.token : undefined }, (passport !== undefined) ? { passport } : undefined), (params.object.clientUser !== undefined && params.object.clientUser !== null)
|
|
8
8
|
? { clientUser: params.object.clientUser }
|
|
9
9
|
: undefined), (typeof ((_b = params.object) === null || _b === void 0 ? void 0 : _b.name) === 'string') ? { name: (_c = params.object) === null || _c === void 0 ? void 0 : _c.name } : undefined), (typeof (broker === null || broker === void 0 ? void 0 : broker.typeOf) === 'string') ? { broker: broker } : undefined), (typeof ((_d = params.object.customer) === null || _d === void 0 ? void 0 : _d.typeOf) === 'string') ? { customer: params.object.customer } : undefined);
|
|
10
10
|
if (typeof seller.id !== 'string') {
|
package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.d.ts
CHANGED
|
@@ -3,4 +3,5 @@ export type IAuthorizeMoneyTransferOffer = factory.action.authorize.offer.moneyT
|
|
|
3
3
|
export declare function createMoneyTransferActions(params: {
|
|
4
4
|
order: factory.order.IOrder;
|
|
5
5
|
transaction: factory.transaction.placeOrder.ITransaction;
|
|
6
|
+
authorizeActions: factory.action.authorize.IAction<factory.action.authorize.IAttributes<any, any>>[];
|
|
6
7
|
}): Promise<factory.action.interact.confirm.moneyTransfer.IAttributes[]>;
|
package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.js
CHANGED
|
@@ -15,7 +15,7 @@ const order_1 = require("../../../../factory/order");
|
|
|
15
15
|
function createMoneyTransferActions(params) {
|
|
16
16
|
return __awaiter(this, void 0, void 0, function* () {
|
|
17
17
|
const moneyTransferActions = [];
|
|
18
|
-
const authorizeMoneyTransferActions = params.
|
|
18
|
+
const authorizeMoneyTransferActions = params.authorizeActions
|
|
19
19
|
.filter((a) => a.actionStatus === factory.actionStatusType.CompletedActionStatus)
|
|
20
20
|
.filter((a) => a.object.typeOf === factory.offerType.Offer)
|
|
21
21
|
.filter((a) => { var _a; return ((_a = a.object.itemOffered) === null || _a === void 0 ? void 0 : _a.typeOf) === factory.actionType.MoneyTransfer; });
|
package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.d.ts
CHANGED
|
@@ -2,4 +2,5 @@ import * as factory from '../../../../factory';
|
|
|
2
2
|
export declare function createRegisterServiceActions(params: {
|
|
3
3
|
order: factory.order.IOrder;
|
|
4
4
|
transaction: factory.transaction.placeOrder.ITransaction;
|
|
5
|
+
authorizeActions: factory.action.authorize.IAction<factory.action.authorize.IAttributes<any, any>>[];
|
|
5
6
|
}): Promise<factory.action.interact.confirm.registerService.IAttributes[]>;
|
package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js
CHANGED
|
@@ -17,7 +17,7 @@ const order_1 = require("../../../../factory/order");
|
|
|
17
17
|
function createRegisterServiceActions(params) {
|
|
18
18
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19
19
|
const registerServiceActions = [];
|
|
20
|
-
const authorizeProductOfferActions = params.
|
|
20
|
+
const authorizeProductOfferActions = params.authorizeActions
|
|
21
21
|
.filter((a) => a.actionStatus === factory.actionStatusType.CompletedActionStatus)
|
|
22
22
|
.filter((a) => Array.isArray(a.object)
|
|
23
23
|
&& a.object.length > 0
|
|
@@ -7,4 +7,5 @@ export declare function createPotentialActions(params: {
|
|
|
7
7
|
potentialActions?: factory.transaction.placeOrder.IPotentialActionsParams;
|
|
8
8
|
transaction: factory.transaction.placeOrder.ITransaction;
|
|
9
9
|
emailMessage?: factory.creativeWork.message.email.ICreativeWork;
|
|
10
|
+
authorizeActions: factory.action.authorize.IAction<factory.action.authorize.IAttributes<any, any>>[];
|
|
10
11
|
}): Promise<factory.transaction.placeOrder.IPotentialActions>;
|
|
@@ -3,12 +3,14 @@ export type IAuthorizeMoneyTransferOffer = factory.action.authorize.offer.moneyT
|
|
|
3
3
|
export type IAuthorizeSeatReservationOffer = factory.action.authorize.offer.seatReservation.IAction<factory.service.webAPI.Identifier>;
|
|
4
4
|
export declare function createReservationAcceptedOffers(params: {
|
|
5
5
|
transaction: factory.transaction.placeOrder.ITransaction;
|
|
6
|
+
authorizeActions: factory.action.authorize.IAction<factory.action.authorize.IAttributes<any, any>>[];
|
|
6
7
|
}): {
|
|
7
8
|
reservationAcceptedOffers: factory.order.IAcceptedOffer<factory.order.IReservation>[];
|
|
8
9
|
reservationOrderItems: factory.order.IOrderedItem[];
|
|
9
10
|
};
|
|
10
11
|
export declare function createProductItems(params: {
|
|
11
12
|
transaction: factory.transaction.placeOrder.ITransaction;
|
|
13
|
+
authorizeActions: factory.action.authorize.IAction<factory.action.authorize.IAttributes<any, any>>[];
|
|
12
14
|
}): {
|
|
13
15
|
productAcceptedOffers: factory.order.IAcceptedOffer<factory.order.IPermit>[];
|
|
14
16
|
productOrderItems: factory.order.IOrderedItem[];
|
|
@@ -16,6 +18,7 @@ export declare function createProductItems(params: {
|
|
|
16
18
|
export declare function createMoneyTransferAcceptedOffers(params: {
|
|
17
19
|
transaction: factory.transaction.placeOrder.ITransaction;
|
|
18
20
|
seller: factory.order.ISeller;
|
|
21
|
+
authorizeActions: factory.action.authorize.IAction<factory.action.authorize.IAttributes<any, any>>[];
|
|
19
22
|
}): {
|
|
20
23
|
moneyTransferAcceptedOffers: factory.order.IAcceptedOffer<factory.order.IMoneyTransfer>[];
|
|
21
24
|
moneyTransferOrderItems: factory.order.IOrderedItem[];
|
|
@@ -7,7 +7,7 @@ function createReservationAcceptedOffers(params) {
|
|
|
7
7
|
const acceptedOffers = [];
|
|
8
8
|
const orderedItems = [];
|
|
9
9
|
// 座席予約に対する承認アクション取り出す
|
|
10
|
-
const seatReservationAuthorizeActions = params.
|
|
10
|
+
const seatReservationAuthorizeActions = params.authorizeActions
|
|
11
11
|
.filter((a) => a.actionStatus === factory.actionStatusType.CompletedActionStatus
|
|
12
12
|
&& a.object.typeOf === factory.action.authorize.offer.seatReservation.ObjectType.SeatReservation);
|
|
13
13
|
const eventIds = [];
|
|
@@ -85,7 +85,7 @@ function reservationOffers2orderedItem(params) {
|
|
|
85
85
|
function createProductItems(params) {
|
|
86
86
|
const acceptedOffers = [];
|
|
87
87
|
const orderedItems = [];
|
|
88
|
-
const authorizePaymentCardOfferActions = params.
|
|
88
|
+
const authorizePaymentCardOfferActions = params.authorizeActions
|
|
89
89
|
.filter((a) => a.actionStatus === factory.actionStatusType.CompletedActionStatus)
|
|
90
90
|
.filter((a) => Array.isArray(a.object)
|
|
91
91
|
&& a.object.length > 0
|
|
@@ -117,7 +117,11 @@ function createProductItems(params) {
|
|
|
117
117
|
exports.createProductItems = createProductItems;
|
|
118
118
|
function createMoneyTransferAcceptedOffers(params) {
|
|
119
119
|
// 通貨転送承認アクション
|
|
120
|
-
const authorizeMoneyTansferActions = params.transaction.object.authorizeActions
|
|
120
|
+
// const authorizeMoneyTansferActions = (<IAuthorizeMoneyTransferOffer[]>params.transaction.object.authorizeActions)
|
|
121
|
+
// .filter((a) => a.actionStatus === factory.actionStatusType.CompletedActionStatus)
|
|
122
|
+
// .filter((a) => a.object.typeOf === factory.offerType.Offer)
|
|
123
|
+
// .filter((a) => a.object.itemOffered?.typeOf === factory.actionType.MoneyTransfer);
|
|
124
|
+
const authorizeMoneyTansferActions = params.authorizeActions
|
|
121
125
|
.filter((a) => a.actionStatus === factory.actionStatusType.CompletedActionStatus)
|
|
122
126
|
.filter((a) => a.object.typeOf === factory.offerType.Offer)
|
|
123
127
|
.filter((a) => { var _a; return ((_a = a.object.itemOffered) === null || _a === void 0 ? void 0 : _a.typeOf) === factory.actionType.MoneyTransfer; });
|
|
@@ -23,7 +23,7 @@ function createOrder(params) {
|
|
|
23
23
|
];
|
|
24
24
|
const orderedItems = [...reservationOrderItems, ...moneyTransferOrderItems, ...productOrderItems];
|
|
25
25
|
// 決済方法をセット
|
|
26
|
-
const { paymentMethods, price } = createPaymentMethods({ transaction: params.transaction });
|
|
26
|
+
const { paymentMethods, price } = createPaymentMethods({ transaction: params.transaction, authorizeActions: params.authorizeActions });
|
|
27
27
|
const discounts = [];
|
|
28
28
|
const name = (typeof params.transaction.object.name === 'string') ? params.transaction.object.name : undefined;
|
|
29
29
|
const broker = (typeof ((_a = params.transaction.object.broker) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? params.transaction.object.broker : undefined;
|
|
@@ -62,7 +62,7 @@ function createCustomer(params) {
|
|
|
62
62
|
function createPaymentMethods(params) {
|
|
63
63
|
const paymentMethods = [];
|
|
64
64
|
let price = 0;
|
|
65
|
-
const authorizePaymentActions = params.
|
|
65
|
+
const authorizePaymentActions = params.authorizeActions
|
|
66
66
|
.filter((a) => {
|
|
67
67
|
var _a;
|
|
68
68
|
return a.actionStatus === factory.actionStatusType.CompletedActionStatus
|
package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ import * as factory from '../../../../factory';
|
|
|
2
2
|
/**
|
|
3
3
|
* 座席予約オファー承認に対してムビチケ承認条件が整っているかどうか検証する
|
|
4
4
|
*/
|
|
5
|
-
export declare function validateMovieTicket(paymentMethodType: string, transaction: factory.transaction.placeOrder.ITransaction): void;
|
|
5
|
+
export declare function validateMovieTicket(paymentMethodType: string, transaction: factory.transaction.placeOrder.ITransaction, authorizeActions: factory.action.authorize.IAction<factory.action.authorize.IAttributes<any, any>>[]): void;
|
package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.js
CHANGED
|
@@ -10,8 +10,8 @@ const debug = createDebug('cinerino-domain:service:validateMovieTicket');
|
|
|
10
10
|
/**
|
|
11
11
|
* 座席予約オファー承認に対してムビチケ承認条件が整っているかどうか検証する
|
|
12
12
|
*/
|
|
13
|
-
function validateMovieTicket(paymentMethodType, transaction) {
|
|
14
|
-
const authorizeActions = transaction.object.authorizeActions;
|
|
13
|
+
function validateMovieTicket(paymentMethodType, transaction, authorizeActions) {
|
|
14
|
+
// const authorizeActions = transaction.object.authorizeActions;
|
|
15
15
|
const authorizeMovieTicketActions = authorizeActions.filter((a) => {
|
|
16
16
|
var _a, _b, _c;
|
|
17
17
|
return a.actionStatus === factory.actionStatusType.CompletedActionStatus
|
|
@@ -7,7 +7,7 @@ export type IUnitPriceSpecification = factory.priceSpecification.IPriceSpecifica
|
|
|
7
7
|
/**
|
|
8
8
|
* 取引が確定可能な状態かどうかをチェックする
|
|
9
9
|
*/
|
|
10
|
-
export declare function validateTransaction(transaction: factory.transaction.placeOrder.ITransaction): void;
|
|
10
|
+
export declare function validateTransaction(transaction: factory.transaction.placeOrder.ITransaction, authorizeActions: factory.action.authorize.IAction<factory.action.authorize.IAttributes<any, any>>[]): void;
|
|
11
11
|
export type IConfirmationNumberGenerator = (order: factory.order.IOrder) => string;
|
|
12
12
|
export type IOrderURLGenerator = (order: factory.order.IOrder) => string;
|
|
13
13
|
export type IResultOrderParams = factory.transaction.placeOrder.IResultOrderParams & {
|
|
@@ -46,4 +46,5 @@ export declare function validatePaymentMethods(params: {
|
|
|
46
46
|
export declare function validateEventOffers(params: {
|
|
47
47
|
transaction: factory.transaction.placeOrder.ITransaction;
|
|
48
48
|
order: factory.order.IOrder;
|
|
49
|
+
authorizeActions: factory.action.authorize.IAction<factory.action.authorize.IAttributes<any, any>>[];
|
|
49
50
|
}): void;
|
|
@@ -13,18 +13,18 @@ const debug = createDebug('cinerino-domain:service');
|
|
|
13
13
|
/**
|
|
14
14
|
* 取引が確定可能な状態かどうかをチェックする
|
|
15
15
|
*/
|
|
16
|
-
function validateTransaction(transaction) {
|
|
16
|
+
function validateTransaction(transaction, authorizeActions) {
|
|
17
17
|
validateProfile(transaction);
|
|
18
|
-
validatePrice(transaction);
|
|
18
|
+
validatePrice(transaction, authorizeActions);
|
|
19
19
|
// 利用可能な通貨単位に対して取引検証
|
|
20
|
-
validateMonetaryAmount(
|
|
20
|
+
validateMonetaryAmount(authorizeActions);
|
|
21
21
|
// 利用可能なMovieTicketIF決済方法タイプに対して動的にコーディング
|
|
22
22
|
// 検証すべきMovieTicketIF決済方法タイプのリストは、決済承認アクションのresult.issuedThrough.typeOf: MovieTicketで抽出できるのでは?
|
|
23
|
-
const movieTicketPaymentMethodTypes = findMovieTicketPaymentMethodTypesFromTransaction(
|
|
23
|
+
const movieTicketPaymentMethodTypes = findMovieTicketPaymentMethodTypesFromTransaction(authorizeActions);
|
|
24
24
|
if (Array.isArray(movieTicketPaymentMethodTypes) && movieTicketPaymentMethodTypes.length > 0) {
|
|
25
25
|
movieTicketPaymentMethodTypes.forEach((paymentMethodType) => {
|
|
26
26
|
try {
|
|
27
|
-
(0, validateMovieTicket_1.validateMovieTicket)(paymentMethodType, transaction);
|
|
27
|
+
(0, validateMovieTicket_1.validateMovieTicket)(paymentMethodType, transaction, authorizeActions);
|
|
28
28
|
}
|
|
29
29
|
catch (error) {
|
|
30
30
|
// 検証結果をlog(2022-06-04~)
|
|
@@ -35,11 +35,13 @@ function validateTransaction(transaction) {
|
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
// 決済URLが発行されている場合、検証
|
|
38
|
-
validatePaymentUrl(transaction);
|
|
38
|
+
validatePaymentUrl(transaction, authorizeActions);
|
|
39
39
|
}
|
|
40
40
|
exports.validateTransaction = validateTransaction;
|
|
41
|
-
function findMovieTicketPaymentMethodTypesFromTransaction(
|
|
42
|
-
|
|
41
|
+
function findMovieTicketPaymentMethodTypesFromTransaction(
|
|
42
|
+
// transaction: factory.transaction.placeOrder.ITransaction,
|
|
43
|
+
authorizeActions) {
|
|
44
|
+
// const authorizeActions = transaction.object.authorizeActions;
|
|
43
45
|
const authorizeMovieTicketPaymentActions = authorizeActions.filter((a) => {
|
|
44
46
|
var _a, _b;
|
|
45
47
|
return a.actionStatus === factory.actionStatusType.CompletedActionStatus
|
|
@@ -86,8 +88,8 @@ function validateProfile(transaction) {
|
|
|
86
88
|
throw new factory.errors.Argument('Transaction', 'Customer Profile Required');
|
|
87
89
|
}
|
|
88
90
|
}
|
|
89
|
-
function validatePrice(transaction) {
|
|
90
|
-
const authorizeActions = transaction.object.authorizeActions;
|
|
91
|
+
function validatePrice(transaction, authorizeActions) {
|
|
92
|
+
// const authorizeActions = transaction.object.authorizeActions;
|
|
91
93
|
let priceByAgent = 0;
|
|
92
94
|
let priceBySeller = 0;
|
|
93
95
|
// 決済承認を確認
|
|
@@ -110,9 +112,9 @@ function validatePrice(transaction) {
|
|
|
110
112
|
throw new factory.errors.Argument('Transaction', 'Transaction cannot be confirmed because prices are not matched');
|
|
111
113
|
}
|
|
112
114
|
}
|
|
113
|
-
function validatePaymentUrl(transaction) {
|
|
115
|
+
function validatePaymentUrl(transaction, authorizeActions) {
|
|
116
|
+
// const authorizeActions = transaction.object.authorizeActions;
|
|
114
117
|
var _a, _b;
|
|
115
|
-
const authorizeActions = transaction.object.authorizeActions;
|
|
116
118
|
// 決済URLが発行されている場合、検証
|
|
117
119
|
const paymentMethodId = (_a = transaction.object.paymentMethods) === null || _a === void 0 ? void 0 : _a.paymentMethodId;
|
|
118
120
|
const paymentUrl = (_b = transaction.object.paymentMethods) === null || _b === void 0 ? void 0 : _b.paymentUrl;
|
|
@@ -135,10 +137,10 @@ function validatePaymentUrl(transaction) {
|
|
|
135
137
|
/**
|
|
136
138
|
* JPY以外の通貨について取引を検証する
|
|
137
139
|
*/
|
|
138
|
-
function validateMonetaryAmount(
|
|
139
|
-
//
|
|
140
|
-
) {
|
|
141
|
-
const authorizeActions = transaction.object.authorizeActions;
|
|
140
|
+
function validateMonetaryAmount(
|
|
141
|
+
// transaction: factory.transaction.placeOrder.ITransaction,
|
|
142
|
+
authorizeActions) {
|
|
143
|
+
// const authorizeActions = transaction.object.authorizeActions;
|
|
142
144
|
const authorizeMonetaryAmountActions = authorizeActions
|
|
143
145
|
.filter((a) => {
|
|
144
146
|
var _a, _b;
|
|
@@ -216,7 +218,11 @@ exports.validatePaymentMethods = validatePaymentMethods;
|
|
|
216
218
|
* イベントオファー適用条件確認
|
|
217
219
|
*/
|
|
218
220
|
function validateEventOffers(params) {
|
|
219
|
-
const seatReservationAuthorizeActions =
|
|
221
|
+
// const seatReservationAuthorizeActions = <IAuthorizeSeatReservationOffer[]>
|
|
222
|
+
// params.transaction.object.authorizeActions
|
|
223
|
+
// .filter((a) => a.actionStatus === factory.actionStatusType.CompletedActionStatus)
|
|
224
|
+
// .filter((a) => a.object.typeOf === factory.action.authorize.offer.seatReservation.ObjectType.SeatReservation);
|
|
225
|
+
const seatReservationAuthorizeActions = params.authorizeActions
|
|
220
226
|
.filter((a) => a.actionStatus === factory.actionStatusType.CompletedActionStatus)
|
|
221
227
|
.filter((a) => a.object.typeOf === factory.action.authorize.offer.seatReservation.ObjectType.SeatReservation);
|
|
222
228
|
seatReservationAuthorizeActions.forEach((a) => {
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 進行中注文取引サービス
|
|
3
|
-
*/
|
|
4
1
|
import * as factory from '../../factory';
|
|
5
2
|
import { MongoRepository as ActionRepo } from '../../repo/action';
|
|
6
3
|
import { RedisRepository as ConfirmationNumberRepo } from '../../repo/confirmationNumber';
|
|
@@ -60,6 +57,7 @@ export type IConfirmParams = factory.transaction.placeOrder.IConfirmParams & {
|
|
|
60
57
|
result: {
|
|
61
58
|
order: IResultOrderParams;
|
|
62
59
|
};
|
|
60
|
+
saveAuthorizeActions: boolean;
|
|
63
61
|
};
|
|
64
62
|
/**
|
|
65
63
|
* 注文取引を確定する
|
|
@@ -13,6 +13,7 @@ exports.voidAward = exports.authorizeAward = exports.publishOrderNumberIfNotExis
|
|
|
13
13
|
/**
|
|
14
14
|
* 進行中注文取引サービス
|
|
15
15
|
*/
|
|
16
|
+
const moment = require("moment");
|
|
16
17
|
const factory = require("../../factory");
|
|
17
18
|
const factory_1 = require("./placeOrderInProgress/factory");
|
|
18
19
|
const potentialActions_1 = require("./placeOrderInProgress/potentialActions");
|
|
@@ -95,14 +96,15 @@ function confirm(params) {
|
|
|
95
96
|
throw new factory.errors.Forbidden('Transaction not yours');
|
|
96
97
|
}
|
|
97
98
|
// 取引に対する全ての承認アクションをマージ
|
|
98
|
-
|
|
99
|
+
const authorizeActions = yield searchAuthorizeActions(params)(repos);
|
|
100
|
+
// transaction.object.authorizeActions = authorizeActions;
|
|
99
101
|
// 注文番号を発行
|
|
100
102
|
const orderNumber = yield publishOrderNumberIfNotExist({
|
|
101
103
|
project: { id: transaction.project.id },
|
|
102
104
|
id: transaction.id,
|
|
103
105
|
object: { orderDate: params.result.order.orderDate }
|
|
104
106
|
})(repos);
|
|
105
|
-
const result = createResult(Object.assign(Object.assign({}, params), { orderNumber, transaction: transaction }));
|
|
107
|
+
const result = createResult(Object.assign(Object.assign({}, params), { orderNumber, transaction: transaction, authorizeActions }));
|
|
106
108
|
// デフォルトEメールメッセージを検索
|
|
107
109
|
let emailMessageOnOrderSent;
|
|
108
110
|
if (repos.emailMessage !== undefined) {
|
|
@@ -119,14 +121,16 @@ function confirm(params) {
|
|
|
119
121
|
order: result.order,
|
|
120
122
|
potentialActions: params.potentialActions,
|
|
121
123
|
transaction: transaction,
|
|
122
|
-
emailMessage: emailMessageOnOrderSent
|
|
124
|
+
emailMessage: emailMessageOnOrderSent,
|
|
125
|
+
authorizeActions
|
|
123
126
|
});
|
|
124
127
|
// ステータス変更
|
|
125
128
|
try {
|
|
126
129
|
yield repos.transaction.confirm({
|
|
127
130
|
typeOf: transaction.typeOf,
|
|
128
131
|
id: transaction.id,
|
|
129
|
-
|
|
132
|
+
// 保管有無を設定化(2023-05-16~)
|
|
133
|
+
authorizeActions: (params.saveAuthorizeActions) ? authorizeActions : [],
|
|
130
134
|
result: result,
|
|
131
135
|
potentialActions: potentialActions
|
|
132
136
|
});
|
|
@@ -214,18 +218,20 @@ exports.publishOrderNumberIfNotExist = publishOrderNumberIfNotExist;
|
|
|
214
218
|
function createResult(params) {
|
|
215
219
|
const transaction = params.transaction;
|
|
216
220
|
// 取引の確定条件が全て整っているかどうか確認
|
|
217
|
-
(0, validation_1.validateTransaction)(transaction);
|
|
221
|
+
(0, validation_1.validateTransaction)(transaction, params.authorizeActions);
|
|
218
222
|
// 注文作成
|
|
219
223
|
const order = (0, result_1.createOrder)({
|
|
220
224
|
orderNumber: params.orderNumber,
|
|
221
225
|
transaction: transaction,
|
|
222
226
|
orderDate: params.result.order.orderDate,
|
|
223
227
|
orderStatus: factory.orderStatus.OrderProcessing,
|
|
224
|
-
isGift: false
|
|
228
|
+
isGift: false,
|
|
229
|
+
authorizeActions: params.authorizeActions
|
|
225
230
|
});
|
|
226
231
|
(0, validation_1.validateEventOffers)({
|
|
227
232
|
transaction: transaction,
|
|
228
|
-
order: order
|
|
233
|
+
order: order,
|
|
234
|
+
authorizeActions: params.authorizeActions
|
|
229
235
|
});
|
|
230
236
|
// 注文アイテム数制限確認
|
|
231
237
|
(0, validation_1.validateNumItems)({
|
|
@@ -252,10 +258,15 @@ function searchAuthorizeActions(params) {
|
|
|
252
258
|
purpose: {
|
|
253
259
|
typeOf: factory.transactionType.PlaceOrder,
|
|
254
260
|
id: params.id
|
|
255
|
-
}
|
|
261
|
+
},
|
|
262
|
+
// Completedに絞る(2023-05-16~)
|
|
263
|
+
actionStatus: { $eq: factory.actionStatusType.CompletedActionStatus }
|
|
256
264
|
});
|
|
257
265
|
// 万が一このプロセス中に他処理が発生してもそれらを無視するように、endDateでフィルタリング
|
|
258
|
-
authorizeActions = authorizeActions.filter((a) =>
|
|
266
|
+
authorizeActions = authorizeActions.filter((a) => {
|
|
267
|
+
return (a.endDate instanceof Date) && moment(a.endDate)
|
|
268
|
+
.isBefore(moment(params.result.order.orderDate));
|
|
269
|
+
});
|
|
259
270
|
return authorizeActions;
|
|
260
271
|
});
|
|
261
272
|
}
|
|
@@ -311,7 +322,7 @@ function authorizeAward(params) {
|
|
|
311
322
|
if (Array.isArray(givePointAwardParams)) {
|
|
312
323
|
const pointAwardIdentifiers = givePointAwardParams.map((g) => { var _a; return String((_a = g.object) === null || _a === void 0 ? void 0 : _a.identifier); });
|
|
313
324
|
// 取引にインセンティブ付与アクションパラメータを保管する
|
|
314
|
-
yield repos.transaction.
|
|
325
|
+
yield repos.transaction.findByIdAndUpdateInProgress({
|
|
315
326
|
id: transaction.id,
|
|
316
327
|
update: {
|
|
317
328
|
$set: {
|
|
@@ -339,7 +350,7 @@ function voidAward(params) {
|
|
|
339
350
|
if (transaction.agent.id !== params.agent.id) {
|
|
340
351
|
throw new factory.errors.Forbidden('Transaction not yours');
|
|
341
352
|
}
|
|
342
|
-
yield repos.transaction.
|
|
353
|
+
yield repos.transaction.findByIdAndUpdateInProgress({
|
|
343
354
|
id: transaction.id,
|
|
344
355
|
update: {
|
|
345
356
|
$unset: {
|
|
@@ -36,7 +36,16 @@ function createTasks(params) {
|
|
|
36
36
|
numberOfTried: 0,
|
|
37
37
|
executionResults: [],
|
|
38
38
|
data: {
|
|
39
|
-
object:
|
|
39
|
+
object: {
|
|
40
|
+
endDate: transaction.endDate,
|
|
41
|
+
id: transaction.id,
|
|
42
|
+
object: {
|
|
43
|
+
order: transaction.object.order
|
|
44
|
+
},
|
|
45
|
+
project: transaction.project,
|
|
46
|
+
startDate: transaction.startDate,
|
|
47
|
+
typeOf: transaction.typeOf
|
|
48
|
+
}
|
|
40
49
|
}
|
|
41
50
|
};
|
|
42
51
|
taskAttributes.push(deleteTransactionTask);
|