@chevre/domain 21.2.0-alpha.97 → 21.2.0-alpha.99
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/processPay.ts +5 -2
- package/example/src/chevre/searchActions.ts +33 -0
- package/lib/chevre/repo/action.js +50 -32
- package/lib/chevre/repo/mongoose/schemas/action.js +12 -0
- package/lib/chevre/service/assetTransaction/pay.d.ts +5 -1
- package/lib/chevre/service/assetTransaction/pay.js +5 -5
- package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +1 -2
- package/lib/chevre/service/assetTransaction/reserve/factory.js +44 -27
- package/lib/chevre/service/assetTransaction/reserve.d.ts +1 -0
- package/lib/chevre/service/assetTransaction/reserve.js +23 -21
- package/lib/chevre/service/offer/event/authorize.js +1 -0
- package/lib/chevre/service/offer/event/factory.d.ts +1 -0
- package/lib/chevre/service/offer/event/factory.js +14 -3
- package/lib/chevre/service/payment/any.d.ts +9 -6
- package/lib/chevre/service/payment/any.js +6 -2
- package/lib/chevre/service/payment/movieTicket/checkByIdentifier.d.ts +7 -6
- package/lib/chevre/service/payment/movieTicket/validation.d.ts +3 -4
- package/lib/chevre/service/payment/movieTicket/validation.js +40 -6
- package/lib/chevre/service/payment/movieTicket.d.ts +1 -1
- package/lib/chevre/service/payment/movieTicket.js +2 -2
- package/lib/chevre/service/transaction/orderProgramMembership.js +6 -3
- package/package.json +3 -3
- package/example/src/chevre/searchAssetTransactions.ts +0 -30
|
@@ -63,8 +63,11 @@ async function main() {
|
|
|
63
63
|
name: 'xx'
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
{
|
|
67
|
+
useCheckMovieTicketBeforePay: true,
|
|
68
|
+
useCheckByIdentifierIfNotYet: true,
|
|
69
|
+
searchTrade4accountId: false
|
|
70
|
+
}
|
|
68
71
|
)({
|
|
69
72
|
accountingReport: accountingReportRepo,
|
|
70
73
|
action: actionRepo,
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// tslint:disable:no-implicit-dependencies no-console
|
|
2
|
+
import { chevre } from '../../../lib/index';
|
|
3
|
+
|
|
4
|
+
import * as mongoose from 'mongoose';
|
|
5
|
+
|
|
6
|
+
// const project = { id: String(process.env.PROJECT_ID) };
|
|
7
|
+
|
|
8
|
+
async function main() {
|
|
9
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: true });
|
|
10
|
+
|
|
11
|
+
const actionRepo = new chevre.repository.Action(mongoose.connection);
|
|
12
|
+
const actions = await actionRepo.search(
|
|
13
|
+
{
|
|
14
|
+
typeOf: { $eq: chevre.factory.actionType.CheckAction },
|
|
15
|
+
// project: { id: { $eq: project.id } },
|
|
16
|
+
object: {
|
|
17
|
+
movieTickets: {
|
|
18
|
+
identifier: { $eq: '0947524082' },
|
|
19
|
+
serviceOutput: { reservationFor: { id: { $eq: 'clhvvbpyn' } } }
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
['_id'],
|
|
24
|
+
[]
|
|
25
|
+
);
|
|
26
|
+
console.log('actions:', actions);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
main()
|
|
30
|
+
.then(() => {
|
|
31
|
+
console.log('success!');
|
|
32
|
+
})
|
|
33
|
+
.catch(console.error);
|
|
@@ -21,7 +21,7 @@ class MongoRepository {
|
|
|
21
21
|
}
|
|
22
22
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
23
23
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
24
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _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, _56, _57;
|
|
24
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _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, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65;
|
|
25
25
|
const andConditions = [];
|
|
26
26
|
const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
27
27
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
@@ -75,9 +75,27 @@ class MongoRepository {
|
|
|
75
75
|
}
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
|
+
const objectMovieTicketsIdentifierEq = (_o = (_m = (_l = params.object) === null || _l === void 0 ? void 0 : _l.movieTickets) === null || _m === void 0 ? void 0 : _m.identifier) === null || _o === void 0 ? void 0 : _o.$eq;
|
|
79
|
+
if (typeof objectMovieTicketsIdentifierEq === 'string') {
|
|
80
|
+
andConditions.push({
|
|
81
|
+
'object.movieTickets.identifier': {
|
|
82
|
+
$exists: true,
|
|
83
|
+
$eq: objectMovieTicketsIdentifierEq
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
const objectMovieTicketsServiceOutputReservationForIdEq = (_t = (_s = (_r = (_q = (_p = params.object) === null || _p === void 0 ? void 0 : _p.movieTickets) === null || _q === void 0 ? void 0 : _q.serviceOutput) === null || _r === void 0 ? void 0 : _r.reservationFor) === null || _s === void 0 ? void 0 : _s.id) === null || _t === void 0 ? void 0 : _t.$eq;
|
|
88
|
+
if (typeof objectMovieTicketsServiceOutputReservationForIdEq === 'string') {
|
|
89
|
+
andConditions.push({
|
|
90
|
+
'object.movieTickets.serviceOutput.reservationFor.id': {
|
|
91
|
+
$exists: true,
|
|
92
|
+
$eq: objectMovieTicketsServiceOutputReservationForIdEq
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
78
96
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
79
97
|
/* istanbul ignore else */
|
|
80
|
-
const objectPaymentMethodIdEq = (
|
|
98
|
+
const objectPaymentMethodIdEq = (_v = (_u = params.object) === null || _u === void 0 ? void 0 : _u.paymentMethodId) === null || _v === void 0 ? void 0 : _v.$eq;
|
|
81
99
|
if (typeof objectPaymentMethodIdEq === 'string') {
|
|
82
100
|
andConditions.push({
|
|
83
101
|
'object.paymentMethodId': {
|
|
@@ -86,7 +104,7 @@ class MongoRepository {
|
|
|
86
104
|
}
|
|
87
105
|
});
|
|
88
106
|
}
|
|
89
|
-
const objectObjectPaymentMethodIdEq = (
|
|
107
|
+
const objectObjectPaymentMethodIdEq = (_y = (_x = (_w = params.object) === null || _w === void 0 ? void 0 : _w.object) === null || _x === void 0 ? void 0 : _x.paymentMethodId) === null || _y === void 0 ? void 0 : _y.$eq;
|
|
90
108
|
if (typeof objectObjectPaymentMethodIdEq === 'string') {
|
|
91
109
|
andConditions.push({
|
|
92
110
|
'object.object.paymentMethodId': {
|
|
@@ -95,7 +113,7 @@ class MongoRepository {
|
|
|
95
113
|
}
|
|
96
114
|
});
|
|
97
115
|
}
|
|
98
|
-
const objectReservationForIdEq = (
|
|
116
|
+
const objectReservationForIdEq = (_1 = (_0 = (_z = params.object) === null || _z === void 0 ? void 0 : _z.reservationFor) === null || _0 === void 0 ? void 0 : _0.id) === null || _1 === void 0 ? void 0 : _1.$eq;
|
|
99
117
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
100
118
|
/* istanbul ignore else */
|
|
101
119
|
if (typeof objectReservationForIdEq === 'string') {
|
|
@@ -106,7 +124,7 @@ class MongoRepository {
|
|
|
106
124
|
}
|
|
107
125
|
});
|
|
108
126
|
}
|
|
109
|
-
const objectReservationNumberEq = (
|
|
127
|
+
const objectReservationNumberEq = (_3 = (_2 = params.object) === null || _2 === void 0 ? void 0 : _2.reservationNumber) === null || _3 === void 0 ? void 0 : _3.$eq;
|
|
110
128
|
if (typeof objectReservationNumberEq === 'string') {
|
|
111
129
|
andConditions.push({
|
|
112
130
|
'object.reservationNumber': {
|
|
@@ -115,7 +133,7 @@ class MongoRepository {
|
|
|
115
133
|
}
|
|
116
134
|
});
|
|
117
135
|
}
|
|
118
|
-
const objectReservationNumberIn = (
|
|
136
|
+
const objectReservationNumberIn = (_5 = (_4 = params.object) === null || _4 === void 0 ? void 0 : _4.reservationNumber) === null || _5 === void 0 ? void 0 : _5.$in;
|
|
119
137
|
if (Array.isArray(objectReservationNumberIn)) {
|
|
120
138
|
andConditions.push({
|
|
121
139
|
'object.reservationNumber': {
|
|
@@ -124,7 +142,7 @@ class MongoRepository {
|
|
|
124
142
|
}
|
|
125
143
|
});
|
|
126
144
|
}
|
|
127
|
-
const objectPaymentMethodAccountIdEq = (
|
|
145
|
+
const objectPaymentMethodAccountIdEq = (_8 = (_7 = (_6 = params.object) === null || _6 === void 0 ? void 0 : _6.paymentMethod) === null || _7 === void 0 ? void 0 : _7.accountId) === null || _8 === void 0 ? void 0 : _8.$eq;
|
|
128
146
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
129
147
|
/* istanbul ignore else */
|
|
130
148
|
if (typeof objectPaymentMethodAccountIdEq === 'string') {
|
|
@@ -135,7 +153,7 @@ class MongoRepository {
|
|
|
135
153
|
}
|
|
136
154
|
});
|
|
137
155
|
}
|
|
138
|
-
const objectPaymentMethodPaymentMethodIdEq = (
|
|
156
|
+
const objectPaymentMethodPaymentMethodIdEq = (_11 = (_10 = (_9 = params.object) === null || _9 === void 0 ? void 0 : _9.paymentMethod) === null || _10 === void 0 ? void 0 : _10.paymentMethodId) === null || _11 === void 0 ? void 0 : _11.$eq;
|
|
139
157
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
140
158
|
/* istanbul ignore else */
|
|
141
159
|
if (typeof objectPaymentMethodPaymentMethodIdEq === 'string') {
|
|
@@ -146,7 +164,7 @@ class MongoRepository {
|
|
|
146
164
|
}
|
|
147
165
|
});
|
|
148
166
|
}
|
|
149
|
-
const objectPaymentMethodPaymentMethodIdIn = (
|
|
167
|
+
const objectPaymentMethodPaymentMethodIdIn = (_14 = (_13 = (_12 = params.object) === null || _12 === void 0 ? void 0 : _12.paymentMethod) === null || _13 === void 0 ? void 0 : _13.paymentMethodId) === null || _14 === void 0 ? void 0 : _14.$in;
|
|
150
168
|
if (Array.isArray(objectPaymentMethodPaymentMethodIdIn)) {
|
|
151
169
|
andConditions.push({
|
|
152
170
|
'object.paymentMethod.paymentMethodId': {
|
|
@@ -155,7 +173,7 @@ class MongoRepository {
|
|
|
155
173
|
}
|
|
156
174
|
});
|
|
157
175
|
}
|
|
158
|
-
const objectPaymentMethodTypeOfEq = (
|
|
176
|
+
const objectPaymentMethodTypeOfEq = (_17 = (_16 = (_15 = params.object) === null || _15 === void 0 ? void 0 : _15.paymentMethod) === null || _16 === void 0 ? void 0 : _16.typeOf) === null || _17 === void 0 ? void 0 : _17.$eq;
|
|
159
177
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
160
178
|
/* istanbul ignore else */
|
|
161
179
|
if (typeof objectPaymentMethodTypeOfEq === 'string') {
|
|
@@ -166,7 +184,7 @@ class MongoRepository {
|
|
|
166
184
|
}
|
|
167
185
|
});
|
|
168
186
|
}
|
|
169
|
-
const objectTypeOfEq = (
|
|
187
|
+
const objectTypeOfEq = (_19 = (_18 = params.object) === null || _18 === void 0 ? void 0 : _18.typeOf) === null || _19 === void 0 ? void 0 : _19.$eq;
|
|
170
188
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
171
189
|
/* istanbul ignore else */
|
|
172
190
|
if (typeof objectTypeOfEq === 'string') {
|
|
@@ -177,7 +195,7 @@ class MongoRepository {
|
|
|
177
195
|
}
|
|
178
196
|
});
|
|
179
197
|
}
|
|
180
|
-
const objectTypeOfIn = (
|
|
198
|
+
const objectTypeOfIn = (_21 = (_20 = params.object) === null || _20 === void 0 ? void 0 : _20.typeOf) === null || _21 === void 0 ? void 0 : _21.$in;
|
|
181
199
|
if (Array.isArray(objectTypeOfIn)) {
|
|
182
200
|
andConditions.push({
|
|
183
201
|
'object.typeOf': {
|
|
@@ -186,7 +204,7 @@ class MongoRepository {
|
|
|
186
204
|
}
|
|
187
205
|
});
|
|
188
206
|
}
|
|
189
|
-
const objectIdEq = (
|
|
207
|
+
const objectIdEq = (_23 = (_22 = params.object) === null || _22 === void 0 ? void 0 : _22.id) === null || _23 === void 0 ? void 0 : _23.$eq;
|
|
190
208
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
191
209
|
/* istanbul ignore else */
|
|
192
210
|
if (typeof objectIdEq === 'string') {
|
|
@@ -197,7 +215,7 @@ class MongoRepository {
|
|
|
197
215
|
}
|
|
198
216
|
});
|
|
199
217
|
}
|
|
200
|
-
const objectIdIn = (
|
|
218
|
+
const objectIdIn = (_25 = (_24 = params.object) === null || _24 === void 0 ? void 0 : _24.id) === null || _25 === void 0 ? void 0 : _25.$in;
|
|
201
219
|
if (Array.isArray(objectIdIn)) {
|
|
202
220
|
andConditions.push({
|
|
203
221
|
'object.id': {
|
|
@@ -206,7 +224,7 @@ class MongoRepository {
|
|
|
206
224
|
}
|
|
207
225
|
});
|
|
208
226
|
}
|
|
209
|
-
const objectOrderNumberIn = (
|
|
227
|
+
const objectOrderNumberIn = (_27 = (_26 = params.object) === null || _26 === void 0 ? void 0 : _26.orderNumber) === null || _27 === void 0 ? void 0 : _27.$in;
|
|
210
228
|
if (Array.isArray(objectOrderNumberIn)) {
|
|
211
229
|
andConditions.push({
|
|
212
230
|
'object.orderNumber': {
|
|
@@ -215,7 +233,7 @@ class MongoRepository {
|
|
|
215
233
|
}
|
|
216
234
|
});
|
|
217
235
|
}
|
|
218
|
-
const objectEventIdIn = (
|
|
236
|
+
const objectEventIdIn = (_30 = (_29 = (_28 = params.object) === null || _28 === void 0 ? void 0 : _28.event) === null || _29 === void 0 ? void 0 : _29.id) === null || _30 === void 0 ? void 0 : _30.$in;
|
|
219
237
|
if (Array.isArray(objectEventIdIn)) {
|
|
220
238
|
andConditions.push({
|
|
221
239
|
'object.event.id': {
|
|
@@ -224,7 +242,7 @@ class MongoRepository {
|
|
|
224
242
|
}
|
|
225
243
|
});
|
|
226
244
|
}
|
|
227
|
-
const objectAcceptedOfferSeatNumberIn = (
|
|
245
|
+
const objectAcceptedOfferSeatNumberIn = (_37 = (_36 = (_35 = (_34 = (_33 = (_32 = (_31 = params.object) === null || _31 === void 0 ? void 0 : _31.acceptedOffer) === null || _32 === void 0 ? void 0 : _32.itemOffered) === null || _33 === void 0 ? void 0 : _33.serviceOutput) === null || _34 === void 0 ? void 0 : _34.reservedTicket) === null || _35 === void 0 ? void 0 : _35.ticketedSeat) === null || _36 === void 0 ? void 0 : _36.seatNumber) === null || _37 === void 0 ? void 0 : _37.$in;
|
|
228
246
|
if (Array.isArray(objectAcceptedOfferSeatNumberIn)) {
|
|
229
247
|
andConditions.push({
|
|
230
248
|
'object.acceptedOffer.itemOffered.serviceOutput.reservedTicket.ticketedSeat.seatNumber': {
|
|
@@ -241,7 +259,7 @@ class MongoRepository {
|
|
|
241
259
|
});
|
|
242
260
|
}
|
|
243
261
|
else {
|
|
244
|
-
const typeOfEq = (
|
|
262
|
+
const typeOfEq = (_38 = params.typeOf) === null || _38 === void 0 ? void 0 : _38.$eq;
|
|
245
263
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
246
264
|
/* istanbul ignore else */
|
|
247
265
|
if (typeof typeOfEq === 'string') {
|
|
@@ -250,7 +268,7 @@ class MongoRepository {
|
|
|
250
268
|
});
|
|
251
269
|
}
|
|
252
270
|
}
|
|
253
|
-
const actionStatusIn = (
|
|
271
|
+
const actionStatusIn = (_39 = params.actionStatus) === null || _39 === void 0 ? void 0 : _39.$in;
|
|
254
272
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
255
273
|
/* istanbul ignore else */
|
|
256
274
|
if (Array.isArray(actionStatusIn)) {
|
|
@@ -281,7 +299,7 @@ class MongoRepository {
|
|
|
281
299
|
startDate: { $lte: startDateLte }
|
|
282
300
|
});
|
|
283
301
|
}
|
|
284
|
-
const fromLocationTypeOfIn = (
|
|
302
|
+
const fromLocationTypeOfIn = (_41 = (_40 = params.fromLocation) === null || _40 === void 0 ? void 0 : _40.typeOf) === null || _41 === void 0 ? void 0 : _41.$in;
|
|
285
303
|
if (Array.isArray(fromLocationTypeOfIn)) {
|
|
286
304
|
andConditions.push({
|
|
287
305
|
'fromLocation.typeOf': {
|
|
@@ -290,7 +308,7 @@ class MongoRepository {
|
|
|
290
308
|
}
|
|
291
309
|
});
|
|
292
310
|
}
|
|
293
|
-
const fromLocationAccountNumberIn = (
|
|
311
|
+
const fromLocationAccountNumberIn = (_43 = (_42 = params.fromLocation) === null || _42 === void 0 ? void 0 : _42.accountNumber) === null || _43 === void 0 ? void 0 : _43.$in;
|
|
294
312
|
if (Array.isArray(fromLocationAccountNumberIn)) {
|
|
295
313
|
andConditions.push({
|
|
296
314
|
'fromLocation.accountNumber': {
|
|
@@ -299,7 +317,7 @@ class MongoRepository {
|
|
|
299
317
|
}
|
|
300
318
|
});
|
|
301
319
|
}
|
|
302
|
-
const fromLocationAccountTypeIn = (
|
|
320
|
+
const fromLocationAccountTypeIn = (_45 = (_44 = params.fromLocation) === null || _44 === void 0 ? void 0 : _44.accountType) === null || _45 === void 0 ? void 0 : _45.$in;
|
|
303
321
|
if (Array.isArray(fromLocationAccountTypeIn)) {
|
|
304
322
|
andConditions.push({
|
|
305
323
|
'fromLocation.accountType': {
|
|
@@ -308,7 +326,7 @@ class MongoRepository {
|
|
|
308
326
|
}
|
|
309
327
|
});
|
|
310
328
|
}
|
|
311
|
-
const toLocationTypeOfIn = (
|
|
329
|
+
const toLocationTypeOfIn = (_47 = (_46 = params.toLocation) === null || _46 === void 0 ? void 0 : _46.typeOf) === null || _47 === void 0 ? void 0 : _47.$in;
|
|
312
330
|
if (Array.isArray(toLocationTypeOfIn)) {
|
|
313
331
|
andConditions.push({
|
|
314
332
|
'toLocation.typeOf': {
|
|
@@ -317,7 +335,7 @@ class MongoRepository {
|
|
|
317
335
|
}
|
|
318
336
|
});
|
|
319
337
|
}
|
|
320
|
-
const toLocationAccountNumberIn = (
|
|
338
|
+
const toLocationAccountNumberIn = (_49 = (_48 = params.toLocation) === null || _48 === void 0 ? void 0 : _48.accountNumber) === null || _49 === void 0 ? void 0 : _49.$in;
|
|
321
339
|
if (Array.isArray(toLocationAccountNumberIn)) {
|
|
322
340
|
andConditions.push({
|
|
323
341
|
'toLocation.accountNumber': {
|
|
@@ -326,7 +344,7 @@ class MongoRepository {
|
|
|
326
344
|
}
|
|
327
345
|
});
|
|
328
346
|
}
|
|
329
|
-
const toLocationAccountTypeIn = (
|
|
347
|
+
const toLocationAccountTypeIn = (_51 = (_50 = params.toLocation) === null || _50 === void 0 ? void 0 : _50.accountType) === null || _51 === void 0 ? void 0 : _51.$in;
|
|
330
348
|
if (Array.isArray(toLocationAccountTypeIn)) {
|
|
331
349
|
andConditions.push({
|
|
332
350
|
'toLocation.accountType': {
|
|
@@ -335,7 +353,7 @@ class MongoRepository {
|
|
|
335
353
|
}
|
|
336
354
|
});
|
|
337
355
|
}
|
|
338
|
-
const purposeTypeOfIn = (
|
|
356
|
+
const purposeTypeOfIn = (_53 = (_52 = params.purpose) === null || _52 === void 0 ? void 0 : _52.typeOf) === null || _53 === void 0 ? void 0 : _53.$in;
|
|
339
357
|
if (Array.isArray(purposeTypeOfIn)) {
|
|
340
358
|
andConditions.push({
|
|
341
359
|
'purpose.typeOf': {
|
|
@@ -344,7 +362,7 @@ class MongoRepository {
|
|
|
344
362
|
}
|
|
345
363
|
});
|
|
346
364
|
}
|
|
347
|
-
const purposeIdIn = (
|
|
365
|
+
const purposeIdIn = (_55 = (_54 = params.purpose) === null || _54 === void 0 ? void 0 : _54.id) === null || _55 === void 0 ? void 0 : _55.$in;
|
|
348
366
|
if (Array.isArray(purposeIdIn)) {
|
|
349
367
|
andConditions.push({
|
|
350
368
|
'purpose.id': {
|
|
@@ -353,7 +371,7 @@ class MongoRepository {
|
|
|
353
371
|
}
|
|
354
372
|
});
|
|
355
373
|
}
|
|
356
|
-
const purposeOrderNumberIn = (
|
|
374
|
+
const purposeOrderNumberIn = (_57 = (_56 = params.purpose) === null || _56 === void 0 ? void 0 : _56.orderNumber) === null || _57 === void 0 ? void 0 : _57.$in;
|
|
357
375
|
if (Array.isArray(purposeOrderNumberIn)) {
|
|
358
376
|
andConditions.push({
|
|
359
377
|
'purpose.orderNumber': {
|
|
@@ -362,7 +380,7 @@ class MongoRepository {
|
|
|
362
380
|
}
|
|
363
381
|
});
|
|
364
382
|
}
|
|
365
|
-
const resultTypeOfIn = (
|
|
383
|
+
const resultTypeOfIn = (_59 = (_58 = params.result) === null || _58 === void 0 ? void 0 : _58.typeOf) === null || _59 === void 0 ? void 0 : _59.$in;
|
|
366
384
|
if (Array.isArray(resultTypeOfIn)) {
|
|
367
385
|
andConditions.push({
|
|
368
386
|
'result.typeOf': {
|
|
@@ -371,7 +389,7 @@ class MongoRepository {
|
|
|
371
389
|
}
|
|
372
390
|
});
|
|
373
391
|
}
|
|
374
|
-
const resultIdIn = (
|
|
392
|
+
const resultIdIn = (_61 = (_60 = params.result) === null || _60 === void 0 ? void 0 : _60.id) === null || _61 === void 0 ? void 0 : _61.$in;
|
|
375
393
|
if (Array.isArray(resultIdIn)) {
|
|
376
394
|
andConditions.push({
|
|
377
395
|
'result.id': {
|
|
@@ -380,7 +398,7 @@ class MongoRepository {
|
|
|
380
398
|
}
|
|
381
399
|
});
|
|
382
400
|
}
|
|
383
|
-
const resultOrderNumberIn = (
|
|
401
|
+
const resultOrderNumberIn = (_63 = (_62 = params.result) === null || _62 === void 0 ? void 0 : _62.orderNumber) === null || _63 === void 0 ? void 0 : _63.$in;
|
|
384
402
|
if (Array.isArray(resultOrderNumberIn)) {
|
|
385
403
|
andConditions.push({
|
|
386
404
|
'result.orderNumber': {
|
|
@@ -389,7 +407,7 @@ class MongoRepository {
|
|
|
389
407
|
}
|
|
390
408
|
});
|
|
391
409
|
}
|
|
392
|
-
const resultCodeIn = (
|
|
410
|
+
const resultCodeIn = (_65 = (_64 = params.result) === null || _64 === void 0 ? void 0 : _64.code) === null || _65 === void 0 ? void 0 : _65.$in;
|
|
393
411
|
if (Array.isArray(resultCodeIn)) {
|
|
394
412
|
andConditions.push({
|
|
395
413
|
'result.code': {
|
|
@@ -117,6 +117,18 @@ schema.index({ 'object.id': 1, startDate: -1 }, {
|
|
|
117
117
|
'object.id': { $exists: true }
|
|
118
118
|
}
|
|
119
119
|
});
|
|
120
|
+
schema.index({ 'object.movieTickets.identifier': 1, startDate: -1 }, {
|
|
121
|
+
name: 'searchByObjectMovieTicketsIdentifier',
|
|
122
|
+
partialFilterExpression: {
|
|
123
|
+
'object.movieTickets.identifier': { $exists: true }
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
schema.index({ 'object.movieTickets.serviceOutput.reservationFor.id': 1, startDate: -1 }, {
|
|
127
|
+
name: 'searchByObjectMovieTicketsServiceOutputReservationForId',
|
|
128
|
+
partialFilterExpression: {
|
|
129
|
+
'object.movieTickets.serviceOutput.reservationFor.id': { $exists: true }
|
|
130
|
+
}
|
|
131
|
+
});
|
|
120
132
|
schema.index({ 'object.paymentMethod.accountId': 1, startDate: -1 }, {
|
|
121
133
|
name: 'searchByObjectPaymentMethodAccountId',
|
|
122
134
|
partialFilterExpression: {
|
|
@@ -96,7 +96,11 @@ export declare function check(params: factory.action.check.paymentMethod.movieTi
|
|
|
96
96
|
/**
|
|
97
97
|
* 取引開始
|
|
98
98
|
*/
|
|
99
|
-
export declare function start(params: factory.assetTransaction.pay.IStartParamsWithoutDetail,
|
|
99
|
+
export declare function start(params: factory.assetTransaction.pay.IStartParamsWithoutDetail, options: {
|
|
100
|
+
useCheckMovieTicketBeforePay: boolean;
|
|
101
|
+
useCheckByIdentifierIfNotYet: boolean;
|
|
102
|
+
searchTrade4accountId: boolean;
|
|
103
|
+
}): IStartOperation<factory.assetTransaction.pay.ITransaction>;
|
|
100
104
|
/**
|
|
101
105
|
* 取引確定
|
|
102
106
|
*/
|
|
@@ -106,7 +106,7 @@ exports.check = check;
|
|
|
106
106
|
/**
|
|
107
107
|
* 取引開始
|
|
108
108
|
*/
|
|
109
|
-
function start(params,
|
|
109
|
+
function start(params, options) {
|
|
110
110
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
111
111
|
var _a, _b;
|
|
112
112
|
// 金額をfix
|
|
@@ -138,11 +138,11 @@ function start(params, useCheckMovieTicketBeforePay, searchTrade4accountId) {
|
|
|
138
138
|
break;
|
|
139
139
|
case factory.service.paymentService.PaymentServiceType.CreditCard:
|
|
140
140
|
transaction =
|
|
141
|
-
yield processAuthorizeCreditCard(params, transaction, String(paymentService === null || paymentService === void 0 ? void 0 : paymentService.id), searchTrade4accountId)(repos);
|
|
141
|
+
yield processAuthorizeCreditCard(params, transaction, String(paymentService === null || paymentService === void 0 ? void 0 : paymentService.id), options.searchTrade4accountId)(repos);
|
|
142
142
|
break;
|
|
143
143
|
case factory.service.paymentService.PaymentServiceType.MovieTicket:
|
|
144
144
|
transaction =
|
|
145
|
-
yield processAuthorizeMovieTicket(params, transaction, String(paymentService === null || paymentService === void 0 ? void 0 : paymentService.id), useCheckMovieTicketBeforePay)(repos);
|
|
145
|
+
yield processAuthorizeMovieTicket(params, transaction, String(paymentService === null || paymentService === void 0 ? void 0 : paymentService.id), options.useCheckMovieTicketBeforePay, options.useCheckByIdentifierIfNotYet)(repos);
|
|
146
146
|
break;
|
|
147
147
|
default:
|
|
148
148
|
throw new factory.errors.NotImplemented(`Payment service '${paymentServiceType}' not implemented`);
|
|
@@ -271,9 +271,9 @@ function processAuthorizeCreditCard(params, transaction, paymentServiceId, searc
|
|
|
271
271
|
})(repos);
|
|
272
272
|
});
|
|
273
273
|
}
|
|
274
|
-
function processAuthorizeMovieTicket(params, transaction, paymentServiceId, useCheckMovieTicketBeforePay) {
|
|
274
|
+
function processAuthorizeMovieTicket(params, transaction, paymentServiceId, useCheckMovieTicketBeforePay, useCheckByIdentifierIfNotYet) {
|
|
275
275
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
276
|
-
const { accountId, payAction, accountsReceivablesByServiceType } = yield MovieTicketPayment.authorize(params, transaction, paymentServiceId, useCheckMovieTicketBeforePay)(repos);
|
|
276
|
+
const { accountId, payAction, accountsReceivablesByServiceType } = yield MovieTicketPayment.authorize(params, transaction, paymentServiceId, useCheckMovieTicketBeforePay, useCheckByIdentifierIfNotYet)(repos);
|
|
277
277
|
return saveAuthorizeResult({
|
|
278
278
|
id: transaction.id,
|
|
279
279
|
update: {
|
|
@@ -50,7 +50,7 @@ export declare function createReservationFor(params: factory.event.screeningEven
|
|
|
50
50
|
export declare function createIssuedThrough(params: {
|
|
51
51
|
reservationFor: factory.event.screeningEvent.IEvent | factory.event.event.IEvent;
|
|
52
52
|
}): {
|
|
53
|
-
issuedThrough: factory.
|
|
53
|
+
issuedThrough: factory.assetTransaction.reserve.IIssuedThrough;
|
|
54
54
|
};
|
|
55
55
|
export declare function createReservation(params: {
|
|
56
56
|
project: {
|
|
@@ -60,7 +60,6 @@ export declare function createReservation(params: {
|
|
|
60
60
|
id: string;
|
|
61
61
|
reserveDate: Date;
|
|
62
62
|
agent: factory.assetTransaction.reserve.IAgent;
|
|
63
|
-
broker?: factory.reservation.IBroker<factory.reservationType.EventReservation>;
|
|
64
63
|
reservationNumber: string;
|
|
65
64
|
reservationFor: factory.event.screeningEvent.IEvent | factory.event.event.IEvent;
|
|
66
65
|
reservedTicket: factory.reservation.ITicket;
|
|
@@ -394,7 +394,7 @@ function createIssuedThrough(params) {
|
|
|
394
394
|
exports.createIssuedThrough = createIssuedThrough;
|
|
395
395
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
396
396
|
function createReservation(params) {
|
|
397
|
-
var _a, _b
|
|
397
|
+
var _a, _b;
|
|
398
398
|
// 適用メンバーシップ確認
|
|
399
399
|
validateEligibleMembershipType({
|
|
400
400
|
availableOffer: params.availableOffer,
|
|
@@ -409,27 +409,36 @@ function createReservation(params) {
|
|
|
409
409
|
}
|
|
410
410
|
// priceを最適化
|
|
411
411
|
const price4reservation = (0, price_1.createPrice)(params);
|
|
412
|
-
const eventOffers = params.reservationFor.offers;
|
|
413
|
-
// offersは必ず存在するはず
|
|
414
|
-
if (eventOffers === undefined) {
|
|
415
|
-
|
|
416
|
-
}
|
|
417
|
-
const serviceTypeOfIssuedThrough
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
412
|
+
// const eventOffers = <factory.event.screeningEvent.IOffer | undefined>params.reservationFor.offers;
|
|
413
|
+
// // offersは必ず存在するはず
|
|
414
|
+
// if (eventOffers === undefined) {
|
|
415
|
+
// throw new factory.errors.NotFound('reservationFor.offers');
|
|
416
|
+
// }
|
|
417
|
+
// const serviceTypeOfIssuedThrough: factory.reservation.eventReservation.IServiceTypeOfIssuedThrough | undefined
|
|
418
|
+
// = (typeof eventOffers.itemOffered.serviceType?.codeValue === 'string')
|
|
419
|
+
// ? {
|
|
420
|
+
// codeValue: eventOffers.itemOffered.serviceType.codeValue,
|
|
421
|
+
// inCodeSet: {
|
|
422
|
+
// typeOf: 'CategoryCodeSet',
|
|
423
|
+
// identifier: factory.categoryCode.CategorySetIdentifier.ServiceType
|
|
424
|
+
// },
|
|
425
|
+
// typeOf: 'CategoryCode'
|
|
426
|
+
// }
|
|
427
|
+
// : undefined;
|
|
428
|
+
// const availableChannel: factory.reservation.IServiceChannel = eventOffers.itemOffered.availableChannel;
|
|
428
429
|
if (params.reservationFor.typeOf === factory.eventType.ScreeningEvent) {
|
|
429
|
-
const issuedThrough
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
430
|
+
// const issuedThrough: factory.reservation.eventReservation.IIssuedThrough = {
|
|
431
|
+
// typeOf: factory.product.ProductType.EventService,
|
|
432
|
+
// // 興行IDを追加(2022-09-08~)
|
|
433
|
+
// id: eventOffers.itemOffered.id,
|
|
434
|
+
// availableChannel,
|
|
435
|
+
// // issuedThrough.serviceTypeを連携
|
|
436
|
+
// ...(typeof serviceTypeOfIssuedThrough?.typeOf === 'string') ? { serviceType: serviceTypeOfIssuedThrough } : undefined
|
|
437
|
+
// };
|
|
438
|
+
return Object.assign(Object.assign(Object.assign({ project: params.project, typeOf: factory.reservationType.EventReservation, id: params.id,
|
|
439
|
+
// reservationPackage保管に移行(2023-06-06~)
|
|
440
|
+
// issuedThrough,
|
|
441
|
+
additionalProperty: params.additionalProperty, bookingTime: params.reserveDate, modifiedTime: params.reserveDate, numSeats: 1, price: price4reservation, priceCurrency: factory.priceCurrency.JPY, reservationNumber: params.reservationNumber, reservationStatus: factory.reservationStatusType.ReservationPending, reservedTicket: params.reservedTicket,
|
|
433
442
|
// 最適化(2022-12-19~)
|
|
434
443
|
underName: {
|
|
435
444
|
typeOf: params.agent.typeOf,
|
|
@@ -445,15 +454,23 @@ function createReservation(params) {
|
|
|
445
454
|
};
|
|
446
455
|
})
|
|
447
456
|
}
|
|
448
|
-
: undefined), (typeof ((
|
|
457
|
+
: undefined), (typeof ((_a = params.programMembershipUsed) === null || _a === void 0 ? void 0 : _a.identifier) === 'string')
|
|
449
458
|
? { programMembershipUsed: params.programMembershipUsed }
|
|
450
459
|
: undefined);
|
|
451
460
|
}
|
|
452
461
|
else {
|
|
453
|
-
const issuedThrough
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
462
|
+
// const issuedThrough: factory.reservation.busReservation.IIssuedThrough = {
|
|
463
|
+
// typeOf: factory.product.ProductType.Transportation,
|
|
464
|
+
// // 興行IDを追加(2022-09-08~)
|
|
465
|
+
// id: eventOffers.itemOffered.id,
|
|
466
|
+
// availableChannel,
|
|
467
|
+
// // issuedThrough.serviceTypeを連携
|
|
468
|
+
// ...(typeof serviceTypeOfIssuedThrough?.typeOf === 'string') ? { serviceType: serviceTypeOfIssuedThrough } : undefined
|
|
469
|
+
// };
|
|
470
|
+
return Object.assign(Object.assign(Object.assign({ project: params.project, typeOf: factory.reservationType.BusReservation, id: params.id,
|
|
471
|
+
// reservationPackage保管に移行(2023-06-06~)
|
|
472
|
+
// issuedThrough,
|
|
473
|
+
additionalProperty: params.additionalProperty, bookingTime: params.reserveDate, modifiedTime: params.reserveDate, numSeats: 1, price: price4reservation, priceCurrency: factory.priceCurrency.JPY, reservationNumber: params.reservationNumber, reservationStatus: factory.reservationStatusType.ReservationPending, reservedTicket: params.reservedTicket, underName: {
|
|
457
474
|
typeOf: params.agent.typeOf,
|
|
458
475
|
name: params.agent.name
|
|
459
476
|
}, checkedIn: false, attended: false }, (typeof params.additionalTicketText === 'string') ? { additionalTicketText: params.additionalTicketText } : undefined), (Array.isArray(params.subReservation))
|
|
@@ -467,7 +484,7 @@ function createReservation(params) {
|
|
|
467
484
|
};
|
|
468
485
|
})
|
|
469
486
|
}
|
|
470
|
-
: undefined), (typeof ((
|
|
487
|
+
: undefined), (typeof ((_b = params.programMembershipUsed) === null || _b === void 0 ? void 0 : _b.identifier) === 'string')
|
|
471
488
|
? { programMembershipUsed: params.programMembershipUsed }
|
|
472
489
|
: undefined);
|
|
473
490
|
}
|
|
@@ -102,6 +102,7 @@ export declare function start(params: IStartParams & {
|
|
|
102
102
|
}): IStartOperation<{
|
|
103
103
|
transaction: factory.assetTransaction.ITransaction<factory.assetTransactionType.Reserve>;
|
|
104
104
|
objectSubReservations: IObjectSubReservation[];
|
|
105
|
+
issuedThrough: factory.assetTransaction.reserve.IIssuedThrough;
|
|
105
106
|
}>;
|
|
106
107
|
/**
|
|
107
108
|
* 取引確定
|
|
@@ -27,7 +27,7 @@ const validateStartRequest_1 = require("./reserve/validateStartRequest");
|
|
|
27
27
|
*/
|
|
28
28
|
function start(params) {
|
|
29
29
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
30
|
-
var _a, _b, _c, _d
|
|
30
|
+
var _a, _b, _c, _d;
|
|
31
31
|
const now = new Date();
|
|
32
32
|
// 自動発行廃止(2022-05-17~)
|
|
33
33
|
const reservationNumber = params.transactionNumber;
|
|
@@ -35,7 +35,8 @@ function start(params) {
|
|
|
35
35
|
throw new factory.errors.ArgumentNull('transactionNumber');
|
|
36
36
|
}
|
|
37
37
|
// eventをfix
|
|
38
|
-
|
|
38
|
+
const reservationForId = (_a = params.object.reservationFor) === null || _a === void 0 ? void 0 : _a.id;
|
|
39
|
+
if (typeof reservationForId !== 'string' || reservationForId.length === 0) {
|
|
39
40
|
throw new factory.errors.ArgumentNull('object.reservationFor.id');
|
|
40
41
|
}
|
|
41
42
|
let event;
|
|
@@ -43,7 +44,7 @@ function start(params) {
|
|
|
43
44
|
event = params.preSearchedEvent;
|
|
44
45
|
}
|
|
45
46
|
else {
|
|
46
|
-
event = yield repos.event.findMinimizedIndividualEventById({ id:
|
|
47
|
+
event = yield repos.event.findMinimizedIndividualEventById({ id: reservationForId });
|
|
47
48
|
}
|
|
48
49
|
// validationを承認アクション開始前から移行(2023-01-27~)
|
|
49
50
|
(0, validateStartRequest_1.validateStartRequest)({
|
|
@@ -64,22 +65,23 @@ function start(params) {
|
|
|
64
65
|
throw error;
|
|
65
66
|
}
|
|
66
67
|
let objectSubReservations = [];
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
68
|
+
const addReservationsResult = yield addReservations({
|
|
69
|
+
id: transaction.id,
|
|
70
|
+
object: params.object,
|
|
71
|
+
event,
|
|
72
|
+
preSearchedTicketOffers: params.preSearchedTicketOffers,
|
|
73
|
+
preSearchedUnitPriceOffers: params.preSearchedUnitPriceOffers,
|
|
74
|
+
availableAtOrFrom: { id: (_d = params.availableAtOrFrom) === null || _d === void 0 ? void 0 : _d.id },
|
|
75
|
+
validateAppliesToMovieTicket: params.validateAppliesToMovieTicket,
|
|
76
|
+
stockHoldUntilDaysAfterEventEnd: params.stockHoldUntilDaysAfterEventEnd
|
|
77
|
+
})(repos);
|
|
78
|
+
transaction = addReservationsResult.transaction;
|
|
79
|
+
objectSubReservations = addReservationsResult.objectSubReservations;
|
|
80
|
+
return {
|
|
81
|
+
transaction,
|
|
82
|
+
objectSubReservations,
|
|
83
|
+
issuedThrough: addReservationsResult.issuedThrough
|
|
84
|
+
};
|
|
83
85
|
});
|
|
84
86
|
}
|
|
85
87
|
exports.start = start;
|
|
@@ -195,7 +197,7 @@ function addReservations(params) {
|
|
|
195
197
|
}
|
|
196
198
|
// ストックホルダー処理(stockHolderで残席数を集計しているので必要)
|
|
197
199
|
yield onReservationsCreated({ event })(repos);
|
|
198
|
-
return { transaction, objectSubReservations };
|
|
200
|
+
return { transaction, objectSubReservations, issuedThrough };
|
|
199
201
|
});
|
|
200
202
|
}
|
|
201
203
|
/**
|
|
@@ -412,7 +414,7 @@ function createReservations4transactionObject(params) {
|
|
|
412
414
|
id: reservationId,
|
|
413
415
|
reserveDate: params.now,
|
|
414
416
|
agent: params.transaction.agent,
|
|
415
|
-
broker: params.transaction.object.broker,
|
|
417
|
+
// broker: params.transaction.object.broker,
|
|
416
418
|
reservationNumber: reservationNumber,
|
|
417
419
|
reservationFor: params.event,
|
|
418
420
|
reservedTicket: reservedTicket,
|
|
@@ -169,6 +169,7 @@ function processStartReserve4chevre(params) {
|
|
|
169
169
|
responseBody = startReserveTransactionResult.transaction;
|
|
170
170
|
// 予約取引からオファー情報を生成する
|
|
171
171
|
acceptedOffers4result = (0, factory_1.responseBody2acceptedOffers4result)({
|
|
172
|
+
issuedThrough: startReserveTransactionResult.issuedThrough,
|
|
172
173
|
objectSubReservations: startReserveTransactionResult.objectSubReservations,
|
|
173
174
|
responseBody: responseBody,
|
|
174
175
|
event: event,
|
|
@@ -26,6 +26,7 @@ export declare function acceptedOffers2amount(params: {
|
|
|
26
26
|
type IObjectSubReservation = factory.assetTransaction.reserve.IObjectSubReservation;
|
|
27
27
|
type IResultAcceptedOffer = factory.action.authorize.offer.seatReservation.IResultAcceptedOffer;
|
|
28
28
|
export declare function responseBody2acceptedOffers4result(params: {
|
|
29
|
+
issuedThrough: factory.assetTransaction.reserve.IIssuedThrough;
|
|
29
30
|
objectSubReservations: IObjectSubReservation[];
|
|
30
31
|
responseBody: factory.assetTransaction.reserve.ITransaction;
|
|
31
32
|
event: IMinimizedIndividualEvent<factory.eventType.ScreeningEvent>;
|
|
@@ -157,7 +157,12 @@ function responseBody2acceptedOffers4result(params) {
|
|
|
157
157
|
if (Array.isArray(params.objectSubReservations)) {
|
|
158
158
|
acceptedOffers4result = params.objectSubReservations.map((itemOffered) => {
|
|
159
159
|
var _a;
|
|
160
|
-
const reservation = createReservation({
|
|
160
|
+
const reservation = createReservation({
|
|
161
|
+
project: params.project,
|
|
162
|
+
itemOffered,
|
|
163
|
+
event: params.event,
|
|
164
|
+
issuedThrough: params.issuedThrough
|
|
165
|
+
});
|
|
161
166
|
// appliesToMovieTicketがArrayでないケースは廃止(2022-09-12~)
|
|
162
167
|
const priceSpecification = itemOffered.price;
|
|
163
168
|
const priceComponent = priceSpecification.priceComponent.map((c) => {
|
|
@@ -244,7 +249,10 @@ function createReservation(params) {
|
|
|
244
249
|
// 最適化(2022-05-31~)
|
|
245
250
|
superEvent: Object.assign(Object.assign({ typeOf: event.superEvent.typeOf, id: event.superEvent.id, kanaName: event.superEvent.kanaName, location: event.superEvent.location, name: event.superEvent.name, soundFormat: event.superEvent.soundFormat, videoFormat: event.superEvent.videoFormat, workPerformed }, (typeof event.superEvent.duration === 'string') ? { duration: event.superEvent.duration } : undefined), (event.superEvent.headline !== undefined) ? { headline: event.superEvent.headline } : undefined)
|
|
246
251
|
};
|
|
247
|
-
|
|
252
|
+
if (params.issuedThrough.typeOf !== factory.product.ProductType.EventService) {
|
|
253
|
+
throw new factory.errors.Argument('issuedThrough', `issuedThrough.typeOf must be ${factory.product.ProductType.EventService}`);
|
|
254
|
+
}
|
|
255
|
+
reservationItem = Object.assign({ project: itemOffered.project, typeOf: itemOffered.typeOf, additionalProperty: itemOffered.additionalProperty, additionalTicketText: itemOffered.additionalTicketText, id: itemOffered.id, issuedThrough: params.issuedThrough, reservationNumber: itemOffered.reservationNumber, reservationFor,
|
|
248
256
|
reservedTicket }, (typeof ((_a = itemOffered.programMembershipUsed) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string')
|
|
249
257
|
? { programMembershipUsed: itemOffered.programMembershipUsed }
|
|
250
258
|
: undefined);
|
|
@@ -269,7 +277,10 @@ function createReservation(params) {
|
|
|
269
277
|
busNumber: tripByEvent.busNumber,
|
|
270
278
|
identifier: tripByEvent.identifier
|
|
271
279
|
};
|
|
272
|
-
|
|
280
|
+
if (params.issuedThrough.typeOf !== factory.product.ProductType.Transportation) {
|
|
281
|
+
throw new factory.errors.Argument('issuedThrough', `issuedThrough.typeOf must be ${factory.product.ProductType.Transportation}`);
|
|
282
|
+
}
|
|
283
|
+
reservationItem = Object.assign({ project: itemOffered.project, typeOf: itemOffered.typeOf, additionalProperty: itemOffered.additionalProperty, additionalTicketText: itemOffered.additionalTicketText, id: itemOffered.id, issuedThrough: params.issuedThrough, reservationNumber: itemOffered.reservationNumber, reservationFor,
|
|
273
284
|
reservedTicket }, (typeof ((_d = itemOffered.programMembershipUsed) === null || _d === void 0 ? void 0 : _d.typeOf) === 'string')
|
|
274
285
|
? { programMembershipUsed: itemOffered.programMembershipUsed }
|
|
275
286
|
: undefined);
|
|
@@ -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",
|
|
@@ -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
11
|
seller: factory.seller.ISeller;
|
|
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 };
|
|
@@ -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;
|
|
@@ -10,12 +10,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.validateMovieTicket = void 0;
|
|
13
|
-
|
|
14
|
-
* 決済取引サービス
|
|
15
|
-
*/
|
|
13
|
+
const createDebug = require("debug");
|
|
16
14
|
const factory = require("../../../factory");
|
|
17
15
|
const checkByIdentifier_1 = require("./checkByIdentifier");
|
|
18
|
-
|
|
16
|
+
const debug = createDebug('chevre-domain:service:payment');
|
|
17
|
+
function validateMovieTicket(params, paymentServiceId, useCheckMovieTicketBeforePay, useCheckByIdentifierIfNotYet) {
|
|
19
18
|
// tslint:disable-next-line:max-func-body-length
|
|
20
19
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
21
20
|
var _a, _b, _c, _d;
|
|
@@ -33,6 +32,7 @@ function validateMovieTicket(params, paymentServiceId, useCheckMovieTicketBefore
|
|
|
33
32
|
if (movieTicketIdentifiers.length !== 1) {
|
|
34
33
|
throw new factory.errors.Argument('movieTickets', 'Number of movie ticket identifiers must be 1');
|
|
35
34
|
}
|
|
35
|
+
const movieTicketIdentifier = movieTicketIdentifiers[0];
|
|
36
36
|
// ムビチケ系統の決済方法タイプは動的
|
|
37
37
|
const paymentMethodType = (_b = params.object.paymentMethod) === null || _b === void 0 ? void 0 : _b.typeOf;
|
|
38
38
|
if (typeof paymentMethodType !== 'string') {
|
|
@@ -56,11 +56,13 @@ function validateMovieTicket(params, paymentServiceId, useCheckMovieTicketBefore
|
|
|
56
56
|
if (!useCheckMovieTicketBeforePay) {
|
|
57
57
|
return { accountsReceivablesByServiceType: [] };
|
|
58
58
|
}
|
|
59
|
-
const checkResult = yield (
|
|
59
|
+
const checkResult = yield checkByIdentifierIfNotYet({
|
|
60
|
+
movieTicketIdentifier,
|
|
60
61
|
movieTickets: movieTickets,
|
|
61
62
|
seller: seller,
|
|
62
63
|
screeningEvent: screeningEvent,
|
|
63
|
-
paymentServiceId
|
|
64
|
+
paymentServiceId,
|
|
65
|
+
useCheckByIdentifierIfNotYet
|
|
64
66
|
})(repos);
|
|
65
67
|
const accountsReceivablesByServiceType = [];
|
|
66
68
|
// 券種ごとに枚数が足りているか
|
|
@@ -89,3 +91,35 @@ function validateMovieTicket(params, paymentServiceId, useCheckMovieTicketBefore
|
|
|
89
91
|
});
|
|
90
92
|
}
|
|
91
93
|
exports.validateMovieTicket = validateMovieTicket;
|
|
94
|
+
function checkByIdentifierIfNotYet(params) {
|
|
95
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
96
|
+
var _a;
|
|
97
|
+
let checkResult;
|
|
98
|
+
if (params.useCheckByIdentifierIfNotYet === true) {
|
|
99
|
+
// すでにCheckActionが存在すれば認証しない(2023-06-06~)
|
|
100
|
+
debug('searching alreadyCheckedActions...movieTicketIdentifier:', params.movieTicketIdentifier, 'screeningEvent.id:', params.screeningEvent.id, new Date());
|
|
101
|
+
const alreadyCheckedAction = yield repos.action.search({
|
|
102
|
+
limit: 1,
|
|
103
|
+
page: 1,
|
|
104
|
+
typeOf: { $eq: factory.actionType.CheckAction },
|
|
105
|
+
actionStatus: { $in: [factory.actionStatusType.CompletedActionStatus] },
|
|
106
|
+
object: {
|
|
107
|
+
typeOf: { $eq: factory.service.paymentService.PaymentServiceType.MovieTicket },
|
|
108
|
+
movieTickets: {
|
|
109
|
+
identifier: { $eq: params.movieTicketIdentifier },
|
|
110
|
+
serviceOutput: {
|
|
111
|
+
reservationFor: { id: { $eq: params.screeningEvent.id } }
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}, ['result'], []);
|
|
116
|
+
checkResult = (_a = alreadyCheckedAction.shift()) === null || _a === void 0 ? void 0 : _a.result;
|
|
117
|
+
debug('checkResult found', checkResult, 'movieTicketIdentifier:', params.movieTicketIdentifier, 'screeningEvent.id:', params.screeningEvent.id, new Date());
|
|
118
|
+
}
|
|
119
|
+
if (checkResult === undefined) {
|
|
120
|
+
debug('checkByIdentifier processing because movieTickets not checked yet...', checkResult);
|
|
121
|
+
checkResult = yield (0, checkByIdentifier_1.checkByIdentifier)(params)(repos);
|
|
122
|
+
}
|
|
123
|
+
return checkResult;
|
|
124
|
+
});
|
|
125
|
+
}
|
|
@@ -49,7 +49,7 @@ interface IAuthorizeResult {
|
|
|
49
49
|
* MovieTicket承認
|
|
50
50
|
* オーソリサービスが存在するわけではないので、実質着券する
|
|
51
51
|
*/
|
|
52
|
-
declare function authorize(params: factory.assetTransaction.pay.IStartParamsWithoutDetail, transaction: factory.assetTransaction.pay.ITransaction, paymentServiceId: string, useCheckMovieTicketBeforePay: boolean): (repos: {
|
|
52
|
+
declare function authorize(params: factory.assetTransaction.pay.IStartParamsWithoutDetail, transaction: factory.assetTransaction.pay.ITransaction, paymentServiceId: string, useCheckMovieTicketBeforePay: boolean, useCheckByIdentifierIfNotYet: boolean): (repos: {
|
|
53
53
|
action: ActionRepo;
|
|
54
54
|
accountingReport: AccountingReportRepo;
|
|
55
55
|
event: EventRepo;
|
|
@@ -102,7 +102,7 @@ exports.checkMovieTicket = checkMovieTicket;
|
|
|
102
102
|
* MovieTicket承認
|
|
103
103
|
* オーソリサービスが存在するわけではないので、実質着券する
|
|
104
104
|
*/
|
|
105
|
-
function authorize(params, transaction, paymentServiceId, useCheckMovieTicketBeforePay) {
|
|
105
|
+
function authorize(params, transaction, paymentServiceId, useCheckMovieTicketBeforePay, useCheckByIdentifierIfNotYet) {
|
|
106
106
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
107
107
|
var _a, _b;
|
|
108
108
|
let accountId;
|
|
@@ -110,7 +110,7 @@ function authorize(params, transaction, paymentServiceId, useCheckMovieTicketBef
|
|
|
110
110
|
let accountsReceivablesByServiceType = [];
|
|
111
111
|
try {
|
|
112
112
|
// MovieTicket決済の場合、認証
|
|
113
|
-
const validateMovieTicketResult = yield (0, validation_1.validateMovieTicket)(params, paymentServiceId, useCheckMovieTicketBeforePay)(repos);
|
|
113
|
+
const validateMovieTicketResult = yield (0, validation_1.validateMovieTicket)(params, paymentServiceId, useCheckMovieTicketBeforePay, useCheckByIdentifierIfNotYet)(repos);
|
|
114
114
|
accountsReceivablesByServiceType = validateMovieTicketResult.accountsReceivablesByServiceType;
|
|
115
115
|
const paymentMethod = transaction.object.paymentMethod;
|
|
116
116
|
const paymentMethodType = String(paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.typeOf);
|
|
@@ -338,9 +338,12 @@ function processAuthorizeCreditCard(params) {
|
|
|
338
338
|
},
|
|
339
339
|
purpose: params.purpose,
|
|
340
340
|
paymentServiceType: factory.service.paymentService.PaymentServiceType.CreditCard,
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
341
|
+
options: {
|
|
342
|
+
useCancelPayTransactionOnFailed: false,
|
|
343
|
+
useCheckMovieTicketBeforePay: false,
|
|
344
|
+
useCheckByIdentifierIfNotYet: false,
|
|
345
|
+
useSearchTrade4accountId: false
|
|
346
|
+
}
|
|
344
347
|
})(repos);
|
|
345
348
|
});
|
|
346
349
|
}
|
package/package.json
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.313.0-alpha.
|
|
13
|
-
"@cinerino/sdk": "3.157.0-alpha.
|
|
12
|
+
"@chevre/factory": "4.313.0-alpha.28",
|
|
13
|
+
"@cinerino/sdk": "3.157.0-alpha.8",
|
|
14
14
|
"@motionpicture/coa-service": "9.2.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.2.0",
|
|
16
16
|
"@sendgrid/mail": "6.4.0",
|
|
@@ -117,5 +117,5 @@
|
|
|
117
117
|
"postversion": "git push origin --tags",
|
|
118
118
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
119
119
|
},
|
|
120
|
-
"version": "21.2.0-alpha.
|
|
120
|
+
"version": "21.2.0-alpha.99"
|
|
121
121
|
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-implicit-dependencies no-console
|
|
2
|
-
import { chevre } from '../../../lib/index';
|
|
3
|
-
|
|
4
|
-
import * as mongoose from 'mongoose';
|
|
5
|
-
|
|
6
|
-
const project = { id: String(process.env.PROJECT_ID) };
|
|
7
|
-
|
|
8
|
-
async function main() {
|
|
9
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: true });
|
|
10
|
-
|
|
11
|
-
const assetTransactionRepo = new chevre.repository.AssetTransaction(mongoose.connection);
|
|
12
|
-
const assetTransactions = await assetTransactionRepo.search(
|
|
13
|
-
{
|
|
14
|
-
typeOf: chevre.factory.assetTransactionType.Reserve,
|
|
15
|
-
project: { id: { $eq: project.id } },
|
|
16
|
-
object: {
|
|
17
|
-
reservations: { reservedTicket: { ticketedSeat: { seatNumber: { $eq: 'A-03' } } } }
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
['_id', 'transactionNumber'],
|
|
21
|
-
[]
|
|
22
|
-
);
|
|
23
|
-
console.log('assetTransactions:', assetTransactions);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
main()
|
|
27
|
-
.then(() => {
|
|
28
|
-
console.log('success!');
|
|
29
|
-
})
|
|
30
|
-
.catch(console.error);
|