feat: add card PIN management and card renewal to child wallet

- Add set PIN / change PIN multi-step flow (4-digit card PIN + 6-digit SCA PIN) with Treezor PCI DSS SCA proof generation
  - Add unblock PIN for blocked cards after failed attempts
  - Add renew card with SCA proof (same as wallet creation)
  - Show menu options conditionally based on hasCardPin and isPinBlocked flags
  - Make ScaPinView configurable with pinLength parameter (default 6)
  - Add hasCardPin to ChildProfileEntity and isPinBlocked to WalletCardEntity
  - Add EN/ES localizations for all new screens and messages
This commit is contained in:
2026-03-24 13:42:09 +01:00
parent a07e9c23ca
commit 47c7821b0c
36 changed files with 1554 additions and 114 deletions

View File

@@ -7,6 +7,6 @@
<versions>
<version>2.6.4</version>
</versions>
<lastUpdated>20260322000000</lastUpdated>
<lastUpdated>20260324000000</lastUpdated>
</versioning>
</metadata>

View File

@@ -1 +1 @@
ec3c2e29f6fe8ca84eadd369212dff2b
60e0101847630ce6dcc19b1e46fb081c

View File

@@ -1 +1 @@
df5c1d0c2331a0f608264e4d5f14b9492f5eb2aa
09ac1da2fb43d606168060ea769ec889804c3ed7

View File

@@ -31,6 +31,10 @@ class AppRoutes {
'${childWallet(childWalletId)}/extract';
static String editChildProfile(String childWalletId) =>
'${childWallet(childWalletId)}/edit';
static String setCardPin(String childWalletId) =>
'${childWallet(childWalletId)}/set-pin';
static String changeCardPin(String childWalletId) =>
'${childWallet(childWalletId)}/change-pin';
static const dashboardActivity = '$dashboard/activity';
static const dashboardNotifications = '$dashboard/notifications';
static const dashboardProfile = '$dashboard/profile';

View File

@@ -763,5 +763,26 @@
"callHistoryEmpty": "No calls recorded",
"callIncoming": "Incoming",
"callOutgoing": "Outgoing",
"callMissed": "Missed"
"callMissed": "Missed",
"cardPinSet": "Set PIN",
"cardPinChange": "Change PIN",
"cardPinUnblock": "Unblock PIN",
"cardPinSetTitle": "Set card PIN",
"cardPinChangeTitle": "Change card PIN",
"cardPinCurrentStep": "Enter current PIN",
"cardPinNewStep": "Enter new PIN",
"cardPinConfirmStep": "Confirm new PIN",
"cardPinScaStep": "Enter your security PIN",
"cardPinNext": "Next",
"cardPinMismatch": "PINs do not match, please try again",
"cardPinSuccess": "Card PIN updated successfully",
"cardPinError": "Error updating card PIN",
"cardPinUnblockConfirm": "Are you sure you want to unblock the card PIN?",
"cardPinUnblockSuccess": "Card PIN unblocked successfully",
"cardPinUnblockError": "Error unblocking card PIN",
"renewCardTitle": "Renew card",
"renewCardConfirm": "Are you sure you want to renew the card? A new card will be issued.",
"renewCardPinTitle": "Enter your security PIN to renew the card",
"renewCardSuccess": "Card renewed successfully",
"renewCardError": "Error renewing card"
}

View File

@@ -761,5 +761,26 @@
"callHistoryEmpty": "No hay llamadas registradas",
"callIncoming": "Entrantes",
"callOutgoing": "Salientes",
"callMissed": "Perdidas"
"callMissed": "Perdidas",
"cardPinSet": "Establecer PIN",
"cardPinChange": "Cambiar PIN",
"cardPinUnblock": "Desbloquear PIN",
"cardPinSetTitle": "Establecer PIN de tarjeta",
"cardPinChangeTitle": "Cambiar PIN de tarjeta",
"cardPinCurrentStep": "Introduce el PIN actual",
"cardPinNewStep": "Introduce el nuevo PIN",
"cardPinConfirmStep": "Confirma el nuevo PIN",
"cardPinScaStep": "Introduce tu PIN de seguridad",
"cardPinNext": "Siguiente",
"cardPinMismatch": "Los PIN no coinciden, inténtalo de nuevo",
"cardPinSuccess": "PIN de tarjeta actualizado correctamente",
"cardPinError": "Error al actualizar el PIN de tarjeta",
"cardPinUnblockConfirm": "¿Estás seguro de que quieres desbloquear el PIN de la tarjeta?",
"cardPinUnblockSuccess": "PIN de tarjeta desbloqueado correctamente",
"cardPinUnblockError": "Error al desbloquear el PIN de tarjeta",
"renewCardTitle": "Renovar tarjeta",
"renewCardConfirm": "¿Estás seguro de que quieres renovar la tarjeta? Se emitirá una nueva tarjeta.",
"renewCardPinTitle": "Introduce tu PIN de seguridad para renovar la tarjeta",
"renewCardSuccess": "Tarjeta renovada correctamente",
"renewCardError": "Error al renovar la tarjeta"
}

View File

@@ -768,4 +768,25 @@ class I18n {
static const String noPhotosAvailable = 'noPhotosAvailable';
static const String yesterday = 'yesterday';
static const String measure = 'measure';
static const String cardPinSet = 'cardPinSet';
static const String cardPinChange = 'cardPinChange';
static const String cardPinUnblock = 'cardPinUnblock';
static const String cardPinSetTitle = 'cardPinSetTitle';
static const String cardPinChangeTitle = 'cardPinChangeTitle';
static const String cardPinCurrentStep = 'cardPinCurrentStep';
static const String cardPinNewStep = 'cardPinNewStep';
static const String cardPinConfirmStep = 'cardPinConfirmStep';
static const String cardPinScaStep = 'cardPinScaStep';
static const String cardPinNext = 'cardPinNext';
static const String cardPinMismatch = 'cardPinMismatch';
static const String cardPinSuccess = 'cardPinSuccess';
static const String cardPinError = 'cardPinError';
static const String cardPinUnblockConfirm = 'cardPinUnblockConfirm';
static const String cardPinUnblockSuccess = 'cardPinUnblockSuccess';
static const String cardPinUnblockError = 'cardPinUnblockError';
static const String renewCardTitle = 'renewCardTitle';
static const String renewCardConfirm = 'renewCardConfirm';
static const String renewCardPinTitle = 'renewCardPinTitle';
static const String renewCardSuccess = 'renewCardSuccess';
static const String renewCardError = 'renewCardError';
}

