resurgence-data 1.1.20 → 1.1.22

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.
@@ -0,0 +1 @@
1
+ export declare function generateUUID(): string;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateUUID = generateUUID;
4
+ const uuid_1 = require("uuid");
5
+ function generateUUID() {
6
+ return (0, uuid_1.v4)();
7
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./id-generation";
2
+ export * from "./manipulation";
@@ -0,0 +1,18 @@
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
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./id-generation"), exports);
18
+ __exportStar(require("./manipulation"), exports);
@@ -0,0 +1,4 @@
1
+ export declare function toCamel(s: any): any;
2
+ export declare function isArray(a: any): a is any[];
3
+ export declare function isObject(o: any): boolean;
4
+ export declare function keysToCamelCase(o: any): any;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toCamel = toCamel;
4
+ exports.isArray = isArray;
5
+ exports.isObject = isObject;
6
+ exports.keysToCamelCase = keysToCamelCase;
7
+ function toCamel(s) {
8
+ return s.replace(/([-_][a-z])/gi, ($1) => {
9
+ return $1.toUpperCase().replace("-", "").replace("_", "");
10
+ });
11
+ }
12
+ function isArray(a) {
13
+ return Array.isArray(a);
14
+ }
15
+ function isObject(o) {
16
+ return o === Object(o) && !isArray(o) && typeof o !== "function";
17
+ }
18
+ function keysToCamelCase(o) {
19
+ if (isObject(o)) {
20
+ const n = {};
21
+ Object.keys(o).forEach((k) => {
22
+ n[toCamel(k)] = keysToCamelCase(o[k]);
23
+ });
24
+ return n;
25
+ }
26
+ else if (isArray(o)) {
27
+ return o.map((i) => {
28
+ return keysToCamelCase(i);
29
+ });
30
+ }
31
+ return o;
32
+ }
package/dist/index.d.ts CHANGED
@@ -6,3 +6,5 @@ export * from "./messaging";
6
6
  export * from "./biller";
7
7
  export * from "./payment";
8
8
  export * from "./invoice";
9
+ export * from "./integration";
10
+ export * from "./functions";
package/dist/index.js CHANGED
@@ -22,3 +22,5 @@ __exportStar(require("./messaging"), exports);
22
22
  __exportStar(require("./biller"), exports);
23
23
  __exportStar(require("./payment"), exports);
24
24
  __exportStar(require("./invoice"), exports);
25
+ __exportStar(require("./integration"), exports);
26
+ __exportStar(require("./functions"), exports);
@@ -0,0 +1 @@
1
+ export * from "./payloads";
@@ -0,0 +1,17 @@
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
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./payloads"), exports);
@@ -0,0 +1,165 @@
1
+ export interface FlutterwavePinAuthorizationDTO {
2
+ mode: string;
3
+ pin: string;
4
+ }
5
+ export interface FlutterwaveCardAVSAuthorizationDTO {
6
+ mode: string;
7
+ city: string;
8
+ address: string;
9
+ state: string;
10
+ country: string;
11
+ zipcode: string;
12
+ }
13
+ export interface FlutterwaveCardChargeResponseDTO {
14
+ status: string;
15
+ message: string;
16
+ data: {
17
+ id: number;
18
+ tx_ref: string;
19
+ flw_ref: string;
20
+ device_fingerprint: string;
21
+ amount: number;
22
+ charged_amount: number;
23
+ app_fee: number;
24
+ merchant_fee: number;
25
+ processor_response: string;
26
+ auth_model: string;
27
+ currency: string;
28
+ ip: string;
29
+ narration: string;
30
+ status: string;
31
+ auth_url: string;
32
+ payment_type: string;
33
+ fraud_status: string;
34
+ charge_type: string;
35
+ created_at: string;
36
+ account_id: number;
37
+ customer: {
38
+ id: number;
39
+ phone_number: string;
40
+ name: string;
41
+ email: string;
42
+ created_at: string;
43
+ };
44
+ card: {
45
+ first_6digits: string;
46
+ last_4digits: string;
47
+ issuer: string;
48
+ country: string;
49
+ type: string;
50
+ expiry: string;
51
+ };
52
+ };
53
+ meta: {
54
+ authorization: {
55
+ mode: string;
56
+ fields?: string[];
57
+ endpoint?: string;
58
+ redirect?: string;
59
+ };
60
+ };
61
+ }
62
+ export interface FlutterwaveCardChargePayload {
63
+ cardNumber: string;
64
+ expiryMonth: string;
65
+ expiryYear: string;
66
+ cvv: string;
67
+ currency: string;
68
+ amount: number;
69
+ emailAddress: string;
70
+ fullname: string;
71
+ phoneNumber: string;
72
+ txRef: string;
73
+ redirectUrl: string;
74
+ enckey: string;
75
+ authorization: FlutterwavePinAuthorizationDTO | FlutterwaveCardAVSAuthorizationDTO;
76
+ }
77
+ export interface Flutterwave3DSChargeResponseDTO {
78
+ id: number;
79
+ tx_ref: string;
80
+ flw_ref: string;
81
+ device_fingerprint: string;
82
+ amount: number;
83
+ charged_amount: number;
84
+ app_fee: number;
85
+ merchant_fee: number;
86
+ processor_response: string;
87
+ auth_model: string;
88
+ currency: string;
89
+ ip: string;
90
+ narration: string;
91
+ status: string;
92
+ payment_type: string;
93
+ fraud_status: string;
94
+ charge_type: string;
95
+ created_at: string;
96
+ account_id: number;
97
+ customer: {
98
+ id: number;
99
+ phone_number: string;
100
+ name: string;
101
+ email: string;
102
+ created_at: string;
103
+ };
104
+ card: {
105
+ first_6digits: string;
106
+ last_4digits: string;
107
+ issuer: string;
108
+ country: string;
109
+ type: string;
110
+ expiry: string;
111
+ };
112
+ }
113
+ export interface FlutterwaveCardResponseDTO {
114
+ status: string;
115
+ message: string;
116
+ data?: Flutterwave3DSChargeResponseDTO;
117
+ meta: {
118
+ authorization: {
119
+ mode: string;
120
+ fields?: string[];
121
+ endpoint?: string;
122
+ redirect?: string;
123
+ };
124
+ };
125
+ }
126
+ export interface VerifyPaymentResponseDTO {
127
+ status: string;
128
+ message: string;
129
+ data: {
130
+ id: number;
131
+ tx_ref: string;
132
+ flw_ref: string;
133
+ device_fingerprint: string;
134
+ amount: number;
135
+ currency: string;
136
+ charged_amount: number;
137
+ app_fee: number;
138
+ merchant_fee: number;
139
+ processor_response: string;
140
+ auth_model: string;
141
+ ip: string;
142
+ narration: string;
143
+ status: string;
144
+ payment_type: string;
145
+ created_at: string;
146
+ account_id: number;
147
+ card: {
148
+ first_6digits: string;
149
+ last_4digits: string;
150
+ issuer: string;
151
+ country: string;
152
+ type: string;
153
+ token: string;
154
+ expiry: string;
155
+ };
156
+ amount_settled: number;
157
+ customer: {
158
+ id: number;
159
+ phone_number: string;
160
+ name: string;
161
+ email: string;
162
+ created_at: string;
163
+ };
164
+ };
165
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var FlutterwaveCardAuthorizationType;
4
+ (function (FlutterwaveCardAuthorizationType) {
5
+ FlutterwaveCardAuthorizationType["PIN"] = "pin";
6
+ FlutterwaveCardAuthorizationType["OTP"] = "otp";
7
+ FlutterwaveCardAuthorizationType["AVS"] = "avs_noauth";
8
+ FlutterwaveCardAuthorizationType["REDIRECT"] = "redirect";
9
+ })(FlutterwaveCardAuthorizationType || (FlutterwaveCardAuthorizationType = {}));
@@ -0,0 +1 @@
1
+ export * from "./flutterwave";
@@ -0,0 +1,17 @@
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
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./flutterwave"), exports);
@@ -6,6 +6,7 @@ export declare class TransactionSplitDto {
6
6
  splitAmount?: number;
7
7
  }
8
8
  export declare class PaymentRequestDto {
9
+ uniqueTransactionRef?: string;
9
10
  billerId: string;
10
11
  apiKey?: string;
11
12
  customerId?: string;
@@ -13,7 +14,7 @@ export declare class PaymentRequestDto {
13
14
  paymentPageId?: string;
14
15
  transactionTotal: number;
15
16
  requestChannel: string;
16
- processorId: string;
17
+ processorId?: string;
17
18
  ipAddress?: string;
18
19
  requestUrl?: string;
19
20
  redirectUrl?: string;
@@ -23,6 +24,7 @@ export declare class PaymentRequestDto {
23
24
  transactionSplits?: TransactionSplitDto[];
24
25
  }
25
26
  export declare class APIPaymentRequestDto {
27
+ uniqueTransactionRef?: string;
26
28
  billerId?: string;
27
29
  apiKey?: string;
28
30
  customerId?: string;
@@ -37,3 +39,14 @@ export declare class APIPaymentRequestDto {
37
39
  customerPhoneNumber?: string;
38
40
  transactionSplits?: TransactionSplitDto[];
39
41
  }
42
+ export declare class cardChargeDTO {
43
+ currency: string;
44
+ cardNumber: string;
45
+ cvv: string;
46
+ expiryMonth: string;
47
+ expiryYear: string;
48
+ emailAddress: string;
49
+ transactionReference: string;
50
+ cardHolderName?: string;
51
+ redirectUrl?: string;
52
+ }
@@ -18,7 +18,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
18
18
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
19
19
  };
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.APIPaymentRequestDto = exports.PaymentRequestDto = exports.TransactionSplitDto = void 0;
21
+ exports.cardChargeDTO = exports.APIPaymentRequestDto = exports.PaymentRequestDto = exports.TransactionSplitDto = void 0;
22
22
  const swagger_1 = require("@nestjs/swagger");
23
23
  const class_validator_1 = require("class-validator");
24
24
  const class_validator_2 = require("class-validator");
@@ -57,6 +57,11 @@ __decorate([
57
57
  class PaymentRequestDto {
58
58
  }
59
59
  exports.PaymentRequestDto = PaymentRequestDto;
60
+ __decorate([
61
+ (0, swagger_1.ApiProperty)({ description: "Unique identifier for the transaction from the biller" }),
62
+ (0, class_validator_1.IsNotEmpty)({ message: "Your unique transaction reference is required" }),
63
+ __metadata("design:type", String)
64
+ ], PaymentRequestDto.prototype, "uniqueTransactionRef", void 0);
60
65
  __decorate([
61
66
  (0, swagger_1.ApiProperty)({ description: "Unique identifier for the biller" }),
62
67
  (0, class_validator_2.IsUUID)("4", { message: "Biller ID must be a valid UUID" }),
@@ -102,7 +107,7 @@ __decorate([
102
107
  __decorate([
103
108
  (0, swagger_1.ApiProperty)({ description: "Unique identifier for the processor" }),
104
109
  (0, class_validator_2.IsUUID)("4", { message: "Processor ID must be a valid UUID" }),
105
- (0, class_validator_1.IsNotEmpty)({ message: "Processor ID is required" }),
110
+ (0, class_validator_2.IsOptional)(),
106
111
  __metadata("design:type", String)
107
112
  ], PaymentRequestDto.prototype, "processorId", void 0);
108
113
  __decorate([
@@ -149,6 +154,11 @@ __decorate([
149
154
  class APIPaymentRequestDto {
150
155
  }
151
156
  exports.APIPaymentRequestDto = APIPaymentRequestDto;
157
+ __decorate([
158
+ (0, swagger_1.ApiProperty)({ description: "Unique identifier for the transaction from the biller" }),
159
+ (0, class_validator_1.IsNotEmpty)({ message: "Your unique transaction reference is required" }),
160
+ __metadata("design:type", String)
161
+ ], APIPaymentRequestDto.prototype, "uniqueTransactionRef", void 0);
152
162
  __decorate([
153
163
  (0, swagger_1.ApiProperty)({ description: "Unique identifier for the biller" }),
154
164
  (0, class_validator_2.IsUUID)("4", { message: "Biller ID must be a valid UUID" }),
@@ -226,3 +236,59 @@ __decorate([
226
236
  (0, class_validator_2.IsOptional)(),
227
237
  __metadata("design:type", Array)
228
238
  ], APIPaymentRequestDto.prototype, "transactionSplits", void 0);
239
+ class cardChargeDTO {
240
+ }
241
+ exports.cardChargeDTO = cardChargeDTO;
242
+ __decorate([
243
+ (0, swagger_1.ApiProperty)({ description: "Charge currency" }),
244
+ (0, class_validator_1.IsNotEmpty)({ message: "Please check your currency" }),
245
+ __metadata("design:type", String)
246
+ ], cardChargeDTO.prototype, "currency", void 0);
247
+ __decorate([
248
+ (0, swagger_1.ApiProperty)({ description: "Card number" }),
249
+ (0, class_validator_1.IsNotEmpty)({ message: "Seems you need to check the card number" }),
250
+ (0, class_validator_1.IsNumberString)(),
251
+ (0, class_validator_1.MinLength)(8, { message: "Please check you card number" }),
252
+ __metadata("design:type", String)
253
+ ], cardChargeDTO.prototype, "cardNumber", void 0);
254
+ __decorate([
255
+ (0, swagger_1.ApiProperty)({ description: "Charge CVV" }),
256
+ (0, class_validator_1.IsNotEmpty)({ message: "You must provide a security code" }),
257
+ (0, class_validator_1.IsNumberString)(),
258
+ (0, class_validator_1.Length)(3, 3, { message: "Please check your security code" }),
259
+ __metadata("design:type", String)
260
+ ], cardChargeDTO.prototype, "cvv", void 0);
261
+ __decorate([
262
+ (0, swagger_1.ApiProperty)({ description: "Card Expiry month" }),
263
+ (0, class_validator_1.IsNotEmpty)({ message: "Check your card expiry month" }),
264
+ (0, class_validator_1.IsNumberString)(),
265
+ (0, class_validator_1.Length)(2, 2, { message: "Expiry month must be 2 digits" }),
266
+ __metadata("design:type", String)
267
+ ], cardChargeDTO.prototype, "expiryMonth", void 0);
268
+ __decorate([
269
+ (0, swagger_1.ApiProperty)({ description: "Card Expiry year" }),
270
+ (0, class_validator_1.IsNotEmpty)({ message: "Check your card expiry year" }),
271
+ (0, class_validator_1.IsNumberString)(),
272
+ (0, class_validator_1.Length)(2, 2, { message: "Expiry year must be 2 digits" }),
273
+ __metadata("design:type", String)
274
+ ], cardChargeDTO.prototype, "expiryYear", void 0);
275
+ __decorate([
276
+ (0, swagger_1.ApiProperty)({ description: "Email address for the customer" }),
277
+ (0, class_validator_1.IsNotEmpty)({ message: "Customer email address is required" }),
278
+ __metadata("design:type", String)
279
+ ], cardChargeDTO.prototype, "emailAddress", void 0);
280
+ __decorate([
281
+ (0, swagger_1.ApiProperty)({ description: "Transaction reference" }),
282
+ (0, class_validator_1.IsNotEmpty)({ message: "Transaction reference is required" }),
283
+ __metadata("design:type", String)
284
+ ], cardChargeDTO.prototype, "transactionReference", void 0);
285
+ __decorate([
286
+ (0, swagger_1.ApiProperty)({ description: "Card holders full name" }),
287
+ (0, class_validator_2.IsOptional)(),
288
+ __metadata("design:type", String)
289
+ ], cardChargeDTO.prototype, "cardHolderName", void 0);
290
+ __decorate([
291
+ (0, swagger_1.ApiProperty)({ description: "3D Secure redirect url for customer" }),
292
+ (0, class_validator_2.IsOptional)(),
293
+ __metadata("design:type", String)
294
+ ], cardChargeDTO.prototype, "redirectUrl", void 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resurgence-data",
3
- "version": "1.1.20",
3
+ "version": "1.1.22",
4
4
  "description": "DTOs and shareable resources",
5
5
  "module": "dist/index.js",
6
6
  "main": "dist/index.js",
@@ -28,6 +28,7 @@
28
28
  "@types/jest": "^29.5.14",
29
29
  "class-transformer": "^0.5.1",
30
30
  "class-validator": "^0.14.1",
31
- "ts-jest": "^29.2.5"
31
+ "ts-jest": "^29.2.5",
32
+ "uuid": "^11.0.5"
32
33
  }
33
34
  }
@@ -0,0 +1,5 @@
1
+ import { v4 as uuidv4 } from "uuid";
2
+
3
+ export function generateUUID(): string {
4
+ return uuidv4();
5
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./id-generation";
2
+ export * from "./manipulation";
@@ -0,0 +1,31 @@
1
+ export function toCamel(s: any) {
2
+ return s.replace(/([-_][a-z])/gi, ($1: any) => {
3
+ return $1.toUpperCase().replace("-", "").replace("_", "");
4
+ });
5
+ }
6
+
7
+ export function isArray(a: any) {
8
+ return Array.isArray(a);
9
+ }
10
+
11
+ export function isObject(o: any) {
12
+ return o === Object(o) && !isArray(o) && typeof o !== "function";
13
+ }
14
+
15
+ export function keysToCamelCase(o: any): any {
16
+ if (isObject(o)) {
17
+ const n: any = {};
18
+
19
+ Object.keys(o).forEach((k) => {
20
+ n[toCamel(k)] = keysToCamelCase(o[k]);
21
+ });
22
+
23
+ return n;
24
+ } else if (isArray(o)) {
25
+ return o.map((i: any) => {
26
+ return keysToCamelCase(i);
27
+ });
28
+ }
29
+
30
+ return o;
31
+ }
package/src/index.ts CHANGED
@@ -6,3 +6,5 @@ export * from "./messaging";
6
6
  export * from "./biller";
7
7
  export * from "./payment";
8
8
  export * from "./invoice";
9
+ export * from "./integration";
10
+ export * from "./functions";
@@ -0,0 +1 @@
1
+ export * from "./payloads";
@@ -0,0 +1,178 @@
1
+ export interface FlutterwavePinAuthorizationDTO {
2
+ mode: string;
3
+ pin: string;
4
+ }
5
+
6
+ export interface FlutterwaveCardAVSAuthorizationDTO {
7
+ mode: string;
8
+ city: string;
9
+ address: string;
10
+ state: string;
11
+ country: string;
12
+ zipcode: string;
13
+ }
14
+
15
+ export interface FlutterwaveCardChargeResponseDTO {
16
+ status: string;
17
+ message: string;
18
+ data: {
19
+ id: number;
20
+ tx_ref: string;
21
+ flw_ref: string;
22
+ device_fingerprint: string;
23
+ amount: number;
24
+ charged_amount: number;
25
+ app_fee: number;
26
+ merchant_fee: number;
27
+ processor_response: string;
28
+ auth_model: string;
29
+ currency: string;
30
+ ip: string;
31
+ narration: string;
32
+ status: string;
33
+ auth_url: string;
34
+ payment_type: string;
35
+ fraud_status: string;
36
+ charge_type: string;
37
+ created_at: string;
38
+ account_id: number;
39
+ customer: {
40
+ id: number;
41
+ phone_number: string;
42
+ name: string;
43
+ email: string;
44
+ created_at: string;
45
+ };
46
+ card: {
47
+ first_6digits: string;
48
+ last_4digits: string;
49
+ issuer: string;
50
+ country: string;
51
+ type: string;
52
+ expiry: string;
53
+ };
54
+ };
55
+ meta: {
56
+ authorization: {
57
+ mode: string;
58
+ fields?: string[]; // required for avs and pin auth
59
+ endpoint?: string; // required for otp validation
60
+ redirect?: string; // required for 3DS redirect
61
+ };
62
+ };
63
+ }
64
+
65
+ export interface FlutterwaveCardChargePayload {
66
+ cardNumber: string;
67
+ expiryMonth: string;
68
+ expiryYear: string;
69
+ cvv: string;
70
+ currency: string;
71
+ amount: number;
72
+ emailAddress: string;
73
+ fullname: string;
74
+ phoneNumber: string;
75
+ txRef: string;
76
+ redirectUrl: string;
77
+ enckey: string;
78
+ authorization: FlutterwavePinAuthorizationDTO | FlutterwaveCardAVSAuthorizationDTO;
79
+ }
80
+
81
+ export interface Flutterwave3DSChargeResponseDTO {
82
+ id: number;
83
+ tx_ref: string;
84
+ flw_ref: string;
85
+ device_fingerprint: string;
86
+ amount: number;
87
+ charged_amount: number;
88
+ app_fee: number;
89
+ merchant_fee: number;
90
+ processor_response: string;
91
+ auth_model: string;
92
+ currency: string;
93
+ ip: string;
94
+ narration: string;
95
+ status: string;
96
+ payment_type: string;
97
+ fraud_status: string;
98
+ charge_type: string;
99
+ created_at: string;
100
+ account_id: number;
101
+ customer: {
102
+ id: number;
103
+ phone_number: string;
104
+ name: string;
105
+ email: string;
106
+ created_at: string;
107
+ };
108
+ card: {
109
+ first_6digits: string;
110
+ last_4digits: string;
111
+ issuer: string;
112
+ country: string;
113
+ type: string;
114
+ expiry: string;
115
+ };
116
+ }
117
+
118
+ enum FlutterwaveCardAuthorizationType {
119
+ PIN = "pin",
120
+ OTP = "otp",
121
+ AVS = "avs_noauth",
122
+ REDIRECT = "redirect", //3ds
123
+ }
124
+
125
+ export interface FlutterwaveCardResponseDTO {
126
+ status: string;
127
+ message: string;
128
+ data?: Flutterwave3DSChargeResponseDTO;
129
+ meta: {
130
+ authorization: {
131
+ mode: string;
132
+ fields?: string[]; //required for avs and pin auth
133
+ endpoint?: string; //required for otp validation
134
+ redirect?: string; //required for 3DS redirect
135
+ };
136
+ };
137
+ }
138
+
139
+ export interface VerifyPaymentResponseDTO {
140
+ status: string;
141
+ message: string;
142
+ data: {
143
+ id: number;
144
+ tx_ref: string;
145
+ flw_ref: string;
146
+ device_fingerprint: string;
147
+ amount: number;
148
+ currency: string;
149
+ charged_amount: number;
150
+ app_fee: number;
151
+ merchant_fee: number;
152
+ processor_response: string;
153
+ auth_model: string;
154
+ ip: string;
155
+ narration: string;
156
+ status: string;
157
+ payment_type: string;
158
+ created_at: string;
159
+ account_id: number;
160
+ card: {
161
+ first_6digits: string;
162
+ last_4digits: string;
163
+ issuer: string;
164
+ country: string;
165
+ type: string;
166
+ token: string;
167
+ expiry: string;
168
+ };
169
+ amount_settled: number;
170
+ customer: {
171
+ id: number;
172
+ phone_number: string;
173
+ name: string;
174
+ email: string;
175
+ created_at: string;
176
+ };
177
+ };
178
+ }
@@ -0,0 +1 @@
1
+ export * from "./flutterwave";
@@ -9,7 +9,17 @@
9
9
  // * @apiParam {Object} [splitDetails] Transaction split details.
10
10
 
11
11
  import { ApiProperty } from "@nestjs/swagger";
12
- import { IsIn, IsInt, IsNotEmpty, IsNumber, IsString } from "class-validator";
12
+ import {
13
+ IsIn,
14
+ IsInt,
15
+ IsNotEmpty,
16
+ IsNumber,
17
+ isNumberString,
18
+ IsNumberString,
19
+ IsString,
20
+ Length,
21
+ MinLength,
22
+ } from "class-validator";
13
23
  import { IsOptional, IsUUID, IsEnum, IsIP, IsUrl, IsEmail } from "class-validator";
14
24
 
15
25
  export class TransactionSplitDto {
@@ -38,6 +48,10 @@ export class TransactionSplitDto {
38
48
  splitAmount?: number;
39
49
  }
40
50
  export class PaymentRequestDto {
51
+ @ApiProperty({ description: "Unique identifier for the transaction from the biller" })
52
+ @IsNotEmpty({ message: "Your unique transaction reference is required" })
53
+ uniqueTransactionRef?: string;
54
+
41
55
  @ApiProperty({ description: "Unique identifier for the biller" })
42
56
  @IsUUID("4", { message: "Biller ID must be a valid UUID" })
43
57
  @IsNotEmpty({ message: "Biller ID is required" })
@@ -75,8 +89,8 @@ export class PaymentRequestDto {
75
89
 
76
90
  @ApiProperty({ description: "Unique identifier for the processor" })
77
91
  @IsUUID("4", { message: "Processor ID must be a valid UUID" })
78
- @IsNotEmpty({ message: "Processor ID is required" })
79
- processorId: string;
92
+ @IsOptional()
93
+ processorId?: string;
80
94
 
81
95
  @ApiProperty({ description: "IP address of the customer", required: false })
82
96
  @IsOptional()
@@ -114,6 +128,10 @@ export class PaymentRequestDto {
114
128
  }
115
129
 
116
130
  export class APIPaymentRequestDto {
131
+ @ApiProperty({ description: "Unique identifier for the transaction from the biller" })
132
+ @IsNotEmpty({ message: "Your unique transaction reference is required" })
133
+ uniqueTransactionRef?: string;
134
+
117
135
  @ApiProperty({ description: "Unique identifier for the biller" })
118
136
  @IsUUID("4", { message: "Biller ID must be a valid UUID" })
119
137
  @IsOptional()
@@ -178,3 +196,41 @@ export class APIPaymentRequestDto {
178
196
  @IsOptional()
179
197
  transactionSplits?: TransactionSplitDto[];
180
198
  }
199
+
200
+ export class cardChargeDTO {
201
+ @ApiProperty({ description: "Charge currency" })
202
+ @IsNotEmpty({ message: "Please check your currency" })
203
+ currency: string;
204
+ @ApiProperty({ description: "Card number" })
205
+ @IsNotEmpty({ message: "Seems you need to check the card number" })
206
+ @IsNumberString()
207
+ @MinLength(8, { message: "Please check you card number" })
208
+ cardNumber: string;
209
+ @ApiProperty({ description: "Charge CVV" })
210
+ @IsNotEmpty({ message: "You must provide a security code" })
211
+ @IsNumberString()
212
+ @Length(3, 3, { message: "Please check your security code" })
213
+ cvv: string;
214
+ @ApiProperty({ description: "Card Expiry month" })
215
+ @IsNotEmpty({ message: "Check your card expiry month" })
216
+ @IsNumberString()
217
+ @Length(2, 2, { message: "Expiry month must be 2 digits" })
218
+ expiryMonth: string;
219
+ @ApiProperty({ description: "Card Expiry year" })
220
+ @IsNotEmpty({ message: "Check your card expiry year" })
221
+ @IsNumberString()
222
+ @Length(2, 2, { message: "Expiry year must be 2 digits" })
223
+ expiryYear: string;
224
+ @ApiProperty({ description: "Email address for the customer" })
225
+ @IsNotEmpty({ message: "Customer email address is required" })
226
+ emailAddress: string;
227
+ @ApiProperty({ description: "Transaction reference" })
228
+ @IsNotEmpty({ message: "Transaction reference is required" })
229
+ transactionReference: string;
230
+ @ApiProperty({ description: "Card holders full name" })
231
+ @IsOptional()
232
+ cardHolderName?: string;
233
+ @ApiProperty({ description: "3D Secure redirect url for customer" })
234
+ @IsOptional()
235
+ redirectUrl?: string;
236
+ }