Browse Source

fix issue for send sms, upper for name, id type back , id number

Mobile-pdf
shakun 1 year ago
parent
commit
e7280a469c
  1. 63
      Business/Mobile/MobileServices.cs
  2. 4
      Business/TPApi/NotifierV2.cs
  3. 2
      Common/Model/UserDetails.cs
  4. 15
      Common/RestApiClient.cs
  5. 1
      JsonRx/Api/CustomerController.cs
  6. 40
      JsonRx/Helper/Util.cs
  7. 89
      Repository/Mobile/MobileServicesRepo.cs

63
Business/Mobile/MobileServices.cs

@ -157,10 +157,10 @@ namespace Business.Mobile
bool smsSent = false;
if (requestOTPModel.userId.IsValidEmail())
{
if (!string.IsNullOrEmpty(jsonRx.Extra2) && jsonRx.Extra2.Equals("100"))
if (!string.IsNullOrEmpty(jsonRx.ErrorCode) && jsonRx.ErrorCode.Equals("0"))
{
List<Notify.Mapping> bodyMappings = new List<Notify.Mapping>();
bodyMappings.Add(new Notify.Mapping() { SValue = "CustomerName", SText = requestOTPModel.customerName });
bodyMappings.Add(new Notify.Mapping() { SValue = "CustomerName", SText = jsonRx.Extra3 });
bodyMappings.Add(new Notify.Mapping() { SValue = "OTP_CODE", SText = requestOTPModel.OTP });
bodyMappings.Add(new Notify.Mapping() { SValue = "TYPE", SText = requestOTPModel.requestFor.Equals("REGISTER") ? "customer" : "receiver" });
try
@ -176,15 +176,13 @@ namespace Business.Mobile
{
new RecipientViewModel()
{
NotificationContent = new NotificationDTO()
{
NotificationContent = new NotificationDTO() {
Body = JsonConvert.SerializeObject(bodyMappings),
//Title will be set by mapping json
},
Address= requestOTPModel.userId,
DeviceType = requestOTPModel.DeviceType,
}
}
} }
};
jsonRx = NotifierV2.SendNotification(request, NOTIFICATION_TYPE.EMAIL);
emailSent = true;
@ -193,7 +191,6 @@ namespace Business.Mobile
{
Log.Error("Error sending email", emailException);
}
}
try
{
@ -220,10 +217,11 @@ namespace Business.Mobile
if (emailSent || smsSent)
{
jsonRx.ErrorCode = "0";
jsonRx.SetResponse("0", "OTP has been verified.");
jsonRx.SetResponse("0", "OTP has been Sent.");
return jsonRx;
}
}
}
else
{
jsonRx.ErrorCode = "1";
@ -287,7 +285,7 @@ namespace Business.Mobile
bodyMappings.Add(new Notify.Mapping() { SValue = "MobileNo", SText = userDetails.Mobile });
bodyMappings.Add(new Notify.Mapping() { SValue = "Address", SText = userDetails.Address });
bodyMappings.Add(new Notify.Mapping() { SValue = "EMAIL_ID", SText = userDetails.Email });
bodyMappings.Add(new Notify.Mapping() { SValue = "RegisteredDate", SText = userDetails.RegisteredDate.ToString() });
bodyMappings.Add(new Notify.Mapping() { SValue = "RegisteredDate", SText = userDetails.RegisteredDate.ToString("dd/MM/YYYY") });
SendNotificationRequest request = new SendNotificationRequest()
{
@ -1888,9 +1886,9 @@ namespace Business.Mobile
//}
if (res.ErrorCode.Equals("0"))
{
_trustDocBusiness.CompareData(new TrustDocRequest() { birth = res.Extra2, name = res.Msg }, res.Extra3, username, res.Id);
// _trustDocBusiness.CompareData(new TrustDocRequest() { birth = res.Extra2, name = res.Msg }, res.Extra3, username, res.Id);
res.Msg = "Thank you for completing your profile. You can now start sending transactions";
// Send a push notification
SendNotificationRequest pushNotificationRequest = new SendNotificationRequest()
{
IsBulkNotification = false,
@ -1904,36 +1902,33 @@ namespace Business.Mobile
},
Language = Convert.ToString(CallContext.GetData(Constants.Language))
};
Task.Run(() => NotifierV2.SendNotification(pushNotificationRequest, NOTIFICATION_TYPE.PUSH_NOTIFICATION));
//SendNotificationRequest emailNotificationRequest = new SendNotificationRequest()
//{
// IsBulkNotification = false,
// UserName = username,
// ProcessId = Guid.NewGuid().ToString(),
// ProviderId = "CustomerInfoAgree",
// NotificationTypeId = NOTIFICATION_TYPE.EMAIL.ToString(),
// Template = Common.Model.Enum.NotifyTemplate.KYC_VERIFICATION_EMAIL,
// Recipients = new List<RecipientViewModel>()
// {
// new RecipientViewModel() { Address= res.Extra , NotificationContent = new NotificationDTO() }
// },
// Language = Convert.ToString(CallContext.GetData(Constants.Language))
//};
// Send an email notification
SendNotificationRequest emailNotificationRequest = new SendNotificationRequest()
{
IsBulkNotification = false,
UserName = username,
ProcessId = Guid.NewGuid().ToString(),
ProviderId = "CustomerInfoAgree",
NotificationTypeId = NOTIFICATION_TYPE.EMAIL.ToString(),
Template = Common.Model.Enum.NotifyTemplate.KYC_VERIFICATION_EMAIL,
Recipients = new List<RecipientViewModel>()
{
new RecipientViewModel() { Address = res.Extra, NotificationContent = new NotificationDTO() }
},
Language = Convert.ToString(CallContext.GetData(Constants.Language))
};
Task.Run(() => NotifierV2.SendNotification(emailNotificationRequest, NOTIFICATION_TYPE.EMAIL));
//Task.Run(() => NotifierV2.SendNotification(emailNotificationRequest, NOTIFICATION_TYPE.EMAIL));
}
Log.Debug("CustomerInfoAgree.Agree | DB RESPONSE : " + JsonConvert.SerializeObject(res));
}
else if (agreeYn.Equals("N"))
{
res = _requestServices.CustomerInfoAgree(username, "agree-manual");
//else if (agreeYn.Equals("N"))
//{
// res = _requestServices.CustomerInfoAgree(username, "agree-manual");
Log.Debug("CustomerInfoAgree.Manual | DB RESPONSE : " + JsonConvert.SerializeObject(res));
}
// Log.Debug("CustomerInfoAgree.Manual | DB RESPONSE : " + JsonConvert.SerializeObject(res));
//}
}

