37 lines
1.1 KiB
Dart
37 lines
1.1 KiB
Dart
import 'package:hl_lieferservice/domain/entity/payment_method.dart';
|
|
|
|
/// Port für Zahlungsmethoden — globale Stammdaten.
|
|
///
|
|
/// Im Gegensatz zu `CarsRepository` keine Account-Filter: die Methoden
|
|
/// sind firmenweit, alle Fahrer sehen dieselbe Liste.
|
|
///
|
|
/// Lösch-Verhalten: `delete` wirft eine `PaymentMethodsRepositoryException`
|
|
/// mit konkretem `409`-Fall, wenn die Methode noch von Lieferungen
|
|
/// referenziert wird (Backend hat dafür den FK-RESTRICT). Für „weiches
|
|
/// Entfernen" gibt es `update(active: false)`.
|
|
abstract interface class PaymentMethodsRepository {
|
|
Future<List<PaymentMethod>> list({bool includeInactive = false});
|
|
|
|
Future<PaymentMethod> create({
|
|
required String code,
|
|
required String name,
|
|
});
|
|
|
|
Future<PaymentMethod> update({
|
|
required String id,
|
|
String? name,
|
|
bool? active,
|
|
});
|
|
|
|
Future<void> delete(String id);
|
|
}
|
|
|
|
class PaymentMethodsRepositoryException implements Exception {
|
|
const PaymentMethodsRepositoryException(this.message, [this.cause]);
|
|
final String message;
|
|
final Object? cause;
|
|
|
|
@override
|
|
String toString() => 'PaymentMethodsRepositoryException: $message';
|
|
}
|