feat: add referral crm queue endpoints

This commit is contained in:
xiong
2026-07-26 20:26:08 +08:00
parent ecfb57bd30
commit 0385a1accd
7 changed files with 905 additions and 0 deletions

View File

@@ -205,6 +205,16 @@ public sealed class ExceptionHandlingMiddleware(
return;
}
if (exception is CrmException crmException)
{
await WriteProblemAsync(
context,
crmException.Message,
CrmStatusCode(crmException.Code),
crmException.Code);
return;
}
if (exception is PaymentProviderException paymentProviderException)
{
await WriteProblemAsync(
@@ -389,4 +399,15 @@ public sealed class ExceptionHandlingMiddleware(
_ => StatusCodes.Status400BadRequest
};
}
private static int CrmStatusCode(string code)
{
return code switch
{
"crm_access_denied" => StatusCodes.Status403Forbidden,
"crm_queue_not_found" => StatusCodes.Status404NotFound,
"crm_queue_status_invalid" => StatusCodes.Status409Conflict,
_ => StatusCodes.Status400BadRequest
};
}
}