Java tutorial
package com.etcc.csc.presentation.datatype; import com.etcc.csc.datatype.Invoice; import com.etcc.csc.datatype.MSPaymentAdjust; import com.etcc.csc.datatype.MonthlyStatement; import com.etcc.csc.datatype.Violation; import com.etcc.csc.dto.LicensePlateDTO; import com.etcc.csc.dto.PaymentResultDTO; import com.etcc.csc.dto.TagDTO; import com.etcc.csc.util.BigDecimalUtil; import java.math.BigDecimal; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.lang.ArrayUtils; public class PaymentContext { private CreditCard paymentMethod; private boolean savePaymentMethod; private Invoice[] invoices; private Invoice[] veaLicPlates; private Violation[] violations; private TagDTO[] tags; private com.etcc.csc.dto.TagDTO[] addedTags; private BigDecimal tagAmount; private BigDecimal originalTagAmount; private BigDecimal transactionId; private boolean veaAccepted; private String paymentId; private String callBack; private LoginCreationInfo loginCreation; private boolean paymentComplete; private String postingStatus; private BigDecimal depAmount; private String trackLink; private Invoice[] monthlyStatementInvoices; private MonthlyStatement monthlyStatement; private MSPaymentAdjust[] msPmtAdjArr; private MSPaymentAdjust[] msRecentPmtAdjArr; private Invoice[] priorInvs; private Invoice[] firstInvs; private Invoice[] secondInvs; private Invoice[] collectionInvs; private Invoice[] legalInvs; private Invoice[] nttaTollInvs; private Invoice[] highwayTollInvs; private List<PaymentResultDTO> paymentResultDTOs; public PaymentContext() { } public void setPaymentMethod(CreditCard paymentMethod) { this.paymentMethod = paymentMethod; } public CreditCard getPaymentMethod() { return paymentMethod; } public void setSavePaymentMethod(boolean savePaymentMethod) { this.savePaymentMethod = savePaymentMethod; } public boolean getSavePaymentMethod() { return savePaymentMethod; } public BigDecimal getAuthorizedInvoiceAmount() { BigDecimal total = new BigDecimal(0.0); if (!ArrayUtils.isEmpty(invoices)) { for (int i = 0; i < invoices.length; i++) { if (invoices[i].isAuthorized()) { total = total.add(invoices[i].getTollAmount()); } } } return total; } public BigDecimal getAuthorizedStatementAmount() { BigDecimal total = new BigDecimal(0.0); Invoice[] authorizedStatementInvoices = getAuthorizedStatementInvoices(); List<Invoice> tempList = new ArrayList<Invoice>(); if (!ArrayUtils.isEmpty(authorizedStatementInvoices)) { for (int i = 0; i < authorizedStatementInvoices.length; i++) { total = total.add(authorizedStatementInvoices[i].getAmount()); tempList.add(authorizedStatementInvoices[i]); } } return total; } public BigDecimal getAuthorizedInvoiceFeeAmount() { BigDecimal total = new BigDecimal(0.0); if (!ArrayUtils.isEmpty(invoices)) { for (int i = 0; i < invoices.length; i++) { if (invoices[i].isAuthorized()) { total = total.add(BigDecimalUtil.nullSafe(invoices[i].getFeeAmount())); } } } return total; } // Added For Rite 2041 public BigDecimal getAuthorizedInvoiceAdminFeeAmount() { BigDecimal total = new BigDecimal(0.0); if (!ArrayUtils.isEmpty(invoices)) { for (int i = 0; i < invoices.length; i++) { if (invoices[i].isAuthorized()) { total = total.add(BigDecimalUtil.nullSafe(invoices[i].getInvoiceAdminFee())); } } } return total; } // RITE 2128-0 public BigDecimal getAuthorizedInvSecondNoticeAdminFee() { BigDecimal total = new BigDecimal(0.0); if (!ArrayUtils.isEmpty(invoices)) { for (int i = 0; i < invoices.length; i++) { if (invoices[i].isAuthorized()) { total = total.add(BigDecimalUtil.nullSafe(invoices[i].getInvSecondNoticeAdminFee())); } } } return total; } public BigDecimal getAuthorizedViolationAmount() { BigDecimal total = new BigDecimal(0.0); if (!ArrayUtils.isEmpty(violations)) { for (int i = 0; i < violations.length; i++) { if (violations[i].isAuthorized()) { total = total.add(violations[i].getCashAmount()); } } } return total; } public BigDecimal getInvoiceAmount() { BigDecimal total = new BigDecimal(0.0); if (!ArrayUtils.isEmpty(invoices)) { for (int i = 0; i < invoices.length; i++) { total = total.add(invoices[i].getAmount()); } } return total; } public BigDecimal getInvoiceVeaAmount() { BigDecimal total = new BigDecimal(0.0); if (!ArrayUtils.isEmpty(invoices)) { for (int i = 0; i < invoices.length; i++) { total = total.add(BigDecimalUtil.nullSafe(invoices[i].getVeaAmount())); } } return total; } public BigDecimal getViolationAmount() { BigDecimal total = new BigDecimal(0.0); if (!ArrayUtils.isEmpty(violations)) { for (int i = 0; i < violations.length; i++) { total = total.add(violations[i].getCashAmount()); } } return total; } public BigDecimal getInvoiceFeeAmount() { BigDecimal total = new BigDecimal(0.0); if (!ArrayUtils.isEmpty(invoices)) { for (int i = 0; i < invoices.length; i++) { total = total.add(BigDecimalUtil.nullSafe(invoices[i].getOnlineFee())); } } return total; } public BigDecimal getViolationFeeAmount() { BigDecimal total = new BigDecimal(0.0); if (!ArrayUtils.isEmpty(violations)) { for (int i = 0; i < violations.length; i++) { total = total.add(BigDecimalUtil.nullSafe(violations[i].getOnlineFee())); } } return total; } public BigDecimal getAuthorizedViolationFeeAmount() { BigDecimal total = new BigDecimal(0.0); if (!ArrayUtils.isEmpty(violations)) { for (int i = 0; i < violations.length; i++) { if (violations[i].isAuthorized()) { total = total.add(BigDecimalUtil.nullSafe(violations[i].getOnlineFee())); } } } return total; } public BigDecimal getPaymentAmount() { if (this.getMonthlyStatement() != null) { return BigDecimalUtil.nullSafe(getAuthorizedViolationAmount()) .add(BigDecimalUtil.nullSafe(getTagAmount())) .add(BigDecimalUtil.nullSafe(getAuthorizedInvoiceAdminFeeAmount())) .add(BigDecimalUtil.nullSafe(getAuthorizedInvoiceFeeAmount())) .add(BigDecimalUtil.nullSafe(getAuthorizedInvSecondNoticeAdminFee())) .add(BigDecimalUtil.nullSafe(getAuthorizedViolationFeeAmount())) .add(BigDecimalUtil.nullSafe(getDepAmount())) .add(BigDecimalUtil.nullSafe(getAuthorizedStatementAmount())); } else { return BigDecimalUtil.nullSafe(getAuthorizedInvoiceAmount()) .add(BigDecimalUtil.nullSafe(getAuthorizedViolationAmount())) .add(BigDecimalUtil.nullSafe(getTagAmount())) .add(BigDecimalUtil.nullSafe(getAuthorizedInvoiceAdminFeeAmount())) .add(BigDecimalUtil.nullSafe(getAuthorizedInvoiceFeeAmount())) .add(BigDecimalUtil.nullSafe(getAuthorizedViolationFeeAmount())) .add(BigDecimalUtil.nullSafe(getAuthorizedInvSecondNoticeAdminFee())) .add(BigDecimalUtil.nullSafe(getDepAmount())); } } public void setInvoices(Invoice[] invoices) { this.invoices = invoices; } public Invoice[] getInvoices() { return invoices; } public void setViolations(Violation[] violations) { this.violations = violations; } public Violation[] getViolations() { return violations; } public void setTags(TagDTO[] tags) { this.tags = tags; } public TagDTO[] getTags() { return tags; } public void setTagAmount(BigDecimal tagAmount) { this.tagAmount = tagAmount != null ? tagAmount : new BigDecimal(0.0); } public BigDecimal getTagAmount() { return tagAmount; } public void setVeaAccepted(boolean veaAccepted) { this.veaAccepted = veaAccepted; } public boolean isVeaAccepted() { return false; } public void setVeaLicPlates(Invoice[] veaLicPlates) { this.veaLicPlates = veaLicPlates; } public Invoice[] getVeaLicPlates() { return veaLicPlates; } public boolean getVeaEligible() { /* if (!ArrayUtils.isEmpty(invoices)) { for (int i = 0; i < invoices.length; i++) { if (invoices[i].isVeaEligible()) { return true; } } } */ return false; } public Invoice[] getDistinctLicPlates() { if (!ArrayUtils.isEmpty(invoices)) { HashMap veaLicPlatesMap = new HashMap(); for (int i = 0; i < invoices.length; i++) { veaLicPlatesMap.put(invoices[i].getLicPlateNumber() + invoices[i].getLicPlateState(), invoices[i]); } return (Invoice[]) veaLicPlatesMap.values().toArray(new Invoice[0]); } return null; } public void setTransactionId(BigDecimal transactionId) { this.transactionId = transactionId; } public BigDecimal getTransactionId() { return transactionId; } public Invoice[] getAuthorizedInvoices() { if (!ArrayUtils.isEmpty(invoices)) { ArrayList list = new ArrayList(); for (int i = 0; i < invoices.length; i++) { if (invoices[i].isAuthorized()) { list.add(invoices[i]); } } if (!list.isEmpty()) { return (Invoice[]) list.toArray(new Invoice[0]); } } return null; } public List<Invoice> getAuthorizedPriorInvs() { List<Invoice> list = new ArrayList<Invoice>(); if (!ArrayUtils.isEmpty(priorInvs)) { for (int i = 0; i < priorInvs.length; i++) { if (priorInvs[i].isAuthorized()) { list.add(priorInvs[i]); } } } return list; } public boolean getOpenPriorInvExists() { if (!ArrayUtils.isEmpty(priorInvs)) { for (int i = 0; i < priorInvs.length; i++) { if ("N".equals(priorInvs[i].getPaidIndicator())) { return true; } } } return false; } public BigDecimal getPriorInvTotalUnPaidAmount() { BigDecimal amount = BigDecimal.ZERO; if (!ArrayUtils.isEmpty(priorInvs)) { for (int i = 0; i < priorInvs.length; i++) { if ("N".equals(priorInvs[i].getPaidIndicator())) { amount = amount.add(priorInvs[i].getAmount()); } } } return amount; } public List<Invoice> getAuthorizedNttaTollInvs() { List<Invoice> list = new ArrayList<Invoice>(); if (!ArrayUtils.isEmpty(nttaTollInvs)) { for (int i = 0; i < nttaTollInvs.length; i++) { if (nttaTollInvs[i].isAuthorized()) { list.add(nttaTollInvs[i]); } } } return list; } public boolean getOpenNttaTollInvExists() { if (!ArrayUtils.isEmpty(nttaTollInvs)) { for (int i = 0; i < nttaTollInvs.length; i++) { if ("N".equals(nttaTollInvs[i].getPaidIndicator())) { return true; } } } return false; } public BigDecimal getNttaTollTotalUnPaidInvAmount() { BigDecimal amount = new BigDecimal(0.0); if (!ArrayUtils.isEmpty(nttaTollInvs)) { for (int i = 0; i < nttaTollInvs.length; i++) { if ("N".equals(nttaTollInvs[i].getPaidIndicator())) { amount = amount.add(nttaTollInvs[i].getAmount()); } } } return amount; } public List<Invoice> getAuthorizedHighwayTollInvs() { List<Invoice> list = new ArrayList<Invoice>(); if (!ArrayUtils.isEmpty(highwayTollInvs)) { for (int i = 0; i < highwayTollInvs.length; i++) { if (highwayTollInvs[i].isAuthorized()) { list.add(highwayTollInvs[i]); } } } return list; } public boolean getOpenHighwayTollInvExists() { if (!ArrayUtils.isEmpty(highwayTollInvs)) { for (int i = 0; i < highwayTollInvs.length; i++) { if ("N".equals(highwayTollInvs[i].getPaidIndicator())) { return true; } } } return false; } public BigDecimal getHighwayTollTotalUnPaidInvAmount() { BigDecimal amount = BigDecimal.ZERO; if (!ArrayUtils.isEmpty(highwayTollInvs)) { for (int i = 0; i < highwayTollInvs.length; i++) { if ("N".equals(highwayTollInvs[i].getPaidIndicator())) { amount = amount.add(highwayTollInvs[i].getAmount()); } } } return amount; } public List<Invoice> getAuthorizedFirstInvs() { List<Invoice> list = new ArrayList<Invoice>(); if (!ArrayUtils.isEmpty(firstInvs)) { for (int i = 0; i < firstInvs.length; i++) { if (firstInvs[i].isAuthorized()) { list.add(firstInvs[i]); } } } return list; } public boolean getOpenFirstInvExists() { if (!ArrayUtils.isEmpty(firstInvs)) { for (int i = 0; i < firstInvs.length; i++) { if ("N".equals(firstInvs[i].getPaidIndicator())) { return true; } } } return false; } public BigDecimal getFirstInvTotalUnPaidAmount() { BigDecimal amount = BigDecimal.ZERO; if (!ArrayUtils.isEmpty(firstInvs)) { for (int i = 0; i < firstInvs.length; i++) { if ("N".equals(firstInvs[i].getPaidIndicator())) { amount = amount.add(firstInvs[i].getAmount()); } } } return amount; } public BigDecimal getFirstInvTotalTollDue() { BigDecimal amount = BigDecimal.ZERO; if (!ArrayUtils.isEmpty(firstInvs)) { for (int i = 0; i < firstInvs.length; i++) { if ("N".equals(firstInvs[i].getPaidIndicator())) { amount = amount.add(firstInvs[i].getAmount()).subtract(firstInvs[i].getInvoiceAdminFee()) .subtract(firstInvs[i].getAdjustedTxnFees()) .subtract(firstInvs[i].getInvSecondNoticeAdminFee()); } } } return amount; } public BigDecimal getFirstInvTotalTXNAdminFee() { BigDecimal amount = BigDecimal.ZERO; if (!ArrayUtils.isEmpty(firstInvs)) { for (int i = 0; i < firstInvs.length; i++) { if ("N".equals(firstInvs[i].getPaidIndicator())) { amount = amount.add(BigDecimalUtil.nullSafe(firstInvs[i].getAdjustedTxnFees())); } } } return amount; } public BigDecimal getFirstInvTotalFNAdminFee() { BigDecimal amount = BigDecimal.ZERO; if (!ArrayUtils.isEmpty(firstInvs)) { for (int i = 0; i < firstInvs.length; i++) { if ("N".equals(firstInvs[i].getPaidIndicator())) { amount = amount.add(BigDecimalUtil.nullSafe(firstInvs[i].getInvoiceAdminFee())); } } } return amount; } public BigDecimal getFirstInvTotalSNAdminFee() { BigDecimal amount = BigDecimal.ZERO; if (!ArrayUtils.isEmpty(firstInvs)) { for (int i = 0; i < firstInvs.length; i++) { if ("N".equals(firstInvs[i].getPaidIndicator())) { amount = amount.add(BigDecimalUtil.nullSafe(firstInvs[i].getInvSecondNoticeAdminFee())); } } } return amount; } public List<Invoice> getAuthorizedSecondInvs() { List<Invoice> list = new ArrayList<Invoice>(); if (!ArrayUtils.isEmpty(secondInvs)) { for (int i = 0; i < secondInvs.length; i++) { if (secondInvs[i].isAuthorized()) { list.add(secondInvs[i]); } } } return list; } public boolean getOpenSecondInvExists() { if (!ArrayUtils.isEmpty(secondInvs)) { for (int i = 0; i < secondInvs.length; i++) { if ("N".equals(secondInvs[i].getPaidIndicator())) { return true; } } } return false; } public BigDecimal getSecondInvTotalUnPaidAmount() { BigDecimal amount = BigDecimal.ZERO; if (!ArrayUtils.isEmpty(secondInvs)) { for (int i = 0; i < secondInvs.length; i++) { if ("N".equals(secondInvs[i].getPaidIndicator())) { amount = amount.add(secondInvs[i].getAmount()); } } } return amount; } public BigDecimal getSecondInvTotalTollDue() { BigDecimal amount = BigDecimal.ZERO; if (!ArrayUtils.isEmpty(secondInvs)) { for (int i = 0; i < secondInvs.length; i++) { if ("N".equals(secondInvs[i].getPaidIndicator())) { amount = amount.add(secondInvs[i].getAmount()).subtract(secondInvs[i].getInvoiceAdminFee()) .subtract(secondInvs[i].getAdjustedTxnFees()) .subtract(secondInvs[i].getInvSecondNoticeAdminFee()); } } } return amount; } public BigDecimal getSecondInvTotalTXNAdminFee() { BigDecimal amount = BigDecimal.ZERO; if (!ArrayUtils.isEmpty(secondInvs)) { for (int i = 0; i < secondInvs.length; i++) { if ("N".equals(secondInvs[i].getPaidIndicator())) { amount = amount.add(BigDecimalUtil.nullSafe(secondInvs[i].getAdjustedTxnFees())); } } } return amount; } public BigDecimal getSecondInvTotalFNAdminFee() { BigDecimal amount = BigDecimal.ZERO; if (!ArrayUtils.isEmpty(secondInvs)) { for (int i = 0; i < secondInvs.length; i++) { if ("N".equals(secondInvs[i].getPaidIndicator())) { amount = amount.add(BigDecimalUtil.nullSafe(secondInvs[i].getInvoiceAdminFee())); } } } return amount; } public BigDecimal getSecondInvTotalSNAdminFee() { BigDecimal amount = BigDecimal.ZERO; if (!ArrayUtils.isEmpty(secondInvs)) { for (int i = 0; i < secondInvs.length; i++) { if ("N".equals(secondInvs[i].getPaidIndicator())) { amount = amount.add(BigDecimalUtil.nullSafe(secondInvs[i].getInvSecondNoticeAdminFee())); } } } return amount; } public List<Invoice> getAuthorizedCollectionInvs() { List<Invoice> list = new ArrayList<Invoice>(); if (!ArrayUtils.isEmpty(collectionInvs)) { for (int i = 0; i < collectionInvs.length; i++) { if (collectionInvs[i].isAuthorized()) { list.add(collectionInvs[i]); } } } return list; } public boolean getOpenCollectionInvExists() { if (!ArrayUtils.isEmpty(collectionInvs)) { for (int i = 0; i < collectionInvs.length; i++) { if ("N".equals(collectionInvs[i].getPaidIndicator())) { return true; } } } return false; } public BigDecimal getCollectionInvTotalUnPaidAmount() { BigDecimal amount = BigDecimal.ZERO; if (!ArrayUtils.isEmpty(collectionInvs)) { for (int i = 0; i < collectionInvs.length; i++) { if ("N".equals(collectionInvs[i].getPaidIndicator())) { amount = amount.add(collectionInvs[i].getAmount()); } } } return amount; } public BigDecimal getCollectionInvTotalTollDue() { BigDecimal amount = BigDecimal.ZERO; if (!ArrayUtils.isEmpty(collectionInvs)) { for (int i = 0; i < collectionInvs.length; i++) { if ("N".equals(collectionInvs[i].getPaidIndicator())) { amount = amount.add(collectionInvs[i].getAmount()) .subtract(collectionInvs[i].getInvoiceAdminFee()) .subtract(collectionInvs[i].getAdjustedTxnFees()) .subtract(collectionInvs[i].getInvSecondNoticeAdminFee()); } } } return amount; } public BigDecimal getCollectionInvTotalTXNAdminFee() { BigDecimal amount = BigDecimal.ZERO; if (!ArrayUtils.isEmpty(collectionInvs)) { for (int i = 0; i < collectionInvs.length; i++) { if ("N".equals(collectionInvs[i].getPaidIndicator())) { amount = amount.add(BigDecimalUtil.nullSafe(collectionInvs[i].getAdjustedTxnFees())); } } } return amount; } public BigDecimal getCollectionInvTotalFNAdminFee() { BigDecimal amount = BigDecimal.ZERO; if (!ArrayUtils.isEmpty(collectionInvs)) { for (int i = 0; i < collectionInvs.length; i++) { if ("N".equals(collectionInvs[i].getPaidIndicator())) { amount = amount.add(BigDecimalUtil.nullSafe(collectionInvs[i].getInvoiceAdminFee())); } } } return amount; } public BigDecimal getCollectionInvTotalSNAdminFee() { BigDecimal amount = BigDecimal.ZERO; if (!ArrayUtils.isEmpty(collectionInvs)) { for (int i = 0; i < collectionInvs.length; i++) { if ("N".equals(collectionInvs[i].getPaidIndicator())) { amount = amount.add(BigDecimalUtil.nullSafe(collectionInvs[i].getInvSecondNoticeAdminFee())); } } } return amount; } public List<Invoice> getAuthorizedLegalInvs() { List<Invoice> list = new ArrayList<Invoice>(); if (!ArrayUtils.isEmpty(legalInvs)) { for (int i = 0; i < legalInvs.length; i++) { if (legalInvs[i].isAuthorized()) { list.add(legalInvs[i]); } } } return list; } public boolean getOpenLegalInvExists() { if (!ArrayUtils.isEmpty(legalInvs)) { for (int i = 0; i < legalInvs.length; i++) { if ("N".equals(legalInvs[i].getPaidIndicator())) { return true; } } } return false; } public BigDecimal getLegalInvTotalUnPaidAmount() { BigDecimal amount = BigDecimal.ZERO; if (!ArrayUtils.isEmpty(legalInvs)) { for (int i = 0; i < legalInvs.length; i++) { if ("N".equals(legalInvs[i].getPaidIndicator())) { amount = amount.add(legalInvs[i].getAmount()); } } } return amount; } public BigDecimal getLegalInvTotalTollDue() { BigDecimal amount = BigDecimal.ZERO; if (!ArrayUtils.isEmpty(legalInvs)) { for (int i = 0; i < legalInvs.length; i++) { if ("N".equals(legalInvs[i].getPaidIndicator())) { amount = amount.add(legalInvs[i].getAmount()).subtract(legalInvs[i].getInvoiceAdminFee()) .subtract(legalInvs[i].getAdjustedTxnFees()) .subtract(legalInvs[i].getInvSecondNoticeAdminFee()); ; } } } return amount; } public BigDecimal getLegalInvTotalTXNAdminFee() { BigDecimal amount = BigDecimal.ZERO; if (!ArrayUtils.isEmpty(legalInvs)) { for (int i = 0; i < legalInvs.length; i++) { if ("N".equals(legalInvs[i].getPaidIndicator())) { amount = amount.add(legalInvs[i].getAdjustedTxnFees()); } } } return amount; } public BigDecimal getLegalInvTotalFNAdminFee() { BigDecimal amount = BigDecimal.ZERO; if (!ArrayUtils.isEmpty(legalInvs)) { for (int i = 0; i < legalInvs.length; i++) { if ("N".equals(legalInvs[i].getPaidIndicator())) { amount = amount.add(legalInvs[i].getInvoiceAdminFee()); } } } return amount; } public BigDecimal getLegalInvTotalSNAdminFee() { BigDecimal amount = BigDecimal.ZERO; if (!ArrayUtils.isEmpty(legalInvs)) { for (int i = 0; i < legalInvs.length; i++) { if ("N".equals(legalInvs[i].getPaidIndicator())) { amount = amount.add(legalInvs[i].getInvSecondNoticeAdminFee()); } } } return amount; } public Invoice[] getAuthorizedStatementInvoices() { try { List<Invoice> list = new ArrayList<Invoice>(); list.addAll(getAuthorizedPriorInvs()); list.addAll(getAuthorizedHighwayTollInvs()); list.addAll(getAuthorizedNttaTollInvs()); list.addAll(getAuthorizedFirstInvs()); list.addAll(getAuthorizedSecondInvs()); list.addAll(getAuthorizedCollectionInvs()); list.addAll(getAuthorizedLegalInvs()); if (!list.isEmpty()) { return (Invoice[]) list.toArray(new Invoice[0]); } } catch (Exception e) { e.printStackTrace(); ; } return null; } public List<Invoice> mergeZipCashInvoice() throws Exception { List<Invoice> result = new ArrayList<Invoice>(); List<Invoice> highwayInvoice = getAuthorizedHighwayTollInvs(); List<Invoice> nttaTollInvoice = getAuthorizedNttaTollInvs(); List<Invoice> keepInvs = new ArrayList<Invoice>(); for (Invoice inv : highwayInvoice) { Invoice totalInv = new Invoice(); BeanUtils.copyProperties(totalInv, inv); if (nttaTollInvoice.contains(totalInv)) { int index = nttaTollInvoice.indexOf(totalInv); Invoice nttaToll = nttaTollInvoice.get(index); totalInv.setTollAmount(nttaToll.getTollAmount().add(inv.getTollAmount())); totalInv.setAmount(nttaToll.getAmount().add(inv.getAmount())); totalInv.setTotalTXNFees(nttaToll.getTotalTXNFees().add(inv.getTotalTXNFees())); totalInv.setLateFee(nttaToll.getLateFee().add(inv.getLateFee())); keepInvs.add(totalInv); } result.add(totalInv); } for (Invoice inv : nttaTollInvoice) { Invoice totalInv = new Invoice(); BeanUtils.copyProperties(totalInv, inv); if (!keepInvs.contains(totalInv)) { result.add(totalInv); } } return result; } public Violation[] getAuthorizedViolations() { if (!ArrayUtils.isEmpty(violations)) { ArrayList list = new ArrayList(); for (int i = 0; i < violations.length; i++) { if (violations[i].isAuthorized()) { list.add(violations[i]); } } if (!list.isEmpty()) { return (Violation[]) list.toArray(new Violation[0]); } } return null; } public BigDecimal getTotalMSPmtAdj() { BigDecimal result = BigDecimal.ZERO; if (!ArrayUtils.isEmpty(this.msPmtAdjArr)) { for (int i = 0; i < this.msPmtAdjArr.length; i++) { result = result.add(this.msPmtAdjArr[i].getPmtAdjAmount()); } } return result; } public BigDecimal getTotalRecentPmtAdjAmt() { BigDecimal result = BigDecimal.ZERO; if (!ArrayUtils.isEmpty(this.msRecentPmtAdjArr)) { for (int i = 0; i < this.msRecentPmtAdjArr.length; i++) { result = result.add(this.msRecentPmtAdjArr[i].getPmtAdjAmount()); } } return result; } public void setPaymentId(String paymentId) { this.paymentId = paymentId; } public String getPaymentId() { return paymentId; } public void setCallBack(String callBack) { this.callBack = callBack; } public String getCallBack() { return callBack; } public void setOriginalTagAmount(BigDecimal originalTagAmount) { this.originalTagAmount = originalTagAmount != null ? originalTagAmount : new BigDecimal(0.0); } public BigDecimal getOriginalTagAmount() { return originalTagAmount; } public void setAddedTags(com.etcc.csc.dto.TagDTO[] addedTags) { this.addedTags = addedTags; } public com.etcc.csc.dto.TagDTO[] getAddedTags() { return addedTags; } public void setLoginCreation(LoginCreationInfo loginCreation) { this.loginCreation = loginCreation; } public LoginCreationInfo getLoginCreation() { return loginCreation; } public void setPaymentComplete(boolean paymentComplete) { this.paymentComplete = paymentComplete; } public boolean isPaymentComplete() { return paymentComplete; } public void setPostingStatus(String postingStatus) { this.postingStatus = postingStatus; } public String getPostingStatus() { return postingStatus; } public void setDepAmount(BigDecimal depAmount) { this.depAmount = depAmount; } public BigDecimal getDepAmount() { if (depAmount == null) { return new BigDecimal(0.0); } return depAmount; } public void setTrackLink(String trackLink) { this.trackLink = trackLink; } public String getTrackLink() { return trackLink; } public void setMonthlyStatement(MonthlyStatement monthlyStatement) { this.monthlyStatement = monthlyStatement; } public MonthlyStatement getMonthlyStatement() { return monthlyStatement; } public void setMsPmtAdjArr(MSPaymentAdjust[] msPmtAdjArr) { this.msPmtAdjArr = msPmtAdjArr; } public MSPaymentAdjust[] getMsPmtAdjArr() { return msPmtAdjArr; } public void setPriorInvs(Invoice[] priorInvs) { this.priorInvs = priorInvs; } public Invoice[] getPriorInvs() { return priorInvs; } public void setFirstInvs(Invoice[] firstInvs) { this.firstInvs = firstInvs; } public Invoice[] getFirstInvs() { return firstInvs; } public void setSecondInvs(Invoice[] secondInvs) { this.secondInvs = secondInvs; } public Invoice[] getSecondInvs() { return secondInvs; } public void setCollectionInvs(Invoice[] collectionInvs) { this.collectionInvs = collectionInvs; } public Invoice[] getCollectionInvs() { return collectionInvs; } public void setLegalInvs(Invoice[] legalInvs) { this.legalInvs = legalInvs; } public Invoice[] getLegalInvs() { return legalInvs; } public void setNttaTollInvs(Invoice[] nttaTollInvs) { this.nttaTollInvs = nttaTollInvs; } public Invoice[] getNttaTollInvs() { return nttaTollInvs; } public void setHighwayTollInvs(Invoice[] highwayTollInvs) { this.highwayTollInvs = highwayTollInvs; } public Invoice[] getHighwayTollInvs() { return highwayTollInvs; } public void setMonthlyStatementInvoices(Invoice[] monthlyStatementInvoices) { this.monthlyStatementInvoices = monthlyStatementInvoices; } public Invoice[] getMonthlyStatementInvoices() { return monthlyStatementInvoices; } public void setPaymentResultDTOs(List<PaymentResultDTO> paymentResultDTOs) { this.paymentResultDTOs = paymentResultDTOs; } public List<PaymentResultDTO> getPaymentResultDTOs() { return paymentResultDTOs; } public void setMsRecentPmtAdjArr(MSPaymentAdjust[] msRecentPmtAdjArr) { this.msRecentPmtAdjArr = msRecentPmtAdjArr; } public MSPaymentAdjust[] getMsRecentPmtAdjArr() { return msRecentPmtAdjArr; } }