@chevre/domain 20.4.0-alpha.15 → 20.4.0-alpha.17
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/deleteMovieTicketCategoryChargePriceSpecs.ts +1 -1
- package/example/src/chevre/searchEventTicketOffers.ts +1 -1
- package/example/src/chevre/unsetUnnecessaryFields.ts +16 -10
- package/lib/chevre/repo/event.d.ts +4 -3
- package/lib/chevre/repo/event.js +2 -11
- package/lib/chevre/repo/mongoose/model/offer.js +12 -0
- package/lib/chevre/repo/offer.d.ts +1 -0
- package/lib/chevre/repo/offer.js +15 -1
- package/lib/chevre/repo/priceSpecification.d.ts +2 -2
- package/lib/chevre/repo/priceSpecification.js +4 -5
- package/lib/chevre/service/assetTransaction/pay.js +2 -3
- package/lib/chevre/service/assetTransaction/reserve.js +1 -0
- package/lib/chevre/service/offer/event/authorize.js +1 -0
- package/lib/chevre/service/offer/event/searchEventTicketOffers.d.ts +1 -1
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +21 -34
- package/lib/chevre/service/offer/factory.js +11 -14
- package/lib/chevre/service/payment/any/factory.js +28 -2
- package/lib/chevre/service/payment/movieTicket.d.ts +7 -2
- package/lib/chevre/service/payment/movieTicket.js +17 -8
- package/lib/chevre/settings.d.ts +1 -0
- package/lib/chevre/settings.js +1 -1
- package/package.json +3 -3
|
@@ -11,7 +11,7 @@ async function main() {
|
|
|
11
11
|
const priceSpecificationRepo = new chevre.repository.PriceSpecification(mongoose.connection);
|
|
12
12
|
|
|
13
13
|
const result = await priceSpecificationRepo.deleteUnnecessaryMovieTicketTypeChargePriceSpecs({
|
|
14
|
-
project: { id: 'cinerino' }
|
|
14
|
+
// project: { id: 'cinerino' }
|
|
15
15
|
});
|
|
16
16
|
console.log('deleted', result);
|
|
17
17
|
}
|
|
@@ -22,7 +22,7 @@ async function main() {
|
|
|
22
22
|
const productRepo = new chevre.repository.Product(mongoose.connection);
|
|
23
23
|
|
|
24
24
|
const { ticketOffers } = await chevre.service.offer.event.searchEventTicketOffers({
|
|
25
|
-
event: { id: '
|
|
25
|
+
event: { id: 'ale6qiedi' },
|
|
26
26
|
onlyValid: true,
|
|
27
27
|
sort: false,
|
|
28
28
|
validateOfferRateLimit: true,
|
|
@@ -7,7 +7,8 @@ async function main() {
|
|
|
7
7
|
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
8
8
|
|
|
9
9
|
// const accountRepo = new chevre.repository.Account(mongoose.connection);
|
|
10
|
-
const permitRepo = new chevre.repository.ServiceOutput(mongoose.connection);
|
|
10
|
+
// const permitRepo = new chevre.repository.ServiceOutput(mongoose.connection);
|
|
11
|
+
const eventRepo = new chevre.repository.Event(mongoose.connection);
|
|
11
12
|
|
|
12
13
|
let updateResult: any;
|
|
13
14
|
// updateResult = await accountRepo.unsetUnnecessaryFields({
|
|
@@ -15,16 +16,21 @@ async function main() {
|
|
|
15
16
|
// $unset: { status: 1 }
|
|
16
17
|
// });
|
|
17
18
|
// console.log('accounts unset.', updateResult);
|
|
18
|
-
updateResult = await permitRepo.unsetUnnecessaryFields({
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
});
|
|
22
|
-
console.log('permits unset', updateResult);
|
|
23
|
-
updateResult = await permitRepo.unsetUnnecessaryFields({
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
// updateResult = await permitRepo.unsetUnnecessaryFields({
|
|
20
|
+
// filter: { 'paymentAccount.project': { $exists: true } },
|
|
21
|
+
// $unset: { 'paymentAccount.project': 1 }
|
|
22
|
+
// });
|
|
23
|
+
// console.log('permits unset', updateResult);
|
|
24
|
+
// updateResult = await permitRepo.unsetUnnecessaryFields({
|
|
25
|
+
// filter: { 'issuedThrough.project': { $exists: true } },
|
|
26
|
+
// $unset: { 'issuedThrough.project': 1 }
|
|
27
|
+
// });
|
|
28
|
+
// console.log('permits unset', updateResult);
|
|
29
|
+
updateResult = await eventRepo.unsetUnnecessaryFields({
|
|
30
|
+
filter: { hasOfferCatalog: { $exists: true } },
|
|
31
|
+
$unset: { hasOfferCatalog: 1 }
|
|
26
32
|
});
|
|
27
|
-
console.log('
|
|
33
|
+
console.log('events unset', updateResult);
|
|
28
34
|
}
|
|
29
35
|
|
|
30
36
|
main()
|
|
@@ -141,9 +141,10 @@ export declare class MongoRepository {
|
|
|
141
141
|
}, update: IUpdateAggregateReservationParams | IUpdateAggregateUseActionsParams): Promise<factory.event.IEvent<T>>;
|
|
142
142
|
bulkWrite(bulkWriteOps: any[]): Promise<BulkWriteOpResultObject>;
|
|
143
143
|
getCursor(conditions: any, projection: any): import("mongoose").QueryCursor<any>;
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
144
|
+
unsetUnnecessaryFields(params: {
|
|
145
|
+
filter: any;
|
|
146
|
+
$unset: any;
|
|
147
|
+
}): Promise<import("mongoose").UpdateWriteOpResult>;
|
|
147
148
|
aggregateEvent(params: {
|
|
148
149
|
project?: {
|
|
149
150
|
id?: {
|
package/lib/chevre/repo/event.js
CHANGED
|
@@ -751,18 +751,9 @@ class MongoRepository {
|
|
|
751
751
|
.sort({ startDate: factory.sortType.Descending })
|
|
752
752
|
.cursor();
|
|
753
753
|
}
|
|
754
|
-
|
|
754
|
+
unsetUnnecessaryFields(params) {
|
|
755
755
|
return __awaiter(this, void 0, void 0, function* () {
|
|
756
|
-
|
|
757
|
-
_id: { $eq: params.id }
|
|
758
|
-
}, {
|
|
759
|
-
$unset: {
|
|
760
|
-
'location.project': 1,
|
|
761
|
-
'workPerformed.project': 1,
|
|
762
|
-
'superEvent.location.project': 1,
|
|
763
|
-
'superEvent.workPerformed.project': 1
|
|
764
|
-
}
|
|
765
|
-
})
|
|
756
|
+
return this.eventModel.updateMany(params.filter, { $unset: params.$unset })
|
|
766
757
|
.exec();
|
|
767
758
|
});
|
|
768
759
|
}
|
|
@@ -196,6 +196,18 @@ schema.index({ additionalProperty: 1, 'priceSpecification.price': 1 }, {
|
|
|
196
196
|
additionalProperty: { $exists: true }
|
|
197
197
|
}
|
|
198
198
|
});
|
|
199
|
+
schema.index({ validFrom: 1, 'priceSpecification.price': 1 }, {
|
|
200
|
+
name: 'searchByValidFrom',
|
|
201
|
+
partialFilterExpression: {
|
|
202
|
+
validFrom: { $exists: true }
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
schema.index({ validThrough: 1, 'priceSpecification.price': 1 }, {
|
|
206
|
+
name: 'searchByValidThrough',
|
|
207
|
+
partialFilterExpression: {
|
|
208
|
+
validThrough: { $exists: true }
|
|
209
|
+
}
|
|
210
|
+
});
|
|
199
211
|
mongoose.model(modelName, schema)
|
|
200
212
|
.on('index',
|
|
201
213
|
// tslint:disable-next-line:no-single-line-block-comment
|
package/lib/chevre/repo/offer.js
CHANGED
|
@@ -310,6 +310,20 @@ class MongoRepository {
|
|
|
310
310
|
}
|
|
311
311
|
});
|
|
312
312
|
}
|
|
313
|
+
if (params.onlyValid === true) {
|
|
314
|
+
const now = new Date();
|
|
315
|
+
andConditions.push({
|
|
316
|
+
$or: [
|
|
317
|
+
{ validFrom: { $exists: false } },
|
|
318
|
+
{ validFrom: { $exists: true, $lte: now } }
|
|
319
|
+
]
|
|
320
|
+
}, {
|
|
321
|
+
$or: [
|
|
322
|
+
{ validThrough: { $exists: false } },
|
|
323
|
+
{ validThrough: { $exists: true, $gte: now } }
|
|
324
|
+
]
|
|
325
|
+
});
|
|
326
|
+
}
|
|
313
327
|
return andConditions;
|
|
314
328
|
}
|
|
315
329
|
/**
|
|
@@ -356,7 +370,7 @@ class MongoRepository {
|
|
|
356
370
|
serviceType: { $exists: false }
|
|
357
371
|
}
|
|
358
372
|
: undefined)
|
|
359
|
-
} }), (typeof params.limit === 'number' && typeof params.page === 'number')
|
|
373
|
+
}, onlyValid: params.onlyValid === true }), (typeof params.limit === 'number' && typeof params.page === 'number')
|
|
360
374
|
? { sort: { _id: factory.sortType.Ascending } }
|
|
361
375
|
: undefined), (typeof params.limit === 'number') ? { limit: params.limit } : undefined), (typeof params.page === 'number') ? { page: params.page } : undefined);
|
|
362
376
|
offers = yield this.search(searchOffersConditions);
|
|
@@ -278,12 +278,11 @@ class MongoRepository {
|
|
|
278
278
|
});
|
|
279
279
|
}
|
|
280
280
|
deleteUnnecessaryMovieTicketTypeChargePriceSpecs(params) {
|
|
281
|
+
var _a;
|
|
281
282
|
return __awaiter(this, void 0, void 0, function* () {
|
|
282
|
-
return this.priceSpecificationModel.deleteMany({
|
|
283
|
-
'project.id': { $eq: params.project.id }
|
|
284
|
-
|
|
285
|
-
price: { $eq: 0 }
|
|
286
|
-
})
|
|
283
|
+
return this.priceSpecificationModel.deleteMany(Object.assign({ typeOf: { $eq: factory.priceSpecificationType.MovieTicketTypeChargeSpecification }, price: { $eq: 0 } }, (typeof ((_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === 'string')
|
|
284
|
+
? { 'project.id': { $eq: params.project.id } }
|
|
285
|
+
: undefined))
|
|
287
286
|
.exec();
|
|
288
287
|
});
|
|
289
288
|
}
|
|
@@ -269,11 +269,10 @@ function processAuthorizeCreditCard(params, transaction, paymentServiceId) {
|
|
|
269
269
|
}
|
|
270
270
|
function processAuthorizeMovieTicket(params, transaction, paymentServiceId) {
|
|
271
271
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
272
|
-
|
|
273
|
-
const authorizeResult = yield MovieTicketPayment.authorize(params, transaction, paymentServiceId)(repos);
|
|
272
|
+
const { accountId, checkResult, payAction } = yield MovieTicketPayment.authorize(params, transaction, paymentServiceId)(repos);
|
|
274
273
|
return saveAuthorizeResult({
|
|
275
274
|
id: transaction.id,
|
|
276
|
-
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)
|
|
277
276
|
})(repos);
|
|
278
277
|
});
|
|
279
278
|
}
|
|
@@ -117,6 +117,7 @@ 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,
|
|
121
122
|
addSortIndex: false,
|
|
122
123
|
validateOfferRateLimit: true
|
|
@@ -35,7 +35,7 @@ function searchTransportationEventTicketOffers(params) {
|
|
|
35
35
|
const transportation = yield repos.product.findById({ id: eventOffers.itemOffered.id });
|
|
36
36
|
if (typeof ((_b = transportation.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.id) === 'string') {
|
|
37
37
|
const findOffersByOfferCatalogIdResult = yield repos.offer.findOffersByOfferCatalogId(Object.assign({ ids: params.ids, offerCatalog: { id: transportation.hasOfferCatalog.id }, availableAtOrFrom: { id: (_c = params.store) === null || _c === void 0 ? void 0 : _c.id }, unacceptedPaymentMethod,
|
|
38
|
-
excludeAppliesToMovieTicket, sort: params.sort }, (!params.sort)
|
|
38
|
+
excludeAppliesToMovieTicket, onlyValid: params.onlyValid === true, sort: params.sort }, (!params.sort)
|
|
39
39
|
? {
|
|
40
40
|
limit: params.limit,
|
|
41
41
|
page: params.page
|
|
@@ -81,14 +81,6 @@ function searchTransportationEventTicketOffers(params) {
|
|
|
81
81
|
return true;
|
|
82
82
|
}
|
|
83
83
|
});
|
|
84
|
-
// paging処理を追加(2023-02-21~)
|
|
85
|
-
if (params.sort) {
|
|
86
|
-
if (typeof params.limit === 'number' && typeof params.page === 'number') {
|
|
87
|
-
const start = params.limit * (params.page - 1);
|
|
88
|
-
const end = params.limit * params.page;
|
|
89
|
-
availableOffers = availableOffers.slice(start, end);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
84
|
let offers4event = availableOffers.map((availableOffer) => {
|
|
93
85
|
let sortIndex;
|
|
94
86
|
if (params.addSortIndex) {
|
|
@@ -157,7 +149,7 @@ function searchScreeningEventTicketOffers(params) {
|
|
|
157
149
|
const eventService = yield repos.product.findById({ id: eventOffers.itemOffered.id });
|
|
158
150
|
if (typeof ((_b = eventService.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.id) === 'string') {
|
|
159
151
|
const findOffersByOfferCatalogIdResult = yield repos.offer.findOffersByOfferCatalogId(Object.assign({ ids: params.ids, offerCatalog: { id: eventService.hasOfferCatalog.id }, availableAtOrFrom: { id: (_c = params.store) === null || _c === void 0 ? void 0 : _c.id }, unacceptedPaymentMethod,
|
|
160
|
-
excludeAppliesToMovieTicket, sort: params.sort }, (!params.sort)
|
|
152
|
+
excludeAppliesToMovieTicket, onlyValid: params.onlyValid === true, sort: params.sort }, (!params.sort)
|
|
161
153
|
? {
|
|
162
154
|
limit: params.limit,
|
|
163
155
|
page: params.page
|
|
@@ -222,14 +214,6 @@ function searchScreeningEventTicketOffers(params) {
|
|
|
222
214
|
}
|
|
223
215
|
});
|
|
224
216
|
}
|
|
225
|
-
// paging処理を追加(2023-02-21~)
|
|
226
|
-
if (params.sort) {
|
|
227
|
-
if (typeof params.limit === 'number' && typeof params.page === 'number') {
|
|
228
|
-
const start = params.limit * (params.page - 1);
|
|
229
|
-
const end = params.limit * params.page;
|
|
230
|
-
availableOffers = availableOffers.slice(start, end);
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
217
|
let offers4event = availableOffers.map((availableOffer) => {
|
|
234
218
|
let sortIndex;
|
|
235
219
|
if (params.addSortIndex) {
|
|
@@ -420,7 +404,8 @@ function searchEventTicketOffers(params) {
|
|
|
420
404
|
page: params.page,
|
|
421
405
|
sort: params.sort,
|
|
422
406
|
addSortIndex: params.addSortIndex,
|
|
423
|
-
validateOfferRateLimit: params.validateOfferRateLimit
|
|
407
|
+
validateOfferRateLimit: params.validateOfferRateLimit,
|
|
408
|
+
onlyValid: params.onlyValid === true
|
|
424
409
|
})(repos);
|
|
425
410
|
offers = searchOffersResult.ticketOffers;
|
|
426
411
|
unitPriceOffers = searchOffersResult.unitPriceOffers;
|
|
@@ -434,7 +419,8 @@ function searchEventTicketOffers(params) {
|
|
|
434
419
|
page: params.page,
|
|
435
420
|
sort: params.sort,
|
|
436
421
|
addSortIndex: params.addSortIndex,
|
|
437
|
-
validateOfferRateLimit: params.validateOfferRateLimit
|
|
422
|
+
validateOfferRateLimit: params.validateOfferRateLimit,
|
|
423
|
+
onlyValid: params.onlyValid === true
|
|
438
424
|
})(repos);
|
|
439
425
|
offers = searchOffersResult.ticketOffers;
|
|
440
426
|
unitPriceOffers = searchOffersResult.unitPriceOffers;
|
|
@@ -451,21 +437,22 @@ function searchEventTicketOffers(params) {
|
|
|
451
437
|
// && o.availableAtOrFrom.some((availableApplication) => availableApplication.id === specifiedStoreId);
|
|
452
438
|
// });
|
|
453
439
|
// }
|
|
440
|
+
// mongo条件へ移行(2023-02-24~)
|
|
454
441
|
// 有効期間を適用
|
|
455
|
-
if (params.onlyValid === true) {
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
}
|
|
442
|
+
// if (params.onlyValid === true) {
|
|
443
|
+
// offers = offers.filter((o) => {
|
|
444
|
+
// let isvalid = true;
|
|
445
|
+
// if (o.validFrom !== undefined && moment(o.validFrom)
|
|
446
|
+
// .isAfter(now)) {
|
|
447
|
+
// isvalid = false;
|
|
448
|
+
// }
|
|
449
|
+
// if (o.validThrough !== undefined && moment(o.validThrough)
|
|
450
|
+
// .isBefore(now)) {
|
|
451
|
+
// isvalid = false;
|
|
452
|
+
// }
|
|
453
|
+
// return isvalid;
|
|
454
|
+
// });
|
|
455
|
+
// }
|
|
469
456
|
for (const offer of offers) {
|
|
470
457
|
if (Array.isArray(offer.addOn)) {
|
|
471
458
|
// store.idでのフィルターをmongoに移行(2023-01-27~)
|
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
exports.createCompoundPriceSpec4event = void 0;
|
|
15
4
|
const factory = require("../../factory");
|
|
@@ -102,8 +91,16 @@ function createCompoundPriceSpec4event(params) {
|
|
|
102
91
|
valueAddedTaxIncluded: true,
|
|
103
92
|
priceComponent
|
|
104
93
|
};
|
|
105
|
-
//
|
|
106
|
-
const
|
|
107
|
-
|
|
94
|
+
// 必要な属性のみに限定(2023-02-24~)
|
|
95
|
+
// const { project, ...unitOfferFields4ticketOffer } = params.offer;
|
|
96
|
+
const { name, description, alternateName, color, typeOf, id, addOn, availability, availableAtOrFrom, category, eligibleMembershipType, eligibleSeatingType, eligibleMonetaryAmount, eligibleSubReservation, priceCurrency, validFrom, validThrough, validRateLimit, additionalProperty, identifier, itemOffered } = params.offer;
|
|
97
|
+
return Object.assign({
|
|
98
|
+
// ...unitOfferFields4ticketOffer,
|
|
99
|
+
name, description, alternateName, color, typeOf, id,
|
|
100
|
+
addOn, availability, availableAtOrFrom, category,
|
|
101
|
+
eligibleMembershipType, eligibleSeatingType, eligibleMonetaryAmount, eligibleSubReservation,
|
|
102
|
+
priceCurrency,
|
|
103
|
+
validFrom, validThrough, validRateLimit, additionalProperty,
|
|
104
|
+
identifier, itemOffered, eligibleQuantity: params.eligibleQuantity, priceSpecification: compoundPriceSpecification }, (typeof params.sortIndex === 'number') ? { sortIndex: params.sortIndex } : undefined);
|
|
108
105
|
}
|
|
109
106
|
exports.createCompoundPriceSpec4event = createCompoundPriceSpec4event;
|
|
@@ -13,8 +13,9 @@ function creatPayTransactionStartParams(params) {
|
|
|
13
13
|
const accountId = (typeof params.accountId === 'string')
|
|
14
14
|
? params.accountId
|
|
15
15
|
: (typeof params.object.accountId === 'string') ? params.object.accountId : undefined;
|
|
16
|
+
// movieTickets最適化(2023-02-24~)
|
|
17
|
+
const movieTickets = (Array.isArray(params.object.movieTickets)) ? params.object.movieTickets.map(createMovieTicket) : undefined;
|
|
16
18
|
return Object.assign(Object.assign({ project: { id: params.transaction.project.id, typeOf: factory.organizationType.Project }, typeOf: factory.assetTransactionType.Pay, transactionNumber: params.transactionNumber, agent: {
|
|
17
|
-
// Sellerに変更(2022-05-30~)
|
|
18
19
|
typeOf: params.transaction.seller.typeOf,
|
|
19
20
|
id: String(params.transaction.seller.id),
|
|
20
21
|
name: (typeof params.transaction.seller.name === 'string')
|
|
@@ -38,7 +39,7 @@ function creatPayTransactionStartParams(params) {
|
|
|
38
39
|
typeOf: params.paymentServiceType,
|
|
39
40
|
// 決済サービスIDを連携(2022-04-12~)
|
|
40
41
|
id: issuedThroughId,
|
|
41
|
-
paymentMethod: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ typeOf: params.object.paymentMethod, amount: params.object.amount, additionalProperty: (Array.isArray(params.object.additionalProperty)) ? params.object.additionalProperty : [] }, (typeof params.object.method === 'string') ? { method: params.object.method } : undefined), (typeof params.object.name === 'string') ? { name: params.object.name } : undefined), (typeof accountId === 'string') ? { accountId } : undefined), (typeof params.object.description === 'string') ? { description: params.object.description } : undefined), (typeof params.object.fromLocation === 'string') ? { fromLocation: params.object.fromLocation } : undefined), (params.object.creditCard !== undefined) ? { creditCard: params.object.creditCard } : undefined), (Array.isArray(
|
|
42
|
+
paymentMethod: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ typeOf: params.object.paymentMethod, amount: params.object.amount, additionalProperty: (Array.isArray(params.object.additionalProperty)) ? params.object.additionalProperty : [] }, (typeof params.object.method === 'string') ? { method: params.object.method } : undefined), (typeof params.object.name === 'string') ? { name: params.object.name } : undefined), (typeof accountId === 'string') ? { accountId } : undefined), (typeof params.object.description === 'string') ? { description: params.object.description } : undefined), (typeof params.object.fromLocation === 'string') ? { fromLocation: params.object.fromLocation } : undefined), (params.object.creditCard !== undefined) ? { creditCard: params.object.creditCard } : undefined), (Array.isArray(movieTickets)) ? { movieTickets } : undefined)
|
|
42
43
|
}, expires: expires }, (typeof confirmationNumber === 'string')
|
|
43
44
|
? {
|
|
44
45
|
purpose: {
|
|
@@ -51,6 +52,31 @@ function creatPayTransactionStartParams(params) {
|
|
|
51
52
|
: undefined);
|
|
52
53
|
}
|
|
53
54
|
exports.creatPayTransactionStartParams = creatPayTransactionStartParams;
|
|
55
|
+
function createMovieTicket(params) {
|
|
56
|
+
const serviceOutput = {
|
|
57
|
+
reservationFor: {
|
|
58
|
+
typeOf: params.serviceOutput.reservationFor.typeOf,
|
|
59
|
+
id: params.serviceOutput.reservationFor.id
|
|
60
|
+
},
|
|
61
|
+
reservedTicket: {
|
|
62
|
+
ticketedSeat: {
|
|
63
|
+
typeOf: factory.placeType.Seat,
|
|
64
|
+
seatNumber: params.serviceOutput.reservedTicket.ticketedSeat.seatNumber,
|
|
65
|
+
seatRow: params.serviceOutput.reservedTicket.ticketedSeat.seatRow,
|
|
66
|
+
seatSection: params.serviceOutput.reservedTicket.ticketedSeat.seatSection
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
return {
|
|
71
|
+
project: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
72
|
+
typeOf: params.typeOf,
|
|
73
|
+
identifier: params.identifier,
|
|
74
|
+
accessCode: params.accessCode,
|
|
75
|
+
category: { codeValue: params.category.codeValue },
|
|
76
|
+
serviceType: params.serviceType,
|
|
77
|
+
serviceOutput
|
|
78
|
+
};
|
|
79
|
+
}
|
|
54
80
|
function createAuthorizeResult(params) {
|
|
55
81
|
var _a, _b, _c, _d;
|
|
56
82
|
const payTransactionObject = params.payTransaction.object;
|
|
@@ -57,9 +57,14 @@ declare function checkByIdentifier(params: {
|
|
|
57
57
|
project: ProjectRepo;
|
|
58
58
|
}) => Promise<ICheckResult>;
|
|
59
59
|
interface IAuthorizeResult {
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
accountId: string;
|
|
61
|
+
checkResult?: ICheckResult;
|
|
62
|
+
payAction: factory.action.trade.pay.IAction;
|
|
62
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* MovieTicket承認
|
|
66
|
+
* オーソリサービスが存在するわけではないので、実質着券する
|
|
67
|
+
*/
|
|
63
68
|
declare function authorize(params: factory.assetTransaction.pay.IStartParamsWithoutDetail, transaction: factory.assetTransaction.pay.ITransaction, paymentServiceId: string): (repos: {
|
|
64
69
|
action: ActionRepo;
|
|
65
70
|
accountingReport: AccountingReportRepo;
|
|
@@ -17,6 +17,7 @@ const surfrock = require("@surfrock/sdk");
|
|
|
17
17
|
const moment = require("moment-timezone");
|
|
18
18
|
const credentials_1 = require("../../credentials");
|
|
19
19
|
const factory = require("../../factory");
|
|
20
|
+
const settings_1 = require("../../settings");
|
|
20
21
|
const factory_1 = require("./movieTicket/factory");
|
|
21
22
|
const validation_1 = require("../assetTransaction/pay/movieTicket/validation");
|
|
22
23
|
const errorHandler_1 = require("../../errorHandler");
|
|
@@ -258,14 +259,22 @@ function purchaseNumberAuthResult2movieTickets(params) {
|
|
|
258
259
|
}
|
|
259
260
|
return movieTickets;
|
|
260
261
|
}
|
|
262
|
+
/**
|
|
263
|
+
* MovieTicket承認
|
|
264
|
+
* オーソリサービスが存在するわけではないので、実質着券する
|
|
265
|
+
*/
|
|
261
266
|
function authorize(params, transaction, paymentServiceId) {
|
|
262
267
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
263
268
|
var _a, _b;
|
|
269
|
+
let accountId;
|
|
264
270
|
let checkResult;
|
|
265
271
|
let payAction;
|
|
266
272
|
try {
|
|
267
|
-
//
|
|
268
|
-
|
|
273
|
+
// オプション追加(2023-02-24~)
|
|
274
|
+
if (settings_1.settings.useCheckMovieTicketBeforePay) {
|
|
275
|
+
// MovieTicket決済の場合、認証
|
|
276
|
+
checkResult = yield (0, validation_1.validateMovieTicket)(params, paymentServiceId)(repos);
|
|
277
|
+
}
|
|
269
278
|
const paymentMethod = transaction.object.paymentMethod;
|
|
270
279
|
const paymentMethodType = String(paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.typeOf);
|
|
271
280
|
const additionalProperty = paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.additionalProperty;
|
|
@@ -273,7 +282,10 @@ function authorize(params, transaction, paymentServiceId) {
|
|
|
273
282
|
? paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.paymentMethodId
|
|
274
283
|
: transaction.id;
|
|
275
284
|
const paymentMethodName = (typeof (paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.name) === 'string') ? paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.name : paymentMethodType;
|
|
276
|
-
|
|
285
|
+
accountId = (Array.isArray(paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.movieTickets)) ? (_a = paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.movieTickets[0]) === null || _a === void 0 ? void 0 : _a.identifier : undefined;
|
|
286
|
+
if (typeof accountId !== 'string' || accountId.length === 0) {
|
|
287
|
+
throw new factory.errors.ArgumentNull('object.paymentMethod.movieTickets.identifier');
|
|
288
|
+
}
|
|
277
289
|
const payObject = {
|
|
278
290
|
typeOf: factory.service.paymentService.PaymentServiceType.MovieTicket,
|
|
279
291
|
id: paymentServiceId,
|
|
@@ -284,10 +296,7 @@ function authorize(params, transaction, paymentServiceId) {
|
|
|
284
296
|
}, typeOf: paymentMethodType }, (typeof accountId === 'string') ? { accountId } : undefined),
|
|
285
297
|
movieTickets: paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.movieTickets
|
|
286
298
|
};
|
|
287
|
-
const payActionAttributes = Object.assign({ project: transaction.project, typeOf: factory.actionType.PayAction, object: [payObject],
|
|
288
|
-
// agent:Projectに変更(2022-05-19~)
|
|
289
|
-
// agent: transaction.agent,
|
|
290
|
-
agent: transaction.project, recipient: transaction.recipient }, (params.purpose !== undefined)
|
|
299
|
+
const payActionAttributes = Object.assign({ project: transaction.project, typeOf: factory.actionType.PayAction, object: [payObject], agent: transaction.project, recipient: transaction.recipient }, (params.purpose !== undefined)
|
|
291
300
|
? { purpose: params.purpose }
|
|
292
301
|
: { purpose: { typeOf: transaction.typeOf, transactionNumber: transaction.transactionNumber, id: transaction.id } });
|
|
293
302
|
// 着券させざるをえないが、informPaymentはしない(注文がまだ存在しないため)
|
|
@@ -296,7 +305,7 @@ function authorize(params, transaction, paymentServiceId) {
|
|
|
296
305
|
catch (error) {
|
|
297
306
|
throw (0, errorHandler_1.handleMvtkReserveError)(error);
|
|
298
307
|
}
|
|
299
|
-
return
|
|
308
|
+
return { accountId, checkResult, payAction };
|
|
300
309
|
});
|
|
301
310
|
}
|
|
302
311
|
exports.authorize = authorize;
|
package/lib/chevre/settings.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export declare type ISettings = factory.project.ISettings & {
|
|
|
26
26
|
useAggregateEntranceGateProjects: string[];
|
|
27
27
|
useAggregateOfferProjects: string[];
|
|
28
28
|
useOfferRateLimitProjects: string[];
|
|
29
|
+
useCheckMovieTicketBeforePay: boolean;
|
|
29
30
|
};
|
|
30
31
|
export declare const DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD: string;
|
|
31
32
|
export declare const USE_ASSET_TRANSACTION_SYNC_PROCESSING: boolean;
|
package/lib/chevre/settings.js
CHANGED
|
@@ -100,4 +100,4 @@ exports.settings = Object.assign(Object.assign({ transactionWebhookUrls, onOrder
|
|
|
100
100
|
? process.env.USE_AGGREGATE_OFFER_PROJECTS.split(',')
|
|
101
101
|
: [], useOfferRateLimitProjects: (typeof process.env.USE_OFFER_RATE_LIMIT_PROJECTS === 'string')
|
|
102
102
|
? process.env.USE_OFFER_RATE_LIMIT_PROJECTS.split(',')
|
|
103
|
-
: [] });
|
|
103
|
+
: [], useCheckMovieTicketBeforePay: process.env.USE_CHECK_MOVIE_TICKET_BEFORE_PAY === '1' });
|
package/package.json
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.289.0-alpha.
|
|
13
|
-
"@cinerino/sdk": "3.140.0-alpha.
|
|
12
|
+
"@chevre/factory": "4.289.0-alpha.14",
|
|
13
|
+
"@cinerino/sdk": "3.140.0-alpha.15",
|
|
14
14
|
"@motionpicture/coa-service": "9.2.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.2.0",
|
|
16
16
|
"@sendgrid/mail": "6.4.0",
|
|
@@ -120,5 +120,5 @@
|
|
|
120
120
|
"postversion": "git push origin --tags",
|
|
121
121
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
122
122
|
},
|
|
123
|
-
"version": "20.4.0-alpha.
|
|
123
|
+
"version": "20.4.0-alpha.17"
|
|
124
124
|
}
|