@chevre/domain 20.4.0-alpha.36 → 20.4.0-alpha.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/example/src/chevre/aggregateEventReservation.ts +2 -1
- package/lib/chevre/errorHandler.js +1 -0
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.d.ts +2 -0
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +63 -29
- package/lib/chevre/service/payment/any/factory.js +2 -20
- package/lib/chevre/service/payment/movieTicket/checkByIdentifier.d.ts +22 -0
- package/lib/chevre/service/payment/movieTicket/checkByIdentifier.js +183 -0
- package/lib/chevre/service/payment/movieTicket/getCredentials.d.ts +13 -0
- package/lib/chevre/service/payment/movieTicket/getCredentials.js +45 -0
- package/lib/chevre/service/payment/movieTicket/validation.d.ts +15 -0
- package/lib/chevre/service/{assetTransaction/pay → payment}/movieTicket/validation.js +8 -7
- package/lib/chevre/service/payment/movieTicket.d.ts +3 -19
- package/lib/chevre/service/payment/movieTicket.js +8 -214
- package/lib/chevre/service/task/aggregateScreeningEvent.js +2 -0
- package/package.json +3 -3
- package/lib/chevre/service/assetTransaction/pay/movieTicket/validation.d.ts +0 -14
|
@@ -16,11 +16,12 @@ async function main() {
|
|
|
16
16
|
|
|
17
17
|
// const now = new Date();
|
|
18
18
|
await chevre.service.aggregation.event.aggregateScreeningEvent({
|
|
19
|
-
id:
|
|
19
|
+
id: String(process.env.EVENT_ID)
|
|
20
20
|
})({
|
|
21
21
|
event: new chevre.repository.Event(mongoose.connection),
|
|
22
22
|
eventAvailability: new chevre.repository.itemAvailability.ScreeningEvent(client),
|
|
23
23
|
offer: new chevre.repository.Offer(mongoose.connection),
|
|
24
|
+
offerCatalog: new chevre.repository.OfferCatalog(mongoose.connection),
|
|
24
25
|
offerRateLimit: new chevre.repository.rateLimit.Offer(client),
|
|
25
26
|
place: new chevre.repository.Place(mongoose.connection),
|
|
26
27
|
product: new chevre.repository.Product(mongoose.connection),
|
|
@@ -19,6 +19,7 @@ function handleMongoError(error) {
|
|
|
19
19
|
if (handledError instanceof mongoose_1.mongo.MongoError) {
|
|
20
20
|
switch (handledError.code) {
|
|
21
21
|
case MongoErrorCode.DuplicateKey:
|
|
22
|
+
handledError = new factory_1.errors.AlreadyInUse('', [], `Some fields already in use. code:${handledError.code} message:${handledError.message}`);
|
|
22
23
|
// no op
|
|
23
24
|
break;
|
|
24
25
|
case MongoErrorCode.MaxTimeMSExpired:
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { MongoRepository as EventRepo } from '../../../repo/event';
|
|
2
2
|
import { RedisRepository as EventAvailabilityRepo } from '../../../repo/itemAvailability/screeningEvent';
|
|
3
3
|
import { MongoRepository as OfferRepo } from '../../../repo/offer';
|
|
4
|
+
import { MongoRepository as OfferCatalogRepo } from '../../../repo/offerCatalog';
|
|
4
5
|
import { MongoRepository as PlaceRepo } from '../../../repo/place';
|
|
5
6
|
import { MongoRepository as ProductRepo } from '../../../repo/product';
|
|
6
7
|
import { MongoRepository as ProjectRepo } from '../../../repo/project';
|
|
@@ -12,6 +13,7 @@ export declare type IAggregateScreeningEventOperation<T> = (repos: {
|
|
|
12
13
|
event: EventRepo;
|
|
13
14
|
eventAvailability: EventAvailabilityRepo;
|
|
14
15
|
offer: OfferRepo;
|
|
16
|
+
offerCatalog: OfferCatalogRepo;
|
|
15
17
|
offerRateLimit: OfferRateLimitRepo;
|
|
16
18
|
place: PlaceRepo;
|
|
17
19
|
product: ProductRepo;
|
|
@@ -89,18 +89,15 @@ function aggregateByEvent(params) {
|
|
|
89
89
|
event: event,
|
|
90
90
|
screeningRoom: screeningRoom
|
|
91
91
|
})(repos);
|
|
92
|
-
// プロジェクト限定(2023-02-22~)
|
|
93
92
|
// オファーごとの集計
|
|
94
93
|
let aggregateOffer;
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
debug('offers aggregated', aggregateOffer);
|
|
103
|
-
}
|
|
94
|
+
aggregateOffer = yield aggregateOfferByEvent({
|
|
95
|
+
aggregateDate: now,
|
|
96
|
+
event: Object.assign(Object.assign({}, event), { maximumAttendeeCapacity,
|
|
97
|
+
remainingAttendeeCapacity }),
|
|
98
|
+
screeningRoom: screeningRoom
|
|
99
|
+
})(repos);
|
|
100
|
+
debug('offers aggregated', aggregateOffer);
|
|
104
101
|
// 値がundefinedの場合に更新しないように注意
|
|
105
102
|
const update = {
|
|
106
103
|
$set: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ updatedAt: new Date(), // $setオブジェクトが空だとMongoエラーになるので
|
|
@@ -133,26 +130,36 @@ function reservedSeatsAvailable(params) {
|
|
|
133
130
|
function aggregateOfferByEvent(params) {
|
|
134
131
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
135
132
|
var _a, _b, _c;
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
133
|
+
// プロジェクト限定(2023-02-22~)
|
|
134
|
+
if (settings_1.settings.useAggregateOfferProjects.includes(params.event.project.id)) {
|
|
135
|
+
const availableOffers = yield findOffers(params)(repos);
|
|
136
|
+
// オファーごとの予約集計
|
|
137
|
+
const offersWithAggregateReservation = [];
|
|
138
|
+
for (const o of availableOffers) {
|
|
139
|
+
const { maximumAttendeeCapacity, remainingAttendeeCapacity, aggregateReservation } = yield aggregateReservationByOffer({
|
|
140
|
+
aggregateDate: params.aggregateDate,
|
|
141
|
+
event: params.event,
|
|
142
|
+
screeningRoom: params.screeningRoom,
|
|
143
|
+
offer: o
|
|
144
|
+
})(repos);
|
|
145
|
+
offersWithAggregateReservation.push(Object.assign(Object.assign(Object.assign({ typeOf: o.typeOf, id: o.id, identifier: o.identifier, aggregateReservation: aggregateReservation, name: {
|
|
146
|
+
en: (_a = o.name) === null || _a === void 0 ? void 0 : _a.en,
|
|
147
|
+
ja: (_b = o.name) === null || _b === void 0 ? void 0 : _b.ja
|
|
148
|
+
} }, (typeof maximumAttendeeCapacity === 'number') ? { maximumAttendeeCapacity } : undefined), (typeof remainingAttendeeCapacity === 'number') ? { remainingAttendeeCapacity } : undefined), (typeof ((_c = o.category) === null || _c === void 0 ? void 0 : _c.codeValue) === 'string') ? { category: o.category } : undefined));
|
|
149
|
+
}
|
|
150
|
+
return {
|
|
151
|
+
typeOf: factory.offerType.AggregateOffer,
|
|
152
|
+
offerCount: availableOffers.length,
|
|
153
|
+
offers: offersWithAggregateReservation
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
const { offerCount } = yield calculateOfferCount({ event: params.event })(repos);
|
|
158
|
+
return {
|
|
159
|
+
typeOf: factory.offerType.AggregateOffer,
|
|
160
|
+
offerCount
|
|
161
|
+
};
|
|
150
162
|
}
|
|
151
|
-
return {
|
|
152
|
-
typeOf: factory.offerType.AggregateOffer,
|
|
153
|
-
offerCount: availableOffers.length,
|
|
154
|
-
offers: offersWithAggregateReservation
|
|
155
|
-
};
|
|
156
163
|
});
|
|
157
164
|
}
|
|
158
165
|
/**
|
|
@@ -194,6 +201,33 @@ function findOffers(params) {
|
|
|
194
201
|
return availableOffers;
|
|
195
202
|
});
|
|
196
203
|
}
|
|
204
|
+
function calculateOfferCount(params) {
|
|
205
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
206
|
+
var _a, _b, _c;
|
|
207
|
+
let offerCount = 0;
|
|
208
|
+
try {
|
|
209
|
+
const eventOffers = params.event.offers;
|
|
210
|
+
if (typeof ((_a = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.itemOffered) === null || _a === void 0 ? void 0 : _a.id) === 'string') {
|
|
211
|
+
const eventService = yield repos.product.findById({ id: eventOffers.itemOffered.id });
|
|
212
|
+
if (typeof ((_b = eventService.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.id) === 'string') {
|
|
213
|
+
const catalogs = yield repos.offerCatalog.search({
|
|
214
|
+
limit: 1,
|
|
215
|
+
page: 1,
|
|
216
|
+
id: { $in: [eventService.hasOfferCatalog.id] }
|
|
217
|
+
});
|
|
218
|
+
const numberOfItems = (_c = catalogs.shift()) === null || _c === void 0 ? void 0 : _c.numberOfItems;
|
|
219
|
+
if (typeof numberOfItems === 'number') {
|
|
220
|
+
offerCount = numberOfItems;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
catch (error) {
|
|
226
|
+
throw error;
|
|
227
|
+
}
|
|
228
|
+
return { offerCount };
|
|
229
|
+
});
|
|
230
|
+
}
|
|
197
231
|
function aggregateReservationByOffer(params) {
|
|
198
232
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
199
233
|
let reservationCount4offer;
|
|
@@ -69,7 +69,8 @@ function createMovieTicket(params) {
|
|
|
69
69
|
}
|
|
70
70
|
};
|
|
71
71
|
return {
|
|
72
|
-
|
|
72
|
+
// optimize(2023-03-06~)
|
|
73
|
+
// project: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
73
74
|
typeOf: params.typeOf,
|
|
74
75
|
identifier: params.identifier,
|
|
75
76
|
accessCode: params.accessCode,
|
|
@@ -85,22 +86,6 @@ function createAuthorizeResult(params) {
|
|
|
85
86
|
if (typeof (totalPaymentDue === null || totalPaymentDue === void 0 ? void 0 : totalPaymentDue.typeOf) !== 'string') {
|
|
86
87
|
throw new factory.errors.ServiceUnavailable('payTransaction.object.paymentMethod.totalPaymentDue undefined');
|
|
87
88
|
}
|
|
88
|
-
// let serviceOutput: factory.action.authorize.paymentMethod.any.IPaymentServiceOutput | undefined;
|
|
89
|
-
// if (payTransactionObject.typeOf === factory.service.paymentService.PaymentServiceType.MovieTicket) {
|
|
90
|
-
// const movieTicketsByPayTransaction = payTransactionObject.paymentMethod?.movieTickets;
|
|
91
|
-
// if (Array.isArray(movieTicketsByPayTransaction)) {
|
|
92
|
-
// serviceOutput = movieTicketsByPayTransaction.map((m) => {
|
|
93
|
-
// // mask accessCode
|
|
94
|
-
// return {
|
|
95
|
-
// identifier: m.identifier,
|
|
96
|
-
// project: m.project,
|
|
97
|
-
// serviceOutput: m.serviceOutput,
|
|
98
|
-
// serviceType: m.serviceType,
|
|
99
|
-
// typeOf: m.typeOf
|
|
100
|
-
// };
|
|
101
|
-
// });
|
|
102
|
-
// }
|
|
103
|
-
// }
|
|
104
89
|
return {
|
|
105
90
|
accountId: (typeof ((_b = payTransactionObject.paymentMethod) === null || _b === void 0 ? void 0 : _b.accountId) === 'string')
|
|
106
91
|
? payTransactionObject.paymentMethod.accountId
|
|
@@ -109,9 +94,6 @@ function createAuthorizeResult(params) {
|
|
|
109
94
|
issuedThrough: {
|
|
110
95
|
typeOf: payTransactionObject.typeOf,
|
|
111
96
|
id: (typeof payTransactionObject.id === 'string') ? payTransactionObject.id : ''
|
|
112
|
-
// ↓不要になったのでいったん保留(2022-05-02~)
|
|
113
|
-
// MovieTicketの場合、カード情報としてserviceOutputを追加
|
|
114
|
-
// ...(serviceOutput !== undefined) ? { serviceOutput } : undefined
|
|
115
97
|
},
|
|
116
98
|
paymentMethod: params.object.paymentMethod,
|
|
117
99
|
paymentStatus: factory.paymentStatusType.PaymentDue,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { IMinimizedIndividualEvent } from '../../../repo/event';
|
|
2
|
+
import { MongoRepository as ProductRepo } from '../../../repo/product';
|
|
3
|
+
import { MongoRepository as ProjectRepo } from '../../../repo/project';
|
|
4
|
+
import * as factory from '../../../factory';
|
|
5
|
+
interface ICheckResult {
|
|
6
|
+
purchaseNumberAuthIn: factory.action.check.paymentMethod.movieTicket.IPurchaseNumberAuthIn;
|
|
7
|
+
purchaseNumberAuthResult: factory.action.check.paymentMethod.movieTicket.IPurchaseNumberAuthResult;
|
|
8
|
+
movieTickets: factory.action.check.paymentMethod.movieTicket.IMovieTicket[];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* MovieTicket認証
|
|
12
|
+
*/
|
|
13
|
+
declare function checkByIdentifier(params: {
|
|
14
|
+
movieTickets: factory.action.check.paymentMethod.movieTicket.IMovieTicket[];
|
|
15
|
+
seller: factory.seller.ISeller;
|
|
16
|
+
screeningEvent: IMinimizedIndividualEvent<factory.eventType.ScreeningEvent>;
|
|
17
|
+
paymentServiceId: string;
|
|
18
|
+
}): (repos: {
|
|
19
|
+
product: ProductRepo;
|
|
20
|
+
project: ProjectRepo;
|
|
21
|
+
}) => Promise<ICheckResult>;
|
|
22
|
+
export { ICheckResult, checkByIdentifier };
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.checkByIdentifier = void 0;
|
|
13
|
+
const surfrock = require("@surfrock/sdk");
|
|
14
|
+
const moment = require("moment-timezone");
|
|
15
|
+
const credentials_1 = require("../../../credentials");
|
|
16
|
+
const factory = require("../../../factory");
|
|
17
|
+
const getCredentials_1 = require("./getCredentials");
|
|
18
|
+
/**
|
|
19
|
+
* MovieTicket認証
|
|
20
|
+
*/
|
|
21
|
+
function checkByIdentifier(params) {
|
|
22
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
var _a, _b, _c, _d;
|
|
24
|
+
let purchaseNumberAuthIn;
|
|
25
|
+
let purchaseNumberAuthResult;
|
|
26
|
+
// MovieTicket系統の決済方法タイプは動的
|
|
27
|
+
const paymentMethodType = (_a = params.movieTickets[0]) === null || _a === void 0 ? void 0 : _a.typeOf;
|
|
28
|
+
if (typeof paymentMethodType !== 'string') {
|
|
29
|
+
throw new factory.errors.ArgumentNull('movieTickets.typeOf');
|
|
30
|
+
}
|
|
31
|
+
const availableChannel = yield repos.product.findAvailableChannel({
|
|
32
|
+
project: params.screeningEvent.project,
|
|
33
|
+
typeOf: factory.service.paymentService.PaymentServiceType.MovieTicket,
|
|
34
|
+
id: params.paymentServiceId
|
|
35
|
+
});
|
|
36
|
+
const movieTicketIdentifiers = [];
|
|
37
|
+
const knyknrNoInfoIn = [];
|
|
38
|
+
params.movieTickets.forEach((movieTicket) => {
|
|
39
|
+
if (movieTicketIdentifiers.indexOf(movieTicket.identifier) < 0) {
|
|
40
|
+
movieTicketIdentifiers.push(movieTicket.identifier);
|
|
41
|
+
knyknrNoInfoIn.push({
|
|
42
|
+
knyknrNo: movieTicket.identifier,
|
|
43
|
+
pinCd: String(movieTicket.accessCode)
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
let skhnCd = params.screeningEvent.superEvent.workPerformed.identifier;
|
|
48
|
+
const eventOffers = params.screeningEvent.offers;
|
|
49
|
+
if (eventOffers === undefined) {
|
|
50
|
+
throw new factory.errors.NotFound('EventOffers', 'Event offers undefined');
|
|
51
|
+
}
|
|
52
|
+
const offeredThrough = eventOffers.offeredThrough;
|
|
53
|
+
// イベントインポート元がCOAの場合、作品コード連携方法が異なる
|
|
54
|
+
if (offeredThrough !== undefined && offeredThrough.identifier === factory.service.webAPI.Identifier.COA) {
|
|
55
|
+
const DIGITS = -2;
|
|
56
|
+
let eventCOAInfo;
|
|
57
|
+
if (Array.isArray(params.screeningEvent.additionalProperty)) {
|
|
58
|
+
const coaInfoProperty = params.screeningEvent.additionalProperty.find((p) => p.name === 'coaInfo');
|
|
59
|
+
eventCOAInfo = (coaInfoProperty !== undefined) ? JSON.parse(coaInfoProperty.value) : undefined;
|
|
60
|
+
}
|
|
61
|
+
skhnCd = `${eventCOAInfo.titleCode}${`00${eventCOAInfo.titleBranchNum}`.slice(DIGITS)}`;
|
|
62
|
+
}
|
|
63
|
+
const sellerCredentials = yield (0, getCredentials_1.getCredentials)({
|
|
64
|
+
paymentMethodType,
|
|
65
|
+
seller: params.seller,
|
|
66
|
+
paymentServiceId: params.paymentServiceId
|
|
67
|
+
})(repos);
|
|
68
|
+
purchaseNumberAuthIn = {
|
|
69
|
+
kgygishCd: sellerCredentials.kgygishCd,
|
|
70
|
+
jhshbtsCd: surfrock.service.auth.factory.InformationTypeCode.All,
|
|
71
|
+
knyknrNoInfoIn: knyknrNoInfoIn,
|
|
72
|
+
skhnCd: skhnCd,
|
|
73
|
+
stCd: sellerCredentials.stCd,
|
|
74
|
+
jeiYmd: moment(params.screeningEvent.startDate)
|
|
75
|
+
.tz('Asia/Tokyo')
|
|
76
|
+
.format('YYYY/MM/DD')
|
|
77
|
+
};
|
|
78
|
+
const mvtkReserveAuthClient = new surfrock.auth.ClientCredentials({
|
|
79
|
+
domain: String((_b = availableChannel.credentials) === null || _b === void 0 ? void 0 : _b.authorizeServerDomain),
|
|
80
|
+
clientId: String((_c = availableChannel.credentials) === null || _c === void 0 ? void 0 : _c.clientId),
|
|
81
|
+
clientSecret: String((_d = availableChannel.credentials) === null || _d === void 0 ? void 0 : _d.clientSecret),
|
|
82
|
+
scopes: [],
|
|
83
|
+
state: ''
|
|
84
|
+
});
|
|
85
|
+
const authService = new surfrock.service.auth.AuthService({
|
|
86
|
+
endpoint: String(availableChannel.serviceUrl),
|
|
87
|
+
auth: mvtkReserveAuthClient
|
|
88
|
+
}, { timeout: credentials_1.credentials.movieticketReserve.timeout });
|
|
89
|
+
purchaseNumberAuthResult = yield authService.purchaseNumberAuth(purchaseNumberAuthIn);
|
|
90
|
+
// 決済カード配列に成形
|
|
91
|
+
const movieTickets = purchaseNumberAuthResult2movieTickets({
|
|
92
|
+
screeningEvent: params.screeningEvent,
|
|
93
|
+
paymentMethodType,
|
|
94
|
+
knyknrNoInfoIn,
|
|
95
|
+
purchaseNumberAuthResult
|
|
96
|
+
});
|
|
97
|
+
return { purchaseNumberAuthIn, purchaseNumberAuthResult, movieTickets };
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
exports.checkByIdentifier = checkByIdentifier;
|
|
101
|
+
function purchaseNumberAuthResult2movieTickets(params) {
|
|
102
|
+
const movieTickets = [];
|
|
103
|
+
const paymentMethodType = params.paymentMethodType;
|
|
104
|
+
const knyknrNoInfoIn = params.knyknrNoInfoIn;
|
|
105
|
+
const purchaseNumberAuthResult = params.purchaseNumberAuthResult;
|
|
106
|
+
if (Array.isArray(purchaseNumberAuthResult.knyknrNoInfoOut)) {
|
|
107
|
+
purchaseNumberAuthResult.knyknrNoInfoOut.forEach((knyknrNoInfoOut) => {
|
|
108
|
+
const knyknrNoInfo = knyknrNoInfoIn.find((info) => info.knyknrNo === knyknrNoInfoOut.knyknrNo);
|
|
109
|
+
if (knyknrNoInfo !== undefined) {
|
|
110
|
+
const movieTicketCategoryCode = (typeof knyknrNoInfoOut.znkkkytsknGkjknTyp === 'string')
|
|
111
|
+
? knyknrNoInfoOut.znkkkytsknGkjknTyp
|
|
112
|
+
: '';
|
|
113
|
+
if (Array.isArray(knyknrNoInfoOut.ykknInfo)) {
|
|
114
|
+
knyknrNoInfoOut.ykknInfo.forEach((ykknInfo) => {
|
|
115
|
+
// tslint:disable-next-line:prefer-array-literal
|
|
116
|
+
[...Array(Number(ykknInfo.ykknKnshbtsmiNum))].forEach(() => {
|
|
117
|
+
movieTickets.push({
|
|
118
|
+
// project: { typeOf: factory.organizationType.Project, id: params.screeningEvent.project.id },
|
|
119
|
+
typeOf: paymentMethodType,
|
|
120
|
+
identifier: knyknrNoInfo.knyknrNo,
|
|
121
|
+
accessCode: knyknrNoInfo.pinCd,
|
|
122
|
+
category: {
|
|
123
|
+
codeValue: movieTicketCategoryCode // 追加(2023-02-08~)
|
|
124
|
+
},
|
|
125
|
+
serviceType: ykknInfo.ykknshTyp,
|
|
126
|
+
serviceOutput: {
|
|
127
|
+
reservationFor: {
|
|
128
|
+
typeOf: params.screeningEvent.typeOf,
|
|
129
|
+
id: params.screeningEvent.id
|
|
130
|
+
}
|
|
131
|
+
// reservedTicket: {
|
|
132
|
+
// ticketedSeat: {
|
|
133
|
+
// typeOf: factory.placeType.Seat,
|
|
134
|
+
// // seatingType: 'Default', // 情報空でよし
|
|
135
|
+
// seatNumber: '', // 情報空でよし
|
|
136
|
+
// seatRow: '', // 情報空でよし
|
|
137
|
+
// seatSection: '' // 情報空でよし
|
|
138
|
+
// }
|
|
139
|
+
// }
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
if (Array.isArray(knyknrNoInfoOut.mkknInfo)) {
|
|
146
|
+
knyknrNoInfoOut.mkknInfo.forEach((mkknInfo) => {
|
|
147
|
+
// tslint:disable-next-line:prefer-array-literal
|
|
148
|
+
[...Array(Number(mkknInfo.mkknKnshbtsmiNum))].forEach(() => {
|
|
149
|
+
movieTickets.push(Object.assign({
|
|
150
|
+
// project: { typeOf: factory.organizationType.Project, id: params.screeningEvent.project.id },
|
|
151
|
+
typeOf: paymentMethodType, identifier: knyknrNoInfo.knyknrNo, accessCode: knyknrNoInfo.pinCd, category: {
|
|
152
|
+
codeValue: movieTicketCategoryCode // 追加(2023-02-08~)
|
|
153
|
+
}, amount: {
|
|
154
|
+
typeOf: 'MonetaryAmount',
|
|
155
|
+
// currency: factory.priceCurrency.JPY,
|
|
156
|
+
validThrough: moment(`${mkknInfo.yykDt}+09:00`, 'YYYY/MM/DD HH:mm:ssZ')
|
|
157
|
+
.toDate()
|
|
158
|
+
}, serviceType: mkknInfo.mkknshTyp, serviceOutput: {
|
|
159
|
+
reservationFor: {
|
|
160
|
+
typeOf: params.screeningEvent.typeOf,
|
|
161
|
+
id: params.screeningEvent.id
|
|
162
|
+
}
|
|
163
|
+
// reservedTicket: {
|
|
164
|
+
// ticketedSeat: {
|
|
165
|
+
// typeOf: factory.placeType.Seat,
|
|
166
|
+
// // seatingType: 'Default', // 情報空でよし
|
|
167
|
+
// seatNumber: '', // 情報空でよし
|
|
168
|
+
// seatRow: '', // 情報空でよし
|
|
169
|
+
// seatSection: '' // 情報空でよし
|
|
170
|
+
// }
|
|
171
|
+
// }
|
|
172
|
+
} }, {
|
|
173
|
+
validThrough: moment(`${mkknInfo.yykDt}+09:00`, 'YYYY/MM/DD HH:mm:ssZ')
|
|
174
|
+
.toDate()
|
|
175
|
+
}));
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
return movieTickets;
|
|
183
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { MongoRepository as ProductRepo } from '../../../repo/product';
|
|
2
|
+
import * as factory from '../../../factory';
|
|
3
|
+
declare function getCredentials(params: {
|
|
4
|
+
paymentMethodType: string;
|
|
5
|
+
seller: factory.seller.ISeller;
|
|
6
|
+
paymentServiceId: string;
|
|
7
|
+
}): (repos: {
|
|
8
|
+
product: ProductRepo;
|
|
9
|
+
}) => Promise<{
|
|
10
|
+
kgygishCd: string;
|
|
11
|
+
stCd: string;
|
|
12
|
+
}>;
|
|
13
|
+
export { getCredentials };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.getCredentials = void 0;
|
|
13
|
+
const factory = require("../../../factory");
|
|
14
|
+
function getCredentials(params) {
|
|
15
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
var _a, _b, _c;
|
|
17
|
+
// 決済サービスからcredentialsを取得する
|
|
18
|
+
const paymentServices = yield repos.product.search({
|
|
19
|
+
limit: 1,
|
|
20
|
+
page: 1,
|
|
21
|
+
project: { id: { $eq: params.seller.project.id } },
|
|
22
|
+
typeOf: { $eq: factory.service.paymentService.PaymentServiceType.MovieTicket },
|
|
23
|
+
// serviceType: { codeValue: { $eq: params.paymentMethodType } },
|
|
24
|
+
id: { $eq: params.paymentServiceId }
|
|
25
|
+
});
|
|
26
|
+
const paymentService = paymentServices.shift();
|
|
27
|
+
if (paymentService === undefined) {
|
|
28
|
+
throw new factory.errors.NotFound('PaymentService');
|
|
29
|
+
}
|
|
30
|
+
const provider = (_a = paymentService.provider) === null || _a === void 0 ? void 0 : _a.find((p) => p.id === params.seller.id);
|
|
31
|
+
if (provider === undefined) {
|
|
32
|
+
throw new factory.errors.NotFound('PaymentService provider');
|
|
33
|
+
}
|
|
34
|
+
const kgygishCd = (_b = provider.credentials) === null || _b === void 0 ? void 0 : _b.kgygishCd;
|
|
35
|
+
const stCd = (_c = provider.credentials) === null || _c === void 0 ? void 0 : _c.stCd;
|
|
36
|
+
if (typeof kgygishCd !== 'string' || typeof stCd !== 'string') {
|
|
37
|
+
throw new factory.errors.Argument('transaction', 'Provider credentials not enough');
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
kgygishCd,
|
|
41
|
+
stCd
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
exports.getCredentials = getCredentials;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 決済取引サービス
|
|
3
|
+
*/
|
|
4
|
+
import * as factory from '../../../factory';
|
|
5
|
+
import { MongoRepository as EventRepo } from '../../../repo/event';
|
|
6
|
+
import { MongoRepository as ProductRepo } from '../../../repo/product';
|
|
7
|
+
import { MongoRepository as ProjectRepo } from '../../../repo/project';
|
|
8
|
+
import { MongoRepository as SellerRepo } from '../../../repo/seller';
|
|
9
|
+
import { ICheckResult } from './checkByIdentifier';
|
|
10
|
+
export declare function validateMovieTicket(params: factory.assetTransaction.pay.IStartParamsWithoutDetail, paymentServiceId: string): (repos: {
|
|
11
|
+
event: EventRepo;
|
|
12
|
+
product: ProductRepo;
|
|
13
|
+
project: ProjectRepo;
|
|
14
|
+
seller: SellerRepo;
|
|
15
|
+
}) => Promise<ICheckResult | undefined>;
|
|
@@ -13,8 +13,9 @@ exports.validateMovieTicket = void 0;
|
|
|
13
13
|
/**
|
|
14
14
|
* 決済取引サービス
|
|
15
15
|
*/
|
|
16
|
-
const factory = require("
|
|
17
|
-
const
|
|
16
|
+
const factory = require("../../../factory");
|
|
17
|
+
const checkByIdentifier_1 = require("./checkByIdentifier");
|
|
18
|
+
const settings_1 = require("../../../settings");
|
|
18
19
|
function validateMovieTicket(params, paymentServiceId) {
|
|
19
20
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
20
21
|
var _a, _b, _c, _d;
|
|
@@ -37,11 +38,7 @@ function validateMovieTicket(params, paymentServiceId) {
|
|
|
37
38
|
if (typeof paymentMethodType !== 'string') {
|
|
38
39
|
throw new factory.errors.ArgumentNull('object.paymentMethod.typeOf');
|
|
39
40
|
}
|
|
40
|
-
// イベント情報取得
|
|
41
41
|
// イベント取得属性最適化(2023-01-23~)
|
|
42
|
-
// const screeningEvent = await repos.event.findById<factory.eventType.ScreeningEvent>({
|
|
43
|
-
// id: eventIds[0]
|
|
44
|
-
// });
|
|
45
42
|
const screeningEvent = yield repos.event.findMinimizedIndividualEventById({
|
|
46
43
|
id: eventIds[0]
|
|
47
44
|
});
|
|
@@ -55,7 +52,11 @@ function validateMovieTicket(params, paymentServiceId) {
|
|
|
55
52
|
if (paymentAccepted !== true) {
|
|
56
53
|
throw new factory.errors.Argument('recipient', 'payment not accepted');
|
|
57
54
|
}
|
|
58
|
-
|
|
55
|
+
// オプション追加(2023-03-06~)
|
|
56
|
+
if (!settings_1.settings.useCheckMovieTicketBeforePay) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const checkResult = yield (0, checkByIdentifier_1.checkByIdentifier)({
|
|
59
60
|
movieTickets: movieTickets,
|
|
60
61
|
seller: seller,
|
|
61
62
|
screeningEvent: screeningEvent,
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
import { MongoRepository as AccountingReportRepo } from '../../repo/accountingReport';
|
|
2
2
|
import { MongoRepository as ActionRepo } from '../../repo/action';
|
|
3
|
-
import {
|
|
3
|
+
import { MongoRepository as EventRepo } from '../../repo/event';
|
|
4
4
|
import { MongoRepository as ProductRepo } from '../../repo/product';
|
|
5
5
|
import { MongoRepository as ProjectRepo } from '../../repo/project';
|
|
6
6
|
import { MongoRepository as SellerRepo } from '../../repo/seller';
|
|
7
7
|
import { MongoRepository as TaskRepo } from '../../repo/task';
|
|
8
8
|
import * as factory from '../../factory';
|
|
9
|
-
|
|
10
|
-
purchaseNumberAuthIn: factory.action.check.paymentMethod.movieTicket.IPurchaseNumberAuthIn;
|
|
11
|
-
purchaseNumberAuthResult: factory.action.check.paymentMethod.movieTicket.IPurchaseNumberAuthResult;
|
|
12
|
-
movieTickets: factory.action.check.paymentMethod.movieTicket.IMovieTicket[];
|
|
13
|
-
}
|
|
9
|
+
import { ICheckResult } from './movieTicket/checkByIdentifier';
|
|
14
10
|
interface ICheckOperationRepos {
|
|
15
11
|
action: ActionRepo;
|
|
16
12
|
event: EventRepo;
|
|
@@ -43,18 +39,6 @@ declare type ICheckMovieTicketAction = factory.action.check.paymentMethod.movieT
|
|
|
43
39
|
* MovieTicket認証
|
|
44
40
|
*/
|
|
45
41
|
declare function checkMovieTicket(params: factory.action.check.paymentMethod.movieTicket.IAttributes): ICheckOperation<ICheckMovieTicketAction>;
|
|
46
|
-
/**
|
|
47
|
-
* MovieTicket認証
|
|
48
|
-
*/
|
|
49
|
-
declare function checkByIdentifier(params: {
|
|
50
|
-
movieTickets: factory.action.check.paymentMethod.movieTicket.IMovieTicket[];
|
|
51
|
-
seller: factory.seller.ISeller;
|
|
52
|
-
screeningEvent: IMinimizedIndividualEvent<factory.eventType.ScreeningEvent>;
|
|
53
|
-
paymentServiceId: string;
|
|
54
|
-
}): (repos: {
|
|
55
|
-
product: ProductRepo;
|
|
56
|
-
project: ProjectRepo;
|
|
57
|
-
}) => Promise<ICheckResult>;
|
|
58
42
|
interface IAuthorizeResult {
|
|
59
43
|
accountId: string;
|
|
60
44
|
checkResult?: ICheckResult;
|
|
@@ -90,4 +74,4 @@ declare function payMovieTicket(params: factory.task.pay.IData): IPayOperation<I
|
|
|
90
74
|
* MovieTicket着券取消
|
|
91
75
|
*/
|
|
92
76
|
declare function refundMovieTicket(params: factory.task.refund.IData): IRefundOperation<factory.action.trade.refund.IAction>;
|
|
93
|
-
export { ICheckResult, authorize, checkMovieTicket,
|
|
77
|
+
export { ICheckResult, authorize, checkMovieTicket, payMovieTicket, refundMovieTicket, voidTransaction };
|
|
@@ -9,17 +9,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.voidTransaction = exports.refundMovieTicket = exports.payMovieTicket = exports.
|
|
12
|
+
exports.voidTransaction = exports.refundMovieTicket = exports.payMovieTicket = exports.checkMovieTicket = exports.authorize = void 0;
|
|
13
13
|
/**
|
|
14
14
|
* 決済サービス
|
|
15
15
|
*/
|
|
16
16
|
const surfrock = require("@surfrock/sdk");
|
|
17
|
-
const moment = require("moment-timezone");
|
|
18
17
|
const credentials_1 = require("../../credentials");
|
|
19
18
|
const factory = require("../../factory");
|
|
20
|
-
const
|
|
19
|
+
const checkByIdentifier_1 = require("./movieTicket/checkByIdentifier");
|
|
21
20
|
const factory_1 = require("./movieTicket/factory");
|
|
22
|
-
const
|
|
21
|
+
const getCredentials_1 = require("./movieTicket/getCredentials");
|
|
22
|
+
const validation_1 = require("./movieTicket/validation");
|
|
23
23
|
const errorHandler_1 = require("../../errorHandler");
|
|
24
24
|
const onPaid_1 = require("./any/onPaid");
|
|
25
25
|
const onRefund_1 = require("./any/onRefund");
|
|
@@ -67,7 +67,7 @@ function checkMovieTicket(params) {
|
|
|
67
67
|
if (paymentAccepted !== true) {
|
|
68
68
|
throw new factory.errors.Argument('transactionId', 'payment not accepted');
|
|
69
69
|
}
|
|
70
|
-
checkResult = yield checkByIdentifier({
|
|
70
|
+
checkResult = yield (0, checkByIdentifier_1.checkByIdentifier)({
|
|
71
71
|
movieTickets: movieTickets,
|
|
72
72
|
seller: seller,
|
|
73
73
|
screeningEvent: screeningEvent,
|
|
@@ -95,172 +95,6 @@ function checkMovieTicket(params) {
|
|
|
95
95
|
});
|
|
96
96
|
}
|
|
97
97
|
exports.checkMovieTicket = checkMovieTicket;
|
|
98
|
-
/**
|
|
99
|
-
* MovieTicket認証
|
|
100
|
-
*/
|
|
101
|
-
function checkByIdentifier(params) {
|
|
102
|
-
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
103
|
-
var _a, _b, _c, _d;
|
|
104
|
-
let purchaseNumberAuthIn;
|
|
105
|
-
let purchaseNumberAuthResult;
|
|
106
|
-
// MovieTicket系統の決済方法タイプは動的
|
|
107
|
-
const paymentMethodType = (_a = params.movieTickets[0]) === null || _a === void 0 ? void 0 : _a.typeOf;
|
|
108
|
-
if (typeof paymentMethodType !== 'string') {
|
|
109
|
-
throw new factory.errors.ArgumentNull('movieTickets.typeOf');
|
|
110
|
-
}
|
|
111
|
-
const availableChannel = yield repos.product.findAvailableChannel({
|
|
112
|
-
project: params.screeningEvent.project,
|
|
113
|
-
typeOf: factory.service.paymentService.PaymentServiceType.MovieTicket,
|
|
114
|
-
id: params.paymentServiceId
|
|
115
|
-
});
|
|
116
|
-
const movieTicketIdentifiers = [];
|
|
117
|
-
const knyknrNoInfoIn = [];
|
|
118
|
-
params.movieTickets.forEach((movieTicket) => {
|
|
119
|
-
if (movieTicketIdentifiers.indexOf(movieTicket.identifier) < 0) {
|
|
120
|
-
movieTicketIdentifiers.push(movieTicket.identifier);
|
|
121
|
-
knyknrNoInfoIn.push({
|
|
122
|
-
knyknrNo: movieTicket.identifier,
|
|
123
|
-
pinCd: String(movieTicket.accessCode)
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
let skhnCd = params.screeningEvent.superEvent.workPerformed.identifier;
|
|
128
|
-
const eventOffers = params.screeningEvent.offers;
|
|
129
|
-
if (eventOffers === undefined) {
|
|
130
|
-
throw new factory.errors.NotFound('EventOffers', 'Event offers undefined');
|
|
131
|
-
}
|
|
132
|
-
const offeredThrough = eventOffers.offeredThrough;
|
|
133
|
-
// イベントインポート元がCOAの場合、作品コード連携方法が異なる
|
|
134
|
-
if (offeredThrough !== undefined && offeredThrough.identifier === factory.service.webAPI.Identifier.COA) {
|
|
135
|
-
const DIGITS = -2;
|
|
136
|
-
let eventCOAInfo;
|
|
137
|
-
if (Array.isArray(params.screeningEvent.additionalProperty)) {
|
|
138
|
-
const coaInfoProperty = params.screeningEvent.additionalProperty.find((p) => p.name === 'coaInfo');
|
|
139
|
-
eventCOAInfo = (coaInfoProperty !== undefined) ? JSON.parse(coaInfoProperty.value) : undefined;
|
|
140
|
-
}
|
|
141
|
-
skhnCd = `${eventCOAInfo.titleCode}${`00${eventCOAInfo.titleBranchNum}`.slice(DIGITS)}`;
|
|
142
|
-
}
|
|
143
|
-
const sellerCredentials = yield getCredentials({
|
|
144
|
-
paymentMethodType,
|
|
145
|
-
seller: params.seller,
|
|
146
|
-
paymentServiceId: params.paymentServiceId
|
|
147
|
-
})(repos);
|
|
148
|
-
purchaseNumberAuthIn = {
|
|
149
|
-
kgygishCd: sellerCredentials.kgygishCd,
|
|
150
|
-
jhshbtsCd: surfrock.service.auth.factory.InformationTypeCode.All,
|
|
151
|
-
knyknrNoInfoIn: knyknrNoInfoIn,
|
|
152
|
-
skhnCd: skhnCd,
|
|
153
|
-
stCd: sellerCredentials.stCd,
|
|
154
|
-
jeiYmd: moment(params.screeningEvent.startDate)
|
|
155
|
-
.tz('Asia/Tokyo')
|
|
156
|
-
.format('YYYY/MM/DD')
|
|
157
|
-
};
|
|
158
|
-
const mvtkReserveAuthClient = new surfrock.auth.ClientCredentials({
|
|
159
|
-
domain: String((_b = availableChannel.credentials) === null || _b === void 0 ? void 0 : _b.authorizeServerDomain),
|
|
160
|
-
clientId: String((_c = availableChannel.credentials) === null || _c === void 0 ? void 0 : _c.clientId),
|
|
161
|
-
clientSecret: String((_d = availableChannel.credentials) === null || _d === void 0 ? void 0 : _d.clientSecret),
|
|
162
|
-
scopes: [],
|
|
163
|
-
state: ''
|
|
164
|
-
});
|
|
165
|
-
const authService = new surfrock.service.auth.AuthService({
|
|
166
|
-
endpoint: String(availableChannel.serviceUrl),
|
|
167
|
-
auth: mvtkReserveAuthClient
|
|
168
|
-
}, { timeout: credentials_1.credentials.movieticketReserve.timeout });
|
|
169
|
-
purchaseNumberAuthResult = yield authService.purchaseNumberAuth(purchaseNumberAuthIn);
|
|
170
|
-
// 決済カード配列に成形
|
|
171
|
-
const movieTickets = purchaseNumberAuthResult2movieTickets({
|
|
172
|
-
screeningEvent: params.screeningEvent,
|
|
173
|
-
paymentMethodType,
|
|
174
|
-
knyknrNoInfoIn,
|
|
175
|
-
purchaseNumberAuthResult
|
|
176
|
-
});
|
|
177
|
-
return { purchaseNumberAuthIn, purchaseNumberAuthResult, movieTickets };
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
exports.checkByIdentifier = checkByIdentifier;
|
|
181
|
-
function purchaseNumberAuthResult2movieTickets(params) {
|
|
182
|
-
const movieTickets = [];
|
|
183
|
-
const paymentMethodType = params.paymentMethodType;
|
|
184
|
-
const knyknrNoInfoIn = params.knyknrNoInfoIn;
|
|
185
|
-
const purchaseNumberAuthResult = params.purchaseNumberAuthResult;
|
|
186
|
-
if (Array.isArray(purchaseNumberAuthResult.knyknrNoInfoOut)) {
|
|
187
|
-
purchaseNumberAuthResult.knyknrNoInfoOut.forEach((knyknrNoInfoOut) => {
|
|
188
|
-
const knyknrNoInfo = knyknrNoInfoIn.find((info) => info.knyknrNo === knyknrNoInfoOut.knyknrNo);
|
|
189
|
-
if (knyknrNoInfo !== undefined) {
|
|
190
|
-
const movieTicketCategoryCode = (typeof knyknrNoInfoOut.znkkkytsknGkjknTyp === 'string')
|
|
191
|
-
? knyknrNoInfoOut.znkkkytsknGkjknTyp
|
|
192
|
-
: '';
|
|
193
|
-
if (Array.isArray(knyknrNoInfoOut.ykknInfo)) {
|
|
194
|
-
knyknrNoInfoOut.ykknInfo.forEach((ykknInfo) => {
|
|
195
|
-
// tslint:disable-next-line:prefer-array-literal
|
|
196
|
-
[...Array(Number(ykknInfo.ykknKnshbtsmiNum))].forEach(() => {
|
|
197
|
-
movieTickets.push({
|
|
198
|
-
// project: { typeOf: factory.organizationType.Project, id: params.screeningEvent.project.id },
|
|
199
|
-
typeOf: paymentMethodType,
|
|
200
|
-
identifier: knyknrNoInfo.knyknrNo,
|
|
201
|
-
accessCode: knyknrNoInfo.pinCd,
|
|
202
|
-
category: {
|
|
203
|
-
codeValue: movieTicketCategoryCode // 追加(2023-02-08~)
|
|
204
|
-
},
|
|
205
|
-
serviceType: ykknInfo.ykknshTyp,
|
|
206
|
-
serviceOutput: {
|
|
207
|
-
reservationFor: {
|
|
208
|
-
typeOf: params.screeningEvent.typeOf,
|
|
209
|
-
id: params.screeningEvent.id
|
|
210
|
-
}
|
|
211
|
-
// reservedTicket: {
|
|
212
|
-
// ticketedSeat: {
|
|
213
|
-
// typeOf: factory.placeType.Seat,
|
|
214
|
-
// // seatingType: 'Default', // 情報空でよし
|
|
215
|
-
// seatNumber: '', // 情報空でよし
|
|
216
|
-
// seatRow: '', // 情報空でよし
|
|
217
|
-
// seatSection: '' // 情報空でよし
|
|
218
|
-
// }
|
|
219
|
-
// }
|
|
220
|
-
}
|
|
221
|
-
});
|
|
222
|
-
});
|
|
223
|
-
});
|
|
224
|
-
}
|
|
225
|
-
if (Array.isArray(knyknrNoInfoOut.mkknInfo)) {
|
|
226
|
-
knyknrNoInfoOut.mkknInfo.forEach((mkknInfo) => {
|
|
227
|
-
// tslint:disable-next-line:prefer-array-literal
|
|
228
|
-
[...Array(Number(mkknInfo.mkknKnshbtsmiNum))].forEach(() => {
|
|
229
|
-
movieTickets.push(Object.assign({
|
|
230
|
-
// project: { typeOf: factory.organizationType.Project, id: params.screeningEvent.project.id },
|
|
231
|
-
typeOf: paymentMethodType, identifier: knyknrNoInfo.knyknrNo, accessCode: knyknrNoInfo.pinCd, category: {
|
|
232
|
-
codeValue: movieTicketCategoryCode // 追加(2023-02-08~)
|
|
233
|
-
}, amount: {
|
|
234
|
-
typeOf: 'MonetaryAmount',
|
|
235
|
-
currency: factory.priceCurrency.JPY,
|
|
236
|
-
validThrough: moment(`${mkknInfo.yykDt}+09:00`, 'YYYY/MM/DD HH:mm:ssZ')
|
|
237
|
-
.toDate()
|
|
238
|
-
}, serviceType: mkknInfo.mkknshTyp, serviceOutput: {
|
|
239
|
-
reservationFor: {
|
|
240
|
-
typeOf: params.screeningEvent.typeOf,
|
|
241
|
-
id: params.screeningEvent.id
|
|
242
|
-
}
|
|
243
|
-
// reservedTicket: {
|
|
244
|
-
// ticketedSeat: {
|
|
245
|
-
// typeOf: factory.placeType.Seat,
|
|
246
|
-
// // seatingType: 'Default', // 情報空でよし
|
|
247
|
-
// seatNumber: '', // 情報空でよし
|
|
248
|
-
// seatRow: '', // 情報空でよし
|
|
249
|
-
// seatSection: '' // 情報空でよし
|
|
250
|
-
// }
|
|
251
|
-
// }
|
|
252
|
-
} }, {
|
|
253
|
-
validThrough: moment(`${mkknInfo.yykDt}+09:00`, 'YYYY/MM/DD HH:mm:ssZ')
|
|
254
|
-
.toDate()
|
|
255
|
-
}));
|
|
256
|
-
});
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
});
|
|
261
|
-
}
|
|
262
|
-
return movieTickets;
|
|
263
|
-
}
|
|
264
98
|
/**
|
|
265
99
|
* MovieTicket承認
|
|
266
100
|
* オーソリサービスが存在するわけではないので、実質着券する
|
|
@@ -272,11 +106,8 @@ function authorize(params, transaction, paymentServiceId) {
|
|
|
272
106
|
let checkResult;
|
|
273
107
|
let payAction;
|
|
274
108
|
try {
|
|
275
|
-
//
|
|
276
|
-
|
|
277
|
-
// MovieTicket決済の場合、認証
|
|
278
|
-
checkResult = yield (0, validation_1.validateMovieTicket)(params, paymentServiceId)(repos);
|
|
279
|
-
}
|
|
109
|
+
// MovieTicket決済の場合、認証
|
|
110
|
+
checkResult = yield (0, validation_1.validateMovieTicket)(params, paymentServiceId)(repos);
|
|
280
111
|
const paymentMethod = transaction.object.paymentMethod;
|
|
281
112
|
const paymentMethodType = String(paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.typeOf);
|
|
282
113
|
const additionalProperty = paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.additionalProperty;
|
|
@@ -470,7 +301,7 @@ function payActionParams2seatInfoSyncIn(params) {
|
|
|
470
301
|
const seller = yield repos.seller.findById({ id: String((_d = params.recipient) === null || _d === void 0 ? void 0 : _d.id) });
|
|
471
302
|
// 全購入管理番号のMovieTicketをマージ
|
|
472
303
|
const movieTickets = params.object.reduce((a, b) => [...a, ...(Array.isArray(b.movieTickets)) ? b.movieTickets : []], []);
|
|
473
|
-
const sellerCredentials = yield getCredentials({ paymentMethodType, seller, paymentServiceId })(repos);
|
|
304
|
+
const sellerCredentials = yield (0, getCredentials_1.getCredentials)({ paymentMethodType, seller, paymentServiceId })(repos);
|
|
474
305
|
return (0, factory_1.createSeatInfoSyncIn)({
|
|
475
306
|
paymentMethodType: paymentMethodType,
|
|
476
307
|
paymentMethodId: paymentMethodId,
|
|
@@ -581,43 +412,6 @@ function createSeatInfoSyncInOnRefund(params) {
|
|
|
581
412
|
// instrument参照に統一(2022-05-02~)
|
|
582
413
|
seatInfoSyncIn = Object.assign(Object.assign({}, seatInfoSyncInOnPay), { trkshFlg: surfrock.service.seat.factory.DeleteFlag.True // 取消フラグ
|
|
583
414
|
});
|
|
584
|
-
// seatInfoSyncIn = {
|
|
585
|
-
// ...(payAction.instrument?.seatInfoSyncIn !== undefined && payAction.instrument?.seatInfoSyncIn !== null)
|
|
586
|
-
// ? <surfrock.service.seat.factory.ISeatInfoSyncIn>payAction.instrument?.seatInfoSyncIn
|
|
587
|
-
// : <surfrock.service.seat.factory.ISeatInfoSyncIn>payAction.result?.seatInfoSyncIn,
|
|
588
|
-
// trkshFlg: surfrock.service.seat.factory.DeleteFlag.True // 取消フラグ
|
|
589
|
-
// };
|
|
590
415
|
return seatInfoSyncIn;
|
|
591
416
|
});
|
|
592
417
|
}
|
|
593
|
-
function getCredentials(params) {
|
|
594
|
-
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
595
|
-
var _a, _b, _c;
|
|
596
|
-
// 決済サービスからcredentialsを取得する
|
|
597
|
-
const paymentServices = yield repos.product.search({
|
|
598
|
-
limit: 1,
|
|
599
|
-
page: 1,
|
|
600
|
-
project: { id: { $eq: params.seller.project.id } },
|
|
601
|
-
typeOf: { $eq: factory.service.paymentService.PaymentServiceType.MovieTicket },
|
|
602
|
-
// serviceType: { codeValue: { $eq: params.paymentMethodType } },
|
|
603
|
-
id: { $eq: params.paymentServiceId }
|
|
604
|
-
});
|
|
605
|
-
const paymentService = paymentServices.shift();
|
|
606
|
-
if (paymentService === undefined) {
|
|
607
|
-
throw new factory.errors.NotFound('PaymentService');
|
|
608
|
-
}
|
|
609
|
-
const provider = (_a = paymentService.provider) === null || _a === void 0 ? void 0 : _a.find((p) => p.id === params.seller.id);
|
|
610
|
-
if (provider === undefined) {
|
|
611
|
-
throw new factory.errors.NotFound('PaymentService provider');
|
|
612
|
-
}
|
|
613
|
-
const kgygishCd = (_b = provider.credentials) === null || _b === void 0 ? void 0 : _b.kgygishCd;
|
|
614
|
-
const stCd = (_c = provider.credentials) === null || _c === void 0 ? void 0 : _c.stCd;
|
|
615
|
-
if (typeof kgygishCd !== 'string' || typeof stCd !== 'string') {
|
|
616
|
-
throw new factory.errors.Argument('transaction', 'Provider credentials not enough');
|
|
617
|
-
}
|
|
618
|
-
return {
|
|
619
|
-
kgygishCd,
|
|
620
|
-
stCd
|
|
621
|
-
};
|
|
622
|
-
});
|
|
623
|
-
}
|
|
@@ -14,6 +14,7 @@ const factory = require("../../factory");
|
|
|
14
14
|
const event_1 = require("../../repo/event");
|
|
15
15
|
const screeningEvent_1 = require("../../repo/itemAvailability/screeningEvent");
|
|
16
16
|
const offer_1 = require("../../repo/offer");
|
|
17
|
+
const offerCatalog_1 = require("../../repo/offerCatalog");
|
|
17
18
|
const place_1 = require("../../repo/place");
|
|
18
19
|
const product_1 = require("../../repo/product");
|
|
19
20
|
const project_1 = require("../../repo/project");
|
|
@@ -33,6 +34,7 @@ function call(data) {
|
|
|
33
34
|
event: new event_1.MongoRepository(settings.connection),
|
|
34
35
|
eventAvailability: new screeningEvent_1.RedisRepository(settings.redisClient),
|
|
35
36
|
offer: new offer_1.MongoRepository(settings.connection),
|
|
37
|
+
offerCatalog: new offerCatalog_1.MongoRepository(settings.connection),
|
|
36
38
|
offerRateLimit: new offer_2.RedisRepository(settings.redisClient),
|
|
37
39
|
place: new place_1.MongoRepository(settings.connection),
|
|
38
40
|
product: new product_1.MongoRepository(settings.connection),
|
package/package.json
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.
|
|
13
|
-
"@cinerino/sdk": "3.144.
|
|
12
|
+
"@chevre/factory": "4.294.0",
|
|
13
|
+
"@cinerino/sdk": "3.144.1",
|
|
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.38"
|
|
124
124
|
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 決済取引サービス
|
|
3
|
-
*/
|
|
4
|
-
import * as factory from '../../../../factory';
|
|
5
|
-
import { MongoRepository as EventRepo } from '../../../../repo/event';
|
|
6
|
-
import { MongoRepository as ProductRepo } from '../../../../repo/product';
|
|
7
|
-
import { MongoRepository as ProjectRepo } from '../../../../repo/project';
|
|
8
|
-
import { MongoRepository as SellerRepo } from '../../../../repo/seller';
|
|
9
|
-
export declare function validateMovieTicket(params: factory.assetTransaction.pay.IStartParamsWithoutDetail, paymentServiceId: string): (repos: {
|
|
10
|
-
event: EventRepo;
|
|
11
|
-
product: ProductRepo;
|
|
12
|
-
project: ProjectRepo;
|
|
13
|
-
seller: SellerRepo;
|
|
14
|
-
}) => Promise<import("../../../payment/movieTicket").ICheckResult>;
|