Browse Source

#34182 changes for registration tracker

feature/Redmine-17825-Email_Template
Leeza Baidar 3 weeks ago
parent
commit
da4114ecd0
  1. 2
      Business/Mobile/IMobileServices.cs
  2. 58
      Business/Mobile/MobileServices.cs
  3. 2
      Common/Common.csproj
  4. 2
      Common/Model/CustomerRegister/NewUserRegisterModel.cs
  5. 26
      Common/Model/CustomerRegister/TempUserRegisterModel.cs
  6. 75
      JsonRx/Api/CustomerController.cs
  7. 4
      Repository/Mobile/IMobileServicesRepo.cs
  8. 35
      Repository/Mobile/MobileServicesRepo.cs

2
Business/Mobile/IMobileServices.cs

@ -96,6 +96,8 @@ namespace Business.Mobile
JsonRxResponse GetFieldsByProduct(MappingType type, string customer, string receiverId, string payoutPartner);
JsonRxResponse ValidateReferralCode(string referralCode);
JsonRxResponse TempUserRegister(TempUserRegisterModel tempUserRegister);
//JsonRxResponse QueryAddress(string postCode);
}
}

58
Business/Mobile/MobileServices.cs

@ -3117,5 +3117,63 @@ namespace Business.Mobile
return jsonRx;
}
}
public JsonRxResponse TempUserRegister(TempUserRegisterModel tempUserRegister)
{
var lang = Convert.ToString(CallContext.GetData(Constants.Language));
JsonRxResponse res = new JsonRxResponse();
try
{
string fullName = tempUserRegister.FullName;
string mobileNo = tempUserRegister.MobileNumber;
string enumString = string.Empty;
string regStep = tempUserRegister.RegStep;
if (regStep == "1")
{
var ds = _requestServices.GetCustId();
string custId = "";
if (ds.Tables[0].Rows.Count > 0)
{
custId = ds.Tables[0].Rows[0]["tempCustId"]?.ToString();
}
int newCustId = 1;
tempUserRegister.tempCustId = newCustId.ToString();
if (!string.IsNullOrEmpty(custId))
{
newCustId = int.Parse(custId) + 1;
tempUserRegister.tempCustId = newCustId.ToString();
}
}
else if (regStep == "2")
{
if (!tempUserRegister.Email.IsValidEmail())
{
enumString = RESPONSE_MSG.NEW_USER_REGISTER_FAIL_4.ToString(); ;
var map = Utilities.GetLanguageMapping(enumString, lang);
res.SetResponse("100", map.Message);
return res;
}
}
tempUserRegister.MobileNumber = tempUserRegister.MobileNumber.getUKFormattedNumber();
res = _requestServices.TempUserRegister(tempUserRegister);
Log.Debug("TempUserRegister | completed with db response. " + "ErrorCode: " + res.ErrorCode + " Msg: " + res.Msg);
return res;
}
catch (Exception ex)
{
Log.Error("Something Went Wrong, Please Try Again!!", ex);
res.SetResponse("1", "Error occurred while registering the customer.");
return res;
}
}
}
}

2
Common/Common.csproj

@ -97,6 +97,7 @@
<Compile Include="Model\CustomerRegister\NewUserRegisterModel.cs" />
<Compile Include="Model\CustomerRegister\OldUserAccessRequestModel.cs" />
<Compile Include="Model\CustomerRegister\OldUserRegisterModel.cs" />
<Compile Include="Model\CustomerRegister\TempUserRegisterModel.cs" />
<Compile Include="Model\Customer\LoadReceiverAccount.cs" />
<Compile Include="Model\DateFilterParams.cs" />
<Compile Include="Model\DepositSlip\DepositSlip.cs" />
@ -107,6 +108,7 @@
<Compile Include="Model\ExRateResponse.cs" />
<Compile Include="Model\External\CallbackParam.cs" />
<Compile Include="Model\External\CallbackTpResponse.cs" />
<Compile Include="Model\FireApi\AccessToken.cs" />
<Compile Include="Model\GetDetailForDllTxn.cs" />
<Compile Include="Model\Inbound\InboundBanks.cs" />
<Compile Include="Model\Inbound\TranHistory.cs" />

2
Common/Model/CustomerRegister/NewUserRegisterModel.cs

@ -38,7 +38,7 @@ namespace Common.Model.CustomerRegister
public string Nationality { get; set; }
[Required]
public string Gender { get; set; }
public string TempCustId { get; set; }
}
}

