@chevre/domain 21.2.0-alpha.48 → 21.2.0-alpha.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/chevre/service/notification/factory.js +2 -2
- package/lib/chevre/service/report/telemetry.d.ts +0 -11
- package/lib/chevre/service/report/telemetry.js +21 -24
- package/lib/chevre/service/transaction/moneyTransfer.js +3 -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.js +15 -8
- package/package.json +3 -3
|
@@ -12,7 +12,7 @@ function task2lineNotify(params) {
|
|
|
12
12
|
const lastExecutionResult = (task.executionResults.length > 0) ? task.executionResults.slice(-1)[0] : undefined;
|
|
13
13
|
let lastError = lastExecutionResult === null || lastExecutionResult === void 0 ? void 0 : lastExecutionResult.error;
|
|
14
14
|
if (typeof lastError === 'string') {
|
|
15
|
-
lastError = { message: lastError };
|
|
15
|
+
lastError = { message: lastError, name: 'Error' };
|
|
16
16
|
}
|
|
17
17
|
const lastMessage = `${String(lastError === null || lastError === void 0 ? void 0 : lastError.name)} ${String(lastError === null || lastError === void 0 ? void 0 : lastError.message)}`;
|
|
18
18
|
const content = `project:${(_a = task.project) === null || _a === void 0 ? void 0 : _a.id}
|
|
@@ -38,7 +38,7 @@ function tasks2lineNotify(params) {
|
|
|
38
38
|
const lastExecutionResult = (task.executionResults.length > 0) ? task.executionResults.slice(-1)[0] : undefined;
|
|
39
39
|
let lastError = lastExecutionResult === null || lastExecutionResult === void 0 ? void 0 : lastExecutionResult.error;
|
|
40
40
|
if (typeof lastError === 'string') {
|
|
41
|
-
lastError = { message: lastError };
|
|
41
|
+
lastError = { message: lastError, name: 'Error' };
|
|
42
42
|
}
|
|
43
43
|
const lastMessage = `${String(lastError === null || lastError === void 0 ? void 0 : lastError.name)} ${String(lastError === null || lastError === void 0 ? void 0 : lastError.message)}`;
|
|
44
44
|
return `project:${(_a = task.project) === null || _a === void 0 ? void 0 : _a.id}
|
|
@@ -148,19 +148,15 @@ export interface ISellerFlowTransactionResult {
|
|
|
148
148
|
/**
|
|
149
149
|
* イベントまでの合計残り時間(ミリ秒)
|
|
150
150
|
*/
|
|
151
|
-
totalTimeLeftUntilEventInMilliseconds: number;
|
|
152
151
|
/**
|
|
153
152
|
* イベントまでの最大残り時間(ミリ秒)
|
|
154
153
|
*/
|
|
155
|
-
maxTimeLeftUntilEventInMilliseconds: number;
|
|
156
154
|
/**
|
|
157
155
|
* イベントまでの最小残り時間(ミリ秒)
|
|
158
156
|
*/
|
|
159
|
-
minTimeLeftUntilEventInMilliseconds: number;
|
|
160
157
|
/**
|
|
161
158
|
* イベントまでの平均残り時間(ミリ秒)
|
|
162
159
|
*/
|
|
163
|
-
averageTimeLeftUntilEventInMilliseconds: number;
|
|
164
160
|
/**
|
|
165
161
|
* 取引の合計金額(yen)
|
|
166
162
|
*/
|
|
@@ -180,15 +176,12 @@ export interface ISellerFlowTransactionResult {
|
|
|
180
176
|
/**
|
|
181
177
|
* アクション数合計値(成立取引)
|
|
182
178
|
*/
|
|
183
|
-
totalNumberOfActionsOnConfirmed: number;
|
|
184
179
|
/**
|
|
185
180
|
* 最大アクション数(成立取引)
|
|
186
181
|
*/
|
|
187
|
-
maxNumberOfActionsOnConfirmed: number;
|
|
188
182
|
/**
|
|
189
183
|
* 最小アクション数(成立取引)
|
|
190
184
|
*/
|
|
191
|
-
minNumberOfActionsOnConfirmed: number;
|
|
192
185
|
/**
|
|
193
186
|
* 注文アイテム数合計値
|
|
194
187
|
*/
|
|
@@ -205,10 +198,6 @@ export interface ISellerFlowTransactionResult {
|
|
|
205
198
|
* 平均注文アイテム数
|
|
206
199
|
*/
|
|
207
200
|
averageNumberOfOrderItems: number;
|
|
208
|
-
/**
|
|
209
|
-
* 平均アクション数(成立取引)
|
|
210
|
-
*/
|
|
211
|
-
averageNumberOfActionsOnConfirmed: number;
|
|
212
201
|
}
|
|
213
202
|
/**
|
|
214
203
|
* 販売者が対象のフローデータ
|
|
@@ -247,17 +247,12 @@ function createSellerFlowTransactionResult(measuredFrom, measuredThrough, seller
|
|
|
247
247
|
const maxRequiredTimeInMilliseconds = requiredTimesConfirmed.reduce((a, b) => Math.max(a, b), 0);
|
|
248
248
|
const minRequiredTimeInMilliseconds = requiredTimesConfirmed.reduce((a, b) => Math.min(a, b), (numberOfTransactionsConfirmed > 0) ? requiredTimesConfirmed[0] : 0);
|
|
249
249
|
const averageRequiredTimeInMilliseconds = (numberOfTransactionsConfirmed > 0) ? totalRequiredTimeInMilliseconds / numberOfTransactionsConfirmed : 0;
|
|
250
|
-
//
|
|
251
|
-
const
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
});
|
|
257
|
-
const totalTimeLeftUntilEventInMilliseconds = timesLeftUntilEvent.reduce((a, b) => a + b, 0);
|
|
258
|
-
const maxTimeLeftUntilEventInMilliseconds = timesLeftUntilEvent.reduce((a, b) => Math.max(a, b), 0);
|
|
259
|
-
const minTimeLeftUntilEventInMilliseconds = timesLeftUntilEvent.reduce((a, b) => Math.min(a, b), (numberOfTransactionsConfirmed > 0) ? timesLeftUntilEvent[0] : 0);
|
|
260
|
-
const averageTimeLeftUntilEventInMilliseconds = (numberOfTransactionsConfirmed > 0) ? totalTimeLeftUntilEventInMilliseconds / numberOfTransactionsConfirmed : 0;
|
|
250
|
+
// const totalTimeLeftUntilEventInMilliseconds = timesLeftUntilEvent.reduce((a, b) => a + b, 0);
|
|
251
|
+
// const maxTimeLeftUntilEventInMilliseconds = timesLeftUntilEvent.reduce((a, b) => Math.max(a, b), 0);
|
|
252
|
+
// const minTimeLeftUntilEventInMilliseconds =
|
|
253
|
+
// timesLeftUntilEvent.reduce((a, b) => Math.min(a, b), (numberOfTransactionsConfirmed > 0) ? timesLeftUntilEvent[0] : 0);
|
|
254
|
+
// const averageTimeLeftUntilEventInMilliseconds =
|
|
255
|
+
// (numberOfTransactionsConfirmed > 0) ? totalTimeLeftUntilEventInMilliseconds / numberOfTransactionsConfirmed : 0;
|
|
261
256
|
// 金額算出
|
|
262
257
|
const amounts = confirmedTransactions.map((transaction) => transaction.result.order.price);
|
|
263
258
|
const totalAmount = amounts.reduce((a, b) => a + b, 0);
|
|
@@ -265,11 +260,13 @@ function createSellerFlowTransactionResult(measuredFrom, measuredThrough, seller
|
|
|
265
260
|
const minAmount = amounts.reduce((a, b) => Math.min(a, b), (numberOfTransactionsConfirmed > 0) ? amounts[0] : 0);
|
|
266
261
|
const averageAmount = (numberOfTransactionsConfirmed > 0) ? totalAmount / numberOfTransactionsConfirmed : 0;
|
|
267
262
|
// アクション数集計
|
|
268
|
-
const numbersOfActions = confirmedTransactions.map((t) => t.object.authorizeActions.length);
|
|
269
|
-
const totalNumberOfActions = numbersOfActions.reduce((a, b) => a + b, 0);
|
|
270
|
-
const maxNumberOfActions = numbersOfActions.reduce((a, b) => Math.max(a, b), 0);
|
|
271
|
-
const minNumberOfActions = numbersOfActions.reduce(
|
|
272
|
-
|
|
263
|
+
// const numbersOfActions = confirmedTransactions.map((t) => t.object.authorizeActions.length);
|
|
264
|
+
// const totalNumberOfActions = numbersOfActions.reduce((a, b) => a + b, 0);
|
|
265
|
+
// const maxNumberOfActions = numbersOfActions.reduce((a, b) => Math.max(a, b), 0);
|
|
266
|
+
// const minNumberOfActions = numbersOfActions.reduce(
|
|
267
|
+
// (a, b) => Math.min(a, b), (numberOfTransactionsConfirmed > 0) ? numbersOfActions[0] : 0
|
|
268
|
+
// );
|
|
269
|
+
// const averageNumberOfActions = (numberOfTransactionsConfirmed > 0) ? totalNumberOfActions / numberOfTransactionsConfirmed : 0;
|
|
273
270
|
// 期限切れ取引数
|
|
274
271
|
const numberOfTransactionsExpired = expiredTransactions.length;
|
|
275
272
|
const expiredTransactionIds = expiredTransactions.map((transaction) => transaction.id);
|
|
@@ -284,18 +281,18 @@ function createSellerFlowTransactionResult(measuredFrom, measuredThrough, seller
|
|
|
284
281
|
maxRequiredTimeInMilliseconds: maxRequiredTimeInMilliseconds,
|
|
285
282
|
minRequiredTimeInMilliseconds: minRequiredTimeInMilliseconds,
|
|
286
283
|
averageRequiredTimeInMilliseconds: parseFloat(averageRequiredTimeInMilliseconds.toFixed(1)),
|
|
287
|
-
totalTimeLeftUntilEventInMilliseconds: totalTimeLeftUntilEventInMilliseconds,
|
|
288
|
-
maxTimeLeftUntilEventInMilliseconds: maxTimeLeftUntilEventInMilliseconds,
|
|
289
|
-
minTimeLeftUntilEventInMilliseconds: minTimeLeftUntilEventInMilliseconds,
|
|
290
|
-
averageTimeLeftUntilEventInMilliseconds: averageTimeLeftUntilEventInMilliseconds,
|
|
284
|
+
// totalTimeLeftUntilEventInMilliseconds: totalTimeLeftUntilEventInMilliseconds,
|
|
285
|
+
// maxTimeLeftUntilEventInMilliseconds: maxTimeLeftUntilEventInMilliseconds,
|
|
286
|
+
// minTimeLeftUntilEventInMilliseconds: minTimeLeftUntilEventInMilliseconds,
|
|
287
|
+
// averageTimeLeftUntilEventInMilliseconds: averageTimeLeftUntilEventInMilliseconds,
|
|
291
288
|
totalAmount: totalAmount,
|
|
292
289
|
maxAmount: maxAmount,
|
|
293
290
|
minAmount: minAmount,
|
|
294
291
|
averageAmount: parseFloat(averageAmount.toFixed(1)),
|
|
295
|
-
totalNumberOfActionsOnConfirmed: totalNumberOfActions,
|
|
296
|
-
maxNumberOfActionsOnConfirmed: maxNumberOfActions,
|
|
297
|
-
minNumberOfActionsOnConfirmed: minNumberOfActions,
|
|
298
|
-
averageNumberOfActionsOnConfirmed: parseFloat(averageNumberOfActions.toFixed(1)),
|
|
292
|
+
// totalNumberOfActionsOnConfirmed: totalNumberOfActions,
|
|
293
|
+
// maxNumberOfActionsOnConfirmed: maxNumberOfActions,
|
|
294
|
+
// minNumberOfActionsOnConfirmed: minNumberOfActions,
|
|
295
|
+
// averageNumberOfActionsOnConfirmed: parseFloat(averageNumberOfActions.toFixed(1)),
|
|
299
296
|
// tslint:disable-next-line:no-suspicious-comment
|
|
300
297
|
totalNumberOfOrderItems: 0,
|
|
301
298
|
// tslint:disable-next-line:no-suspicious-comment
|
|
@@ -545,7 +545,9 @@ function searchAuthorizeActions(params) {
|
|
|
545
545
|
purpose: {
|
|
546
546
|
typeOf: params.transaction.typeOf,
|
|
547
547
|
id: params.transaction.id
|
|
548
|
-
}
|
|
548
|
+
},
|
|
549
|
+
// Completedに絞る(2023-05-16~)
|
|
550
|
+
actionStatus: { $eq: factory.actionStatusType.CompletedActionStatus }
|
|
549
551
|
});
|
|
550
552
|
// 万が一このプロセス中に他処理が発生してもそれらを無視するように、endDateでフィルタリング
|
|
551
553
|
authorizeActions = authorizeActions.filter((a) => {
|
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) => {
|
|
@@ -95,14 +95,15 @@ function confirm(params) {
|
|
|
95
95
|
throw new factory.errors.Forbidden('Transaction not yours');
|
|
96
96
|
}
|
|
97
97
|
// 取引に対する全ての承認アクションをマージ
|
|
98
|
-
|
|
98
|
+
const authorizeActions = yield searchAuthorizeActions(params)(repos);
|
|
99
|
+
// transaction.object.authorizeActions = authorizeActions;
|
|
99
100
|
// 注文番号を発行
|
|
100
101
|
const orderNumber = yield publishOrderNumberIfNotExist({
|
|
101
102
|
project: { id: transaction.project.id },
|
|
102
103
|
id: transaction.id,
|
|
103
104
|
object: { orderDate: params.result.order.orderDate }
|
|
104
105
|
})(repos);
|
|
105
|
-
const result = createResult(Object.assign(Object.assign({}, params), { orderNumber, transaction: transaction }));
|
|
106
|
+
const result = createResult(Object.assign(Object.assign({}, params), { orderNumber, transaction: transaction, authorizeActions }));
|
|
106
107
|
// デフォルトEメールメッセージを検索
|
|
107
108
|
let emailMessageOnOrderSent;
|
|
108
109
|
if (repos.emailMessage !== undefined) {
|
|
@@ -119,14 +120,16 @@ function confirm(params) {
|
|
|
119
120
|
order: result.order,
|
|
120
121
|
potentialActions: params.potentialActions,
|
|
121
122
|
transaction: transaction,
|
|
122
|
-
emailMessage: emailMessageOnOrderSent
|
|
123
|
+
emailMessage: emailMessageOnOrderSent,
|
|
124
|
+
authorizeActions
|
|
123
125
|
});
|
|
124
126
|
// ステータス変更
|
|
125
127
|
try {
|
|
126
128
|
yield repos.transaction.confirm({
|
|
127
129
|
typeOf: transaction.typeOf,
|
|
128
130
|
id: transaction.id,
|
|
129
|
-
authorizeActions: transaction.object.authorizeActions,
|
|
131
|
+
// authorizeActions: transaction.object.authorizeActions,
|
|
132
|
+
authorizeActions,
|
|
130
133
|
result: result,
|
|
131
134
|
potentialActions: potentialActions
|
|
132
135
|
});
|
|
@@ -214,18 +217,20 @@ exports.publishOrderNumberIfNotExist = publishOrderNumberIfNotExist;
|
|
|
214
217
|
function createResult(params) {
|
|
215
218
|
const transaction = params.transaction;
|
|
216
219
|
// 取引の確定条件が全て整っているかどうか確認
|
|
217
|
-
(0, validation_1.validateTransaction)(transaction);
|
|
220
|
+
(0, validation_1.validateTransaction)(transaction, params.authorizeActions);
|
|
218
221
|
// 注文作成
|
|
219
222
|
const order = (0, result_1.createOrder)({
|
|
220
223
|
orderNumber: params.orderNumber,
|
|
221
224
|
transaction: transaction,
|
|
222
225
|
orderDate: params.result.order.orderDate,
|
|
223
226
|
orderStatus: factory.orderStatus.OrderProcessing,
|
|
224
|
-
isGift: false
|
|
227
|
+
isGift: false,
|
|
228
|
+
authorizeActions: params.authorizeActions
|
|
225
229
|
});
|
|
226
230
|
(0, validation_1.validateEventOffers)({
|
|
227
231
|
transaction: transaction,
|
|
228
|
-
order: order
|
|
232
|
+
order: order,
|
|
233
|
+
authorizeActions: params.authorizeActions
|
|
229
234
|
});
|
|
230
235
|
// 注文アイテム数制限確認
|
|
231
236
|
(0, validation_1.validateNumItems)({
|
|
@@ -252,7 +257,9 @@ function searchAuthorizeActions(params) {
|
|
|
252
257
|
purpose: {
|
|
253
258
|
typeOf: factory.transactionType.PlaceOrder,
|
|
254
259
|
id: params.id
|
|
255
|
-
}
|
|
260
|
+
},
|
|
261
|
+
// Completedに絞る(2023-05-16~)
|
|
262
|
+
actionStatus: { $eq: factory.actionStatusType.CompletedActionStatus }
|
|
256
263
|
});
|
|
257
264
|
// 万が一このプロセス中に他処理が発生してもそれらを無視するように、endDateでフィルタリング
|
|
258
265
|
authorizeActions = authorizeActions.filter((a) => (a.endDate !== undefined && a.endDate < params.result.order.orderDate));
|
package/package.json
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.
|
|
13
|
-
"@cinerino/sdk": "3.
|
|
12
|
+
"@chevre/factory": "4.312.0",
|
|
13
|
+
"@cinerino/sdk": "3.156.0",
|
|
14
14
|
"@motionpicture/coa-service": "9.2.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.2.0",
|
|
16
16
|
"@sendgrid/mail": "6.4.0",
|
|
@@ -117,5 +117,5 @@
|
|
|
117
117
|
"postversion": "git push origin --tags",
|
|
118
118
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
119
119
|
},
|
|
120
|
-
"version": "21.2.0-alpha.
|
|
120
|
+
"version": "21.2.0-alpha.49"
|
|
121
121
|
}
|