Browse Source

notify api

feature/19315_Customer-Registration-new
shakun 11 months ago
parent
commit
496c9bad8d
  1. 61
      CustomerOnlineV2/CustomerOnlineV2.Api/API/TPApi/TPApiService.cs
  2. 7
      CustomerOnlineV2/CustomerOnlineV2.Common/Models/CommonResponse.cs
  3. 16
      CustomerOnlineV2/CustomerOnlineV2.Common/Models/Notification/AttachmentModel.cs
  4. 25
      CustomerOnlineV2/CustomerOnlineV2.Common/Models/Notification/NotificationDTO.cs
  5. 62
      CustomerOnlineV2/CustomerOnlineV2.Common/Models/Notification/NotifyTemplate.cs
  6. 30
      CustomerOnlineV2/CustomerOnlineV2.Common/Models/Notification/RecipientViewModel.cs
  7. 23
      CustomerOnlineV2/CustomerOnlineV2.Common/Models/Notification/SendNotificationRequest.cs
  8. BIN
      DB/PROC_DYNAMIC_TABLE.sql
  9. 2
      DB/mobile_proc_online_customerMaster_V1.sql

61
CustomerOnlineV2/CustomerOnlineV2.Api/API/TPApi/TPApiService.cs

@ -4,6 +4,9 @@ using CustomerOnlineV2.Common.Models.RegisterModel;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using System.Text;
using static System.Runtime.InteropServices.JavaScript.JSType;
using static CustomerOnlineV2.Common.Models.CommonResponse;
using CustomerOnlineV2.Common.Models.Notification;
namespace CustomerOnlineV2.Api.API.TPApi
{
@ -119,7 +122,6 @@ namespace CustomerOnlineV2.Api.API.TPApi
}
return _response;
}
public async Task<AddressListResponse> GetAddressList(AddressRequest _request)
{
AddressListResponse _response = new AddressListResponse();
@ -136,10 +138,8 @@ namespace CustomerOnlineV2.Api.API.TPApi
{
string responseContent = await response.Content.ReadAsStringAsync();
_responseTP = JsonConvert.DeserializeObject<TPResponse>(responseContent);
_response.ResponseCode = Convert.ToInt16(_responseTP.ResponseCode);
_response.Msg = _responseTP.Msg;
if (_response.ResponseCode == ResponseHelper.SUCCESS)
{
_response.ResponseCode = ResponseHelper.SUCCESS;
@ -152,7 +152,6 @@ namespace CustomerOnlineV2.Api.API.TPApi
{
_response.ResponseCode = ResponseHelper.FAILED;
_response.Msg = "Error occured while calling getting exrate from TPAPI: ";
_logger.LogError("ADDRESSlISTRESPONSE | GETADDRESSLIST | ERROR | " + JsonConvert.SerializeObject(_response));
}
}
@ -161,12 +160,62 @@ namespace CustomerOnlineV2.Api.API.TPApi
{
_response.ResponseCode = ResponseHelper.EXCEPTION;
_response.Msg = "Exception occured: " + ex.Message;
_logger.LogError("ADDRESSlISTRESPONSE | GETADDRESSLIST | ERROR | " + JsonConvert.SerializeObject(_response));
}
}
return _response;
}
public async Task<CommonResponse> SendNotification(SendNotificationRequest request, NOTIFICATION_TYPE nOTIFICATION_TYPE = NOTIFICATION_TYPE.PUSH_NOTIFICATION)
{
CommonResponse jsonResponse = new CommonResponse();
using (HttpClient client = new HttpClient())
{
var obj = JsonConvert.SerializeObject(request);
var jbdContent = new StringContent(obj.ToString(), Encoding.UTF8, "application/json");
try
{
var URL = "http://77.68.15.91:1083/api/v1/TP/NotificationAPI";
HttpResponseMessage resp = client.PostAsync(URL, jbdContent).Result;
string resultData = resp.Content.ReadAsStringAsync().Result;
if (resp.IsSuccessStatusCode)
{
jsonResponse = JsonConvert.DeserializeObject<CommonResponse>(resultData);
var a = (jsonResponse.Data != null ? JsonConvert.DeserializeObject<CommonResponse>(jsonResponse.Data.ToString()) : null);
jsonResponse.Data = a;
return jsonResponse;
}
else
{
var errorJson = JsonConvert.DeserializeObject<ErrorJosn>(resultData);
var jsonResponseData = JsonConvert.DeserializeObject<CommonResponse>(errorJson.Message);
jsonResponse.Id = jsonResponseData.Id;
jsonResponse.ResponseCode = jsonResponseData.ResponseCode;
jsonResponse.Msg = jsonResponseData.Msg;
jsonResponse.Extra = jsonResponseData.Extra;
jsonResponse.Extra1 = jsonResponseData.Extra1;
return jsonResponse;
}
}
catch (Exception ex)
{
return new CommonResponse()
{
ResponseCode = 1,
Msg = (ex.InnerException == null ? ex.Message : ex.InnerException.Message)
};
}
}
}
}
}

