File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
src/main/java/org/spacious_team/broker/report_parser/api Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ public List<TransactionCashFlow> getTransactionCashFlows() {
7676 }
7777
7878 protected Optional <TransactionCashFlow > getValueCashFlow (CashFlowType type ) {
79- if (value != null && valueCurrency != null && Math . abs (value . floatValue ()) >= 0.0001 ) {
79+ if (value != null && valueCurrency != null && isNotZero (value ) ) {
8080 return Optional .of (TransactionCashFlow .builder ()
8181 .transactionId (id )
8282 .eventType (type )
@@ -88,7 +88,7 @@ protected Optional<TransactionCashFlow> getValueCashFlow(CashFlowType type) {
8888 }
8989
9090 protected Optional <TransactionCashFlow > getFeeCashFlow () {
91- if (fee != null && feeCurrency != null && Math . abs (fee . floatValue ()) >= 0.0001 ) {
91+ if (fee != null && feeCurrency != null && isNotZero (fee ) ) {
9292 return Optional .of (TransactionCashFlow .builder ()
9393 .transactionId (id )
9494 .eventType (FEE )
@@ -99,6 +99,10 @@ protected Optional<TransactionCashFlow> getFeeCashFlow() {
9999 return Optional .empty ();
100100 }
101101
102+ protected boolean isNotZero (BigDecimal value ) {
103+ return Math .abs (value .floatValue ()) >= 0.0001 ;
104+ }
105+
102106 @ EqualsAndHashCode .Include
103107 @ SuppressWarnings ("unused" )
104108 private @ Nullable BigDecimal getValueForEquals () {
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ public List<TransactionCashFlow> getTransactionCashFlows() {
5252
5353 private Optional <TransactionCashFlow > getAccruedInterestCashFlow () {
5454 // for securities accrued interest = 0
55- if (accruedInterest != null && valueCurrency != null && Math . abs (accruedInterest . floatValue ()) >= 0.0001 ) {
55+ if (accruedInterest != null && valueCurrency != null && isNotZero (accruedInterest ) ) {
5656 return Optional .of (TransactionCashFlow .builder ()
5757 .transactionId (id )
5858 .eventType (CashFlowType .ACCRUED_INTEREST )
You can’t perform that action at this time.
0 commit comments