def post_top_up_alipay_callback_verify(): """余额充值-支付宝回调验证""" try: data = request.args out_trade_no, total_amount, trade_no = AliPay.callback_verify_sign( data) if not out_trade_no: return Response("failure") doc = manage.client["recharge_records"].find_one( {"order": out_trade_no}) if not doc: return Response("failure") if doc.get("amount") != total_amount: return Response("failure") manage.client["recharge_records"].update( {"order": out_trade_no}, {"$set": { "trade_id": trade_no, "state": 1 }}) return Response("success") except Exception as e: manage.log.error(e) return response(msg="Internal Server Error: %s." % str(e), code=1, status=500)
def post_alipay_callback_verify(): """支付宝回调验证""" try: data = request.args out_trade_no, total_amount, _ = AliPay.callback_verify_sign(data) if not out_trade_no: return Response("failure") cursor = manage.client["order"].find({"order": out_trade_no}) data_list = [] temp_amount = 0 for doc in cursor: data_list.append(doc) temp_amount += doc.get("price") if not data_list: return Response("failure") if temp_amount != total_amount: return Response("failure") return Response("success") except Exception as e: manage.log.error(e) return response(msg="Internal Server Error: %s." % str(e), code=1, status=500)