@chevre/domain 20.4.0-alpha.8 → 20.4.0
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/example/src/chevre/deleteMovieTicketCategoryChargePriceSpecs.ts +21 -0
- package/example/src/chevre/{deleteReservationTicketUnderNames.ts → deleteTasksByName.ts} +4 -2
- package/example/src/chevre/migrateMoneyTransferPendingTransactionIdentifier.ts +96 -0
- package/example/src/chevre/reIndex.ts +25 -0
- package/example/src/chevre/searchEventTicketOffers.ts +7 -4
- package/example/src/chevre/searchOfferCatalogs.ts +14 -16
- package/example/src/chevre/searchOffersByCatalog.ts +2 -1
- package/example/src/chevre/searchProductOffers.ts +38 -0
- package/example/src/chevre/searchTasks.ts +22 -0
- package/example/src/chevre/unsetUnnecessaryFields.ts +6 -11
- package/lib/chevre/errorHandler.js +1 -0
- package/lib/chevre/repo/accountTransaction.d.ts +0 -5
- package/lib/chevre/repo/accountTransaction.js +44 -38
- package/lib/chevre/repo/assetTransaction.d.ts +1 -0
- package/lib/chevre/repo/assetTransaction.js +5 -0
- package/lib/chevre/repo/code.d.ts +0 -7
- package/lib/chevre/repo/code.js +0 -17
- package/lib/chevre/repo/event.d.ts +5 -4
- package/lib/chevre/repo/event.js +8 -17
- package/lib/chevre/repo/mongoose/model/accountTransaction.js +0 -5
- package/lib/chevre/repo/mongoose/model/member.js +5 -2
- package/lib/chevre/repo/mongoose/model/offer.js +19 -9
- package/lib/chevre/repo/mongoose/model/priceSpecification.js +19 -52
- package/lib/chevre/repo/mongoose/model/product.js +15 -2
- package/lib/chevre/repo/offer.d.ts +17 -2
- package/lib/chevre/repo/offer.js +77 -44
- package/lib/chevre/repo/offerCatalog.d.ts +3 -5
- package/lib/chevre/repo/offerCatalog.js +78 -37
- package/lib/chevre/repo/priceSpecification.d.ts +11 -0
- package/lib/chevre/repo/priceSpecification.js +44 -66
- package/lib/chevre/repo/task.d.ts +8 -0
- package/lib/chevre/repo/task.js +21 -9
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.d.ts +2 -0
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +93 -96
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +3 -1
- package/lib/chevre/service/assetTransaction/moneyTransfer.js +19 -11
- package/lib/chevre/service/assetTransaction/pay.js +2 -3
- package/lib/chevre/service/assetTransaction/registerService/factory.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/registerService/factory.js +6 -3
- package/lib/chevre/service/assetTransaction/registerService.js +3 -1
- package/lib/chevre/service/assetTransaction/reserve/factory/price.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/reserve/factory/price.js +0 -7
- package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +2 -2
- package/lib/chevre/service/assetTransaction/reserve/factory.js +0 -1
- package/lib/chevre/service/assetTransaction/reserve.js +47 -17
- package/lib/chevre/service/assetTransaction.d.ts +1 -1
- package/lib/chevre/service/code.d.ts +0 -8
- package/lib/chevre/service/code.js +1 -38
- package/lib/chevre/service/delivery.js +12 -3
- package/lib/chevre/service/event.js +0 -3
- package/lib/chevre/service/moneyTransfer.d.ts +1 -1
- package/lib/chevre/service/moneyTransfer.js +7 -8
- package/lib/chevre/service/offer/event/authorize.js +5 -5
- package/lib/chevre/service/offer/event/factory.js +1 -1
- package/lib/chevre/service/offer/event/searchEventTicketOffers.d.ts +7 -7
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +222 -346
- package/lib/chevre/service/offer/factory.d.ts +8 -3
- package/lib/chevre/service/offer/factory.js +44 -26
- package/lib/chevre/service/offer/moneyTransfer/authorize.js +0 -1
- package/lib/chevre/service/offer/moneyTransfer/returnMoneyTransfer.js +0 -1
- package/lib/chevre/service/offer/product/searchProductOffers.d.ts +11 -1
- package/lib/chevre/service/offer/product/searchProductOffers.js +15 -7
- package/lib/chevre/service/offer/product.d.ts +11 -4
- package/lib/chevre/service/offer/product.js +59 -50
- package/lib/chevre/service/payment/any/factory.js +30 -21
- package/lib/chevre/service/payment/any.js +11 -4
- 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/factory.d.ts +1 -1
- 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 +10 -22
- package/lib/chevre/service/payment/movieTicket.js +15 -210
- package/lib/chevre/service/permit.d.ts +5 -1
- package/lib/chevre/service/permit.js +18 -11
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +25 -53
- package/lib/chevre/service/task/aggregateScreeningEvent.js +2 -0
- package/lib/chevre/service/transaction/moneyTransfer.js +0 -1
- package/lib/chevre/service/transaction/orderProgramMembership.js +5 -6
- package/lib/chevre/settings.d.ts +4 -0
- package/lib/chevre/settings.js +8 -2
- package/package.json +3 -3
- package/example/src/chevre/migrateAccountTitleAdditionalProperties.ts +0 -157
- package/lib/chevre/service/assetTransaction/pay/movieTicket/validation.d.ts +0 -14
- package/lib/chevre/service/task/deleteAuthorization.d.ts +0 -6
- package/lib/chevre/service/task/deleteAuthorization.js +0 -29
|
@@ -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
|
+
}
|
|
@@ -3,7 +3,7 @@ import * as factory from '../../../factory';
|
|
|
3
3
|
export declare function createSeatInfoSyncIn(params: {
|
|
4
4
|
paymentMethodType: string;
|
|
5
5
|
paymentMethodId: string;
|
|
6
|
-
movieTickets: factory.
|
|
6
|
+
movieTickets: factory.action.trade.pay.IMovieTicket[];
|
|
7
7
|
event: factory.event.screeningEvent.IEvent;
|
|
8
8
|
purpose: factory.action.trade.pay.IPurpose;
|
|
9
9
|
seller: factory.seller.ISeller;
|
|
@@ -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,17 +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
|
-
interface ICheckResult {
|
|
11
|
-
purchaseNumberAuthIn: factory.action.check.paymentMethod.movieTicket.IPurchaseNumberAuthIn;
|
|
12
|
-
purchaseNumberAuthResult: factory.action.check.paymentMethod.movieTicket.IPurchaseNumberAuthResult;
|
|
13
|
-
movieTickets: IMovieTicket[];
|
|
14
|
-
}
|
|
9
|
+
import { ICheckResult } from './movieTicket/checkByIdentifier';
|
|
15
10
|
interface ICheckOperationRepos {
|
|
16
11
|
action: ActionRepo;
|
|
17
12
|
event: EventRepo;
|
|
@@ -44,22 +39,15 @@ declare type ICheckMovieTicketAction = factory.action.check.paymentMethod.movieT
|
|
|
44
39
|
* MovieTicket認証
|
|
45
40
|
*/
|
|
46
41
|
declare function checkMovieTicket(params: factory.action.check.paymentMethod.movieTicket.IAttributes): ICheckOperation<ICheckMovieTicketAction>;
|
|
47
|
-
/**
|
|
48
|
-
* MovieTicket認証
|
|
49
|
-
*/
|
|
50
|
-
declare function checkByIdentifier(params: {
|
|
51
|
-
movieTickets: IMovieTicket[];
|
|
52
|
-
seller: factory.seller.ISeller;
|
|
53
|
-
screeningEvent: IMinimizedIndividualEvent<factory.eventType.ScreeningEvent>;
|
|
54
|
-
paymentServiceId: string;
|
|
55
|
-
}): (repos: {
|
|
56
|
-
product: ProductRepo;
|
|
57
|
-
project: ProjectRepo;
|
|
58
|
-
}) => Promise<ICheckResult>;
|
|
59
42
|
interface IAuthorizeResult {
|
|
60
|
-
|
|
61
|
-
|
|
43
|
+
accountId: string;
|
|
44
|
+
checkResult?: ICheckResult;
|
|
45
|
+
payAction: factory.action.trade.pay.IAction;
|
|
62
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* MovieTicket承認
|
|
49
|
+
* オーソリサービスが存在するわけではないので、実質着券する
|
|
50
|
+
*/
|
|
63
51
|
declare function authorize(params: factory.assetTransaction.pay.IStartParamsWithoutDetail, transaction: factory.assetTransaction.pay.ITransaction, paymentServiceId: string): (repos: {
|
|
64
52
|
action: ActionRepo;
|
|
65
53
|
accountingReport: AccountingReportRepo;
|
|
@@ -86,4 +74,4 @@ declare function payMovieTicket(params: factory.task.pay.IData): IPayOperation<I
|
|
|
86
74
|
* MovieTicket着券取消
|
|
87
75
|
*/
|
|
88
76
|
declare function refundMovieTicket(params: factory.task.refund.IData): IRefundOperation<factory.action.trade.refund.IAction>;
|
|
89
|
-
export { ICheckResult, authorize, checkMovieTicket,
|
|
77
|
+
export { ICheckResult, authorize, checkMovieTicket, payMovieTicket, refundMovieTicket, voidTransaction };
|
|
@@ -9,16 +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");
|
|
19
|
+
const checkByIdentifier_1 = require("./movieTicket/checkByIdentifier");
|
|
20
20
|
const factory_1 = require("./movieTicket/factory");
|
|
21
|
-
const
|
|
21
|
+
const getCredentials_1 = require("./movieTicket/getCredentials");
|
|
22
|
+
const validation_1 = require("./movieTicket/validation");
|
|
22
23
|
const errorHandler_1 = require("../../errorHandler");
|
|
23
24
|
const onPaid_1 = require("./any/onPaid");
|
|
24
25
|
const onRefund_1 = require("./any/onRefund");
|
|
@@ -66,7 +67,7 @@ function checkMovieTicket(params) {
|
|
|
66
67
|
if (paymentAccepted !== true) {
|
|
67
68
|
throw new factory.errors.Argument('transactionId', 'payment not accepted');
|
|
68
69
|
}
|
|
69
|
-
checkResult = yield checkByIdentifier({
|
|
70
|
+
checkResult = yield (0, checkByIdentifier_1.checkByIdentifier)({
|
|
70
71
|
movieTickets: movieTickets,
|
|
71
72
|
seller: seller,
|
|
72
73
|
screeningEvent: screeningEvent,
|
|
@@ -95,172 +96,13 @@ function checkMovieTicket(params) {
|
|
|
95
96
|
}
|
|
96
97
|
exports.checkMovieTicket = checkMovieTicket;
|
|
97
98
|
/**
|
|
98
|
-
* MovieTicket
|
|
99
|
+
* MovieTicket承認
|
|
100
|
+
* オーソリサービスが存在するわけではないので、実質着券する
|
|
99
101
|
*/
|
|
100
|
-
function checkByIdentifier(params) {
|
|
101
|
-
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
102
|
-
var _a, _b, _c, _d;
|
|
103
|
-
let purchaseNumberAuthIn;
|
|
104
|
-
let purchaseNumberAuthResult;
|
|
105
|
-
// MovieTicket系統の決済方法タイプは動的
|
|
106
|
-
const paymentMethodType = (_a = params.movieTickets[0]) === null || _a === void 0 ? void 0 : _a.typeOf;
|
|
107
|
-
if (typeof paymentMethodType !== 'string') {
|
|
108
|
-
throw new factory.errors.ArgumentNull('movieTickets.typeOf');
|
|
109
|
-
}
|
|
110
|
-
const availableChannel = yield repos.product.findAvailableChannel({
|
|
111
|
-
project: params.screeningEvent.project,
|
|
112
|
-
typeOf: factory.service.paymentService.PaymentServiceType.MovieTicket,
|
|
113
|
-
id: params.paymentServiceId
|
|
114
|
-
});
|
|
115
|
-
const movieTicketIdentifiers = [];
|
|
116
|
-
const knyknrNoInfoIn = [];
|
|
117
|
-
params.movieTickets.forEach((movieTicket) => {
|
|
118
|
-
if (movieTicketIdentifiers.indexOf(movieTicket.identifier) < 0) {
|
|
119
|
-
movieTicketIdentifiers.push(movieTicket.identifier);
|
|
120
|
-
knyknrNoInfoIn.push({
|
|
121
|
-
knyknrNo: movieTicket.identifier,
|
|
122
|
-
pinCd: String(movieTicket.accessCode)
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
let skhnCd = params.screeningEvent.superEvent.workPerformed.identifier;
|
|
127
|
-
const eventOffers = params.screeningEvent.offers;
|
|
128
|
-
if (eventOffers === undefined) {
|
|
129
|
-
throw new factory.errors.NotFound('EventOffers', 'Event offers undefined');
|
|
130
|
-
}
|
|
131
|
-
const offeredThrough = eventOffers.offeredThrough;
|
|
132
|
-
// イベントインポート元がCOAの場合、作品コード連携方法が異なる
|
|
133
|
-
if (offeredThrough !== undefined && offeredThrough.identifier === factory.service.webAPI.Identifier.COA) {
|
|
134
|
-
const DIGITS = -2;
|
|
135
|
-
let eventCOAInfo;
|
|
136
|
-
if (Array.isArray(params.screeningEvent.additionalProperty)) {
|
|
137
|
-
const coaInfoProperty = params.screeningEvent.additionalProperty.find((p) => p.name === 'coaInfo');
|
|
138
|
-
eventCOAInfo = (coaInfoProperty !== undefined) ? JSON.parse(coaInfoProperty.value) : undefined;
|
|
139
|
-
}
|
|
140
|
-
skhnCd = `${eventCOAInfo.titleCode}${`00${eventCOAInfo.titleBranchNum}`.slice(DIGITS)}`;
|
|
141
|
-
}
|
|
142
|
-
const sellerCredentials = yield getCredentials({
|
|
143
|
-
paymentMethodType,
|
|
144
|
-
seller: params.seller,
|
|
145
|
-
paymentServiceId: params.paymentServiceId
|
|
146
|
-
})(repos);
|
|
147
|
-
purchaseNumberAuthIn = {
|
|
148
|
-
kgygishCd: sellerCredentials.kgygishCd,
|
|
149
|
-
jhshbtsCd: surfrock.service.auth.factory.InformationTypeCode.All,
|
|
150
|
-
knyknrNoInfoIn: knyknrNoInfoIn,
|
|
151
|
-
skhnCd: skhnCd,
|
|
152
|
-
stCd: sellerCredentials.stCd,
|
|
153
|
-
jeiYmd: moment(params.screeningEvent.startDate)
|
|
154
|
-
.tz('Asia/Tokyo')
|
|
155
|
-
.format('YYYY/MM/DD')
|
|
156
|
-
};
|
|
157
|
-
const mvtkReserveAuthClient = new surfrock.auth.ClientCredentials({
|
|
158
|
-
domain: String((_b = availableChannel.credentials) === null || _b === void 0 ? void 0 : _b.authorizeServerDomain),
|
|
159
|
-
clientId: String((_c = availableChannel.credentials) === null || _c === void 0 ? void 0 : _c.clientId),
|
|
160
|
-
clientSecret: String((_d = availableChannel.credentials) === null || _d === void 0 ? void 0 : _d.clientSecret),
|
|
161
|
-
scopes: [],
|
|
162
|
-
state: ''
|
|
163
|
-
});
|
|
164
|
-
const authService = new surfrock.service.auth.AuthService({
|
|
165
|
-
endpoint: String(availableChannel.serviceUrl),
|
|
166
|
-
auth: mvtkReserveAuthClient
|
|
167
|
-
}, { timeout: credentials_1.credentials.movieticketReserve.timeout });
|
|
168
|
-
purchaseNumberAuthResult = yield authService.purchaseNumberAuth(purchaseNumberAuthIn);
|
|
169
|
-
// 決済カード配列に成形
|
|
170
|
-
const movieTickets = purchaseNumberAuthResult2movieTickets({
|
|
171
|
-
screeningEvent: params.screeningEvent,
|
|
172
|
-
paymentMethodType,
|
|
173
|
-
knyknrNoInfoIn,
|
|
174
|
-
purchaseNumberAuthResult
|
|
175
|
-
});
|
|
176
|
-
return { purchaseNumberAuthIn, purchaseNumberAuthResult, movieTickets };
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
exports.checkByIdentifier = checkByIdentifier;
|
|
180
|
-
function purchaseNumberAuthResult2movieTickets(params) {
|
|
181
|
-
const movieTickets = [];
|
|
182
|
-
const paymentMethodType = params.paymentMethodType;
|
|
183
|
-
const knyknrNoInfoIn = params.knyknrNoInfoIn;
|
|
184
|
-
const purchaseNumberAuthResult = params.purchaseNumberAuthResult;
|
|
185
|
-
if (Array.isArray(purchaseNumberAuthResult.knyknrNoInfoOut)) {
|
|
186
|
-
purchaseNumberAuthResult.knyknrNoInfoOut.forEach((knyknrNoInfoOut) => {
|
|
187
|
-
const knyknrNoInfo = knyknrNoInfoIn.find((info) => info.knyknrNo === knyknrNoInfoOut.knyknrNo);
|
|
188
|
-
if (knyknrNoInfo !== undefined) {
|
|
189
|
-
const movieTicketCategoryCode = (typeof knyknrNoInfoOut.znkkkytsknGkjknTyp === 'string')
|
|
190
|
-
? knyknrNoInfoOut.znkkkytsknGkjknTyp
|
|
191
|
-
: '';
|
|
192
|
-
if (Array.isArray(knyknrNoInfoOut.ykknInfo)) {
|
|
193
|
-
knyknrNoInfoOut.ykknInfo.forEach((ykknInfo) => {
|
|
194
|
-
// tslint:disable-next-line:prefer-array-literal
|
|
195
|
-
[...Array(Number(ykknInfo.ykknKnshbtsmiNum))].forEach(() => {
|
|
196
|
-
movieTickets.push({
|
|
197
|
-
project: { typeOf: factory.organizationType.Project, id: params.screeningEvent.project.id },
|
|
198
|
-
typeOf: paymentMethodType,
|
|
199
|
-
identifier: knyknrNoInfo.knyknrNo,
|
|
200
|
-
accessCode: knyknrNoInfo.pinCd,
|
|
201
|
-
category: {
|
|
202
|
-
codeValue: movieTicketCategoryCode // 追加(2023-02-08~)
|
|
203
|
-
},
|
|
204
|
-
serviceType: ykknInfo.ykknshTyp,
|
|
205
|
-
serviceOutput: {
|
|
206
|
-
reservationFor: {
|
|
207
|
-
typeOf: params.screeningEvent.typeOf,
|
|
208
|
-
id: params.screeningEvent.id
|
|
209
|
-
},
|
|
210
|
-
reservedTicket: {
|
|
211
|
-
ticketedSeat: {
|
|
212
|
-
typeOf: factory.placeType.Seat,
|
|
213
|
-
// seatingType: 'Default', // 情報空でよし
|
|
214
|
-
seatNumber: '',
|
|
215
|
-
seatRow: '',
|
|
216
|
-
seatSection: '' // 情報空でよし
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
});
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
if (Array.isArray(knyknrNoInfoOut.mkknInfo)) {
|
|
225
|
-
knyknrNoInfoOut.mkknInfo.forEach((mkknInfo) => {
|
|
226
|
-
// tslint:disable-next-line:prefer-array-literal
|
|
227
|
-
[...Array(Number(mkknInfo.mkknKnshbtsmiNum))].forEach(() => {
|
|
228
|
-
movieTickets.push(Object.assign({ project: { typeOf: factory.organizationType.Project, id: params.screeningEvent.project.id }, typeOf: paymentMethodType, identifier: knyknrNoInfo.knyknrNo, accessCode: knyknrNoInfo.pinCd, category: {
|
|
229
|
-
codeValue: movieTicketCategoryCode // 追加(2023-02-08~)
|
|
230
|
-
}, amount: {
|
|
231
|
-
typeOf: 'MonetaryAmount',
|
|
232
|
-
currency: factory.priceCurrency.JPY,
|
|
233
|
-
validThrough: moment(`${mkknInfo.yykDt}+09:00`, 'YYYY/MM/DD HH:mm:ssZ')
|
|
234
|
-
.toDate()
|
|
235
|
-
}, serviceType: mkknInfo.mkknshTyp, serviceOutput: {
|
|
236
|
-
reservationFor: {
|
|
237
|
-
typeOf: params.screeningEvent.typeOf,
|
|
238
|
-
id: params.screeningEvent.id
|
|
239
|
-
},
|
|
240
|
-
reservedTicket: {
|
|
241
|
-
ticketedSeat: {
|
|
242
|
-
typeOf: factory.placeType.Seat,
|
|
243
|
-
// seatingType: 'Default', // 情報空でよし
|
|
244
|
-
seatNumber: '',
|
|
245
|
-
seatRow: '',
|
|
246
|
-
seatSection: '' // 情報空でよし
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
} }, {
|
|
250
|
-
validThrough: moment(`${mkknInfo.yykDt}+09:00`, 'YYYY/MM/DD HH:mm:ssZ')
|
|
251
|
-
.toDate()
|
|
252
|
-
}));
|
|
253
|
-
});
|
|
254
|
-
});
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
return movieTickets;
|
|
260
|
-
}
|
|
261
102
|
function authorize(params, transaction, paymentServiceId) {
|
|
262
103
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
263
104
|
var _a, _b;
|
|
105
|
+
let accountId;
|
|
264
106
|
let checkResult;
|
|
265
107
|
let payAction;
|
|
266
108
|
try {
|
|
@@ -273,7 +115,10 @@ function authorize(params, transaction, paymentServiceId) {
|
|
|
273
115
|
? paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.paymentMethodId
|
|
274
116
|
: transaction.id;
|
|
275
117
|
const paymentMethodName = (typeof (paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.name) === 'string') ? paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.name : paymentMethodType;
|
|
276
|
-
|
|
118
|
+
accountId = (Array.isArray(paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.movieTickets)) ? (_a = paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.movieTickets[0]) === null || _a === void 0 ? void 0 : _a.identifier : undefined;
|
|
119
|
+
if (typeof accountId !== 'string' || accountId.length === 0) {
|
|
120
|
+
throw new factory.errors.ArgumentNull('object.paymentMethod.movieTickets.identifier');
|
|
121
|
+
}
|
|
277
122
|
const payObject = {
|
|
278
123
|
typeOf: factory.service.paymentService.PaymentServiceType.MovieTicket,
|
|
279
124
|
id: paymentServiceId,
|
|
@@ -284,10 +129,7 @@ function authorize(params, transaction, paymentServiceId) {
|
|
|
284
129
|
}, typeOf: paymentMethodType }, (typeof accountId === 'string') ? { accountId } : undefined),
|
|
285
130
|
movieTickets: paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.movieTickets
|
|
286
131
|
};
|
|
287
|
-
const payActionAttributes = Object.assign({ project: transaction.project, typeOf: factory.actionType.PayAction, object: [payObject],
|
|
288
|
-
// agent:Projectに変更(2022-05-19~)
|
|
289
|
-
// agent: transaction.agent,
|
|
290
|
-
agent: transaction.project, recipient: transaction.recipient }, (params.purpose !== undefined)
|
|
132
|
+
const payActionAttributes = Object.assign({ project: transaction.project, typeOf: factory.actionType.PayAction, object: [payObject], agent: transaction.project, recipient: transaction.recipient }, (params.purpose !== undefined)
|
|
291
133
|
? { purpose: params.purpose }
|
|
292
134
|
: { purpose: { typeOf: transaction.typeOf, transactionNumber: transaction.transactionNumber, id: transaction.id } });
|
|
293
135
|
// 着券させざるをえないが、informPaymentはしない(注文がまだ存在しないため)
|
|
@@ -296,7 +138,7 @@ function authorize(params, transaction, paymentServiceId) {
|
|
|
296
138
|
catch (error) {
|
|
297
139
|
throw (0, errorHandler_1.handleMvtkReserveError)(error);
|
|
298
140
|
}
|
|
299
|
-
return
|
|
141
|
+
return { accountId, checkResult, payAction };
|
|
300
142
|
});
|
|
301
143
|
}
|
|
302
144
|
exports.authorize = authorize;
|
|
@@ -459,7 +301,7 @@ function payActionParams2seatInfoSyncIn(params) {
|
|
|
459
301
|
const seller = yield repos.seller.findById({ id: String((_d = params.recipient) === null || _d === void 0 ? void 0 : _d.id) });
|
|
460
302
|
// 全購入管理番号のMovieTicketをマージ
|
|
461
303
|
const movieTickets = params.object.reduce((a, b) => [...a, ...(Array.isArray(b.movieTickets)) ? b.movieTickets : []], []);
|
|
462
|
-
const sellerCredentials = yield getCredentials({ paymentMethodType, seller, paymentServiceId })(repos);
|
|
304
|
+
const sellerCredentials = yield (0, getCredentials_1.getCredentials)({ paymentMethodType, seller, paymentServiceId })(repos);
|
|
463
305
|
return (0, factory_1.createSeatInfoSyncIn)({
|
|
464
306
|
paymentMethodType: paymentMethodType,
|
|
465
307
|
paymentMethodId: paymentMethodId,
|
|
@@ -570,43 +412,6 @@ function createSeatInfoSyncInOnRefund(params) {
|
|
|
570
412
|
// instrument参照に統一(2022-05-02~)
|
|
571
413
|
seatInfoSyncIn = Object.assign(Object.assign({}, seatInfoSyncInOnPay), { trkshFlg: surfrock.service.seat.factory.DeleteFlag.True // 取消フラグ
|
|
572
414
|
});
|
|
573
|
-
// seatInfoSyncIn = {
|
|
574
|
-
// ...(payAction.instrument?.seatInfoSyncIn !== undefined && payAction.instrument?.seatInfoSyncIn !== null)
|
|
575
|
-
// ? <surfrock.service.seat.factory.ISeatInfoSyncIn>payAction.instrument?.seatInfoSyncIn
|
|
576
|
-
// : <surfrock.service.seat.factory.ISeatInfoSyncIn>payAction.result?.seatInfoSyncIn,
|
|
577
|
-
// trkshFlg: surfrock.service.seat.factory.DeleteFlag.True // 取消フラグ
|
|
578
|
-
// };
|
|
579
415
|
return seatInfoSyncIn;
|
|
580
416
|
});
|
|
581
417
|
}
|
|
582
|
-
function getCredentials(params) {
|
|
583
|
-
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
584
|
-
var _a, _b, _c;
|
|
585
|
-
// 決済サービスからcredentialsを取得する
|
|
586
|
-
const paymentServices = yield repos.product.search({
|
|
587
|
-
limit: 1,
|
|
588
|
-
page: 1,
|
|
589
|
-
project: { id: { $eq: params.seller.project.id } },
|
|
590
|
-
typeOf: { $eq: factory.service.paymentService.PaymentServiceType.MovieTicket },
|
|
591
|
-
// serviceType: { codeValue: { $eq: params.paymentMethodType } },
|
|
592
|
-
id: { $eq: params.paymentServiceId }
|
|
593
|
-
});
|
|
594
|
-
const paymentService = paymentServices.shift();
|
|
595
|
-
if (paymentService === undefined) {
|
|
596
|
-
throw new factory.errors.NotFound('PaymentService');
|
|
597
|
-
}
|
|
598
|
-
const provider = (_a = paymentService.provider) === null || _a === void 0 ? void 0 : _a.find((p) => p.id === params.seller.id);
|
|
599
|
-
if (provider === undefined) {
|
|
600
|
-
throw new factory.errors.NotFound('PaymentService provider');
|
|
601
|
-
}
|
|
602
|
-
const kgygishCd = (_b = provider.credentials) === null || _b === void 0 ? void 0 : _b.kgygishCd;
|
|
603
|
-
const stCd = (_c = provider.credentials) === null || _c === void 0 ? void 0 : _c.stCd;
|
|
604
|
-
if (typeof kgygishCd !== 'string' || typeof stCd !== 'string') {
|
|
605
|
-
throw new factory.errors.Argument('transaction', 'Provider credentials not enough');
|
|
606
|
-
}
|
|
607
|
-
return {
|
|
608
|
-
kgygishCd,
|
|
609
|
-
stCd
|
|
610
|
-
};
|
|
611
|
-
});
|
|
612
|
-
}
|