Skip to content
Snippets Groups Projects
Commit 46c8fe00 authored by zidane-itb's avatar zidane-itb
Browse files

add null filter in check payment status batch

parent 921e28d6
Branches
Tags
No related merge requests found
......@@ -13,6 +13,7 @@ import javax.jws.WebService;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
@WebService
......@@ -72,13 +73,13 @@ public class PaymentService {
@WebMethod
public PaymentStatusBatchResp checkPaymentStatusBatch(@WebParam(name = "paymentIds") List<Integer> paymentIds) {
List<Payment> payments = paymentIds.stream().map(paymentId -> {
try {
return paymentDao.queryForId(paymentId);
} catch (SQLException e) {
return null;
}
}).collect(Collectors.toList());
try {
return paymentDao.queryForId(paymentId);
} catch (SQLException e) {
return null;
}
}).filter(Objects::nonNull)
.collect(Collectors.toList());
if (payments.isEmpty()) {
return new PaymentStatusBatchResp("Payment ids not found or unexpected error has happened", null);
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment