001: /*
002: * Copyright 2007 The Kuali Foundation.
003: *
004: * Licensed under the Educational Community License, Version 1.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/ecl1.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.module.purap.fixtures;
017:
018: import java.sql.Date;
019:
020: import org.kuali.core.service.DateTimeService;
021: import org.kuali.core.util.KualiDecimal;
022: import org.kuali.kfs.context.SpringContext;
023: import org.kuali.module.purap.document.PaymentRequestDocument;
024:
025: public enum PaymentRequestDocumentFixture {
026:
027: PREQ_ONLY_REQUIRED_FIELDS(
028: SpringContext.getBean(DateTimeService.class)
029: .getCurrentSqlDate(), //invoiceDate
030: "123456", //invoiceNumber,
031: new KualiDecimal(100), //vendorInvoiceAmount,
032: "00N10", //vendorPaymentTermsCode,
033: "CL", //vendorShippingPaymentTermsCode,
034: SpringContext.getBean(DateTimeService.class)
035: .getCurrentSqlDate(), //paymentRequestPayDate,
036: "EST", //paymentRequestCostSourceCode,
037: false, //paymentRequestedCancelIndicator,
038: false, //paymentAttachmentIndicator,
039: false, //immediatePaymentIndicator,
040: null, //specialHandlingInstructionLine1Text,
041: null, //specialHandlingInstructionLine2Text,
042: null, //specialHandlingInstructionLine3Text,
043: null, //paymentPaidDate,
044: false, //paymentRequestElectronicInvoiceIndicator,
045: null, //accountsPayableRequestCancelIdentifier,
046: 1010, //originalVendorHeaderGeneratedIdentifier,
047: 2, //originalVendorDetailAssignedIdentifier,
048: null, //alternateVendorHeaderGeneratedIdentifier,
049: null, //alternateVendorDetailAssignedIdentifier,
050: null, //purchaseOrderNotes,
051: null, //recurringPaymentTypeCode,
052: PurchasingAccountsPayableDocumentFixture.PREQ_ONLY_REQUIRED_FIELDS, // purapDocumentFixture
053: AccountsPayableDocumentFixture.PREQ_ONLY_REQUIRED_FIELDS, // apDocumentFixture
054: new PaymentRequestItemFixture[] { PaymentRequestItemFixture.PREQ_QTY_UNRESTRICTED_ITEM_1 } // requisitionItemMultiFixtures
055: );
056:
057: public final Date invoiceDate;
058: public final String invoiceNumber;
059: public final KualiDecimal vendorInvoiceAmount;
060: public final String vendorPaymentTermsCode;
061: public final String vendorShippingPaymentTermsCode;
062: public final Date paymentRequestPayDate;
063: public final String paymentRequestCostSourceCode;
064: public final boolean paymentRequestedCancelIndicator;
065: public final boolean paymentAttachmentIndicator;
066: public final boolean immediatePaymentIndicator;
067: public final String specialHandlingInstructionLine1Text;
068: public final String specialHandlingInstructionLine2Text;
069: public final String specialHandlingInstructionLine3Text;
070: public final Date paymentPaidDate;
071: public final boolean paymentRequestElectronicInvoiceIndicator;
072: public final String accountsPayableRequestCancelIdentifier;
073: public final Integer originalVendorHeaderGeneratedIdentifier;
074: public final Integer originalVendorDetailAssignedIdentifier;
075: public final Integer alternateVendorHeaderGeneratedIdentifier;
076: public final Integer alternateVendorDetailAssignedIdentifier;
077: public final String purchaseOrderNotes;
078: public final String recurringPaymentTypeCode;
079:
080: private PurchasingAccountsPayableDocumentFixture purapDocumentFixture;
081: private AccountsPayableDocumentFixture apDocumentFixture;
082: private PaymentRequestItemFixture[] paymentRequestItemFixtures;
083:
084: private PaymentRequestDocumentFixture(
085: Date invoiceDate,
086: String invoiceNumber,
087: KualiDecimal vendorInvoiceAmount,
088: String vendorPaymentTermsCode,
089: String vendorShippingPaymentTermsCode,
090: Date paymentRequestPayDate,
091: String paymentRequestCostSourceCode,
092: boolean paymentRequestedCancelIndicator,
093: boolean paymentAttachmentIndicator,
094: boolean immediatePaymentIndicator,
095: String specialHandlingInstructionLine1Text,
096: String specialHandlingInstructionLine2Text,
097: String specialHandlingInstructionLine3Text,
098: Date paymentPaidDate,
099: boolean paymentRequestElectronicInvoiceIndicator,
100: String accountsPayableRequestCancelIdentifier,
101: Integer originalVendorHeaderGeneratedIdentifier,
102: Integer originalVendorDetailAssignedIdentifier,
103: Integer alternateVendorHeaderGeneratedIdentifier,
104: Integer alternateVendorDetailAssignedIdentifier,
105: String purchaseOrderNotes,
106: String recurringPaymentTypeCode,
107: PurchasingAccountsPayableDocumentFixture purapDocumentFixture,
108: AccountsPayableDocumentFixture apDocumentFixture,
109: PaymentRequestItemFixture[] paymentRequestItemFixtures) {
110:
111: this .invoiceDate = invoiceDate;
112: this .invoiceNumber = invoiceNumber;
113: this .vendorInvoiceAmount = vendorInvoiceAmount;
114: this .vendorPaymentTermsCode = vendorPaymentTermsCode;
115: this .vendorShippingPaymentTermsCode = vendorShippingPaymentTermsCode;
116: this .paymentRequestPayDate = paymentRequestPayDate;
117: this .paymentRequestCostSourceCode = paymentRequestCostSourceCode;
118: this .paymentRequestedCancelIndicator = paymentRequestedCancelIndicator;
119: this .paymentAttachmentIndicator = paymentAttachmentIndicator;
120: this .immediatePaymentIndicator = immediatePaymentIndicator;
121: this .specialHandlingInstructionLine1Text = specialHandlingInstructionLine1Text;
122: this .specialHandlingInstructionLine2Text = specialHandlingInstructionLine2Text;
123: this .specialHandlingInstructionLine3Text = specialHandlingInstructionLine3Text;
124: this .paymentPaidDate = paymentPaidDate;
125: this .paymentRequestElectronicInvoiceIndicator = paymentRequestElectronicInvoiceIndicator;
126: this .accountsPayableRequestCancelIdentifier = accountsPayableRequestCancelIdentifier;
127: this .originalVendorHeaderGeneratedIdentifier = originalVendorHeaderGeneratedIdentifier;
128: this .originalVendorDetailAssignedIdentifier = originalVendorDetailAssignedIdentifier;
129: this .alternateVendorHeaderGeneratedIdentifier = alternateVendorHeaderGeneratedIdentifier;
130: this .alternateVendorDetailAssignedIdentifier = alternateVendorDetailAssignedIdentifier;
131: this .purchaseOrderNotes = purchaseOrderNotes;
132: this .recurringPaymentTypeCode = recurringPaymentTypeCode;
133:
134: this .purapDocumentFixture = purapDocumentFixture;
135: this .apDocumentFixture = apDocumentFixture;
136: this .paymentRequestItemFixtures = paymentRequestItemFixtures;
137: }
138:
139: public PaymentRequestDocument createPaymentRequestDocument() {
140:
141: PaymentRequestDocument doc = apDocumentFixture
142: .createPaymentRequestDocument(purapDocumentFixture);
143:
144: doc.setInvoiceDate(this .invoiceDate);
145: doc.setInvoiceNumber(this .invoiceNumber);
146: doc.setVendorInvoiceAmount(this .vendorInvoiceAmount);
147: doc.setVendorPaymentTermsCode(this .vendorPaymentTermsCode);
148: doc
149: .setVendorShippingPaymentTermsCode(this .vendorShippingPaymentTermsCode);
150: doc.setPaymentRequestPayDate(this .paymentRequestPayDate);
151: doc
152: .setPaymentRequestCostSourceCode(this .paymentRequestCostSourceCode);
153: doc
154: .setPaymentRequestedCancelIndicator(this .paymentRequestedCancelIndicator);
155: doc
156: .setPaymentAttachmentIndicator(this .paymentAttachmentIndicator);
157: doc
158: .setImmediatePaymentIndicator(this .immediatePaymentIndicator);
159: doc
160: .setSpecialHandlingInstructionLine1Text(this .specialHandlingInstructionLine1Text);
161: doc
162: .setSpecialHandlingInstructionLine2Text(this .specialHandlingInstructionLine2Text);
163: doc
164: .setSpecialHandlingInstructionLine3Text(this .specialHandlingInstructionLine3Text);
165: doc.setPaymentPaidDate(this .paymentPaidDate);
166: doc
167: .setPaymentRequestElectronicInvoiceIndicator(this .paymentRequestElectronicInvoiceIndicator);
168: doc
169: .setAccountsPayableRequestCancelIdentifier(this .accountsPayableRequestCancelIdentifier);
170: doc
171: .setOriginalVendorHeaderGeneratedIdentifier(this .originalVendorHeaderGeneratedIdentifier);
172: doc
173: .setOriginalVendorDetailAssignedIdentifier(this .originalVendorDetailAssignedIdentifier);
174: doc
175: .setAlternateVendorHeaderGeneratedIdentifier(this .alternateVendorHeaderGeneratedIdentifier);
176: doc
177: .setAlternateVendorDetailAssignedIdentifier(this .alternateVendorDetailAssignedIdentifier);
178: doc.setPurchaseOrderNotes(this .purchaseOrderNotes);
179: doc.setRecurringPaymentTypeCode(this .recurringPaymentTypeCode);
180: doc.setPostingYear(2008);
181:
182: for (PaymentRequestItemFixture paymentRequestItemFixture : paymentRequestItemFixtures) {
183: paymentRequestItemFixture.addTo(doc);
184: }
185:
186: return doc;
187: }
188:
189: }
|