-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.ts
181 lines (160 loc) · 3.26 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
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
import { Document } from "mongoose"
/* eslint-disable max-classes-per-file*/
import {
AuthRequestBody,
CryptoType,
DeleteFiatAccountRequestParams,
FiatAccountSchema,
FiatAccountSchemas,
FiatAccountType,
FiatConnectError,
FiatType,
PostFiatAccountRequestBody,
QuoteRequestBody,
TransferRequestBody,
TransferStatusRequestParams,
} from "@fiatconnect/fiatconnect-types"
export {
AuthRequestBody,
CryptoType,
DeleteFiatAccountRequestParams,
FiatAccountSchema,
FiatAccountSchemas,
FiatAccountType,
FiatConnectError,
FiatType,
PostFiatAccountRequestBody,
QuoteRequestBody,
TransferRequestBody,
TransferStatusRequestParams,
}
export interface UserCreds {
clientId: string
secret: string
}
export interface KYCStatusI {
success: boolean
response: {
_id?: string
storeId: string
requireKyc: boolean
email: string
__v?: 0
}
}
export interface CredentialsI {
client: string
secret: string
}
export interface KYCFormI {
firstName: string
lastName: string
nationality: string
birthDate: string
email: string
address?: string
diverLicense?: string
age: string | number
citizenShip: string
nationalId: string | number
fullName: string
expiryDate?: string
}
export enum EnviromentE {
"DEV",
"LIVE",
}
export interface TransactionI {
store: string
txHash: string
amount: number
fiat: number
phone: string
asset: string
network?: string
status: string
createdAt?: string
}
export interface EmulatorI extends Document {
store: string
phone?: string
}
export interface MomoMessageI extends Document {
emulator: string
message?: string
}
export interface BankQuoteI extends Document {
transferId: string
code: string
accountNumber: string
accountName: string
}
/*
* API error types
*/
export class ValidationError extends Error {
validationError: any
fiatConnectError: FiatConnectError
constructor(
msg: string,
validationError: any,
fiatConnectError: FiatConnectError
) {
super(msg)
this.validationError = validationError
this.fiatConnectError = fiatConnectError
}
}
// Define the Response interface for TypeScript
export interface ITransfer extends Document {
quote: string
status: string
address: string
operator?: string
txHash: string
phone?: string
orderId?: string
bankOrderId?: string
kotaniRef?: string
date: string
}
export enum Countries {
UG = "UG",
KE = "KE",
GHA = "GHA",
TZ = "TZ",
ZM = "ZM",
NG = "NG",
}
export enum FiatAccountSchemaEnum {
"AccountNumber",
"MobileMoney",
"DuniaWallet",
"IBANNumber",
"IFSCAccount",
"PIXAccount",
}
export class InvalidSiweParamsError extends Error {
fiatConnectError: FiatConnectError
constructor(fiatConnectError: FiatConnectError, msg?: string) {
super(msg || fiatConnectError)
this.fiatConnectError = fiatConnectError
}
}
export class NotImplementedError extends Error {}
export class UnauthorizedError extends Error {
fiatConnectError: FiatConnectError
constructor(
fiatConnectError: FiatConnectError = FiatConnectError.Unauthorized,
msg?: string
) {
super(msg || fiatConnectError)
this.fiatConnectError = fiatConnectError
}
}
export interface AssetsI {
id: number
name: string
network: string[]
fees: number
}