40 lines
1.8 KiB
TypeScript
40 lines
1.8 KiB
TypeScript
import { String, Text, Price, Boolean, Datetime } from 'oak-domain/lib/types/DataType';
|
|
import { EntityShape } from 'oak-domain/lib/types/Entity';
|
|
import { EntityDesc, ActionDef } from 'oak-domain/lib/types';
|
|
import { Schema as User } from 'oak-general-business/lib/entities/User';
|
|
import { Schema as Address } from 'oak-general-business/lib/entities/Address';
|
|
import { Schema as AccountOper } from './AccountOper';
|
|
import { Schema as System } from './System';
|
|
export interface Schema extends EntityShape {
|
|
price: Price;
|
|
receivingMethod: 'express' | 'pickup';
|
|
paid: Price;
|
|
refunded: Price;
|
|
title: String<32>;
|
|
desc: Text;
|
|
timeoutAt?: Datetime;
|
|
creator: User;
|
|
entity: String<32>;
|
|
entityId: String<64>;
|
|
settled: Boolean;
|
|
allowPartialPay?: Boolean;
|
|
system: System;
|
|
address?: Address;
|
|
payAt?: Datetime;
|
|
sendAt?: Datetime;
|
|
receiveAt?: Datetime;
|
|
opers: AccountOper[];
|
|
}
|
|
export type IAction = 'startPaying' | 'payAll' | 'payPartially' | 'payNone' | 'timeout' | 'cancel' | 'startRefunding' | 'refundAll' | 'refundPartially' | 'refundNone';
|
|
export type IState = 'unpaid' | 'timeout' | 'cancelled' | 'paying' | 'partiallyPaid' | 'paid' | 'refunding' | 'partiallyRefunded' | 'refunded';
|
|
export declare const IActionDef: ActionDef<IAction, IState>;
|
|
export type GState = 'staging' | 'shipping' | 'packaged' | 'unshipped' | 'received' | 'taken' | 'taking';
|
|
export type GAction = 'package' | 'send' | 'receive' | 'store' | 'take' | 'startTaking' | 'cancelTaking' | 'completeTaking' | 'turnBack' | 'unship';
|
|
export declare const GActionDef: ActionDef<GAction, GState>;
|
|
export type Action = IAction | GAction | 'settle';
|
|
export declare const entityDesc: EntityDesc<Schema, Action, '', {
|
|
iState: IState;
|
|
gState: GState;
|
|
receivingMethod: Schema['receivingMethod'];
|
|
}>;
|