Этот метод проверяет лимит карты с которой переводим, нужно добавить проверку карты на…
- User
Этот метод проверяет лимит карты с которой переводим, нужно добавить проверку карты на которую переводим public boolean checkCard2cardLimit(FraudCheckRequest request, PayLimitType payLimitType) { LocalDateTime truncDateDay = LocalDateTime.now().truncatedTo(ChronoUnit.DAYS); LocalDateTime truncDateMonth = truncDateDay.withDayOfMonth(1); LocalDateTime thresholdDate = PayLimitType.DAILY.equals(payLimitType) ? truncDateDay : truncDateMonth; log.info("[checkCard2cardLimit] thresholdDate = {}", thresholdDate); String panHashCode = md5Hex(request.getPan()); log.info("[checkCard2cardLimit] panHashCode = {}", panHashCode); List turnoverList = dataService.selectFromWhere(QBusinessOperationTurnover.businessOperationTurnover, QBusinessOperationTurnover.class, p -> p.panHash.eq(panHashCode). and(p.processingDate.goe(thresholdDate))).fetch(); log.info("[checkCard2cardLimit] turnoverList = {}", new Gson().toJson(turnoverList)); BigDecimal previousAmount = turnoverList.stream().map(BusinessOperationTurnover::getSumAmount).reduce(BigDecimal.ZERO, BigDecimal::add); log.info("[checkCard2cardLimit] previousAmount = {}", previousAmount); BigDecimal currentAmount = previousAmount.add(request.getAmount()); log.info("[checkCard2cardLimit] currentAmount = {}", currentAmount); BigDecimal limit = PayLimitType.DAILY.equals(payLimitType) ? getTransferLimit(NcsProperty.KEY_CARD2CARD_DAY_LIMIT) : getTransferLimit(NcsProperty.KEY_CARD2CARD_MONTH_LIMIT); log.info("[checkCard2cardLimit] limit = {}", limit); if (limit == null) { log.info("[checkCard2cardLimit] limit value = null, returning true"); return true; } return currentAmount.compareTo(limit) < 1; }
- Assistant
Для добавления проверки карты, на которую происходит перевод, нужно получить хэш-код пан-номера этой карты и добавить его в условие выборки данных:
String recipientPanHashCode = md5Hex(request.getRecipientPan()); ... List<BusinessOperationTurnover> turnoverList = dataService.selectFromWhere(QBusinessOperationTurnover.businessOperationTurnover, QBusinessOperationTurnover.class, p -> p.panHash.eq(panHashCode). and(p.recipientPanHash.eq(recipientPanHashCode)). and(p.processingDate.goe(thresholdDate))).fetch();В этом случае, в предыдущем списке
turnoverListбудут только транзакции с указанной карты "получателя".Нужно также обновить соответствующие логи, чтобы они отображали информацию о проверяемой карте "получателе" и новый список
turnoverList:log.info("[checkCard2cardLimit] recipientPanHashCode = {}", recipientPanHashCode); ... log.info("[checkCard2cardLimit] turnoverList = {}", new Gson().toJson(turnoverList)); ... log.info("[checkCard2cardLimit] previousAmount = {}", previousAmount); log.info("[checkCard2cardLimit] currentAmount = {}", currentAmount); log.info("[checkCard2cardLimit] limit = {}", limit);
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.