littlefish_payments_cash

Cash payment gateway for the LittleFish payments ecosystem. Provides a concrete implementation of CashPaymentsGateway for processing manual cash transactions.

Architecture

littlefish_payments_cash
├── gateway/
│   └── cash_payment_gateway.dart    # LittleFishCashPaymentGateway
└── models/
    ├── cash_payment_result.dart      # CashPaymentResult extends PaymentResult
    └── cash_provider.dart            # CashProvider extends PaymentProvider

Components

LittleFishCashPaymentGateway

Extends CashPaymentsGateway (from littlefish_payments) with four implemented operations:

Operation Description
processPurchase Basic cash purchase
processPurchaseWithCash Purchase with explicit cash amount tracking
processRefundByAmount Amount-based cash refund
processWithdrawByAmount Cash withdrawal

All operations validate authentication and business/merchant IDs before processing.

CashPaymentResult

Extends PaymentResult with cash-specific defaults (entry mode = manual, payment method = cash). Includes a CashPaymentResult.failed() factory for error scenarios.

CashProvider

Extends PaymentProvider with PaymentProviderType.cash. No external configuration or SDK integration required.

Usage

import 'package:littlefish_payments_cash/littlefish_payments_cash.dart';

final gateway = LittleFishCashPaymentGateway('my_app');
await gateway.initialise();

final result = await gateway.processPurchase(
  businessId: 'BUS_123',
  merchantId: 'MER_456',
  amount: Decimal.parse('100.00'),
  isoCurrencyCode: 'ZAR',
  transactionId: 'TXN_789',
  reference: 'REF_001',
);

Dependencies

  • littlefish_core — Auth service, logger service
  • littlefish_paymentsCashPaymentsGateway base class, PaymentResult, PaymentProvider
  • decimal — Monetary arithmetic
  • uuid — Transaction ID generation