4
Business/TPApi/NotifierV2.cs

@ -54,14 +54,14 @@ namespace Business
public APIJsonResponse SMSTPApi(SMSRequestModel model)
{
//Log.Debug("Calculate | Calling third party api to fetch the ex-rate details " + JsonConvert.SerializeObject(model));
using (var client = RestApiClient.CallJMEThirdParty())
using (var client = RestApiClient.GetThirdPartyClient())
{
APIJsonResponse jsonResponse = new APIJsonResponse();
var obj = JsonConvert.SerializeObject(model);
var jbdContent = new StringContent(obj.ToString(), Encoding.UTF8, "application/json");
try
{
var URL = "api/v1/TP/SMSApi";
var URL = "TP/SMSApi";
HttpResponseMessage resp = client.PostAsync(URL, jbdContent).Result;
string resultData = resp.Content.ReadAsStringAsync().Result;

2
Common/Model/UserDetails.cs

@ -9,7 +9,7 @@ namespace Common.Model
public class UserDetails
{
public string FullName { get; set; }
public int CustomerId { get; set; }
public string CustomerId { get; set; }
public string MembershipId { get; set; }
public string FirstName { get; set; }
public string MiddleName { get; set; }

15
Common/RestApiClient.cs

@ -14,11 +14,10 @@ namespace Common
//string authHeader = ConfigurationManager.AppSettings["ApiUser"].ToString() + ":" +ConfigurationManager.AppSettings["ApiPwd"].ToString();
//var plainTextBytes = Encoding.UTF8.GetBytes(authHeader);
//string encodedAuthHeader = Convert.ToBase64String(plainTextBytes);
string thirdPartyUrl = ConfigurationManager.AppSettings["ThirdParty_Url"].ToString();
string thirdPartyUrl = ConfigurationManager.AppSettings["ThirdParty_Base_Url"].ToString();
var httpClient = new HttpClient();
httpClient.BaseAddress = new Uri(thirdPartyUrl);
httpClient.DefaultRequestHeaders.Add("HeaderToken", ConfigurationManager.AppSettings["ThirdParty_HeaderToken"].ToString());
httpClient.DefaultRequestHeaders.Add("Authorization", ConfigurationManager.AppSettings["ThirdParty_Authorization"].ToString());
httpClient.DefaultRequestHeaders.Add("apiAccessKey", ConfigurationManager.AppSettings["apiAccessKey"].ToString());
httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
httpClient.Timeout = new TimeSpan(0, 0, timeOut);
return httpClient;
@ -36,15 +35,5 @@ namespace Common
return httpClient;
}
public static HttpClient CallJMEThirdParty()
{
string thirdPartyUrl = ConfigurationManager.AppSettings["JMECoreAPIURL"].ToString();
var httpClient = new HttpClient();
httpClient.BaseAddress = new Uri(thirdPartyUrl);
httpClient.DefaultRequestHeaders.Add("apiAccessKey", ConfigurationManager.AppSettings["JMECoreAPI_HeaderToken"].ToString());
httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
httpClient.Timeout = new TimeSpan(0, 0, timeOut);
return httpClient;
}
}
}

1
JsonRx/Api/CustomerController.cs

@ -120,6 +120,7 @@ namespace JsonRx.Api
Validate(newUserRegister);
if (ModelState.IsValid)
{
newUserRegister.FullName= newUserRegister.FullName.ToTitleCase(TitleCase.All);
var custRegisterResponse = _requestServices.NewUserRegister(newUserRegister);

40
JsonRx/Helper/Util.cs

@ -245,4 +245,44 @@ namespace JsonRx.Helper
}
}
public static class StringHelper
{
private static CultureInfo ci = new CultureInfo("en-US");
public static string ToTitleCase(this string str)
{
str = str.ToLower();
var strArray = str.Split(' ');
if (strArray.Length > 1)
{
strArray[0] = ci.TextInfo.ToTitleCase(strArray[0]);
return string.Join(" ", strArray);
}
return ci.TextInfo.ToTitleCase(str);
}
public static string ToTitleCase(this string str, TitleCase tcase)
{
str = str.ToLower();
switch (tcase)
{
case TitleCase.First:
var strArray = str.Split(' ');
if (strArray.Length > 1)
{
strArray[0] = ci.TextInfo.ToTitleCase(strArray[0]);
return string.Join(" ", strArray);
}
break;
case TitleCase.All:
return ci.TextInfo.ToTitleCase(str);
default:
break;
}
return ci.TextInfo.ToTitleCase(str);
}
}
public enum TitleCase
{
First,
All
}
}

