aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/lib/shared.ts
blob: cc4472feedcfad2d9e2a28a7c2f7f19aa8835c2d (plain) (blame)
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
import * as v from 'valibot'

export type ImportForm = v.InferOutput<typeof ImportForm>
export const ImportForm = v.object({
    budgetId: v.string(),
    mappings: v.array(
        v.object({
            sb1Id: v.string(),
            actualId: v.string()
        })
    ),
    dryRun: v.boolean()
})
export type Sb1TransactionDetails = {
    id: string;
    date: Date;
    type: string;
    amount: number;
    typeCode: string;
    typeText: string;
    valueDate: Date;
    accountKey: string;
    bookedDate: Date;
    accountName: string;
    description: string;
    eInvoiceUrl: string;
    nonUniqueId: string;
    postingDate: Date;
    currencyCode: string;
    exchangeRate: number;
    kidOrMessage: string;
    accountNumber: number;
    currencyAmount: number;
    paymentDetails: Sb1PaymentDetails;
    accountCurrency: string;
    archiveReference: string;
    paymentReference: string;
    remoteAccountName: string;
    cleanedDescription: string;
    numericalReference: string;
    classificationInput: Sb1ClassificationInput;
    originalDescription: string;
    remoteAccountNumber: string;
}

export type Sb1PaymentDetails = {
    amount: number;
    message: string;
    paymentCid: string;
    payeeAddress: Sb1PayeeAddress;
    payeeBankName: string;
    payeeBicSwift: string;
    amountCurrency: string;
    serviceCharges: Sb1ServiceCharge[];
    payeeBankAddress: Sb1PayeeAddress;
    paymentReference: string;
    payeeEmailAddress: string;
    internationalDetails: Sb1InternationalDetails;
}

export type Sb1InternationalDetails = {
    agreedRate: string;
    agreedWith: string;
    authorityReportCode: string;
    authorityReportText: string;
}

export type Sb1PayeeAddress = {
    city: string;
    line1: string;
    line2: string;
    line3: string;
    zipCode: string;
    countryCode: string;
}

export type Sb1ServiceCharge = {
    paidBy: string;
    chargedAmount: number;
    chargedAmountCurrency: string;
}

export type Sb1Tokens = {
    access_token: string
    expires_in: number
    refresh_token_expires_in: number
    refresh_token_absolute_expires_in: number
    token_type: string
    refresh_token: string
}

export type Sb1Transaction = {
    id: string
    nonUniqueId: string
    description: string
    cleanedDescription: string
    accountNumber: Sb1AccountNumber
    amount: number
    date: number
    interestDate: number
    typeCode: string
    typeText: string
    currencyCode: string
    canShowDetails: boolean
    source: string
    isConfidential: boolean
    bookingStatus: string
    accountName: string
    accountKey: string
    accountCurrency: string
    isFromCurrencyAccount: boolean
    classificationInput: Sb1ClassificationInput
}

export type Sb1Account = {
    key: string;
    accountNumber: string;
    iban: string;
    name: string;
    description: string;
    balance: number;
    availableBalance: number;
    currencyCode: string;
    owner: Sb1AccountOwner;
    productType: string;
    type: string;
    productId: string;
    descriptionCode: string;
    accountProperties: { [key: string]: boolean };
}

export type Sb1AccountOwner = {
    name: string;
    firstName: string;
    lastName: string;
    type: string;
    age: number;
    customerKey: string;
    ssnKey: string;
}

export type Sb1AccountNumber = {
    value: string
    formatted: string
    unformatted: string
}

export type Sb1ClassificationInput = {
    id: string
    amount: number
    type: string
    text: string
    date: string
}