@chevre/domain 23.1.0-alpha.9 → 23.1.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/{eventOffer/adminEventOffers.ts → acceptedPaymentMethodOffer/adminAcceptedPaymentMethodOffers.ts} +12 -11
- package/example/src/chevre/actions/checkAcceptPayActions.ts +60 -0
- package/example/src/chevre/assetTransaction/checkPayTransactionsTicketToken.ts +67 -0
- package/example/src/chevre/eventSeries/migrateEventSeriesUnacceptedPaymentMethod.ts +93 -0
- package/example/src/chevre/importEventsFromCOA.ts +5 -5
- package/example/src/chevre/pendingReservation/findEventSeatOffersBySection.ts +46 -0
- package/example/src/chevre/place/checkSectionCount.ts +27 -0
- package/example/src/chevre/place/findSectionsByRoom.ts +50 -0
- package/example/src/chevre/project/unsetProjectSettings.ts +73 -0
- package/example/src/chevre/reIndex.ts +0 -1
- package/example/src/chevre/roles/{addAdminSellerEventIfNotExists.ts → addAdminSellerEventOfferIfNotExists.ts} +1 -1
- package/example/src/chevre/stockHolder/findSeatsBySection.ts +59 -0
- package/example/src/chevre/stockHolder/searchSeats.ts +2 -2
- package/lib/chevre/repo/acceptedPaymentMethod.d.ts +41 -0
- package/lib/chevre/repo/acceptedPaymentMethod.js +180 -0
- package/lib/chevre/repo/authorization.d.ts +3 -2
- package/lib/chevre/repo/authorization.js +13 -5
- package/lib/chevre/repo/event.d.ts +1 -35
- package/lib/chevre/repo/event.js +2 -102
- package/lib/chevre/repo/eventOffer.js +3 -3
- package/lib/chevre/repo/mongoose/schemas/acceptedPaymentMethod.d.ts +10 -0
- package/lib/chevre/repo/mongoose/schemas/acceptedPaymentMethod.js +97 -0
- package/lib/chevre/repo/mongoose/schemas/eventOffer.js +9 -0
- package/lib/chevre/repo/note.js +4 -2
- package/lib/chevre/repo/pendingReservation.js +28 -71
- package/lib/chevre/repo/place/seat.d.ts +24 -0
- package/lib/chevre/repo/place/seat.js +103 -21
- package/lib/chevre/repo/place/section.d.ts +20 -0
- package/lib/chevre/repo/place/section.js +47 -0
- package/lib/chevre/repo/ticket.d.ts +7 -1
- package/lib/chevre/repo/ticket.js +14 -1
- package/lib/chevre/repository.d.ts +5 -0
- package/lib/chevre/repository.js +15 -2
- package/lib/chevre/service/assetTransaction/pay/factory.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/pay/factory.js +8 -3
- package/lib/chevre/service/assetTransaction/pay/validateAcceptedPaymentMethodIfNeeded.d.ts +16 -0
- package/lib/chevre/service/assetTransaction/pay/validateAcceptedPaymentMethodIfNeeded.js +94 -0
- package/lib/chevre/service/assetTransaction/pay.d.ts +6 -1
- package/lib/chevre/service/assetTransaction/pay.js +6 -1
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/fixExtendedEventOffer.d.ts +1 -2
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/fixExtendedEventOffer.js +7 -7
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateIssuedOfferIfExists.d.ts +6 -2
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateIssuedOfferIfExists.js +30 -30
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateMemberTierIfExists.d.ts +0 -1
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateMemberTierIfExists.js +7 -51
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/verifyTicketTokenAsNeeded.js +6 -8
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.d.ts +29 -1
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.js +9 -9
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre/requestedProgramMembershipUsed2permit.js +1 -1
- package/lib/chevre/service/offer/event/issueEventOfferTicket.d.ts +48 -0
- package/lib/chevre/service/offer/event/issueEventOfferTicket.js +123 -0
- package/lib/chevre/service/offer/event.d.ts +2 -1
- package/lib/chevre/service/offer/event.js +3 -1
- package/lib/chevre/service/offer.d.ts +31 -1
- package/lib/chevre/service/offer.js +104 -34
- package/lib/chevre/service/payment/any/authorize/fixTransactionNumber.d.ts +9 -0
- package/lib/chevre/service/payment/any/authorize/fixTransactionNumber.js +22 -11
- package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.d.ts +19 -2
- package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.js +87 -9
- package/lib/chevre/service/payment/any/factory.d.ts +20 -3
- package/lib/chevre/service/payment/any/factory.js +26 -6
- package/lib/chevre/service/payment/any/publishPaymentUrl/fixTransactionNumberOnPublishPaymentUrl.d.ts +4 -0
- package/lib/chevre/service/payment/any/publishPaymentUrl/fixTransactionNumberOnPublishPaymentUrl.js +15 -11
- package/lib/chevre/service/payment/any/verifyTicketTokenAsNeeded.d.ts +6 -3
- package/lib/chevre/service/payment/any/verifyTicketTokenAsNeeded.js +8 -22
- package/lib/chevre/service/payment/any.d.ts +5 -1
- package/lib/chevre/service/payment/any.js +22 -13
- package/lib/chevre/service/payment/factory.js +0 -5
- package/lib/chevre/service/payment/movieTicket/authorize.js +0 -5
- package/lib/chevre/service/task/authorizePayment.js +2 -0
- package/lib/chevre/service/task/publishPaymentUrl.js +4 -0
- package/lib/chevre/service/transaction/placeOrder/confirm/publishCode.js +1 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/validation/factory.d.ts +9 -0
- package/lib/chevre/service/transaction/placeOrder/confirm/validation/factory.js +2 -0
- package/lib/chevre/service/transaction/placeOrder/confirm/validation/validateInvoiceReferencesOrder.d.ts +8 -0
- package/lib/chevre/service/transaction/placeOrder/confirm/validation/validateInvoiceReferencesOrder.js +45 -0
- package/lib/chevre/service/transaction/placeOrder/confirm/validation/validatePrice.d.ts +3 -0
- package/lib/chevre/service/transaction/placeOrder/confirm/validation/validatePrice.js +38 -0
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.d.ts +2 -8
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +5 -35
- package/package.json +3 -3
- package/example/src/chevre/checkReplaceActions.ts +0 -65
- package/example/src/chevre/upsertManyEventsByAdditionalProperty.ts +0 -193
- package/lib/chevre/service/code.d.ts +0 -8
- package/lib/chevre/service/code.js +0 -7
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.issueEventOfferTicket = issueEventOfferTicket;
|
|
13
|
+
const moment = require("moment");
|
|
14
|
+
const factory = require("../../../factory");
|
|
15
|
+
const validateStartRequest_1 = require("../../assetTransaction/reserve/validateStartRequest");
|
|
16
|
+
function createOfferTicket(params) {
|
|
17
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
var _a;
|
|
19
|
+
const { audience, expiresInSeconds, issuedBy, object, validFrom, author, project, instrument } = params;
|
|
20
|
+
const actionAttributes = {
|
|
21
|
+
project: { id: project.id, typeOf: factory.organizationType.Project },
|
|
22
|
+
typeOf: factory.actionType.AuthorizeAction,
|
|
23
|
+
agent: author,
|
|
24
|
+
recipient: author,
|
|
25
|
+
object: [object],
|
|
26
|
+
instrument: {
|
|
27
|
+
typeOf: factory.creativeWorkType.WebApplication,
|
|
28
|
+
id: instrument.id
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
const action = yield repos.action.start(actionAttributes);
|
|
32
|
+
let authorizations;
|
|
33
|
+
try {
|
|
34
|
+
authorizations = yield repos.authorization.issueAuthorization([{
|
|
35
|
+
project: { id: project.id, typeOf: factory.organizationType.Project },
|
|
36
|
+
object,
|
|
37
|
+
validFrom,
|
|
38
|
+
expiresInSeconds,
|
|
39
|
+
author,
|
|
40
|
+
issuedBy,
|
|
41
|
+
audience
|
|
42
|
+
}]);
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
try {
|
|
46
|
+
yield repos.action.giveUp({ typeOf: action.typeOf, id: action.id, error });
|
|
47
|
+
}
|
|
48
|
+
catch (__) {
|
|
49
|
+
// 失敗したら仕方ない
|
|
50
|
+
}
|
|
51
|
+
throw error;
|
|
52
|
+
}
|
|
53
|
+
const result = authorizations.map(({ code, typeOf }) => ({ code, typeOf }));
|
|
54
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: result });
|
|
55
|
+
const ticketToken = (_a = authorizations.shift()) === null || _a === void 0 ? void 0 : _a.code;
|
|
56
|
+
if (typeof ticketToken !== 'string') {
|
|
57
|
+
// 基本的にありえないフロー
|
|
58
|
+
throw new factory.errors.Internal('code not published by an unexpected reason');
|
|
59
|
+
}
|
|
60
|
+
// チケット作成
|
|
61
|
+
yield repos.ticket.issueByTicketToken({
|
|
62
|
+
project: { id: project.id },
|
|
63
|
+
ticketToken,
|
|
64
|
+
issuedBy
|
|
65
|
+
});
|
|
66
|
+
return { ticketToken };
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function issueEventOfferTicket(params) {
|
|
70
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
var _a, _b;
|
|
72
|
+
const { now, audience, eventId, eventOfferId, ticketedOffer, author, project, instrument } = params;
|
|
73
|
+
// 取引は存在するか
|
|
74
|
+
const transaction = yield repos.transaction.projectFieldsInProgressById({ typeOf: factory.transactionType.PlaceOrder, id: audience.id }, ['expires', 'typeOf', 'seller']);
|
|
75
|
+
// イベントは存在するか
|
|
76
|
+
const event = yield repos.event.projectEventFieldsById({ id: eventId }, ['project', 'offers', 'identifier']);
|
|
77
|
+
// 取引番号発行
|
|
78
|
+
// const { transactionNumber } = await transactionNumberRepo.publishByTimestamp({ startDate: now });
|
|
79
|
+
const { seller } = transaction;
|
|
80
|
+
// 承認作成
|
|
81
|
+
const issuedBy = Object.assign({ id: seller.id, typeOf: seller.typeOf }, (typeof seller.name.ja === 'string') ? { name: seller.name.ja } : undefined);
|
|
82
|
+
const validForMemberTierToken = (_a = ticketedOffer === null || ticketedOffer === void 0 ? void 0 : ticketedOffer.validForMemberTier) === null || _a === void 0 ? void 0 : _a.token;
|
|
83
|
+
const validForMemberProgramIdentifier = (_b = ticketedOffer === null || ticketedOffer === void 0 ? void 0 : ticketedOffer.validForMemberTier) === null || _b === void 0 ? void 0 : _b.isTierOf.identifier;
|
|
84
|
+
const authorizationObject = Object.assign(Object.assign(Object.assign({ typeOf: factory.offerType.Offer, itemOffered: {
|
|
85
|
+
typeOf: factory.product.ProductType.EventService,
|
|
86
|
+
serviceOutput: {
|
|
87
|
+
typeOf: factory.reservationType.ReservationPackage,
|
|
88
|
+
reservationFor: { id: eventId }
|
|
89
|
+
}
|
|
90
|
+
} }, (typeof eventOfferId === 'string' && eventOfferId !== '') ? { id: eventOfferId } : undefined), (typeof (ticketedOffer === null || ticketedOffer === void 0 ? void 0 : ticketedOffer.token) === 'string' && ticketedOffer.token !== '')
|
|
91
|
+
? { token: ticketedOffer.token }
|
|
92
|
+
: undefined), (typeof validForMemberTierToken === 'string' && validForMemberTierToken !== ''
|
|
93
|
+
&& typeof validForMemberProgramIdentifier === 'string' && validForMemberProgramIdentifier !== '')
|
|
94
|
+
? {
|
|
95
|
+
validForMemberTier: {
|
|
96
|
+
token: validForMemberTierToken,
|
|
97
|
+
isTierOf: { identifier: validForMemberProgramIdentifier }
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
: undefined);
|
|
101
|
+
// validations(eventId,eventOfferIdentifier,offerToken...)
|
|
102
|
+
yield (0, validateStartRequest_1.validEventOfferByApplicationExists)({
|
|
103
|
+
event,
|
|
104
|
+
now,
|
|
105
|
+
availableAt: { id: instrument.id },
|
|
106
|
+
acceptedEventOffer: authorizationObject,
|
|
107
|
+
numAcceptedOffers: 0 // オファーチケット発行時は予約数を検証しないので0でok
|
|
108
|
+
})(repos);
|
|
109
|
+
const expiresInSeconds = moment(transaction.expires)
|
|
110
|
+
.diff(now, 'seconds');
|
|
111
|
+
const { ticketToken } = yield createOfferTicket({
|
|
112
|
+
object: authorizationObject,
|
|
113
|
+
validFrom: now,
|
|
114
|
+
expiresInSeconds,
|
|
115
|
+
issuedBy,
|
|
116
|
+
audience: { id: transaction.id, typeOf: transaction.typeOf },
|
|
117
|
+
author,
|
|
118
|
+
project,
|
|
119
|
+
instrument
|
|
120
|
+
})(repos);
|
|
121
|
+
return { ticketToken };
|
|
122
|
+
});
|
|
123
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { authorize } from './event/authorize';
|
|
2
2
|
import { importCategoryCodesFromCOA, importFromCOA } from './event/importFromCOA';
|
|
3
|
+
import { issueEventOfferTicket } from './event/issueEventOfferTicket';
|
|
3
4
|
import { searchEventTicketOffers } from './event/searchEventTicketOffers';
|
|
4
5
|
import { searchOfferAppliesToMovieTicket } from './event/searchOfferAppliesToMovieTicket';
|
|
5
6
|
import { searchOfferCatalogItemAvailability } from './event/searchOfferCatalogItemAvailability';
|
|
6
7
|
import { searchOfferCatalogItems } from './event/searchOfferCatalogItems';
|
|
7
8
|
import { voidTransaction } from './event/voidTransaction';
|
|
8
|
-
export { authorize, importCategoryCodesFromCOA, importFromCOA, voidTransaction, searchEventTicketOffers, searchOfferAppliesToMovieTicket, searchOfferCatalogItemAvailability, searchOfferCatalogItems };
|
|
9
|
+
export { authorize, importCategoryCodesFromCOA, importFromCOA, issueEventOfferTicket, voidTransaction, searchEventTicketOffers, searchOfferAppliesToMovieTicket, searchOfferCatalogItemAvailability, searchOfferCatalogItems };
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.searchOfferCatalogItems = exports.searchOfferCatalogItemAvailability = exports.searchOfferAppliesToMovieTicket = exports.searchEventTicketOffers = exports.voidTransaction = exports.importFromCOA = exports.importCategoryCodesFromCOA = exports.authorize = void 0;
|
|
3
|
+
exports.searchOfferCatalogItems = exports.searchOfferCatalogItemAvailability = exports.searchOfferAppliesToMovieTicket = exports.searchEventTicketOffers = exports.voidTransaction = exports.issueEventOfferTicket = exports.importFromCOA = exports.importCategoryCodesFromCOA = exports.authorize = void 0;
|
|
4
4
|
const authorize_1 = require("./event/authorize");
|
|
5
5
|
Object.defineProperty(exports, "authorize", { enumerable: true, get: function () { return authorize_1.authorize; } });
|
|
6
6
|
const importFromCOA_1 = require("./event/importFromCOA");
|
|
7
7
|
Object.defineProperty(exports, "importCategoryCodesFromCOA", { enumerable: true, get: function () { return importFromCOA_1.importCategoryCodesFromCOA; } });
|
|
8
8
|
Object.defineProperty(exports, "importFromCOA", { enumerable: true, get: function () { return importFromCOA_1.importFromCOA; } });
|
|
9
|
+
const issueEventOfferTicket_1 = require("./event/issueEventOfferTicket");
|
|
10
|
+
Object.defineProperty(exports, "issueEventOfferTicket", { enumerable: true, get: function () { return issueEventOfferTicket_1.issueEventOfferTicket; } });
|
|
9
11
|
const searchEventTicketOffers_1 = require("./event/searchEventTicketOffers");
|
|
10
12
|
Object.defineProperty(exports, "searchEventTicketOffers", { enumerable: true, get: function () { return searchEventTicketOffers_1.searchEventTicketOffers; } });
|
|
11
13
|
const searchOfferAppliesToMovieTicket_1 = require("./event/searchOfferAppliesToMovieTicket");
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { EventRepo } from '../repo/event';
|
|
2
2
|
import type { SeatRepo } from '../repo/place/seat';
|
|
3
|
+
import type { SectionRepo } from '../repo/place/section';
|
|
3
4
|
import type { StockHolderRepo } from '../repo/stockHolder';
|
|
4
5
|
import * as factory from '../factory';
|
|
5
6
|
import * as EventOfferService from './offer/event';
|
|
@@ -25,6 +26,11 @@ type ISeatAsEventOffer = Pick<factory.place.seat.IPlaceWithOffer, 'branchCode' |
|
|
|
25
26
|
};
|
|
26
27
|
offers?: Pick<factory.place.seat.IOffer, 'availability'>[];
|
|
27
28
|
};
|
|
29
|
+
type ISeatOfferBySection = Pick<factory.place.seat.IOffer, 'availability'> & {
|
|
30
|
+
itemOffered: {
|
|
31
|
+
branchCode: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
28
34
|
/**
|
|
29
35
|
* イベントに対する座席オファーを検索する
|
|
30
36
|
*/
|
|
@@ -43,9 +49,33 @@ export declare function searchEventSeatOffersWithPaging(params: {
|
|
|
43
49
|
id: string;
|
|
44
50
|
};
|
|
45
51
|
$projection?: factory.place.seat.IProjection;
|
|
46
|
-
options: {
|
|
52
|
+
options: {
|
|
53
|
+
/**
|
|
54
|
+
* 自動的にひとつめのセクションに絞るかどうか
|
|
55
|
+
*/
|
|
56
|
+
useDefaultSection: boolean;
|
|
57
|
+
};
|
|
47
58
|
}): (repos: {
|
|
48
59
|
event: EventRepo;
|
|
49
60
|
stockHolder: StockHolderRepo;
|
|
50
61
|
seat: SeatRepo;
|
|
62
|
+
section: SectionRepo;
|
|
51
63
|
}) => Promise<ISeatAsEventOffer[]>;
|
|
64
|
+
/**
|
|
65
|
+
* セクション指定でイベントに対する座席オファーを検索する
|
|
66
|
+
*/
|
|
67
|
+
export declare function findEventSeatOffersBySection(params: {
|
|
68
|
+
limit: number;
|
|
69
|
+
page: number;
|
|
70
|
+
projectId: string;
|
|
71
|
+
sellerId: string;
|
|
72
|
+
eventId: string;
|
|
73
|
+
/**
|
|
74
|
+
* セクションコード
|
|
75
|
+
*/
|
|
76
|
+
sectionCode: string;
|
|
77
|
+
}): (repos: {
|
|
78
|
+
event: EventRepo;
|
|
79
|
+
stockHolder: StockHolderRepo;
|
|
80
|
+
seat: SeatRepo;
|
|
81
|
+
}) => Promise<ISeatOfferBySection[]>;
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.product = exports.moneyTransfer = exports.eventServiceByCOA = exports.event = void 0;
|
|
13
13
|
exports.addOffers2Seat = addOffers2Seat;
|
|
14
14
|
exports.searchEventSeatOffersWithPaging = searchEventSeatOffersWithPaging;
|
|
15
|
+
exports.findEventSeatOffersBySection = findEventSeatOffersBySection;
|
|
15
16
|
const moment = require("moment");
|
|
16
17
|
const factory = require("../factory");
|
|
17
18
|
const EventOfferService = require("./offer/event");
|
|
@@ -56,32 +57,48 @@ function addOffers2Seat(params) {
|
|
|
56
57
|
/**
|
|
57
58
|
* イベントに対する座席オファーを検索する
|
|
58
59
|
*/
|
|
59
|
-
// tslint:disable-next-line:max-func-body-length
|
|
60
60
|
function searchEventSeatOffersWithPaging(params) {
|
|
61
|
-
// tslint:disable-next-line:max-func-body-length
|
|
62
61
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
63
62
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
64
|
-
|
|
63
|
+
const { useDefaultSection } = params.options;
|
|
65
64
|
let offers = [];
|
|
66
65
|
// optimize(2024-07-18~)
|
|
67
|
-
const event = yield repos.event.projectEventFieldsById({ id: params.event.id }, ['project', 'startDate', 'offers.itemOffered']);
|
|
66
|
+
const event = yield repos.event.projectEventFieldsById({ id: params.event.id }, ['project', 'startDate', 'offers.itemOffered', 'organizer']);
|
|
68
67
|
// 座席指定利用可能かどうか
|
|
69
68
|
const eventOffers = event.offers;
|
|
70
69
|
const reservedSeatsAvailable = ((_b = (_a = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.itemOffered.serviceOutput) === null || _a === void 0 ? void 0 : _a.reservedTicket) === null || _b === void 0 ? void 0 : _b.ticketedSeat) !== undefined;
|
|
71
70
|
if (reservedSeatsAvailable) {
|
|
72
71
|
const roomBranchCode = String((_d = (_c = eventOffers.itemOffered) === null || _c === void 0 ? void 0 : _c.availableChannel) === null || _d === void 0 ? void 0 : _d.serviceLocation.branchCode);
|
|
73
72
|
const movieTheaterBranchCode = String((_f = (_e = eventOffers.itemOffered) === null || _e === void 0 ? void 0 : _e.availableChannel) === null || _f === void 0 ? void 0 : _f.serviceLocation.containedInPlace.branchCode);
|
|
73
|
+
let defaultSectionCode;
|
|
74
|
+
if (useDefaultSection) {
|
|
75
|
+
const defaultSection = (yield repos.section.findSectionsByRoom({
|
|
76
|
+
limit: 1,
|
|
77
|
+
page: 1,
|
|
78
|
+
projectId: event.project.id,
|
|
79
|
+
sellerId: event.organizer.id,
|
|
80
|
+
movieTheaterCode: movieTheaterBranchCode,
|
|
81
|
+
roomCode: roomBranchCode
|
|
82
|
+
})).shift();
|
|
83
|
+
if (defaultSection === undefined) {
|
|
84
|
+
return [];
|
|
85
|
+
}
|
|
86
|
+
defaultSectionCode = defaultSection.branchCode;
|
|
87
|
+
// console.log('searchEventSeatOffersWithPaging:defaultSectionCode:', defaultSectionCode);
|
|
88
|
+
}
|
|
74
89
|
const seats = yield repos.seat.projectSeatsByScreeningRoom(Object.assign(Object.assign({}, params), { project: { id: { $eq: event.project.id } }, screeningRoom: {
|
|
75
90
|
branchCode: { $eq: roomBranchCode },
|
|
76
91
|
containedInPlace: {
|
|
77
92
|
branchCode: { $eq: movieTheaterBranchCode }
|
|
78
93
|
}
|
|
79
94
|
}, containedInPlace: {
|
|
80
|
-
branchCode: {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
:
|
|
84
|
-
|
|
95
|
+
branchCode: Object.assign({}, (typeof defaultSectionCode === 'string')
|
|
96
|
+
? { $eq: defaultSectionCode }
|
|
97
|
+
: {
|
|
98
|
+
$eq: (typeof ((_h = (_g = params.containedInPlace) === null || _g === void 0 ? void 0 : _g.branchCode) === null || _h === void 0 ? void 0 : _h.$eq) === 'string')
|
|
99
|
+
? (_k = (_j = params.containedInPlace) === null || _j === void 0 ? void 0 : _j.branchCode) === null || _k === void 0 ? void 0 : _k.$eq
|
|
100
|
+
: undefined
|
|
101
|
+
})
|
|
85
102
|
}, $projection: Object.assign({}, params.$projection) }));
|
|
86
103
|
if (seats.length > 0) {
|
|
87
104
|
const availabilities = yield repos.stockHolder.searchHolders({
|
|
@@ -98,31 +115,6 @@ function searchEventSeatOffersWithPaging(params) {
|
|
|
98
115
|
};
|
|
99
116
|
})
|
|
100
117
|
});
|
|
101
|
-
// ルームに含まれる座席区分のみ加算料金を検索(2024-08-05~)
|
|
102
|
-
// const uniqueSeatingTypes = await repos.seat.aggregateSeatingTypes({
|
|
103
|
-
// project: { id: { $eq: event.project.id } },
|
|
104
|
-
// containedInPlace: {
|
|
105
|
-
// containedInPlace: {
|
|
106
|
-
// branchCode: { $eq: roomBranchCode },
|
|
107
|
-
// containedInPlace: { branchCode: { $eq: movieTheaterBranchCode } }
|
|
108
|
-
// }
|
|
109
|
-
// }
|
|
110
|
-
// });
|
|
111
|
-
// 座席タイプ価格仕様を検索
|
|
112
|
-
// let priceSpecs: ICategoryCodeChargeSpecification[] = [];
|
|
113
|
-
// if (!excludePriceSpecification) {
|
|
114
|
-
// if (Array.isArray(uniqueSeatingTypes) && uniqueSeatingTypes.length > 0) {
|
|
115
|
-
// priceSpecs =
|
|
116
|
-
// await repos.priceSpecification.search<factory.priceSpecificationType.CategoryCodeChargeSpecification>({
|
|
117
|
-
// project: { id: { $eq: event.project.id } },
|
|
118
|
-
// typeOf: factory.priceSpecificationType.CategoryCodeChargeSpecification,
|
|
119
|
-
// appliesToCategoryCode: {
|
|
120
|
-
// inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.SeatingType } },
|
|
121
|
-
// codeValue: { $in: uniqueSeatingTypes } // ルームに含まれる座席区分のみ加算料金を検索(2024-08-05~)
|
|
122
|
-
// }
|
|
123
|
-
// });
|
|
124
|
-
// }
|
|
125
|
-
// }
|
|
126
118
|
offers = seats.map((seat, index) => {
|
|
127
119
|
return addOffers2Seat({
|
|
128
120
|
seat,
|
|
@@ -137,3 +129,81 @@ function searchEventSeatOffersWithPaging(params) {
|
|
|
137
129
|
return offers;
|
|
138
130
|
});
|
|
139
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* セクション指定でイベントに対する座席オファーを検索する
|
|
134
|
+
*/
|
|
135
|
+
function findEventSeatOffersBySection(params) {
|
|
136
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
137
|
+
var _a, _b, _c, _d, _e, _f;
|
|
138
|
+
const { limit, page, projectId, sellerId, eventId, sectionCode } = params;
|
|
139
|
+
let offers = [];
|
|
140
|
+
const event = (yield repos.event.projectEventFields({
|
|
141
|
+
limit: 1,
|
|
142
|
+
page: 1,
|
|
143
|
+
project: { id: { $eq: projectId } },
|
|
144
|
+
organizer: { id: { $eq: sellerId } },
|
|
145
|
+
id: { $eq: eventId },
|
|
146
|
+
typeOf: factory.eventType.ScreeningEvent
|
|
147
|
+
}, ['startDate', 'offers.itemOffered'])).shift();
|
|
148
|
+
if (event === undefined) {
|
|
149
|
+
throw new factory.errors.NotFound(factory.eventType.ScreeningEvent);
|
|
150
|
+
}
|
|
151
|
+
// 座席指定利用可能かどうか
|
|
152
|
+
const eventOffers = event.offers;
|
|
153
|
+
const reservedSeatsAvailable = ((_b = (_a = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.itemOffered.serviceOutput) === null || _a === void 0 ? void 0 : _a.reservedTicket) === null || _b === void 0 ? void 0 : _b.ticketedSeat) !== undefined;
|
|
154
|
+
if (reservedSeatsAvailable) {
|
|
155
|
+
const roomBranchCode = String((_d = (_c = eventOffers.itemOffered) === null || _c === void 0 ? void 0 : _c.availableChannel) === null || _d === void 0 ? void 0 : _d.serviceLocation.branchCode);
|
|
156
|
+
const movieTheaterBranchCode = String((_f = (_e = eventOffers.itemOffered) === null || _e === void 0 ? void 0 : _e.availableChannel) === null || _f === void 0 ? void 0 : _f.serviceLocation.containedInPlace.branchCode);
|
|
157
|
+
const seats = yield repos.seat.projectSeatsByScreeningRoom({
|
|
158
|
+
limit,
|
|
159
|
+
page,
|
|
160
|
+
project: { id: { $eq: projectId } },
|
|
161
|
+
screeningRoom: {
|
|
162
|
+
branchCode: { $eq: roomBranchCode },
|
|
163
|
+
containedInPlace: {
|
|
164
|
+
branchCode: { $eq: movieTheaterBranchCode }
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
containedInPlace: {
|
|
168
|
+
branchCode: { $eq: sectionCode } // セクション指定
|
|
169
|
+
},
|
|
170
|
+
$projection: {
|
|
171
|
+
'containedInPlace.branchCode': 0,
|
|
172
|
+
'containedInPlace.containedInPlace': 0,
|
|
173
|
+
'containedInPlace.typeOf': 0,
|
|
174
|
+
'containedInPlace.name': 0,
|
|
175
|
+
typeOf: 0,
|
|
176
|
+
additionalProperty: 0,
|
|
177
|
+
seatingType: 0,
|
|
178
|
+
name: 0
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
if (seats.length > 0) {
|
|
182
|
+
const availabilities = yield repos.stockHolder.searchHolders({
|
|
183
|
+
project: { id: projectId },
|
|
184
|
+
eventId,
|
|
185
|
+
startDate: moment(event.startDate)
|
|
186
|
+
.toDate(),
|
|
187
|
+
hasTicketedSeat: true,
|
|
188
|
+
offers: seats.map((s) => {
|
|
189
|
+
return {
|
|
190
|
+
seatNumber: s.branchCode,
|
|
191
|
+
seatSection: sectionCode
|
|
192
|
+
};
|
|
193
|
+
})
|
|
194
|
+
});
|
|
195
|
+
offers = seats.map((seat, index) => {
|
|
196
|
+
return {
|
|
197
|
+
availability: (typeof availabilities[index] === 'string')
|
|
198
|
+
? factory.itemAvailability.OutOfStock // ホルダーが存在すればOutOfStock
|
|
199
|
+
: factory.itemAvailability.InStock,
|
|
200
|
+
itemOffered: {
|
|
201
|
+
branchCode: seat.branchCode
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
return offers;
|
|
208
|
+
});
|
|
209
|
+
}
|
|
@@ -5,6 +5,7 @@ import type { TicketRepo } from '../../../../repo/ticket';
|
|
|
5
5
|
import type { ITransactionInProgress, TransactionRepo } from '../../../../repo/transaction';
|
|
6
6
|
import type { TransactionNumberRepo } from '../../../../repo/transactionNumber';
|
|
7
7
|
import * as PayTransactionService from '../../../assetTransaction/pay';
|
|
8
|
+
import { IInvoiceByTicketToken } from '../factory';
|
|
8
9
|
interface IFixTransactionNumberRepos {
|
|
9
10
|
action: ActionRepo;
|
|
10
11
|
authorization: AuthorizationRepo;
|
|
@@ -27,6 +28,14 @@ declare function fixTransactionNumber(params: {
|
|
|
27
28
|
transactionNumber: string;
|
|
28
29
|
pendingPaymentAgencyTransaction?: PayTransactionService.IPaymentAgencyTransaction;
|
|
29
30
|
creditCard?: factory.action.authorize.paymentMethod.any.ICreditCard;
|
|
31
|
+
/**
|
|
32
|
+
* 承認時に指定のチケット、あるいは、決済採用時に指定のチケット
|
|
33
|
+
*/
|
|
34
|
+
invoiceByTicketToken?: IInvoiceByTicketToken;
|
|
35
|
+
/**
|
|
36
|
+
* 承認時に指定のチケット、あるいは、決済採用時に指定のチケット
|
|
37
|
+
*/
|
|
38
|
+
ticketToken?: string;
|
|
30
39
|
permitOrInvoice?: never;
|
|
31
40
|
id?: never;
|
|
32
41
|
} | {
|
|
@@ -18,13 +18,16 @@ const handlePrePublishedPaymentMethodIdOnAuthorizing_1 = require("./handlePrePub
|
|
|
18
18
|
*/
|
|
19
19
|
function fixTransactionNumber(params) {
|
|
20
20
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
var _a, _b, _c, _d, _e, _f;
|
|
21
22
|
const { paymentServiceType, transaction, object } = params;
|
|
22
23
|
// 取引番号生成
|
|
23
24
|
let transactionNumber;
|
|
24
25
|
let pendingPaymentAgencyTransaction;
|
|
25
26
|
let creditCard = object.creditCard;
|
|
27
|
+
let invoiceByTicketToken;
|
|
28
|
+
let ticketToken;
|
|
26
29
|
// ticketTokenを解釈(2024-08-13~)
|
|
27
|
-
const {
|
|
30
|
+
const { verifyPaymentMethodTicketResult } = yield (0, verifyTicketTokenAsNeeded_1.verifyTicketTokenAsNeeded)({
|
|
28
31
|
project: { id: transaction.project.id },
|
|
29
32
|
object: object,
|
|
30
33
|
paymentServiceType,
|
|
@@ -34,18 +37,21 @@ function fixTransactionNumber(params) {
|
|
|
34
37
|
* ticketTokenによって指定された決済方法ID
|
|
35
38
|
*/
|
|
36
39
|
let paymentMethodIdByTicketToken;
|
|
37
|
-
if ((
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
if (((_a = verifyPaymentMethodTicketResult === null || verifyPaymentMethodTicketResult === void 0 ? void 0 : verifyPaymentMethodTicketResult.invoiceByTicketToken) === null || _a === void 0 ? void 0 : _a.typeOf) === factory.permit.PermitType.Permit) {
|
|
41
|
+
throw new factory.errors.Argument('ticketToken', `typeOfGood.typeOf ${(_b = verifyPaymentMethodTicketResult === null || verifyPaymentMethodTicketResult === void 0 ? void 0 : verifyPaymentMethodTicketResult.invoiceByTicketToken) === null || _b === void 0 ? void 0 : _b.typeOf} discontinued`);
|
|
42
|
+
// paymentMethodIdByTicketToken = permitOrInvoice?.identifier;
|
|
43
|
+
// if (typeof paymentMethodIdByTicketToken === 'string') {
|
|
44
|
+
// transactionNumber = paymentMethodIdByTicketToken; // メンバーシップ指定の場合、取引番号に適用(2024-08-13~)
|
|
45
|
+
// }
|
|
42
46
|
}
|
|
43
|
-
else if ((
|
|
47
|
+
else if (((_c = verifyPaymentMethodTicketResult === null || verifyPaymentMethodTicketResult === void 0 ? void 0 : verifyPaymentMethodTicketResult.invoiceByTicketToken) === null || _c === void 0 ? void 0 : _c.typeOf) === 'Invoice') {
|
|
44
48
|
// support paymentServiceType.MovieTicket(2024-11-23~)
|
|
45
|
-
if (typeof (
|
|
46
|
-
paymentMethodIdByTicketToken =
|
|
49
|
+
if (typeof ((_d = verifyPaymentMethodTicketResult.invoiceByTicketToken) === null || _d === void 0 ? void 0 : _d.paymentMethodId) === 'string') {
|
|
50
|
+
paymentMethodIdByTicketToken = (_e = verifyPaymentMethodTicketResult.invoiceByTicketToken) === null || _e === void 0 ? void 0 : _e.paymentMethodId;
|
|
47
51
|
if (typeof paymentMethodIdByTicketToken === 'string') {
|
|
48
52
|
transactionNumber = paymentMethodIdByTicketToken;
|
|
53
|
+
invoiceByTicketToken = verifyPaymentMethodTicketResult.invoiceByTicketToken;
|
|
54
|
+
ticketToken = verifyPaymentMethodTicketResult.ticketToken;
|
|
49
55
|
}
|
|
50
56
|
}
|
|
51
57
|
}
|
|
@@ -63,14 +69,18 @@ function fixTransactionNumber(params) {
|
|
|
63
69
|
transaction
|
|
64
70
|
})(repos);
|
|
65
71
|
if (existingCompletedAuthorizeAction !== undefined) {
|
|
72
|
+
// 既に承認済であれば何もしない
|
|
66
73
|
return { id: existingCompletedAuthorizeAction.id };
|
|
67
74
|
}
|
|
68
75
|
else if (authorizeParams !== undefined) {
|
|
69
76
|
// creditCardを決済URL発行時の情報で上書き(2024-01-08~)
|
|
70
|
-
// creditCard = authorizeParams.paymentMethodByTransaction.paymentMethod?.creditCard;
|
|
71
77
|
creditCard = authorizeParams.creditCard;
|
|
72
78
|
transactionNumber = object.paymentMethodId;
|
|
73
79
|
pendingPaymentAgencyTransaction = authorizeParams.pendingPaymentAgencyTransaction;
|
|
80
|
+
if (typeof ((_f = authorizeParams.acceptAction2ticketResult) === null || _f === void 0 ? void 0 : _f.ticketToken) === 'string') {
|
|
81
|
+
invoiceByTicketToken = authorizeParams.acceptAction2ticketResult.invoiceByTicketToken;
|
|
82
|
+
ticketToken = authorizeParams.acceptAction2ticketResult.ticketToken;
|
|
83
|
+
}
|
|
74
84
|
}
|
|
75
85
|
else {
|
|
76
86
|
throw new factory.errors.NotImplemented('pendingPaymentAgencyTransaction required on paymentMethodId specified');
|
|
@@ -81,7 +91,8 @@ function fixTransactionNumber(params) {
|
|
|
81
91
|
const publishTransactionNumberResult = yield repos.transactionNumber.publishByTimestamp({ startDate: new Date() });
|
|
82
92
|
transactionNumber = publishTransactionNumberResult.transactionNumber;
|
|
83
93
|
}
|
|
84
|
-
return Object.assign(Object.assign({ transactionNumber
|
|
94
|
+
return Object.assign(Object.assign(Object.assign({ transactionNumber,
|
|
95
|
+
ticketToken }, (pendingPaymentAgencyTransaction !== undefined) ? { pendingPaymentAgencyTransaction } : undefined), (creditCard !== undefined) ? { creditCard } : undefined), (invoiceByTicketToken !== undefined) ? { invoiceByTicketToken } : undefined
|
|
85
96
|
// ...(permitOrInvoice !== undefined) ? { permitOrInvoice } : undefined
|
|
86
97
|
);
|
|
87
98
|
});
|
package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.d.ts
CHANGED
|
@@ -1,23 +1,40 @@
|
|
|
1
1
|
import * as factory from '../../../../factory';
|
|
2
2
|
import type { ActionRepo } from '../../../../repo/action';
|
|
3
|
+
import type { AuthorizationRepo } from '../../../../repo/authorization';
|
|
4
|
+
import type { TicketRepo } from '../../../../repo/ticket';
|
|
3
5
|
import type { ITransactionInProgress, TransactionRepo } from '../../../../repo/transaction';
|
|
4
6
|
import * as PayTransactionService from '../../../assetTransaction/pay';
|
|
7
|
+
import type { IInvoiceByTicketToken } from '../factory';
|
|
5
8
|
type IObjectWithoutDetail = factory.action.authorize.paymentMethod.any.IObjectWithoutDetail;
|
|
9
|
+
interface IAcceptAction2ticketResult {
|
|
10
|
+
invoiceByTicketToken: IInvoiceByTicketToken;
|
|
11
|
+
ticketToken: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* 決済承認前の決済採用アクションを参照する
|
|
15
|
+
*/
|
|
6
16
|
declare function handlePrePublishedPaymentMethodIdOnAuthorizing(params: {
|
|
7
|
-
object: Pick<IObjectWithoutDetail, 'amount' | 'issuedThrough' | 'paymentMethod'>;
|
|
17
|
+
object: Pick<IObjectWithoutDetail, 'amount' | 'issuedThrough' | 'paymentMethod' | 'referencesOrder'>;
|
|
8
18
|
prePublishedPaymentMethodId: string;
|
|
9
19
|
transaction: Pick<ITransactionInProgress<factory.transactionType.PlaceOrder>, 'agent' | 'expires' | 'id' | 'typeOf' | 'project' | 'seller'>;
|
|
10
20
|
}): (repos: {
|
|
11
21
|
action: ActionRepo;
|
|
22
|
+
authorization: AuthorizationRepo;
|
|
23
|
+
ticket: TicketRepo;
|
|
12
24
|
transaction: TransactionRepo;
|
|
13
25
|
}) => Promise<{
|
|
14
26
|
authorizeParams?: {
|
|
15
27
|
creditCard: factory.action.authorize.paymentMethod.any.ICreditCard;
|
|
16
28
|
paymentMethodByTransaction: factory.transaction.placeOrder.IPaymentMethodByPaymentUrl;
|
|
17
29
|
pendingPaymentAgencyTransaction: PayTransactionService.IPaymentAgencyTransaction;
|
|
30
|
+
acceptAction2ticketResult?: IAcceptAction2ticketResult;
|
|
18
31
|
};
|
|
19
|
-
existingCompletedAuthorizeAction?:
|
|
32
|
+
existingCompletedAuthorizeAction?: never;
|
|
33
|
+
} | {
|
|
34
|
+
existingCompletedAuthorizeAction: {
|
|
20
35
|
id: string;
|
|
21
36
|
};
|
|
37
|
+
authorizeParams?: never;
|
|
38
|
+
acceptAction2ticketResult?: never;
|
|
22
39
|
}>;
|
|
23
40
|
export { handlePrePublishedPaymentMethodIdOnAuthorizing };
|