89
Repository/Mobile/MobileServicesRepo.cs

@ -99,42 +99,16 @@ namespace Repository.Mobile
var _dbRes = _dao.ParseDbResult(sql);
Log.Debug("RequestOTP | DB RESPONSE : " + JsonConvert.SerializeObject(_dbRes));
string enumString = string.Empty;
if (_dbRes.ResponseCode.Equals("100"))
{
enumString = RESPONSE_MSG.REQUEST_OTP_SUCCESS_1.ToString();
//_dbRes.ResponseCode = "0";
}
else if (_dbRes.ResponseCode.Equals("103"))
{
enumString = RESPONSE_MSG.REQUEST_OTP_SUCCESS_2.ToString();
//_dbRes.ResponseCode = "0";
}
else if (_dbRes.ResponseCode.Equals("1"))
{
enumString = RESPONSE_MSG.REQUEST_OTP_FAIL_1.ToString();
}
else if (_dbRes.ResponseCode.Equals("2"))
{
enumString = RESPONSE_MSG.REQUEST_OTP_FAIL_2.ToString();
}
else if (_dbRes.ResponseCode.Equals("3"))
{
enumString = RESPONSE_MSG.REQUEST_OTP_FAIL_3.ToString();
}
else if (_dbRes.ResponseCode.Equals("4"))
{
enumString = RESPONSE_MSG.REQUEST_OTP_FAIL_4.ToString();
}
else if (_dbRes.ResponseCode.Equals("5"))
{
enumString = RESPONSE_MSG.REQUEST_OTP_FAIL_5.ToString();
}
var map = Utilities.GetLanguageMapping(enumString, lang);
List<string> successCode = new List<string> { "0", "100", "103" };
return new JsonRxResponse { ErrorCode = successCode.Contains(_dbRes.ResponseCode) ? "0" : "1", Msg = map.Message, Extra = _dbRes.Id, Extra2 = _dbRes.ResponseCode };
return new JsonRxResponse { ErrorCode = successCode.Contains(_dbRes.ResponseCode) ? "0" : "1",
Msg = _dbRes.Msg,
Extra = _dbRes.Id,
Extra2 = _dbRes.ResponseCode,
Extra3 = _dbRes.Extra };
//return new JsonRxResponse
//{
@ -462,6 +436,10 @@ namespace Repository.Mobile
sql += ", @mobile = " + _dao.FilterString(kyc.mobile);
sql += ", @additionalAddress = N" + _dao.FilterString(kyc.additionalAddress);
sql += ", @idType = " + _dao.FilterString(kyc.idType);
sql += ", @idTypeNumber = " + _dao.FilterString(kyc.idNumber);
sql += ", @idStartDate = " + _dao.FilterString(kyc.idStartDate);
sql += ", @idEndDate = " + _dao.FilterString(kyc.idExpiryDate);
sql += ", @idIssuingCountry = " + _dao.FilterString(kyc.idIssuingCountry);
sql += ", @additionalIdType = " + _dao.FilterString(kyc.additionalIdType);
//IMAGES
sql += ", @idFront = " + _dao.FilterString(kyc.idFront);
@ -483,28 +461,9 @@ namespace Repository.Mobile
jsonRx.Extra = dataTable.Extra;
//var res = _dao.ParseDbResult(sql);
string enumString = string.Empty;
if (dataTable.ResponseCode.Equals("0"))
{
enumString = RESPONSE_MSG.REGISTER_KYC_SUCCESS.ToString();
}
else if (dataTable.ResponseCode.Equals("1"))
{
enumString = RESPONSE_MSG.REGISTER_KYC_FAIL_1.ToString();
}
else if (dataTable.ResponseCode.Equals("2"))
{
enumString = RESPONSE_MSG.REGISTER_KYC_FAIL_2.ToString();
}
else if (dataTable.ResponseCode.Equals("3"))
{
enumString = RESPONSE_MSG.REGISTER_KYC_FAIL_3.ToString();
}
var map = Utilities.GetLanguageMapping(enumString, lang);
return new JsonRxResponse { ErrorCode = dataTable.ResponseCode.Equals("0") ? "0" : "1", Msg = map.Message.Replace("@Extra", dataTable.Extra) };
//return new JsonRxResponse { ErrorCode = dataTable.ResponseCode, Msg = dataTable.Msg };
return new JsonRxResponse { ErrorCode = dataTable.ResponseCode, Msg = dataTable.Msg };
//return jsonRx;
}
@ -1345,6 +1304,7 @@ namespace Repository.Mobile
sql += ", @mobile = " + _dao.FilterString(newUserRegister.MobileNumber);
sql += ", @postalCode = " + _dao.FilterString(newUserRegister.PostalCode);
sql += ", @address1 = " + _dao.FilterString(newUserRegister.Address1);
sql += ", @address2 = " + _dao.FilterString(newUserRegister.Address2);
sql += ", @city = " + _dao.FilterString(newUserRegister.City);
sql += ", @gender = " + _dao.FilterString(newUserRegister.Gender);
@ -1405,9 +1365,22 @@ namespace Repository.Mobile
{
var sql = "EXEC GetUserInfo @flag='basic-reg' ";
sql += ", @emailId = " + _dao.FilterString(email);
UserDetails userDetails = _dao.ParseDbResult<UserDetails>(sql);
var row = _dao.ExecuteDataRow(sql);
UserDetails userDetails = new UserDetails();
if (row!=null)
{
userDetails.FullName = row["fullName"].ToString();
userDetails.CustomerId = row["customerid"].ToString();
userDetails.MembershipId = row["membershipid"].ToString();
userDetails.FirstName = row["Firstname"].ToString();
userDetails.Mobile = row["mobile"].ToString();
userDetails.MiddleName = row["middleName"].ToString();
userDetails.LastName = row["Lastname1"].ToString();
userDetails.Email = row["email"].ToString();
userDetails.Address = row["address"].ToString();
userDetails.RegisteredDate = DateTime.Parse( row["createdDate"].ToString());
}
return userDetails;
}
@ -2865,7 +2838,8 @@ namespace Repository.Mobile
select new IdType
{
id = vit.Field<int>("id").ToString(),
text = vit.Field<string>("text")
text = vit.Field<string>("text"),
isBackRequired = Convert.ToBoolean(vit.Field<int>("isBackRequired"))
};
kycData.IdType = vitr.ToList();
@ -2905,6 +2879,7 @@ namespace Repository.Mobile
idIssuingCountry = Convert.ToString(dt["idIssueCountry"]),
idStartDate = Convert.ToString(dt["passportIssueDate"]),
idExpiryDate = Convert.ToString(dt["passportExpiryDate"]),
idNumber = Convert.ToString(dt["passportNumber"])
};
if (type.ToLower().Equals("kycv3-existing"))

Loading…
Cancel
Save