26
Common/Model/CustomerRegister/TempUserRegisterModel.cs

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Common.Model.CustomerRegister
{
public class TempUserRegisterModel
{
[Required(ErrorMessage = "Full Name is required.")]
public string FullName { get; set; }
[Required]
public string MobileNumber { get; set; }
public string Email { get; set; }
public string AppVersion { get; set; }
public string phoneBrand { get; set; }
public string phoneOs { get; set; }
public string fcmId { get; set; }
public string osVersion { get; set; }
public string RegStep { get; set; }
public string tempCustId { get; set; }
public string flag { get; set; }
}
}

75
JsonRx/Api/CustomerController.cs

@ -120,14 +120,14 @@ namespace JsonRx.Api
Validate(newUserRegister);
if (ModelState.IsValid)
{
// newUserRegister.phoneOs = Util.GetDeviceType(Request);
newUserRegister.FullName= newUserRegister.FullName.ToTitleCase(TitleCase.All);
// newUserRegister.phoneOs = Util.GetDeviceType(Request);
newUserRegister.FullName = newUserRegister.FullName.ToTitleCase(TitleCase.All);
var custRegisterResponse = _requestServices.NewUserRegister(newUserRegister);
Log.Debug("NewUserRegister | RESPONSE : " + JsonConvert.SerializeObject(custRegisterResponse));
return Ok(custRegisterResponse);
}
return ModelValidationError(ModelState,"100");
return ModelValidationError(ModelState, "100");
}
/// <summary>
@ -162,14 +162,14 @@ namespace JsonRx.Api
{
DepositSlip request = new DepositSlip();
request.UserId= HttpContext.Current.Request["userId"];
request.UserId = HttpContext.Current.Request["userId"];
request.Amount = HttpContext.Current.Request["Amount"];
request.Remarks = HttpContext.Current.Request["Remarks"];
LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = Guid.NewGuid();
LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "DepositSlip";
LogicalThreadContext.Properties[LoggerProperty.CREATEDBY] = request.UserId;
Log.Debug("DepositSlip | " + JsonConvert.SerializeObject(request));
var depositResponse = _requestServices.DepositSlip(request);
@ -206,7 +206,7 @@ namespace JsonRx.Api
LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = Guid.NewGuid();
LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "RegisterKyc";
LogicalThreadContext.Properties[LoggerProperty.CREATEDBY] = HttpContext.Current.Request["userId"];
LogicalThreadContext.Properties[LoggerProperty.IPADDRESS] = HttpContext.Current.Request["TrustDocId"] != null ? HttpContext.Current.Request["TrustDocId"] : "";
LogicalThreadContext.Properties[LoggerProperty.IPADDRESS] = HttpContext.Current.Request["TrustDocId"] != null ? HttpContext.Current.Request["TrustDocId"] : "";
//Log.Debug("RegisterKyc | REQUEST : " + HttpContext.Current.Request["userId"]);
//var fcmid = Util.getJWTTokenClaim(Request.GetJWTToken(), "ClientFcmId");
@ -378,14 +378,14 @@ namespace JsonRx.Api
/// </summary>
/// <param name="modelState"></param>
/// <returns></returns>
protected IHttpActionResult ModelValidationError(ModelStateDictionary modelState, string error="")
protected IHttpActionResult ModelValidationError(ModelStateDictionary modelState, string error = "")
{
var modelErrors = modelState.Select(x => x.Value.Errors)
.Where(y => y.Count > 0)
.First()[0].ErrorMessage;
JsonRxResponse jsonRx = new JsonRxResponse()
{
ErrorCode = error??"1",
ErrorCode = error ?? "1",
Msg = string.IsNullOrEmpty(modelErrors) ? "It seems like incorrect Json input(s)." : modelErrors,
Data = ""
};
@ -412,5 +412,64 @@ namespace JsonRx.Api
}
return ModelValidationError(ModelState);
}
/// <summary>
/// </summary>
/// <param name="registerParam"></param>
/// <returns></returns>
[HttpPost]
[ApplicationLevelAuthentication]
[Route("mobile/tempUserRegister")]
public IHttpActionResult TempUserRegister(TempUserRegisterModel tempUserRegister)
{
var processid = Guid.NewGuid().ToString();
LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = processid;
LogicalThreadContext.Properties[LoggerProperty.CREATEDBY] = tempUserRegister.Email;
LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "TempUserRegister";
Log.Debug("TempUserRegister | REQUEST : " + JsonConvert.SerializeObject(tempUserRegister));
JsonRxResponse res = new JsonRxResponse();
if (string.IsNullOrEmpty(tempUserRegister.MobileNumber))
{
res.SetResponse("100", "Mobile Number is required!");
return Ok(res);
}
if (string.IsNullOrEmpty(tempUserRegister.Email))
{
tempUserRegister.RegStep = "1";
tempUserRegister.flag = "sign-up-temp-cust";
}
else
{
tempUserRegister.RegStep = "2";
tempUserRegister.flag = "update-temp-cust";
}
if (tempUserRegister.RegStep == "2")
{
if (string.IsNullOrEmpty(tempUserRegister.Email))
{
res.SetResponse("100", "Email is required!");
return Ok(res);
}
}
Validate(tempUserRegister);
if (ModelState.IsValid)
{
tempUserRegister.FullName = tempUserRegister.FullName.ToTitleCase(TitleCase.All);
var custRegisterResponse = _requestServices.TempUserRegister(tempUserRegister);
if (custRegisterResponse.ErrorCode == "0")
{
tempUserRegister.tempCustId = custRegisterResponse.Id;
}
Log.Debug("TempUserRegister | RESPONSE : " + JsonConvert.SerializeObject(custRegisterResponse));
return Ok(custRegisterResponse);
}
return ModelValidationError(ModelState, "100");
}
}
}

