Handling of paddle purchases and add-ons.
This commit is contained in:
@@ -30,4 +30,34 @@ public static class WinoAccountAuthErrorTranslator
|
||||
_ => errorCode
|
||||
};
|
||||
}
|
||||
|
||||
public static string Format(string? errorCode, string? errorMessage)
|
||||
{
|
||||
var translatedCode = Translate(errorCode);
|
||||
var hasCode = !string.IsNullOrWhiteSpace(errorCode);
|
||||
var hasMessage = !string.IsNullOrWhiteSpace(errorMessage);
|
||||
|
||||
if (!hasCode && !hasMessage)
|
||||
{
|
||||
return Translator.GeneralTitle_Error;
|
||||
}
|
||||
|
||||
var formattedCode = translatedCode;
|
||||
if (hasCode && !string.Equals(translatedCode, errorCode, System.StringComparison.Ordinal))
|
||||
{
|
||||
formattedCode = $"{translatedCode} ({errorCode})";
|
||||
}
|
||||
|
||||
if (!hasMessage || string.Equals(errorMessage, translatedCode, System.StringComparison.OrdinalIgnoreCase) || string.Equals(errorMessage, errorCode, System.StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return formattedCode;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(formattedCode))
|
||||
{
|
||||
return errorMessage!;
|
||||
}
|
||||
|
||||
return $"{formattedCode}{System.Environment.NewLine}{errorMessage}";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user