mcc groups, limits to expend, delete child device, card status, responsive states, added some overrides to AppDelegate, router modified, sca wallet fixes

This commit is contained in:
2026-02-26 14:59:51 +01:00
parent 0c93440f9b
commit 7849240ff2
81 changed files with 4320 additions and 2068 deletions

View File

@@ -11,3 +11,6 @@ export 'src/buttons/secondary_button.dart';
export 'src/buttons/custom_text_button.dart';
export 'src/dropdowns/dropdown.dart';
export 'src/dropdowns/country_prefix_picker.dart';
export 'src/containers/section_container.dart';
export 'src/containers/footer_container.dart';
export 'src/rows/editable_row.dart';

View File

@@ -0,0 +1,55 @@
import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
class FooterContainer extends StatelessWidget {
final String primaryText;
final VoidCallback? onPrimaryPressed;
final String cancelText;
final VoidCallback onCancelPressed;
final Color primaryColor;
final Color backgroundColor;
final double padding;
final double borderRadius;
const FooterContainer({
super.key,
required this.primaryText,
this.onPrimaryPressed,
required this.cancelText,
required this.onCancelPressed,
required this.primaryColor,
required this.backgroundColor,
this.padding = 24,
this.borderRadius = 24,
});
@override
Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(
color: backgroundColor,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(borderRadius),
topRight: Radius.circular(borderRadius),
),
),
padding: EdgeInsets.all(padding),
child: Column(
children: [
PrimaryButton(
onPressed: onPrimaryPressed,
text: primaryText,
color: primaryColor,
),
TextButton(
onPressed: onCancelPressed,
child: Text(
cancelText,
style: TextStyle(fontSize: 18),
),
),
],
),
);
}
}

View File

@@ -0,0 +1,48 @@
import 'package:flutter/material.dart';
class SectionContainer extends StatelessWidget {
final String? title;
final String? subtitle;
final double padding;
final double borderRadius;
final List<Widget> children;
final double spacing;
final Color backgroundColor;
const SectionContainer({
super.key,
this.title,
this.subtitle,
this.padding = 24,
this.borderRadius = 24,
this.children = const [],
this.spacing = 10,
required this.backgroundColor,
});
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.all(padding),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(borderRadius)),
color: backgroundColor,
),
child: Column(
spacing: spacing,
children: [
if (title != null)
Align(
alignment: Alignment.topLeft,
child: Text(
title!,
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
),
),
if (subtitle != null) Text(subtitle!),
...children,
],
),
);
}
}

View File

@@ -0,0 +1,49 @@
import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
class EditableRow extends StatelessWidget {
final String label;
final String displayValue;
final bool isEditing;
final VoidCallback onToggleEdit;
final String editButtonText;
final String hint;
final TextInputType keyboardType;
final ValueChanged<String>? onChanged;
const EditableRow({
super.key,
required this.label,
required this.displayValue,
this.isEditing = false,
required this.onToggleEdit,
required this.editButtonText,
this.hint = '',
this.keyboardType = TextInputType.text,
this.onChanged,
});
@override
Widget build(BuildContext context) {
return Column(
children: [
Row(
children: [
Text("$label: $displayValue"),
Spacer(),
TextButton(
onPressed: onToggleEdit,
child: Text(editButtonText),
),
],
),
if (isEditing)
CustomTextField(
hint: hint,
keyboardType: keyboardType,
onChanged: onChanged,
),
],
);
}
}

View File

@@ -7,6 +7,6 @@
<versions>
<version>2.6.4</version>
</versions>
<lastUpdated>20260225000000</lastUpdated>
<lastUpdated>20260226000000</lastUpdated>
</versioning>
</metadata>

View File

@@ -1 +1 @@
7f7d74256c9acd1f6cc92eeee34d86a8
7b90ce161fd31b7548cc91c8f2a13ac0

View File

@@ -1 +1 @@
6072df0b16aa4891cfd1a4c2c81cf5042c2972ee
9e11339b7af5cbe6896128c907e1bb1b596c981d

View File

