@chevre/domain 24.0.0-alpha.80 → 24.0.0-alpha.82
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/errorHandler.d.ts +5 -0
- package/lib/chevre/errorHandler.js +26 -4
- package/lib/chevre/repo/accountingReport.js +2 -25
- package/lib/chevre/repo/aggregateOffer.js +11 -36
- package/lib/chevre/repo/event.js +2 -37
- package/lib/chevre/repo/eventSeries.js +0 -144
- package/lib/chevre/repo/message.js +1 -3
- package/lib/chevre/repo/mongoose/schemas/setting.d.ts +0 -1
- package/lib/chevre/repo/offer/unitPriceInCatalog.js +1 -1
- package/lib/chevre/repo/order.js +2 -4
- package/lib/chevre/repo/ownershipInfo.js +2 -4
- package/lib/chevre/repo/passport.js +1 -1
- package/lib/chevre/repo/pendingReservation.js +2 -35
- package/lib/chevre/repo/task.js +5 -7
- package/lib/chevre/repo/transactionNumberCounter.js +4 -6
- package/lib/chevre/repository.d.ts +0 -13
- package/lib/chevre/repository.js +1 -26
- package/lib/chevre/service/aggregation/event/importFromCOA.js +4 -8
- package/lib/chevre/service/assetTransaction/pay/start/preStart/validateAcceptedPaymentMethodIfNeeded.js +15 -23
- package/lib/chevre/service/assetTransaction/reserve/start.d.ts +0 -2
- package/lib/chevre/service/assetTransaction/reserve/start.js +0 -1
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.d.ts +0 -3
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.js +1 -11
- package/lib/chevre/service/event.js +4 -10
- package/lib/chevre/service/notification/triggerWebhook.js +43 -48
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +0 -2
- package/lib/chevre/service/offer/event/authorize.d.ts +0 -2
- package/lib/chevre/service/offer/event/importFromCOA/factory.js +0 -12
- package/lib/chevre/service/offer/event/importFromCOA.js +5 -16
- package/lib/chevre/service/offer/event/issueEventOfferTicket.d.ts +1 -3
- package/lib/chevre/service/offer/event/issueEventOfferTicket.js +11 -13
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer/authorize.js +5 -15
- package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.d.ts +0 -1
- package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.js +1 -12
- package/lib/chevre/service/offer/eventServiceByCOA/authorize/validateAcceptedOffers.js +0 -15
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +2 -5
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +2 -3
- package/lib/chevre/service/offer/factory.js +6 -2
- package/lib/chevre/service/payment/creditCard/authorize/handleAuthorizeError.js +2 -7
- package/lib/chevre/service/payment/creditCard/gmoError.d.ts +1 -31
- package/lib/chevre/service/payment/creditCard/refundCreditCard.js +2 -2
- package/lib/chevre/service/payment/creditCard/searchGMOTrade.js +1 -1
- package/lib/chevre/service/payment/creditCard/voidTransaction.js +1 -1
- package/lib/chevre/service/payment/movieTicket/payMovieTicket/processSeatInfoSync.js +2 -2
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket/processSeatInfoSync.js +2 -2
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket/processSeatInfoSyncCancel.js +1 -2
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket.js +10 -3
- package/lib/chevre/service/reserveCOA/cancelReservation.js +12 -16
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesBySeller.d.ts +0 -2
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesBySeller.js +0 -6
- package/lib/chevre/service/task/onResourceDeleted.js +0 -2
- package/lib/chevre/service/task/onResourceUpdated.js +0 -2
- package/lib/chevre/service/taskHandler.js +0 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +26 -32
- package/lib/chevre/service/transaction/placeOrder/confirm.js +2 -4
- package/lib/chevre/service/transaction/placeOrder/updateAgent.js +1 -1
- package/lib/chevre/service/transaction/returnOrder.js +2 -5
- package/package.json +3 -3
- package/lib/chevre/repo/mongoose/schemas/productOffer.d.ts +0 -14
- package/lib/chevre/repo/mongoose/schemas/productOffer.js +0 -108
- package/lib/chevre/repo/place/busStop.d.ts +0 -27
- package/lib/chevre/repo/place/busStop.js +0 -169
- package/lib/chevre/repo/productOffer.d.ts +0 -52
- package/lib/chevre/repo/productOffer.js +0 -209
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateMemberTierIfExists.d.ts +0 -16
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateMemberTierIfExists.js +0 -129
|
@@ -6,7 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.importFromCOA = importFromCOA;
|
|
7
7
|
const debug_1 = __importDefault(require("debug"));
|
|
8
8
|
const moment_timezone_1 = __importDefault(require("moment-timezone"));
|
|
9
|
+
const factory_1 = require("../../../factory");
|
|
9
10
|
const saveScreeningEvents_1 = require("../../event/saveScreeningEvents");
|
|
11
|
+
const errorHandler_1 = require("../../../errorHandler");
|
|
10
12
|
const debug = (0, debug_1.default)('chevre-domain:service');
|
|
11
13
|
/**
|
|
12
14
|
* イベント席数を更新する
|
|
@@ -66,16 +68,10 @@ function importFromCOA(params) {
|
|
|
66
68
|
}
|
|
67
69
|
catch (error) {
|
|
68
70
|
let throwsError = true;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
) {
|
|
71
|
+
const handledCOAError = (0, errorHandler_1.handleCOAError)(error);
|
|
72
|
+
if (handledCOAError instanceof factory_1.factory.errors.GatewayTimeout) {
|
|
72
73
|
throwsError = false;
|
|
73
74
|
}
|
|
74
|
-
if (error.name === 'COAServiceError') {
|
|
75
|
-
if (error.message === 'ESOCKETTIMEDOUT') {
|
|
76
|
-
throwsError = false;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
75
|
if (throwsError) {
|
|
80
76
|
throw error;
|
|
81
77
|
}
|
|
@@ -127,29 +127,21 @@ const TIMEOUT = 2000;
|
|
|
127
127
|
// isAllowed: boolean;
|
|
128
128
|
// };
|
|
129
129
|
async function validateByCustomUrl(params) {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
throw new factory_1.factory.errors.Argument('paymentMethod', `paymentMethod denied by the customValidation. statusCode: ${res.status}`);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
catch (error) {
|
|
149
|
-
// ネットワークエラーやタイムアウト時のハンドリング
|
|
150
|
-
// サービス継続を優先するか、安全側に倒してエラーにするかはポリシー次第
|
|
151
|
-
debug('Custom validation failed:', error.message);
|
|
152
|
-
throw error;
|
|
130
|
+
// 判定エンジンへのリクエスト
|
|
131
|
+
const validationRequest = {
|
|
132
|
+
eventSeriesIds: params.eventSeriesIds,
|
|
133
|
+
paymentMethodType: params.paymentMethodType,
|
|
134
|
+
// amount: params.amount
|
|
135
|
+
};
|
|
136
|
+
const res = await fetch(params.customValidationUrl, {
|
|
137
|
+
method: 'POST',
|
|
138
|
+
headers: { 'Content-Type': 'application/json' },
|
|
139
|
+
body: JSON.stringify(validationRequest),
|
|
140
|
+
// body data type must match "Content-Type" header
|
|
141
|
+
signal: AbortSignal.timeout(TIMEOUT)
|
|
142
|
+
});
|
|
143
|
+
if (!res.ok) {
|
|
144
|
+
throw new factory_1.factory.errors.Argument('paymentMethod', `paymentMethod denied by the customValidation. statusCode: ${res.status}`);
|
|
153
145
|
}
|
|
154
146
|
}
|
|
155
147
|
// /**
|
|
@@ -16,7 +16,6 @@ import type { PaymentServiceRepo } from '../../../repo/paymentService';
|
|
|
16
16
|
import { SeatRepo } from '../../../repo/place/seat';
|
|
17
17
|
import type { PriceSpecificationRepo } from '../../../repo/priceSpecification';
|
|
18
18
|
import type { ProductRepo } from '../../../repo/product';
|
|
19
|
-
import type { ProductOfferRepo } from '../../../repo/productOffer';
|
|
20
19
|
import type { ProjectRepo } from '../../../repo/project';
|
|
21
20
|
import type { OfferRateLimitRepo } from '../../../repo/rateLimit/offer';
|
|
22
21
|
import type { SettingRepo } from '../../../repo/setting';
|
|
@@ -39,7 +38,6 @@ interface IStartOperationRepos {
|
|
|
39
38
|
offerRateLimit: OfferRateLimitRepo;
|
|
40
39
|
paymentService: PaymentServiceRepo;
|
|
41
40
|
product: ProductRepo;
|
|
42
|
-
productOffer: ProductOfferRepo;
|
|
43
41
|
priceSpecification: PriceSpecificationRepo;
|
|
44
42
|
project: ProjectRepo;
|
|
45
43
|
seat: SeatRepo;
|
|
@@ -5,7 +5,6 @@ import type { EventOfferRepo } from '../../../repo/eventOffer';
|
|
|
5
5
|
import type { IssuerRepo } from '../../../repo/issuer';
|
|
6
6
|
import type { MemberRepo } from '../../../repo/member';
|
|
7
7
|
import type { MemberProgramRepo } from '../../../repo/memberProgram';
|
|
8
|
-
import type { ProductOfferRepo } from '../../../repo/productOffer';
|
|
9
8
|
import type { TicketRepo } from '../../../repo/ticket';
|
|
10
9
|
declare function validateStartRequest(params: {
|
|
11
10
|
object: factory.assetTransaction.reserve.IObjectWithoutDetail;
|
|
@@ -29,7 +28,6 @@ declare function validateStartRequest(params: {
|
|
|
29
28
|
issuer: IssuerRepo;
|
|
30
29
|
member: MemberRepo;
|
|
31
30
|
memberProgram: MemberProgramRepo;
|
|
32
|
-
productOffer: ProductOfferRepo;
|
|
33
31
|
ticket: TicketRepo;
|
|
34
32
|
}) => Promise<void>;
|
|
35
33
|
/**
|
|
@@ -58,6 +56,5 @@ declare function validEventOfferByApplicationExists(params: {
|
|
|
58
56
|
issuer: IssuerRepo;
|
|
59
57
|
member: MemberRepo;
|
|
60
58
|
memberProgram: MemberProgramRepo;
|
|
61
|
-
productOffer: ProductOfferRepo;
|
|
62
59
|
}) => Promise<void>;
|
|
63
60
|
export { validateStartRequest, validEventOfferByApplicationExists };
|
|
@@ -9,7 +9,6 @@ const moment_1 = __importDefault(require("moment"));
|
|
|
9
9
|
const factory_1 = require("../../../factory");
|
|
10
10
|
const fixExtendedEventOffer_1 = require("./validateStartRequest/fixExtendedEventOffer");
|
|
11
11
|
const validateIssuedOfferIfExists_1 = require("./validateStartRequest/validateIssuedOfferIfExists");
|
|
12
|
-
const validateMemberTierIfExists_1 = require("./validateStartRequest/validateMemberTierIfExists");
|
|
13
12
|
const verifyTicketTokenAsNeeded_1 = require("./validateStartRequest/verifyTicketTokenAsNeeded");
|
|
14
13
|
function validateStartRequest(params) {
|
|
15
14
|
return async (repos) => {
|
|
@@ -59,8 +58,6 @@ function validEventOfferByApplicationExists(params) {
|
|
|
59
58
|
}
|
|
60
59
|
const validFrom = makesOfferOnApplication.validFrom;
|
|
61
60
|
const validThrough = makesOfferOnApplication.validThrough;
|
|
62
|
-
// const validFrom = eventOffers?.validFrom;
|
|
63
|
-
// const validThrough = eventOffers?.validThrough;
|
|
64
61
|
if (validFrom !== undefined && validFrom !== null) {
|
|
65
62
|
if (acceptedDate.isBefore((0, moment_1.default)(validFrom))) {
|
|
66
63
|
throw new factory_1.factory.errors.Argument('reservationFor.id', `Offer of ${params.event.id} is valid from ${validFrom}`);
|
|
@@ -84,14 +81,7 @@ function validEventOfferByApplicationExists(params) {
|
|
|
84
81
|
})(repos);
|
|
85
82
|
}
|
|
86
83
|
else {
|
|
87
|
-
//
|
|
88
|
-
// 有効メンバープログラムティアが存在する場合
|
|
89
|
-
await (0, validateMemberTierIfExists_1.validateMemberTierIfExists)({
|
|
90
|
-
event,
|
|
91
|
-
now: params.now,
|
|
92
|
-
makesOfferOnApplication,
|
|
93
|
-
acceptedEventOffer
|
|
94
|
-
})(repos);
|
|
84
|
+
// 拡張イベントオファーを利用しない場合は、これ以上検証なし
|
|
95
85
|
}
|
|
96
86
|
};
|
|
97
87
|
}
|
|
@@ -15,6 +15,7 @@ const saveScreeningEvents_1 = require("./event/saveScreeningEvents");
|
|
|
15
15
|
Object.defineProperty(exports, "saveScreeningEvents", { enumerable: true, get: function () { return saveScreeningEvents_1.saveScreeningEvents; } });
|
|
16
16
|
const saveScreeningEventSeries_1 = require("./event/saveScreeningEventSeries");
|
|
17
17
|
Object.defineProperty(exports, "saveScreeningEventSeries", { enumerable: true, get: function () { return saveScreeningEventSeries_1.saveScreeningEventSeries; } });
|
|
18
|
+
const errorHandler_1 = require("../errorHandler");
|
|
18
19
|
// const customsearch = google.customsearch('v1');
|
|
19
20
|
const debug = (0, debug_1.default)('chevre-domain:service:event');
|
|
20
21
|
/**
|
|
@@ -118,18 +119,11 @@ function importFromCOA(params) {
|
|
|
118
119
|
}
|
|
119
120
|
catch (error) {
|
|
120
121
|
let throwsError = true;
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
console.error('saveScreeningEvents throwed an error', error.name, error.message);
|
|
122
|
+
const handledCOAError = (0, errorHandler_1.handleCOAError)(error);
|
|
123
|
+
if (handledCOAError instanceof factory_1.factory.errors.GatewayTimeout) {
|
|
124
|
+
console.error('saveScreeningEvents threw an error', handledCOAError.name, handledCOAError.message);
|
|
125
125
|
throwsError = false;
|
|
126
126
|
}
|
|
127
|
-
if (error.name === 'COAServiceError') {
|
|
128
|
-
if (error.message === 'ESOCKETTIMEDOUT') {
|
|
129
|
-
console.error('saveScreeningEvents throwed an error', error.name, error.message);
|
|
130
|
-
throwsError = false;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
127
|
if (throwsError) {
|
|
134
128
|
throw error;
|
|
135
129
|
}
|
|
@@ -155,7 +155,6 @@ function signRequest(params) {
|
|
|
155
155
|
function processInformAction(params, options) {
|
|
156
156
|
return async (repos) => {
|
|
157
157
|
const timeout = options?.triggerWebhook?.timeout;
|
|
158
|
-
const useFetchAPI = options?.triggerWebhook?.useFetchAPI === true;
|
|
159
158
|
const secretKey = options?.triggerWebhook?.secretKey;
|
|
160
159
|
const headerIdentifier = options?.triggerWebhook?.headerIdentifier;
|
|
161
160
|
const { identifier } = params;
|
|
@@ -180,63 +179,59 @@ function processInformAction(params, options) {
|
|
|
180
179
|
&& typeof headerIdentifier === 'string' && headerIdentifier !== '') {
|
|
181
180
|
signature = signRequest({ requestBody, timestamp, secretKey });
|
|
182
181
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
headers.append(`X-${headerIdentifier}-Webhook-Signature`, signature);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
const res = await fetch(urlTemplate, {
|
|
192
|
-
method: 'POST',
|
|
193
|
-
headers,
|
|
194
|
-
body: requestBody, // body data type must match "Content-Type" header
|
|
195
|
-
...(typeof timeout === 'number')
|
|
196
|
-
? { signal: AbortSignal.timeout(timeout) }
|
|
197
|
-
: undefined
|
|
198
|
-
});
|
|
199
|
-
let body;
|
|
200
|
-
try {
|
|
201
|
-
body = await res.text();
|
|
182
|
+
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
183
|
+
if (typeof headerIdentifier === 'string' && headerIdentifier !== '') {
|
|
184
|
+
headers.append(`X-${headerIdentifier}-Webhook-Timestamp`, String(timestamp));
|
|
185
|
+
if (typeof signature === 'string') {
|
|
186
|
+
headers.append(`X-${headerIdentifier}-Webhook-Signature`, signature);
|
|
202
187
|
}
|
|
203
|
-
|
|
204
|
-
|
|
188
|
+
}
|
|
189
|
+
const res = await fetch(urlTemplate, {
|
|
190
|
+
method: 'POST',
|
|
191
|
+
headers,
|
|
192
|
+
body: requestBody, // body data type must match "Content-Type" header
|
|
193
|
+
...(typeof timeout === 'number')
|
|
194
|
+
? { signal: AbortSignal.timeout(timeout) }
|
|
195
|
+
: undefined
|
|
196
|
+
});
|
|
197
|
+
let body;
|
|
198
|
+
try {
|
|
199
|
+
body = await res.text();
|
|
200
|
+
}
|
|
201
|
+
catch (_error) {
|
|
202
|
+
// no op
|
|
203
|
+
}
|
|
204
|
+
switch (res.status) {
|
|
205
|
+
case http_status_1.status.OK:
|
|
206
|
+
case http_status_1.status.CREATED:
|
|
207
|
+
case http_status_1.status.ACCEPTED:
|
|
208
|
+
case http_status_1.status.NO_CONTENT: {
|
|
209
|
+
result = {
|
|
210
|
+
statusCode: res.status,
|
|
211
|
+
useFetchAPI: true
|
|
212
|
+
};
|
|
213
|
+
break;
|
|
205
214
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
statusCode: res.status,
|
|
213
|
-
useFetchAPI
|
|
214
|
-
};
|
|
215
|
-
break;
|
|
216
|
-
default:
|
|
215
|
+
default: {
|
|
216
|
+
// プロジェクト固有の特別対応
|
|
217
|
+
const ignoreUnexpectedResponse = res.status === http_status_1.status.INTERNAL_SERVER_ERROR
|
|
218
|
+
&& typeof body === 'string'
|
|
219
|
+
&& body.includes(USERNAME_ARGUMENT_REQUIRED_MESSAGE);
|
|
220
|
+
if (!ignoreUnexpectedResponse) {
|
|
217
221
|
throw new factory_1.factory.errors.Internal(`statusCode: ${res.status} body: ${body}`);
|
|
222
|
+
}
|
|
218
223
|
}
|
|
219
224
|
}
|
|
220
|
-
else {
|
|
221
|
-
throw new factory_1.factory.errors.NotImplemented('only useFetchAPI implemented');
|
|
222
|
-
}
|
|
223
225
|
}
|
|
224
226
|
}
|
|
225
227
|
catch (error) {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
if (error.statusCode === http_status_1.status.INTERNAL_SERVER_ERROR && error.body?.message === USERNAME_ARGUMENT_REQUIRED_MESSAGE) {
|
|
229
|
-
throwsError = false;
|
|
228
|
+
try {
|
|
229
|
+
await repos.action.giveUp({ typeOf: action.typeOf, id: action.id, error });
|
|
230
230
|
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
await repos.action.giveUp({ typeOf: action.typeOf, id: action.id, error });
|
|
234
|
-
}
|
|
235
|
-
catch (__) {
|
|
236
|
-
// 失敗したら仕方ない
|
|
237
|
-
}
|
|
238
|
-
throw error;
|
|
231
|
+
catch (__) {
|
|
232
|
+
// 失敗したら仕方ない
|
|
239
233
|
}
|
|
234
|
+
throw error;
|
|
240
235
|
}
|
|
241
236
|
await repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: result });
|
|
242
237
|
};
|
|
@@ -16,7 +16,6 @@ import type { PaymentServiceRepo } from '../../../../repo/paymentService';
|
|
|
16
16
|
import type { SeatRepo } from '../../../../repo/place/seat';
|
|
17
17
|
import type { PriceSpecificationRepo } from '../../../../repo/priceSpecification';
|
|
18
18
|
import type { ProductRepo } from '../../../../repo/product';
|
|
19
|
-
import type { ProductOfferRepo } from '../../../../repo/productOffer';
|
|
20
19
|
import type { ProjectRepo } from '../../../../repo/project';
|
|
21
20
|
import type { OfferRateLimitRepo } from '../../../../repo/rateLimit/offer';
|
|
22
21
|
import type { SettingRepo } from '../../../../repo/setting';
|
|
@@ -65,7 +64,6 @@ declare function processStartReserve4chevre(params: {
|
|
|
65
64
|
offerRateLimit: OfferRateLimitRepo;
|
|
66
65
|
paymentService: PaymentServiceRepo;
|
|
67
66
|
product: ProductRepo;
|
|
68
|
-
productOffer: ProductOfferRepo;
|
|
69
67
|
priceSpecification: PriceSpecificationRepo;
|
|
70
68
|
project: ProjectRepo;
|
|
71
69
|
seat: SeatRepo;
|
|
@@ -19,7 +19,6 @@ import type { PaymentServiceRepo } from '../../../repo/paymentService';
|
|
|
19
19
|
import type { SeatRepo } from '../../../repo/place/seat';
|
|
20
20
|
import type { PriceSpecificationRepo } from '../../../repo/priceSpecification';
|
|
21
21
|
import type { ProductRepo } from '../../../repo/product';
|
|
22
|
-
import type { ProductOfferRepo } from '../../../repo/productOffer';
|
|
23
22
|
import type { ProjectRepo } from '../../../repo/project';
|
|
24
23
|
import type { OfferRateLimitRepo } from '../../../repo/rateLimit/offer';
|
|
25
24
|
import type { SettingRepo } from '../../../repo/setting';
|
|
@@ -50,7 +49,6 @@ interface IAuthorizeRepos {
|
|
|
50
49
|
paymentService: PaymentServiceRepo;
|
|
51
50
|
priceSpecification: PriceSpecificationRepo;
|
|
52
51
|
product: ProductRepo;
|
|
53
|
-
productOffer: ProductOfferRepo;
|
|
54
52
|
project: ProjectRepo;
|
|
55
53
|
seat: SeatRepo;
|
|
56
54
|
setting: SettingRepo;
|
|
@@ -5,17 +5,6 @@ const coa_service_1 = require("@motionpicture/coa-service");
|
|
|
5
5
|
const util_1 = require("util");
|
|
6
6
|
const factory_1 = require("../../../../factory");
|
|
7
7
|
function coaTicket2offer(params) {
|
|
8
|
-
// discontinue eligibleMonetaryAmount(2025-01-03~)
|
|
9
|
-
// 適用通貨区分
|
|
10
|
-
// const eligibleMonetaryAmount: [factory.offer.IEligibleMonetaryAmount] | undefined
|
|
11
|
-
// = (typeof params.ticketResult.usePoint === 'number' && params.ticketResult.usePoint > 0
|
|
12
|
-
// && typeof params.defaultCurrencyType?.typeOf === 'string')
|
|
13
|
-
// ? [{
|
|
14
|
-
// typeOf: 'MonetaryAmount',
|
|
15
|
-
// currency: params.defaultCurrencyType.codeValue,
|
|
16
|
-
// value: Number(params.ticketResult.usePoint)
|
|
17
|
-
// }]
|
|
18
|
-
// : undefined;
|
|
19
8
|
// 決済カード条件へ変更(2025-01-03~)
|
|
20
9
|
// 適用メンバーシップ区分
|
|
21
10
|
// const eligibleMembershipType: [factory.offer.IEligibleCategoryCode] | undefined
|
|
@@ -85,7 +74,6 @@ function coaTicket2offer(params) {
|
|
|
85
74
|
},
|
|
86
75
|
priceSpecification: unitPriceSpec,
|
|
87
76
|
// ...(Array.isArray(eligibleMembershipType)) ? { eligibleMembershipType } : undefined, // 決済カード条件へ変更(2025-01-03~)
|
|
88
|
-
// ...(Array.isArray(eligibleMonetaryAmount)) ? { eligibleMonetaryAmount } : undefined, // discontinue(2025-01-03~)
|
|
89
77
|
additionalProperty: [
|
|
90
78
|
{ name: 'theaterCode', value: params.theaterCode },
|
|
91
79
|
{ name: 'ticketCode', value: String(params.ticketResult.ticketCode) },
|
|
@@ -5,6 +5,7 @@ exports.importCategoryCodesFromCOA = importCategoryCodesFromCOA;
|
|
|
5
5
|
// import type { TaskRepo } from '../../../repo/task';
|
|
6
6
|
const factory_1 = require("../../../factory");
|
|
7
7
|
const factory_2 = require("./importFromCOA/factory");
|
|
8
|
+
const errorHandler_1 = require("../../../errorHandler");
|
|
8
9
|
function importFromCOA(params) {
|
|
9
10
|
return async (repos) => {
|
|
10
11
|
// 通貨区分検索
|
|
@@ -45,16 +46,10 @@ function importFromCOA(params) {
|
|
|
45
46
|
}
|
|
46
47
|
catch (error) {
|
|
47
48
|
let throwsError = true;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
) {
|
|
49
|
+
const handledCOAError = (0, errorHandler_1.handleCOAError)(error);
|
|
50
|
+
if (handledCOAError instanceof factory_1.factory.errors.GatewayTimeout) {
|
|
51
51
|
throwsError = false;
|
|
52
52
|
}
|
|
53
|
-
if (error.name === 'COAServiceError') {
|
|
54
|
-
if (error.message === 'ESOCKETTIMEDOUT') {
|
|
55
|
-
throwsError = false;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
53
|
if (throwsError) {
|
|
59
54
|
throw error;
|
|
60
55
|
}
|
|
@@ -114,16 +109,10 @@ function importCategoryCodesFromCOA(params) {
|
|
|
114
109
|
}
|
|
115
110
|
catch (error) {
|
|
116
111
|
let throwsError = true;
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
) {
|
|
112
|
+
const handledCOAError = (0, errorHandler_1.handleCOAError)(error);
|
|
113
|
+
if (handledCOAError instanceof factory_1.factory.errors.GatewayTimeout) {
|
|
120
114
|
throwsError = false;
|
|
121
115
|
}
|
|
122
|
-
if (error.name === 'COAServiceError') {
|
|
123
|
-
if (error.message === 'ESOCKETTIMEDOUT') {
|
|
124
|
-
throwsError = false;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
116
|
if (throwsError) {
|
|
128
117
|
throw error;
|
|
129
118
|
}
|
|
@@ -6,7 +6,6 @@ import type { EventOfferRepo } from '../../../repo/eventOffer';
|
|
|
6
6
|
import type { IssuerRepo } from '../../../repo/issuer';
|
|
7
7
|
import type { MemberRepo } from '../../../repo/member';
|
|
8
8
|
import type { MemberProgramRepo } from '../../../repo/memberProgram';
|
|
9
|
-
import type { ProductOfferRepo } from '../../../repo/productOffer';
|
|
10
9
|
import type { TicketRepo } from '../../../repo/ticket';
|
|
11
10
|
import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
|
|
12
11
|
interface IIssueEventOfferTicketRepos {
|
|
@@ -18,7 +17,6 @@ interface IIssueEventOfferTicketRepos {
|
|
|
18
17
|
issuer: IssuerRepo;
|
|
19
18
|
member: MemberRepo;
|
|
20
19
|
memberProgram: MemberProgramRepo;
|
|
21
|
-
productOffer: ProductOfferRepo;
|
|
22
20
|
ticket: TicketRepo;
|
|
23
21
|
placeOrder: PlaceOrderRepo;
|
|
24
22
|
}
|
|
@@ -33,7 +31,7 @@ declare function issueEventOfferTicket(params: {
|
|
|
33
31
|
* 拡張イベントオファーID
|
|
34
32
|
*/
|
|
35
33
|
eventOfferId?: string;
|
|
36
|
-
ticketedOffer?: Pick<factory.authorization.IOfferAsObject, 'token'
|
|
34
|
+
ticketedOffer?: Pick<factory.authorization.IOfferAsObject, 'token'>;
|
|
37
35
|
author: Pick<factory.authorization.IAuthor, 'id' | 'typeOf'>;
|
|
38
36
|
project: {
|
|
39
37
|
id: string;
|
|
@@ -66,8 +66,6 @@ function issueEventOfferTicket(params) {
|
|
|
66
66
|
const transaction = await repos.placeOrder.findPlaceOrderInProgressById({ typeOf: factory_1.factory.transactionType.PlaceOrder, id: audience.id }, ['expires', 'typeOf', 'seller']);
|
|
67
67
|
// イベントは存在するか
|
|
68
68
|
const event = await repos.event.projectEventFieldsById({ id: eventId }, ['project', 'offers', 'identifier']);
|
|
69
|
-
// 取引番号発行
|
|
70
|
-
// const { transactionNumber } = await transactionNumberRepo.publishByTimestamp({ startDate: now });
|
|
71
69
|
const { seller } = transaction;
|
|
72
70
|
// 承認作成
|
|
73
71
|
const issuedBy = {
|
|
@@ -75,8 +73,8 @@ function issueEventOfferTicket(params) {
|
|
|
75
73
|
typeOf: seller.typeOf,
|
|
76
74
|
...(typeof seller.name.ja === 'string') ? { name: seller.name.ja } : undefined
|
|
77
75
|
};
|
|
78
|
-
const validForMemberTierToken = ticketedOffer?.validForMemberTier?.token;
|
|
79
|
-
const validForMemberProgramIdentifier = ticketedOffer?.validForMemberTier?.isTierOf.identifier;
|
|
76
|
+
// const validForMemberTierToken = ticketedOffer?.validForMemberTier?.token;
|
|
77
|
+
// const validForMemberProgramIdentifier = ticketedOffer?.validForMemberTier?.isTierOf.identifier;
|
|
80
78
|
const authorizationObject = {
|
|
81
79
|
typeOf: factory_1.factory.offerType.Offer,
|
|
82
80
|
itemOffered: {
|
|
@@ -90,15 +88,15 @@ function issueEventOfferTicket(params) {
|
|
|
90
88
|
...(typeof ticketedOffer?.token === 'string' && ticketedOffer.token !== '')
|
|
91
89
|
? { token: ticketedOffer.token }
|
|
92
90
|
: undefined,
|
|
93
|
-
...(typeof validForMemberTierToken === 'string' && validForMemberTierToken !== ''
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
91
|
+
// ...(typeof validForMemberTierToken === 'string' && validForMemberTierToken !== ''
|
|
92
|
+
// && typeof validForMemberProgramIdentifier === 'string' && validForMemberProgramIdentifier !== '')
|
|
93
|
+
// ? {
|
|
94
|
+
// validForMemberTier: {
|
|
95
|
+
// token: validForMemberTierToken,
|
|
96
|
+
// isTierOf: { identifier: validForMemberProgramIdentifier }
|
|
97
|
+
// }
|
|
98
|
+
// }
|
|
99
|
+
// : undefined
|
|
102
100
|
};
|
|
103
101
|
// validations(eventId,eventOfferIdentifier,offerToken...)
|
|
104
102
|
await (0, validateStartRequest_1.validEventOfferByApplicationExists)({
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createAcceptedOffersWithoutDetails = createAcceptedOffersWithoutDetails;
|
|
4
4
|
exports.validateOffers = validateOffers;
|
|
5
5
|
const coa_service_1 = require("@motionpicture/coa-service");
|
|
6
|
-
const http_status_1 = require("http-status");
|
|
7
6
|
const errorHandler_1 = require("../../../../errorHandler");
|
|
8
7
|
const factory_1 = require("../../../../factory");
|
|
8
|
+
const errorHandler_2 = require("../../../../errorHandler");
|
|
9
9
|
function createAcceptedOffersWithoutDetails(params) {
|
|
10
10
|
return async (repos) => {
|
|
11
11
|
const { listSeat } = await repos.reserveService.stateReserveSeat(params.coaInfo);
|
|
@@ -98,13 +98,8 @@ function offer2availableSalesTicket(params) {
|
|
|
98
98
|
}
|
|
99
99
|
catch (error) {
|
|
100
100
|
// COAサービスエラーの場合ハンドリング
|
|
101
|
-
if (
|
|
102
|
-
|
|
103
|
-
// 500未満であればクライアントエラーとみなす
|
|
104
|
-
if (typeof error.code === 'number'
|
|
105
|
-
&& error.code < http_status_1.status.INTERNAL_SERVER_ERROR) {
|
|
106
|
-
throw new factory_1.factory.errors.NotFound(`offers.${offerIndex}`, `ticketCode ${offer.ticketInfo.ticketCode} not found. ${error.message}`);
|
|
107
|
-
}
|
|
101
|
+
if ((0, errorHandler_2.isCOAClientError)(error)) {
|
|
102
|
+
throw new factory_1.factory.errors.NotFound(`offers.${offerIndex}`, `ticketCode ${offer.ticketInfo.ticketCode} not found. ${error.message}`);
|
|
108
103
|
}
|
|
109
104
|
throw error;
|
|
110
105
|
}
|
|
@@ -130,13 +125,8 @@ function offer2availableSalesTicket(params) {
|
|
|
130
125
|
}
|
|
131
126
|
catch (error) {
|
|
132
127
|
// COAサービスエラーの場合ハンドリング
|
|
133
|
-
if (
|
|
134
|
-
|
|
135
|
-
// 500未満であればクライアントエラーとみなす
|
|
136
|
-
if (typeof error.code === 'number'
|
|
137
|
-
&& error.code < http_status_1.status.INTERNAL_SERVER_ERROR) {
|
|
138
|
-
throw new factory_1.factory.errors.NotFound(`offers.${offerIndex}`, `couponTicket ${offer.ticketInfo.ticketCode} not found. ${error.message}`);
|
|
139
|
-
}
|
|
128
|
+
if ((0, errorHandler_2.isCOAClientError)(error)) {
|
|
129
|
+
throw new factory_1.factory.errors.NotFound(`offers.${offerIndex}`, `couponTicket ${offer.ticketInfo.ticketCode} not found. ${error.message}`);
|
|
140
130
|
}
|
|
141
131
|
throw error;
|
|
142
132
|
}
|
|
@@ -20,7 +20,6 @@ export declare function createAuthorizeSeatReservationActionAttributes(params: {
|
|
|
20
20
|
*/
|
|
21
21
|
export declare function offers2resultPrice(offers: IAcceptedOffer4COA[]): {
|
|
22
22
|
price: number;
|
|
23
|
-
eligibleMonetaryAmount: never[];
|
|
24
23
|
};
|
|
25
24
|
type IResultAcceptedOffer = Omit<factory.order.IAcceptedOffer, 'itemOffered'> & {
|
|
26
25
|
itemOffered: factory.order.ICOAEventReservation;
|
|
@@ -59,18 +59,7 @@ function createAuthorizeSeatReservationActionAttributes(params) {
|
|
|
59
59
|
*/
|
|
60
60
|
function offers2resultPrice(offers) {
|
|
61
61
|
const price = offers.reduce((a, b) => a + b.price, 0);
|
|
62
|
-
|
|
63
|
-
// const eligibleMonetaryAmount = offers.reduce<factory.offer.IEligibleMonetaryAmount[]>(
|
|
64
|
-
// (a, b) => {
|
|
65
|
-
// if (Array.isArray(b.eligibleMonetaryAmount)) {
|
|
66
|
-
// return [...a, ...b.eligibleMonetaryAmount];
|
|
67
|
-
// } else {
|
|
68
|
-
// return a;
|
|
69
|
-
// }
|
|
70
|
-
// },
|
|
71
|
-
// []
|
|
72
|
-
// );
|
|
73
|
-
return { price, eligibleMonetaryAmount: [] };
|
|
62
|
+
return { price };
|
|
74
63
|
}
|
|
75
64
|
/**
|
|
76
65
|
* COA仮予約結果から注文アイテムを生成する
|
|
@@ -55,7 +55,6 @@ function createPriceComponent(params) {
|
|
|
55
55
|
});
|
|
56
56
|
let surfrockChargePriceSpec;
|
|
57
57
|
let appliesToMovieTicket4surfrock;
|
|
58
|
-
// let eligibleMonetaryAmount: [factory.offer.IEligibleMonetaryAmount] | undefined;
|
|
59
58
|
// appliesToSurfrockの指定があれば強制的にMovieTicket決済
|
|
60
59
|
const appliesToSurfrockByUnitPriceOffer = availableUnitPriceOffer.priceSpecification.appliesToMovieTicket?.at(0);
|
|
61
60
|
const surfrockIdentifier = acceptedOffer.priceSpecification?.appliesToSurfrock?.identifier;
|
|
@@ -89,11 +88,6 @@ function createPriceComponent(params) {
|
|
|
89
88
|
};
|
|
90
89
|
}
|
|
91
90
|
else {
|
|
92
|
-
// discontinue eligibleMonetaryAmount(2025-01-03~)
|
|
93
|
-
// appliesToSurfrockの指定がなければ単価オファーの適用通貨条件を強制適用
|
|
94
|
-
// if (Array.isArray(availableUnitPriceOffer.eligibleMonetaryAmount)) {
|
|
95
|
-
// eligibleMonetaryAmount = availableUnitPriceOffer.eligibleMonetaryAmount;
|
|
96
|
-
// }
|
|
97
91
|
if (typeof appliesToSurfrockByUnitPriceOffer?.serviceType === 'string') {
|
|
98
92
|
throw new factory_1.factory.errors.ArgumentNull('priceSpecification.appliesToSurfrock');
|
|
99
93
|
}
|
|
@@ -377,15 +371,6 @@ function validateAcceptedOffers(params) {
|
|
|
377
371
|
id: availableUnitPriceOffer.id,
|
|
378
372
|
identifier: availableUnitPriceOffer.identifier,
|
|
379
373
|
typeOf: availableUnitPriceOffer.typeOf,
|
|
380
|
-
// discontinue eligibleMonetaryAmount(2025-01-03~)
|
|
381
|
-
// ...(Array.isArray(eligibleMonetaryAmount)) ? { eligibleMonetaryAmount } : undefined,
|
|
382
|
-
// ↓互換性維持対応として
|
|
383
|
-
...{
|
|
384
|
-
// discontinue(2025-01-03~)
|
|
385
|
-
// seatNumber: itemOffered.serviceOutput?.reservedTicket?.ticketedSeat?.seatNumber,
|
|
386
|
-
// discontinue(2025-01-03~)
|
|
387
|
-
// seatSection: itemOffered.serviceOutput?.reservedTicket?.ticketedSeat?.seatSection
|
|
388
|
-
}
|
|
389
374
|
};
|
|
390
375
|
});
|
|
391
376
|
return { acceptedOffers };
|
|
@@ -97,7 +97,7 @@ function authorize(params) {
|
|
|
97
97
|
const action = await repos.action.start(actionAttributes);
|
|
98
98
|
try {
|
|
99
99
|
// 座席仮予約からオファー情報を生成する
|
|
100
|
-
const { price
|
|
100
|
+
const { price } = (0, factory_1.offers2resultPrice)(acceptedOffers);
|
|
101
101
|
const acceptedOffers4result = (0, factory_1.responseBody2acceptedOffers4result)({
|
|
102
102
|
project: { id: transaction.project.id },
|
|
103
103
|
responseBody: params.result.responseBody,
|
|
@@ -112,10 +112,7 @@ function authorize(params) {
|
|
|
112
112
|
typeOf: factory_2.factory.offerType.AggregateOffer, // add(2024-06-18~)
|
|
113
113
|
price: price,
|
|
114
114
|
priceCurrency: factory_2.factory.priceCurrency.JPY,
|
|
115
|
-
amount:
|
|
116
|
-
// requestBody: params.result.requestBody, // discontinue(2024-06-11~)
|
|
117
|
-
// responseBody: params.result.responseBody, // discontinue(2024-06-11~)
|
|
118
|
-
// acceptedOffers: [] // discontinue(2024-06-17~)
|
|
115
|
+
amount: []
|
|
119
116
|
};
|
|
120
117
|
// add orderInTransaction(2024-01-15~)
|
|
121
118
|
// if (params.options.useCreateOrderOnOfferAccepted) {
|
|
@@ -120,7 +120,7 @@ function changeOffers(params) {
|
|
|
120
120
|
if (updTmpReserveSeatResult === undefined) {
|
|
121
121
|
throw new factory_2.factory.errors.NotFound('afterMedia by recipe');
|
|
122
122
|
}
|
|
123
|
-
const { price
|
|
123
|
+
const { price } = (0, factory_1.offers2resultPrice)(acceptedOffers);
|
|
124
124
|
const acceptedOffers4result = (0, factory_1.responseBody2acceptedOffers4result)({
|
|
125
125
|
project: { id: authorizeAction.project.id },
|
|
126
126
|
responseBody: updTmpReserveSeatResult,
|
|
@@ -134,8 +134,7 @@ function changeOffers(params) {
|
|
|
134
134
|
const actionResult = {
|
|
135
135
|
...authorizeAction.result,
|
|
136
136
|
price: price,
|
|
137
|
-
amount:
|
|
138
|
-
// acceptedOffers: [] // discontinue(2024-06-17~)
|
|
137
|
+
amount: []
|
|
139
138
|
};
|
|
140
139
|
// ActiveActionStatus->CompletedActionStatusで再実装(2024-01-15~)
|
|
141
140
|
await repos.action.reStart({ id: authorizeAction.id, typeOf: authorizeAction.typeOf });
|