@chevre/domain 20.4.0-alpha.8 → 20.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/example/src/chevre/aggregateEventReservation.ts +2 -1
- package/example/src/chevre/deleteMovieTicketCategoryChargePriceSpecs.ts +21 -0
- package/example/src/chevre/{deleteReservationTicketUnderNames.ts → deleteTasksByName.ts} +4 -2
- package/example/src/chevre/migrateMoneyTransferPendingTransactionIdentifier.ts +96 -0
- package/example/src/chevre/reIndex.ts +25 -0
- package/example/src/chevre/searchEventTicketOffers.ts +7 -4
- package/example/src/chevre/searchOfferCatalogs.ts +14 -16
- package/example/src/chevre/searchOffersByCatalog.ts +2 -1
- package/example/src/chevre/searchProductOffers.ts +38 -0
- package/example/src/chevre/searchTasks.ts +22 -0
- package/example/src/chevre/unsetUnnecessaryFields.ts +6 -11
- package/lib/chevre/errorHandler.js +1 -0
- package/lib/chevre/repo/accountTransaction.d.ts +0 -5
- package/lib/chevre/repo/accountTransaction.js +44 -38
- package/lib/chevre/repo/assetTransaction.d.ts +1 -0
- package/lib/chevre/repo/assetTransaction.js +5 -0
- package/lib/chevre/repo/code.d.ts +0 -7
- package/lib/chevre/repo/code.js +0 -17
- package/lib/chevre/repo/event.d.ts +5 -4
- package/lib/chevre/repo/event.js +8 -17
- package/lib/chevre/repo/mongoose/model/accountTransaction.js +0 -5
- package/lib/chevre/repo/mongoose/model/member.js +5 -2
- package/lib/chevre/repo/mongoose/model/offer.js +19 -9
- package/lib/chevre/repo/mongoose/model/priceSpecification.js +19 -52
- package/lib/chevre/repo/mongoose/model/product.js +15 -2
- package/lib/chevre/repo/offer.d.ts +17 -2
- package/lib/chevre/repo/offer.js +77 -44
- package/lib/chevre/repo/offerCatalog.d.ts +3 -5
- package/lib/chevre/repo/offerCatalog.js +78 -37
- package/lib/chevre/repo/priceSpecification.d.ts +11 -0
- package/lib/chevre/repo/priceSpecification.js +44 -66
- package/lib/chevre/repo/task.d.ts +8 -0
- package/lib/chevre/repo/task.js +21 -9
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.d.ts +2 -0
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +93 -96
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +3 -1
- package/lib/chevre/service/assetTransaction/moneyTransfer.js +19 -11
- package/lib/chevre/service/assetTransaction/pay.js +2 -3
- package/lib/chevre/service/assetTransaction/registerService/factory.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/registerService/factory.js +6 -3
- package/lib/chevre/service/assetTransaction/registerService.js +3 -1
- package/lib/chevre/service/assetTransaction/reserve/factory/price.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/reserve/factory/price.js +0 -7
- package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +2 -2
- package/lib/chevre/service/assetTransaction/reserve/factory.js +0 -1
- package/lib/chevre/service/assetTransaction/reserve.js +47 -17
- package/lib/chevre/service/assetTransaction.d.ts +1 -1
- package/lib/chevre/service/code.d.ts +0 -8
- package/lib/chevre/service/code.js +1 -38
- package/lib/chevre/service/delivery.js +12 -3
- package/lib/chevre/service/event.js +0 -3
- package/lib/chevre/service/moneyTransfer.d.ts +1 -1
- package/lib/chevre/service/moneyTransfer.js +7 -8
- package/lib/chevre/service/offer/event/authorize.js +5 -5
- package/lib/chevre/service/offer/event/factory.js +1 -1
- package/lib/chevre/service/offer/event/searchEventTicketOffers.d.ts +7 -7
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +222 -346
- package/lib/chevre/service/offer/factory.d.ts +8 -3
- package/lib/chevre/service/offer/factory.js +44 -26
- package/lib/chevre/service/offer/moneyTransfer/authorize.js +0 -1
- package/lib/chevre/service/offer/moneyTransfer/returnMoneyTransfer.js +0 -1
- package/lib/chevre/service/offer/product/searchProductOffers.d.ts +11 -1
- package/lib/chevre/service/offer/product/searchProductOffers.js +15 -7
- package/lib/chevre/service/offer/product.d.ts +11 -4
- package/lib/chevre/service/offer/product.js +59 -50
- package/lib/chevre/service/payment/any/factory.js +30 -21
- package/lib/chevre/service/payment/any.js +11 -4
- package/lib/chevre/service/payment/movieTicket/checkByIdentifier.d.ts +22 -0
- package/lib/chevre/service/payment/movieTicket/checkByIdentifier.js +183 -0
- package/lib/chevre/service/payment/movieTicket/factory.d.ts +1 -1
- package/lib/chevre/service/payment/movieTicket/getCredentials.d.ts +13 -0
- package/lib/chevre/service/payment/movieTicket/getCredentials.js +45 -0
- package/lib/chevre/service/payment/movieTicket/validation.d.ts +15 -0
- package/lib/chevre/service/{assetTransaction/pay → payment}/movieTicket/validation.js +8 -7
- package/lib/chevre/service/payment/movieTicket.d.ts +10 -22
- package/lib/chevre/service/payment/movieTicket.js +15 -210
- package/lib/chevre/service/permit.d.ts +5 -1
- package/lib/chevre/service/permit.js +18 -11
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +25 -53
- package/lib/chevre/service/task/aggregateScreeningEvent.js +2 -0
- package/lib/chevre/service/transaction/moneyTransfer.js +0 -1
- package/lib/chevre/service/transaction/orderProgramMembership.js +5 -6
- package/lib/chevre/settings.d.ts +4 -0
- package/lib/chevre/settings.js +8 -2
- package/package.json +3 -3
- package/example/src/chevre/migrateAccountTitleAdditionalProperties.ts +0 -157
- package/lib/chevre/service/assetTransaction/pay/movieTicket/validation.d.ts +0 -14
- package/lib/chevre/service/task/deleteAuthorization.d.ts +0 -6
- package/lib/chevre/service/task/deleteAuthorization.js +0 -29
|
@@ -6,7 +6,7 @@ export declare type IUnitPriceSpecification = factory.priceSpecification.IPriceS
|
|
|
6
6
|
export declare function createPointAward(params: {
|
|
7
7
|
acceptedOffer: factory.assetTransaction.registerService.IAcceptedOfferWithoutDetail;
|
|
8
8
|
offer: factory.product.ITicketOffer;
|
|
9
|
-
}): factory.
|
|
9
|
+
}): factory.action.transfer.moneyTransfer.IPointAward | undefined;
|
|
10
10
|
/**
|
|
11
11
|
* サービスアウトプットを作成する
|
|
12
12
|
*/
|
|
@@ -20,7 +20,6 @@ function createPointAward(params) {
|
|
|
20
20
|
&& typeof (pointAwardToLocation === null || pointAwardToLocation === void 0 ? void 0 : pointAwardToLocation.identifier) === 'string'
|
|
21
21
|
&& typeof (pointAwardToLocation === null || pointAwardToLocation === void 0 ? void 0 : pointAwardToLocation.issuedThrough.id) === 'string') {
|
|
22
22
|
pointAward = Object.assign(Object.assign(Object.assign({ amount: pointAwardAmount, toLocation: {
|
|
23
|
-
// ひとまず'Permit'で固定
|
|
24
23
|
typeOf: factory.permit.PermitType.Permit,
|
|
25
24
|
identifier: pointAwardToLocation.identifier,
|
|
26
25
|
issuedThrough: { id: pointAwardToLocation.issuedThrough.id }
|
|
@@ -58,7 +57,8 @@ function createServiceOutput(params) {
|
|
|
58
57
|
throw new factory.errors.ArgumentNull('object.itemOffered.serviceOutput.accessCode');
|
|
59
58
|
}
|
|
60
59
|
paymentAccount = {
|
|
61
|
-
|
|
60
|
+
// 廃止(2023-02-20~)
|
|
61
|
+
// project: { typeOf: product.project.typeOf, id: product.project.id },
|
|
62
62
|
// ひとまず固定
|
|
63
63
|
// 口座は複数のプロダクトに結合する可能性もあり、どのように利用されるかは知らない。ただbalanceを管理するだけ。通貨は知っている。
|
|
64
64
|
typeOf: factory.accountType.Account,
|
|
@@ -74,7 +74,10 @@ function createServiceOutput(params) {
|
|
|
74
74
|
default:
|
|
75
75
|
throw new factory.errors.NotImplemented(`Product type ${product.typeOf} not implemented`);
|
|
76
76
|
}
|
|
77
|
-
const issuedThrough = Object.assign({
|
|
77
|
+
const issuedThrough = Object.assign({
|
|
78
|
+
// 廃止(2023-02-20~)
|
|
79
|
+
// project: { typeOf: product.project.typeOf, id: product.project.id },
|
|
80
|
+
typeOf: product.typeOf, id: product.id }, (typeof ((_m = product.serviceType) === null || _m === void 0 ? void 0 : _m.typeOf) === 'string') ? { serviceType: product.serviceType } : undefined);
|
|
78
81
|
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ project: { typeOf: product.project.typeOf, id: product.project.id }, identifier: identifier, issuedThrough, typeOf: serviceOutputType, dateIssued: params.dateIssued }, (typeof accessCode === 'string') ? { accessCode } : undefined), (Array.isArray(additionalProperty)) ? { additionalProperty } : undefined), (typeof validFor === 'string') ? { validFor } : undefined), (name !== undefined) ? { name } : undefined), (amount !== undefined) ? { amount } : undefined), (depositAmount !== undefined) ? { depositAmount } : undefined), (paymentAmount !== undefined) ? { paymentAmount } : undefined), (paymentAccount !== undefined) ? { paymentAccount } : undefined), (issuedBy !== undefined) ? { issuedBy } : undefined);
|
|
79
82
|
}
|
|
80
83
|
exports.createServiceOutput = createServiceOutput;
|
|
@@ -94,8 +94,10 @@ function createTransactionObject(params) {
|
|
|
94
94
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
95
95
|
// オファー検索
|
|
96
96
|
const offers = yield (0, searchProductOffers_1.searchProductOffers)({
|
|
97
|
+
ids: params.acceptedOffers.map((o) => o.id),
|
|
97
98
|
itemOffered: { id: String(params.product.id) },
|
|
98
|
-
|
|
99
|
+
onlyValid: true,
|
|
100
|
+
addSortIndex: false
|
|
99
101
|
})(repos);
|
|
100
102
|
const transactionObject = [];
|
|
101
103
|
for (const acceptedOffer of params.acceptedOffers) {
|
|
@@ -9,6 +9,6 @@ export declare function createPrice(params: {
|
|
|
9
9
|
};
|
|
10
10
|
ticketOffer: factory.product.ITicketOffer;
|
|
11
11
|
seatPriceComponent: factory.place.seat.IPriceComponent[];
|
|
12
|
-
acceptedAddOns: factory.
|
|
12
|
+
acceptedAddOns: factory.product.ITicketAddOn[];
|
|
13
13
|
appliesToMovieTicket?: factory.assetTransaction.reserve.IAcceptedAppliesToMovieTicket;
|
|
14
14
|
}): factory.reservation.IPriceSpecification<factory.reservationType.EventReservation>;
|
|
@@ -44,27 +44,20 @@ function createUnitPriceSpecsAppliedToAddOn(params) {
|
|
|
44
44
|
if (Array.isArray(params.acceptedAddOns)) {
|
|
45
45
|
unitPriceSpecsAppliedToAddOn = params.acceptedAddOns.map((acceptedAddOn) => {
|
|
46
46
|
const acceptedAddOnPriceSpec = acceptedAddOn.priceSpecification;
|
|
47
|
-
if (acceptedAddOnPriceSpec === undefined || acceptedAddOnPriceSpec === null) {
|
|
48
|
-
throw new factory.errors.NotFound('AddOn PriceSpecification');
|
|
49
|
-
}
|
|
50
47
|
// アドオンプロダクトを最適化
|
|
51
48
|
const itemOffered4appliesToAddOn = {
|
|
52
49
|
id: acceptedAddOn.itemOffered.id,
|
|
53
50
|
name: acceptedAddOn.itemOffered.name,
|
|
54
51
|
productID: acceptedAddOn.itemOffered.productID,
|
|
55
|
-
// project: acceptedAddOn.itemOffered.project,
|
|
56
52
|
typeOf: acceptedAddOn.itemOffered.typeOf
|
|
57
53
|
};
|
|
58
54
|
const appliesToAddOn = {
|
|
59
|
-
// project: acceptedAddOn.project,
|
|
60
55
|
typeOf: acceptedAddOn.typeOf,
|
|
61
56
|
id: acceptedAddOn.id,
|
|
62
57
|
identifier: acceptedAddOn.identifier,
|
|
63
58
|
itemOffered: itemOffered4appliesToAddOn
|
|
64
|
-
// priceCurrency: acceptedAddOn.priceCurrency
|
|
65
59
|
};
|
|
66
60
|
return {
|
|
67
|
-
project: params.project,
|
|
68
61
|
typeOf: factory.priceSpecificationType.UnitPriceSpecification,
|
|
69
62
|
name: acceptedAddOnPriceSpec.name,
|
|
70
63
|
price: acceptedAddOnPriceSpec.price,
|
|
@@ -13,7 +13,7 @@ export declare function createPointAward(params: {
|
|
|
13
13
|
id: string;
|
|
14
14
|
};
|
|
15
15
|
assetTransaction: factory.assetTransaction.reserve.ITransaction;
|
|
16
|
-
}): factory.
|
|
16
|
+
}): factory.action.transfer.moneyTransfer.IPointAward | undefined;
|
|
17
17
|
export declare function createReservedTicket(params: {
|
|
18
18
|
acceptedOffer: factory.assetTransaction.reserve.IAcceptedTicketOfferWithoutDetail;
|
|
19
19
|
availableOffer: factory.unitPriceOffer.IUnitPriceOffer;
|
|
@@ -59,7 +59,7 @@ export declare function createReservation(params: {
|
|
|
59
59
|
additionalTicketText?: string;
|
|
60
60
|
ticketOffer: factory.product.ITicketOffer;
|
|
61
61
|
seatPriceComponent: factory.place.seat.IPriceComponent[];
|
|
62
|
-
acceptedAddOns: factory.
|
|
62
|
+
acceptedAddOns: factory.product.ITicketAddOn[];
|
|
63
63
|
subReservation?: factory.reservation.ISubReservation<factory.reservationType.EventReservation>[];
|
|
64
64
|
programMembershipUsed?: factory.reservation.IProgramMembershipUsed<factory.reservationType.EventReservation>;
|
|
65
65
|
availableOffer: factory.unitPriceOffer.IUnitPriceOffer;
|
|
@@ -49,7 +49,6 @@ function createPointAward(params) {
|
|
|
49
49
|
toLocation: { identifier: pointAwardToLocationIdentifier }
|
|
50
50
|
});
|
|
51
51
|
pointAward = Object.assign(Object.assign({ amount: pointAwardAmount, purpose: { identifier: purposeIdentifier }, toLocation: {
|
|
52
|
-
// ひとまず'Permit'で固定
|
|
53
52
|
typeOf: factory.permit.PermitType.Permit,
|
|
54
53
|
identifier: pointAwardToLocationIdentifier,
|
|
55
54
|
issuedThrough: { id: pointAwardToLocationIssuedThroughId }
|
|
@@ -117,26 +117,14 @@ function addReservations(params) {
|
|
|
117
117
|
event: { id: event.id },
|
|
118
118
|
// 対応アプリケーション条件追加(2023-01-27~)
|
|
119
119
|
store: { id: (_a = params.availableAtOrFrom) === null || _a === void 0 ? void 0 : _a.id },
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
onlyValid: true,
|
|
121
|
+
addSortIndex: false,
|
|
122
|
+
validateOfferRateLimit: true,
|
|
123
|
+
searchAddOns: false // false化(2023-03-02~)
|
|
122
124
|
})(repos);
|
|
123
125
|
ticketOffers = searchEventTicketOffersResult.ticketOffers;
|
|
124
126
|
availableOffers = searchEventTicketOffersResult.unitPriceOffers;
|
|
125
127
|
}
|
|
126
|
-
// 冗長なfindOffersByOfferCatalogId処理を削除(2023-01-26~)
|
|
127
|
-
// let availableOffers: factory.unitPriceOffer.IUnitPriceOffer[] = [];
|
|
128
|
-
// // 興行設定があれば興行のカタログを参照する(2022-08-31~)
|
|
129
|
-
// const eventOffers = <factory.event.screeningEvent.IOffer | undefined>event.offers;
|
|
130
|
-
// if (typeof eventOffers?.itemOffered?.id === 'string') {
|
|
131
|
-
// const eventService = <factory.product.IProduct>await repos.product.findById({ id: eventOffers.itemOffered.id });
|
|
132
|
-
// if (typeof eventService.hasOfferCatalog?.id === 'string') {
|
|
133
|
-
// availableOffers = await repos.offer.findOffersByOfferCatalogId({
|
|
134
|
-
// offerCatalog: { id: eventService.hasOfferCatalog.id }
|
|
135
|
-
// });
|
|
136
|
-
// }
|
|
137
|
-
// } else {
|
|
138
|
-
// throw new factory.errors.NotFound('event.offers.itemOffered.id');
|
|
139
|
-
// }
|
|
140
128
|
const availableSeatOffers = yield searchAvailableSeatOffers({ acceptedOffers, event: { id: event.id } })(repos);
|
|
141
129
|
// 仮予約作成
|
|
142
130
|
const { acceptedOffers4transactionObject, objectSubReservations } = yield createAcceptedOffers4transactionObject({
|
|
@@ -145,6 +133,7 @@ function addReservations(params) {
|
|
|
145
133
|
availableOffers, now,
|
|
146
134
|
event, availableSeatOffers,
|
|
147
135
|
transaction,
|
|
136
|
+
availableAtOrFrom: params.availableAtOrFrom,
|
|
148
137
|
validateAppliesToMovieTicket: params.validateAppliesToMovieTicket
|
|
149
138
|
})(repos);
|
|
150
139
|
// 予約イベント最適化
|
|
@@ -319,8 +308,18 @@ function createReservations4transactionObject(params) {
|
|
|
319
308
|
}
|
|
320
309
|
// 指定されたアドオンがオファーに存在すれば、アドオンの単価仕様作成
|
|
321
310
|
let acceptedAddOns = [];
|
|
311
|
+
let availableAddOns;
|
|
322
312
|
const acceptedAddOnParams = acceptedOffer.addOn;
|
|
323
|
-
|
|
313
|
+
if (Array.isArray(acceptedAddOnParams) && acceptedAddOnParams.length > 0) {
|
|
314
|
+
// アドオンオファー検索(2023-03-02~)
|
|
315
|
+
availableAddOns = yield searchAvailableAddOns({
|
|
316
|
+
ids: acceptedAddOnParams.map((acceptedAddOn) => String(acceptedAddOn.id)),
|
|
317
|
+
project: { id: params.transaction.project.id },
|
|
318
|
+
ticketOffer,
|
|
319
|
+
availableAtOrFrom: params.availableAtOrFrom
|
|
320
|
+
})(repos);
|
|
321
|
+
}
|
|
322
|
+
// availableAddOns = <factory.product.ITicketAddOn[] | undefined>ticketOffer.addOn;
|
|
324
323
|
if (Array.isArray(availableAddOns) && Array.isArray(acceptedAddOnParams)) {
|
|
325
324
|
acceptedAddOns = availableAddOns.filter((availableAddOn) => acceptedAddOnParams.some((acceptedAddOn) => availableAddOn.id === acceptedAddOn.id));
|
|
326
325
|
}
|
|
@@ -350,6 +349,37 @@ function createReservations4transactionObject(params) {
|
|
|
350
349
|
return reservations;
|
|
351
350
|
});
|
|
352
351
|
}
|
|
352
|
+
function searchAvailableAddOns(params) {
|
|
353
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
354
|
+
var _a;
|
|
355
|
+
const availableAddOns = [];
|
|
356
|
+
if (Array.isArray(params.ticketOffer.addOn)) {
|
|
357
|
+
const addOnProductIds = [...new Set(params.ticketOffer.addOn.map((o) => String(o.itemOffered.id)))];
|
|
358
|
+
for (const addOnProductId of addOnProductIds) {
|
|
359
|
+
const { offers, product } = yield OfferService.product.search(Object.assign({ ids: params.ids, project: { id: params.project.id }, itemOffered: { id: addOnProductId }, onlyValid: true, addSortIndex: false }, (typeof ((_a = params.availableAtOrFrom) === null || _a === void 0 ? void 0 : _a.id) === 'string')
|
|
360
|
+
? { availableAt: { id: params.availableAtOrFrom.id } }
|
|
361
|
+
: undefined))(repos);
|
|
362
|
+
availableAddOns.push(...offers.map((o) => {
|
|
363
|
+
const itemOffered4addOn = {
|
|
364
|
+
description: product.description,
|
|
365
|
+
id: product.id,
|
|
366
|
+
name: product.name,
|
|
367
|
+
productID: product.productID,
|
|
368
|
+
typeOf: product.typeOf
|
|
369
|
+
};
|
|
370
|
+
const unitPriceSpec = o.priceSpecification.priceComponent.find((component) => {
|
|
371
|
+
return component.typeOf === factory.priceSpecificationType.UnitPriceSpecification;
|
|
372
|
+
});
|
|
373
|
+
if ((unitPriceSpec === null || unitPriceSpec === void 0 ? void 0 : unitPriceSpec.typeOf) !== factory.priceSpecificationType.UnitPriceSpecification) {
|
|
374
|
+
throw new factory.errors.NotFound('UnitPriceSpecification of an addOn');
|
|
375
|
+
}
|
|
376
|
+
return Object.assign(Object.assign({ alternateName: o.alternateName, availability: o.availability, description: o.description, id: String(o.id), identifier: o.identifier, itemOffered: itemOffered4addOn, name: o.name, priceCurrency: o.priceCurrency, priceSpecification: unitPriceSpec, typeOf: o.typeOf }, (o.validFrom instanceof Date) ? { validFrom: o.validFrom } : undefined), (o.validThrough instanceof Date) ? { validThrough: o.validThrough } : undefined);
|
|
377
|
+
}));
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
return availableAddOns;
|
|
381
|
+
});
|
|
382
|
+
}
|
|
353
383
|
function getAcceptedSeatNumbersAndSeatSections(params) {
|
|
354
384
|
const acceptedSeatNumbers = [];
|
|
355
385
|
const acceptedSeatSections = [];
|
|
@@ -33,4 +33,4 @@ export declare function exportTasks<T extends factory.assetTransactionType>(para
|
|
|
33
33
|
project: ProjectRepo;
|
|
34
34
|
task: TaskRepo;
|
|
35
35
|
assetTransaction: AssetTransactionRepo;
|
|
36
|
-
}) => Promise<(import("@chevre/factory/lib/task/confirmReserveTransaction").ITask | import("@chevre/factory/lib/task").ITask | import("@chevre/factory/lib/task/deleteAssetTransaction").ITask | import("@chevre/factory/lib/task/
|
|
36
|
+
}) => Promise<(import("@chevre/factory/lib/task/confirmReserveTransaction").ITask | import("@chevre/factory/lib/task").ITask | import("@chevre/factory/lib/task/deleteAssetTransaction").ITask | import("@chevre/factory/lib/task/deleteOrder").ITask | import("@chevre/factory/lib/task/deleteTransaction").ITask | import("@chevre/factory/lib/task/sendEmailMessage").ITask | import("@chevre/factory/lib/task/triggerWebhook").ITask | import("@chevre/factory/lib/task/confirmMoneyTransfer").ITask | import("@chevre/factory/lib/task/confirmRegisterService").ITask | import("@chevre/factory/lib/task/confirmPayTransaction").ITask | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/deleteMember").ITask | import("@chevre/factory/lib/task/givePointAward").ITask | import("@chevre/factory/lib/task/orderProgramMembership").ITask | import("@chevre/factory/lib/task/placeOrder").ITask | import("@chevre/factory/lib/task/returnOrder").ITask | import("@chevre/factory/lib/task/returnMoneyTransfer").ITask | import("@chevre/factory/lib/task/returnPayTransaction").ITask | import("@chevre/factory/lib/task/returnPointAward").ITask | import("@chevre/factory/lib/task/returnReserveTransaction").ITask | import("@chevre/factory/lib/task/sendOrder").ITask | import("@chevre/factory/lib/task/voidMoneyTransferTransaction").ITask | import("@chevre/factory/lib/task/voidPayTransaction").ITask | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/voidReserveTransaction").ITask)[] | undefined>;
|
|
@@ -3,14 +3,6 @@ import { MongoRepository as AuthorizationRepo } from '../repo/code';
|
|
|
3
3
|
import * as factory from '../factory';
|
|
4
4
|
export declare type IToken = string;
|
|
5
5
|
export declare type ICode = string;
|
|
6
|
-
/**
|
|
7
|
-
* 承認を削除する
|
|
8
|
-
* 冪等性を確保すること
|
|
9
|
-
*/
|
|
10
|
-
export declare function deleteAuthorization(params: factory.task.IData<factory.taskName.DeleteAuthorization>): (repos: {
|
|
11
|
-
action: ActionRepo;
|
|
12
|
-
authorization: AuthorizationRepo;
|
|
13
|
-
}) => Promise<void>;
|
|
14
6
|
/**
|
|
15
7
|
* コードをトークンに変換する
|
|
16
8
|
*/
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.verifyToken = exports.getToken =
|
|
12
|
+
exports.verifyToken = exports.getToken = void 0;
|
|
13
13
|
/**
|
|
14
14
|
* 承認サービス
|
|
15
15
|
*/
|
|
@@ -17,43 +17,6 @@ const jwt = require("jsonwebtoken");
|
|
|
17
17
|
const code_1 = require("../repo/code");
|
|
18
18
|
const factory = require("../factory");
|
|
19
19
|
const credentials_1 = require("../credentials");
|
|
20
|
-
/**
|
|
21
|
-
* 承認を削除する
|
|
22
|
-
* 冪等性を確保すること
|
|
23
|
-
*/
|
|
24
|
-
function deleteAuthorization(params) {
|
|
25
|
-
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
const authorization = params.object;
|
|
27
|
-
// Deleteアクションを作成(logとしての意味合いも含めて)
|
|
28
|
-
const actionAttributes = {
|
|
29
|
-
typeOf: factory.actionType.DeleteAction,
|
|
30
|
-
project: authorization.project,
|
|
31
|
-
object: authorization,
|
|
32
|
-
agent: authorization.project
|
|
33
|
-
};
|
|
34
|
-
let deleteAuthorizationResult;
|
|
35
|
-
const action = yield repos.action.start(actionAttributes);
|
|
36
|
-
try {
|
|
37
|
-
// 承認削除
|
|
38
|
-
deleteAuthorizationResult = yield repos.authorization.deleteByCode({ code: authorization.code });
|
|
39
|
-
}
|
|
40
|
-
catch (error) {
|
|
41
|
-
// actionにエラー結果を追加
|
|
42
|
-
try {
|
|
43
|
-
const actionError = Object.assign(Object.assign({}, error), { message: error.message, name: error.name });
|
|
44
|
-
yield repos.action.giveUp({ typeOf: action.typeOf, id: action.id, error: actionError });
|
|
45
|
-
}
|
|
46
|
-
catch (__) {
|
|
47
|
-
// 失敗したら仕方ない
|
|
48
|
-
}
|
|
49
|
-
throw error;
|
|
50
|
-
}
|
|
51
|
-
// アクション完了
|
|
52
|
-
const actionResult = { deleteAuthorizationResult };
|
|
53
|
-
yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
exports.deleteAuthorization = deleteAuthorization;
|
|
57
20
|
/**
|
|
58
21
|
* コードをトークンに変換する
|
|
59
22
|
*/
|
|
@@ -88,7 +88,10 @@ function createGivePointAwardStartParams4moneyTransfer(params, transactionNumber
|
|
|
88
88
|
: params.purpose.typeOf,
|
|
89
89
|
fromLocation: agent,
|
|
90
90
|
toLocation,
|
|
91
|
-
pendingTransaction: {
|
|
91
|
+
pendingTransaction: {
|
|
92
|
+
typeOf: factory.account.transactionType.Deposit,
|
|
93
|
+
transactionNumber
|
|
94
|
+
}
|
|
92
95
|
} }, (typeof params.object.identifier === 'string') ? { identifier: params.object.identifier } : undefined);
|
|
93
96
|
}
|
|
94
97
|
/**
|
|
@@ -181,7 +184,10 @@ function processReturnPointAwardByTransactionIdentifier(params) {
|
|
|
181
184
|
fromLocation,
|
|
182
185
|
toLocation: depositTransaction.object.fromLocation,
|
|
183
186
|
description: `[Return Award]${depositTransaction.object.description}`,
|
|
184
|
-
pendingTransaction: {
|
|
187
|
+
pendingTransaction: {
|
|
188
|
+
typeOf: factory.account.transactionType.Withdraw,
|
|
189
|
+
transactionNumber
|
|
190
|
+
},
|
|
185
191
|
force: true
|
|
186
192
|
}
|
|
187
193
|
})(repos);
|
|
@@ -260,7 +266,10 @@ function processReturnPointAwardByTransactionFromLocationIdentifier(params) {
|
|
|
260
266
|
// },
|
|
261
267
|
toLocation,
|
|
262
268
|
description: `[Return Award]${returningTransaction.object.description}`,
|
|
263
|
-
pendingTransaction: {
|
|
269
|
+
pendingTransaction: {
|
|
270
|
+
typeOf: factory.account.transactionType.Transfer,
|
|
271
|
+
transactionNumber
|
|
272
|
+
},
|
|
264
273
|
force: true
|
|
265
274
|
}
|
|
266
275
|
})(repos);
|
|
@@ -456,10 +456,7 @@ function createScreeningEventFromCOA(params) {
|
|
|
456
456
|
identifier: id,
|
|
457
457
|
name: params.superEvent.name,
|
|
458
458
|
eventStatus: factory.eventStatusType.EventScheduled,
|
|
459
|
-
workPerformed: params.superEvent.workPerformed,
|
|
460
459
|
location: {
|
|
461
|
-
// 不要なので廃止(2022-12-19~)
|
|
462
|
-
// project: { typeOf: params.project.typeOf, id: params.project.id },
|
|
463
460
|
typeOf: params.screenRoom.typeOf,
|
|
464
461
|
branchCode: params.screenRoom.branchCode,
|
|
465
462
|
name: params.screenRoom.name
|
|
@@ -28,9 +28,9 @@ function authorize(params) {
|
|
|
28
28
|
id: params.purpose.id
|
|
29
29
|
});
|
|
30
30
|
// 口座取引開始
|
|
31
|
-
let pendingTransaction;
|
|
31
|
+
// let pendingTransaction: factory.action.transfer.moneyTransfer.IPendingTransaction;
|
|
32
32
|
try {
|
|
33
|
-
|
|
33
|
+
yield processAccountTransaction({
|
|
34
34
|
typeOf: params.typeOf,
|
|
35
35
|
identifier: params.identifier,
|
|
36
36
|
transactionNumber: params.transactionNumber,
|
|
@@ -46,13 +46,12 @@ function authorize(params) {
|
|
|
46
46
|
error = (0, errorHandler_1.handlePecorinoError)(error);
|
|
47
47
|
throw error;
|
|
48
48
|
}
|
|
49
|
-
return pendingTransaction;
|
|
49
|
+
// return pendingTransaction;
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
exports.authorize = authorize;
|
|
53
53
|
function processAccountTransaction(params) {
|
|
54
54
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
55
|
-
let pendingTransaction;
|
|
56
55
|
const transaction = params.transaction;
|
|
57
56
|
const agent = createAccountTransactionAgent(params);
|
|
58
57
|
const recipient = createAccountTransactionRecipient(params);
|
|
@@ -75,7 +74,7 @@ function processAccountTransaction(params) {
|
|
|
75
74
|
});
|
|
76
75
|
switch (params.typeOf) {
|
|
77
76
|
case factory.account.transactionType.Deposit:
|
|
78
|
-
|
|
77
|
+
yield processDepositTransaction({
|
|
79
78
|
identifier: params.identifier,
|
|
80
79
|
transactionNumber: params.transactionNumber,
|
|
81
80
|
project: params.project,
|
|
@@ -88,7 +87,7 @@ function processAccountTransaction(params) {
|
|
|
88
87
|
})({ permit: permitService });
|
|
89
88
|
break;
|
|
90
89
|
case factory.account.transactionType.Transfer:
|
|
91
|
-
|
|
90
|
+
yield processTransferTransaction({
|
|
92
91
|
identifier: params.identifier,
|
|
93
92
|
transactionNumber: params.transactionNumber,
|
|
94
93
|
project: params.project,
|
|
@@ -101,7 +100,7 @@ function processAccountTransaction(params) {
|
|
|
101
100
|
})({ permit: permitService });
|
|
102
101
|
break;
|
|
103
102
|
case factory.account.transactionType.Withdraw:
|
|
104
|
-
|
|
103
|
+
yield processWithdrawTransaction({
|
|
105
104
|
identifier: params.identifier,
|
|
106
105
|
transactionNumber: params.transactionNumber,
|
|
107
106
|
project: params.project,
|
|
@@ -116,7 +115,7 @@ function processAccountTransaction(params) {
|
|
|
116
115
|
default:
|
|
117
116
|
throw new factory.errors.Argument('Object', 'At least one of accounts from and to must be specified');
|
|
118
117
|
}
|
|
119
|
-
return pendingTransaction;
|
|
118
|
+
// return pendingTransaction;
|
|
120
119
|
});
|
|
121
120
|
}
|
|
122
121
|
function processDepositTransaction(params) {
|
|
@@ -223,10 +223,11 @@ function validateAcceptedOffers(params) {
|
|
|
223
223
|
// 受け入れたオファーIDだけ取得する(2023-01-26~)
|
|
224
224
|
ids: offerIds,
|
|
225
225
|
event: { id: params.event.id },
|
|
226
|
-
// seller: params.seller,
|
|
227
226
|
store: params.store,
|
|
228
|
-
|
|
229
|
-
|
|
227
|
+
onlyValid: true,
|
|
228
|
+
addSortIndex: false,
|
|
229
|
+
validateOfferRateLimit: true,
|
|
230
|
+
searchAddOns: false // false化(2023-03-02~)
|
|
230
231
|
})(repos);
|
|
231
232
|
// 利用可能なチケットオファーであれば受け入れる
|
|
232
233
|
const acceptedOffers = (Array.isArray(acceptedOffersWithoutDetail))
|
|
@@ -313,9 +314,8 @@ function acceptedOfferWithoutDetail2acceptedOffer(params) {
|
|
|
313
314
|
addOn: (Array.isArray(offerWithoutDetail.addOn))
|
|
314
315
|
? offerWithoutDetail.addOn.map((a) => {
|
|
315
316
|
return {
|
|
316
|
-
// project: offer.project,
|
|
317
317
|
typeOf: factory.offerType.Offer,
|
|
318
|
-
id: a.id,
|
|
318
|
+
id: String(a.id),
|
|
319
319
|
priceCurrency: offer.priceCurrency
|
|
320
320
|
};
|
|
321
321
|
})
|
|
@@ -294,7 +294,7 @@ function coaTicket2offer(params) {
|
|
|
294
294
|
const eligibleMembershipType = (params.ticketResult.flgMember === COA.factory.master.FlgMember.Member
|
|
295
295
|
&& typeof ((_b = params.defaultMembershipType) === null || _b === void 0 ? void 0 : _b.typeOf) === 'string')
|
|
296
296
|
? [{
|
|
297
|
-
project: params.defaultMembershipType.project,
|
|
297
|
+
// project: params.defaultMembershipType.project,
|
|
298
298
|
typeOf: params.defaultMembershipType.typeOf,
|
|
299
299
|
id: params.defaultMembershipType.id,
|
|
300
300
|
codeValue: params.defaultMembershipType.codeValue,
|
|
@@ -13,6 +13,7 @@ interface ISearchEventTicketOffersRepos {
|
|
|
13
13
|
}
|
|
14
14
|
declare type ISearchEventTicketOffersOperation<T> = (repos: ISearchEventTicketOffersRepos) => Promise<T>;
|
|
15
15
|
declare type IAcceptedPaymentMethod = factory.paymentMethod.paymentCard.movieTicket.IMovieTicket;
|
|
16
|
+
declare type ITicketOfferWithSortIndex = factory.product.ITicketOffer;
|
|
16
17
|
/**
|
|
17
18
|
* 興行オファー検索
|
|
18
19
|
*/
|
|
@@ -27,10 +28,6 @@ declare function searchEventTicketOffers(params: {
|
|
|
27
28
|
event: {
|
|
28
29
|
id: string;
|
|
29
30
|
};
|
|
30
|
-
/**
|
|
31
|
-
* どの販売者に対して
|
|
32
|
-
* 不要なので廃止(2023-01-27~)
|
|
33
|
-
*/
|
|
34
31
|
/**
|
|
35
32
|
* どのアプリケーションに対して
|
|
36
33
|
*/
|
|
@@ -40,7 +37,7 @@ declare function searchEventTicketOffers(params: {
|
|
|
40
37
|
/**
|
|
41
38
|
* 有効期間内のみかどうか
|
|
42
39
|
*/
|
|
43
|
-
onlyValid
|
|
40
|
+
onlyValid: boolean;
|
|
44
41
|
/**
|
|
45
42
|
* どの決済方法に対して
|
|
46
43
|
*/
|
|
@@ -74,10 +71,13 @@ declare function searchEventTicketOffers(params: {
|
|
|
74
71
|
*/
|
|
75
72
|
kbnEisyahousiki: string;
|
|
76
73
|
};
|
|
77
|
-
|
|
74
|
+
limit?: number;
|
|
75
|
+
page?: number;
|
|
76
|
+
addSortIndex: boolean;
|
|
78
77
|
validateOfferRateLimit: boolean;
|
|
78
|
+
searchAddOns: boolean;
|
|
79
79
|
}): ISearchEventTicketOffersOperation<{
|
|
80
|
-
ticketOffers:
|
|
80
|
+
ticketOffers: ITicketOfferWithSortIndex[];
|
|
81
81
|
unitPriceOffers: factory.unitPriceOffer.IUnitPriceOffer[];
|
|
82
82
|
}>;
|
|
83
83
|
export { searchEventTicketOffers };
|