|
|
@ -2030,9 +2030,10 @@ namespace Business.Mobile |
|
|
|
|
|
|
|
if (res.ErrorCode == "0") |
|
|
|
{ |
|
|
|
bool emailSent = false; |
|
|
|
bool smsSent = false; |
|
|
|
try |
|
|
|
{ |
|
|
|
|
|
|
|
List<Notify.Mapping> bodyMappings = new List<Notify.Mapping>(); |
|
|
|
bodyMappings.Add(new Notify.Mapping() { SValue = "CustomerName", SText = res.Extra2 }); |
|
|
|
bodyMappings.Add(new Notify.Mapping() { SValue = "EMAIL_ID", SText = pwdReset.Username }); |
|
|
@ -2059,28 +2060,53 @@ namespace Business.Mobile |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
Log.Debug("SendNotification.EMAIL | REQUEST : " + JsonConvert.SerializeObject(request)); |
|
|
|
|
|
|
|
res = NotifierV2.SendNotification(request, NOTIFICATION_TYPE.EMAIL); |
|
|
|
|
|
|
|
Log.Debug("SendNotification.EMAIL | RESPONSE : " + JsonConvert.SerializeObject(res)); |
|
|
|
emailSent = true; |
|
|
|
|
|
|
|
|
|
|
|
string ProcessId = Guid.NewGuid().ToString().Replace("-", "") + ":sendSms"; |
|
|
|
var mobileNo = getSenderFormattedNumber(res.Extra3); |
|
|
|
SendSMSApiService _sendAPI = new SendSMSApiService(); |
|
|
|
|
|
|
|
StringBuilder s = new StringBuilder(); |
|
|
|
s.AppendLine($"Dear { pwdReset.Username}"); |
|
|
|
s.AppendLine($"We received your password reset request and your new credentials are"); |
|
|
|
s.AppendLine($"Login ID: { pwdReset.Username}"); |
|
|
|
s.AppendLine($"Password: { pwdReset.RandomPassword}"); |
|
|
|
s.AppendLine("Regards, IME London"); |
|
|
|
|
|
|
|
SMSRequestModel _req = new SMSRequestModel |
|
|
|
{ |
|
|
|
ProviderId = "onewaysms", |
|
|
|
MobileNumber = pwdReset.mobileNo, |
|
|
|
SMSBody = Common.Model.Enum.NotifyTemplate.RESET_PASSWORD_EMAIL.ToString(), |
|
|
|
SMSBody = s.ToString(), |
|
|
|
ProcessId = ProcessId.Substring(ProcessId.Length - 40, 40), |
|
|
|
RequestedBy = pwdReset.Username, |
|
|
|
UserName = pwdReset.Username, |
|
|
|
method = "send", |
|
|
|
ControlNo = "", // GetControlNo()
|
|
|
|
}; |
|
|
|
Log.Debug("SendNotification.SMS | REQUEST : " + JsonConvert.SerializeObject(_req)); |
|
|
|
|
|
|
|
APIJsonResponse _resp = _sendAPI.SMSTPApi(_req); |
|
|
|
res = NotifierV2.SendNotification(request, NOTIFICATION_TYPE.EMAIL); |
|
|
|
|
|
|
|
Log.Debug("SendNotification.SMS | RESPONSE : " + JsonConvert.SerializeObject(_resp)); |
|
|
|
smsSent = true; |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
|
|
|
|
Log.Error("ResetPassword.SendNotification", ex); |
|
|
|
} |
|
|
|
|
|
|
|
if (emailSent || smsSent) |
|
|
|
{ |
|
|
|
res.ErrorCode = "0"; |
|
|
|
res.SetResponse("0", "Reset password email/sms has been sent."); |
|
|
|
return res; |
|
|
|
} |
|
|
|
var map = Utilities.GetLanguageMapping(RESPONSE_MSG.SEND_EMAIL_FOR_RESETPASSWORD_SUCCESS.ToString(), lang); |
|
|
|
return new JsonRxResponse { ErrorCode = "0", Msg = map.Message }; |
|
|
|
// return res;
|
|
|
|