use of org.kuali.kfs.coreservice.framework.parameter.ParameterService in project cu-kfs by CU-CommunityApps.
the class CuDisbursementVoucherDocument method templateStudent.
/**
* Convenience method to set dv payee detail fields based on a given student.
*
* @param student
*/
public void templateStudent(Person student) {
if (student == null) {
return;
}
this.getDvPayeeDetail().setDisbursementVoucherPayeeTypeCode(CuDisbursementVoucherConstants.DV_PAYEE_TYPE_STUDENT);
this.getDvPayeeDetail().setDisbVchrPayeeIdNumber(student.getPrincipalId());
((CuDisbursementVoucherPayeeDetailExtension) this.getDvPayeeDetail().getExtension()).setDisbVchrPayeeIdType(CuDisbursementVoucherConstants.DV_PAYEE_ID_TYP_ENTITY);
((CuDisbursementVoucherPayeeDetailExtension) this.getDvPayeeDetail().getExtension()).setPayeeTypeSuffix(StringUtils.EMPTY);
this.getDvPayeeDetail().setDisbVchrPayeePersonName(student.getNameUnmasked());
final ParameterService parameterService = this.getParameterService();
// Use the same parameter as for employees even though this is a student as basic intention is the same
if (parameterService.parameterExists(DisbursementVoucherDocument.class, DisbursementVoucherDocument.USE_DEFAULT_EMPLOYEE_ADDRESS_PARAMETER_NAME) && parameterService.getParameterValueAsBoolean(DisbursementVoucherDocument.class, DisbursementVoucherDocument.USE_DEFAULT_EMPLOYEE_ADDRESS_PARAMETER_NAME)) {
this.getDvPayeeDetail().setDisbVchrPayeeLine1Addr(student.getAddressLine1Unmasked());
this.getDvPayeeDetail().setDisbVchrPayeeLine2Addr(student.getAddressLine2Unmasked());
this.getDvPayeeDetail().setDisbVchrPayeeCityName(student.getAddressCityUnmasked());
this.getDvPayeeDetail().setDisbVchrPayeeStateCode(student.getAddressStateProvinceCodeUnmasked());
this.getDvPayeeDetail().setDisbVchrPayeeZipCode(student.getAddressPostalCodeUnmasked());
this.getDvPayeeDetail().setDisbVchrPayeeCountryCode(student.getAddressCountryCodeUnmasked());
} else {
final EntityAddress address = getNonDefaultAddress(student);
if (address != null) {
this.getDvPayeeDetail().setDisbVchrPayeeLine1Addr(address.getLine1Unmasked());
this.getDvPayeeDetail().setDisbVchrPayeeLine2Addr(address.getLine2Unmasked());
this.getDvPayeeDetail().setDisbVchrPayeeCityName(address.getCityUnmasked());
this.getDvPayeeDetail().setDisbVchrPayeeStateCode(address.getStateProvinceCodeUnmasked());
this.getDvPayeeDetail().setDisbVchrPayeeZipCode(student.getAddressPostalCodeUnmasked());
this.getDvPayeeDetail().setDisbVchrPayeeCountryCode(address.getCountryCodeUnmasked());
} else {
this.getDvPayeeDetail().setDisbVchrPayeeLine1Addr("");
this.getDvPayeeDetail().setDisbVchrPayeeLine2Addr("");
this.getDvPayeeDetail().setDisbVchrPayeeCityName("");
this.getDvPayeeDetail().setDisbVchrPayeeStateCode("");
this.getDvPayeeDetail().setDisbVchrPayeeZipCode("");
this.getDvPayeeDetail().setDisbVchrPayeeCountryCode("");
}
}
// I'm assuming that if a tax id type code other than 'TAX' is present, then the student must be foreign
for (String externalIdentifierTypeCode : student.getExternalIdentifiers().keySet()) {
if (KimConstants.PersonExternalIdentifierTypes.TAX.equals(externalIdentifierTypeCode)) {
this.getDvPayeeDetail().setDisbVchrAlienPaymentCode(false);
}
}
// Determine if student is a research subject
ParameterEvaluator researchPaymentReasonCodeEvaluator = SpringContext.getBean(ParameterEvaluatorService.class).getParameterEvaluator(DisbursementVoucherDocument.class, DisbursementVoucherConstants.RESEARCH_PAYMENT_REASONS_PARM_NM);
if (researchPaymentReasonCodeEvaluator.evaluationSucceeds()) {
if (getParameterService().parameterExists(DisbursementVoucherDocument.class, DisbursementVoucherConstants.RESEARCH_NON_VENDOR_PAY_LIMIT_AMOUNT_PARM_NM)) {
String researchPayLimit = getParameterService().getParameterValueAsString(DisbursementVoucherDocument.class, DisbursementVoucherConstants.RESEARCH_NON_VENDOR_PAY_LIMIT_AMOUNT_PARM_NM);
if (StringUtils.isNotBlank(researchPayLimit)) {
KualiDecimal payLimit = new KualiDecimal(researchPayLimit);
if (getDisbVchrCheckTotalAmount().isLessThan(payLimit)) {
this.getDvPayeeDetail().setDvPayeeSubjectPaymentCode(true);
}
}
}
}
this.disbVchrPayeeTaxControlCode = "";
this.disbVchrPayeeW9CompleteCode = true;
}
use of org.kuali.kfs.coreservice.framework.parameter.ParameterService in project cu-kfs by CU-CommunityApps.
the class CuPurchasingAccountsPayableModuleServiceImpl method handlePurchasingBatchCancels.
/**
* @see org.kuali.kfs.integration.pdp.service.PurchasingAccountsPayableModuleService#handlePurchasingBatchCancels(java.lang.String)
*/
public void handlePurchasingBatchCancels(String documentNumber, String documentTypeCode, boolean primaryCancel, boolean disbursedPayment, boolean crCancel) {
ParameterService parameterService = SpringContext.getBean(ParameterService.class);
PaymentRequestService paymentRequestService = SpringContext.getBean(PaymentRequestService.class);
CreditMemoService creditMemoService = SpringContext.getBean(CreditMemoService.class);
String preqCancelNote = parameterService.getParameterValueAsString(PaymentRequestDocument.class, PurapParameterConstants.PURAP_PDP_PREQ_CANCEL_NOTE);
String preqResetNote = parameterService.getParameterValueAsString(PaymentRequestDocument.class, PurapParameterConstants.PURAP_PDP_PREQ_RESET_NOTE);
String cmCancelNote = parameterService.getParameterValueAsString(VendorCreditMemoDocument.class, PurapParameterConstants.PURAP_PDP_CM_CANCEL_NOTE);
String cmResetNote = parameterService.getParameterValueAsString(VendorCreditMemoDocument.class, PurapParameterConstants.PURAP_PDP_CM_RESET_NOTE);
if (PurapConstants.PurapDocTypeCodes.PAYMENT_REQUEST_DOCUMENT.equals(documentTypeCode)) {
PaymentRequestDocument pr = paymentRequestService.getPaymentRequestByDocumentNumber(documentNumber);
if (pr != null) {
if (disbursedPayment || primaryCancel || crCancel) {
if (!crCancel) {
paymentRequestService.cancelExtractedPaymentRequest(pr, preqCancelNote);
}
} else {
paymentRequestService.resetExtractedPaymentRequest(pr, preqResetNote);
}
} else {
LOG.error("processPdpCancels() DOES NOT EXIST, CANNOT PROCESS - Payment Request with doc type of " + documentTypeCode + " with id " + documentNumber);
}
} else if (PurapConstants.PurapDocTypeCodes.CREDIT_MEMO_DOCUMENT.equals(documentTypeCode)) {
VendorCreditMemoDocument cm = creditMemoService.getCreditMemoByDocumentNumber(documentNumber);
if (cm != null) {
if (disbursedPayment || primaryCancel || crCancel) {
if (!crCancel) {
creditMemoService.cancelExtractedCreditMemo(cm, cmCancelNote);
}
} else {
creditMemoService.resetExtractedCreditMemo(cm, cmResetNote);
}
} else {
LOG.error("processPdpCancels() DOES NOT EXIST, CANNOT PROCESS - Credit Memo with doc type of " + documentTypeCode + " with id " + documentNumber);
}
}
}
use of org.kuali.kfs.coreservice.framework.parameter.ParameterService in project cu-kfs by CU-CommunityApps.
the class ProcurementCardErrorEmailServiceImplTest method setUp.
@Before
public void setUp() throws Exception {
procurementCardErrorEmailService = new ProcurementCardErrorEmailServiceImpl();
EmailServiceImpl emailService = new EmailServiceImpl();
ParameterService parameterService = new MockParameterServiceImpl();
emailService.setParameterService(parameterService);
procurementCardErrorEmailService.setEmailService(emailService);
procurementCardErrorEmailService.setParameterService(parameterService);
}
use of org.kuali.kfs.coreservice.framework.parameter.ParameterService in project cu-kfs by CU-CommunityApps.
the class DocumentType1099BoxServiceImplTest method setupMockParameterServiceForMappings.
protected void setupMockParameterServiceForMappings(String... mappings) {
Collection<String> mappingsCollection = Arrays.asList(mappings);
ParameterService parameterService = EasyMock.createMock(ParameterServiceImpl.class);
EasyMock.expect(parameterService.getParameterValuesAsString(CUTaxConstants.TAX_NAMESPACE, CUTaxConstants.TAX_1099_PARM_DETAIL, CUTaxConstants.Tax1099ParameterNames.DOCUMENT_TYPE_TO_TAX_BOX)).andStubReturn(mappingsCollection);
EasyMock.replay(parameterService);
documentType1099BoxService.setParameterService(parameterService);
}
use of org.kuali.kfs.coreservice.framework.parameter.ParameterService in project cu-kfs by CU-CommunityApps.
the class CuBankServiceImplTest method testGetDefaultBankByDocType_valid.
/*
* test document type that has bank code set up in parameter
*/
public void testGetDefaultBankByDocType_valid() {
parameterService = SpringContext.getBean(ParameterService.class);
bankCodesMap = parameterService.getParameterValueAsString(Bank.class, KFSParameterKeyConstants.DEFAULT_BANK_BY_DOCUMENT_TYPE);
if (StringUtils.isNotBlank(bankCodesMap)) {
for (String docTypeBankCode : bankCodesMap.split(";")) {
String[] docTypeBankCodePair = docTypeBankCode.split("=");
Bank bank = cUBankService.getDefaultBankByDocType(docTypeBankCodePair[0]);
assertTrue("should get valid bank code for " + docTypeBankCodePair[0], StringUtils.equals(docTypeBankCodePair[1], bank.getBankCode()));
}
}
}
Aggregations