@ -155,7 +155,7 @@ namespace Business.Mobile
{
bool emailSent = false ;
bool smsSent = false ;
if ( requestOTPModel . userId . IsValidEmail ( ) )
if ( requestOTPModel . userId . IsValidEmail ( ) & ( jsonRx . Extra3 . Equals ( "0" ) | jsonRx . Extra3 . Equals ( "100" ) ) )
{
if ( ! string . IsNullOrEmpty ( jsonRx . ErrorCode ) & & jsonRx . ErrorCode . Equals ( "0" ) )
@ -201,7 +201,6 @@ namespace Business.Mobile
try
{
string ProcessId = Guid . NewGuid ( ) . ToString ( ) . Replace ( "-" , "" ) + ":sendSms" ;
string mobileNum = jsonRx . Extra2 ;
var mobNum = getSenderFormattedNumber ( mobileNum ) ;
@ -214,10 +213,10 @@ namespace Business.Mobile
SMSRequestModel _req = new SMSRequestModel
{
ProviderId = "onewaysms " ,
ProviderId = "ProcessId " ,
MobileNumber = mobileNum ,
SMSBody = s . ToString ( ) ,
ProcessId = ProcessId . Substring ( ProcessId . Length - 4 0 , 4 0 ) ,
ProcessId = requestOTPModel . ProcessId ,
RequestedBy = requestOTPModel . userId ,
UserName = requestOTPModel . userId ,
method = "send" ,
@ -248,9 +247,15 @@ namespace Business.Mobile
}
else
{
if ( jsonRx . Extra3 ! = null & jsonRx . Extra3 . Equals ( "103" ) )
{
return new JsonRxResponse { ErrorCode = "0" , Msg = "OTP Already Sent" } ;
}
jsonRx . ErrorCode = "1" ;
var map = Utilities . GetLanguageMapping ( RESPONSE_MSG . OLD_USER_REGISTER_FAIL_11 . ToString ( ) , lang ) ;
return new JsonRxResponse { ErrorCode = jsonRx . ErrorCode , Msg = map . Message } ;
// var map = Utilities.GetLanguageMapping(RESPONSE_MSG.OLD_USER_REGISTER_FAIL_11.ToString(), lang);
return new JsonRxResponse { ErrorCode = jsonRx . ErrorCode , Msg = jsonRx . Msg } ;
}
}
@ -265,7 +270,7 @@ namespace Business.Mobile
return jsonRx ;
}
}
private string getSenderFormattedNumber ( string number )
public string getSenderFormattedNumber ( string number )
{
string finalNo = number ;
if ( ! number . Contains ( "+44" ) )
@ -297,7 +302,10 @@ namespace Business.Mobile
}
}
if ( ! finalNo . Substring ( 0 , 1 ) . Contains ( "+" ) )
{
finalNo = $"+{finalNo}" ;
}
return finalNo ;
}
@ -696,7 +704,7 @@ namespace Business.Mobile
// }
//}
Log . Debug ( $"RegisterKYC | httpRequest : {httpRequest.Params}" ) ;
//Log.Debug( $"RegisterKYC | httpRequest : {httpRequest.Params}");
Log . Debug ( $"RegisterKYC | REQUEST : { JsonConvert.SerializeObject(custKyc)} | Files: { httpRequest.Files.Count}" ) ;
@ -1014,7 +1022,7 @@ namespace Business.Mobile
// kyc.mobile = jsonRxMobile.Extra;
//}
if ( kyc . type . Equals ( "0" ) )
if ( kyc . type . Equals ( "0" ) )
{
if ( string . IsNullOrEmpty ( kyc . otherOccupation ) & & string . IsNullOrEmpty ( kyc . occupation ) )
{
@ -1035,6 +1043,25 @@ namespace Business.Mobile
return jsonRx ;
}
}
if ( string . IsNullOrEmpty ( kyc . idExpiryDate ) )
{
jsonRx . SetResponse ( "1" , "IdExpiryDate is required" ) ;
return jsonRx ;
}
if ( string . IsNullOrEmpty ( kyc . idStartDate ) )
{
jsonRx . SetResponse ( "1" , "Idissue Date is required" ) ;
return jsonRx ;
}
if ( string . IsNullOrEmpty ( kyc . idIssuingCountry ) )
{
jsonRx . SetResponse ( "1" , "idIssuingCountry is required" ) ;
return jsonRx ;
}
}
@ -1046,24 +1073,7 @@ namespace Business.Mobile
//}
//if (string.IsNullOrEmpty(kyc.idExpiryDate))
//{
// jsonRx.SetResponse("1", "IdExpiryDate is required");
// return jsonRx;
//}
//if (string.IsNullOrEmpty(kyc.idStartDate))
//{
// jsonRx.SetResponse("1", "Idissue Date is required");
// return jsonRx;
//}
//if (string.IsNullOrEmpty(kyc.idIssuingCountry))
//{
// jsonRx.SetResponse("1", "idIssuingCountry is required");
// return jsonRx;
//}
//if (string.IsNullOrEmpty(kyc.additionalAddress))
//{
@ -1702,28 +1712,28 @@ namespace Business.Mobile
_resp . SetResponse ( "1" , "Password can not be empty!" ) ;
return _resp ;
}
if ( confirmpwd . Length < 8 )
if ( confirmpwd . Length < 6 )
{
_resp . SetResponse ( "1" , "Password must be of atleast 8 digits!" ) ;
_resp . SetResponse ( "1" , "Password must be of atleast 6 digits!" ) ;
return _resp ;
}
if ( ! Regex . Match ( confirmpwd , @"\d+" ) . Success )
{
_resp . SetResponse ( "1" , "Password must contain 1 number!" ) ;
return _resp ;
}
//if (!Regex.Match(confirmpwd, @"\d+").Success)
//{
// _resp.SetResponse("1", "Password must contain 1 number!");
// return _resp;
//}
if ( ! Regex . Match ( confirmpwd , @"[A-Z]" ) . Success )
{
_resp . SetResponse ( "1" , "Password must contain atleaset one capital letter!" ) ;
return _resp ;
}
if ( ! Regex . Match ( confirmpwd , @"[!@#$%&*_+\-]" ) . Success )
{
_resp . SetResponse ( "1" , "Password must contain atleaset one special character!" ) ;
return _resp ;
}
//if (!Regex.Match(confirmpwd, @"[A-Z]").Success)
//{
// _resp.SetResponse("1", "Password must contain atleaset one capital letter!");
// return _resp;
//}
//if (!Regex.Match(confirmpwd, @"[!@#$%&*_+\-]").Success)
//{
// _resp.SetResponse("1", "Password must contain atleaset one special character!");
// return _resp;
//}
return _resp ;
}
@ -1775,6 +1785,8 @@ namespace Business.Mobile
return verifyPwdResp ;
}
newUserRegister . MobileNumber = newUserRegister . MobileNumber . getUKFormattedNumber ( ) ;
res = _requestServices . NewUserRegister ( newUserRegister ) ;
Log . Debug ( "NewUserRegister | completed with db response. " + "ErrorCode: " + res . ErrorCode + " Msg: " + res . Msg ) ;
@ -2015,6 +2027,15 @@ namespace Business.Mobile
return res ;
}
DateTime dateTime ;
if ( DateTime . TryParseExact ( pwdReset . Dob , "dd/MM/yyyy" , System . Globalization . CultureInfo . InvariantCulture , System . Globalization . DateTimeStyles . None , out dateTime ) )
{
pwdReset . Dob = dateTime . ToString ( "yyyy-MM-dd" ) ;
}
if ( ! pwdReset . Username . IsValidEmail ( ) )
{
var map = Utilities . GetLanguageMapping ( RESPONSE_MSG . INVALID_EMAIL_FOR_RESETPASSWORD . ToString ( ) , lang ) ;
@ -2022,7 +2043,9 @@ namespace Business.Mobile
return res ;
} ;
var randomPassword = PasswordGenerator . GenerateRandomPassword ( ) ;
// var randomPassword = PasswordGenerator.GenerateRandomPassword();
var randomPassword = Utilities . GenerateRandomPin ( ) ;
pwdReset . RandomPassword = randomPassword ;
res = _requestServices . ResetPassword ( pwdReset ) ;
@ -2030,6 +2053,8 @@ namespace Business.Mobile
if ( res . ErrorCode = = "0" )
{
bool emailSent = false ;
bool smsSent = false ;
try
{
@ -2059,28 +2084,55 @@ namespace Business.Mobile
}
} ;
Log . Debug ( "SendNotification.EMAIL | REQUEST : " + JsonConvert . SerializeObject ( request ) ) ;
var resEmail = NotifierV2 . SendNotification ( request , NOTIFICATION_TYPE . EMAIL ) ;
Log . Debug ( "SendNotification.EMAIL | RESPONSE : " + JsonConvert . SerializeObject ( resEmail ) ) ;
emailSent = true ;
string ProcessId = Guid . NewGuid ( ) . ToString ( ) . Replace ( "-" , "" ) + ":sendSms" ;
SendSMSApiService _sendAPI = new SendSMSApiService ( ) ;
SMSRequestModel _req = new SMSRequestModel
var mobileNo = "" ;
if ( ! string . IsNullOrEmpty ( res . Extra3 ) )
{
ProviderId = "onewaysms" ,
MobileNumber = pwdReset . mobileNo ,
SMSBody = Common . Model . Enum . NotifyTemplate . RESET_PASSWORD_EMAIL . ToString ( ) ,
ProcessId = ProcessId . Substring ( ProcessId . Length - 4 0 , 4 0 ) ,
RequestedBy = pwdReset . Username ,
UserName = pwdReset . Username ,
method = "send" ,
ControlNo = "" , // GetControlNo()
} ;
APIJsonResponse _resp = _sendAPI . SMSTPApi ( _req ) ;
res = NotifierV2 . SendNotification ( request , NOTIFICATION_TYPE . EMAIL ) ;
mobileNo = getSenderFormattedNumber ( res . Extra3 ) ;
SendSMSApiService _sendAPI = new SendSMSApiService ( ) ;
StringBuilder s = new StringBuilder ( ) ;
s . AppendLine ( $"Dear { res.Extra2}" ) ;
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 = mobileNo ,
SMSBody = s . ToString ( ) ,
ProcessId = ProcessId . Substring ( ProcessId . Length - 4 0 , 4 0 ) ,
RequestedBy = pwdReset . Username ,
UserName = pwdReset . Username ,
method = "send" ,
ControlNo = "" , // GetControlNo()
} ;
Log . Debug ( "SendNotification.SMS | REQUEST : " + JsonConvert . SerializeObject ( _req ) ) ;
APIJsonResponse _resp = _sendAPI . SMSTPApi ( _req ) ;
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;
@ -2134,7 +2186,7 @@ namespace Business.Mobile
return jsonRx ;
}
jsonRx . ErrorCode = "0" ;
jsonRx . ErrorCode = "0" ;
jsonRx . Data = liWalletStmtResponse ;
@ -2353,11 +2405,11 @@ namespace Business.Mobile
var requiredList = props . Where ( x = > list . Any ( z = > x . Key . ToLower ( ) = = z . Field . ToLower ( ) ) )
. Where ( y = > string . IsNullOrEmpty ( y . Value ) ) . ToList ( ) ; // case when Field Value empty
var pLength = props . SingleOrDefault ( p = > p . Key . ToLower ( ) . Equals ( "mobile" ) ) . Value . Length ;
var rLength = list . SingleOrDefault ( p = > p . Field . ToLower ( ) . Equals ( "mobile" ) ) . MinLength ;
//var pLength = props.SingleOrDefault(p => p.Key.ToLower().Equals("mobile")).Value.Length;
//var rLength = list.SingleOrDefault(p => p.Field.ToLower().Equals("mobile")).MinLength;
if ( pLength < rLength )
requiredList . Add ( new KeyValuePair ( ) { Key = "mobile" } ) ;
//if (pLength < rLength)
// requiredList.Add(new KeyValuePair() { Key = "mobile" });
if ( requiredList . Count > 0 )
{