File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed
src/main/java/app/banking/services Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -160,18 +160,20 @@ public Object groupedTransfer(GroupTransferPayload payload){
160160 .amount (Math .abs (payload .getAmount ()))
161161 .idAccount (transaction .getReceiver ())
162162 .build ());
163+ AccountBalance defaultBalance = new AccountBalance ();
164+ defaultBalance .setCurrentBalance (0D );
165+ defaultBalance .setIdAccount (transaction .getReceiver ());
163166 AccountBalance targetBalance = balanceRepo
164167 .findCurrentByAccountId (transaction .getReceiver ().getId ())
165- .orElse (null );
166- if (targetBalance != null ){
167- double amount = targetBalance .getCurrentBalance () + payload .getAmount ();
168- transactionService .deposit (DepositPayload
169- .builder ()
170- .label (label )
171- .accountId (transaction .getReceiver ().getId ())
172- .amount (amount )
173- .build ());
174- }
168+ .orElse (defaultBalance );
169+ System .out .println (transaction .getReceiver ().getId ());
170+ double amount = targetBalance .getCurrentBalance () + payload .getAmount ();
171+ transactionService .deposit (DepositPayload
172+ .builder ()
173+ .label (label )
174+ .accountId (transaction .getReceiver ().getId ())
175+ .amount (amount )
176+ .build ());
175177 }
176178 AccountBalance accountBalance = new AccountBalance ();
177179 accountBalance .setIdAccount (transactionGroup .getIdAccount ());
You can’t perform that action at this time.
0 commit comments