feat: add referral crm queue endpoints
This commit is contained in:
@@ -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
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user