diff --git a/CustomerOnlineV2/CustomerOnlineV2.Api/API/TPApi/TPApiService.cs b/CustomerOnlineV2/CustomerOnlineV2.Api/API/TPApi/TPApiService.cs index 69d351d..8a2896b 100644 --- a/CustomerOnlineV2/CustomerOnlineV2.Api/API/TPApi/TPApiService.cs +++ b/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 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(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 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(resultData); + var a = (jsonResponse.Data != null ? JsonConvert.DeserializeObject(jsonResponse.Data.ToString()) : null); + jsonResponse.Data = a; + + return jsonResponse; + } + else + { + var errorJson = JsonConvert.DeserializeObject(resultData); + var jsonResponseData = JsonConvert.DeserializeObject(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) + }; + } + } + + + } + + } } diff --git a/CustomerOnlineV2/CustomerOnlineV2.Common/Models/CommonResponse.cs b/CustomerOnlineV2/CustomerOnlineV2.Common/Models/CommonResponse.cs index 6944f37..71005cd 100644 --- a/CustomerOnlineV2/CustomerOnlineV2.Common/Models/CommonResponse.cs +++ b/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; } + } } } diff --git a/CustomerOnlineV2/CustomerOnlineV2.Common/Models/Notification/AttachmentModel.cs b/CustomerOnlineV2/CustomerOnlineV2.Common/Models/Notification/AttachmentModel.cs new file mode 100644 index 0000000..dd2eac8 --- /dev/null +++ b/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; } + } +} diff --git a/CustomerOnlineV2/CustomerOnlineV2.Common/Models/Notification/NotificationDTO.cs b/CustomerOnlineV2/CustomerOnlineV2.Common/Models/Notification/NotificationDTO.cs new file mode 100644 index 0000000..e230de2 --- /dev/null +++ b/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 Attachments { get; set; } + + public List EmbeddedResources { get; set; } + + public string ClickActivity { get; set; } + } +} + diff --git a/CustomerOnlineV2/CustomerOnlineV2.Common/Models/Notification/NotifyTemplate.cs b/CustomerOnlineV2/CustomerOnlineV2.Common/Models/Notification/NotifyTemplate.cs new file mode 100644 index 0000000..bd471af --- /dev/null +++ b/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 + } +} diff --git a/CustomerOnlineV2/CustomerOnlineV2.Common/Models/Notification/RecipientViewModel.cs b/CustomerOnlineV2/CustomerOnlineV2.Common/Models/Notification/RecipientViewModel.cs new file mode 100644 index 0000000..01e3089 --- /dev/null +++ b/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; } + + } + +} diff --git a/CustomerOnlineV2/CustomerOnlineV2.Common/Models/Notification/SendNotificationRequest.cs b/CustomerOnlineV2/CustomerOnlineV2.Common/Models/Notification/SendNotificationRequest.cs new file mode 100644 index 0000000..653c9df --- /dev/null +++ b/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 Recipients { get; set; } + + public NotifyTemplate Template { get; set; } + + public string Language { get; set; } + } +} diff --git a/DB/PROC_DYNAMIC_TABLE.sql b/DB/PROC_DYNAMIC_TABLE.sql index 19946f4..924f142 100644 Binary files a/DB/PROC_DYNAMIC_TABLE.sql and b/DB/PROC_DYNAMIC_TABLE.sql differ diff --git a/DB/mobile_proc_online_customerMaster_V1.sql b/DB/mobile_proc_online_customerMaster_V1.sql index 82d5c03..6e86595 100644 --- a/DB/mobile_proc_online_customerMaster_V1.sql +++ b/DB/mobile_proc_online_customerMaster_V1.sql @@ -1 +1 @@ - ALTER PROC [dbo].[mobile_proc_online_customerMaster_V1] ( --EXEC mobile_proc_online_customerMaster_V1 @flag='detail',@customerId='3' @flag VARCHAR(20) ,@customerId VARCHAR(100) = NULL ,@username VARCHAR(100) = NULL ,@postalCode VARCHAR(100) = NULL ,@address1 NVARCHAR(200) = NULL ,@address2 NVARCHAR(200) = NULL ,@city VARCHAR(100) = NULL ,@idType VARCHAR(100) = NULL ,@idTypeNumber VARCHAR(100) = NULL ,@idIssuingCountry VARCHAR(5) = NULL ,@idStartDate VARCHAR(20) = NULL ,@idEndDate VARCHAR(20) = NULL ) AS ; SET NOCOUNT ON; SET XACT_ABORT ON; BEGIN IF @flag = 'detail' BEGIN --ID TYPE SELECT valueId AS id ,detailTitle AS [text] ,isBackRequired = CASE sv.valueId WHEN '10997' THEN 0 ELSE 1 END INTO #ID_TYPE FROM countryIdType CID WITH (NOLOCK) INNER JOIN staticDataValue SV WITH (NOLOCK) ON CID.IdTypeId = SV.valueId WHERE ISNULL(SV.ISActive, 'Y') = 'Y' AND ISNULL(isDeleted, 'N') <> 'Y' AND COUNTRYID = 233 IF EXISTS ( SELECT 'x' FROM dbo.customerMasterTemp(NOLOCK) WHERE customerId = @customerId ) BEGIN SELECT TOP 1 cmt.firstName ,fullName ,gender = CASE WHEN gender = 97 THEN 'M' WHEN gender = 98 THEN 'F' ELSE NULL END ,idType = CASE WHEN ID.ID = '11402' THEN CMT.otherIdNumber ELSE CAST(ID.id AS VARCHAR) END ,CONVERT(VARCHAR(10), dob, 120) AS dob ,email AS email ,mobile ,city ,ISNULL(zipCode, postalCode) ,address address1 ,ISNULL(city, additionalAddress) address2 ,nativeCountry ,cm.countryName ,idNumber ,cmt.idIssueDate ,cmt.idExpiryDate ,idIssueCountry ,KycStatus = ISNULL(verificationCode, 'NOT_COMPLETED') ,KycStatusMsg = CASE verificationCode WHEN 'NOT_COMPLETED' THEN 'Not Completed' WHEN 'PROCESSING' THEN 'ID Document Submission is in Processing' WHEN 'COMPLETED' THEN 'KYC Completed' ELSE 'NOT COMPLETED' END FROM dbo.customerMasterTEMP(NOLOCK) cmt LEFT JOIN #ID_TYPE ID ON ID.id = cmt.idType LEFT JOIN dbo.countryMaster(NOLOCK) cm ON cm.countryId = cmt.nativeCountry WHERE customerId = @customerId END ELSE BEGIN SELECT TOP 1 cmt.firstName ,fullName ,gender = CASE WHEN gender = 97 THEN 'M' WHEN gender = 98 THEN 'F' ELSE NULL END ,idType = CASE WHEN ID.ID = '11402' THEN CMT.otherIdNumber ELSE CAST(ID.id AS VARCHAR) END ,CONVERT(VARCHAR(10), dob, 120) AS dob ,email AS email ,mobile ,city ,zipCode ,address address1 ,additionalAddress address2 ,nativeCountry ,cm.countryName ,idNumber ,CONVERT(VARCHAR(10), cmt.idIssueDate, 120) as idIssueDate ,CONVERT(VARCHAR(10), cmt.idExpiryDate, 120) as idExpiryDate ,cmt.idType ,icm.countryName as ICountryName ,KycStatus = ISNULL(verificationCode, 'NOT_COMPLETED') ,KycStatusMsg = CASE verificationCode WHEN 'NOT_COMPLETED' THEN 'Not Completed' WHEN 'PROCESSING' THEN 'ID Document Submission is in Processing' WHEN 'COMPLETED' THEN 'KYC Completed' ELSE 'NOT COMPLETED' END ,'0' errorCode ,'Success' msg FROM dbo.customerMaster(NOLOCK) cmt LEFT JOIN #ID_TYPE ID ON ID.id = cmt.idType LEFT JOIN dbo.countryMaster(NOLOCK) cm ON cm.countryId = cmt.nativeCountry LEFT JOIN dbo.countryMaster(NOLOCK) icm On icm.countryId= cmt.idIssueCountry WHERE customerId = @customerId END END IF @flag = 'update-id-Kyc' BEGIN IF EXISTS ( SELECT 'X' FROM dbo.customerMasterTemp(NOLOCK) WHERE customerId = @customerId ) BEGIN UPDATE dbo.customerMasterTemp SET idType = ISNULL(@idType, idType) ,idNumber = ISNULL(@idTypeNumber, idNumber) ,idExpiryDate = ISNULL(@idEndDate, idExpiryDate) ,idIssueDate = ISNULL(@idStartDate, idIssueDate) ,idIssueCountry = ISNULL(@idIssuingCountry, idIssueCountry) WHERE username = @userName END ELSE BEGIN UPDATE dbo.customerMaster SET idType = ISNULL(@idType, idType) ,idNumber = ISNULL(@idTypeNumber, idNumber) ,idExpiryDate = ISNULL(@idEndDate, idExpiryDate) ,idIssueDate = ISNULL(@idStartDate, idIssueDate) ,idIssueCountry = ISNULL(@idIssuingCountry, idIssueCountry) WHERE username = @userName END END IF @flag = 'update-address' BEGIN IF EXISTS ( SELECT 'X' FROM dbo.customerMasterTemp(NOLOCK) WHERE customerId = @customerId ) BEGIN UPDATE dbo.customerMasterTemp SET zipCode = ISNULL(@postalCode, zipCode) ,address = ISNULL(@address1, address) ,ADDITIONALADDRESS = ISNULL(@address2, ADDITIONALADDRESS) ,city = ISNULL(@city, city) WHERE customerId = @customerId END ELSE BEGIN UPDATE dbo.customerMaster SET zipCode = ISNULL(@postalCode, zipCode) ,address = ISNULL(@address1, address) ,ADDITIONALADDRESS = ISNULL(@address2, ADDITIONALADDRESS) ,city = ISNULL(@city, city) WHERE customerId = @customerId END END END \ No newline at end of file +USE [FastMoneyPro_Remit] GO /****** Object: StoredProcedure [dbo].[mobile_proc_online_customerMaster_V1] Script Date: 10/10/2023 9:49:53 AM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROC [dbo].[mobile_proc_online_customerMaster_V1] ( --EXEC mobile_proc_online_customerMaster_V1 @flag='detail',@customerId='3' @flag VARCHAR(20) ,@customerId VARCHAR(100) = NULL ,@username VARCHAR(100) = NULL ,@postalCode VARCHAR(100) = NULL ,@address1 NVARCHAR(200) = NULL ,@address2 NVARCHAR(200) = NULL ,@city VARCHAR(100) = NULL ,@idType VARCHAR(100) = NULL ,@idTypeNumber VARCHAR(100) = NULL ,@idIssuingCountry VARCHAR(5) = NULL ,@idStartDate VARCHAR(20) = NULL ,@idEndDate VARCHAR(20) = NULL ) AS ; SET NOCOUNT ON; SET XACT_ABORT ON; BEGIN IF @flag = 'detail' BEGIN --ID TYPE SELECT valueId AS id ,detailTitle AS [text] ,isBackRequired = CASE sv.valueId WHEN '10997' THEN 0 ELSE 1 END INTO #ID_TYPE FROM countryIdType CID WITH (NOLOCK) INNER JOIN staticDataValue SV WITH (NOLOCK) ON CID.IdTypeId = SV.valueId WHERE ISNULL(SV.ISActive, 'Y') = 'Y' AND ISNULL(isDeleted, 'N') <> 'Y' AND COUNTRYID = 233 IF EXISTS ( SELECT 'x' FROM dbo.customerMasterTemp(NOLOCK) WHERE customerId = @customerId ) BEGIN SELECT TOP 1 cmt.firstName ,fullName ,gender = CASE WHEN gender = 97 THEN 'M' WHEN gender = 98 THEN 'F' ELSE NULL END ,idType = CASE WHEN ID.ID = '11402' THEN CMT.otherIdNumber ELSE CAST(ID.id AS VARCHAR) END ,CONVERT(VARCHAR(10), dob, 120) AS dob ,email AS email ,mobile ,city ,ISNULL(zipCode, postalCode) ,address address1 ,ISNULL(city, additionalAddress) address2 ,nativeCountry ,cm.countryName ,idNumber ,cmt.idIssueDate ,cmt.idExpiryDate ,idIssueCountry ,KycStatus = ISNULL(verificationCode, 'NOT_COMPLETED') ,KycStatusMsg = CASE verificationCode WHEN 'NOT_COMPLETED' THEN 'Not Completed' WHEN 'PROCESSING' THEN 'ID Document Submission is in Processing' WHEN 'COMPLETED' THEN 'KYC Completed' ELSE 'NOT COMPLETED' END FROM dbo.customerMasterTEMP(NOLOCK) cmt LEFT JOIN #ID_TYPE ID ON ID.id = cmt.idType LEFT JOIN dbo.countryMaster(NOLOCK) cm ON cm.countryId = cmt.nativeCountry WHERE customerId = @customerId END ELSE BEGIN SELECT TOP 1 cmt.firstName ,fullName ,gender = CASE WHEN gender = 97 THEN 'M' WHEN gender = 98 THEN 'F' ELSE NULL END ,idType = CASE WHEN ID.ID = '11402' THEN CMT.otherIdNumber ELSE CAST(ID.id AS VARCHAR) END ,CONVERT(VARCHAR(10), dob, 120) AS dob ,email AS email ,mobile ,city ,zipCode ,address address1 ,additionalAddress address2 ,nativeCountry ,cm.countryName ,idNumber ,CONVERT(VARCHAR(10), cmt.idIssueDate, 120) as idIssueDate ,CONVERT(VARCHAR(10), cmt.idExpiryDate, 120) as idExpiryDate ,cmt.idType ,icm.countryName as ICountryName ,KycStatus = ISNULL(verificationCode, 'NOT_COMPLETED') ,KycStatusMsg = CASE verificationCode WHEN 'NOT_COMPLETED' THEN 'Not Completed' WHEN 'PROCESSING' THEN 'ID Document Submission is in Processing' WHEN 'COMPLETED' THEN 'KYC Completed' ELSE 'NOT COMPLETED' END ,'0' errorCode ,'Success' msg FROM dbo.customerMaster(NOLOCK) cmt LEFT JOIN #ID_TYPE ID ON ID.id = cmt.idType LEFT JOIN dbo.countryMaster(NOLOCK) cm ON cm.countryId = cmt.nativeCountry LEFT JOIN dbo.countryMaster(NOLOCK) icm On icm.countryId= cmt.idIssueCountry WHERE customerId = @customerId END END IF @flag = 'update-id-Kyc' BEGIN IF EXISTS ( SELECT 'X' FROM dbo.customerMasterTemp(NOLOCK) WHERE customerId = @customerId ) BEGIN UPDATE dbo.customerMasterTemp SET idType = ISNULL(@idType, idType) ,idNumber = ISNULL(@idTypeNumber, idNumber) ,idExpiryDate = ISNULL(@idEndDate, idExpiryDate) ,idIssueDate = ISNULL(@idStartDate, idIssueDate) ,idIssueCountry = ISNULL(@idIssuingCountry, idIssueCountry) WHERE customerId = @customerId SELECT '0' ErrorCode ,'Customer update successfully.' Msg ,@customerId id return END ELSE BEGIN UPDATE dbo.customerMaster SET idType = ISNULL(@idType, idType) ,idNumber = ISNULL(@idTypeNumber, idNumber) ,idExpiryDate = ISNULL(@idEndDate, idExpiryDate) ,idIssueDate = ISNULL(@idStartDate, idIssueDate) ,idIssueCountry = ISNULL(@idIssuingCountry, idIssueCountry) WHERE customerId = @customerId SELECT '0' ErrorCode ,'Customer updated successfully.' Msg ,@customerId id return END END IF @flag = 'update-address' BEGIN IF EXISTS ( SELECT 'X' FROM dbo.customerMasterTemp(NOLOCK) WHERE customerId = @customerId ) BEGIN UPDATE dbo.customerMasterTemp SET zipCode = ISNULL(@postalCode, zipCode) ,address = ISNULL(@address1, address) ,ADDITIONALADDRESS = ISNULL(@address2, ADDITIONALADDRESS) ,city = ISNULL(@city, city) WHERE customerId = @customerId SELECT '0' ErrorCode ,'Customer update successfully.' Msg ,@customerId id return END ELSE --print 'update' BEGIN UPDATE dbo.customerMaster SET zipCode = ISNULL(@postalCode, zipCode) ,address = ISNULL(@address1, address) ,ADDITIONALADDRESS = ISNULL(@address2, ADDITIONALADDRESS) ,city = ISNULL(@city, city) WHERE customerId = @customerId SELECT '0' ErrorCode ,'Customer update successfully.' Msg ,@customerId id return END END END \ No newline at end of file