@cowris/paymentdb-client 1.0.6 → 2.0.0
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 +9 -6
- package/prisma/schema/currency.prisma +13 -9
- package/prisma/schema/funding.prisma +2 -1
- package/prisma/schema/hold.prisma +39 -0
- package/prisma/schema/managedWallet.prisma +2 -1
- package/prisma/schema/migrations/20251029145728_remove_unnecessary_unique_constraint/migration.sql +24 -0
- package/prisma/schema/migrations/20251231010424_init/migration.sql +99 -0
- package/prisma/schema/paymentIntent.prisma +26 -0
- package/prisma/schema/schema.prisma +0 -1
- package/prisma/schema/transfer.prisma +2 -2
- package/prisma/schema/webhookEvent.prisma +29 -0
- package/prisma/schema/withdrawal.prisma +2 -2
- package/prisma/generated/paymentdb/client.d.ts +0 -1
- package/prisma/generated/paymentdb/client.js +0 -4
- package/prisma/generated/paymentdb/default.d.ts +0 -1
- package/prisma/generated/paymentdb/default.js +0 -4
- package/prisma/generated/paymentdb/edge.d.ts +0 -1
- package/prisma/generated/paymentdb/edge.js +0 -351
- package/prisma/generated/paymentdb/index-browser.js +0 -338
- package/prisma/generated/paymentdb/index.d.ts +0 -22365
- package/prisma/generated/paymentdb/index.js +0 -372
- package/prisma/generated/paymentdb/libquery_engine-debian-openssl-3.0.x.so.node +0 -0
- package/prisma/generated/paymentdb/package.json +0 -146
- package/prisma/generated/paymentdb/runtime/edge-esm.js +0 -34
- package/prisma/generated/paymentdb/runtime/edge.js +0 -34
- package/prisma/generated/paymentdb/runtime/index-browser.d.ts +0 -370
- package/prisma/generated/paymentdb/runtime/index-browser.js +0 -16
- package/prisma/generated/paymentdb/runtime/library.d.ts +0 -3687
- package/prisma/generated/paymentdb/runtime/library.js +0 -146
- package/prisma/generated/paymentdb/runtime/react-native.js +0 -83
- package/prisma/generated/paymentdb/runtime/wasm-compiler-edge.js +0 -83
- package/prisma/generated/paymentdb/runtime/wasm-engine-edge.js +0 -35
- package/prisma/generated/paymentdb/schema.prisma +0 -199
- package/prisma/generated/paymentdb/wasm.d.ts +0 -1
- package/prisma/generated/paymentdb/wasm.js +0 -338
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cowris/paymentdb-client",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "This is a Prisma Client package for the Cowris PaymentDB. It provides a simple interface to interact with the Payment database, allowing you to perform CRUD operations on payment and transaction data and related tables.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"private": false,
|
|
@@ -23,16 +23,19 @@
|
|
|
23
23
|
},
|
|
24
24
|
"homepage": "https://github.com/Cowristech/services-paymentdb#readme",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@prisma/
|
|
27
|
-
"dotenv": "^16.
|
|
26
|
+
"@prisma/adapter-pg": "^7.2.0",
|
|
27
|
+
"dotenv": "^16.6.1",
|
|
28
|
+
"pg": "^8.16.3",
|
|
28
29
|
"uuid": "^11.1.0"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
|
-
"
|
|
32
|
+
"@types/node": "^25.0.3",
|
|
33
|
+
"@types/pg": "^8.16.0",
|
|
34
|
+
"prisma": "^7.2.0"
|
|
32
35
|
},
|
|
33
36
|
"peerDependencies": {
|
|
34
|
-
"@prisma/client": "^
|
|
35
|
-
"prisma": "
|
|
37
|
+
"@prisma/client": "^7.2.0",
|
|
38
|
+
"prisma": ""
|
|
36
39
|
},
|
|
37
40
|
"files": [
|
|
38
41
|
"index.js",
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
model Currency {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
created_at DateTime @default(now())
|
|
8
|
-
updated_at DateTime @updatedAt
|
|
2
|
+
id String @id @default(uuid())
|
|
3
|
+
name String
|
|
4
|
+
code String @unique // NGN, USD, EUR
|
|
5
|
+
symbol String // ₦, $, €
|
|
6
|
+
country String
|
|
9
7
|
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
minor_unit String // kobo, cent, e.t.c
|
|
9
|
+
minor_unit_factor Int
|
|
10
|
+
|
|
11
|
+
created_at DateTime @default(now())
|
|
12
|
+
updated_at DateTime @updatedAt
|
|
13
|
+
|
|
14
|
+
payment_providers GlobalPaymentProvider[]
|
|
15
|
+
accounts PaymentAccount[]
|
|
12
16
|
}
|
|
@@ -13,8 +13,9 @@ model Funding {
|
|
|
13
13
|
id String @id @default(uuid())
|
|
14
14
|
transaction_id String @unique
|
|
15
15
|
account_id String
|
|
16
|
+
managed_wallet_id String?
|
|
16
17
|
status String
|
|
17
|
-
amount
|
|
18
|
+
amount Int
|
|
18
19
|
source_currency_id String?
|
|
19
20
|
destination_currency_id String
|
|
20
21
|
sender_account_information_id String? @unique
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
model Hold {
|
|
2
|
+
id String @id @default(uuid())
|
|
3
|
+
|
|
4
|
+
account_id String
|
|
5
|
+
managed_wallet_id String?
|
|
6
|
+
amount Int // kobo
|
|
7
|
+
currency_id String
|
|
8
|
+
|
|
9
|
+
reference String @unique
|
|
10
|
+
reason HoldReason
|
|
11
|
+
|
|
12
|
+
status HoldStatus
|
|
13
|
+
expires_at DateTime
|
|
14
|
+
|
|
15
|
+
// linkage
|
|
16
|
+
transfer_id String? // internal transfer
|
|
17
|
+
payment_intent_id String?
|
|
18
|
+
webhookEventId String?
|
|
19
|
+
|
|
20
|
+
created_at DateTime @default(now())
|
|
21
|
+
updated_at DateTime @updatedAt
|
|
22
|
+
|
|
23
|
+
@@index([account_id])
|
|
24
|
+
@@index([status])
|
|
25
|
+
@@index([expires_at])
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
enum HoldStatus {
|
|
29
|
+
ACTIVE
|
|
30
|
+
CONSUMED
|
|
31
|
+
RELEASED
|
|
32
|
+
EXPIRED
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
enum HoldReason {
|
|
36
|
+
TRANSFER
|
|
37
|
+
WITHDRAWAL
|
|
38
|
+
REVERSAL
|
|
39
|
+
}
|
|
@@ -7,7 +7,8 @@ model ManagedWallet {
|
|
|
7
7
|
wallet_customer_phone String?
|
|
8
8
|
account_number String?
|
|
9
9
|
email String?
|
|
10
|
-
|
|
10
|
+
total_balance Int @default(0) // based on currency's smallest unit
|
|
11
|
+
available_balance Int @default(0) // based on currency's smallest unit
|
|
11
12
|
currency_id String
|
|
12
13
|
global_payment_provider_id String
|
|
13
14
|
type String
|
package/prisma/schema/migrations/20251029145728_remove_unnecessary_unique_constraint/migration.sql
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Warnings:
|
|
3
|
+
|
|
4
|
+
- A unique constraint covering the columns `[reference_id]` on the table `Transaction` will be added. If there are existing duplicate values, this will fail.
|
|
5
|
+
- Made the column `reference_id` on table `Transaction` required. This step will fail if there are existing NULL values in that column.
|
|
6
|
+
|
|
7
|
+
*/
|
|
8
|
+
-- DropIndex
|
|
9
|
+
DROP INDEX "Transfer_destination_currency_id_key";
|
|
10
|
+
|
|
11
|
+
-- DropIndex
|
|
12
|
+
DROP INDEX "Transfer_source_currency_id_key";
|
|
13
|
+
|
|
14
|
+
-- DropIndex
|
|
15
|
+
DROP INDEX "Withdrawal_destination_currency_id_key";
|
|
16
|
+
|
|
17
|
+
-- DropIndex
|
|
18
|
+
DROP INDEX "Withdrawal_source_currency_id_key";
|
|
19
|
+
|
|
20
|
+
-- AlterTable
|
|
21
|
+
ALTER TABLE "Transaction" ALTER COLUMN "reference_id" SET NOT NULL;
|
|
22
|
+
|
|
23
|
+
-- CreateIndex
|
|
24
|
+
CREATE UNIQUE INDEX "Transaction_reference_id_key" ON "Transaction"("reference_id");
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Warnings:
|
|
3
|
+
|
|
4
|
+
- You are about to drop the `Currency` table. If the table is not empty, all the data it contains will be lost.
|
|
5
|
+
- You are about to drop the `Funding` table. If the table is not empty, all the data it contains will be lost.
|
|
6
|
+
- You are about to drop the `GlobalPaymentProvider` table. If the table is not empty, all the data it contains will be lost.
|
|
7
|
+
- You are about to drop the `ManagedWallet` table. If the table is not empty, all the data it contains will be lost.
|
|
8
|
+
- You are about to drop the `Otp` table. If the table is not empty, all the data it contains will be lost.
|
|
9
|
+
- You are about to drop the `PaymentAccount` table. If the table is not empty, all the data it contains will be lost.
|
|
10
|
+
- You are about to drop the `Reversal` table. If the table is not empty, all the data it contains will be lost.
|
|
11
|
+
- You are about to drop the `SenderAccountInformation` table. If the table is not empty, all the data it contains will be lost.
|
|
12
|
+
- You are about to drop the `Transaction` table. If the table is not empty, all the data it contains will be lost.
|
|
13
|
+
- You are about to drop the `Transfer` table. If the table is not empty, all the data it contains will be lost.
|
|
14
|
+
- You are about to drop the `TransferDestinationAccountDetails` table. If the table is not empty, all the data it contains will be lost.
|
|
15
|
+
- You are about to drop the `Withdrawal` table. If the table is not empty, all the data it contains will be lost.
|
|
16
|
+
- You are about to drop the `WithdrawalDestinationAccountDetails` table. If the table is not empty, all the data it contains will be lost.
|
|
17
|
+
- You are about to drop the `_CurrencyToGlobalPaymentProvider` table. If the table is not empty, all the data it contains will be lost.
|
|
18
|
+
|
|
19
|
+
*/
|
|
20
|
+
-- DropForeignKey
|
|
21
|
+
ALTER TABLE "Funding" DROP CONSTRAINT "Funding_sender_account_information_id_fkey";
|
|
22
|
+
|
|
23
|
+
-- DropForeignKey
|
|
24
|
+
ALTER TABLE "ManagedWallet" DROP CONSTRAINT "ManagedWallet_account_id_fkey";
|
|
25
|
+
|
|
26
|
+
-- DropForeignKey
|
|
27
|
+
ALTER TABLE "PaymentAccount" DROP CONSTRAINT "PaymentAccount_currency_id_fkey";
|
|
28
|
+
|
|
29
|
+
-- DropForeignKey
|
|
30
|
+
ALTER TABLE "Transaction" DROP CONSTRAINT "Transaction_account_id_fkey";
|
|
31
|
+
|
|
32
|
+
-- DropForeignKey
|
|
33
|
+
ALTER TABLE "Transaction" DROP CONSTRAINT "Transaction_funding_id_fkey";
|
|
34
|
+
|
|
35
|
+
-- DropForeignKey
|
|
36
|
+
ALTER TABLE "Transaction" DROP CONSTRAINT "Transaction_provider_id_fkey";
|
|
37
|
+
|
|
38
|
+
-- DropForeignKey
|
|
39
|
+
ALTER TABLE "Transaction" DROP CONSTRAINT "Transaction_reversal_id_fkey";
|
|
40
|
+
|
|
41
|
+
-- DropForeignKey
|
|
42
|
+
ALTER TABLE "Transaction" DROP CONSTRAINT "Transaction_transfer_id_fkey";
|
|
43
|
+
|
|
44
|
+
-- DropForeignKey
|
|
45
|
+
ALTER TABLE "Transaction" DROP CONSTRAINT "Transaction_withdrawal_id_fkey";
|
|
46
|
+
|
|
47
|
+
-- DropForeignKey
|
|
48
|
+
ALTER TABLE "Transfer" DROP CONSTRAINT "Transfer_destination_account_details_id_fkey";
|
|
49
|
+
|
|
50
|
+
-- DropForeignKey
|
|
51
|
+
ALTER TABLE "Withdrawal" DROP CONSTRAINT "Withdrawal_destination_account_details_id_fkey";
|
|
52
|
+
|
|
53
|
+
-- DropForeignKey
|
|
54
|
+
ALTER TABLE "_CurrencyToGlobalPaymentProvider" DROP CONSTRAINT "_CurrencyToGlobalPaymentProvider_A_fkey";
|
|
55
|
+
|
|
56
|
+
-- DropForeignKey
|
|
57
|
+
ALTER TABLE "_CurrencyToGlobalPaymentProvider" DROP CONSTRAINT "_CurrencyToGlobalPaymentProvider_B_fkey";
|
|
58
|
+
|
|
59
|
+
-- DropTable
|
|
60
|
+
DROP TABLE "Currency";
|
|
61
|
+
|
|
62
|
+
-- DropTable
|
|
63
|
+
DROP TABLE "Funding";
|
|
64
|
+
|
|
65
|
+
-- DropTable
|
|
66
|
+
DROP TABLE "GlobalPaymentProvider";
|
|
67
|
+
|
|
68
|
+
-- DropTable
|
|
69
|
+
DROP TABLE "ManagedWallet";
|
|
70
|
+
|
|
71
|
+
-- DropTable
|
|
72
|
+
DROP TABLE "Otp";
|
|
73
|
+
|
|
74
|
+
-- DropTable
|
|
75
|
+
DROP TABLE "PaymentAccount";
|
|
76
|
+
|
|
77
|
+
-- DropTable
|
|
78
|
+
DROP TABLE "Reversal";
|
|
79
|
+
|
|
80
|
+
-- DropTable
|
|
81
|
+
DROP TABLE "SenderAccountInformation";
|
|
82
|
+
|
|
83
|
+
-- DropTable
|
|
84
|
+
DROP TABLE "Transaction";
|
|
85
|
+
|
|
86
|
+
-- DropTable
|
|
87
|
+
DROP TABLE "Transfer";
|
|
88
|
+
|
|
89
|
+
-- DropTable
|
|
90
|
+
DROP TABLE "TransferDestinationAccountDetails";
|
|
91
|
+
|
|
92
|
+
-- DropTable
|
|
93
|
+
DROP TABLE "Withdrawal";
|
|
94
|
+
|
|
95
|
+
-- DropTable
|
|
96
|
+
DROP TABLE "WithdrawalDestinationAccountDetails";
|
|
97
|
+
|
|
98
|
+
-- DropTable
|
|
99
|
+
DROP TABLE "_CurrencyToGlobalPaymentProvider";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
model PaymentIntent {
|
|
2
|
+
id String @id @default(uuid())
|
|
3
|
+
reference String @unique
|
|
4
|
+
account_id String
|
|
5
|
+
managed_wallet_id String?
|
|
6
|
+
amount Int // amount in kobo
|
|
7
|
+
currency_id String // NGN, USD, etc
|
|
8
|
+
global_payment_provider_id String
|
|
9
|
+
provider_intent_id String?
|
|
10
|
+
status PaymentIntentStatus
|
|
11
|
+
metadata Json?
|
|
12
|
+
created_at DateTime @default(now())
|
|
13
|
+
updated_at DateTime @updatedAt
|
|
14
|
+
|
|
15
|
+
webhook_events WebhookEvent[]
|
|
16
|
+
|
|
17
|
+
@@index([account_id])
|
|
18
|
+
@@index([reference])
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
enum PaymentIntentStatus {
|
|
22
|
+
PENDING
|
|
23
|
+
SUCCEEDED
|
|
24
|
+
FAILED
|
|
25
|
+
CANCELLED
|
|
26
|
+
}
|
|
@@ -14,8 +14,8 @@ model Transfer {
|
|
|
14
14
|
from_account_id String
|
|
15
15
|
to_account_id String?
|
|
16
16
|
destination_account_details_id String? @unique
|
|
17
|
-
source_currency_id String
|
|
18
|
-
destination_currency_id String
|
|
17
|
+
source_currency_id String
|
|
18
|
+
destination_currency_id String
|
|
19
19
|
amount_in_source_currency String
|
|
20
20
|
amount_in_destination_currency String
|
|
21
21
|
status String
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
model WebhookEvent {
|
|
2
|
+
id String @id @default(uuid())
|
|
3
|
+
provider_id String
|
|
4
|
+
event_type EventType
|
|
5
|
+
reference String @unique
|
|
6
|
+
provider_event_id String? // Paystack transaction ID
|
|
7
|
+
payload Json
|
|
8
|
+
verified Boolean @default(false)
|
|
9
|
+
processed Boolean @default(false)
|
|
10
|
+
received_at DateTime @default(now())
|
|
11
|
+
processed_at DateTime?
|
|
12
|
+
|
|
13
|
+
payment_intent_id String?
|
|
14
|
+
paymentIntent PaymentIntent? @relation(fields: [payment_intent_id], references: [id])
|
|
15
|
+
|
|
16
|
+
@@index([reference])
|
|
17
|
+
@@index([processed])
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
enum EventType {
|
|
21
|
+
FUNDING_SUCCESS
|
|
22
|
+
FUNDING_FAILED
|
|
23
|
+
WITHDRAWAL_SUCCESS
|
|
24
|
+
WITHDRAWAL_FAILED
|
|
25
|
+
REVERSAL_SUCCESS
|
|
26
|
+
REVERSAL_FAILED
|
|
27
|
+
TRANSFER_SUCCESS
|
|
28
|
+
TRANSFER_FAILED
|
|
29
|
+
}
|
|
@@ -16,8 +16,8 @@ model Withdrawal {
|
|
|
16
16
|
status String
|
|
17
17
|
|
|
18
18
|
destination_account_details_id String? @unique
|
|
19
|
-
source_currency_id String
|
|
20
|
-
destination_currency_id String
|
|
19
|
+
source_currency_id String
|
|
20
|
+
destination_currency_id String
|
|
21
21
|
amount_in_destination_currency String
|
|
22
22
|
|
|
23
23
|
transaction Transaction?
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./index"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./index"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./default"
|