app/src/main/java/com/treslines/pagsegurodemo/PagSeguroItem.java
private void validate(final String id, final String description, final BigDecimal amount, final int quantity, final int weightInGramms){
        if(id.isEmpty()){
            throw new IllegalArgumentException("Product's Id can not be empty!");
        }
        if(id.length()>100){
            throw new IllegalArgumentException("Product's Id can not exceed 100 characters!");
        }
        if(description.isEmpty()){
            throw new IllegalArgumentException("Product's description can not be empty!");
        }
        if(description.length()>100){
            throw new IllegalArgumentException("Product's description can not exceed 100 characters!");
        }
        if(quantity<=0 || quantity >999){
            throw new IllegalArgumentException("Product's quantity can not be smaller or equals 0 and not greater then 999!");
        }
        if(weightInGramms<0 || weightInGramms > (1000*30)){
            throw new IllegalArgumentException("Product's weight can not be smaller 0 and the sum of all products can not exceed 30kg!");
        }
        if (amount.compareTo(BigDecimal.valueOf(1)) == -1 || amount.compareTo(BigDecimal.valueOf(9999999.00)) == 1 ){
            throw new IllegalArgumentException("Product's amount can not be smaller then R$1.00 and not greater then R$9999999.00!");
        }
    }
/** validation acc. to pagseguro's web documentation*/
validation acc. to pagseguro's web documentation
validation acc . to pagseguro ' s web documentation
private void validate(final String id, final String description, final BigDecimal amount, final int quantity, final int weightInGramms){
        if(id.isEmpty()){
            throw new IllegalArgumentException("Product's Id can not be empty!");
        }
        if(id.length()>100){
            throw new IllegalArgumentException("Product's Id can not exceed 100 characters!");
        }
        if(description.isEmpty()){
            throw new IllegalArgumentException("Product's description can not be empty!");
        }
        if(description.length()>100){
            throw new IllegalArgumentException("Product's description can not exceed 100 characters!");
        }
        if(quantity<=0 || quantity >999){
            throw new IllegalArgumentException("Product's quantity can not be smaller or equals 0 and not greater then 999!");
        }
        if(weightInGramms<0 || weightInGramms > (1000*30)){
            throw new IllegalArgumentException("Product's weight can not be smaller 0 and the sum of all products can not exceed 30kg!");
        }
        if (amount.compareTo(BigDecimal.valueOf(1)) == -1 || amount.compareTo(BigDecimal.valueOf(9999999.00)) == 1 ){
            throw new IllegalArgumentException("Product's amount can not be smaller then R$1.00 and not greater then R$9999999.00!");
        }
    }
private void validate ( final String id , final String description , final BigDecimal amount , final int quantity , final int weightInGramms ) { if ( id . isEmpty ( ) ) { throw new IllegalArgumentException ( "Product's Id can not be empty!" ) ; } if ( id . length ( ) > 100 ) { throw new IllegalArgumentException ( "Product's Id can not exceed 100 characters!" ) ; } if ( description . isEmpty ( ) ) { throw new IllegalArgumentException ( "Product's description can not be empty!" ) ; } if ( description . length ( ) > 100 ) { throw new IllegalArgumentException ( "Product's description can not exceed 100 characters!" ) ; } if ( quantity <= 0 || quantity > 999 ) { throw new IllegalArgumentException ( "Product's quantity can not be smaller or equals 0 and not greater then 999!" ) ; } if ( weightInGramms < 0 || weightInGramms > ( 1000 * 30 ) ) { throw new IllegalArgumentException ( "Product's weight can not be smaller 0 and the sum of all products can not exceed 30kg!" ) ; } if ( amount . compareTo ( BigDecimal . valueOf ( 1 ) ) == - 1 || amount . compareTo ( BigDecimal . valueOf ( 9999999.00 ) ) == 1 ) { throw new IllegalArgumentException ( "Product's amount can not be smaller then R$1.00 and not greater then R$9999999.00!" ) ; } }
validation acc.
validation acc .