public void documentCloseClient()

in component-test/src/main/java/org/apache/fineract/cn/customer/CustomerApiDocumentation.java [915:990]


  public void documentCloseClient ( ) throws Exception {
    final Customer customer = CustomerGenerator.createRandomCustomer();

    DateOfBirth dateOfBirth = new DateOfBirth();
    dateOfBirth.setYear(Integer.valueOf(1992));
    dateOfBirth.setMonth(Integer.valueOf(3));
    dateOfBirth.setDay(Integer.valueOf(3));

    Address address = new Address();
    address.setStreet("Soppo");
    address.setCity("Buea");
    address.setRegion("SWR");
    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("677223344");
    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("668877553");
    nextellContact.setPreferenceLevel(Integer.valueOf(2));
    nextellContact.setValidated(Boolean.FALSE);

    List <ContactDetail> contactDetails = new ArrayList <>();
    contactDetails.add(mtnContact);
    contactDetails.add(nextellContact);

    customer.setIdentifier("epolle");
    customer.setType(Customer.Type.PERSON.name());
    customer.setGivenName("Epolle");
    customer.setMiddleName("E.");
    customer.setSurname("Makoge");
    customer.setDateOfBirth(dateOfBirth);
    customer.setMember(Boolean.TRUE);
    customer.setAssignedOffice("Muea");
    customer.setAssignedEmployee("Epie N.");
    customer.setAddress(address);
    customer.setContactDetails(contactDetails);
    customer.setCurrentState(Customer.State.PENDING.name());
    customer.setAccountBeneficiary("Relative");
    customer.setReferenceCustomer("pobum");
    customer.setApplicationDate(LocalDate.ofYearDay(2017, 32).toString());
    customer.setLastModifiedBy("Epie N.");
    customer.setLastModifiedOn(LocalDate.ofYearDay(2018, 80).toString());

    this.customerManager.createCustomer(customer);
    this.eventRecorder.wait(CustomerEventConstants.POST_CUSTOMER, customer.getIdentifier());

    Command closeClient = CommandGenerator.create(Command.Action.CLOSE, "Client Closed");

    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(closeClient)))
            .andExpect(status().isAccepted())
            .andDo(document("document-close-client", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()),
                    requestFields(
                            fieldWithPath("action").description("Action CLOSE " +
                                    " +\n" +
                                    " *enum* _Action_ { +\n" +
                                    "    ACTIVATE, +\n" +
                                    "    LOCK, +\n" +
                                    "    UNLOCK, +\n" +
                                    "    CLOSE, +\n" +
                                    "    REOPEN +\n" +
                                    "  }"),
                            fieldWithPath("comment").description("Close comment"))));
  }