@chevre/domain
Version:
Chevre Domain Library for Node.js
99 lines (98 loc) • 3.98 kB
TypeScript
import * as factory from '../../../factory';
import { Settings } from '../../../settings';
import type { ActionRepo } from '../../../repo/action';
import type { AdvanceBookingRequirementRepo } from '../../../repo/advanceBookingRequirement';
import type { AssetTransactionRepo } from '../../../repo/assetTransaction';
import type { AuthorizationRepo } from '../../../repo/authorization';
import type { EventRepo } from '../../../repo/event';
import { EventSeriesRepo } from '../../../repo/eventSeries';
import type { IssuerRepo } from '../../../repo/issuer';
import type { MemberProgramRepo } from '../../../repo/memberProgram';
import type { EventOfferRepo } from '../../../repo/offer/event';
import type { OfferRepo } from '../../../repo/offer/unitPriceInCatalog';
import type { OfferCatalogRepo } from '../../../repo/offerCatalog';
import type { OfferCatalogItemRepo } from '../../../repo/offerCatalogItem';
import type { OrderInTransactionRepo } from '../../../repo/orderInTransaction';
import type { OrderNumberRepo } from '../../../repo/orderNumber';
import type { PaymentServiceRepo } from '../../../repo/paymentService';
import type { SeatRepo } from '../../../repo/place/seat';
import type { PriceSpecificationRepo } from '../../../repo/priceSpecification';
import type { ProductRepo } from '../../../repo/product';
import type { ProductOfferRepo } from '../../../repo/productOffer';
import type { ProjectRepo } from '../../../repo/project';
import type { OfferRateLimitRepo } from '../../../repo/rateLimit/offer';
import type { SettingRepo } from '../../../repo/setting';
import type { StockHolderRepo } from '../../../repo/stockHolder';
import type { TaskRepo } from '../../../repo/task';
import type { TicketRepo } from '../../../repo/ticket';
import type { TransactionRepo } from '../../../repo/transaction';
import type { TransactionNumberRepo } from '../../../repo/transactionNumber';
interface IAuthorizeRepos {
action: ActionRepo;
advanceBookingRequirement: AdvanceBookingRequirementRepo;
assetTransaction: AssetTransactionRepo;
authorization: AuthorizationRepo;
event: EventRepo;
eventOffer: EventOfferRepo;
eventSeries: EventSeriesRepo;
issuer: IssuerRepo;
memberProgram: MemberProgramRepo;
stockHolder: StockHolderRepo;
offer: OfferRepo;
offerCatalog: OfferCatalogRepo;
offerCatalogItem: OfferCatalogItemRepo;
offerRateLimit: OfferRateLimitRepo;
orderInTransaction: OrderInTransactionRepo;
orderNumber: OrderNumberRepo;
paymentService: PaymentServiceRepo;
priceSpecification: PriceSpecificationRepo;
product: ProductRepo;
productOffer: ProductOfferRepo;
project: ProjectRepo;
seat: SeatRepo;
setting: SettingRepo;
task: TaskRepo;
ticket: TicketRepo;
transaction: TransactionRepo;
transactionNumber: TransactionNumberRepo;
}
type IAuthorizeOperation<T> = (repos: IAuthorizeRepos, settings: Settings) => Promise<T>;
type IAuthorizeOfferAction = factory.action.authorize.offer.eventService.IAction;
type IObjectWithoutDetail = factory.action.authorize.offer.eventService.IObjectWithoutDetail;
interface IAuthorizeOptions {
/**
* オファーID指定なしに座席をおさえる場合true
*/
noOfferSpecified: boolean;
/**
* 最大n日前から予約可能
*/
maxReservationGracePeriodInDays: number;
}
/**
* 興行オファー承認
*/
declare function authorize(params: {
project: {
id: string;
typeOf: factory.organizationType.Project;
};
object: IObjectWithoutDetail;
agent: {
id: string;
};
transaction: {
id: string;
};
validateEventOfferPeriod: boolean;
validateEvent: boolean;
store: {
/**
* 販売アプリケーションID
*/
id: string;
};
}, options: IAuthorizeOptions): IAuthorizeOperation<Pick<IAuthorizeOfferAction, 'id'> & {
result: IAuthorizeOfferAction['result'];
}>;
export { authorize };