@cowris/paymentdb-client 2.1.2 → 2.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -6
- package/prisma/generated/paymentdb/client.d.ts +1 -0
- package/prisma/generated/paymentdb/client.js +5 -0
- package/prisma/generated/paymentdb/default.d.ts +1 -0
- package/prisma/generated/paymentdb/default.js +5 -0
- package/prisma/generated/paymentdb/edge.d.ts +1 -0
- package/prisma/generated/paymentdb/edge.js +454 -0
- package/prisma/generated/paymentdb/index-browser.js +440 -0
- package/prisma/generated/paymentdb/index.d.ts +29958 -0
- package/prisma/generated/paymentdb/index.js +475 -0
- package/prisma/generated/paymentdb/libquery_engine-darwin-arm64.dylib.node +0 -0
- package/prisma/generated/paymentdb/package.json +183 -0
- package/prisma/generated/paymentdb/query_engine_bg.js +2 -0
- package/prisma/generated/paymentdb/query_engine_bg.wasm +0 -0
- package/prisma/generated/paymentdb/runtime/edge-esm.js +35 -0
- package/prisma/generated/paymentdb/runtime/edge.js +35 -0
- package/prisma/generated/paymentdb/runtime/index-browser.d.ts +370 -0
- package/prisma/generated/paymentdb/runtime/index-browser.js +17 -0
- package/prisma/generated/paymentdb/runtime/library.d.ts +3982 -0
- package/prisma/generated/paymentdb/runtime/library.js +147 -0
- package/prisma/generated/paymentdb/runtime/react-native.js +84 -0
- package/prisma/generated/paymentdb/runtime/wasm-compiler-edge.js +85 -0
- package/prisma/generated/paymentdb/runtime/wasm-engine-edge.js +38 -0
- package/prisma/generated/paymentdb/schema.prisma +323 -0
- package/prisma/generated/paymentdb/wasm-edge-light-loader.mjs +5 -0
- package/prisma/generated/paymentdb/wasm-worker-loader.mjs +5 -0
- package/prisma/generated/paymentdb/wasm.d.ts +1 -0
- package/prisma/generated/paymentdb/wasm.js +461 -0
- package/prisma/schema/schema.prisma +1 -0
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
model PaymentAccount {
|
|
2
|
+
id String @id @default(uuid())
|
|
3
|
+
account_number String? @unique
|
|
4
|
+
email String?
|
|
5
|
+
currency_id String
|
|
6
|
+
currency Currency @relation(fields: [currency_id], references: [id])
|
|
7
|
+
wallet_id String @unique
|
|
8
|
+
wallet_queue_url String?
|
|
9
|
+
wallet_webhook_url String?
|
|
10
|
+
managed_wallets ManagedWallet[]
|
|
11
|
+
transactions Transaction[]
|
|
12
|
+
withdrawal_accounts WithdrawalAccount[]
|
|
13
|
+
|
|
14
|
+
@@index([wallet_id], name: "wallet_id_index")
|
|
15
|
+
@@index([account_number], name: "wallet_account_number")
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
model Currency {
|
|
19
|
+
id String @id @default(uuid())
|
|
20
|
+
name String
|
|
21
|
+
code String @unique // NGN, USD, EUR
|
|
22
|
+
symbol String // ₦, $, €
|
|
23
|
+
country String
|
|
24
|
+
|
|
25
|
+
minor_unit String // kobo, cent, e.t.c
|
|
26
|
+
minor_unit_factor Int
|
|
27
|
+
|
|
28
|
+
created_at DateTime @default(now())
|
|
29
|
+
updated_at DateTime @updatedAt
|
|
30
|
+
|
|
31
|
+
payment_providers GlobalPaymentProvider[]
|
|
32
|
+
accounts PaymentAccount[]
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
model SenderAccountInformation {
|
|
36
|
+
id String @id @default(uuid())
|
|
37
|
+
account_firstname String? @default("")
|
|
38
|
+
account_lastname String? @default("")
|
|
39
|
+
account_number String?
|
|
40
|
+
account_email String?
|
|
41
|
+
account_bank_name String?
|
|
42
|
+
|
|
43
|
+
funding Funding?
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
model Funding {
|
|
47
|
+
id String @id @default(uuid())
|
|
48
|
+
transaction_id String @unique
|
|
49
|
+
account_id String
|
|
50
|
+
managed_wallet_id String?
|
|
51
|
+
status String
|
|
52
|
+
amount BigInt
|
|
53
|
+
source_currency_id String?
|
|
54
|
+
destination_currency_id String
|
|
55
|
+
sender_account_information_id String? @unique
|
|
56
|
+
|
|
57
|
+
transaction Transaction?
|
|
58
|
+
sender_account_information SenderAccountInformation? @relation(fields: [sender_account_information_id], references: [id])
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
model GlobalPaymentProvider {
|
|
62
|
+
id String @id @default(uuid())
|
|
63
|
+
name String
|
|
64
|
+
idx Int @default(autoincrement())
|
|
65
|
+
supported_currencies Currency[]
|
|
66
|
+
created_at DateTime @default(now())
|
|
67
|
+
updated_at DateTime @updatedAt
|
|
68
|
+
|
|
69
|
+
transactions Transaction[]
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
model Hold {
|
|
73
|
+
id String @id @default(uuid())
|
|
74
|
+
|
|
75
|
+
account_id String
|
|
76
|
+
managed_wallet_id String?
|
|
77
|
+
amount BigInt // kobo
|
|
78
|
+
currency_id String
|
|
79
|
+
|
|
80
|
+
reference String @unique
|
|
81
|
+
reason HoldReason
|
|
82
|
+
|
|
83
|
+
status HoldStatus
|
|
84
|
+
expires_at DateTime
|
|
85
|
+
|
|
86
|
+
// linkage
|
|
87
|
+
transfer_id String? // internal transfer
|
|
88
|
+
payment_intent_id String?
|
|
89
|
+
webhookEventId String?
|
|
90
|
+
|
|
91
|
+
created_at DateTime @default(now())
|
|
92
|
+
updated_at DateTime @updatedAt
|
|
93
|
+
|
|
94
|
+
@@index([account_id])
|
|
95
|
+
@@index([managed_wallet_id])
|
|
96
|
+
@@index([status])
|
|
97
|
+
@@index([expires_at])
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
enum HoldStatus {
|
|
101
|
+
ACTIVE
|
|
102
|
+
CONSUMED
|
|
103
|
+
RELEASED
|
|
104
|
+
EXPIRED
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
enum HoldReason {
|
|
108
|
+
TRANSFER
|
|
109
|
+
WITHDRAWAL
|
|
110
|
+
REVERSAL
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
model ManagedWallet {
|
|
114
|
+
id String @id @default(uuid())
|
|
115
|
+
account_id String
|
|
116
|
+
customer_name String?
|
|
117
|
+
wallet_identifier String?
|
|
118
|
+
wallet_customer_email String?
|
|
119
|
+
wallet_customer_phone String?
|
|
120
|
+
account_number String?
|
|
121
|
+
email String?
|
|
122
|
+
total_balance BigInt @default(0) // based on currency's smallest unit
|
|
123
|
+
available_balance BigInt @default(0) // based on currency's smallest unit
|
|
124
|
+
currency_id String
|
|
125
|
+
global_payment_provider_id String
|
|
126
|
+
type String
|
|
127
|
+
// Type can be either "static", "dynamic", "virtual-static", "virtual-dynamic"
|
|
128
|
+
|
|
129
|
+
created_at DateTime @default(now())
|
|
130
|
+
updated_at DateTime @updatedAt
|
|
131
|
+
payment_account PaymentAccount @relation(fields: [account_id], references: [id])
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
model Otp {
|
|
135
|
+
id String @id @default(uuid())
|
|
136
|
+
email String
|
|
137
|
+
otp String
|
|
138
|
+
created_at DateTime @default(now())
|
|
139
|
+
updated_at DateTime @default(now()) @updatedAt
|
|
140
|
+
expires_at DateTime
|
|
141
|
+
|
|
142
|
+
@@index([email], name: "otp_email_index")
|
|
143
|
+
@@index([otp], name: "otp_str_index")
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
model PaymentIntent {
|
|
147
|
+
id String @id @default(uuid())
|
|
148
|
+
reference String @unique
|
|
149
|
+
account_id String
|
|
150
|
+
managed_wallet_id String?
|
|
151
|
+
amount BigInt // amount in kobo
|
|
152
|
+
currency_id String // NGN, USD, etc
|
|
153
|
+
global_payment_provider_id String
|
|
154
|
+
provider_intent_id String?
|
|
155
|
+
status PaymentIntentStatus
|
|
156
|
+
metadata Json?
|
|
157
|
+
created_at DateTime @default(now())
|
|
158
|
+
updated_at DateTime @updatedAt
|
|
159
|
+
|
|
160
|
+
webhook_events WebhookEvent[]
|
|
161
|
+
|
|
162
|
+
@@index([account_id])
|
|
163
|
+
@@index([reference])
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
enum PaymentIntentStatus {
|
|
167
|
+
PENDING
|
|
168
|
+
SUCCEEDED
|
|
169
|
+
FAILED
|
|
170
|
+
CANCELLED
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
model Reversal {
|
|
174
|
+
id String @id @default(uuid())
|
|
175
|
+
transaction_id String @unique
|
|
176
|
+
account_id String
|
|
177
|
+
source_currency_id String?
|
|
178
|
+
destination_currency_id String
|
|
179
|
+
|
|
180
|
+
amount BigInt
|
|
181
|
+
status String
|
|
182
|
+
|
|
183
|
+
transaction Transaction?
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
generator client {
|
|
187
|
+
provider = "prisma-client-js"
|
|
188
|
+
output = "../generated/paymentdb"
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
datasource db {
|
|
192
|
+
provider = "postgresql"
|
|
193
|
+
url = env("PAYMENT_DATABASE_URL")
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
model Transaction {
|
|
197
|
+
id String @id @unique @default(uuid())
|
|
198
|
+
account_id String
|
|
199
|
+
funding_id String? @unique
|
|
200
|
+
withdrawal_id String? @unique
|
|
201
|
+
reversal_id String? @unique
|
|
202
|
+
transfer_id String? @unique
|
|
203
|
+
|
|
204
|
+
// Type can be funding, withdrawal, transfer, reversal
|
|
205
|
+
type String
|
|
206
|
+
|
|
207
|
+
// Status can be initiated, pending, success, failed
|
|
208
|
+
status String
|
|
209
|
+
metadata Json?
|
|
210
|
+
provider_id String?
|
|
211
|
+
reference_id String @unique
|
|
212
|
+
created_at DateTime @default(now())
|
|
213
|
+
upadated_at DateTime @default(now())
|
|
214
|
+
|
|
215
|
+
provider GlobalPaymentProvider? @relation(fields: [provider_id], references: [id])
|
|
216
|
+
account PaymentAccount @relation(fields: [account_id], references: [id])
|
|
217
|
+
|
|
218
|
+
transfer_infomation Transfer? @relation(fields: [transfer_id], references: [id])
|
|
219
|
+
funding_information Funding? @relation(fields: [funding_id], references: [id])
|
|
220
|
+
withdrawal_information Withdrawal? @relation(fields: [withdrawal_id], references: [id])
|
|
221
|
+
reversal_information Reversal? @relation(fields: [reversal_id], references: [id])
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
model TransferDestinationAccountDetails {
|
|
225
|
+
id String @id @default(uuid())
|
|
226
|
+
account_firstname String @default("")
|
|
227
|
+
account_lastname String @default("")
|
|
228
|
+
account_number String?
|
|
229
|
+
account_email String?
|
|
230
|
+
account_bank_name String?
|
|
231
|
+
Transfer Transfer?
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
model Transfer {
|
|
235
|
+
id String @id @default(uuid())
|
|
236
|
+
transaction_id String @unique
|
|
237
|
+
from_account_id String
|
|
238
|
+
to_account_id String?
|
|
239
|
+
destination_account_details_id String? @unique
|
|
240
|
+
source_currency_id String
|
|
241
|
+
destination_currency_id String
|
|
242
|
+
amount_in_source_currency BigInt
|
|
243
|
+
amount_in_destination_currency BigInt
|
|
244
|
+
status String
|
|
245
|
+
|
|
246
|
+
transaction Transaction?
|
|
247
|
+
destination_account_details TransferDestinationAccountDetails? @relation(fields: [destination_account_details_id], references: [id])
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
model WebhookEvent {
|
|
251
|
+
id String @id @default(uuid())
|
|
252
|
+
provider_id String
|
|
253
|
+
event_type EventType
|
|
254
|
+
reference String @unique
|
|
255
|
+
provider_event_id String? // Paystack transaction ID
|
|
256
|
+
payload Json
|
|
257
|
+
verified Boolean @default(false)
|
|
258
|
+
processed Boolean @default(false)
|
|
259
|
+
received_at DateTime @default(now())
|
|
260
|
+
processed_at DateTime?
|
|
261
|
+
|
|
262
|
+
payment_intent_id String?
|
|
263
|
+
paymentIntent PaymentIntent? @relation(fields: [payment_intent_id], references: [id])
|
|
264
|
+
|
|
265
|
+
@@index([reference])
|
|
266
|
+
@@index([processed])
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
enum EventType {
|
|
270
|
+
FUNDING_SUCCESS
|
|
271
|
+
FUNDING_FAILED
|
|
272
|
+
WITHDRAWAL_SUCCESS
|
|
273
|
+
WITHDRAWAL_FAILED
|
|
274
|
+
REVERSAL_SUCCESS
|
|
275
|
+
REVERSAL_FAILED
|
|
276
|
+
TRANSFER_SUCCESS
|
|
277
|
+
TRANSFER_FAILED
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
model WithdrawalDestinationAccountDetails {
|
|
281
|
+
id String @id @default(uuid())
|
|
282
|
+
account_firstname String @default("")
|
|
283
|
+
account_lastname String @default("")
|
|
284
|
+
account_number String?
|
|
285
|
+
account_email String?
|
|
286
|
+
account_bank_name String?
|
|
287
|
+
withdrawal Withdrawal?
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
model Withdrawal {
|
|
291
|
+
id String @id @default(uuid())
|
|
292
|
+
transaction_id String @unique
|
|
293
|
+
from_account_id String
|
|
294
|
+
amount_in_source_currency BigInt
|
|
295
|
+
status String
|
|
296
|
+
|
|
297
|
+
destination_account_details_id String? @unique
|
|
298
|
+
source_currency_id String
|
|
299
|
+
destination_currency_id String
|
|
300
|
+
amount_in_destination_currency BigInt
|
|
301
|
+
|
|
302
|
+
transaction Transaction?
|
|
303
|
+
destination_account_details WithdrawalDestinationAccountDetails? @relation(fields: [destination_account_details_id], references: [id])
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
model WithdrawalAccount {
|
|
307
|
+
id String @id @default(uuid())
|
|
308
|
+
account_number String?
|
|
309
|
+
account_bank_code String?
|
|
310
|
+
account_bank_name String?
|
|
311
|
+
account_firstname String
|
|
312
|
+
account_lastname String?
|
|
313
|
+
account_email String?
|
|
314
|
+
currency_id String
|
|
315
|
+
created_at DateTime @default(now())
|
|
316
|
+
updated_at DateTime @updatedAt
|
|
317
|
+
|
|
318
|
+
account_id String
|
|
319
|
+
account PaymentAccount @relation(fields: [account_id], references: [id])
|
|
320
|
+
|
|
321
|
+
@@unique([account_number, account_bank_code, currency_id], name: "unique_withdrawal_account")
|
|
322
|
+
@@index([currency_id], name: "withdrawal_account_currency_index")
|
|
323
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./default"
|