moamalat_payment 2.0.0
moamalat_payment: ^2.0.0 copied to clipboard
Comprehensive Flutter package for Moamalat payment gateway integration with native Android SDK and WebView support, featuring intelligent auto-selection and Libya-focused currency handling.
Changelog #
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
2.0.0 - 2024-10-06 #
๐ Major Release - Native SDK Integration & Unified Architecture #
This major release introduces dual payment method support with native Android SDK integration alongside the existing WebView implementation, featuring intelligent auto-selection and comprehensive developer experience improvements.
โจ Added #
๐ Native SDK Integration
- NEW:
MoamalatSdkService
- Direct integration with native Moamalat Android SDK - NEW:
MoamalatPaymentUnified
- Unified widget supporting both SDK and WebView methods - NEW:
PaymentMethod
enum for explicit method selection (SDK, WebView) - NEW: Automatic payment method selection (SDK on Android, WebView elsewhere)
- NEW: Platform capability detection and fallback mechanisms
- NEW: SDK availability checking with
MoamalatSdkService.isAvailable()
- NEW: Native error handling and transaction callbacks for SDK
๐ฏ Smart Method Selection
- NEW: Auto-selection logic that chooses optimal payment method per platform
- NEW: Manual override support for forced SDK or WebView usage
- NEW: Graceful fallback from SDK to WebView when SDK unavailable
- NEW: Platform-specific conditional exports for optimal performance
๐๏ธ Enhanced Architecture
- NEW: Modular widget architecture with separate page components
- NEW: Reusable UI components following pub.flutter-io.cn best practices:
PaymentAmountInput
- Currency input with real-time conversionPaymentMethodButton
- Consistent method selection buttonsPaymentStatusCard
- Transaction result displaySdkAvailabilityIndicator
- Real-time SDK status checking
- NEW: Separate page components for different demo types
- NEW: Clean navigation structure with Material Design 3
๐ฑ Android Integration
- NEW: Native Android plugin implementation with method channels
- NEW: PayButton SDK integration with full transaction callbacks
- NEW: Proper Android manifest configuration and dependency management
- NEW: MultiDex support for SDK compatibility
- NEW: JitPack repository integration for SDK dependencies
๐ Improved #
๐ Developer Experience
- IMPROVED: Comprehensive example app refactoring with multiple demo types:
- Payment Methods Demo (unified widget showcase)
- WebView Implementation (traditional approach)
- Direct SDK Usage (advanced integration)
- IMPROVED: Professional Material Design 3 theming
- IMPROVED: Intuitive navigation with descriptive cards and icons
- IMPROVED: Real-time currency conversion display
- IMPROVED: Interactive SDK availability checking
๐จ Code Quality & Documentation
- IMPROVED: Complete code documentation following pub.flutter-io.cn standards
- IMPROVED: Comprehensive inline comments for all public APIs
- IMPROVED: Enhanced error model documentation with usage examples
- IMPROVED: Clear distinction between SDK and WebView amount handling
- IMPROVED: Removed all debug print statements (production-ready)
๐ฐ Currency Handling
- IMPROVED: Consistent CurrencyConverter usage throughout package
- IMPROVED: Clear documentation of amount formats for different methods:
- Unified Widget: Always use dirham strings
- SDK Service: Use LYD doubles (automatic conversion)
- WebView Widget: Use dirham strings
- IMPROVED: Better error messages for amount validation
- IMPROVED: Enhanced display formatting with proper localization
๐ Security & Error Handling
- IMPROVED: Enhanced transaction parsing with robust type checking
- IMPROVED: Better error propagation from native SDK
- IMPROVED: Comprehensive validation for all payment parameters
- IMPROVED: Secure handling of different platform result formats
๐ง Fixed #
๐ Critical Fixes
- FIXED: Amount formatting consistency across all payment methods
- FIXED: Currency conversion calculations now use CurrencyConverter exclusively
- FIXED: Transaction success model amount field changed from int to double
- FIXED: Platform-specific Map type handling in method channel results
- FIXED: Hex validation for merchant secret keys (supports both hex and string)
๐๏ธ Build & Configuration
- FIXED: Android namespace configuration for plugin
- FIXED: Java toolchain compatibility issues
- FIXED: SDK dependency resolution with compileOnly pattern
- FIXED: Manifest merger conflicts with MultiDex configuration
- FIXED: Proper plugin registration and method channel setup
๐ฑ Platform Compatibility
- FIXED: NoClassDefFoundError for SDK classes in runtime
- FIXED: Platform channel result type casting issues
- FIXED: iOS compatibility with WebView-only fallback
- FIXED: Web/WASM compatibility maintained
๐๏ธ Removed #
๐งน Code Cleanup
- REMOVED: All debug print statements from production code
- REMOVED: Manual currency calculations (replaced with CurrencyConverter)
- REMOVED: Redundant example code in main.dart
- REMOVED: Legacy widget examples (moved to dedicated pages)
๐ฆ Dependencies & Configuration #
๐ Updated Dependencies
- UPDATED: Android compileSdkVersion to 34
- UPDATED: Android targetSdkVersion to 34
- UPDATED: Minimum Android SDK version to 19 (required for SDK)
- ADDED: Native SDK dependencies with proper version constraints
- ADDED: MultiDex support for Android applications
๐ Highlights #
This release represents a major architectural evolution:
- ๐ Dual Integration: Both native SDK and WebView support in one package
- ๐ง Smart Selection: Automatic method selection with intelligent fallbacks
- ๐ฑ Native Performance: Direct Android SDK integration for optimal UX
- ๐ Universal Compatibility: Maintained support for all platforms
- ๐จ Professional Examples: Production-ready demo implementations
- ๐ Clear Documentation: Comprehensive guides for all integration approaches
- ๐ฐ Currency Clarity: Crystal-clear amount handling for different methods
๐ Migration Guide #
From v1.x.x to v2.0.0:
-
Recommended Approach: Switch to
MoamalatPaymentUnified
// OLD MoamalatPayment(...) // NEW (Recommended) MoamalatPaymentUnified(...) // Auto-selects best method
-
Amount Handling: No changes needed - dirham strings work everywhere
amount: "1000" // Still correct for all widgets amount: CurrencyConverter.dinarToDirham(1.0) // Still correct
-
Android Setup: Add SDK dependencies for optimal performance
dependencies { implementation 'com.github.payskyCompany:NUMO-PayButton-SDK-android:1.0.12' }
-
Existing Code: All existing
MoamalatPayment
usage continues to work
๐ฎ What's Next #
Future releases will focus on:
- iOS native SDK integration (when available)
- Advanced customization options
- Enhanced analytics and reporting
- Additional payment method support
1.0.1 - 2024-09-23 #
๐ Documentation Improvements #
Enhanced Comments
- IMPROVED: Added clear explanation for
merchantReference
parameter - IMPROVED: Updated comments to explain transaction reference usage
- IMPROVED: Better developer understanding of parameter purpose
Examples Updated
- UPDATED: Main.dart example with improved comments
- UPDATED: README.md examples with clearer explanations
- UPDATED: All merchantReference instances now have descriptive comments
๐ง Minor Fixes #
- FIXED: Comment clarity for transaction reference management
- IMPROVED: Developer experience with better parameter documentation
1.0.0 - 2024-09-23 #
๐ Major Release - Complete Package Overhaul #
This major release represents a complete transformation of the MoamalatPayment package with significant new features, WASM compatibility, and comprehensive improvements.
โจ Added #
๐ฑ Currency Conversion System
- NEW:
CurrencyConverter
utility class for Libyan Dinar โ Dirham conversion - NEW:
dinarToDirham()
- Convert dinar amounts to dirham strings - NEW:
dinarStringToDirham()
- Convert dinar strings to dirham format - NEW:
dirhamToDinar()
- Convert dirham back to dinar for display - NEW:
isValidDinarAmount()
andisValidDirhamAmount()
- Input validation - NEW:
formatDinarAmount()
andformatDirhamAmount()
- Display formatting - NEW: Thousands separators and currency symbols in formatting
๐ WASM Compatibility & Multi-Platform Support
- NEW: Full WebAssembly (WASM) runtime compatibility
- NEW:
MoamalatPaymentWeb
- Web-specific implementation using HTML iframe - NEW:
MoamalatPaymentStub
- Graceful fallback for unsupported platforms - NEW:
MoamalatPaymentPlatform
- Conditional imports for platform detection - NEW: Automatic platform selection (Android/iOS/Web/WASM)
๐จ User Experience Enhancements
- NEW: Beautiful loading indicators with customizable messages
- NEW: Arabic language support with RTL text handling
- NEW: Smooth navigation transitions with proper WebView cleanup
- NEW: Enhanced error handling with user-friendly messages
- NEW: Professional loading screens with progress indicators
๐ Security & Compliance
- NEW: Enhanced HMAC-SHA256 transaction signing
- NEW: Improved secret key handling and validation
- NEW: Comprehensive input validation for all parameters
- NEW: Security best practices documentation
๐ Improved #
๐ Documentation
- IMPROVED: Complete README.md overhaul with professional design
- IMPROVED: Comprehensive API documentation with examples
- IMPROVED: Real-world usage examples (e-commerce, gaming)
- IMPROVED: Platform-specific setup guides
- IMPROVED: Troubleshooting section with common issues
- IMPROVED: Security best practices guide
- IMPROVED: Multi-language examples (Arabic/English)
๐๏ธ Code Quality
- IMPROVED: Complete code documentation following pub.flutter-io.cn standards
- IMPROVED: Enhanced error handling and edge case management
- IMPROVED: Type safety improvements with detailed model classes
- IMPROVED: Code organization and structure
- IMPROVED: Performance optimizations for WebView handling
๐ ๏ธ Developer Experience
- IMPROVED: Comprehensive example application with live demonstrations
- IMPROVED: Currency conversion examples and best practices
- IMPROVED: Platform-specific implementation guides
- IMPROVED: Enhanced debugging and logging capabilities
๐ง Fixed #
๐ Bug Fixes
- FIXED: WebView navigation back button smoothness issues
- FIXED: WebView overlay appearing during navigation transitions
- FIXED: Memory leaks in WebView disposal
- FIXED: PopScope navigation handling for Flutter 3.16+
- FIXED: Platform-specific build issues and compatibility
๐ Compatibility
- FIXED: Flutter 3.16+ compatibility with PopScope migration
- FIXED: Gradle plugin compatibility issues
- FIXED: iOS build configuration problems
- FIXED: Web deployment and WASM runtime issues
๐๏ธ Removed #
๐งน Deprecated Features
- REMOVED: Legacy WillPopScope implementation (replaced with PopScope)
- REMOVED: Redundant debug print statements
- REMOVED: Unused import statements and dependencies
- REMOVED: Generated files from version control
๐ฆ Package Management #
๐ Dependencies
- UPDATED: flutter_inappwebview to latest compatible version
- UPDATED: crypto package for enhanced security
- UPDATED: Flutter SDK compatibility to latest stable
๐ Repository
- IMPROVED: Comprehensive .gitignore following Flutter best practices
- IMPROVED: Repository structure and organization
- IMPROVED: Removed generated files from version control
- IMPROVED: Added proper licensing and contribution guidelines
๐ Highlights #
This release transforms MoamalatPayment from a basic payment widget into a comprehensive, enterprise-ready payment solution:
- ๐ Enterprise Ready: Professional-grade documentation and examples
- ๐ Multi-Platform: Works seamlessly on Android, iOS, Web, and WASM
- ๐ฑ Libya-Focused: Built-in Libyan Dinar currency handling
- ๐ Security First: Enhanced security practices and validation
- ๐จ User Friendly: Beautiful UI with Arabic language support
- ๐ ๏ธ Developer Friendly: Comprehensive documentation and examples
๐ Migration Guide #
For users upgrading from previous versions:
- Currency Amounts: Use
CurrencyConverter.dinarToDirham()
for user-friendly dinar input - Navigation: PopScope is now used instead of WillPopScope (automatic)
- Platform Support: Package now works on all platforms including Web/WASM
- Documentation: Refer to the new comprehensive README for updated examples