@easyflow/javascript-sdk 2.1.25 → 2.1.27
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/DATA-STRUCTURES.md +28 -10
- package/INDEX.md +41 -0
- package/README.md +141 -1144
- package/dist/easyflow-sdk.min.js +1 -1
- package/package.json +3 -3
package/DATA-STRUCTURES.md
CHANGED
|
@@ -115,6 +115,7 @@ const payments = [
|
|
|
115
115
|
method: 'credit-card',
|
|
116
116
|
numberInstallments: 6,
|
|
117
117
|
creditCard: {
|
|
118
|
+
token: 'transactional-token-123',
|
|
118
119
|
cardId: 'saved-card-123',
|
|
119
120
|
last4Numbers: '1234',
|
|
120
121
|
holderName: 'JOAO SILVA SANTOS',
|
|
@@ -389,7 +390,7 @@ interface ErrorResponse {
|
|
|
389
390
|
### Common Error Codes
|
|
390
391
|
|
|
391
392
|
| Code | Description | HTTP Status |
|
|
392
|
-
|
|
393
|
+
|--------------------------|--------------------------|-------------|
|
|
393
394
|
| `VALIDATION_ERROR` | Data validation failed | 400 |
|
|
394
395
|
| `SECURITY_ERROR` | Security violation | 403 |
|
|
395
396
|
| `RATE_LIMIT_EXCEEDED` | Too many requests | 429 |
|
|
@@ -404,15 +405,32 @@ interface ErrorResponse {
|
|
|
404
405
|
|
|
405
406
|
```javascript
|
|
406
407
|
{
|
|
407
|
-
"error"
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
"
|
|
411
|
-
|
|
412
|
-
"
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
408
|
+
"error"
|
|
409
|
+
:
|
|
410
|
+
{
|
|
411
|
+
"code"
|
|
412
|
+
:
|
|
413
|
+
"VALIDATION_ERROR",
|
|
414
|
+
"message"
|
|
415
|
+
:
|
|
416
|
+
"Invalid email format",
|
|
417
|
+
"details"
|
|
418
|
+
:
|
|
419
|
+
"Email must be a valid email address",
|
|
420
|
+
"field"
|
|
421
|
+
:
|
|
422
|
+
"email",
|
|
423
|
+
"value"
|
|
424
|
+
:
|
|
425
|
+
"invalid-email"
|
|
426
|
+
}
|
|
427
|
+
,
|
|
428
|
+
"timestamp"
|
|
429
|
+
:
|
|
430
|
+
"2024-01-15T10:30:00.000Z",
|
|
431
|
+
"requestId"
|
|
432
|
+
:
|
|
433
|
+
"req-12345-abcde"
|
|
416
434
|
}
|
|
417
435
|
```
|
|
418
436
|
|
package/INDEX.md
CHANGED
|
@@ -121,3 +121,44 @@ npm install @easyflow/javascript-sdk
|
|
|
121
121
|
**Built with ❤️ by the Easyflow Team**
|
|
122
122
|
|
|
123
123
|
_For questions and support, contact [contato@easyflow.digital](mailto:contato@easyflow.digital)_
|
|
124
|
+
|
|
125
|
+
## 🚀 **Quick Start**
|
|
126
|
+
|
|
127
|
+
### **Via NPM (Recomendado para TypeScript)**
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
npm install @easyflow/javascript-sdk
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### **Via CDN (Para projetos simples)**
|
|
134
|
+
|
|
135
|
+
```html
|
|
136
|
+
<script src="https://easyflow-sdk.pages.dev/easyflow-sdk.min.js"></script>
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## 📚 **TypeScript Integration**
|
|
140
|
+
|
|
141
|
+
Para projetos TypeScript, o SDK é exposto globalmente quando carregado via CDN. Adicione as seguintes declarações ao seu projeto:
|
|
142
|
+
|
|
143
|
+
```typescript
|
|
144
|
+
// O SDK está sendo carregado via CDN e exposto globalmente como window.easyflowSDK
|
|
145
|
+
declare global {
|
|
146
|
+
interface Window {
|
|
147
|
+
easyflowSDK: any
|
|
148
|
+
EasyflowSDK: any
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### **Exemplo de Uso com TypeScript**
|
|
154
|
+
|
|
155
|
+
```typescript
|
|
156
|
+
// Configurar o SDK
|
|
157
|
+
window.easyflowSDK.configure({ businessId: 'your-business-id' })
|
|
158
|
+
|
|
159
|
+
// Usar métodos do SDK
|
|
160
|
+
const customer = await window.easyflowSDK.createCustomer(customerData)
|
|
161
|
+
const payment = await window.easyflowSDK.charge(paymentData)
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## 🔧 **Usage Examples**
|