Skip to content

Commit

Permalink
Bug fix and advance payment fix (#142)
Browse files Browse the repository at this point in the history
* Adpter version update (#131)

* Implementation - Accumulated bill id for consumer code and payment by… (#111)

* Vendor Creation integration for challan create (#115)

* Rahu vendor env (#116)

* Adding role details to vendor's owner.

* PSPCL name in env variable

* removed unnecessary constant

* Version update and change log description

* Cron expr conversion (#133)

* Implementation - Accumulated bill id for consumer code and payment by… (#111)

* Vendor Creation integration for challan create (#115)

* Rahu vendor env (#116)

* Adding role details to vendor's owner.

* PSPCL name in env variable

* removed unnecessary constant

* Version update and change log description

* Time calculation for fiscal event search (PSPCL) - done by cron expression.

* Condition only for more than 6 elements in cron expression.

* Penalty receipt amount fix (#138)

* removing unnecessarily spaces for PSPCL account no. (#139)

* PFM-1001: Advance payment amount correction (#140)
  • Loading branch information
rahu-eGov authored Oct 13, 2022
1 parent aa9ee6b commit efd21ec
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.time.Instant;
import java.util.ArrayList;
import java.util.List;

Expand Down Expand Up @@ -108,7 +107,7 @@ private List<Amount> getAmounts(JsonObject payment, JsonObject data) {
String coaCode = billAccountDetailsJO.get(PAYMENT_RECEIPT_CLIENT_COA_CODE).getAsString();

Amount amount = Amount.builder()
.amount(billAccountDetailsJO.get(PAYMENT_RECEIPT_CLIENT_COA_AMOUNT).getAsBigDecimal())
.amount(billAccountDetailsJO.get(PAYMENT_RECEIPT_CLIENT_COA_ADJUSTED_AMOUNT).getAsBigDecimal())
.coaCode(chartOfAccountService.getResolvedChartOfAccountCode(coaCode))
.fromBillingPeriod(taxPeriodFrom)
.toBillingPeriod(taxPeriodTo).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.time.Instant;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

Expand Down Expand Up @@ -107,17 +108,35 @@ private List<Amount> getAmountDetails(JsonObject payment, JsonObject data) {
JsonObject billAccountDetailsJB = billAccountDetailsJE.getAsJsonObject();
String coaCode = billAccountDetailsJB.get(PAYMENT_RECEIPT_CLIENT_COA_CODE).getAsString();

Amount amount = Amount.builder()
.amount(billAccountDetailsJB.get(PAYMENT_RECEIPT_CLIENT_COA_AMOUNT).getAsBigDecimal())
.coaCode(chartOfAccountService.getResolvedChartOfAccountCode(coaCode))
.fromBillingPeriod(taxPeriodFrom)
.toBillingPeriod(taxPeriodTo).build();
BigDecimal calculatedAmount = getBillAccountDetailAmount(coaCode, billAccountDetailsJB);

amountList.add(amount);
if (new BigDecimal(0).compareTo(calculatedAmount) != 0) {

Amount amount = Amount.builder()
.amount(calculatedAmount)
.coaCode(chartOfAccountService.getResolvedChartOfAccountCode(coaCode))
.fromBillingPeriod(taxPeriodFrom)
.toBillingPeriod(taxPeriodTo).build();

amountList.add(amount);
}
});
});
}

return amountList;
}

/**
* @param taxHeadCode
* @param billAccountDetailsJB
* @return
*/
private BigDecimal getBillAccountDetailAmount(@NotNull String taxHeadCode, @NotNull JsonObject billAccountDetailsJB) {
if (taxHeadCode.contains(ADVANCE_TAX_HEAD_CODE_SUBSTRING)) {
return billAccountDetailsJB.get(PAYMENT_RECEIPT_CLIENT_COA_AMOUNT).getAsBigDecimal();
}else {
return billAccountDetailsJB.get(PAYMENT_RECEIPT_CLIENT_COA_ADJUSTED_AMOUNT).getAsBigDecimal();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ private Optional<String> getDepartmentEntityCode(FiscalEvent fiscalEvent) {
"PSPCL account number is missing from attributes section of fiscal event");
throw new GenericCustomException(PSPCL, "PSPCL account number is missing from attributes section");
} else {
return objectNodeAttribute.get("pspclAccountNumber").asText();
return StringUtils.trimAllWhitespace(objectNodeAttribute.get("pspclAccountNumber").asText());
}
} catch (JsonProcessingException e) {
pspclEventPersistenceService.saveFailedPspclEventDetail(NA, NA, NA,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ public class EventConstants {
public static final String PAYMENT_RECEIPT_TRANSACTION_DATE = "transactionDate";
public static final String PAYMENT_RECEIPT_FROM_BILLING_PERIOD = "fromPeriod";
public static final String PAYMENT_RECEIPT_TO_BILLING_PERIOD = "toPeriod";
public static final String PAYMENT_RECEIPT_CLIENT_COA_AMOUNT = "adjustedAmount";
public static final String PAYMENT_RECEIPT_CLIENT_COA_ADJUSTED_AMOUNT = "adjustedAmount";
public static final String PAYMENT_RECEIPT_CLIENT_COA_AMOUNT = "amount";
public static final String BILL_ACCOUNT_DETAILS = "billAccountDetails";
public static final String PAYMENT_RECEIPT_CLIENT_COA_CODE = "taxHeadCode";
public static final String CONSUMER_CODE = "consumerCode";
Expand Down Expand Up @@ -88,5 +89,6 @@ public class EventConstants {
public static final String CLIENT_SECRET = "client_secret";
public static final String CLIENT_ID = "client_id";
public static final String OWNER_ROLE_CITIZEN = "CITIZEN";
public static final String ADVANCE_TAX_HEAD_CODE_SUBSTRING = "ADVANCE";

}

0 comments on commit efd21ec

Please sign in to comment.