@chevre/domain 24.1.0-alpha.27 → 24.1.0-alpha.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/chevre/repo/acceptedOffer.d.ts +0 -1
- package/lib/chevre/repo/acceptedOffer.js +19 -25
- package/lib/chevre/repo/acceptedOfferInReserve.d.ts +4 -4
- package/lib/chevre/repo/acceptedOfferInReserve.js +15 -14
- package/lib/chevre/repo/factory/acceptedOffer/reserveTransaction2itemOffered.d.ts +3 -5
- package/lib/chevre/repo/factory/acceptedOffer/reserveTransaction2itemOffered.js +4 -2
- package/lib/chevre/repo/order.d.ts +0 -82
- package/lib/chevre/repo/order.js +0 -194
- package/lib/chevre/repo/orderInTransaction.js +6 -6
- package/lib/chevre/service/notification/notifyAbortedTasksByEmail.d.ts +1 -1
- package/lib/chevre/service/notification/notifyAbortedTasksByEmail.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +2 -1
- package/lib/chevre/service/payment/creditCard/authorize.js +3 -3
- package/lib/chevre/service/payment/creditCard/payCreditCard.js +1 -1
- package/lib/chevre/service/payment/creditCard/refundCreditCard.js +1 -1
- package/lib/chevre/service/payment/creditCard/searchGMOTrade.js +1 -1
- package/lib/chevre/service/payment/creditCard/voidTransaction.js +1 -1
- package/lib/chevre/service/payment/factory/createPayObjectServiceOutput.d.ts +8 -1
- package/lib/chevre/service/payment/factory/createPayObjectServiceOutput.js +1 -1
- package/lib/chevre/service/payment/movieTicket/payMovieTicket.js +1 -1
- package/lib/chevre/service/payment/movieTicket/processPurchaseNumberAuth.js +1 -1
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket.js +2 -2
- package/lib/chevre/service/task/acceptCOAOffer.js +2 -2
- package/lib/chevre/service/task/authorizePayment.js +1 -1
- package/lib/chevre/service/task/cancelPendingReservation.js +1 -1
- package/lib/chevre/service/task/checkMovieTicket.js +1 -1
- package/lib/chevre/service/task/confirmReserveTransaction.js +1 -1
- package/lib/chevre/service/task/importEventCapacitiesFromCOA.js +1 -1
- package/lib/chevre/service/task/importEventsFromCOA.js +1 -1
- package/lib/chevre/service/task/importOffersFromCOA.js +1 -1
- package/lib/chevre/service/task/pay.js +1 -1
- package/lib/chevre/service/task/refund.js +1 -1
- package/lib/chevre/service/task/returnReserveTransaction.js +1 -1
- package/lib/chevre/service/task/syncResourcesFromCOA.js +1 -1
- package/lib/chevre/service/task/voidPayment.js +1 -1
- package/lib/chevre/service/task/voidReserveTransaction.js +1 -1
- package/lib/chevre/settings.d.ts +8 -14
- package/lib/chevre/settings.js +50 -19
- package/package.json +1 -1
|
@@ -19,7 +19,6 @@ export declare class AcceptedOfferRepo extends AcceptedOfferInReserveRepo {
|
|
|
19
19
|
* オファー展開の注文検索
|
|
20
20
|
*/
|
|
21
21
|
searchWithUnwoundAcceptedOffers(params: factory.order.ISearchConditions, projection: IProjection4searchWithUnwoundAcceptedOffers, options: {
|
|
22
|
-
useMatchBeforeUnwind: boolean;
|
|
23
22
|
useReserveTransaction: boolean;
|
|
24
23
|
}): Promise<(factory.order.IOrder & {
|
|
25
24
|
acceptedOffers: [IAcceptedOffer];
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.AcceptedOfferRepo = void 0;
|
|
7
|
-
const debug_1 = __importDefault(require("debug"));
|
|
8
4
|
const factory_1 = require("../factory");
|
|
9
5
|
const order_1 = require("./mongoose/schemas/order");
|
|
10
6
|
const acceptedOfferInReserve_1 = require("./acceptedOfferInReserve");
|
|
11
7
|
const order_2 = require("./order");
|
|
12
8
|
const settings_1 = require("../settings");
|
|
13
|
-
const debug = (
|
|
9
|
+
// const debug = createDebug('chevre-domain:repo:acceptedOffer');
|
|
14
10
|
/**
|
|
15
11
|
* 注文オファーリポジトリ
|
|
16
12
|
*/
|
|
@@ -24,16 +20,13 @@ class AcceptedOfferRepo extends acceptedOfferInReserve_1.AcceptedOfferInReserveR
|
|
|
24
20
|
* オファー展開の注文検索
|
|
25
21
|
*/
|
|
26
22
|
async searchWithUnwoundAcceptedOffers(params, projection, options) {
|
|
27
|
-
const { useMatchBeforeUnwind } = options;
|
|
28
23
|
const conditions = order_2.OrderRepo.CREATE_MONGO_CONDITIONS(params);
|
|
29
24
|
const aggregate = this.orderModel.aggregate();
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
});
|
|
36
|
-
}
|
|
25
|
+
// unwind->matchでは遅い
|
|
26
|
+
// match->unwind->matchにする(2026-05-08~)
|
|
27
|
+
conditions.forEach((c) => {
|
|
28
|
+
aggregate.match(c);
|
|
29
|
+
});
|
|
37
30
|
// pipelineの順序に注意
|
|
38
31
|
// @see https://docs.mongodb.com/manual/reference/operator/aggregation/sort/
|
|
39
32
|
/* istanbul ignore else */
|
|
@@ -64,32 +57,33 @@ class AcceptedOfferRepo extends acceptedOfferInReserve_1.AcceptedOfferInReserveR
|
|
|
64
57
|
&& offeredThroughIdentifier !== factory_1.factory.service.webAPI.Identifier.COA; // COAでは予約取引を参照しない
|
|
65
58
|
if (useReserveTransaction) {
|
|
66
59
|
const reservationNumbers = [...new Set(orders.map((order) => String(order.acceptedOffers[0].serialNumber)))];
|
|
67
|
-
|
|
68
|
-
let subReservations = [];
|
|
60
|
+
let acceptedOffersByReserveTransaction = [];
|
|
69
61
|
if (reservationNumbers.length > 0) {
|
|
70
|
-
|
|
62
|
+
acceptedOffersByReserveTransaction = await this.findAcceptedOffersByReservationNumbers({ reservationNumbers });
|
|
71
63
|
}
|
|
72
64
|
return orders.map((order) => {
|
|
73
65
|
const acceptedOffer = order.acceptedOffers[0];
|
|
74
|
-
const
|
|
66
|
+
const acceptedOfferByReserveTransaction = acceptedOffersByReserveTransaction.find(((offer) => offer.itemOffered.id === acceptedOffer.itemOffered.id));
|
|
75
67
|
// 予約は必ず存在するはず
|
|
76
|
-
if (
|
|
77
|
-
console.error('searchWithUnwoundAcceptedOffers:
|
|
68
|
+
if (acceptedOfferByReserveTransaction === undefined) {
|
|
69
|
+
console.error('repo:acceptedOffer: searchWithUnwoundAcceptedOffers: acceptedOfferByReserveTransaction: undefined!!!', acceptedOffer.itemOffered.id);
|
|
78
70
|
}
|
|
79
|
-
const priceSpecByReserveTransaction =
|
|
71
|
+
const priceSpecByReserveTransaction = acceptedOfferByReserveTransaction?.priceSpecification;
|
|
80
72
|
// 予約の価格は必ず存在するはず
|
|
81
73
|
if (priceSpecByReserveTransaction === undefined) {
|
|
82
|
-
console.error('searchWithUnwoundAcceptedOffers: priceSpecByReserveTransaction: undefined!!!', acceptedOffer.itemOffered.id);
|
|
74
|
+
console.error('repo:acceptedOffer: searchWithUnwoundAcceptedOffers: priceSpecByReserveTransaction: undefined!!!', acceptedOffer.itemOffered.id);
|
|
83
75
|
}
|
|
84
|
-
const { priceSpecification,
|
|
76
|
+
const { priceSpecification: _originalPriceSpec, // 注文ドキュメントのpriceSpecificationはもう採用しない(2026-05-21~)
|
|
77
|
+
...acceptedOfferWithoutPrice } = acceptedOffer;
|
|
85
78
|
return {
|
|
86
79
|
...order,
|
|
87
80
|
acceptedOffers: [
|
|
88
81
|
{
|
|
89
82
|
...acceptedOfferWithoutPrice,
|
|
90
|
-
...(priceSpecByReserveTransaction !== undefined)
|
|
91
|
-
|
|
92
|
-
|
|
83
|
+
...((priceSpecByReserveTransaction !== undefined) && { priceSpecification: priceSpecByReserveTransaction }) // 予約取引参照の値で上書き
|
|
84
|
+
// ...(priceSpecByReserveTransaction !== undefined)
|
|
85
|
+
// ? { priceSpecification: priceSpecByReserveTransaction } // 予約取引参照の値で上書き
|
|
86
|
+
// : { priceSpecification } // 万が一予約取引に存在しなければ注文ドキュメントの値を採用
|
|
93
87
|
}
|
|
94
88
|
]
|
|
95
89
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Connection } from 'mongoose';
|
|
2
2
|
import { factory } from '../factory';
|
|
3
3
|
import { IModel } from './mongoose/schemas/assetTransaction';
|
|
4
|
-
import {
|
|
4
|
+
import { IAcceptedOfferByReserveTransaction } from './factory/acceptedOffer/reserveTransaction2itemOffered';
|
|
5
5
|
export type IAcceptedOffer = Omit<factory.order.IAcceptedOffer, 'priceSpecification'> & {
|
|
6
6
|
/**
|
|
7
7
|
* COA以外では注文ドキュメントにpriceSpecificationが存在しないのでIFを補完
|
|
@@ -15,14 +15,14 @@ export declare class AcceptedOfferInReserveRepo {
|
|
|
15
15
|
protected readonly reserveTransactionModel: IModel;
|
|
16
16
|
constructor(connection: Connection);
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* 予約番号指定で予約取引から注文オファーを生成する
|
|
19
19
|
*/
|
|
20
|
-
protected
|
|
20
|
+
protected findAcceptedOffersByReservationNumbers(params: {
|
|
21
21
|
/**
|
|
22
22
|
* 予約番号リスト
|
|
23
23
|
*/
|
|
24
24
|
reservationNumbers: string[];
|
|
25
|
-
}): Promise<
|
|
25
|
+
}): Promise<IAcceptedOfferByReserveTransaction[]>;
|
|
26
26
|
/**
|
|
27
27
|
* 予約取引からオファー詳細情報を付加する
|
|
28
28
|
*/
|
|
@@ -18,9 +18,9 @@ class AcceptedOfferInReserveRepo {
|
|
|
18
18
|
this.reserveTransactionModel = connection.model(assetTransaction_1.modelName, (0, assetTransaction_1.createSchema)());
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* 予約番号指定で予約取引から注文オファーを生成する
|
|
22
22
|
*/
|
|
23
|
-
async
|
|
23
|
+
async findAcceptedOffersByReservationNumbers(params) {
|
|
24
24
|
const { reservationNumbers } = params;
|
|
25
25
|
if (!Array.isArray(reservationNumbers) || reservationNumbers.length === 0) {
|
|
26
26
|
throw new factory_1.factory.errors.ArgumentNull('reservationNumbers');
|
|
@@ -48,28 +48,29 @@ class AcceptedOfferInReserveRepo {
|
|
|
48
48
|
return acceptedOffers;
|
|
49
49
|
}
|
|
50
50
|
const reservationNumbers = [...new Set(acceptedOffers.map((acceptedOffer) => String(acceptedOffer.serialNumber)))];
|
|
51
|
-
|
|
52
|
-
let subReservations = [];
|
|
51
|
+
let acceptedOffersByReserveTransaction = [];
|
|
53
52
|
if (reservationNumbers.length > 0) {
|
|
54
|
-
|
|
53
|
+
acceptedOffersByReserveTransaction = await this.findAcceptedOffersByReservationNumbers({ reservationNumbers });
|
|
55
54
|
}
|
|
56
55
|
return acceptedOffers.map((acceptedOffer) => {
|
|
57
|
-
const
|
|
56
|
+
const acceptedOfferByReserveTransaction = acceptedOffersByReserveTransaction.find(((offer) => offer.itemOffered.id === acceptedOffer.itemOffered.id));
|
|
58
57
|
// 予約は必ず存在するはず
|
|
59
|
-
if (
|
|
60
|
-
console.error('addAcceptedOffersDetails:
|
|
58
|
+
if (acceptedOfferByReserveTransaction === undefined) {
|
|
59
|
+
console.error('repo:acceptedOffer: addAcceptedOffersDetails: acceptedOfferByReserveTransaction: undefined!!!', acceptedOffer.itemOffered.id);
|
|
61
60
|
}
|
|
62
|
-
const priceSpecByReserveTransaction =
|
|
61
|
+
const priceSpecByReserveTransaction = acceptedOfferByReserveTransaction?.priceSpecification;
|
|
63
62
|
// 予約の価格は必ず存在するはず
|
|
64
63
|
if (priceSpecByReserveTransaction === undefined) {
|
|
65
|
-
console.error('addAcceptedOffersDetails: priceSpecByReserveTransaction: undefined!!!', acceptedOffer.itemOffered.id);
|
|
64
|
+
console.error('repo:acceptedOffer: addAcceptedOffersDetails: priceSpecByReserveTransaction: undefined!!!', acceptedOffer.itemOffered.id);
|
|
66
65
|
}
|
|
67
|
-
const { priceSpecification,
|
|
66
|
+
const { priceSpecification: _originalPriceSpec, // 注文ドキュメントのpriceSpecificationはもう採用しない(2026-05-21~)
|
|
67
|
+
...acceptedOfferWithoutPrice } = acceptedOffer;
|
|
68
68
|
return {
|
|
69
69
|
...acceptedOfferWithoutPrice,
|
|
70
|
-
...(priceSpecByReserveTransaction !== undefined)
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
...((priceSpecByReserveTransaction !== undefined) && { priceSpecification: priceSpecByReserveTransaction }) // 予約取引参照の値で上書き
|
|
71
|
+
// ...(priceSpecByReserveTransaction !== undefined)
|
|
72
|
+
// ? { priceSpecification: priceSpecByReserveTransaction } // 予約取引参照の値で上書き
|
|
73
|
+
// : { priceSpecification } // 万が一予約取引に存在しなければ注文ドキュメントの値を採用
|
|
73
74
|
};
|
|
74
75
|
});
|
|
75
76
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { factory } from '../../../factory';
|
|
2
|
-
type
|
|
3
|
-
price?: factory.assetTransaction.reserve.IPrice;
|
|
4
|
-
};
|
|
2
|
+
type IAcceptedOfferByReserveTransaction = Pick<factory.order.IOptimizedAcceptedOffer, 'itemOffered' | 'priceSpecification'>;
|
|
5
3
|
/**
|
|
6
4
|
* 予約取引を注文のitemOfferedへ変換する
|
|
7
5
|
*/
|
|
8
|
-
declare function reserveTransaction2itemOffered(params: Pick<factory.assetTransaction.reserve.ITransaction, 'object'>):
|
|
9
|
-
export {
|
|
6
|
+
declare function reserveTransaction2itemOffered(params: Pick<factory.assetTransaction.reserve.ITransaction, 'object'>): IAcceptedOfferByReserveTransaction[];
|
|
7
|
+
export { IAcceptedOfferByReserveTransaction, reserveTransaction2itemOffered };
|
|
@@ -65,8 +65,10 @@ function reserveTransaction2itemOffered(params) {
|
|
|
65
65
|
reservationFor,
|
|
66
66
|
...((typeof additionalTicketText === 'string') && { additionalTicketText }),
|
|
67
67
|
...((typeof programMembershipUsed?.identifier === 'string') && { programMembershipUsed }),
|
|
68
|
-
...((price !== undefined) && { price })
|
|
69
68
|
};
|
|
70
|
-
return
|
|
69
|
+
return {
|
|
70
|
+
itemOffered: reservationByReserveTransaction,
|
|
71
|
+
...((price !== undefined) && { priceSpecification: price })
|
|
72
|
+
};
|
|
71
73
|
});
|
|
72
74
|
}
|
|
@@ -17,12 +17,6 @@ interface IAggregation {
|
|
|
17
17
|
maxPrice: number;
|
|
18
18
|
minPrice: number;
|
|
19
19
|
}
|
|
20
|
-
interface IGlobalAggregateOrder {
|
|
21
|
-
orderCount: number;
|
|
22
|
-
aggregateProject: {
|
|
23
|
-
projectCount: number;
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
20
|
interface IAggregateOrder {
|
|
27
21
|
aggregation: IAggregation;
|
|
28
22
|
}
|
|
@@ -172,81 +166,5 @@ export declare class OrderRepo {
|
|
|
172
166
|
$lte: Date;
|
|
173
167
|
};
|
|
174
168
|
}): Promise<IAggregateOrder>;
|
|
175
|
-
aggregateOrderOfSeat(params: {
|
|
176
|
-
project: {
|
|
177
|
-
id: {
|
|
178
|
-
$eq: string;
|
|
179
|
-
};
|
|
180
|
-
};
|
|
181
|
-
orderDate: {
|
|
182
|
-
$gte: Date;
|
|
183
|
-
$lte: Date;
|
|
184
|
-
};
|
|
185
|
-
acceptedOffers: {
|
|
186
|
-
itemOffered: {
|
|
187
|
-
reservationFor: {
|
|
188
|
-
location: {
|
|
189
|
-
branchCode: string;
|
|
190
|
-
};
|
|
191
|
-
superEvent: {
|
|
192
|
-
location: {
|
|
193
|
-
branchCode: string;
|
|
194
|
-
};
|
|
195
|
-
};
|
|
196
|
-
};
|
|
197
|
-
reservedTicket: {
|
|
198
|
-
ticketedSeat: {
|
|
199
|
-
seatNumber: string;
|
|
200
|
-
};
|
|
201
|
-
};
|
|
202
|
-
};
|
|
203
|
-
};
|
|
204
|
-
customer?: {
|
|
205
|
-
email?: {
|
|
206
|
-
$in?: string[];
|
|
207
|
-
};
|
|
208
|
-
};
|
|
209
|
-
}): Promise<{
|
|
210
|
-
aggregation: Pick<IAggregation, 'orderCount'> & {
|
|
211
|
-
sumGraceTime?: number;
|
|
212
|
-
emailCount?: number;
|
|
213
|
-
};
|
|
214
|
-
}>;
|
|
215
|
-
aggregateOrderOfCustomerByProject(params: {
|
|
216
|
-
project?: {
|
|
217
|
-
id: {
|
|
218
|
-
$eq: string;
|
|
219
|
-
};
|
|
220
|
-
};
|
|
221
|
-
orderDate: {
|
|
222
|
-
$gte: Date;
|
|
223
|
-
$lte: Date;
|
|
224
|
-
};
|
|
225
|
-
customer: {
|
|
226
|
-
email: {
|
|
227
|
-
$eq: string;
|
|
228
|
-
};
|
|
229
|
-
};
|
|
230
|
-
}): Promise<{
|
|
231
|
-
aggregation: Pick<IAggregation, 'orderCount'> & {
|
|
232
|
-
sumGraceTime?: number;
|
|
233
|
-
emailCount?: number;
|
|
234
|
-
};
|
|
235
|
-
}>;
|
|
236
|
-
aggregateOrderOfCustomerGlobally(params: {
|
|
237
|
-
orderDate: {
|
|
238
|
-
$gte: Date;
|
|
239
|
-
$lte: Date;
|
|
240
|
-
};
|
|
241
|
-
customer: {
|
|
242
|
-
email: {
|
|
243
|
-
$eq: string;
|
|
244
|
-
};
|
|
245
|
-
};
|
|
246
|
-
}): Promise<{
|
|
247
|
-
aggregation: IGlobalAggregateOrder & {
|
|
248
|
-
sumGraceTime?: never;
|
|
249
|
-
};
|
|
250
|
-
}>;
|
|
251
169
|
}
|
|
252
170
|
export {};
|
package/lib/chevre/repo/order.js
CHANGED
|
@@ -1072,199 +1072,5 @@ class OrderRepo {
|
|
|
1072
1072
|
}
|
|
1073
1073
|
return { aggregation: aggregations[0] };
|
|
1074
1074
|
}
|
|
1075
|
-
async aggregateOrderOfSeat(params) {
|
|
1076
|
-
const seatNumber = params.acceptedOffers.itemOffered.reservedTicket.ticketedSeat.seatNumber;
|
|
1077
|
-
const screenCode = params.acceptedOffers.itemOffered.reservationFor.location.branchCode;
|
|
1078
|
-
const movieTheaterCode = params.acceptedOffers.itemOffered.reservationFor.superEvent.location.branchCode;
|
|
1079
|
-
const customerEmailIn = params.customer?.email?.$in;
|
|
1080
|
-
const matchConditions = {
|
|
1081
|
-
orderDate: {
|
|
1082
|
-
$gte: params.orderDate.$gte,
|
|
1083
|
-
$lte: params.orderDate.$lte
|
|
1084
|
-
},
|
|
1085
|
-
typeOf: { $eq: factory_1.factory.order.OrderType.Order },
|
|
1086
|
-
'project.id': { $eq: params.project.id.$eq },
|
|
1087
|
-
'acceptedOffers.itemOffered.reservationFor.superEvent.location.branchCode': { $exists: true, $eq: movieTheaterCode },
|
|
1088
|
-
'acceptedOffers.itemOffered.reservationFor.location.branchCode': { $exists: true, $eq: screenCode },
|
|
1089
|
-
'acceptedOffers.itemOffered.reservedTicket.ticketedSeat.seatNumber': { $exists: true, $eq: seatNumber },
|
|
1090
|
-
...(Array.isArray(customerEmailIn))
|
|
1091
|
-
? { 'customer.email': { $exists: true, $in: customerEmailIn } }
|
|
1092
|
-
: undefined
|
|
1093
|
-
};
|
|
1094
|
-
const aggregations4email = await this.orderModel.aggregate([
|
|
1095
|
-
{ $match: matchConditions },
|
|
1096
|
-
{
|
|
1097
|
-
$group: {
|
|
1098
|
-
_id: '$customer.email'
|
|
1099
|
-
}
|
|
1100
|
-
},
|
|
1101
|
-
{
|
|
1102
|
-
$count: 'emailCount'
|
|
1103
|
-
}
|
|
1104
|
-
])
|
|
1105
|
-
.exec();
|
|
1106
|
-
const emailCount = (aggregations4email.length > 0) ? aggregations4email[0].emailCount : 0;
|
|
1107
|
-
const aggregations = await this.orderModel.aggregate([
|
|
1108
|
-
{ $match: matchConditions },
|
|
1109
|
-
{
|
|
1110
|
-
$project: {
|
|
1111
|
-
typeOf: '$typeOf',
|
|
1112
|
-
graceTime: {
|
|
1113
|
-
$subtract: [
|
|
1114
|
-
{ $first: '$acceptedOffers.itemOffered.reservationFor.startDate' },
|
|
1115
|
-
'$orderDate'
|
|
1116
|
-
]
|
|
1117
|
-
}
|
|
1118
|
-
}
|
|
1119
|
-
},
|
|
1120
|
-
{
|
|
1121
|
-
$group: {
|
|
1122
|
-
_id: '$typeOf',
|
|
1123
|
-
orderCount: { $sum: 1 },
|
|
1124
|
-
sumGraceTime: { $sum: '$graceTime' }
|
|
1125
|
-
}
|
|
1126
|
-
},
|
|
1127
|
-
{
|
|
1128
|
-
$project: {
|
|
1129
|
-
_id: 0,
|
|
1130
|
-
orderCount: '$orderCount',
|
|
1131
|
-
sumGraceTime: '$sumGraceTime'
|
|
1132
|
-
}
|
|
1133
|
-
}
|
|
1134
|
-
])
|
|
1135
|
-
.exec();
|
|
1136
|
-
if (aggregations.length === 0) {
|
|
1137
|
-
return {
|
|
1138
|
-
aggregation: {
|
|
1139
|
-
orderCount: 0
|
|
1140
|
-
}
|
|
1141
|
-
};
|
|
1142
|
-
}
|
|
1143
|
-
return {
|
|
1144
|
-
aggregation: {
|
|
1145
|
-
...aggregations[0],
|
|
1146
|
-
emailCount
|
|
1147
|
-
}
|
|
1148
|
-
};
|
|
1149
|
-
}
|
|
1150
|
-
async aggregateOrderOfCustomerByProject(params) {
|
|
1151
|
-
const matchConditions = {
|
|
1152
|
-
orderDate: {
|
|
1153
|
-
$gte: params.orderDate.$gte,
|
|
1154
|
-
$lte: params.orderDate.$lte
|
|
1155
|
-
},
|
|
1156
|
-
typeOf: { $eq: factory_1.factory.order.OrderType.Order },
|
|
1157
|
-
...(typeof params.project?.id.$eq === 'string') ? { 'project.id': { $eq: params.project.id.$eq } } : undefined,
|
|
1158
|
-
'customer.email': { $exists: true, $eq: params.customer.email.$eq }
|
|
1159
|
-
};
|
|
1160
|
-
const aggregations = await this.orderModel.aggregate([
|
|
1161
|
-
{ $match: matchConditions },
|
|
1162
|
-
{
|
|
1163
|
-
$project: {
|
|
1164
|
-
typeOf: '$typeOf',
|
|
1165
|
-
graceTime: {
|
|
1166
|
-
$subtract: [
|
|
1167
|
-
{ $first: '$acceptedOffers.itemOffered.reservationFor.startDate' },
|
|
1168
|
-
'$orderDate'
|
|
1169
|
-
]
|
|
1170
|
-
}
|
|
1171
|
-
}
|
|
1172
|
-
},
|
|
1173
|
-
{
|
|
1174
|
-
$group: {
|
|
1175
|
-
_id: '$typeOf',
|
|
1176
|
-
orderCount: { $sum: 1 },
|
|
1177
|
-
sumGraceTime: { $sum: '$graceTime' }
|
|
1178
|
-
}
|
|
1179
|
-
},
|
|
1180
|
-
{
|
|
1181
|
-
$project: {
|
|
1182
|
-
_id: 0,
|
|
1183
|
-
orderCount: '$orderCount',
|
|
1184
|
-
sumGraceTime: '$sumGraceTime'
|
|
1185
|
-
}
|
|
1186
|
-
}
|
|
1187
|
-
])
|
|
1188
|
-
.exec();
|
|
1189
|
-
if (aggregations.length === 0) {
|
|
1190
|
-
return {
|
|
1191
|
-
aggregation: {
|
|
1192
|
-
orderCount: 0
|
|
1193
|
-
}
|
|
1194
|
-
};
|
|
1195
|
-
}
|
|
1196
|
-
return {
|
|
1197
|
-
aggregation: {
|
|
1198
|
-
...aggregations[0]
|
|
1199
|
-
}
|
|
1200
|
-
};
|
|
1201
|
-
}
|
|
1202
|
-
async aggregateOrderOfCustomerGlobally(params) {
|
|
1203
|
-
const matchConditions = {
|
|
1204
|
-
orderDate: {
|
|
1205
|
-
$gte: params.orderDate.$gte,
|
|
1206
|
-
$lte: params.orderDate.$lte
|
|
1207
|
-
},
|
|
1208
|
-
typeOf: { $eq: factory_1.factory.order.OrderType.Order },
|
|
1209
|
-
'customer.email': { $exists: true, $eq: params.customer.email.$eq }
|
|
1210
|
-
};
|
|
1211
|
-
const aggregations = await this.orderModel.aggregate([
|
|
1212
|
-
{ $match: matchConditions },
|
|
1213
|
-
{
|
|
1214
|
-
$project: {
|
|
1215
|
-
typeOf: '$typeOf'
|
|
1216
|
-
}
|
|
1217
|
-
},
|
|
1218
|
-
{
|
|
1219
|
-
$group: {
|
|
1220
|
-
_id: '$typeOf',
|
|
1221
|
-
orderCount: { $sum: 1 }
|
|
1222
|
-
}
|
|
1223
|
-
},
|
|
1224
|
-
{
|
|
1225
|
-
$project: {
|
|
1226
|
-
_id: 0,
|
|
1227
|
-
orderCount: '$orderCount'
|
|
1228
|
-
}
|
|
1229
|
-
}
|
|
1230
|
-
])
|
|
1231
|
-
.exec();
|
|
1232
|
-
if (aggregations.length === 0) {
|
|
1233
|
-
return {
|
|
1234
|
-
aggregation: {
|
|
1235
|
-
orderCount: 0,
|
|
1236
|
-
aggregateProject: { projectCount: 0 }
|
|
1237
|
-
}
|
|
1238
|
-
};
|
|
1239
|
-
}
|
|
1240
|
-
const aggregations2 = await this.orderModel.aggregate([
|
|
1241
|
-
{ $match: matchConditions },
|
|
1242
|
-
{
|
|
1243
|
-
$project: {
|
|
1244
|
-
project: '$project'
|
|
1245
|
-
}
|
|
1246
|
-
},
|
|
1247
|
-
{
|
|
1248
|
-
$group: {
|
|
1249
|
-
_id: '$project.id'
|
|
1250
|
-
}
|
|
1251
|
-
},
|
|
1252
|
-
{
|
|
1253
|
-
$count: 'projectCount'
|
|
1254
|
-
},
|
|
1255
|
-
{
|
|
1256
|
-
$project: {
|
|
1257
|
-
aggregateProject: { projectCount: '$projectCount' }
|
|
1258
|
-
}
|
|
1259
|
-
}
|
|
1260
|
-
])
|
|
1261
|
-
.exec();
|
|
1262
|
-
return {
|
|
1263
|
-
aggregation: {
|
|
1264
|
-
...aggregations[0],
|
|
1265
|
-
...aggregations2[0]
|
|
1266
|
-
}
|
|
1267
|
-
};
|
|
1268
|
-
}
|
|
1269
1075
|
}
|
|
1270
1076
|
exports.OrderRepo = OrderRepo;
|
|
@@ -35,20 +35,20 @@ class OrderInTransactionRepo extends acceptedOfferInReserve_1.AcceptedOfferInRes
|
|
|
35
35
|
return doc.acceptedOffers;
|
|
36
36
|
}
|
|
37
37
|
// priceSpecificationを予約取引から補完する(2026-05-12~)
|
|
38
|
-
let
|
|
38
|
+
let acceptedOffersByReserveTransaction = [];
|
|
39
39
|
const reservationNumbers = [...new Set(doc.acceptedOffers.map((aceptedOffer) => aceptedOffer.itemOffered.reservationNumber))];
|
|
40
40
|
if (reservationNumbers.length > 0) {
|
|
41
|
-
|
|
41
|
+
acceptedOffersByReserveTransaction = await this.findAcceptedOffersByReservationNumbers({ reservationNumbers });
|
|
42
42
|
}
|
|
43
43
|
return doc.acceptedOffers.map((acceptedOffer) => {
|
|
44
|
-
const
|
|
44
|
+
const priceSpecification = acceptedOffersByReserveTransaction.find((acceptedOfferByReserveTransaction) => acceptedOfferByReserveTransaction.itemOffered.id === acceptedOffer.itemOffered.id)?.priceSpecification;
|
|
45
45
|
// COA予約でなければ、予約取引の価格は必ず存在するはず(2026-05-20~)
|
|
46
|
-
if (
|
|
47
|
-
throw new factory_1.factory.errors.Internal(`findAcceptedOffersWithPriceByOrderNumber:
|
|
46
|
+
if (priceSpecification === undefined) {
|
|
47
|
+
throw new factory_1.factory.errors.Internal(`findAcceptedOffersWithPriceByOrderNumber: priceSpecification undefined. ${acceptedOffer.itemOffered.id}`);
|
|
48
48
|
}
|
|
49
49
|
return {
|
|
50
50
|
...acceptedOffer,
|
|
51
|
-
priceSpecification
|
|
51
|
+
priceSpecification
|
|
52
52
|
};
|
|
53
53
|
});
|
|
54
54
|
}
|
|
@@ -9,7 +9,7 @@ declare function notifyAbortedTasksByEmail(params: {
|
|
|
9
9
|
dateAbortedGte: Date;
|
|
10
10
|
}): (repos: {
|
|
11
11
|
task: TaskRepo;
|
|
12
|
-
}, settings:
|
|
12
|
+
}, settings: Settings, credentials: {
|
|
13
13
|
sendGrid: SendGridCredentials;
|
|
14
14
|
}) => Promise<void>;
|
|
15
15
|
export { notifyAbortedTasksByEmail };
|
|
@@ -15,7 +15,7 @@ const debug = (0, debug_1.default)('chevre-domain:service:notification');
|
|
|
15
15
|
*/
|
|
16
16
|
function notifyAbortedTasksByEmail(params) {
|
|
17
17
|
return async (repos, settings, credentials) => {
|
|
18
|
-
const
|
|
18
|
+
const abortedTasksWithoutReport = await settings.getByKey('abortedTasksWithoutReport');
|
|
19
19
|
const abortedTasks = await repos.task.projectFields({
|
|
20
20
|
status: { $eq: factory_1.factory.taskStatus.Aborted },
|
|
21
21
|
dateAborted: { $gte: params.dateAbortedGte },
|
|
@@ -18,7 +18,8 @@ const debug = (0, debug_1.default)('chevre-domain:service:order');
|
|
|
18
18
|
function onOrderProcessing(params) {
|
|
19
19
|
return async (repos, settings) => {
|
|
20
20
|
const setting = await repos.setting.findOne({ project: { id: { $eq: '*' } } }, ['onOrderStatusChanged']);
|
|
21
|
-
const { numTryConfirmReserveTransaction } = settings;
|
|
21
|
+
// const { numTryConfirmReserveTransaction } = settings;
|
|
22
|
+
const numTryConfirmReserveTransaction = await settings.getByKey('numTryConfirmReserveTransaction');
|
|
22
23
|
debug('onOrderStatusChanged called.', params.order.orderNumber, params.order.orderStatus, params.order.orderDate);
|
|
23
24
|
let tasks;
|
|
24
25
|
let creatingCheckResourceTask;
|
|
@@ -48,9 +48,9 @@ payTransaction, paymentServiceId, options) {
|
|
|
48
48
|
// タスクによって実行されているかどうか
|
|
49
49
|
const executedByTask = typeof options.executor?.id === 'string' && options.executor.id !== '';
|
|
50
50
|
// 非同期承認時に長時間対応(2024-05-18~)
|
|
51
|
-
const timeout = (executedByTask && typeof settings.gmo.timeoutBackground === 'number')
|
|
52
|
-
? settings.gmo.timeoutBackground
|
|
53
|
-
: settings.gmo.timeout;
|
|
51
|
+
const timeout = (executedByTask && typeof (await settings.getByKey('gmo')).timeoutBackground === 'number')
|
|
52
|
+
? (await settings.getByKey('gmo')).timeoutBackground
|
|
53
|
+
: (await settings.getByKey('gmo')).timeout;
|
|
54
54
|
debug('processAuthorizeCreditCard processing... executor:', options.executor?.id, 'timeout:', timeout);
|
|
55
55
|
const creditCardService = new gmo_service_1.GMO.service.Credit({
|
|
56
56
|
endpoint: String(availableChannel.serviceUrl)
|
|
@@ -39,7 +39,7 @@ function payCreditCard(params) {
|
|
|
39
39
|
try {
|
|
40
40
|
const creditService = new gmo_service_1.GMO.service.Credit({
|
|
41
41
|
endpoint: String(availableChannel.serviceUrl)
|
|
42
|
-
}, { timeout: settings.gmo.timeout });
|
|
42
|
+
}, { timeout: (await settings.getByKey('gmo')).timeout });
|
|
43
43
|
await Promise.all(payObject.map(async (paymentMethod) => {
|
|
44
44
|
const processAlterTranResult = await processAlterTran({
|
|
45
45
|
shopId, shopPass, availableChannel, paymentMethod
|
|
@@ -59,7 +59,7 @@ function refundCreditCard(params
|
|
|
59
59
|
try {
|
|
60
60
|
const creditService = new gmo_service_1.GMO.service.Credit({
|
|
61
61
|
endpoint: String(availableChannel.serviceUrl)
|
|
62
|
-
}, { timeout: settings.gmo.timeout });
|
|
62
|
+
}, { timeout: (await settings.getByKey('gmo')).timeout });
|
|
63
63
|
processAlterTranResult = await processAlterTran({
|
|
64
64
|
availableChannel,
|
|
65
65
|
alterTranResultByPayAction,
|
|
@@ -11,7 +11,7 @@ const gmoError_1 = require("./gmoError");
|
|
|
11
11
|
async function searchGMOTrade(params, settings) {
|
|
12
12
|
const creditCardService = new gmo_service_1.GMO.service.Credit({
|
|
13
13
|
endpoint: String(params.availableChannel.serviceUrl)
|
|
14
|
-
}, { timeout: settings.gmo.timeout });
|
|
14
|
+
}, { timeout: (await settings.getByKey('gmo')).timeout });
|
|
15
15
|
// 取引状態参照
|
|
16
16
|
let searchTradeResult;
|
|
17
17
|
try {
|
|
@@ -59,7 +59,7 @@ function voidTransaction(params) {
|
|
|
59
59
|
}
|
|
60
60
|
const creditCardService = new gmo_service_1.GMO.service.Credit({
|
|
61
61
|
endpoint: String(availableChannel.serviceUrl)
|
|
62
|
-
}, { timeout: settings.gmo.timeout });
|
|
62
|
+
}, { timeout: (await settings.getByKey('gmo')).timeout });
|
|
63
63
|
let searchTradeResult;
|
|
64
64
|
try {
|
|
65
65
|
searchTradeResult = await creditCardService.searchTrade({
|
|
@@ -12,5 +12,12 @@ declare function createPayObjectServiceOutput(params: {
|
|
|
12
12
|
purchaseNumberAuthResult: factory.action.check.paymentMethod.movieTicket.IPurchaseNumberAuthResult;
|
|
13
13
|
};
|
|
14
14
|
}): factory.invoice.IPaymentServiceOutput | undefined;
|
|
15
|
-
|
|
15
|
+
/**
|
|
16
|
+
* 決済カードの適用された注文オファー
|
|
17
|
+
*/
|
|
18
|
+
type IAcceptedOfferMovieTicketUsed = Pick<factory.order.IAcceptedOffer, 'priceSpecification'> & {
|
|
19
|
+
itemOffered: Pick<factory.order.IReservation, 'reservationFor' | 'reservationNumber'> & {
|
|
20
|
+
reservedTicket: Pick<factory.order.IReservedTicket, 'identifier' | 'ticketedSeat' | 'ticketToken'> | Pick<factory.order.ICOAReservedTicket, 'identifier' | 'ticketedSeat' | 'ticketToken'>;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
16
23
|
export { createPayObjectServiceOutput, IAcceptedOfferMovieTicketUsed };
|
|
@@ -131,7 +131,7 @@ function reservationPriceComponent2invoicePriceComponent(component) {
|
|
|
131
131
|
* 決済カードの対象予約情報を作成する
|
|
132
132
|
*/
|
|
133
133
|
function movieTicket2reservation4invoice(movieTicket, order, paymentMethodType, payTransactionNumber) {
|
|
134
|
-
// Order
|
|
134
|
+
// Orderから決済カードの対象予約を取得
|
|
135
135
|
const reservationOffer = order.acceptedOffersMovieTicketUsed.find(({ itemOffered, priceSpecification }) => {
|
|
136
136
|
let mvtkUnitPriceSpec;
|
|
137
137
|
// MovieTicket適用単価オファーからidentifierを取り出す
|
|
@@ -53,7 +53,7 @@ function payMovieTicket(params, options) {
|
|
|
53
53
|
state: '',
|
|
54
54
|
credentialsRepo: repos.credentials // set credentialsRepo(2024-11-20~)
|
|
55
55
|
});
|
|
56
|
-
const seatService = new sdk_1.Surfrock.service.seat.SeatService({ endpoint: String(availableChannel.serviceUrl), auth: mvtkReserveAuthClient }, { timeout: settings.movieticketReserve.timeout });
|
|
56
|
+
const seatService = new sdk_1.Surfrock.service.seat.SeatService({ endpoint: String(availableChannel.serviceUrl), auth: mvtkReserveAuthClient }, { timeout: (await settings.getByKey('movieticketReserve')).timeout });
|
|
57
57
|
processSeatInfoSyncResult = await (0, processSeatInfoSync_1.processSeatInfoSync)({ seatInfoSyncIn })({ seatService });
|
|
58
58
|
}
|
|
59
59
|
// add recipe(2024-06-03~)
|
|
@@ -73,7 +73,7 @@ function processPurchaseNumberAuth(params) {
|
|
|
73
73
|
const authService = new sdk_1.Surfrock.service.auth.AuthService({
|
|
74
74
|
endpoint: String(availableChannel.serviceUrl),
|
|
75
75
|
auth: mvtkReserveAuthClient
|
|
76
|
-
}, { timeout: settings.movieticketReserve.timeoutCheck });
|
|
76
|
+
}, { timeout: (await settings.getByKey('movieticketReserve')).timeoutCheck });
|
|
77
77
|
const purchaseNumberAuthResult = await authService.purchaseNumberAuth(purchaseNumberAuthIn);
|
|
78
78
|
return { purchaseNumberAuthIn, purchaseNumberAuthResult };
|
|
79
79
|
};
|
|
@@ -17,7 +17,7 @@ const processSeatInfoSyncCancel_1 = require("./refundMovieTicket/processSeatInfo
|
|
|
17
17
|
function wait4payActionDelayIfNeeded(params) {
|
|
18
18
|
return async (settings) => {
|
|
19
19
|
const { payAction } = params;
|
|
20
|
-
const minIntervalBetweenPayAndRefund = settings.movieticketReserve.minIntervalBetweenPayAndRefund;
|
|
20
|
+
const minIntervalBetweenPayAndRefund = (await settings.getByKey('movieticketReserve')).minIntervalBetweenPayAndRefund;
|
|
21
21
|
let waitingNecessary = false;
|
|
22
22
|
if (typeof minIntervalBetweenPayAndRefund === 'number' && minIntervalBetweenPayAndRefund > 0) {
|
|
23
23
|
if (payAction.actionStatus !== factory_1.factory.actionStatusType.CompletedActionStatus) {
|
|
@@ -74,7 +74,7 @@ function refundMovieTicket(params, options) {
|
|
|
74
74
|
state: '',
|
|
75
75
|
credentialsRepo: repos.credentials // set credentialsRepo(2024-11-20~)
|
|
76
76
|
});
|
|
77
|
-
const seatService = new sdk_1.Surfrock.service.seat.SeatService({ endpoint: String(availableChannel.serviceUrl), auth: mvtkReserveAuthClient }, { timeout: settings.movieticketReserve.timeout });
|
|
77
|
+
const seatService = new sdk_1.Surfrock.service.seat.SeatService({ endpoint: String(availableChannel.serviceUrl), auth: mvtkReserveAuthClient }, { timeout: (await settings.getByKey('movieticketReserve')).timeout });
|
|
78
78
|
let seatInfoSyncCancelIn;
|
|
79
79
|
let seatInfoSyncIn;
|
|
80
80
|
const useSeatInfoSyncCancel = availableChannel.credentials?.useSeatInfoSyncCancel === true;
|
|
@@ -61,11 +61,11 @@ function call(params) {
|
|
|
61
61
|
const reserveService = new coa_service_1.COA.service.Reserve({
|
|
62
62
|
endpoint: coaAuthClient.options.endpoint, // same as authClient(2024-07-17~)
|
|
63
63
|
auth: coaAuthClient
|
|
64
|
-
}, { timeout: settings.coa.timeout });
|
|
64
|
+
}, { timeout: (await settings.getByKey('coa')).timeout });
|
|
65
65
|
const masterService = new coa_service_1.COA.service.Master({
|
|
66
66
|
endpoint: coaAuthClient.options.endpoint, // same as authClient(2024-07-17~)
|
|
67
67
|
auth: coaAuthClient
|
|
68
|
-
}, { timeout: settings.coa.timeout });
|
|
68
|
+
}, { timeout: (await settings.getByKey('coa')).timeout });
|
|
69
69
|
const { agent, object, potentialActions, purpose } = params.data;
|
|
70
70
|
// agent.idからflgMemberを自動セット(2024-12-16~)
|
|
71
71
|
const isMember = memberClients.includes(agent.id);
|
|
@@ -48,7 +48,7 @@ function call(params) {
|
|
|
48
48
|
const authorizePaymentMethodActionRepo = new authorizePaymentMethod_1.AuthorizePaymentMethodActionRepo(connection);
|
|
49
49
|
// const transactionProcessRepo = new TransactionProcessRepo(redisClient, { lockExpiresInSeconds: 120 });
|
|
50
50
|
const paymentServiceId = params.data.object.issuedThrough.id;
|
|
51
|
-
const credentialsExpireInSeconds = settings.movieticketReserve.credentialsExpireInSeconds;
|
|
51
|
+
const credentialsExpireInSeconds = (await settings.getByKey('movieticketReserve')).credentialsExpireInSeconds;
|
|
52
52
|
const useCredentialsRepo = typeof paymentServiceId === 'string' && paymentServiceId !== ''
|
|
53
53
|
&& typeof credentialsExpireInSeconds === 'number' && credentialsExpireInSeconds > 0;
|
|
54
54
|
try {
|
|
@@ -54,7 +54,7 @@ function call(params) {
|
|
|
54
54
|
const reserveService = new coa_service_1.COA.service.Reserve({
|
|
55
55
|
endpoint: coaAuthClient.options.endpoint,
|
|
56
56
|
auth: coaAuthClient
|
|
57
|
-
}, { timeout: settings.coa.timeout });
|
|
57
|
+
}, { timeout: (await settings.getByKey('coa')).timeout });
|
|
58
58
|
const { object, instrument } = data;
|
|
59
59
|
await (0, cancelReservation_2.cancelPendingReservation)({
|
|
60
60
|
object,
|
|
@@ -25,7 +25,7 @@ function call(params) {
|
|
|
25
25
|
const actionRepo = new checkMovieTicket_1.CheckMovieTicketActionRepo(connection);
|
|
26
26
|
// const transactionProcessRepo = new TransactionProcessRepo(redisClient, { lockExpiresInSeconds: 120 });
|
|
27
27
|
const paymentServiceId = params.data.object[0]?.id;
|
|
28
|
-
const credentialsExpireInSeconds = settings.movieticketReserve.credentialsExpireInSeconds;
|
|
28
|
+
const credentialsExpireInSeconds = (await settings.getByKey('movieticketReserve')).credentialsExpireInSeconds;
|
|
29
29
|
const useCredentialsRepo = typeof paymentServiceId === 'string' && paymentServiceId !== ''
|
|
30
30
|
&& typeof credentialsExpireInSeconds === 'number' && credentialsExpireInSeconds > 0;
|
|
31
31
|
try {
|
|
@@ -41,7 +41,7 @@ function call(params) {
|
|
|
41
41
|
const reserveService = new coa_service_1.COA.service.Reserve({
|
|
42
42
|
endpoint: coaAuthClient.options.endpoint, // same as authClient(2024-07-17~)
|
|
43
43
|
auth: coaAuthClient
|
|
44
|
-
}, { timeout: settings.coa.timeout });
|
|
44
|
+
}, { timeout: (await settings.getByKey('coa')).timeout });
|
|
45
45
|
await confirmReserveTransaction({
|
|
46
46
|
...params.data,
|
|
47
47
|
project: params.project,
|
|
@@ -57,7 +57,7 @@ function call(params) {
|
|
|
57
57
|
const reserveService = new coa_service_1.COA.service.Reserve({
|
|
58
58
|
endpoint: coaAuthClient.options.endpoint, // same as authClient(2024-07-17~)
|
|
59
59
|
auth: coaAuthClient
|
|
60
|
-
}, { timeout: settings.coa.timeout });
|
|
60
|
+
}, { timeout: (await settings.getByKey('coa')).timeout });
|
|
61
61
|
await EventAggregationService.importFromCOA(params.data)({
|
|
62
62
|
event: new event_1.EventRepo(connection),
|
|
63
63
|
reserveService
|
|
@@ -64,7 +64,7 @@ function call(params) {
|
|
|
64
64
|
const masterService = new coa_service_1.COA.service.Master({
|
|
65
65
|
endpoint: coaAuthClient.options.endpoint, // same as authClient(2024-07-17~)
|
|
66
66
|
auth: coaAuthClient
|
|
67
|
-
}, { timeout: settings.coa.timeout });
|
|
67
|
+
}, { timeout: (await settings.getByKey('coa')).timeout });
|
|
68
68
|
await EventService.importFromCOA(params.data)({
|
|
69
69
|
action: new action_1.ActionRepo(connection),
|
|
70
70
|
categoryCode: new categoryCode_1.CategoryCodeRepo(connection),
|
|
@@ -67,7 +67,7 @@ function call(params) {
|
|
|
67
67
|
const masterService = new coa_service_1.COA.service.Master({
|
|
68
68
|
endpoint: coaAuthClient.options.endpoint, // same as authClient(2024-07-17~)
|
|
69
69
|
auth: coaAuthClient
|
|
70
|
-
}, { timeout: settings.coa.timeout });
|
|
70
|
+
}, { timeout: (await settings.getByKey('coa')).timeout });
|
|
71
71
|
await OfferService.event.importFromCOA({
|
|
72
72
|
project: { id: params.data.project.id },
|
|
73
73
|
theaterCode: params.data.theaterCode,
|
|
@@ -38,7 +38,7 @@ function call(params) {
|
|
|
38
38
|
order: new order_1.OrderRepo(connection)
|
|
39
39
|
});
|
|
40
40
|
const paymentServiceId = payActionAttributes.object.at(0)?.id;
|
|
41
|
-
const credentialsExpireInSeconds = settings.movieticketReserve.credentialsExpireInSeconds;
|
|
41
|
+
const credentialsExpireInSeconds = (await settings.getByKey('movieticketReserve')).credentialsExpireInSeconds;
|
|
42
42
|
const useCredentialsRepo = typeof paymentServiceId === 'string' && paymentServiceId !== ''
|
|
43
43
|
&& typeof credentialsExpireInSeconds === 'number' && credentialsExpireInSeconds > 0;
|
|
44
44
|
await (0, payByTask_1.payByTask)(
|
|
@@ -35,7 +35,7 @@ function call(params) {
|
|
|
35
35
|
data = params;
|
|
36
36
|
}
|
|
37
37
|
const paymentServiceId = data.object.at(0)?.id;
|
|
38
|
-
const credentialsExpireInSeconds = settings.movieticketReserve.credentialsExpireInSeconds;
|
|
38
|
+
const credentialsExpireInSeconds = (await settings.getByKey('movieticketReserve')).credentialsExpireInSeconds;
|
|
39
39
|
const useCredentialsRepo = typeof paymentServiceId === 'string' && paymentServiceId !== ''
|
|
40
40
|
&& typeof credentialsExpireInSeconds === 'number' && credentialsExpireInSeconds > 0;
|
|
41
41
|
await (0, refundByTask_1.refundByTask)(data)({
|
|
@@ -75,7 +75,7 @@ function call(params) {
|
|
|
75
75
|
const reserveService = new coa_service_1.COA.service.Reserve({
|
|
76
76
|
endpoint: coaAuthClient.options.endpoint, // same as authClient(2024-07-17~)
|
|
77
77
|
auth: coaAuthClient
|
|
78
|
-
}, { timeout: settings.coa.timeout });
|
|
78
|
+
}, { timeout: (await settings.getByKey('coa')).timeout });
|
|
79
79
|
await returnReserve({
|
|
80
80
|
...params.data,
|
|
81
81
|
sameAs: { id: params.id }
|
|
@@ -60,7 +60,7 @@ function call(params) {
|
|
|
60
60
|
const masterService = new coa_service_1.COA.service.Master({
|
|
61
61
|
endpoint: coaAuthClient.options.endpoint, // same as authClient(2024-07-17~)
|
|
62
62
|
auth: coaAuthClient
|
|
63
|
-
}, { timeout: settings.coa.timeout });
|
|
63
|
+
}, { timeout: (await settings.getByKey('coa')).timeout });
|
|
64
64
|
const { agent, object } = params.data;
|
|
65
65
|
if (object.typeOf === factory_1.factory.eventType.ScreeningEventSeries) {
|
|
66
66
|
await syncEventSeries({
|
|
@@ -24,7 +24,7 @@ function call(data) {
|
|
|
24
24
|
throw new factory_1.factory.errors.Argument('settings', 'redisClient required');
|
|
25
25
|
}
|
|
26
26
|
const paymentServiceId = data.object.object.id;
|
|
27
|
-
const credentialsExpireInSeconds = settings.movieticketReserve.credentialsExpireInSeconds;
|
|
27
|
+
const credentialsExpireInSeconds = (await settings.getByKey('movieticketReserve')).credentialsExpireInSeconds;
|
|
28
28
|
const useCredentialsRepo = typeof paymentServiceId === 'string' && paymentServiceId !== ''
|
|
29
29
|
&& typeof credentialsExpireInSeconds === 'number' && credentialsExpireInSeconds > 0;
|
|
30
30
|
await (0, voidPaymentByTask_1.voidPaymentByTask)(data)({
|
|
@@ -50,7 +50,7 @@ function call(params) {
|
|
|
50
50
|
const reserveService = new coa_service_1.COA.service.Reserve({
|
|
51
51
|
endpoint: coaAuthClient.options.endpoint, // same as authClient(2024-07-17~)
|
|
52
52
|
auth: coaAuthClient
|
|
53
|
-
}, { timeout: settings.coa.timeout });
|
|
53
|
+
}, { timeout: (await settings.getByKey('coa')).timeout });
|
|
54
54
|
// const transactionProcessRepo = new TransactionProcessRepo(redisClient, { lockExpiresInSeconds: 120 });
|
|
55
55
|
try {
|
|
56
56
|
await (0, voidTransaction_1.voidTransaction)({
|
package/lib/chevre/settings.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Connection } from 'mongoose';
|
|
1
2
|
interface ISurfrockSettings {
|
|
2
3
|
/**
|
|
3
4
|
* 着券時タイムアウト
|
|
@@ -31,26 +32,19 @@ interface IOptions {
|
|
|
31
32
|
movieticketReserve: ISurfrockSettings;
|
|
32
33
|
useExperimentalFeature: boolean;
|
|
33
34
|
}
|
|
35
|
+
interface IDBOptions {
|
|
36
|
+
connection: Connection;
|
|
37
|
+
}
|
|
34
38
|
/**
|
|
35
39
|
* domain settings
|
|
36
40
|
*/
|
|
37
41
|
declare class Settings {
|
|
38
|
-
readonly
|
|
39
|
-
|
|
40
|
-
readonly deliverOrderLimit: number;
|
|
41
|
-
readonly coa: {
|
|
42
|
-
timeout: number;
|
|
43
|
-
};
|
|
44
|
-
readonly gmo: {
|
|
45
|
-
timeout: number;
|
|
46
|
-
timeoutBackground: number;
|
|
47
|
-
};
|
|
48
|
-
readonly movieticketReserve: ISurfrockSettings;
|
|
49
|
-
readonly useExperimentalFeature: boolean;
|
|
42
|
+
private readonly options;
|
|
43
|
+
constructor(options: IOptions & IDBOptions);
|
|
50
44
|
/**
|
|
51
|
-
*
|
|
45
|
+
* 設定名称から設定を参照する
|
|
52
46
|
*/
|
|
53
|
-
|
|
47
|
+
getByKey<T extends keyof IOptions>(key: T): Promise<IOptions[T]>;
|
|
54
48
|
}
|
|
55
49
|
export declare const MONGO_MAX_TIME_MS: number;
|
|
56
50
|
export declare const MONGO_READ_PREFERENCE: string;
|
package/lib/chevre/settings.js
CHANGED
|
@@ -5,27 +5,58 @@ exports.Settings = exports.MONGO_AUTO_INDEX = exports.MONGO_READ_PREFERENCE = ex
|
|
|
5
5
|
* domain settings
|
|
6
6
|
*/
|
|
7
7
|
class Settings {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
// private readonly settingModel: IModel;
|
|
9
|
+
options;
|
|
10
|
+
// private readonly abortedTasksWithoutReport: string[];
|
|
11
|
+
// private readonly numTryConfirmReserveTransaction: number;
|
|
12
|
+
// private readonly deliverOrderLimit: number;
|
|
13
|
+
// private readonly coa: {
|
|
14
|
+
// timeout: number;
|
|
15
|
+
// };
|
|
16
|
+
// private readonly gmo: {
|
|
17
|
+
// timeout: number;
|
|
18
|
+
// timeoutBackground: number;
|
|
19
|
+
// };
|
|
20
|
+
// private readonly movieticketReserve: ISurfrockSettings;
|
|
21
|
+
// private readonly useExperimentalFeature: boolean;
|
|
22
|
+
constructor(options) {
|
|
23
|
+
const { connection: _connection, // ひとまず使用しない
|
|
24
|
+
...restOptions
|
|
25
|
+
// abortedTasksWithoutReport,
|
|
26
|
+
// numTryConfirmReserveTransaction,
|
|
27
|
+
// deliverOrderLimit,
|
|
28
|
+
// coa,
|
|
29
|
+
// gmo,
|
|
30
|
+
// movieticketReserve,
|
|
31
|
+
// useExperimentalFeature
|
|
32
|
+
} = options;
|
|
33
|
+
// this.settingModel = connection.model<IDocType, IModel>(modelName, createSchema());
|
|
34
|
+
this.options = restOptions;
|
|
35
|
+
// this.abortedTasksWithoutReport = abortedTasksWithoutReport;
|
|
36
|
+
// this.numTryConfirmReserveTransaction = numTryConfirmReserveTransaction;
|
|
37
|
+
// this.deliverOrderLimit = deliverOrderLimit;
|
|
38
|
+
// this.coa = coa;
|
|
39
|
+
// this.gmo = gmo;
|
|
40
|
+
// this.movieticketReserve = movieticketReserve;
|
|
41
|
+
// this.useExperimentalFeature = useExperimentalFeature;
|
|
42
|
+
}
|
|
15
43
|
/**
|
|
16
|
-
*
|
|
44
|
+
* 設定名称から設定を参照する
|
|
17
45
|
*/
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
this.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
//
|
|
46
|
+
async getByKey(key) {
|
|
47
|
+
// const projection: Record<string, AnyExpression> = {
|
|
48
|
+
// _id: 0,
|
|
49
|
+
// [key]: 1
|
|
50
|
+
// // id: { $toString: '$_id' },
|
|
51
|
+
// };
|
|
52
|
+
// // とりあえず設定コレクションを参照するが、値を使用しない(2026-05-21~)
|
|
53
|
+
// await this.settingModel.findOne(
|
|
54
|
+
// { 'project.id': { $eq: '*' } },
|
|
55
|
+
// projection
|
|
56
|
+
// )
|
|
57
|
+
// .lean()
|
|
58
|
+
// .exec();
|
|
59
|
+
return this.options[key];
|
|
29
60
|
}
|
|
30
61
|
}
|
|
31
62
|
exports.Settings = Settings;
|
package/package.json
CHANGED