View File

@@ -94,4 +94,27 @@ abstract class TreezorRemoteDatasource {
required String walletId,
required WalletLimitsModel limits,
});
Future<void> setCardPin({
required String walletId,
required String newPin,
required String confirmPin,
required String scaProof,
});
Future<void> changeCardPin({
required String walletId,
required String currentPin,
required String newPin,
required String confirmPin,
required String scaProof,
});
Future<void> unblockCardPin({required String walletId});
Future<void> renewCard({
required String childProfileId,
required String publicToken,
required String scaProof,
});
}

View File

@@ -549,6 +549,91 @@ class TreezorRemoteDatasourceImpl implements TreezorRemoteDatasource {
);
}
}
@override
Future<void> setCardPin({
required String walletId,
required String newPin,
required String confirmPin,
required String scaProof,
}) async {
try {
await _repository.put<void>(
'/wallets/$walletId/card/set-pin',
body: <String, dynamic>{
'newPin': newPin,
'confirmPin': confirmPin,
'scaProof': scaProof,
},
);
} on DioException catch (error) {
throw _mapDioError(
error,
defaultMessage: 'Error in /wallets/$walletId/card/set-pin',
);
}
}
@override
Future<void> changeCardPin({
required String walletId,
required String currentPin,
required String newPin,
required String confirmPin,
required String scaProof,
}) async {
try {
await _repository.put<void>(
'/wallets/$walletId/card/change-pin',
body: <String, dynamic>{
'currentPin': currentPin,
'newPin': newPin,
'confirmPin': confirmPin,
'scaProof': scaProof,
},
);
} on DioException catch (error) {
throw _mapDioError(
error,
defaultMessage: 'Error in /wallets/$walletId/card/change-pin',
);
}
}
@override
Future<void> unblockCardPin({required String walletId}) async {
try {
await _repository.put<void>('/wallets/$walletId/card/unblock-pin');
} on DioException catch (error) {
throw _mapDioError(
error,
defaultMessage: 'Error in /wallets/$walletId/card/unblock-pin',
);
}
}
@override
Future<void> renewCard({
required String childProfileId,
required String publicToken,
required String scaProof,
}) async {
try {
await _repository.put<void>(
'/child-profiles/$childProfileId/renew-card',
body: <String, dynamic>{
'publicToken': publicToken,
'scaProof': scaProof,
},
);
} on DioException catch (error) {
throw _mapDioError(
error,
defaultMessage:
'Error in /child-profiles/$childProfileId/renew-card',
);
}
}
}
Exception _mapDioError(DioException error, {required String defaultMessage}) {

View File

@@ -30,6 +30,7 @@ abstract class ChildProfileModel with _$ChildProfileModel {
required String treezorUserId,
required String address,
required int createdAt,
@Default(false) bool hasCardPin,
}) = _ChildProfileModel;
factory ChildProfileModel.fromJson(Map<String, dynamic> json) =>
@@ -49,6 +50,7 @@ extension ChildProfileModelMapper on ChildProfileModel {
treezorUserId: treezorUserId,
address: address,
createdAt: createdAt,
hasCardPin: hasCardPin,
);
}
}

View File

