resurgence-data 1.1.20 → 1.1.21

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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resurgence-data",
3
- "version": "1.1.20",
3
+ "version": "1.1.21",
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";