@chevre/domain
Version:
Chevre Domain Library for Node.js
70 lines (69 loc) • 2.5 kB
TypeScript
import type { ActionRepo } from '../../repo/action';
import type { AssetTransactionRepo } from '../../repo/assetTransaction';
import type { AuthorizationRepo } from '../../repo/authorization';
import type { OrderRepo } from '../../repo/order';
import type { PassportRepo } from '../../repo/passport';
import type { ProductRepo } from '../../repo/product';
import type { ProjectRepo } from '../../repo/project';
import type { SellerRepo } from '../../repo/seller';
import type { SettingRepo } from '../../repo/setting';
import type { TaskRepo } from '../../repo/task';
import type { TicketRepo } from '../../repo/ticket';
import type { IStartedTransaction, TransactionRepo } from '../../repo/transaction';
import type { TransactionNumberRepo } from '../../repo/transactionNumber';
import { moneyTransfer as MoneyTransferFactory } from '../../factory/transaction';
export interface IStartOperationRepos {
action: ActionRepo;
authorization: AuthorizationRepo;
order: OrderRepo;
passport: PassportRepo;
product: ProductRepo;
project: ProjectRepo;
seller: SellerRepo;
ticket: TicketRepo;
transaction: TransactionRepo;
transactionNumber: TransactionNumberRepo;
assetTransaction: AssetTransactionRepo;
}
export type IStartOperation<T> = (repos: IStartOperationRepos) => Promise<T>;
export type ITaskAndTransactionOperation<T> = (repos: {
setting: SettingRepo;
task: TaskRepo;
transaction: TransactionRepo;
}) => Promise<T>;
export type IConfirmOperation<T> = (repos: {
action: ActionRepo;
transaction: TransactionRepo;
}) => Promise<T>;
export type IStartParams = MoneyTransferFactory.IStartParams;
/**
* 取引開始
* 通貨転送資産取引サービスを利用して転送取引を開始する
*/
export declare function start(params: IStartParams): IStartOperation<IStartedTransaction>;
export type IAuthorizeOperation<T> = (repos: {
action: ActionRepo;
authorization: AuthorizationRepo;
order: OrderRepo;
product: ProductRepo;
project: ProjectRepo;
ticket: TicketRepo;
transaction: TransactionRepo;
assetTransaction: AssetTransactionRepo;
}) => Promise<T>;
/**
* 取引確定
*/
export declare function confirm(params: {
id: string;
}): IConfirmOperation<void>;
/**
* 取引のタスク出力
*/
export declare function exportTasksById(params: {
id: string;
/**
* タスク実行日時バッファ
*/
runsTasksAfterInSeconds?: number;
}): ITaskAndTransactionOperation<void>;