@@ -293,7 +293,7 @@ as int,
/// @nodoc
mixin _$ChildProfileModel {
String get id; String get deviceIdentificator; String get parentId; String get firstName; String get lastName; int get bornAt; String get walletId; String get treezorUserId; String get address; int get createdAt;
String get id; String get deviceIdentificator; String get parentId; String get firstName; String get lastName; int get bornAt; String get walletId; String get treezorUserId; String get address; int get createdAt; bool get hasCardPin;
/// Create a copy of ChildProfileModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -306,16 +306,16 @@ $ChildProfileModelCopyWith<ChildProfileModel> get copyWith => _$ChildProfileMode
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is ChildProfileModel&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceIdentificator, deviceIdentificator) || other.deviceIdentificator == deviceIdentificator)&&(identical(other.parentId, parentId) || other.parentId == parentId)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.bornAt, bornAt) || other.bornAt == bornAt)&&(identical(other.walletId, walletId) || other.walletId == walletId)&&(identical(other.treezorUserId, treezorUserId) || other.treezorUserId == treezorUserId)&&(identical(other.address, address) || other.address == address)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt));
return identical(this, other) || (other.runtimeType == runtimeType&&other is ChildProfileModel&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceIdentificator, deviceIdentificator) || other.deviceIdentificator == deviceIdentificator)&&(identical(other.parentId, parentId) || other.parentId == parentId)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.bornAt, bornAt) || other.bornAt == bornAt)&&(identical(other.walletId, walletId) || other.walletId == walletId)&&(identical(other.treezorUserId, treezorUserId) || other.treezorUserId == treezorUserId)&&(identical(other.address, address) || other.address == address)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.hasCardPin, hasCardPin) || other.hasCardPin == hasCardPin));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,id,deviceIdentificator,parentId,firstName,lastName,bornAt,walletId,treezorUserId,address,createdAt);
int get hashCode => Object.hash(runtimeType,id,deviceIdentificator,parentId,firstName,lastName,bornAt,walletId,treezorUserId,address,createdAt,hasCardPin);
@override
String toString() {
return 'ChildProfileModel(id: $id, deviceIdentificator: $deviceIdentificator, parentId: $parentId, firstName: $firstName, lastName: $lastName, bornAt: $bornAt, walletId: $walletId, treezorUserId: $treezorUserId, address: $address, createdAt: $createdAt)';
return 'ChildProfileModel(id: $id, deviceIdentificator: $deviceIdentificator, parentId: $parentId, firstName: $firstName, lastName: $lastName, bornAt: $bornAt, walletId: $walletId, treezorUserId: $treezorUserId, address: $address, createdAt: $createdAt, hasCardPin: $hasCardPin)';
}
@@ -326,7 +326,7 @@ abstract mixin class $ChildProfileModelCopyWith<$Res> {
factory $ChildProfileModelCopyWith(ChildProfileModel value, $Res Function(ChildProfileModel) _then) = _$ChildProfileModelCopyWithImpl;
@useResult
$Res call({
String id, String deviceIdentificator, String parentId, String firstName, String lastName, int bornAt, String walletId, String treezorUserId, String address, int createdAt
String id, String deviceIdentificator, String parentId, String firstName, String lastName, int bornAt, String walletId, String treezorUserId, String address, int createdAt, bool hasCardPin
});
@@ -343,7 +343,7 @@ class _$ChildProfileModelCopyWithImpl<$Res>
/// Create a copy of ChildProfileModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? deviceIdentificator = null,Object? parentId = null,Object? firstName = null,Object? lastName = null,Object? bornAt = null,Object? walletId = null,Object? treezorUserId = null,Object? address = null,Object? createdAt = null,}) {
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? deviceIdentificator = null,Object? parentId = null,Object? firstName = null,Object? lastName = null,Object? bornAt = null,Object? walletId = null,Object? treezorUserId = null,Object? address = null,Object? createdAt = null,Object? hasCardPin = null,}) {
return _then(_self.copyWith(
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String,deviceIdentificator: null == deviceIdentificator ? _self.deviceIdentificator : deviceIdentificator // ignore: cast_nullable_to_non_nullable
@@ -355,7 +355,8 @@ as int,walletId: null == walletId ? _self.walletId : walletId // ignore: cast_nu
as String,treezorUserId: null == treezorUserId ? _self.treezorUserId : treezorUserId // ignore: cast_nullable_to_non_nullable
as String,address: null == address ? _self.address : address // ignore: cast_nullable_to_non_nullable
as String,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
as int,
as int,hasCardPin: null == hasCardPin ? _self.hasCardPin : hasCardPin // ignore: cast_nullable_to_non_nullable
as bool,
));
}
@@ -440,10 +441,10 @@ return $default(_that);case _:
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String deviceIdentificator, String parentId, String firstName, String lastName, int bornAt, String walletId, String treezorUserId, String address, int createdAt)? $default,{required TResult orElse(),}) {final _that = this;
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String deviceIdentificator, String parentId, String firstName, String lastName, int bornAt, String walletId, String treezorUserId, String address, int createdAt, bool hasCardPin)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _ChildProfileModel() when $default != null:
return $default(_that.id,_that.deviceIdentificator,_that.parentId,_that.firstName,_that.lastName,_that.bornAt,_that.walletId,_that.treezorUserId,_that.address,_that.createdAt);case _:
return $default(_that.id,_that.deviceIdentificator,_that.parentId,_that.firstName,_that.lastName,_that.bornAt,_that.walletId,_that.treezorUserId,_that.address,_that.createdAt,_that.hasCardPin);case _:
return orElse();
}
@@ -461,10 +462,10 @@ return $default(_that.id,_that.deviceIdentificator,_that.parentId,_that.firstNam
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, String deviceIdentificator, String parentId, String firstName, String lastName, int bornAt, String walletId, String treezorUserId, String address, int createdAt) $default,) {final _that = this;
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, String deviceIdentificator, String parentId, String firstName, String lastName, int bornAt, String walletId, String treezorUserId, String address, int createdAt, bool hasCardPin) $default,) {final _that = this;
switch (_that) {
case _ChildProfileModel():
return $default(_that.id,_that.deviceIdentificator,_that.parentId,_that.firstName,_that.lastName,_that.bornAt,_that.walletId,_that.treezorUserId,_that.address,_that.createdAt);case _:
return $default(_that.id,_that.deviceIdentificator,_that.parentId,_that.firstName,_that.lastName,_that.bornAt,_that.walletId,_that.treezorUserId,_that.address,_that.createdAt,_that.hasCardPin);case _:
throw StateError('Unexpected subclass');
}
@@ -481,10 +482,10 @@ return $default(_that.id,_that.deviceIdentificator,_that.parentId,_that.firstNam
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String deviceIdentificator, String parentId, String firstName, String lastName, int bornAt, String walletId, String treezorUserId, String address, int createdAt)? $default,) {final _that = this;
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String deviceIdentificator, String parentId, String firstName, String lastName, int bornAt, String walletId, String treezorUserId, String address, int createdAt, bool hasCardPin)? $default,) {final _that = this;
switch (_that) {
case _ChildProfileModel() when $default != null:
return $default(_that.id,_that.deviceIdentificator,_that.parentId,_that.firstName,_that.lastName,_that.bornAt,_that.walletId,_that.treezorUserId,_that.address,_that.createdAt);case _:
return $default(_that.id,_that.deviceIdentificator,_that.parentId,_that.firstName,_that.lastName,_that.bornAt,_that.walletId,_that.treezorUserId,_that.address,_that.createdAt,_that.hasCardPin);case _:
return null;
}
@@ -496,7 +497,7 @@ return $default(_that.id,_that.deviceIdentificator,_that.parentId,_that.firstNam
@JsonSerializable()
class _ChildProfileModel implements ChildProfileModel {
const _ChildProfileModel({required this.id, required this.deviceIdentificator, required this.parentId, required this.firstName, required this.lastName, required this.bornAt, required this.walletId, required this.treezorUserId, required this.address, required this.createdAt});
const _ChildProfileModel({required this.id, required this.deviceIdentificator, required this.parentId, required this.firstName, required this.lastName, required this.bornAt, required this.walletId, required this.treezorUserId, required this.address, required this.createdAt, this.hasCardPin = false});
factory _ChildProfileModel.fromJson(Map<String, dynamic> json) => _$ChildProfileModelFromJson(json);
@override final String id;
@@ -509,6 +510,7 @@ class _ChildProfileModel implements ChildProfileModel {
@override final String treezorUserId;
@override final String address;
@override final int createdAt;
@override@JsonKey() final bool hasCardPin;
/// Create a copy of ChildProfileModel
/// with the given fields replaced by the non-null parameter values.
@@ -523,16 +525,16 @@ Map<String, dynamic> toJson() {
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ChildProfileModel&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceIdentificator, deviceIdentificator) || other.deviceIdentificator == deviceIdentificator)&&(identical(other.parentId, parentId) || other.parentId == parentId)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.bornAt, bornAt) || other.bornAt == bornAt)&&(identical(other.walletId, walletId) || other.walletId == walletId)&&(identical(other.treezorUserId, treezorUserId) || other.treezorUserId == treezorUserId)&&(identical(other.address, address) || other.address == address)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt));
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ChildProfileModel&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceIdentificator, deviceIdentificator) || other.deviceIdentificator == deviceIdentificator)&&(identical(other.parentId, parentId) || other.parentId == parentId)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.bornAt, bornAt) || other.bornAt == bornAt)&&(identical(other.walletId, walletId) || other.walletId == walletId)&&(identical(other.treezorUserId, treezorUserId) || other.treezorUserId == treezorUserId)&&(identical(other.address, address) || other.address == address)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.hasCardPin, hasCardPin) || other.hasCardPin == hasCardPin));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,id,deviceIdentificator,parentId,firstName,lastName,bornAt,walletId,treezorUserId,address,createdAt);
int get hashCode => Object.hash(runtimeType,id,deviceIdentificator,parentId,firstName,lastName,bornAt,walletId,treezorUserId,address,createdAt,hasCardPin);
@override
String toString() {
return 'ChildProfileModel(id: $id, deviceIdentificator: $deviceIdentificator, parentId: $parentId, firstName: $firstName, lastName: $lastName, bornAt: $bornAt, walletId: $walletId, treezorUserId: $treezorUserId, address: $address, createdAt: $createdAt)';
return 'ChildProfileModel(id: $id, deviceIdentificator: $deviceIdentificator, parentId: $parentId, firstName: $firstName, lastName: $lastName, bornAt: $bornAt, walletId: $walletId, treezorUserId: $treezorUserId, address: $address, createdAt: $createdAt, hasCardPin: $hasCardPin)';
}
@@ -543,7 +545,7 @@ abstract mixin class _$ChildProfileModelCopyWith<$Res> implements $ChildProfileM
factory _$ChildProfileModelCopyWith(_ChildProfileModel value, $Res Function(_ChildProfileModel) _then) = __$ChildProfileModelCopyWithImpl;
@override @useResult
$Res call({
String id, String deviceIdentificator, String parentId, String firstName, String lastName, int bornAt, String walletId, String treezorUserId, String address, int createdAt
String id, String deviceIdentificator, String parentId, String firstName, String lastName, int bornAt, String walletId, String treezorUserId, String address, int createdAt, bool hasCardPin
});
@@ -560,7 +562,7 @@ class __$ChildProfileModelCopyWithImpl<$Res>
/// Create a copy of ChildProfileModel
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? deviceIdentificator = null,Object? parentId = null,Object? firstName = null,Object? lastName = null,Object? bornAt = null,Object? walletId = null,Object? treezorUserId = null,Object? address = null,Object? createdAt = null,}) {
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? deviceIdentificator = null,Object? parentId = null,Object? firstName = null,Object? lastName = null,Object? bornAt = null,Object? walletId = null,Object? treezorUserId = null,Object? address = null,Object? createdAt = null,Object? hasCardPin = null,}) {
return _then(_ChildProfileModel(
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String,deviceIdentificator: null == deviceIdentificator ? _self.deviceIdentificator : deviceIdentificator // ignore: cast_nullable_to_non_nullable
@@ -572,7 +574,8 @@ as int,walletId: null == walletId ? _self.walletId : walletId // ignore: cast_nu
as String,treezorUserId: null == treezorUserId ? _self.treezorUserId : treezorUserId // ignore: cast_nullable_to_non_nullable
as String,address: null == address ? _self.address : address // ignore: cast_nullable_to_non_nullable
as String,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
as int,
as int,hasCardPin: null == hasCardPin ? _self.hasCardPin : hasCardPin // ignore: cast_nullable_to_non_nullable
as bool,
));
}

