@chevre/domain 22.7.0-alpha.9 → 22.7.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/aggregateOfferCatalogItemList.ts +36 -0
- package/example/src/chevre/aggregation/aggregateOffersOnEvent.ts +1 -1
- package/example/src/chevre/aggregation/searchAggregateReservations.ts +1 -1
- package/example/src/chevre/deleteDiscontinuedPeople.ts +153 -0
- package/example/src/chevre/deleteDiscontinuedPeopleByFetch.ts +38 -0
- package/example/src/chevre/findJWTSetting.ts +19 -0
- package/example/src/chevre/person/checkUserPoolClients.ts +119 -0
- package/example/src/chevre/person/cleanUpCognitoUsers.ts +73 -23
- package/example/src/chevre/person/cleanUpCognitoUsersByFetch.ts +162 -0
- package/example/src/chevre/person/cleanUpCreditCard.ts +113 -0
- package/example/src/chevre/unsetUnnecessaryFields.ts +3 -29
- package/example/src/chevre/upsertManyEventsByAdditionalProperty.ts +152 -150
- package/lib/chevre/credentials.d.ts +0 -5
- package/lib/chevre/credentials.js +0 -13
- package/lib/chevre/repo/action.d.ts +4 -20
- package/lib/chevre/repo/action.js +61 -160
- package/lib/chevre/repo/additionalProperty.js +1 -1
- package/lib/chevre/repo/aggregateOffer.js +1 -1
- package/lib/chevre/repo/aggregateReservation.d.ts +2 -2
- package/lib/chevre/repo/aggregateReservation.js +1 -1
- package/lib/chevre/repo/categoryCode.d.ts +6 -2
- package/lib/chevre/repo/categoryCode.js +15 -8
- package/lib/chevre/repo/comment.js +1 -1
- package/lib/chevre/repo/creativeWork.js +1 -1
- package/lib/chevre/repo/customer.js +1 -1
- package/lib/chevre/repo/emailMessage.js +1 -1
- package/lib/chevre/repo/event.d.ts +10 -7
- package/lib/chevre/repo/event.js +40 -80
- package/lib/chevre/repo/mongoose/schemas/account.js +4 -12
- package/lib/chevre/repo/mongoose/schemas/accountTransaction.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/accountTransaction.js +18 -23
- package/lib/chevre/repo/mongoose/schemas/aggregateReservation.d.ts +0 -1
- package/lib/chevre/repo/mongoose/schemas/aggregateReservation.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/event.js +0 -1
- package/lib/chevre/repo/mongoose/schemas/setting.d.ts +26 -0
- package/lib/chevre/repo/mongoose/schemas/setting.js +1 -0
- package/lib/chevre/repo/offerCatalog.d.ts +9 -0
- package/lib/chevre/repo/offerCatalog.js +37 -3
- package/lib/chevre/repo/offerCatalogItem.d.ts +9 -0
- package/lib/chevre/repo/offerCatalogItem.js +37 -1
- package/lib/chevre/repo/offerItemCondition.js +1 -1
- package/lib/chevre/repo/ownershipInfo.js +1 -1
- package/lib/chevre/repo/person.d.ts +5 -3
- package/lib/chevre/repo/person.js +0 -1
- package/lib/chevre/repo/priceSpecification.js +1 -1
- package/lib/chevre/repo/seller.js +1 -1
- package/lib/chevre/repo/setting/jwt.d.ts +10 -0
- package/lib/chevre/repo/setting/jwt.js +65 -0
- package/lib/chevre/repo/task.js +1 -1
- package/lib/chevre/repository.d.ts +7 -0
- package/lib/chevre/repository.js +17 -1
- package/lib/chevre/service/aggregation/event.d.ts +1 -2
- package/lib/chevre/service/aggregation/event.js +1 -3
- package/lib/chevre/service/assetTransaction/pay.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/pay.js +12 -17
- package/lib/chevre/service/assetTransaction/reserve/start/factory/price.js +8 -19
- package/lib/chevre/service/code.d.ts +3 -34
- package/lib/chevre/service/code.js +18 -136
- package/lib/chevre/service/offer/event/authorize/factory.js +19 -14
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre/requestedProgramMembershipUsed2permit.d.ts +0 -5
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre/requestedProgramMembershipUsed2permit.js +43 -39
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +1 -4
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.js +12 -4
- package/lib/chevre/service/offer/event/authorize.d.ts +1 -4
- package/lib/chevre/service/offer/event/authorize.js +6 -2
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.d.ts +2 -1
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.js +10 -4
- package/lib/chevre/service/offer/factory.js +22 -5
- package/lib/chevre/service/offer.d.ts +7 -9
- package/lib/chevre/service/offer.js +25 -24
- package/lib/chevre/service/order/deleteOrder.d.ts +4 -0
- package/lib/chevre/service/order/deleteOrder.js +48 -5
- package/lib/chevre/service/payment/any/factory.d.ts +1 -1
- package/lib/chevre/service/payment/any.d.ts +1 -4
- package/lib/chevre/service/payment/any.js +35 -22
- package/lib/chevre/service/payment/factory/createPayObjectServiceOutput.js +32 -26
- package/lib/chevre/service/payment/movieTicket/validation.js +1 -22
- package/lib/chevre/service/report/telemetry.js +3 -3
- package/lib/chevre/service/reserve/verifyToken4reservation.js +1 -16
- package/lib/chevre/service/task/acceptCOAOffer.js +24 -14
- package/lib/chevre/service/task/authorizePayment.js +7 -5
- package/lib/chevre/service/task/createEvent/createEventSeries.js +5 -2
- package/lib/chevre/service/task/deletePerson.js +57 -56
- package/lib/chevre/service/task/deleteTransaction.js +2 -0
- package/lib/chevre/service/task.d.ts +0 -2
- package/lib/chevre/service/transaction/deleteTransaction.d.ts +2 -0
- package/lib/chevre/service/transaction/moneyTransfer.d.ts +1 -6
- package/lib/chevre/service/transaction/moneyTransfer.js +57 -36
- package/package.json +9 -5
- package/example/src/chevre/findValidAuthorization.ts +0 -56
- package/example/src/chevre/saveAggregateReservation.ts +0 -43
- package/lib/chevre/credentials/jwt.d.ts +0 -23
- package/lib/chevre/credentials/jwt.js +0 -18
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.d.ts +0 -19
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +0 -145
- package/lib/chevre/service/task/aggregateUseActionsOnEvent.d.ts +0 -6
- package/lib/chevre/service/task/aggregateUseActionsOnEvent.js +0 -37
|
@@ -60,6 +60,7 @@ import type { SellerPaymentAcceptedRepo } from './repo/sellerPaymentAccepted';
|
|
|
60
60
|
import type { ServiceOutputRepo } from './repo/serviceOutput';
|
|
61
61
|
import type { ServiceOutputIdentifierRepo } from './repo/serviceOutputIdentifier';
|
|
62
62
|
import type { SettingRepo } from './repo/setting';
|
|
63
|
+
import type { JWTSettingRepo } from './repo/setting/jwt';
|
|
63
64
|
import type { StockHolderRepo } from './repo/stockHolder';
|
|
64
65
|
import type { TaskRepo } from './repo/task';
|
|
65
66
|
import type { TelemetryRepo } from './repo/telemetry';
|
|
@@ -345,6 +346,12 @@ export type Setting = SettingRepo;
|
|
|
345
346
|
export declare namespace Setting {
|
|
346
347
|
function createInstance(...params: ConstructorParameters<typeof SettingRepo>): Promise<SettingRepo>;
|
|
347
348
|
}
|
|
349
|
+
export declare namespace setting {
|
|
350
|
+
type JWT = JWTSettingRepo;
|
|
351
|
+
namespace JWT {
|
|
352
|
+
function createInstance(...params: ConstructorParameters<typeof JWTSettingRepo>): Promise<JWTSettingRepo>;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
348
355
|
export type StockHolder = StockHolderRepo;
|
|
349
356
|
export declare namespace StockHolder {
|
|
350
357
|
function createInstance(...params: ConstructorParameters<typeof StockHolderRepo>): Promise<StockHolderRepo>;
|
package/lib/chevre/repository.js
CHANGED
|
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.Reservation = exports.ProjectMakesOffer = exports.Project = exports.ProductOffer = exports.ProductModel = exports.Product = exports.PriceSpecification = exports.place = exports.Permit = exports.Person = exports.paymentMethod = exports.PaymentServiceProvider = exports.PaymentService = exports.Passport = exports.OwnershipInfo = exports.OrderNumber = exports.OrderInTransaction = exports.Order = exports.Offer = exports.OfferItemCondition = exports.OfferCatalogItem = exports.OfferCatalog = exports.Note = exports.Message = exports.MerchantReturnPolicy = exports.Member = exports.Interface = exports.EventSeries = exports.EventSellerMakesOffer = exports.Event = exports.EmailMessage = exports.CustomerType = exports.Customer = exports.Credentials = exports.CreativeWork = exports.ConfirmationNumber = exports.Comment = exports.Authorization = exports.CategoryCode = exports.AssetTransaction = exports.Aggregation = exports.AggregateReservation = exports.AggregateOffer = exports.AdditionalProperty = exports.Action = exports.AccountTransaction = exports.AccountTitle = exports.AccountingReport = exports.Account = exports.AcceptedOffer = void 0;
|
|
13
|
-
exports.rateLimit = exports.Trip = exports.TransactionProcess = exports.TransactionNumber = exports.Transaction = exports.Ticket = exports.Telemetry = exports.Task = exports.StockHolder = exports.Setting = exports.ServiceOutputIdentifier = exports.ServiceOutput = exports.SellerPaymentAccepted = exports.Seller = exports.Schedule = exports.Role = void 0;
|
|
13
|
+
exports.rateLimit = exports.Trip = exports.TransactionProcess = exports.TransactionNumber = exports.Transaction = exports.Ticket = exports.Telemetry = exports.Task = exports.StockHolder = exports.setting = exports.Setting = exports.ServiceOutputIdentifier = exports.ServiceOutput = exports.SellerPaymentAccepted = exports.Seller = exports.Schedule = exports.Role = void 0;
|
|
14
14
|
var AcceptedOffer;
|
|
15
15
|
(function (AcceptedOffer) {
|
|
16
16
|
let repo;
|
|
@@ -841,6 +841,22 @@ var Setting;
|
|
|
841
841
|
}
|
|
842
842
|
Setting.createInstance = createInstance;
|
|
843
843
|
})(Setting = exports.Setting || (exports.Setting = {}));
|
|
844
|
+
var setting;
|
|
845
|
+
(function (setting) {
|
|
846
|
+
let JWT;
|
|
847
|
+
(function (JWT) {
|
|
848
|
+
let repo;
|
|
849
|
+
function createInstance(...params) {
|
|
850
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
851
|
+
if (repo === undefined) {
|
|
852
|
+
repo = (yield Promise.resolve().then(() => require('./repo/setting/jwt'))).JWTSettingRepo;
|
|
853
|
+
}
|
|
854
|
+
return new repo(...params);
|
|
855
|
+
});
|
|
856
|
+
}
|
|
857
|
+
JWT.createInstance = createInstance;
|
|
858
|
+
})(JWT = setting.JWT || (setting.JWT = {}));
|
|
859
|
+
})(setting = exports.setting || (exports.setting = {}));
|
|
844
860
|
var StockHolder;
|
|
845
861
|
(function (StockHolder) {
|
|
846
862
|
let repo;
|
|
@@ -3,6 +3,5 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { aggregateOffers } from './event/aggregateOffers';
|
|
5
5
|
import { aggregateScreeningEvent } from './event/aggregateScreeningEvent';
|
|
6
|
-
import { aggregateUseActionsOnEvent } from './event/aggregateUseActionsOnEvent';
|
|
7
6
|
import { importFromCOA } from './event/importFromCOA';
|
|
8
|
-
export { aggregateOffers, aggregateScreeningEvent,
|
|
7
|
+
export { aggregateOffers, aggregateScreeningEvent, importFromCOA };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.importFromCOA = exports.
|
|
3
|
+
exports.importFromCOA = exports.aggregateScreeningEvent = exports.aggregateOffers = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* イベント集計サービス
|
|
6
6
|
*/
|
|
@@ -8,7 +8,5 @@ const aggregateOffers_1 = require("./event/aggregateOffers");
|
|
|
8
8
|
Object.defineProperty(exports, "aggregateOffers", { enumerable: true, get: function () { return aggregateOffers_1.aggregateOffers; } });
|
|
9
9
|
const aggregateScreeningEvent_1 = require("./event/aggregateScreeningEvent");
|
|
10
10
|
Object.defineProperty(exports, "aggregateScreeningEvent", { enumerable: true, get: function () { return aggregateScreeningEvent_1.aggregateScreeningEvent; } });
|
|
11
|
-
const aggregateUseActionsOnEvent_1 = require("./event/aggregateUseActionsOnEvent");
|
|
12
|
-
Object.defineProperty(exports, "aggregateUseActionsOnEvent", { enumerable: true, get: function () { return aggregateUseActionsOnEvent_1.aggregateUseActionsOnEvent; } });
|
|
13
11
|
const importFromCOA_1 = require("./event/importFromCOA");
|
|
14
12
|
Object.defineProperty(exports, "importFromCOA", { enumerable: true, get: function () { return importFromCOA_1.importFromCOA; } });
|
|
@@ -134,7 +134,7 @@ export declare function start(params: factory.assetTransaction.pay.IStartParamsW
|
|
|
134
134
|
checkedAction: {
|
|
135
135
|
id: string;
|
|
136
136
|
};
|
|
137
|
-
}): IStartOperation<factory.assetTransaction.pay.ITransaction
|
|
137
|
+
}): IStartOperation<Pick<factory.assetTransaction.pay.ITransaction, 'id' | 'object'>>;
|
|
138
138
|
/**
|
|
139
139
|
* 取引確定
|
|
140
140
|
*/
|
|
@@ -408,23 +408,18 @@ function processAuthorizeMovieTicket(params, transaction, paymentServiceId,
|
|
|
408
408
|
// useCheckByIdentifierIfNotYet: boolean,
|
|
409
409
|
options) {
|
|
410
410
|
return (repos, settings) => __awaiter(this, void 0, void 0, function* () {
|
|
411
|
-
const { accountsReceivablesByServiceType } =
|
|
412
|
-
//
|
|
413
|
-
//
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
//
|
|
417
|
-
return saveAuthorizeResult({
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
// 'object.payAction': payActionInObject, // 最適化(2024-04-09~)
|
|
424
|
-
// 認証レスポンスより計上金額を保管(2023-05-15~)
|
|
425
|
-
'object.accountsReceivablesByServiceType': accountsReceivablesByServiceType
|
|
426
|
-
}
|
|
427
|
-
})(repos);
|
|
411
|
+
// const { accountsReceivablesByServiceType } = await MovieTicketPayment.authorize(
|
|
412
|
+
// params, transaction, paymentServiceId, options
|
|
413
|
+
// )(repos, settings);
|
|
414
|
+
yield MovieTicketPayment.authorize(params, transaction, paymentServiceId, options)(repos, settings);
|
|
415
|
+
return transaction;
|
|
416
|
+
// discontinue(2024-12-17~)
|
|
417
|
+
// return saveAuthorizeResult({
|
|
418
|
+
// id: transaction.id,
|
|
419
|
+
// update: {
|
|
420
|
+
// 'object.accountsReceivablesByServiceType': accountsReceivablesByServiceType // 認証レスポンスより計上金額を保管(2023-05-15~)
|
|
421
|
+
// }
|
|
422
|
+
// })(repos);
|
|
428
423
|
});
|
|
429
424
|
}
|
|
430
425
|
function saveAuthorizeResult(params) {
|
|
@@ -17,7 +17,6 @@ function createPrice(params) {
|
|
|
17
17
|
name: priceSpec.name,
|
|
18
18
|
price: priceSpec.price,
|
|
19
19
|
priceCurrency: priceSpec.priceCurrency,
|
|
20
|
-
// project: priceSpec.project,
|
|
21
20
|
typeOf: priceSpec.typeOf,
|
|
22
21
|
appliesToCategoryCode: priceSpec.appliesToCategoryCode,
|
|
23
22
|
valueAddedTaxIncluded: priceSpec.valueAddedTaxIncluded
|
|
@@ -30,8 +29,6 @@ function createPrice(params) {
|
|
|
30
29
|
];
|
|
31
30
|
return {
|
|
32
31
|
priceCurrency: params.ticketOffer.priceSpecification.priceCurrency,
|
|
33
|
-
// 不要な属性を除外(2022-11-02~)
|
|
34
|
-
// project: params.ticketOffer.priceSpecification.project,
|
|
35
32
|
typeOf: params.ticketOffer.priceSpecification.typeOf,
|
|
36
33
|
valueAddedTaxIncluded: params.ticketOffer.priceSpecification.valueAddedTaxIncluded,
|
|
37
34
|
priceComponent: priceComponent4reservation
|
|
@@ -82,6 +79,8 @@ function createPriceSpecsByEventOffer(params) {
|
|
|
82
79
|
else if (typeof ((_a = params.appliesToMovieTicket) === null || _a === void 0 ? void 0 : _a.identifier) === 'string') {
|
|
83
80
|
appliesToMovieTicketSpecifiedAsArray = [params.appliesToMovieTicket];
|
|
84
81
|
}
|
|
82
|
+
let categoryCodeChargePriceComponent;
|
|
83
|
+
let movieTicketChargePriceComponent;
|
|
85
84
|
// 予約のpriceComponentを必要最低限に最適化
|
|
86
85
|
return params.ticketOffer.priceSpecification.priceComponent.map((priceSpec) => {
|
|
87
86
|
if (priceSpec.typeOf === factory.priceSpecificationType.UnitPriceSpecification) {
|
|
@@ -92,31 +91,30 @@ function createPriceSpecsByEventOffer(params) {
|
|
|
92
91
|
});
|
|
93
92
|
}
|
|
94
93
|
else if (priceSpec.typeOf === factory.priceSpecificationType.MovieTicketTypeChargeSpecification) {
|
|
95
|
-
|
|
94
|
+
movieTicketChargePriceComponent = {
|
|
96
95
|
name: priceSpec.name,
|
|
97
96
|
price: priceSpec.price,
|
|
98
97
|
priceCurrency: priceSpec.priceCurrency,
|
|
99
|
-
// project: priceSpec.project,
|
|
100
98
|
typeOf: priceSpec.typeOf,
|
|
101
99
|
appliesToVideoFormat: priceSpec.appliesToVideoFormat,
|
|
102
100
|
valueAddedTaxIncluded: priceSpec.valueAddedTaxIncluded,
|
|
103
|
-
// MovieTicketTypeChargeSpecificationの場合、appliesToMovieTicketは必ず存在する(2022-06-02~)
|
|
104
101
|
appliesToMovieTicket: priceSpec.appliesToMovieTicket
|
|
105
102
|
};
|
|
103
|
+
return movieTicketChargePriceComponent;
|
|
106
104
|
}
|
|
107
105
|
else if (priceSpec.typeOf === factory.priceSpecificationType.CategoryCodeChargeSpecification) {
|
|
108
|
-
|
|
106
|
+
categoryCodeChargePriceComponent = {
|
|
109
107
|
name: priceSpec.name,
|
|
110
108
|
price: priceSpec.price,
|
|
111
109
|
priceCurrency: priceSpec.priceCurrency,
|
|
112
|
-
// project: priceSpec.project,
|
|
113
110
|
typeOf: priceSpec.typeOf,
|
|
114
111
|
appliesToCategoryCode: priceSpec.appliesToCategoryCode,
|
|
115
112
|
valueAddedTaxIncluded: priceSpec.valueAddedTaxIncluded
|
|
116
113
|
};
|
|
114
|
+
return categoryCodeChargePriceComponent;
|
|
117
115
|
}
|
|
118
116
|
else {
|
|
119
|
-
|
|
117
|
+
throw new factory.errors.NotImplemented(`priceSpec.typeOf not implemented. ticketOffer: ${params.ticketOffer.id}`);
|
|
120
118
|
}
|
|
121
119
|
});
|
|
122
120
|
}
|
|
@@ -126,8 +124,6 @@ function createPriceSpecsByEventOffer(params) {
|
|
|
126
124
|
function eventOfferUnitPriceSpec2reservationUnitPriceSpec(params) {
|
|
127
125
|
var _a;
|
|
128
126
|
const priceSpec = params.unitPriceSpec;
|
|
129
|
-
// 予約単価仕様の適用決済カードをArray化(2022-07-27~)
|
|
130
|
-
// let appliesToMovieTicket: factory.priceSpecification.unitPrice.IAppliesToMovieTicket | undefined;
|
|
131
127
|
let appliesToMovieTicket;
|
|
132
128
|
// 複数決済カード対応(2022-07-11~)
|
|
133
129
|
const priceSpecificationAppliesToMovieTicket = priceSpec.appliesToMovieTicket;
|
|
@@ -167,10 +163,6 @@ function eventOfferUnitPriceSpec2reservationUnitPriceSpec(params) {
|
|
|
167
163
|
}
|
|
168
164
|
else {
|
|
169
165
|
// appliesToMovieTicketがArrayでないケースは廃止(2022-09-12~)
|
|
170
|
-
// if (typeof priceSpecificationAppliesToMovieTicket?.typeOf === 'string') {
|
|
171
|
-
// // Arrayでない場合を廃止(2022-08-01~)
|
|
172
|
-
// throw new factory.errors.NotImplemented('appliesToMovieTickets.typeOf as string not implemented');
|
|
173
|
-
// }
|
|
174
166
|
}
|
|
175
167
|
let accounting4reservation;
|
|
176
168
|
const accounting = priceSpec.accounting;
|
|
@@ -180,14 +172,11 @@ function eventOfferUnitPriceSpec2reservationUnitPriceSpec(params) {
|
|
|
180
172
|
: undefined), (typeof ((_a = accounting.operatingRevenue) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string')
|
|
181
173
|
? {
|
|
182
174
|
operatingRevenue: {
|
|
183
|
-
// project: accounting.operatingRevenue.project, // 削除(2023-12-13~)
|
|
184
175
|
typeOf: accounting.operatingRevenue.typeOf,
|
|
185
176
|
codeValue: accounting.operatingRevenue.codeValue
|
|
186
177
|
}
|
|
187
178
|
}
|
|
188
179
|
: undefined);
|
|
189
180
|
}
|
|
190
|
-
return Object.assign(Object.assign({ name: priceSpec.name, price: priceSpec.price, priceCurrency: priceSpec.priceCurrency,
|
|
191
|
-
// project: priceSpec.project,
|
|
192
|
-
referenceQuantity: priceSpec.referenceQuantity, typeOf: priceSpec.typeOf, valueAddedTaxIncluded: priceSpec.valueAddedTaxIncluded }, (Array.isArray(appliesToMovieTicket)) ? { appliesToMovieTicket } : undefined), (typeof (accounting4reservation === null || accounting4reservation === void 0 ? void 0 : accounting4reservation.typeOf) === 'string') ? { accounting: accounting4reservation } : undefined);
|
|
181
|
+
return Object.assign(Object.assign({ name: priceSpec.name, price: priceSpec.price, priceCurrency: priceSpec.priceCurrency, referenceQuantity: priceSpec.referenceQuantity, typeOf: priceSpec.typeOf, valueAddedTaxIncluded: priceSpec.valueAddedTaxIncluded }, (Array.isArray(appliesToMovieTicket)) ? { appliesToMovieTicket } : undefined), (typeof (accounting4reservation === null || accounting4reservation === void 0 ? void 0 : accounting4reservation.typeOf) === 'string') ? { accounting: accounting4reservation } : undefined);
|
|
193
182
|
}
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 承認サービス
|
|
3
|
-
*/
|
|
4
|
-
import * as jwt from 'jsonwebtoken';
|
|
5
|
-
import type { ActionRepo } from '../repo/action';
|
|
6
1
|
import type { AuthorizationRepo } from '../repo/authorization';
|
|
2
|
+
import type { JWTSettingRepo } from '../repo/setting/jwt';
|
|
7
3
|
import type { TicketRepo } from '../repo/ticket';
|
|
8
|
-
import { JWTCredentials } from '../credentials/jwt';
|
|
9
4
|
import * as factory from '../factory';
|
|
10
5
|
type IToken = string;
|
|
11
6
|
interface IPayload extends Pick<factory.clientUser.IClientUser, 'aud' | 'exp' | 'iat' | 'iss' | 'sub' | 'token_use' | 'typ' | 'version'> {
|
|
@@ -13,7 +8,6 @@ interface IPayload extends Pick<factory.clientUser.IClientUser, 'aud' | 'exp' |
|
|
|
13
8
|
typ: string;
|
|
14
9
|
jti?: string;
|
|
15
10
|
}
|
|
16
|
-
type IAuthorizedObject = factory.authorization.IObject;
|
|
17
11
|
/**
|
|
18
12
|
* コードをトークンに変換する
|
|
19
13
|
*/
|
|
@@ -27,36 +21,11 @@ declare function getToken(params: {
|
|
|
27
21
|
};
|
|
28
22
|
code: string;
|
|
29
23
|
expiresIn: number;
|
|
30
|
-
/**
|
|
31
|
-
* jtw.payload.iss
|
|
32
|
-
*/
|
|
33
|
-
issuer: string;
|
|
34
|
-
/**
|
|
35
|
-
* jtw.payload.aud
|
|
36
|
-
*/
|
|
37
|
-
audience: string;
|
|
38
24
|
}): (repos: {
|
|
39
25
|
authorization: AuthorizationRepo;
|
|
26
|
+
jwtSetting: JWTSettingRepo;
|
|
40
27
|
ticket: TicketRepo;
|
|
41
|
-
}, credentials: {
|
|
42
|
-
jwt: JWTCredentials;
|
|
43
28
|
}) => Promise<{
|
|
44
29
|
token: IToken;
|
|
45
30
|
}>;
|
|
46
|
-
|
|
47
|
-
project: {
|
|
48
|
-
id: string;
|
|
49
|
-
};
|
|
50
|
-
agent: factory.action.check.token.IAgent;
|
|
51
|
-
token: string;
|
|
52
|
-
audience?: string[];
|
|
53
|
-
}): (repos: {
|
|
54
|
-
action?: ActionRepo;
|
|
55
|
-
authorization: AuthorizationRepo;
|
|
56
|
-
ticket: TicketRepo;
|
|
57
|
-
}, credentials: {
|
|
58
|
-
jwt: JWTCredentials;
|
|
59
|
-
}) => Promise<{
|
|
60
|
-
authorizedObject: IAuthorizedObject;
|
|
61
|
-
}>;
|
|
62
|
-
export { IPayload, getToken, verifyToken };
|
|
31
|
+
export { IPayload, getToken };
|
|
@@ -9,23 +9,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.getToken = void 0;
|
|
13
13
|
/**
|
|
14
14
|
* 承認サービス
|
|
15
15
|
*/
|
|
16
16
|
const jwt = require("jsonwebtoken");
|
|
17
17
|
const factory = require("../factory");
|
|
18
|
-
// type IPayloadWithNoVersion = factory.authorization.IObject & {
|
|
19
|
-
// version?: never;
|
|
20
|
-
// typ?: never;
|
|
21
|
-
// };
|
|
22
|
-
const ALGORITHM = 'HS256';
|
|
23
18
|
/**
|
|
24
19
|
* コードをトークンに変換する
|
|
25
20
|
*/
|
|
26
21
|
function getToken(params) {
|
|
27
|
-
return (repos
|
|
22
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
28
23
|
var _a;
|
|
24
|
+
const jwtSetting = yield repos.jwtSetting.findDefault();
|
|
29
25
|
if (typeof params.project.id !== 'string' || params.project.id.length === 0) {
|
|
30
26
|
throw new factory.errors.ArgumentNull('project.id');
|
|
31
27
|
}
|
|
@@ -36,42 +32,39 @@ function getToken(params) {
|
|
|
36
32
|
project: { id: params.project.id },
|
|
37
33
|
code: params.code
|
|
38
34
|
});
|
|
39
|
-
if (typeof params.issuer !== 'string' || params.issuer.length === 0) {
|
|
40
|
-
|
|
41
|
-
}
|
|
35
|
+
// if (typeof params.issuer !== 'string' || params.issuer.length === 0) {
|
|
36
|
+
// throw new factory.errors.ArgumentNull('issuer');
|
|
37
|
+
// }
|
|
42
38
|
let subject;
|
|
43
39
|
let typ;
|
|
44
|
-
let jti;
|
|
45
|
-
// let subject: string = authorization.id;
|
|
46
|
-
// let typ: string = `${credentials.jwt.payloadTypPrefix}:${authorization.typeOf}`;
|
|
47
40
|
// jti必須化(2024-08-22~)
|
|
48
|
-
// let jti: string | undefined;
|
|
49
|
-
// if (params.useJti) {
|
|
50
|
-
// }
|
|
51
41
|
const { id } = yield repos.ticket.issueByTicketToken(Object.assign({ project: { id: params.project.id }, ticketToken: params.code }, (typeof ((_a = authorization.issuedBy) === null || _a === void 0 ? void 0 : _a.id) === 'string') ? { issuedBy: authorization.issuedBy } : undefined));
|
|
52
|
-
jti = id;
|
|
42
|
+
const jti = id;
|
|
53
43
|
// ロール承認の場合、subjectはメンバーID,typはメンバータイプ
|
|
54
44
|
if (authorization.object.typeOf === factory.iam.RoleType.OrganizationRole) {
|
|
55
45
|
subject = authorization.object.member.id;
|
|
56
|
-
typ = `${
|
|
46
|
+
typ = `${jwtSetting.payloadTypPrefix}:${authorization.object.member.typeOf}`;
|
|
57
47
|
}
|
|
58
48
|
else {
|
|
59
49
|
// useJtiの場合、subject,typはagent(2024-05-09~)
|
|
60
50
|
subject = params.agent.id;
|
|
61
|
-
typ = `${
|
|
51
|
+
typ = `${jwtSetting.payloadTypPrefix}:${params.agent.typeOf}`;
|
|
62
52
|
}
|
|
63
53
|
const payload = {
|
|
64
|
-
// sub: authorization.id, // 拡張(2024-05-01~)
|
|
65
54
|
token_use: 'access',
|
|
66
|
-
version:
|
|
55
|
+
version: jwtSetting.version,
|
|
67
56
|
typ // 拡張(2024-05-07~)
|
|
68
57
|
};
|
|
69
58
|
const token = yield new Promise((resolve, reject) => {
|
|
70
59
|
// 所有権を暗号化する
|
|
71
|
-
jwt.sign(payload,
|
|
72
|
-
|
|
73
|
-
issuer:
|
|
74
|
-
|
|
60
|
+
jwt.sign(payload, jwtSetting.secret, {
|
|
61
|
+
algorithm: jwtSetting.algorithm,
|
|
62
|
+
issuer: jwtSetting.issuer,
|
|
63
|
+
expiresIn: params.expiresIn,
|
|
64
|
+
subject,
|
|
65
|
+
audience: jwtSetting.issuer,
|
|
66
|
+
jwtid: jti // 拡張(2024-05-08~)
|
|
67
|
+
}, (err, encoded) => {
|
|
75
68
|
if (err instanceof Error) {
|
|
76
69
|
reject(err);
|
|
77
70
|
}
|
|
@@ -89,114 +82,3 @@ function getToken(params) {
|
|
|
89
82
|
});
|
|
90
83
|
}
|
|
91
84
|
exports.getToken = getToken;
|
|
92
|
-
function payload2authorizeObject(params) {
|
|
93
|
-
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
94
|
-
const { payload } = params;
|
|
95
|
-
let authorizedObject;
|
|
96
|
-
// token.payloadが承認のケースに対応(2024-05-02~)
|
|
97
|
-
if (typeof payload.version === 'string') {
|
|
98
|
-
if (typeof payload.sub !== 'string' || payload.sub.length === 0) {
|
|
99
|
-
throw new factory.errors.Unauthorized(`invalid token [sub:${payload.sub}]`);
|
|
100
|
-
}
|
|
101
|
-
// discontinue purposeTokenに対応(2024-07-10~)
|
|
102
|
-
// sskts.purposeTokenに対応
|
|
103
|
-
// let resourceTypeByPayload: string | undefined;
|
|
104
|
-
// if (typeof payload.typ === 'string') {
|
|
105
|
-
// resourceTypeByPayload = payload.typ.split(`${credentials.jwt.payloadTypPrefix}:`)
|
|
106
|
-
// .at(1);
|
|
107
|
-
// }
|
|
108
|
-
// if (resourceTypeByPayload === factory.transactionType.PlaceOrder) {
|
|
109
|
-
// result = {
|
|
110
|
-
// id: payload.sub,
|
|
111
|
-
// typeOf: resourceTypeByPayload
|
|
112
|
-
// };
|
|
113
|
-
// } else {
|
|
114
|
-
// }
|
|
115
|
-
if (typeof payload.jti === 'string') {
|
|
116
|
-
// jtiに対応(2024-05-08~)
|
|
117
|
-
const ticket = (yield repos.ticket.projectFields({
|
|
118
|
-
limit: 1,
|
|
119
|
-
page: 1,
|
|
120
|
-
project: { id: { $eq: params.project.id } },
|
|
121
|
-
id: { $eq: payload.jti }
|
|
122
|
-
}, ['ticketToken'])).shift();
|
|
123
|
-
if (ticket === undefined) {
|
|
124
|
-
throw new factory.errors.NotFound('Ticket');
|
|
125
|
-
}
|
|
126
|
-
// 承認を参照
|
|
127
|
-
const { object } = yield repos.authorization.findValidOneByCode({
|
|
128
|
-
project: { id: params.project.id },
|
|
129
|
-
code: ticket.ticketToken
|
|
130
|
-
});
|
|
131
|
-
authorizedObject = object;
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
// 基本的にはsubで承認を参照
|
|
135
|
-
const { object } = yield repos.authorization.findValidOneById({
|
|
136
|
-
project: { id: params.project.id },
|
|
137
|
-
id: payload.sub
|
|
138
|
-
});
|
|
139
|
-
authorizedObject = object;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
else {
|
|
143
|
-
// NO_VERSIONを廃止(2024-05-06~)
|
|
144
|
-
throw new factory.errors.NotImplemented('USE_TOKEN_WITH_NO_VERSION discontinued');
|
|
145
|
-
}
|
|
146
|
-
return { authorizedObject };
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
function verifyToken(params) {
|
|
150
|
-
return (repos, credentials) => __awaiter(this, void 0, void 0, function* () {
|
|
151
|
-
let payload;
|
|
152
|
-
let action;
|
|
153
|
-
if (repos.action !== undefined) {
|
|
154
|
-
const actionAttributes = {
|
|
155
|
-
project: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
156
|
-
typeOf: factory.actionType.CheckAction,
|
|
157
|
-
agent: params.agent,
|
|
158
|
-
object: {
|
|
159
|
-
token: params.token,
|
|
160
|
-
typeOf: factory.action.check.token.ObjectType.Ticket
|
|
161
|
-
}
|
|
162
|
-
};
|
|
163
|
-
action = yield repos.action.start(actionAttributes);
|
|
164
|
-
}
|
|
165
|
-
try {
|
|
166
|
-
// payload = await new Promise<IPayloadWithNoVersion | IPayload>((resolve, reject) => {
|
|
167
|
-
payload = yield new Promise((resolve, reject) => {
|
|
168
|
-
jwt.verify(params.token, credentials.jwt.secret, Object.assign({ algorithms: [ALGORITHM],
|
|
169
|
-
// 互換性維持のために複数対応(2024-05-02~)
|
|
170
|
-
// issuer: credentials.jwt.issuer,
|
|
171
|
-
issuer: credentials.jwt.issuers }, (Array.isArray(params.audience)) ? { audience: params.audience } : undefined), (err, decoded) => {
|
|
172
|
-
if (err instanceof Error) {
|
|
173
|
-
reject(err);
|
|
174
|
-
}
|
|
175
|
-
else {
|
|
176
|
-
resolve(decoded);
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
catch (error) {
|
|
182
|
-
if (repos.action !== undefined && action !== undefined) {
|
|
183
|
-
try {
|
|
184
|
-
yield repos.action.giveUp({ typeOf: action.typeOf, id: action.id, error });
|
|
185
|
-
}
|
|
186
|
-
catch (__) {
|
|
187
|
-
// 失敗したら仕方ない
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
// JWTエラーをハンドリング
|
|
191
|
-
if (error instanceof jwt.TokenExpiredError) {
|
|
192
|
-
throw new factory.errors.Argument('token', `${error.message} expiredAt:${error.expiredAt}`);
|
|
193
|
-
}
|
|
194
|
-
throw error;
|
|
195
|
-
}
|
|
196
|
-
if (repos.action !== undefined && action !== undefined) {
|
|
197
|
-
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: payload });
|
|
198
|
-
}
|
|
199
|
-
return payload2authorizeObject({ payload, project: { id: params.project.id } })(repos);
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
exports.verifyToken = verifyToken;
|
|
@@ -217,21 +217,26 @@ function responseBody2acceptedOffers4result(params) {
|
|
|
217
217
|
const priceSpecification = itemOffered.price;
|
|
218
218
|
const priceComponent = priceSpecification.priceComponent.map((c) => {
|
|
219
219
|
var _a;
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
?
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
220
|
+
if (c.typeOf === factory.priceSpecificationType.UnitPriceSpecification) {
|
|
221
|
+
const accounting = c.accounting;
|
|
222
|
+
return Object.assign(Object.assign({}, c), (typeof (accounting === null || accounting === void 0 ? void 0 : accounting.typeOf) === 'string')
|
|
223
|
+
? {
|
|
224
|
+
accounting: Object.assign(Object.assign({ typeOf: accounting.typeOf }, (typeof accounting.accountsReceivable === 'number')
|
|
225
|
+
? { accountsReceivable: accounting.accountsReceivable }
|
|
226
|
+
: undefined), (typeof ((_a = accounting.operatingRevenue) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string')
|
|
227
|
+
? {
|
|
228
|
+
operatingRevenue: {
|
|
229
|
+
typeOf: accounting.operatingRevenue.typeOf,
|
|
230
|
+
codeValue: accounting.operatingRevenue.codeValue
|
|
231
|
+
}
|
|
230
232
|
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
233
|
+
: undefined)
|
|
234
|
+
}
|
|
235
|
+
: undefined);
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
return c;
|
|
239
|
+
}
|
|
235
240
|
});
|
|
236
241
|
// tslint:disable-next-line:no-unnecessary-local-variable
|
|
237
242
|
const resultAcceptedOffer = {
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import * as factory from '../../../../../factory';
|
|
2
|
-
import type { JWTCredentials } from '../../../../../credentials/jwt';
|
|
3
|
-
import type { ActionRepo } from '../../../../../repo/action';
|
|
4
2
|
import type { AuthorizationRepo } from '../../../../../repo/authorization';
|
|
5
3
|
import type { TicketRepo } from '../../../../../repo/ticket';
|
|
6
4
|
/**
|
|
@@ -15,10 +13,7 @@ declare function requestedProgramMembershipUsed2permit(params: {
|
|
|
15
13
|
id: string;
|
|
16
14
|
};
|
|
17
15
|
}): (repos: {
|
|
18
|
-
action: ActionRepo;
|
|
19
16
|
authorization: AuthorizationRepo;
|
|
20
17
|
ticket: TicketRepo;
|
|
21
|
-
}, credentials: {
|
|
22
|
-
jwt: JWTCredentials;
|
|
23
18
|
}) => Promise<factory.assetTransaction.reserve.IPermitIssuedThroughFaceToFace | factory.assetTransaction.reserve.IPermitIssuedThroughMembershipService | undefined>;
|
|
24
19
|
export { requestedProgramMembershipUsed2permit };
|