throw new ErrorCodeException(TransactionResult.ErrorCode.INVALID_CURRENCY_CODE, "TransactionResult.ErrorCode.INVALID_CURRENCY_CODE");
if(command.indexOf(':')!=-1) throw new ErrorCodeException(new IllegalArgumentException("command may not contain a colon (:): "+command), TransactionResult.ErrorCode.HASH_CHECK_FAILED, "TransactionResult.ErrorCode.HASH_CHECK_FAILED");
if(pin.indexOf(':')!=-1) throw new ErrorCodeException(new IllegalArgumentException("pin may not contain a colon (:): "+pin), TransactionResult.ErrorCode.HASH_CHECK_FAILED, "TransactionResult.ErrorCode.HASH_CHECK_FAILED");
hashData.append(command).append(':').append(pin).append(':').append(amount.toString()).append(':');
if(invoiceNumber!=null && invoiceNumber.length()>0) hashData.append(invoiceNumber);
request.put("UMhash", hash);
} catch(NoSuchAlgorithmException err) {
throw new ErrorCodeException(err, TransactionResult.ErrorCode.HASH_CHECK_FAILED, "TransactionResult.ErrorCode.HASH_CHECK_FAILED");
throw new ErrorCodeException(TransactionResult.ErrorCode.HASH_CHECK_FAILED, "TransactionResult.ErrorCode.HASH_CHECK_FAILED");
if(slashPos1==-1) {
System.err.println("Unable to find first slash: "+responseHash);
throw new ErrorCodeException(TransactionResult.ErrorCode.HASH_CHECK_FAILED, "TransactionResult.ErrorCode.HASH_CHECK_FAILED");
throw new ErrorCodeException(TransactionResult.ErrorCode.HASH_CHECK_FAILED, "TransactionResult.ErrorCode.HASH_CHECK_FAILED");
if(slashPos2==-1) {
System.err.println("Unable to find second slash: "+responseHash);
throw new ErrorCodeException(TransactionResult.ErrorCode.HASH_CHECK_FAILED, "TransactionResult.ErrorCode.HASH_CHECK_FAILED");
if(!expectedMd5.equalsIgnoreCase(responseMd5)) {
System.err.println("Response MD5 != Expected MD5: "+responseMd5+" != "+expectedMd5);
throw new ErrorCodeException(TransactionResult.ErrorCode.HASH_CHECK_FAILED, "TransactionResult.ErrorCode.HASH_CHECK_FAILED");
throw new ErrorCodeException(err, TransactionResult.ErrorCode.HASH_CHECK_FAILED, "TransactionResult.ErrorCode.HASH_CHECK_FAILED");