Skip to content
Permalink
Browse files
validating amounts to be in precision 15 scale 5
  • Loading branch information
mgeiss committed Sep 6, 2017
1 parent 04edee8 commit 8cfb6257a990e44003347a135081ca64004bd450
Showing 6 changed files with 18 additions and 6 deletions.
@@ -15,6 +15,7 @@
*/
package io.mifos.teller.api.v1.domain;

import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.DecimalMin;
import java.math.BigDecimal;

@@ -23,7 +24,8 @@ public class Charge {
private String code;
private String incomeAccountIdentifier;
private String name;
@DecimalMin(value = "0.00")
@DecimalMin(value = "0.001")
@DecimalMax(value = "9999999999.99999")
private BigDecimal amount;

public Charge() {
@@ -18,6 +18,7 @@
import org.hibernate.validator.constraints.NotEmpty;

import javax.validation.Valid;
import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
@@ -32,7 +33,8 @@ public class Cheque {
@NotEmpty
private String payee;
@NotNull
@DecimalMin(value = "0.00", inclusive = false)
@DecimalMin(value = "0.001")
@DecimalMax(value = "9999999999.99999")
private BigDecimal amount;
@NotEmpty
private String dateIssued;
@@ -15,14 +15,16 @@
*/
package io.mifos.teller.api.v1.domain;

import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.DecimalMin;
import java.math.BigDecimal;
import java.util.List;

public class TellerBalanceSheet {

private String day;
@DecimalMin("0.00")
@DecimalMin(value = "0.001")
@DecimalMax(value = "9999999999.99999")
private BigDecimal balance;
private List<TellerEntry> entries;

@@ -15,6 +15,7 @@
*/
package io.mifos.teller.api.v1.domain;

import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.DecimalMin;
import java.math.BigDecimal;

@@ -28,7 +29,8 @@ public enum Type {
private Type type;
private String transactionDate;
private String message;
@DecimalMin("0.00")
@DecimalMin(value = "0.001")
@DecimalMax(value = "9999999999.99999")
private BigDecimal amount;

public TellerEntry() {
@@ -18,6 +18,7 @@
import io.mifos.core.lang.validation.constraints.ValidIdentifier;

import javax.validation.Valid;
import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
@@ -49,7 +50,8 @@ public enum State {
@ValidIdentifier
private String clerk;
@NotNull
@DecimalMin(value = "0.00", inclusive = false)
@DecimalMin(value = "0.001")
@DecimalMax(value = "9999999999.99999")
private BigDecimal amount;
private State state;
@Valid
@@ -15,14 +15,16 @@
*/
package io.mifos.teller.api.v1.domain;

import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.DecimalMin;
import java.math.BigDecimal;
import java.util.List;

public class TellerTransactionCosts {

private String tellerTransactionIdentifier;
@DecimalMin("0.00")
@DecimalMin(value = "0.001")
@DecimalMax(value = "9999999999.99999")
private BigDecimal totalAmount;
private List<Charge> charges;

0 comments on commit 8cfb625

Please sign in to comment.