Skip to content
This repository has been archived by the owner on Nov 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #374 from egovernments/mdms-state-tenant-level-config
Browse files Browse the repository at this point in the history
MDMS-State and Tenant Level config Changes for fetching Penalty and a…
  • Loading branch information
Ramkrishna-egov authored Feb 24, 2023
2 parents cdbe51f + a994427 commit 9585ded
Show file tree
Hide file tree
Showing 5 changed files with 148 additions and 96 deletions.
33 changes: 28 additions & 5 deletions frontend/mgramseva/lib/providers/collect_payment.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'dart:async';
import 'dart:typed_data';

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -112,9 +111,21 @@ class CollectPaymentProvider with ChangeNotifier {
} else {}

if (paymentDetails != null) {
var commonProvider = Provider.of<CommonProvider>(
navigatorKey.currentContext!,
listen: false);
if (mdmsData == null) {
mdmsData = await CommonProvider.getMdmsBillingService();
paymentDetails.first.mdmsData = mdmsData;
mdmsData = await CommonProvider.getMdmsBillingService(
commonProvider.userDetails!.selectedtenant?.code.toString() ??
commonProvider.userDetails!.userRequest!.tenantId.toString());
if (mdmsData.mdmsRes?.billingService?.taxHeadMasterList != null &&
mdmsData.mdmsRes!.billingService!.taxHeadMasterList!.isNotEmpty) {
paymentDetails.first.mdmsData = mdmsData;
} else {
mdmsData = await CommonProvider.getMdmsBillingService(
commonProvider.userDetails!.userRequest!.tenantId.toString());
paymentDetails.first.mdmsData = mdmsData;
}
}

paymentDetails.first.billDetails
Expand Down Expand Up @@ -394,7 +405,7 @@ class CollectPaymentProvider with ChangeNotifier {
navigatorKey.currentContext!,
listen: false);
var res = await CoreRepository().getMdms(getMdmsPaymentModes(
commonProvider.userDetails!.userRequest!.tenantId.toString()));
commonProvider.userDetails!.selectedtenant!.code.toString()));
if (res.mdmsRes?.billingService != null &&
res.mdmsRes?.billingService?.businessServiceList != null) {
Constants.PAYMENT_METHOD.forEach((e) {
Expand All @@ -406,8 +417,20 @@ class CollectPaymentProvider with ChangeNotifier {
}
});
fetchBill.paymentMethod = paymentModeList.first.key;
notifyListeners();
} else {
var mdms = await CoreRepository().getMdms(getMdmsPaymentModes(
commonProvider.userDetails!.userRequest!.tenantId.toString()));
Constants.PAYMENT_METHOD.forEach((e) {
var index = mdms.mdmsRes?.billingService?.businessServiceList?.first
.collectionModesNotAllowed!
.indexOf(e.key);
if (index == -1) {
paymentModeList.add(KeyValue(e.key, e.label));
}
});
fetchBill.paymentMethod = paymentModeList.first.key;
}
notifyListeners();
}

Future<void> updatePaymentInformation(
Expand Down
7 changes: 3 additions & 4 deletions frontend/mgramseva/lib/providers/common_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -907,15 +907,14 @@ class CommonProvider with ChangeNotifier {
.abs();
}

static Future<PaymentType> getMdmsBillingService() async {
static Future<PaymentType> getMdmsBillingService(String tenantId) async {
try {
var commonProvider = Provider.of<CommonProvider>(
navigatorKey.currentContext!,
listen: false);

return await CoreRepository().getPaymentTypeMDMS(getMdmsPaymentModes(
commonProvider.userDetails!.selectedtenant?.code.toString() ??
commonProvider.userDetails!.userRequest!.tenantId.toString()));
return await CoreRepository()
.getPaymentTypeMDMS(getMdmsPaymentModes(tenantId));
} catch (e) {
return PaymentType();
}
Expand Down
Loading

0 comments on commit 9585ded

Please sign in to comment.