001/*
002 * Copyright 2007 The Kuali Foundation
003 * 
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 * 
008 * http://www.opensource.org/licenses/ecl2.php
009 * 
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.ole.pdp.service;
017
018import java.sql.Date;
019import java.util.Iterator;
020import java.util.List;
021
022import org.kuali.ole.pdp.businessobject.PaymentGroup;
023import org.kuali.ole.pdp.businessobject.PaymentProcess;
024import org.kuali.rice.coreservice.framework.parameter.ParameterService;
025import org.kuali.rice.kns.service.DataDictionaryService;
026
027public interface PaymentGroupService {
028    /**
029     * Get all payment groups by a disbursement type code and status code
030     * 
031     * @param disbursementType
032     * @param paymentStatusCode
033     * @return
034     */
035    public Iterator getByDisbursementTypeStatusCode(String disbursementType, String paymentStatusCode);
036
037    /**
038     * Get all payment groups by Payment Process object
039     * 
040     * @param p
041     * @return
042     */
043    public Iterator getByProcess(PaymentProcess p);
044
045    /**
046     * Get all payment groups by Payment Process Id/Disbursement Type
047     * 
048     * @param pid
049     * @param disbursementType
050     * @return
051     */
052    public List<Integer> getDisbursementNumbersByDisbursementType(Integer pid,String disbursementType);
053    
054    /**
055     * Get all payment groups by Payment Process Id/Disbursement Type for a given bank code
056     * 
057     * @param pid
058     * @param disbursementType
059     * @param bankCode
060     * @return
061     */
062    public abstract List<Integer> getDisbursementNumbersByDisbursementTypeAndBankCode(Integer pid,String disbursementType, String bankCode);
063    
064    /**
065     * Given a process id and a disbursement type, finds a distinct list of bank codes used by payment groups within that payment process
066     * @param pid payment process to query payment groups of
067     * @param disbursementType the type of disbursements to query
068     * @return a sorted List of bank codes
069     */
070    public abstract List<String> getDistinctBankCodesForProcessAndType(Integer pid, String disbursementType);
071    
072    public PaymentGroup get(Integer id);
073
074    public List getByBatchId(Integer batchId);
075
076    public List getByDisbursementNumber(Integer disbursementNbr);
077
078    /**
079     * Mark a paid group as processed
080     * 
081     * @param group
082     * @param processDate
083     */
084    public void processPaidGroup(PaymentGroup group, Date processDate);
085
086    /**
087     * Mark a cancelled group as processed
088     * 
089     * @param group
090     * @param processDate
091     */
092    public void processCancelledGroup(PaymentGroup group, Date processDate);
093    
094    /**
095     * Gets the sort group id
096     * 
097     * @param paymentGroup
098     * @return
099     */
100    public int getSortGroupId(PaymentGroup paymentGroup);
101    
102    /**
103     * Gets the sort group name
104     * 
105     * @param sortGroupId
106     * @return
107     */
108    public String getSortGroupName(int sortGroupId);
109    
110    /**
111     * Sets the parameter service
112     * 
113     * @param parameterService
114     */
115    public void setParameterService(ParameterService parameterService);
116    
117    /**
118     * Sets DataDictionaryService
119     * 
120     * @param dataDictionaryService
121     */
122    public void setDataDictionaryService(DataDictionaryService dataDictionaryService);
123    
124    /**
125     * Gets list of ach payments in which an advice notification has not been sent
126     * 
127     * @return List<PaymentGroup>
128     */
129    public List<PaymentGroup> getAchPaymentsNeedingAdviceNotification();
130}