View File

@@ -38,6 +38,7 @@ _ChildProfileModel _$ChildProfileModelFromJson(Map<String, dynamic> json) =>
treezorUserId: json['treezorUserId'] as String,
address: json['address'] as String,
createdAt: (json['createdAt'] as num).toInt(),
hasCardPin: json['hasCardPin'] as bool? ?? false,
);
Map<String, dynamic> _$ChildProfileModelToJson(_ChildProfileModel instance) =>
@@ -52,4 +53,5 @@ Map<String, dynamic> _$ChildProfileModelToJson(_ChildProfileModel instance) =>
'treezorUserId': instance.treezorUserId,
'address': instance.address,
'createdAt': instance.createdAt,
'hasCardPin': instance.hasCardPin,
};

View File

@@ -11,6 +11,7 @@ abstract class WalletCardModel with _$WalletCardModel {
required int walletId,
required int userId,
required String status,
@Default(false) bool isPinBlocked,
}) = _WalletCardModel;
factory WalletCardModel.fromJson(Map<String, dynamic> json) =>
@@ -24,6 +25,7 @@ extension WalletCardModelMapper on WalletCardModel {
walletId: walletId,
userId: userId,
status: status,
isPinBlocked: isPinBlocked,
);
}
}

View File

@@ -15,7 +15,7 @@ T _$identity<T>(T value) => value;
/// @nodoc
mixin _$WalletCardModel {
int get cardId; int get walletId; int get userId; String get status;
int get cardId; int get walletId; int get userId; String get status; bool get isPinBlocked;
/// Create a copy of WalletCardModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -28,16 +28,16 @@ $WalletCardModelCopyWith<WalletCardModel> get copyWith => _$WalletCardModelCopyW
@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));
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)&&(identical(other.isPinBlocked, isPinBlocked) || other.isPinBlocked == isPinBlocked));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,cardId,walletId,userId,status);
int get hashCode => Object.hash(runtimeType,cardId,walletId,userId,status,isPinBlocked);
@override
String toString() {
return 'WalletCardModel(cardId: $cardId, walletId: $walletId, userId: $userId, status: $status)';
return 'WalletCardModel(cardId: $cardId, walletId: $walletId, userId: $userId, status: $status, isPinBlocked: $isPinBlocked)';
}
@@ -48,7 +48,7 @@ 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
int cardId, int walletId, int userId, String status, bool isPinBlocked
});
@@ -65,13 +65,14 @@ class _$WalletCardModelCopyWithImpl<$Res>
/// 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,}) {
@pragma('vm:prefer-inline') @override $Res call({Object? cardId = null,Object? walletId = null,Object? userId = null,Object? status = null,Object? isPinBlocked = 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,
as String,isPinBlocked: null == isPinBlocked ? _self.isPinBlocked : isPinBlocked // ignore: cast_nullable_to_non_nullable
as bool,
));
}
@@ -156,10 +157,10 @@ return $default(_that);case _:
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( int cardId, int walletId, int userId, String status)? $default,{required TResult orElse(),}) {final _that = this;
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( int cardId, int walletId, int userId, String status, bool isPinBlocked)? $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 $default(_that.cardId,_that.walletId,_that.userId,_that.status,_that.isPinBlocked);case _:
return orElse();
}
@@ -177,10 +178,10 @@ return $default(_that.cardId,_that.walletId,_that.userId,_that.status);case _:
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( int cardId, int walletId, int userId, String status) $default,) {final _that = this;
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( int cardId, int walletId, int userId, String status, bool isPinBlocked) $default,) {final _that = this;
switch (_that) {
case _WalletCardModel():
return $default(_that.cardId,_that.walletId,_that.userId,_that.status);case _:
return $default(_that.cardId,_that.walletId,_that.userId,_that.status,_that.isPinBlocked);case _:
throw StateError('Unexpected subclass');
}
@@ -197,10 +198,10 @@ return $default(_that.cardId,_that.walletId,_that.userId,_that.status);case _:
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( int cardId, int walletId, int userId, String status)? $default,) {final _that = this;
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( int cardId, int walletId, int userId, String status, bool isPinBlocked)? $default,) {final _that = this;
switch (_that) {
case _WalletCardModel() when $default != null:
return $default(_that.cardId,_that.walletId,_that.userId,_that.status);case _:
return $default(_that.cardId,_that.walletId,_that.userId,_that.status,_that.isPinBlocked);case _:
return null;
}
@@ -212,13 +213,14 @@ return $default(_that.cardId,_that.walletId,_that.userId,_that.status);case _:
@JsonSerializable()
class _WalletCardModel implements WalletCardModel {
const _WalletCardModel({required this.cardId, required this.walletId, required this.userId, required this.status});
const _WalletCardModel({required this.cardId, required this.walletId, required this.userId, required this.status, this.isPinBlocked = false});
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;
@override@JsonKey() final bool isPinBlocked;
/// Create a copy of WalletCardModel
/// with the given fields replaced by the non-null parameter values.
@@ -233,16 +235,16 @@ 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));
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)&&(identical(other.isPinBlocked, isPinBlocked) || other.isPinBlocked == isPinBlocked));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,cardId,walletId,userId,status);
int get hashCode => Object.hash(runtimeType,cardId,walletId,userId,status,isPinBlocked);
@override
String toString() {
return 'WalletCardModel(cardId: $cardId, walletId: $walletId, userId: $userId, status: $status)';
return 'WalletCardModel(cardId: $cardId, walletId: $walletId, userId: $userId, status: $status, isPinBlocked: $isPinBlocked)';
}
@@ -253,7 +255,7 @@ abstract mixin class _$WalletCardModelCopyWith<$Res> implements $WalletCardModel
factory _$WalletCardModelCopyWith(_WalletCardModel value, $Res Function(_WalletCardModel) _then) = __$WalletCardModelCopyWithImpl;
@override @useResult
$Res call({
int cardId, int walletId, int userId, String status
int cardId, int walletId, int userId, String status, bool isPinBlocked
});
@@ -270,13 +272,14 @@ class __$WalletCardModelCopyWithImpl<$Res>
/// 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,}) {
@override @pragma('vm:prefer-inline') $Res call({Object? cardId = null,Object? walletId = null,Object? userId = null,Object? status = null,Object? isPinBlocked = 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,
as String,isPinBlocked: null == isPinBlocked ? _self.isPinBlocked : isPinBlocked // ignore: cast_nullable_to_non_nullable
as bool,
));
}

