forked from TrustUp-app/TrustUp-Frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLoan.ts
More file actions
51 lines (48 loc) · 1.21 KB
/
Copy pathLoan.ts
File metadata and controls
51 lines (48 loc) · 1.21 KB
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
/**
* Loan status values returned by the API.
* - pending: Loan application submitted, awaiting approval
* - active: Loan is approved and has outstanding payments
* - completed: All installments have been paid
* - defaulted: Borrower failed to meet repayment obligations
*/
export type LoanStatus = 'pending' | 'active' | 'completed' | 'defaulted';
/**
* A single installment within a loan's repayment schedule.
*/
export interface LoanInstallment {
id: string;
installmentNumber: number;
amount: number;
dueDate: string;
paidDate: string | null;
status: 'paid' | 'pending' | 'overdue';
}
/**
* Full loan record as returned by the API.
*/
export interface Loan {
id: string;
merchantName: string;
merchantId: string;
amount: number;
amountPaid: number;
interestRate: number;
totalWithInterest: number;
status: LoanStatus;
installmentCount: number;
installments: LoanInstallment[];
nextPaymentDue: string | null;
nextPaymentAmount: number | null;
createdAt: string;
completedAt: string | null;
}
/**
* Paginated response shape from GET /loans/my-loans.
*/
export interface LoansResponse {
loans: Loan[];
total: number;
offset: number;
limit: number;
hasMore: boolean;
}