View Javadoc
1   package org.kuali.ole.deliver.bo;
2   
3   
4   import org.kuali.ole.OLEConstants;
5   import org.kuali.rice.core.api.util.type.KualiDecimal;
6   import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
7   import org.kuali.rice.krad.util.GlobalVariables;
8   
9   import java.math.BigDecimal;
10  import java.sql.Date;
11  import java.util.ArrayList;
12  import java.util.LinkedHashMap;
13  import java.util.List;
14  
15  /**
16   * PatronBillMaintenance provides Patron bill  information through getter and setter.
17   */
18  
19  public class PatronBillPayment extends PersistableBusinessObjectBase {
20  
21  
22      private KualiDecimal totalAmount;
23      private String billNumber;
24      private Date billDate;
25      private FeeType patronFeeType;
26      private String patronId;
27      private String proxyPatronId;
28      private String freeTextNote;
29      private List<FeeType> feeType = new ArrayList<FeeType>();
30      private KualiDecimal unPaidBalance = new KualiDecimal(0);
31      private String paymentMethod;
32      private KualiDecimal paymentAmount;
33      private String paymentOperatorId;
34      private String paymentMachineId;
35      private Date payDate;
36      //Need to retrieve from services
37      private String machineId;
38      private String note;
39      private String operatorId = "test";
40      private String proxyPatronName;
41      private List<org.kuali.ole.deliver.bo.SystemGeneratedBill> sysGeneratedBill = new ArrayList<org.kuali.ole.deliver.bo.SystemGeneratedBill>();
42      private boolean reviewed;
43      private String firstName;
44      private String lastName;
45      private String patronName;
46      private boolean selectBill;
47      private String paymentStatusCode;
48      private String paymentStatusName;
49      private String errorMessage;
50      private boolean zeroFeeAmount;
51      private boolean requiredFeeAmount;
52      private KualiDecimal paidAmount = new KualiDecimal(0);
53  
54      private OlePatronDocument olePatron = new OlePatronDocument();
55  
56      public KualiDecimal getPaidAmount() {
57         /* if(totalAmount!=null && unPaidBalance!=null && totalAmount.compareTo(unPaidBalance)>0){
58              paidAmount = totalAmount.subtract(unPaidBalance);
59          }*/
60          return paidAmount;
61      }
62  
63      public String getPatronName() {
64          if(olePatron!=null){
65              this.patronName = olePatron.getEntity().getNames().get(0).getFirstName() + " " + olePatron.getEntity().getNames().get(0).getLastName();
66          }
67          return patronName;
68      }
69  
70  
71  
72      public void setPaidAmount(KualiDecimal paidAmount) {
73          this.paidAmount = paidAmount;
74      }
75  
76      public String getPaymentStatusName() {
77          return paymentStatusName;
78      }
79  
80      public void setPaymentStatusName(String paymentStatusName) {
81          this.paymentStatusName = paymentStatusName;
82      }
83  
84      public String getPaymentStatusCode() {
85  
86          for (FeeType feeTypeObj : feeType) {
87              if (feeTypeObj.getPaymentStatusCode().equalsIgnoreCase(OLEConstants.PAY_STATUS_OUTSTANDING_CODE)) {
88                  paymentStatusName = feeTypeObj.getOlePaymentStatus().getPaymentStatusName();
89                  return feeTypeObj.getPaymentStatusCode();
90              } else if (feeTypeObj.getPaymentStatusCode().equalsIgnoreCase(OLEConstants.PAY_STATUS_PART_CODE)) {
91                  paymentStatusName = feeTypeObj.getOlePaymentStatus().getPaymentStatusName();
92                  return feeTypeObj.getPaymentStatusCode();
93              } else if (feeTypeObj.getPaymentStatusCode().equalsIgnoreCase(OLEConstants.PAY_STATUS_ERROR_CODE)) {
94                  paymentStatusName = feeTypeObj.getOlePaymentStatus().getPaymentStatusName();
95                  return feeTypeObj.getPaymentStatusCode();
96              } else if (feeTypeObj.getPaymentStatusCode().equalsIgnoreCase(OLEConstants.PAY_STATUS_FORGIVEN_CODE)) {
97                  paymentStatusName = feeTypeObj.getOlePaymentStatus().getPaymentStatusName();
98                  return feeTypeObj.getPaymentStatusCode();
99              } else if (feeTypeObj.getPaymentStatusCode().equalsIgnoreCase(OLEConstants.PAY_STATUS_FULL_CODE)) {
100                 paymentStatusName = feeTypeObj.getOlePaymentStatus().getPaymentStatusName();
101                 return feeTypeObj.getPaymentStatusCode();
102             } else if (feeTypeObj.getPaymentStatusCode().equalsIgnoreCase(OLEConstants.PAY_STATUS_CANCEL_CODE)) {
103                 paymentStatusName = feeTypeObj.getOlePaymentStatus().getPaymentStatusName();
104                 return feeTypeObj.getPaymentStatusCode();
105             } else {
106                 paymentStatusName = feeTypeObj.getOlePaymentStatus().getPaymentStatusName();
107                 return feeTypeObj.getPaymentStatusCode();
108             }
109         }
110         return paymentStatusCode != null ? paymentStatusCode : "";
111     }
112 
113     public void setPaymentStatusCode(String paymentStatusCode) {
114         this.paymentStatusCode = paymentStatusCode;
115     }
116 
117     public boolean isSelectBill() {
118         return selectBill;
119     }
120 
121     public void setSelectBill(boolean selectBill) {
122         this.selectBill = selectBill;
123     }
124 
125     public String getFirstName() {
126         return firstName;
127     }
128 
129     public void setFirstName(String firstName) {
130         this.firstName = firstName;
131     }
132 
133     public String getLastName() {
134         return lastName;
135     }
136 
137     public void setLastName(String lastName) {
138         this.lastName = lastName;
139     }
140 
141     /**
142      * Gets the value of note property
143      *
144      * @return barcode
145      */
146     public String getNote() {
147         return note;
148     }
149 
150     /**
151      * Sets the value for note property
152      *
153      * @param note
154      */
155     public void setNote(String note) {
156         this.note = note;
157     }
158 
159     /**
160      * Gets the value of Machine property
161      *
162      * @return barcode
163      */
164     public String getMachineId() {
165         return machineId;
166     }
167 
168     /**
169      * Sets the value for machineId property
170      *
171      * @param machineId
172      */
173     public void setMachineId(String machineId) {
174         this.machineId = machineId;
175     }
176 
177     /**
178      * Gets the value of operator property
179      *
180      * @return operatorId
181      */
182     public String getOperatorId() {
183         return operatorId;
184     }
185 
186     /**
187      * Sets the value for machineId property
188      *
189      * @param operatorId
190      */
191     public void setOperatorId(String operatorId) {
192         if (operatorId == null || (operatorId != null && operatorId.isEmpty()))
193             operatorId = GlobalVariables.getUserSession().getLoggedInUserPrincipalName();
194         this.operatorId = operatorId;
195     }
196 
197     /**
198      * Gets the value of date property
199      *
200      * @return payDate
201      */
202     public Date getPayDate() {
203         return payDate;
204     }
205 
206     /**
207      * Sets the value for machineId property
208      *
209      * @param payDate
210      */
211     public void setPayDate(Date payDate) {
212         this.payDate = payDate;
213     }
214 
215     /**
216      * Gets the value of machine id property
217      *
218      * @return paymentMachineId
219      */
220     public String getPaymentMachineId() {
221         return paymentMachineId;
222     }
223 
224     /**
225      * Sets the value for machineId property
226      *
227      * @param paymentMachineId
228      */
229     public void setPaymentMachineId(String paymentMachineId) {
230         this.paymentMachineId = paymentMachineId;
231     }
232 
233     /**
234      * Gets the value of payment operator id property
235      *
236      * @return paymentOperatorId
237      */
238     public String getPaymentOperatorId() {
239         return paymentOperatorId;
240     }
241 
242     /**
243      * Sets the value for machineId property
244      *
245      * @param paymentOperatorId
246      */
247     public void setPaymentOperatorId(String paymentOperatorId) {
248         this.paymentOperatorId = paymentOperatorId;
249     }
250 
251     /**
252      * Gets the value of payment method property
253      *
254      * @return paymentMethod
255      */
256     public String getPaymentMethod() {
257         return paymentMethod;
258     }
259 
260     /**
261      * Sets the value for machineId property
262      *
263      * @param paymentMethod
264      */
265     public void setPaymentMethod(String paymentMethod) {
266         this.paymentMethod = paymentMethod;
267     }
268 
269     /**
270      * Gets the value of patron id property
271      *
272      * @return patronId
273      */
274     public String getPatronId() {
275         return patronId;
276     }
277 
278     /**
279      * Sets the value for machineId property
280      *
281      * @param patronId
282      */
283     public void setPatronId(String patronId) {
284         this.patronId = patronId;
285     }
286 
287     /**
288      * Gets the value of proxy patron property
289      *
290      * @return proxyPatronId
291      */
292     public String getProxyPatronId() {
293         return proxyPatronId;
294     }
295 
296     /**
297      * Sets the value for machineId property
298      *
299      * @param proxyPatronId
300      */
301     public void setProxyPatronId(String proxyPatronId) {
302         this.proxyPatronId = proxyPatronId;
303     }
304 
305     /**
306      * Gets the entity of fee type property
307      *
308      * @return patronFeeType
309      */
310     public FeeType getPatronFeeType() {
311         return patronFeeType;
312     }
313 
314     /**
315      * Sets the value for machineId property
316      *
317      * @param patronFeeType
318      */
319     public void setPatronFeeType(FeeType patronFeeType) {
320         this.patronFeeType = patronFeeType;
321     }
322 
323     /**
324      * Gets the list of feetype property
325      * @return feeType
326      *//*
327     public List<FeeType> getFeeType() {
328         return feeType;
329     }
330     *//**
331      * Sets the value for machineId property
332      * @param feeType
333      *//*
334     public void setFeeType(List<FeeType> feeType) {
335         this.feeType = feeType;
336     }*/
337 
338     /**
339      * Gets the value of bill date property
340      *
341      * @return billDate
342      */
343     public Date getBillDate() {
344         return billDate;
345     }
346 
347     /**
348      * Sets the value for machineId property
349      *
350      * @param billDate
351      */
352     public void setBillDate(Date billDate) {
353         this.billDate = billDate;
354     }
355 
356     /**
357      * Gets the value of bill number property
358      *
359      * @return billNumber
360      */
361     public String getBillNumber() {
362         return billNumber;
363     }
364 
365     /**
366      * Sets the value for machineId property
367      *
368      * @param billNumber
369      */
370     public void setBillNumber(String billNumber) {
371         this.billNumber = billNumber;
372     }
373 
374     /**
375      * Gets the value of free text note property
376      *
377      * @return freeTextNote
378      */
379     public String getFreeTextNote() {
380         return freeTextNote;
381     }
382 
383     /**
384      * Sets the value for machineId property
385      *
386      * @param freeTextNote
387      */
388     public void setFreeTextNote(String freeTextNote) {
389         this.freeTextNote = freeTextNote;
390     }
391 
392     /**
393      * Gets the value of total amount property
394      *
395      * @return totalAmount
396      */
397     public KualiDecimal getTotalAmount() {
398         return totalAmount;
399     }
400 
401     /**
402      * Sets the value for machineId property
403      *
404      * @param totalAmount
405      */
406     public void setTotalAmount(KualiDecimal totalAmount) {
407         this.totalAmount = totalAmount;
408     }
409 
410     /**
411      * Gets the value of payment amount property
412      *
413      * @return paymentAmount
414      */
415     public KualiDecimal getPaymentAmount() {
416         return paymentAmount;
417     }
418 
419     /**
420      * Sets the value for machineId property
421      *
422      * @param paymentAmount
423      */
424     public void setPaymentAmount(KualiDecimal paymentAmount) {
425         this.paymentAmount = paymentAmount;
426     }
427 
428     /**
429      * Gets the value of unpaid balance property
430      *
431      * @return unPaidBalance
432      */
433     public KualiDecimal getUnPaidBalance() {
434         return unPaidBalance;
435     }
436 
437     /**
438      * Sets the value for machineId property
439      *
440      * @param unPaidBalance
441      */
442     public void setUnPaidBalance(KualiDecimal unPaidBalance) {
443         this.unPaidBalance = unPaidBalance;
444     }
445 
446     public List<org.kuali.ole.deliver.bo.SystemGeneratedBill> getSysGeneratedBill() {
447         return sysGeneratedBill;
448     }
449 
450     public void setSysGeneratedBill(List<SystemGeneratedBill> sysGeneratedBill) {
451         this.sysGeneratedBill = sysGeneratedBill;
452     }
453 
454     public String getProxyPatronName() {
455         return proxyPatronName;
456     }
457 
458     public void setProxyPatronName(String proxyPatronName) {
459         this.proxyPatronName = proxyPatronName;
460     }
461 
462 
463     public List<FeeType> getFeeType() {
464         return feeType;
465     }
466 
467     public void setFeeType(List<FeeType> feeType) {
468         this.feeType = feeType;
469     }
470 
471     public boolean isReviewed() {
472         return reviewed;
473     }
474 
475     public void setReviewed(boolean reviewed) {
476         this.reviewed = reviewed;
477     }
478 
479     public String getErrorMessage() {
480         return errorMessage;
481     }
482 
483     public void setErrorMessage(String errorMessage) {
484         this.errorMessage = errorMessage;
485     }
486 
487     public OlePatronDocument getOlePatron() {
488         return olePatron;
489     }
490 
491     public void setOlePatron(OlePatronDocument olePatron) {
492         this.olePatron = olePatron;
493     }
494 
495     /**
496      * Gets the value of billNumber property
497      *
498      * @return billNumber
499      */
500     protected LinkedHashMap toStringMapper() {
501         LinkedHashMap toStringMap = new LinkedHashMap();
502         toStringMap.put("billNumber", billNumber);
503         return toStringMap;
504     }
505 
506     public boolean isZeroFeeAmount() {
507         return zeroFeeAmount;
508     }
509 
510     public void setZeroFeeAmount(boolean zeroFeeAmount) {
511         this.zeroFeeAmount = zeroFeeAmount;
512     }
513 
514     public boolean isRequiredFeeAmount() {
515         return requiredFeeAmount;
516     }
517 
518     public void setRequiredFeeAmount(boolean requiredFeeAmount) {
519         this.requiredFeeAmount = requiredFeeAmount;
520     }
521 }