|
|
@ -24,6 +24,7 @@ using Abp.EntityFrameworkCore.Repositories; |
|
|
|
using System.Security.Cryptography; |
|
|
|
using Abp.Domain.Uow; |
|
|
|
using Google.Type; |
|
|
|
using Microsoft.AspNetCore.Http; |
|
|
|
|
|
|
|
namespace BCS.BMC.Web.Controllers |
|
|
|
{ |
|
|
@ -58,12 +59,18 @@ namespace BCS.BMC.Web.Controllers |
|
|
|
|
|
|
|
|
|
|
|
[HttpPost] |
|
|
|
public async Task<IActionResult> SendNotification([FromBody] List<FireBaseResponseModel> notifications) |
|
|
|
public async Task<SendResponse> SendNotification([FromBody] FireBaseResponseModelForBmc notification) |
|
|
|
{ |
|
|
|
var result = await _notificationService.SendNotification(notification); |
|
|
|
return result.Responses[0]; |
|
|
|
} |
|
|
|
|
|
|
|
public async Task<IActionResult> SendNotificationForBwac([FromBody] List<FireBaseResponseModel> notifications) |
|
|
|
{ |
|
|
|
List<BmcMessageStatusInput> bmcMessageStatusInputs = new List<BmcMessageStatusInput>(); |
|
|
|
foreach (var notification in notifications) |
|
|
|
{ |
|
|
|
var result = await _notificationService.SendNotification(notification); |
|
|
|
var result = await _notificationService.SendNotificationBwac(notification); |
|
|
|
|
|
|
|
if (result.SuccessCount > 0) |
|
|
|
{ |
|
|
@ -72,8 +79,6 @@ namespace BCS.BMC.Web.Controllers |
|
|
|
notification.getResponseData.IsSuccess = true; |
|
|
|
notification.getResponseData.Status = "Delivered"; |
|
|
|
} |
|
|
|
|
|
|
|
// return Ok(result);
|
|
|
|
} |
|
|
|
if (result.FailureCount > 0) |
|
|
|
{ |
|
|
@ -83,7 +88,6 @@ namespace BCS.BMC.Web.Controllers |
|
|
|
notification.getResponseData.Status = result.Responses[0].Exception.Message; |
|
|
|
} |
|
|
|
//await UpdateBmcMessageStatus(notification.getResponseData);
|
|
|
|
return BadRequest(result.Responses); |
|
|
|
} |
|
|
|
bmcMessageStatusInputs.Add(notification.getResponseData); |
|
|
|
} |
|
|
@ -189,7 +193,7 @@ namespace BCS.BMC.Web.Controllers |
|
|
|
} |
|
|
|
await uow.CompleteAsync(); |
|
|
|
} |
|
|
|
await SendNotification(sendNotificationInfoList); |
|
|
|
await SendNotificationForBwac(sendNotificationInfoList); |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|