resurgence-data 1.1.26 → 1.1.28

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.
@@ -59,6 +59,87 @@ export interface FlutterwaveCardChargeResponseDTO {
59
59
  };
60
60
  };
61
61
  }
62
+ export interface FlutterwaveCardValidationResponseDTO {
63
+ status: string;
64
+ message: string;
65
+ data: {
66
+ id: number;
67
+ tx_ref: string;
68
+ flw_ref: string;
69
+ device_fingerprint: string;
70
+ amount: number;
71
+ charged_amount: number;
72
+ app_fee: number;
73
+ merchant_fee: number;
74
+ processor_response: string;
75
+ auth_model: string;
76
+ currency: string;
77
+ ip: string;
78
+ narration: string;
79
+ status: string;
80
+ auth_url: string;
81
+ payment_type: string;
82
+ fraud_status: string;
83
+ charge_type: string;
84
+ created_at: string;
85
+ account_id: number;
86
+ customer: {
87
+ id: number;
88
+ phone_number: string;
89
+ name: string;
90
+ email: string;
91
+ created_at: string;
92
+ };
93
+ card: {
94
+ first_6digits: string;
95
+ last_4digits: string;
96
+ issuer: string;
97
+ country: string;
98
+ type: string;
99
+ expiry: string;
100
+ };
101
+ };
102
+ }
103
+ export interface FlutterwaveCardVerificationResponseDTO {
104
+ status: string;
105
+ message: string;
106
+ data: {
107
+ id: number;
108
+ tx_ref: string;
109
+ flw_ref: string;
110
+ device_fingerprint: string;
111
+ amount: number;
112
+ currency: string;
113
+ charged_amount: number;
114
+ app_fee: number;
115
+ merchant_fee: number;
116
+ processor_response: string;
117
+ auth_model: string;
118
+ ip: string;
119
+ narration: string;
120
+ status: string;
121
+ payment_type: string;
122
+ created_at: string;
123
+ account_id: number;
124
+ card: {
125
+ first_6digits: string;
126
+ last_4digits: string;
127
+ issuer: string;
128
+ country: string;
129
+ type: string;
130
+ token: string;
131
+ expiry: string;
132
+ };
133
+ amount_settled: number;
134
+ customer: {
135
+ id: number;
136
+ phone_number: string;
137
+ name: string;
138
+ email: string;
139
+ created_at: string;
140
+ };
141
+ };
142
+ }
62
143
  export interface FlutterwaveCardChargePayload {
63
144
  cardNumber: string;
64
145
  expiryMonth: string;
@@ -163,3 +244,7 @@ export interface VerifyPaymentResponseDTO {
163
244
  };
164
245
  };
165
246
  }