View File

@@ -12,6 +12,7 @@ _WalletCardModel _$WalletCardModelFromJson(Map<String, dynamic> json) =>
walletId: (json['walletId'] as num).toInt(),
userId: (json['userId'] as num).toInt(),
status: json['status'] as String,
isPinBlocked: json['isPinBlocked'] as bool? ?? false,
);
Map<String, dynamic> _$WalletCardModelToJson(_WalletCardModel instance) =>
@@ -20,4 +21,5 @@ Map<String, dynamic> _$WalletCardModelToJson(_WalletCardModel instance) =>
'walletId': instance.walletId,
'userId': instance.userId,
'status': instance.status,
'isPinBlocked': instance.isPinBlocked,
};

View File

@@ -325,4 +325,54 @@ class TreezorRepositoryImpl implements TreezorRepository {
),
);
}
@override
Future<void> setCardPin({
required String walletId,
required String newPin,
required String confirmPin,
required String scaProof,
}) async {
await _remote.setCardPin(
walletId: walletId,
newPin: newPin,
confirmPin: confirmPin,
scaProof: scaProof,
);
}
@override
Future<void> changeCardPin({
required String walletId,
required String currentPin,
required String newPin,
required String confirmPin,
required String scaProof,
}) async {
await _remote.changeCardPin(
walletId: walletId,
currentPin: currentPin,
newPin: newPin,
confirmPin: confirmPin,
scaProof: scaProof,
);
}
@override
Future<void> unblockCardPin({required String walletId}) async {
await _remote.unblockCardPin(walletId: walletId);
}
@override
Future<void> renewCard({
required String childProfileId,
required String publicToken,
required String scaProof,
}) async {
await _remote.renewCard(
childProfileId: childProfileId,
publicToken: publicToken,
scaProof: scaProof,
);
}
}

View File

@@ -15,5 +15,6 @@ abstract class ChildProfileEntity with _$ChildProfileEntity {
required String treezorUserId,
required String address,
required int createdAt,
@Default(false) bool hasCardPin,
}) = _ChildProfileEntity;
}

View File

