in component-test/src/main/java/org/apache/fineract/cn/customer/IdentificationApiDocumentation.java [167:213]
public void documentCreateIdCard ( ) throws Exception {
final Customer customer = CustomerGenerator.createRandomCustomer();
customer.setIdentifier("ejiks");
this.customerManager.createCustomer(customer);
this.eventRecorder.wait(CustomerEventConstants.POST_CUSTOMER, customer.getIdentifier());
final String customerIdentifier = customer.getIdentifier();
final IdentificationCard identificationCard = IdentificationCardGenerator.createRandomIdentificationCard();
ExpirationDate expirationDate = new ExpirationDate();
expirationDate.setYear(2029);
expirationDate.setMonth(10);
expirationDate.setDay(10);
identificationCard.setType("National");
identificationCard.setNumber("SC10A1234567");
identificationCard.setExpirationDate(expirationDate);
identificationCard.setIssuer("National Security");
identificationCard.setCreatedBy("Ndop Ndop");
identificationCard.setCreatedOn("2018/10/10");
identificationCard.setLastModifiedBy("Cho Toh");
identificationCard.setLastModifiedOn(LocalDate.now().toString());
Gson gson = new Gson();
this.mockMvc.perform(post("/customers/" + customerIdentifier + "/identifications")
.contentType(MediaType.APPLICATION_JSON_VALUE)
.content(gson.toJson(identificationCard))
.accept(MediaType.APPLICATION_JSON_VALUE))
.andExpect(status().isAccepted())
.andDo(document("document-create-id-card", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()),
requestFields(
fieldWithPath("type").description("Type of identity card"),
fieldWithPath("number").description("Identity card number"),
fieldWithPath("expirationDate").type("ExpirationDate").description("expiry date of card +\n" +
" +\n" +
" *class* _ExpirationDate_ { +\n" +
" *Integer* year, +\n" +
" *Integer* month, +\n" +
" *Integer* day, +\n" +
"} +"),
fieldWithPath("issuer").description("Issuer of identity Card"),
fieldWithPath("createdBy").description("employee who created card"),
fieldWithPath("createdOn").description("date when card was created"),
fieldWithPath("lastModifiedBy").description("employee who last modified card"),
fieldWithPath("lastModifiedOn").description("last time card was modified"))));
}