/** To create a customer */ public static UserWS createCustomer( Integer currencyId, String userName, String password, Integer languageId, Integer mainRoleId, boolean isParent, Integer statusID, PaymentInformationWS instrument, ContactWS contact) { UserWS newUser = new UserWS(); newUser.setUserName(userName); newUser.setLanguageId(languageId); newUser.setCurrencyId(currencyId); // defautl account type id newUser.setAccountTypeId(Integer.valueOf(1)); MetaFieldValueWS metaField1 = new MetaFieldValueWS(); metaField1.setFieldName("partner.prompt.fee"); metaField1.setValue("serial-from-ws"); MetaFieldValueWS metaField2 = new MetaFieldValueWS(); metaField2.setFieldName("ccf.payment_processor"); metaField2.setValue("FAKE_2"); // the plug-in parameter of the processor // contact info MetaFieldValueWS metaField3 = new MetaFieldValueWS(); metaField3.setFieldName("contact.email"); metaField3.setValue(newUser.getUserName() + "@shire.com"); metaField3.setGroupId(1); MetaFieldValueWS metaField4 = new MetaFieldValueWS(); metaField4.setFieldName("contact.first.name"); metaField4.setValue("Frodo"); metaField4.setGroupId(1); MetaFieldValueWS metaField5 = new MetaFieldValueWS(); metaField5.setFieldName("contact.last.name"); metaField5.setValue("Baggins"); metaField5.setGroupId(1); newUser.setMetaFields( new MetaFieldValueWS[] {metaField1, metaField2, metaField3, metaField4, metaField5}); // Provide Defaults newUser.setPassword(password); newUser.setMainRoleId(mainRoleId); // customer newUser.setIsParent(isParent); // not parent newUser.setStatusId(statusID); // active user // add a contact if (contact != null) { newUser.setContact(contact); } // instrument can be credit card or ach if (instrument != null) { newUser.getPaymentInstruments().add(instrument); } return newUser; }