@chevre/domain 21.2.0-alpha.7 → 21.2.0-alpha.71
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 +10 -2
- package/example/src/chevre/importEventsFromCOA.ts +3 -4
- package/example/src/chevre/migrateOrderAdditionalProperties.ts +85 -0
- package/example/src/chevre/saveTasks.ts +13 -10
- package/example/src/chevre/searchAbortedTasks.ts +36 -0
- package/example/src/chevre/searchReservationNumbersByOrderNumbers.ts +37 -1
- package/example/src/chevre/searchSellers.ts +22 -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/processReturnOrder.ts +40 -0
- package/example/src/chevre/transaction/startExportTasks.ts +20 -0
- package/example/src/chevre/updateTransaction.ts +1 -1
- package/example/src/playOnMoment.ts +24 -0
- 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/accountTransaction.d.ts +3 -11
- package/lib/chevre/repo/accountTransaction.js +1 -54
- package/lib/chevre/repo/action.d.ts +29 -1
- package/lib/chevre/repo/action.js +32 -25
- package/lib/chevre/repo/assetTransaction.d.ts +24 -9
- package/lib/chevre/repo/assetTransaction.js +207 -64
- package/lib/chevre/repo/comment.d.ts +4 -1
- package/lib/chevre/repo/comment.js +20 -5
- 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/emailMessage.d.ts +1 -27
- package/lib/chevre/repo/event.d.ts +5 -1
- package/lib/chevre/repo/merchantReturnPolicy.d.ts +1 -3
- 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 +7 -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/offerItemCondition.d.ts +22 -0
- package/lib/chevre/repo/offerItemCondition.js +120 -0
- package/lib/chevre/repo/order.d.ts +49 -1
- package/lib/chevre/repo/order.js +44 -3
- package/lib/chevre/repo/reservation.d.ts +3 -1
- package/lib/chevre/repo/seller.js +19 -19
- package/lib/chevre/repo/task.d.ts +45 -2
- package/lib/chevre/repo/task.js +101 -8
- package/lib/chevre/repo/transaction.d.ts +23 -3
- package/lib/chevre/repo/transaction.js +174 -54
- 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 +1 -28
- package/lib/chevre/service/assetTransaction/moneyTransfer.js +1 -23
- package/lib/chevre/service/assetTransaction/pay/potentialActions.js +17 -1
- package/lib/chevre/service/assetTransaction/pay.js +10 -25
- package/lib/chevre/service/assetTransaction/refund.js +1 -23
- package/lib/chevre/service/assetTransaction/registerService.js +1 -25
- package/lib/chevre/service/assetTransaction/reserve/factory.js +15 -15
- package/lib/chevre/service/assetTransaction/reserve.d.ts +5 -1
- package/lib/chevre/service/assetTransaction/reserve.js +8 -28
- 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/authorize.js +3 -1
- package/lib/chevre/service/offer/event/factory.d.ts +2 -0
- package/lib/chevre/service/offer/event/factory.js +2 -2
- 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.d.ts +3 -1
- package/lib/chevre/service/order/deleteOrder.js +8 -8
- package/lib/chevre/service/order/onOrderStatusChanged/factory.d.ts +0 -1
- package/lib/chevre/service/order/onOrderStatusChanged/factory.js +1 -48
- package/lib/chevre/service/order/onOrderStatusChanged.js +1 -3
- 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 +2 -4
- 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 +232 -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/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 +0 -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/potentialActions/returnPaymentMethod.js +25 -17
- package/lib/chevre/service/transaction/returnOrder.d.ts +4 -0
- package/lib/chevre/service/transaction/returnOrder.js +225 -35
- package/lib/chevre/service/transaction.d.ts +8 -13
- package/lib/chevre/service/transaction.js +12 -145
- package/lib/chevre/settings.d.ts +4 -1
- package/lib/chevre/settings.js +15 -5
- package/package.json +5 -5
- package/example/src/chevre/migrateMoneyTransferPendingTransactionIdentifier.ts +0 -96
- package/example/src/chevre/migrateMovieAdditionalProperties.ts +0 -98
- package/lib/chevre/service/task/deleteAssetTransaction.d.ts +0 -12
- package/lib/chevre/service/task/deleteAssetTransaction.js +0 -65
- package/lib/chevre/service/task/deleteOrder.d.ts +0 -6
- package/lib/chevre/service/task/deleteOrder.js +0 -35
|
@@ -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) => {
|
|
@@ -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: [],
|
|
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);
|
|
@@ -133,31 +133,39 @@ exports.createReturnPaymentMethodActions = createReturnPaymentMethodActions;
|
|
|
133
133
|
function createReturnPaymentMethodIssuedThroughMovieTicketActions(params) {
|
|
134
134
|
return __awaiter(this, void 0, void 0, function* () {
|
|
135
135
|
const order = params.order;
|
|
136
|
-
const
|
|
136
|
+
const returnFeesMovieTicketByTransaction = params.transaction.object.returnPolicy.returnFeesMovieTicket;
|
|
137
137
|
return Promise.all(params.order.paymentMethods
|
|
138
138
|
.filter((paymentMethod) => {
|
|
139
139
|
return paymentMethod.issuedThrough.typeOf === factory.service.paymentService.PaymentServiceType.MovieTicket;
|
|
140
140
|
})
|
|
141
|
-
//
|
|
141
|
+
// 決済カード着券取消有無設定を適用
|
|
142
142
|
.filter((paymentMethod) => {
|
|
143
|
-
|
|
143
|
+
// デフォルトで実行する
|
|
144
|
+
let returnPaymentMethod = true;
|
|
144
145
|
const movieTicketIdentifier = paymentMethod.accountId;
|
|
145
|
-
const
|
|
146
|
+
const returnFeesMovieTicketSettingsByIdentifier = returnFeesMovieTicketByTransaction === null || returnFeesMovieTicketByTransaction === void 0 ? void 0 : returnFeesMovieTicketByTransaction.filter((r) => {
|
|
147
|
+
var _a;
|
|
148
|
+
return r.identifier === String(movieTicketIdentifier)
|
|
149
|
+
&& ((_a = r.serviceOutput) === null || _a === void 0 ? void 0 : _a.typeOf) === paymentMethod.typeOf;
|
|
150
|
+
});
|
|
146
151
|
// 設定がなければスルー
|
|
147
|
-
if (
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
152
|
+
if (Array.isArray(returnFeesMovieTicketSettingsByIdentifier) && returnFeesMovieTicketSettingsByIdentifier.length > 0) {
|
|
153
|
+
returnFeesMovieTicketSettingsByIdentifier.forEach((returnFeesMovieTicketSetting) => {
|
|
154
|
+
const returnFeesEnumeration = returnFeesMovieTicketSetting.returnFees;
|
|
155
|
+
switch (returnFeesEnumeration) {
|
|
156
|
+
case factory.merchantReturnPolicy.ReturnFeesEnumeration.FreeReturn:
|
|
157
|
+
break;
|
|
158
|
+
// ひとつでも「取消を実行しない」に設定されていれば、実行しない
|
|
159
|
+
case factory.merchantReturnPolicy.ReturnFeesEnumeration.ReturnFeesCustomerResponsibility:
|
|
160
|
+
// 取消実行しない
|
|
161
|
+
returnPaymentMethod = false;
|
|
162
|
+
break;
|
|
163
|
+
default:
|
|
164
|
+
throw new factory.errors.NotImplemented(`returnFees ${returnFeesEnumeration} not implemented`);
|
|
165
|
+
}
|
|
166
|
+
});
|
|
160
167
|
}
|
|
168
|
+
return returnPaymentMethod;
|
|
161
169
|
})
|
|
162
170
|
.map((p) => __awaiter(this, void 0, void 0, function* () {
|
|
163
171
|
const potentialActionsOnRefund = yield createReturnPaymentMethodPotentialActions({
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import * as factory from '../../factory';
|
|
2
2
|
import { MongoRepository as EmailMessageRepo } from '../../repo/emailMessage';
|
|
3
|
+
import { MongoRepository as EventRepo } from '../../repo/event';
|
|
3
4
|
import { MongoRepository as MerchantReturnPolicyRepo } from '../../repo/merchantReturnPolicy';
|
|
4
5
|
import { MongoRepository as OfferRepo } from '../../repo/offer';
|
|
6
|
+
import { MongoRepository as OfferItemConditionRepo } from '../../repo/offerItemCondition';
|
|
5
7
|
import { MongoRepository as OrderRepo } from '../../repo/order';
|
|
6
8
|
import { MongoRepository as ReservationRepo } from '../../repo/reservation';
|
|
7
9
|
import { MongoRepository as SellerRepo } from '../../repo/seller';
|
|
8
10
|
import { MongoRepository as TaskRepo } from '../../repo/task';
|
|
9
11
|
import { MongoRepository as TransactionRepo } from '../../repo/transaction';
|
|
10
12
|
export interface IStartOperationRepos {
|
|
13
|
+
event: EventRepo;
|
|
11
14
|
merchantReturnPolicy: MerchantReturnPolicyRepo;
|
|
12
15
|
offer: OfferRepo;
|
|
16
|
+
offerItemCondition: OfferItemConditionRepo;
|
|
13
17
|
order: OrderRepo;
|
|
14
18
|
reservation: ReservationRepo;
|
|
15
19
|
seller: SellerRepo;
|