Search in sources :

Example 6 with VendorContact

use of org.kuali.kfs.vnd.businessobject.VendorContact in project cu-kfs by CU-CommunityApps.

the class PaymentWorksVendorToKfsVendorDetailConversionServiceImplTest method testBuildContactWithEmptyPhone.

@Test
void testBuildContactWithEmptyPhone() {
    VendorContact actualContact = conversionService.buildContact(PaymentWorksConstants.KFSVendorContactTypes.E_INVOICING, PaymentWorksConstants.KFSVendorContactPhoneTypes.E_INVOICING, CONTACT_NAME, CONTACT_EMAIL_ADDRESS, StringUtils.EMPTY, StringUtils.EMPTY);
    assertBaseContactDetails(actualContact);
    assertEquals(0, CollectionUtils.size(actualContact.getVendorContactPhoneNumbers()));
}
Also used : VendorContact(org.kuali.kfs.vnd.businessobject.VendorContact) Test(org.junit.jupiter.api.Test)

Example 7 with VendorContact

use of org.kuali.kfs.vnd.businessobject.VendorContact in project cu-kfs by CU-CommunityApps.

the class PaymentWorksVendorToKfsVendorDetailConversionServiceImplTest method testBuildContactWithNullPhone.

@Test
void testBuildContactWithNullPhone() {
    VendorContact actualContact = conversionService.buildContact(PaymentWorksConstants.KFSVendorContactTypes.E_INVOICING, PaymentWorksConstants.KFSVendorContactPhoneTypes.E_INVOICING, CONTACT_NAME, CONTACT_EMAIL_ADDRESS, null, null);
    assertBaseContactDetails(actualContact);
    assertEquals(0, CollectionUtils.size(actualContact.getVendorContactPhoneNumbers()));
}
Also used : VendorContact(org.kuali.kfs.vnd.businessobject.VendorContact) Test(org.junit.jupiter.api.Test)

Example 8 with VendorContact

use of org.kuali.kfs.vnd.businessobject.VendorContact in project cu-kfs by CU-CommunityApps.

the class PaymentWorksVendorToKfsVendorDetailConversionServiceImplTest method testBuildContactWithPhone.

@Test
void testBuildContactWithPhone() {
    VendorContact actualContact = conversionService.buildContact(PaymentWorksConstants.KFSVendorContactTypes.E_INVOICING, PaymentWorksConstants.KFSVendorContactPhoneTypes.E_INVOICING, CONTACT_NAME, CONTACT_EMAIL_ADDRESS, CONTACT_PHONE_NUMBER, CONTACT_PHONE_NUMBER_EXTENSION);
    assertBaseContactDetails(actualContact);
    assertEquals(1, CollectionUtils.size(actualContact.getVendorContactPhoneNumbers()));
    VendorContactPhoneNumber actualPhoneContact = actualContact.getVendorContactPhoneNumbers().get(0);
    assertEquals(PaymentWorksConstants.KFSVendorContactPhoneTypes.E_INVOICING, actualPhoneContact.getVendorPhoneTypeCode());
    assertEquals(CONTACT_PHONE_NUMBER, actualPhoneContact.getVendorPhoneNumber());
    assertEquals(CONTACT_PHONE_NUMBER_EXTENSION, actualPhoneContact.getVendorPhoneExtensionNumber());
}
Also used : VendorContactPhoneNumber(org.kuali.kfs.vnd.businessobject.VendorContactPhoneNumber) VendorContact(org.kuali.kfs.vnd.businessobject.VendorContact) Test(org.junit.jupiter.api.Test)

Example 9 with VendorContact

use of org.kuali.kfs.vnd.businessobject.VendorContact in project cu-kfs by CU-CommunityApps.

the class VendorRule method processContactValidation.

/**
 * A stub method as placeholder for future Contact Validation
 *
 * @return boolean false or true
 */
