def post_transaction(): from transient.services.transactions import create_transaction try: transaction = create_transaction(**request.json) session.add(transaction) session.commit() except Exception, e: session.rollback() return jsonify({ 'success': False })
def post_payment(): from transient.services.payments import create_payment try: payment = create_payment(**request.json) session.add(payment) session.commit() except: session.rollback() return jsonify({ 'success': False }) else: return jsonify({ 'success': True, 'payment': payment.to_dict() }) finally: session.remove()
def tearDown(self): Transaction.query.delete() Withdrawal.query.delete() Payment.query.delete() session.commit() session.remove()