temp build

This commit is contained in:
Stephan D
2025-12-05 01:32:41 +01:00
parent 082d782a80
commit f71cc76f64
50 changed files with 853 additions and 707 deletions

View File

@@ -0,0 +1,37 @@
import 'package:pshared/api/responses/payment_method.dart';
import 'package:pshared/data/mapper/payment/method.dart';
import 'package:pshared/models/payment/methods/type.dart';
import 'package:pshared/service/services.dart';
import 'package:pshared/service/template.dart';
class PaymentMethodService {
static const String _objectType = Services.paymentMethods;
static final BasicService<PaymentMethod> _basicService = BasicService<PaymentMethod>(
objectType: _objectType,
fromJson: (json) => PaymentMethodResponse.fromJson(json).paymentMethods.map((dto) => dto.toDomain()).toList(),
);
static BasicService<PaymentMethod> get basicService => _basicService;
static Future<List<PaymentMethod>> list(String organizationRef, String recipientRef) async {
return _basicService.list(organizationRef, recipientRef);
}
static Future<PaymentMethod> get(String recipientRef) async {
return _basicService.get(recipientRef);
}
static Future<List<PaymentMethod>> create(String organizationRef, PaymentMethod paymentMethod) async {
return _basicService.create(organizationRef, paymentMethod.toDTO().toJson());
}
static Future<List<PaymentMethod>> update(PaymentMethod paymentMethod) async {
return _basicService.update(paymentMethod.toDTO().toJson());
}
static Future<List<PaymentMethod>> delete(PaymentMethod paymentMethod) async {
return _basicService.delete(paymentMethod.storable.id);
}
}

View File

@@ -0,0 +1,37 @@
import 'package:pshared/api/responses/recipient.dart';
import 'package:pshared/data/mapper/recipient/recipient.dart';
import 'package:pshared/models/recipient/recipient.dart';
import 'package:pshared/service/services.dart';
import 'package:pshared/service/template.dart';
class RecipientService {
static const String _objectType = Services.recipients;
static final BasicService<Recipient> _basicService = BasicService<Recipient>(
objectType: _objectType,
fromJson: (json) => RecipientResponse.fromJson(json).recipients.map((dto) => dto.toDomain()).toList(),
);
static BasicService<Recipient> get basicService => _basicService;
static Future<List<Recipient>> list(String organizationRef, String _) async {
return _basicService.list(organizationRef, organizationRef);
}
static Future<Recipient> get(String recipientRef) async {
return _basicService.get(recipientRef);
}
static Future<List<Recipient>> create(String organizationRef, Recipient recipient) async {
return _basicService.create(organizationRef, recipient.toDTO().toJson());
}
static Future<List<Recipient>> update(Recipient recipient) async {
return _basicService.update(recipient.toDTO().toJson());
}
static Future<List<Recipient>> delete(Recipient recipient) async {
return _basicService.delete(recipient.storable.id);
}
}