@chevre/domain 21.36.0-alpha.1 → 21.36.0-alpha.3
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.js +7 -7
- package/lib/chevre/repo/account.js +1 -1
- package/lib/chevre/repo/action.js +0 -13
- package/lib/chevre/repo/code.js +1 -1
- package/lib/chevre/repo/confirmationNumber.js +1 -1
- package/lib/chevre/repo/orderNumber.js +1 -1
- package/lib/chevre/repo/reservation.js +0 -18
- package/lib/chevre/repo/serviceOutputIdentifier.js +1 -1
- package/lib/chevre/repo/stockHolder.js +3 -3
- package/lib/chevre/repo/task.js +2 -2
- package/lib/chevre/repo/transaction.js +1 -1
- package/lib/chevre/repo/transactionNumber.js +1 -1
- package/lib/chevre/service/assetTransaction/pay.js +1 -1
- package/lib/chevre/service/assetTransaction/reserve.js +2 -2
- package/lib/chevre/service/code.js +1 -1
- package/lib/chevre/service/notification.js +1 -1
- package/lib/chevre/service/offer/event/authorize.js +1 -1
- package/lib/chevre/service/offer/event/factory.js +4 -4
- package/lib/chevre/service/offer/event/processStartReserve4chevre.d.ts +1 -1
- package/lib/chevre/service/offer/event/processStartReserve4chevre.js +0 -5
- package/lib/chevre/service/offer/product/factory.js +4 -4
- package/lib/chevre/service/order/deleteOrder.js +1 -1
- package/lib/chevre/service/order/placeOrder.js +1 -1
- package/lib/chevre/service/payment/any/factory.js +1 -1
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket.js +2 -2
- package/lib/chevre/service/permit.js +3 -3
- package/lib/chevre/service/reserve/searchByOrder.js +1 -1
- package/lib/chevre/service/transaction/moneyTransfer.js +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/confirm.js +2 -2
- package/lib/chevre/service/transaction/placeOrderInProgress/publishCode.js +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/publishConfirmationNumberIfNotExist.js +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/publishOrderNumberIfNotExist.js +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/result/orderedItem.js +1 -1
- package/lib/chevre/service/transaction/returnOrder/preStart.js +1 -3
- package/package.json +2 -2
|
@@ -72,10 +72,10 @@ function handleCOAError(error) {
|
|
|
72
72
|
// error.requestOptions.uriを処理
|
|
73
73
|
const uri = (_a = error.requestOptions) === null || _a === void 0 ? void 0 : _a.uri;
|
|
74
74
|
if (error.message === 'ETIMEDOUT' || error.message === 'ESOCKETTIMEDOUT') {
|
|
75
|
-
handledError = new factory_1.errors.GatewayTimeout(`
|
|
75
|
+
handledError = new factory_1.errors.GatewayTimeout(`Timeout. name:${error.name} code:${error.code} message:${error.message} uri:${uri}`);
|
|
76
76
|
}
|
|
77
77
|
else {
|
|
78
|
-
handledError = new factory_1.errors.
|
|
78
|
+
handledError = new factory_1.errors.Internal(`Service Unavailable. name:${error.name} code:${error.code} message:${error.message} uri:${uri}`);
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
return handledError;
|
|
@@ -103,10 +103,10 @@ function handleCOAReserveTemporarilyError(error) {
|
|
|
103
103
|
else {
|
|
104
104
|
const uri = (_a = error.requestOptions) === null || _a === void 0 ? void 0 : _a.uri;
|
|
105
105
|
if (error.message === 'ETIMEDOUT' || error.message === 'ESOCKETTIMEDOUT') {
|
|
106
|
-
handledError = new factory_1.errors.GatewayTimeout(`
|
|
106
|
+
handledError = new factory_1.errors.GatewayTimeout(`Timeout. name:${error.name} code:${error.code} message:${error.message} uri:${uri}`);
|
|
107
107
|
}
|
|
108
108
|
else {
|
|
109
|
-
handledError = new factory_1.errors.
|
|
109
|
+
handledError = new factory_1.errors.Internal(`Reserve service unavailable. name:${error.name} code:${error.code} message:${error.message} uri:${uri}`);
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
}
|
|
@@ -141,7 +141,7 @@ function handlePecorinoError(error) {
|
|
|
141
141
|
handledError = new factory_1.errors.RateLimitExceeded(message);
|
|
142
142
|
break;
|
|
143
143
|
default:
|
|
144
|
-
handledError = new factory_1.errors.
|
|
144
|
+
handledError = new factory_1.errors.Internal(message);
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
return handledError;
|
|
@@ -176,7 +176,7 @@ function handleMvtkReserveError(error) {
|
|
|
176
176
|
handledError = new factory_1.errors.RateLimitExceeded(message);
|
|
177
177
|
break;
|
|
178
178
|
default:
|
|
179
|
-
handledError = new factory_1.errors.
|
|
179
|
+
handledError = new factory_1.errors.Internal(message);
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
// タイムアウト設定によって中止されたリクエストの場合
|
|
@@ -196,7 +196,7 @@ function handleAWSError(error) {
|
|
|
196
196
|
const message = `${error.name}:${error.message}`;
|
|
197
197
|
switch (error.name) {
|
|
198
198
|
case 'InternalErrorException':
|
|
199
|
-
handledError = new factory_1.errors.
|
|
199
|
+
handledError = new factory_1.errors.Internal(message);
|
|
200
200
|
break;
|
|
201
201
|
case 'MissingRequiredParameter':
|
|
202
202
|
handledError = new factory_1.errors.ArgumentNull('AWSArgument', message);
|
|
@@ -162,7 +162,7 @@ class MongoRepository {
|
|
|
162
162
|
});
|
|
163
163
|
const result = yield this.accountModel.insertMany(accounts, { ordered: false, rawResult: true });
|
|
164
164
|
if (result.insertedCount !== accounts.length) {
|
|
165
|
-
throw new factory.errors.
|
|
165
|
+
throw new factory.errors.Internal('all accounts not saved');
|
|
166
166
|
}
|
|
167
167
|
// return result.ops;
|
|
168
168
|
return accounts;
|
|
@@ -1501,19 +1501,6 @@ class MongoRepository {
|
|
|
1501
1501
|
};
|
|
1502
1502
|
return this.actionRecipeModel.updateOne(filter, update, options)
|
|
1503
1503
|
.exec();
|
|
1504
|
-
// return this.actionRecipeModel.insertMany<factory.recipe.IRecipe & { dateCreated: Date }>(
|
|
1505
|
-
// {
|
|
1506
|
-
// ...savingRecipe,
|
|
1507
|
-
// dateCreated: new Date()
|
|
1508
|
-
// },
|
|
1509
|
-
// { rawResult: true }
|
|
1510
|
-
// );
|
|
1511
|
-
// const result = await this.actionRecipeModel.insertMany<IRecipe>(savingRecipe, { rawResult: true });
|
|
1512
|
-
// const id = result.insertedIds?.[0]?.toHexString();
|
|
1513
|
-
// if (typeof id !== 'string') {
|
|
1514
|
-
// throw new factory.errors.ServiceUnavailable('recipe not saved');
|
|
1515
|
-
// }
|
|
1516
|
-
// return { id };
|
|
1517
1504
|
});
|
|
1518
1505
|
}
|
|
1519
1506
|
}
|
package/lib/chevre/repo/code.js
CHANGED
|
@@ -207,7 +207,7 @@ class AuthorizationRepo {
|
|
|
207
207
|
});
|
|
208
208
|
const result = yield this.authorizationModel.insertMany(docs, { ordered: false, rawResult: true });
|
|
209
209
|
if (result.insertedCount !== docs.length) {
|
|
210
|
-
throw new factory.errors.
|
|
210
|
+
throw new factory.errors.Internal('all codes not saved');
|
|
211
211
|
}
|
|
212
212
|
// return result.ops;
|
|
213
213
|
return docs;
|
|
@@ -55,7 +55,7 @@ class ConfirmationNumberRepo {
|
|
|
55
55
|
/* istanbul ignore if */
|
|
56
56
|
if (typeof incrReply !== 'number') {
|
|
57
57
|
// 基本的にありえないフロー
|
|
58
|
-
throw new factory.errors.
|
|
58
|
+
throw new factory.errors.Internal('confirmation number not incremented unexpectedly');
|
|
59
59
|
}
|
|
60
60
|
// 桁数調整
|
|
61
61
|
let confirmationNumber = ConfirmationNumberRepo.alignDigits(incrReply);
|
|
@@ -50,7 +50,7 @@ class RedisRepository {
|
|
|
50
50
|
/* istanbul ignore if */
|
|
51
51
|
if (typeof incrReply !== 'number') {
|
|
52
52
|
// 基本的にありえないフロー
|
|
53
|
-
throw new factory.errors.
|
|
53
|
+
throw new factory.errors.Internal('order number not incremented unexpectedly');
|
|
54
54
|
}
|
|
55
55
|
let orderNumber = `${timestamp}${incrReply}`;
|
|
56
56
|
// checkdigit
|
|
@@ -792,24 +792,6 @@ class MongoRepository {
|
|
|
792
792
|
}
|
|
793
793
|
return andConditions;
|
|
794
794
|
}
|
|
795
|
-
// public async createMany(params: {
|
|
796
|
-
// reservations: factory.assetTransaction.reserve.IObjectSubReservation[];
|
|
797
|
-
// reservationFor: factory.assetTransaction.reserve.IReservationFor;
|
|
798
|
-
// }): Promise<void> {
|
|
799
|
-
// if (params.reservations.length > 0) {
|
|
800
|
-
// const result = await this.reservationModel.insertMany(
|
|
801
|
-
// params.reservations.map((r) => {
|
|
802
|
-
// return { ...r, _id: r.id, reservationFor: params.reservationFor };
|
|
803
|
-
// }),
|
|
804
|
-
// { ordered: false, rawResult: true }
|
|
805
|
-
// );
|
|
806
|
-
// if (result.insertedCount !== params.reservations.length) {
|
|
807
|
-
// throw new factory.errors.ServiceUnavailable('all reservations not saved');
|
|
808
|
-
// }
|
|
809
|
-
// } else {
|
|
810
|
-
// // no op
|
|
811
|
-
// }
|
|
812
|
-
// }
|
|
813
795
|
/**
|
|
814
796
|
* 汎用予約カウント
|
|
815
797
|
*/
|
|
@@ -47,7 +47,7 @@ class RedisRepository {
|
|
|
47
47
|
/* istanbul ignore else: please write tests */
|
|
48
48
|
if (typeof incrReply !== 'number') {
|
|
49
49
|
// 基本的にありえないフロー
|
|
50
|
-
throw new factory.errors.
|
|
50
|
+
throw new factory.errors.Internal('serviceOutput identifier not incremented unexpectedly');
|
|
51
51
|
}
|
|
52
52
|
let identifier = `${timestamp}${incrReply}`;
|
|
53
53
|
// checkdigit
|
|
@@ -33,7 +33,7 @@ class StockHolderRepository {
|
|
|
33
33
|
return serviceOutputId;
|
|
34
34
|
}
|
|
35
35
|
else {
|
|
36
|
-
throw new factory.errors.
|
|
36
|
+
throw new factory.errors.Internal('offer2field requires itemOffered.serviceOutput.id');
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -141,7 +141,7 @@ class StockHolderRepository {
|
|
|
141
141
|
throw new factory.errors.AlreadyInUse(factory.reservationType.EventReservation, ['ticketedSeat'], 'Already hold');
|
|
142
142
|
}
|
|
143
143
|
else {
|
|
144
|
-
throw new factory.errors.
|
|
144
|
+
throw new factory.errors.Internal('timeout cannot be set unexpectedly');
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
}
|
|
@@ -229,7 +229,7 @@ class StockHolderRepository {
|
|
|
229
229
|
// Array reply: list of values associated with the given fields, in the same order as they are requested.
|
|
230
230
|
const result = yield this.redisClient.hmGet(key, fields);
|
|
231
231
|
if (!Array.isArray(result)) {
|
|
232
|
-
throw new factory.errors.
|
|
232
|
+
throw new factory.errors.Internal(`searchAvailability got non-array: ${typeof result}`);
|
|
233
233
|
}
|
|
234
234
|
// そのまま返却(2023-04-17~)
|
|
235
235
|
return result;
|
package/lib/chevre/repo/task.js
CHANGED
|
@@ -146,7 +146,7 @@ class MongoRepository {
|
|
|
146
146
|
const result = yield this.taskModel.insertMany(savingTask, { rawResult: true });
|
|
147
147
|
const id = (_b = (_a = result.insertedIds) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.toHexString();
|
|
148
148
|
if (typeof id !== 'string') {
|
|
149
|
-
throw new factory.errors.
|
|
149
|
+
throw new factory.errors.Internal('task not saved');
|
|
150
150
|
}
|
|
151
151
|
const { emitImmediately } = options;
|
|
152
152
|
if (emitImmediately) {
|
|
@@ -164,7 +164,7 @@ class MongoRepository {
|
|
|
164
164
|
if (taskAttributes.length > 0) {
|
|
165
165
|
const result = yield this.taskModel.insertMany(taskAttributes, { ordered: false, rawResult: true });
|
|
166
166
|
if (result.insertedCount !== taskAttributes.length) {
|
|
167
|
-
throw new factory.errors.
|
|
167
|
+
throw new factory.errors.Internal('all tasks not saved');
|
|
168
168
|
}
|
|
169
169
|
const savedTasks = Object.values(result.insertedIds)
|
|
170
170
|
.map((objectId) => {
|
|
@@ -268,7 +268,7 @@ class MongoRepository {
|
|
|
268
268
|
const result = yield this.transactionModel.insertMany(creatingTransaction, { rawResult: true });
|
|
269
269
|
const id = (_b = (_a = result.insertedIds) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.toHexString();
|
|
270
270
|
if (typeof id !== 'string') {
|
|
271
|
-
throw new factory.errors.
|
|
271
|
+
throw new factory.errors.Internal('transaction not saved');
|
|
272
272
|
}
|
|
273
273
|
// 取引開始時にも取引イベントエミッター連携(2024-03-21~)
|
|
274
274
|
transaction_1.transactionEventEmitter.emitTransactionStatusChanged({ id, typeOf, status });
|
|
@@ -47,7 +47,7 @@ class RedisRepository {
|
|
|
47
47
|
/* istanbul ignore else: please write tests */
|
|
48
48
|
if (typeof incrReply !== 'number') {
|
|
49
49
|
// 基本的にありえないフロー
|
|
50
|
-
throw new factory.errors.
|
|
50
|
+
throw new factory.errors.Internal('transaction number not incremented unexpectedly');
|
|
51
51
|
}
|
|
52
52
|
let transactionNumber = `${timestamp}${incrReply}`;
|
|
53
53
|
// checkdigit
|
|
@@ -101,7 +101,7 @@ function publishPaymentUrl(params, options) {
|
|
|
101
101
|
paymentUrl = authorizeResult.execTranResult.acsUrl;
|
|
102
102
|
}
|
|
103
103
|
if (typeof paymentUrl !== 'string' || paymentUrl.length === 0) {
|
|
104
|
-
throw new factory.errors.
|
|
104
|
+
throw new factory.errors.Internal(`Payment URL unable to publish. [retUrl: ${retUrl}]`);
|
|
105
105
|
}
|
|
106
106
|
result = {
|
|
107
107
|
paymentMethodId: transactionNumber,
|
|
@@ -307,7 +307,7 @@ function createAcceptedOffers4transactionObject(params) {
|
|
|
307
307
|
// 予約番号
|
|
308
308
|
const reservationNumber = params.transaction.object.reservationNumber;
|
|
309
309
|
if (typeof reservationNumber !== 'string') {
|
|
310
|
-
throw new factory.errors.
|
|
310
|
+
throw new factory.errors.Internal('Reservation number undefined');
|
|
311
311
|
}
|
|
312
312
|
const objectSubReservations = yield createReservations4transactionObject(params)(repos);
|
|
313
313
|
const acceptedOffers4transactionObject = [];
|
|
@@ -343,7 +343,7 @@ function createReservations4transactionObject(params) {
|
|
|
343
343
|
// 予約番号
|
|
344
344
|
const reservationNumber = params.transaction.object.reservationNumber;
|
|
345
345
|
if (typeof reservationNumber !== 'string') {
|
|
346
|
-
throw new factory.errors.
|
|
346
|
+
throw new factory.errors.Internal('Reservation number undefined');
|
|
347
347
|
}
|
|
348
348
|
// 指定席のみかどうか
|
|
349
349
|
const eventOffers = params.event.offers;
|
|
@@ -73,7 +73,7 @@ function getToken(params) {
|
|
|
73
73
|
}
|
|
74
74
|
else {
|
|
75
75
|
if (typeof encoded !== 'string') {
|
|
76
|
-
reject(new factory.errors.
|
|
76
|
+
reject(new factory.errors.Internal('authorization.object cannot be signed unexpectedly'));
|
|
77
77
|
}
|
|
78
78
|
else {
|
|
79
79
|
resolve(encoded);
|
|
@@ -44,7 +44,7 @@ function sendEmailMessage(params) {
|
|
|
44
44
|
apiKey = project.settings.sendgridApiKey;
|
|
45
45
|
}
|
|
46
46
|
if (typeof apiKey !== 'string') {
|
|
47
|
-
throw new factory.errors.
|
|
47
|
+
throw new factory.errors.Internal('API Key not found');
|
|
48
48
|
}
|
|
49
49
|
sgMail.setApiKey(apiKey);
|
|
50
50
|
let emailMessage;
|
|
@@ -209,7 +209,7 @@ function validateAcceptedOffers(params) {
|
|
|
209
209
|
const unitPriceSpec = acceptedOffersByOfferId[0].priceSpecification.priceComponent.find((spec) => spec.typeOf === factory.priceSpecificationType.UnitPriceSpecification && (!Array.isArray(spec.appliesToAddOn)));
|
|
210
210
|
// 単価仕様は必ず存在するはず
|
|
211
211
|
if ((unitPriceSpec === null || unitPriceSpec === void 0 ? void 0 : unitPriceSpec.typeOf) !== factory.priceSpecificationType.UnitPriceSpecification) {
|
|
212
|
-
throw new factory.errors.
|
|
212
|
+
throw new factory.errors.Internal(`unitPriceSpec of the offer '${offerId}' not found`);
|
|
213
213
|
}
|
|
214
214
|
const unitPriceSpecReferenceQuantityValue = (_a = unitPriceSpec.referenceQuantity) === null || _a === void 0 ? void 0 : _a.value;
|
|
215
215
|
if (typeof unitPriceSpecReferenceQuantityValue === 'number') {
|
|
@@ -127,10 +127,10 @@ function acceptedOffers2amount(params) {
|
|
|
127
127
|
// 金額計算
|
|
128
128
|
let amount = acceptedOffers.reduce((a, b) => {
|
|
129
129
|
if (b.priceSpecification === undefined || b.priceSpecification === null) {
|
|
130
|
-
throw new factory.errors.
|
|
130
|
+
throw new factory.errors.Internal('price specification of result accepted offer undefined');
|
|
131
131
|
}
|
|
132
132
|
if (b.priceSpecification.typeOf !== factory.priceSpecificationType.CompoundPriceSpecification) {
|
|
133
|
-
throw new factory.errors.
|
|
133
|
+
throw new factory.errors.Internal('price specification of result accepted offer must be CompoundPriceSpecification');
|
|
134
134
|
}
|
|
135
135
|
const priceSpecification = b.priceSpecification;
|
|
136
136
|
return a + priceSpecification.priceComponent.reduce((a2, b2) => a2 + Number(b2.price), 0);
|
|
@@ -169,7 +169,7 @@ function acceptedOffers2authorizeResult(params) {
|
|
|
169
169
|
offers = offerIds.map((offerId) => {
|
|
170
170
|
const acceptedOffer = acceptedOffers.find(({ id }) => id === offerId);
|
|
171
171
|
if (acceptedOffer === undefined) {
|
|
172
|
-
throw new factory.errors.
|
|
172
|
+
throw new factory.errors.Internal(`acceptedOffer not found [id:${offerId}]`);
|
|
173
173
|
}
|
|
174
174
|
const amountOfThisGood = acceptedOffers.filter(({ id }) => id === offerId).length;
|
|
175
175
|
const { acceptedPaymentMethod, priceSpecification } = acceptedOffer;
|
|
@@ -177,7 +177,7 @@ function acceptedOffers2authorizeResult(params) {
|
|
|
177
177
|
&& (!Array.isArray(spec.appliesToAddOn)) // アドオン単価ではない
|
|
178
178
|
);
|
|
179
179
|
if (unitPriceSpec === undefined) {
|
|
180
|
-
throw new factory.errors.
|
|
180
|
+
throw new factory.errors.Internal(`unitPriceSpec not found [id:${offerId}]`);
|
|
181
181
|
}
|
|
182
182
|
const { eligibleQuantity, eligibleTransactionVolume } = unitPriceSpec;
|
|
183
183
|
return Object.assign({ id: offerId, includesObject: { amountOfThisGood }, typeOf: factory.offerType.Offer, priceSpecification: Object.assign(Object.assign({}, (eligibleQuantity !== undefined) ? { eligibleQuantity } : undefined), (eligibleTransactionVolume !== undefined) ? { eligibleTransactionVolume } : undefined) }, (acceptedPaymentMethod !== undefined) ? { acceptedPaymentMethod } : undefined);
|
|
@@ -21,7 +21,7 @@ declare function processStartReserve4chevre(params: {
|
|
|
21
21
|
acceptedOffer: factory.action.authorize.offer.eventService.IAcceptedOffer4chevre[];
|
|
22
22
|
event: IMinimizedIndividualEvent<factory.eventType.ScreeningEvent>;
|
|
23
23
|
broker?: factory.reservation.IBroker<factory.reservationType>;
|
|
24
|
-
transactionNumber
|
|
24
|
+
transactionNumber: string;
|
|
25
25
|
transaction: Pick<factory.transaction.ITransaction<factory.transactionType.PlaceOrder>, 'agent' | 'expires' | 'id' | 'project' | 'seller' | 'typeOf'>;
|
|
26
26
|
availableAtOrFrom: {
|
|
27
27
|
id: string;
|
|
@@ -16,16 +16,11 @@ const CodeService = require("../../code");
|
|
|
16
16
|
const factory_1 = require("./factory");
|
|
17
17
|
function processStartReserve4chevre(params) {
|
|
18
18
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
19
|
-
// const action = params.action;
|
|
20
19
|
const event = params.event;
|
|
21
20
|
const transactionNumber = params.transactionNumber;
|
|
22
21
|
const transaction = params.transaction;
|
|
23
22
|
let responseBody;
|
|
24
23
|
let acceptedOffers4result = [];
|
|
25
|
-
if (typeof transactionNumber !== 'string') {
|
|
26
|
-
// 論理的にありえないフロー
|
|
27
|
-
throw new factory.errors.ServiceUnavailable('Unexpected error occurred: reserve transactionNumber not found');
|
|
28
|
-
}
|
|
29
24
|
// 予約取引開始
|
|
30
25
|
const startParams = (0, factory_1.createReserveTransactionStartParams)(Object.assign({ project: transaction.project,
|
|
31
26
|
// object: <IObjectWithDetail>action.object,
|
|
@@ -69,10 +69,10 @@ function acceptedOffers2amount(params) {
|
|
|
69
69
|
// 金額計算
|
|
70
70
|
return acceptedOffers.reduce((a, b) => {
|
|
71
71
|
if (b.priceSpecification === undefined || b.priceSpecification === null) {
|
|
72
|
-
throw new factory.errors.
|
|
72
|
+
throw new factory.errors.Internal('price specification of result accepted offer undefined');
|
|
73
73
|
}
|
|
74
74
|
if (b.priceSpecification.typeOf !== factory.priceSpecificationType.CompoundPriceSpecification) {
|
|
75
|
-
throw new factory.errors.
|
|
75
|
+
throw new factory.errors.Internal('price specification of result accepted offer must be CompoundPriceSpecification');
|
|
76
76
|
}
|
|
77
77
|
const priceSpecification = b.priceSpecification;
|
|
78
78
|
return a + priceSpecification.priceComponent.reduce((a2, b2) => a2 + Number(b2.price), 0);
|
|
@@ -88,7 +88,7 @@ function responseBody2resultAcceptedOffer(params) {
|
|
|
88
88
|
const serviceOutputIdentifier = (_b = (_a = responseBodyObject.itemOffered) === null || _a === void 0 ? void 0 : _a.serviceOutput) === null || _b === void 0 ? void 0 : _b.identifier;
|
|
89
89
|
if (serviceOutputIdentifier !== undefined && typeof serviceOutputIdentifier !== 'string') {
|
|
90
90
|
// 基本的にありえないフロー↓
|
|
91
|
-
throw new factory.errors.
|
|
91
|
+
throw new factory.errors.Internal(`invalid type of serviceOutput.identifier: ${typeof serviceOutputIdentifier}`);
|
|
92
92
|
}
|
|
93
93
|
// itemOfferedを最小限に最適化
|
|
94
94
|
const permitByResponse = responseBodyObject.itemOffered.serviceOutput;
|
|
@@ -98,7 +98,7 @@ function responseBody2resultAcceptedOffer(params) {
|
|
|
98
98
|
typeOf: permitByResponse.typeOf, identifier: permitByResponse.identifier, issuedThrough: permitByResponse.issuedThrough, name: permitByResponse.name }, (typeof permitByResponse.validFor === 'string') ? { validFor: permitByResponse.validFor } : undefined), (typeof ((_c = permitByResponse.amount) === null || _c === void 0 ? void 0 : _c.typeOf) === 'string') ? { amount: permitByResponse.amount } : undefined);
|
|
99
99
|
const offer = params.acceptedOffer.find((o) => o.id === responseBodyObject.id);
|
|
100
100
|
if (offer === undefined) {
|
|
101
|
-
throw new factory.errors.
|
|
101
|
+
throw new factory.errors.Internal(`Offer ${responseBodyObject.id} from registerService not found`);
|
|
102
102
|
}
|
|
103
103
|
if (typeof ((_d = offer.priceSpecification) === null || _d === void 0 ? void 0 : _d.typeOf) !== 'string') {
|
|
104
104
|
throw new factory.errors.NotFound('acceptedOffer.priceSpecification');
|
|
@@ -28,7 +28,7 @@ function deleteOrder(params) {
|
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
30
|
if (typeof order.id !== 'string') {
|
|
31
|
-
throw new factory.errors.
|
|
31
|
+
throw new factory.errors.Internal(`order.id undefined. orderNumber: ${params.object.orderNumber}`);
|
|
32
32
|
}
|
|
33
33
|
// 注文アイテムの予約を削除
|
|
34
34
|
yield deleteReservationsByOrder(order)(repos);
|
|
@@ -33,7 +33,7 @@ function placeOrder(params) {
|
|
|
33
33
|
})(repos);
|
|
34
34
|
// USE_ORDER_PAYMENT_DUE_ON_PLACED設定を廃止したので、必ずOrderPaymentDueのはず(2024-01-10~)
|
|
35
35
|
if (order.orderStatus !== factory.orderStatus.OrderPaymentDue) {
|
|
36
|
-
throw new factory.errors.
|
|
36
|
+
throw new factory.errors.Internal(`orderStatus must be ${factory.orderStatus.OrderPaymentDue}`);
|
|
37
37
|
}
|
|
38
38
|
const simpleOrder = {
|
|
39
39
|
typeOf: order.typeOf,
|
|
@@ -103,7 +103,7 @@ function createAuthorizeResult(params) {
|
|
|
103
103
|
const payTransactionObject = params.payTransaction.object;
|
|
104
104
|
const totalPaymentDue = (_a = payTransactionObject.paymentMethod) === null || _a === void 0 ? void 0 : _a.totalPaymentDue;
|
|
105
105
|
if (typeof (totalPaymentDue === null || totalPaymentDue === void 0 ? void 0 : totalPaymentDue.typeOf) !== 'string') {
|
|
106
|
-
throw new factory.errors.
|
|
106
|
+
throw new factory.errors.Internal('payTransaction.object.paymentMethod.totalPaymentDue undefined');
|
|
107
107
|
}
|
|
108
108
|
const issuedThrough = {
|
|
109
109
|
typeOf: payTransactionObject.typeOf,
|
|
@@ -65,13 +65,13 @@ function refundMovieTicket(params) {
|
|
|
65
65
|
try {
|
|
66
66
|
if (useSeatInfoSyncCancel) {
|
|
67
67
|
if (seatInfoSyncCancelIn === undefined) {
|
|
68
|
-
throw new factory.errors.
|
|
68
|
+
throw new factory.errors.Internal('seatInfoSyncCancelIn must be set');
|
|
69
69
|
}
|
|
70
70
|
processSeatInfoSyncCancelResult = yield processSeatInfoSyncCancel({ seatInfoSyncCancelIn })({ seatService });
|
|
71
71
|
}
|
|
72
72
|
else {
|
|
73
73
|
if (seatInfoSyncIn === undefined) {
|
|
74
|
-
throw new factory.errors.
|
|
74
|
+
throw new factory.errors.Internal('seatInfoSyncIn must be set');
|
|
75
75
|
}
|
|
76
76
|
processSeatInfoSyncResult = yield processSeatInfoSync({
|
|
77
77
|
seatInfoSyncIn, paymentMethodId, purpose: params.purpose
|
|
@@ -31,13 +31,13 @@ function issue(params) {
|
|
|
31
31
|
const accountType = (_c = serviceOutput === null || serviceOutput === void 0 ? void 0 : serviceOutput.amount) === null || _c === void 0 ? void 0 : _c.currency;
|
|
32
32
|
const initialBalance = (_d = serviceOutput === null || serviceOutput === void 0 ? void 0 : serviceOutput.amount) === null || _d === void 0 ? void 0 : _d.value;
|
|
33
33
|
if (typeof accountTypeOf !== 'string' || accountTypeOf.length === 0) {
|
|
34
|
-
throw new factory.errors.
|
|
34
|
+
throw new factory.errors.Internal('serviceOutput.paymentAccount.typeOf undefined');
|
|
35
35
|
}
|
|
36
36
|
if (typeof accountNumber !== 'string' || accountNumber.length === 0) {
|
|
37
|
-
throw new factory.errors.
|
|
37
|
+
throw new factory.errors.Internal('serviceOutput.paymentAccount.accountNumber undefined');
|
|
38
38
|
}
|
|
39
39
|
if (typeof accountType !== 'string' || accountType.length === 0) {
|
|
40
|
-
throw new factory.errors.
|
|
40
|
+
throw new factory.errors.Internal('Account currency undefined');
|
|
41
41
|
}
|
|
42
42
|
return Object.assign({ project: { id: params.project.id }, accountType: accountType, accountNumber, name: (typeof serviceOutputName === 'string') ? serviceOutputName : accountNumber, typeOf: accountTypeOf }, (typeof initialBalance === 'number') ? { initialBalance } : undefined);
|
|
43
43
|
});
|
|
@@ -36,7 +36,7 @@ function searchByOrder(params) {
|
|
|
36
36
|
}
|
|
37
37
|
else {
|
|
38
38
|
// 検索条件にreservationTypeを含めているので、ありえないケース
|
|
39
|
-
throw new factory.errors.
|
|
39
|
+
throw new factory.errors.Internal(`unexpected itemOffered.typeOf ${offer.itemOffered.typeOf}`);
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
42
|
const offeredThroughIdentifier = (yield repos.acceptedOffer.distinctValues({
|
|
@@ -177,7 +177,7 @@ function processAuthorizePaymentCard(params) {
|
|
|
177
177
|
const transactionNumber = (_a = transaction.object.pendingTransaction) === null || _a === void 0 ? void 0 : _a.transactionNumber;
|
|
178
178
|
// ↓事前に取引番号を発行しているので、ありえないフロー
|
|
179
179
|
if (typeof transactionNumber !== 'string') {
|
|
180
|
-
throw new factory.errors.
|
|
180
|
+
throw new factory.errors.Internal('transaction.object.pendingTransaction.transactionNumber undefined');
|
|
181
181
|
}
|
|
182
182
|
// 承認アクションを開始する
|
|
183
183
|
const actionAttributes = createAuthorizeMoneyTransferOfferActionAttributes({
|
|
@@ -32,7 +32,7 @@ function processTransactionNotInProgress(transaction) {
|
|
|
32
32
|
orderNumber: { $eq: String(transaction.object.orderNumber) }
|
|
33
33
|
});
|
|
34
34
|
if (resultCustomer === undefined) {
|
|
35
|
-
throw new factory.errors.
|
|
35
|
+
throw new factory.errors.Internal('resultCustomer undefined'); // impossible process
|
|
36
36
|
}
|
|
37
37
|
// すでに確定済の場合
|
|
38
38
|
return Object.assign(Object.assign({}, transaction.result), { customer: resultCustomer });
|
|
@@ -373,7 +373,7 @@ function createConfirmationNumber(params) {
|
|
|
373
373
|
// 取引に確認番号が保管されていなければ、確認番号を発行
|
|
374
374
|
if (typeof confirmationNumber !== 'string') {
|
|
375
375
|
// 事前に発行済なはずなので、ありえないフロー
|
|
376
|
-
throw new factory.errors.
|
|
376
|
+
throw new factory.errors.Internal('object.confirmationNumber undefined');
|
|
377
377
|
}
|
|
378
378
|
// URLの指定があれば上書き
|
|
379
379
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
@@ -36,7 +36,7 @@ function publishCode(params) {
|
|
|
36
36
|
const code = (_a = authorizations.shift()) === null || _a === void 0 ? void 0 : _a.code;
|
|
37
37
|
if (typeof code !== 'string') {
|
|
38
38
|
// 基本的にありえないフロー
|
|
39
|
-
throw new factory.errors.
|
|
39
|
+
throw new factory.errors.Internal('code not published by an unexpected reason');
|
|
40
40
|
}
|
|
41
41
|
return code;
|
|
42
42
|
});
|
package/lib/chevre/service/transaction/placeOrderInProgress/publishConfirmationNumberIfNotExist.js
CHANGED
|
@@ -39,7 +39,7 @@ function publishConfirmationNumberIfNotExist(params) {
|
|
|
39
39
|
});
|
|
40
40
|
// 万が一処理が想定通りでない場合confirmationNumberが存在しない
|
|
41
41
|
if (typeof confirmationNumber !== 'string') {
|
|
42
|
-
throw new factory.errors.
|
|
42
|
+
throw new factory.errors.Internal('transaction.object.confirmationNumber not found');
|
|
43
43
|
}
|
|
44
44
|
return confirmationNumber;
|
|
45
45
|
});
|
|
@@ -38,7 +38,7 @@ function publishOrderNumberIfNotExist(params) {
|
|
|
38
38
|
orderNumber = yield repos.transaction.findInProgressOrderNumberById({ id: params.id });
|
|
39
39
|
// 万が一処理が想定通りでない場合orderNumberが存在しない
|
|
40
40
|
if (typeof orderNumber !== 'string') {
|
|
41
|
-
throw new factory.errors.
|
|
41
|
+
throw new factory.errors.Internal('transaction.object.orderNumber not found');
|
|
42
42
|
}
|
|
43
43
|
return orderNumber;
|
|
44
44
|
});
|
|
@@ -74,7 +74,7 @@ function reservationOffers2orderedItem(params) {
|
|
|
74
74
|
} });
|
|
75
75
|
}
|
|
76
76
|
else {
|
|
77
|
-
throw new factory.errors.
|
|
77
|
+
throw new factory.errors.Internal('unexpected params on reservationOffers2orderedItem');
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
function createProductItems(params) {
|
|
@@ -323,9 +323,7 @@ function getReturnPolicyByProject(params) {
|
|
|
323
323
|
throw new factory.errors.Argument('', `custom return policy returned statusCode: ${res.status}`);
|
|
324
324
|
// break;
|
|
325
325
|
default:
|
|
326
|
-
|
|
327
|
-
console.error('custom return policy temporarily unavailable.', res.status, body);
|
|
328
|
-
throw new factory.errors.ServiceUnavailable(`custom return policy temporarily unavailable. statusCode: ${res.status} body: ${body}`);
|
|
326
|
+
throw new factory.errors.Internal(`ProjectReturnPolicy unavailable. statusCode: ${res.status} body: ${body}`);
|
|
329
327
|
}
|
|
330
328
|
return returnPolicy;
|
|
331
329
|
}
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/credential-providers": "3.433.0",
|
|
13
|
-
"@chevre/factory": "4.376.0-alpha.
|
|
13
|
+
"@chevre/factory": "4.376.0-alpha.1",
|
|
14
14
|
"@cinerino/sdk": "8.0.0-alpha.2",
|
|
15
15
|
"@motionpicture/coa-service": "9.4.0",
|
|
16
16
|
"@motionpicture/gmo-service": "5.3.0",
|
|
@@ -110,5 +110,5 @@
|
|
|
110
110
|
"postversion": "git push origin --tags",
|
|
111
111
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
112
112
|
},
|
|
113
|
-
"version": "21.36.0-alpha.
|
|
113
|
+
"version": "21.36.0-alpha.3"
|
|
114
114
|
}
|