From b61d81d84bf6bc70dfe9094ade1dd6db705f2b96 Mon Sep 17 00:00:00 2001 From: Vusumuzi Khoza Date: Mon, 1 Jun 2026 13:27:32 +0200 Subject: [PATCH] bug fixes on UI --- lib/screens/pay/pay_controller.dart | 2 + lib/screens/pay/pay_screen.dart | 58 +++++++++++-------- lib/screens/transaction_controller.dart | 3 + .../transaction_controller.freezed.dart | 39 +++++++------ lib/screens/transaction_controller.g.dart | 2 + 5 files changed, 62 insertions(+), 42 deletions(-) diff --git a/lib/screens/pay/pay_controller.dart b/lib/screens/pay/pay_controller.dart index e02f242..59b97a7 100644 --- a/lib/screens/pay/pay_controller.dart +++ b/lib/screens/pay/pay_controller.dart @@ -18,6 +18,7 @@ class PayScreenModel { hc.BillProvider? selectedProvider; BillProduct? selectedProduct; PaymentProcessor? selectedPaymentProcessor; + String region = ''; bool isLoading = false; String? errorMessage; String? status; @@ -99,6 +100,7 @@ class PayController extends ChangeNotifier { creditEmail: transactionController.model.formData.creditEmail, productUid: model.selectedProduct?.uid, billProductName: model.selectedProduct?.name, + region: model.region, ); dynamic workflowResponse = await http.post( diff --git a/lib/screens/pay/pay_screen.dart b/lib/screens/pay/pay_screen.dart index f80863c..5eb8d65 100644 --- a/lib/screens/pay/pay_screen.dart +++ b/lib/screens/pay/pay_screen.dart @@ -31,31 +31,31 @@ class _PayScreenState extends State with TickerProviderStateMixin { final _emailController = TextEditingController(); final _phoneController = TextEditingController(); bool showAdditionalRecipientDetails = false; - String selectedCountryCode = '+263'; // Default to ZW + String selectedCountryCode = '263'; // Default to ZW // Common country codes with flags and names final List> countryCodes = [ - {'code': '+263', 'name': 'ZW', 'flag': '🇿🇼'}, - {'code': '+27', 'name': 'ZA', 'flag': '🇿🇦'}, - {'code': '+1', 'name': 'US', 'flag': '🇺🇸'}, - {'code': '+44', 'name': 'UK', 'flag': '🇬🇧'}, - {'code': '+61', 'name': 'AU', 'flag': '🇦🇺'}, - {'code': '+91', 'name': 'IN', 'flag': '🇮🇳'}, - {'code': '+86', 'name': 'CN', 'flag': '🇨🇳'}, - {'code': '+81', 'name': 'JP', 'flag': '🇯🇵'}, - {'code': '+49', 'name': 'DE', 'flag': '🇩🇪'}, - {'code': '+33', 'name': 'FR', 'flag': '🇫🇷'}, - {'code': '+39', 'name': 'IT', 'flag': '🇮🇹'}, - {'code': '+34', 'name': 'ES', 'flag': '🇪🇸'}, - {'code': '+7', 'name': 'RU', 'flag': '🇷🇺'}, - {'code': '+55', 'name': 'BR', 'flag': '🇧🇷'}, - {'code': '+52', 'name': 'MX', 'flag': '🇲🇽'}, - {'code': '+971', 'name': 'AE', 'flag': '🇦🇪'}, - {'code': '+966', 'name': 'SA', 'flag': '🇸🇦'}, - {'code': '+234', 'name': 'NG', 'flag': '🇳🇬'}, - {'code': '+254', 'name': 'KE', 'flag': '🇰🇪'}, - {'code': '+233', 'name': 'GH', 'flag': '🇬🇭'}, - {'code': '+256', 'name': 'UG', 'flag': '🇺🇬'}, + {'code': '263', 'name': 'ZW', 'flag': '🇿🇼'}, + {'code': '27', 'name': 'ZA', 'flag': '🇿🇦'}, + {'code': '1', 'name': 'US', 'flag': '🇺🇸'}, + {'code': '44', 'name': 'UK', 'flag': '🇬🇧'}, + {'code': '61', 'name': 'AU', 'flag': '🇦🇺'}, + {'code': '91', 'name': 'IN', 'flag': '🇮🇳'}, + {'code': '86', 'name': 'CN', 'flag': '🇨🇳'}, + {'code': '81', 'name': 'JP', 'flag': '🇯🇵'}, + {'code': '49', 'name': 'DE', 'flag': '🇩🇪'}, + {'code': '33', 'name': 'FR', 'flag': '🇫🇷'}, + {'code': '39', 'name': 'IT', 'flag': '🇮🇹'}, + {'code': '34', 'name': 'ES', 'flag': '🇪🇸'}, + {'code': '7', 'name': 'RU', 'flag': '🇷🇺'}, + {'code': '55', 'name': 'BR', 'flag': '🇧🇷'}, + {'code': '52', 'name': 'MX', 'flag': '🇲🇽'}, + {'code': '971', 'name': 'AE', 'flag': '🇦🇪'}, + {'code': '966', 'name': 'SA', 'flag': '🇸🇦'}, + {'code': '234', 'name': 'NG', 'flag': '🇳🇬'}, + {'code': '254', 'name': 'KE', 'flag': '🇰🇪'}, + {'code': '233', 'name': 'GH', 'flag': '🇬🇭'}, + {'code': '256', 'name': 'UG', 'flag': '🇺🇬'}, ]; @override @@ -110,20 +110,24 @@ class _PayScreenState extends State with TickerProviderStateMixin { _setupData() async { prefs = await SharedPreferences.getInstance(); + // check logged in phone number and prefill if exists if (prefs.containsKey('phone')) { updatePhoneNumber(prefs.getString('phone')!); } + // or else check if there's a phone number from a previous transaction and prefill that + else if (transactionController.model.formData.debitPhone != null) { + updatePhoneNumber(transactionController.model.formData.debitPhone!); + } _nameController.text = transactionController.model.formData.creditName ?? ''; _emailController.text = transactionController.model.formData.creditEmail ?? ''; _amountController.text = transactionController.model.formData.amount; - _phoneController.text = - transactionController.model.formData.debitPhone ?? ''; } Future updatePhoneNumber(String newNumber) async { + newNumber = newNumber.replaceAll(RegExp(r'[^0-9]'), ''); for (var country in countryCodes) { if (newNumber.startsWith(country['code']!)) { setState(() { @@ -135,6 +139,10 @@ class _PayScreenState extends State with TickerProviderStateMixin { } } + String getCountryName(String code) { + return countryCodes.firstWhere((c) => c['code'] == code)['name']!; + } + Future _submitPayment(PaymentProcessor e, BuildContext context) async { controller.updateAmount(_amountController.text); if (!controller.model.selectedProvider!.requiresAmount) { @@ -155,6 +163,8 @@ class _PayScreenState extends State with TickerProviderStateMixin { controller.updateSelectedPaymentProcessor(e); transactionController.updateSelectedPaymentProcessor(e); + controller.model.region = getCountryName(selectedCountryCode); + final apiResponse = await controller.doTransaction(); if (!apiResponse.isSuccess) { diff --git a/lib/screens/transaction_controller.dart b/lib/screens/transaction_controller.dart index e40bc21..b155332 100644 --- a/lib/screens/transaction_controller.dart +++ b/lib/screens/transaction_controller.dart @@ -39,6 +39,7 @@ class TransactionModel { providerImage: '', userId: '', providerLabel: '', + region: '', ); String paymentStatus = 'PENDING'; String pollStatus = 'PENDING'; @@ -77,6 +78,7 @@ abstract class FormData with _$FormData { String? gatewayCharge, String? tax, String? totalAmount, + String? region, }) = _FormData; factory FormData.fromJson(Map json) => @@ -143,6 +145,7 @@ class TransactionController extends ChangeNotifier { providerImage: '', userId: '', providerLabel: '', + region: '', ); notifyListeners(); diff --git a/lib/screens/transaction_controller.freezed.dart b/lib/screens/transaction_controller.freezed.dart index 0d18c8d..447b78a 100644 --- a/lib/screens/transaction_controller.freezed.dart +++ b/lib/screens/transaction_controller.freezed.dart @@ -16,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 billProductName; 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; String? get region; /// Create a copy of FormData /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -29,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.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)); + 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)&&(identical(other.region, region) || other.region == region)); } @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,billProductName,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,region]); @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, billProductName: $billProductName, 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, region: $region)'; } @@ -49,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? billProductName, 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, String? region }); @@ -66,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? billProductName = 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,Object? region = 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 @@ -97,6 +97,7 @@ as String?,charge: freezed == charge ? _self.charge : charge // ignore: cast_nul as String?,gatewayCharge: freezed == gatewayCharge ? _self.gatewayCharge : gatewayCharge // ignore: cast_nullable_to_non_nullable as String?,tax: freezed == tax ? _self.tax : tax // ignore: cast_nullable_to_non_nullable as String?,totalAmount: freezed == totalAmount ? _self.totalAmount : totalAmount // ignore: cast_nullable_to_non_nullable +as String?,region: freezed == region ? _self.region : region // ignore: cast_nullable_to_non_nullable as String?, )); } @@ -182,10 +183,10 @@ return $default(_that);case _: /// } /// ``` -@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; +@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, String? region)? $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 $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,_that.region);case _: return orElse(); } @@ -203,10 +204,10 @@ return $default(_that.id,_that.type,_that.billClientId,_that.debitRef,_that.debi /// } /// ``` -@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; +@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, String? region) $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 _: +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,_that.region);case _: throw StateError('Unexpected subclass'); } @@ -223,10 +224,10 @@ return $default(_that.id,_that.type,_that.billClientId,_that.debitRef,_that.debi /// } /// ``` -@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; +@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, String? region)? $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 $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,_that.region);case _: return null; } @@ -238,7 +239,7 @@ return $default(_that.id,_that.type,_that.billClientId,_that.debitRef,_that.debi @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.billProductName, 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, this.region}); factory _FormData.fromJson(Map json) => _$FormDataFromJson(json); @override final String? id; @@ -271,6 +272,7 @@ class _FormData implements FormData { @override final String? gatewayCharge; @override final String? tax; @override final String? totalAmount; +@override final String? region; /// Create a copy of FormData /// with the given fields replaced by the non-null parameter values. @@ -285,16 +287,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.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)); + 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)&&(identical(other.region, region) || other.region == region)); } @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,billProductName,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,region]); @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, billProductName: $billProductName, 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, region: $region)'; } @@ -305,7 +307,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? billProductName, 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, String? region }); @@ -322,7 +324,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? billProductName = 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,Object? region = 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 @@ -353,6 +355,7 @@ as String?,charge: freezed == charge ? _self.charge : charge // ignore: cast_nul as String?,gatewayCharge: freezed == gatewayCharge ? _self.gatewayCharge : gatewayCharge // ignore: cast_nullable_to_non_nullable as String?,tax: freezed == tax ? _self.tax : tax // ignore: cast_nullable_to_non_nullable as String?,totalAmount: freezed == totalAmount ? _self.totalAmount : totalAmount // ignore: cast_nullable_to_non_nullable +as String?,region: freezed == region ? _self.region : region // ignore: cast_nullable_to_non_nullable as String?, )); } diff --git a/lib/screens/transaction_controller.g.dart b/lib/screens/transaction_controller.g.dart index 1e5d7d9..f04bc2b 100644 --- a/lib/screens/transaction_controller.g.dart +++ b/lib/screens/transaction_controller.g.dart @@ -36,6 +36,7 @@ _FormData _$FormDataFromJson(Map json) => _FormData( gatewayCharge: json['gatewayCharge'] as String?, tax: json['tax'] as String?, totalAmount: json['totalAmount'] as String?, + region: json['region'] as String?, ); Map _$FormDataToJson(_FormData instance) => { @@ -68,4 +69,5 @@ Map _$FormDataToJson(_FormData instance) => { 'gatewayCharge': instance.gatewayCharge, 'tax': instance.tax, 'totalAmount': instance.totalAmount, + 'region': instance.region, };