001 /* 002 * Copyright 2011 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 */ 016 package org.kuali.kfs.sys.service; 017 018 import java.util.List; 019 import java.util.Map; 020 021 import org.kuali.kfs.fp.document.AdvanceDepositDocument; 022 import org.kuali.kfs.sys.businessobject.AccountingLine; 023 import org.kuali.kfs.sys.businessobject.ElectronicPaymentClaim; 024 import org.kuali.rice.kim.bo.Person; 025 import org.kuali.rice.kns.document.Document; 026 027 /** 028 * A service which helps in the claiming of ElectronicPaymentClaim records 029 */ 030 public interface ElectronicPaymentClaimingService { 031 032 /** 033 * Constructs a List of Notes that detail which ElectronicPaymentClaim records have been claimed by a document 034 * 035 * @param claims the ElectronicPaymentClaim record that will be claimed by a document 036 * @param claimingUser the user who's actually claiming ElectronicPaymentClaim records 037 * @return a List of Notes that will summarize that claiming. 038 */ 039 public abstract List<String> constructNoteTextsForClaims(List<ElectronicPaymentClaim> claims); 040 041 /** 042 * Returns a list of which document types the given user can claim Electronic Payment Claims with. 043 * 044 * @param user the user attempting to use a document to claim ElectronicPaymentClaim records 045 * @return a list of ElectronicPaymentClaimingDocumentGenerationStrategy document helper implementations 046 */ 047 public abstract List<ElectronicPaymentClaimingDocumentGenerationStrategy> getClaimingDocumentChoices(Person user); 048 049 /** 050 * Given a List of ElectronicPaymentClaim records and a ElectronicPaymentClaimingDocumentGenerationStrategy document helper 051 * implementation, creates a document that will claim; this method should also do the work of "claiming" each of the given 052 * ElectronicPaymentClaim records by filling in their referenceFinancialDocumentNumber field. 053 * 054 * @param claims the List of ElectronicPaymentClaim records to claim with a document 055 * @param documentCreationHelper the document helper which will help this method in constructing the claiming document 056 * @param user the Person record of the user who is claiming the given electronic payments 057 * @return the URL to redirect to, so the user can edit the document 058 */ 059 public abstract String createPaymentClaimingDocument(List<ElectronicPaymentClaim> claims, ElectronicPaymentClaimingDocumentGenerationStrategy documentCreationHelper, Person user); 060 061 /** 062 * Unclaims all ElectronicPaymentClaim records claimed by the given document, by setting the ElectronicPaymentClaim's reference 063 * document to null. 064 * 065 * @param document the document that claimed ElectronicPaymentClaims and now needs to give them back 066 */ 067 public abstract void declaimElectronicPaymentClaimsForDocument(Document document); 068 069 /** 070 * Sets the referenceFinancialDocumentNumber on each of the payments passed in with the given document number and then saves 071 * them. 072 * 073 * @param payments a list of payments to claim 074 * @param docmentNumber the document number of the claiming document 075 */ 076 public abstract void claimElectronicPayments(List<ElectronicPaymentClaim> payments, String documentNumber); 077 078 /** 079 * Returns a list of SAVED electronic payment claims from the lines of an AdvanceDepositDocument 080 * 081 * @param doc the document that is generating electronic payment claim records 082 * @return a list of the generated electronic payment claim records 083 */ 084 public abstract List<ElectronicPaymentClaim> generateElectronicPaymentClaimRecords(AdvanceDepositDocument doc); 085 086 /** 087 * Determines if the given accounting line represents an electronic payment 088 * @param accountingLine the accounting line to check 089 * @return true if the accounting line does represent an electronic payment, false otherwise 090 */ 091 public abstract boolean representsElectronicFundAccount(AccountingLine accountingLine); 092 093 /** 094 * check whether the given user has permission to claim eletronic payment for the given document type defined in the specified 095 * namespace 096 * 097 * @param user the given user being checked 098 * @param namespaceCode the specified namespace 099 * @param workflowDocumentTypeName the workflow document type name of the document being claimed 100 * @return true if the user has permisson to claim electronic payment; otherwise, false 101 */ 102 public abstract boolean isAuthorizedForClaimingElectronicPayment(Person user, String workflowDocumentTypeName); 103 104 }