Wallet amount reload

pull/324/head
Haroon Amjad 3 weeks ago
parent 89670445b3
commit 3590dfc511

@ -30,6 +30,7 @@ class HabibWalletViewModel extends ChangeNotifier {
num habibWalletAmount = 0;
num walletRechargeAmount = 0;
String notesText = "";
bool isWalletAmountToBeLoaded = true;
bool isBottomSheetContentLoading = false;
@ -392,6 +393,11 @@ class HabibWalletViewModel extends ChangeNotifier {
notifyListeners();
}
setIsWalletAmountToBeLoaded(bool value) {
isWalletAmountToBeLoaded = value;
notifyListeners();
}
String getSelectedRechargeTypeValue() {
switch (selectedRechargeType) {
case 1:
@ -406,6 +412,9 @@ class HabibWalletViewModel extends ChangeNotifier {
}
Future<void> getPatientBalanceAmount({Function(dynamic)? onSuccess, Function(String)? onError}) async {
if (!isWalletAmountToBeLoaded) {
return;
}
isWalletAmountLoading = true;
notifyListeners();
@ -425,6 +434,7 @@ class HabibWalletViewModel extends ChangeNotifier {
habibWalletBalanceList.removeWhere((element) => element.patientAdvanceBalanceAmount == 0);
isWalletAmountLoading = false;
isWalletAmountToBeLoaded = false;
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);
@ -462,12 +472,7 @@ class HabibWalletViewModel extends ChangeNotifier {
Function(dynamic)? onSuccess,
Function(String)? onError}) async {
final result = await habibWalletRepo.HISCreateAdvancePayment(
paymentMethodName: paymentMethodName,
paidAmount: paidAmount,
paymentReference: paymentReference,
patientID: patientID,
projectID: projectID,
depositorName: depositorName);
paymentMethodName: paymentMethodName, paidAmount: paidAmount, paymentReference: paymentReference, patientID: patientID, projectID: projectID, depositorName: depositorName);
result.fold(
// (failure) async => await errorHandlerService.handleError(failure: failure),
@ -489,8 +494,7 @@ class HabibWalletViewModel extends ChangeNotifier {
);
}
Future<void> addAdvanceNumberRequest(
{required String advanceNumber, required String paymentReference, Function(dynamic)? onSuccess, Function(String)? onError}) async {
Future<void> addAdvanceNumberRequest({required String advanceNumber, required String paymentReference, Function(dynamic)? onSuccess, Function(String)? onError}) async {
final result = await habibWalletRepo.addAdvanceNumberRequest(advanceNumber: advanceNumber, paymentReference: paymentReference);
result.fold(
@ -538,8 +542,7 @@ class HabibWalletViewModel extends ChangeNotifier {
lakumAccountInfo = LakumInquiryInformationResponseModel();
notifyListeners();
final result = await habibWalletRepo.getLakumAccountInformation(
identificationNumber: getIt.get<AppState>().getAuthenticatedUser()!.patientIdentificationNo ?? "");
final result = await habibWalletRepo.getLakumAccountInformation(identificationNumber: getIt.get<AppState>().getAuthenticatedUser()!.patientIdentificationNo ?? "");
result.fold(
(failure) async => await errorHandlerService.handleError(failure: failure),

Loading…
Cancel
Save