diff --git a/apps/mobile_app/config/development.json b/apps/mobile_app/config/development.json index 638b13e4..9ad21f44 100644 --- a/apps/mobile_app/config/development.json +++ b/apps/mobile_app/config/development.json @@ -1,5 +1,5 @@ { "env": "development", "apiBaseUrl": "https://api-neki-b2b.neki.es/gateway/api/", - "apiOrigin": "bde6ea73-d09c-475f-aabf-1d11137e4d0d" -} + "apiOrigin": "https://neki-b2b.neki.es" +} \ No newline at end of file diff --git a/modules/profile/lib/src/features/payout/presentation/payout_view_model.dart b/modules/profile/lib/src/features/payout/presentation/payout_view_model.dart index d3752f4d..986c83a7 100644 --- a/modules/profile/lib/src/features/payout/presentation/payout_view_model.dart +++ b/modules/profile/lib/src/features/payout/presentation/payout_view_model.dart @@ -298,11 +298,13 @@ class PayoutViewModel extends Notifier { try { final treezorRepo = ref.read(treezorRepositoryProvider); - final beneficiaryValidationId = await treezorRepo + final validation = await treezorRepo .validateTransactionBeneficiary(beneficiaryId: beneficiary.id); if (!ref.mounted) return; + final beneficiaryValidationId = validation.beneficiaryValidationId; + final url = 'https://savefamily.sandbox.treezor.co/v1/payouts'; final scaInput = { 'url': url, diff --git a/packages/sf_shared/lib/sf_shared.dart b/packages/sf_shared/lib/sf_shared.dart index 1173b608..8f534c0b 100644 --- a/packages/sf_shared/lib/sf_shared.dart +++ b/packages/sf_shared/lib/sf_shared.dart @@ -29,6 +29,7 @@ export 'src/providers/user_info_provider.dart'; export 'src/domain/repositories/user_repository.dart'; export 'src/data/repositories/user_repository_impl.dart'; export 'src/data/datasource/user_remote_datasource_impl.dart'; +export 'src/domain/entities/beneficiary_validation_entity.dart'; export 'src/domain/entities/transaction_beneficiary_entity.dart'; export 'src/data/models/payout_beneficiary_model.dart'; export 'src/domain/entities/payout_beneficiary_entity.dart'; diff --git a/packages/sf_shared/lib/src/data/datasource/treezor_remote_data_source.dart b/packages/sf_shared/lib/src/data/datasource/treezor_remote_data_source.dart index 72916962..23554658 100644 --- a/packages/sf_shared/lib/src/data/datasource/treezor_remote_data_source.dart +++ b/packages/sf_shared/lib/src/data/datasource/treezor_remote_data_source.dart @@ -3,6 +3,7 @@ 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/beneficiary_validation_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'; @@ -41,7 +42,7 @@ abstract class TreezorRemoteDatasource { required String scaProof, }); - Future validateTransactionBeneficiary({required int beneficiaryId}); + Future validateTransactionBeneficiary({required int beneficiaryId}); Future walletTransfer({ required int beneficiaryId, diff --git a/packages/sf_shared/lib/src/data/datasource/treezor_remote_data_source_impl.dart b/packages/sf_shared/lib/src/data/datasource/treezor_remote_data_source_impl.dart index e54f8931..72692b0e 100644 --- a/packages/sf_shared/lib/src/data/datasource/treezor_remote_data_source_impl.dart +++ b/packages/sf_shared/lib/src/data/datasource/treezor_remote_data_source_impl.dart @@ -7,6 +7,7 @@ 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/beneficiary_validation_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'; @@ -241,7 +242,7 @@ class TreezorRemoteDatasourceImpl implements TreezorRemoteDatasource { } @override - Future validateTransactionBeneficiary({ + Future validateTransactionBeneficiary({ required int beneficiaryId, }) async { try { @@ -254,7 +255,9 @@ class TreezorRemoteDatasourceImpl implements TreezorRemoteDatasource { 'Invalid response from /transaction-beneficiaries/$beneficiaryId/validation', ); } - return data['item'] as String; + return BeneficiaryValidationResponseModel.fromJson( + Map.from(data), + ); } on DioException catch (error) { throw _mapDioError( error, diff --git a/packages/sf_shared/lib/src/data/models/beneficiary_validation_model.dart b/packages/sf_shared/lib/src/data/models/beneficiary_validation_model.dart new file mode 100644 index 00000000..099e115b --- /dev/null +++ b/packages/sf_shared/lib/src/data/models/beneficiary_validation_model.dart @@ -0,0 +1,54 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:sf_shared/src/domain/entities/beneficiary_validation_entity.dart'; + +part 'beneficiary_validation_model.freezed.dart'; +part 'beneficiary_validation_model.g.dart'; + +@freezed +abstract class BeneficiaryValidationResponseModel + with _$BeneficiaryValidationResponseModel { + const BeneficiaryValidationResponseModel._(); + + const factory BeneficiaryValidationResponseModel({ + @Default(false) bool isCreated, + required BeneficiaryValidationItemModel item, + }) = _BeneficiaryValidationResponseModel; + + factory BeneficiaryValidationResponseModel.fromJson( + Map json, + ) => + _$BeneficiaryValidationResponseModelFromJson(json); + + BeneficiaryValidationEntity toEntity() => BeneficiaryValidationEntity( + isCreated: isCreated, + beneficiaryValidationId: item.beneficiaryValidationId, + createdDate: item.createdDate, + vopResult: item.vop?.result ?? '', + ); +} + +@freezed +abstract class BeneficiaryValidationItemModel + with _$BeneficiaryValidationItemModel { + const factory BeneficiaryValidationItemModel({ + required String beneficiaryValidationId, + @Default('') String createdDate, + BeneficiaryValidationVopModel? vop, + }) = _BeneficiaryValidationItemModel; + + factory BeneficiaryValidationItemModel.fromJson(Map json) => + _$BeneficiaryValidationItemModelFromJson(json); +} + +@freezed +abstract class BeneficiaryValidationVopModel + with _$BeneficiaryValidationVopModel { + const factory BeneficiaryValidationVopModel({ + @Default('') String matchedName, + @Default('') String recurrenceType, + @Default('') String result, + }) = _BeneficiaryValidationVopModel; + + factory BeneficiaryValidationVopModel.fromJson(Map json) => + _$BeneficiaryValidationVopModelFromJson(json); +} diff --git a/packages/sf_shared/lib/src/data/models/beneficiary_validation_model.freezed.dart b/packages/sf_shared/lib/src/data/models/beneficiary_validation_model.freezed.dart new file mode 100644 index 00000000..e368a420 --- /dev/null +++ b/packages/sf_shared/lib/src/data/models/beneficiary_validation_model.freezed.dart @@ -0,0 +1,860 @@ +// 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 'beneficiary_validation_model.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; + +/// @nodoc +mixin _$BeneficiaryValidationResponseModel { + + bool get isCreated; BeneficiaryValidationItemModel get item; +/// Create a copy of BeneficiaryValidationResponseModel +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$BeneficiaryValidationResponseModelCopyWith get copyWith => _$BeneficiaryValidationResponseModelCopyWithImpl(this as BeneficiaryValidationResponseModel, _$identity); + + /// Serializes this BeneficiaryValidationResponseModel to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is BeneficiaryValidationResponseModel&&(identical(other.isCreated, isCreated) || other.isCreated == isCreated)&&(identical(other.item, item) || other.item == item)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,isCreated,item); + +@override +String toString() { + return 'BeneficiaryValidationResponseModel(isCreated: $isCreated, item: $item)'; +} + + +} + +/// @nodoc +abstract mixin class $BeneficiaryValidationResponseModelCopyWith<$Res> { + factory $BeneficiaryValidationResponseModelCopyWith(BeneficiaryValidationResponseModel value, $Res Function(BeneficiaryValidationResponseModel) _then) = _$BeneficiaryValidationResponseModelCopyWithImpl; +@useResult +$Res call({ + bool isCreated, BeneficiaryValidationItemModel item +}); + + +$BeneficiaryValidationItemModelCopyWith<$Res> get item; + +} +/// @nodoc +class _$BeneficiaryValidationResponseModelCopyWithImpl<$Res> + implements $BeneficiaryValidationResponseModelCopyWith<$Res> { + _$BeneficiaryValidationResponseModelCopyWithImpl(this._self, this._then); + + final BeneficiaryValidationResponseModel _self; + final $Res Function(BeneficiaryValidationResponseModel) _then; + +/// Create a copy of BeneficiaryValidationResponseModel +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? isCreated = null,Object? item = null,}) { + return _then(_self.copyWith( +isCreated: null == isCreated ? _self.isCreated : isCreated // ignore: cast_nullable_to_non_nullable +as bool,item: null == item ? _self.item : item // ignore: cast_nullable_to_non_nullable +as BeneficiaryValidationItemModel, + )); +} +/// Create a copy of BeneficiaryValidationResponseModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$BeneficiaryValidationItemModelCopyWith<$Res> get item { + + return $BeneficiaryValidationItemModelCopyWith<$Res>(_self.item, (value) { + return _then(_self.copyWith(item: value)); + }); +} +} + + +/// Adds pattern-matching-related methods to [BeneficiaryValidationResponseModel]. +extension BeneficiaryValidationResponseModelPatterns on BeneficiaryValidationResponseModel { +/// 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 Function( _BeneficiaryValidationResponseModel value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _BeneficiaryValidationResponseModel() 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 Function( _BeneficiaryValidationResponseModel value) $default,){ +final _that = this; +switch (_that) { +case _BeneficiaryValidationResponseModel(): +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? Function( _BeneficiaryValidationResponseModel value)? $default,){ +final _that = this; +switch (_that) { +case _BeneficiaryValidationResponseModel() 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 Function( bool isCreated, BeneficiaryValidationItemModel item)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _BeneficiaryValidationResponseModel() when $default != null: +return $default(_that.isCreated,_that.item);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 Function( bool isCreated, BeneficiaryValidationItemModel item) $default,) {final _that = this; +switch (_that) { +case _BeneficiaryValidationResponseModel(): +return $default(_that.isCreated,_that.item);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? Function( bool isCreated, BeneficiaryValidationItemModel item)? $default,) {final _that = this; +switch (_that) { +case _BeneficiaryValidationResponseModel() when $default != null: +return $default(_that.isCreated,_that.item);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _BeneficiaryValidationResponseModel extends BeneficiaryValidationResponseModel { + const _BeneficiaryValidationResponseModel({this.isCreated = false, required this.item}): super._(); + factory _BeneficiaryValidationResponseModel.fromJson(Map json) => _$BeneficiaryValidationResponseModelFromJson(json); + +@override@JsonKey() final bool isCreated; +@override final BeneficiaryValidationItemModel item; + +/// Create a copy of BeneficiaryValidationResponseModel +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$BeneficiaryValidationResponseModelCopyWith<_BeneficiaryValidationResponseModel> get copyWith => __$BeneficiaryValidationResponseModelCopyWithImpl<_BeneficiaryValidationResponseModel>(this, _$identity); + +@override +Map toJson() { + return _$BeneficiaryValidationResponseModelToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _BeneficiaryValidationResponseModel&&(identical(other.isCreated, isCreated) || other.isCreated == isCreated)&&(identical(other.item, item) || other.item == item)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,isCreated,item); + +@override +String toString() { + return 'BeneficiaryValidationResponseModel(isCreated: $isCreated, item: $item)'; +} + + +} + +/// @nodoc +abstract mixin class _$BeneficiaryValidationResponseModelCopyWith<$Res> implements $BeneficiaryValidationResponseModelCopyWith<$Res> { + factory _$BeneficiaryValidationResponseModelCopyWith(_BeneficiaryValidationResponseModel value, $Res Function(_BeneficiaryValidationResponseModel) _then) = __$BeneficiaryValidationResponseModelCopyWithImpl; +@override @useResult +$Res call({ + bool isCreated, BeneficiaryValidationItemModel item +}); + + +@override $BeneficiaryValidationItemModelCopyWith<$Res> get item; + +} +/// @nodoc +class __$BeneficiaryValidationResponseModelCopyWithImpl<$Res> + implements _$BeneficiaryValidationResponseModelCopyWith<$Res> { + __$BeneficiaryValidationResponseModelCopyWithImpl(this._self, this._then); + + final _BeneficiaryValidationResponseModel _self; + final $Res Function(_BeneficiaryValidationResponseModel) _then; + +/// Create a copy of BeneficiaryValidationResponseModel +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? isCreated = null,Object? item = null,}) { + return _then(_BeneficiaryValidationResponseModel( +isCreated: null == isCreated ? _self.isCreated : isCreated // ignore: cast_nullable_to_non_nullable +as bool,item: null == item ? _self.item : item // ignore: cast_nullable_to_non_nullable +as BeneficiaryValidationItemModel, + )); +} + +/// Create a copy of BeneficiaryValidationResponseModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$BeneficiaryValidationItemModelCopyWith<$Res> get item { + + return $BeneficiaryValidationItemModelCopyWith<$Res>(_self.item, (value) { + return _then(_self.copyWith(item: value)); + }); +} +} + + +/// @nodoc +mixin _$BeneficiaryValidationItemModel { + + String get beneficiaryValidationId; String get createdDate; BeneficiaryValidationVopModel? get vop; +/// Create a copy of BeneficiaryValidationItemModel +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$BeneficiaryValidationItemModelCopyWith get copyWith => _$BeneficiaryValidationItemModelCopyWithImpl(this as BeneficiaryValidationItemModel, _$identity); + + /// Serializes this BeneficiaryValidationItemModel to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is BeneficiaryValidationItemModel&&(identical(other.beneficiaryValidationId, beneficiaryValidationId) || other.beneficiaryValidationId == beneficiaryValidationId)&&(identical(other.createdDate, createdDate) || other.createdDate == createdDate)&&(identical(other.vop, vop) || other.vop == vop)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,beneficiaryValidationId,createdDate,vop); + +@override +String toString() { + return 'BeneficiaryValidationItemModel(beneficiaryValidationId: $beneficiaryValidationId, createdDate: $createdDate, vop: $vop)'; +} + + +} + +/// @nodoc +abstract mixin class $BeneficiaryValidationItemModelCopyWith<$Res> { + factory $BeneficiaryValidationItemModelCopyWith(BeneficiaryValidationItemModel value, $Res Function(BeneficiaryValidationItemModel) _then) = _$BeneficiaryValidationItemModelCopyWithImpl; +@useResult +$Res call({ + String beneficiaryValidationId, String createdDate, BeneficiaryValidationVopModel? vop +}); + + +$BeneficiaryValidationVopModelCopyWith<$Res>? get vop; + +} +/// @nodoc +class _$BeneficiaryValidationItemModelCopyWithImpl<$Res> + implements $BeneficiaryValidationItemModelCopyWith<$Res> { + _$BeneficiaryValidationItemModelCopyWithImpl(this._self, this._then); + + final BeneficiaryValidationItemModel _self; + final $Res Function(BeneficiaryValidationItemModel) _then; + +/// Create a copy of BeneficiaryValidationItemModel +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? beneficiaryValidationId = null,Object? createdDate = null,Object? vop = freezed,}) { + return _then(_self.copyWith( +beneficiaryValidationId: null == beneficiaryValidationId ? _self.beneficiaryValidationId : beneficiaryValidationId // ignore: cast_nullable_to_non_nullable +as String,createdDate: null == createdDate ? _self.createdDate : createdDate // ignore: cast_nullable_to_non_nullable +as String,vop: freezed == vop ? _self.vop : vop // ignore: cast_nullable_to_non_nullable +as BeneficiaryValidationVopModel?, + )); +} +/// Create a copy of BeneficiaryValidationItemModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$BeneficiaryValidationVopModelCopyWith<$Res>? get vop { + if (_self.vop == null) { + return null; + } + + return $BeneficiaryValidationVopModelCopyWith<$Res>(_self.vop!, (value) { + return _then(_self.copyWith(vop: value)); + }); +} +} + + +/// Adds pattern-matching-related methods to [BeneficiaryValidationItemModel]. +extension BeneficiaryValidationItemModelPatterns on BeneficiaryValidationItemModel { +/// 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 Function( _BeneficiaryValidationItemModel value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _BeneficiaryValidationItemModel() 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 Function( _BeneficiaryValidationItemModel value) $default,){ +final _that = this; +switch (_that) { +case _BeneficiaryValidationItemModel(): +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? Function( _BeneficiaryValidationItemModel value)? $default,){ +final _that = this; +switch (_that) { +case _BeneficiaryValidationItemModel() 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 Function( String beneficiaryValidationId, String createdDate, BeneficiaryValidationVopModel? vop)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _BeneficiaryValidationItemModel() when $default != null: +return $default(_that.beneficiaryValidationId,_that.createdDate,_that.vop);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 Function( String beneficiaryValidationId, String createdDate, BeneficiaryValidationVopModel? vop) $default,) {final _that = this; +switch (_that) { +case _BeneficiaryValidationItemModel(): +return $default(_that.beneficiaryValidationId,_that.createdDate,_that.vop);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? Function( String beneficiaryValidationId, String createdDate, BeneficiaryValidationVopModel? vop)? $default,) {final _that = this; +switch (_that) { +case _BeneficiaryValidationItemModel() when $default != null: +return $default(_that.beneficiaryValidationId,_that.createdDate,_that.vop);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _BeneficiaryValidationItemModel implements BeneficiaryValidationItemModel { + const _BeneficiaryValidationItemModel({required this.beneficiaryValidationId, this.createdDate = '', this.vop}); + factory _BeneficiaryValidationItemModel.fromJson(Map json) => _$BeneficiaryValidationItemModelFromJson(json); + +@override final String beneficiaryValidationId; +@override@JsonKey() final String createdDate; +@override final BeneficiaryValidationVopModel? vop; + +/// Create a copy of BeneficiaryValidationItemModel +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$BeneficiaryValidationItemModelCopyWith<_BeneficiaryValidationItemModel> get copyWith => __$BeneficiaryValidationItemModelCopyWithImpl<_BeneficiaryValidationItemModel>(this, _$identity); + +@override +Map toJson() { + return _$BeneficiaryValidationItemModelToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _BeneficiaryValidationItemModel&&(identical(other.beneficiaryValidationId, beneficiaryValidationId) || other.beneficiaryValidationId == beneficiaryValidationId)&&(identical(other.createdDate, createdDate) || other.createdDate == createdDate)&&(identical(other.vop, vop) || other.vop == vop)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,beneficiaryValidationId,createdDate,vop); + +@override +String toString() { + return 'BeneficiaryValidationItemModel(beneficiaryValidationId: $beneficiaryValidationId, createdDate: $createdDate, vop: $vop)'; +} + + +} + +/// @nodoc +abstract mixin class _$BeneficiaryValidationItemModelCopyWith<$Res> implements $BeneficiaryValidationItemModelCopyWith<$Res> { + factory _$BeneficiaryValidationItemModelCopyWith(_BeneficiaryValidationItemModel value, $Res Function(_BeneficiaryValidationItemModel) _then) = __$BeneficiaryValidationItemModelCopyWithImpl; +@override @useResult +$Res call({ + String beneficiaryValidationId, String createdDate, BeneficiaryValidationVopModel? vop +}); + + +@override $BeneficiaryValidationVopModelCopyWith<$Res>? get vop; + +} +/// @nodoc +class __$BeneficiaryValidationItemModelCopyWithImpl<$Res> + implements _$BeneficiaryValidationItemModelCopyWith<$Res> { + __$BeneficiaryValidationItemModelCopyWithImpl(this._self, this._then); + + final _BeneficiaryValidationItemModel _self; + final $Res Function(_BeneficiaryValidationItemModel) _then; + +/// Create a copy of BeneficiaryValidationItemModel +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? beneficiaryValidationId = null,Object? createdDate = null,Object? vop = freezed,}) { + return _then(_BeneficiaryValidationItemModel( +beneficiaryValidationId: null == beneficiaryValidationId ? _self.beneficiaryValidationId : beneficiaryValidationId // ignore: cast_nullable_to_non_nullable +as String,createdDate: null == createdDate ? _self.createdDate : createdDate // ignore: cast_nullable_to_non_nullable +as String,vop: freezed == vop ? _self.vop : vop // ignore: cast_nullable_to_non_nullable +as BeneficiaryValidationVopModel?, + )); +} + +/// Create a copy of BeneficiaryValidationItemModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$BeneficiaryValidationVopModelCopyWith<$Res>? get vop { + if (_self.vop == null) { + return null; + } + + return $BeneficiaryValidationVopModelCopyWith<$Res>(_self.vop!, (value) { + return _then(_self.copyWith(vop: value)); + }); +} +} + + +/// @nodoc +mixin _$BeneficiaryValidationVopModel { + + String get matchedName; String get recurrenceType; String get result; +/// Create a copy of BeneficiaryValidationVopModel +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$BeneficiaryValidationVopModelCopyWith get copyWith => _$BeneficiaryValidationVopModelCopyWithImpl(this as BeneficiaryValidationVopModel, _$identity); + + /// Serializes this BeneficiaryValidationVopModel to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is BeneficiaryValidationVopModel&&(identical(other.matchedName, matchedName) || other.matchedName == matchedName)&&(identical(other.recurrenceType, recurrenceType) || other.recurrenceType == recurrenceType)&&(identical(other.result, result) || other.result == result)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,matchedName,recurrenceType,result); + +@override +String toString() { + return 'BeneficiaryValidationVopModel(matchedName: $matchedName, recurrenceType: $recurrenceType, result: $result)'; +} + + +} + +/// @nodoc +abstract mixin class $BeneficiaryValidationVopModelCopyWith<$Res> { + factory $BeneficiaryValidationVopModelCopyWith(BeneficiaryValidationVopModel value, $Res Function(BeneficiaryValidationVopModel) _then) = _$BeneficiaryValidationVopModelCopyWithImpl; +@useResult +$Res call({ + String matchedName, String recurrenceType, String result +}); + + + + +} +/// @nodoc +class _$BeneficiaryValidationVopModelCopyWithImpl<$Res> + implements $BeneficiaryValidationVopModelCopyWith<$Res> { + _$BeneficiaryValidationVopModelCopyWithImpl(this._self, this._then); + + final BeneficiaryValidationVopModel _self; + final $Res Function(BeneficiaryValidationVopModel) _then; + +/// Create a copy of BeneficiaryValidationVopModel +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? matchedName = null,Object? recurrenceType = null,Object? result = null,}) { + return _then(_self.copyWith( +matchedName: null == matchedName ? _self.matchedName : matchedName // ignore: cast_nullable_to_non_nullable +as String,recurrenceType: null == recurrenceType ? _self.recurrenceType : recurrenceType // ignore: cast_nullable_to_non_nullable +as String,result: null == result ? _self.result : result // ignore: cast_nullable_to_non_nullable +as String, + )); +} + +} + + +/// Adds pattern-matching-related methods to [BeneficiaryValidationVopModel]. +extension BeneficiaryValidationVopModelPatterns on BeneficiaryValidationVopModel { +/// 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 Function( _BeneficiaryValidationVopModel value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _BeneficiaryValidationVopModel() 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 Function( _BeneficiaryValidationVopModel value) $default,){ +final _that = this; +switch (_that) { +case _BeneficiaryValidationVopModel(): +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? Function( _BeneficiaryValidationVopModel value)? $default,){ +final _that = this; +switch (_that) { +case _BeneficiaryValidationVopModel() 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 Function( String matchedName, String recurrenceType, String result)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _BeneficiaryValidationVopModel() when $default != null: +return $default(_that.matchedName,_that.recurrenceType,_that.result);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 Function( String matchedName, String recurrenceType, String result) $default,) {final _that = this; +switch (_that) { +case _BeneficiaryValidationVopModel(): +return $default(_that.matchedName,_that.recurrenceType,_that.result);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? Function( String matchedName, String recurrenceType, String result)? $default,) {final _that = this; +switch (_that) { +case _BeneficiaryValidationVopModel() when $default != null: +return $default(_that.matchedName,_that.recurrenceType,_that.result);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _BeneficiaryValidationVopModel implements BeneficiaryValidationVopModel { + const _BeneficiaryValidationVopModel({this.matchedName = '', this.recurrenceType = '', this.result = ''}); + factory _BeneficiaryValidationVopModel.fromJson(Map json) => _$BeneficiaryValidationVopModelFromJson(json); + +@override@JsonKey() final String matchedName; +@override@JsonKey() final String recurrenceType; +@override@JsonKey() final String result; + +/// Create a copy of BeneficiaryValidationVopModel +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$BeneficiaryValidationVopModelCopyWith<_BeneficiaryValidationVopModel> get copyWith => __$BeneficiaryValidationVopModelCopyWithImpl<_BeneficiaryValidationVopModel>(this, _$identity); + +@override +Map toJson() { + return _$BeneficiaryValidationVopModelToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _BeneficiaryValidationVopModel&&(identical(other.matchedName, matchedName) || other.matchedName == matchedName)&&(identical(other.recurrenceType, recurrenceType) || other.recurrenceType == recurrenceType)&&(identical(other.result, result) || other.result == result)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,matchedName,recurrenceType,result); + +@override +String toString() { + return 'BeneficiaryValidationVopModel(matchedName: $matchedName, recurrenceType: $recurrenceType, result: $result)'; +} + + +} + +/// @nodoc +abstract mixin class _$BeneficiaryValidationVopModelCopyWith<$Res> implements $BeneficiaryValidationVopModelCopyWith<$Res> { + factory _$BeneficiaryValidationVopModelCopyWith(_BeneficiaryValidationVopModel value, $Res Function(_BeneficiaryValidationVopModel) _then) = __$BeneficiaryValidationVopModelCopyWithImpl; +@override @useResult +$Res call({ + String matchedName, String recurrenceType, String result +}); + + + + +} +/// @nodoc +class __$BeneficiaryValidationVopModelCopyWithImpl<$Res> + implements _$BeneficiaryValidationVopModelCopyWith<$Res> { + __$BeneficiaryValidationVopModelCopyWithImpl(this._self, this._then); + + final _BeneficiaryValidationVopModel _self; + final $Res Function(_BeneficiaryValidationVopModel) _then; + +/// Create a copy of BeneficiaryValidationVopModel +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? matchedName = null,Object? recurrenceType = null,Object? result = null,}) { + return _then(_BeneficiaryValidationVopModel( +matchedName: null == matchedName ? _self.matchedName : matchedName // ignore: cast_nullable_to_non_nullable +as String,recurrenceType: null == recurrenceType ? _self.recurrenceType : recurrenceType // ignore: cast_nullable_to_non_nullable +as String,result: null == result ? _self.result : result // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + +// dart format on diff --git a/packages/sf_shared/lib/src/data/models/beneficiary_validation_model.g.dart b/packages/sf_shared/lib/src/data/models/beneficiary_validation_model.g.dart new file mode 100644 index 00000000..3ccbe59f --- /dev/null +++ b/packages/sf_shared/lib/src/data/models/beneficiary_validation_model.g.dart @@ -0,0 +1,56 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'beneficiary_validation_model.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_BeneficiaryValidationResponseModel +_$BeneficiaryValidationResponseModelFromJson(Map json) => + _BeneficiaryValidationResponseModel( + isCreated: json['isCreated'] as bool? ?? false, + item: BeneficiaryValidationItemModel.fromJson( + json['item'] as Map, + ), + ); + +Map _$BeneficiaryValidationResponseModelToJson( + _BeneficiaryValidationResponseModel instance, +) => {'isCreated': instance.isCreated, 'item': instance.item}; + +_BeneficiaryValidationItemModel _$BeneficiaryValidationItemModelFromJson( + Map json, +) => _BeneficiaryValidationItemModel( + beneficiaryValidationId: json['beneficiaryValidationId'] as String, + createdDate: json['createdDate'] as String? ?? '', + vop: json['vop'] == null + ? null + : BeneficiaryValidationVopModel.fromJson( + json['vop'] as Map, + ), +); + +Map _$BeneficiaryValidationItemModelToJson( + _BeneficiaryValidationItemModel instance, +) => { + 'beneficiaryValidationId': instance.beneficiaryValidationId, + 'createdDate': instance.createdDate, + 'vop': instance.vop, +}; + +_BeneficiaryValidationVopModel _$BeneficiaryValidationVopModelFromJson( + Map json, +) => _BeneficiaryValidationVopModel( + matchedName: json['matchedName'] as String? ?? '', + recurrenceType: json['recurrenceType'] as String? ?? '', + result: json['result'] as String? ?? '', +); + +Map _$BeneficiaryValidationVopModelToJson( + _BeneficiaryValidationVopModel instance, +) => { + 'matchedName': instance.matchedName, + 'recurrenceType': instance.recurrenceType, + 'result': instance.result, +}; diff --git a/packages/sf_shared/lib/src/data/repositories/treezor_repository_impl.dart b/packages/sf_shared/lib/src/data/repositories/treezor_repository_impl.dart index abf0455a..36a1dfae 100644 --- a/packages/sf_shared/lib/src/data/repositories/treezor_repository_impl.dart +++ b/packages/sf_shared/lib/src/data/repositories/treezor_repository_impl.dart @@ -14,6 +14,7 @@ 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'; import 'package:sf_shared/src/domain/entities/sca_wallet_entity.dart'; +import 'package:sf_shared/src/domain/entities/beneficiary_validation_entity.dart'; import 'package:sf_shared/src/domain/entities/transaction_beneficiary_entity.dart'; import 'package:sf_shared/src/domain/entities/wallet_balance_entity.dart'; import 'package:sf_shared/src/domain/entities/wallet_transaction_entity.dart'; @@ -185,12 +186,13 @@ class TreezorRepositoryImpl implements TreezorRepository { } @override - Future validateTransactionBeneficiary({ + Future validateTransactionBeneficiary({ required int beneficiaryId, }) async { - return _remote.validateTransactionBeneficiary( + final model = await _remote.validateTransactionBeneficiary( beneficiaryId: beneficiaryId, ); + return model.toEntity(); } @override diff --git a/packages/sf_shared/lib/src/domain/entities/beneficiary_validation_entity.dart b/packages/sf_shared/lib/src/domain/entities/beneficiary_validation_entity.dart new file mode 100644 index 00000000..4743c282 --- /dev/null +++ b/packages/sf_shared/lib/src/domain/entities/beneficiary_validation_entity.dart @@ -0,0 +1,14 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'beneficiary_validation_entity.freezed.dart'; + +@freezed +abstract class BeneficiaryValidationEntity + with _$BeneficiaryValidationEntity { + const factory BeneficiaryValidationEntity({ + @Default(false) bool isCreated, + required String beneficiaryValidationId, + @Default('') String createdDate, + @Default('') String vopResult, + }) = _BeneficiaryValidationEntity; +} diff --git a/packages/sf_shared/lib/src/domain/entities/beneficiary_validation_entity.freezed.dart b/packages/sf_shared/lib/src/domain/entities/beneficiary_validation_entity.freezed.dart new file mode 100644 index 00000000..ec872419 --- /dev/null +++ b/packages/sf_shared/lib/src/domain/entities/beneficiary_validation_entity.freezed.dart @@ -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 'beneficiary_validation_entity.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$BeneficiaryValidationEntity { + + bool get isCreated; String get beneficiaryValidationId; String get createdDate; String get vopResult; +/// Create a copy of BeneficiaryValidationEntity +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$BeneficiaryValidationEntityCopyWith get copyWith => _$BeneficiaryValidationEntityCopyWithImpl(this as BeneficiaryValidationEntity, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is BeneficiaryValidationEntity&&(identical(other.isCreated, isCreated) || other.isCreated == isCreated)&&(identical(other.beneficiaryValidationId, beneficiaryValidationId) || other.beneficiaryValidationId == beneficiaryValidationId)&&(identical(other.createdDate, createdDate) || other.createdDate == createdDate)&&(identical(other.vopResult, vopResult) || other.vopResult == vopResult)); +} + + +@override +int get hashCode => Object.hash(runtimeType,isCreated,beneficiaryValidationId,createdDate,vopResult); + +@override +String toString() { + return 'BeneficiaryValidationEntity(isCreated: $isCreated, beneficiaryValidationId: $beneficiaryValidationId, createdDate: $createdDate, vopResult: $vopResult)'; +} + + +} + +/// @nodoc +abstract mixin class $BeneficiaryValidationEntityCopyWith<$Res> { + factory $BeneficiaryValidationEntityCopyWith(BeneficiaryValidationEntity value, $Res Function(BeneficiaryValidationEntity) _then) = _$BeneficiaryValidationEntityCopyWithImpl; +@useResult +$Res call({ + bool isCreated, String beneficiaryValidationId, String createdDate, String vopResult +}); + + + + +} +/// @nodoc +class _$BeneficiaryValidationEntityCopyWithImpl<$Res> + implements $BeneficiaryValidationEntityCopyWith<$Res> { + _$BeneficiaryValidationEntityCopyWithImpl(this._self, this._then); + + final BeneficiaryValidationEntity _self; + final $Res Function(BeneficiaryValidationEntity) _then; + +/// Create a copy of BeneficiaryValidationEntity +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? isCreated = null,Object? beneficiaryValidationId = null,Object? createdDate = null,Object? vopResult = null,}) { + return _then(_self.copyWith( +isCreated: null == isCreated ? _self.isCreated : isCreated // ignore: cast_nullable_to_non_nullable +as bool,beneficiaryValidationId: null == beneficiaryValidationId ? _self.beneficiaryValidationId : beneficiaryValidationId // ignore: cast_nullable_to_non_nullable +as String,createdDate: null == createdDate ? _self.createdDate : createdDate // ignore: cast_nullable_to_non_nullable +as String,vopResult: null == vopResult ? _self.vopResult : vopResult // ignore: cast_nullable_to_non_nullable +as String, + )); +} + +} + + +/// Adds pattern-matching-related methods to [BeneficiaryValidationEntity]. +extension BeneficiaryValidationEntityPatterns on BeneficiaryValidationEntity { +/// 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 Function( _BeneficiaryValidationEntity value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _BeneficiaryValidationEntity() 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 Function( _BeneficiaryValidationEntity value) $default,){ +final _that = this; +switch (_that) { +case _BeneficiaryValidationEntity(): +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? Function( _BeneficiaryValidationEntity value)? $default,){ +final _that = this; +switch (_that) { +case _BeneficiaryValidationEntity() 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 Function( bool isCreated, String beneficiaryValidationId, String createdDate, String vopResult)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _BeneficiaryValidationEntity() when $default != null: +return $default(_that.isCreated,_that.beneficiaryValidationId,_that.createdDate,_that.vopResult);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 Function( bool isCreated, String beneficiaryValidationId, String createdDate, String vopResult) $default,) {final _that = this; +switch (_that) { +case _BeneficiaryValidationEntity(): +return $default(_that.isCreated,_that.beneficiaryValidationId,_that.createdDate,_that.vopResult);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? Function( bool isCreated, String beneficiaryValidationId, String createdDate, String vopResult)? $default,) {final _that = this; +switch (_that) { +case _BeneficiaryValidationEntity() when $default != null: +return $default(_that.isCreated,_that.beneficiaryValidationId,_that.createdDate,_that.vopResult);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _BeneficiaryValidationEntity implements BeneficiaryValidationEntity { + const _BeneficiaryValidationEntity({this.isCreated = false, required this.beneficiaryValidationId, this.createdDate = '', this.vopResult = ''}); + + +@override@JsonKey() final bool isCreated; +@override final String beneficiaryValidationId; +@override@JsonKey() final String createdDate; +@override@JsonKey() final String vopResult; + +/// Create a copy of BeneficiaryValidationEntity +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$BeneficiaryValidationEntityCopyWith<_BeneficiaryValidationEntity> get copyWith => __$BeneficiaryValidationEntityCopyWithImpl<_BeneficiaryValidationEntity>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _BeneficiaryValidationEntity&&(identical(other.isCreated, isCreated) || other.isCreated == isCreated)&&(identical(other.beneficiaryValidationId, beneficiaryValidationId) || other.beneficiaryValidationId == beneficiaryValidationId)&&(identical(other.createdDate, createdDate) || other.createdDate == createdDate)&&(identical(other.vopResult, vopResult) || other.vopResult == vopResult)); +} + + +@override +int get hashCode => Object.hash(runtimeType,isCreated,beneficiaryValidationId,createdDate,vopResult); + +@override +String toString() { + return 'BeneficiaryValidationEntity(isCreated: $isCreated, beneficiaryValidationId: $beneficiaryValidationId, createdDate: $createdDate, vopResult: $vopResult)'; +} + + +} + +/// @nodoc +abstract mixin class _$BeneficiaryValidationEntityCopyWith<$Res> implements $BeneficiaryValidationEntityCopyWith<$Res> { + factory _$BeneficiaryValidationEntityCopyWith(_BeneficiaryValidationEntity value, $Res Function(_BeneficiaryValidationEntity) _then) = __$BeneficiaryValidationEntityCopyWithImpl; +@override @useResult +$Res call({ + bool isCreated, String beneficiaryValidationId, String createdDate, String vopResult +}); + + + + +} +/// @nodoc +class __$BeneficiaryValidationEntityCopyWithImpl<$Res> + implements _$BeneficiaryValidationEntityCopyWith<$Res> { + __$BeneficiaryValidationEntityCopyWithImpl(this._self, this._then); + + final _BeneficiaryValidationEntity _self; + final $Res Function(_BeneficiaryValidationEntity) _then; + +/// Create a copy of BeneficiaryValidationEntity +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? isCreated = null,Object? beneficiaryValidationId = null,Object? createdDate = null,Object? vopResult = null,}) { + return _then(_BeneficiaryValidationEntity( +isCreated: null == isCreated ? _self.isCreated : isCreated // ignore: cast_nullable_to_non_nullable +as bool,beneficiaryValidationId: null == beneficiaryValidationId ? _self.beneficiaryValidationId : beneficiaryValidationId // ignore: cast_nullable_to_non_nullable +as String,createdDate: null == createdDate ? _self.createdDate : createdDate // ignore: cast_nullable_to_non_nullable +as String,vopResult: null == vopResult ? _self.vopResult : vopResult // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + +// dart format on diff --git a/packages/sf_shared/lib/src/domain/repositories/treezor_repository.dart b/packages/sf_shared/lib/src/domain/repositories/treezor_repository.dart index ccb712ae..62cfa5d8 100644 --- a/packages/sf_shared/lib/src/domain/repositories/treezor_repository.dart +++ b/packages/sf_shared/lib/src/domain/repositories/treezor_repository.dart @@ -3,6 +3,7 @@ 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/beneficiary_validation_entity.dart'; import '../entities/transaction_beneficiary_entity.dart'; import '../entities/wallet_balance_entity.dart'; import '../entities/wallet_card_entity.dart'; @@ -47,7 +48,7 @@ abstract class TreezorRepository { required String scaProof, }); - Future validateTransactionBeneficiary({required int beneficiaryId}); + Future validateTransactionBeneficiary({required int beneficiaryId}); Future walletTransfer({ required int beneficiaryId,