Exemplo n.º 1
0
    def _parse_coins(self, s, minimum=None):
        try:
            s = utils.parse_number(s)
        except ValueError:
            pass

        match = REGEX_FLOAT.match(s)
        if match:
            coins = decimal.Decimal(match.group(0))
            if minimum == None or coins >= minimum:
                return coins
            else:
                raise CoinParseException(
                    "Coin amount provided is lower than %s" % minimum)
        else:
            raise CoinParseException(
                "Please provide a valid positive coin amount")
Exemplo n.º 2
0
    def _parse_coins(self, s, minimum=None):
        try:
            s = utils.parse_number(s)
        except ValueError:
            pass

        match = REGEX_FLOAT.match(s)
        if match:
            coins = decimal.Decimal(match.group(0))
            if minimum == None or coins >= minimum:
                return coins
            else:
                raise CoinParseException(
                    "Coin amount provided is lower than %s" % minimum)
        else:
            raise CoinParseException(
                "Please provide a valid positive coin amount")