@easyflow/javascript-sdk 2.1.13 → 2.1.16
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 +167 -40
- 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)
|
|
@@ -88,7 +88,7 @@ platform. With this SDK, you can:
|
|
|
88
88
|
- **High Performance**: Optimized for production
|
|
89
89
|
- **Complete Documentation**: Practical examples for all use cases
|
|
90
90
|
|
|
91
|
-
## What's New in v2.1.
|
|
91
|
+
## What's New in v2.1.14
|
|
92
92
|
|
|
93
93
|
### Complete Implementation Examples
|
|
94
94
|
|
|
@@ -307,12 +307,41 @@ Creates an order using an existing offer.
|
|
|
307
307
|
|
|
308
308
|
```javascript
|
|
309
309
|
const orderId = await easyflowSDK.placeOrder('demo-offer-67890', {
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
310
|
+
buyer: {
|
|
311
|
+
customerId: customer.id,
|
|
312
|
+
name: "E. R.",
|
|
313
|
+
email: "e***o@gmail.com",
|
|
314
|
+
document: {
|
|
315
|
+
number: "***202266**",
|
|
316
|
+
type: "CPF"
|
|
317
|
+
},
|
|
318
|
+
phone: {
|
|
319
|
+
areaCode: "+55",
|
|
320
|
+
ddd: "92",
|
|
321
|
+
number: "*****2191",
|
|
322
|
+
isMobile: true
|
|
323
|
+
},
|
|
324
|
+
address: {
|
|
325
|
+
zipCode: "37537***",
|
|
326
|
+
street: "Rua R. C. M. de A.",
|
|
327
|
+
complement: "",
|
|
328
|
+
neighborhood: "M. do S.",
|
|
329
|
+
city: "Santa Rita do Sapucaí",
|
|
330
|
+
state: "MG",
|
|
331
|
+
number: "***"
|
|
332
|
+
}
|
|
314
333
|
},
|
|
315
|
-
payments:
|
|
334
|
+
payments:
|
|
335
|
+
[
|
|
336
|
+
{
|
|
337
|
+
method: 'credit-card',
|
|
338
|
+
creditCard: {
|
|
339
|
+
token: 'valid token here',
|
|
340
|
+
},
|
|
341
|
+
numberInstallments: 1,
|
|
342
|
+
},
|
|
343
|
+
],
|
|
344
|
+
metadata: [],
|
|
316
345
|
})
|
|
317
346
|
```
|
|
318
347
|
|
|
@@ -322,8 +351,49 @@ Processes a direct charge without using an offer.
|
|
|
322
351
|
|
|
323
352
|
```javascript
|
|
324
353
|
const orderId = await easyflowSDK.charge({
|
|
325
|
-
|
|
326
|
-
|
|
354
|
+
buyer: {
|
|
355
|
+
name: 'João Silva Santos',
|
|
356
|
+
email: 'joao.silva@exemplo.com',
|
|
357
|
+
document: {
|
|
358
|
+
number: '12345678901',
|
|
359
|
+
type: 'CPF',
|
|
360
|
+
},
|
|
361
|
+
phone: {
|
|
362
|
+
areaCode: '+55',
|
|
363
|
+
ddd: '11',
|
|
364
|
+
number: '9988776655',
|
|
365
|
+
isMobile: true,
|
|
366
|
+
},
|
|
367
|
+
address: {
|
|
368
|
+
zipCode: '01234567',
|
|
369
|
+
street: 'Rua das Flores',
|
|
370
|
+
complement: 'Apto 101',
|
|
371
|
+
neighborhood: 'Centro',
|
|
372
|
+
city: 'São Paulo',
|
|
373
|
+
state: 'SP',
|
|
374
|
+
number: '123',
|
|
375
|
+
},
|
|
376
|
+
customerId: 'demo-customer-12345', // ID do cliente existente (opcional)
|
|
377
|
+
},
|
|
378
|
+
payments: [
|
|
379
|
+
{
|
|
380
|
+
method: 'credit-card',
|
|
381
|
+
numberInstallments: 1,
|
|
382
|
+
valueInCents: 500,
|
|
383
|
+
creditCard: {
|
|
384
|
+
cardId: 'demo-card-id-here', // cardId e token são opcionais, mas pelo menos 1 deve ser fornecido
|
|
385
|
+
token: 'demo-token-credit-card-here',
|
|
386
|
+
},
|
|
387
|
+
},
|
|
388
|
+
],
|
|
389
|
+
items: [
|
|
390
|
+
{
|
|
391
|
+
description: 'Carregador de celular com cabo USB-C',
|
|
392
|
+
name: 'Carregador de Celular',
|
|
393
|
+
quantity: 1,
|
|
394
|
+
priceInCents: 500,
|
|
395
|
+
},
|
|
396
|
+
],
|
|
327
397
|
})
|
|
328
398
|
```
|
|
329
399
|
|
|
@@ -533,14 +603,41 @@ const creditCard = await easyflowSDK.addCreditCard(customer.id, token)
|
|
|
533
603
|
|
|
534
604
|
// 4. Place order
|
|
535
605
|
const orderId = await easyflowSDK.placeOrder('demo-offer-67890', {
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
606
|
+
buyer: {
|
|
607
|
+
customerId: customer.id,
|
|
608
|
+
name: "E. R.",
|
|
609
|
+
email: "e***o@gmail.com",
|
|
610
|
+
document: {
|
|
611
|
+
number: "***202266**",
|
|
612
|
+
type: "CPF"
|
|
542
613
|
},
|
|
543
|
-
|
|
614
|
+
phone: {
|
|
615
|
+
areaCode: "+55",
|
|
616
|
+
ddd: "92",
|
|
617
|
+
number: "*****2191",
|
|
618
|
+
isMobile: true
|
|
619
|
+
},
|
|
620
|
+
address: {
|
|
621
|
+
zipCode: "37537***",
|
|
622
|
+
street: "Rua R. C. M. de A.",
|
|
623
|
+
complement: "",
|
|
624
|
+
neighborhood: "M. do S.",
|
|
625
|
+
city: "Santa Rita do Sapucaí",
|
|
626
|
+
state: "MG",
|
|
627
|
+
number: "***"
|
|
628
|
+
}
|
|
629
|
+
},
|
|
630
|
+
payments:
|
|
631
|
+
[
|
|
632
|
+
{
|
|
633
|
+
method: 'credit-card',
|
|
634
|
+
creditCard: {
|
|
635
|
+
cardId: creditCard.id,
|
|
636
|
+
},
|
|
637
|
+
numberInstallments: 1,
|
|
638
|
+
},
|
|
639
|
+
],
|
|
640
|
+
metadata: [],
|
|
544
641
|
})
|
|
545
642
|
```
|
|
546
643
|
|
|
@@ -548,17 +645,35 @@ const orderId = await easyflowSDK.placeOrder('demo-offer-67890', {
|
|
|
548
645
|
|
|
549
646
|
```javascript
|
|
550
647
|
const orderId = await easyflowSDK.placeOrder('demo-offer-67890', {
|
|
551
|
-
|
|
552
|
-
name:
|
|
553
|
-
email:
|
|
554
|
-
document: {
|
|
648
|
+
buyer: {
|
|
649
|
+
name: "E. R.",
|
|
650
|
+
email: "e***o@gmail.com",
|
|
651
|
+
document: {
|
|
652
|
+
number: "***202266**",
|
|
653
|
+
type: "CPF"
|
|
654
|
+
},
|
|
655
|
+
phone: {
|
|
656
|
+
areaCode: "+55",
|
|
657
|
+
ddd: "92",
|
|
658
|
+
number: "*****2191",
|
|
659
|
+
isMobile: true
|
|
660
|
+
},
|
|
661
|
+
address: {
|
|
662
|
+
zipCode: "37537***",
|
|
663
|
+
street: "Rua R. C. M. de A.",
|
|
664
|
+
complement: "",
|
|
665
|
+
neighborhood: "M. do S.",
|
|
666
|
+
city: "Santa Rita do Sapucaí",
|
|
667
|
+
state: "MG",
|
|
668
|
+
number: "***"
|
|
669
|
+
}
|
|
555
670
|
},
|
|
556
671
|
payments: [
|
|
557
672
|
{
|
|
558
673
|
method: 'pix',
|
|
559
674
|
numberInstallments: 1,
|
|
560
675
|
},
|
|
561
|
-
]
|
|
676
|
+
]
|
|
562
677
|
})
|
|
563
678
|
|
|
564
679
|
// Get PIX data
|
|
@@ -570,11 +685,30 @@ console.log('PIX QR Code:', pixData.qrCode)
|
|
|
570
685
|
|
|
571
686
|
```javascript
|
|
572
687
|
const orderId = await easyflowSDK.placeOrder('demo-offer-67890', {
|
|
573
|
-
|
|
574
|
-
name:
|
|
575
|
-
email:
|
|
576
|
-
document: {
|
|
688
|
+
buyer: {
|
|
689
|
+
name: "E. R.",
|
|
690
|
+
email: "e***o@gmail.com",
|
|
691
|
+
document: {
|
|
692
|
+
number: "***202266**",
|
|
693
|
+
type: "CPF"
|
|
694
|
+
},
|
|
695
|
+
phone: {
|
|
696
|
+
areaCode: "+55",
|
|
697
|
+
ddd: "92",
|
|
698
|
+
number: "*****2191",
|
|
699
|
+
isMobile: true
|
|
700
|
+
},
|
|
701
|
+
address: {
|
|
702
|
+
zipCode: "37537***",
|
|
703
|
+
street: "Rua R. C. M. de A.",
|
|
704
|
+
complement: "",
|
|
705
|
+
neighborhood: "M. do S.",
|
|
706
|
+
city: "Santa Rita do Sapucaí",
|
|
707
|
+
state: "MG",
|
|
708
|
+
number: "***"
|
|
709
|
+
}
|
|
577
710
|
},
|
|
711
|
+
metadata: [],
|
|
578
712
|
payments: [
|
|
579
713
|
{
|
|
580
714
|
method: 'bank-billet',
|
|
@@ -633,12 +767,6 @@ const orderId = await easyflowSDK.placeOrder(
|
|
|
633
767
|
numberInstallments: 1,
|
|
634
768
|
},
|
|
635
769
|
],
|
|
636
|
-
offerItems: [
|
|
637
|
-
{
|
|
638
|
-
offerItemId: '3df92ac7-9d7f-4948-b54f-7e082492f6d2',
|
|
639
|
-
quantity: 1,
|
|
640
|
-
},
|
|
641
|
-
],
|
|
642
770
|
metadata: [],
|
|
643
771
|
}
|
|
644
772
|
)
|
|
@@ -691,12 +819,6 @@ const orderId = await easyflowSDK.placeOrder(
|
|
|
691
819
|
},
|
|
692
820
|
},
|
|
693
821
|
],
|
|
694
|
-
offerItems: [
|
|
695
|
-
{
|
|
696
|
-
offerItemId: '3df92ac7-9d7f-4948-b54f-7e082492f6d2',
|
|
697
|
-
quantity: 1,
|
|
698
|
-
},
|
|
699
|
-
],
|
|
700
822
|
metadata: [],
|
|
701
823
|
}
|
|
702
824
|
)
|
|
@@ -753,8 +875,7 @@ const orderId = await easyflowSDK.charge({
|
|
|
753
875
|
quantity: 1,
|
|
754
876
|
priceInCents: 500,
|
|
755
877
|
},
|
|
756
|
-
]
|
|
757
|
-
businessId: 'demo-business-12345',
|
|
878
|
+
]
|
|
758
879
|
})
|
|
759
880
|
|
|
760
881
|
console.log('Charge processed with credit card:', orderId)
|
|
@@ -1024,7 +1145,7 @@ completeWorkflow()
|
|
|
1024
1145
|
<script src="https://easyflow-sdk.pages.dev/easyflow-sdk.min.js"></script>
|
|
1025
1146
|
|
|
1026
1147
|
<!-- Versioned (recommended for production) -->
|
|
1027
|
-
<script src="https://easyflow-sdk.pages.dev/easyflow-sdk.v2.1.
|
|
1148
|
+
<script src="https://easyflow-sdk.pages.dev/easyflow-sdk.v2.1.14.min.js"></script>
|
|
1028
1149
|
|
|
1029
1150
|
<!-- With SRI (Subresource Integrity) -->
|
|
1030
1151
|
<script
|
|
@@ -1059,6 +1180,12 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
|
|
|
1059
1180
|
|
|
1060
1181
|
## Changelog
|
|
1061
1182
|
|
|
1183
|
+
### v2.1.14
|
|
1184
|
+
|
|
1185
|
+
- **Version Update**: Patch release for latest improvements
|
|
1186
|
+
- **Documentation**: Updated version references and CDN URLs
|
|
1187
|
+
- **Consistency**: All version references aligned to v2.1.14
|
|
1188
|
+
|
|
1062
1189
|
### v2.1.13
|
|
1063
1190
|
|
|
1064
1191
|
- **Code Formatting**: Improved readability of placeOrder examples with better line breaks
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@easyflow/javascript-sdk",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.16",
|
|
4
4
|
"description": "Easyflow JavaScript SDK - Documentation and TypeScript definitions. For production use, use the CDN script: https://easyflow-sdk.pages.dev/easyflow-sdk.min.js",
|
|
5
5
|
"main": "README.md",
|
|
6
6
|
"module": "README.md",
|