@chevre/domain 23.1.0-alpha.8 → 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/assetTransaction/processReserve.ts +7 -3
- package/example/src/chevre/authorizeEventServiceOffer.ts +6 -5
- package/example/src/chevre/eventSeries/migrateEventSeriesUnacceptedPaymentMethod.ts +93 -0
- package/example/src/chevre/importEventsFromCOA.ts +5 -5
- package/example/src/chevre/member/migrateMemberIdentifier.ts +20 -15
- 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 +1 -2
- 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 +48 -35
- package/lib/chevre/repo/mongoose/schemas/member.js +10 -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/start.d.ts +4 -0
- package/lib/chevre/service/assetTransaction/reserve/start.js +4 -1
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/fixExtendedEventOffer.d.ts +2 -2
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/fixExtendedEventOffer.js +8 -8
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateIssuedOfferIfExists.d.ts +7 -2
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateIssuedOfferIfExists.js +32 -32
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateMemberTierIfExists.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateMemberTierIfExists.js +10 -54
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/verifyTicketTokenAsNeeded.d.ts +23 -0
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/verifyTicketTokenAsNeeded.js +62 -0
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.d.ts +34 -1
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.js +21 -9
- package/lib/chevre/service/offer/event/authorize/factory.d.ts +0 -4
- package/lib/chevre/service/offer/event/authorize/factory.js +2 -5
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre/requestedProgramMembershipUsed2permit.js +1 -1
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +1 -0
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.js +2 -7
- package/lib/chevre/service/offer/event/authorize.d.ts +1 -0
- package/lib/chevre/service/offer/event/authorize.js +7 -7
- 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,16 @@
|
|
|
1
|
+
import * as factory from '../../../factory';
|
|
2
|
+
import type { EventRepo } from '../../../repo/event';
|
|
3
|
+
import type { EventSeriesRepo } from '../../../repo/eventSeries';
|
|
4
|
+
/**
|
|
5
|
+
* 必要あらば関連リソースの対応決済方法を検証する
|
|
6
|
+
*/
|
|
7
|
+
export declare function validateAcceptedPaymentMethodIfNeeded(params: Pick<factory.assetTransaction.pay.IStartParamsWithoutDetail, 'object'> | {
|
|
8
|
+
object: factory.action.accept.pay.IPayObject & {
|
|
9
|
+
paymentMethod: factory.action.accept.pay.IPaymentMethod & {
|
|
10
|
+
movieTickets: never;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
}): (repos: {
|
|
14
|
+
event: EventRepo;
|
|
15
|
+
eventSeries: EventSeriesRepo;
|
|
16
|
+
}) => Promise<void>;
|
|
@@ -0,0 +1,94 @@
|
|
|
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.validateAcceptedPaymentMethodIfNeeded = validateAcceptedPaymentMethodIfNeeded;
|
|
13
|
+
/**
|
|
14
|
+
* ペイメントカード決済取引バリデーション
|
|
15
|
+
*/
|
|
16
|
+
const createDebug = require("debug");
|
|
17
|
+
const factory = require("../../../factory");
|
|
18
|
+
const debug = createDebug('chevre-domain:service:assetTransaction:pay');
|
|
19
|
+
/**
|
|
20
|
+
* 必要あらば関連リソースの対応決済方法を検証する
|
|
21
|
+
*/
|
|
22
|
+
function validateAcceptedPaymentMethodIfNeeded(params) {
|
|
23
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
var _a, _b;
|
|
25
|
+
/**
|
|
26
|
+
* 検証対象のイベントIDリスト
|
|
27
|
+
*/
|
|
28
|
+
let checkingEventIds;
|
|
29
|
+
const paymentServiceType = params.object.typeOf;
|
|
30
|
+
// CreditCard or MovieTicket?
|
|
31
|
+
if (paymentServiceType === factory.service.paymentService.PaymentServiceType.CreditCard) {
|
|
32
|
+
// クレジットカードIF決済の場合、objectに注文アイテム指定があればそちらで検証する
|
|
33
|
+
const orderedItems = (_a = params.object.serviceOutput) === null || _a === void 0 ? void 0 : _a.referencesOrder.orderedItem;
|
|
34
|
+
if (Array.isArray(orderedItems)) {
|
|
35
|
+
checkingEventIds = orderedItems.map((orderedItem) => orderedItem.orderedItem.serviceOutput.reservationFor.id);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
else if (paymentServiceType === factory.service.paymentService.PaymentServiceType.MovieTicket) {
|
|
39
|
+
const movieTickets = params.object.paymentMethod.movieTickets;
|
|
40
|
+
if (Array.isArray(movieTickets)) {
|
|
41
|
+
checkingEventIds = [...new Set(movieTickets.map((ticket) => ticket.serviceOutput.reservationFor.id))];
|
|
42
|
+
// イベントがひとつに特定されているかどうか確認
|
|
43
|
+
if (checkingEventIds.length !== 1) {
|
|
44
|
+
throw new factory.errors.Argument('movieTickets', 'Number of events must be 1');
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
// 対面決済ではひとまず対応決済方法検証なし
|
|
50
|
+
}
|
|
51
|
+
debug('validateAcceptedPaymentMethodIfNeeded: checkingEventIds:', checkingEventIds, paymentServiceType);
|
|
52
|
+
if (Array.isArray(checkingEventIds)) {
|
|
53
|
+
// 検証対象のイベントIDが存在する場合、その数が0ということはありえない
|
|
54
|
+
if (checkingEventIds.length === 0) {
|
|
55
|
+
throw new factory.errors.ArgumentNull('object.serviceOutput.referencesOrder.orderedItem');
|
|
56
|
+
}
|
|
57
|
+
// 指定された全イベントについて、施設コンテンツの対応決済方法を検証する
|
|
58
|
+
const eventSeriesIds = (yield repos.event.projectEventFields({
|
|
59
|
+
limit: checkingEventIds.length,
|
|
60
|
+
page: 1,
|
|
61
|
+
id: { $in: checkingEventIds },
|
|
62
|
+
typeOf: factory.eventType.ScreeningEvent
|
|
63
|
+
}, ['superEvent'])).map((event) => event.superEvent.id);
|
|
64
|
+
if (eventSeriesIds.length !== checkingEventIds.length) {
|
|
65
|
+
throw new factory.errors.NotFound(factory.eventType.ScreeningEvent);
|
|
66
|
+
}
|
|
67
|
+
const uniqueEventSeriesIds = [...new Set(eventSeriesIds)];
|
|
68
|
+
debug('validateAcceptedPaymentMethodIfNeeded: eventSeries with AggregateOffer?', uniqueEventSeriesIds);
|
|
69
|
+
for (const eventSeriesId of uniqueEventSeriesIds) {
|
|
70
|
+
const eventSeries = (yield repos.eventSeries.projectEventSeriesFields({
|
|
71
|
+
limit: 1,
|
|
72
|
+
page: 1,
|
|
73
|
+
id: { $eq: eventSeriesId }
|
|
74
|
+
}, ['offers'])).shift();
|
|
75
|
+
if (eventSeries === undefined) {
|
|
76
|
+
throw new factory.errors.NotFound(factory.eventType.ScreeningEventSeries);
|
|
77
|
+
}
|
|
78
|
+
if (((_b = eventSeries.offers) === null || _b === void 0 ? void 0 : _b.typeOf) === factory.offerType.AggregateOffer) {
|
|
79
|
+
// 対応決済方法オファーIDの指定が必要
|
|
80
|
+
throw new factory.errors.ArgumentNull('acceptedPaymentMethodOfferId');
|
|
81
|
+
// if (paymentAccepted !== true) {
|
|
82
|
+
// throw new factory.errors.Argument('recipient', `payment not accepted [${paymentMethodType}]`);
|
|
83
|
+
// }
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
// 集約オファーでなければ検証の必要なし
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
// 関連注文の指定がなければ検証の必要なし
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
@@ -10,6 +10,7 @@ import type { ActionRepo } from '../../repo/action';
|
|
|
10
10
|
import type { AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
11
11
|
import type { CredentialsRepo } from '../../repo/credentials';
|
|
12
12
|
import type { EventRepo } from '../../repo/event';
|
|
13
|
+
import type { EventSeriesRepo } from '../../repo/eventSeries';
|
|
13
14
|
import type { OrderRepo } from '../../repo/order';
|
|
14
15
|
import type { PaymentServiceRepo } from '../../repo/paymentService';
|
|
15
16
|
import type { PaymentServiceProviderRepo } from '../../repo/paymentServiceProvider';
|
|
@@ -24,6 +25,7 @@ export interface IStartOperationRepos {
|
|
|
24
25
|
action: ActionRepo;
|
|
25
26
|
credentials: CredentialsRepo;
|
|
26
27
|
event: EventRepo;
|
|
28
|
+
eventSeries: EventSeriesRepo;
|
|
27
29
|
paymentAccepted: SellerPaymentAcceptedRepo;
|
|
28
30
|
paymentService: PaymentServiceRepo;
|
|
29
31
|
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
@@ -61,6 +63,8 @@ export type ICheckOperation<T> = (repos: {
|
|
|
61
63
|
}, settings: Settings) => Promise<T>;
|
|
62
64
|
export type IPublishPaymentUrlOperation<T> = (repos: {
|
|
63
65
|
action: ActionRepo;
|
|
66
|
+
event: EventRepo;
|
|
67
|
+
eventSeries: EventSeriesRepo;
|
|
64
68
|
paymentAccepted: SellerPaymentAcceptedRepo;
|
|
65
69
|
paymentService: PaymentServiceRepo;
|
|
66
70
|
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
@@ -78,6 +82,7 @@ export declare function publishPaymentUrl(params: Pick<factory.assetTransaction.
|
|
|
78
82
|
* add identifier for an unique index(2025-02-25~)
|
|
79
83
|
*/
|
|
80
84
|
identifier?: string;
|
|
85
|
+
instrument: factory.action.accept.pay.IInstrument[];
|
|
81
86
|
}, options: {
|
|
82
87
|
purposeAsTransaction: {
|
|
83
88
|
id: string;
|
|
@@ -104,7 +109,7 @@ export import IPaymentAgencyTransaction = CreditCardPayment.IPaymentAgencyTransa
|
|
|
104
109
|
* 取引開始
|
|
105
110
|
*/
|
|
106
111
|
export declare function start(params: factory.assetTransaction.pay.IStartParamsWithoutDetail & {
|
|
107
|
-
instrument: factory.action.trade.pay.
|
|
112
|
+
instrument: factory.action.trade.pay.IPlaceOrderRelatedInstrument[];
|
|
108
113
|
}, options: {
|
|
109
114
|
pendingPaymentAgencyTransaction?: CreditCardPayment.IPaymentAgencyTransaction;
|
|
110
115
|
/**
|
|
@@ -24,6 +24,7 @@ const PaymentCardPayment = require("../payment/paymentCard");
|
|
|
24
24
|
const fixInformAction_1 = require("./fixInformAction");
|
|
25
25
|
const validation_1 = require("./pay/account/validation");
|
|
26
26
|
const factory_1 = require("./pay/factory");
|
|
27
|
+
const validateAcceptedPaymentMethodIfNeeded_1 = require("./pay/validateAcceptedPaymentMethodIfNeeded");
|
|
27
28
|
function publishPaymentUrlResult2recipe(params) {
|
|
28
29
|
const { project, result } = params;
|
|
29
30
|
return {
|
|
@@ -76,6 +77,8 @@ function publishPaymentUrl(params, options) {
|
|
|
76
77
|
throw new factory.errors.ArgumentNull('transactionNumber');
|
|
77
78
|
}
|
|
78
79
|
yield validateSeller(params)(repos);
|
|
80
|
+
// リソースの対応決済方法検証(2025-12-02~)
|
|
81
|
+
yield (0, validateAcceptedPaymentMethodIfNeeded_1.validateAcceptedPaymentMethodIfNeeded)(params)(repos);
|
|
79
82
|
// 決済サービス確認
|
|
80
83
|
const paymentServiceId = getPaymentServiceId(params);
|
|
81
84
|
// 決済受入アクション生成(2024-03-28~)
|
|
@@ -84,7 +87,7 @@ function publishPaymentUrl(params, options) {
|
|
|
84
87
|
object: params.object,
|
|
85
88
|
transactionNumber,
|
|
86
89
|
typeOf: params.typeOf
|
|
87
|
-
}, purpose: { typeOf: factory.transactionType.PlaceOrder, id: options.purposeAsTransaction.id } }, (typeof taskId === 'string')
|
|
90
|
+
}, purpose: { typeOf: factory.transactionType.PlaceOrder, id: options.purposeAsTransaction.id }, instrument: (Array.isArray(params.instrument)) ? params.instrument : [] }, (typeof taskId === 'string')
|
|
88
91
|
? { sameAs: { id: taskId, typeOf: 'Task' } } // タスク関連付け(2024-05-22~)
|
|
89
92
|
: undefined), (typeof ((_d = params.location) === null || _d === void 0 ? void 0 : _d.typeOf) === 'string')
|
|
90
93
|
? { location: params.location }
|
|
@@ -186,6 +189,8 @@ function start(params, options) {
|
|
|
186
189
|
throw new factory.errors.ArgumentNull('transactionNumber');
|
|
187
190
|
}
|
|
188
191
|
yield validateSeller(params)(repos);
|
|
192
|
+
// リソースの対応決済方法検証(2025-12-02~)
|
|
193
|
+
yield (0, validateAcceptedPaymentMethodIfNeeded_1.validateAcceptedPaymentMethodIfNeeded)(params)(repos);
|
|
189
194
|
// 決済サービス確認
|
|
190
195
|
const paymentServiceType = (_b = params.object) === null || _b === void 0 ? void 0 : _b.typeOf;
|
|
191
196
|
const paymentService = yield fixPaymentService(params)(repos);
|
|
@@ -2,6 +2,7 @@ import * as factory from '../../../factory';
|
|
|
2
2
|
import { Settings } from '../../../settings';
|
|
3
3
|
import type { AdvanceBookingRequirementRepo } from '../../../repo/advanceBookingRequirement';
|
|
4
4
|
import type { AssetTransactionRepo } from '../../../repo/assetTransaction';
|
|
5
|
+
import type { AuthorizationRepo } from '../../../repo/authorization';
|
|
5
6
|
import type { EventRepo } from '../../../repo/event';
|
|
6
7
|
import type { EventOfferRepo } from '../../../repo/eventOffer';
|
|
7
8
|
import type { EventSeriesRepo } from '../../../repo/eventSeries';
|
|
@@ -21,8 +22,10 @@ import type { OfferRateLimitRepo } from '../../../repo/rateLimit/offer';
|
|
|
21
22
|
import type { SettingRepo } from '../../../repo/setting';
|
|
22
23
|
import type { StockHolderRepo } from '../../../repo/stockHolder';
|
|
23
24
|
import type { TaskRepo } from '../../../repo/task';
|
|
25
|
+
import type { TicketRepo } from '../../../repo/ticket';
|
|
24
26
|
interface IStartOperationRepos {
|
|
25
27
|
advanceBookingRequirement: AdvanceBookingRequirementRepo;
|
|
28
|
+
authorization: AuthorizationRepo;
|
|
26
29
|
stockHolder: StockHolderRepo;
|
|
27
30
|
event: EventRepo;
|
|
28
31
|
eventOffer: EventOfferRepo;
|
|
@@ -42,6 +45,7 @@ interface IStartOperationRepos {
|
|
|
42
45
|
seat: SeatRepo;
|
|
43
46
|
setting: SettingRepo;
|
|
44
47
|
task: TaskRepo;
|
|
48
|
+
ticket: TicketRepo;
|
|
45
49
|
assetTransaction: AssetTransactionRepo;
|
|
46
50
|
}
|
|
47
51
|
type IStartOperation<T> = (repos: IStartOperationRepos, settings: Settings) => Promise<T>;
|
|
@@ -41,17 +41,20 @@ function start(params, options) {
|
|
|
41
41
|
// validationを承認アクション開始前から移行(2023-01-27~)
|
|
42
42
|
yield (0, validateStartRequest_1.validateStartRequest)({
|
|
43
43
|
object: params.object,
|
|
44
|
+
instrument: params.instrument,
|
|
44
45
|
event,
|
|
45
46
|
validateEventOfferPeriod: params.validateEventOfferPeriod,
|
|
46
47
|
validateEvent: params.validateEvent,
|
|
47
48
|
now,
|
|
48
49
|
store: { id: (_a = params.availableAtOrFrom) === null || _a === void 0 ? void 0 : _a.id }
|
|
49
50
|
})({
|
|
51
|
+
authorization: repos.authorization,
|
|
50
52
|
eventOffer: repos.eventOffer,
|
|
51
53
|
issuer: repos.issuer,
|
|
52
54
|
member: repos.member,
|
|
53
55
|
memberProgram: repos.memberProgram,
|
|
54
|
-
productOffer: repos.productOffer
|
|
56
|
+
productOffer: repos.productOffer,
|
|
57
|
+
ticket: repos.ticket
|
|
55
58
|
});
|
|
56
59
|
// objectに必要な情報をそろえる
|
|
57
60
|
const { acceptedOffers4transactionObject, objectSubReservations } = yield createObjectAttributes({
|
package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/fixExtendedEventOffer.d.ts
CHANGED
|
@@ -14,9 +14,9 @@ declare function fixExtendedEventOffer(params: {
|
|
|
14
14
|
*/
|
|
15
15
|
id: string;
|
|
16
16
|
};
|
|
17
|
-
|
|
17
|
+
acceptedEventOffer?: factory.authorization.IOfferAsObject;
|
|
18
18
|
}): (repos: {
|
|
19
19
|
eventOffer: EventOfferRepo;
|
|
20
20
|
member: MemberRepo;
|
|
21
|
-
}) => Promise<Pick<factory.eventOffer.IEventOffer, "identifier" | "itemOffered" | "typeOf" | "offeredBy" | "validFrom" | "validThrough">>;
|
|
21
|
+
}) => Promise<Pick<factory.eventOffer.IEventOffer, "identifier" | "itemOffered" | "typeOf" | "offeredBy" | "validFrom" | "validThrough" | "id">>;
|
|
22
22
|
export { fixExtendedEventOffer };
|
package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/fixExtendedEventOffer.js
CHANGED
|
@@ -17,13 +17,13 @@ const factory = require("../../../../factory");
|
|
|
17
17
|
*/
|
|
18
18
|
function fixExtendedEventOffer(params) {
|
|
19
19
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
var _a
|
|
20
|
+
var _a;
|
|
21
21
|
const { event, availableAt } = params;
|
|
22
22
|
const acceptedDate = moment(params.now);
|
|
23
23
|
// リクエストによるオファーコード指定が必須
|
|
24
|
-
const
|
|
25
|
-
if (typeof
|
|
26
|
-
throw new factory.errors.ArgumentNull('
|
|
24
|
+
const eventOfferIdMustBe = (_a = params.acceptedEventOffer) === null || _a === void 0 ? void 0 : _a.id;
|
|
25
|
+
if (typeof eventOfferIdMustBe !== 'string' || eventOfferIdMustBe === '') {
|
|
26
|
+
throw new factory.errors.ArgumentNull('ticket as instrument');
|
|
27
27
|
}
|
|
28
28
|
// アプリケーションIDからアプリケーションコードを参照
|
|
29
29
|
const existingCustomerMember = (yield repos.member.searchCustomerMembers({
|
|
@@ -37,8 +37,7 @@ function fixExtendedEventOffer(params) {
|
|
|
37
37
|
if (existingCustomerMember === undefined) {
|
|
38
38
|
throw new factory.errors.NotFound(`Member: ${availableAt.id}`);
|
|
39
39
|
}
|
|
40
|
-
//
|
|
41
|
-
console.log('existingCustomerMember found:', JSON.stringify(existingCustomerMember));
|
|
40
|
+
// console.log('existingCustomerMember found:', JSON.stringify(existingCustomerMember));
|
|
42
41
|
const applicationIdentifier = existingCustomerMember.member.identifier;
|
|
43
42
|
if (typeof applicationIdentifier !== 'string') {
|
|
44
43
|
throw new factory.errors.NotFound(`member.identifier of ${availableAt.id}`);
|
|
@@ -51,11 +50,12 @@ function fixExtendedEventOffer(params) {
|
|
|
51
50
|
validFrom: { $lte: acceptedDate.toDate() },
|
|
52
51
|
validThrough: { $gte: acceptedDate.toDate() },
|
|
53
52
|
itemOffered: { id: { $eq: event.id } }, // 対象イベント
|
|
54
|
-
|
|
53
|
+
id: { $eq: eventOfferIdMustBe }, // オファーID
|
|
54
|
+
// identifier: { $eq: eventOfferIdentifierMustBe }, // オファーコード
|
|
55
55
|
availableAtOrFrom: { identifier: { $eq: applicationIdentifier } } // アプリケーションコード
|
|
56
56
|
}, ['identifier', 'itemOffered', 'offeredBy', 'typeOf', 'validFrom', 'validThrough'])).shift();
|
|
57
57
|
if (existingEventOffer === undefined) {
|
|
58
|
-
throw new factory.errors.NotFound(`eventOffer: ${
|
|
58
|
+
throw new factory.errors.NotFound(`valid eventOffer: ${eventOfferIdMustBe}`);
|
|
59
59
|
}
|
|
60
60
|
return existingEventOffer;
|
|
61
61
|
});
|
|
@@ -7,8 +7,13 @@ import type { IssuerRepo } from '../../../../repo/issuer';
|
|
|
7
7
|
declare function validateIssuedOfferIfExists(params: {
|
|
8
8
|
event: Pick<IMinimizedIndividualEvent, 'offers' | 'id' | 'project' | 'identifier'>;
|
|
9
9
|
now: Date;
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
eventOffer: Pick<factory.eventOffer.IEventOffer, 'identifier' | 'itemOffered' | 'offeredBy' | 'validFrom' | 'validThrough' | 'id'>;
|
|
11
|
+
acceptedEventOffer?: factory.authorization.IOfferAsObject;
|
|
12
|
+
/**
|
|
13
|
+
* オファー承認時の予約数
|
|
14
|
+
* 0であれば特に何も検証されない
|
|
15
|
+
*/
|
|
16
|
+
numAcceptedOffers: number;
|
|
12
17
|
}): (repos: {
|
|
13
18
|
issuer: IssuerRepo;
|
|
14
19
|
}) => Promise<void>;
|
|
@@ -37,10 +37,10 @@ function verifyOfferToken(params) {
|
|
|
37
37
|
catch (error) {
|
|
38
38
|
// JWTエラーをハンドリング
|
|
39
39
|
if (error instanceof jwt.TokenExpiredError) {
|
|
40
|
-
throw new factory.errors.Argument('
|
|
40
|
+
throw new factory.errors.Argument('ticketedOffer.token', `invalid token. [${error.message} expiredAt:${error.expiredAt}]`);
|
|
41
41
|
}
|
|
42
42
|
else if (error instanceof jwt.JsonWebTokenError) {
|
|
43
|
-
throw new factory.errors.Argument('
|
|
43
|
+
throw new factory.errors.Argument('ticketedOffer.token', `invalid token. [${error.message}]`);
|
|
44
44
|
}
|
|
45
45
|
throw error;
|
|
46
46
|
}
|
|
@@ -51,30 +51,30 @@ const OFFER_TOKEN_DATE_FORMAT = 'YYYY-MM-DDTHH:mm:ssZ';
|
|
|
51
51
|
function validateOfferToken(params) {
|
|
52
52
|
return () => __awaiter(this, void 0, void 0, function* () {
|
|
53
53
|
var _a, _b;
|
|
54
|
-
const { event, acceptedDate, verifiedOffer, eventOffer } = params;
|
|
55
|
-
//
|
|
56
|
-
const
|
|
57
|
-
if (typeof
|
|
58
|
-
throw new factory.errors.Argument('
|
|
54
|
+
const { event, acceptedDate, verifiedOffer, eventOffer, numAcceptedOffers } = params;
|
|
55
|
+
// イベントID一致検証
|
|
56
|
+
const itemOfferedId = (_a = verifiedOffer.itemOffered) === null || _a === void 0 ? void 0 : _a.id;
|
|
57
|
+
if (typeof itemOfferedId !== 'string' || itemOfferedId === '') {
|
|
58
|
+
throw new factory.errors.Argument('ticketedOffer.token', 'itemOffered.id must be string');
|
|
59
59
|
}
|
|
60
|
-
const
|
|
61
|
-
if (typeof
|
|
62
|
-
throw new factory.errors.NotFound('
|
|
60
|
+
const itemOfferedIdMustBe = event.id;
|
|
61
|
+
if (typeof itemOfferedIdMustBe !== 'string') {
|
|
62
|
+
throw new factory.errors.NotFound('event.id', 'the event must have an ID');
|
|
63
63
|
}
|
|
64
|
-
if (
|
|
65
|
-
throw new factory.errors.Argument('
|
|
64
|
+
if (itemOfferedId !== itemOfferedIdMustBe) {
|
|
65
|
+
throw new factory.errors.Argument('ticketedOffer.token', 'itemOffered.id not matched');
|
|
66
66
|
}
|
|
67
|
-
//
|
|
67
|
+
// オファーコード一致検証
|
|
68
68
|
const applicationOfferIdentifier = verifiedOffer.identifier;
|
|
69
69
|
if (typeof applicationOfferIdentifier !== 'string' || applicationOfferIdentifier === '') {
|
|
70
|
-
throw new factory.errors.Argument('
|
|
70
|
+
throw new factory.errors.Argument('ticketedOffer.token', 'identifier must be string');
|
|
71
71
|
}
|
|
72
72
|
const applicationOfferIdentifierMustBe = eventOffer.identifier;
|
|
73
73
|
if (typeof applicationOfferIdentifierMustBe !== 'string') {
|
|
74
74
|
throw new factory.errors.NotFound('makesOffer.identifier');
|
|
75
75
|
}
|
|
76
76
|
if (applicationOfferIdentifier !== applicationOfferIdentifierMustBe) {
|
|
77
|
-
throw new factory.errors.Argument('
|
|
77
|
+
throw new factory.errors.Argument('ticketedOffer.token', 'identifier not matched');
|
|
78
78
|
}
|
|
79
79
|
// 有効期間検証
|
|
80
80
|
let validThroughMoment;
|
|
@@ -82,26 +82,26 @@ function validateOfferToken(params) {
|
|
|
82
82
|
validThroughMoment = moment(verifiedOffer.validThrough, OFFER_TOKEN_DATE_FORMAT, true);
|
|
83
83
|
validFromMoment = moment(verifiedOffer.validFrom, OFFER_TOKEN_DATE_FORMAT, true);
|
|
84
84
|
if (!validThroughMoment.isValid()) {
|
|
85
|
-
throw new factory.errors.Argument('
|
|
85
|
+
throw new factory.errors.Argument('ticketedOffer.token', 'invalid validThrough');
|
|
86
86
|
}
|
|
87
87
|
if (!validFromMoment.isValid()) {
|
|
88
|
-
throw new factory.errors.Argument('
|
|
88
|
+
throw new factory.errors.Argument('ticketedOffer.token', 'invalid validFrom');
|
|
89
89
|
}
|
|
90
90
|
if (acceptedDate.isBefore(validFromMoment)) {
|
|
91
|
-
throw new factory.errors.Argument('
|
|
91
|
+
throw new factory.errors.Argument('ticketedOffer.token', `the offer id valid from ${validFromMoment}`);
|
|
92
92
|
}
|
|
93
93
|
if (acceptedDate.isAfter(validThroughMoment)) {
|
|
94
|
-
throw new factory.errors.Argument('
|
|
94
|
+
throw new factory.errors.Argument('ticketedOffer.token', `the offer id valid through ${validThroughMoment}`);
|
|
95
95
|
}
|
|
96
96
|
// maxValueを検証
|
|
97
|
-
const maxValue = (
|
|
97
|
+
const maxValue = (_b = verifiedOffer === null || verifiedOffer === void 0 ? void 0 : verifiedOffer.eligibleQuantity) === null || _b === void 0 ? void 0 : _b.maxValue;
|
|
98
98
|
if (typeof maxValue !== 'number') {
|
|
99
|
-
throw new factory.errors.Argument('
|
|
99
|
+
throw new factory.errors.Argument('ticketedOffer.token', 'eligibleQuantity.maxValue must be number');
|
|
100
100
|
}
|
|
101
101
|
if (maxValue > NUM_ACCEPTED_OFFERS_MAX_VALUE) {
|
|
102
|
-
throw new factory.errors.Argument('
|
|
102
|
+
throw new factory.errors.Argument('ticketedOffer.token', `eligibleQuantity.maxValue must be <= ${NUM_ACCEPTED_OFFERS_MAX_VALUE}`);
|
|
103
103
|
}
|
|
104
|
-
const numAcceptedOffers =
|
|
104
|
+
// const numAcceptedOffers = params.object.acceptedOffer?.length;
|
|
105
105
|
if (typeof numAcceptedOffers === 'number' && numAcceptedOffers > 0) {
|
|
106
106
|
if (numAcceptedOffers > maxValue) {
|
|
107
107
|
throw new factory.errors.Argument('reservationFor.id', `Maximum number of offers exceeded`);
|
|
@@ -114,16 +114,16 @@ function validateOfferToken(params) {
|
|
|
114
114
|
*/
|
|
115
115
|
function validateIssuedOfferIfExists(params) {
|
|
116
116
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
117
|
-
var _a, _b, _c
|
|
118
|
-
const { event, eventOffer } = params;
|
|
117
|
+
var _a, _b, _c;
|
|
118
|
+
const { event, eventOffer, numAcceptedOffers } = params;
|
|
119
119
|
const acceptedDate = moment(params.now);
|
|
120
120
|
const offerTokenIssuer = (_a = eventOffer.offeredBy) === null || _a === void 0 ? void 0 : _a.identifier;
|
|
121
121
|
const offerTokenRequired = typeof offerTokenIssuer === 'string';
|
|
122
122
|
if (offerTokenRequired) {
|
|
123
|
-
const
|
|
124
|
-
const offerToken = (
|
|
125
|
-
if (typeof
|
|
126
|
-
throw new factory.errors.
|
|
123
|
+
const offerIdMustBe = (_b = params.acceptedEventOffer) === null || _b === void 0 ? void 0 : _b.id;
|
|
124
|
+
const offerToken = (_c = params.acceptedEventOffer) === null || _c === void 0 ? void 0 : _c.token;
|
|
125
|
+
if (typeof offerIdMustBe !== 'string' || offerIdMustBe === '') {
|
|
126
|
+
throw new factory.errors.NotFound('ticketedOffer.id');
|
|
127
127
|
}
|
|
128
128
|
if (typeof offerToken !== 'string' || offerToken === '') {
|
|
129
129
|
throw new factory.errors.ArgumentNull('object.reservationFor.offers.token');
|
|
@@ -131,8 +131,8 @@ function validateIssuedOfferIfExists(params) {
|
|
|
131
131
|
if (typeof eventOffer.identifier !== 'string' || eventOffer.identifier === '') {
|
|
132
132
|
throw new factory.errors.NotFound('eventOffer.identifier');
|
|
133
133
|
}
|
|
134
|
-
//
|
|
135
|
-
if (eventOffer.
|
|
134
|
+
// イベントオファーID一致検証
|
|
135
|
+
if (eventOffer.id !== offerIdMustBe) {
|
|
136
136
|
throw new factory.errors.Argument('object.reservationFor.offers.identifier', 'eventOffer.identifier not matched');
|
|
137
137
|
}
|
|
138
138
|
const issuer = yield repos.issuer.findByIdentifier({
|
|
@@ -152,7 +152,7 @@ function validateIssuedOfferIfExists(params) {
|
|
|
152
152
|
acceptedDate,
|
|
153
153
|
verifiedOffer,
|
|
154
154
|
eventOffer,
|
|
155
|
-
|
|
155
|
+
numAcceptedOffers
|
|
156
156
|
})();
|
|
157
157
|
}
|
|
158
158
|
});
|
|
@@ -6,8 +6,8 @@ import type { ProductOfferRepo } from '../../../../repo/productOffer';
|
|
|
6
6
|
declare function validateMemberTierIfExists(params: {
|
|
7
7
|
event: Pick<IMinimizedIndividualEvent, 'offers' | 'id' | 'project'>;
|
|
8
8
|
now: Date;
|
|
9
|
-
object: factory.assetTransaction.reserve.IObjectWithoutDetail;
|
|
10
9
|
makesOfferOnApplication: factory.event.screeningEvent.ISellerMakesOffer;
|
|
10
|
+
acceptedEventOffer?: factory.authorization.IOfferAsObject;
|
|
11
11
|
}): (repos: {
|
|
12
12
|
issuer: IssuerRepo;
|
|
13
13
|
memberProgram: MemberProgramRepo;
|
|
@@ -20,13 +20,13 @@ function validateMemberTier(params) {
|
|
|
20
20
|
const tierIdentifier = (_b = (_a = verifiedValidForMemberTier.member) === null || _a === void 0 ? void 0 : _a.memberOf) === null || _b === void 0 ? void 0 : _b.identifier;
|
|
21
21
|
const memberProgramIdentifier = (_e = (_d = (_c = verifiedValidForMemberTier.member) === null || _c === void 0 ? void 0 : _c.memberOf) === null || _d === void 0 ? void 0 : _d.isTierOf) === null || _e === void 0 ? void 0 : _e.identifier;
|
|
22
22
|
if (typeof tierIdentifier !== 'string') {
|
|
23
|
-
throw new factory.errors.Argument('
|
|
23
|
+
throw new factory.errors.Argument('ticketedOffer.validForMemberTier', 'tier identifier must be string');
|
|
24
24
|
}
|
|
25
25
|
if (typeof memberProgramIdentifier !== 'string') {
|
|
26
|
-
throw new factory.errors.Argument('
|
|
26
|
+
throw new factory.errors.Argument('ticketedOffer.validForMemberTier', 'member program must be string');
|
|
27
27
|
}
|
|
28
28
|
if (memberProgramIdentifier !== memberProgramIdentifierMustBe) {
|
|
29
|
-
throw new factory.errors.Argument('
|
|
29
|
+
throw new factory.errors.Argument('ticketedOffer.validForMemberTier', 'member program not matched');
|
|
30
30
|
}
|
|
31
31
|
const sellerId = event.offers.seller.id;
|
|
32
32
|
if (typeof sellerId !== 'string' || sellerId === '') {
|
|
@@ -47,22 +47,6 @@ function validateMemberTier(params) {
|
|
|
47
47
|
if (productOfferForMemberTier === undefined) {
|
|
48
48
|
throw new factory.errors.NotFound(factory.offerType.Offer, 'valid product offers for member tier not found');
|
|
49
49
|
}
|
|
50
|
-
// let validThroughMoment: moment.Moment;
|
|
51
|
-
// let validFromMoment: moment.Moment;
|
|
52
|
-
// validThroughMoment = moment(productOfferForMemberTier.validThrough, ROLE_DATE_FORMAT, true);
|
|
53
|
-
// validFromMoment = moment(productOfferForMemberTier.validFrom, ROLE_DATE_FORMAT, true);
|
|
54
|
-
// if (acceptedDate.isBefore(validFromMoment)) {
|
|
55
|
-
// throw new factory.errors.Argument(
|
|
56
|
-
// 'reservationFor.offers.validForMemberTier',
|
|
57
|
-
// `the offer id valid from ${validFromMoment}`
|
|
58
|
-
// );
|
|
59
|
-
// }
|
|
60
|
-
// if (acceptedDate.isAfter(validThroughMoment)) {
|
|
61
|
-
// throw new factory.errors.Argument(
|
|
62
|
-
// 'reservationFor.offers.validForMemberTier',
|
|
63
|
-
// `the offer id valid through ${validThroughMoment}`
|
|
64
|
-
// );
|
|
65
|
-
// }
|
|
66
50
|
});
|
|
67
51
|
}
|
|
68
52
|
function verifyMemberTierToken(params) {
|
|
@@ -88,10 +72,10 @@ function verifyMemberTierToken(params) {
|
|
|
88
72
|
catch (error) {
|
|
89
73
|
// JWTエラーをハンドリング
|
|
90
74
|
if (error instanceof jwt.TokenExpiredError) {
|
|
91
|
-
throw new factory.errors.Argument('
|
|
75
|
+
throw new factory.errors.Argument('ticketedOffer.validForMemberTier', `invalid token. [${error.message} expiredAt:${error.expiredAt}]`);
|
|
92
76
|
}
|
|
93
77
|
else if (error instanceof jwt.JsonWebTokenError) {
|
|
94
|
-
throw new factory.errors.Argument('
|
|
78
|
+
throw new factory.errors.Argument('ticketedOffer.validForMemberTier', `invalid token. [${error.message}]`);
|
|
95
79
|
}
|
|
96
80
|
throw error;
|
|
97
81
|
}
|
|
@@ -101,7 +85,7 @@ function verifyMemberTierToken(params) {
|
|
|
101
85
|
function validateMemberTierIfExists(params) {
|
|
102
86
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
103
87
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
104
|
-
var _a, _b, _c
|
|
88
|
+
var _a, _b, _c;
|
|
105
89
|
const { event, makesOfferOnApplication } = params;
|
|
106
90
|
const acceptedDate = moment(params.now);
|
|
107
91
|
const eventOffers = event.offers;
|
|
@@ -109,16 +93,16 @@ function validateMemberTierIfExists(params) {
|
|
|
109
93
|
// support validForMemberTier(2025-05-14~)
|
|
110
94
|
const validForMemberTierExists = ((_a = makesOfferOnApplication.validForMemberTier) === null || _a === void 0 ? void 0 : _a.typeOf) === 'MemberProgramTier';
|
|
111
95
|
if (validForMemberTierExists) {
|
|
112
|
-
const tokenizedMemberProgramTier = (
|
|
96
|
+
const tokenizedMemberProgramTier = (_b = params.acceptedEventOffer) === null || _b === void 0 ? void 0 : _b.validForMemberTier;
|
|
113
97
|
const validForMemberTierToken = tokenizedMemberProgramTier === null || tokenizedMemberProgramTier === void 0 ? void 0 : tokenizedMemberProgramTier.token;
|
|
114
|
-
const memberProgramIdentifierMustBe = (
|
|
98
|
+
const memberProgramIdentifierMustBe = (_c = tokenizedMemberProgramTier === null || tokenizedMemberProgramTier === void 0 ? void 0 : tokenizedMemberProgramTier.isTierOf) === null || _c === void 0 ? void 0 : _c.identifier;
|
|
115
99
|
// ティアトークンが必須
|
|
116
100
|
if (typeof validForMemberTierToken !== 'string' || validForMemberTierToken === '') {
|
|
117
|
-
throw new factory.errors.ArgumentNull('
|
|
101
|
+
throw new factory.errors.ArgumentNull('ticketedOffer.validForMemberTier.token');
|
|
118
102
|
}
|
|
119
103
|
// メンバープログラムコード指定が必須
|
|
120
104
|
if (typeof memberProgramIdentifierMustBe !== 'string' || memberProgramIdentifierMustBe === '') {
|
|
121
|
-
throw new factory.errors.ArgumentNull('
|
|
105
|
+
throw new factory.errors.ArgumentNull('ticketedOffer.validForMemberTier.isTierOf.identifier');
|
|
122
106
|
}
|
|
123
107
|
// 有効メンバープログラムティアが存在する場合、オファーコレクションコードが必須
|
|
124
108
|
const aggregateOfferIdentifier = eventOffers.identifier;
|
|
@@ -152,33 +136,5 @@ function validateMemberTierIfExists(params) {
|
|
|
152
136
|
memberProgramIdentifierMustBe, aggregateOfferIdentifier
|
|
153
137
|
})(repos);
|
|
154
138
|
}
|
|
155
|
-
// tslint:disable-next-line:no-suspicious-comment
|
|
156
|
-
// TODO オファートークン検証(2025-10-21~)
|
|
157
|
-
// const offerTokenIssuer = makesOfferOnApplication.issuedBy?.identifier;
|
|
158
|
-
// const offerTokenRequired = typeof offerTokenIssuer === 'string';
|
|
159
|
-
// if (offerTokenRequired) {
|
|
160
|
-
// const offerToken = params.object.reservationFor?.offers?.token;
|
|
161
|
-
// if (typeof offerToken !== 'string' || offerToken === '') {
|
|
162
|
-
// throw new factory.errors.ArgumentNull('object.reservationFor.offers.token');
|
|
163
|
-
// }
|
|
164
|
-
// const issuer = await repos.issuer.findByIdentifier({
|
|
165
|
-
// project: { id: params.event.project.id },
|
|
166
|
-
// identifier: offerTokenIssuer
|
|
167
|
-
// });
|
|
168
|
-
// if (typeof issuer.tokenSecret !== 'string' || issuer.tokenSecret === '') {
|
|
169
|
-
// throw new factory.errors.NotFound('issuer.tokenSecret');
|
|
170
|
-
// }
|
|
171
|
-
// const verifiedOffer = await verifyOfferToken({
|
|
172
|
-
// secret: issuer.tokenSecret,
|
|
173
|
-
// issuer: issuer.url,
|
|
174
|
-
// token: offerToken
|
|
175
|
-
// });
|
|
176
|
-
// await validateOfferToken({
|
|
177
|
-
// acceptedDate,
|
|
178
|
-
// verifiedOffer,
|
|
179
|
-
// makesOfferOnApplication,
|
|
180
|
-
// object: params.object
|
|
181
|
-
// })();
|
|
182
|
-
// }
|
|
183
139
|
});
|
|
184
140
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as factory from '../../../../factory';
|
|
2
|
+
import { IMinimizedIndividualEvent } from '../../../../factory/event';
|
|
3
|
+
import type { AuthorizationRepo } from '../../../../repo/authorization';
|
|
4
|
+
import type { TicketRepo } from '../../../../repo/ticket';
|
|
5
|
+
type IPermitOrInvoice = Pick<factory.ownershipInfo.IPermitAsGood, 'identifier' | 'typeOf'> | Pick<factory.invoice.IInvoice, 'paymentMethodId' | 'typeOf'>;
|
|
6
|
+
declare function verifyTicketTokenAsNeeded(params: {
|
|
7
|
+
event: Pick<IMinimizedIndividualEvent, 'offers' | 'id' | 'project' | 'identifier'>;
|
|
8
|
+
now: Date;
|
|
9
|
+
availableAt: {
|
|
10
|
+
/**
|
|
11
|
+
* 販売アプリケーションID
|
|
12
|
+
*/
|
|
13
|
+
id: string;
|
|
14
|
+
};
|
|
15
|
+
object: factory.assetTransaction.reserve.IObjectWithoutDetail;
|
|
16
|
+
instrument: factory.assetTransaction.reserve.IInstrument[];
|
|
17
|
+
}): (repos: {
|
|
18
|
+
authorization: AuthorizationRepo;
|
|
19
|
+
ticket: TicketRepo;
|
|
20
|
+
}) => Promise<{
|
|
21
|
+
acceptedEventOffer?: factory.authorization.IOfferAsObject;
|
|
22
|
+
}>;
|
|
23
|
+
export { IPermitOrInvoice, verifyTicketTokenAsNeeded };
|