44 lines
1.2 KiB
Dart
44 lines
1.2 KiB
Dart
part of '../wallet_dtos.dart';
|
|||
|
|
|
||
|
|
@freezed
|
||
|
|
abstract class PinStatusDto with _$PinStatusDto {
|
||
|
|
const factory PinStatusDto({
|
||
|
|
@JsonKey(name: 'has_pin') bool? hasPin,
|
||
|
|
@JsonKey(name: 'locked_until') String? lockedUntil,
|
||
|
|
@JsonKey(name: 'transfer_blocked_until') String? transferBlockedUntil,
|
||
|
|
}) = _PinStatusDto;
|
||
|
|
|
||
|
|
factory PinStatusDto.fromJson(Map<String, dynamic> json) =>
|
||
|
|
_$PinStatusDtoFromJson(json);
|
||
|
|
|
||
|
|
const PinStatusDto._();
|
||
|
|
|
||
|
|
PinStatus toDomain() => PinStatus(
|
||
|
|
hasPin: hasPin ?? false,
|
||
|
|
lockedUntil: _parseDateTime(lockedUntil),
|
||
|
|
transferBlockedUntil: _parseDateTime(transferBlockedUntil),
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
@freezed
|
||
|
|
abstract class PinOtpDto with _$PinOtpDto {
|
||
|
|
const factory PinOtpDto({
|
||
|
|
@JsonKey(name: 'purpose') String? purpose,
|
||
|
|
@JsonKey(name: 'otp_token') String? otpToken,
|
||
|
|
@JsonKey(name: 'expires_at') String? expiresAt,
|
||
|
|
}) = _PinOtpDto;
|
||
|
|
|
||
|
|
factory PinOtpDto.fromJson(Map<String, dynamic> json) =>
|
||
|
|
_$PinOtpDtoFromJson(json);
|
||
|
|
|
||
|
|
const PinOtpDto._();
|
||
|
|
|
||
|
|
PinOtp toDomain() => PinOtp(
|
||
|
|
purpose: purpose == PinOtpPurpose.reset.apiValue
|
||
|
|
? PinOtpPurpose.reset
|
||
|
|
: PinOtpPurpose.setup,
|
||
|
|
otpToken: otpToken ?? '',
|
||
|
|
expiresAt: _parseDateTime(expiresAt),
|
||
|
|
);
|
||
|
|
}
|