@@ -14,7 +14,7 @@ T _$identity<T>(T value) => value;
/// @nodoc
mixin _$ChildProfileEntity {
String get id; String get deviceIdentificator; String get parentId; String get firstName; String get lastName; int get bornAt; String get walletId; String get treezorUserId; String get address; int get createdAt;
String get id; String get deviceIdentificator; String get parentId; String get firstName; String get lastName; int get bornAt; String get walletId; String get treezorUserId; String get address; int get createdAt; bool get hasCardPin;
/// Create a copy of ChildProfileEntity
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -25,16 +25,16 @@ $ChildProfileEntityCopyWith<ChildProfileEntity> get copyWith => _$ChildProfileEn
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is ChildProfileEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceIdentificator, deviceIdentificator) || other.deviceIdentificator == deviceIdentificator)&&(identical(other.parentId, parentId) || other.parentId == parentId)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.bornAt, bornAt) || other.bornAt == bornAt)&&(identical(other.walletId, walletId) || other.walletId == walletId)&&(identical(other.treezorUserId, treezorUserId) || other.treezorUserId == treezorUserId)&&(identical(other.address, address) || other.address == address)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt));
return identical(this, other) || (other.runtimeType == runtimeType&&other is ChildProfileEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceIdentificator, deviceIdentificator) || other.deviceIdentificator == deviceIdentificator)&&(identical(other.parentId, parentId) || other.parentId == parentId)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.bornAt, bornAt) || other.bornAt == bornAt)&&(identical(other.walletId, walletId) || other.walletId == walletId)&&(identical(other.treezorUserId, treezorUserId) || other.treezorUserId == treezorUserId)&&(identical(other.address, address) || other.address == address)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.hasCardPin, hasCardPin) || other.hasCardPin == hasCardPin));
}
@override
int get hashCode => Object.hash(runtimeType,id,deviceIdentificator,parentId,firstName,lastName,bornAt,walletId,treezorUserId,address,createdAt);
int get hashCode => Object.hash(runtimeType,id,deviceIdentificator,parentId,firstName,lastName,bornAt,walletId,treezorUserId,address,createdAt,hasCardPin);
@override
String toString() {
return 'ChildProfileEntity(id: $id, deviceIdentificator: $deviceIdentificator, parentId: $parentId, firstName: $firstName, lastName: $lastName, bornAt: $bornAt, walletId: $walletId, treezorUserId: $treezorUserId, address: $address, createdAt: $createdAt)';
return 'ChildProfileEntity(id: $id, deviceIdentificator: $deviceIdentificator, parentId: $parentId, firstName: $firstName, lastName: $lastName, bornAt: $bornAt, walletId: $walletId, treezorUserId: $treezorUserId, address: $address, createdAt: $createdAt, hasCardPin: $hasCardPin)';
}
@@ -45,7 +45,7 @@ abstract mixin class $ChildProfileEntityCopyWith<$Res> {
factory $ChildProfileEntityCopyWith(ChildProfileEntity value, $Res Function(ChildProfileEntity) _then) = _$ChildProfileEntityCopyWithImpl;
@useResult
$Res call({
String id, String deviceIdentificator, String parentId, String firstName, String lastName, int bornAt, String walletId, String treezorUserId, String address, int createdAt
String id, String deviceIdentificator, String parentId, String firstName, String lastName, int bornAt, String walletId, String treezorUserId, String address, int createdAt, bool hasCardPin
});
@@ -62,7 +62,7 @@ class _$ChildProfileEntityCopyWithImpl<$Res>
/// Create a copy of ChildProfileEntity
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? deviceIdentificator = null,Object? parentId = null,Object? firstName = null,Object? lastName = null,Object? bornAt = null,Object? walletId = null,Object? treezorUserId = null,Object? address = null,Object? createdAt = null,}) {
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? deviceIdentificator = null,Object? parentId = null,Object? firstName = null,Object? lastName = null,Object? bornAt = null,Object? walletId = null,Object? treezorUserId = null,Object? address = null,Object? createdAt = null,Object? hasCardPin = null,}) {
return _then(_self.copyWith(
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String,deviceIdentificator: null == deviceIdentificator ? _self.deviceIdentificator : deviceIdentificator // ignore: cast_nullable_to_non_nullable
@@ -74,7 +74,8 @@ as int,walletId: null == walletId ? _self.walletId : walletId // ignore: cast_nu
as String,treezorUserId: null == treezorUserId ? _self.treezorUserId : treezorUserId // ignore: cast_nullable_to_non_nullable
as String,address: null == address ? _self.address : address // ignore: cast_nullable_to_non_nullable
as String,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
as int,
as int,hasCardPin: null == hasCardPin ? _self.hasCardPin : hasCardPin // ignore: cast_nullable_to_non_nullable
as bool,
));
}
@@ -159,10 +160,10 @@ return $default(_that);case _:
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String deviceIdentificator, String parentId, String firstName, String lastName, int bornAt, String walletId, String treezorUserId, String address, int createdAt)? $default,{required TResult orElse(),}) {final _that = this;
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String deviceIdentificator, String parentId, String firstName, String lastName, int bornAt, String walletId, String treezorUserId, String address, int createdAt, bool hasCardPin)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _ChildProfileEntity() when $default != null:
return $default(_that.id,_that.deviceIdentificator,_that.parentId,_that.firstName,_that.lastName,_that.bornAt,_that.walletId,_that.treezorUserId,_that.address,_that.createdAt);case _:
return $default(_that.id,_that.deviceIdentificator,_that.parentId,_that.firstName,_that.lastName,_that.bornAt,_that.walletId,_that.treezorUserId,_that.address,_that.createdAt,_that.hasCardPin);case _:
return orElse();
}
@@ -180,10 +181,10 @@ return $default(_that.id,_that.deviceIdentificator,_that.parentId,_that.firstNam
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, String deviceIdentificator, String parentId, String firstName, String lastName, int bornAt, String walletId, String treezorUserId, String address, int createdAt) $default,) {final _that = this;
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, String deviceIdentificator, String parentId, String firstName, String lastName, int bornAt, String walletId, String treezorUserId, String address, int createdAt, bool hasCardPin) $default,) {final _that = this;
switch (_that) {
case _ChildProfileEntity():
return $default(_that.id,_that.deviceIdentificator,_that.parentId,_that.firstName,_that.lastName,_that.bornAt,_that.walletId,_that.treezorUserId,_that.address,_that.createdAt);case _:
return $default(_that.id,_that.deviceIdentificator,_that.parentId,_that.firstName,_that.lastName,_that.bornAt,_that.walletId,_that.treezorUserId,_that.address,_that.createdAt,_that.hasCardPin);case _:
throw StateError('Unexpected subclass');
}
@@ -200,10 +201,10 @@ return $default(_that.id,_that.deviceIdentificator,_that.parentId,_that.firstNam
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String deviceIdentificator, String parentId, String firstName, String lastName, int bornAt, String walletId, String treezorUserId, String address, int createdAt)? $default,) {final _that = this;
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String deviceIdentificator, String parentId, String firstName, String lastName, int bornAt, String walletId, String treezorUserId, String address, int createdAt, bool hasCardPin)? $default,) {final _that = this;
switch (_that) {
case _ChildProfileEntity() when $default != null:
return $default(_that.id,_that.deviceIdentificator,_that.parentId,_that.firstName,_that.lastName,_that.bornAt,_that.walletId,_that.treezorUserId,_that.address,_that.createdAt);case _:
return $default(_that.id,_that.deviceIdentificator,_that.parentId,_that.firstName,_that.lastName,_that.bornAt,_that.walletId,_that.treezorUserId,_that.address,_that.createdAt,_that.hasCardPin);case _:
return null;
}
@@ -215,7 +216,7 @@ return $default(_that.id,_that.deviceIdentificator,_that.parentId,_that.firstNam
class _ChildProfileEntity implements ChildProfileEntity {
const _ChildProfileEntity({required this.id, required this.deviceIdentificator, required this.parentId, required this.firstName, required this.lastName, required this.bornAt, required this.walletId, required this.treezorUserId, required this.address, required this.createdAt});
const _ChildProfileEntity({required this.id, required this.deviceIdentificator, required this.parentId, required this.firstName, required this.lastName, required this.bornAt, required this.walletId, required this.treezorUserId, required this.address, required this.createdAt, this.hasCardPin = false});
@override final String id;
@@ -228,6 +229,7 @@ class _ChildProfileEntity implements ChildProfileEntity {
@override final String treezorUserId;
@override final String address;
@override final int createdAt;
@override@JsonKey() final bool hasCardPin;
/// Create a copy of ChildProfileEntity
/// with the given fields replaced by the non-null parameter values.
@@ -239,16 +241,16 @@ _$ChildProfileEntityCopyWith<_ChildProfileEntity> get copyWith => __$ChildProfil
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ChildProfileEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceIdentificator, deviceIdentificator) || other.deviceIdentificator == deviceIdentificator)&&(identical(other.parentId, parentId) || other.parentId == parentId)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.bornAt, bornAt) || other.bornAt == bornAt)&&(identical(other.walletId, walletId) || other.walletId == walletId)&&(identical(other.treezorUserId, treezorUserId) || other.treezorUserId == treezorUserId)&&(identical(other.address, address) || other.address == address)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt));
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ChildProfileEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceIdentificator, deviceIdentificator) || other.deviceIdentificator == deviceIdentificator)&&(identical(other.parentId, parentId) || other.parentId == parentId)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.bornAt, bornAt) || other.bornAt == bornAt)&&(identical(other.walletId, walletId) || other.walletId == walletId)&&(identical(other.treezorUserId, treezorUserId) || other.treezorUserId == treezorUserId)&&(identical(other.address, address) || other.address == address)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.hasCardPin, hasCardPin) || other.hasCardPin == hasCardPin));
}
@override
int get hashCode => Object.hash(runtimeType,id,deviceIdentificator,parentId,firstName,lastName,bornAt,walletId,treezorUserId,address,createdAt);
int get hashCode => Object.hash(runtimeType,id,deviceIdentificator,parentId,firstName,lastName,bornAt,walletId,treezorUserId,address,createdAt,hasCardPin);
@override
String toString() {
return 'ChildProfileEntity(id: $id, deviceIdentificator: $deviceIdentificator, parentId: $parentId, firstName: $firstName, lastName: $lastName, bornAt: $bornAt, walletId: $walletId, treezorUserId: $treezorUserId, address: $address, createdAt: $createdAt)';
return 'ChildProfileEntity(id: $id, deviceIdentificator: $deviceIdentificator, parentId: $parentId, firstName: $firstName, lastName: $lastName, bornAt: $bornAt, walletId: $walletId, treezorUserId: $treezorUserId, address: $address, createdAt: $createdAt, hasCardPin: $hasCardPin)';
}
@@ -259,7 +261,7 @@ abstract mixin class _$ChildProfileEntityCopyWith<$Res> implements $ChildProfile
factory _$ChildProfileEntityCopyWith(_ChildProfileEntity value, $Res Function(_ChildProfileEntity) _then) = __$ChildProfileEntityCopyWithImpl;
@override @useResult
$Res call({
String id, String deviceIdentificator, String parentId, String firstName, String lastName, int bornAt, String walletId, String treezorUserId, String address, int createdAt
String id, String deviceIdentificator, String parentId, String firstName, String lastName, int bornAt, String walletId, String treezorUserId, String address, int createdAt, bool hasCardPin
});
@@ -276,7 +278,7 @@ class __$ChildProfileEntityCopyWithImpl<$Res>
/// Create a copy of ChildProfileEntity
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? deviceIdentificator = null,Object? parentId = null,Object? firstName = null,Object? lastName = null,Object? bornAt = null,Object? walletId = null,Object? treezorUserId = null,Object? address = null,Object? createdAt = null,}) {
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? deviceIdentificator = null,Object? parentId = null,Object? firstName = null,Object? lastName = null,Object? bornAt = null,Object? walletId = null,Object? treezorUserId = null,Object? address = null,Object? createdAt = null,Object? hasCardPin = null,}) {
return _then(_ChildProfileEntity(
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String,deviceIdentificator: null == deviceIdentificator ? _self.deviceIdentificator : deviceIdentificator // ignore: cast_nullable_to_non_nullable
@@ -288,7 +290,8 @@ as int,walletId: null == walletId ? _self.walletId : walletId // ignore: cast_nu
as String,treezorUserId: null == treezorUserId ? _self.treezorUserId : treezorUserId // ignore: cast_nullable_to_non_nullable
as String,address: null == address ? _self.address : address // ignore: cast_nullable_to_non_nullable
as String,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
as int,
as int,hasCardPin: null == hasCardPin ? _self.hasCardPin : hasCardPin // ignore: cast_nullable_to_non_nullable
as bool,
));
}

