Nabeel-DG-BS
Raja Nabeel 1 year ago
parent 92b91f9628
commit c8b90452cc

@ -18,10 +18,12 @@ public class CashInTransactionRequest {
private String drMbmBkmstitle;
private String drPcrCurrcode;
private String drPcrCurrdesc;
private String drPcrCurrshort;
private String crMbmBkmsnumber;
private String crMbmBkmstitle;
private String crPcrCurrcode;
private String crPcrCurrdesc;
private String crPcrCurrshort;
private String sgtGntrnarration;
private String dmpProdCode;
private String transType;

@ -57,6 +57,10 @@ public class TransactionTrail {
private String drpcrCurrdesc;
@Column(name = "DR_PCR_CURRCODE", columnDefinition = FieldNameLength.PCR_CURRCODE)
private String drPcrCurrcode;
@Column(name = "DR_PCR_CURRSHORT", nullable = false, columnDefinition = FieldNameLength.DESCRIPTION_LONG)
private String drPcrCurrshort;
@Column(name = "cR_PCR_CURRSHORT", nullable = false, columnDefinition = FieldNameLength.DESCRIPTION_LONG)
private String crPcrCurrshort;
@Column(name = "CR_PCR_CURRDESC", nullable = false, columnDefinition = FieldNameLength.DESCRIPTION_LONG)
private String crPcrCurrdesc;
@Column(name = "CR_PCR_CURRCODE", columnDefinition = FieldNameLength.PCR_CURRCODE)

@ -46,11 +46,13 @@ public class TransactionService {
.dmpProdcode(transactionRequest.getDmpProdCode())
.drmbmBkmstitle(transactionRequest.getDrMbmBkmstitle())
.drpcrCurrdesc(transactionRequest.getDrPcrCurrdesc())
.drPcrCurrshort(transactionRequest.getDrPcrCurrshort())
.cmpCustcode(transactionRequest.getCmpCustcode())
.drPcrCurrcode(transactionRequest.getDrPcrCurrcode())
.crMbmBkmstitle(transactionRequest.getCrMbmBkmstitle())
.crPcrCurrdesc(transactionRequest.getCrPcrCurrdesc())
.crPcrCurrcode(transactionRequest.getCrPcrCurrcode())
.crPcrCurrshort(transactionRequest.getCrPcrCurrshort())
.sgtSentGntrnumber(null)
.drSgtGntrdate(LocalDate.now())
.sgtGntramt(BigDecimal.valueOf(transactionRequest.getSgtGntramtfc()))
@ -98,8 +100,9 @@ public class TransactionService {
Map<String, Object> response = new HashMap<>();
Optional<TransactionTrail> transactionTrail = transactionTrailRepository.findById(Math.toIntExact(cashOutTransactionRequest.getId()));
if (transactionTrail.isPresent()) {
CoreCashOutTransaction cashOutTransaction = CoreCashOutTransaction.builder()
.crPcrCurrcode("123")
.crPcrCurrcode(transactionTrail.get().getCrPcrCurrcode())
.crMbmBkmsnumber(transactionTrail.get().getCrMbmBkmsnumber())
.porOrgacode(cashOutTransactionRequest.getPorOrgacode())
.otdTrancomment(cashOutTransactionRequest.getId() + "_Received")
@ -157,21 +160,20 @@ public class TransactionService {
}
public double convertCurrency(String baseCurrencyCode, String targetCurrencyCode, double amount, Map<String, Double> exchangeRates) {
if (baseCurrencyCode.equals(targetCurrencyCode)) {
return amount;
}
if (baseCurrencyCode.equals("default")) {
return exchangeRates.get(targetCurrencyCode) * amount;
} else if (targetCurrencyCode.equals("default")) {
return exchangeRates.get(baseCurrencyCode) * amount;
}
if (baseCurrencyCode.equals(targetCurrencyCode)) {
return amount;
}
if (!exchangeRates.containsKey(baseCurrencyCode) || !exchangeRates.containsKey(targetCurrencyCode)) {
throw new IllegalArgumentException("Unsupported currency code");
}
double amountInPKR = amount * exchangeRates.get(baseCurrencyCode);
double amountInTargetCurrency = amountInPKR / exchangeRates.get(targetCurrencyCode);
return amountInTargetCurrency;
}

Loading…
Cancel
Save