7
CustomerOnlineV2/CustomerOnlineV2.Common/Models/CommonResponse.cs

@ -6,8 +6,11 @@
public string? ResponseMessage { get; set; }
public string? Id { get; set; }
public string? Extra { get; set; }
public string Extra1 { get; set; }
public string Extra2 { get; set; }
public object Data { get; set; }
public string Msg { get; set; }
public CommonResponse()
{
ResponseCode = ResponseHelper.FAILED;
@ -21,5 +24,9 @@
Id = id;
Extra = extra;
}
public class ErrorJosn
{
public string Message { get; set; }
}
}
}

16
CustomerOnlineV2/CustomerOnlineV2.Common/Models/Notification/AttachmentModel.cs

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CustomerOnlineV2.Common.Models.Notification
{
public class AttachmentModel
{
public string FileName { get; set; }
public string FilePath { get; set; }
public string FileType { get; set; }
public string Byte64String { get; set; }
}
}

25
CustomerOnlineV2/CustomerOnlineV2.Common/Models/Notification/NotificationDTO.cs

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CustomerOnlineV2.Common.Models.Notification
{
public class NotificationDTO
{
public string Body { get; set; }
public string Title { get; set; }
public string Image { get; set; }
public List<AttachmentModel> Attachments { get; set; }
public List<AttachmentModel> EmbeddedResources { get; set; }
public string ClickActivity { get; set; }
}
}

62
CustomerOnlineV2/CustomerOnlineV2.Common/Models/Notification/NotifyTemplate.cs

@ -0,0 +1,62 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CustomerOnlineV2.Common.Models.Notification
{
[DefaultValue(NONE)]
public enum NotifyTemplate
{
NONE,
[Description("Email to customer txn is created for bank transfer")]
BANK_TRANSFER_TXN_PENDING = 1,
[Description("Email to customer after txn payment is cleared by IME London")]
BANK_TRANSFER_TXN_CLEARED = 2,
[Description("Email to customer after txn is accepted by Pay-out partner")]
BANK_TXN_POST = 3,
[Description("Email to customer after txn has been accepted by Pay-out partner (Cash Collection)")]
CASH_TXN_POST = 4,
[Description("Email to customer for reset password. JsonRX")]
RESET_PASSWORD_EMAIL = 5,
[Description("Email to customer after Basic Registration has been completed")]
BASIC_REGISTRATION_EMAIL = 6,
[Description("Email to customer after KYC completion")]
KYC_VERIFICATION_EMAIL = 7,
[Description("Email to customer for OTP")]
OTP_EMAIL = 8,
TRANSACTION_APPROVED = 10,
TRANSACTION_MODIFY = 11,
JP_POST_APPROVED = 12,
TRANSACTION_CANCELLED = 13,
TRANSACTION_PAID = 14,
TRANSACTION_SUCCESS = 15,
TF_NO_BALANCE = 16
}
public enum NOTIFICATION_TYPE
{
SMS,
EMAIL,
PUSH_NOTIFICATION
}
}

30
CustomerOnlineV2/CustomerOnlineV2.Common/Models/Notification/RecipientViewModel.cs

@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CustomerOnlineV2.Common.Models.Notification
{
public class RecipientViewModel
{
public string Address { get; set; }
public string CcAddress { get; set; }
public string BccAddress { get; set; }
public string DeviceType { get; set; }
public DisplayMailAddress MailAddress { get; set; }
public NotificationDTO NotificationContent { get; set; }
}
public class DisplayMailAddress
{
public string FromEmail { get; set; }
public string AliasName { get; set; }
}
}

23
CustomerOnlineV2/CustomerOnlineV2.Common/Models/Notification/SendNotificationRequest.cs

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CustomerOnlineV2.Common.Models.Notification
{
public class SendNotificationRequest
{
public string NotificationTypeId { get; set; }
public bool IsBulkNotification { get; set; }
public string ControlNo { get; set; }
public List<RecipientViewModel> Recipients { get; set; }
public NotifyTemplate Template { get; set; }
public string Language { get; set; }
}
}

BIN
DB/PROC_DYNAMIC_TABLE.sql

2
DB/mobile_proc_online_customerMaster_V1.sql
File diff suppressed because it is too large
View File

Loading…
Cancel
Save