Skip to content

rachmatx/smart-pay

Repository files navigation

Smart Pay (Flutter Mobile App)

Smart Pay is a secure, premium digital wallet application built with the Flutter framework. It serves as the mobile interface for customers to interact with the Sparkleen Laundry ecosystem, enabling seamless QRIS scanning and Virtual Account / Bank Transfer payments.


Core Features

  1. Biometric Authentication: Utilizes local_auth to secure the application with Fingerprint or Face Recognition before accessing the main dashboard.
  2. Dynamic QR Scanner: Integrates mobile_scanner to scan QR Codes generated by the Sparkleen Laundry cashier system.
  3. Smart Transfer Matching: Automatically finds pending transactions on the server by cross-referencing the transfer amount and the selected bank.
  4. Real-time Status Tracking: Displays elegant UI status indicators for pending, successful, and failed transactions.
  5. Indonesian Localization: Automatically formats dates, times, and currency (Rupiah) according to Indonesian standards without bloated dependencies.
  6. Optimized Build: Fully configured to support R8/ProGuard minification in Release mode without breaking ML Kit Vision dependencies.

System Requirements

  • Flutter SDK: Version 3.12.2 or higher.
  • Android Studio / Command Line Tools: For building Android APKs.
  • Physical Device: A physical Android device is required to test Biometric (Fingerprint) and Camera capabilities. (Chrome/Web emulation is heavily restricted).

Development & Setup

1. Configuration

Before compiling the application, ensure it points to the correct production or local Payment API. Open the following file: lib/config/merchant_config.dart

Ensure the variables are set to match your backend:

class MerchantConfig {
  static final MerchantConfig _instance = MerchantConfig._internal();
  factory MerchantConfig() => _instance;
  MerchantConfig._internal();

  /// API URL of the Node.js Payment API (e.g., Railway URL)
  String baseUrl = 'https://payment-api-production-ba66.up.railway.app';

  /// Master API Key matching the Node.js server
  String apiKey = 'my-super-secret-key-123';
}

2. Running in Debug Mode

To run the app on your connected device in debug mode (allows Hot Reload but includes debugging bloat):

flutter run

3. Compiling for Production (Release Mode)

To create a lightweight, optimized APK suitable for end-users, run the following command in your terminal:

flutter build apk --split-per-abi

This command generates multiple APKs targeted for specific CPU architectures (significantly reducing the file size down to ~20MB). You can find the compiled files in: build/app/outputs/flutter-apk/

To install the lightweight release APK directly to your connected device via USB debugging, use:

flutter run --release

Integration Guide for Other Projects

While Smart Pay is currently tailored for Sparkleen Laundry, its architecture is highly modular and can be integrated into any other point-of-sale or e-commerce project.

To adapt Smart Pay for a different project, you only need to ensure your new backend replicates the Node.js API behavior:

  1. API Endpoints: Your new backend must provide the exact REST API endpoints expected by the PaymentService (/api/transactions/:id, /api/transactions/find-transfer-target, and /api/transactions/:id/pay).
  2. JSON Contract: Your new backend must return JSON objects that map perfectly to the TransactionModel defined in lib/models/transaction.dart.
  3. Update Config: Modify the baseUrl in merchant_config.dart to point to your new project's API.

No UI or core logic changes are required within the Flutter application as long as the API contract remains identical.


Troubleshooting

  • Biometric Not Supported (Red Snackbar): Ensure you are running the app on a physical device with a registered fingerprint/face. Emulators and Web Browsers will reject biometric requests.
  • Camera Black Screen / Null Pointer Exception: Ensure isMinifyEnabled and isShrinkResources are set to false in the android/app/build.gradle.kts release block, or proper ProGuard rules are configured for ML Kit.
  • Invalid API Key: Ensure the apiKey string in merchant_config.dart perfectly matches the API_KEY environment variable on your Node.js server.

About

Gateway pembayaran digital atau simulator transaksi keuangan yang dibangun untuk efisiensi dan pemrosesan pembayaran yang aman.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages