@easyflow/javascript-sdk 2.1.11 → 2.1.12

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.
Files changed (2) hide show
  1. package/README.md +392 -28
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Easyflow JavaScript SDK
2
2
 
3
3
  [![Build Status](https://github.com/easyflow-cash/easyflow-javascript-sdk/workflows/Build%20&%20Deploy%20Easyflow%20SDK/badge.svg)](https://github.com/easyflow-cash/easyflow-javascript-sdk/actions)
4
- [![Version](https://img.shields.io/badge/version-2.1.11-blue.svg)](https://easyflow-sdk.pages.dev)
4
+ [![Version](https://img.shields.io/badge/version-2.1.12-blue.svg)](https://easyflow-sdk.pages.dev)
5
5
  [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
6
6
  [![Tests](https://img.shields.io/badge/tests-250%20passing-brightgreen.svg)](https://github.com/easyflow-cash/easyflow-javascript-sdk)
7
7
  [![Coverage](https://img.shields.io/badge/coverage-95%25-brightgreen.svg)](https://github.com/easyflow-cash/easyflow-javascript-sdk)
@@ -12,7 +12,8 @@
12
12
 
13
13
  **Freedom to sell more, better and longer**
14
14
 
15
- > **Enterprise-grade JavaScript SDK** for integration with the Easyflow payment processing platform with robust validation, comprehensive security and Brazilian compliance
15
+ > **Enterprise-grade JavaScript SDK** for integration with the Easyflow payment processing platform with robust
16
+ > validation, comprehensive security and Brazilian compliance
16
17
 
17
18
  [![Website](https://img.shields.io/badge/Website-Easyflow.digital-667eea?style=for-the-badge)](https://www.easyflow.digital/)
18
19
  [![Start Free](https://img.shields.io/badge/Start_Free-22c55e?style=for-the-badge&logo=rocket&logoColor=white)](https://www.easyflow.digital/)
@@ -22,7 +23,9 @@
22
23
 
23
24
  ## About Easyflow
24
25
 
25
- [Easyflow](https://www.easyflow.digital/) is a payment platform that **facilitates the sales process** of digital products and services in a simple and intuitive way. Our mission is to transform Digital Commerce by offering a complete sales structure to maximize your LTV.
26
+ [Easyflow](https://www.easyflow.digital/) is a payment platform that **facilitates the sales process** of digital
27
+ products and services in a simple and intuitive way. Our mission is to transform Digital Commerce by offering a complete
28
+ sales structure to maximize your LTV.
26
29
 
27
30
  ### Why Choose Easyflow?
28
31
 
@@ -68,7 +71,8 @@
68
71
 
69
72
  ## What is the Easyflow JavaScript SDK?
70
73
 
71
- The **Easyflow JavaScript SDK** is the official tool for developers to integrate their applications with the Easyflow platform. With this SDK, you can:
74
+ The **Easyflow JavaScript SDK** is the official tool for developers to integrate their applications with the Easyflow
75
+ platform. With this SDK, you can:
72
76
 
73
77
  - **Process payments** securely and reliably
74
78
  - **Manage customers** with complete Brazilian data validation
@@ -84,7 +88,15 @@ The **Easyflow JavaScript SDK** is the official tool for developers to integrate
84
88
  - **High Performance**: Optimized for production
85
89
  - **Complete Documentation**: Practical examples for all use cases
86
90
 
87
- ## What's New in v2.1.11
91
+ ## What's New in v2.1.12
92
+
93
+ ### Complete Implementation Examples
94
+
95
+ - **Full Data Models**: Comprehensive examples for placeOrder, charge, createCustomer, and addCreditCard
96
+ - **Real-World Scenarios**: Complete workflows with all available data fields
97
+ - **Brazilian Data**: Realistic Brazilian addresses, phone numbers, and document formats
98
+ - **End-to-End Workflows**: Complete customer → credit card → order examples
99
+ - **Code Quality**: Improved formatting and consistency across all examples
88
100
 
89
101
  ### Credit Card Token Validation Fix
90
102
 
@@ -96,8 +108,6 @@ The **Easyflow JavaScript SDK** is the official tool for developers to integrate
96
108
 
97
109
  ### Workflow Corrections
98
110
 
99
- ### Workflow Corrections
100
-
101
111
  - **GitHub Actions Fixed**: Resolved release workflow permissions and SRI hash generation
102
112
  - **CDN Deployment**: Automated deployment to Cloudflare Pages working correctly
103
113
  - **Release Automation**: GitHub releases created automatically with proper SRI hashes
@@ -105,8 +115,6 @@ The **Easyflow JavaScript SDK** is the official tool for developers to integrate
105
115
 
106
116
  ### Hybrid Distribution Strategy
107
117
 
108
- ### Hybrid Distribution Strategy
109
-
110
118
  - **NPM Package**: Contains only documentation and TypeScript definitions
111
119
  - **CDN Scripts**: Production-ready obfuscated builds via Cloudflare Pages
112
120
  - **Enhanced Security**: Code source protected while maintaining accessibility
@@ -119,21 +127,6 @@ The **Easyflow JavaScript SDK** is the official tool for developers to integrate
119
127
  - **Professional Documentation**: Clean, business-focused documentation
120
128
  - **NPM Safety**: Safe for public NPM publication
121
129
 
122
- ### Security & Privacy Improvements
123
-
124
- - **README Anonymization**: Removed all personal information and sensitive data
125
- - **Privacy Protection**: No personal emails, URLs, or contact information exposed
126
- - **Professional Documentation**: Clean, business-focused documentation
127
- - **NPM Safety**: Safe for public NPM publication
128
-
129
- ### Test Suite Improvements
130
-
131
- - **Test Coverage Optimization**: Fixed all failing unit tests for complete 250 test coverage
132
- - **Mock Structure Corrections**: Updated test mocks to align with actual API response patterns
133
- - **Customer Management Tests**: Corrected mock structures for `createCustomer` and `getCustomer` methods
134
- - **Credit Card Tests**: Fixed mock data structures for `addCreditCard` and `getCreditCard` methods
135
- - **Consistent Test Patterns**: Standardized mock response structures across all endpoints
136
-
137
130
  ### Test Suite Improvements
138
131
 
139
132
  - **Test Coverage Optimization**: Fixed all failing unit tests for complete 250 test coverage
@@ -177,7 +170,7 @@ Add this script tag to your HTML:
177
170
  <script src="https://easyflow-sdk.pages.dev/easyflow-sdk.min.js"></script>
178
171
 
179
172
  <!-- Specific version -->
180
- <script src="https://easyflow-sdk.pages.dev/easyflow-sdk.v2.1.11.min.js"></script>
173
+ <script src="https://easyflow-sdk.pages.dev/easyflow-sdk.v2.1.12.min.js"></script>
181
174
  ```
182
175
 
183
176
  #### Option 2: NPM Package (Documentation Only)
@@ -190,7 +183,8 @@ npm install @easyflow/javascript-sdk
190
183
 
191
184
  #### Option 3: Direct Download
192
185
 
193
- Download the latest obfuscated build from [GitHub Releases](https://github.com/easyflow-cash/easyflow-javascript-sdk/releases).
186
+ Download the latest obfuscated build
187
+ from [GitHub Releases](https://github.com/easyflow-cash/easyflow-javascript-sdk/releases).
194
188
 
195
189
  ### Basic Usage
196
190
 
@@ -594,6 +588,366 @@ const bankBillet = await easyflowSDK.getBankBillet(orderId)
594
588
  console.log('Bank Billet Link:', bankBillet.link)
595
589
  ```
596
590
 
591
+ ## Complete Implementation Examples
592
+
593
+ ### 1. placeOrder - Complete Data Model
594
+
595
+ ```javascript
596
+ // Configure SDK
597
+ easyflowSDK.configure({
598
+ businessId: 'demo-business-12345',
599
+ })
600
+
601
+ // Complete placeOrder example with all available fields
602
+ const orderId = await easyflowSDK.placeOrder('demo-offer-67890', {
603
+ buyer: {
604
+ name: 'João Silva Santos',
605
+ email: 'joao.silva@exemplo.com',
606
+ document: {
607
+ number: '12345678901',
608
+ type: 'CPF',
609
+ },
610
+ phone: {
611
+ areaCode: '+55',
612
+ ddd: '11',
613
+ number: '9988776655',
614
+ isMobile: true,
615
+ },
616
+ address: {
617
+ zipCode: '01234567',
618
+ street: 'Rua das Flores',
619
+ complement: 'Apto 101',
620
+ neighborhood: 'Centro',
621
+ city: 'São Paulo',
622
+ state: 'SP',
623
+ number: '123',
624
+ },
625
+ deliveryAddress: {
626
+ zipCode: '01234567',
627
+ street: 'Rua das Flores',
628
+ complement: 'Apto 101',
629
+ neighborhood: 'Centro',
630
+ city: 'São Paulo',
631
+ state: 'SP',
632
+ number: '123',
633
+ },
634
+ },
635
+ payments: [
636
+ {
637
+ method: 'credit-card',
638
+ numberInstallments: 3,
639
+ valueInCents: 15000,
640
+ creditCard: {
641
+ cardId: 'demo-card-67890',
642
+ },
643
+ },
644
+ ],
645
+ items: [
646
+ {
647
+ name: 'Produto Premium',
648
+ description: 'Descrição detalhada do produto premium',
649
+ quantity: 2,
650
+ priceInCents: 7500,
651
+ weightInGrams: 500,
652
+ dimensions: {
653
+ length: 20,
654
+ width: 15,
655
+ height: 10,
656
+ },
657
+ },
658
+ ],
659
+ metadata: {
660
+ source: 'website',
661
+ campaign: 'black-friday-2024',
662
+ affiliate: 'partner-123',
663
+ },
664
+ })
665
+
666
+ console.log('Order created with complete data:', orderId)
667
+ ```
668
+
669
+ ### 2. charge - Complete Data Model
670
+
671
+ ```javascript
672
+ // Complete charge example with all available fields
673
+ const orderId = await easyflowSDK.charge({
674
+ buyer: {
675
+ name: 'Maria Santos Costa',
676
+ email: 'maria.costa@exemplo.com',
677
+ document: {
678
+ number: '98765432100',
679
+ type: 'CPF',
680
+ },
681
+ phone: {
682
+ areaCode: '+55',
683
+ ddd: '21',
684
+ number: '987654321',
685
+ isMobile: true,
686
+ },
687
+ address: {
688
+ zipCode: '20000000',
689
+ street: 'Avenida Rio Branco',
690
+ complement: 'Sala 1001',
691
+ neighborhood: 'Centro',
692
+ city: 'Rio de Janeiro',
693
+ state: 'RJ',
694
+ number: '456',
695
+ },
696
+ deliveryAddress: {
697
+ zipCode: '20000000',
698
+ street: 'Avenida Rio Branco',
699
+ complement: 'Sala 1001',
700
+ neighborhood: 'Centro',
701
+ city: 'Rio de Janeiro',
702
+ state: 'RJ',
703
+ number: '456',
704
+ },
705
+ },
706
+ payments: [
707
+ {
708
+ method: 'pix',
709
+ numberInstallments: 1,
710
+ valueInCents: 25000,
711
+ },
712
+ {
713
+ method: 'bank-billet',
714
+ numberInstallments: 1,
715
+ valueInCents: 15000,
716
+ },
717
+ ],
718
+ items: [
719
+ {
720
+ name: 'Curso Online',
721
+ description: 'Curso completo de desenvolvimento web',
722
+ quantity: 1,
723
+ priceInCents: 25000,
724
+ weightInGrams: 0,
725
+ dimensions: {
726
+ length: 0,
727
+ width: 0,
728
+ height: 0,
729
+ },
730
+ },
731
+ {
732
+ name: 'E-book Premium',
733
+ description: 'E-book com estratégias avançadas',
734
+ quantity: 1,
735
+ priceInCents: 15000,
736
+ weightInGrams: 0,
737
+ dimensions: {
738
+ length: 0,
739
+ width: 0,
740
+ height: 0,
741
+ },
742
+ },
743
+ ],
744
+ metadata: {
745
+ source: 'landing-page',
746
+ campaign: 'curso-web-2024',
747
+ utm_source: 'google',
748
+ utm_medium: 'cpc',
749
+ },
750
+ })
751
+
752
+ console.log('Charge processed with complete data:', orderId)
753
+ ```
754
+
755
+ ### 3. createCustomer - Complete Data Model
756
+
757
+ ```javascript
758
+ // Complete createCustomer example with all available fields
759
+ const customer = await easyflowSDK.createCustomer({
760
+ businessId: 'demo-business-12345',
761
+ name: 'Pedro Oliveira Lima',
762
+ email: 'pedro.oliveira@exemplo.com',
763
+ document: {
764
+ type: 'CPF',
765
+ number: '11122233344',
766
+ },
767
+ phone: {
768
+ areaCode: '+55',
769
+ ddd: '31',
770
+ number: '876543210',
771
+ isMobile: true,
772
+ },
773
+ address: {
774
+ zipCode: '30000000',
775
+ street: 'Rua da Liberdade',
776
+ complement: 'Casa',
777
+ neighborhood: 'Savassi',
778
+ city: 'Belo Horizonte',
779
+ state: 'MG',
780
+ number: '789',
781
+ },
782
+ deliveryAddress: {
783
+ zipCode: '30000000',
784
+ street: 'Rua da Liberdade',
785
+ complement: 'Casa',
786
+ neighborhood: 'Savassi',
787
+ city: 'Belo Horizonte',
788
+ state: 'MG',
789
+ number: '789',
790
+ },
791
+ birthDate: '1990-05-15',
792
+ gender: 'M',
793
+ maritalStatus: 'single',
794
+ occupation: 'Desenvolvedor',
795
+ company: 'Tech Solutions Ltda',
796
+ website: 'https://pedrooliveira.com',
797
+ notes: 'Cliente preferencial com histórico de compras',
798
+ tags: ['premium', 'tech-savvy', 'early-adopter'],
799
+ preferences: {
800
+ newsletter: true,
801
+ marketing: false,
802
+ language: 'pt-BR',
803
+ currency: 'BRL',
804
+ },
805
+ })
806
+
807
+ console.log('Customer created with complete data:', customer)
808
+ ```
809
+
810
+ ### 4. addCreditCard - Complete Data Model
811
+
812
+ ```javascript
813
+ // First, encrypt the credit card data
814
+ const encryptedToken = await easyflowSDK.encrypt({
815
+ cardNumber: '4111111111111111',
816
+ cvv: '123',
817
+ month: '12',
818
+ year: '2025',
819
+ holderName: 'PEDRO OLIVEIRA LIMA',
820
+ })
821
+
822
+ console.log('Credit card encrypted:', encryptedToken)
823
+
824
+ // Then add the encrypted token to the customer
825
+ const creditCard = await easyflowSDK.addCreditCard(
826
+ customer.id, // customer ID from createCustomer
827
+ encryptedToken
828
+ )
829
+
830
+ console.log('Credit card added successfully:', creditCard)
831
+
832
+ // Now you can use the credit card for payments
833
+ const orderWithSavedCard = await easyflowSDK.placeOrder('demo-offer-67890', {
834
+ buyer: {
835
+ customerId: customer.id, // Use existing customer
836
+ name: 'Pedro Oliveira Lima',
837
+ email: 'pedro.oliveira@exemplo.com',
838
+ document: {
839
+ number: '11122233344',
840
+ type: 'CPF',
841
+ },
842
+ },
843
+ payments: [
844
+ {
845
+ method: 'credit-card',
846
+ numberInstallments: 6,
847
+ valueInCents: 50000,
848
+ creditCard: {
849
+ cardId: creditCard.id, // Use saved credit card
850
+ },
851
+ },
852
+ ],
853
+ items: [
854
+ {
855
+ name: 'Produto com Cartão Salvo',
856
+ description: 'Compra usando cartão salvo anteriormente',
857
+ quantity: 1,
858
+ priceInCents: 50000,
859
+ },
860
+ ],
861
+ })
862
+
863
+ console.log('Order with saved credit card:', orderWithSavedCard)
864
+ ```
865
+
866
+ ### 5. Complete Workflow Example
867
+
868
+ ```javascript
869
+ // Complete workflow: Customer → Credit Card → Order
870
+ async function completeWorkflow() {
871
+ try {
872
+ // 1. Configure SDK
873
+ easyflowSDK.configure({
874
+ businessId: 'demo-business-12345',
875
+ })
876
+
877
+ // 2. Create customer with complete data
878
+ const customer = await easyflowSDK.createCustomer({
879
+ businessId: 'demo-business-12345',
880
+ name: 'Ana Silva Costa',
881
+ email: 'ana.silva@exemplo.com',
882
+ document: { type: 'CPF', number: '55566677788' },
883
+ phone: {
884
+ areaCode: '+55',
885
+ ddd: '41',
886
+ number: '765432109',
887
+ isMobile: true,
888
+ },
889
+ address: {
890
+ zipCode: '80000000',
891
+ street: 'Rua das Palmeiras',
892
+ complement: 'Apto 202',
893
+ neighborhood: 'Batel',
894
+ city: 'Curitiba',
895
+ state: 'PR',
896
+ number: '321',
897
+ },
898
+ })
899
+
900
+ // 3. Encrypt and add credit card
901
+ const token = await easyflowSDK.encrypt({
902
+ cardNumber: '5555555555554444',
903
+ cvv: '321',
904
+ month: '10',
905
+ year: '2026',
906
+ holderName: 'ANA SILVA COSTA',
907
+ })
908
+
909
+ const creditCard = await easyflowSDK.addCreditCard(customer.id, token)
910
+
911
+ // 4. Create order using saved customer and credit card
912
+ const orderId = await easyflowSDK.placeOrder('demo-offer-67890', {
913
+ buyer: {
914
+ customerId: customer.id,
915
+ name: customer.name,
916
+ email: customer.email,
917
+ document: customer.document,
918
+ },
919
+ payments: [
920
+ {
921
+ method: 'credit-card',
922
+ numberInstallments: 12,
923
+ valueInCents: 120000,
924
+ creditCard: { cardId: creditCard.id },
925
+ },
926
+ ],
927
+ items: [
928
+ {
929
+ name: 'Pacote Premium Anual',
930
+ description: 'Acesso completo por 12 meses',
931
+ quantity: 1,
932
+ priceInCents: 120000,
933
+ },
934
+ ],
935
+ })
936
+
937
+ console.log('Complete workflow successful:', {
938
+ customer: customer.id,
939
+ creditCard: creditCard.id,
940
+ order: orderId,
941
+ })
942
+ } catch (error) {
943
+ console.error('Workflow failed:', error.message)
944
+ }
945
+ }
946
+
947
+ // Execute the complete workflow
948
+ completeWorkflow()
949
+ ```
950
+
597
951
  ## Distribution & Security
598
952
 
599
953
  ### Why CDN Scripts?
@@ -614,7 +968,7 @@ console.log('Bank Billet Link:', bankBillet.link)
614
968
 
615
969
  <!-- With SRI (Subresource Integrity) -->
616
970
  <script
617
- src="https://easyflow-sdk.pages.dev/easyflow-sdk.v2.1.11.min.js"
971
+ src="https://easyflow-sdk.pages.dev/easyflow-sdk.v2.1.12.min.js"
618
972
  integrity="sha384-[hash]"
619
973
  crossorigin="anonymous"
620
974
  ></script>
@@ -635,7 +989,8 @@ We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) f
635
989
  ## Support
636
990
 
637
991
  - **Documentation**: [https://docs.easyflow.digital](https://docs.easyflow.digital)
638
- - **GitHub Issues**: [https://github.com/easyflow-cash/easyflow-javascript-sdk/issues](https://github.com/easyflow-cash/easyflow-javascript-sdk/issues)
992
+ - **GitHub Issues
993
+ **: [https://github.com/easyflow-cash/easyflow-javascript-sdk/issues](https://github.com/easyflow-cash/easyflow-javascript-sdk/issues)
639
994
  - **Website**: [https://www.easyflow.digital](https://www.easyflow.digital)
640
995
 
641
996
  ## License
@@ -644,6 +999,15 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
644
999
 
645
1000
  ## Changelog
646
1001
 
1002
+ ### v2.1.12
1003
+
1004
+ - **Complete Implementation Examples**: Added comprehensive examples for all major methods
1005
+ - **Full Data Models**: Examples showing all available fields for placeOrder, charge, createCustomer, addCreditCard
1006
+ - **Brazilian Data Examples**: Realistic Brazilian addresses, phone numbers, and document formats
1007
+ - **End-to-End Workflows**: Complete customer → credit card → order workflow examples
1008
+ - **Code Quality**: Improved formatting, consistency, and readability across all examples
1009
+ - **Documentation**: Fixed duplicate sections and improved overall structure
1010
+
647
1011
  ### v2.1.11
648
1012
 
649
1013
  - **Credit Card Token Fix**: Accepts real encrypted/ciphered tokens from vault services
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easyflow/javascript-sdk",
3
- "version": "2.1.11",
3
+ "version": "2.1.12",
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",