'Verifies that the receipt can be decoded and that the initial
contents of the receipt are correct.
If its invalid, then just return invalid rather than give out any
information.'

def decode(self):

    try:
        receipt = decode_receipt(self.receipt)
    except:
        (exc_type, exc_value, tb) = sys.exc_info()
        log_exception({'receipt': ('%s...' % self.receipt[:10]), 'app': self.get_app_id(raise_exception=False)})
        log_info('Error    decoding    receipt')
        raise InvalidReceipt('ERROR_DECODING'), None, tb
    try:
        assert (receipt['user']['type'] == 'directed-identifier')
    except (AssertionError, KeyError):
        log_info('No    directed-identifier    supplied')
        raise InvalidReceipt('NO_DIRECTED_IDENTIFIER')
    return receipt
