-
-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial Implement Azul Payment Gateway Integration #24
Open
joelGabriel7
wants to merge
43
commits into
indexa-git:master
Choose a base branch
from
joelGabriel7:features-fixes
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+3,991
−388
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Added PaymentTransaction base model with amount validation - Implemented SaleTransaction, HoldTransaction, RefundTransaction models - Added CardData validation with proper field constraints - Enhanced validation utilities for amount and ITBIS handling This improves payment processing reliability and provides proper validation for Azul transactions.
- Added AzulAPI client with retry mechanism - Implemented request/response error handling - Added logging for debugging feat(api): add environment and endpoint management - Added Environment enum and AzulEndpoints class - Implemented environment-based URL selection - Added custom URL support refactor(api): extract common request logic - Added shared request configuration - Unified request handling methods - Improved type hints and error messages
- Added TransactionService for payments - Added DataVaultService for tokenization - Implemented async methods
- Add AzulBaseModel with common payment fields (Channel, Amount, Itbis) - Implement distinct transaction models: * SaleTransactionModel for direct card payments * HoldTransactionModel for authorization holds * RefundTransactionModel for refunds * TokenSaleModel for token-based transactions - Add DataVault operation models: * DataVaultCreateModel for token creation * DataVaultDeleteModel for token deletion - Set default values and validations: * Default Channel=EC and PosInputMode=E-Commerce * Required card fields for direct payments * Optional card fields for token payments * Literal types for transaction types (Sale, Hold, Refund) This change provides type-safe models for each payment operation, ensuring proper data validation and improving API reliability.
…ault services - Add detailed class-level documentation explaining service purposes: * TransactionService for payment processing (sales, holds, refunds) * DataVaultService for card tokenization operations - Document all public methods with: * Clear descriptions of functionality * Complete Args/Returns/Raises sections * Detailed API response field descriptions * Common error scenarios - Include PCI compliance context for DataVault usage - Add type hints and return value specifications This documentation helps developers understand: - The purpose and capabilities of each service - Expected inputs and outputs for each operation - How to handle API responses and errors - Best practices for secure card data handling
Core Features: - Implement async HTTP client with certificate-based authentication - Add automatic environment detection (PROD/TEST) - Handle request retries with alternate URLs for production - Add comprehensive error handling and logging Technical Details: - Add certificate and private key management - Implement request preparation with required merchant params - Add response validation and error parsing - Set up configurable timeouts and headers - Add logging for debugging and monitoring Security: - Implement secure certificate-based authentication - Handle sensitive auth headers (Auth1, Auth2) - Validate API responses for error conditions - Support custom URLs for different environments This client provides a secure and reliable foundation for all Azul API operations, with proper error handling and logging for production use.
Payment Tests: - Add comprehensive test cases for card payments and refunds - Document fixture data with detailed explanations - Add test assertions with descriptive messages - Implement proper test isolation with fixtures Hold Tests: - Add authorization hold test scenarios - Document hold transaction flow and purpose - Add validation for authorization codes and RRN DataVault Tests: - Implement complete token lifecycle testing - Add token creation and validation tests - Test token-based sales scenarios - Verify proper error handling for invalid tokens Test Improvements: - Add detailed docstrings explaining test purposes - Document expected outcomes and assertions - Add descriptive comments for test data - Improve error messages for failed assertions - Ensure proper test isolation and data cleanup This change improves test maintainability and serves as documentation for the payment integration workflow.
Payment Examples: - Add detailed payment flow example with card processing - Add refund example with transaction reference handling - Add hold/authorization example for pre-auth scenarios - Add complete DataVault token lifecycle example Documentation Improvements: - Add detailed docstrings explaining each example's purpose - Include step-by-step process descriptions - Document specific use cases and scenarios - Add security notes for token handling - Improve code comments and output messages Example Features: - Direct card payment with proper error handling - Refund processing with transaction ID validation - Authorization holds for reservations - Token creation, usage, and deletion flow - Clear response handling and formatting These examples serve as both documentation and implementation guides, showing proper usage of the Azul payment integration in real-world scenarios.
- Added a new test in to verify the transaction method. - Created a fixture for to provide a configured instance. - Ensured the test checks for successful transaction verification and transaction presence. - Add schemas to verifyPayment to validate transaction
- Added for handling void transactions. - Updated to use Post as the . - Added for verifying transactions. - Ensured is correctly utilized in transaction models. - Cleaned up and organized schema definitions for better readability.
- Implemented method to support pre-authorization transactions. - Added method to process post-authorization transactions. - Improved error handling and logging for transaction operations. - Refactored transaction service for better modularity and maintainability.
- Added test for transaction method to ensure correct verification. - Implemented test for transaction to validate voiding functionality. - Created test for transaction to check post-authorization process. - Utilized fixtures for consistent setup across transaction tests. - Enhanced test coverage and reliability for transaction service.
- Refactored client to reduce code duplication and enhance readability. - Centralized certificate handling and improved error management. - Added to handle SSL configuration errors. - Enhanced logging for better traceability of client operations.
- Created to demonstrate hold and post transaction flow. - Added to illustrate transaction verification process. - Enhanced examples to provide clear usage patterns for transaction services.
- Add amount format validation and conversion - Add support for ITBIS calculation - Add string representation with formatted amounts - Add field descriptions and documentation - Add validation for custom fields
- Add secure form generation with auto-submit - Add HMAC-SHA512 hash calculation - Add environment-based URL handling - Add comprehensive documentation - Remove unnecessary logging
- Add payment form creation endpoint - Add amount visualization endpoint - Add example amount handling - Add error handling - Add clean documentation
- Replace class-based Config with model_config = ConfigDict - Add comprehensive test suite for PaymentPageModel - Add test cases for amount validation and form generation - Fix Pydantic deprecation warning - Maintain backward compatibility with existing functionality
… support for multiple certificate input formats (file paths, PEM content, base64) - Enhance certificate loading in config.py with better validation - Update client.py to handle certificate errors gracefully - Add detailed error messages for certificate loading failures - Improve security by enforcing proper file permissions - Add support for environment-specific certificate paths
…h credential depends on type transaction if is 3D or not
- Created SecureSaleRequest model for 3DS transactions with validation - Implemented CardHolderInfo model with optional fields and documentation - Added ThreeDSAuth model with URL validation and serialization - Added ChallengeIndicator enum for authentication preferences - Implemented custom validation for URLs and critical fields - Improved data type handling and serialization formats
…ement - Added SecureService for handling 3DS authenticated payments - Implemented process_sale for initiating secure transactions - Added support for 3DSMethod and challenge handling - Improved session and form management with UI feedback - Implemented tracking system for 3DS methods - Optimized authentication flow and error handling - Added detailed logging for debugging
- Created FastAPI application for 3DS payment demonstration - Added test cards with different configurations - Implemented endpoints for payment processing - Added custom error handling and user feedback - Implemented complete 3DS flow with method and challenge support - Improved session handling with secure_id - Added visual feedback system for transaction states
- Created modern UI components for payment flow feedback - Added dynamic status handling for transactions and errors - Implemented consistent styling across all templates - Added responsive design and visual feedback system - Improved error handling with detailed messages - Added animated icons and interactive elements
- Removed code duplication by consolidating request methods in client - Unified _make_request and _async_request into a single method - Updated API client to handle SSL certificates properly - Added delay in void transaction tests to handle processing time - Improved test configuration in pyproject.toml - Updated gitignore patterns for development files - Fixed SSL deprecation warnings in client implementation - Enhanced error handling for transaction state conflicts
- Added conftest.py to handle PYTHONPATH configuration - Updated MANIFEST.in to include required package files - Configured setup.py for proper package installation - Organized package initialization in api and core modules - Improved module discovery and import handling - Enhanced development environment configuration
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Azul Payment Gateway Integration
Description
This PR implements a integration with Azul's payment gateway, providing a robust Python SDK for processing payments, refunds, authorization holds, and secure card tokenization. The implementation follows best practices for payment processing and includes comprehensive documentation and testing.
Features
Payment Processing
Card Tokenization (DataVault)
Developer Experience
Recent Updates (04/02/2025)
New Features
Extended Transaction Operations
Enhanced Error Handling
Testing Improvements
Documentation Updates
Implementation Details
Core Components
Transaction Service (
pyazul/services/transaction.py
)DataVault Service (
pyazul/services/datavault.py
)Latest Changes (05/02/2025)
Model Improvements
Testing Enhancements
Latest Changes (11/02/2025)
Certificate Management Improvements
Enhanced Certificate Handling
Configuration Enhancements
config.py
with robust validationClient Updates
client.py
Latest Changes (17/02/2025)
3D Secure Implementation Details
Core Components
Models
Services
Client Refactoring
Example Implementation
Secure Payment Demo
Test Cards
Key Improvements
Architecture
Authentication
UI/UX
Documentation