@easyflow/javascript-sdk 2.1.7 → 2.1.8
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 +256 -739
- package/dist/435.easyflow-sdk.min.js +1 -1
- package/dist/easyflow-sdk.min.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Easyflow JavaScript SDK
|
|
2
2
|
|
|
3
3
|
[](https://github.com/easyflow-cash/easyflow-javascript-sdk/actions)
|
|
4
|
-
[](https://easyflow-sdk.pages.dev)
|
|
5
5
|
[](LICENSE)
|
|
6
6
|
[](https://github.com/easyflow-cash/easyflow-javascript-sdk)
|
|
7
7
|
[](https://github.com/easyflow-cash/easyflow-javascript-sdk)
|
|
@@ -84,7 +84,22 @@ The **Easyflow JavaScript SDK** is the official tool for developers to integrate
|
|
|
84
84
|
- **High Performance**: Optimized for production
|
|
85
85
|
- **Complete Documentation**: Practical examples for all use cases
|
|
86
86
|
|
|
87
|
-
## What's New in v2.1.
|
|
87
|
+
## What's New in v2.1.8
|
|
88
|
+
|
|
89
|
+
### Security & Privacy Improvements
|
|
90
|
+
|
|
91
|
+
- **README Anonymization**: Removed all personal information and sensitive data
|
|
92
|
+
- **Privacy Protection**: No personal emails, URLs, or contact information exposed
|
|
93
|
+
- **Professional Documentation**: Clean, business-focused documentation
|
|
94
|
+
- **NPM Safety**: Safe for public NPM publication
|
|
95
|
+
|
|
96
|
+
### Test Suite Improvements
|
|
97
|
+
|
|
98
|
+
- **Test Coverage Optimization**: Fixed all failing unit tests for complete 250 test coverage
|
|
99
|
+
- **Mock Structure Corrections**: Updated test mocks to align with actual API response patterns
|
|
100
|
+
- **Customer Management Tests**: Corrected mock structures for `createCustomer` and `getCustomer` methods
|
|
101
|
+
- **Credit Card Tests**: Fixed mock data structures for `addCreditCard` and `getCreditCard` methods
|
|
102
|
+
- **Consistent Test Patterns**: Standardized mock response structures across all endpoints
|
|
88
103
|
|
|
89
104
|
### Test Suite Improvements
|
|
90
105
|
|
|
@@ -109,12 +124,6 @@ The **Easyflow JavaScript SDK** is the official tool for developers to integrate
|
|
|
109
124
|
- **MongoDB ObjectId**: 24-character hexadecimal format `507f1f77bcf86cd799439011`
|
|
110
125
|
- **Strict Validation**: Rejects any other formats for enhanced security
|
|
111
126
|
|
|
112
|
-
### ID Validation Corrections
|
|
113
|
-
|
|
114
|
-
- **UUID v4 Validation**: All entity IDs (order, offer, customer, credit card) now use proper UUID v4 validation instead of incorrect format patterns
|
|
115
|
-
- **Consistent Validation**: Standardized validation across all ID types with proper error messages
|
|
116
|
-
- **Improved Security**: More robust ID validation prevents format-based attacks
|
|
117
|
-
|
|
118
127
|
### Lovable Integration Fixes
|
|
119
128
|
|
|
120
129
|
- **Event System Implementation**: Complete event system with `on()` and `off()` methods
|
|
@@ -122,196 +131,37 @@ The **Easyflow JavaScript SDK** is the official tool for developers to integrate
|
|
|
122
131
|
- **Global Instance**: `window.easyflowSDK` instance with all methods and events
|
|
123
132
|
- **Event Emissions**: Automatic events for `customerCreated`, `orderPlaced`, and `paymentProcessed`
|
|
124
133
|
|
|
125
|
-
### What's New in v2.1.4
|
|
126
|
-
|
|
127
|
-
### New Customer Management Features
|
|
128
|
-
|
|
129
|
-
- **Complete Customer CRUD**: Create, read, and update customers
|
|
130
|
-
- **Brazilian Data Validation**: Full validation for CPF/CNPJ, phone, address
|
|
131
|
-
- **Address Management**: Support for delivery and billing addresses
|
|
132
|
-
- **Phone Number Support**: Brazilian DDD format with international support
|
|
133
|
-
|
|
134
|
-
### Advanced Credit Card Management
|
|
135
|
-
|
|
136
|
-
- **Credit Card Operations**: Add, remove, and get credit cards
|
|
137
|
-
- **Secure Token Handling**: Encrypted credit card token management
|
|
138
|
-
- **Customer Association**: Link credit cards to specific customers
|
|
139
|
-
- **Card Information Retrieval**: Get detailed credit card information
|
|
140
|
-
|
|
141
|
-
### Enhanced HTTP Helper
|
|
142
|
-
|
|
143
|
-
- **Query Parameter Support**: Proper handling of URL parameters
|
|
144
|
-
- **Target-Specific Logic**: Optimized API calls for each endpoint
|
|
145
|
-
- **Parameter Separation**: Clean separation of body and query data
|
|
146
|
-
- **URL Building**: Dynamic URL construction with parameters
|
|
147
|
-
|
|
148
|
-
### Enhanced Security & Validation
|
|
149
|
-
|
|
150
|
-
- **Robust Input Validation**: 15+ validation methods for all data types
|
|
151
|
-
- **Brazilian Compliance**: CPF/CNPJ validation with official algorithms
|
|
152
|
-
- **Address Validation**: Complete Brazilian address structure validation
|
|
153
|
-
- **Phone Validation**: International + Brazilian DDD format support
|
|
154
|
-
- **Email Security**: Advanced email validation with security checks
|
|
155
|
-
|
|
156
|
-
### Advanced Data Protection
|
|
157
|
-
|
|
158
|
-
- **Recursive Sanitization**: Deep object sanitization with circular reference protection
|
|
159
|
-
- **XSS Prevention**: Enhanced sanitization preserving legitimate quotes
|
|
160
|
-
- **Protocol Filtering**: Protection against dangerous protocols
|
|
161
|
-
- **Input Length Validation**: Comprehensive length and format validation
|
|
162
|
-
|
|
163
|
-
### Improved Testing & Quality
|
|
164
|
-
|
|
165
|
-
- **256 Tests Passing**: 100% test success rate
|
|
166
|
-
- **Comprehensive Validation Tests**: All new validation methods tested
|
|
167
|
-
- **Mock System**: Robust mocking for reliable testing
|
|
168
|
-
- **Error Handling**: Enhanced error scenarios coverage
|
|
169
|
-
|
|
170
|
-
## Key Features
|
|
171
|
-
|
|
172
|
-
- **Enterprise Security**: Multi-layered security framework
|
|
173
|
-
- **Brazilian Compliance**: CPF, CNPJ, phone, address validation
|
|
174
|
-
- **Multi-Payment**: Credit card, PIX, bank billet support
|
|
175
|
-
- **Customer Management**: Complete CRM functionality with CRUD operations
|
|
176
|
-
- **Credit Card Management**: Secure add, remove, and get operations
|
|
177
|
-
- **Address Management**: Support for delivery and billing addresses
|
|
178
|
-
- **Phone Validation**: Brazilian DDD format with international support
|
|
179
|
-
- **High Performance**: Optimized for production use
|
|
180
|
-
- **PCI DSS Ready**: Payment industry compliance
|
|
181
|
-
- **Comprehensive Docs**: Complete API documentation
|
|
182
|
-
|
|
183
134
|
## Quick Start
|
|
184
135
|
|
|
185
|
-
###
|
|
186
|
-
|
|
187
|
-
#### Cloudflare Pages CDN (Recommended)
|
|
188
|
-
|
|
189
|
-
```html
|
|
190
|
-
<!-- Latest version -->
|
|
191
|
-
<script src="https://easyflow-sdk.pages.dev/easyflow-sdk.min.js"></script>
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
#### jsDelivr CDN
|
|
195
|
-
|
|
196
|
-
```html
|
|
197
|
-
<!-- Latest version -->
|
|
198
|
-
<script src="https://cdn.jsdelivr.net/npm/@easyflow/javascript-sdk"></script>
|
|
199
|
-
```
|
|
136
|
+
### Installation
|
|
200
137
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
#### For Low-Code/No-Code Platforms (Lovable, Bubble, Webflow, etc.)
|
|
204
|
-
|
|
205
|
-
The SDK configures **automatically** and exposes all functionalities:
|
|
206
|
-
|
|
207
|
-
```javascript
|
|
208
|
-
// Functionalities available automatically
|
|
209
|
-
window.easyflowSDK = {
|
|
210
|
-
// Customers
|
|
211
|
-
createCustomer: function (data) {
|
|
212
|
-
/* ... */
|
|
213
|
-
},
|
|
214
|
-
getCustomer: function (id) {
|
|
215
|
-
/* ... */
|
|
216
|
-
},
|
|
217
|
-
updateCustomer: function (id, data) {
|
|
218
|
-
/* ... */
|
|
219
|
-
},
|
|
220
|
-
|
|
221
|
-
// Payments
|
|
222
|
-
placeOrder: function (offerId, data) {
|
|
223
|
-
/* ... */
|
|
224
|
-
},
|
|
225
|
-
charge: function (data) {
|
|
226
|
-
/* ... */
|
|
227
|
-
},
|
|
228
|
-
|
|
229
|
-
// Validation
|
|
230
|
-
validate: {
|
|
231
|
-
email: function (email) {
|
|
232
|
-
/* ... */
|
|
233
|
-
},
|
|
234
|
-
},
|
|
235
|
-
|
|
236
|
-
// Event callbacks
|
|
237
|
-
on: function (event, callback) {
|
|
238
|
-
/* ... */
|
|
239
|
-
},
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
// Configure callbacks for events
|
|
243
|
-
easyflowSDK.on('customerCreated', function (customer) {
|
|
244
|
-
console.log('Customer created:', customer)
|
|
245
|
-
// Update platform UI
|
|
246
|
-
})
|
|
247
|
-
|
|
248
|
-
easyflowSDK.on('paymentProcessed', function (result) {
|
|
249
|
-
console.log('Payment processed:', result)
|
|
250
|
-
// Redirect or update status
|
|
251
|
-
})
|
|
138
|
+
```bash
|
|
139
|
+
npm install @easyflow/javascript-sdk
|
|
252
140
|
```
|
|
253
141
|
|
|
254
|
-
|
|
142
|
+
### Basic Usage
|
|
255
143
|
|
|
256
144
|
```javascript
|
|
257
|
-
|
|
258
|
-
const sdk = new EasyflowSDK('your-business-id')
|
|
145
|
+
import { EasyflowSDK } from '@easyflow/javascript-sdk'
|
|
259
146
|
|
|
260
|
-
//
|
|
261
|
-
const
|
|
147
|
+
// Initialize SDK
|
|
148
|
+
const sdk = new EasyflowSDK({
|
|
262
149
|
businessId: 'your-business-id',
|
|
263
|
-
enableDebug: true,
|
|
264
150
|
})
|
|
265
|
-
```
|
|
266
|
-
|
|
267
|
-
### Public Documentation
|
|
268
|
-
|
|
269
|
-
**Complete documentation available at:** [https://easyflow-sdk.pages.dev](https://easyflow-sdk.pages.dev)
|
|
270
151
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
### 3. Process Payment with Full Validation
|
|
278
|
-
|
|
279
|
-
```javascript
|
|
280
|
-
// Create order with comprehensive validation
|
|
281
|
-
const orderId = await sdk.placeOrder('f47ac10b-58cc-4372-a567-0e02b2c3d479', {
|
|
282
|
-
buyer: {
|
|
283
|
-
name: 'João Silva',
|
|
284
|
-
email: 'joao@exemplo.com',
|
|
152
|
+
// Process a payment
|
|
153
|
+
const orderId = await sdk.placeOrder('offer-id', {
|
|
154
|
+
customer: {
|
|
155
|
+
name: 'John Doe',
|
|
156
|
+
email: 'john@example.com',
|
|
285
157
|
document: {
|
|
286
158
|
type: 'CPF',
|
|
287
|
-
number: '
|
|
288
|
-
},
|
|
289
|
-
phone: {
|
|
290
|
-
areaCode: '+55',
|
|
291
|
-
ddd: '11',
|
|
292
|
-
number: '999999999', // Only digits
|
|
293
|
-
isMobile: true,
|
|
294
|
-
},
|
|
295
|
-
address: {
|
|
296
|
-
zipCode: '01234567', // Only digits, no hyphens
|
|
297
|
-
street: 'Rua das Flores',
|
|
298
|
-
number: '123',
|
|
299
|
-
complement: 'Apto 45',
|
|
300
|
-
neighborhood: 'Centro',
|
|
301
|
-
city: 'São Paulo',
|
|
302
|
-
state: 'SP', // Validated against Brazilian states
|
|
159
|
+
number: '12345678901',
|
|
303
160
|
},
|
|
304
161
|
},
|
|
305
162
|
payments: [
|
|
306
163
|
{
|
|
307
164
|
method: 'credit-card',
|
|
308
|
-
creditCard: {
|
|
309
|
-
number: '4111111111111111',
|
|
310
|
-
holderName: 'João Silva',
|
|
311
|
-
month: '12',
|
|
312
|
-
year: '2025',
|
|
313
|
-
cvv: '123',
|
|
314
|
-
},
|
|
315
165
|
numberInstallments: 1,
|
|
316
166
|
},
|
|
317
167
|
],
|
|
@@ -320,694 +170,361 @@ const orderId = await sdk.placeOrder('f47ac10b-58cc-4372-a567-0e02b2c3d479', {
|
|
|
320
170
|
console.log('Order created:', orderId)
|
|
321
171
|
```
|
|
322
172
|
|
|
323
|
-
##
|
|
173
|
+
## Features
|
|
324
174
|
|
|
325
|
-
|
|
175
|
+
### Payment Processing
|
|
326
176
|
|
|
327
|
-
|
|
177
|
+
- **Credit Card**: Highest approval rate with advanced fraud detection
|
|
178
|
+
- **PIX**: Instant Brazilian payment method
|
|
179
|
+
- **Bank Billet**: Traditional bank payment option
|
|
180
|
+
- **Recurring Payments**: Custom subscription rules
|
|
328
181
|
|
|
329
|
-
|
|
330
|
-
// Advanced email validation with security checks
|
|
331
|
-
Validator.validateEmail('user@example.com') // Valid
|
|
332
|
-
Validator.validateEmail('user..name@example.com') // Invalid (consecutive dots)
|
|
333
|
-
Validator.validateEmail('a'.repeat(250) + '@example.com') // Too long
|
|
334
|
-
```
|
|
182
|
+
### Customer Management
|
|
335
183
|
|
|
336
|
-
|
|
184
|
+
- **Complete Validation**: CPF/CNPJ, phone, address validation
|
|
185
|
+
- **Data Sanitization**: XSS protection and input cleaning
|
|
186
|
+
- **Secure Storage**: Encrypted sensitive data handling
|
|
337
187
|
|
|
338
|
-
|
|
339
|
-
// CPF validation with official Brazilian algorithm
|
|
340
|
-
Validator.validateCPF('12345678909') // Valid CPF (only digits)
|
|
341
|
-
Validator.validateCPF('11111111111') // Invalid (all same digits)
|
|
342
|
-
|
|
343
|
-
// CNPJ validation with official algorithm
|
|
344
|
-
Validator.validateCNPJ('11222333000181') // Valid CNPJ (only digits)
|
|
345
|
-
Validator.validateCNPJ('00000000000000') // Invalid (all zeros)
|
|
346
|
-
|
|
347
|
-
// Document object format for API
|
|
348
|
-
const document = {
|
|
349
|
-
type: 'CPF',
|
|
350
|
-
number: '12345678909', // Only digits, no formatting
|
|
351
|
-
}
|
|
352
|
-
```
|
|
188
|
+
### Security Features
|
|
353
189
|
|
|
354
|
-
|
|
190
|
+
- **PCI Compliance**: Bank-level security standards
|
|
191
|
+
- **Fingerprinting**: Advanced fraud detection
|
|
192
|
+
- **Rate Limiting**: Protection against abuse
|
|
193
|
+
- **Input Validation**: Comprehensive data validation
|
|
355
194
|
|
|
356
|
-
|
|
357
|
-
// Brazilian phone validation
|
|
358
|
-
Validator.validatePhone({
|
|
359
|
-
areaCode: '+55', // International format
|
|
360
|
-
ddd: '11', // 2-digit DDD (only digits)
|
|
361
|
-
number: '999999999', // 8-9 digit number (only digits)
|
|
362
|
-
isMobile: true, // Boolean flag
|
|
363
|
-
})
|
|
364
|
-
```
|
|
195
|
+
## API Reference
|
|
365
196
|
|
|
366
|
-
###
|
|
197
|
+
### Core Methods
|
|
367
198
|
|
|
368
|
-
|
|
369
|
-
// Complete Brazilian address validation
|
|
370
|
-
Validator.validateAddress({
|
|
371
|
-
zipCode: '01234567', // Brazilian ZIP format (8 digits only)
|
|
372
|
-
street: 'Rua das Flores', // 3-100 characters
|
|
373
|
-
neighborhood: 'Centro', // 2-50 characters
|
|
374
|
-
city: 'São Paulo', // 2-50 characters
|
|
375
|
-
state: 'SP', // Valid Brazilian state
|
|
376
|
-
number: '123', // Valid street number
|
|
377
|
-
})
|
|
378
|
-
```
|
|
199
|
+
#### `placeOrder(offerId, data, headers)`
|
|
379
200
|
|
|
380
|
-
|
|
201
|
+
Creates an order using an existing offer.
|
|
381
202
|
|
|
382
203
|
```javascript
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
email: 'joao@exemplo.com', // Valid email
|
|
387
|
-
document: {
|
|
388
|
-
// Valid CPF/CNPJ (only digits)
|
|
389
|
-
type: 'CPF',
|
|
390
|
-
number: '12345678909',
|
|
391
|
-
},
|
|
392
|
-
phone: {
|
|
393
|
-
// Valid phone (only digits)
|
|
394
|
-
areaCode: '+55',
|
|
395
|
-
ddd: '11',
|
|
396
|
-
number: '999999999',
|
|
397
|
-
isMobile: true,
|
|
204
|
+
const orderId = await sdk.placeOrder('offer-id', {
|
|
205
|
+
customer: {
|
|
206
|
+
/* customer data */
|
|
398
207
|
},
|
|
208
|
+
payments: [
|
|
209
|
+
/* payment methods */
|
|
210
|
+
],
|
|
399
211
|
})
|
|
400
212
|
```
|
|
401
213
|
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
```javascript
|
|
405
|
-
// Business ID validation
|
|
406
|
-
Validator.validateBusinessId('my-business-123') // Valid format
|
|
407
|
-
Validator.validateBusinessId('-business') // Starts with hyphen
|
|
214
|
+
#### `charge(data, headers)`
|
|
408
215
|
|
|
409
|
-
|
|
410
|
-
Validator.validateOrderId('f47ac10b-58cc-4372-a567-0e02b2c3d479') // UUID v4
|
|
411
|
-
Validator.validateOrderId('01890b24-2d7f-7c3f-8f1a-123456789abc') // UUID v7
|
|
412
|
-
Validator.validateOrderId('507f1f77bcf86cd799439011') // MongoDB ObjectId
|
|
216
|
+
Processes a direct charge without using an offer.
|
|
413
217
|
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
218
|
+
```javascript
|
|
219
|
+
const orderId = await sdk.charge({
|
|
220
|
+
items: [{ name: 'Product', price: 1000 }],
|
|
221
|
+
payments: [{ method: 'pix', numberInstallments: 1 }],
|
|
222
|
+
})
|
|
223
|
+
```
|
|
417
224
|
|
|
418
|
-
|
|
419
|
-
Validator.validateCustomerId('01890b24-2d7f-7c3f-af1a-123456789abc') // UUID v7
|
|
420
|
-
Validator.validateCustomerId('507f1f77bcf86cd799439013') // MongoDB ObjectId
|
|
225
|
+
#### `encrypt(creditCardData, headers)`
|
|
421
226
|
|
|
422
|
-
|
|
423
|
-
Validator.validateCreditCardId('01890b24-2d7f-7c3f-bf1a-123456789abc') // UUID v7
|
|
424
|
-
Validator.validateCreditCardId('507f1f77bcf86cd799439014') // MongoDB ObjectId
|
|
227
|
+
Encrypts credit card data for secure processing.
|
|
425
228
|
|
|
426
|
-
|
|
427
|
-
|
|
229
|
+
```javascript
|
|
230
|
+
const token = await sdk.encrypt({
|
|
231
|
+
number: '4111111111111111',
|
|
232
|
+
holderName: 'John Doe',
|
|
233
|
+
expirationMonth: '12',
|
|
234
|
+
expirationYear: '2025',
|
|
235
|
+
cvv: '123',
|
|
236
|
+
})
|
|
428
237
|
```
|
|
429
238
|
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
- **UUID v4**: Must follow pattern `xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx` where `y` is 8, 9, A, or B
|
|
433
|
-
- **UUID v7**: Must follow pattern `xxxxxxxx-xxxx-7xxx-yxxx-xxxxxxxxxxxx` where `y` is 8, 9, A, or B
|
|
434
|
-
- **MongoDB ObjectId**: Must be exactly 24 hexadecimal characters
|
|
435
|
-
- **Business ID**: Must be 3-50 characters, alphanumeric with hyphens, no consecutive hyphens
|
|
239
|
+
### Customer Management
|
|
436
240
|
|
|
437
|
-
|
|
241
|
+
#### `createCustomer(customerData, headers)`
|
|
438
242
|
|
|
439
|
-
|
|
243
|
+
Creates a new customer.
|
|
440
244
|
|
|
441
245
|
```javascript
|
|
442
246
|
const customer = await sdk.createCustomer({
|
|
443
|
-
name: '
|
|
444
|
-
email: '
|
|
445
|
-
|
|
446
|
-
zipCode: '37540114',
|
|
447
|
-
street: 'Rua Marechal Deodoro',
|
|
448
|
-
complement: 'Apt',
|
|
449
|
-
neighborhood: 'Centro',
|
|
450
|
-
city: 'Pouso Alegre',
|
|
451
|
-
state: 'MG',
|
|
452
|
-
number: '33',
|
|
453
|
-
},
|
|
454
|
-
address: {
|
|
455
|
-
zipCode: '37540114',
|
|
456
|
-
street: 'Rua Marechal Deodoro',
|
|
457
|
-
complement: 'Apt',
|
|
458
|
-
neighborhood: 'Centro',
|
|
459
|
-
city: 'Pouso Alegre',
|
|
460
|
-
state: 'MG',
|
|
461
|
-
number: '33',
|
|
462
|
-
},
|
|
463
|
-
document: {
|
|
464
|
-
type: 'CPF',
|
|
465
|
-
number: '01234567890',
|
|
466
|
-
},
|
|
467
|
-
phone: {
|
|
468
|
-
areaCode: '+55',
|
|
469
|
-
ddd: '11',
|
|
470
|
-
number: '998862782',
|
|
471
|
-
isMobile: true,
|
|
472
|
-
},
|
|
247
|
+
name: 'John Doe',
|
|
248
|
+
email: 'john@example.com',
|
|
249
|
+
document: { type: 'CPF', number: '12345678901' },
|
|
473
250
|
})
|
|
474
|
-
|
|
475
|
-
console.log('Customer created:', customer.id)
|
|
476
251
|
```
|
|
477
252
|
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
```javascript
|
|
481
|
-
const customerInfo = await sdk.getCustomer(
|
|
482
|
-
'16fd2706-8baf-433b-82eb-8c7fada847da'
|
|
483
|
-
)
|
|
484
|
-
console.log('Name:', customerInfo.name)
|
|
485
|
-
console.log('Email:', customerInfo.email)
|
|
486
|
-
console.log('Document:', customerInfo.document)
|
|
487
|
-
```
|
|
253
|
+
#### `getCustomer(customerId, headers)`
|
|
488
254
|
|
|
489
|
-
|
|
255
|
+
Retrieves customer information.
|
|
490
256
|
|
|
491
257
|
```javascript
|
|
492
|
-
const
|
|
493
|
-
'16fd2706-8baf-433b-82eb-8c7fada847da',
|
|
494
|
-
{
|
|
495
|
-
name: 'Diego Moura Updated',
|
|
496
|
-
email: 'diegomoura637+21@gmail.com',
|
|
497
|
-
phone: {
|
|
498
|
-
areaCode: '+55',
|
|
499
|
-
ddd: '11',
|
|
500
|
-
number: '998862783',
|
|
501
|
-
isMobile: true,
|
|
502
|
-
},
|
|
503
|
-
}
|
|
504
|
-
)
|
|
505
|
-
|
|
506
|
-
console.log('Customer updated:', updateResult.success)
|
|
258
|
+
const customer = await sdk.getCustomer('customer-id')
|
|
507
259
|
```
|
|
508
260
|
|
|
509
|
-
|
|
261
|
+
#### `updateCustomer(customerId, updateData, headers)`
|
|
510
262
|
|
|
511
|
-
|
|
263
|
+
Updates existing customer information.
|
|
512
264
|
|
|
513
265
|
```javascript
|
|
514
|
-
const
|
|
515
|
-
'
|
|
516
|
-
'
|
|
517
|
-
)
|
|
518
|
-
|
|
519
|
-
console.log('Credit card added:', cardResult.creditCardId)
|
|
266
|
+
const result = await sdk.updateCustomer('customer-id', {
|
|
267
|
+
name: 'John Updated',
|
|
268
|
+
email: 'john.updated@example.com',
|
|
269
|
+
})
|
|
520
270
|
```
|
|
521
271
|
|
|
522
|
-
###
|
|
272
|
+
### Credit Card Management
|
|
523
273
|
|
|
524
|
-
|
|
525
|
-
const creditCard = await sdk.getCreditCard(
|
|
526
|
-
'16fd2706-8baf-433b-82eb-8c7fada847da',
|
|
527
|
-
'58c8f2e0-3d22-4b5d-98ab-9c0a1f2b3c4d'
|
|
528
|
-
)
|
|
529
|
-
|
|
530
|
-
console.log('Brand:', creditCard.brand)
|
|
531
|
-
console.log('Last 4 digits:', creditCard.last4Numbers)
|
|
532
|
-
console.log(
|
|
533
|
-
'Expires:',
|
|
534
|
-
`${creditCard.expiresAtMonth}/${creditCard.expiresAtYear}`
|
|
535
|
-
)
|
|
536
|
-
```
|
|
274
|
+
#### `addCreditCard(customerId, creditCardToken, headers)`
|
|
537
275
|
|
|
538
|
-
|
|
276
|
+
Adds a credit card to a customer.
|
|
539
277
|
|
|
540
278
|
```javascript
|
|
541
|
-
const
|
|
542
|
-
'16fd2706-8baf-433b-82eb-8c7fada847da',
|
|
543
|
-
'58c8f2e0-3d22-4b5d-98ab-9c0a1f2b3c4d'
|
|
544
|
-
)
|
|
545
|
-
|
|
546
|
-
console.log('Credit card removed:', removeResult.success)
|
|
279
|
+
const result = await sdk.addCreditCard('customer-id', 'encrypted-token')
|
|
547
280
|
```
|
|
548
281
|
|
|
549
|
-
|
|
282
|
+
#### `getCreditCard(customerId, creditCardId, headers)`
|
|
550
283
|
|
|
551
|
-
|
|
284
|
+
Retrieves credit card information.
|
|
552
285
|
|
|
553
286
|
```javascript
|
|
554
|
-
|
|
555
|
-
const sanitizedData = Sanitizer.sanitizeObjectFields({
|
|
556
|
-
user: {
|
|
557
|
-
name: '<script>alert("xss")</script>John',
|
|
558
|
-
profile: {
|
|
559
|
-
bio: 'Bio with <strong>HTML</strong>',
|
|
560
|
-
website: 'javascript:alert("xss")',
|
|
561
|
-
},
|
|
562
|
-
},
|
|
563
|
-
})
|
|
564
|
-
// Result: All dangerous content removed, structure preserved
|
|
287
|
+
const creditCard = await sdk.getCreditCard('customer-id', 'credit-card-id')
|
|
565
288
|
```
|
|
566
289
|
|
|
567
|
-
|
|
290
|
+
#### `removeCreditCard(customerId, creditCardId, headers)`
|
|
291
|
+
|
|
292
|
+
Removes a credit card from a customer.
|
|
568
293
|
|
|
569
294
|
```javascript
|
|
570
|
-
|
|
571
|
-
Sanitizer.sanitizeInput('<script>alert("xss")</script>')
|
|
572
|
-
// Returns: 'scriptalert("xss")/script' (quotes preserved)
|
|
295
|
+
const result = await sdk.removeCreditCard('customer-id', 'credit-card-id')
|
|
573
296
|
```
|
|
574
297
|
|
|
575
|
-
|
|
298
|
+
## Validation
|
|
576
299
|
|
|
577
|
-
|
|
578
|
-
// Safe handling of circular references
|
|
579
|
-
const obj = { name: 'test' }
|
|
580
|
-
obj.self = obj
|
|
581
|
-
const sanitized = Sanitizer.sanitizeObjectFields(obj)
|
|
582
|
-
// No infinite recursion, safe processing
|
|
583
|
-
```
|
|
300
|
+
### ID Validation
|
|
584
301
|
|
|
585
|
-
|
|
302
|
+
All entity IDs must follow specific formats:
|
|
586
303
|
|
|
587
|
-
|
|
304
|
+
- **UUID v4**: `xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx` (y = 8,9,A,B)
|
|
305
|
+
- **UUID v7**: `xxxxxxxx-xxxx-7xxx-yxxx-xxxxxxxxxxxx` (y = 8,9,A,B)
|
|
306
|
+
- **MongoDB ObjectId**: 24-character hexadecimal format
|
|
588
307
|
|
|
589
308
|
```javascript
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
price: 1000, // R$ 10.00
|
|
595
|
-
quantity: 1,
|
|
596
|
-
},
|
|
597
|
-
],
|
|
598
|
-
payments: [
|
|
599
|
-
{
|
|
600
|
-
method: 'pix',
|
|
601
|
-
numberInstallments: 1,
|
|
602
|
-
},
|
|
603
|
-
],
|
|
604
|
-
buyer: {
|
|
605
|
-
name: 'João Silva',
|
|
606
|
-
email: 'joao@exemplo.com',
|
|
607
|
-
document: { type: 'CPF', number: '12345678909' }, // Only digits
|
|
608
|
-
},
|
|
609
|
-
})
|
|
309
|
+
// Valid IDs
|
|
310
|
+
Validator.validateOrderId('f47ac10b-58cc-4372-a567-0e02b2c3d479') // UUID v4
|
|
311
|
+
Validator.validateOrderId('01890b24-2d7f-7c3f-8f1a-123456789abc') // UUID v7
|
|
312
|
+
Validator.validateOrderId('507f1f77bcf86cd799439011') // MongoDB ObjectId
|
|
610
313
|
```
|
|
611
314
|
|
|
612
|
-
###
|
|
315
|
+
### Data Validation
|
|
316
|
+
|
|
317
|
+
Comprehensive validation for all input data:
|
|
613
318
|
|
|
614
319
|
```javascript
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
cvv: '123',
|
|
320
|
+
// Customer validation
|
|
321
|
+
Validator.validateCustomer({
|
|
322
|
+
name: 'John Doe',
|
|
323
|
+
email: 'john@example.com',
|
|
324
|
+
document: { type: 'CPF', number: '12345678901' },
|
|
621
325
|
})
|
|
622
|
-
// All data automatically validated before encryption
|
|
623
|
-
```
|
|
624
|
-
|
|
625
|
-
### PIX Payment Retrieval
|
|
626
326
|
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
console.log('Expiration:', pix.expirationDate)
|
|
633
|
-
}
|
|
327
|
+
// Payment validation
|
|
328
|
+
Validator.validateOrderData({
|
|
329
|
+
items: [{ name: 'Product', price: 1000 }],
|
|
330
|
+
payments: [{ method: 'credit-card', numberInstallments: 1 }],
|
|
331
|
+
})
|
|
634
332
|
```
|
|
635
333
|
|
|
636
|
-
##
|
|
334
|
+
## Events
|
|
637
335
|
|
|
638
|
-
|
|
336
|
+
The SDK provides an event system for monitoring operations:
|
|
639
337
|
|
|
640
338
|
```javascript
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
'
|
|
644
|
-
|
|
645
|
-
'x-custom-header': 'custom_value',
|
|
646
|
-
}
|
|
339
|
+
// Listen to events
|
|
340
|
+
sdk.on('customerCreated', (data) => {
|
|
341
|
+
console.log('Customer created:', data)
|
|
342
|
+
})
|
|
647
343
|
|
|
648
|
-
|
|
649
|
-
'
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
)
|
|
344
|
+
sdk.on('orderPlaced', (data) => {
|
|
345
|
+
console.log('Order placed:', data)
|
|
346
|
+
})
|
|
347
|
+
|
|
348
|
+
sdk.on('paymentProcessed', (data) => {
|
|
349
|
+
console.log('Payment processed:', data)
|
|
350
|
+
})
|
|
351
|
+
|
|
352
|
+
// Remove event listeners
|
|
353
|
+
sdk.off('customerCreated', callback)
|
|
653
354
|
```
|
|
654
355
|
|
|
655
|
-
|
|
356
|
+
## Error Handling
|
|
357
|
+
|
|
358
|
+
The SDK provides comprehensive error handling:
|
|
656
359
|
|
|
657
360
|
```javascript
|
|
658
361
|
try {
|
|
659
|
-
const
|
|
660
|
-
'f47ac10b-58cc-4372-a567-0e02b2c3d479',
|
|
661
|
-
data
|
|
662
|
-
)
|
|
663
|
-
console.log('Success:', orderId)
|
|
362
|
+
const result = await sdk.placeOrder('offer-id', orderData)
|
|
664
363
|
} catch (error) {
|
|
665
|
-
if (error
|
|
666
|
-
console.
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
console.error('Security error:', error.message)
|
|
672
|
-
} else {
|
|
673
|
-
console.error('Unexpected error:', error)
|
|
364
|
+
if (error.name === 'ValidationError') {
|
|
365
|
+
console.log('Validation failed:', error.message)
|
|
366
|
+
} else if (error.name === 'NetworkError') {
|
|
367
|
+
console.log('Network error:', error.message)
|
|
368
|
+
} else if (error.name === 'SecurityError') {
|
|
369
|
+
console.log('Security violation:', error.message)
|
|
674
370
|
}
|
|
675
371
|
}
|
|
676
372
|
```
|
|
677
373
|
|
|
678
|
-
##
|
|
679
|
-
|
|
680
|
-
### Run Tests
|
|
681
|
-
|
|
682
|
-
```bash
|
|
683
|
-
# All tests
|
|
684
|
-
npm test
|
|
685
|
-
|
|
686
|
-
# Watch mode
|
|
687
|
-
npm run test:watch
|
|
374
|
+
## Configuration
|
|
688
375
|
|
|
689
|
-
|
|
690
|
-
npm run test:coverage
|
|
376
|
+
### SDK Options
|
|
691
377
|
|
|
692
|
-
|
|
693
|
-
|
|
378
|
+
```javascript
|
|
379
|
+
const sdk = new EasyflowSDK({
|
|
380
|
+
businessId: 'your-business-id',
|
|
381
|
+
environment: 'production', // 'production' or 'sandbox'
|
|
382
|
+
debug: false, // Enable debug logging
|
|
383
|
+
timeout: 30000, // Request timeout in milliseconds
|
|
384
|
+
})
|
|
694
385
|
```
|
|
695
386
|
|
|
696
|
-
###
|
|
697
|
-
|
|
698
|
-
- **250 Tests Passing**
|
|
699
|
-
- **100% Success Rate**
|
|
700
|
-
- **0 Tests Failing**
|
|
701
|
-
- **Fast Execution**
|
|
387
|
+
### Environment Variables
|
|
702
388
|
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
libs/validator.spec.js - Validation framework tests
|
|
708
|
-
libs/sanitizer.spec.js - Sanitization tests
|
|
709
|
-
libs/errors.spec.js - Error handling tests
|
|
710
|
-
libs/constants.spec.js - Constants tests
|
|
711
|
-
libs/utils.spec.js - Utilities tests
|
|
712
|
-
libs/http.spec.js - HTTP communication tests
|
|
713
|
-
libs/logger.spec.js - Logging tests
|
|
714
|
-
libs/exception-handler.spec.js - Exception handling tests
|
|
389
|
+
```bash
|
|
390
|
+
EASYFLOW_BUSINESS_ID=your-business-id
|
|
391
|
+
EASYFLOW_ENVIRONMENT=production
|
|
392
|
+
EASYFLOW_DEBUG=false
|
|
715
393
|
```
|
|
716
394
|
|
|
717
|
-
##
|
|
395
|
+
## Examples
|
|
718
396
|
|
|
719
|
-
###
|
|
397
|
+
### Complete Checkout Flow
|
|
720
398
|
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
| `getPix(orderId, headers)` | Get PIX data | ID validation |
|
|
729
|
-
| `getBankBillet(orderId, headers)` | Get billet data | ID validation |
|
|
730
|
-
|
|
731
|
-
### Customer Management
|
|
732
|
-
|
|
733
|
-
| Method | Description | Validation |
|
|
734
|
-
| --------------------------------------- | --------------- | ------------------------ |
|
|
735
|
-
| `createCustomer(customer, headers)` | Create customer | Full customer validation |
|
|
736
|
-
| `getCustomer(id, headers)` | Get customer | ID validation |
|
|
737
|
-
| `updateCustomer(id, customer, headers)` | Update customer | Full validation |
|
|
738
|
-
|
|
739
|
-
### Credit Card Management
|
|
740
|
-
|
|
741
|
-
| Method | Description | Validation |
|
|
742
|
-
| ----------------------------------------------- | ----------- | --------------------- |
|
|
743
|
-
| `addCreditCard(customerId, token, headers)` | Add card | ID + token validation |
|
|
744
|
-
| `getCreditCard(customerId, cardId, headers)` | Get card | ID validation |
|
|
745
|
-
| `removeCreditCard(customerId, cardId, headers)` | Remove card | ID validation |
|
|
746
|
-
|
|
747
|
-
### Validation Methods
|
|
748
|
-
|
|
749
|
-
| Method | Description | Use Case |
|
|
750
|
-
| ------------------------------------------- | ---------------------- | --------------------- |
|
|
751
|
-
| `Validator.validateEmail(email)` | Email validation | User registration |
|
|
752
|
-
| `Validator.validateCPF(cpf)` | CPF validation | Brazilian individuals |
|
|
753
|
-
| `Validator.validateCNPJ(cnpj)` | CNPJ validation | Brazilian companies |
|
|
754
|
-
| `Validator.validatePhone(phone)` | Phone validation | Contact information |
|
|
755
|
-
| `Validator.validateAddress(address)` | Address validation | Shipping/billing |
|
|
756
|
-
| `Validator.validateCustomer(customer)` | Customer validation | Complete profile |
|
|
757
|
-
| `Validator.validateBusinessId(id)` | Business ID validation | SDK initialization |
|
|
758
|
-
| `Validator.validateOrderId(id)` | Order ID validation | Order operations |
|
|
759
|
-
| `Validator.validateOfferId(id)` | Offer ID validation | Offer operations |
|
|
760
|
-
| `Validator.validateCreditCardToken(token)` | Token validation | Card operations |
|
|
761
|
-
| `Validator.validatePagination(page, limit)` | Pagination validation | List operations |
|
|
399
|
+
```javascript
|
|
400
|
+
// 1. Create customer
|
|
401
|
+
const customer = await sdk.createCustomer({
|
|
402
|
+
name: 'John Doe',
|
|
403
|
+
email: 'john@example.com',
|
|
404
|
+
document: { type: 'CPF', number: '12345678901' },
|
|
405
|
+
})
|
|
762
406
|
|
|
763
|
-
|
|
407
|
+
// 2. Encrypt credit card
|
|
408
|
+
const token = await sdk.encrypt({
|
|
409
|
+
number: '4111111111111111',
|
|
410
|
+
holderName: 'John Doe',
|
|
411
|
+
expirationMonth: '12',
|
|
412
|
+
expirationYear: '2025',
|
|
413
|
+
cvv: '123',
|
|
414
|
+
})
|
|
764
415
|
|
|
765
|
-
|
|
416
|
+
// 3. Add credit card to customer
|
|
417
|
+
const creditCard = await sdk.addCreditCard(customer.id, token)
|
|
766
418
|
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
notifications: true,
|
|
776
|
-
language: 'pt-BR<script>alert("xss")</script>',
|
|
777
|
-
},
|
|
419
|
+
// 4. Place order
|
|
420
|
+
const orderId = await sdk.placeOrder('offer-id', {
|
|
421
|
+
customer: customer,
|
|
422
|
+
payments: [
|
|
423
|
+
{
|
|
424
|
+
method: 'credit-card',
|
|
425
|
+
creditCardId: creditCard.creditCardId,
|
|
426
|
+
numberInstallments: 1,
|
|
778
427
|
},
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
tags: ['tag1', '<script>alert("xss")</script>tag2'],
|
|
782
|
-
},
|
|
783
|
-
}
|
|
784
|
-
|
|
785
|
-
const sanitized = Sanitizer.sanitizeObjectFields(complexData)
|
|
786
|
-
// All dangerous content removed, structure preserved
|
|
428
|
+
],
|
|
429
|
+
})
|
|
787
430
|
```
|
|
788
431
|
|
|
789
|
-
###
|
|
432
|
+
### PIX Payment
|
|
790
433
|
|
|
791
434
|
```javascript
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
phone: { areaCode: '+55', ddd: '11', number: '999999999' }, // Only digits
|
|
796
|
-
address: {
|
|
797
|
-
zipCode: '01234567', // Only digits, no hyphens
|
|
798
|
-
state: 'SP', // Validated against 27 Brazilian states
|
|
799
|
-
city: 'São Paulo',
|
|
435
|
+
const orderId = await sdk.placeOrder('offer-id', {
|
|
436
|
+
customer: {
|
|
437
|
+
/* customer data */
|
|
800
438
|
},
|
|
801
|
-
|
|
439
|
+
payments: [
|
|
440
|
+
{
|
|
441
|
+
method: 'pix',
|
|
442
|
+
numberInstallments: 1,
|
|
443
|
+
},
|
|
444
|
+
],
|
|
445
|
+
})
|
|
802
446
|
|
|
803
|
-
//
|
|
804
|
-
|
|
447
|
+
// Get PIX data
|
|
448
|
+
const pixData = await sdk.getPix(orderId)
|
|
449
|
+
console.log('PIX QR Code:', pixData.qrCode)
|
|
805
450
|
```
|
|
806
451
|
|
|
807
|
-
###
|
|
452
|
+
### Bank Billet Payment
|
|
808
453
|
|
|
809
454
|
```javascript
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
### Optimized for Production
|
|
823
|
-
|
|
824
|
-
- **Minified**: 40% size reduction
|
|
825
|
-
- **Tree Shaking**: Unused code elimination
|
|
826
|
-
- **Lazy Loading**: On-demand feature loading
|
|
827
|
-
- **Memory Efficient**: Optimized data structures
|
|
828
|
-
|
|
829
|
-
### CDN Distribution
|
|
830
|
-
|
|
831
|
-
```html
|
|
832
|
-
<!-- Latest version -->
|
|
833
|
-
<script src="https://easyflow-sdk.pages.dev/easyflow-sdk.min.js"></script>
|
|
834
|
-
|
|
835
|
-
<!-- Versioned (recommended for production) -->
|
|
836
|
-
<script src="https://easyflow-sdk.pages.dev/easyflow-sdk.v2.1.4.min.js"></script>
|
|
837
|
-
|
|
838
|
-
<!-- With SRI (Subresource Integrity) -->
|
|
839
|
-
<script
|
|
840
|
-
src="https://easyflow-sdk.pages.dev/easyflow-sdk.v2.1.4.min.js"
|
|
841
|
-
integrity="sha384-ABC123..."
|
|
842
|
-
crossorigin="anonymous"
|
|
843
|
-
></script>
|
|
844
|
-
```
|
|
845
|
-
|
|
846
|
-
## Development & Contributing
|
|
847
|
-
|
|
848
|
-
### Local Development
|
|
849
|
-
|
|
850
|
-
```bash
|
|
851
|
-
# Clone repository
|
|
852
|
-
git clone https://github.com/easyflow-cash/easyflow-javascript-sdk.git
|
|
853
|
-
cd easyflow-javascript-sdk
|
|
854
|
-
|
|
855
|
-
# Install dependencies
|
|
856
|
-
npm install
|
|
857
|
-
|
|
858
|
-
# Start development server
|
|
859
|
-
npm run dev
|
|
860
|
-
|
|
861
|
-
# Run tests
|
|
862
|
-
npm test
|
|
863
|
-
|
|
864
|
-
# Build for production
|
|
865
|
-
npm run build
|
|
866
|
-
```
|
|
867
|
-
|
|
868
|
-
### Project Structure
|
|
455
|
+
const orderId = await sdk.placeOrder('offer-id', {
|
|
456
|
+
customer: {
|
|
457
|
+
/* customer data */
|
|
458
|
+
},
|
|
459
|
+
payments: [
|
|
460
|
+
{
|
|
461
|
+
method: 'bank-billet',
|
|
462
|
+
numberInstallments: 1,
|
|
463
|
+
},
|
|
464
|
+
],
|
|
465
|
+
})
|
|
869
466
|
|
|
467
|
+
// Get bank billet data
|
|
468
|
+
const bankBillet = await sdk.getBankBillet(orderId)
|
|
469
|
+
console.log('Bank Billet Link:', bankBillet.link)
|
|
870
470
|
```
|
|
871
|
-
├── libs/ # Core libraries
|
|
872
|
-
│ ├── validator.mjs # Validation framework
|
|
873
|
-
│ ├── sanitizer.mjs # Data sanitization
|
|
874
|
-
│ ├── security.mjs # Security features
|
|
875
|
-
│ ├── http.mjs # HTTP communication
|
|
876
|
-
│ ├── errors.mjs # Error handling
|
|
877
|
-
│ ├── constants.mjs # Constants
|
|
878
|
-
│ ├── utils.mjs # Utilities
|
|
879
|
-
│ ├── logger.mjs # Logging
|
|
880
|
-
│ └── exception-handler.mjs # Exception handling
|
|
881
|
-
├── sdk.mjs # Main SDK class
|
|
882
|
-
├── tests/ # Test files
|
|
883
|
-
├── dist/ # Built files
|
|
884
|
-
└── docs/ # Documentation
|
|
885
|
-
```
|
|
886
|
-
|
|
887
|
-
## Quality Metrics
|
|
888
|
-
|
|
889
|
-
### Code Quality
|
|
890
|
-
|
|
891
|
-
- **ESLint**: 0 warnings, 0 errors
|
|
892
|
-
- **Prettier**: Consistent formatting
|
|
893
|
-
- **TypeScript**: JSDoc type definitions
|
|
894
|
-
- **Coverage**: 95% test coverage
|
|
895
|
-
|
|
896
|
-
### Security Score
|
|
897
|
-
|
|
898
|
-
- **Input Validation**: 95/100
|
|
899
|
-
- **Data Sanitization**: 98/100
|
|
900
|
-
- **Error Handling**: 92/100
|
|
901
|
-
- **Rate Limiting**: 90/100
|
|
902
|
-
- **Overall Security**: 92/100
|
|
903
|
-
|
|
904
|
-
### Performance Score
|
|
905
|
-
|
|
906
|
-
- **Bundle Size**: 95/100
|
|
907
|
-
- **Execution Speed**: 92/100
|
|
908
|
-
- **Memory Usage**: 90/100
|
|
909
|
-
- **Network Efficiency**: 88/100
|
|
910
|
-
- **Overall Performance**: 95/100
|
|
911
471
|
|
|
912
472
|
## Browser Support
|
|
913
473
|
|
|
914
|
-
- **Chrome**:
|
|
915
|
-
- **Firefox**:
|
|
916
|
-
- **Safari**:
|
|
917
|
-
- **Edge**:
|
|
918
|
-
- **Node.js**: 16+
|
|
474
|
+
- **Chrome**: 88+
|
|
475
|
+
- **Firefox**: 85+
|
|
476
|
+
- **Safari**: 14+
|
|
477
|
+
- **Edge**: 88+
|
|
919
478
|
|
|
920
|
-
##
|
|
479
|
+
## Node.js Support
|
|
921
480
|
|
|
922
|
-
- **
|
|
923
|
-
- **
|
|
924
|
-
- **
|
|
481
|
+
- **Node.js**: 18+
|
|
482
|
+
- **npm**: 8+
|
|
483
|
+
- **yarn**: 1.22+
|
|
925
484
|
|
|
926
|
-
##
|
|
927
|
-
|
|
928
|
-
### Need Help?
|
|
929
|
-
|
|
930
|
-
- **Complete Documentation**: [docs.easyflow.digital](https://docs.easyflow.digital)
|
|
931
|
-
- **Technical Support**: [easyflow.digital/contact](https://easyflow.digital/contact)
|
|
932
|
-
- **Demo**: [Schedule a demo](https://www.easyflow.digital/)
|
|
933
|
-
- **Issues**: [GitHub Issues](https://github.com/easyflow-cash/easyflow-javascript-sdk/issues)
|
|
934
|
-
|
|
935
|
-
### Start Now
|
|
485
|
+
## Contributing
|
|
936
486
|
|
|
937
|
-
|
|
938
|
-
- **No Bureaucracy**: Product live in 1 minute
|
|
939
|
-
- **100% Plug & Play**: Works for any type of business
|
|
940
|
-
- **Scales with You**: Grow without limits
|
|
487
|
+
We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
|
|
941
488
|
|
|
942
|
-
##
|
|
489
|
+
## Support
|
|
943
490
|
|
|
944
|
-
- **Official Website**: [https://www.easyflow.digital](https://www.easyflow.digital)
|
|
945
|
-
- **Live Demo**: [https://easyflow-sdk.pages.dev](https://easyflow-sdk.pages.dev)
|
|
946
491
|
- **Documentation**: [https://docs.easyflow.digital](https://docs.easyflow.digital)
|
|
947
|
-
- **
|
|
948
|
-
- **
|
|
949
|
-
- **Repository**: [GitHub Repository](https://github.com/easyflow-cash/easyflow-javascript-sdk)
|
|
950
|
-
|
|
951
|
-
## CDN URLs
|
|
952
|
-
|
|
953
|
-
### Cloudflare Pages CDN
|
|
954
|
-
|
|
955
|
-
- **Latest**: [https://easyflow-sdk.pages.dev/easyflow-sdk.min.js](https://easyflow-sdk.pages.dev/easyflow-sdk.min.js)
|
|
956
|
-
- **Versioned**: [https://easyflow-sdk.pages.dev/easyflow-sdk.v2.1.4.min.js](https://easyflow-sdk.pages.dev/easyflow-sdk.v2.1.4.min.js)
|
|
957
|
-
|
|
958
|
-
### jsDelivr CDN
|
|
959
|
-
|
|
960
|
-
- **Latest**: [https://cdn.jsdelivr.net/npm/@easyflow/javascript-sdk@latest/dist/easyflow-sdk.min.js](https://cdn.jsdelivr.net/npm/@easyflow/javascript-sdk@latest/dist/easyflow-sdk.min.js)
|
|
961
|
-
- **Versioned**: [https://cdn.jsdelivr.net/npm/@easyflow/javascript-sdk@2.1.4/dist/easyflow-sdk.min.js](https://cdn.jsdelivr.net/npm/@easyflow/javascript-sdk@2.1.4/dist/easyflow-sdk.min.js)
|
|
962
|
-
|
|
963
|
-
## Author & Maintainer
|
|
964
|
-
|
|
965
|
-
**Diego Moura** - Co-Founder/CTO
|
|
492
|
+
- **GitHub Issues**: [https://github.com/easyflow-cash/easyflow-javascript-sdk/issues](https://github.com/easyflow-cash/easyflow-javascript-sdk/issues)
|
|
493
|
+
- **Website**: [https://www.easyflow.digital](https://www.easyflow.digital)
|
|
966
494
|
|
|
967
|
-
|
|
968
|
-
- **Email**: [diego@easyflow.digital](mailto:diego@easyflow.digital)
|
|
969
|
-
- **Website**: [diegomoura.pro](https://diegomoura.pro)
|
|
970
|
-
- **LinkedIn**: [diego-moura-8499a664](https://www.linkedin.com/in/diego-moura-8499a664/)
|
|
971
|
-
- **Medium**: [@diego_moura](https://medium.com/@diego_moura)
|
|
972
|
-
|
|
973
|
-
### About Diego
|
|
974
|
-
|
|
975
|
-
Diego Moura is a **Solutions Architect**, **Senior Full Stack Developer**, and **CTO** with extensive experience in open source technologies and technical challenges. He is the principal developer and maintainer of the EasyFlow JavaScript SDK, bringing his expertise in security, performance, and enterprise-grade solutions to this project.
|
|
976
|
-
|
|
977
|
-
---
|
|
978
|
-
|
|
979
|
-
## Contributing
|
|
980
|
-
|
|
981
|
-
We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
|
|
495
|
+
## License
|
|
982
496
|
|
|
983
|
-
|
|
497
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
984
498
|
|
|
985
|
-
|
|
499
|
+
## Changelog
|
|
986
500
|
|
|
987
|
-
|
|
501
|
+
### v2.1.8
|
|
988
502
|
|
|
989
|
-
|
|
503
|
+
- **Security & Privacy**: Anonymized README.md for safe NPM publication
|
|
504
|
+
- **Documentation**: Removed all personal information and sensitive data
|
|
505
|
+
- **Professional**: Clean, business-focused documentation
|
|
990
506
|
|
|
991
|
-
|
|
507
|
+
### v2.1.7
|
|
992
508
|
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
**Performance score:** 95/100
|
|
509
|
+
- Fixed all failing unit tests for complete 250 test coverage
|
|
510
|
+
- Corrected mock structures for customer and credit card management
|
|
511
|
+
- Standardized API response patterns across all endpoints
|
|
512
|
+
- Enhanced test reliability and maintainability
|
|
998
513
|
|
|
999
|
-
|
|
514
|
+
### v2.1.6
|
|
1000
515
|
|
|
1001
|
-
|
|
516
|
+
- Enhanced ID validation with UUID v4, UUID v7, and MongoDB ObjectId support
|
|
517
|
+
- Fixed iframe compatibility issues for low-code platforms
|
|
518
|
+
- Implemented complete event system with `on()` and `off()` methods
|
|
519
|
+
- Added global SDK instance for easier integration
|
|
1002
520
|
|
|
1003
|
-
|
|
521
|
+
### v2.1.5
|
|
1004
522
|
|
|
1005
|
-
|
|
1006
|
-
|
|
523
|
+
- Added browser fingerprinting for enhanced security
|
|
524
|
+
- Implemented automatic `x-fingerprint-id` header generation
|
|
525
|
+
- Enhanced security validation and error handling
|
|
526
|
+
- Improved documentation and examples
|
|
1007
527
|
|
|
1008
528
|
---
|
|
1009
529
|
|
|
1010
|
-
**
|
|
1011
|
-
_Solutions Architect & CTO_
|
|
1012
|
-
|
|
1013
|
-
</div>
|
|
530
|
+
**Built with ❤️ by the Easyflow Team**
|