@chevre/domain 21.25.0-alpha.16 → 21.25.0-alpha.18
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/migrateScreeningEventSeriesOffers.ts +87 -0
- package/lib/chevre/service/aggregation/event/findEventOffers.d.ts +1 -1
- package/lib/chevre/service/aggregation/event/findEventOffers.js +1 -1
- package/lib/chevre/service/assetTransaction/reserve/factory/price.js +1 -1
- package/lib/chevre/service/assetTransaction/reserve.js +1 -1
- package/lib/chevre/service/offer/event/authorize.d.ts +2 -2
- package/lib/chevre/service/offer/event/authorize.js +9 -17
- package/lib/chevre/service/offer/event/cancel.d.ts +1 -1
- package/lib/chevre/service/offer/event/cancel.js +1 -1
- package/lib/chevre/service/offer/event/factory.d.ts +6 -5
- package/lib/chevre/service/offer/event/factory.js +7 -6
- package/lib/chevre/service/offer/event/processStartReserve4chevre.d.ts +3 -3
- package/lib/chevre/service/offer/event/processStartReserve4chevre.js +5 -9
- package/lib/chevre/service/offer/event/voidTransaction.d.ts +1 -1
- package/lib/chevre/service/offer/event/voidTransaction.js +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +6 -3
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +2 -1
- package/lib/chevre/service/offer/eventServiceByCOA/factory.d.ts +2 -1
- package/lib/chevre/service/offer/eventServiceByCOA/factory.js +5 -3
- package/package.json +3 -3
- package/example/src/chevre/migrateMovieAvailabilityStarts.ts +0 -83
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as moment from 'moment';
|
|
3
|
+
import * as mongoose from 'mongoose';
|
|
4
|
+
|
|
5
|
+
import { chevre } from '../../../lib/index';
|
|
6
|
+
|
|
7
|
+
// const project = { id: String(process.env.PROJECT_ID) };
|
|
8
|
+
const EXCLUDED_PROJECT_ID = process.env.EXCLUDED_PROJECT_ID;
|
|
9
|
+
|
|
10
|
+
// tslint:disable-next-line:max-func-body-length
|
|
11
|
+
async function main() {
|
|
12
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
13
|
+
|
|
14
|
+
const eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
|
|
15
|
+
|
|
16
|
+
const cursor = eventRepo.getCursor(
|
|
17
|
+
{
|
|
18
|
+
typeOf: { $eq: chevre.factory.eventType.ScreeningEventSeries },
|
|
19
|
+
// typeOf: { $eq: chevre.factory.eventType.ScreeningEvent },
|
|
20
|
+
'project.id': { $ne: EXCLUDED_PROJECT_ID }
|
|
21
|
+
// 'offers.availabilityEnds': { $exists: true }
|
|
22
|
+
},
|
|
23
|
+
{}
|
|
24
|
+
);
|
|
25
|
+
console.log('events found');
|
|
26
|
+
|
|
27
|
+
let i = 0;
|
|
28
|
+
let updateCount = 0;
|
|
29
|
+
const projectIds: string[] = [];
|
|
30
|
+
let createdAtLatest: Date | undefined;
|
|
31
|
+
let updatedAtLatest: Date | undefined;
|
|
32
|
+
await cursor.eachAsync(async (doc) => {
|
|
33
|
+
i += 1;
|
|
34
|
+
const event: chevre.factory.event.screeningEventSeries.IEvent = doc.toObject();
|
|
35
|
+
|
|
36
|
+
const unacceptedPaymentMethod = event.offers?.unacceptedPaymentMethod;
|
|
37
|
+
const alreadyMigrated =
|
|
38
|
+
(!Array.isArray(unacceptedPaymentMethod))
|
|
39
|
+
|| (Array.isArray(unacceptedPaymentMethod) && unacceptedPaymentMethod.length === 0)
|
|
40
|
+
|| (Array.isArray(unacceptedPaymentMethod) && unacceptedPaymentMethod.length === 1 && unacceptedPaymentMethod[0] === 'MovieTicket');
|
|
41
|
+
|
|
42
|
+
if (alreadyMigrated) {
|
|
43
|
+
console.log(
|
|
44
|
+
'already migrated.', event.project.id, event.id, event.startDate, i);
|
|
45
|
+
} else {
|
|
46
|
+
projectIds.push(event.project.id);
|
|
47
|
+
if (createdAtLatest instanceof Date) {
|
|
48
|
+
if (moment(createdAtLatest)
|
|
49
|
+
.isBefore(moment((<any>event).createdAt))) {
|
|
50
|
+
createdAtLatest = (<any>event).createdAt;
|
|
51
|
+
}
|
|
52
|
+
} else {
|
|
53
|
+
createdAtLatest = (<any>event).createdAt;
|
|
54
|
+
}
|
|
55
|
+
if (updatedAtLatest instanceof Date) {
|
|
56
|
+
if (moment(updatedAtLatest)
|
|
57
|
+
.isBefore(moment((<any>event).updatedAt))) {
|
|
58
|
+
updatedAtLatest = (<any>event).updatedAt;
|
|
59
|
+
}
|
|
60
|
+
} else {
|
|
61
|
+
updatedAtLatest = (<any>event).updatedAt;
|
|
62
|
+
}
|
|
63
|
+
console.log(
|
|
64
|
+
'updating event...', event.project.id, event.id, event.startDate, unacceptedPaymentMethod,
|
|
65
|
+
(<any>event).createdAt,
|
|
66
|
+
(<any>event).updatedAt,
|
|
67
|
+
i
|
|
68
|
+
);
|
|
69
|
+
// await creativeWorkRepo.saveMovie(<any>{
|
|
70
|
+
// id: String(movie.id),
|
|
71
|
+
// 'offers.availabilityStarts': availabilityStarts
|
|
72
|
+
// });
|
|
73
|
+
updateCount += 1;
|
|
74
|
+
console.log('updated.', event.project.id, event.id, event.startDate, i);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
console.log(i, 'events checked');
|
|
79
|
+
console.log(updateCount, 'events updated');
|
|
80
|
+
console.log('projectIds:', [...new Set(projectIds)]);
|
|
81
|
+
console.log('createdAtLatest:', createdAtLatest);
|
|
82
|
+
console.log('updatedAtLatest:', updatedAtLatest);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
main()
|
|
86
|
+
.then()
|
|
87
|
+
.catch(console.error);
|
|
@@ -4,7 +4,7 @@ import type { MongoRepository as OfferCatalogRepo } from '../../../repo/offerCat
|
|
|
4
4
|
import type { MongoRepository as ProductRepo } from '../../../repo/product';
|
|
5
5
|
import * as factory from '../../../factory';
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* 興行オファー検索
|
|
8
8
|
* NotFoundエラーをハンドリングする
|
|
9
9
|
*/
|
|
10
10
|
export declare function findEventOffers(params: {
|
|
@@ -112,7 +112,7 @@ function addReservations(params) {
|
|
|
112
112
|
availableOffers = params.preSearchedUnitPriceOffers;
|
|
113
113
|
}
|
|
114
114
|
else {
|
|
115
|
-
//
|
|
115
|
+
// 興行オファー検索
|
|
116
116
|
const searchEventTicketOffersResult = yield OfferService.event.searchEventTicketOffers({
|
|
117
117
|
ids: acceptedOfferIds,
|
|
118
118
|
event: { id: event.id },
|
|
@@ -19,7 +19,6 @@ import type { StockHolderRepository as StockHolderRepo } from '../../../repo/sto
|
|
|
19
19
|
import type { MongoRepository as TaskRepo } from '../../../repo/task';
|
|
20
20
|
import type { MongoRepository as TransactionRepo } from '../../../repo/transaction';
|
|
21
21
|
import type { RedisRepository as TransactionNumberRepo } from '../../../repo/transactionNumber';
|
|
22
|
-
import { IObjectWithoutDetail } from './factory';
|
|
23
22
|
interface IAuthorizeRepos {
|
|
24
23
|
action: ActionRepo;
|
|
25
24
|
assetTransaction: AssetTransactionRepo;
|
|
@@ -44,8 +43,9 @@ interface IAuthorizeRepos {
|
|
|
44
43
|
}
|
|
45
44
|
type IAuthorizeOperation<T> = (repos: IAuthorizeRepos) => Promise<T>;
|
|
46
45
|
type IAuthorizeOfferAction = factory.action.authorize.offer.eventService.IAction<factory.service.webAPI.Identifier>;
|
|
46
|
+
type IObjectWithoutDetail = factory.action.authorize.offer.eventService.IObjectWithoutDetail4chevre;
|
|
47
47
|
/**
|
|
48
|
-
*
|
|
48
|
+
* 興行オファー承認
|
|
49
49
|
*/
|
|
50
50
|
declare function authorize(params: {
|
|
51
51
|
project: {
|
|
@@ -17,11 +17,12 @@ const processStartReserve4chevre_1 = require("./processStartReserve4chevre");
|
|
|
17
17
|
const searchEventTicketOffers_1 = require("./searchEventTicketOffers");
|
|
18
18
|
const factory_1 = require("./factory");
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
20
|
+
* 興行オファー承認
|
|
21
21
|
*/
|
|
22
22
|
function authorize(params) {
|
|
23
23
|
// tslint:disable-next-line:max-func-body-length
|
|
24
24
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
var _a;
|
|
25
26
|
const noOfferSpecified = params.noOfferSpecified === true;
|
|
26
27
|
const { transaction, event, bookingServiceIdentifire } = yield validateCreateRequest(params)({ event: repos.event, transaction: repos.transaction });
|
|
27
28
|
const { acceptedOffers, ticketOffers, unitPriceOffers } = yield validateAcceptedOffers({
|
|
@@ -41,31 +42,22 @@ function authorize(params) {
|
|
|
41
42
|
event: event,
|
|
42
43
|
transaction: transaction,
|
|
43
44
|
pendingTransaction: { typeOf: factory.assetTransactionType.Reserve, transactionNumber },
|
|
44
|
-
broker: params.object.broker
|
|
45
|
+
broker: params.object.broker,
|
|
46
|
+
useResultAcceptedOffers: params.options.useResultAcceptedOffers
|
|
45
47
|
});
|
|
46
48
|
const action = yield repos.action.start(actionAttributes);
|
|
47
49
|
try {
|
|
48
50
|
switch (bookingServiceIdentifire) {
|
|
49
51
|
// 実質使用する予定なしなので廃止(2022-05-12~)
|
|
50
52
|
// case factory.service.webAPI.Identifier.COA:
|
|
51
|
-
// const processStartReserve4coaResult = await processStartReserve4coa({ event, object: params.object });
|
|
52
|
-
// requestBody = processStartReserve4coaResult.requestBody;
|
|
53
|
-
// responseBody = processStartReserve4coaResult.responseBody;
|
|
54
53
|
// break;
|
|
55
54
|
case factory.service.webAPI.Identifier.Chevre:
|
|
56
|
-
const processStartReserveResult = yield (0, processStartReserve4chevre_1.processStartReserve4chevre)({
|
|
57
|
-
action,
|
|
58
|
-
event,
|
|
55
|
+
const processStartReserveResult = yield (0, processStartReserve4chevre_1.processStartReserve4chevre)(Object.assign({
|
|
56
|
+
// action,
|
|
57
|
+
acceptedOffer: acceptedOffers, event,
|
|
59
58
|
transactionNumber,
|
|
60
|
-
transaction,
|
|
61
|
-
|
|
62
|
-
ticketOffers,
|
|
63
|
-
unitPriceOffers,
|
|
64
|
-
validateEvent: params.validateEvent === true,
|
|
65
|
-
validateEventOfferPeriod: params.validateEventOfferPeriod === true,
|
|
66
|
-
useHoldStockByTransactionNumber: params.useHoldStockByTransactionNumber,
|
|
67
|
-
stockHoldUntilDaysAfterEventEnd: params.stockHoldUntilDaysAfterEventEnd
|
|
68
|
-
})(repos);
|
|
59
|
+
transaction, availableAtOrFrom: { id: params.store.id }, ticketOffers,
|
|
60
|
+
unitPriceOffers, validateEvent: params.validateEvent === true, validateEventOfferPeriod: params.validateEventOfferPeriod === true, useHoldStockByTransactionNumber: params.useHoldStockByTransactionNumber, stockHoldUntilDaysAfterEventEnd: params.stockHoldUntilDaysAfterEventEnd }, (typeof ((_a = params.object.broker) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? { broker: params.object.broker } : undefined))(repos);
|
|
69
61
|
acceptedOffers4result = processStartReserveResult.acceptedOffers4result;
|
|
70
62
|
// add orderInTransaction(2024-01-15~)
|
|
71
63
|
if (!noOfferSpecified) {
|
|
@@ -14,7 +14,7 @@ const factory = require("../../../factory");
|
|
|
14
14
|
const ReserveTransactionService = require("../../assetTransaction/reserve");
|
|
15
15
|
const any_1 = require("../any");
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* 興行オファー承認取消(apiから実行)
|
|
18
18
|
* 特定の承認アクションについて処理する
|
|
19
19
|
*/
|
|
20
20
|
function cancel(params) {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import * as COA from '@motionpicture/coa-service';
|
|
2
2
|
import * as factory from '../../../factory';
|
|
3
3
|
import { IMinimizedIndividualEvent } from '../../../factory/event';
|
|
4
|
-
export type IReservationFor = factory.reservation.IReservationFor<factory.reservationType.EventReservation>;
|
|
5
|
-
export type IUnitPriceSpecification = factory.priceSpecification.IPriceSpecification<factory.priceSpecificationType.UnitPriceSpecification>;
|
|
6
|
-
export type IObjectWithoutDetail = factory.action.authorize.offer.eventService.IObjectWithoutDetail4chevre;
|
|
7
|
-
export type IObjectWithDetail = factory.action.authorize.offer.eventService.IObject<factory.service.webAPI.Identifier.Chevre>;
|
|
8
4
|
export declare function createReserveTransactionStartParams(params: {
|
|
9
5
|
project: {
|
|
10
6
|
id: string;
|
|
11
7
|
};
|
|
12
|
-
|
|
8
|
+
acceptedOffer: factory.action.authorize.offer.eventService.IAcceptedOffer<factory.service.webAPI.Identifier.Chevre>[];
|
|
9
|
+
event: {
|
|
10
|
+
id: string;
|
|
11
|
+
};
|
|
12
|
+
broker?: factory.reservation.IBroker<factory.reservationType>;
|
|
13
13
|
transaction: factory.transaction.ITransaction<factory.transactionType>;
|
|
14
14
|
transactionNumber: string;
|
|
15
15
|
}): factory.assetTransaction.reserve.IStartParamsWithoutDetail;
|
|
@@ -19,6 +19,7 @@ export declare function createAuthorizeSeatReservationActionAttributes(params: {
|
|
|
19
19
|
pendingTransaction: factory.action.authorize.offer.eventService.IChevrePendingTransaction;
|
|
20
20
|
transaction: factory.transaction.ITransaction<factory.transactionType.PlaceOrder>;
|
|
21
21
|
broker?: factory.reservation.IBroker<factory.reservationType.EventReservation>;
|
|
22
|
+
useResultAcceptedOffers: boolean;
|
|
22
23
|
}): factory.action.authorize.offer.eventService.IAttributes<factory.service.webAPI.Identifier.Chevre>;
|
|
23
24
|
export declare function acceptedOffers2amount(params: {
|
|
24
25
|
acceptedOffers: IResultAcceptedOffer[];
|
|
@@ -6,9 +6,9 @@ const moment = require("moment");
|
|
|
6
6
|
const util_1 = require("util");
|
|
7
7
|
const factory = require("../../../factory");
|
|
8
8
|
function createReserveTransactionStartParams(params) {
|
|
9
|
-
var _a
|
|
10
|
-
const acceptedTicketOffersWithoutDetail = (Array.isArray(params.
|
|
11
|
-
? params.
|
|
9
|
+
var _a;
|
|
10
|
+
const acceptedTicketOffersWithoutDetail = (Array.isArray(params.acceptedOffer))
|
|
11
|
+
? params.acceptedOffer.map((o) => {
|
|
12
12
|
var _a, _b, _c, _d, _e;
|
|
13
13
|
const issuedBy = {
|
|
14
14
|
typeOf: params.transaction.seller.typeOf,
|
|
@@ -53,7 +53,7 @@ function createReserveTransactionStartParams(params) {
|
|
|
53
53
|
// }
|
|
54
54
|
// ]
|
|
55
55
|
},
|
|
56
|
-
object: Object.assign({ acceptedOffer: acceptedTicketOffersWithoutDetail, reservationFor: { id:
|
|
56
|
+
object: Object.assign({ acceptedOffer: acceptedTicketOffersWithoutDetail, reservationFor: { id: params.event.id } }, (params.broker !== undefined) ? { broker: params.broker } : undefined),
|
|
57
57
|
expires: moment(params.transaction.expires)
|
|
58
58
|
.add(1, 'month')
|
|
59
59
|
.toDate() // 余裕を持って
|
|
@@ -91,7 +91,7 @@ function createAuthorizeSeatReservationActionAttributes(params) {
|
|
|
91
91
|
return {
|
|
92
92
|
project: transaction.project,
|
|
93
93
|
typeOf: factory.actionType.AuthorizeAction,
|
|
94
|
-
object: Object.assign({ typeOf: factory.action.authorize.offer.eventService.ObjectType.SeatReservation, event: authorizeObjectEvent, acceptedOffer: acceptedOffers, pendingTransaction: params.pendingTransaction }, (params.broker !== undefined) ? { broker: params.broker } : undefined),
|
|
94
|
+
object: Object.assign(Object.assign({ typeOf: factory.action.authorize.offer.eventService.ObjectType.SeatReservation, event: authorizeObjectEvent, acceptedOffer: acceptedOffers, pendingTransaction: params.pendingTransaction }, (params.broker !== undefined) ? { broker: params.broker } : undefined), { useResultAcceptedOffers: params.useResultAcceptedOffers }),
|
|
95
95
|
agent: {
|
|
96
96
|
id: transaction.seller.id,
|
|
97
97
|
typeOf: transaction.seller.typeOf,
|
|
@@ -105,7 +105,8 @@ function createAuthorizeSeatReservationActionAttributes(params) {
|
|
|
105
105
|
},
|
|
106
106
|
purpose: { typeOf: transaction.typeOf, id: transaction.id },
|
|
107
107
|
instrument: {
|
|
108
|
-
typeOf: 'WebAPI',
|
|
108
|
+
// typeOf: 'WebAPI',
|
|
109
|
+
typeOf: factory.assetTransactionType.Reserve,
|
|
109
110
|
identifier: factory.service.webAPI.Identifier.Chevre,
|
|
110
111
|
transactionNumber: params.pendingTransaction.transactionNumber
|
|
111
112
|
}
|
|
@@ -15,10 +15,10 @@ import type { RedisRepository as OfferRateLimitRepo } from '../../../repo/rateLi
|
|
|
15
15
|
import type { MongoRepository as ReservationRepo } from '../../../repo/reservation';
|
|
16
16
|
import type { StockHolderRepository as StockHolderRepo } from '../../../repo/stockHolder';
|
|
17
17
|
import type { MongoRepository as TaskRepo } from '../../../repo/task';
|
|
18
|
-
type IAuthorizeOfferAction = factory.action.authorize.offer.eventService.IAction<factory.service.webAPI.Identifier>;
|
|
19
18
|
declare function processStartReserve4chevre(params: {
|
|
20
|
-
|
|
19
|
+
acceptedOffer: factory.action.authorize.offer.eventService.IAcceptedOffer<factory.service.webAPI.Identifier.Chevre>[];
|
|
21
20
|
event: IMinimizedIndividualEvent<factory.eventType.ScreeningEvent>;
|
|
21
|
+
broker?: factory.reservation.IBroker<factory.reservationType>;
|
|
22
22
|
transactionNumber?: string;
|
|
23
23
|
transaction: factory.transaction.ITransaction<factory.transactionType.PlaceOrder>;
|
|
24
24
|
availableAtOrFrom: {
|
|
@@ -48,6 +48,6 @@ declare function processStartReserve4chevre(params: {
|
|
|
48
48
|
task: TaskRepo;
|
|
49
49
|
assetTransaction: AssetTransactionRepo;
|
|
50
50
|
}) => Promise<{
|
|
51
|
-
acceptedOffers4result:
|
|
51
|
+
acceptedOffers4result: factory.action.authorize.offer.eventService.IResultAcceptedOffer[];
|
|
52
52
|
}>;
|
|
53
53
|
export { processStartReserve4chevre };
|
|
@@ -16,11 +16,10 @@ const CodeService = require("../../code");
|
|
|
16
16
|
const factory_1 = require("./factory");
|
|
17
17
|
function processStartReserve4chevre(params) {
|
|
18
18
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
19
|
-
const action = params.action;
|
|
19
|
+
// const action = params.action;
|
|
20
20
|
const event = params.event;
|
|
21
21
|
const transactionNumber = params.transactionNumber;
|
|
22
22
|
const transaction = params.transaction;
|
|
23
|
-
// let requestBody: factory.assetTransaction.reserve.IStartParamsWithoutDetail;
|
|
24
23
|
let responseBody;
|
|
25
24
|
let acceptedOffers4result = [];
|
|
26
25
|
if (typeof transactionNumber !== 'string') {
|
|
@@ -28,13 +27,10 @@ function processStartReserve4chevre(params) {
|
|
|
28
27
|
throw new factory.errors.ServiceUnavailable('Unexpected error occurred: reserve transactionNumber not found');
|
|
29
28
|
}
|
|
30
29
|
// 予約取引開始
|
|
31
|
-
const startParams = (0, factory_1.createReserveTransactionStartParams)({
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
transactionNumber
|
|
36
|
-
});
|
|
37
|
-
// requestBody = startParams;
|
|
30
|
+
const startParams = (0, factory_1.createReserveTransactionStartParams)(Object.assign({ project: transaction.project,
|
|
31
|
+
// object: <IObjectWithDetail>action.object,
|
|
32
|
+
acceptedOffer: params.acceptedOffer, event: { id: event.id }, transaction,
|
|
33
|
+
transactionNumber }, (params.broker !== undefined) ? { broker: params.broker } : undefined));
|
|
38
34
|
const startParamObject = yield validateObjectWithoutDetail(startParams)(repos);
|
|
39
35
|
// 予約取引開始
|
|
40
36
|
const startReserveTransactionResult = yield ReserveTransactionService.start(Object.assign(Object.assign({}, startParams), { object: startParamObject, preSearchedEvent: event, preSearchedTicketOffers: params.ticketOffers, preSearchedUnitPriceOffers: params.unitPriceOffers, availableAtOrFrom: { id: params.availableAtOrFrom.id }, validateEvent: params.validateEvent, validateEventOfferPeriod: params.validateEventOfferPeriod, validateAppliesToMovieTicket: true, useHoldStockByTransactionNumber: params.useHoldStockByTransactionNumber, stockHoldUntilDaysAfterEventEnd: params.stockHoldUntilDaysAfterEventEnd }))(repos);
|
|
@@ -19,7 +19,7 @@ interface IVoidTransactionRepos {
|
|
|
19
19
|
transaction: TransactionRepo;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* 興行オファー承認取消(タスクから実行)
|
|
23
23
|
* 取引中の承認アクション全てについて処理する
|
|
24
24
|
*/
|
|
25
25
|
export declare function voidTransaction(params: factory.task.IData<factory.taskName.VoidReserveTransaction>): (repos: IVoidTransactionRepos) => Promise<void>;
|
|
@@ -79,7 +79,8 @@ function authorize(params) {
|
|
|
79
79
|
acceptedOffers: [],
|
|
80
80
|
event: { id: params.object.event.id, typeOf: factory.eventType.ScreeningEvent },
|
|
81
81
|
transaction,
|
|
82
|
-
pendingTransaction
|
|
82
|
+
pendingTransaction,
|
|
83
|
+
useResultAcceptedOffers: params.options.useResultAcceptedOffers
|
|
83
84
|
});
|
|
84
85
|
const failedAction = yield repos.action.start(failedActionAttributes);
|
|
85
86
|
yield repos.action.giveUp({ typeOf: failedAction.typeOf, id: failedAction.id, error });
|
|
@@ -91,7 +92,8 @@ function authorize(params) {
|
|
|
91
92
|
acceptedOffers,
|
|
92
93
|
event: screeningEvent,
|
|
93
94
|
transaction,
|
|
94
|
-
pendingTransaction
|
|
95
|
+
pendingTransaction,
|
|
96
|
+
useResultAcceptedOffers: params.options.useResultAcceptedOffers
|
|
95
97
|
});
|
|
96
98
|
const action = yield repos.action.start(actionAttributes);
|
|
97
99
|
try {
|
|
@@ -99,7 +101,8 @@ function authorize(params) {
|
|
|
99
101
|
const { price, eligibleMonetaryAmount } = (0, factory_1.offers2resultPrice)(acceptedOffers);
|
|
100
102
|
const acceptedOffers4result = (0, factory_1.responseBody2acceptedOffers4result)({
|
|
101
103
|
responseBody: params.result.responseBody,
|
|
102
|
-
object: action.object,
|
|
104
|
+
// object: action.object,
|
|
105
|
+
acceptedOffer: acceptedOffers,
|
|
103
106
|
event: screeningEvent,
|
|
104
107
|
seller: transaction.seller,
|
|
105
108
|
bookingTime: moment(action.startDate)
|
|
@@ -84,7 +84,8 @@ function changeOffers(params) {
|
|
|
84
84
|
const { price, eligibleMonetaryAmount } = (0, factory_1.offers2resultPrice)(acceptedOffers);
|
|
85
85
|
const acceptedOffers4result = (0, factory_1.responseBody2acceptedOffers4result)({
|
|
86
86
|
responseBody: updTmpReserveSeatResult,
|
|
87
|
-
object: authorizeAction.object,
|
|
87
|
+
// object: authorizeAction.object,
|
|
88
|
+
acceptedOffer: acceptedOffers,
|
|
88
89
|
event: screeningEvent,
|
|
89
90
|
seller: transaction.seller,
|
|
90
91
|
bookingTime: moment(authorizeAction.startDate)
|
|
@@ -7,6 +7,7 @@ export declare function createAuthorizeSeatReservationActionAttributes(params: {
|
|
|
7
7
|
event: Pick<IMinimizedIndividualEvent<factory.eventType.ScreeningEvent>, 'id' | 'typeOf'>;
|
|
8
8
|
transaction: factory.transaction.ITransaction<factory.transactionType.PlaceOrder>;
|
|
9
9
|
pendingTransaction: factory.action.authorize.offer.eventService.ICOAPendingTransaction;
|
|
10
|
+
useResultAcceptedOffers: boolean;
|
|
10
11
|
}): factory.action.authorize.offer.eventService.IAttributes<WebAPIIdentifier.COA>;
|
|
11
12
|
/**
|
|
12
13
|
* 供給情報から承認アクションの価格を導き出す
|
|
@@ -21,7 +22,7 @@ type IResultAcceptedOffer = factory.action.authorize.offer.eventService.IResultA
|
|
|
21
22
|
*/
|
|
22
23
|
export declare function responseBody2acceptedOffers4result(params: {
|
|
23
24
|
responseBody: factory.action.authorize.offer.eventService.IResponseBody<factory.service.webAPI.Identifier.COA>;
|
|
24
|
-
|
|
25
|
+
acceptedOffer: factory.action.authorize.offer.eventService.IAcceptedOffer<factory.service.webAPI.Identifier.COA>[];
|
|
25
26
|
event: IMinimizedIndividualEvent<factory.eventType.ScreeningEvent>;
|
|
26
27
|
seller: Pick<factory.transaction.placeOrder.ISeller, 'typeOf' | 'name'>;
|
|
27
28
|
bookingTime: Date;
|
|
@@ -23,7 +23,8 @@ function createAuthorizeSeatReservationActionAttributes(params) {
|
|
|
23
23
|
typeOf: factory.action.authorize.offer.eventService.ObjectType.SeatReservation,
|
|
24
24
|
acceptedOffer: params.acceptedOffers,
|
|
25
25
|
event: authorizeObjectEvent,
|
|
26
|
-
pendingTransaction: params.pendingTransaction
|
|
26
|
+
pendingTransaction: params.pendingTransaction,
|
|
27
|
+
useResultAcceptedOffers: params.useResultAcceptedOffers
|
|
27
28
|
};
|
|
28
29
|
return {
|
|
29
30
|
project: transaction.project,
|
|
@@ -42,7 +43,8 @@ function createAuthorizeSeatReservationActionAttributes(params) {
|
|
|
42
43
|
},
|
|
43
44
|
purpose: { typeOf: transaction.typeOf, id: transaction.id },
|
|
44
45
|
instrument: {
|
|
45
|
-
typeOf: 'WebAPI',
|
|
46
|
+
// typeOf: 'WebAPI',
|
|
47
|
+
typeOf: 'COAReserveTransaction',
|
|
46
48
|
identifier: factory.service.webAPI.Identifier.COA,
|
|
47
49
|
transactionNumber: params.pendingTransaction.transactionNumber
|
|
48
50
|
}
|
|
@@ -76,7 +78,7 @@ function responseBody2acceptedOffers4result(params) {
|
|
|
76
78
|
// tslint:disable-next-line:max-func-body-length
|
|
77
79
|
acceptedOffers4result.push(...params.responseBody.listTmpReserve.map((tmpReserve, index) => {
|
|
78
80
|
var _a, _b, _c, _d;
|
|
79
|
-
const requestedOffer = params.
|
|
81
|
+
const requestedOffer = params.acceptedOffer.find((o) => {
|
|
80
82
|
var _a, _b, _c, _d;
|
|
81
83
|
return ((_d = (_c = (_b = (_a = o.itemOffered) === null || _a === void 0 ? void 0 : _a.serviceOutput) === null || _b === void 0 ? void 0 : _b.reservedTicket) === null || _c === void 0 ? void 0 : _c.ticketedSeat) === null || _d === void 0 ? void 0 : _d.seatNumber) === tmpReserve.seatNum
|
|
82
84
|
&& o.itemOffered.serviceOutput.reservedTicket.ticketedSeat.seatSection === tmpReserve.seatSection;
|
package/package.json
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/credential-providers": "3.433.0",
|
|
13
|
-
"@chevre/factory": "4.360.0
|
|
14
|
-
"@cinerino/sdk": "5.13.0
|
|
13
|
+
"@chevre/factory": "4.360.0",
|
|
14
|
+
"@cinerino/sdk": "5.13.0",
|
|
15
15
|
"@motionpicture/coa-service": "9.4.0",
|
|
16
16
|
"@motionpicture/gmo-service": "5.3.0",
|
|
17
17
|
"@sendgrid/mail": "6.4.0",
|
|
@@ -110,5 +110,5 @@
|
|
|
110
110
|
"postversion": "git push origin --tags",
|
|
111
111
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
112
112
|
},
|
|
113
|
-
"version": "21.25.0-alpha.
|
|
113
|
+
"version": "21.25.0-alpha.18"
|
|
114
114
|
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import * as moment from 'moment-timezone';
|
|
3
|
-
import * as mongoose from 'mongoose';
|
|
4
|
-
|
|
5
|
-
import { chevre } from '../../../lib/index';
|
|
6
|
-
|
|
7
|
-
// const project = { id: String(process.env.PROJECT_ID) };
|
|
8
|
-
// const EXCLUDED_PROJECT_ID = process.env.EXCLUDED_PROJECT_ID;
|
|
9
|
-
|
|
10
|
-
// tslint:disable-next-line:max-func-body-length
|
|
11
|
-
async function main() {
|
|
12
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
13
|
-
|
|
14
|
-
const creativeWorkRepo = await chevre.repository.CreativeWork.createInstance(mongoose.connection);
|
|
15
|
-
|
|
16
|
-
const cursor = creativeWorkRepo.getCursor(
|
|
17
|
-
{
|
|
18
|
-
// 'offers.availabilityEnds': { $exists: true }
|
|
19
|
-
},
|
|
20
|
-
{}
|
|
21
|
-
);
|
|
22
|
-
console.log('creativeWorks found');
|
|
23
|
-
|
|
24
|
-
let i = 0;
|
|
25
|
-
let updateCount = 0;
|
|
26
|
-
// let datePublishedUndefinedCount = 0;
|
|
27
|
-
// let datePublishedIsAfterNowCount = 0;
|
|
28
|
-
await cursor.eachAsync(async (doc) => {
|
|
29
|
-
i += 1;
|
|
30
|
-
const movie: chevre.factory.creativeWork.movie.ICreativeWork = doc.toObject();
|
|
31
|
-
|
|
32
|
-
const availabilityEnds = movie.offers.availabilityEnds;
|
|
33
|
-
let availabilityStarts = movie.offers.availabilityStarts;
|
|
34
|
-
const createdAt: Date = (<any>movie).createdAt;
|
|
35
|
-
if (!(createdAt instanceof Date)) {
|
|
36
|
-
throw new Error('createdAt not Date');
|
|
37
|
-
}
|
|
38
|
-
const alreadyMigrated = availabilityStarts instanceof Date
|
|
39
|
-
&& moment(availabilityStarts)
|
|
40
|
-
.isSame(moment(createdAt)
|
|
41
|
-
.tz('Asia/Tokyo')
|
|
42
|
-
.startOf('day')
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
if (alreadyMigrated) {
|
|
46
|
-
console.log(
|
|
47
|
-
'already exist...', movie.project.id, movie.id, movie.identifier, availabilityStarts, availabilityEnds, createdAt, i);
|
|
48
|
-
|
|
49
|
-
// if (moment(movie.datePublished)
|
|
50
|
-
// .isAfter(moment())) {
|
|
51
|
-
// datePublishedIsAfterNowCount += 1;
|
|
52
|
-
// }
|
|
53
|
-
} else {
|
|
54
|
-
// if (movie.datePublished === undefined) {
|
|
55
|
-
// console.error('movie.datePublished undefined', movie.project.id, movie.id, movie.identifier, i);
|
|
56
|
-
// // throw new Error('movie.datePublished undefined');
|
|
57
|
-
// datePublishedUndefinedCount += 1;
|
|
58
|
-
// }
|
|
59
|
-
|
|
60
|
-
availabilityStarts = moment(createdAt)
|
|
61
|
-
.tz('Asia/Tokyo')
|
|
62
|
-
.startOf('day')
|
|
63
|
-
.toDate();
|
|
64
|
-
console.log('updating movie...', movie.project.id, movie.id, movie.identifier, availabilityStarts, availabilityEnds, i);
|
|
65
|
-
await creativeWorkRepo.saveMovie(<any>{
|
|
66
|
-
id: String(movie.id),
|
|
67
|
-
'offers.availabilityStarts': availabilityStarts
|
|
68
|
-
});
|
|
69
|
-
updateCount += 1;
|
|
70
|
-
console.log('updated.', movie.project.id, movie.id, movie.identifier, availabilityStarts, availabilityEnds, i);
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
console.log(i, 'creativeWorks checked');
|
|
75
|
-
console.log(updateCount, 'creativeWorks updated');
|
|
76
|
-
// console.log(datePublishedUndefinedCount, 'datePublishedUndefinedCount');
|
|
77
|
-
// console.log(datePublishedIsAfterNowCount, 'datePublishedIsAfterNowCount');
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
main()
|
|
82
|
-
.then()
|
|
83
|
-
.catch(console.error);
|