Merge branch 'master' of https://github.com/ibininja/exchange into ibininja-master

This commit is contained in:
Manfred Karrer 2017-12-19 21:14:55 +01:00
commit 3c0082aee5
No known key found for this signature in database
GPG Key ID: 401250966A6B2C46
3 changed files with 20 additions and 1 deletions

View File

@ -146,7 +146,7 @@ public class CurrencyUtil {
result.add(new CryptoCurrency("XZC", "Zcoin"));
result.add(new CryptoCurrency("ZEC", "Zcash"));
result.add(new CryptoCurrency("ZEN", "ZenCash"));
result.add(new CryptoCurrency("CRED", "Verify", true));
result.sort(TradeCurrency::compareTo);
// Util for printing all altcoins for adding to FAQ page

View File

@ -367,6 +367,11 @@ public final class AltCoinAddressValidator extends InputValidator {
} catch (AddressFormatException e) {
return new ValidationResult(false, getErrorMessage(e));
}
case "CRED":
if (!input.matches("^(0x)?[0-9a-fA-F]{40}$"))
return regexTestFailed;
else
return new ValidationResult(true);
// Add new coins at the end...
default:
log.debug("Validation for AltCoinAddress not implemented yet. currencyCode: " + currencyCode);

View File

@ -412,4 +412,18 @@ public class AltCoinAddressValidatorTest {
assertFalse(validator.validate("1HQQgsvLTgN9xD9hNmAgAreakzVzQUSLSH#").isValid);
assertFalse(validator.validate("").isValid);
}
@Test
public void testCRED() {
AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("CRED");
assertTrue(validator.validate("0x65767ec6d4d3d18a200842352485cdc37cbf3a21").isValid);
assertTrue(validator.validate("65767ec6d4d3d18a200842352485cdc37cbf3a21").isValid);
assertFalse(validator.validate("0x65767ec6d4d3d18a200842352485cdc37cbf3a216").isValid);
assertFalse(validator.validate("0x65767ec6d4d3d18a200842352485cdc37cbf3a2g").isValid);
assertFalse(validator.validate("65767ec6d4d3d18a200842352485cdc37cbf3a2g").isValid);
assertFalse(validator.validate("").isValid);
}
}