in component-test/src/main/java/org/apache/fineract/cn/customer/CustomerApiDocumentation.java [747:826]
public void documentLockClient ( ) throws Exception {
final Customer customer = CustomerGenerator.createRandomCustomer();
DateOfBirth dateOfBirth = new DateOfBirth();
dateOfBirth.setYear(Integer.valueOf(1990));
dateOfBirth.setMonth(Integer.valueOf(1));
dateOfBirth.setDay(Integer.valueOf(1));
Address address = new Address();
address.setStreet("Ghana St");
address.setCity("Bamenda");
address.setRegion("NWR");
address.setPostalCode("8050");
address.setCountryCode("CM");
address.setCountry("Cameroon");
ContactDetail mtnContact = new ContactDetail();
mtnContact.setType(ContactDetail.Type.MOBILE.name());
mtnContact.setGroup(ContactDetail.Group.PRIVATE.name());
mtnContact.setValue("670696104");
mtnContact.setPreferenceLevel(Integer.valueOf(1));
mtnContact.setValidated(Boolean.FALSE);
ContactDetail nextellContact = new ContactDetail();
nextellContact.setType(ContactDetail.Type.MOBILE.name());
nextellContact.setGroup(ContactDetail.Group.PRIVATE.name());
nextellContact.setValue("669876543");
nextellContact.setPreferenceLevel(Integer.valueOf(2));
nextellContact.setValidated(Boolean.FALSE);
List <ContactDetail> contactDetails = new ArrayList <>();
contactDetails.add(mtnContact);
contactDetails.add(nextellContact);
customer.setIdentifier("bahtende");
customer.setType(Customer.Type.PERSON.name());
customer.setGivenName("Bah");
customer.setMiddleName("Tende");
customer.setSurname("Njuh");
customer.setDateOfBirth(dateOfBirth);
customer.setMember(Boolean.TRUE);
customer.setAssignedOffice("Nkwen");
customer.setAssignedEmployee("Nchang Shu");
customer.setAddress(address);
customer.setContactDetails(contactDetails);
customer.setCurrentState(Customer.State.PENDING.name());
customer.setAccountBeneficiary("Wife");
customer.setReferenceCustomer("bihade");
customer.setApplicationDate(LocalDate.ofYearDay(2017, 14).toString());
customer.setLastModifiedBy("Cho Sa'ah");
customer.setLastModifiedOn(LocalDate.ofYearDay(2018, 56).toString());
this.customerManager.createCustomer(customer);
this.eventRecorder.wait(CustomerEventConstants.POST_CUSTOMER, customer.getIdentifier());
Command activateClient = CommandGenerator.create(Command.Action.ACTIVATE, "Client Activated");
this.customerManager.customerCommand(customer.getIdentifier(), activateClient);
this.eventRecorder.wait(CustomerEventConstants.ACTIVATE_CUSTOMER, customer.getIdentifier());
Command lockClient = CommandGenerator.create(Command.Action.LOCK, "Locked Client");
Gson gson = new Gson();
this.mockMvc.perform(post("/customers/" + customer.getIdentifier() + "/commands")
.contentType(MediaType.APPLICATION_JSON_VALUE)
.accept(MediaType.APPLICATION_JSON_VALUE)
.content(gson.toJson(lockClient)))
.andExpect(status().isAccepted())
.andDo(document("document-lock-client", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()),
requestFields(
fieldWithPath("action").description("Action LOCK " +
" +\n" +
" *enum* _Action_ { +\n" +
" ACTIVATE, +\n" +
" LOCK, +\n" +
" UNLOCK, +\n" +
" CLOSE, +\n" +
" REOPEN +\n" +
" }"),
fieldWithPath("comment").description("Lock comment"))));
}