247
+ export interface FlutterwaveOTPPayload {
248
+ otp: string;
249
+ flwRef: string;
250
+ }
@@ -16,7 +16,7 @@ export declare class CreateInvoiceDto extends BaseDTO {
16
16
  discountValue: number;
17
17
  total?: number;
18
18
  totalService?: number;
19
- discountType: string;
19
+ discountType?: string;
20
20
  dueDate: string;
21
21
  status?: string | "PENDING";
22
22
  customer?: InvoiceCustomerDto;
@@ -79,6 +79,12 @@ __decorate([
79
79
  __metadata("design:type", Number)
80
80
  ], InvoiceItemDto.prototype, "quantity", void 0);
81
81
  class CreateInvoiceDto extends dto_type_1.BaseDTO {
82
+ constructor() {
83
+ super(...arguments);
84
+ this.discountValue = 0;
85
+ this.total = 0;
86
+ this.discountType = "FIXED";
87
+ }
82
88
  }
83
89
  exports.CreateInvoiceDto = CreateInvoiceDto;
84
90
  __decorate([
@@ -113,14 +119,16 @@ __decorate([
113
119
  (0, swagger_1.ApiProperty)({
114
120
  description: "The discount value applied to the invoice",
115
121
  example: 10.5,
122
+ required: false,
116
123
  }),
117
- (0, class_validator_1.IsNotEmpty)({ message: "Discount value must not be empty" }),
118
124
  (0, class_validator_1.IsNumber)(undefined, { message: "Discount value must be a valid number" }),
125
+ (0, class_validator_1.IsOptional)(),
119
126
  __metadata("design:type", Number)
120
127
  ], CreateInvoiceDto.prototype, "discountValue", void 0);
121
128
  __decorate([
122
129
  (0, swagger_1.ApiProperty)({
123
130
  description: "Total for invoice",
131
+ required: false,
124
132
  example: 20030,
125
133
  }),
126
134
  (0, class_validator_1.IsInt)({ message: "Total invoice value must be a valid number" }),
@@ -131,17 +139,20 @@ __decorate([
131
139
  (0, swagger_1.ApiProperty)({
132
140
  description: "Total for invoice service charges",
133
141
  example: 1000,
142
+ required: false,
134
143
  }),
135
144
  (0, class_validator_1.IsNumber)(undefined, { message: "Service fee total value must be a valid number" }),
145
+ (0, class_validator_1.IsOptional)(),
136
146
  __metadata("design:type", Number)
137
147
  ], CreateInvoiceDto.prototype, "totalService", void 0);
138
148
  __decorate([
139
149
  (0, swagger_1.ApiProperty)({
140
150
  description: "The type of discount applied to the invoice",
141
151
  example: "FIXED",
152
+ required: false,
142
153
  }),
143
- (0, class_validator_1.IsNotEmpty)({ message: "Discount type must not be empty" }),
144
154
  (0, class_validator_1.IsEnum)(["FIXED", "PERCENT"], { message: "Discount type must be FIXED or PERCENT" }),
155
+ (0, class_validator_1.IsOptional)(),
145
156
  __metadata("design:type", String)
146
157
  ], CreateInvoiceDto.prototype, "discountType", void 0);
147
158
  __decorate([
@@ -197,8 +208,8 @@ __decorate([
197
208
  example: "[{id:'550e8400-e29b-41d4-a716-446655440001', quantity:2},{id:'550e8400-e29b-41d4-a716-446655440001', quantity:3}]",
198
209
  required: false,
199
210
  }),
200
- (0, class_validator_1.IsNotEmpty)({ message: "Please provide items for this invoice" }),
201
211
  (0, class_validator_1.IsArray)({ message: "Please provide a list of items for this invoice" }),
212
+ (0, class_validator_1.IsOptional)(),
202
213
  __metadata("design:type", Array)
203
214
  ], UpdateInvoiceDto.prototype, "items", void 0);
204
215
  __decorate([
@@ -71,6 +71,7 @@ __decorate([
71
71
  (0, swagger_1.ApiProperty)({
72
72
  description: "List of items",
73
73
  example: "[{id:'550e8400-e29b-41d4-a716-446655440001', quantity:2},{id:'550e8400-e29b-41d4-a716-446655440001', quantity:3}]",
74
+ required: false,
74
75
  }),
75
76
  (0, class_validator_1.IsOptional)(),
76
77
  (0, class_validator_1.IsArray)({ message: "Please provide a list of items for this invoice" }),
@@ -117,7 +118,7 @@ __decorate([
117
118
  __decorate([
118
119
  (0, swagger_1.ApiProperty)({ description: "Amount's currency code", default: "NGN", required: false }),
119
120
  (0, class_validator_1.IsString)({ message: "currencyCode must be a string" }),
120
- (0, class_validator_1.IsNotEmpty)({ message: "Please select a currency" }),
121
+ (0, class_validator_1.IsOptional)(),
121
122
  __metadata("design:type", String)
122
123
  ], UpdatePaymentPageDto.prototype, "currencyCode", void 0);
123
124
  __decorate([
@@ -142,6 +143,7 @@ __decorate([
142
143
  (0, swagger_1.ApiProperty)({
143
144
  description: "List of items",
144
145
  example: "[{id:'550e8400-e29b-41d4-a716-446655440001', quantity:2},{id:'550e8400-e29b-41d4-a716-446655440001', quantity:3}]",
146
+ required: false,
145
147
  }),
146
148
  (0, class_validator_1.IsOptional)(),
147
149
  (0, class_validator_1.IsArray)({ message: "Please provide a list of items for this invoice" }),
@@ -191,6 +193,6 @@ __decorate([
191
193
  __metadata("design:type", Date)
192
194
  ], PaymentPageResponseDto.prototype, "updatedAt", void 0);
193
195
  __decorate([
194
- (0, swagger_1.ApiProperty)({ description: "List of Items" }),
196
+ (0, swagger_1.ApiProperty)({ description: "List of Items", required: false }),
195
197
  __metadata("design:type", Array)
196
198
  ], PaymentPageResponseDto.prototype, "items", void 0);
@@ -50,3 +50,13 @@ export declare class CardChargeDTO {
50
50
  cardHolderName?: string;
51
51
  redirectUrl?: string;
52
52
  }
53
+ export declare class CardChargeAuthorizationDto {
54
+ transactionReference: string;
55
+ mode: string;
56
+ pin?: string;
57
+ city?: string;
58
+ address?: string;
59
+ state?: string;
60
+ country?: string;
61
+ zipcode?: string;
62
+ }
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- // * @apiParam {String} transactionReference Merchants generated unique transaction reference.
3
- // * @apiParam {String} clientId Merchants client ID.
4
- // * @apiParam {Integer} amount Transaction amount (In lowrst denomination)
5
- // * @apiParam {String} [customerEmailAddress] Customer's email address.
6
- // * @apiParam {String} [customerPhoneNumber] Customer's phone number.
7
- // * @apiParam {String} [customerName] Customer's name
8
- // * @apiParam {String} customerId Merchant's preffered customer identifier (eg. email or phone number etc)
9
- // * @apiParam {String} currencyCode Account holder's email address.
10
- // * @apiParam {Object} [splitDetails] Transaction split details.
11
2
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
12
3
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13
4
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -18,16 +9,15 @@ var __metadata = (this && this.__metadata) || function (k, v) {
18
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
19
10
  };
20
11
  Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.CardChargeDTO = exports.APIPaymentRequestDto = exports.PaymentRequestDto = exports.TransactionSplitDto = void 0;
12
+ exports.CardChargeAuthorizationDto = exports.CardChargeDTO = exports.APIPaymentRequestDto = exports.PaymentRequestDto = exports.TransactionSplitDto = void 0;
22
13
  const swagger_1 = require("@nestjs/swagger");
23
14
  const class_validator_1 = require("class-validator");
24
- const class_validator_2 = require("class-validator");
25
15
  class TransactionSplitDto {
26
16
  }
27
17
  exports.TransactionSplitDto = TransactionSplitDto;
28
18
  __decorate([
29
19
  (0, swagger_1.ApiProperty)({ description: "Unique identifier for the account" }),
30
- (0, class_validator_2.IsUUID)("4", { message: "Account ID must be a valid UUID" }),
20
+ (0, class_validator_1.IsUUID)("4", { message: "Account ID must be a valid UUID" }),
31
21
  (0, class_validator_1.IsNotEmpty)({ message: "Account ID is required" }),
32
22
  __metadata("design:type", String)
33
23
  ], TransactionSplitDto.prototype, "accountId", void 0);
@@ -51,7 +41,7 @@ __decorate([
51
41
  ], TransactionSplitDto.prototype, "transactionTotal", void 0);
52
42
  __decorate([
53
43
  (0, swagger_1.ApiProperty)({ description: "Amount of the transaction split" }),
54
- (0, class_validator_2.IsOptional)(),
44
+ (0, class_validator_1.IsOptional)(),
55
45
  __metadata("design:type", Number)
56
46
  ], TransactionSplitDto.prototype, "splitAmount", void 0);
57
47
  class PaymentRequestDto {
@@ -64,32 +54,32 @@ __decorate([
64
54
  ], PaymentRequestDto.prototype, "uniqueTransactionRef", void 0);
65
55
  __decorate([
66
56
  (0, swagger_1.ApiProperty)({ description: "Unique identifier for the biller" }),
67
- (0, class_validator_2.IsUUID)("4", { message: "Biller ID must be a valid UUID" }),
57
+ (0, class_validator_1.IsUUID)("4", { message: "Biller ID must be a valid UUID" }),
68
58
  (0, class_validator_1.IsNotEmpty)({ message: "Biller ID is required" }),
69
59
  __metadata("design:type", String)
70
60
  ], PaymentRequestDto.prototype, "billerId", void 0);
71
61
  __decorate([
72
62
  (0, swagger_1.ApiProperty)({ description: "API Key for the biller" }),
73
63
  (0, class_validator_1.IsString)({ message: "API key is not provided" }),
74
- (0, class_validator_2.IsOptional)(),
64
+ (0, class_validator_1.IsOptional)(),
75
65
  __metadata("design:type", String)
76
66
  ], PaymentRequestDto.prototype, "apiKey", void 0);
77
67
  __decorate([
78
68
  (0, swagger_1.ApiProperty)({ description: "Unique identifier for the customer", required: false }),
79
- (0, class_validator_2.IsOptional)(),
80
- (0, class_validator_2.IsUUID)("4", { message: "Customer ID must be a valid UUID" }),
69
+ (0, class_validator_1.IsOptional)(),
70
+ (0, class_validator_1.IsUUID)("4", { message: "Customer ID must be a valid UUID" }),
81
71
  __metadata("design:type", String)
82
72
  ], PaymentRequestDto.prototype, "customerId", void 0);
83
73
  __decorate([
84
74
  (0, swagger_1.ApiProperty)({ description: "Unique identifier for the invoice", required: false }),
85
- (0, class_validator_2.IsOptional)(),
86
- (0, class_validator_2.IsUUID)("4", { message: "Invoice ID must be a valid UUID" }),
75
+ (0, class_validator_1.IsOptional)(),
76
+ (0, class_validator_1.IsUUID)("4", { message: "Invoice ID must be a valid UUID" }),
87
77
  __metadata("design:type", String)
88
78
  ], PaymentRequestDto.prototype, "invoiceId", void 0);
89
79
  __decorate([
90
80
  (0, swagger_1.ApiProperty)({ description: "Unique identifier for the payment page", required: false }),
91
- (0, class_validator_2.IsOptional)(),
92
- (0, class_validator_2.IsUUID)("4", { message: "Payment Page ID must be a valid UUID" }),
81
+ (0, class_validator_1.IsOptional)(),
82
+ (0, class_validator_1.IsUUID)("4", { message: "Payment Page ID must be a valid UUID" }),
93
83
  __metadata("design:type", String)
94
84
  ], PaymentRequestDto.prototype, "paymentPageId", void 0);
95
85
  __decorate([
@@ -106,49 +96,49 @@ __decorate([
106
96
  ], PaymentRequestDto.prototype, "requestChannel", void 0);
107
97
  __decorate([
108
98
  (0, swagger_1.ApiProperty)({ description: "Unique identifier for the processor" }),
109
- (0, class_validator_2.IsUUID)("4", { message: "Processor ID must be a valid UUID" }),
110
- (0, class_validator_2.IsOptional)(),
99
+ (0, class_validator_1.IsUUID)("4", { message: "Processor ID must be a valid UUID" }),
100
+ (0, class_validator_1.IsOptional)(),
111
101
  __metadata("design:type", String)
112
102
  ], PaymentRequestDto.prototype, "processorId", void 0);
113
103
  __decorate([
114
104
  (0, swagger_1.ApiProperty)({ description: "IP address of the customer", required: false }),
115
- (0, class_validator_2.IsOptional)(),
116
- (0, class_validator_2.IsIP)("4", { message: "IP address must be a valid IP address" }),
105
+ (0, class_validator_1.IsOptional)(),
106
+ (0, class_validator_1.IsIP)("4", { message: "IP address must be a valid IP address" }),
117
107
  __metadata("design:type", String)
118
108
  ], PaymentRequestDto.prototype, "ipAddress", void 0);
119
109
  __decorate([
120
110
  (0, swagger_1.ApiProperty)({ description: "URL of the request", required: false }),
121
- (0, class_validator_2.IsOptional)(),
122
- (0, class_validator_2.IsUrl)({}, { message: "Request URL must be a valid URL" }),
111
+ (0, class_validator_1.IsOptional)(),
112
+ (0, class_validator_1.IsUrl)({}, { message: "Request URL must be a valid URL" }),
123
113
  __metadata("design:type", String)
124
114
  ], PaymentRequestDto.prototype, "requestUrl", void 0);
125
115
  __decorate([
126
116
  (0, swagger_1.ApiProperty)({ description: "Redirect URL after payment", required: false }),
127
- (0, class_validator_2.IsOptional)(),
128
- (0, class_validator_2.IsUrl)({}, { message: "Redirect URL must be a valid URL" }),
117
+ (0, class_validator_1.IsOptional)(),
118
+ (0, class_validator_1.IsUrl)({}, { message: "Redirect URL must be a valid URL" }),
129
119
  __metadata("design:type", String)
130
120
  ], PaymentRequestDto.prototype, "redirectUrl", void 0);
131
121
  __decorate([
132
122
  (0, swagger_1.ApiProperty)({ description: "Name of the customer", required: false }),
133
- (0, class_validator_2.IsOptional)(),
123
+ (0, class_validator_1.IsOptional)(),
134
124
  (0, class_validator_1.IsString)({ message: "Customer name must be a string" }),
135
125
  __metadata("design:type", String)
136
126
  ], PaymentRequestDto.prototype, "customerName", void 0);
137
127
  __decorate([
138
128
  (0, swagger_1.ApiProperty)({ description: "Email address of the customer", required: false }),
139
- (0, class_validator_2.IsOptional)(),
140
- (0, class_validator_2.IsEmail)({}, { message: "Customer email address must be a valid email address" }),
129
+ (0, class_validator_1.IsOptional)(),
130
+ (0, class_validator_1.IsEmail)({}, { message: "Customer email address must be a valid email address" }),
141
131
  __metadata("design:type", String)
142
132
  ], PaymentRequestDto.prototype, "customerEmailAddress", void 0);
143
133
  __decorate([
144
134
  (0, swagger_1.ApiProperty)({ description: "Phone number of the customer", required: false }),
145
- (0, class_validator_2.IsOptional)(),
135
+ (0, class_validator_1.IsOptional)(),
146
136
  (0, class_validator_1.IsString)({ message: "Customer phone number must be a string" }),
147
137
  __metadata("design:type", String)
148
138
  ], PaymentRequestDto.prototype, "customerPhoneNumber", void 0);
149
139
  __decorate([
150
140
  (0, swagger_1.ApiProperty)({ description: "Array of transaction splits", required: false }),
151
- (0, class_validator_2.IsOptional)(),
141
+ (0, class_validator_1.IsOptional)(),
152
142
  __metadata("design:type", Array)
153
143
  ], PaymentRequestDto.prototype, "transactionSplits", void 0);
154
144
  class APIPaymentRequestDto {
@@ -161,38 +151,38 @@ __decorate([
161
151
  ], APIPaymentRequestDto.prototype, "uniqueTransactionRef", void 0);
162
152
  __decorate([
163
153
  (0, swagger_1.ApiProperty)({ description: "Unique identifier for the biller" }),
164
- (0, class_validator_2.IsUUID)("4", { message: "Biller ID must be a valid UUID" }),
165
- (0, class_validator_2.IsOptional)(),
154
+ (0, class_validator_1.IsUUID)("4", { message: "Biller ID must be a valid UUID" }),
155
+ (0, class_validator_1.IsOptional)(),
166
156
  __metadata("design:type", String)
167
157
  ], APIPaymentRequestDto.prototype, "billerId", void 0);
168
158
  __decorate([
169
159
  (0, swagger_1.ApiProperty)({ description: "API Key for the biller" }),
170
160
  (0, class_validator_1.IsString)({ message: "API key is not provided" }),
171
- (0, class_validator_2.IsOptional)(),
161
+ (0, class_validator_1.IsOptional)(),
172
162
  __metadata("design:type", String)
173
163
  ], APIPaymentRequestDto.prototype, "apiKey", void 0);
174
164
  __decorate([
175
165
  (0, swagger_1.ApiProperty)({ description: "Unique identifier for the customer", required: false }),
176
- (0, class_validator_2.IsOptional)(),
177
- (0, class_validator_2.IsUUID)("4", { message: "Customer ID must be a valid UUID" }),
166
+ (0, class_validator_1.IsOptional)(),
167
+ (0, class_validator_1.IsUUID)("4", { message: "Customer ID must be a valid UUID" }),
178
168
  __metadata("design:type", String)
179
169
  ], APIPaymentRequestDto.prototype, "customerId", void 0);
180
170
  __decorate([
181
171
  (0, swagger_1.ApiProperty)({ description: "Unique identifier for the invoice", required: false }),
182
- (0, class_validator_2.IsOptional)(),
183
- (0, class_validator_2.IsUUID)("4", { message: "Invoice ID must be a valid UUID" }),
172
+ (0, class_validator_1.IsOptional)(),
173
+ (0, class_validator_1.IsUUID)("4", { message: "Invoice ID must be a valid UUID" }),
184
174
  __metadata("design:type", String)
185
175
  ], APIPaymentRequestDto.prototype, "invoiceId", void 0);
186
176
  __decorate([
187
177
  (0, swagger_1.ApiProperty)({ description: "Unique identifier for the payment page", required: false }),
188
- (0, class_validator_2.IsOptional)(),
189
- (0, class_validator_2.IsUUID)("4", { message: "Payment Page ID must be a valid UUID" }),
178
+ (0, class_validator_1.IsOptional)(),
179
+ (0, class_validator_1.IsUUID)("4", { message: "Payment Page ID must be a valid UUID" }),
190
180
  __metadata("design:type", String)
191
181
  ], APIPaymentRequestDto.prototype, "paymentPageId", void 0);
192
182
  __decorate([
193
183
  (0, swagger_1.ApiProperty)({ description: "IP address of the customer", required: false }),
194
- (0, class_validator_2.IsOptional)(),
195
- (0, class_validator_2.IsIP)("4", { message: "IP address must be a valid IP address" }),
184
+ (0, class_validator_1.IsOptional)(),
185
+ (0, class_validator_1.IsIP)("4", { message: "IP address must be a valid IP address" }),
196
186
  __metadata("design:type", String)
197
187
  ], APIPaymentRequestDto.prototype, "ipAddress", void 0);
198
188
  __decorate([
@@ -203,37 +193,37 @@ __decorate([
203
193
  ], APIPaymentRequestDto.prototype, "transactionTotal", void 0);
204
194
  __decorate([
205
195
  (0, swagger_1.ApiProperty)({ description: "URL of the request", required: false }),
206
- (0, class_validator_2.IsOptional)(),
207
- (0, class_validator_2.IsUrl)({}, { message: "Request URL must be a valid URL" }),
196
+ (0, class_validator_1.IsOptional)(),
197
+ (0, class_validator_1.IsUrl)({}, { message: "Request URL must be a valid URL" }),
208
198
  __metadata("design:type", String)
209
199
  ], APIPaymentRequestDto.prototype, "requestUrl", void 0);
210
200
  __decorate([
211
201
  (0, swagger_1.ApiProperty)({ description: "Redirect URL after payment", required: false }),
212
- (0, class_validator_2.IsOptional)(),
213
- (0, class_validator_2.IsUrl)({}, { message: "Redirect URL must be a valid URL" }),
202
+ (0, class_validator_1.IsOptional)(),
203
+ (0, class_validator_1.IsUrl)({}, { message: "Redirect URL must be a valid URL" }),
214
204
  __metadata("design:type", String)
215
205
  ], APIPaymentRequestDto.prototype, "redirectUrl", void 0);
216
206
  __decorate([
217
207
  (0, swagger_1.ApiProperty)({ description: "Name of the customer", required: false }),
218
- (0, class_validator_2.IsOptional)(),
208
+ (0, class_validator_1.IsOptional)(),
219
209
  (0, class_validator_1.IsString)({ message: "Customer name must be a string" }),
220
210
  __metadata("design:type", String)
221
211
  ], APIPaymentRequestDto.prototype, "customerName", void 0);
222
212
  __decorate([
223
213
  (0, swagger_1.ApiProperty)({ description: "Email address of the customer", required: false }),
224
- (0, class_validator_2.IsOptional)(),
225
- (0, class_validator_2.IsEmail)({}, { message: "Customer email address must be a valid email address" }),
214
+ (0, class_validator_1.IsOptional)(),
215
+ (0, class_validator_1.IsEmail)({}, { message: "Customer email address must be a valid email address" }),
226
216
  __metadata("design:type", String)
227
217
  ], APIPaymentRequestDto.prototype, "customerEmailAddress", void 0);
228
218
  __decorate([
229
219
  (0, swagger_1.ApiProperty)({ description: "Phone number of the customer", required: false }),
230
- (0, class_validator_2.IsOptional)(),
220
+ (0, class_validator_1.IsOptional)(),
231
221
  (0, class_validator_1.IsString)({ message: "Customer phone number must be a string" }),
232
222
  __metadata("design:type", String)
233
223
  ], APIPaymentRequestDto.prototype, "customerPhoneNumber", void 0);
234
224
  __decorate([
235
225
  (0, swagger_1.ApiProperty)({ description: "Array of transaction splits", required: false }),
236
- (0, class_validator_2.IsOptional)(),
226
+ (0, class_validator_1.IsOptional)(),
237
227
  __metadata("design:type", Array)
238
228
  ], APIPaymentRequestDto.prototype, "transactionSplits", void 0);
239
229
  class CardChargeDTO {
@@ -284,11 +274,59 @@ __decorate([
284
274
  ], CardChargeDTO.prototype, "transactionReference", void 0);
285
275
  __decorate([
286
276
  (0, swagger_1.ApiProperty)({ description: "Card holders full name" }),
287
- (0, class_validator_2.IsOptional)(),
277
+ (0, class_validator_1.IsOptional)(),
288
278
  __metadata("design:type", String)
289
279
  ], CardChargeDTO.prototype, "cardHolderName", void 0);
290
280
  __decorate([
291
281
  (0, swagger_1.ApiProperty)({ description: "3D Secure redirect url for customer" }),
292
- (0, class_validator_2.IsOptional)(),
282
+ (0, class_validator_1.IsOptional)(),
293
283
  __metadata("design:type", String)
294
284
  ], CardChargeDTO.prototype, "redirectUrl", void 0);
285
+ class CardChargeAuthorizationDto {
286
+ }
287
+ exports.CardChargeAuthorizationDto = CardChargeAuthorizationDto;
288
+ __decorate([
289
+ (0, class_validator_1.IsNotEmpty)({ message: "Transaction reference is required" }),
290
+ (0, class_validator_1.IsString)({ message: "Transaction reference must be a string" }),
291
+ __metadata("design:type", String)
292
+ ], CardChargeAuthorizationDto.prototype, "transactionReference", void 0);
293
+ __decorate([
294
+ (0, class_validator_1.IsIn)(["pin", "redirect", "avs_noauth"], { message: "Mode must be one of 'pin', 'redirect', 'avs_noauth'" }),
295
+ __metadata("design:type", String)
296
+ ], CardChargeAuthorizationDto.prototype, "mode", void 0);
297
+ __decorate([
298
+ (0, class_validator_1.ValidateIf)((o) => o.mode === "pin"),
299
+ (0, class_validator_1.IsNotEmpty)({ message: "Please enter your card pin" }),
300
+ (0, class_validator_1.IsString)({ message: "Please enter a 4 digit pin" }),
301
+ __metadata("design:type", String)
302
+ ], CardChargeAuthorizationDto.prototype, "pin", void 0);
303
+ __decorate([
304
+ (0, class_validator_1.ValidateIf)((o) => o.mode === "avs_noauth"),
305
+ (0, class_validator_1.IsNotEmpty)({ message: "City is required for AVS no-auth mode" }),
306
+ (0, class_validator_1.IsString)({ message: "Please enter your address city" }),
307
+ __metadata("design:type", String)
308
+ ], CardChargeAuthorizationDto.prototype, "city", void 0);
309
+ __decorate([
310
+ (0, class_validator_1.ValidateIf)((o) => o.mode === "avs_noauth"),
311
+ (0, class_validator_1.IsNotEmpty)({ message: "Address is required for AVS no-auth mode" }),
312
+ (0, class_validator_1.IsString)({ message: "Please enter your address" }),
313
+ __metadata("design:type", String)
314
+ ], CardChargeAuthorizationDto.prototype, "address", void 0);
315
+ __decorate([
316
+ (0, class_validator_1.ValidateIf)((o) => o.mode === "avs_noauth"),
317
+ (0, class_validator_1.IsNotEmpty)({ message: "State is required for AVS no-auth mode" }),
318
+ (0, class_validator_1.IsString)({ message: "Please enter your state" }),
319
+ __metadata("design:type", String)
320
+ ], CardChargeAuthorizationDto.prototype, "state", void 0);
321
+ __decorate([
322
+ (0, class_validator_1.ValidateIf)((o) => o.mode === "avs_noauth"),
323
+ (0, class_validator_1.IsNotEmpty)({ message: "Country is required for AVS no-auth mode" }),
324
+ (0, class_validator_1.IsString)({ message: "Please enter your country" }),
325
+ __metadata("design:type", String)
326
+ ], CardChargeAuthorizationDto.prototype, "country", void 0);
327
+ __decorate([
328
+ (0, class_validator_1.ValidateIf)((o) => o.mode === "avs_noauth"),
329
+ (0, class_validator_1.IsNotEmpty)({ message: "Zipcode is required for AVS no-auth mode" }),
330
+ (0, class_validator_1.IsString)({ message: "Please enter your zip code" }),
331
+ __metadata("design:type", String)
332
+ ], CardChargeAuthorizationDto.prototype, "zipcode", void 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resurgence-data",
3
- "version": "1.1.26",
3
+ "version": "1.1.28",
4
4
  "description": "DTOs and shareable resources",
5
5
  "module": "dist/index.js",
6
6
  "main": "dist/index.js",
@@ -62,6 +62,88 @@ export interface FlutterwaveCardChargeResponseDTO {
62
62
  };
63
63
  }
64
64
 
65
+ export interface FlutterwaveCardValidationResponseDTO {
66
+ status: string;
67
+ message: string;
68
+ data: {
69
+ id: number;
70
+ tx_ref: string;
71
+ flw_ref: string;
72
+ device_fingerprint: string;
73
+ amount: number;
74
+ charged_amount: number;
75
+ app_fee: number;
76
+ merchant_fee: number;
77
+ processor_response: string;
78
+ auth_model: string;
79
+ currency: string;
80
+ ip: string;
81
+ narration: string;
82
+ status: string;
83
+ auth_url: string;
84
+ payment_type: string;
85
+ fraud_status: string;
86
+ charge_type: string;
87
+ created_at: string;
88
+ account_id: number;
89
+ customer: {
90
+ id: number;
91
+ phone_number: string;
92
+ name: string;
93
+ email: string;
94
+ created_at: string;
95
+ };
96
+ card: {
97
+ first_6digits: string;
98
+ last_4digits: string;
99
+ issuer: string;
100
+ country: string;
101
+ type: string;
102
+ expiry: string;
103
+ };
104
+ };
105
+ }
106
+ export interface FlutterwaveCardVerificationResponseDTO {
107
+ status: string;
108
+ message: string;
109
+ data: {
110
+ id: number;
111
+ tx_ref: string;
112
+ flw_ref: string;
113
+ device_fingerprint: string;
114
+ amount: number;
115
+ currency: string;
116
+ charged_amount: number;
117
+ app_fee: number;
118
+ merchant_fee: number;
119
+ processor_response: string;
120
+ auth_model: string;
121
+ ip: string;
122
+ narration: string;
123
+ status: string;
124
+ payment_type: string;
125
+ created_at: string;
126
+ account_id: number;
127
+ card: {
128
+ first_6digits: string;
129
+ last_4digits: string;
130
+ issuer: string;
131
+ country: string;
132
+ type: string;
133
+ token: string;
134
+ expiry: string;
135
+ };
136
+ amount_settled: number;
137
+ customer: {
138
+ id: number;
139
+ phone_number: string;
140
+ name: string;
141
+ email: string;
142
+ created_at: string;
143
+ };
144
+ };
145
+ }
146
+
65
147
  export interface FlutterwaveCardChargePayload {
66
148
  cardNumber: string;
67
149
  expiryMonth: string;
@@ -176,3 +258,8 @@ export interface VerifyPaymentResponseDTO {
176
258
  };
177
259
  };
178
260
  }
261
+
262
+ export interface FlutterwaveOTPPayload {
263
+ otp: string;
264
+ flwRef: string;
265
+ }
@@ -99,31 +99,36 @@ export class CreateInvoiceDto extends BaseDTO {
99
99
  @ApiProperty({
100
100
  description: "The discount value applied to the invoice",
101
101
  example: 10.5,
102
+ required: false,
102
103
  })
103
- @IsNotEmpty({ message: "Discount value must not be empty" })
104
104
  @IsNumber(undefined, { message: "Discount value must be a valid number" })
105
- discountValue: number;
105
+ @IsOptional()
106
+ discountValue: number = 0;
106
107
  @ApiProperty({
107
108
  description: "Total for invoice",
109
+ required: false,
108
110
  example: 20030,
109
111
  })
110
112
  @IsInt({ message: "Total invoice value must be a valid number" })
111
113
  @IsOptional()
112
- total?: number;
114
+ total?: number = 0;
113
115
  @ApiProperty({
114
116
  description: "Total for invoice service charges",
115
117
  example: 1000,
118
+ required: false,
116
119
  })
117
120
  @IsNumber(undefined, { message: "Service fee total value must be a valid number" })
121
+ @IsOptional()
118
122
  totalService?: number;
119
123
 
120
124
  @ApiProperty({
121
125
  description: "The type of discount applied to the invoice",
122
126
  example: "FIXED",
127
+ required: false,
123
128
  })
124
- @IsNotEmpty({ message: "Discount type must not be empty" })
125
129
  @IsEnum(["FIXED", "PERCENT"], { message: "Discount type must be FIXED or PERCENT" })
126
- discountType: string;
130
+ @IsOptional()
131
+ discountType?: string = "FIXED";
127
132
 
128
133
  @ApiProperty({
129
134
  description: "The due date for the invoice",
@@ -172,8 +177,8 @@ export class UpdateInvoiceDto extends BaseDTO {
172
177
  "[{id:'550e8400-e29b-41d4-a716-446655440001', quantity:2},{id:'550e8400-e29b-41d4-a716-446655440001', quantity:3}]",
173
178
  required: false,
174
179
  })
175
- @IsNotEmpty({ message: "Please provide items for this invoice" })
176
180
  @IsArray({ message: "Please provide a list of items for this invoice" })
181
+ @IsOptional()
177
182
  items?: InvoiceItemDto[];
178
183
 
179
184
  @ApiProperty({
@@ -44,10 +44,12 @@ export class PaymentPageDto {
44
44
  @IsBoolean({ message: "acceptsUserAmount must be a boolean" })
45
45
  @IsOptional()
46
46
  acceptsUserAmount?: boolean;
47
+
47
48
  @ApiProperty({
48
49
  description: "List of items",
49
50
  example:
50
51
  "[{id:'550e8400-e29b-41d4-a716-446655440001', quantity:2},{id:'550e8400-e29b-41d4-a716-446655440001', quantity:3}]",
52
+ required: false,
51
53
  })
52
54
  @IsOptional()
53
55
  @IsArray({ message: "Please provide a list of items for this invoice" })
@@ -84,7 +86,7 @@ export class UpdatePaymentPageDto {
84
86
 
85
87
  @ApiProperty({ description: "Amount's currency code", default: "NGN", required: false })
86
88
  @IsString({ message: "currencyCode must be a string" })
87
- @IsNotEmpty({ message: "Please select a currency" })
89
+ @IsOptional()
88
90
  currencyCode?: string = "NGN";
89
91
 
90
92
  @ApiProperty({ description: "Invoice's active status", required: false })
@@ -106,6 +108,7 @@ export class UpdatePaymentPageDto {
106
108
  description: "List of items",
107
109
  example:
108
110
  "[{id:'550e8400-e29b-41d4-a716-446655440001', quantity:2},{id:'550e8400-e29b-41d4-a716-446655440001', quantity:3}]",
111
+ required: false,
109
112
  })
110
113
  @IsOptional()
111
114
  @IsArray({ message: "Please provide a list of items for this invoice" })
@@ -143,6 +146,6 @@ export class PaymentPageResponseDto {
143
146
  @ApiProperty({ description: "Date when the page was last updated" })
144
147
  updatedAt: Date;
145
148
 
146
- @ApiProperty({ description: "List of Items" })
149
+ @ApiProperty({ description: "List of Items", required: false })
147
150
  items?: InvoiceItemDto[];
148
151
  }
@@ -1,26 +1,19 @@
1
- // * @apiParam {String} transactionReference Merchants generated unique transaction reference.
2
- // * @apiParam {String} clientId Merchants client ID.
3
- // * @apiParam {Integer} amount Transaction amount (In lowrst denomination)
4
- // * @apiParam {String} [customerEmailAddress] Customer's email address.
5
- // * @apiParam {String} [customerPhoneNumber] Customer's phone number.
6
- // * @apiParam {String} [customerName] Customer's name
7
- // * @apiParam {String} customerId Merchant's preffered customer identifier (eg. email or phone number etc)
8
- // * @apiParam {String} currencyCode Account holder's email address.
9
- // * @apiParam {Object} [splitDetails] Transaction split details.
10
-
11
1
  import { ApiProperty } from "@nestjs/swagger";
12
2
  import {
13
3
  IsIn,
14
4
  IsInt,
15
5
  IsNotEmpty,
16
- IsNumber,
17
- isNumberString,
18
6
  IsNumberString,
19
7
  IsString,
20
8
  Length,
21
9
  MinLength,
10
+ ValidateIf,
11
+ IsOptional,
12
+ IsUUID,
13
+ IsIP,
14
+ IsUrl,
15
+ IsEmail,
22
16
  } from "class-validator";
23
- import { IsOptional, IsUUID, IsEnum, IsIP, IsUrl, IsEmail } from "class-validator";
24
17
 
25
18
  export class TransactionSplitDto {
26
19
  @ApiProperty({ description: "Unique identifier for the account" })
@@ -234,3 +227,42 @@ export class CardChargeDTO {
234
227
  @IsOptional()
235
228
  redirectUrl?: string;
236
229
  }
230
+
231
+ export class CardChargeAuthorizationDto {
232
+ @IsNotEmpty({ message: "Transaction reference is required" })
233
+ @IsString({ message: "Transaction reference must be a string" })
234
+ transactionReference: string;
235
+
236
+ @IsIn(["pin", "redirect", "avs_noauth"], { message: "Mode must be one of 'pin', 'redirect', 'avs_noauth'" })
237
+ mode: string;
238
+
239
+ @ValidateIf((o) => o.mode === "pin")
240
+ @IsNotEmpty({ message: "Please enter your card pin" })
241
+ @IsString({ message: "Please enter a 4 digit pin" })
242
+ pin?: string;
243
+
244
+ @ValidateIf((o) => o.mode === "avs_noauth")
245
+ @IsNotEmpty({ message: "City is required for AVS no-auth mode" })
246
+ @IsString({ message: "Please enter your address city" })
247
+ city?: string;
248
+
249
+ @ValidateIf((o) => o.mode === "avs_noauth")
250
+ @IsNotEmpty({ message: "Address is required for AVS no-auth mode" })
251
+ @IsString({ message: "Please enter your address" })
252
+ address?: string;
253
+
254
+ @ValidateIf((o) => o.mode === "avs_noauth")
255
+ @IsNotEmpty({ message: "State is required for AVS no-auth mode" })
256
+ @IsString({ message: "Please enter your state" })
257
+ state?: string;
258
+
259
+ @ValidateIf((o) => o.mode === "avs_noauth")
260
+ @IsNotEmpty({ message: "Country is required for AVS no-auth mode" })
261
+ @IsString({ message: "Please enter your country" })
262
+ country?: string;
263
+
264
+ @ValidateIf((o) => o.mode === "avs_noauth")
265
+ @IsNotEmpty({ message: "Zipcode is required for AVS no-auth mode" })
266
+ @IsString({ message: "Please enter your zip code" })
267
+ zipcode?: string;
268
+ }