diff --git a/applications/Unity.GrantManager/modules/Unity.Payments/src/Unity.Payments.Application/Integrations/Cas/InvoiceService.cs b/applications/Unity.GrantManager/modules/Unity.Payments/src/Unity.Payments.Application/Integrations/Cas/InvoiceService.cs index 5f5235a057..9cd659d376 100644 --- a/applications/Unity.GrantManager/modules/Unity.Payments/src/Unity.Payments.Application/Integrations/Cas/InvoiceService.cs +++ b/applications/Unity.GrantManager/modules/Unity.Payments/src/Unity.Payments.Application/Integrations/Cas/InvoiceService.cs @@ -3,7 +3,10 @@ using System.Threading.Tasks; using System.Text.Json; using System; +using System.Globalization; +using System.Text.RegularExpressions; using Unity.Payments.Integrations.Http; +using System.Text.Encodings.Web; using Volo.Abp.Application.Services; using System.Collections.Generic; using Unity.Payments.Enums; @@ -197,7 +200,7 @@ await AbpUserTenantAccessor.GetCurrentTenantNameAsync(serviceProvider) var generated = string.IsNullOrWhiteSpace(tenantDesc) ? "Grant Payment" - : $"{tenantDesc} – Grant Payment"; + : $"{tenantDesc} - Grant Payment"; if (generated.Length > 50) { @@ -248,9 +251,13 @@ await invoiceManager.UpdatePaymentRequestWithInvoiceAsync( public async Task CreateInvoiceAsync(Invoice casAPInvoice) { - string jsonString = JsonSerializer.Serialize(casAPInvoice); + var jsonOptions = new JsonSerializerOptions + { + Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping + }; + + string jsonString = JsonSerializer.Serialize(casAPInvoice, jsonOptions); - Logger.LogDebug("CAS Invoice JSON: {CasInvoiceJson}", jsonString); var authToken = await iTokenService.GetAuthTokenAsync(CurrentTenant.Id ?? Guid.Empty); string casBaseUrl = await endpointManagementAppService.GetUgmUrlByKeyNameAsync(DynamicUrlKeyNames.PAYMENT_API_BASE);