@easyflow/javascript-sdk 2.1.14 → 2.1.17
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 -53
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -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)
|
|
@@ -815,7 +936,6 @@ console.log('Charge processed with PIX:', orderId)
|
|
|
815
936
|
```javascript
|
|
816
937
|
// Complete createCustomer example with all available fields
|
|
817
938
|
const customer = await easyflowSDK.createCustomer({
|
|
818
|
-
businessId: 'demo-business-12345',
|
|
819
939
|
name: 'João Silva Santos',
|
|
820
940
|
email: 'joao.silva@exemplo.com',
|
|
821
941
|
document: {
|
|
@@ -846,20 +966,6 @@ const customer = await easyflowSDK.createCustomer({
|
|
|
846
966
|
state: 'SP',
|
|
847
967
|
number: '123',
|
|
848
968
|
},
|
|
849
|
-
birthDate: '1990-05-15',
|
|
850
|
-
gender: 'M',
|
|
851
|
-
maritalStatus: 'single',
|
|
852
|
-
occupation: 'Desenvolvedor',
|
|
853
|
-
company: 'Tech Solutions Ltda',
|
|
854
|
-
website: 'https://joaosilva.com',
|
|
855
|
-
notes: 'Cliente preferencial com histórico de compras',
|
|
856
|
-
tags: ['premium', 'tech-savvy', 'early-adopter'],
|
|
857
|
-
preferences: {
|
|
858
|
-
newsletter: true,
|
|
859
|
-
marketing: false,
|
|
860
|
-
language: 'pt-BR',
|
|
861
|
-
currency: 'BRL',
|
|
862
|
-
},
|
|
863
969
|
})
|
|
864
970
|
|
|
865
971
|
console.log('Customer created with complete data:', customer)
|
|
@@ -935,7 +1041,6 @@ async function completeWorkflow() {
|
|
|
935
1041
|
|
|
936
1042
|
// 2. Create customer with complete data
|
|
937
1043
|
const customer = await easyflowSDK.createCustomer({
|
|
938
|
-
businessId: 'demo-business-12345',
|
|
939
1044
|
name: 'Ana Silva Costa',
|
|
940
1045
|
email: 'ana.silva@exemplo.com',
|
|
941
1046
|
document: { type: 'CPF', number: '55566677788' },
|
|
@@ -1059,6 +1164,15 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
|
|
|
1059
1164
|
|
|
1060
1165
|
## Changelog
|
|
1061
1166
|
|
|
1167
|
+
### v2.1.17
|
|
1168
|
+
|
|
1169
|
+
- **Complete Implementation Examples**: Added comprehensive examples for all major methods
|
|
1170
|
+
- **Full Data Models**: Examples showing all available fields for placeOrder, charge, createCustomer, addCreditCard
|
|
1171
|
+
- **Brazilian Data Examples**: Realistic Brazilian addresses, phone
|
|
1172
|
+
- **Version Update**: Patch release for latest improvements
|
|
1173
|
+
- **Documentation**: Updated version references and CDN URLs
|
|
1174
|
+
- **Consistency**: All version references aligned to v2.1.17
|
|
1175
|
+
|
|
1062
1176
|
### v2.1.14
|
|
1063
1177
|
|
|
1064
1178
|
- **Version Update**: Patch release for latest improvements
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@easyflow/javascript-sdk",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.17",
|
|
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",
|