@@ -4,7 +4,7 @@ import 'package:dio/dio.dart';
class TreezorTokenInterceptor extends Interceptor {
TreezorTokenInterceptor({required void Function() onTokenExpired})
: _onTokenExpired = onTokenExpired;
: _onTokenExpired = onTokenExpired;
final void Function() _onTokenExpired;
bool _handling = false;
@@ -12,7 +12,7 @@ class TreezorTokenInterceptor extends Interceptor {
@override
void onError(DioException err, ErrorInterceptorHandler handler) {
final message = _extractApiMessage(err.response?.data);
if (message == 'Treezor Token Expired' && !_handling) {
if (message != null && message.contains('Treezor Token Expired') && !_handling) {
_handling = true;
_onTokenExpired();
Future.delayed(const Duration(seconds: 2), () => _handling = false);

View File

@@ -364,12 +364,23 @@
"cardStatusSuccess": "Kartenstatus aktualisiert",
"cardStatusError": "Fehler beim Aktualisieren des Kartenstatus",
"deleteDevice": "Gerät löschen",
"deleteDeviceConfirmTitle": "Gerät löschen?",
"deleteDeviceConfirmMessage": "Diese Aktion kann nicht rückgängig gemacht werden. Bist du sicher, dass du dieses Gerät löschen möchtest?",
"deleteDeviceSuccess": "Gerät erfolgreich gelöscht",
"limitsSave": "Limits speichern",
"limitsSpendingTitle": "Ausgabenlimits setzen",
"limitsSpendingSubtitle": "Freiheit für sie, Gelassenheit für dich",
"limitsAllowedHours": "Erlaubte Zeiten",
"limitsAllowedHoursSubtitle": "Steuere, wann sie einkaufen können",
"limitsBlockedStores": "Gesperrte Geschäfte",
"limitsSaveSuccess": "Limits erfolgreich gespeichert",
"limitsSaveError": "Fehler beim Speichern der Limits",
"limitsDayLimit": "Täglich",
"limitsWeekLimit": "Wöchentlich",
"limitsMonthLimit": "Monatlich",
"limitsYearLimit": "Jährlich",
"goalsTitle": "Ziele",
"goalsOnlyFullPlan": "Nur mit dem Komplettplan",

View File

@@ -364,12 +364,23 @@
"cardStatusSuccess": "Card status updated",
"cardStatusError": "Error updating card status",
"deleteDevice": "Delete device",
"deleteDeviceConfirmTitle": "Delete device?",
"deleteDeviceConfirmMessage": "This action cannot be undone. Are you sure you want to delete this device?",
"deleteDeviceSuccess": "Device deleted successfully",
"limitsSave": "Save limits",
"limitsSpendingTitle": "Set spending limits",
"limitsSpendingSubtitle": "Freedom for them, peace of mind for you",
"limitsAllowedHours": "Allowed hours",
"limitsAllowedHoursSubtitle": "Control when they can buy",
"limitsBlockedStores": "Blocked merchants",
"limitsSaveSuccess": "Limits saved successfully",
"limitsSaveError": "Error saving limits",
"limitsDayLimit": "Daily",
"limitsWeekLimit": "Weekly",
"limitsMonthLimit": "Monthly",
"limitsYearLimit": "Yearly",
"goalsTitle": "Goals",
"goalsOnlyFullPlan": "Only with Full Plan",

View File

@@ -364,12 +364,23 @@
"cardStatusSuccess": "Estado de tarjeta actualizado",
"cardStatusError": "Error al actualizar el estado de la tarjeta",
"deleteDevice": "Eliminar dispositivo",
"deleteDeviceConfirmTitle": "¿Eliminar dispositivo?",
"deleteDeviceConfirmMessage": "Esta acción no se puede deshacer. ¿Estás seguro de que quieres eliminar este dispositivo?",
"deleteDeviceSuccess": "Dispositivo eliminado correctamente",
"limitsSave": "Guardar límites",
"limitsSpendingTitle": "Pon límite de gastos",
"limitsSpendingSubtitle": "Libertad para ellos, tranquilidad para ti",
"limitsAllowedHours": "Horarios permitidos",
"limitsAllowedHoursSubtitle": "Controla cuándo pueden comprar",
"limitsBlockedStores": "Comercios bloqueados",
"limitsSaveSuccess": "Límites guardados correctamente",
"limitsSaveError": "Error al guardar los límites",
"limitsDayLimit": "Diario",
"limitsWeekLimit": "Semanal",
"limitsMonthLimit": "Mensual",
"limitsYearLimit": "Anual",
"goalsTitle": "Metas",
"goalsOnlyFullPlan": "Sólo con Plan Completo",

View File

@@ -364,12 +364,23 @@
"cardStatusSuccess": "État de la carte mis à jour",
"cardStatusError": "Erreur lors de la mise à jour de la carte",
"deleteDevice": "Supprimer l'appareil",
"deleteDeviceConfirmTitle": "Supprimer l'appareil ?",
"deleteDeviceConfirmMessage": "Cette action est irréversible. Êtes-vous sûr de vouloir supprimer cet appareil ?",
"deleteDeviceSuccess": "Appareil supprimé avec succès",
"limitsSave": "Enregistrer les limites",
"limitsSpendingTitle": "Fixe des limites de dépenses",
"limitsSpendingSubtitle": "Liberté pour eux, tranquillité pour toi",
"limitsAllowedHours": "Horaires autorisés",
"limitsAllowedHoursSubtitle": "Contrôle quand ils peuvent acheter",
"limitsBlockedStores": "Commerces bloqués",
"limitsSaveSuccess": "Limites enregistrées avec succès",
"limitsSaveError": "Erreur lors de l'enregistrement des limites",
"limitsDayLimit": "Journalier",
"limitsWeekLimit": "Hebdomadaire",
"limitsMonthLimit": "Mensuel",
"limitsYearLimit": "Annuel",
"goalsTitle": "Objectifs",
"goalsOnlyFullPlan": "Uniquement avec le Plan Complet",

View File

@@ -364,12 +364,23 @@
"cardStatusSuccess": "Stato della carta aggiornato",
"cardStatusError": "Errore nell'aggiornamento dello stato della carta",
"deleteDevice": "Elimina dispositivo",
"deleteDeviceConfirmTitle": "Eliminare il dispositivo?",
"deleteDeviceConfirmMessage": "Questa azione non può essere annullata. Sei sicuro di voler eliminare questo dispositivo?",
"deleteDeviceSuccess": "Dispositivo eliminato con successo",
"limitsSave": "Salva limiti",
"limitsSpendingTitle": "Imposta limiti di spesa",
"limitsSpendingSubtitle": "Libertà per loro, tranquillità per te",
"limitsAllowedHours": "Orari consentiti",
"limitsAllowedHoursSubtitle": "Controlla quando possono acquistare",
"limitsBlockedStores": "Negozi bloccati",
"limitsSaveSuccess": "Limiti salvati con successo",
"limitsSaveError": "Errore nel salvataggio dei limiti",
"limitsDayLimit": "Giornaliero",
"limitsWeekLimit": "Settimanale",
"limitsMonthLimit": "Mensile",
"limitsYearLimit": "Annuale",
"goalsTitle": "Obiettivi",
"goalsOnlyFullPlan": "Solo con il Piano Completo",

View File

@@ -364,12 +364,23 @@
"cardStatusSuccess": "Estado do cartão atualizado",
"cardStatusError": "Erro ao atualizar o estado do cartão",
"deleteDevice": "Eliminar dispositivo",
"deleteDeviceConfirmTitle": "Eliminar dispositivo?",
"deleteDeviceConfirmMessage": "Esta ação não pode ser desfeita. Tens a certeza de que queres eliminar este dispositivo?",
"deleteDeviceSuccess": "Dispositivo eliminado com sucesso",
"limitsSave": "Guardar limites",
"limitsSpendingTitle": "Define limite de gastos",
"limitsSpendingSubtitle": "Liberdade para eles, tranquilidade para ti",
"limitsAllowedHours": "Horários permitidos",
"limitsAllowedHoursSubtitle": "Controla quando podem comprar",
"limitsBlockedStores": "Lojas bloqueadas",
"limitsSaveSuccess": "Limites guardados com sucesso",
"limitsSaveError": "Erro ao guardar os limites",
"limitsDayLimit": "Diário",
"limitsWeekLimit": "Semanal",
"limitsMonthLimit": "Mensal",
"limitsYearLimit": "Anual",
"goalsTitle": "Metas",
"goalsOnlyFullPlan": "Apenas com Plano Completo",

View File

@@ -408,6 +408,12 @@ class I18n {
static const String cardStatusSuccess = 'cardStatusSuccess';
static const String cardStatusError = 'cardStatusError';
// Device
static const String deleteDevice = 'deleteDevice';
static const String deleteDeviceConfirmTitle = 'deleteDeviceConfirmTitle';
static const String deleteDeviceConfirmMessage = 'deleteDeviceConfirmMessage';
static const String deleteDeviceSuccess = 'deleteDeviceSuccess';
// Limits
static const String limitsSave = 'limitsSave';
static const String limitsSpendingTitle = 'limitsSpendingTitle';
@@ -415,6 +421,12 @@ class I18n {
static const String limitsAllowedHours = 'limitsAllowedHours';
static const String limitsAllowedHoursSubtitle = 'limitsAllowedHoursSubtitle';
static const String limitsBlockedStores = 'limitsBlockedStores';
static const String limitsSaveSuccess = 'limitsSaveSuccess';
static const String limitsSaveError = 'limitsSaveError';
static const String limitsDayLimit = 'limitsDayLimit';
static const String limitsWeekLimit = 'limitsWeekLimit';
static const String limitsMonthLimit = 'limitsMonthLimit';
static const String limitsYearLimit = 'limitsYearLimit';
// Goals
static const String goalsTitle = 'goalsTitle';

View File

@@ -41,4 +41,7 @@ export 'src/providers/parent_wallet_balance_provider.dart';
export 'src/providers/child_profiles_provider.dart';
export 'src/providers/account_total_balance_provider.dart';
export 'src/domain/entities/date_filter.dart';
export 'src/domain/entities/mcc_group_entity.dart';
export 'src/domain/entities/wallet_card_entity.dart';
export 'src/domain/entities/wallet_limits_entity.dart';
export 'src/providers/wallet_transactions_provider.dart';

View File

@@ -1,9 +1,12 @@
import 'package:sf_shared/src/data/models/child_wallet_model.dart';
import 'package:sf_shared/src/data/models/mcc_group_model.dart';
import 'package:sf_shared/src/data/models/payment_profile_response_model.dart';
import 'package:sf_shared/src/data/models/payout_beneficiary_model.dart';
import 'package:sf_shared/src/data/models/sca_wallet_model.dart';
import 'package:sf_shared/src/data/models/transaction_beneficiary_model.dart';
import 'package:sf_shared/src/data/models/wallet_balance_model.dart';
import 'package:sf_shared/src/data/models/wallet_card_model.dart';
import 'package:sf_shared/src/data/models/wallet_limits_model.dart';
import 'package:sf_shared/src/data/models/wallet_transaction_model.dart';
abstract class TreezorRemoteDatasource {
@@ -24,7 +27,7 @@ abstract class TreezorRemoteDatasource {
Future<WalletBalanceModel> getWalletBalance({required String walletId});
Future<void> deleteScaWallet({required String scaWalletId});
Future<bool> deleteScaWallet({required String scaWalletId});
Future<TransactionBeneficiaryModel> createTransactionBeneficiary({
required String name,
@@ -68,7 +71,21 @@ abstract class TreezorRemoteDatasource {
required int month,
});
Future<({String cardId, String statusCode})> getCard({
Future<WalletCardModel> getCard({required String walletId});
Future<List<MccGroupModel>> getMccGroups();
Future<List<String>> getWalletMccLimits({required String walletId});
Future<void> setWalletMccLimits({
required String walletId,
required List<String> mccGroupIds,
});
Future<WalletLimitsModel> getWalletLimits({required String walletId});
Future<void> setWalletLimits({
required String walletId,
required WalletLimitsModel limits,
});
}

View File

@@ -1,13 +1,17 @@
import 'dart:convert';
import 'package:flutter/foundation.dart';
import 'package:dio/dio.dart';
import 'package:sf_infrastructure/sf_infrastructure.dart';
import 'package:sf_shared/src/data/models/child_wallet_model.dart';
import 'package:sf_shared/src/data/models/mcc_group_model.dart';
import 'package:sf_shared/src/data/models/payment_profile_response_model.dart';
import 'package:sf_shared/src/data/models/payout_beneficiary_model.dart';
import 'package:sf_shared/src/data/models/sca_wallet_model.dart';
import 'package:sf_shared/src/data/models/transaction_beneficiary_model.dart';
import 'package:sf_shared/src/data/models/wallet_balance_model.dart';
import 'package:sf_shared/src/data/models/wallet_card_model.dart';
import 'package:sf_shared/src/data/models/wallet_limits_model.dart';
import 'package:sf_shared/src/data/models/wallet_transaction_model.dart';
import 'treezor_remote_data_source.dart';
@@ -166,14 +170,12 @@ class TreezorRemoteDatasourceImpl implements TreezorRemoteDatasource {
}
@override
Future<void> deleteScaWallet({required String scaWalletId}) async {
Future<bool> deleteScaWallet({required String scaWalletId}) async {
try {
await _repository.delete<void>('/treezor/sca-wallets/$scaWalletId');
} on DioException catch (error) {
throw _mapDioError(
error,
defaultMessage: 'Error deleting SCA wallet $scaWalletId',
);
return true;
} on DioException catch (_) {
return false;
}
}
@@ -398,26 +400,125 @@ class TreezorRemoteDatasourceImpl implements TreezorRemoteDatasource {
}
@override
Future<({String cardId, String statusCode})> getCard({
required String walletId,
}) async {
Future<WalletCardModel> getCard({required String walletId}) async {
try {
final response = await _repository.get<Map<String, dynamic>>(
'/wallets/$walletId/card',
);
final data = response.data;
if (data == null || data['item'] == null) {
if (data == null) {
throw Exception('Empty response from /wallets/$walletId/card');
}
final item = data['item'] as Map<String, dynamic>;
return (
cardId: item['cardId'] as String,
statusCode: item['statusCode'] as String,
final item = data['item'] as Map<String, dynamic>? ?? data;
return WalletCardModel.fromJson(item);
} on DioException catch (error) {
throw _mapDioError(
error,
defaultMessage: 'Error fetching card for wallet $walletId',
);
}
}
@override
Future<List<MccGroupModel>> getMccGroups() async {
try {
final response = await _repository.get<Map<String, dynamic>>(
'/mcc-groups',
);
final data = response.data;
if (data == null) return [];
final items = data['items'];
if (items is List) {
return items
.cast<Map<String, dynamic>>()
.map(MccGroupModel.fromJson)
.toList();
}
return [];
} on DioException catch (error) {
throw _mapDioError(error, defaultMessage: 'Error fetching MCC groups');
}
}
@override
Future<List<String>> getWalletMccLimits({required String walletId}) async {
try {
final response = await _repository.get<Map<String, dynamic>>(
'/wallets/$walletId/mcc/limits',
);
final data = response.data;
if (data == null) return [];
final item = data['item'] as Map<String, dynamic>? ?? data;
final ids = item['mccGroupIds'];
if (ids is List) return ids.cast<String>();
return [];
} on DioException catch (error) {
throw _mapDioError(
error,
defaultMessage: 'Error fetching MCC limits for wallet $walletId',
);
}
}
@override
Future<void> setWalletMccLimits({
required String walletId,
required List<String> mccGroupIds,
}) async {
try {
await _repository.post<void>(
'/wallets/$walletId/mcc/limits',
body: <String, dynamic>{'mccGroupIds': mccGroupIds},
);
} on DioException catch (error) {
throw _mapDioError(
error,
defaultMessage: 'Error in /wallets/$walletId/card',
defaultMessage: 'Error setting MCC limits for wallet $walletId',
);
}
}
@override
Future<WalletLimitsModel> getWalletLimits({required String walletId}) async {
try {
final response = await _repository.get<Map<String, dynamic>>(
'/wallets/$walletId/limits',
);
final data = response.data;
if (data == null || data.isEmpty) {
return const WalletLimitsModel();
}
final item = data['item'] as Map<String, dynamic>? ?? data;
return WalletLimitsModel.fromJson(item);
} on DioException catch (error) {
throw _mapDioError(
error,
defaultMessage: 'Error fetching limits for wallet $walletId',
);
}
}
@override
Future<void> setWalletLimits({
required String walletId,
required WalletLimitsModel limits,
}) async {
try {
final body = limits.toJson()..removeWhere((_, v) => v == null);
debugPrint('setWalletLimits body: $body');
await _repository.post<void>('/wallets/$walletId/limits', body: body);
} on DioException catch (error) {
throw _mapDioError(
error,
defaultMessage: 'Error setting limits for wallet $walletId',
);
}
}

View File

@@ -6,4 +6,5 @@ abstract class UserRemoteDatasource {
Future<UserModel> getUserInfo();
Future<ChildProfileResponseModel> getChildProfiles();
Future<DeviceModel> getDeviceByIdentificator({required String identificator});
Future<String> deleteDevice({required String deviceId});
}

View File

@@ -72,4 +72,24 @@ class UserRemoteDatasourceImpl implements UserRemoteDatasource {
throw Exception('Error parsing device response: $e');
}
}
@override
Future<String> deleteDevice({required String deviceId}) async {
try {
final response = await _repository.delete<Map<String, dynamic>>(
'/devices/$deviceId',
);
final data = response.data;
if (data == null) {
throw Exception('Empty response from DELETE /devices/$deviceId');
}
return data['id'] as String? ?? deviceId;
} on DioException catch (error) {
final apiMsg = error.response?.data;
final msg = apiMsg is String
? apiMsg
: (error.message ?? 'Error deleting device $deviceId');
throw Exception(msg);
}
}
}

View File

@@ -0,0 +1,29 @@
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:sf_shared/src/domain/entities/mcc_group_entity.dart';
part 'mcc_group_model.freezed.dart';
part 'mcc_group_model.g.dart';
@freezed
abstract class MccGroupModel with _$MccGroupModel {
const factory MccGroupModel({
required String id,
required String name,
@Default([]) List<String> mccs,
int? createdAt,
int? updatedAt,
}) = _MccGroupModel;
factory MccGroupModel.fromJson(Map<String, dynamic> json) =>
_$MccGroupModelFromJson(json);
}
extension MccGroupModelMapper on MccGroupModel {
MccGroupEntity toEntity() {
return MccGroupEntity(
id: id,
name: name,
mccs: mccs,
);
}
}

View File

@@ -0,0 +1,295 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'mcc_group_model.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$MccGroupModel {
String get id; String get name; List<String> get mccs; int? get createdAt; int? get updatedAt;
/// Create a copy of MccGroupModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$MccGroupModelCopyWith<MccGroupModel> get copyWith => _$MccGroupModelCopyWithImpl<MccGroupModel>(this as MccGroupModel, _$identity);
/// Serializes this MccGroupModel to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is MccGroupModel&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&const DeepCollectionEquality().equals(other.mccs, mccs)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,id,name,const DeepCollectionEquality().hash(mccs),createdAt,updatedAt);
@override
String toString() {
return 'MccGroupModel(id: $id, name: $name, mccs: $mccs, createdAt: $createdAt, updatedAt: $updatedAt)';
}
}
/// @nodoc
abstract mixin class $MccGroupModelCopyWith<$Res> {
factory $MccGroupModelCopyWith(MccGroupModel value, $Res Function(MccGroupModel) _then) = _$MccGroupModelCopyWithImpl;
@useResult
$Res call({
String id, String name, List<String> mccs, int? createdAt, int? updatedAt
});
}
/// @nodoc
class _$MccGroupModelCopyWithImpl<$Res>
implements $MccGroupModelCopyWith<$Res> {
_$MccGroupModelCopyWithImpl(this._self, this._then);
final MccGroupModel _self;
final $Res Function(MccGroupModel) _then;
/// Create a copy of MccGroupModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? name = null,Object? mccs = null,Object? createdAt = freezed,Object? updatedAt = freezed,}) {
return _then(_self.copyWith(
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
as String,mccs: null == mccs ? _self.mccs : mccs // ignore: cast_nullable_to_non_nullable
as List<String>,createdAt: freezed == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
as int?,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
as int?,
));
}
}
/// Adds pattern-matching-related methods to [MccGroupModel].
extension MccGroupModelPatterns on MccGroupModel {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _MccGroupModel value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _MccGroupModel() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _MccGroupModel value) $default,){
final _that = this;
switch (_that) {
case _MccGroupModel():
return $default(_that);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _MccGroupModel value)? $default,){
final _that = this;
switch (_that) {
case _MccGroupModel() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String name, List<String> mccs, int? createdAt, int? updatedAt)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _MccGroupModel() when $default != null:
return $default(_that.id,_that.name,_that.mccs,_that.createdAt,_that.updatedAt);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, String name, List<String> mccs, int? createdAt, int? updatedAt) $default,) {final _that = this;
switch (_that) {
case _MccGroupModel():
return $default(_that.id,_that.name,_that.mccs,_that.createdAt,_that.updatedAt);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String name, List<String> mccs, int? createdAt, int? updatedAt)? $default,) {final _that = this;
switch (_that) {
case _MccGroupModel() when $default != null:
return $default(_that.id,_that.name,_that.mccs,_that.createdAt,_that.updatedAt);case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _MccGroupModel implements MccGroupModel {
const _MccGroupModel({required this.id, required this.name, final List<String> mccs = const [], this.createdAt, this.updatedAt}): _mccs = mccs;
factory _MccGroupModel.fromJson(Map<String, dynamic> json) => _$MccGroupModelFromJson(json);
@override final String id;
@override final String name;
final List<String> _mccs;
@override@JsonKey() List<String> get mccs {
if (_mccs is EqualUnmodifiableListView) return _mccs;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_mccs);
}
@override final int? createdAt;
@override final int? updatedAt;
/// Create a copy of MccGroupModel
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$MccGroupModelCopyWith<_MccGroupModel> get copyWith => __$MccGroupModelCopyWithImpl<_MccGroupModel>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$MccGroupModelToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _MccGroupModel&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&const DeepCollectionEquality().equals(other._mccs, _mccs)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,id,name,const DeepCollectionEquality().hash(_mccs),createdAt,updatedAt);
@override
String toString() {
return 'MccGroupModel(id: $id, name: $name, mccs: $mccs, createdAt: $createdAt, updatedAt: $updatedAt)';
}
}
/// @nodoc
abstract mixin class _$MccGroupModelCopyWith<$Res> implements $MccGroupModelCopyWith<$Res> {
factory _$MccGroupModelCopyWith(_MccGroupModel value, $Res Function(_MccGroupModel) _then) = __$MccGroupModelCopyWithImpl;
@override @useResult
$Res call({
String id, String name, List<String> mccs, int? createdAt, int? updatedAt
});
}
/// @nodoc
class __$MccGroupModelCopyWithImpl<$Res>
implements _$MccGroupModelCopyWith<$Res> {
__$MccGroupModelCopyWithImpl(this._self, this._then);
final _MccGroupModel _self;
final $Res Function(_MccGroupModel) _then;
/// Create a copy of MccGroupModel
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? name = null,Object? mccs = null,Object? createdAt = freezed,Object? updatedAt = freezed,}) {
return _then(_MccGroupModel(
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
as String,mccs: null == mccs ? _self._mccs : mccs // ignore: cast_nullable_to_non_nullable
as List<String>,createdAt: freezed == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
as int?,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
as int?,
));
}
}
// dart format on

View File

@@ -0,0 +1,27 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'mcc_group_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_MccGroupModel _$MccGroupModelFromJson(Map<String, dynamic> json) =>
_MccGroupModel(
id: json['id'] as String,
name: json['name'] as String,
mccs:
(json['mccs'] as List<dynamic>?)?.map((e) => e as String).toList() ??
const [],
createdAt: (json['createdAt'] as num?)?.toInt(),
updatedAt: (json['updatedAt'] as num?)?.toInt(),
);
Map<String, dynamic> _$MccGroupModelToJson(_MccGroupModel instance) =>
<String, dynamic>{
'id': instance.id,
'name': instance.name,
'mccs': instance.mccs,
'createdAt': instance.createdAt,
'updatedAt': instance.updatedAt,
};

View File

@@ -0,0 +1,29 @@
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:sf_shared/src/domain/entities/wallet_card_entity.dart';
part 'wallet_card_model.freezed.dart';
part 'wallet_card_model.g.dart';
@freezed
abstract class WalletCardModel with _$WalletCardModel {
const factory WalletCardModel({
required int cardId,
required int walletId,
required int userId,
required String status,
}) = _WalletCardModel;
factory WalletCardModel.fromJson(Map<String, dynamic> json) =>
_$WalletCardModelFromJson(json);
}
extension WalletCardModelMapper on WalletCardModel {
WalletCardEntity toEntity() {
return WalletCardEntity(
cardId: cardId,
walletId: walletId,
userId: userId,
status: status,
);
}
}

View File

@@ -0,0 +1,286 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'wallet_card_model.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$WalletCardModel {
int get cardId; int get walletId; int get userId; String get status;
/// Create a copy of WalletCardModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$WalletCardModelCopyWith<WalletCardModel> get copyWith => _$WalletCardModelCopyWithImpl<WalletCardModel>(this as WalletCardModel, _$identity);
/// Serializes this WalletCardModel to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is WalletCardModel&&(identical(other.cardId, cardId) || other.cardId == cardId)&&(identical(other.walletId, walletId) || other.walletId == walletId)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.status, status) || other.status == status));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,cardId,walletId,userId,status);
@override
String toString() {
return 'WalletCardModel(cardId: $cardId, walletId: $walletId, userId: $userId, status: $status)';
}
}
/// @nodoc
abstract mixin class $WalletCardModelCopyWith<$Res> {
factory $WalletCardModelCopyWith(WalletCardModel value, $Res Function(WalletCardModel) _then) = _$WalletCardModelCopyWithImpl;
@useResult
$Res call({
int cardId, int walletId, int userId, String status
});
}
/// @nodoc
class _$WalletCardModelCopyWithImpl<$Res>
implements $WalletCardModelCopyWith<$Res> {
_$WalletCardModelCopyWithImpl(this._self, this._then);
final WalletCardModel _self;
final $Res Function(WalletCardModel) _then;
/// Create a copy of WalletCardModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? cardId = null,Object? walletId = null,Object? userId = null,Object? status = null,}) {
return _then(_self.copyWith(
cardId: null == cardId ? _self.cardId : cardId // ignore: cast_nullable_to_non_nullable
as int,walletId: null == walletId ? _self.walletId : walletId // ignore: cast_nullable_to_non_nullable
as int,userId: null == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable
as int,status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// Adds pattern-matching-related methods to [WalletCardModel].
extension WalletCardModelPatterns on WalletCardModel {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _WalletCardModel value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _WalletCardModel() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _WalletCardModel value) $default,){
final _that = this;
switch (_that) {
case _WalletCardModel():
return $default(_that);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _WalletCardModel value)? $default,){
final _that = this;
switch (_that) {
case _WalletCardModel() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( int cardId, int walletId, int userId, String status)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _WalletCardModel() when $default != null:
return $default(_that.cardId,_that.walletId,_that.userId,_that.status);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( int cardId, int walletId, int userId, String status) $default,) {final _that = this;
switch (_that) {
case _WalletCardModel():
return $default(_that.cardId,_that.walletId,_that.userId,_that.status);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( int cardId, int walletId, int userId, String status)? $default,) {final _that = this;
switch (_that) {
case _WalletCardModel() when $default != null:
return $default(_that.cardId,_that.walletId,_that.userId,_that.status);case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _WalletCardModel implements WalletCardModel {
const _WalletCardModel({required this.cardId, required this.walletId, required this.userId, required this.status});
factory _WalletCardModel.fromJson(Map<String, dynamic> json) => _$WalletCardModelFromJson(json);
@override final int cardId;
@override final int walletId;
@override final int userId;
@override final String status;
/// Create a copy of WalletCardModel
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$WalletCardModelCopyWith<_WalletCardModel> get copyWith => __$WalletCardModelCopyWithImpl<_WalletCardModel>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$WalletCardModelToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _WalletCardModel&&(identical(other.cardId, cardId) || other.cardId == cardId)&&(identical(other.walletId, walletId) || other.walletId == walletId)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.status, status) || other.status == status));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,cardId,walletId,userId,status);
@override
String toString() {
return 'WalletCardModel(cardId: $cardId, walletId: $walletId, userId: $userId, status: $status)';
}
}
/// @nodoc
abstract mixin class _$WalletCardModelCopyWith<$Res> implements $WalletCardModelCopyWith<$Res> {
factory _$WalletCardModelCopyWith(_WalletCardModel value, $Res Function(_WalletCardModel) _then) = __$WalletCardModelCopyWithImpl;
@override @useResult
$Res call({
int cardId, int walletId, int userId, String status
});
}
/// @nodoc
class __$WalletCardModelCopyWithImpl<$Res>
implements _$WalletCardModelCopyWith<$Res> {
__$WalletCardModelCopyWithImpl(this._self, this._then);
final _WalletCardModel _self;
final $Res Function(_WalletCardModel) _then;
/// Create a copy of WalletCardModel
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? cardId = null,Object? walletId = null,Object? userId = null,Object? status = null,}) {
return _then(_WalletCardModel(
cardId: null == cardId ? _self.cardId : cardId // ignore: cast_nullable_to_non_nullable
as int,walletId: null == walletId ? _self.walletId : walletId // ignore: cast_nullable_to_non_nullable
as int,userId: null == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable
as int,status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
// dart format on

View File

@@ -0,0 +1,23 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'wallet_card_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_WalletCardModel _$WalletCardModelFromJson(Map<String, dynamic> json) =>
_WalletCardModel(
cardId: (json['cardId'] as num).toInt(),
walletId: (json['walletId'] as num).toInt(),
userId: (json['userId'] as num).toInt(),
status: json['status'] as String,
);
Map<String, dynamic> _$WalletCardModelToJson(_WalletCardModel instance) =>
<String, dynamic>{
'cardId': instance.cardId,
'walletId': instance.walletId,
'userId': instance.userId,
'status': instance.status,
};

View File

@@ -0,0 +1,29 @@
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:sf_shared/src/domain/entities/wallet_limits_entity.dart';
part 'wallet_limits_model.freezed.dart';
part 'wallet_limits_model.g.dart';
@freezed
abstract class WalletLimitsModel with _$WalletLimitsModel {
const factory WalletLimitsModel({
double? dayLimit,
double? weekLimit,
double? monthLimit,
double? yearLimit,
}) = _WalletLimitsModel;
factory WalletLimitsModel.fromJson(Map<String, dynamic> json) =>
_$WalletLimitsModelFromJson(json);
}
extension WalletLimitsModelMapper on WalletLimitsModel {
WalletLimitsEntity toEntity() {
return WalletLimitsEntity(
dayLimit: dayLimit,
weekLimit: weekLimit,
monthLimit: monthLimit,
yearLimit: yearLimit,
);
}
}

View File

@@ -0,0 +1,286 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'wallet_limits_model.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$WalletLimitsModel {
double? get dayLimit; double? get weekLimit; double? get monthLimit; double? get yearLimit;
/// Create a copy of WalletLimitsModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$WalletLimitsModelCopyWith<WalletLimitsModel> get copyWith => _$WalletLimitsModelCopyWithImpl<WalletLimitsModel>(this as WalletLimitsModel, _$identity);
/// Serializes this WalletLimitsModel to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is WalletLimitsModel&&(identical(other.dayLimit, dayLimit) || other.dayLimit == dayLimit)&&(identical(other.weekLimit, weekLimit) || other.weekLimit == weekLimit)&&(identical(other.monthLimit, monthLimit) || other.monthLimit == monthLimit)&&(identical(other.yearLimit, yearLimit) || other.yearLimit == yearLimit));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,dayLimit,weekLimit,monthLimit,yearLimit);
@override
String toString() {
return 'WalletLimitsModel(dayLimit: $dayLimit, weekLimit: $weekLimit, monthLimit: $monthLimit, yearLimit: $yearLimit)';
}
}
/// @nodoc
abstract mixin class $WalletLimitsModelCopyWith<$Res> {
factory $WalletLimitsModelCopyWith(WalletLimitsModel value, $Res Function(WalletLimitsModel) _then) = _$WalletLimitsModelCopyWithImpl;
@useResult
$Res call({
double? dayLimit, double? weekLimit, double? monthLimit, double? yearLimit
});
}
/// @nodoc
class _$WalletLimitsModelCopyWithImpl<$Res>
implements $WalletLimitsModelCopyWith<$Res> {
_$WalletLimitsModelCopyWithImpl(this._self, this._then);
final WalletLimitsModel _self;
final $Res Function(WalletLimitsModel) _then;
/// Create a copy of WalletLimitsModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? dayLimit = freezed,Object? weekLimit = freezed,Object? monthLimit = freezed,Object? yearLimit = freezed,}) {
return _then(_self.copyWith(
dayLimit: freezed == dayLimit ? _self.dayLimit : dayLimit // ignore: cast_nullable_to_non_nullable
as double?,weekLimit: freezed == weekLimit ? _self.weekLimit : weekLimit // ignore: cast_nullable_to_non_nullable
as double?,monthLimit: freezed == monthLimit ? _self.monthLimit : monthLimit // ignore: cast_nullable_to_non_nullable
as double?,yearLimit: freezed == yearLimit ? _self.yearLimit : yearLimit // ignore: cast_nullable_to_non_nullable
as double?,
));
}
}
/// Adds pattern-matching-related methods to [WalletLimitsModel].
extension WalletLimitsModelPatterns on WalletLimitsModel {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _WalletLimitsModel value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _WalletLimitsModel() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _WalletLimitsModel value) $default,){
final _that = this;
switch (_that) {
case _WalletLimitsModel():
return $default(_that);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _WalletLimitsModel value)? $default,){
final _that = this;
switch (_that) {
case _WalletLimitsModel() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( double? dayLimit, double? weekLimit, double? monthLimit, double? yearLimit)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _WalletLimitsModel() when $default != null:
return $default(_that.dayLimit,_that.weekLimit,_that.monthLimit,_that.yearLimit);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( double? dayLimit, double? weekLimit, double? monthLimit, double? yearLimit) $default,) {final _that = this;
switch (_that) {
case _WalletLimitsModel():
return $default(_that.dayLimit,_that.weekLimit,_that.monthLimit,_that.yearLimit);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( double? dayLimit, double? weekLimit, double? monthLimit, double? yearLimit)? $default,) {final _that = this;
switch (_that) {
case _WalletLimitsModel() when $default != null:
return $default(_that.dayLimit,_that.weekLimit,_that.monthLimit,_that.yearLimit);case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _WalletLimitsModel implements WalletLimitsModel {
const _WalletLimitsModel({this.dayLimit, this.weekLimit, this.monthLimit, this.yearLimit});
factory _WalletLimitsModel.fromJson(Map<String, dynamic> json) => _$WalletLimitsModelFromJson(json);
@override final double? dayLimit;
@override final double? weekLimit;
@override final double? monthLimit;
@override final double? yearLimit;
/// Create a copy of WalletLimitsModel
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$WalletLimitsModelCopyWith<_WalletLimitsModel> get copyWith => __$WalletLimitsModelCopyWithImpl<_WalletLimitsModel>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$WalletLimitsModelToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _WalletLimitsModel&&(identical(other.dayLimit, dayLimit) || other.dayLimit == dayLimit)&&(identical(other.weekLimit, weekLimit) || other.weekLimit == weekLimit)&&(identical(other.monthLimit, monthLimit) || other.monthLimit == monthLimit)&&(identical(other.yearLimit, yearLimit) || other.yearLimit == yearLimit));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,dayLimit,weekLimit,monthLimit,yearLimit);
@override
String toString() {
return 'WalletLimitsModel(dayLimit: $dayLimit, weekLimit: $weekLimit, monthLimit: $monthLimit, yearLimit: $yearLimit)';
}
}
/// @nodoc
abstract mixin class _$WalletLimitsModelCopyWith<$Res> implements $WalletLimitsModelCopyWith<$Res> {
factory _$WalletLimitsModelCopyWith(_WalletLimitsModel value, $Res Function(_WalletLimitsModel) _then) = __$WalletLimitsModelCopyWithImpl;
@override @useResult
$Res call({
double? dayLimit, double? weekLimit, double? monthLimit, double? yearLimit
});
}
/// @nodoc
class __$WalletLimitsModelCopyWithImpl<$Res>
implements _$WalletLimitsModelCopyWith<$Res> {
__$WalletLimitsModelCopyWithImpl(this._self, this._then);
final _WalletLimitsModel _self;
final $Res Function(_WalletLimitsModel) _then;
/// Create a copy of WalletLimitsModel
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? dayLimit = freezed,Object? weekLimit = freezed,Object? monthLimit = freezed,Object? yearLimit = freezed,}) {
return _then(_WalletLimitsModel(
dayLimit: freezed == dayLimit ? _self.dayLimit : dayLimit // ignore: cast_nullable_to_non_nullable
as double?,weekLimit: freezed == weekLimit ? _self.weekLimit : weekLimit // ignore: cast_nullable_to_non_nullable
as double?,monthLimit: freezed == monthLimit ? _self.monthLimit : monthLimit // ignore: cast_nullable_to_non_nullable
as double?,yearLimit: freezed == yearLimit ? _self.yearLimit : yearLimit // ignore: cast_nullable_to_non_nullable
as double?,
));
}
}
// dart format on

View File

@@ -0,0 +1,23 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'wallet_limits_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_WalletLimitsModel _$WalletLimitsModelFromJson(Map<String, dynamic> json) =>
_WalletLimitsModel(
dayLimit: (json['dayLimit'] as num?)?.toDouble(),
weekLimit: (json['weekLimit'] as num?)?.toDouble(),
monthLimit: (json['monthLimit'] as num?)?.toDouble(),
yearLimit: (json['yearLimit'] as num?)?.toDouble(),
);
Map<String, dynamic> _$WalletLimitsModelToJson(_WalletLimitsModel instance) =>
<String, dynamic>{
'dayLimit': instance.dayLimit,
'weekLimit': instance.weekLimit,
'monthLimit': instance.monthLimit,
'yearLimit': instance.yearLimit,
};

View File

@@ -1,9 +1,15 @@
import 'package:sf_shared/src/data/models/child_wallet_model.dart';
import 'package:sf_shared/src/data/models/mcc_group_model.dart';
import 'package:sf_shared/src/data/models/payment_profile_response_model.dart';
import 'package:sf_shared/src/data/models/payout_beneficiary_model.dart';
import 'package:sf_shared/src/data/models/sca_wallet_model.dart';
import 'package:sf_shared/src/data/models/wallet_balance_model.dart';
import 'package:sf_shared/src/data/models/wallet_card_model.dart';
import 'package:sf_shared/src/data/models/wallet_limits_model.dart';
import 'package:sf_shared/src/data/models/wallet_transaction_model.dart';
import 'package:sf_shared/src/domain/entities/mcc_group_entity.dart';
import 'package:sf_shared/src/domain/entities/wallet_card_entity.dart';
import 'package:sf_shared/src/domain/entities/wallet_limits_entity.dart';
import 'package:sf_shared/src/domain/entities/payment_profile_entity.dart';
import 'package:sf_shared/src/domain/entities/child_wallet_entity.dart';
import 'package:sf_shared/src/domain/entities/payout_beneficiary_entity.dart';
@@ -108,9 +114,10 @@ class TreezorRepositoryImpl implements TreezorRepository {
}
@override
Future<void> deleteScaWallet({required String scaWalletId}) async {
await _remote.deleteScaWallet(scaWalletId: scaWalletId);
await _local.clearScaWallets();
Future<bool> deleteScaWallet({required String scaWalletId}) async {
final deleted = await _remote.deleteScaWallet(scaWalletId: scaWalletId);
if (deleted) await _local.clearScaWallets();
return deleted;
}
@override
@@ -218,9 +225,54 @@ class TreezorRepositoryImpl implements TreezorRepository {
}
@override
Future<({String cardId, String statusCode})> getCard({
Future<WalletCardEntity> getCard({required String walletId}) async {
final model = await _remote.getCard(walletId: walletId);
return model.toEntity();
}
@override
Future<List<MccGroupEntity>> getMccGroups() async {
final models = await _remote.getMccGroups();
return models.map((m) => m.toEntity()).toList();
}
@override
Future<List<String>> getWalletMccLimits({required String walletId}) {
return _remote.getWalletMccLimits(walletId: walletId);
}
@override
Future<void> setWalletMccLimits({
required String walletId,
}) {
return _remote.getCard(walletId: walletId);
required List<String> mccGroupIds,
}) async {
await _remote.setWalletMccLimits(
walletId: walletId,
mccGroupIds: mccGroupIds,
);
}
@override
Future<WalletLimitsEntity> getWalletLimits({
required String walletId,
}) async {
final model = await _remote.getWalletLimits(walletId: walletId);
return model.toEntity();
}
@override
Future<void> setWalletLimits({
required String walletId,
required WalletLimitsEntity limits,
}) async {
await _remote.setWalletLimits(
walletId: walletId,
limits: WalletLimitsModel(
dayLimit: limits.dayLimit,
weekLimit: limits.weekLimit,
monthLimit: limits.monthLimit,
yearLimit: limits.yearLimit,
),
);
}
}

View File

@@ -34,4 +34,9 @@ class UserRepositoryImpl implements UserRepository {
);
return model.toEntity();
}
@override
Future<String> deleteDevice({required String deviceId}) {
return _remote.deleteDevice(deviceId: deviceId);
}
}

View File

@@ -0,0 +1,12 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'mcc_group_entity.freezed.dart';
@freezed
abstract class MccGroupEntity with _$MccGroupEntity {
const factory MccGroupEntity({
required String id,
required String name,
@Default([]) List<String> mccs,
}) = _MccGroupEntity;
}

View File

@@ -0,0 +1,283 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'mcc_group_entity.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$MccGroupEntity {
String get id; String get name; List<String> get mccs;
/// Create a copy of MccGroupEntity
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$MccGroupEntityCopyWith<MccGroupEntity> get copyWith => _$MccGroupEntityCopyWithImpl<MccGroupEntity>(this as MccGroupEntity, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is MccGroupEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&const DeepCollectionEquality().equals(other.mccs, mccs));
}
@override
int get hashCode => Object.hash(runtimeType,id,name,const DeepCollectionEquality().hash(mccs));
@override
String toString() {
return 'MccGroupEntity(id: $id, name: $name, mccs: $mccs)';
}
}
/// @nodoc
abstract mixin class $MccGroupEntityCopyWith<$Res> {
factory $MccGroupEntityCopyWith(MccGroupEntity value, $Res Function(MccGroupEntity) _then) = _$MccGroupEntityCopyWithImpl;
@useResult
$Res call({
String id, String name, List<String> mccs
});
}
/// @nodoc
class _$MccGroupEntityCopyWithImpl<$Res>
implements $MccGroupEntityCopyWith<$Res> {
_$MccGroupEntityCopyWithImpl(this._self, this._then);
final MccGroupEntity _self;
final $Res Function(MccGroupEntity) _then;
/// Create a copy of MccGroupEntity
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? name = null,Object? mccs = null,}) {
return _then(_self.copyWith(
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
as String,mccs: null == mccs ? _self.mccs : mccs // ignore: cast_nullable_to_non_nullable
as List<String>,
));
}
}
/// Adds pattern-matching-related methods to [MccGroupEntity].
extension MccGroupEntityPatterns on MccGroupEntity {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _MccGroupEntity value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _MccGroupEntity() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _MccGroupEntity value) $default,){
final _that = this;
switch (_that) {
case _MccGroupEntity():
return $default(_that);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _MccGroupEntity value)? $default,){
final _that = this;
switch (_that) {
case _MccGroupEntity() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String name, List<String> mccs)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _MccGroupEntity() when $default != null:
return $default(_that.id,_that.name,_that.mccs);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, String name, List<String> mccs) $default,) {final _that = this;
switch (_that) {
case _MccGroupEntity():
return $default(_that.id,_that.name,_that.mccs);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String name, List<String> mccs)? $default,) {final _that = this;
switch (_that) {
case _MccGroupEntity() when $default != null:
return $default(_that.id,_that.name,_that.mccs);case _:
return null;
}
}
}
/// @nodoc
class _MccGroupEntity implements MccGroupEntity {
const _MccGroupEntity({required this.id, required this.name, final List<String> mccs = const []}): _mccs = mccs;
@override final String id;
@override final String name;
final List<String> _mccs;
@override@JsonKey() List<String> get mccs {
if (_mccs is EqualUnmodifiableListView) return _mccs;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_mccs);
}
/// Create a copy of MccGroupEntity
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$MccGroupEntityCopyWith<_MccGroupEntity> get copyWith => __$MccGroupEntityCopyWithImpl<_MccGroupEntity>(this, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _MccGroupEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&const DeepCollectionEquality().equals(other._mccs, _mccs));
}
@override
int get hashCode => Object.hash(runtimeType,id,name,const DeepCollectionEquality().hash(_mccs));
@override
String toString() {
return 'MccGroupEntity(id: $id, name: $name, mccs: $mccs)';
}
}
/// @nodoc
abstract mixin class _$MccGroupEntityCopyWith<$Res> implements $MccGroupEntityCopyWith<$Res> {
factory _$MccGroupEntityCopyWith(_MccGroupEntity value, $Res Function(_MccGroupEntity) _then) = __$MccGroupEntityCopyWithImpl;
@override @useResult
$Res call({
String id, String name, List<String> mccs
});
}
/// @nodoc
class __$MccGroupEntityCopyWithImpl<$Res>
implements _$MccGroupEntityCopyWith<$Res> {
__$MccGroupEntityCopyWithImpl(this._self, this._then);
final _MccGroupEntity _self;
final $Res Function(_MccGroupEntity) _then;
/// Create a copy of MccGroupEntity
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? name = null,Object? mccs = null,}) {
return _then(_MccGroupEntity(
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
as String,mccs: null == mccs ? _self._mccs : mccs // ignore: cast_nullable_to_non_nullable
as List<String>,
));
}
}
// dart format on

