-
Notifications
You must be signed in to change notification settings - Fork 172
/
types.ts
82 lines (74 loc) · 2.5 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import { TransactionDirection, PaymentMethod, TransactionRecordType } from '@prisma/client';
import { AggregateType, TIME_UNITS } from './consts';
export type InlineRule = {
id: string;
subjects: string[] | readonly string[];
} & (
| {
fnName: 'evaluateHighTransactionTypePercentage';
options: Omit<HighTransactionTypePercentage, 'projectId'>;
}
| {
fnName: 'evaluateTransactionsAgainstDynamicRules';
options: Omit<TransactionsAgainstDynamicRulesType, 'projectId'>;
}
| {
fnName: 'evaluateCustomersTransactionType';
options: Omit<TCustomersTransactionTypeOptions, 'projectId'>;
}
| {
fnName: 'evaluateTransactionLimitHistoricAverageInbound';
options: Omit<TransactionLimitHistoricAverageOptions, 'projectId'>;
}
);
export type TAggregations = keyof typeof AggregateType;
export type TExcludedCounterparty = {
counterpartyBeneficiaryIds: string[] | readonly string[];
counterpartyOriginatorIds: string[] | readonly string[];
};
export type TimeUnit = (typeof TIME_UNITS)[keyof typeof TIME_UNITS];
export type TransactionsAgainstDynamicRulesType = {
projectId: string;
havingAggregate?: TAggregations;
amountBetween?: { min: number; max: number };
timeAmount?: number;
transactionType?: TransactionRecordType[] | readonly TransactionRecordType[];
timeUnit?: TimeUnit;
direction?: TransactionDirection;
excludedCounterparty?: TExcludedCounterparty;
paymentMethods?: PaymentMethod[] | readonly PaymentMethod[];
excludePaymentMethods?: boolean;
days?: number;
amountThreshold?: number;
groupBy?: string[] | readonly string[];
};
export type HighTransactionTypePercentage = {
projectId: string;
transactionType: TransactionRecordType;
subjectColumn: 'counterpartyOriginatorId' | 'counterpartyBeneficiaryId';
minimumCount: number;
minimumPercentage: number;
timeAmount: number;
timeUnit: TimeUnit;
};
export type TCustomersTransactionTypeOptions = {
projectId: string;
transactionType?: TransactionRecordType[] | readonly TransactionRecordType[];
threshold?: number;
paymentMethods?: PaymentMethod[] | readonly PaymentMethod[];
timeAmount?: number;
timeUnit?: TimeUnit;
isPerBrand?: boolean;
havingAggregate?: TAggregations;
};
export type TransactionLimitHistoricAverageOptions = {
projectId: string;
transactionDirection: TransactionDirection;
paymentMethod: {
value: PaymentMethod;
operator: '=' | '!=';
};
minimumCount: number;
minimumTransactionAmount: number;
transactionFactor: number;
};