Skip to content

Commit

Permalink
revert uralsib CouponAmortizationRedemptionTable logic
Browse files Browse the repository at this point in the history
  • Loading branch information
vananiev committed Nov 5, 2024
1 parent cdb7b80 commit d2b69ef
Showing 1 changed file with 3 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public CouponAmortizationRedemptionTable(UralsibBrokerReport report,
protected Collection<SecurityEventCashFlow> parseRowToCollection(TableRow row) {
@Nullable CashFlowType event;
String action = row.getStringCellValue(OPERATION);
action = String.valueOf(action).toLowerCase().trim();
action = action.toLowerCase().trim();
if (action.equalsIgnoreCase("погашение купона")) {
event = CashFlowType.COUPON;
} else if (action.equalsIgnoreCase("погашение номинала")) { // и амортизация и погашение
Expand All @@ -70,7 +70,7 @@ protected Collection<SecurityEventCashFlow> parseRowToCollection(TableRow row) {
Instant timestamp = convertToInstant(row.getStringCellValue(DATE));

if (event == null) {
if (isRedemption(security.getName(), timestamp)) {
if (isRedemption(requireNonNull(security.getName()), timestamp)) {
event = CashFlowType.REDEMPTION;
} else {
event = CashFlowType.AMORTIZATION;
Expand Down Expand Up @@ -100,10 +100,7 @@ protected Collection<SecurityEventCashFlow> parseRowToCollection(TableRow row) {
return data;
}

private boolean isRedemption(@Nullable String securityName, Instant amortizationDay) {
if (isNull(securityName)) {
return false;
}
private boolean isRedemption(String securityName, Instant amortizationDay) {
@Nullable LocalDate redemptionDate = redemptionDates.stream()
.filter(e -> securityName.equalsIgnoreCase(e.getKey()))
.map(Map.Entry::getValue)
Expand All @@ -112,9 +109,4 @@ private boolean isRedemption(@Nullable String securityName, Instant amortization
.orElse(null);
return nonNull(redemptionDate) && redemptionDate.equals(LocalDate.ofInstant(amortizationDay, getReport().getReportZoneId()));
}

protected BigDecimal getTax(Table table, TableRow row) {
// информация о налоге по купонам облигаций не выводится в отчет брокера
return BigDecimal.ZERO;
}
}

0 comments on commit d2b69ef

Please sign in to comment.