View File

@@ -0,0 +1,13 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'wallet_card_entity.freezed.dart';
@freezed
abstract class WalletCardEntity with _$WalletCardEntity {
const factory WalletCardEntity({
required int cardId,
required int walletId,
required int userId,
required String status,
}) = _WalletCardEntity;
}

View File

@@ -0,0 +1,280 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'wallet_card_entity.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$WalletCardEntity {
int get cardId; int get walletId; int get userId; String get status;
/// Create a copy of WalletCardEntity
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$WalletCardEntityCopyWith<WalletCardEntity> get copyWith => _$WalletCardEntityCopyWithImpl<WalletCardEntity>(this as WalletCardEntity, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is WalletCardEntity&&(identical(other.cardId, cardId) || other.cardId == cardId)&&(identical(other.walletId, walletId) || other.walletId == walletId)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.status, status) || other.status == status));
}
@override
int get hashCode => Object.hash(runtimeType,cardId,walletId,userId,status);
@override
String toString() {
return 'WalletCardEntity(cardId: $cardId, walletId: $walletId, userId: $userId, status: $status)';
}
}
/// @nodoc
abstract mixin class $WalletCardEntityCopyWith<$Res> {
factory $WalletCardEntityCopyWith(WalletCardEntity value, $Res Function(WalletCardEntity) _then) = _$WalletCardEntityCopyWithImpl;
@useResult
$Res call({
int cardId, int walletId, int userId, String status
});
}
/// @nodoc
class _$WalletCardEntityCopyWithImpl<$Res>
implements $WalletCardEntityCopyWith<$Res> {
_$WalletCardEntityCopyWithImpl(this._self, this._then);
final WalletCardEntity _self;
final $Res Function(WalletCardEntity) _then;
/// Create a copy of WalletCardEntity
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? cardId = null,Object? walletId = null,Object? userId = null,Object? status = null,}) {
return _then(_self.copyWith(
cardId: null == cardId ? _self.cardId : cardId // ignore: cast_nullable_to_non_nullable
as int,walletId: null == walletId ? _self.walletId : walletId // ignore: cast_nullable_to_non_nullable
as int,userId: null == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable
as int,status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// Adds pattern-matching-related methods to [WalletCardEntity].
extension WalletCardEntityPatterns on WalletCardEntity {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _WalletCardEntity value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _WalletCardEntity() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _WalletCardEntity value) $default,){
final _that = this;
switch (_that) {
case _WalletCardEntity():
return $default(_that);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _WalletCardEntity value)? $default,){
final _that = this;
switch (_that) {
case _WalletCardEntity() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( int cardId, int walletId, int userId, String status)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _WalletCardEntity() when $default != null:
return $default(_that.cardId,_that.walletId,_that.userId,_that.status);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( int cardId, int walletId, int userId, String status) $default,) {final _that = this;
switch (_that) {
case _WalletCardEntity():
return $default(_that.cardId,_that.walletId,_that.userId,_that.status);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( int cardId, int walletId, int userId, String status)? $default,) {final _that = this;
switch (_that) {
case _WalletCardEntity() when $default != null:
return $default(_that.cardId,_that.walletId,_that.userId,_that.status);case _:
return null;
}
}
}
/// @nodoc
class _WalletCardEntity implements WalletCardEntity {
const _WalletCardEntity({required this.cardId, required this.walletId, required this.userId, required this.status});
@override final int cardId;
@override final int walletId;
@override final int userId;
@override final String status;
/// Create a copy of WalletCardEntity
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$WalletCardEntityCopyWith<_WalletCardEntity> get copyWith => __$WalletCardEntityCopyWithImpl<_WalletCardEntity>(this, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _WalletCardEntity&&(identical(other.cardId, cardId) || other.cardId == cardId)&&(identical(other.walletId, walletId) || other.walletId == walletId)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.status, status) || other.status == status));
}
@override
int get hashCode => Object.hash(runtimeType,cardId,walletId,userId,status);
@override
String toString() {
return 'WalletCardEntity(cardId: $cardId, walletId: $walletId, userId: $userId, status: $status)';
}
}
/// @nodoc
abstract mixin class _$WalletCardEntityCopyWith<$Res> implements $WalletCardEntityCopyWith<$Res> {
factory _$WalletCardEntityCopyWith(_WalletCardEntity value, $Res Function(_WalletCardEntity) _then) = __$WalletCardEntityCopyWithImpl;
@override @useResult
$Res call({
int cardId, int walletId, int userId, String status
});
}
/// @nodoc
class __$WalletCardEntityCopyWithImpl<$Res>
implements _$WalletCardEntityCopyWith<$Res> {
__$WalletCardEntityCopyWithImpl(this._self, this._then);
final _WalletCardEntity _self;
final $Res Function(_WalletCardEntity) _then;
/// Create a copy of WalletCardEntity
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? cardId = null,Object? walletId = null,Object? userId = null,Object? status = null,}) {
return _then(_WalletCardEntity(
cardId: null == cardId ? _self.cardId : cardId // ignore: cast_nullable_to_non_nullable
as int,walletId: null == walletId ? _self.walletId : walletId // ignore: cast_nullable_to_non_nullable
as int,userId: null == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable
as int,status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
// dart format on

View File

@@ -0,0 +1,13 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'wallet_limits_entity.freezed.dart';
@freezed
abstract class WalletLimitsEntity with _$WalletLimitsEntity {
const factory WalletLimitsEntity({
double? dayLimit,
double? weekLimit,
double? monthLimit,
double? yearLimit,
}) = _WalletLimitsEntity;
}

View File

@@ -0,0 +1,280 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'wallet_limits_entity.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$WalletLimitsEntity {
double? get dayLimit; double? get weekLimit; double? get monthLimit; double? get yearLimit;
/// Create a copy of WalletLimitsEntity
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$WalletLimitsEntityCopyWith<WalletLimitsEntity> get copyWith => _$WalletLimitsEntityCopyWithImpl<WalletLimitsEntity>(this as WalletLimitsEntity, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is WalletLimitsEntity&&(identical(other.dayLimit, dayLimit) || other.dayLimit == dayLimit)&&(identical(other.weekLimit, weekLimit) || other.weekLimit == weekLimit)&&(identical(other.monthLimit, monthLimit) || other.monthLimit == monthLimit)&&(identical(other.yearLimit, yearLimit) || other.yearLimit == yearLimit));
}
@override
int get hashCode => Object.hash(runtimeType,dayLimit,weekLimit,monthLimit,yearLimit);
@override
String toString() {
return 'WalletLimitsEntity(dayLimit: $dayLimit, weekLimit: $weekLimit, monthLimit: $monthLimit, yearLimit: $yearLimit)';
}
}
/// @nodoc
abstract mixin class $WalletLimitsEntityCopyWith<$Res> {
factory $WalletLimitsEntityCopyWith(WalletLimitsEntity value, $Res Function(WalletLimitsEntity) _then) = _$WalletLimitsEntityCopyWithImpl;
@useResult
$Res call({
double? dayLimit, double? weekLimit, double? monthLimit, double? yearLimit
});
}
/// @nodoc
class _$WalletLimitsEntityCopyWithImpl<$Res>
implements $WalletLimitsEntityCopyWith<$Res> {
_$WalletLimitsEntityCopyWithImpl(this._self, this._then);
final WalletLimitsEntity _self;
final $Res Function(WalletLimitsEntity) _then;
/// Create a copy of WalletLimitsEntity
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? dayLimit = freezed,Object? weekLimit = freezed,Object? monthLimit = freezed,Object? yearLimit = freezed,}) {
return _then(_self.copyWith(
dayLimit: freezed == dayLimit ? _self.dayLimit : dayLimit // ignore: cast_nullable_to_non_nullable
as double?,weekLimit: freezed == weekLimit ? _self.weekLimit : weekLimit // ignore: cast_nullable_to_non_nullable
as double?,monthLimit: freezed == monthLimit ? _self.monthLimit : monthLimit // ignore: cast_nullable_to_non_nullable
as double?,yearLimit: freezed == yearLimit ? _self.yearLimit : yearLimit // ignore: cast_nullable_to_non_nullable
as double?,
));
}
}
/// Adds pattern-matching-related methods to [WalletLimitsEntity].
extension WalletLimitsEntityPatterns on WalletLimitsEntity {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _WalletLimitsEntity value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _WalletLimitsEntity() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _WalletLimitsEntity value) $default,){
final _that = this;
switch (_that) {
case _WalletLimitsEntity():
return $default(_that);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _WalletLimitsEntity value)? $default,){
final _that = this;
switch (_that) {
case _WalletLimitsEntity() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( double? dayLimit, double? weekLimit, double? monthLimit, double? yearLimit)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _WalletLimitsEntity() when $default != null:
return $default(_that.dayLimit,_that.weekLimit,_that.monthLimit,_that.yearLimit);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( double? dayLimit, double? weekLimit, double? monthLimit, double? yearLimit) $default,) {final _that = this;
switch (_that) {
case _WalletLimitsEntity():
return $default(_that.dayLimit,_that.weekLimit,_that.monthLimit,_that.yearLimit);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( double? dayLimit, double? weekLimit, double? monthLimit, double? yearLimit)? $default,) {final _that = this;
switch (_that) {
case _WalletLimitsEntity() when $default != null:
return $default(_that.dayLimit,_that.weekLimit,_that.monthLimit,_that.yearLimit);case _:
return null;
}
}
}
/// @nodoc
class _WalletLimitsEntity implements WalletLimitsEntity {
const _WalletLimitsEntity({this.dayLimit, this.weekLimit, this.monthLimit, this.yearLimit});
@override final double? dayLimit;
@override final double? weekLimit;
@override final double? monthLimit;
@override final double? yearLimit;
/// Create a copy of WalletLimitsEntity
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$WalletLimitsEntityCopyWith<_WalletLimitsEntity> get copyWith => __$WalletLimitsEntityCopyWithImpl<_WalletLimitsEntity>(this, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _WalletLimitsEntity&&(identical(other.dayLimit, dayLimit) || other.dayLimit == dayLimit)&&(identical(other.weekLimit, weekLimit) || other.weekLimit == weekLimit)&&(identical(other.monthLimit, monthLimit) || other.monthLimit == monthLimit)&&(identical(other.yearLimit, yearLimit) || other.yearLimit == yearLimit));
}
@override
int get hashCode => Object.hash(runtimeType,dayLimit,weekLimit,monthLimit,yearLimit);
@override
String toString() {
return 'WalletLimitsEntity(dayLimit: $dayLimit, weekLimit: $weekLimit, monthLimit: $monthLimit, yearLimit: $yearLimit)';
}
}
/// @nodoc
abstract mixin class _$WalletLimitsEntityCopyWith<$Res> implements $WalletLimitsEntityCopyWith<$Res> {
factory _$WalletLimitsEntityCopyWith(_WalletLimitsEntity value, $Res Function(_WalletLimitsEntity) _then) = __$WalletLimitsEntityCopyWithImpl;
@override @useResult
$Res call({
double? dayLimit, double? weekLimit, double? monthLimit, double? yearLimit
});
}
/// @nodoc
class __$WalletLimitsEntityCopyWithImpl<$Res>
implements _$WalletLimitsEntityCopyWith<$Res> {
__$WalletLimitsEntityCopyWithImpl(this._self, this._then);
final _WalletLimitsEntity _self;
final $Res Function(_WalletLimitsEntity) _then;
/// Create a copy of WalletLimitsEntity
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? dayLimit = freezed,Object? weekLimit = freezed,Object? monthLimit = freezed,Object? yearLimit = freezed,}) {
return _then(_WalletLimitsEntity(
dayLimit: freezed == dayLimit ? _self.dayLimit : dayLimit // ignore: cast_nullable_to_non_nullable
as double?,weekLimit: freezed == weekLimit ? _self.weekLimit : weekLimit // ignore: cast_nullable_to_non_nullable
as double?,monthLimit: freezed == monthLimit ? _self.monthLimit : monthLimit // ignore: cast_nullable_to_non_nullable
as double?,yearLimit: freezed == yearLimit ? _self.yearLimit : yearLimit // ignore: cast_nullable_to_non_nullable
as double?,
));
}
}
// dart format on

