def __init__(self, user, game, resource_key,
                 consume_amount, gamesession_id, token):

        self.user = user
        self.game = game
        self.id = create_id()
        self.key = resource_key
        self.gamesession_id = gamesession_id
        self.token = token
        self.consumed = False

        # validation step
        try:
            consume_amount = int(consume_amount)
        except ValueError:
            raise StoreError('Item "%s" consume amount parameters must be an integer' % resource_key)

        self.consume_amount = consume_amount

        if consume_amount <= 0:
            raise StoreError('Item "%s" consume amount parameter must be non-negative' % resource_key)

        game_store_items = StoreList.get(game)
        try:
            resource_meta = game_store_items.get_resource(resource_key)
            if resource_meta.type != 'consume':
                raise StoreError('Item "%s" is not a consumable' % resource_key)
        except KeyError:
            raise StoreError('No item with key "%s"' % resource_key)
dataset/ETHPy150Open turbulenz/turbulenz_local/turbulenz_local/models/apiv1/store.py/ConsumeTransaction.__init__/original