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 #376 from egovernments/develop
Browse files Browse the repository at this point in the history
changes required as part of the ticket https://digit-discuss.atlassian.net/browse/PFM-2501
and making penalty configurable to use both state and tenant
  • Loading branch information
snehal-eGov authored Mar 2, 2023
2 parents 357491e + 6a4a6c0 commit ad9cb98
Show file tree
Hide file tree
Showing 8 changed files with 160 additions and 109 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 ad9cb98

Please sign in to comment.