Skip to content
Permalink
Browse files
added MICR resolution for on us cheques
  • Loading branch information
mgeiss committed Aug 22, 2017
1 parent d574660 commit bad4be7333d76621370b669e3fd0261fe2ca7932
Showing 18 changed files with 607 additions and 15 deletions.
@@ -18,8 +18,14 @@
import io.mifos.cheque.api.v1.domain.Cheque;
import io.mifos.cheque.api.v1.domain.ChequeProcessingCommand;
import io.mifos.cheque.api.v1.domain.ChequeTransaction;
import io.mifos.cheque.api.v1.domain.IssuingCount;
import io.mifos.cheque.api.v1.domain.MICRResolution;
import io.mifos.core.api.annotation.ThrowsException;
import io.mifos.core.api.annotation.ThrowsExceptions;
import io.mifos.core.api.util.CustomFeignClientsConfiguration;
import io.mifos.core.api.util.NotFoundException;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
@@ -84,4 +90,17 @@ void process(@PathVariable("identifier") final String identifier,
consumes = {MediaType.APPLICATION_JSON_VALUE}
)
void process(@RequestBody @Valid final ChequeTransaction chequeTransaction);

@RequestMapping(
value = "/micr/{identifier}",
method = RequestMethod.GET,
produces = {MediaType.ALL_VALUE},
consumes = {MediaType.APPLICATION_JSON_VALUE}
)
@ThrowsExceptions({
@ThrowsException(status = HttpStatus.NOT_FOUND, exception = NotFoundException.class),
@ThrowsException(status = HttpStatus.CONFLICT, exception = InvalidChequeNumberException.class),
@ThrowsException(status = HttpStatus.BAD_REQUEST, exception = DependingResourceNotValidException.class)
})
MICRResolution expandMicr(@PathVariable("identifier") final String identifier);
}
@@ -0,0 +1,19 @@
/*
* Copyright 2017 Kuelap, Inc.
*
* All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains
* the property of Kuelap, Inc and its suppliers, if any.
* The intellectual and technical concepts contained herein
* are proprietary to Kuelap, Inc and its suppliers and may
* be covered by U.S. and Foreign Patents, patents in process,
* and are protected by trade secret or copyright law.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* Kuelap, Inc.
*/
package io.mifos.cheque.api.v1.client;

public class DependingResourceNotValidException extends RuntimeException {
}
@@ -0,0 +1,19 @@
/*
* Copyright 2017 Kuelap, Inc.
*
* All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains
* the property of Kuelap, Inc and its suppliers, if any.
* The intellectual and technical concepts contained herein
* are proprietary to Kuelap, Inc and its suppliers and may
* be covered by U.S. and Foreign Patents, patents in process,
* and are protected by trade secret or copyright law.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* Kuelap, Inc.
*/
package io.mifos.cheque.api.v1.client;

public class InvalidChequeNumberException extends RuntimeException {
}
@@ -13,7 +13,7 @@
* is strictly forbidden unless prior written permission is obtained
* Kuelap, Inc.
*/
package io.mifos.cheque.api.v1.client;
package io.mifos.cheque.api.v1.domain;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
@@ -0,0 +1,42 @@
/*
* Copyright 2017 Kuelap, Inc.
*
* All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains
* the property of Kuelap, Inc and its suppliers, if any.
* The intellectual and technical concepts contained herein
* are proprietary to Kuelap, Inc and its suppliers and may
* be covered by U.S. and Foreign Patents, patents in process,
* and are protected by trade secret or copyright law.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* Kuelap, Inc.
*/
package io.mifos.cheque.api.v1.domain;

public class MICRResolution {

private String office;
private String customer;

public MICRResolution() {
super();
}

public String getOffice() {
return this.office;
}

public void setOffice(final String office) {
this.office = office;
}

public String getCustomer() {
return this.customer;
}

public void setCustomer(final String customer) {
this.customer = customer;
}
}
@@ -20,11 +20,11 @@
import io.mifos.accounting.api.v1.domain.Debtor;
import io.mifos.accounting.api.v1.domain.JournalEntry;
import io.mifos.cheque.api.v1.EventConstants;
import io.mifos.cheque.api.v1.client.IssuingCount;
import io.mifos.cheque.api.v1.domain.Action;
import io.mifos.cheque.api.v1.domain.Cheque;
import io.mifos.cheque.api.v1.domain.ChequeProcessingCommand;
import io.mifos.cheque.api.v1.domain.ChequeTransaction;
import io.mifos.cheque.api.v1.domain.IssuingCount;
import io.mifos.cheque.api.v1.domain.State;
import io.mifos.cheque.service.internal.format.MICRParser;
import io.mifos.cheque.service.internal.service.helper.AccountingService;
@@ -81,7 +81,6 @@ public void shouldProcessChequeOnUs() throws Exception {
.doAnswer(invocation -> true)
.when(this.accountingServiceSpy).accountExists(randomCheque.getMicr().getAccountNumber());


final ChequeTransaction chequeTransaction = new ChequeTransaction();
chequeTransaction.setCheque(randomCheque);
chequeTransaction.setCreditorAccountNumber(RandomStringUtils.randomAlphanumeric(34));
@@ -15,7 +15,7 @@
*/
package io.mifos.cheque;

import io.mifos.cheque.api.v1.client.IssuingCount;
import io.mifos.cheque.api.v1.domain.IssuingCount;
import io.mifos.cheque.service.internal.repository.IssuedChequeEntity;
import io.mifos.cheque.service.internal.repository.IssuedChequeRepository;
import io.mifos.cheque.service.internal.service.helper.AccountingService;

0 comments on commit bad4be7

Please sign in to comment.