1
This commit is contained in:
@@ -85,7 +85,7 @@ async def wechat_callback(request: Request, db: AsyncSession = Depends(get_db)):
|
||||
return {"code": "SUCCESS", "message": "OK"}
|
||||
|
||||
|
||||
@router.post("/alipay/callback")
|
||||
@router.get("/alipay/callback")
|
||||
async def alipay_callback(request: Request, db: AsyncSession = Depends(get_db)):
|
||||
form_data = await request.form()
|
||||
data = dict(form_data)
|
||||
|
||||
@@ -42,6 +42,11 @@ class RequestEncryptMiddleware(BaseHTTPMiddleware):
|
||||
async def dispatch(
|
||||
self, request: Request, call_next: RequestResponseEndpoint
|
||||
) -> Response:
|
||||
# 白名单:支付回调接口不需要加密/解密
|
||||
path = request.url.path
|
||||
if "/payments/alipay/callback" in path or "/payments/wechat/callback" in path:
|
||||
return await call_next(request)
|
||||
|
||||
encrypted = request.headers.get("X-Encrypted", "").lower() == "true"
|
||||
if not encrypted:
|
||||
return await call_next(request)
|
||||
|
||||
Reference in New Issue
Block a user