@chevre/domain 20.4.0-alpha.2 → 20.4.0-alpha.21
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/createManyEventsIfNotExist.ts +10 -10
- package/example/src/chevre/deleteMovieTicketCategoryChargePriceSpecs.ts +21 -0
- package/example/src/chevre/migrateMoneyTransferPendingTransactionIdentifier.ts +96 -0
- package/example/src/chevre/searchEventTicketOffers.ts +7 -4
- package/example/src/chevre/searchOffersByCatalog.ts +2 -1
- package/example/src/chevre/unsetUnnecessaryFields.ts +21 -0
- package/lib/chevre/repo/account.d.ts +4 -10
- package/lib/chevre/repo/account.js +72 -60
- package/lib/chevre/repo/assetTransaction.d.ts +1 -0
- package/lib/chevre/repo/assetTransaction.js +5 -0
- package/lib/chevre/repo/event.d.ts +5 -4
- package/lib/chevre/repo/event.js +12 -30
- package/lib/chevre/repo/mongoose/model/comments.d.ts +1 -1
- package/lib/chevre/repo/mongoose/model/comments.js +1 -1
- package/lib/chevre/repo/mongoose/model/offer.js +12 -0
- package/lib/chevre/repo/offer.d.ts +17 -2
- package/lib/chevre/repo/offer.js +77 -44
- package/lib/chevre/repo/priceSpecification.d.ts +10 -0
- package/lib/chevre/repo/priceSpecification.js +9 -0
- package/lib/chevre/repo/serviceOutput.d.ts +4 -0
- package/lib/chevre/repo/serviceOutput.js +6 -0
- package/lib/chevre/repository.d.ts +6 -0
- package/lib/chevre/repository.js +8 -1
- package/lib/chevre/service/account.d.ts +0 -8
- package/lib/chevre/service/account.js +16 -10
- package/lib/chevre/service/accountTransaction/deposit.js +2 -1
- package/lib/chevre/service/accountTransaction/factory.js +25 -20
- package/lib/chevre/service/accountTransaction/transfer.js +4 -2
- package/lib/chevre/service/accountTransaction/withdraw.js +2 -1
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +46 -83
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +3 -1
- package/lib/chevre/service/assetTransaction/moneyTransfer.js +19 -11
- package/lib/chevre/service/assetTransaction/pay.js +19 -14
- package/lib/chevre/service/assetTransaction/registerService/factory.js +9 -4
- package/lib/chevre/service/assetTransaction/reserve.js +2 -0
- package/lib/chevre/service/delivery.js +12 -3
- package/lib/chevre/service/event.js +3 -23
- package/lib/chevre/service/moneyTransfer.d.ts +1 -1
- package/lib/chevre/service/moneyTransfer.js +7 -8
- package/lib/chevre/service/offer/event/authorize.js +2 -1
- package/lib/chevre/service/offer/event/factory.js +1 -1
- package/lib/chevre/service/offer/event/searchEventTicketOffers.d.ts +6 -6
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +106 -91
- package/lib/chevre/service/offer/factory.d.ts +4 -1
- package/lib/chevre/service/offer/factory.js +57 -26
- package/lib/chevre/service/offer/moneyTransfer/authorize.js +0 -1
- package/lib/chevre/service/offer/moneyTransfer/returnMoneyTransfer.js +0 -1
- package/lib/chevre/service/offer/product/searchProductOffers.js +5 -1
- package/lib/chevre/service/payment/any/factory.js +29 -2
- package/lib/chevre/service/payment/any.js +11 -4
- package/lib/chevre/service/payment/movieTicket.d.ts +7 -2
- package/lib/chevre/service/payment/movieTicket.js +17 -8
- package/lib/chevre/service/payment/paymentCard.d.ts +6 -2
- package/lib/chevre/service/payment/paymentCard.js +16 -8
- package/lib/chevre/service/permit.d.ts +5 -1
- package/lib/chevre/service/permit.js +18 -11
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +25 -53
- package/lib/chevre/service/transaction/moneyTransfer.js +0 -1
- package/lib/chevre/settings.d.ts +6 -0
- package/lib/chevre/settings.js +8 -2
- package/package.json +3 -3
- package/example/src/chevre/migrateAccountTitleAdditionalProperties.ts +0 -157
- package/example/src/chevre/migrateProjectSubscription.ts +0 -51
- package/example/src/chevre/migrateSection.ts +0 -105
|
@@ -17,6 +17,7 @@ const createDebug = require("debug");
|
|
|
17
17
|
const moment = require("moment-timezone");
|
|
18
18
|
const event_1 = require("../../../repo/event");
|
|
19
19
|
const factory = require("../../../factory");
|
|
20
|
+
const settings_1 = require("../../../settings");
|
|
20
21
|
const debug = createDebug('chevre-domain:service');
|
|
21
22
|
/**
|
|
22
23
|
* イベントデータをID指定で集計する
|
|
@@ -28,31 +29,34 @@ function aggregateScreeningEvent(params) {
|
|
|
28
29
|
// const event = await repos.event.findById<factory.eventType.ScreeningEvent | factory.eventType.Event>(params);
|
|
29
30
|
const event = yield repos.event.findMinimizedIndividualEventById(params);
|
|
30
31
|
let aggregatingEvents = [event];
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
32
|
+
// プロジェクト限定(2023-02-22~)
|
|
33
|
+
if (settings_1.settings.useOfferRateLimitProjects.includes(event.project.id)) {
|
|
34
|
+
const availableOffers = yield findOffers({ event })(repos);
|
|
35
|
+
const offerRateLimitExists = availableOffers.some((o) => { var _a; return typeof ((_a = o.validRateLimit) === null || _a === void 0 ? void 0 : _a.scope) === 'string'; });
|
|
36
|
+
if (offerRateLimitExists) {
|
|
37
|
+
// 同location、かつ同時間帯、のイベントに関しても集計する(ttts暫定対応)
|
|
38
|
+
const startFrom = moment(event.startDate)
|
|
39
|
+
.startOf('hour')
|
|
40
|
+
.toDate();
|
|
41
|
+
const startThrough = moment(startFrom)
|
|
42
|
+
.add(1, 'hour')
|
|
43
|
+
.add(-1, 'second')
|
|
44
|
+
.toDate();
|
|
45
|
+
// 取得属性最適化(2023-01-25~)
|
|
46
|
+
aggregatingEvents = yield repos.event.search({
|
|
47
|
+
limit: 100,
|
|
48
|
+
page: 1,
|
|
49
|
+
project: { id: { $eq: event.project.id } },
|
|
50
|
+
typeOf: event.typeOf,
|
|
51
|
+
eventStatuses: [factory.eventStatusType.EventScheduled],
|
|
52
|
+
startFrom: startFrom,
|
|
53
|
+
startThrough: startThrough,
|
|
54
|
+
location: { branchCode: { $eq: event.location.branchCode } }
|
|
55
|
+
}, event_1.PROJECTION_MINIMIZED_EVENT);
|
|
56
|
+
// ID指定されたイベントについてはEventScheduledでなくても集計したいので、集計対象を調整
|
|
57
|
+
aggregatingEvents = aggregatingEvents.filter((e) => e.id !== event.id);
|
|
58
|
+
aggregatingEvents = [event, ...aggregatingEvents];
|
|
59
|
+
}
|
|
56
60
|
}
|
|
57
61
|
debug(aggregatingEvents.length, 'aggregatingEvents found', aggregatingEvents.map((e) => e.id));
|
|
58
62
|
for (const aggregatingEvent of aggregatingEvents) {
|
|
@@ -79,41 +83,29 @@ function aggregateByEvent(params) {
|
|
|
79
83
|
branchCode: { $eq: event.location.branchCode },
|
|
80
84
|
containedInPlace: { id: { $eq: movieTheaterId } }
|
|
81
85
|
});
|
|
82
|
-
// 施設取得
|
|
83
|
-
// const movieTheater = await findLocation(params)(repos);
|
|
84
|
-
// // 万が一施設が存在しなければ処理終了
|
|
85
|
-
// if (movieTheater === undefined) {
|
|
86
|
-
// return;
|
|
87
|
-
// }
|
|
88
|
-
// const screeningRoom = <factory.place.screeningRoom.IPlace | undefined>
|
|
89
|
-
// movieTheater.containsPlace.find((p) => p.branchCode === event.location.branchCode);
|
|
90
|
-
// if (screeningRoom === undefined) {
|
|
91
|
-
// // 基本的にありえないはずだが、万が一スクリーンが見つからなければcapacityは0のまま
|
|
92
|
-
// // tslint:disable-next-line:no-console
|
|
93
|
-
// console.error(new Error(`Screening room not found. branchCode: ${event.location.branchCode}`));
|
|
94
|
-
// return;
|
|
95
|
-
// }
|
|
96
86
|
// 予約集計
|
|
97
87
|
const { maximumAttendeeCapacity, remainingAttendeeCapacity, aggregateReservation } = yield aggregateReservationByEvent({
|
|
98
88
|
aggregateDate: now,
|
|
99
89
|
event: event,
|
|
100
90
|
screeningRoom: screeningRoom
|
|
101
91
|
})(repos);
|
|
92
|
+
// プロジェクト限定(2023-02-22~)
|
|
102
93
|
// オファーごとの集計
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
94
|
+
let aggregateOffer;
|
|
95
|
+
if (settings_1.settings.useAggregateOfferProjects.includes(event.project.id)) {
|
|
96
|
+
aggregateOffer = yield aggregateOfferByEvent({
|
|
97
|
+
aggregateDate: now,
|
|
98
|
+
event: Object.assign(Object.assign({}, event), { maximumAttendeeCapacity,
|
|
99
|
+
remainingAttendeeCapacity }),
|
|
100
|
+
screeningRoom: screeningRoom
|
|
101
|
+
})(repos);
|
|
102
|
+
debug('offers aggregated', aggregateOffer);
|
|
103
|
+
}
|
|
110
104
|
// 値がundefinedの場合に更新しないように注意
|
|
111
105
|
const update = {
|
|
112
|
-
$set: Object.assign(Object.assign(Object.assign(Object.assign({ updatedAt: new Date(), // $setオブジェクトが空だとMongoエラーになるので
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
aggregateOffer }, (maximumAttendeeCapacity !== undefined) ? { maximumAttendeeCapacity: maximumAttendeeCapacity } : undefined), (remainingAttendeeCapacity !== undefined) ? { remainingAttendeeCapacity: remainingAttendeeCapacity } : undefined), (aggregateReservation.checkInCount !== undefined) ? { checkInCount: aggregateReservation.checkInCount } : undefined), (aggregateReservation.attendeeCount !== undefined) ? { attendeeCount: aggregateReservation.attendeeCount } : undefined),
|
|
116
|
-
$unset: Object.assign(Object.assign({ noExistingAttributeName: 1 }, (maximumAttendeeCapacity === undefined) ? { maximumAttendeeCapacity: '' } : undefined), (remainingAttendeeCapacity === undefined) ? { remainingAttendeeCapacity: '' } : undefined)
|
|
106
|
+
$set: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ updatedAt: new Date(), // $setオブジェクトが空だとMongoエラーになるので
|
|
107
|
+
aggregateReservation }, (typeof (aggregateOffer === null || aggregateOffer === void 0 ? void 0 : aggregateOffer.typeOf) === 'string') ? { aggregateOffer: aggregateOffer } : undefined), (maximumAttendeeCapacity !== undefined) ? { maximumAttendeeCapacity: maximumAttendeeCapacity } : undefined), (remainingAttendeeCapacity !== undefined) ? { remainingAttendeeCapacity: remainingAttendeeCapacity } : undefined), (aggregateReservation.checkInCount !== undefined) ? { checkInCount: aggregateReservation.checkInCount } : undefined), (aggregateReservation.attendeeCount !== undefined) ? { attendeeCount: aggregateReservation.attendeeCount } : undefined),
|
|
108
|
+
$unset: Object.assign(Object.assign(Object.assign({ noExistingAttributeName: 1 }, (typeof (aggregateOffer === null || aggregateOffer === void 0 ? void 0 : aggregateOffer.typeOf) !== 'string') ? { aggregateOffer: '' } : undefined), (maximumAttendeeCapacity === undefined) ? { maximumAttendeeCapacity: '' } : undefined), (remainingAttendeeCapacity === undefined) ? { remainingAttendeeCapacity: '' } : undefined)
|
|
117
109
|
};
|
|
118
110
|
debug('update:', update);
|
|
119
111
|
// 保管
|
|
@@ -125,37 +117,6 @@ function aggregateByEvent(params) {
|
|
|
125
117
|
});
|
|
126
118
|
}
|
|
127
119
|
exports.aggregateByEvent = aggregateByEvent;
|
|
128
|
-
/**
|
|
129
|
-
* イベントロケーション取得
|
|
130
|
-
* NotFoundエラーをハンドリングする
|
|
131
|
-
*/
|
|
132
|
-
// function findLocation(params: {
|
|
133
|
-
// event: factory.event.screeningEvent.IEvent | factory.event.event.IEvent;
|
|
134
|
-
// }) {
|
|
135
|
-
// return async (repos: {
|
|
136
|
-
// place: PlaceRepo;
|
|
137
|
-
// }): Promise<factory.place.movieTheater.IPlace | undefined> => {
|
|
138
|
-
// let movieTheater: factory.place.movieTheater.IPlace | undefined;
|
|
139
|
-
// try {
|
|
140
|
-
// if (params.event.typeOf === factory.eventType.ScreeningEvent) {
|
|
141
|
-
// movieTheater = await repos.place.findById({ id: params.event.superEvent.location.id });
|
|
142
|
-
// } else {
|
|
143
|
-
// const movieTheaterId: string =
|
|
144
|
-
// String(params.event.offers?.itemOffered.availableChannel.serviceLocation.containedInPlace.id);
|
|
145
|
-
// movieTheater = await repos.place.findById({ id: movieTheaterId });
|
|
146
|
-
// }
|
|
147
|
-
// } catch (error) {
|
|
148
|
-
// let throwsError = true;
|
|
149
|
-
// if (error instanceof factory.errors.NotFound) {
|
|
150
|
-
// throwsError = false;
|
|
151
|
-
// }
|
|
152
|
-
// if (throwsError) {
|
|
153
|
-
// throw error;
|
|
154
|
-
// }
|
|
155
|
-
// }
|
|
156
|
-
// return movieTheater;
|
|
157
|
-
// };
|
|
158
|
-
// }
|
|
159
120
|
/**
|
|
160
121
|
* 集計後アクション
|
|
161
122
|
*/
|
|
@@ -208,10 +169,12 @@ function findOffers(params) {
|
|
|
208
169
|
if (typeof ((_a = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.itemOffered) === null || _a === void 0 ? void 0 : _a.id) === 'string') {
|
|
209
170
|
const eventService = yield repos.product.findById({ id: eventOffers.itemOffered.id });
|
|
210
171
|
if (typeof ((_b = eventService.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.id) === 'string') {
|
|
211
|
-
|
|
172
|
+
const findOffersByOfferCatalogIdResult = yield repos.offer.findOffersByOfferCatalogId({
|
|
212
173
|
offerCatalog: { id: eventService.hasOfferCatalog.id },
|
|
174
|
+
excludeAppliesToMovieTicket: false,
|
|
213
175
|
sort: false // ソート不要(2023-01-27~)
|
|
214
176
|
});
|
|
177
|
+
availableOffers = findOffersByOfferCatalogIdResult.offers;
|
|
215
178
|
}
|
|
216
179
|
}
|
|
217
180
|
else {
|
|
@@ -91,10 +91,12 @@ function findOffers(params) {
|
|
|
91
91
|
if (typeof ((_a = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.itemOffered) === null || _a === void 0 ? void 0 : _a.id) === 'string') {
|
|
92
92
|
const eventService = yield repos.product.findById({ id: eventOffers.itemOffered.id });
|
|
93
93
|
if (typeof ((_b = eventService.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.id) === 'string') {
|
|
94
|
-
|
|
94
|
+
const findOffersByOfferCatalogIdResult = yield repos.offer.findOffersByOfferCatalogId({
|
|
95
95
|
offerCatalog: { id: eventService.hasOfferCatalog.id },
|
|
96
|
+
excludeAppliesToMovieTicket: false,
|
|
96
97
|
sort: false // ソート不要(2023-01-27~)
|
|
97
98
|
});
|
|
99
|
+
availableOffers = findOffersByOfferCatalogIdResult.offers;
|
|
98
100
|
}
|
|
99
101
|
}
|
|
100
102
|
else {
|
|
@@ -62,20 +62,29 @@ function start(params) {
|
|
|
62
62
|
recipient: params.recipient,
|
|
63
63
|
object: Object.assign(Object.assign({ amount,
|
|
64
64
|
fromLocation,
|
|
65
|
-
toLocation, pendingTransaction: Object.assign({ typeOf: transactionType,
|
|
65
|
+
toLocation, pendingTransaction: Object.assign({ typeOf: transactionType, transactionNumber: transactionNumber }, (typeof params.identifier === 'string') ? { identifier: params.identifier } : undefined) }, (typeof params.object.description === 'string') ? { description: params.object.description } : {}), { force: params.object.force === true }),
|
|
66
66
|
expires: params.expires
|
|
67
67
|
};
|
|
68
68
|
// 取引開始
|
|
69
69
|
let transaction;
|
|
70
70
|
try {
|
|
71
71
|
transaction = yield repos.assetTransaction.start(startParams);
|
|
72
|
-
const pendingTransaction =
|
|
73
|
-
yield
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
72
|
+
// const pendingTransaction = await authorizeAccount({ transaction })(repos);
|
|
73
|
+
yield authorizeAccount({ transaction })(repos);
|
|
74
|
+
// 更新不要(2023-02-20~)
|
|
75
|
+
// await repos.assetTransaction.findByIdAndUpdate<factory.assetTransactionType.MoneyTransfer>({
|
|
76
|
+
// id: transaction.id,
|
|
77
|
+
// update: {
|
|
78
|
+
// 'object.pendingTransaction': {
|
|
79
|
+
// typeOf: pendingTransaction.typeOf,
|
|
80
|
+
// id: pendingTransaction.id,
|
|
81
|
+
// transactionNumber: pendingTransaction.transactionNumber,
|
|
82
|
+
// ...(typeof pendingTransaction.identifier === 'string')
|
|
83
|
+
// ? { identifier: pendingTransaction.identifier }
|
|
84
|
+
// : undefined
|
|
85
|
+
// }
|
|
86
|
+
// }
|
|
87
|
+
// });
|
|
79
88
|
}
|
|
80
89
|
catch (error) {
|
|
81
90
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
@@ -113,13 +122,12 @@ function authorizeAccount(params) {
|
|
|
113
122
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
114
123
|
var _a, _b, _c;
|
|
115
124
|
const transaction = params.transaction;
|
|
116
|
-
let pendingTransaction;
|
|
117
125
|
const fromLocation = transaction.object.fromLocation;
|
|
118
126
|
const toLocation = transaction.object.toLocation;
|
|
119
127
|
if (typeof ((_a = transaction.object.pendingTransaction) === null || _a === void 0 ? void 0 : _a.typeOf) !== 'string') {
|
|
120
128
|
throw new factory.errors.NotFound('transaction.object.pendingTransaction.typeOf');
|
|
121
129
|
}
|
|
122
|
-
|
|
130
|
+
yield MoneyTransferService.authorize({
|
|
123
131
|
typeOf: transaction.object.pendingTransaction.typeOf,
|
|
124
132
|
identifier: transaction.object.pendingTransaction.identifier,
|
|
125
133
|
transactionNumber: transaction.object.pendingTransaction.transactionNumber,
|
|
@@ -143,7 +151,7 @@ function authorizeAccount(params) {
|
|
|
143
151
|
recipient: transaction.recipient,
|
|
144
152
|
purpose: { typeOf: transaction.typeOf, id: transaction.id }
|
|
145
153
|
})(repos);
|
|
146
|
-
return pendingTransaction;
|
|
154
|
+
// return pendingTransaction;
|
|
147
155
|
});
|
|
148
156
|
}
|
|
149
157
|
function fixMonetaryAmount(params, product) {
|
|
@@ -220,26 +220,32 @@ function validateSeller(params) {
|
|
|
220
220
|
}
|
|
221
221
|
function processAuthorizeAccount(params, transaction, paymentServiceId) {
|
|
222
222
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
223
|
+
var _a;
|
|
224
|
+
const amount = (_a = params.object.paymentMethod) === null || _a === void 0 ? void 0 : _a.amount;
|
|
225
|
+
if (typeof amount !== 'number') {
|
|
226
|
+
throw new factory.errors.ArgumentNull('object.paymentMethod?.amount');
|
|
227
|
+
}
|
|
223
228
|
yield (0, validation_1.validateAccount)(params)(repos);
|
|
224
|
-
const
|
|
229
|
+
const { pendingTransaction, currency, accountNumber } = yield PaymentCardPayment.authorize(params, paymentServiceId)(repos);
|
|
225
230
|
const totalPaymentDue = {
|
|
226
231
|
typeOf: 'MonetaryAmount',
|
|
227
|
-
currency
|
|
228
|
-
value:
|
|
229
|
-
|
|
230
|
-
|
|
232
|
+
currency,
|
|
233
|
+
value: amount
|
|
234
|
+
// value: (typeof pendingTransaction.object.amount === 'number')
|
|
235
|
+
// ? pendingTransaction.object.amount
|
|
236
|
+
// : pendingTransaction.object.amount.value
|
|
231
237
|
};
|
|
232
|
-
const
|
|
233
|
-
typeOf:
|
|
234
|
-
id:
|
|
235
|
-
transactionNumber:
|
|
236
|
-
object: { fromLocation: { accountNumber
|
|
238
|
+
const savingPendingTransaction = {
|
|
239
|
+
typeOf: pendingTransaction.typeOf,
|
|
240
|
+
id: pendingTransaction.id,
|
|
241
|
+
transactionNumber: pendingTransaction.transactionNumber,
|
|
242
|
+
object: { fromLocation: { accountNumber } }
|
|
237
243
|
};
|
|
238
244
|
return saveAuthorizeResult({
|
|
239
245
|
id: transaction.id,
|
|
240
246
|
update: {
|
|
241
247
|
'object.paymentMethod.totalPaymentDue': totalPaymentDue,
|
|
242
|
-
'object.pendingTransaction':
|
|
248
|
+
'object.pendingTransaction': savingPendingTransaction
|
|
243
249
|
}
|
|
244
250
|
})(repos);
|
|
245
251
|
});
|
|
@@ -263,11 +269,10 @@ function processAuthorizeCreditCard(params, transaction, paymentServiceId) {
|
|
|
263
269
|
}
|
|
264
270
|
function processAuthorizeMovieTicket(params, transaction, paymentServiceId) {
|
|
265
271
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
266
|
-
|
|
267
|
-
const authorizeResult = yield MovieTicketPayment.authorize(params, transaction, paymentServiceId)(repos);
|
|
272
|
+
const { accountId, checkResult, payAction } = yield MovieTicketPayment.authorize(params, transaction, paymentServiceId)(repos);
|
|
268
273
|
return saveAuthorizeResult({
|
|
269
274
|
id: transaction.id,
|
|
270
|
-
update: Object.assign({ 'object.accountId':
|
|
275
|
+
update: Object.assign({ 'object.accountId': accountId, 'object.paymentMethod.accountId': accountId, 'object.payAction': payAction }, (checkResult !== undefined) ? { 'object.checkResult': checkResult } : undefined)
|
|
271
276
|
})(repos);
|
|
272
277
|
});
|
|
273
278
|
}
|
|
@@ -58,13 +58,15 @@ function createServiceOutput(params) {
|
|
|
58
58
|
throw new factory.errors.ArgumentNull('object.itemOffered.serviceOutput.accessCode');
|
|
59
59
|
}
|
|
60
60
|
paymentAccount = {
|
|
61
|
-
|
|
61
|
+
// 廃止(2023-02-20~)
|
|
62
|
+
// project: { typeOf: product.project.typeOf, id: product.project.id },
|
|
62
63
|
// ひとまず固定
|
|
63
64
|
// 口座は複数のプロダクトに結合する可能性もあり、どのように利用されるかは知らない。ただbalanceを管理するだけ。通貨は知っている。
|
|
64
65
|
typeOf: factory.accountType.Account,
|
|
65
66
|
// ひとまずPermit識別子と口座番号は同一
|
|
66
|
-
accountNumber: identifier
|
|
67
|
-
|
|
67
|
+
accountNumber: identifier
|
|
68
|
+
// 廃止(2023-02-16~)
|
|
69
|
+
// accountType: amount.currency
|
|
68
70
|
};
|
|
69
71
|
break;
|
|
70
72
|
case factory.product.ProductType.MembershipService:
|
|
@@ -73,7 +75,10 @@ function createServiceOutput(params) {
|
|
|
73
75
|
default:
|
|
74
76
|
throw new factory.errors.NotImplemented(`Product type ${product.typeOf} not implemented`);
|
|
75
77
|
}
|
|
76
|
-
const issuedThrough = Object.assign({
|
|
78
|
+
const issuedThrough = Object.assign({
|
|
79
|
+
// 廃止(2023-02-20~)
|
|
80
|
+
// project: { typeOf: product.project.typeOf, id: product.project.id },
|
|
81
|
+
typeOf: product.typeOf, id: product.id }, (typeof ((_m = product.serviceType) === null || _m === void 0 ? void 0 : _m.typeOf) === 'string') ? { serviceType: product.serviceType } : undefined);
|
|
77
82
|
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ project: { typeOf: product.project.typeOf, id: product.project.id }, identifier: identifier, issuedThrough, typeOf: serviceOutputType, dateIssued: params.dateIssued }, (typeof accessCode === 'string') ? { accessCode } : undefined), (Array.isArray(additionalProperty)) ? { additionalProperty } : undefined), (typeof validFor === 'string') ? { validFor } : undefined), (name !== undefined) ? { name } : undefined), (amount !== undefined) ? { amount } : undefined), (depositAmount !== undefined) ? { depositAmount } : undefined), (paymentAmount !== undefined) ? { paymentAmount } : undefined), (paymentAccount !== undefined) ? { paymentAccount } : undefined), (issuedBy !== undefined) ? { issuedBy } : undefined);
|
|
78
83
|
}
|
|
79
84
|
exports.createServiceOutput = createServiceOutput;
|
|
@@ -117,7 +117,9 @@ function addReservations(params) {
|
|
|
117
117
|
event: { id: event.id },
|
|
118
118
|
// 対応アプリケーション条件追加(2023-01-27~)
|
|
119
119
|
store: { id: (_a = params.availableAtOrFrom) === null || _a === void 0 ? void 0 : _a.id },
|
|
120
|
+
onlyValid: true,
|
|
120
121
|
sort: false,
|
|
122
|
+
addSortIndex: false,
|
|
121
123
|
validateOfferRateLimit: true
|
|
122
124
|
})(repos);
|
|
123
125
|
ticketOffers = searchEventTicketOffersResult.ticketOffers;
|
|
@@ -88,7 +88,10 @@ function createGivePointAwardStartParams4moneyTransfer(params, transactionNumber
|
|
|
88
88
|
: params.purpose.typeOf,
|
|
89
89
|
fromLocation: agent,
|
|
90
90
|
toLocation,
|
|
91
|
-
pendingTransaction: {
|
|
91
|
+
pendingTransaction: {
|
|
92
|
+
typeOf: factory.account.transactionType.Deposit,
|
|
93
|
+
transactionNumber
|
|
94
|
+
}
|
|
92
95
|
} }, (typeof params.object.identifier === 'string') ? { identifier: params.object.identifier } : undefined);
|
|
93
96
|
}
|
|
94
97
|
/**
|
|
@@ -181,7 +184,10 @@ function processReturnPointAwardByTransactionIdentifier(params) {
|
|
|
181
184
|
fromLocation,
|
|
182
185
|
toLocation: depositTransaction.object.fromLocation,
|
|
183
186
|
description: `[Return Award]${depositTransaction.object.description}`,
|
|
184
|
-
pendingTransaction: {
|
|
187
|
+
pendingTransaction: {
|
|
188
|
+
typeOf: factory.account.transactionType.Withdraw,
|
|
189
|
+
transactionNumber
|
|
190
|
+
},
|
|
185
191
|
force: true
|
|
186
192
|
}
|
|
187
193
|
})(repos);
|
|
@@ -260,7 +266,10 @@ function processReturnPointAwardByTransactionFromLocationIdentifier(params) {
|
|
|
260
266
|
// },
|
|
261
267
|
toLocation,
|
|
262
268
|
description: `[Return Award]${returningTransaction.object.description}`,
|
|
263
|
-
pendingTransaction: {
|
|
269
|
+
pendingTransaction: {
|
|
270
|
+
typeOf: factory.account.transactionType.Transfer,
|
|
271
|
+
transactionNumber
|
|
272
|
+
},
|
|
264
273
|
force: true
|
|
265
274
|
}
|
|
266
275
|
})(repos);
|
|
@@ -21,6 +21,7 @@ const difference = require("lodash.difference");
|
|
|
21
21
|
const moment = require("moment-timezone");
|
|
22
22
|
const credentials_1 = require("../credentials");
|
|
23
23
|
const factory = require("../factory");
|
|
24
|
+
const settings_1 = require("../settings");
|
|
24
25
|
const offer_1 = require("./offer");
|
|
25
26
|
// const customsearch = google.customsearch('v1');
|
|
26
27
|
const debug = createDebug('chevre-domain:service:event');
|
|
@@ -449,32 +450,11 @@ function createScreeningEventFromCOA(params) {
|
|
|
449
450
|
priceCurrency: factory.priceCurrency.JPY
|
|
450
451
|
};
|
|
451
452
|
const { additionalProperty, coaInfo } = createScreeningEventAdditionalPropertyFromCOA(params);
|
|
452
|
-
return {
|
|
453
|
-
project: { typeOf: params.project.typeOf, id: params.project.id },
|
|
454
|
-
typeOf: factory.eventType.ScreeningEvent,
|
|
455
|
-
id: id,
|
|
456
|
-
identifier: id,
|
|
457
|
-
name: params.superEvent.name,
|
|
458
|
-
eventStatus: factory.eventStatusType.EventScheduled,
|
|
459
|
-
workPerformed: params.superEvent.workPerformed,
|
|
460
|
-
location: {
|
|
461
|
-
// 不要なので廃止(2022-12-19~)
|
|
462
|
-
// project: { typeOf: params.project.typeOf, id: params.project.id },
|
|
453
|
+
return Object.assign({ project: { typeOf: params.project.typeOf, id: params.project.id }, typeOf: factory.eventType.ScreeningEvent, id: id, identifier: id, name: params.superEvent.name, eventStatus: factory.eventStatusType.EventScheduled, location: {
|
|
463
454
|
typeOf: params.screenRoom.typeOf,
|
|
464
455
|
branchCode: params.screenRoom.branchCode,
|
|
465
456
|
name: params.screenRoom.name
|
|
466
|
-
},
|
|
467
|
-
endDate: endDate,
|
|
468
|
-
startDate: startDate,
|
|
469
|
-
superEvent: params.superEvent,
|
|
470
|
-
coaInfo,
|
|
471
|
-
offers: offers,
|
|
472
|
-
checkInCount: 0,
|
|
473
|
-
attendeeCount: 0,
|
|
474
|
-
maximumAttendeeCapacity: params.screenRoom.maximumAttendeeCapacity,
|
|
475
|
-
remainingAttendeeCapacity: params.screenRoom.maximumAttendeeCapacity,
|
|
476
|
-
additionalProperty
|
|
477
|
-
};
|
|
457
|
+
}, endDate: endDate, startDate: startDate, superEvent: params.superEvent, coaInfo, offers: offers, checkInCount: 0, attendeeCount: 0, maximumAttendeeCapacity: params.screenRoom.maximumAttendeeCapacity, remainingAttendeeCapacity: params.screenRoom.maximumAttendeeCapacity, additionalProperty }, (settings_1.settings.useEventWorkPerformed) ? { workPerformed: params.superEvent.workPerformed } : undefined);
|
|
478
458
|
}
|
|
479
459
|
function createScreeningEventAdditionalPropertyFromCOA(params) {
|
|
480
460
|
const coaInfo = {
|
|
@@ -28,9 +28,9 @@ function authorize(params) {
|
|
|
28
28
|
id: params.purpose.id
|
|
29
29
|
});
|
|
30
30
|
// 口座取引開始
|
|
31
|
-
let pendingTransaction;
|
|
31
|
+
// let pendingTransaction: factory.action.transfer.moneyTransfer.IPendingTransaction;
|
|
32
32
|
try {
|
|
33
|
-
|
|
33
|
+
yield processAccountTransaction({
|
|
34
34
|
typeOf: params.typeOf,
|
|
35
35
|
identifier: params.identifier,
|
|
36
36
|
transactionNumber: params.transactionNumber,
|
|
@@ -46,13 +46,12 @@ function authorize(params) {
|
|
|
46
46
|
error = (0, errorHandler_1.handlePecorinoError)(error);
|
|
47
47
|
throw error;
|
|
48
48
|
}
|
|
49
|
-
return pendingTransaction;
|
|
49
|
+
// return pendingTransaction;
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
exports.authorize = authorize;
|
|
53
53
|
function processAccountTransaction(params) {
|
|
54
54
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
55
|
-
let pendingTransaction;
|
|
56
55
|
const transaction = params.transaction;
|
|
57
56
|
const agent = createAccountTransactionAgent(params);
|
|
58
57
|
const recipient = createAccountTransactionRecipient(params);
|
|
@@ -75,7 +74,7 @@ function processAccountTransaction(params) {
|
|
|
75
74
|
});
|
|
76
75
|
switch (params.typeOf) {
|
|
77
76
|
case factory.account.transactionType.Deposit:
|
|
78
|
-
|
|
77
|
+
yield processDepositTransaction({
|
|
79
78
|
identifier: params.identifier,
|
|
80
79
|
transactionNumber: params.transactionNumber,
|
|
81
80
|
project: params.project,
|
|
@@ -88,7 +87,7 @@ function processAccountTransaction(params) {
|
|
|
88
87
|
})({ permit: permitService });
|
|
89
88
|
break;
|
|
90
89
|
case factory.account.transactionType.Transfer:
|
|
91
|
-
|
|
90
|
+
yield processTransferTransaction({
|
|
92
91
|
identifier: params.identifier,
|
|
93
92
|
transactionNumber: params.transactionNumber,
|
|
94
93
|
project: params.project,
|
|
@@ -101,7 +100,7 @@ function processAccountTransaction(params) {
|
|
|
101
100
|
})({ permit: permitService });
|
|
102
101
|
break;
|
|
103
102
|
case factory.account.transactionType.Withdraw:
|
|
104
|
-
|
|
103
|
+
yield processWithdrawTransaction({
|
|
105
104
|
identifier: params.identifier,
|
|
106
105
|
transactionNumber: params.transactionNumber,
|
|
107
106
|
project: params.project,
|
|
@@ -116,7 +115,7 @@ function processAccountTransaction(params) {
|
|
|
116
115
|
default:
|
|
117
116
|
throw new factory.errors.Argument('Object', 'At least one of accounts from and to must be specified');
|
|
118
117
|
}
|
|
119
|
-
return pendingTransaction;
|
|
118
|
+
// return pendingTransaction;
|
|
120
119
|
});
|
|
121
120
|
}
|
|
122
121
|
function processDepositTransaction(params) {
|
|
@@ -223,9 +223,10 @@ function validateAcceptedOffers(params) {
|
|
|
223
223
|
// 受け入れたオファーIDだけ取得する(2023-01-26~)
|
|
224
224
|
ids: offerIds,
|
|
225
225
|
event: { id: params.event.id },
|
|
226
|
-
// seller: params.seller,
|
|
227
226
|
store: params.store,
|
|
227
|
+
onlyValid: true,
|
|
228
228
|
sort: false,
|
|
229
|
+
addSortIndex: false,
|
|
229
230
|
validateOfferRateLimit: true
|
|
230
231
|
})(repos);
|
|
231
232
|
// 利用可能なチケットオファーであれば受け入れる
|
|
@@ -294,7 +294,7 @@ function coaTicket2offer(params) {
|
|
|
294
294
|
const eligibleMembershipType = (params.ticketResult.flgMember === COA.factory.master.FlgMember.Member
|
|
295
295
|
&& typeof ((_b = params.defaultMembershipType) === null || _b === void 0 ? void 0 : _b.typeOf) === 'string')
|
|
296
296
|
? [{
|
|
297
|
-
project: params.defaultMembershipType.project,
|
|
297
|
+
// project: params.defaultMembershipType.project,
|
|
298
298
|
typeOf: params.defaultMembershipType.typeOf,
|
|
299
299
|
id: params.defaultMembershipType.id,
|
|
300
300
|
codeValue: params.defaultMembershipType.codeValue,
|
|
@@ -13,6 +13,7 @@ interface ISearchEventTicketOffersRepos {
|
|
|
13
13
|
}
|
|
14
14
|
declare type ISearchEventTicketOffersOperation<T> = (repos: ISearchEventTicketOffersRepos) => Promise<T>;
|
|
15
15
|
declare type IAcceptedPaymentMethod = factory.paymentMethod.paymentCard.movieTicket.IMovieTicket;
|
|
16
|
+
declare type ITicketOfferWithSortIndex = factory.product.ITicketOffer;
|
|
16
17
|
/**
|
|
17
18
|
* 興行オファー検索
|
|
18
19
|
*/
|
|
@@ -27,10 +28,6 @@ declare function searchEventTicketOffers(params: {
|
|
|
27
28
|
event: {
|
|
28
29
|
id: string;
|
|
29
30
|
};
|
|
30
|
-
/**
|
|
31
|
-
* どの販売者に対して
|
|
32
|
-
* 不要なので廃止(2023-01-27~)
|
|
33
|
-
*/
|
|
34
31
|
/**
|
|
35
32
|
* どのアプリケーションに対して
|
|
36
33
|
*/
|
|
@@ -40,7 +37,7 @@ declare function searchEventTicketOffers(params: {
|
|
|
40
37
|
/**
|
|
41
38
|
* 有効期間内のみかどうか
|
|
42
39
|
*/
|
|
43
|
-
onlyValid
|
|
40
|
+
onlyValid: boolean;
|
|
44
41
|
/**
|
|
45
42
|
* どの決済方法に対して
|
|
46
43
|
*/
|
|
@@ -74,10 +71,13 @@ declare function searchEventTicketOffers(params: {
|
|
|
74
71
|
*/
|
|
75
72
|
kbnEisyahousiki: string;
|
|
76
73
|
};
|
|
74
|
+
limit?: number;
|
|
75
|
+
page?: number;
|
|
77
76
|
sort: boolean;
|
|
77
|
+
addSortIndex: boolean;
|
|
78
78
|
validateOfferRateLimit: boolean;
|
|
79
79
|
}): ISearchEventTicketOffersOperation<{
|
|
80
|
-
ticketOffers:
|
|
80
|
+
ticketOffers: ITicketOfferWithSortIndex[];
|
|
81
81
|
unitPriceOffers: factory.unitPriceOffer.IUnitPriceOffer[];
|
|
82
82
|
}>;
|
|
83
83
|
export { searchEventTicketOffers };
|