4
Repository/Mobile/IMobileServicesRepo.cs

@ -104,5 +104,9 @@ namespace Repository.Mobile
//ataSet StaticQueryAddress();
List<KeyValues> GetPaymentMethod(string receiverId, string pcountryid);
JsonRxResponse TempUserRegister(TempUserRegisterModel tempUserRegister);
DataSet GetCustId();
}
}

35
Repository/Mobile/MobileServicesRepo.cs

@ -1340,8 +1340,9 @@ namespace Repository.Mobile
sql += ", @address1 = " + _dao.FilterString(newUserRegister.Address1);
sql += ", @address2 = " + _dao.FilterString(newUserRegister.Address2);
sql += ", @city = " + _dao.FilterString(newUserRegister.City);
sql += ", @gender = " + _dao.FilterString(newUserRegister.Gender);
sql += ", @gender = " + _dao.FilterString(newUserRegister.Gender);
sql += ", @tempCustId = " + _dao.FilterString(newUserRegister.TempCustId);
if (!string.IsNullOrEmpty(newUserRegister.FullName))
{
var str = newUserRegister.FullName.Trim().Split(' ');
@ -3244,5 +3245,35 @@ namespace Repository.Mobile
return new JsonRxResponse { ErrorCode = res.ResponseCode.Equals("0") ? "0" : "1", Msg = map.Message, Id = res.Id, Extra = res.Extra };
}
public JsonRxResponse TempUserRegister(TempUserRegisterModel tempUserRegister)
{
var lang = Convert.ToString(CallContext.GetData(Constants.Language));
var sql = "EXEC JsonRx_Proc_UserRegistration_V2";
sql += " @flag = " + _dao.FilterString(tempUserRegister.flag);
sql += ", @fullName = " + _dao.FilterString(tempUserRegister.FullName);
sql += ", @mobile = " + _dao.FilterString(tempUserRegister.MobileNumber);
sql += ", @username = " + _dao.FilterString(tempUserRegister.Email);
sql += ", @appVersion = " + _dao.FilterString(tempUserRegister.AppVersion);
sql += ", @phoneBrand = " + _dao.FilterString(tempUserRegister.phoneBrand);
sql += ", @phoneOs = " + _dao.FilterString(tempUserRegister.phoneOs);
sql += ", @fcmId = " + _dao.FilterString(tempUserRegister.fcmId);
sql += ", @osVersion = " + _dao.FilterString(tempUserRegister.osVersion);
sql += ", @tempCustId = " + _dao.FilterString(tempUserRegister.tempCustId);
Log.DebugFormat("TempUserRegister | SQL : {0}", sql);
var res = _dao.ParseDbResult(sql);
return new JsonRxResponse { ErrorCode = res.ResponseCode.Equals("0") ? "0" : "1", Msg = res.Msg, Id = res.Id, Extra = res.Extra };
}
public DataSet GetCustId()
{
var sql = "EXEC JsonRx_Proc_UserRegistration_V2 @flag='get-id'";
Log.DebugFormat("GetCustId | SQL : {0} | {1}", sql);
return _dao.ExecuteDataset(sql);
}
}
}
Loading…
Cancel
Save