def viewer(trn): result = deserialize_field(trn.to_dict(), 'serialized_info', 'info') result.pop('environment_id', None) result['creation_date'] = '%s' % result['creation_date'] result['real_amount'] = '%s' % trn.real_amount result['virtual_amount'] = '%s' % trn.virtual_amount result['order_id'] = trn.order_id return result
def viewer(lock): currency = currs_id_idx[lock.currency_id] lock_info = deserialize_field(lock.to_dict(), 'serialized_info', 'info') return { 'id': lock.id, 'user_id': lock.user_id, 'balance_id': lock.balance_id, 'currency_code': currency.code, 'creation_date': '%s' % lock.creation_date, 'real_amount': '%s' % cents_to_decimal(currency, lock.real_amount), 'virtual_amount': '%s' % cents_to_decimal(currency, lock.virtual_amount), 'order_id': lock.order_id, 'info': lock_info['info'], }