payment method
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
part of '../payment_method.dart';
|
||||
|
||||
@freezed
|
||||
class ListPaymentMethod with _$ListPaymentMethod {
|
||||
const factory ListPaymentMethod({
|
||||
required List<PaymentMethod> paymentMethods,
|
||||
required int totalCount,
|
||||
required int page,
|
||||
required int limit,
|
||||
required int totalPages,
|
||||
}) = _ListPaymentMethod;
|
||||
|
||||
factory ListPaymentMethod.empty() => ListPaymentMethod(
|
||||
paymentMethods: [],
|
||||
totalCount: 0,
|
||||
page: 0,
|
||||
limit: 0,
|
||||
totalPages: 0,
|
||||
);
|
||||
}
|
||||
|
||||
@freezed
|
||||
class PaymentMethod with _$PaymentMethod {
|
||||
const factory PaymentMethod({
|
||||
required String id,
|
||||
required String organizationId,
|
||||
required String name,
|
||||
required String type,
|
||||
required bool isActive,
|
||||
required DateTime createdAt,
|
||||
required DateTime updatedAt,
|
||||
}) = _PaymentMethod;
|
||||
|
||||
factory PaymentMethod.empty() => PaymentMethod(
|
||||
id: '',
|
||||
organizationId: '',
|
||||
name: '',
|
||||
type: '',
|
||||
isActive: false,
|
||||
createdAt: DateTime(1970),
|
||||
updatedAt: DateTime(1970),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
part of '../payment_method.dart';
|
||||
|
||||
@freezed
|
||||
sealed class PaymentMethodFailure with _$PaymentMethodFailure {
|
||||
const factory PaymentMethodFailure.serverError(ApiFailure failure) =
|
||||
_ServerError;
|
||||
const factory PaymentMethodFailure.unexpectedError() = _UnexpectedError;
|
||||
const factory PaymentMethodFailure.empty() = _Empty;
|
||||
const factory PaymentMethodFailure.localStorageError(String erroMessage) =
|
||||
_LocalStorageError;
|
||||
const factory PaymentMethodFailure.dynamicErrorMessage(String erroMessage) =
|
||||
_DynamicErrorMessage;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
import '../../common/api/api_failure.dart';
|
||||
|
||||
part 'payment_method.freezed.dart';
|
||||
|
||||
part 'entities/payment_method_entity.dart';
|
||||
part 'failures/payment_method_failure.dart';
|
||||
part 'repositories/i_payment_method_repository.dart';
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,8 @@
|
||||
part of '../payment_method.dart';
|
||||
|
||||
abstract class IPaymentMethodRepository {
|
||||
Future<Either<PaymentMethodFailure, ListPaymentMethod>> getPaymentMethods({
|
||||
int page = 1,
|
||||
int limit = 30,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user