View File

@@ -9,5 +9,6 @@ abstract class WalletCardEntity with _$WalletCardEntity {
required int walletId,
required int userId,
required String status,
@Default(false) bool isPinBlocked,
}) = _WalletCardEntity;
}

View File

@@ -14,7 +14,7 @@ T _$identity<T>(T value) => value;
/// @nodoc
mixin _$WalletCardEntity {
int get cardId; int get walletId; int get userId; String get status;
int get cardId; int get walletId; int get userId; String get status; bool get isPinBlocked;
/// Create a copy of WalletCardEntity
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -25,16 +25,16 @@ $WalletCardEntityCopyWith<WalletCardEntity> get copyWith => _$WalletCardEntityCo
@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));
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)&&(identical(other.isPinBlocked, isPinBlocked) || other.isPinBlocked == isPinBlocked));
}
@override
int get hashCode => Object.hash(runtimeType,cardId,walletId,userId,status);
int get hashCode => Object.hash(runtimeType,cardId,walletId,userId,status,isPinBlocked);
@override
String toString() {
return 'WalletCardEntity(cardId: $cardId, walletId: $walletId, userId: $userId, status: $status)';
return 'WalletCardEntity(cardId: $cardId, walletId: $walletId, userId: $userId, status: $status, isPinBlocked: $isPinBlocked)';
}
@@ -45,7 +45,7 @@ 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
int cardId, int walletId, int userId, String status, bool isPinBlocked
});
@@ -62,13 +62,14 @@ class _$WalletCardEntityCopyWithImpl<$Res>
/// 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,}) {
@pragma('vm:prefer-inline') @override $Res call({Object? cardId = null,Object? walletId = null,Object? userId = null,Object? status = null,Object? isPinBlocked = 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,
as String,isPinBlocked: null == isPinBlocked ? _self.isPinBlocked : isPinBlocked // ignore: cast_nullable_to_non_nullable
as bool,
));
}
@@ -153,10 +154,10 @@ return $default(_that);case _:
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( int cardId, int walletId, int userId, String status)? $default,{required TResult orElse(),}) {final _that = this;
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( int cardId, int walletId, int userId, String status, bool isPinBlocked)? $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 $default(_that.cardId,_that.walletId,_that.userId,_that.status,_that.isPinBlocked);case _:
return orElse();
}
@@ -174,10 +175,10 @@ return $default(_that.cardId,_that.walletId,_that.userId,_that.status);case _:
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( int cardId, int walletId, int userId, String status) $default,) {final _that = this;
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( int cardId, int walletId, int userId, String status, bool isPinBlocked) $default,) {final _that = this;
switch (_that) {
case _WalletCardEntity():
return $default(_that.cardId,_that.walletId,_that.userId,_that.status);case _:
return $default(_that.cardId,_that.walletId,_that.userId,_that.status,_that.isPinBlocked);case _:
throw StateError('Unexpected subclass');
}
@@ -194,10 +195,10 @@ return $default(_that.cardId,_that.walletId,_that.userId,_that.status);case _:
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( int cardId, int walletId, int userId, String status)? $default,) {final _that = this;
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( int cardId, int walletId, int userId, String status, bool isPinBlocked)? $default,) {final _that = this;
switch (_that) {
case _WalletCardEntity() when $default != null:
return $default(_that.cardId,_that.walletId,_that.userId,_that.status);case _:
return $default(_that.cardId,_that.walletId,_that.userId,_that.status,_that.isPinBlocked);case _:
return null;
}
@@ -209,13 +210,14 @@ return $default(_that.cardId,_that.walletId,_that.userId,_that.status);case _:
class _WalletCardEntity implements WalletCardEntity {
const _WalletCardEntity({required this.cardId, required this.walletId, required this.userId, required this.status});
const _WalletCardEntity({required this.cardId, required this.walletId, required this.userId, required this.status, this.isPinBlocked = false});
@override final int cardId;
@override final int walletId;
@override final int userId;
@override final String status;
@override@JsonKey() final bool isPinBlocked;
/// Create a copy of WalletCardEntity
/// with the given fields replaced by the non-null parameter values.
@@ -227,16 +229,16 @@ _$WalletCardEntityCopyWith<_WalletCardEntity> get copyWith => __$WalletCardEntit
@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));
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)&&(identical(other.isPinBlocked, isPinBlocked) || other.isPinBlocked == isPinBlocked));
}
@override
int get hashCode => Object.hash(runtimeType,cardId,walletId,userId,status);
int get hashCode => Object.hash(runtimeType,cardId,walletId,userId,status,isPinBlocked);
@override
String toString() {
return 'WalletCardEntity(cardId: $cardId, walletId: $walletId, userId: $userId, status: $status)';
return 'WalletCardEntity(cardId: $cardId, walletId: $walletId, userId: $userId, status: $status, isPinBlocked: $isPinBlocked)';
}
@@ -247,7 +249,7 @@ abstract mixin class _$WalletCardEntityCopyWith<$Res> implements $WalletCardEnti
factory _$WalletCardEntityCopyWith(_WalletCardEntity value, $Res Function(_WalletCardEntity) _then) = __$WalletCardEntityCopyWithImpl;
@override @useResult
$Res call({
int cardId, int walletId, int userId, String status
int cardId, int walletId, int userId, String status, bool isPinBlocked
});
@@ -264,13 +266,14 @@ class __$WalletCardEntityCopyWithImpl<$Res>
/// 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,}) {
@override @pragma('vm:prefer-inline') $Res call({Object? cardId = null,Object? walletId = null,Object? userId = null,Object? status = null,Object? isPinBlocked = 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,
as String,isPinBlocked: null == isPinBlocked ? _self.isPinBlocked : isPinBlocked // ignore: cast_nullable_to_non_nullable
as bool,
));
}

View File

@@ -100,4 +100,27 @@ abstract class TreezorRepository {
required String walletId,
required WalletLimitsEntity limits,
});
Future<void> setCardPin({
required String walletId,
required String newPin,
required String confirmPin,
required String scaProof,
});
Future<void> changeCardPin({
required String walletId,
required String currentPin,
required String newPin,
required String confirmPin,
required String scaProof,
});
Future<void> unblockCardPin({required String walletId});
Future<void> renewCard({
required String childProfileId,
required String publicToken,
required String scaProof,
});
}