From 2313d72eab38f1d7d0776dcad6e5248f2cb9af6e Mon Sep 17 00:00:00 2001 From: Vusumuzi Khoza Date: Fri, 28 Nov 2025 12:18:40 +0200 Subject: [PATCH] bill product flow bug fixes --- assets/.env | 4 +- .../confirm/confirm_controller.freezed.dart | 153 +++++++++- lib/screens/gateway/gateway_redirect.dart | 6 - lib/screens/gateway/gateway_screen.dart | 2 +- lib/screens/gateway/gateway_web_screen.dart | 8 +- lib/screens/home/home_controller.freezed.dart | 263 +++++++++++++++++- lib/screens/pay/pay_controller.dart | 3 +- lib/screens/pay/pay_controller.freezed.dart | 263 +++++++++++++++++- lib/screens/pay/pay_screen.dart | 3 +- .../recipients_controller.freezed.dart | 133 ++++++++- lib/screens/transaction_controller.dart | 5 +- .../transaction_controller.freezed.dart | 160 ++++++++++- lib/screens/transaction_controller.g.dart | 2 + 13 files changed, 959 insertions(+), 46 deletions(-) diff --git a/assets/.env b/assets/.env index 7645daa..b19906c 100644 --- a/assets/.env +++ b/assets/.env @@ -1,7 +1,7 @@ -BASE_URL=https://peakapi.qantra.co.zw/api +; BASE_URL=https://peakapi.qantra.co.zw/api ; BASE_URL=http://192.168.100.26:6950/api ; BASE_URL=http://173.212.247.232:6950/api -; BASE_URL=http://192.168.1.164:6950/api +BASE_URL=http://10.69.5.201:6950/api ; BASE_URL=http://192.168.120.160:6950/api ; BASE_URL=http://10.10.2.92:6950/api ; BASE_URL=http://172.20.5.105:6950/api diff --git a/lib/screens/confirm/confirm_controller.freezed.dart b/lib/screens/confirm/confirm_controller.freezed.dart index cc95267..77915f0 100644 --- a/lib/screens/confirm/confirm_controller.freezed.dart +++ b/lib/screens/confirm/confirm_controller.freezed.dart @@ -1,6 +1,5 @@ -// dart format width=80 -// coverage:ignore-file // 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 @@ -14,7 +13,7 @@ part of 'confirm_controller.dart'; T _$identity(T value) => value; /// @nodoc -mixin _$ConfirmData { +mixin _$ConfirmData implements DiagnosticableTreeMixin { String get status; String get errorMessage; /// Create a copy of ConfirmData @@ -26,6 +25,12 @@ $ConfirmDataCopyWith get copyWith => _$ConfirmDataCopyWithImpl toJson(); +@override +void debugFillProperties(DiagnosticPropertiesBuilder properties) { + properties + ..add(DiagnosticsProperty('type', 'ConfirmData')) + ..add(DiagnosticsProperty('status', status))..add(DiagnosticsProperty('errorMessage', errorMessage)); +} @override bool operator ==(Object other) { @@ -37,7 +42,7 @@ bool operator ==(Object other) { int get hashCode => Object.hash(runtimeType,status,errorMessage); @override -String toString() { +String toString({ DiagnosticLevel minLevel = DiagnosticLevel.info }) { return 'ConfirmData(status: $status, errorMessage: $errorMessage)'; } @@ -77,10 +82,140 @@ as String, } +/// Adds pattern-matching-related methods to [ConfirmData]. +extension ConfirmDataPatterns on ConfirmData { +/// 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( _ConfirmData value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _ConfirmData() 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( _ConfirmData value) $default,){ +final _that = this; +switch (_that) { +case _ConfirmData(): +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( _ConfirmData value)? $default,){ +final _that = this; +switch (_that) { +case _ConfirmData() 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 status, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _ConfirmData() when $default != null: +return $default(_that.status,_that.errorMessage);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 status, String errorMessage) $default,) {final _that = this; +switch (_that) { +case _ConfirmData(): +return $default(_that.status,_that.errorMessage);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 status, String errorMessage)? $default,) {final _that = this; +switch (_that) { +case _ConfirmData() when $default != null: +return $default(_that.status,_that.errorMessage);case _: + return null; + +} +} + +} + /// @nodoc @JsonSerializable() -class _ConfirmData implements ConfirmData { +class _ConfirmData with DiagnosticableTreeMixin implements ConfirmData { const _ConfirmData({required this.status, required this.errorMessage}); factory _ConfirmData.fromJson(Map json) => _$ConfirmDataFromJson(json); @@ -97,6 +232,12 @@ _$ConfirmDataCopyWith<_ConfirmData> get copyWith => __$ConfirmDataCopyWithImpl<_ Map toJson() { return _$ConfirmDataToJson(this, ); } +@override +void debugFillProperties(DiagnosticPropertiesBuilder properties) { + properties + ..add(DiagnosticsProperty('type', 'ConfirmData')) + ..add(DiagnosticsProperty('status', status))..add(DiagnosticsProperty('errorMessage', errorMessage)); +} @override bool operator ==(Object other) { @@ -108,7 +249,7 @@ bool operator ==(Object other) { int get hashCode => Object.hash(runtimeType,status,errorMessage); @override -String toString() { +String toString({ DiagnosticLevel minLevel = DiagnosticLevel.info }) { return 'ConfirmData(status: $status, errorMessage: $errorMessage)'; } diff --git a/lib/screens/gateway/gateway_redirect.dart b/lib/screens/gateway/gateway_redirect.dart index 35c9a14..6cbe061 100644 --- a/lib/screens/gateway/gateway_redirect.dart +++ b/lib/screens/gateway/gateway_redirect.dart @@ -63,12 +63,6 @@ class _GatewayRedirectScreenState extends State { body: ListenableBuilder( listenable: controller, builder: (context, child) { - if (controller.model.status == 'SUCCESS') { - WidgetsBinding.instance.addPostFrameCallback((_) { - context.go('/integration'); - }); - } - return Container( padding: EdgeInsets.all(50), child: Center( diff --git a/lib/screens/gateway/gateway_screen.dart b/lib/screens/gateway/gateway_screen.dart index 5fda0f2..c4451e3 100644 --- a/lib/screens/gateway/gateway_screen.dart +++ b/lib/screens/gateway/gateway_screen.dart @@ -85,7 +85,7 @@ class _GatewayScreenState extends State { }); WidgetsBinding.instance.addPostFrameCallback((_) { - context.go('/integration'); + context.go('/poll'); }); } } diff --git a/lib/screens/gateway/gateway_web_screen.dart b/lib/screens/gateway/gateway_web_screen.dart index 493c88d..8457be9 100644 --- a/lib/screens/gateway/gateway_web_screen.dart +++ b/lib/screens/gateway/gateway_web_screen.dart @@ -136,7 +136,7 @@ class _GatewayWebScreenState extends State { }); WidgetsBinding.instance.addPostFrameCallback((_) { - context.go('/integration'); + context.go('/poll'); }); } } @@ -164,12 +164,6 @@ class _GatewayWebScreenState extends State { body: ListenableBuilder( listenable: controller, builder: (context, child) { - if (controller.model.status == 'SUCCESS') { - WidgetsBinding.instance.addPostFrameCallback((_) { - context.go('/integration'); - }); - } - return LayoutBuilder( builder: (context, constraints) { return SingleChildScrollView( diff --git a/lib/screens/home/home_controller.freezed.dart b/lib/screens/home/home_controller.freezed.dart index 8c9f802..aaa4658 100644 --- a/lib/screens/home/home_controller.freezed.dart +++ b/lib/screens/home/home_controller.freezed.dart @@ -1,6 +1,5 @@ -// dart format width=80 -// coverage:ignore-file // 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 @@ -79,6 +78,136 @@ as String, } +/// Adds pattern-matching-related methods to [Category]. +extension CategoryPatterns on Category { +/// 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( _Category value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _Category() 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( _Category value) $default,){ +final _that = this; +switch (_that) { +case _Category(): +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( _Category value)? $default,){ +final _that = this; +switch (_that) { +case _Category() 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 name, String description, String? image, String label)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _Category() when $default != null: +return $default(_that.name,_that.description,_that.image,_that.label);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 name, String description, String? image, String label) $default,) {final _that = this; +switch (_that) { +case _Category(): +return $default(_that.name,_that.description,_that.image,_that.label);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 name, String description, String? image, String label)? $default,) {final _that = this; +switch (_that) { +case _Category() when $default != null: +return $default(_that.name,_that.description,_that.image,_that.label);case _: + return null; + +} +} + +} + /// @nodoc @JsonSerializable() @@ -232,6 +361,136 @@ as String?, } +/// Adds pattern-matching-related methods to [BillProvider]. +extension BillProviderPatterns on BillProvider { +/// 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( _BillProvider value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _BillProvider() 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( _BillProvider value) $default,){ +final _that = this; +switch (_that) { +case _BillProvider(): +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( _BillProvider value)? $default,){ +final _that = this; +switch (_that) { +case _BillProvider() 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 clientId, String name, String description, bool requiresAccount, bool requiresAmount, bool requiresAmountFromMerchant, bool requiresPhone, bool requiresReversal, String? additionalDataString, String processorType, String uid, String image, String label, String category, String? accountFieldName)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _BillProvider() when $default != null: +return $default(_that.clientId,_that.name,_that.description,_that.requiresAccount,_that.requiresAmount,_that.requiresAmountFromMerchant,_that.requiresPhone,_that.requiresReversal,_that.additionalDataString,_that.processorType,_that.uid,_that.image,_that.label,_that.category,_that.accountFieldName);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 clientId, String name, String description, bool requiresAccount, bool requiresAmount, bool requiresAmountFromMerchant, bool requiresPhone, bool requiresReversal, String? additionalDataString, String processorType, String uid, String image, String label, String category, String? accountFieldName) $default,) {final _that = this; +switch (_that) { +case _BillProvider(): +return $default(_that.clientId,_that.name,_that.description,_that.requiresAccount,_that.requiresAmount,_that.requiresAmountFromMerchant,_that.requiresPhone,_that.requiresReversal,_that.additionalDataString,_that.processorType,_that.uid,_that.image,_that.label,_that.category,_that.accountFieldName);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 clientId, String name, String description, bool requiresAccount, bool requiresAmount, bool requiresAmountFromMerchant, bool requiresPhone, bool requiresReversal, String? additionalDataString, String processorType, String uid, String image, String label, String category, String? accountFieldName)? $default,) {final _that = this; +switch (_that) { +case _BillProvider() when $default != null: +return $default(_that.clientId,_that.name,_that.description,_that.requiresAccount,_that.requiresAmount,_that.requiresAmountFromMerchant,_that.requiresPhone,_that.requiresReversal,_that.additionalDataString,_that.processorType,_that.uid,_that.image,_that.label,_that.category,_that.accountFieldName);case _: + return null; + +} +} + +} + /// @nodoc @JsonSerializable() diff --git a/lib/screens/pay/pay_controller.dart b/lib/screens/pay/pay_controller.dart index ccee845..2930f00 100644 --- a/lib/screens/pay/pay_controller.dart +++ b/lib/screens/pay/pay_controller.dart @@ -109,6 +109,7 @@ class PayController extends ChangeNotifier { creditName: transactionController.model.formData.creditName, creditEmail: transactionController.model.formData.creditEmail, productUid: model.selectedProduct?.uid, + billProductName: model.selectedProduct?.name, ); dynamic workflowResponse = await http.post( @@ -145,7 +146,7 @@ class PayController extends ChangeNotifier { } Future getProducts(String providerId) async { - model.products = getFakeProducts(); + // model.products = getFakeProducts(); try { model.isLoading = true; diff --git a/lib/screens/pay/pay_controller.freezed.dart b/lib/screens/pay/pay_controller.freezed.dart index 0acb605..7ebb80c 100644 --- a/lib/screens/pay/pay_controller.freezed.dart +++ b/lib/screens/pay/pay_controller.freezed.dart @@ -1,6 +1,5 @@ -// dart format width=80 -// coverage:ignore-file // 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 @@ -82,6 +81,136 @@ as String, } +/// Adds pattern-matching-related methods to [PaymentProcessor]. +extension PaymentProcessorPatterns on PaymentProcessor { +/// 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( _PaymentProcessor value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _PaymentProcessor() 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( _PaymentProcessor value) $default,){ +final _that = this; +switch (_that) { +case _PaymentProcessor(): +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( _PaymentProcessor value)? $default,){ +final _that = this; +switch (_that) { +case _PaymentProcessor() 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 name, String description, String image, String accountFieldName, String accountFieldLabel, String label, String authType)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _PaymentProcessor() when $default != null: +return $default(_that.name,_that.description,_that.image,_that.accountFieldName,_that.accountFieldLabel,_that.label,_that.authType);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 name, String description, String image, String accountFieldName, String accountFieldLabel, String label, String authType) $default,) {final _that = this; +switch (_that) { +case _PaymentProcessor(): +return $default(_that.name,_that.description,_that.image,_that.accountFieldName,_that.accountFieldLabel,_that.label,_that.authType);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 name, String description, String image, String accountFieldName, String accountFieldLabel, String label, String authType)? $default,) {final _that = this; +switch (_that) { +case _PaymentProcessor() when $default != null: +return $default(_that.name,_that.description,_that.image,_that.accountFieldName,_that.accountFieldLabel,_that.label,_that.authType);case _: + return null; + +} +} + +} + /// @nodoc @JsonSerializable() @@ -232,6 +361,136 @@ as bool, } +/// Adds pattern-matching-related methods to [BillProduct]. +extension BillProductPatterns on BillProduct { +/// 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( _BillProduct value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _BillProduct() 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( _BillProduct value) $default,){ +final _that = this; +switch (_that) { +case _BillProduct(): +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( _BillProduct value)? $default,){ +final _that = this; +switch (_that) { +case _BillProduct() 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 uid, String name, String description, String displayName, double defaultAmount, bool requiresAmount)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _BillProduct() when $default != null: +return $default(_that.uid,_that.name,_that.description,_that.displayName,_that.defaultAmount,_that.requiresAmount);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 uid, String name, String description, String displayName, double defaultAmount, bool requiresAmount) $default,) {final _that = this; +switch (_that) { +case _BillProduct(): +return $default(_that.uid,_that.name,_that.description,_that.displayName,_that.defaultAmount,_that.requiresAmount);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 uid, String name, String description, String displayName, double defaultAmount, bool requiresAmount)? $default,) {final _that = this; +switch (_that) { +case _BillProduct() when $default != null: +return $default(_that.uid,_that.name,_that.description,_that.displayName,_that.defaultAmount,_that.requiresAmount);case _: + return null; + +} +} + +} + /// @nodoc @JsonSerializable() diff --git a/lib/screens/pay/pay_screen.dart b/lib/screens/pay/pay_screen.dart index dbc720e..1994b01 100644 --- a/lib/screens/pay/pay_screen.dart +++ b/lib/screens/pay/pay_screen.dart @@ -583,7 +583,8 @@ class _PayScreenState extends State with TickerProviderStateMixin { ...controller.model.products.map( (e) => DropdownMenuItem( value: e.uid, - child: Text(e.displayName), + child: Text('${e.displayName} - ' + '${transactionController.model.formData.debitCurrency}${e.defaultAmount}'), ), ), ], diff --git a/lib/screens/recipient/recipients_controller.freezed.dart b/lib/screens/recipient/recipients_controller.freezed.dart index dc76b9c..0ad08f1 100644 --- a/lib/screens/recipient/recipients_controller.freezed.dart +++ b/lib/screens/recipient/recipients_controller.freezed.dart @@ -1,6 +1,5 @@ -// dart format width=80 -// coverage:ignore-file // 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 @@ -83,6 +82,136 @@ as String?, } +/// Adds pattern-matching-related methods to [Recipient]. +extension RecipientPatterns on Recipient { +/// 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( _Recipient value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _Recipient() 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( _Recipient value) $default,){ +final _that = this; +switch (_that) { +case _Recipient(): +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( _Recipient value)? $default,){ +final _that = this; +switch (_that) { +case _Recipient() 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? uid, String? name, String? email, String? phoneNumber, String? address, String? account, String? initials, String? latestProviderLabel)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _Recipient() when $default != null: +return $default(_that.uid,_that.name,_that.email,_that.phoneNumber,_that.address,_that.account,_that.initials,_that.latestProviderLabel);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? uid, String? name, String? email, String? phoneNumber, String? address, String? account, String? initials, String? latestProviderLabel) $default,) {final _that = this; +switch (_that) { +case _Recipient(): +return $default(_that.uid,_that.name,_that.email,_that.phoneNumber,_that.address,_that.account,_that.initials,_that.latestProviderLabel);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? uid, String? name, String? email, String? phoneNumber, String? address, String? account, String? initials, String? latestProviderLabel)? $default,) {final _that = this; +switch (_that) { +case _Recipient() when $default != null: +return $default(_that.uid,_that.name,_that.email,_that.phoneNumber,_that.address,_that.account,_that.initials,_that.latestProviderLabel);case _: + return null; + +} +} + +} + /// @nodoc @JsonSerializable() diff --git a/lib/screens/transaction_controller.dart b/lib/screens/transaction_controller.dart index 8788c84..e40bc21 100644 --- a/lib/screens/transaction_controller.dart +++ b/lib/screens/transaction_controller.dart @@ -18,7 +18,7 @@ class TransactionModel { type: '', billClientId: '', debitRef: '', - debitCurrency: '', + debitCurrency: 'USD', amount: '', debitPhone: '', debitAccount: '', @@ -70,6 +70,7 @@ abstract class FormData with _$FormData { String? debitPhone, String? debitAccount, String? productUid, + String? billProductName, String? trace, String? authType, String? charge, @@ -121,7 +122,7 @@ class TransactionController extends ChangeNotifier { type: '', billClientId: '', debitRef: '', - debitCurrency: '', + debitCurrency: 'USD', amount: '', debitPhone: '', debitAccount: '', diff --git a/lib/screens/transaction_controller.freezed.dart b/lib/screens/transaction_controller.freezed.dart index 8b49421..0d18c8d 100644 --- a/lib/screens/transaction_controller.freezed.dart +++ b/lib/screens/transaction_controller.freezed.dart @@ -1,6 +1,5 @@ -// dart format width=80 -// coverage:ignore-file // 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 @@ -17,7 +16,7 @@ T _$identity(T value) => value; mixin _$FormData { String? get id; String get type;// CONFIRM, REQUEST, REVERSE - String get billClientId; String get debitRef; String get debitCurrency; String get amount; String get creditAccount; String? get creditPhone; String? get creditName; String? get creditEmail; String get billName; String? get errorMessage; String get status; String get paymentProcessorLabel; String get paymentProcessorName; String get paymentProcessorImage; String get providerImage; String get providerLabel; String get userId; String? get debitPhone; String? get debitAccount; String? get productUid; String? get trace; String? get authType; String? get charge; String? get gatewayCharge; String? get tax; String? get totalAmount; + String get billClientId; String get debitRef; String get debitCurrency; String get amount; String get creditAccount; String? get creditPhone; String? get creditName; String? get creditEmail; String get billName; String? get errorMessage; String get status; String get paymentProcessorLabel; String get paymentProcessorName; String get paymentProcessorImage; String get providerImage; String get providerLabel; String get userId; String? get debitPhone; String? get debitAccount; String? get productUid; String? get billProductName; String? get trace; String? get authType; String? get charge; String? get gatewayCharge; String? get tax; String? get totalAmount; /// Create a copy of FormData /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -30,16 +29,16 @@ $FormDataCopyWith get copyWith => _$FormDataCopyWithImpl(thi @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is FormData&&(identical(other.id, id) || other.id == id)&&(identical(other.type, type) || other.type == type)&&(identical(other.billClientId, billClientId) || other.billClientId == billClientId)&&(identical(other.debitRef, debitRef) || other.debitRef == debitRef)&&(identical(other.debitCurrency, debitCurrency) || other.debitCurrency == debitCurrency)&&(identical(other.amount, amount) || other.amount == amount)&&(identical(other.creditAccount, creditAccount) || other.creditAccount == creditAccount)&&(identical(other.creditPhone, creditPhone) || other.creditPhone == creditPhone)&&(identical(other.creditName, creditName) || other.creditName == creditName)&&(identical(other.creditEmail, creditEmail) || other.creditEmail == creditEmail)&&(identical(other.billName, billName) || other.billName == billName)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.status, status) || other.status == status)&&(identical(other.paymentProcessorLabel, paymentProcessorLabel) || other.paymentProcessorLabel == paymentProcessorLabel)&&(identical(other.paymentProcessorName, paymentProcessorName) || other.paymentProcessorName == paymentProcessorName)&&(identical(other.paymentProcessorImage, paymentProcessorImage) || other.paymentProcessorImage == paymentProcessorImage)&&(identical(other.providerImage, providerImage) || other.providerImage == providerImage)&&(identical(other.providerLabel, providerLabel) || other.providerLabel == providerLabel)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.debitPhone, debitPhone) || other.debitPhone == debitPhone)&&(identical(other.debitAccount, debitAccount) || other.debitAccount == debitAccount)&&(identical(other.productUid, productUid) || other.productUid == productUid)&&(identical(other.trace, trace) || other.trace == trace)&&(identical(other.authType, authType) || other.authType == authType)&&(identical(other.charge, charge) || other.charge == charge)&&(identical(other.gatewayCharge, gatewayCharge) || other.gatewayCharge == gatewayCharge)&&(identical(other.tax, tax) || other.tax == tax)&&(identical(other.totalAmount, totalAmount) || other.totalAmount == totalAmount)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is FormData&&(identical(other.id, id) || other.id == id)&&(identical(other.type, type) || other.type == type)&&(identical(other.billClientId, billClientId) || other.billClientId == billClientId)&&(identical(other.debitRef, debitRef) || other.debitRef == debitRef)&&(identical(other.debitCurrency, debitCurrency) || other.debitCurrency == debitCurrency)&&(identical(other.amount, amount) || other.amount == amount)&&(identical(other.creditAccount, creditAccount) || other.creditAccount == creditAccount)&&(identical(other.creditPhone, creditPhone) || other.creditPhone == creditPhone)&&(identical(other.creditName, creditName) || other.creditName == creditName)&&(identical(other.creditEmail, creditEmail) || other.creditEmail == creditEmail)&&(identical(other.billName, billName) || other.billName == billName)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.status, status) || other.status == status)&&(identical(other.paymentProcessorLabel, paymentProcessorLabel) || other.paymentProcessorLabel == paymentProcessorLabel)&&(identical(other.paymentProcessorName, paymentProcessorName) || other.paymentProcessorName == paymentProcessorName)&&(identical(other.paymentProcessorImage, paymentProcessorImage) || other.paymentProcessorImage == paymentProcessorImage)&&(identical(other.providerImage, providerImage) || other.providerImage == providerImage)&&(identical(other.providerLabel, providerLabel) || other.providerLabel == providerLabel)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.debitPhone, debitPhone) || other.debitPhone == debitPhone)&&(identical(other.debitAccount, debitAccount) || other.debitAccount == debitAccount)&&(identical(other.productUid, productUid) || other.productUid == productUid)&&(identical(other.billProductName, billProductName) || other.billProductName == billProductName)&&(identical(other.trace, trace) || other.trace == trace)&&(identical(other.authType, authType) || other.authType == authType)&&(identical(other.charge, charge) || other.charge == charge)&&(identical(other.gatewayCharge, gatewayCharge) || other.gatewayCharge == gatewayCharge)&&(identical(other.tax, tax) || other.tax == tax)&&(identical(other.totalAmount, totalAmount) || other.totalAmount == totalAmount)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hashAll([runtimeType,id,type,billClientId,debitRef,debitCurrency,amount,creditAccount,creditPhone,creditName,creditEmail,billName,errorMessage,status,paymentProcessorLabel,paymentProcessorName,paymentProcessorImage,providerImage,providerLabel,userId,debitPhone,debitAccount,productUid,trace,authType,charge,gatewayCharge,tax,totalAmount]); +int get hashCode => Object.hashAll([runtimeType,id,type,billClientId,debitRef,debitCurrency,amount,creditAccount,creditPhone,creditName,creditEmail,billName,errorMessage,status,paymentProcessorLabel,paymentProcessorName,paymentProcessorImage,providerImage,providerLabel,userId,debitPhone,debitAccount,productUid,billProductName,trace,authType,charge,gatewayCharge,tax,totalAmount]); @override String toString() { - return 'FormData(id: $id, type: $type, billClientId: $billClientId, debitRef: $debitRef, debitCurrency: $debitCurrency, amount: $amount, creditAccount: $creditAccount, creditPhone: $creditPhone, creditName: $creditName, creditEmail: $creditEmail, billName: $billName, errorMessage: $errorMessage, status: $status, paymentProcessorLabel: $paymentProcessorLabel, paymentProcessorName: $paymentProcessorName, paymentProcessorImage: $paymentProcessorImage, providerImage: $providerImage, providerLabel: $providerLabel, userId: $userId, debitPhone: $debitPhone, debitAccount: $debitAccount, productUid: $productUid, trace: $trace, authType: $authType, charge: $charge, gatewayCharge: $gatewayCharge, tax: $tax, totalAmount: $totalAmount)'; + return 'FormData(id: $id, type: $type, billClientId: $billClientId, debitRef: $debitRef, debitCurrency: $debitCurrency, amount: $amount, creditAccount: $creditAccount, creditPhone: $creditPhone, creditName: $creditName, creditEmail: $creditEmail, billName: $billName, errorMessage: $errorMessage, status: $status, paymentProcessorLabel: $paymentProcessorLabel, paymentProcessorName: $paymentProcessorName, paymentProcessorImage: $paymentProcessorImage, providerImage: $providerImage, providerLabel: $providerLabel, userId: $userId, debitPhone: $debitPhone, debitAccount: $debitAccount, productUid: $productUid, billProductName: $billProductName, trace: $trace, authType: $authType, charge: $charge, gatewayCharge: $gatewayCharge, tax: $tax, totalAmount: $totalAmount)'; } @@ -50,7 +49,7 @@ abstract mixin class $FormDataCopyWith<$Res> { factory $FormDataCopyWith(FormData value, $Res Function(FormData) _then) = _$FormDataCopyWithImpl; @useResult $Res call({ - String? id, String type, String billClientId, String debitRef, String debitCurrency, String amount, String creditAccount, String? creditPhone, String? creditName, String? creditEmail, String billName, String? errorMessage, String status, String paymentProcessorLabel, String paymentProcessorName, String paymentProcessorImage, String providerImage, String providerLabel, String userId, String? debitPhone, String? debitAccount, String? productUid, String? trace, String? authType, String? charge, String? gatewayCharge, String? tax, String? totalAmount + String? id, String type, String billClientId, String debitRef, String debitCurrency, String amount, String creditAccount, String? creditPhone, String? creditName, String? creditEmail, String billName, String? errorMessage, String status, String paymentProcessorLabel, String paymentProcessorName, String paymentProcessorImage, String providerImage, String providerLabel, String userId, String? debitPhone, String? debitAccount, String? productUid, String? billProductName, String? trace, String? authType, String? charge, String? gatewayCharge, String? tax, String? totalAmount }); @@ -67,7 +66,7 @@ class _$FormDataCopyWithImpl<$Res> /// Create a copy of FormData /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? id = freezed,Object? type = null,Object? billClientId = null,Object? debitRef = null,Object? debitCurrency = null,Object? amount = null,Object? creditAccount = null,Object? creditPhone = freezed,Object? creditName = freezed,Object? creditEmail = freezed,Object? billName = null,Object? errorMessage = freezed,Object? status = null,Object? paymentProcessorLabel = null,Object? paymentProcessorName = null,Object? paymentProcessorImage = null,Object? providerImage = null,Object? providerLabel = null,Object? userId = null,Object? debitPhone = freezed,Object? debitAccount = freezed,Object? productUid = freezed,Object? trace = freezed,Object? authType = freezed,Object? charge = freezed,Object? gatewayCharge = freezed,Object? tax = freezed,Object? totalAmount = freezed,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? id = freezed,Object? type = null,Object? billClientId = null,Object? debitRef = null,Object? debitCurrency = null,Object? amount = null,Object? creditAccount = null,Object? creditPhone = freezed,Object? creditName = freezed,Object? creditEmail = freezed,Object? billName = null,Object? errorMessage = freezed,Object? status = null,Object? paymentProcessorLabel = null,Object? paymentProcessorName = null,Object? paymentProcessorImage = null,Object? providerImage = null,Object? providerLabel = null,Object? userId = null,Object? debitPhone = freezed,Object? debitAccount = freezed,Object? productUid = freezed,Object? billProductName = freezed,Object? trace = freezed,Object? authType = freezed,Object? charge = freezed,Object? gatewayCharge = freezed,Object? tax = freezed,Object? totalAmount = freezed,}) { return _then(_self.copyWith( id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as String?,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable @@ -91,6 +90,7 @@ as String,userId: null == userId ? _self.userId : userId // ignore: cast_nullabl as String,debitPhone: freezed == debitPhone ? _self.debitPhone : debitPhone // ignore: cast_nullable_to_non_nullable as String?,debitAccount: freezed == debitAccount ? _self.debitAccount : debitAccount // ignore: cast_nullable_to_non_nullable as String?,productUid: freezed == productUid ? _self.productUid : productUid // ignore: cast_nullable_to_non_nullable +as String?,billProductName: freezed == billProductName ? _self.billProductName : billProductName // ignore: cast_nullable_to_non_nullable as String?,trace: freezed == trace ? _self.trace : trace // ignore: cast_nullable_to_non_nullable as String?,authType: freezed == authType ? _self.authType : authType // ignore: cast_nullable_to_non_nullable as String?,charge: freezed == charge ? _self.charge : charge // ignore: cast_nullable_to_non_nullable @@ -104,11 +104,141 @@ as String?, } +/// Adds pattern-matching-related methods to [FormData]. +extension FormDataPatterns on FormData { +/// 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( _FormData value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _FormData() 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( _FormData value) $default,){ +final _that = this; +switch (_that) { +case _FormData(): +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( _FormData value)? $default,){ +final _that = this; +switch (_that) { +case _FormData() 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? id, String type, String billClientId, String debitRef, String debitCurrency, String amount, String creditAccount, String? creditPhone, String? creditName, String? creditEmail, String billName, String? errorMessage, String status, String paymentProcessorLabel, String paymentProcessorName, String paymentProcessorImage, String providerImage, String providerLabel, String userId, String? debitPhone, String? debitAccount, String? productUid, String? billProductName, String? trace, String? authType, String? charge, String? gatewayCharge, String? tax, String? totalAmount)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _FormData() when $default != null: +return $default(_that.id,_that.type,_that.billClientId,_that.debitRef,_that.debitCurrency,_that.amount,_that.creditAccount,_that.creditPhone,_that.creditName,_that.creditEmail,_that.billName,_that.errorMessage,_that.status,_that.paymentProcessorLabel,_that.paymentProcessorName,_that.paymentProcessorImage,_that.providerImage,_that.providerLabel,_that.userId,_that.debitPhone,_that.debitAccount,_that.productUid,_that.billProductName,_that.trace,_that.authType,_that.charge,_that.gatewayCharge,_that.tax,_that.totalAmount);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? id, String type, String billClientId, String debitRef, String debitCurrency, String amount, String creditAccount, String? creditPhone, String? creditName, String? creditEmail, String billName, String? errorMessage, String status, String paymentProcessorLabel, String paymentProcessorName, String paymentProcessorImage, String providerImage, String providerLabel, String userId, String? debitPhone, String? debitAccount, String? productUid, String? billProductName, String? trace, String? authType, String? charge, String? gatewayCharge, String? tax, String? totalAmount) $default,) {final _that = this; +switch (_that) { +case _FormData(): +return $default(_that.id,_that.type,_that.billClientId,_that.debitRef,_that.debitCurrency,_that.amount,_that.creditAccount,_that.creditPhone,_that.creditName,_that.creditEmail,_that.billName,_that.errorMessage,_that.status,_that.paymentProcessorLabel,_that.paymentProcessorName,_that.paymentProcessorImage,_that.providerImage,_that.providerLabel,_that.userId,_that.debitPhone,_that.debitAccount,_that.productUid,_that.billProductName,_that.trace,_that.authType,_that.charge,_that.gatewayCharge,_that.tax,_that.totalAmount);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? id, String type, String billClientId, String debitRef, String debitCurrency, String amount, String creditAccount, String? creditPhone, String? creditName, String? creditEmail, String billName, String? errorMessage, String status, String paymentProcessorLabel, String paymentProcessorName, String paymentProcessorImage, String providerImage, String providerLabel, String userId, String? debitPhone, String? debitAccount, String? productUid, String? billProductName, String? trace, String? authType, String? charge, String? gatewayCharge, String? tax, String? totalAmount)? $default,) {final _that = this; +switch (_that) { +case _FormData() when $default != null: +return $default(_that.id,_that.type,_that.billClientId,_that.debitRef,_that.debitCurrency,_that.amount,_that.creditAccount,_that.creditPhone,_that.creditName,_that.creditEmail,_that.billName,_that.errorMessage,_that.status,_that.paymentProcessorLabel,_that.paymentProcessorName,_that.paymentProcessorImage,_that.providerImage,_that.providerLabel,_that.userId,_that.debitPhone,_that.debitAccount,_that.productUid,_that.billProductName,_that.trace,_that.authType,_that.charge,_that.gatewayCharge,_that.tax,_that.totalAmount);case _: + return null; + +} +} + +} + /// @nodoc @JsonSerializable() class _FormData implements FormData { - const _FormData({this.id, required this.type, required this.billClientId, required this.debitRef, required this.debitCurrency, required this.amount, required this.creditAccount, required this.creditPhone, required this.creditName, required this.creditEmail, required this.billName, required this.errorMessage, required this.status, required this.paymentProcessorLabel, required this.paymentProcessorName, required this.paymentProcessorImage, required this.providerImage, required this.providerLabel, required this.userId, this.debitPhone, this.debitAccount, this.productUid, this.trace, this.authType, this.charge, this.gatewayCharge, this.tax, this.totalAmount}); + const _FormData({this.id, required this.type, required this.billClientId, required this.debitRef, required this.debitCurrency, required this.amount, required this.creditAccount, required this.creditPhone, required this.creditName, required this.creditEmail, required this.billName, required this.errorMessage, required this.status, required this.paymentProcessorLabel, required this.paymentProcessorName, required this.paymentProcessorImage, required this.providerImage, required this.providerLabel, required this.userId, this.debitPhone, this.debitAccount, this.productUid, this.billProductName, this.trace, this.authType, this.charge, this.gatewayCharge, this.tax, this.totalAmount}); factory _FormData.fromJson(Map json) => _$FormDataFromJson(json); @override final String? id; @@ -134,6 +264,7 @@ class _FormData implements FormData { @override final String? debitPhone; @override final String? debitAccount; @override final String? productUid; +@override final String? billProductName; @override final String? trace; @override final String? authType; @override final String? charge; @@ -154,16 +285,16 @@ Map toJson() { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _FormData&&(identical(other.id, id) || other.id == id)&&(identical(other.type, type) || other.type == type)&&(identical(other.billClientId, billClientId) || other.billClientId == billClientId)&&(identical(other.debitRef, debitRef) || other.debitRef == debitRef)&&(identical(other.debitCurrency, debitCurrency) || other.debitCurrency == debitCurrency)&&(identical(other.amount, amount) || other.amount == amount)&&(identical(other.creditAccount, creditAccount) || other.creditAccount == creditAccount)&&(identical(other.creditPhone, creditPhone) || other.creditPhone == creditPhone)&&(identical(other.creditName, creditName) || other.creditName == creditName)&&(identical(other.creditEmail, creditEmail) || other.creditEmail == creditEmail)&&(identical(other.billName, billName) || other.billName == billName)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.status, status) || other.status == status)&&(identical(other.paymentProcessorLabel, paymentProcessorLabel) || other.paymentProcessorLabel == paymentProcessorLabel)&&(identical(other.paymentProcessorName, paymentProcessorName) || other.paymentProcessorName == paymentProcessorName)&&(identical(other.paymentProcessorImage, paymentProcessorImage) || other.paymentProcessorImage == paymentProcessorImage)&&(identical(other.providerImage, providerImage) || other.providerImage == providerImage)&&(identical(other.providerLabel, providerLabel) || other.providerLabel == providerLabel)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.debitPhone, debitPhone) || other.debitPhone == debitPhone)&&(identical(other.debitAccount, debitAccount) || other.debitAccount == debitAccount)&&(identical(other.productUid, productUid) || other.productUid == productUid)&&(identical(other.trace, trace) || other.trace == trace)&&(identical(other.authType, authType) || other.authType == authType)&&(identical(other.charge, charge) || other.charge == charge)&&(identical(other.gatewayCharge, gatewayCharge) || other.gatewayCharge == gatewayCharge)&&(identical(other.tax, tax) || other.tax == tax)&&(identical(other.totalAmount, totalAmount) || other.totalAmount == totalAmount)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _FormData&&(identical(other.id, id) || other.id == id)&&(identical(other.type, type) || other.type == type)&&(identical(other.billClientId, billClientId) || other.billClientId == billClientId)&&(identical(other.debitRef, debitRef) || other.debitRef == debitRef)&&(identical(other.debitCurrency, debitCurrency) || other.debitCurrency == debitCurrency)&&(identical(other.amount, amount) || other.amount == amount)&&(identical(other.creditAccount, creditAccount) || other.creditAccount == creditAccount)&&(identical(other.creditPhone, creditPhone) || other.creditPhone == creditPhone)&&(identical(other.creditName, creditName) || other.creditName == creditName)&&(identical(other.creditEmail, creditEmail) || other.creditEmail == creditEmail)&&(identical(other.billName, billName) || other.billName == billName)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.status, status) || other.status == status)&&(identical(other.paymentProcessorLabel, paymentProcessorLabel) || other.paymentProcessorLabel == paymentProcessorLabel)&&(identical(other.paymentProcessorName, paymentProcessorName) || other.paymentProcessorName == paymentProcessorName)&&(identical(other.paymentProcessorImage, paymentProcessorImage) || other.paymentProcessorImage == paymentProcessorImage)&&(identical(other.providerImage, providerImage) || other.providerImage == providerImage)&&(identical(other.providerLabel, providerLabel) || other.providerLabel == providerLabel)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.debitPhone, debitPhone) || other.debitPhone == debitPhone)&&(identical(other.debitAccount, debitAccount) || other.debitAccount == debitAccount)&&(identical(other.productUid, productUid) || other.productUid == productUid)&&(identical(other.billProductName, billProductName) || other.billProductName == billProductName)&&(identical(other.trace, trace) || other.trace == trace)&&(identical(other.authType, authType) || other.authType == authType)&&(identical(other.charge, charge) || other.charge == charge)&&(identical(other.gatewayCharge, gatewayCharge) || other.gatewayCharge == gatewayCharge)&&(identical(other.tax, tax) || other.tax == tax)&&(identical(other.totalAmount, totalAmount) || other.totalAmount == totalAmount)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hashAll([runtimeType,id,type,billClientId,debitRef,debitCurrency,amount,creditAccount,creditPhone,creditName,creditEmail,billName,errorMessage,status,paymentProcessorLabel,paymentProcessorName,paymentProcessorImage,providerImage,providerLabel,userId,debitPhone,debitAccount,productUid,trace,authType,charge,gatewayCharge,tax,totalAmount]); +int get hashCode => Object.hashAll([runtimeType,id,type,billClientId,debitRef,debitCurrency,amount,creditAccount,creditPhone,creditName,creditEmail,billName,errorMessage,status,paymentProcessorLabel,paymentProcessorName,paymentProcessorImage,providerImage,providerLabel,userId,debitPhone,debitAccount,productUid,billProductName,trace,authType,charge,gatewayCharge,tax,totalAmount]); @override String toString() { - return 'FormData(id: $id, type: $type, billClientId: $billClientId, debitRef: $debitRef, debitCurrency: $debitCurrency, amount: $amount, creditAccount: $creditAccount, creditPhone: $creditPhone, creditName: $creditName, creditEmail: $creditEmail, billName: $billName, errorMessage: $errorMessage, status: $status, paymentProcessorLabel: $paymentProcessorLabel, paymentProcessorName: $paymentProcessorName, paymentProcessorImage: $paymentProcessorImage, providerImage: $providerImage, providerLabel: $providerLabel, userId: $userId, debitPhone: $debitPhone, debitAccount: $debitAccount, productUid: $productUid, trace: $trace, authType: $authType, charge: $charge, gatewayCharge: $gatewayCharge, tax: $tax, totalAmount: $totalAmount)'; + return 'FormData(id: $id, type: $type, billClientId: $billClientId, debitRef: $debitRef, debitCurrency: $debitCurrency, amount: $amount, creditAccount: $creditAccount, creditPhone: $creditPhone, creditName: $creditName, creditEmail: $creditEmail, billName: $billName, errorMessage: $errorMessage, status: $status, paymentProcessorLabel: $paymentProcessorLabel, paymentProcessorName: $paymentProcessorName, paymentProcessorImage: $paymentProcessorImage, providerImage: $providerImage, providerLabel: $providerLabel, userId: $userId, debitPhone: $debitPhone, debitAccount: $debitAccount, productUid: $productUid, billProductName: $billProductName, trace: $trace, authType: $authType, charge: $charge, gatewayCharge: $gatewayCharge, tax: $tax, totalAmount: $totalAmount)'; } @@ -174,7 +305,7 @@ abstract mixin class _$FormDataCopyWith<$Res> implements $FormDataCopyWith<$Res> factory _$FormDataCopyWith(_FormData value, $Res Function(_FormData) _then) = __$FormDataCopyWithImpl; @override @useResult $Res call({ - String? id, String type, String billClientId, String debitRef, String debitCurrency, String amount, String creditAccount, String? creditPhone, String? creditName, String? creditEmail, String billName, String? errorMessage, String status, String paymentProcessorLabel, String paymentProcessorName, String paymentProcessorImage, String providerImage, String providerLabel, String userId, String? debitPhone, String? debitAccount, String? productUid, String? trace, String? authType, String? charge, String? gatewayCharge, String? tax, String? totalAmount + String? id, String type, String billClientId, String debitRef, String debitCurrency, String amount, String creditAccount, String? creditPhone, String? creditName, String? creditEmail, String billName, String? errorMessage, String status, String paymentProcessorLabel, String paymentProcessorName, String paymentProcessorImage, String providerImage, String providerLabel, String userId, String? debitPhone, String? debitAccount, String? productUid, String? billProductName, String? trace, String? authType, String? charge, String? gatewayCharge, String? tax, String? totalAmount }); @@ -191,7 +322,7 @@ class __$FormDataCopyWithImpl<$Res> /// Create a copy of FormData /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? id = freezed,Object? type = null,Object? billClientId = null,Object? debitRef = null,Object? debitCurrency = null,Object? amount = null,Object? creditAccount = null,Object? creditPhone = freezed,Object? creditName = freezed,Object? creditEmail = freezed,Object? billName = null,Object? errorMessage = freezed,Object? status = null,Object? paymentProcessorLabel = null,Object? paymentProcessorName = null,Object? paymentProcessorImage = null,Object? providerImage = null,Object? providerLabel = null,Object? userId = null,Object? debitPhone = freezed,Object? debitAccount = freezed,Object? productUid = freezed,Object? trace = freezed,Object? authType = freezed,Object? charge = freezed,Object? gatewayCharge = freezed,Object? tax = freezed,Object? totalAmount = freezed,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? id = freezed,Object? type = null,Object? billClientId = null,Object? debitRef = null,Object? debitCurrency = null,Object? amount = null,Object? creditAccount = null,Object? creditPhone = freezed,Object? creditName = freezed,Object? creditEmail = freezed,Object? billName = null,Object? errorMessage = freezed,Object? status = null,Object? paymentProcessorLabel = null,Object? paymentProcessorName = null,Object? paymentProcessorImage = null,Object? providerImage = null,Object? providerLabel = null,Object? userId = null,Object? debitPhone = freezed,Object? debitAccount = freezed,Object? productUid = freezed,Object? billProductName = freezed,Object? trace = freezed,Object? authType = freezed,Object? charge = freezed,Object? gatewayCharge = freezed,Object? tax = freezed,Object? totalAmount = freezed,}) { return _then(_FormData( id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as String?,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable @@ -215,6 +346,7 @@ as String,userId: null == userId ? _self.userId : userId // ignore: cast_nullabl as String,debitPhone: freezed == debitPhone ? _self.debitPhone : debitPhone // ignore: cast_nullable_to_non_nullable as String?,debitAccount: freezed == debitAccount ? _self.debitAccount : debitAccount // ignore: cast_nullable_to_non_nullable as String?,productUid: freezed == productUid ? _self.productUid : productUid // ignore: cast_nullable_to_non_nullable +as String?,billProductName: freezed == billProductName ? _self.billProductName : billProductName // ignore: cast_nullable_to_non_nullable as String?,trace: freezed == trace ? _self.trace : trace // ignore: cast_nullable_to_non_nullable as String?,authType: freezed == authType ? _self.authType : authType // ignore: cast_nullable_to_non_nullable as String?,charge: freezed == charge ? _self.charge : charge // ignore: cast_nullable_to_non_nullable diff --git a/lib/screens/transaction_controller.g.dart b/lib/screens/transaction_controller.g.dart index 9b326ff..1e5d7d9 100644 --- a/lib/screens/transaction_controller.g.dart +++ b/lib/screens/transaction_controller.g.dart @@ -29,6 +29,7 @@ _FormData _$FormDataFromJson(Map json) => _FormData( debitPhone: json['debitPhone'] as String?, debitAccount: json['debitAccount'] as String?, productUid: json['productUid'] as String?, + billProductName: json['billProductName'] as String?, trace: json['trace'] as String?, authType: json['authType'] as String?, charge: json['charge'] as String?, @@ -60,6 +61,7 @@ Map _$FormDataToJson(_FormData instance) => { 'debitPhone': instance.debitPhone, 'debitAccount': instance.debitAccount, 'productUid': instance.productUid, + 'billProductName': instance.billProductName, 'trace': instance.trace, 'authType': instance.authType, 'charge': instance.charge,