private boolean processContactValidation() {
    boolean valid = true;
    int i = 0;
    for (VendorContact contact : newVendor.getVendorContacts()) {
        String errorPath = MAINTAINABLE_ERROR_PREFIX + VendorPropertyConstants.VENDOR_CONTACT + "[" + i + "]";
        GlobalVariables.getMessageMap().addToErrorPath(errorPath);
        this.getDictionaryValidationService().validateBusinessObject(contact);
        // ==== CU Customization ====
        int j = 0;
        for (VendorContactPhoneNumber contactPhoneNumber : contact.getVendorContactPhoneNumbers()) {
            String errorSubPath = VendorPropertyConstants.VENDOR_CONTACT_PHONE_NUMBER + "[" + j + "]";
            GlobalVariables.getMessageMap().addToErrorPath(errorSubPath);
            this.getDictionaryValidationService().validateBusinessObject(contactPhoneNumber);
            GlobalVariables.getMessageMap().removeFromErrorPath(errorSubPath);
            j++;
        }
        // ==== End CU Customization Section ====
        Map<String, AutoPopulatingList<ErrorMessage>> errors = GlobalVariables.getMessageMap().getErrorMessages();
        if (errors != null && !errors.isEmpty()) {
            valid = false;
        }
        i++;
        GlobalVariables.getMessageMap().clearErrorPath();
    }
    return valid;
}
Also used : VendorContactPhoneNumber(org.kuali.kfs.vnd.businessobject.VendorContactPhoneNumber) VendorContact(org.kuali.kfs.vnd.businessobject.VendorContact) AutoPopulatingList(org.springframework.util.AutoPopulatingList)

Example 10 with VendorContact

use of org.kuali.kfs.vnd.businessobject.VendorContact in project cu-kfs by CU-CommunityApps.

the class PaymentWorksVendorToKfsVendorDetailConversionServiceImplTest method testBuildContactWithPhoneNoExtension.

@Test
void testBuildContactWithPhoneNoExtension() {
    VendorContact actualContact = conversionService.buildContact(PaymentWorksConstants.KFSVendorContactTypes.E_INVOICING, PaymentWorksConstants.KFSVendorContactPhoneTypes.E_INVOICING, CONTACT_NAME, CONTACT_EMAIL_ADDRESS, CONTACT_PHONE_NUMBER, StringUtils.EMPTY);
    assertBaseContactDetails(actualContact);
    assertEquals(1, CollectionUtils.size(actualContact.getVendorContactPhoneNumbers()));
    VendorContactPhoneNumber actualPhoneContact = actualContact.getVendorContactPhoneNumbers().get(0);
    assertEquals(PaymentWorksConstants.KFSVendorContactPhoneTypes.E_INVOICING, actualPhoneContact.getVendorPhoneTypeCode());
    assertEquals(CONTACT_PHONE_NUMBER, actualPhoneContact.getVendorPhoneNumber());
    assertEquals(null, actualPhoneContact.getVendorPhoneExtensionNumber());
}
Also used : VendorContactPhoneNumber(org.kuali.kfs.vnd.businessobject.VendorContactPhoneNumber) VendorContact(org.kuali.kfs.vnd.businessobject.VendorContact) Test(org.junit.jupiter.api.Test)

Aggregations

VendorContact (org.kuali.kfs.vnd.businessobject.VendorContact)10 VendorContactPhoneNumber (org.kuali.kfs.vnd.businessobject.VendorContactPhoneNumber)5 Test (org.junit.jupiter.api.Test)4 VendorBatchContact (edu.cornell.kfs.vnd.businessobject.VendorBatchContact)2 ArrayList (java.util.ArrayList)2 VendorAddress (org.kuali.kfs.vnd.businessobject.VendorAddress)1 VendorContract (org.kuali.kfs.vnd.businessobject.VendorContract)1 VendorDefaultAddress (org.kuali.kfs.vnd.businessobject.VendorDefaultAddress)1 AutoPopulatingList (org.springframework.util.AutoPopulatingList)1