@takentrade/takentrade-libs 4.1.8 → 4.1.9
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/README.md +14 -102
- package/dist/common/index.d.ts +0 -2
- package/dist/common/index.js +0 -2
- package/dist/common/utils/index.d.ts +0 -1
- package/dist/common/utils/index.js +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/nats/events/ajo.events.d.ts +14 -0
- package/dist/nats/events/index.d.ts +10 -174
- package/dist/nats/events/index.js +24 -0
- package/dist/nats/events/loans.events.d.ts +19 -0
- package/dist/nats/events/loans.events.js +2 -0
- package/dist/nats/events/notification.events.d.ts +8 -0
- package/dist/nats/events/notification.events.js +2 -0
- package/dist/nats/events/payment.events.d.ts +40 -0
- package/dist/nats/events/payment.events.js +2 -0
- package/dist/nats/events/providus.events.d.ts +14 -0
- package/dist/nats/events/providus.events.js +2 -0
- package/dist/nats/events/referral.events.d.ts +7 -0
- package/dist/nats/events/referral.events.js +2 -0
- package/dist/nats/events/savings.events.d.ts +11 -0
- package/dist/nats/events/savings.events.js +2 -0
- package/dist/nats/events/user.events.d.ts +35 -0
- package/dist/nats/events/user.events.js +2 -0
- package/dist/nats/events/vas.events.d.ts +12 -0
- package/dist/nats/events/vas.events.js +2 -0
- package/dist/nats/events/withdrawal.events.d.ts +9 -0
- package/dist/nats/events/withdrawal.events.js +2 -0
- package/dist/notification/broadcast-templates.d.ts +20 -20
- package/dist/notification/broadcast-templates.js +20 -20
- package/dist/rpc/rpc.client.d.ts +6 -8
- package/dist/rpc/rpc.client.js +59 -62
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/enums/subaccount.enum.d.ts +0 -4
- package/dist/utils/enums/subaccount.enum.js +1 -6
- package/dist/utils/index.d.ts +0 -2
- package/dist/utils/index.js +0 -2
- package/dist/utils/interfaces/index.d.ts +0 -1
- package/dist/utils/interfaces/index.js +0 -1
- package/dist/utils/utils/index.d.ts +0 -1
- package/dist/utils/utils/index.js +0 -1
- package/package.json +4 -5
- package/dist/bullmq/bullmq.module.d.ts +0 -2
- package/dist/bullmq/bullmq.module.js +0 -16
- package/dist/bullmq/bullmq.service.d.ts +0 -2
- package/dist/bullmq/bullmq.service.js +0 -16
- package/dist/bullmq/config/bull.config.d.ts +0 -22
- package/dist/bullmq/config/bull.config.js +0 -28
- package/dist/bullmq/index.d.ts +0 -2
- package/dist/bullmq/index.js +0 -18
- package/dist/common/dto/account.dto.d.ts +0 -18
- package/dist/common/dto/account.dto.js +0 -68
- package/dist/common/dto/index.d.ts +0 -2
- package/dist/common/dto/index.js +0 -18
- package/dist/common/dto/user.dto.d.ts +0 -34
- package/dist/common/dto/user.dto.js +0 -132
- package/dist/common/enums/index.d.ts +0 -3
- package/dist/common/enums/index.js +0 -19
- package/dist/common/enums/support-action.enum.d.ts +0 -7
- package/dist/common/enums/support-action.enum.js +0 -11
- package/dist/common/enums/ticket.enum.d.ts +0 -19
- package/dist/common/enums/ticket.enum.js +0 -25
- package/dist/common/enums/transaction.enum.d.ts +0 -85
- package/dist/common/enums/transaction.enum.js +0 -97
- package/dist/common/utils/string.utils.d.ts +0 -10
- package/dist/common/utils/string.utils.js +0 -34
- package/dist/utils/helpers/penalty.util.d.ts +0 -25
- package/dist/utils/helpers/penalty.util.js +0 -40
- package/dist/utils/helpers/role.util.d.ts +0 -8
- package/dist/utils/helpers/role.util.js +0 -18
- package/dist/utils/interfaces/general.interface.d.ts +0 -13
- package/dist/utils/utils/otp.d.ts +0 -1
- package/dist/utils/utils/otp.js +0 -102
- /package/dist/{utils/interfaces/general.interface.js → nats/events/ajo.events.js} +0 -0
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# TakeNTrade Microservices Libraries
|
|
2
2
|
|
|
3
|
-
Shared libraries for the TakeNTrade microservices architecture
|
|
3
|
+
Shared libraries for the TakeNTrade microservices architecture.
|
|
4
|
+
|
|
5
|
+
This package provides shared authentication, caching, messaging, notification, and utility contracts used by the service repos.
|
|
4
6
|
|
|
5
7
|
## Installation
|
|
6
8
|
|
|
@@ -8,6 +10,16 @@ Shared libraries for the TakeNTrade microservices architecture, providing authen
|
|
|
8
10
|
npm install @takentrade/takentrade-libs
|
|
9
11
|
```
|
|
10
12
|
|
|
13
|
+
## Development
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm run build
|
|
17
|
+
npm run test
|
|
18
|
+
npm run typecheck
|
|
19
|
+
npm run format
|
|
20
|
+
npm run format:check
|
|
21
|
+
```
|
|
22
|
+
|
|
11
23
|
## Quick Start
|
|
12
24
|
|
|
13
25
|
```typescript
|
|
@@ -38,108 +50,8 @@ For authentication, services can extend the shared `TntBaseAuthGuard` and pair i
|
|
|
38
50
|
| ------------------ | ---------------------------------------------- | ---------------------------------------------- |
|
|
39
51
|
| **Authentication** | Route protection and role-based access control | [docs/auth.md](docs/auth.md) |
|
|
40
52
|
| **Cache** | Redis-based caching with TTL support | [docs/cache.md](docs/cache.md) |
|
|
41
|
-
| **BullMQ** | Background job processing and queues | [docs/bullmq.md](docs/bullmq.md) |
|
|
42
53
|
| **NATS** | Microservice messaging and event streaming | [docs/nats.md](docs/nats.md) |
|
|
43
54
|
| **Notifications** | Email, SMS, and push notifications | [docs/notifications.md](docs/notifications.md) |
|
|
44
55
|
| **RPC** | Request-response patterns for NATS | [docs/rpc.md](docs/rpc.md) |
|
|
45
|
-
| **Common** | Shared constants
|
|
56
|
+
| **Common** | Shared constants and utilities | [docs/common.md](docs/common.md) |
|
|
46
57
|
| **Utils** | DTOs, pipes, filters, and helpers | [docs/utils.md](docs/utils.md) |
|
|
47
|
-
|
|
48
|
-
## Features
|
|
49
|
-
|
|
50
|
-
### 🔐 Authentication & Authorization
|
|
51
|
-
|
|
52
|
-
- `@Public()` and `@Roles()` decorators
|
|
53
|
-
- `TntBaseAuthGuard` for shared JWT guard behavior
|
|
54
|
-
- JWT-based authentication support
|
|
55
|
-
- Role-based access control
|
|
56
|
-
|
|
57
|
-
### 💾 Caching
|
|
58
|
-
|
|
59
|
-
- Redis integration with ioredis
|
|
60
|
-
- TTL support
|
|
61
|
-
- Hash operations
|
|
62
|
-
- Auto-reconnection
|
|
63
|
-
|
|
64
|
-
### 🚀 Background Jobs
|
|
65
|
-
|
|
66
|
-
- BullMQ integration
|
|
67
|
-
- Job scheduling and retries
|
|
68
|
-
- Delayed and repeatable jobs
|
|
69
|
-
- Progress tracking
|
|
70
|
-
|
|
71
|
-
### 📨 Messaging
|
|
72
|
-
|
|
73
|
-
- NATS integration
|
|
74
|
-
- Event patterns
|
|
75
|
-
- Request-response (RPC)
|
|
76
|
-
- Subject constants
|
|
77
|
-
- Automatic logging
|
|
78
|
-
|
|
79
|
-
### 📧 Notifications
|
|
80
|
-
|
|
81
|
-
- Email (verification, OTP, password reset, etc.)
|
|
82
|
-
- SMS notifications
|
|
83
|
-
- Push notifications
|
|
84
|
-
- Template support
|
|
85
|
-
|
|
86
|
-
## Environment Variables
|
|
87
|
-
|
|
88
|
-
```env
|
|
89
|
-
# Cache & BullMQ
|
|
90
|
-
REDIS_HOST=localhost
|
|
91
|
-
REDIS_PORT=6379
|
|
92
|
-
REDIS_PASSWORD=your_password
|
|
93
|
-
|
|
94
|
-
# NATS
|
|
95
|
-
NATS_URL=nats://localhost:4222
|
|
96
|
-
NATS_SERVICE_QUEUE=service_queue
|
|
97
|
-
|
|
98
|
-
# JWT
|
|
99
|
-
JWT_SECRET=your_jwt_secret
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
## Usage Examples
|
|
103
|
-
|
|
104
|
-
### Cache
|
|
105
|
-
|
|
106
|
-
```typescript
|
|
107
|
-
await this.cacheService.set('key', 'value', 3600); // 1 hour TTL
|
|
108
|
-
const value = await this.cacheService.get('key');
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
### Background Jobs
|
|
112
|
-
|
|
113
|
-
```typescript
|
|
114
|
-
await this.queue.add(
|
|
115
|
-
'process-order',
|
|
116
|
-
{ orderId: '123' },
|
|
117
|
-
{
|
|
118
|
-
attempts: 3,
|
|
119
|
-
backoff: { type: 'exponential', delay: 1000 },
|
|
120
|
-
}
|
|
121
|
-
);
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
## Documentation
|
|
125
|
-
|
|
126
|
-
- [Authentication](docs/auth.md) - Route protection and RBAC
|
|
127
|
-
- [Cache](docs/cache.md) - Redis caching
|
|
128
|
-
- [BullMQ](docs/bullmq.md) - Background jobs
|
|
129
|
-
- [NATS](docs/nats.md) - Messaging
|
|
130
|
-
- [Notifications](docs/notifications.md) - Email, SMS, push
|
|
131
|
-
- [RPC](docs/rpc.md) - Request-response patterns
|
|
132
|
-
- [Common](docs/common.md) - Shared utilities
|
|
133
|
-
- [Utils](docs/utils.md) - DTOs, pipes, filters
|
|
134
|
-
|
|
135
|
-
## Contributing
|
|
136
|
-
|
|
137
|
-
This is a private package for TakeNTrade microservices.
|
|
138
|
-
|
|
139
|
-
## License
|
|
140
|
-
|
|
141
|
-
Proprietary - See [LICENSE](LICENSE) file for details.
|
|
142
|
-
|
|
143
|
-
## Support
|
|
144
|
-
|
|
145
|
-
For issues or questions, contact the TakeNTrade development team.
|
package/dist/common/index.d.ts
CHANGED
package/dist/common/index.js
CHANGED
|
@@ -15,6 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./constants"), exports);
|
|
18
|
-
__exportStar(require("./enums"), exports);
|
|
19
18
|
__exportStar(require("./utils"), exports);
|
|
20
|
-
__exportStar(require("./dto"), exports);
|
|
@@ -14,6 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./string.utils"), exports);
|
|
18
17
|
__exportStar(require("./random.utils"), exports);
|
|
19
18
|
__exportStar(require("./reference.utils"), exports);
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -16,7 +16,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./nats"), exports);
|
|
18
18
|
__exportStar(require("./common"), exports);
|
|
19
|
-
__exportStar(require("./bullmq"), exports);
|
|
20
19
|
__exportStar(require("./cache"), exports);
|
|
21
20
|
__exportStar(require("./utils"), exports);
|
|
22
21
|
__exportStar(require("./rpc"), exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface AjoContributionEvent {
|
|
2
|
+
ajoId: string;
|
|
3
|
+
userId: string;
|
|
4
|
+
amount: number;
|
|
5
|
+
reference: string;
|
|
6
|
+
status: 'PENDING' | 'SUCCESSFUL' | 'FAILED' | 'REVERSED';
|
|
7
|
+
timestamp: string;
|
|
8
|
+
}
|
|
9
|
+
export interface AjoMemberJoinedEvent {
|
|
10
|
+
ajoId: string;
|
|
11
|
+
userId: string;
|
|
12
|
+
joinedAt: string;
|
|
13
|
+
timestamp: string;
|
|
14
|
+
}
|
|
@@ -1,174 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
firstname?: string;
|
|
12
|
-
lastname?: string;
|
|
13
|
-
middlename?: string;
|
|
14
|
-
gender?: string;
|
|
15
|
-
dateOfBirth?: string;
|
|
16
|
-
referralCode?: string;
|
|
17
|
-
createdAt: string;
|
|
18
|
-
}
|
|
19
|
-
export interface PaymentSuccessEvent {
|
|
20
|
-
transactionId: string;
|
|
21
|
-
userId: string;
|
|
22
|
-
amount: number;
|
|
23
|
-
fee?: number;
|
|
24
|
-
currency: string;
|
|
25
|
-
category?: string;
|
|
26
|
-
provider: 'PROVIDUS' | 'PAYSTACK';
|
|
27
|
-
reference: string;
|
|
28
|
-
providerReference?: string;
|
|
29
|
-
balanceBefore?: number;
|
|
30
|
-
balanceAfter?: number;
|
|
31
|
-
metadata?: Record<string, any>;
|
|
32
|
-
timestamp: string;
|
|
33
|
-
}
|
|
34
|
-
export interface PaymentFailedEvent {
|
|
35
|
-
transactionId: string;
|
|
36
|
-
userId: string;
|
|
37
|
-
amount: number;
|
|
38
|
-
currency: string;
|
|
39
|
-
provider: 'PROVIDUS' | 'PAYSTACK';
|
|
40
|
-
reference: string;
|
|
41
|
-
reason: string;
|
|
42
|
-
errorCode?: string;
|
|
43
|
-
timestamp: string;
|
|
44
|
-
}
|
|
45
|
-
export interface TransactionProcessedEvent {
|
|
46
|
-
transactionId: string;
|
|
47
|
-
userId: string;
|
|
48
|
-
type: 'CREDIT' | 'DEBIT';
|
|
49
|
-
category: string;
|
|
50
|
-
amount: number;
|
|
51
|
-
fee: number;
|
|
52
|
-
balanceBefore: number;
|
|
53
|
-
balanceAfter: number;
|
|
54
|
-
reference: string;
|
|
55
|
-
description: string;
|
|
56
|
-
metadata?: Record<string, any>;
|
|
57
|
-
timestamp: string;
|
|
58
|
-
}
|
|
59
|
-
export interface NotificationSentEvent {
|
|
60
|
-
notificationId: string;
|
|
61
|
-
userId: string;
|
|
62
|
-
channel: 'EMAIL' | 'SMS' | 'PUSH' | 'VOICE';
|
|
63
|
-
type: string;
|
|
64
|
-
status: 'SENT' | 'FAILED';
|
|
65
|
-
timestamp: string;
|
|
66
|
-
}
|
|
67
|
-
export interface SavingsMaturedEvent {
|
|
68
|
-
savingsId: string;
|
|
69
|
-
userId: string;
|
|
70
|
-
amount: number;
|
|
71
|
-
interest: number;
|
|
72
|
-
interestRate?: number;
|
|
73
|
-
balance: number;
|
|
74
|
-
plan: string;
|
|
75
|
-
maturityDate: string;
|
|
76
|
-
timestamp: string;
|
|
77
|
-
}
|
|
78
|
-
export interface LoanApprovedEvent {
|
|
79
|
-
loanId: string;
|
|
80
|
-
userId: string;
|
|
81
|
-
amount: number;
|
|
82
|
-
interestRate: number;
|
|
83
|
-
totalInterest: number;
|
|
84
|
-
processingFee: number;
|
|
85
|
-
duration: string;
|
|
86
|
-
repaymentDate: string;
|
|
87
|
-
timestamp: string;
|
|
88
|
-
}
|
|
89
|
-
export interface LoanRepaidEvent {
|
|
90
|
-
loanId: string;
|
|
91
|
-
userId: string;
|
|
92
|
-
amount: number;
|
|
93
|
-
remainingBalance: number;
|
|
94
|
-
reference?: string;
|
|
95
|
-
timestamp: string;
|
|
96
|
-
}
|
|
97
|
-
export interface CreateProvidusAccountEvent {
|
|
98
|
-
userId: string;
|
|
99
|
-
bvn?: string;
|
|
100
|
-
firstName?: string;
|
|
101
|
-
lastName?: string;
|
|
102
|
-
dateOfBirth?: string;
|
|
103
|
-
phoneNumber?: string;
|
|
104
|
-
email?: string;
|
|
105
|
-
address?: string;
|
|
106
|
-
}
|
|
107
|
-
export interface KycVerifiedEvent {
|
|
108
|
-
userId: string;
|
|
109
|
-
verificationId: string;
|
|
110
|
-
bvn: string;
|
|
111
|
-
timestamp: string;
|
|
112
|
-
}
|
|
113
|
-
export interface KycRejectedEvent {
|
|
114
|
-
userId: string;
|
|
115
|
-
verificationId: string;
|
|
116
|
-
reason: string;
|
|
117
|
-
timestamp: string;
|
|
118
|
-
}
|
|
119
|
-
export interface VasTransactionEvent {
|
|
120
|
-
transactionId: string;
|
|
121
|
-
userId: string;
|
|
122
|
-
serviceId: string;
|
|
123
|
-
category: TransactionCategory;
|
|
124
|
-
amount: number;
|
|
125
|
-
recipientIdentifier: string;
|
|
126
|
-
status: TransactionStatus;
|
|
127
|
-
provider: string;
|
|
128
|
-
reference: string;
|
|
129
|
-
timestamp: string;
|
|
130
|
-
}
|
|
131
|
-
export interface AjoContributionEvent {
|
|
132
|
-
ajoId: string;
|
|
133
|
-
userId: string;
|
|
134
|
-
amount: number;
|
|
135
|
-
reference: string;
|
|
136
|
-
status: TransactionStatus;
|
|
137
|
-
timestamp: string;
|
|
138
|
-
}
|
|
139
|
-
export interface AjoMemberJoinedEvent {
|
|
140
|
-
ajoId: string;
|
|
141
|
-
userId: string;
|
|
142
|
-
joinedAt: string;
|
|
143
|
-
timestamp: string;
|
|
144
|
-
}
|
|
145
|
-
export interface ReferralRewardClaimedEvent {
|
|
146
|
-
userId: string;
|
|
147
|
-
referralId: string;
|
|
148
|
-
amount: number;
|
|
149
|
-
reference: string;
|
|
150
|
-
timestamp: string;
|
|
151
|
-
}
|
|
152
|
-
export interface WithdrawalRequestedEvent {
|
|
153
|
-
withdrawalId: string;
|
|
154
|
-
userId: string;
|
|
155
|
-
amount: number;
|
|
156
|
-
bankName: string;
|
|
157
|
-
accountNumber: string;
|
|
158
|
-
status: TransactionStatus;
|
|
159
|
-
timestamp: string;
|
|
160
|
-
}
|
|
161
|
-
export interface ProvidusDebitEvent {
|
|
162
|
-
userId: string;
|
|
163
|
-
amount: number;
|
|
164
|
-
reference: string;
|
|
165
|
-
metadata?: Record<string, any>;
|
|
166
|
-
timestamp: string;
|
|
167
|
-
}
|
|
168
|
-
export interface ProvidusCreditEvent {
|
|
169
|
-
userId: string;
|
|
170
|
-
amount: number;
|
|
171
|
-
reference: string;
|
|
172
|
-
metadata?: Record<string, any>;
|
|
173
|
-
timestamp: string;
|
|
174
|
-
}
|
|
1
|
+
export * from './user.events';
|
|
2
|
+
export * from './payment.events';
|
|
3
|
+
export * from './notification.events';
|
|
4
|
+
export * from './savings.events';
|
|
5
|
+
export * from './loans.events';
|
|
6
|
+
export * from './vas.events';
|
|
7
|
+
export * from './ajo.events';
|
|
8
|
+
export * from './referral.events';
|
|
9
|
+
export * from './withdrawal.events';
|
|
10
|
+
export * from './providus.events';
|
|
@@ -1,2 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./user.events"), exports);
|
|
18
|
+
__exportStar(require("./payment.events"), exports);
|
|
19
|
+
__exportStar(require("./notification.events"), exports);
|
|
20
|
+
__exportStar(require("./savings.events"), exports);
|
|
21
|
+
__exportStar(require("./loans.events"), exports);
|
|
22
|
+
__exportStar(require("./vas.events"), exports);
|
|
23
|
+
__exportStar(require("./ajo.events"), exports);
|
|
24
|
+
__exportStar(require("./referral.events"), exports);
|
|
25
|
+
__exportStar(require("./withdrawal.events"), exports);
|
|
26
|
+
__exportStar(require("./providus.events"), exports);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface LoanApprovedEvent {
|
|
2
|
+
loanId: string;
|
|
3
|
+
userId: string;
|
|
4
|
+
amount: number;
|
|
5
|
+
interestRate: number;
|
|
6
|
+
totalInterest: number;
|
|
7
|
+
processingFee: number;
|
|
8
|
+
duration: string;
|
|
9
|
+
repaymentDate: string;
|
|
10
|
+
timestamp: string;
|
|
11
|
+
}
|
|
12
|
+
export interface LoanRepaidEvent {
|
|
13
|
+
loanId: string;
|
|
14
|
+
userId: string;
|
|
15
|
+
amount: number;
|
|
16
|
+
remainingBalance: number;
|
|
17
|
+
reference?: string;
|
|
18
|
+
timestamp: string;
|
|
19
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export interface PaymentSuccessEvent {
|
|
2
|
+
transactionId: string;
|
|
3
|
+
userId: string;
|
|
4
|
+
amount: number;
|
|
5
|
+
fee?: number;
|
|
6
|
+
currency: string;
|
|
7
|
+
category?: string;
|
|
8
|
+
provider: 'PROVIDUS' | 'PAYSTACK';
|
|
9
|
+
reference: string;
|
|
10
|
+
providerReference?: string;
|
|
11
|
+
balanceBefore?: number;
|
|
12
|
+
balanceAfter?: number;
|
|
13
|
+
metadata?: Record<string, unknown>;
|
|
14
|
+
timestamp: string;
|
|
15
|
+
}
|
|
16
|
+
export interface PaymentFailedEvent {
|
|
17
|
+
transactionId: string;
|
|
18
|
+
userId: string;
|
|
19
|
+
amount: number;
|
|
20
|
+
currency: string;
|
|
21
|
+
provider: 'PROVIDUS' | 'PAYSTACK';
|
|
22
|
+
reference: string;
|
|
23
|
+
reason: string;
|
|
24
|
+
errorCode?: string;
|
|
25
|
+
timestamp: string;
|
|
26
|
+
}
|
|
27
|
+
export interface TransactionProcessedEvent {
|
|
28
|
+
transactionId: string;
|
|
29
|
+
userId: string;
|
|
30
|
+
type: 'CREDIT' | 'DEBIT';
|
|
31
|
+
category: string;
|
|
32
|
+
amount: number;
|
|
33
|
+
fee: number;
|
|
34
|
+
balanceBefore: number;
|
|
35
|
+
balanceAfter: number;
|
|
36
|
+
reference: string;
|
|
37
|
+
description: string;
|
|
38
|
+
metadata?: Record<string, unknown>;
|
|
39
|
+
timestamp: string;
|
|
40
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface ProvidusDebitEvent {
|
|
2
|
+
userId: string;
|
|
3
|
+
amount: number;
|
|
4
|
+
reference: string;
|
|
5
|
+
metadata?: Record<string, unknown>;
|
|
6
|
+
timestamp: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ProvidusCreditEvent {
|
|
9
|
+
userId: string;
|
|
10
|
+
amount: number;
|
|
11
|
+
reference: string;
|
|
12
|
+
metadata?: Record<string, unknown>;
|
|
13
|
+
timestamp: string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export interface UserCreatedEvent {
|
|
2
|
+
userId: string;
|
|
3
|
+
email: string;
|
|
4
|
+
phone: string;
|
|
5
|
+
username: string;
|
|
6
|
+
firstname?: string;
|
|
7
|
+
lastname?: string;
|
|
8
|
+
middlename?: string;
|
|
9
|
+
gender?: string;
|
|
10
|
+
dateOfBirth?: string;
|
|
11
|
+
referralCode?: string;
|
|
12
|
+
createdAt: string;
|
|
13
|
+
}
|
|
14
|
+
export interface CreateProvidusAccountEvent {
|
|
15
|
+
userId: string;
|
|
16
|
+
bvn?: string;
|
|
17
|
+
firstName?: string;
|
|
18
|
+
lastName?: string;
|
|
19
|
+
dateOfBirth?: string;
|
|
20
|
+
phoneNumber?: string;
|
|
21
|
+
email?: string;
|
|
22
|
+
address?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface KycVerifiedEvent {
|
|
25
|
+
userId: string;
|
|
26
|
+
verificationId: string;
|
|
27
|
+
bvn: string;
|
|
28
|
+
timestamp: string;
|
|
29
|
+
}
|
|
30
|
+
export interface KycRejectedEvent {
|
|
31
|
+
userId: string;
|
|
32
|
+
verificationId: string;
|
|
33
|
+
reason: string;
|
|
34
|
+
timestamp: string;
|
|
35
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface VasTransactionEvent {
|
|
2
|
+
transactionId: string;
|
|
3
|
+
userId: string;
|
|
4
|
+
serviceId: string;
|
|
5
|
+
category: string;
|
|
6
|
+
amount: number;
|
|
7
|
+
recipientIdentifier: string;
|
|
8
|
+
status: 'PENDING' | 'SUCCESSFUL' | 'FAILED' | 'REVERSED';
|
|
9
|
+
provider: string;
|
|
10
|
+
reference: string;
|
|
11
|
+
timestamp: string;
|
|
12
|
+
}
|