1 /*
2 * Copyright 2008 The Kuali Foundation
3 *
4 * Licensed under the Educational Community License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.opensource.org/licenses/ecl2.php
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.kuali.ole.sys.service;
17
18 import java.util.List;
19
20 import org.kuali.ole.fp.document.AdvanceDepositDocument;
21 import org.kuali.ole.sys.businessobject.AccountingLine;
22 import org.kuali.ole.sys.businessobject.ElectronicPaymentClaim;
23 import org.kuali.rice.kim.api.identity.Person;
24 import org.kuali.rice.krad.document.Document;
25
26 /**
27 * A service which helps in the claiming of ElectronicPaymentClaim records
28 */
29 public interface ElectronicPaymentClaimingService {
30
31 /**
32 * Constructs a List of Notes that detail which ElectronicPaymentClaim records have been claimed by a document
33 *
34 * @param claims the ElectronicPaymentClaim record that will be claimed by a document
35 * @param claimingUser the user who's actually claiming ElectronicPaymentClaim records
36 * @return a List of Notes that will summarize that claiming.
37 */
38 public abstract List<String> constructNoteTextsForClaims(List<ElectronicPaymentClaim> claims);
39
40 /**
41 * Returns a list of which document types the given user can claim Electronic Payment Claims with.
42 *
43 * @param user the user attempting to use a document to claim ElectronicPaymentClaim records
44 * @return a list of ElectronicPaymentClaimingDocumentGenerationStrategy document helper implementations
45 */
46 public abstract List<ElectronicPaymentClaimingDocumentGenerationStrategy> getClaimingDocumentChoices(Person user);
47
48 /**
49 * Given a List of ElectronicPaymentClaim records and a ElectronicPaymentClaimingDocumentGenerationStrategy document helper
50 * implementation, creates a document that will claim; this method should also do the work of "claiming" each of the given
51 * ElectronicPaymentClaim records by filling in their referenceFinancialDocumentNumber field.
52 *
53 * @param claims the List of ElectronicPaymentClaim records to claim with a document
54 * @param documentCreationHelper the document helper which will help this method in constructing the claiming document
55 * @param user the Person record of the user who is claiming the given electronic payments
56 * @return the URL to redirect to, so the user can edit the document
57 */
58 public abstract String createPaymentClaimingDocument(List<ElectronicPaymentClaim> claims, ElectronicPaymentClaimingDocumentGenerationStrategy documentCreationHelper, Person user);
59
60 /**
61 * Unclaims all ElectronicPaymentClaim records claimed by the given document, by setting the ElectronicPaymentClaim's reference
62 * document to null.
63 *
64 * @param document the document that claimed ElectronicPaymentClaims and now needs to give them back
65 */
66 public abstract void declaimElectronicPaymentClaimsForDocument(Document document);
67
68 /**
69 * Sets the referenceFinancialDocumentNumber on each of the payments passed in with the given document number and then saves
70 * them.
71 *
72 * @param payments a list of payments to claim
73 * @param docmentNumber the document number of the claiming document
74 */
75 public abstract void claimElectronicPayments(List<ElectronicPaymentClaim> payments, String documentNumber);
76
77 /**
78 * Returns a list of SAVED electronic payment claims from the lines of an AdvanceDepositDocument
79 *
80 * @param doc the document that is generating electronic payment claim records
81 * @return a list of the generated electronic payment claim records
82 */
83 public abstract List<ElectronicPaymentClaim> generateElectronicPaymentClaimRecords(AdvanceDepositDocument doc);
84
85 /**
86 * Determines if the given accounting line represents an electronic payment
87 * @param accountingLine the accounting line to check
88 * @return true if the accounting line does represent an electronic payment, false otherwise
89 */
90 public abstract boolean representsElectronicFundAccount(AccountingLine accountingLine);
91
92 /**
93 * check whether the given user has permission to claim eletronic payment for the given document type defined in the specified
94 * namespace
95 *
96 * @param user the given user being checked
97 * @param namespaceCode the specified namespace
98 * @param workflowDocumentTypeName the workflow document type name of the document being claimed
99 * @return true if the user has permisson to claim electronic payment; otherwise, false
100 */
101 public abstract boolean isAuthorizedForClaimingElectronicPayment(Person user, String workflowDocumentTypeName);
102
103 }