@chevre/domain 21.2.0-alpha.98 → 21.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/example/src/chevre/aggregateEventReservation.ts +1 -1
- package/example/src/chevre/aggregateSellerPaymentAccepted.ts +27 -0
- package/example/src/chevre/aggregation/aggregateSystem.ts +53 -22
- package/example/src/chevre/countDelayedTasks.ts +7 -2
- package/example/src/chevre/createManyEventsIfNotExist.ts +199 -46
- package/example/src/chevre/findScreeningRoomsByBranchCode.ts +4 -3
- package/example/src/chevre/giveUpStartDatePassedCertainPeriod.ts +56 -0
- package/example/src/chevre/lockStockHolder.ts +5 -2
- package/example/src/chevre/migrateCategoryCodeAdditionalProperties.ts +116 -0
- package/example/src/chevre/migrateScreeningEventSeriesVersion.ts +79 -0
- package/example/src/chevre/processPay.ts +5 -2
- package/example/src/chevre/processRegisterMembership.ts +8 -4
- package/example/src/chevre/processRegisterPaymentCard.ts +8 -4
- package/example/src/chevre/processReserve.ts +1 -1
- package/example/src/chevre/searchAbortedTasks.ts +4 -6
- package/example/src/chevre/searchActions.ts +33 -0
- package/example/src/chevre/searchEventSeats.ts +5 -2
- package/example/src/chevre/searchHoldReservations.ts +38 -0
- package/example/src/chevre/searchPermissions.ts +54 -0
- package/example/src/chevre/searchScreeningRooms.ts +35 -0
- package/example/src/chevre/sendEmailMessage.ts +1 -2
- package/example/src/chevre/syncScreeningRooms.ts +22 -0
- package/example/src/chevre/syncScreeningRoomsAll.ts +44 -0
- package/example/src/chevre/unsetContainsInPlaceFromMovieTheater.ts +41 -0
- package/lib/chevre/factory/order.d.ts +4 -1
- package/lib/chevre/factory/order.js +19 -6
- package/lib/chevre/repo/account.js +3 -2
- package/lib/chevre/repo/accountTransaction.js +2 -1
- package/lib/chevre/repo/accountingReport.d.ts +1 -3
- package/lib/chevre/repo/action.d.ts +50 -1
- package/lib/chevre/repo/action.js +103 -34
- package/lib/chevre/repo/additionalProperty.js +2 -1
- package/lib/chevre/repo/aggregation.d.ts +3 -0
- package/lib/chevre/repo/aggregation.js +3 -0
- package/lib/chevre/repo/assetTransaction.js +6 -5
- package/lib/chevre/repo/categoryCode.d.ts +1 -1
- package/lib/chevre/repo/categoryCode.js +37 -25
- package/lib/chevre/repo/code.js +3 -2
- package/lib/chevre/repo/comment.js +2 -1
- package/lib/chevre/repo/creativeWork.d.ts +1 -1
- package/lib/chevre/repo/creativeWork.js +35 -12
- package/lib/chevre/repo/customer.js +2 -1
- package/lib/chevre/repo/emailMessage.js +2 -1
- package/lib/chevre/repo/event.d.ts +30 -2
- package/lib/chevre/repo/event.js +87 -36
- package/lib/chevre/repo/member.d.ts +14 -0
- package/lib/chevre/repo/member.js +31 -3
- package/lib/chevre/repo/merchantReturnPolicy.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/action.js +12 -0
- package/lib/chevre/repo/mongoose/schemas/assetTransaction.d.ts +3 -3
- package/lib/chevre/repo/mongoose/schemas/holdReservation.d.ts +75 -0
- package/lib/chevre/repo/mongoose/schemas/holdReservation.js +93 -0
- package/lib/chevre/repo/mongoose/schemas/offer.d.ts +3 -3
- package/lib/chevre/repo/mongoose/schemas/order.d.ts +21 -21
- package/lib/chevre/repo/mongoose/schemas/place.d.ts +6 -0
- package/lib/chevre/repo/mongoose/schemas/place.js +16 -1
- package/lib/chevre/repo/mongoose/schemas/product.js +6 -0
- package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +9 -9
- package/lib/chevre/repo/mongoose/schemas/transaction.d.ts +3 -3
- package/lib/chevre/repo/offer.js +3 -2
- package/lib/chevre/repo/offerCatalog.js +0 -27
- package/lib/chevre/repo/offerItemCondition.js +2 -1
- package/lib/chevre/repo/order.js +8 -7
- package/lib/chevre/repo/ownershipInfo.js +2 -7
- package/lib/chevre/repo/paymentServiceProvider.d.ts +65 -0
- package/lib/chevre/repo/paymentServiceProvider.js +156 -0
- package/lib/chevre/repo/place.d.ts +203 -27
- package/lib/chevre/repo/place.js +1726 -694
- package/lib/chevre/repo/priceSpecification.js +3 -2
- package/lib/chevre/repo/product.d.ts +5 -3
- package/lib/chevre/repo/product.js +92 -5
- package/lib/chevre/repo/project.js +2 -1
- package/lib/chevre/repo/reservation.d.ts +9 -1
- package/lib/chevre/repo/reservation.js +29 -20
- package/lib/chevre/repo/role.d.ts +7 -0
- package/lib/chevre/repo/role.js +39 -2
- package/lib/chevre/repo/seller.d.ts +21 -1
- package/lib/chevre/repo/seller.js +59 -4
- package/lib/chevre/repo/serviceOutput.js +2 -1
- package/lib/chevre/repo/stockHolder.d.ts +143 -7
- package/lib/chevre/repo/stockHolder.js +622 -104
- package/lib/chevre/repo/task.d.ts +12 -1
- package/lib/chevre/repo/task.js +17 -7
- package/lib/chevre/repo/transaction.js +6 -5
- package/lib/chevre/repo/trip.js +2 -1
- package/lib/chevre/repository.d.ts +6 -0
- package/lib/chevre/repository.js +8 -1
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +18 -8
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +19 -8
- package/lib/chevre/service/aggregation/system.d.ts +43 -1
- package/lib/chevre/service/aggregation/system.js +112 -2
- package/lib/chevre/service/assetTransaction/moneyTransfer.js +1 -1
- package/lib/chevre/service/assetTransaction/pay/account/validation.js +1 -1
- package/lib/chevre/service/assetTransaction/pay.d.ts +5 -1
- package/lib/chevre/service/assetTransaction/pay.js +7 -7
- package/lib/chevre/service/assetTransaction/refund.js +1 -1
- package/lib/chevre/service/assetTransaction/reserve.js +10 -3
- package/lib/chevre/service/event.d.ts +3 -0
- package/lib/chevre/service/event.js +52 -21
- package/lib/chevre/service/iam.d.ts +6 -2
- package/lib/chevre/service/iam.js +23 -9
- package/lib/chevre/service/offer/event/factory.js +22 -13
- package/lib/chevre/service/offer/event/importFromCOA.js +2 -2
- package/lib/chevre/service/offer/eventServiceByCOA/factory.js +15 -8
- package/lib/chevre/service/offer/eventServiceByCOA.js +7 -9
- package/lib/chevre/service/offer/product/factory.js +13 -6
- package/lib/chevre/service/offer/product.js +2 -2
- package/lib/chevre/service/offer.d.ts +16 -8
- package/lib/chevre/service/offer.js +71 -8
- package/lib/chevre/service/order/createAccountingReportIfNotExist.js +31 -17
- package/lib/chevre/service/order/onOrderStatusChanged/factory.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged.js +2 -2
- package/lib/chevre/service/order/placeOrder.js +4 -4
- package/lib/chevre/service/order/returnOrder.js +1 -1
- package/lib/chevre/service/order/sendOrder.js +3 -3
- package/lib/chevre/service/payment/any/onPaymentStatusChanged.js +4 -6
- package/lib/chevre/service/payment/any/onRefund.js +46 -42
- package/lib/chevre/service/payment/any.d.ts +9 -6
- package/lib/chevre/service/payment/any.js +6 -2
- package/lib/chevre/service/payment/creditCard.js +2 -2
- package/lib/chevre/service/payment/movieTicket/checkByIdentifier.d.ts +8 -7
- package/lib/chevre/service/payment/movieTicket/factory.d.ts +1 -1
- package/lib/chevre/service/payment/movieTicket/getCredentials.d.ts +1 -1
- package/lib/chevre/service/payment/movieTicket/getCredentials.js +1 -1
- package/lib/chevre/service/payment/movieTicket/validation.d.ts +3 -4
- package/lib/chevre/service/payment/movieTicket/validation.js +53 -12
- package/lib/chevre/service/payment/movieTicket.d.ts +1 -1
- package/lib/chevre/service/payment/movieTicket.js +4 -4
- package/lib/chevre/service/reserve/cancelReservation.js +15 -3
- package/lib/chevre/service/reserve/confirmReservation.js +19 -11
- package/lib/chevre/service/task/aggregateScreeningEvent.js +1 -1
- package/lib/chevre/service/task/cancelPendingReservation.js +1 -1
- package/lib/chevre/service/task/cancelReservation.js +1 -1
- package/lib/chevre/service/task/deleteTransaction.js +2 -0
- package/lib/chevre/service/task/onEventChanged.d.ts +7 -0
- package/lib/chevre/service/task/onEventChanged.js +29 -0
- package/lib/chevre/service/task/onResourceUpdated.d.ts +7 -0
- package/lib/chevre/service/task/onResourceUpdated.js +396 -0
- package/lib/chevre/service/task/syncScreeningRooms.d.ts +7 -0
- package/lib/chevre/service/task/syncScreeningRooms.js +24 -0
- package/lib/chevre/service/task/voidReserveTransaction.js +1 -1
- package/lib/chevre/service/transaction/deleteTransaction.d.ts +2 -0
- package/lib/chevre/service/transaction/deleteTransaction.js +129 -1
- package/lib/chevre/service/transaction/moneyTransfer/exportTasks/factory.js +1 -0
- package/lib/chevre/service/transaction/moneyTransfer/factory.d.ts +1 -1
- package/lib/chevre/service/transaction/moneyTransfer.js +1 -1
- package/lib/chevre/service/transaction/orderProgramMembership/findCreditCard.js +1 -1
- package/lib/chevre/service/transaction/orderProgramMembership/findPaymentCardPermit.js +1 -1
- package/lib/chevre/service/transaction/orderProgramMembership.js +7 -4
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +1 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/givePointAward.js +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.js +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/sendEmailMessage.js +4 -4
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.js +3 -4
- package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +8 -12
- package/lib/chevre/service/transaction/placeOrderInProgress.js +6 -4
- package/lib/chevre/service/transaction/returnOrder/exportTasks/factory.js +1 -0
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnMoneyTransfer.js +2 -2
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +5 -5
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPointAward.js +2 -2
- package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.js +3 -3
- package/lib/chevre/service/transaction/returnOrder/potentialActions.js +1 -1
- package/lib/chevre/service/transaction/returnOrder.js +3 -1
- package/lib/chevre/settings.d.ts +11 -0
- package/lib/chevre/settings.js +44 -2
- package/package.json +3 -3
- package/example/src/chevre/eventCatalog2eventService.ts +0 -123
- package/example/src/chevre/migrateOrderAdditionalProperties.ts +0 -85
- package/example/src/chevre/migrateStockHolderKeys.ts +0 -89
- package/example/src/chevre/searchAssetTransactions.ts +0 -30
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.createAggregateScreeningEventIfNotExist = exports.onEventChanged = exports.searchEventSeatOffersWithPaging = exports.addOffers2Seat = exports.product = exports.moneyTransfer = exports.eventServiceByCOA = exports.event = void 0;
|
|
12
|
+
exports.createInformTasks = exports.createAggregateScreeningEventIfNotExist = exports.onEventChanged = exports.searchEventSeatOffersWithPaging = exports.addOffers2Seat = exports.product = exports.moneyTransfer = exports.eventServiceByCOA = exports.event = void 0;
|
|
13
13
|
const moment = require("moment");
|
|
14
14
|
const factory = require("../factory");
|
|
15
15
|
const EventOfferService = require("./offer/event");
|
|
@@ -20,6 +20,8 @@ const MoneyTransferOfferService = require("./offer/moneyTransfer");
|
|
|
20
20
|
exports.moneyTransfer = MoneyTransferOfferService;
|
|
21
21
|
const ProductOfferService = require("./offer/product");
|
|
22
22
|
exports.product = ProductOfferService;
|
|
23
|
+
const settings_1 = require("../settings");
|
|
24
|
+
const informEvents = settings_1.settings.onEventChanged.informEvent;
|
|
23
25
|
/**
|
|
24
26
|
* 座席にオファー情報を付加する
|
|
25
27
|
*/
|
|
@@ -86,12 +88,14 @@ function searchEventSeatOffersWithPaging(params) {
|
|
|
86
88
|
branchCode: { $eq: movieTheaterBranchCode }
|
|
87
89
|
}
|
|
88
90
|
}
|
|
89
|
-
} }));
|
|
91
|
+
} }), settings_1.USE_READ_SCREENING_ROOM_TYPE);
|
|
90
92
|
if (seats.length > 0) {
|
|
91
93
|
const availabilities = yield repos.stockHolder.searchHolders({
|
|
94
|
+
project: { id: event.project.id },
|
|
92
95
|
eventId: params.event.id,
|
|
93
96
|
startDate: moment(event.startDate)
|
|
94
97
|
.toDate(),
|
|
98
|
+
hasTicketedSeat: true,
|
|
95
99
|
offers: seats.map((s) => {
|
|
96
100
|
var _a;
|
|
97
101
|
return {
|
|
@@ -117,24 +121,33 @@ function searchEventSeatOffersWithPaging(params) {
|
|
|
117
121
|
});
|
|
118
122
|
}
|
|
119
123
|
exports.searchEventSeatOffersWithPaging = searchEventSeatOffersWithPaging;
|
|
124
|
+
// type IChangedEvent = factory.task.onEventChanged.IChangedEvent;
|
|
120
125
|
/**
|
|
121
126
|
* イベント変更時処理
|
|
122
127
|
*/
|
|
123
128
|
function onEventChanged(params) {
|
|
124
129
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
125
|
-
const changedEvents = (Array.isArray(params.event)) ? params.event : [params.event];
|
|
126
|
-
if (
|
|
130
|
+
// const changedEvents = (Array.isArray(params.event)) ? params.event : [params.event];
|
|
131
|
+
if (params.id.length > 0) {
|
|
127
132
|
// ScreeningEventであれば集計タスク
|
|
128
|
-
if (
|
|
133
|
+
if (params.typeOf === factory.eventType.ScreeningEvent) {
|
|
129
134
|
yield createAggregateScreeningEventIfNotExist({
|
|
130
|
-
project: { id:
|
|
131
|
-
reservationFor:
|
|
132
|
-
return { id
|
|
135
|
+
project: { id: params.project.id },
|
|
136
|
+
reservationFor: params.id.map((id) => {
|
|
137
|
+
return { id };
|
|
133
138
|
}),
|
|
134
139
|
// 新規作成の場合は強制的に集計
|
|
135
140
|
force: params.isNew
|
|
136
141
|
})(repos);
|
|
137
142
|
}
|
|
143
|
+
// 通知タスク作成(2023-06-08~)
|
|
144
|
+
if (params.useInform === true) {
|
|
145
|
+
yield createInformTasks({
|
|
146
|
+
project: { id: params.project.id },
|
|
147
|
+
ids: params.id,
|
|
148
|
+
typeOf: params.typeOf
|
|
149
|
+
})(repos);
|
|
150
|
+
}
|
|
138
151
|
}
|
|
139
152
|
});
|
|
140
153
|
}
|
|
@@ -191,3 +204,53 @@ function createAggregateScreeningEventIfNotExist(params) {
|
|
|
191
204
|
});
|
|
192
205
|
}
|
|
193
206
|
exports.createAggregateScreeningEventIfNotExist = createAggregateScreeningEventIfNotExist;
|
|
207
|
+
function createInformTasks(params) {
|
|
208
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
209
|
+
const events4inform = yield repos.event.search({
|
|
210
|
+
id: { $in: params.ids },
|
|
211
|
+
typeOf: params.typeOf
|
|
212
|
+
}, {
|
|
213
|
+
aggregateEntranceGate: 0, aggregateOffer: 0, aggregateReservation: 0,
|
|
214
|
+
remainingAttendeeCapacity: 0, checkInCount: 0, attendeeCount: 0
|
|
215
|
+
});
|
|
216
|
+
if (events4inform.length > 0) {
|
|
217
|
+
const taskRunsAt = new Date();
|
|
218
|
+
const informTasks = [];
|
|
219
|
+
informEvents === null || informEvents === void 0 ? void 0 : informEvents.forEach((informEvent) => {
|
|
220
|
+
var _a;
|
|
221
|
+
const informUrl = String((_a = informEvent.recipient) === null || _a === void 0 ? void 0 : _a.url);
|
|
222
|
+
events4inform.forEach((event4inform) => {
|
|
223
|
+
var _a;
|
|
224
|
+
// _idは不要であり、存在すると予期せぬ影響を及ぼす可能性がある
|
|
225
|
+
delete event4inform._id;
|
|
226
|
+
const informActionAttributes = {
|
|
227
|
+
agent: event4inform.project,
|
|
228
|
+
object: event4inform,
|
|
229
|
+
project: event4inform.project,
|
|
230
|
+
recipient: {
|
|
231
|
+
id: '',
|
|
232
|
+
name: String((_a = informEvent.recipient) === null || _a === void 0 ? void 0 : _a.name),
|
|
233
|
+
typeOf: factory.creativeWorkType.WebApplication,
|
|
234
|
+
url: informUrl
|
|
235
|
+
},
|
|
236
|
+
typeOf: factory.actionType.InformAction
|
|
237
|
+
};
|
|
238
|
+
informTasks.push({
|
|
239
|
+
project: event4inform.project,
|
|
240
|
+
name: factory.taskName.TriggerWebhook,
|
|
241
|
+
status: factory.taskStatus.Ready,
|
|
242
|
+
runsAt: taskRunsAt,
|
|
243
|
+
remainingNumberOfTries: 10,
|
|
244
|
+
numberOfTried: 0,
|
|
245
|
+
executionResults: [],
|
|
246
|
+
data: informActionAttributes
|
|
247
|
+
});
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
if (informTasks.length > 0) {
|
|
251
|
+
yield repos.task.saveMany(informTasks, { emitImmediately: true });
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
exports.createInformTasks = createInformTasks;
|
|
@@ -12,17 +12,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.createAccountingReportIfNotExist = void 0;
|
|
13
13
|
const moment = require("moment-timezone");
|
|
14
14
|
const factory = require("../../factory");
|
|
15
|
-
|
|
15
|
+
// import { createMaskedCustomer } from '../../factory/order';
|
|
16
16
|
function createAccountingReportIfNotExist(params) {
|
|
17
17
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
18
18
|
const order4report = createOrder4report(params);
|
|
19
|
-
const accountingReport = createAccountingReport(
|
|
19
|
+
const accountingReport = createAccountingReport({
|
|
20
|
+
mainEntity: order4report,
|
|
21
|
+
project: { id: params.project.id }
|
|
22
|
+
});
|
|
20
23
|
// 経理レポートを保管
|
|
21
24
|
yield repos.accountingReport.createIfNotExist(accountingReport);
|
|
22
25
|
});
|
|
23
26
|
}
|
|
24
27
|
exports.createAccountingReportIfNotExist = createAccountingReportIfNotExist;
|
|
28
|
+
// 最適化(2023-06-30~)
|
|
25
29
|
function createOrder4report(params) {
|
|
30
|
+
var _a;
|
|
26
31
|
const numItems = (Array.isArray(params.acceptedOffers)) ? params.acceptedOffers.length : 0;
|
|
27
32
|
// 必要な属性についてDate型に変換(でないと検索クエリを効率的に使えない)
|
|
28
33
|
const acceptedOffers = (Array.isArray(params.acceptedOffers))
|
|
@@ -53,26 +58,35 @@ function createOrder4report(params) {
|
|
|
53
58
|
}
|
|
54
59
|
})
|
|
55
60
|
: [];
|
|
56
|
-
|
|
57
|
-
//
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
const customer = {
|
|
62
|
+
// ...createMaskedCustomer(params),
|
|
63
|
+
id: params.customer.id,
|
|
64
|
+
typeOf: params.customer.typeOf,
|
|
65
|
+
additionalProperty: (Array.isArray(params.customer.additionalProperty))
|
|
66
|
+
? params.customer.additionalProperty
|
|
67
|
+
: [],
|
|
68
|
+
identifier: (Array.isArray(params.customer.identifier))
|
|
69
|
+
? params.customer.identifier
|
|
70
|
+
: []
|
|
71
|
+
};
|
|
72
|
+
return Object.assign({
|
|
73
|
+
// ...params,
|
|
74
|
+
confirmationNumber: params.confirmationNumber, id: params.id, orderNumber: params.orderNumber, orderedItem: params.orderedItem, paymentMethods: params.paymentMethods, price: params.price, priceCurrency: params.priceCurrency, seller: params.seller, typeOf: params.typeOf, customer, orderDate: moment(params.orderDate)
|
|
63
75
|
.toDate(), acceptedOffers,
|
|
64
|
-
numItems }
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
76
|
+
numItems }, (typeof ((_a = params.broker) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? { broker: params.broker } : undefined
|
|
77
|
+
// ...(params.dateReturned !== null && params.dateReturned !== undefined)
|
|
78
|
+
// ? {
|
|
79
|
+
// dateReturned: moment(params.dateReturned)
|
|
80
|
+
// .toDate()
|
|
81
|
+
// }
|
|
82
|
+
// : undefined
|
|
83
|
+
);
|
|
70
84
|
}
|
|
71
85
|
function createAccountingReport(params) {
|
|
72
86
|
return {
|
|
73
|
-
project: params.project,
|
|
87
|
+
project: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
74
88
|
typeOf: 'Report',
|
|
75
89
|
hasPart: [],
|
|
76
|
-
mainEntity: params
|
|
90
|
+
mainEntity: params.mainEntity
|
|
77
91
|
};
|
|
78
92
|
}
|
|
@@ -117,7 +117,7 @@ function creteOrder4inform(order) {
|
|
|
117
117
|
// whitelistで作成する(2022-07-19~)
|
|
118
118
|
project: order.project, typeOf: order.typeOf, seller: order.seller, price: order.price, priceCurrency: order.priceCurrency, confirmationNumber: order.confirmationNumber, orderNumber: order.orderNumber, acceptedOffers: order.acceptedOffers, orderStatus: order.orderStatus, orderDate: order.orderDate,
|
|
119
119
|
// mask
|
|
120
|
-
customer: Object.assign(Object.assign({}, (0, order_1.createMaskedCustomer)(order)), { additionalProperty: (Array.isArray(order.customer.additionalProperty)) ? order.customer.additionalProperty : [],
|
|
120
|
+
customer: Object.assign(Object.assign({}, (0, order_1.createMaskedCustomer)(order, { noProfile: false })), { additionalProperty: (Array.isArray(order.customer.additionalProperty)) ? order.customer.additionalProperty : [],
|
|
121
121
|
// identifierは必要
|
|
122
122
|
// 予約後を隠蔽(2022-12-24~)
|
|
123
123
|
identifier: (Array.isArray(order.customer.identifier))
|
|
@@ -24,11 +24,11 @@ const TOKEN_EXPIRES_IN = 604800;
|
|
|
24
24
|
function onOrderStatusChanged(params) {
|
|
25
25
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
26
26
|
let tasks = [];
|
|
27
|
-
const maskedCustomer = (0, order_1.createMaskedCustomer)(params.order);
|
|
27
|
+
const maskedCustomer = (0, order_1.createMaskedCustomer)(params.order, { noProfile: true });
|
|
28
28
|
const simpleOrder = {
|
|
29
29
|
typeOf: params.order.typeOf,
|
|
30
30
|
seller: params.order.seller,
|
|
31
|
-
customer: { typeOf: maskedCustomer.typeOf, id: maskedCustomer.id
|
|
31
|
+
customer: { typeOf: maskedCustomer.typeOf, id: maskedCustomer.id },
|
|
32
32
|
// IOrderへ移行(2022-11-17~)
|
|
33
33
|
// confirmationNumber: params.order.confirmationNumber,
|
|
34
34
|
orderNumber: params.order.orderNumber,
|
|
@@ -105,12 +105,12 @@ function placeOrderWithoutTransaction(params) {
|
|
|
105
105
|
// orderNumber: params.object.orderNumber
|
|
106
106
|
// })({ transaction: repos.transaction });
|
|
107
107
|
// アクションを作成する(2022-04-11~)
|
|
108
|
-
const maskedCustomer = (0, order_1.createMaskedCustomer)(order);
|
|
108
|
+
const maskedCustomer = (0, order_1.createMaskedCustomer)(order, { noProfile: true });
|
|
109
109
|
const simpleOrder = {
|
|
110
110
|
// project: order.project,
|
|
111
111
|
typeOf: order.typeOf,
|
|
112
112
|
seller: order.seller,
|
|
113
|
-
customer: { typeOf: maskedCustomer.typeOf, id: maskedCustomer.id
|
|
113
|
+
customer: { typeOf: maskedCustomer.typeOf, id: maskedCustomer.id },
|
|
114
114
|
// IOrderへ移行(2022-11-17~)
|
|
115
115
|
// confirmationNumber: order.confirmationNumber,
|
|
116
116
|
orderNumber: order.orderNumber,
|
|
@@ -168,11 +168,11 @@ function placeOrder(params) {
|
|
|
168
168
|
confirmationNumber: params.object.confirmationNumber,
|
|
169
169
|
orderNumber: params.object.orderNumber
|
|
170
170
|
})({ transaction: repos.transaction });
|
|
171
|
-
const maskedCustomer = (0, order_1.createMaskedCustomer)(order);
|
|
171
|
+
const maskedCustomer = (0, order_1.createMaskedCustomer)(order, { noProfile: true });
|
|
172
172
|
const simpleOrder = {
|
|
173
173
|
typeOf: order.typeOf,
|
|
174
174
|
seller: order.seller,
|
|
175
|
-
customer: { typeOf: maskedCustomer.typeOf, id: maskedCustomer.id
|
|
175
|
+
customer: { typeOf: maskedCustomer.typeOf, id: maskedCustomer.id },
|
|
176
176
|
orderNumber: order.orderNumber,
|
|
177
177
|
price: order.price,
|
|
178
178
|
priceCurrency: order.priceCurrency,
|
|
@@ -44,7 +44,7 @@ function returnOrder(params) {
|
|
|
44
44
|
const simpleOrder = {
|
|
45
45
|
typeOf: order.typeOf,
|
|
46
46
|
seller: order.seller,
|
|
47
|
-
customer: (0, order_1.createMaskedCustomer)(order),
|
|
47
|
+
customer: (0, order_1.createMaskedCustomer)(order, { noProfile: true }),
|
|
48
48
|
orderNumber: order.orderNumber,
|
|
49
49
|
price: order.price,
|
|
50
50
|
priceCurrency: order.priceCurrency,
|
|
@@ -40,11 +40,11 @@ function sendOrder(params) {
|
|
|
40
40
|
if (order.confirmationNumber !== confirmationNumber) {
|
|
41
41
|
throw new factory.errors.NotFound('Order');
|
|
42
42
|
}
|
|
43
|
-
const maskedCustomer = (0, order_1.createMaskedCustomer)(order);
|
|
43
|
+
const maskedCustomer = (0, order_1.createMaskedCustomer)(order, { noProfile: true });
|
|
44
44
|
const simpleOrder = {
|
|
45
45
|
typeOf: order.typeOf,
|
|
46
46
|
seller: order.seller,
|
|
47
|
-
customer: { typeOf: maskedCustomer.typeOf, id: maskedCustomer.id
|
|
47
|
+
customer: { typeOf: maskedCustomer.typeOf, id: maskedCustomer.id },
|
|
48
48
|
orderNumber: order.orderNumber,
|
|
49
49
|
price: order.price,
|
|
50
50
|
priceCurrency: order.priceCurrency,
|
|
@@ -57,7 +57,7 @@ function sendOrder(params) {
|
|
|
57
57
|
// sendEmailMessage: undefined
|
|
58
58
|
},
|
|
59
59
|
project: order.project,
|
|
60
|
-
recipient: order.customer,
|
|
60
|
+
recipient: { id: order.customer.id, typeOf: order.customer.typeOf },
|
|
61
61
|
typeOf: factory.actionType.SendAction
|
|
62
62
|
};
|
|
63
63
|
const action = yield repos.action.start(sendOrderActionAttributes);
|
|
@@ -56,12 +56,11 @@ function optimizeAction4report(action) {
|
|
|
56
56
|
endDate: action.endDate,
|
|
57
57
|
id: action.id,
|
|
58
58
|
object: optimizedPayActionObject,
|
|
59
|
-
|
|
59
|
+
// 最適化(2023-06-30~)
|
|
60
|
+
// project: action.project,
|
|
60
61
|
purpose: action.purpose,
|
|
61
62
|
startDate: action.startDate,
|
|
62
63
|
typeOf: action.typeOf
|
|
63
|
-
// 不要なので廃止(2022-05-19~)
|
|
64
|
-
// ...(maskedRecipient !== undefined) ? { recipient: <factory.action.trade.pay.IRecipient>maskedRecipient } : undefined
|
|
65
64
|
};
|
|
66
65
|
optimizedAction = optimizedPayAction;
|
|
67
66
|
break;
|
|
@@ -78,12 +77,11 @@ function optimizeAction4report(action) {
|
|
|
78
77
|
endDate: action.endDate,
|
|
79
78
|
id: action.id,
|
|
80
79
|
object: optimizedRefundActionObject,
|
|
81
|
-
|
|
80
|
+
// 最適化(2023-06-30~)
|
|
81
|
+
// project: action.project,
|
|
82
82
|
purpose: action.purpose,
|
|
83
83
|
startDate: action.startDate,
|
|
84
84
|
typeOf: action.typeOf
|
|
85
|
-
// 不要なので廃止(2022-05-19~)
|
|
86
|
-
// ...(maskedRecipient !== undefined) ? { recipient: maskedRecipient } : undefined
|
|
87
85
|
};
|
|
88
86
|
optimizedAction = optimizedRefundAction;
|
|
89
87
|
break;
|
|
@@ -21,7 +21,7 @@ const onPaymentStatusChanged_1 = require("./onPaymentStatusChanged");
|
|
|
21
21
|
*/
|
|
22
22
|
function onRefund(refundAction) {
|
|
23
23
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
24
|
-
var _a;
|
|
24
|
+
var _a, _b;
|
|
25
25
|
const aciton4inform = (0, factory_1.optimizeAction4inform)(refundAction);
|
|
26
26
|
const potentialActions = refundAction.potentialActions;
|
|
27
27
|
const now = new Date();
|
|
@@ -33,49 +33,53 @@ function onRefund(refundAction) {
|
|
|
33
33
|
}
|
|
34
34
|
const informPayment = potentialActions === null || potentialActions === void 0 ? void 0 : potentialActions.informPayment;
|
|
35
35
|
// 手数料決済があれば処理
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
36
|
+
// CreditCardIFのみ(2023-06-29~)
|
|
37
|
+
const paymentServiceType = (_a = refundAction.object[0]) === null || _a === void 0 ? void 0 : _a.typeOf;
|
|
38
|
+
if (paymentServiceType === factory.service.paymentService.PaymentServiceType.CreditCard) {
|
|
39
|
+
const refundFee = (_b = refundAction.object[0]) === null || _b === void 0 ? void 0 : _b.refundFee;
|
|
40
|
+
if (typeof refundFee === 'number' && refundFee > 0) {
|
|
41
|
+
const payObject = refundAction.object.map((o) => {
|
|
42
|
+
return {
|
|
43
|
+
typeOf: o.typeOf,
|
|
44
|
+
id: o.id,
|
|
45
|
+
paymentMethod: {
|
|
46
|
+
accountId: o.paymentMethod.accountId,
|
|
47
|
+
additionalProperty: o.paymentMethod.additionalProperty,
|
|
48
|
+
name: o.paymentMethod.name,
|
|
49
|
+
paymentMethodId: o.paymentMethod.paymentMethodId,
|
|
50
|
+
totalPaymentDue: {
|
|
51
|
+
typeOf: 'MonetaryAmount',
|
|
52
|
+
currency: factory.priceCurrency.JPY,
|
|
53
|
+
value: refundFee
|
|
54
|
+
},
|
|
55
|
+
typeOf: o.paymentMethod.typeOf
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
const payAction = {
|
|
60
|
+
project: refundAction.project,
|
|
61
|
+
typeOf: factory.actionType.PayAction,
|
|
62
|
+
object: payObject,
|
|
63
|
+
agent: refundAction.recipient,
|
|
64
|
+
recipient: refundAction.agent,
|
|
65
|
+
purpose: refundAction.purpose,
|
|
66
|
+
potentialActions: {
|
|
67
|
+
add2report: true,
|
|
68
|
+
informPayment: (Array.isArray(informPayment)) ? informPayment : []
|
|
53
69
|
}
|
|
54
70
|
};
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
};
|
|
68
|
-
const payTask = {
|
|
69
|
-
project: refundAction.project,
|
|
70
|
-
name: factory.taskName.Pay,
|
|
71
|
-
status: factory.taskStatus.Ready,
|
|
72
|
-
runsAt: now,
|
|
73
|
-
remainingNumberOfTries: 10,
|
|
74
|
-
numberOfTried: 0,
|
|
75
|
-
executionResults: [],
|
|
76
|
-
data: payAction
|
|
77
|
-
};
|
|
78
|
-
taskAttributes.push(payTask);
|
|
71
|
+
const payTask = {
|
|
72
|
+
project: refundAction.project,
|
|
73
|
+
name: factory.taskName.Pay,
|
|
74
|
+
status: factory.taskStatus.Ready,
|
|
75
|
+
runsAt: now,
|
|
76
|
+
remainingNumberOfTries: 10,
|
|
77
|
+
numberOfTried: 0,
|
|
78
|
+
executionResults: [],
|
|
79
|
+
data: payAction
|
|
80
|
+
};
|
|
81
|
+
taskAttributes.push(payTask);
|
|
82
|
+
}
|
|
79
83
|
}
|
|
80
84
|
if (Array.isArray(informPayment)) {
|
|
81
85
|
taskAttributes.push(...informPayment.map((a) => {
|
|
@@ -108,11 +108,14 @@ declare function authorize(params: {
|
|
|
108
108
|
purpose: factory.action.authorize.paymentMethod.any.IPurpose;
|
|
109
109
|
paymentServiceType: factory.service.paymentService.PaymentServiceType;
|
|
110
110
|
location?: factory.action.trade.pay.ILocation;
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
111
|
+
options: {
|
|
112
|
+
/**
|
|
113
|
+
* アクション失敗時に即時に決済取引を中止するかどうか
|
|
114
|
+
*/
|
|
115
|
+
useCancelPayTransactionOnFailed: boolean;
|
|
116
|
+
useCheckMovieTicketBeforePay: boolean;
|
|
117
|
+
useCheckByIdentifierIfNotYet: boolean;
|
|
118
|
+
useSearchTrade4accountId: boolean;
|
|
119
|
+
};
|
|
117
120
|
}): IAuthorizeOperation<IAuthorizePaymentAction>;
|
|
118
121
|
export { onPaymentStatusChanged, authorize, invalidatePaymentUrl, voidPayTransaction, person2username, processVoidPayTransaction, publishPaymentUrl };
|
|
@@ -314,7 +314,11 @@ function authorize(params) {
|
|
|
314
314
|
transactionNumber: transactionNumber,
|
|
315
315
|
location: params.location
|
|
316
316
|
});
|
|
317
|
-
payTransaction = yield PayTransactionService.start(startParams,
|
|
317
|
+
payTransaction = yield PayTransactionService.start(startParams, {
|
|
318
|
+
useCheckMovieTicketBeforePay: params.options.useCheckMovieTicketBeforePay,
|
|
319
|
+
useCheckByIdentifierIfNotYet: params.options.useCheckByIdentifierIfNotYet,
|
|
320
|
+
searchTrade4accountId: params.options.useSearchTrade4accountId
|
|
321
|
+
})(repos);
|
|
318
322
|
}
|
|
319
323
|
catch (error) {
|
|
320
324
|
try {
|
|
@@ -325,7 +329,7 @@ function authorize(params) {
|
|
|
325
329
|
// no op
|
|
326
330
|
}
|
|
327
331
|
// 即時に決済取引を中止するか?(2023-02-03~)
|
|
328
|
-
if (params.useCancelPayTransactionOnFailed) {
|
|
332
|
+
if (params.options.useCancelPayTransactionOnFailed) {
|
|
329
333
|
// abortエラーの場合は状態不明なので即時中止しない(2023-06-01~)
|
|
330
334
|
// {
|
|
331
335
|
// "type": "aborted",
|
|
@@ -521,7 +521,7 @@ function processChangeTransaction(params) {
|
|
|
521
521
|
function getGMOInfoFromSeller(params) {
|
|
522
522
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
523
523
|
var _a, _b, _c, _d;
|
|
524
|
-
const seller = yield repos.seller.findById({ id: String(params.seller.id) });
|
|
524
|
+
const seller = yield repos.seller.findById({ id: String(params.seller.id) }, ['paymentAccepted', 'project'], []);
|
|
525
525
|
const paymentAccepted = (_a = seller.paymentAccepted) === null || _a === void 0 ? void 0 : _a.some((a) => a.paymentMethodType === params.paymentMethodType);
|
|
526
526
|
if (paymentAccepted !== true) {
|
|
527
527
|
throw new factory.errors.Argument('transaction', 'payment not accepted');
|
|
@@ -534,7 +534,7 @@ function getGMOInfoFromSeller(params) {
|
|
|
534
534
|
typeOf: { $eq: factory.service.paymentService.PaymentServiceType.CreditCard },
|
|
535
535
|
// serviceType: { codeValue: { $eq: params.paymentMethodType } },
|
|
536
536
|
id: { $eq: params.paymentServiceId }
|
|
537
|
-
});
|
|
537
|
+
}, [], []);
|
|
538
538
|
const paymentService = paymentServices.shift();
|
|
539
539
|
if (paymentService === undefined) {
|
|
540
540
|
throw new factory.errors.NotFound('PaymentService');
|
|
@@ -6,16 +6,17 @@ interface ICheckResult {
|
|
|
6
6
|
purchaseNumberAuthIn: factory.action.check.paymentMethod.movieTicket.IPurchaseNumberAuthIn;
|
|
7
7
|
purchaseNumberAuthResult: factory.action.check.paymentMethod.movieTicket.IPurchaseNumberAuthResult;
|
|
8
8
|
}
|
|
9
|
-
|
|
10
|
-
* MovieTicket認証
|
|
11
|
-
*/
|
|
12
|
-
declare function checkByIdentifier(params: {
|
|
9
|
+
interface ICheckByIdentifierParams {
|
|
13
10
|
movieTickets: factory.action.check.paymentMethod.movieTicket.IMovieTicket[];
|
|
14
|
-
seller: factory.seller.ISeller
|
|
11
|
+
seller: Pick<factory.seller.ISeller, 'id' | 'project'>;
|
|
15
12
|
screeningEvent: IMinimizedIndividualEvent<factory.eventType.ScreeningEvent>;
|
|
16
13
|
paymentServiceId: string;
|
|
17
|
-
}
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* MovieTicket認証
|
|
17
|
+
*/
|
|
18
|
+
declare function checkByIdentifier(params: ICheckByIdentifierParams): (repos: {
|
|
18
19
|
product: ProductRepo;
|
|
19
20
|
project: ProjectRepo;
|
|
20
21
|
}) => Promise<ICheckResult>;
|
|
21
|
-
export { ICheckResult, checkByIdentifier };
|
|
22
|
+
export { ICheckByIdentifierParams, ICheckResult, checkByIdentifier };
|
|
@@ -6,7 +6,7 @@ export declare function createSeatInfoSyncIn(params: {
|
|
|
6
6
|
movieTickets: factory.action.trade.pay.IMovieTicket[];
|
|
7
7
|
event: factory.event.screeningEvent.IEvent;
|
|
8
8
|
purpose: factory.action.trade.pay.IPurpose;
|
|
9
|
-
seller: factory.seller.ISeller
|
|
9
|
+
seller: Pick<factory.seller.ISeller, 'paymentAccepted'>;
|
|
10
10
|
credentials: {
|
|
11
11
|
kgygishCd: string;
|
|
12
12
|
stCd: string;
|
|
@@ -2,7 +2,7 @@ import { MongoRepository as ProductRepo } from '../../../repo/product';
|
|
|
2
2
|
import * as factory from '../../../factory';
|
|
3
3
|
declare function getCredentials(params: {
|
|
4
4
|
paymentMethodType: string;
|
|
5
|
-
seller: factory.seller.ISeller
|
|
5
|
+
seller: Pick<factory.seller.ISeller, 'id' | 'project'>;
|
|
6
6
|
paymentServiceId: string;
|
|
7
7
|
}): (repos: {
|
|
8
8
|
product: ProductRepo;
|
|
@@ -22,7 +22,7 @@ function getCredentials(params) {
|
|
|
22
22
|
typeOf: { $eq: factory.service.paymentService.PaymentServiceType.MovieTicket },
|
|
23
23
|
// serviceType: { codeValue: { $eq: params.paymentMethodType } },
|
|
24
24
|
id: { $eq: params.paymentServiceId }
|
|
25
|
-
});
|
|
25
|
+
}, [], []);
|
|
26
26
|
const paymentService = paymentServices.shift();
|
|
27
27
|
if (paymentService === undefined) {
|
|
28
28
|
throw new factory.errors.NotFound('PaymentService');
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 決済取引サービス
|
|
3
|
-
*/
|
|
4
1
|
import * as factory from '../../../factory';
|
|
2
|
+
import { MongoRepository as ActionRepo } from '../../../repo/action';
|
|
5
3
|
import { MongoRepository as EventRepo } from '../../../repo/event';
|
|
6
4
|
import { MongoRepository as ProductRepo } from '../../../repo/product';
|
|
7
5
|
import { MongoRepository as ProjectRepo } from '../../../repo/project';
|
|
8
6
|
import { MongoRepository as SellerRepo } from '../../../repo/seller';
|
|
9
|
-
export declare function validateMovieTicket(params: factory.assetTransaction.pay.IStartParamsWithoutDetail, paymentServiceId: string, useCheckMovieTicketBeforePay: boolean): (repos: {
|
|
7
|
+
export declare function validateMovieTicket(params: factory.assetTransaction.pay.IStartParamsWithoutDetail, paymentServiceId: string, useCheckMovieTicketBeforePay: boolean, useCheckByIdentifierIfNotYet: boolean): (repos: {
|
|
8
|
+
action: ActionRepo;
|
|
10
9
|
event: EventRepo;
|
|
11
10
|
product: ProductRepo;
|
|
12
11
|
project: ProjectRepo;
|