@chevre/domain 21.37.0-alpha.10 → 21.37.0-alpha.12
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/lib/chevre/service/assetTransaction/reserve/start.d.ts +1 -0
- package/lib/chevre/service/assetTransaction/reserve/start.js +10 -2
- package/lib/chevre/service/offer/event/{defaultOffer.d.ts → authorize/defaultOffer.d.ts} +1 -1
- package/lib/chevre/service/offer/event/{defaultOffer.js → authorize/defaultOffer.js} +1 -1
- package/lib/chevre/service/offer/event/{factory.d.ts → authorize/factory.d.ts} +13 -20
- package/lib/chevre/service/offer/event/{factory.js → authorize/factory.js} +72 -146
- package/lib/chevre/service/offer/event/{processStartReserve4chevre.d.ts → authorize/processStartReserve4chevre.d.ts} +19 -19
- package/lib/chevre/service/offer/event/{processStartReserve4chevre.js → authorize/processStartReserve4chevre.js} +8 -13
- package/lib/chevre/service/offer/event/authorize.d.ts +1 -1
- package/lib/chevre/service/offer/event/authorize.js +60 -92
- package/lib/chevre/service/offer/event/importFromCOA/factory.d.ts +9 -0
- package/lib/chevre/service/offer/event/importFromCOA/factory.js +67 -0
- package/lib/chevre/service/offer/event/importFromCOA.js +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/factory.d.ts +3 -3
- package/lib/chevre/service/validation/validateOrder.js +1 -1
- package/package.json +3 -3
- package/example/src/chevre/migrateAuthorizeEventServiceOfferResult.ts +0 -163
|
@@ -69,5 +69,6 @@ declare function start(params: IStartParams & {
|
|
|
69
69
|
transaction: Pick<factory.assetTransaction.ITransaction<factory.assetTransactionType.Reserve>, 'id'>;
|
|
70
70
|
objectSubReservations: IObjectSubReservation[];
|
|
71
71
|
issuedThrough: factory.assetTransaction.reserve.IIssuedThrough;
|
|
72
|
+
reservationFor: factory.assetTransaction.reserve.IReservationFor;
|
|
72
73
|
}>;
|
|
73
74
|
export { start };
|
|
@@ -77,14 +77,15 @@ function start(params) {
|
|
|
77
77
|
transaction: { id },
|
|
78
78
|
objectSubReservations,
|
|
79
79
|
// issuedThrough: addReservationsResult.issuedThrough
|
|
80
|
-
issuedThrough: startParams.object.issuedThrough
|
|
80
|
+
issuedThrough: startParams.object.issuedThrough,
|
|
81
|
+
reservationFor: startParams.object.reservationFor
|
|
81
82
|
};
|
|
82
83
|
});
|
|
83
84
|
}
|
|
84
85
|
exports.start = start;
|
|
85
86
|
function fixEvent(params) {
|
|
86
87
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
87
|
-
var _a, _b;
|
|
88
|
+
var _a, _b, _c;
|
|
88
89
|
const reservationForId = (_a = params.object.reservationFor) === null || _a === void 0 ? void 0 : _a.id;
|
|
89
90
|
if (typeof reservationForId !== 'string' || reservationForId.length === 0) {
|
|
90
91
|
throw new factory.errors.ArgumentNull('object.reservationFor.id');
|
|
@@ -96,6 +97,13 @@ function fixEvent(params) {
|
|
|
96
97
|
else {
|
|
97
98
|
event = yield repos.event.findMinimizedIndividualEventById({ id: reservationForId });
|
|
98
99
|
}
|
|
100
|
+
let offeredThrough = (_c = event.offers) === null || _c === void 0 ? void 0 : _c.offeredThrough;
|
|
101
|
+
if (offeredThrough === undefined) {
|
|
102
|
+
offeredThrough = { typeOf: 'WebAPI', identifier: factory.service.webAPI.Identifier.Chevre };
|
|
103
|
+
}
|
|
104
|
+
if (offeredThrough.identifier === factory.service.webAPI.Identifier.COA) {
|
|
105
|
+
throw new factory.errors.NotImplemented(`${offeredThrough.identifier} not implemented`);
|
|
106
|
+
}
|
|
99
107
|
return event;
|
|
100
108
|
});
|
|
101
109
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as factory from '
|
|
1
|
+
import * as factory from '../../../../factory';
|
|
2
2
|
declare const DEFAULT_OFFER_ID = "****AUTOMATICALLY_APPLIED****";
|
|
3
3
|
declare const DEFAULT_TICKET_OFFER: factory.product.ITicketOffer;
|
|
4
4
|
declare const DEFAULT_AVAILABLE_OFFER: factory.unitPriceOffer.IUnitPriceOffer;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DEFAULT_AVAILABLE_OFFER = exports.DEFAULT_TICKET_OFFER = exports.DEFAULT_OFFER_ID = void 0;
|
|
4
|
-
const factory = require("
|
|
4
|
+
const factory = require("../../../../factory");
|
|
5
5
|
const DEFAULT_OFFER_ID = '****AUTOMATICALLY_APPLIED****';
|
|
6
6
|
exports.DEFAULT_OFFER_ID = DEFAULT_OFFER_ID;
|
|
7
7
|
const DEFAULT_OFFER_IDENTIFIER = '****AUTOMATICALLY_APPLIED****';
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
export declare function createReserveTransactionStartParams(params: {
|
|
1
|
+
import * as factory from '../../../../factory';
|
|
2
|
+
import { IMinimizedIndividualEvent } from '../../../../factory/event';
|
|
3
|
+
declare function createReserveTransactionStartParams(params: {
|
|
5
4
|
project: {
|
|
6
5
|
id: string;
|
|
7
6
|
};
|
|
8
|
-
|
|
7
|
+
acceptedOffers: factory.action.authorize.offer.eventService.IAcceptedOffer4chevre[];
|
|
9
8
|
event: {
|
|
10
9
|
id: string;
|
|
11
10
|
};
|
|
12
11
|
broker?: factory.reservation.IBroker<factory.reservationType>;
|
|
13
|
-
transaction: Pick<factory.transaction.ITransaction<factory.transactionType.PlaceOrder>, '
|
|
12
|
+
transaction: Pick<factory.transaction.ITransaction<factory.transactionType.PlaceOrder>, 'expires' | 'seller'>;
|
|
14
13
|
transactionNumber: string;
|
|
15
14
|
}): factory.assetTransaction.reserve.IStartParamsWithoutDetail;
|
|
16
|
-
|
|
17
|
-
event: IMinimizedIndividualEvent<factory.eventType.ScreeningEvent>;
|
|
15
|
+
declare function createAuthorizeSeatReservationActionAttributes(params: {
|
|
16
|
+
event: Pick<IMinimizedIndividualEvent<factory.eventType.ScreeningEvent>, 'id' | 'typeOf'>;
|
|
18
17
|
instrument: {
|
|
19
18
|
/**
|
|
20
19
|
* 予約取引番号
|
|
@@ -22,33 +21,27 @@ export declare function createAuthorizeSeatReservationActionAttributes(params: {
|
|
|
22
21
|
transactionNumber: string;
|
|
23
22
|
};
|
|
24
23
|
transaction: Pick<factory.transaction.ITransaction<factory.transactionType.PlaceOrder>, 'agent' | 'id' | 'project' | 'seller' | 'typeOf'>;
|
|
25
|
-
broker?: factory.reservation.IBroker<factory.reservationType.EventReservation>;
|
|
26
24
|
}): factory.action.authorize.offer.eventService.IAttributes<factory.service.webAPI.Identifier.Chevre>;
|
|
27
|
-
|
|
25
|
+
declare function acceptedOffers2amount(params: {
|
|
28
26
|
acceptedOffers: IResultAcceptedOffer[];
|
|
29
27
|
}): number;
|
|
30
|
-
|
|
28
|
+
declare function acceptedOffers2authorizeResult(params: {
|
|
31
29
|
acceptedOffers: factory.action.authorize.offer.eventService.IAcceptedOffer4chevre[];
|
|
32
30
|
acceptedOffers4result: IResultAcceptedOffer[];
|
|
33
31
|
noOfferSpecified: boolean;
|
|
32
|
+
ticketOffers: factory.product.ITicketOffer[];
|
|
34
33
|
}): factory.action.authorize.offer.eventService.IResult;
|
|
35
34
|
type IObjectSubReservation = factory.assetTransaction.reserve.IObjectSubReservation;
|
|
36
35
|
type IResultAcceptedOffer = factory.action.authorize.offer.eventService.IResultAcceptedOffer;
|
|
37
|
-
|
|
36
|
+
declare function responseBody2acceptedOffers4result(params: {
|
|
38
37
|
issuedThrough: factory.assetTransaction.reserve.IIssuedThrough;
|
|
38
|
+
reservationFor: factory.assetTransaction.reserve.IReservationFor;
|
|
39
39
|
objectSubReservations: IObjectSubReservation[];
|
|
40
40
|
transactionNumber: string;
|
|
41
|
-
event: IMinimizedIndividualEvent<factory.eventType.ScreeningEvent>;
|
|
42
41
|
project: {
|
|
43
42
|
id: string;
|
|
44
43
|
typeOf: factory.organizationType.Project;
|
|
45
44
|
};
|
|
46
45
|
seller: factory.transaction.placeOrder.ISeller;
|
|
47
46
|
}): IResultAcceptedOffer[];
|
|
48
|
-
export
|
|
49
|
-
theaterCode: string;
|
|
50
|
-
ticketResult: COA.factory.master.ITicketResult;
|
|
51
|
-
defaultCurrencyType?: factory.categoryCode.ICategoryCode;
|
|
52
|
-
defaultMembershipType?: factory.categoryCode.ICategoryCode;
|
|
53
|
-
}): factory.aggregateOffer.ISubOffer;
|
|
54
|
-
export {};
|
|
47
|
+
export { acceptedOffers2amount, acceptedOffers2authorizeResult, createAuthorizeSeatReservationActionAttributes, createReserveTransactionStartParams, responseBody2acceptedOffers4result };
|
|
@@ -1,59 +1,54 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const COA = require("@motionpicture/coa-service");
|
|
3
|
+
exports.responseBody2acceptedOffers4result = exports.createReserveTransactionStartParams = exports.createAuthorizeSeatReservationActionAttributes = exports.acceptedOffers2authorizeResult = exports.acceptedOffers2amount = void 0;
|
|
5
4
|
const moment = require("moment");
|
|
6
|
-
const
|
|
7
|
-
const factory = require("../../../factory");
|
|
5
|
+
const factory = require("../../../../factory");
|
|
8
6
|
function createReserveTransactionStartParams(params) {
|
|
9
7
|
var _a;
|
|
10
|
-
const
|
|
11
|
-
|
|
8
|
+
const { transaction, transactionNumber } = params;
|
|
9
|
+
const { seller } = transaction;
|
|
10
|
+
const acceptedTicketOffersWithoutDetail = (Array.isArray(params.acceptedOffers))
|
|
11
|
+
? params.acceptedOffers.map((o) => {
|
|
12
12
|
var _a, _b, _c, _d, _e;
|
|
13
13
|
const issuedBy = {
|
|
14
|
-
typeOf:
|
|
15
|
-
name: (typeof
|
|
16
|
-
? params.transaction.seller.name
|
|
17
|
-
: String((_a = params.transaction.seller.name) === null || _a === void 0 ? void 0 : _a.ja)
|
|
14
|
+
typeOf: seller.typeOf,
|
|
15
|
+
name: (typeof seller.name === 'string') ? seller.name : String((_a = seller.name) === null || _a === void 0 ? void 0 : _a.ja)
|
|
18
16
|
};
|
|
19
17
|
// 適用決済カード情報を連携(複数対応)(2022-08-02~)
|
|
20
18
|
let appliesToMovieTicket;
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
const appliesToMovieTicketFromAcceptedOffer = (_b = o.priceSpecification) === null || _b === void 0 ? void 0 : _b.appliesToMovieTicket;
|
|
20
|
+
if (Array.isArray(appliesToMovieTicketFromAcceptedOffer)) {
|
|
21
|
+
appliesToMovieTicket = appliesToMovieTicketFromAcceptedOffer;
|
|
23
22
|
}
|
|
24
|
-
else if (typeof (
|
|
25
|
-
appliesToMovieTicket = { identifier:
|
|
23
|
+
else if (typeof (appliesToMovieTicketFromAcceptedOffer === null || appliesToMovieTicketFromAcceptedOffer === void 0 ? void 0 : appliesToMovieTicketFromAcceptedOffer.identifier) === 'string') {
|
|
24
|
+
appliesToMovieTicket = { identifier: appliesToMovieTicketFromAcceptedOffer.identifier };
|
|
26
25
|
}
|
|
27
26
|
return Object.assign(Object.assign({
|
|
28
27
|
// 必要な属性のみ指定する
|
|
29
28
|
id: o.id, itemOffered: Object.assign(Object.assign({}, o.itemOffered), { serviceOutput: Object.assign(Object.assign({}, (_c = o.itemOffered) === null || _c === void 0 ? void 0 : _c.serviceOutput), { reservedTicket: Object.assign(Object.assign({}, (_e = (_d = o.itemOffered) === null || _d === void 0 ? void 0 : _d.serviceOutput) === null || _e === void 0 ? void 0 : _e.reservedTicket), {
|
|
30
29
|
// issuedByを明示的に指定する
|
|
31
|
-
issuedBy, typeOf: 'Ticket' }), typeOf: factory.reservationType.EventReservation }) }) }, (Array.isArray(o.addOn)) ? { addOn: o.addOn } : undefined), (appliesToMovieTicket !== undefined)
|
|
32
|
-
? { priceSpecification: { appliesToMovieTicket } }
|
|
33
|
-
: undefined);
|
|
30
|
+
issuedBy, typeOf: 'Ticket' }), typeOf: factory.reservationType.EventReservation }) }) }, (Array.isArray(o.addOn)) ? { addOn: o.addOn } : undefined), (appliesToMovieTicket !== undefined) ? { priceSpecification: { appliesToMovieTicket } } : undefined);
|
|
34
31
|
})
|
|
35
32
|
: undefined;
|
|
33
|
+
const agent = {
|
|
34
|
+
typeOf: seller.typeOf,
|
|
35
|
+
id: seller.id,
|
|
36
|
+
name: (typeof seller.name === 'string') ? seller.name : String((_a = seller.name) === null || _a === void 0 ? void 0 : _a.ja)
|
|
37
|
+
// identifierを廃止(2024-03-05~)
|
|
38
|
+
// identifier: [
|
|
39
|
+
// { name: 'transaction', value: params.transaction.id },
|
|
40
|
+
// {
|
|
41
|
+
// name: 'transactionExpires',
|
|
42
|
+
// value: moment(params.transaction.expires)
|
|
43
|
+
// .toISOString()
|
|
44
|
+
// }
|
|
45
|
+
// ]
|
|
46
|
+
};
|
|
47
|
+
const object = Object.assign({ acceptedOffer: acceptedTicketOffersWithoutDetail, reservationFor: { id: params.event.id } }, (params.broker !== undefined) ? { broker: params.broker } : undefined);
|
|
36
48
|
return {
|
|
37
49
|
project: { typeOf: factory.organizationType.Project, id: params.project.id },
|
|
38
50
|
typeOf: factory.assetTransactionType.Reserve,
|
|
39
|
-
transactionNumber
|
|
40
|
-
agent: {
|
|
41
|
-
typeOf: params.transaction.seller.typeOf,
|
|
42
|
-
id: params.transaction.seller.id,
|
|
43
|
-
name: (typeof params.transaction.seller.name === 'string')
|
|
44
|
-
? params.transaction.seller.name
|
|
45
|
-
: String((_a = params.transaction.seller.name) === null || _a === void 0 ? void 0 : _a.ja)
|
|
46
|
-
// identifierを廃止(2024-03-05~)
|
|
47
|
-
// identifier: [
|
|
48
|
-
// { name: 'transaction', value: params.transaction.id },
|
|
49
|
-
// {
|
|
50
|
-
// name: 'transactionExpires',
|
|
51
|
-
// value: moment(params.transaction.expires)
|
|
52
|
-
// .toISOString()
|
|
53
|
-
// }
|
|
54
|
-
// ]
|
|
55
|
-
},
|
|
56
|
-
object: Object.assign({ acceptedOffer: acceptedTicketOffersWithoutDetail, reservationFor: { id: params.event.id } }, (params.broker !== undefined) ? { broker: params.broker } : undefined),
|
|
51
|
+
transactionNumber, agent, object,
|
|
57
52
|
expires: moment(params.transaction.expires)
|
|
58
53
|
.add(1, 'month')
|
|
59
54
|
.toDate() // 余裕を持って
|
|
@@ -63,20 +58,7 @@ exports.createReserveTransactionStartParams = createReserveTransactionStartParam
|
|
|
63
58
|
function createAuthorizeSeatReservationActionAttributes(params) {
|
|
64
59
|
var _a;
|
|
65
60
|
// const acceptedOffers = params.acceptedOffers;
|
|
66
|
-
const event = params
|
|
67
|
-
const transaction = params.transaction;
|
|
68
|
-
const offers = event.offers;
|
|
69
|
-
if (offers === undefined) {
|
|
70
|
-
throw new factory.errors.NotFound('EventOffers', 'Event offers undefined');
|
|
71
|
-
}
|
|
72
|
-
let offeredThrough = offers.offeredThrough;
|
|
73
|
-
if (offeredThrough === undefined) {
|
|
74
|
-
offeredThrough = { typeOf: 'WebAPI', identifier: factory.service.webAPI.Identifier.Chevre };
|
|
75
|
-
}
|
|
76
|
-
if (offeredThrough.identifier === factory.service.webAPI.Identifier.COA) {
|
|
77
|
-
throw new factory.errors.NotImplemented(`offeredThrough.identifier not implemented`);
|
|
78
|
-
}
|
|
79
|
-
// 最適化(2022-06-07~)
|
|
61
|
+
const { event, transaction } = params;
|
|
80
62
|
const authorizeObjectEvent = {
|
|
81
63
|
id: event.id,
|
|
82
64
|
// イベント提供サービスを識別できるようにするために追加(2022-06-04~)
|
|
@@ -102,23 +84,22 @@ function createAuthorizeSeatReservationActionAttributes(params) {
|
|
|
102
84
|
identifier: factory.service.webAPI.Identifier.Chevre,
|
|
103
85
|
transactionNumber: params.instrument.transactionNumber
|
|
104
86
|
};
|
|
87
|
+
const agent = {
|
|
88
|
+
id: transaction.seller.id,
|
|
89
|
+
typeOf: transaction.seller.typeOf,
|
|
90
|
+
name: (typeof transaction.seller.name === 'string')
|
|
91
|
+
? transaction.seller.name
|
|
92
|
+
: String((_a = transaction.seller.name) === null || _a === void 0 ? void 0 : _a.ja)
|
|
93
|
+
};
|
|
94
|
+
const recipient = {
|
|
95
|
+
typeOf: transaction.agent.typeOf,
|
|
96
|
+
id: transaction.agent.id
|
|
97
|
+
};
|
|
105
98
|
return {
|
|
106
99
|
project: transaction.project,
|
|
107
100
|
typeOf: factory.actionType.AuthorizeAction,
|
|
108
|
-
object,
|
|
109
|
-
|
|
110
|
-
id: transaction.seller.id,
|
|
111
|
-
typeOf: transaction.seller.typeOf,
|
|
112
|
-
name: (typeof transaction.seller.name === 'string')
|
|
113
|
-
? transaction.seller.name
|
|
114
|
-
: String((_a = transaction.seller.name) === null || _a === void 0 ? void 0 : _a.ja)
|
|
115
|
-
},
|
|
116
|
-
recipient: {
|
|
117
|
-
typeOf: transaction.agent.typeOf,
|
|
118
|
-
id: transaction.agent.id
|
|
119
|
-
},
|
|
120
|
-
purpose: { typeOf: transaction.typeOf, id: transaction.id },
|
|
121
|
-
instrument
|
|
101
|
+
object, agent, recipient, instrument,
|
|
102
|
+
purpose: { typeOf: transaction.typeOf, id: transaction.id }
|
|
122
103
|
};
|
|
123
104
|
}
|
|
124
105
|
exports.createAuthorizeSeatReservationActionAttributes = createAuthorizeSeatReservationActionAttributes;
|
|
@@ -156,9 +137,9 @@ function acceptedOffers2amount(params) {
|
|
|
156
137
|
}
|
|
157
138
|
exports.acceptedOffers2amount = acceptedOffers2amount;
|
|
158
139
|
function acceptedOffers2authorizeResult(params) {
|
|
159
|
-
|
|
160
|
-
const
|
|
161
|
-
const priceCurrency =
|
|
140
|
+
const { acceptedOffers, acceptedOffers4result, noOfferSpecified, ticketOffers } = params;
|
|
141
|
+
// const priceCurrency = acceptedOffers[0]?.priceSpecification?.priceCurrency;
|
|
142
|
+
const priceCurrency = factory.priceCurrency.JPY; // fix(2024-07-03~)
|
|
162
143
|
// redefine as typeOf: AggregateOffer(2024-06-18~)
|
|
163
144
|
let offers;
|
|
164
145
|
let price;
|
|
@@ -167,10 +148,14 @@ function acceptedOffers2authorizeResult(params) {
|
|
|
167
148
|
// オファーIDごとに集計
|
|
168
149
|
const offerIds = [...new Set(acceptedOffers.map((o) => o.id))];
|
|
169
150
|
offers = offerIds.map((offerId) => {
|
|
170
|
-
const acceptedOffer =
|
|
151
|
+
const acceptedOffer = ticketOffers.find(({ id }) => id === offerId);
|
|
171
152
|
if (acceptedOffer === undefined) {
|
|
172
153
|
throw new factory.errors.Internal(`acceptedOffer not found [id:${offerId}]`);
|
|
173
154
|
}
|
|
155
|
+
// const acceptedOffer = acceptedOffers.find(({ id }) => id === offerId);
|
|
156
|
+
// if (acceptedOffer === undefined) {
|
|
157
|
+
// throw new factory.errors.Internal(`acceptedOffer not found [id:${offerId}]`);
|
|
158
|
+
// }
|
|
174
159
|
const amountOfThisGood = acceptedOffers.filter(({ id }) => id === offerId).length;
|
|
175
160
|
const { acceptedPaymentMethod, priceSpecification } = acceptedOffer;
|
|
176
161
|
const unitPriceSpec = priceSpecification.priceComponent.find((spec) => spec.typeOf === factory.priceSpecificationType.UnitPriceSpecification
|
|
@@ -194,7 +179,8 @@ function responseBody2acceptedOffers4result(params) {
|
|
|
194
179
|
const reservation = createReservation({
|
|
195
180
|
project: params.project,
|
|
196
181
|
itemOffered,
|
|
197
|
-
event: params.event,
|
|
182
|
+
// event: params.event,
|
|
183
|
+
reservationFor: params.reservationFor,
|
|
198
184
|
issuedThrough: params.issuedThrough,
|
|
199
185
|
reservationNumber: params.transactionNumber
|
|
200
186
|
});
|
|
@@ -244,9 +230,10 @@ exports.responseBody2acceptedOffers4result = responseBody2acceptedOffers4result;
|
|
|
244
230
|
*/
|
|
245
231
|
// tslint:disable-next-line:max-func-body-length
|
|
246
232
|
function createReservation(params) {
|
|
247
|
-
var _a, _b
|
|
248
|
-
const itemOffered = params
|
|
249
|
-
const
|
|
233
|
+
var _a, _b;
|
|
234
|
+
// const { itemOffered, event, reservationFor } = params;
|
|
235
|
+
const { itemOffered } = params;
|
|
236
|
+
const event = params.reservationFor;
|
|
250
237
|
let reservationItem;
|
|
251
238
|
const reservedTicket = Object.assign(Object.assign({ typeOf: itemOffered.reservedTicket.typeOf, ticketType: {
|
|
252
239
|
typeOf: itemOffered.reservedTicket.ticketType.typeOf,
|
|
@@ -288,30 +275,30 @@ function createReservation(params) {
|
|
|
288
275
|
: undefined);
|
|
289
276
|
}
|
|
290
277
|
else if (itemOffered.typeOf === factory.reservationType.BusReservation
|
|
291
|
-
&& event.typeOf === factory.
|
|
292
|
-
const tripByEvent =
|
|
293
|
-
if (typeof
|
|
294
|
-
|
|
295
|
-
}
|
|
278
|
+
&& event.typeOf === factory.tripType.BusTrip) {
|
|
279
|
+
// const tripByEvent = event.offers?.itemOffered.serviceOutput?.reservationFor;
|
|
280
|
+
// if (typeof tripByEvent?.typeOf !== 'string') {
|
|
281
|
+
// throw new factory.errors.NotFound('event.offers.itemOffered.serviceOutput.reservationFor');
|
|
282
|
+
// }
|
|
296
283
|
const reservationFor = {
|
|
297
|
-
typeOf:
|
|
284
|
+
typeOf: event.typeOf,
|
|
298
285
|
id: event.id,
|
|
299
|
-
arrivalBusStop:
|
|
300
|
-
departureBusStop:
|
|
286
|
+
arrivalBusStop: event.arrivalBusStop,
|
|
287
|
+
departureBusStop: event.departureBusStop,
|
|
301
288
|
name: event.name,
|
|
302
|
-
departureTime: moment(
|
|
289
|
+
departureTime: moment(event.departureTime)
|
|
303
290
|
.toDate(),
|
|
304
|
-
arrivalTime: moment(
|
|
291
|
+
arrivalTime: moment(event.arrivalTime)
|
|
305
292
|
.toDate(),
|
|
306
|
-
busName:
|
|
307
|
-
busNumber:
|
|
308
|
-
identifier:
|
|
293
|
+
busName: event.busName,
|
|
294
|
+
busNumber: event.busNumber,
|
|
295
|
+
identifier: event.identifier
|
|
309
296
|
};
|
|
310
297
|
if (params.issuedThrough.typeOf !== factory.product.ProductType.Transportation) {
|
|
311
298
|
throw new factory.errors.Argument('issuedThrough', `issuedThrough.typeOf must be ${factory.product.ProductType.Transportation}`);
|
|
312
299
|
}
|
|
313
300
|
reservationItem = Object.assign({ typeOf: itemOffered.typeOf, additionalProperty: itemOffered.additionalProperty, additionalTicketText: itemOffered.additionalTicketText, id: itemOffered.id, issuedThrough: params.issuedThrough, reservationNumber: params.reservationNumber, reservationFor,
|
|
314
|
-
reservedTicket }, (typeof ((
|
|
301
|
+
reservedTicket }, (typeof ((_b = itemOffered.programMembershipUsed) === null || _b === void 0 ? void 0 : _b.typeOf) === 'string')
|
|
315
302
|
? { programMembershipUsed: itemOffered.programMembershipUsed }
|
|
316
303
|
: undefined);
|
|
317
304
|
}
|
|
@@ -320,64 +307,3 @@ function createReservation(params) {
|
|
|
320
307
|
}
|
|
321
308
|
return reservationItem;
|
|
322
309
|
}
|
|
323
|
-
// tslint:disable-next-line:max-func-body-length
|
|
324
|
-
function coaTicket2offer(params) {
|
|
325
|
-
var _a, _b;
|
|
326
|
-
// 適用通貨区分
|
|
327
|
-
const eligibleMonetaryAmount = (typeof params.ticketResult.usePoint === 'number' && params.ticketResult.usePoint > 0
|
|
328
|
-
&& typeof ((_a = params.defaultCurrencyType) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string')
|
|
329
|
-
? [{
|
|
330
|
-
typeOf: 'MonetaryAmount',
|
|
331
|
-
currency: params.defaultCurrencyType.codeValue,
|
|
332
|
-
value: Number(params.ticketResult.usePoint)
|
|
333
|
-
}]
|
|
334
|
-
: undefined;
|
|
335
|
-
// 適用メンバーシップ区分
|
|
336
|
-
const eligibleMembershipType = (params.ticketResult.flgMember === COA.factory.master.FlgMember.Member
|
|
337
|
-
&& typeof ((_b = params.defaultMembershipType) === null || _b === void 0 ? void 0 : _b.typeOf) === 'string')
|
|
338
|
-
? [{
|
|
339
|
-
typeOf: params.defaultMembershipType.typeOf,
|
|
340
|
-
id: params.defaultMembershipType.id,
|
|
341
|
-
codeValue: params.defaultMembershipType.codeValue,
|
|
342
|
-
inCodeSet: params.defaultMembershipType.inCodeSet
|
|
343
|
-
}]
|
|
344
|
-
: undefined;
|
|
345
|
-
const unitPriceSpec = {
|
|
346
|
-
typeOf: factory.priceSpecificationType.UnitPriceSpecification,
|
|
347
|
-
price: 0,
|
|
348
|
-
priceCurrency: factory.priceCurrency.JPY,
|
|
349
|
-
valueAddedTaxIncluded: true,
|
|
350
|
-
referenceQuantity: {
|
|
351
|
-
typeOf: 'QuantitativeValue',
|
|
352
|
-
unitCode: factory.unitCode.C62,
|
|
353
|
-
value: 1
|
|
354
|
-
}
|
|
355
|
-
};
|
|
356
|
-
const identifier = (0, util_1.format)('%s-%s-%s', factory.service.webAPI.Identifier.COA, params.theaterCode, params.ticketResult.ticketCode);
|
|
357
|
-
const offerName = {
|
|
358
|
-
ja: params.ticketResult.ticketName,
|
|
359
|
-
en: (typeof params.ticketResult.ticketNameEng === 'string')
|
|
360
|
-
? params.ticketResult.ticketNameEng
|
|
361
|
-
: ''
|
|
362
|
-
};
|
|
363
|
-
return Object.assign(Object.assign(Object.assign({ typeOf: factory.offerType.Offer, priceCurrency: factory.priceCurrency.JPY,
|
|
364
|
-
// id: '',
|
|
365
|
-
identifier: identifier, name: offerName, description: {
|
|
366
|
-
ja: '',
|
|
367
|
-
en: ''
|
|
368
|
-
}, alternateName: {
|
|
369
|
-
ja: params.ticketResult.ticketName,
|
|
370
|
-
en: (typeof params.ticketResult.ticketNameEng === 'string')
|
|
371
|
-
? params.ticketResult.ticketNameEng
|
|
372
|
-
: ''
|
|
373
|
-
}, availability: factory.itemAvailability.InStock, itemOffered: {
|
|
374
|
-
typeOf: factory.product.ProductType.EventService
|
|
375
|
-
}, priceSpecification: unitPriceSpec }, (Array.isArray(eligibleMembershipType)) ? { eligibleMembershipType } : undefined), (Array.isArray(eligibleMonetaryAmount)) ? { eligibleMonetaryAmount } : undefined), { additionalProperty: [
|
|
376
|
-
{ name: 'theaterCode', value: params.theaterCode },
|
|
377
|
-
...Object.keys(params.ticketResult)
|
|
378
|
-
.map((key) => {
|
|
379
|
-
return { name: String(key), value: String(params.ticketResult[key]) };
|
|
380
|
-
})
|
|
381
|
-
] });
|
|
382
|
-
}
|
|
383
|
-
exports.coaTicket2offer = coaTicket2offer;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import * as factory from '
|
|
2
|
-
import type { MongoRepository as ActionRepo } from '
|
|
3
|
-
import type { MongoRepository as AssetTransactionRepo } from '
|
|
4
|
-
import type { AuthorizationRepo } from '
|
|
5
|
-
import type { IMinimizedIndividualEvent, MongoRepository as EventRepo } from '
|
|
6
|
-
import type { MongoRepository as OfferRepo } from '
|
|
7
|
-
import type { MongoRepository as OfferCatalogRepo } from '
|
|
8
|
-
import type { MongoRepository as OfferCatalogItemRepo } from '
|
|
9
|
-
import type { MongoRepository as PaymentServiceRepo } from '
|
|
10
|
-
import type { MongoRepository as SeatRepo } from '
|
|
11
|
-
import type { MongoRepository as PriceSpecificationRepo } from '
|
|
12
|
-
import type { MongoRepository as ProductRepo } from '
|
|
13
|
-
import type { MongoRepository as ProductOfferRepo } from '
|
|
14
|
-
import type { MongoRepository as ProjectRepo } from '
|
|
15
|
-
import type { RedisRepository as OfferRateLimitRepo } from '
|
|
16
|
-
import type { StockHolderRepository as StockHolderRepo } from '
|
|
17
|
-
import type { MongoRepository as TaskRepo } from '
|
|
18
|
-
import type { TicketRepo } from '
|
|
1
|
+
import * as factory from '../../../../factory';
|
|
2
|
+
import type { MongoRepository as ActionRepo } from '../../../../repo/action';
|
|
3
|
+
import type { MongoRepository as AssetTransactionRepo } from '../../../../repo/assetTransaction';
|
|
4
|
+
import type { AuthorizationRepo } from '../../../../repo/code';
|
|
5
|
+
import type { IMinimizedIndividualEvent, MongoRepository as EventRepo } from '../../../../repo/event';
|
|
6
|
+
import type { MongoRepository as OfferRepo } from '../../../../repo/offer';
|
|
7
|
+
import type { MongoRepository as OfferCatalogRepo } from '../../../../repo/offerCatalog';
|
|
8
|
+
import type { MongoRepository as OfferCatalogItemRepo } from '../../../../repo/offerCatalogItem';
|
|
9
|
+
import type { MongoRepository as PaymentServiceRepo } from '../../../../repo/paymentService';
|
|
10
|
+
import type { MongoRepository as SeatRepo } from '../../../../repo/place/seat';
|
|
11
|
+
import type { MongoRepository as PriceSpecificationRepo } from '../../../../repo/priceSpecification';
|
|
12
|
+
import type { MongoRepository as ProductRepo } from '../../../../repo/product';
|
|
13
|
+
import type { MongoRepository as ProductOfferRepo } from '../../../../repo/productOffer';
|
|
14
|
+
import type { MongoRepository as ProjectRepo } from '../../../../repo/project';
|
|
15
|
+
import type { RedisRepository as OfferRateLimitRepo } from '../../../../repo/rateLimit/offer';
|
|
16
|
+
import type { StockHolderRepository as StockHolderRepo } from '../../../../repo/stockHolder';
|
|
17
|
+
import type { MongoRepository as TaskRepo } from '../../../../repo/task';
|
|
18
|
+
import type { TicketRepo } from '../../../../repo/ticket';
|
|
19
19
|
declare function processStartReserve4chevre(params: {
|
|
20
|
-
|
|
20
|
+
acceptedOffers: factory.action.authorize.offer.eventService.IAcceptedOffer4chevre[];
|
|
21
21
|
event: IMinimizedIndividualEvent<factory.eventType.ScreeningEvent>;
|
|
22
22
|
broker?: factory.reservation.IBroker<factory.reservationType>;
|
|
23
23
|
transactionNumber: string;
|
|
@@ -10,35 +10,30 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.processStartReserve4chevre = void 0;
|
|
13
|
-
const factory = require("
|
|
14
|
-
const ReserveTransactionService = require("
|
|
15
|
-
const CodeService = require("
|
|
13
|
+
const factory = require("../../../../factory");
|
|
14
|
+
const ReserveTransactionService = require("../../../assetTransaction/reserve");
|
|
15
|
+
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 event = params
|
|
20
|
-
const transactionNumber = params.transactionNumber;
|
|
21
|
-
const transaction = params.transaction;
|
|
22
|
-
// let responseBody: factory.assetTransaction.reserve.ITransaction;
|
|
19
|
+
const { event, transaction, transactionNumber } = params;
|
|
23
20
|
let acceptedOffers4result = [];
|
|
24
21
|
// 予約取引開始
|
|
25
22
|
const startParams = (0, factory_1.createReserveTransactionStartParams)(Object.assign({ project: transaction.project,
|
|
26
23
|
// object: <IObjectWithDetail>action.object,
|
|
27
|
-
|
|
24
|
+
acceptedOffers: params.acceptedOffers, event: { id: event.id }, transaction,
|
|
28
25
|
transactionNumber }, (params.broker !== undefined) ? { broker: params.broker } : undefined));
|
|
29
26
|
const startParamObject = yield validateObjectWithoutDetail(startParams)(repos);
|
|
30
|
-
// 予約取引開始
|
|
31
27
|
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,
|
|
32
28
|
// useHoldStockByTransactionNumber: params.useHoldStockByTransactionNumber, // discontinue(2024-07-02~)
|
|
33
29
|
stockHoldUntilDaysAfterEventEnd: params.stockHoldUntilDaysAfterEventEnd }))(repos);
|
|
34
|
-
//
|
|
35
|
-
// 予約取引からオファー情報を生成する
|
|
30
|
+
// 予約取引結果から注文オファーを生成する
|
|
36
31
|
acceptedOffers4result = (0, factory_1.responseBody2acceptedOffers4result)({
|
|
37
32
|
issuedThrough: startReserveTransactionResult.issuedThrough,
|
|
33
|
+
reservationFor: startReserveTransactionResult.reservationFor,
|
|
38
34
|
objectSubReservations: startReserveTransactionResult.objectSubReservations,
|
|
39
35
|
transactionNumber,
|
|
40
|
-
//
|
|
41
|
-
event: event,
|
|
36
|
+
// event: event,
|
|
42
37
|
project: transaction.project,
|
|
43
38
|
seller: transaction.seller
|
|
44
39
|
});
|
|
@@ -45,7 +45,7 @@ interface IAuthorizeRepos {
|
|
|
45
45
|
}
|
|
46
46
|
type IAuthorizeOperation<T> = (repos: IAuthorizeRepos) => Promise<T>;
|
|
47
47
|
type IAuthorizeOfferAction = factory.action.authorize.offer.eventService.IAction<factory.service.webAPI.Identifier>;
|
|
48
|
-
type IObjectWithoutDetail = factory.action.authorize.offer.eventService.
|
|
48
|
+
type IObjectWithoutDetail = factory.action.authorize.offer.eventService.IObjectWithoutDetail<factory.service.webAPI.Identifier.Chevre>;
|
|
49
49
|
/**
|
|
50
50
|
* 興行オファー承認
|
|
51
51
|
*/
|
|
@@ -8,80 +8,53 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
-
var t = {};
|
|
13
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
-
t[p] = s[p];
|
|
15
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
-
t[p[i]] = s[p[i]];
|
|
19
|
-
}
|
|
20
|
-
return t;
|
|
21
|
-
};
|
|
22
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
12
|
exports.authorize = void 0;
|
|
24
13
|
const factory = require("../../../factory");
|
|
25
14
|
const any_1 = require("../any");
|
|
26
|
-
const defaultOffer_1 = require("./defaultOffer");
|
|
27
|
-
const
|
|
15
|
+
const defaultOffer_1 = require("./authorize/defaultOffer");
|
|
16
|
+
const factory_1 = require("./authorize/factory");
|
|
17
|
+
const processStartReserve4chevre_1 = require("./authorize/processStartReserve4chevre");
|
|
28
18
|
const searchEventTicketOffers_1 = require("./searchEventTicketOffers");
|
|
29
|
-
const factory_1 = require("./factory");
|
|
30
19
|
/**
|
|
31
20
|
* 興行オファー承認
|
|
32
21
|
*/
|
|
33
22
|
function authorize(params) {
|
|
34
|
-
// tslint:disable-next-line:max-func-body-length
|
|
35
23
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
36
24
|
var _a;
|
|
37
25
|
const noOfferSpecified = params.noOfferSpecified === true;
|
|
38
|
-
const { transaction, event
|
|
26
|
+
const { transaction, event } = yield validateCreateRequest(params)(repos);
|
|
39
27
|
const { acceptedOffers, ticketOffers, unitPriceOffers } = yield validateAcceptedOffers({
|
|
40
28
|
object: params.object,
|
|
41
29
|
event,
|
|
42
|
-
seller: { typeOf: transaction.seller.typeOf, id:
|
|
30
|
+
seller: { typeOf: transaction.seller.typeOf, id: transaction.seller.id },
|
|
43
31
|
transaction,
|
|
44
32
|
store: params.store,
|
|
45
33
|
noOfferSpecified
|
|
46
34
|
})(repos);
|
|
47
35
|
let acceptedOffers4result = [];
|
|
48
|
-
//
|
|
36
|
+
// まず取引番号発行
|
|
49
37
|
const { transactionNumber } = yield repos.transactionNumber.publishByTimestamp({ startDate: new Date() });
|
|
50
|
-
// 承認アクションを開始
|
|
51
38
|
const actionAttributes = (0, factory_1.createAuthorizeSeatReservationActionAttributes)({
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
transaction: transaction,
|
|
55
|
-
instrument: { transactionNumber },
|
|
56
|
-
broker: params.object.broker
|
|
39
|
+
event, transaction,
|
|
40
|
+
instrument: { transactionNumber }
|
|
57
41
|
});
|
|
58
42
|
const action = yield repos.action.start(actionAttributes);
|
|
59
43
|
try {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
//
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
// if (params.options.useCreateOrderOnOfferAccepted) {
|
|
75
|
-
yield (0, any_1.acceptOffer)({
|
|
76
|
-
project: transaction.project,
|
|
77
|
-
purpose: { id: transaction.id },
|
|
78
|
-
acceptedOffers: acceptedOffers4result
|
|
79
|
-
})(repos);
|
|
80
|
-
// }
|
|
81
|
-
}
|
|
82
|
-
break;
|
|
83
|
-
default:
|
|
84
|
-
throw new factory.errors.Argument('Event', `Unknown booking service '${bookingServiceIdentifire}'`);
|
|
44
|
+
const processStartReserveResult = yield (0, processStartReserve4chevre_1.processStartReserve4chevre)(Object.assign({ acceptedOffers, event,
|
|
45
|
+
transactionNumber, transaction, availableAtOrFrom: { id: params.store.id }, ticketOffers, unitPriceOffers, validateEvent: params.validateEvent === true, validateEventOfferPeriod: params.validateEventOfferPeriod === true,
|
|
46
|
+
// useHoldStockByTransactionNumber: params.useHoldStockByTransactionNumber, // discontinue(2024-07-02~)
|
|
47
|
+
stockHoldUntilDaysAfterEventEnd: params.stockHoldUntilDaysAfterEventEnd }, (typeof ((_a = params.object.broker) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? { broker: params.object.broker } : undefined))(repos);
|
|
48
|
+
acceptedOffers4result = processStartReserveResult.acceptedOffers4result;
|
|
49
|
+
// add orderInTransaction(2024-01-15~)
|
|
50
|
+
if (!noOfferSpecified) {
|
|
51
|
+
// if (params.options.useCreateOrderOnOfferAccepted) {
|
|
52
|
+
yield (0, any_1.acceptOffer)({
|
|
53
|
+
project: transaction.project,
|
|
54
|
+
purpose: { id: transaction.id },
|
|
55
|
+
acceptedOffers: acceptedOffers4result
|
|
56
|
+
})(repos);
|
|
57
|
+
// }
|
|
85
58
|
}
|
|
86
59
|
}
|
|
87
60
|
catch (error) {
|
|
@@ -91,25 +64,16 @@ function authorize(params) {
|
|
|
91
64
|
catch (__) {
|
|
92
65
|
// no op
|
|
93
66
|
}
|
|
94
|
-
switch (bookingServiceIdentifire) {
|
|
95
|
-
case factory.service.webAPI.Identifier.COA:
|
|
96
|
-
// error = handleCOAReserveTemporarilyError(error);
|
|
97
|
-
break;
|
|
98
|
-
case factory.service.webAPI.Identifier.Chevre:
|
|
99
|
-
// error = handleChevreError(error);
|
|
100
|
-
break;
|
|
101
|
-
default:
|
|
102
|
-
}
|
|
103
67
|
throw error;
|
|
104
68
|
}
|
|
105
|
-
const result = (0, factory_1.acceptedOffers2authorizeResult)({ acceptedOffers, acceptedOffers4result, noOfferSpecified });
|
|
69
|
+
const result = (0, factory_1.acceptedOffers2authorizeResult)({ acceptedOffers, acceptedOffers4result, noOfferSpecified, ticketOffers });
|
|
106
70
|
return yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: result });
|
|
107
71
|
});
|
|
108
72
|
}
|
|
109
73
|
exports.authorize = authorize;
|
|
110
74
|
function validateCreateRequest(params) {
|
|
111
75
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
112
|
-
var _a, _b
|
|
76
|
+
var _a, _b;
|
|
113
77
|
const transaction = yield repos.transaction.findInProgressById({
|
|
114
78
|
typeOf: factory.transactionType.PlaceOrder,
|
|
115
79
|
id: params.transaction.id
|
|
@@ -133,12 +97,12 @@ function validateCreateRequest(params) {
|
|
|
133
97
|
const event = yield repos.event.findMinimizedIndividualEventById({
|
|
134
98
|
id: params.object.reservationFor.id
|
|
135
99
|
});
|
|
136
|
-
let offeredThrough =
|
|
137
|
-
if (offeredThrough === undefined) {
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
const bookingServiceIdentifire = offeredThrough.identifier;
|
|
141
|
-
return { transaction, event
|
|
100
|
+
// let offeredThrough = event.offers?.offeredThrough;
|
|
101
|
+
// if (offeredThrough === undefined) {
|
|
102
|
+
// offeredThrough = { typeOf: 'WebAPI', identifier: factory.service.webAPI.Identifier.Chevre };
|
|
103
|
+
// }
|
|
104
|
+
// const bookingServiceIdentifire = offeredThrough.identifier;
|
|
105
|
+
return { transaction, event };
|
|
142
106
|
});
|
|
143
107
|
}
|
|
144
108
|
/**
|
|
@@ -193,7 +157,7 @@ function validateAcceptedOffers(params) {
|
|
|
193
157
|
return acceptedOfferWithoutDetail2acceptedOffer({
|
|
194
158
|
availableTicketOffers: ticketOffers,
|
|
195
159
|
offerWithoutDetail,
|
|
196
|
-
event: params.event,
|
|
160
|
+
// event: params.event,
|
|
197
161
|
transaction: params.transaction,
|
|
198
162
|
seller: params.seller
|
|
199
163
|
})();
|
|
@@ -250,7 +214,7 @@ function validateAcceptedOffers(params) {
|
|
|
250
214
|
function acceptedOfferWithoutDetail2acceptedOffer(params) {
|
|
251
215
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
252
216
|
return () => __awaiter(this, void 0, void 0, function* () {
|
|
253
|
-
var _a, _b, _c
|
|
217
|
+
var _a, _b, _c;
|
|
254
218
|
const availableTicketOffers = params.availableTicketOffers;
|
|
255
219
|
const offerWithoutDetail = params.offerWithoutDetail;
|
|
256
220
|
const offer = availableTicketOffers.find((o) => o.id === offerWithoutDetail.id);
|
|
@@ -264,13 +228,21 @@ function acceptedOfferWithoutDetail2acceptedOffer(params) {
|
|
|
264
228
|
});
|
|
265
229
|
const acceptedAppliesToMovieTicket = (_a = offerWithoutDetail.priceSpecification) === null || _a === void 0 ? void 0 : _a.appliesToMovieTicket;
|
|
266
230
|
// 承認アクションオブジェクトのacceptedOfferにappliesToMovieTicketを連携する(2022-08-02~)
|
|
267
|
-
const priceSpecification =
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
231
|
+
// const priceSpecification: IAcceptedOfferPriceSpecification = {
|
|
232
|
+
// // 必要な属性のみに最適化(2024-04-09~)
|
|
233
|
+
// // ...offer.priceSpecification,
|
|
234
|
+
// typeOf: offer.priceSpecification.typeOf,
|
|
235
|
+
// priceCurrency: offer.priceSpecification.priceCurrency,
|
|
236
|
+
// // valueAddedTaxIncluded: offer.priceSpecification.valueAddedTaxIncluded,
|
|
237
|
+
// priceComponent: offer.priceSpecification.priceComponent.map(({
|
|
238
|
+
// name, accounting, id, priceCurrency, valueAddedTaxIncluded, ...necessaryComponentFields
|
|
239
|
+
// }) => necessaryComponentFields),
|
|
240
|
+
// // appliesToMovieTicket.identifierを連携する
|
|
241
|
+
// ...(Array.isArray(acceptedAppliesToMovieTicket) || typeof acceptedAppliesToMovieTicket?.identifier === 'string')
|
|
242
|
+
// ? { appliesToMovieTicket: acceptedAppliesToMovieTicket }
|
|
243
|
+
// : undefined
|
|
244
|
+
// };
|
|
245
|
+
const priceSpecification = Object.assign({}, (Array.isArray(acceptedAppliesToMovieTicket) || typeof (acceptedAppliesToMovieTicket === null || acceptedAppliesToMovieTicket === void 0 ? void 0 : acceptedAppliesToMovieTicket.identifier) === 'string')
|
|
274
246
|
? { appliesToMovieTicket: acceptedAppliesToMovieTicket }
|
|
275
247
|
: undefined);
|
|
276
248
|
const acceptedAddOns = (Array.isArray(offerWithoutDetail.addOn))
|
|
@@ -313,28 +285,24 @@ function acceptedOfferWithoutDetail2acceptedOffer(params) {
|
|
|
313
285
|
// no op
|
|
314
286
|
}
|
|
315
287
|
}
|
|
316
|
-
|
|
288
|
+
return {
|
|
317
289
|
// オファーの中身を最適化する(必要最低限の情報のみに)
|
|
318
|
-
id: String(offer.id),
|
|
290
|
+
id: String(offer.id),
|
|
291
|
+
// identifier: offer.identifier,
|
|
292
|
+
priceSpecification,
|
|
293
|
+
// typeOf: offer.typeOf,
|
|
294
|
+
// priceCurrency: offer.priceCurrency,
|
|
295
|
+
itemOffered: Object.assign(Object.assign({}, (itemOfferedServiceOutput !== undefined) ? { serviceOutput: itemOfferedServiceOutput } : undefined), (pointAward !== undefined) ? { pointAward } : undefined),
|
|
296
|
+
addOn: acceptedAddOns,
|
|
319
297
|
// 追加属性をマージ
|
|
320
298
|
additionalProperty: [
|
|
321
299
|
...(Array.isArray(offerWithoutDetail.additionalProperty)) ? offerWithoutDetail.additionalProperty : [],
|
|
322
300
|
...(Array.isArray(offer.additionalProperty)) ? offer.additionalProperty : []
|
|
323
|
-
]
|
|
324
|
-
|
|
325
|
-
:
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
offeredThrough = { typeOf: 'WebAPI', identifier: factory.service.webAPI.Identifier.Chevre };
|
|
329
|
-
}
|
|
330
|
-
switch (offeredThrough.identifier) {
|
|
331
|
-
case factory.service.webAPI.Identifier.COA:
|
|
332
|
-
// 実質使用する予定なしなので廃止(2022-05-12~)
|
|
333
|
-
throw new factory.errors.NotImplemented(`booking service '${offeredThrough.identifier}' not implemented`);
|
|
334
|
-
default:
|
|
335
|
-
// no op
|
|
336
|
-
}
|
|
337
|
-
return acceptedOffer;
|
|
301
|
+
]
|
|
302
|
+
// ...(Array.isArray(offer.acceptedPaymentMethod)) // discontinue(2024-07-03~)
|
|
303
|
+
// ? { acceptedPaymentMethod: offer.acceptedPaymentMethod }
|
|
304
|
+
// : undefined
|
|
305
|
+
};
|
|
338
306
|
});
|
|
339
307
|
}
|
|
340
308
|
function createPointAwardByOfferWithoutDetail(params) {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as COA from '@motionpicture/coa-service';
|
|
2
|
+
import * as factory from '../../../../factory';
|
|
3
|
+
declare function coaTicket2offer(params: {
|
|
4
|
+
theaterCode: string;
|
|
5
|
+
ticketResult: COA.factory.master.ITicketResult;
|
|
6
|
+
defaultCurrencyType?: factory.categoryCode.ICategoryCode;
|
|
7
|
+
defaultMembershipType?: factory.categoryCode.ICategoryCode;
|
|
8
|
+
}): factory.aggregateOffer.ISubOffer;
|
|
9
|
+
export { coaTicket2offer };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.coaTicket2offer = void 0;
|
|
4
|
+
const COA = require("@motionpicture/coa-service");
|
|
5
|
+
const util_1 = require("util");
|
|
6
|
+
const factory = require("../../../../factory");
|
|
7
|
+
// tslint:disable-next-line:max-func-body-length
|
|
8
|
+
function coaTicket2offer(params) {
|
|
9
|
+
var _a, _b;
|
|
10
|
+
// 適用通貨区分
|
|
11
|
+
const eligibleMonetaryAmount = (typeof params.ticketResult.usePoint === 'number' && params.ticketResult.usePoint > 0
|
|
12
|
+
&& typeof ((_a = params.defaultCurrencyType) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string')
|
|
13
|
+
? [{
|
|
14
|
+
typeOf: 'MonetaryAmount',
|
|
15
|
+
currency: params.defaultCurrencyType.codeValue,
|
|
16
|
+
value: Number(params.ticketResult.usePoint)
|
|
17
|
+
}]
|
|
18
|
+
: undefined;
|
|
19
|
+
// 適用メンバーシップ区分
|
|
20
|
+
const eligibleMembershipType = (params.ticketResult.flgMember === COA.factory.master.FlgMember.Member
|
|
21
|
+
&& typeof ((_b = params.defaultMembershipType) === null || _b === void 0 ? void 0 : _b.typeOf) === 'string')
|
|
22
|
+
? [{
|
|
23
|
+
typeOf: params.defaultMembershipType.typeOf,
|
|
24
|
+
id: params.defaultMembershipType.id,
|
|
25
|
+
codeValue: params.defaultMembershipType.codeValue,
|
|
26
|
+
inCodeSet: params.defaultMembershipType.inCodeSet
|
|
27
|
+
}]
|
|
28
|
+
: undefined;
|
|
29
|
+
const unitPriceSpec = {
|
|
30
|
+
typeOf: factory.priceSpecificationType.UnitPriceSpecification,
|
|
31
|
+
price: 0,
|
|
32
|
+
priceCurrency: factory.priceCurrency.JPY,
|
|
33
|
+
valueAddedTaxIncluded: true,
|
|
34
|
+
referenceQuantity: {
|
|
35
|
+
typeOf: 'QuantitativeValue',
|
|
36
|
+
unitCode: factory.unitCode.C62,
|
|
37
|
+
value: 1
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const identifier = (0, util_1.format)('%s-%s-%s', factory.service.webAPI.Identifier.COA, params.theaterCode, params.ticketResult.ticketCode);
|
|
41
|
+
const offerName = {
|
|
42
|
+
ja: params.ticketResult.ticketName,
|
|
43
|
+
en: (typeof params.ticketResult.ticketNameEng === 'string')
|
|
44
|
+
? params.ticketResult.ticketNameEng
|
|
45
|
+
: ''
|
|
46
|
+
};
|
|
47
|
+
return Object.assign(Object.assign(Object.assign({ typeOf: factory.offerType.Offer, priceCurrency: factory.priceCurrency.JPY,
|
|
48
|
+
// id: '',
|
|
49
|
+
identifier: identifier, name: offerName, description: {
|
|
50
|
+
ja: '',
|
|
51
|
+
en: ''
|
|
52
|
+
}, alternateName: {
|
|
53
|
+
ja: params.ticketResult.ticketName,
|
|
54
|
+
en: (typeof params.ticketResult.ticketNameEng === 'string')
|
|
55
|
+
? params.ticketResult.ticketNameEng
|
|
56
|
+
: ''
|
|
57
|
+
}, availability: factory.itemAvailability.InStock, itemOffered: {
|
|
58
|
+
typeOf: factory.product.ProductType.EventService
|
|
59
|
+
}, priceSpecification: unitPriceSpec }, (Array.isArray(eligibleMembershipType)) ? { eligibleMembershipType } : undefined), (Array.isArray(eligibleMonetaryAmount)) ? { eligibleMonetaryAmount } : undefined), { additionalProperty: [
|
|
60
|
+
{ name: 'theaterCode', value: params.theaterCode },
|
|
61
|
+
...Object.keys(params.ticketResult)
|
|
62
|
+
.map((key) => {
|
|
63
|
+
return { name: String(key), value: String(params.ticketResult[key]) };
|
|
64
|
+
})
|
|
65
|
+
] });
|
|
66
|
+
}
|
|
67
|
+
exports.coaTicket2offer = coaTicket2offer;
|
|
@@ -11,7 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.importCategoryCodesFromCOA = exports.importFromCOA = void 0;
|
|
13
13
|
const factory = require("../../../factory");
|
|
14
|
-
const factory_1 = require("./factory");
|
|
14
|
+
const factory_1 = require("./importFromCOA/factory");
|
|
15
15
|
function importFromCOA(params) {
|
|
16
16
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
17
17
|
// 通貨区分検索
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as factory from '../../../factory';
|
|
2
2
|
import { IMinimizedIndividualEvent } from '../../../factory/event';
|
|
3
3
|
export import WebAPIIdentifier = factory.service.webAPI.Identifier;
|
|
4
|
-
export type IAcceptedOffer4COA = factory.action.authorize.offer.eventService.
|
|
4
|
+
export type IAcceptedOffer4COA = factory.action.authorize.offer.eventService.IAcceptedOffer4COA;
|
|
5
5
|
export declare function createAuthorizeSeatReservationActionAttributes(params: {
|
|
6
6
|
acceptAction: {
|
|
7
7
|
id: string;
|
|
8
8
|
};
|
|
9
|
-
acceptedOffers: factory.action.authorize.offer.eventService.
|
|
9
|
+
acceptedOffers: factory.action.authorize.offer.eventService.IAcceptedOffer4COA[];
|
|
10
10
|
event: Pick<IMinimizedIndividualEvent<factory.eventType.ScreeningEvent>, 'id' | 'typeOf'>;
|
|
11
11
|
transaction: Pick<factory.transaction.ITransaction<factory.transactionType.PlaceOrder>, 'agent' | 'id' | 'project' | 'seller' | 'typeOf'>;
|
|
12
12
|
pendingTransaction: factory.action.authorize.offer.eventService.ICOAPendingTransaction;
|
|
@@ -24,7 +24,7 @@ type IResultAcceptedOffer = factory.action.authorize.offer.eventService.IResultA
|
|
|
24
24
|
*/
|
|
25
25
|
export declare function responseBody2acceptedOffers4result(params: {
|
|
26
26
|
responseBody: factory.action.authorize.offer.eventService.IResponseBody<factory.service.webAPI.Identifier.COA>;
|
|
27
|
-
acceptedOffer: factory.action.authorize.offer.eventService.
|
|
27
|
+
acceptedOffer: factory.action.authorize.offer.eventService.IAcceptedOffer4COA[];
|
|
28
28
|
event: IMinimizedIndividualEvent<factory.eventType.ScreeningEvent>;
|
|
29
29
|
seller: Pick<factory.transaction.placeOrder.ISeller, 'typeOf' | 'name'>;
|
|
30
30
|
bookingTime: Date;
|
|
@@ -13,7 +13,7 @@ exports.validateOrder = void 0;
|
|
|
13
13
|
// import * as createDebug from 'debug';
|
|
14
14
|
const moment = require("moment");
|
|
15
15
|
const factory = require("../../factory");
|
|
16
|
-
const factory_1 = require("../offer/event/factory");
|
|
16
|
+
const factory_1 = require("../offer/event/authorize/factory");
|
|
17
17
|
const factory_2 = require("../offer/product/factory");
|
|
18
18
|
const validateMovieTicket_1 = require("../transaction/placeOrderInProgress/validation/validateMovieTicket");
|
|
19
19
|
// const debug = createDebug('chevre-domain:service:validation');
|
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.377.0-alpha.
|
|
14
|
-
"@cinerino/sdk": "8.
|
|
13
|
+
"@chevre/factory": "4.377.0-alpha.5",
|
|
14
|
+
"@cinerino/sdk": "8.2.0-alpha.1",
|
|
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.37.0-alpha.
|
|
113
|
+
"version": "21.37.0-alpha.12"
|
|
114
114
|
}
|
|
@@ -1,163 +0,0 @@
|
|
|
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
|
-
type IUnitPriceSpecification =
|
|
8
|
-
chevre.factory.priceSpecification.IPriceSpecification<chevre.factory.priceSpecificationType.UnitPriceSpecification>;
|
|
9
|
-
type IAuthorizeAction4chevre = chevre.factory.action.authorize.offer.eventService.IAction<chevre.factory.service.webAPI.Identifier.Chevre>;
|
|
10
|
-
type IAcceptedOffer4chevre = chevre.factory.action.authorize.offer.eventService.IAcceptedOffer4chevre;
|
|
11
|
-
|
|
12
|
-
// tslint:disable-next-line:max-func-body-length
|
|
13
|
-
async function main() {
|
|
14
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
15
|
-
|
|
16
|
-
const actionRepo = await chevre.repository.Action.createInstance(mongoose.connection);
|
|
17
|
-
const cursor = actionRepo.getCursor(
|
|
18
|
-
{
|
|
19
|
-
// _id: { $eq: '66697991037c9d7243208261' },
|
|
20
|
-
typeOf: { $eq: chevre.factory.actionType.AuthorizeAction },
|
|
21
|
-
actionStatus: { $eq: chevre.factory.actionStatusType.CompletedActionStatus },
|
|
22
|
-
startDate: {
|
|
23
|
-
$lte: moment()
|
|
24
|
-
// tslint:disable-next-line:no-magic-numbers
|
|
25
|
-
.add(-180, 'days')
|
|
26
|
-
// $gte: moment()
|
|
27
|
-
// // tslint:disable-next-line:no-magic-numbers
|
|
28
|
-
// .add(-180, 'days')
|
|
29
|
-
},
|
|
30
|
-
'object.typeOf': { $exists: true, $eq: chevre.factory.action.authorize.offer.eventService.ObjectType.SeatReservation }
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
__id: 1, startDate: 1, endDate: 1, result: 1, project: 1, typeOf: 1, actionStatus: 1, instrument: 1, object: 1
|
|
34
|
-
}
|
|
35
|
-
);
|
|
36
|
-
console.log('actions found');
|
|
37
|
-
|
|
38
|
-
let i = 0;
|
|
39
|
-
let updateCount = 0;
|
|
40
|
-
let saveResultCount = 0;
|
|
41
|
-
// tslint:disable-next-line:max-func-body-length
|
|
42
|
-
await cursor.eachAsync(async (doc) => {
|
|
43
|
-
i += 1;
|
|
44
|
-
const authorizeAction = <Pick<
|
|
45
|
-
chevre.factory.action.authorize.offer.eventService.IAction<chevre.factory.service.webAPI.Identifier>,
|
|
46
|
-
'id' | 'startDate' | 'endDate' | 'result' | 'project' | 'typeOf' | 'actionStatus' | 'instrument' | 'object'
|
|
47
|
-
>>doc.toObject();
|
|
48
|
-
const result = authorizeAction.result;
|
|
49
|
-
if (result === undefined) {
|
|
50
|
-
throw new Error(`result undefined [${authorizeAction.id}]`);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
let migrated = false;
|
|
54
|
-
if (authorizeAction.instrument.typeOf === chevre.factory.assetTransactionType.COAReserveTransaction
|
|
55
|
-
|| (<any>authorizeAction.instrument).identifier === chevre.factory.service.webAPI.Identifier.COA) {
|
|
56
|
-
migrated = true;
|
|
57
|
-
} else {
|
|
58
|
-
if (result.typeOf === chevre.factory.offerType.AggregateOffer && Array.isArray(result.offers)) {
|
|
59
|
-
migrated = true;
|
|
60
|
-
}
|
|
61
|
-
if (typeof result.price !== 'number') {
|
|
62
|
-
migrated = true;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
if (migrated) {
|
|
67
|
-
console.log(
|
|
68
|
-
'already migrated.',
|
|
69
|
-
authorizeAction.project.id, authorizeAction.id, authorizeAction.startDate, i, updateCount, saveResultCount);
|
|
70
|
-
|
|
71
|
-
// optimize action
|
|
72
|
-
if (Array.isArray((<any>authorizeAction.object).acceptedOffer)) {
|
|
73
|
-
let unsetResult: any;
|
|
74
|
-
unsetResult = await actionRepo.unsetUnnecessaryFields({
|
|
75
|
-
filter: { _id: { $eq: authorizeAction.id } },
|
|
76
|
-
$unset: {
|
|
77
|
-
'object.acceptedOffer': 1
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
updateCount += 1;
|
|
81
|
-
console.log(
|
|
82
|
-
'result unset. unsetResult:', unsetResult,
|
|
83
|
-
authorizeAction.project.id, authorizeAction.id, authorizeAction.startDate, i, updateCount, saveResultCount);
|
|
84
|
-
}
|
|
85
|
-
} else {
|
|
86
|
-
console.log(
|
|
87
|
-
'redefining result as AggreagteOffer...',
|
|
88
|
-
authorizeAction.project.id, authorizeAction.id, authorizeAction.startDate, i, updateCount, saveResultCount);
|
|
89
|
-
const acceptedOffers = <IAcceptedOffer4chevre[]>(<any>(<IAuthorizeAction4chevre>authorizeAction).object).acceptedOffer;
|
|
90
|
-
if (!Array.isArray(acceptedOffers)) {
|
|
91
|
-
throw new Error(`acceptedOffer undefined [${authorizeAction.id}]`);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
let offers: chevre.factory.action.authorize.offer.eventService.IAcceptedOfferInResult[] | undefined;
|
|
95
|
-
if (typeof result.price === 'number') {
|
|
96
|
-
// オファーIDごとに集計
|
|
97
|
-
const offerIds = [...new Set(acceptedOffers.map((o) => o.id))];
|
|
98
|
-
offers = offerIds.map<chevre.factory.action.authorize.offer.eventService.IAcceptedOfferInResult>((offerId) => {
|
|
99
|
-
const acceptedOfferInObject = acceptedOffers.find(({ id }) => id === offerId);
|
|
100
|
-
if (acceptedOfferInObject === undefined) {
|
|
101
|
-
throw new Error(`acceptedOffer not found [id:${offerId}]`);
|
|
102
|
-
}
|
|
103
|
-
const amountOfThisGood: number = acceptedOffers.filter(({ id }) => id === offerId).length;
|
|
104
|
-
const { acceptedPaymentMethod, priceSpecification } = acceptedOfferInObject;
|
|
105
|
-
|
|
106
|
-
const unitPriceSpec = <IUnitPriceSpecification | undefined>priceSpecification.priceComponent.find(
|
|
107
|
-
(spec) => spec.typeOf === chevre.factory.priceSpecificationType.UnitPriceSpecification
|
|
108
|
-
&& (!Array.isArray(spec.appliesToAddOn)) // アドオン単価ではない
|
|
109
|
-
);
|
|
110
|
-
if (unitPriceSpec === undefined) {
|
|
111
|
-
throw new Error(`unitPriceSpec not found [id:${offerId}]`);
|
|
112
|
-
}
|
|
113
|
-
const { eligibleQuantity, eligibleTransactionVolume } = unitPriceSpec;
|
|
114
|
-
|
|
115
|
-
return {
|
|
116
|
-
id: offerId,
|
|
117
|
-
includesObject: { amountOfThisGood },
|
|
118
|
-
typeOf: chevre.factory.offerType.Offer,
|
|
119
|
-
priceSpecification: {
|
|
120
|
-
...(eligibleQuantity !== undefined) ? { eligibleQuantity } : undefined,
|
|
121
|
-
...(eligibleTransactionVolume !== undefined) ? { eligibleTransactionVolume } : undefined
|
|
122
|
-
},
|
|
123
|
-
...(acceptedPaymentMethod !== undefined) ? { acceptedPaymentMethod } : undefined
|
|
124
|
-
};
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
const resultAsAggregateOffer: chevre.factory.action.authorize.offer.eventService.IResultAsAggregateOffer = {
|
|
128
|
-
typeOf: chevre.factory.offerType.AggregateOffer,
|
|
129
|
-
offers
|
|
130
|
-
};
|
|
131
|
-
// const newResult: chevre.factory.action.authorize.offer.eventService.IResult = {
|
|
132
|
-
// ...result,
|
|
133
|
-
// ...resultAsAggregateOffer
|
|
134
|
-
// };
|
|
135
|
-
console.log(
|
|
136
|
-
'saving action...',
|
|
137
|
-
authorizeAction.project.id, authorizeAction.id, authorizeAction.startDate, i, updateCount, saveResultCount);
|
|
138
|
-
// tslint:disable-next-line:no-null-keyword
|
|
139
|
-
console.dir(resultAsAggregateOffer, { depth: null });
|
|
140
|
-
await actionRepo.findByIdAndUpdate({
|
|
141
|
-
id: authorizeAction.id,
|
|
142
|
-
update: {
|
|
143
|
-
$set: {
|
|
144
|
-
'result.typeOf': resultAsAggregateOffer.typeOf,
|
|
145
|
-
'result.offers': resultAsAggregateOffer.offers
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
saveResultCount += 1;
|
|
150
|
-
console.log(
|
|
151
|
-
'action saved.',
|
|
152
|
-
authorizeAction.project.id, authorizeAction.id, authorizeAction.startDate, i, updateCount, saveResultCount);
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
console.log(i, 'actions checked');
|
|
157
|
-
console.log(updateCount, 'actions updated');
|
|
158
|
-
console.log(saveResultCount, 'result saved');
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
main()
|
|
162
|
-
.then()
|
|
163
|
-
.catch(console.error);
|