View File

@@ -1,9 +1,12 @@
import '../entities/child_wallet_entity.dart';
import '../entities/mcc_group_entity.dart';
import '../entities/payment_profile_entity.dart';
import '../entities/payout_beneficiary_entity.dart';
import '../entities/sca_wallet_entity.dart';
import '../entities/transaction_beneficiary_entity.dart';
import '../entities/wallet_balance_entity.dart';
import '../entities/wallet_card_entity.dart';
import '../entities/wallet_limits_entity.dart';
import '../entities/wallet_transaction_entity.dart';
abstract class TreezorRepository {
@@ -24,7 +27,7 @@ abstract class TreezorRepository {
Future<WalletBalanceEntity> getWalletBalance({required String walletId});
Future<void> deleteScaWallet({required String scaWalletId});
Future<bool> deleteScaWallet({required String scaWalletId});
Future<TransactionBeneficiaryEntity> createTransactionBeneficiary({
required String name,
@@ -68,7 +71,21 @@ abstract class TreezorRepository {
required int month,
});
Future<({String cardId, String statusCode})> getCard({
Future<WalletCardEntity> getCard({required String walletId});
Future<List<MccGroupEntity>> getMccGroups();
Future<List<String>> getWalletMccLimits({required String walletId});
Future<void> setWalletMccLimits({
required String walletId,
required List<String> mccGroupIds,
});
Future<WalletLimitsEntity> getWalletLimits({required String walletId});
Future<void> setWalletLimits({
required String walletId,
required WalletLimitsEntity limits,
});
}

View File

@@ -6,4 +6,5 @@ abstract class UserRepository {
Future<UserEntity> getUserInfo();
Future<List<ChildProfileEntity>> getChildProfiles();
Future<DeviceEntity> getDeviceByIdentificator({required String identificator});
Future<String> deleteDevice({required String deviceId});
}