Browse Source

lastes code

Mobile-pdf
shakun 10 months ago
parent
commit
e5c836a812
  1. 7
      Business/Business.csproj
  2. 373
      Business/Mobile/MobileServices.cs
  3. 11
      Business/MobileV2/IMobileV2Business.cs
  4. 49
      Business/MobileV2/MobileV2Business.cs
  5. 68
      Business/SendMoney/SendMoneyBusiness.cs
  6. 6
      Business/TPApi/ThirdPartyAPI.cs
  7. 64
      Business/Utility/AesOperation.cs
  8. 3
      Common/APIJsonResponse.cs
  9. 12
      Common/Common.csproj
  10. 47
      Common/Helper/Utilities.cs
  11. 5
      Common/Model/CustomerRegister/NewUserRegisterModel.cs
  12. 9
      Common/Model/JsonRxResponse.cs
  13. 30
      Common/Model/MobileV2/CustomerProfileV2.cs
  14. 5
      Common/Model/Notification/SMSRequestModel.cs
  15. 4
      Common/Model/RequestOTP/RequestOTPModel.cs
  16. 8
      Common/Model/RewardFee.cs
  17. 3
      Common/Model/TPSendMoney/TpSendMoney.cs
  18. 5
      Common/Model/TranHistoryResponse.cs
  19. 2
      Common/Model/TransactionResponse.cs
  20. 23
      Common/Model/WalletStatementResponse.cs
  21. 2
      JsonRx/Api/AuthController.cs
  22. 6
      JsonRx/Api/MobileController.cs
  23. 59
      JsonRx/Api/SendMoneyController.cs
  24. 95
      JsonRx/ApiV3/MobileV3Controller.cs
  25. 17
      JsonRx/AuthFilter/TokenAuthenticationAttribute.cs
  26. 4006
      JsonRx/Config/ResponseMsg.json
  27. 14
      JsonRx/Helper/Util.cs
  28. 2
      JsonRx/JsonRx.csproj
  29. 17
      JsonRx/Web.config
  30. 140
      Repository/Mobile/MobileServicesRepo.cs
  31. 3
      Repository/MobileV2/IMobileV2Repo.cs
  32. 154
      Repository/MobileV2/MobileV2Repo.cs

7
Business/Business.csproj

@ -45,8 +45,7 @@
<Reference Include="Microsoft.IdentityModel.Tokens, Version=6.25.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.IdentityModel.Tokens.6.25.1\lib\net45\Microsoft.IdentityModel.Tokens.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
@ -71,6 +70,9 @@
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="TransactionProcessor">
<HintPath>..\..\TransactionProcessor\TransactionProcessor\bin\Debug\TransactionProcessor.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Addressy\LocateBusiness.cs" />
@ -123,6 +125,7 @@
<Compile Include="TPApi\ThirdPartyAPI.cs" />
<Compile Include="TrustDoc\ITrustDocBusiness.cs" />
<Compile Include="TrustDoc\TrustDocBusiness.cs" />
<Compile Include="Utility\AesOperation.cs" />
<Compile Include="Utility\IUtilityBusiness.cs" />
<Compile Include="Utility\UtilityBusiness.cs" />
</ItemGroup>

373
Business/Mobile/MobileServices.cs

@ -32,6 +32,7 @@ using Repository;
using System.Configuration;
using Business.TrustDoc;
using Business.Addressy;
using System.Text;
namespace Business.Mobile
{
@ -144,10 +145,9 @@ namespace Business.Mobile
{
var lang = Convert.ToString(CallContext.GetData(Constants.Language));
JsonRxResponse jsonRx = new JsonRxResponse();
try
{
requestOTPModel.OTP = Utilities.GenerateOTP();
requestOTPModel.OTP = Utilities.GenerateOTP(); //implement the logic to send OTP SMS in customers mobile.
jsonRx = _requestServices.RequestOTP(requestOTPModel);
Log.Debug("GenerateOTP | RESPONSE : " + JsonConvert.SerializeObject(jsonRx));
@ -155,8 +155,9 @@ 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"))
{
List<Notify.Mapping> bodyMappings = new List<Notify.Mapping>();
@ -173,71 +174,93 @@ namespace Business.Mobile
ProviderId = "REQUESTOTP_EMAIL",
Template = Common.Model.Enum.NotifyTemplate.OTP_EMAIL,
Recipients = new List<RecipientViewModel>()
{
new RecipientViewModel()
{
new RecipientViewModel()
{
NotificationContent = new NotificationDTO() {
Body = JsonConvert.SerializeObject(bodyMappings),
//Title will be set by mapping json
},
Address= requestOTPModel.userId,
DeviceType = requestOTPModel.DeviceType,
Body = JsonConvert.SerializeObject(bodyMappings),
//Title will be set by mapping json
},
Address= requestOTPModel.userId,
DeviceType = requestOTPModel.DeviceType,
} }
};
Log.Debug("SendNotification.EMAIL | REQUEST : " + JsonConvert.SerializeObject(request));
var jsonRx1 = NotifierV2.SendNotification(request, NOTIFICATION_TYPE.EMAIL);
Log.Debug("SendNotification.EMAIL | RESPONSE : " + JsonConvert.SerializeObject(jsonRx1));
emailSent = true;
}
catch (Exception emailException)
{
Log.Error("Error sending email", emailException);
}
}
try
{
string ProcessId = Guid.NewGuid().ToString().Replace("-", "") + ":sendSms";
SendSMSApiService _sendAPI = new SendSMSApiService();
string mobileNum = jsonRx.Extra2;
var mobNum = getSenderFormattedNumber(mobileNum);
SMSRequestModel _req = new SMSRequestModel
try
{
ProviderId = "onewaysms",
MobileNumber = mobNum, //jsonRx.Extra2,
SMSBody = Common.Model.Enum.NotifyTemplate.OTP_EMAIL,
ProcessId = ProcessId.Substring(ProcessId.Length - 40, 40),
RequestedBy = requestOTPModel.userId,
UserName = requestOTPModel.userId,
method = "send",
ControlNo = "", // GetControlNo()
};
string mobileNum = jsonRx.Extra2;
var mobNum = getSenderFormattedNumber(mobileNum);
SendSMSApiService _sendAPI = new SendSMSApiService();
StringBuilder s = new StringBuilder();
s.AppendLine($"Dear { jsonRx.Extra}");
s.AppendLine($"Your OTP code for Customer Registration is {requestOTPModel.OTP }.");
s.AppendLine("Regards, IME London");
SMSRequestModel _req = new SMSRequestModel
{
ProviderId = "ProcessId",
MobileNumber = mobileNum,
SMSBody = s.ToString(),
ProcessId = requestOTPModel.ProcessId,
RequestedBy = requestOTPModel.userId,
UserName = requestOTPModel.userId,
method = "send",
ControlNo = "", // GetControlNo()
};
Log.Debug("SendNotification.SMS | REQUEST : " + JsonConvert.SerializeObject(_req));
APIJsonResponse _resp = _sendAPI.SMSTPApi(_req);
APIJsonResponse _resp = _sendAPI.SMSTPApi(_req);
Log.Debug("SendNotification.SMS | RESPONSE : " + JsonConvert.SerializeObject(_resp));
smsSent = true;
}
catch (Exception smsException)
{
Log.Error("Error sending SMS", smsException);
}
if (emailSent || smsSent)
{
jsonRx.ErrorCode = "0";
smsSent = true;
}
catch (Exception smsException)
{
Log.Error("Error sending SMS", smsException);
}
if (emailSent || smsSent)
{
jsonRx.ErrorCode = "0";
jsonRx.SetResponse("0", "OTP has been Sent.");
return jsonRx;
return jsonRx;
}
}
}
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 };
}
}
jsonRx.ErrorCode = jsonRx.ErrorCode == "103" ? "0" : jsonRx.ErrorCode; // 103 = previous OTP was not expired, so the same was used
jsonRx.ErrorCode = jsonRx.ErrorCode == "103" ? "0" : jsonRx.ErrorCode;//103 = previous OTP was not expired so same was used
return jsonRx;
}
catch (Exception ex)
@ -246,13 +269,10 @@ namespace Business.Mobile
jsonRx.SetResponse("1", "Error occurred while calling RequestOTP.");
return jsonRx;
}
}
private string getSenderFormattedNumber(string number)
public string getSenderFormattedNumber(string number)
{
string finalNo = number;
if (!number.Contains("+44"))
{
string mobileFirst = number.Substring(0, 1);
@ -272,19 +292,20 @@ namespace Business.Mobile
{
finalNo = $"+44{number}";
}
}
else if (number.Contains("+44"))
{
string MobN = number.Substring(4, 1);
if (MobN == "0" && number.Length > 14)
{
finalNo = number.Remove(4, 1);
}
}
if (!finalNo.Substring(0, 1).Contains("+"))
{
finalNo = $"+{finalNo}";
}
return finalNo;
}
@ -668,8 +689,6 @@ namespace Business.Mobile
}
if (!string.IsNullOrEmpty(custKyc.RegistrationType) && custKyc.RegistrationType.Equals("EKYC"))
{
isKyc = true;
@ -684,6 +703,8 @@ namespace Business.Mobile
// isBackRequired = id["isBackRequired"].ToString();
// }
//}
//Log.Debug($"RegisterKYC | httpRequest : {httpRequest.Params}");
Log.Debug($"RegisterKYC | REQUEST : { JsonConvert.SerializeObject(custKyc)} | Files: { httpRequest.Files.Count}");
@ -1001,34 +1022,59 @@ namespace Business.Mobile
// kyc.mobile = jsonRxMobile.Extra;
//}
if (kyc.type.Equals("0"))
{
if (string.IsNullOrEmpty(kyc.otherOccupation) && string.IsNullOrEmpty(kyc.occupation))
{
enumString = RESPONSE_MSG.VALIDATE_FORM_2.ToString();
var map = Utilities.GetLanguageMapping(enumString, lang);
jsonRx.SetResponse("1", map.Message);
//if (string.IsNullOrEmpty(kyc.otherOccupation) && string.IsNullOrEmpty(kyc.occupation))
//{
// enumString = RESPONSE_MSG.VALIDATE_FORM_2.ToString();
// var map = Utilities.GetLanguageMapping(enumString, lang);
// jsonRx.SetResponse("1", map.Message);
return jsonRx;
}
else if (string.IsNullOrEmpty(kyc.occupation))
{
if (string.IsNullOrEmpty(kyc.otherOccupation))
{
enumString = RESPONSE_MSG.VALIDATE_FORM_9.ToString();
var map = Utilities.GetLanguageMapping(enumString, lang);
jsonRx.SetResponse("1", map.Message);
// return jsonRx;
//}
//else if (string.IsNullOrEmpty(kyc.occupation))
//{
// if (string.IsNullOrEmpty(kyc.otherOccupation))
// {
// enumString = RESPONSE_MSG.VALIDATE_FORM_9.ToString();
// var map = Utilities.GetLanguageMapping(enumString, lang);
// jsonRx.SetResponse("1", map.Message);
// return jsonRx;
// }
//}
return jsonRx;
}
}
if (string.IsNullOrEmpty(kyc.idExpiryDate))
{
//if (string.IsNullOrEmpty(kyc.monthlyIncome))
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.idNumber))
//{
// enumString = RESPONSE_MSG.VALIDATE_FORM_3.ToString();
// var map = Utilities.GetLanguageMapping(enumString, lang);
// jsonRx.SetResponse("1", map.Message);
// jsonRx.SetResponse("1", "Id number is required");
// return jsonRx;
//}
//if (string.IsNullOrEmpty(kyc.additionalAddress))
//{
// enumString = RESPONSE_MSG.VALIDATE_FORM_4.ToString();
@ -1666,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;
}
@ -1739,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);
@ -1907,29 +1955,9 @@ namespace Business.Mobile
res = _requestServices.CustomerInfoAgree(username, "agree");
//if (res.ErrorCode.Equals("0"))
//{
// _trustDocBusiness.CompareData(new TrustDocRequest() { birth = res.Extra2, name = res.Msg }, res.Extra3, username, res.Id);
// SendNotificationRequest request = new SendNotificationRequest()
// {
// IsBulkNotification = false,
// UserName = username,
// ProcessId = Guid.NewGuid().ToString(),
// ProviderId = "CustomerInfoAgree",
// NotificationTypeId = NOTIFICATION_TYPE.PUSH_NOTIFICATION.ToString(),
// //Template = Common.Model.Enum.NotifyTemplate.NEW_REGISTER_WELCOME,
// Recipients = new List<RecipientViewModel>()
// {
// new RecipientViewModel() { Address= res.Extra , NotificationContent = new NotificationDTO() }
// },
// Language = Convert.ToString(CallContext.GetData(Constants.Language))
// };
// Task.Run(() => NotifierV2.SendNotification(request, NOTIFICATION_TYPE.PUSH_NOTIFICATION));
//}
if (res.ErrorCode.Equals("0"))
{
// _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";
@ -1961,10 +1989,8 @@ namespace Business.Mobile
// },
// Language = Convert.ToString(CallContext.GetData(Constants.Language))
//};
//Task.Run(() => NotifierV2.SendNotification(emailNotificationRequest, NOTIFICATION_TYPE.EMAIL));
}
Log.Debug("CustomerInfoAgree.Agree | DB RESPONSE : " + JsonConvert.SerializeObject(res));
}
//else if (agreeYn.Equals("N"))
@ -2001,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);
@ -2008,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);
@ -2018,20 +2055,21 @@ namespace Business.Mobile
{
try
{
List<Notify.Mapping> bodyMappings = new List<Notify.Mapping>();
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 });
bodyMappings.Add(new Notify.Mapping() { SValue = "PASS_WORD", SText = randomPassword });
bodyMappings.Add(new Notify.Mapping() { SValue = "PASS_WORD", SText = randomPassword });
SendNotificationRequest request = new SendNotificationRequest()
{
IsBulkNotification = false,
UserName = pwdReset.Username,
ProcessId = processId,
ProviderId = "ResetPassword",
NotificationTypeId = NOTIFICATION_TYPE.EMAIL.ToString(),
Template = Common.Model.Enum.NotifyTemplate.RESET_PASSWORD_EMAIL,
Recipients = new List<RecipientViewModel>()
SendNotificationRequest request = new SendNotificationRequest()
{
IsBulkNotification = false,
UserName = pwdReset.Username,
ProcessId = processId,
ProviderId = "ResetPassword",
NotificationTypeId = NOTIFICATION_TYPE.EMAIL.ToString(),
Template = Common.Model.Enum.NotifyTemplate.RESET_PASSWORD_EMAIL,
Recipients = new List<RecipientViewModel>()
{
new RecipientViewModel()
{
@ -2042,25 +2080,26 @@ namespace Business.Mobile
Address= pwdReset.Username
}
}
};
};
string ProcessId = Guid.NewGuid().ToString().Replace("-", "") + ":sendSms";
SendSMSApiService _sendAPI = new SendSMSApiService();
res = NotifierV2.SendNotification(request, NOTIFICATION_TYPE.);
//GetSMSTextForTxn
SMSRequestModel _req = new SMSRequestModel
{
ProviderId = "onewaysms",
MobileNumber = pwdReset.mobileNo,
SMSBody = Common.Model.Enum.NotifyTemplate.RESET_PASSWORD_EMAIL,
ProcessId = ProcessId.Substring(ProcessId.Length - 40, 40),
RequestedBy = pwdReset.Username,
UserName = pwdReset.Username,
method = "send",
ControlNo = "", // GetControlNo()
};
APIJsonResponse _resp = _sendAPI.SMSTPApi(_req);
res = NotifierV2.SendNotification(request, NOTIFICATION_TYPE.EMAIL);
string ProcessId = Guid.NewGuid().ToString().Replace("-", "") + ":sendSms";
SendSMSApiService _sendAPI = new SendSMSApiService();
SMSRequestModel _req = new SMSRequestModel
{
ProviderId = "onewaysms",
MobileNumber = pwdReset.mobileNo,
SMSBody = Common.Model.Enum.NotifyTemplate.RESET_PASSWORD_EMAIL.ToString(),
ProcessId = ProcessId.Substring(ProcessId.Length - 40, 40),
RequestedBy = pwdReset.Username,
UserName = pwdReset.Username,
method = "send",
ControlNo = "", // GetControlNo()
};
APIJsonResponse _resp = _sendAPI.SMSTPApi(_req);
}
catch (Exception ex)
{
@ -2114,56 +2153,16 @@ namespace Business.Mobile
if (liWalletStmtResponse == null)
{
jsonRx.ErrorCode = "0";
jsonRx.ErrorCode = "1";
jsonRx.Msg = "No wallet statement found.";
jsonRx.Data = new System.Collections.ArrayList();
Log.Debug("GetWalletStatement | Returning null while fetching the list of wallet statements.");
return jsonRx;
}
double OpenBalnce = 0.0;
foreach (var item in liWalletStmtResponse)
{
if (item.Particular.ToString().ToUpper() == "BALANCE BROUGHT FORWARD")
{
OpenBalnce = GetStatic.ParseDouble(item.ClosingAmount.ToString());
}
else
{
item.ClosingAmount = (OpenBalnce + GetStatic.ParseDouble(item.WalletIn) - GetStatic.ParseDouble(item.WalletOut)).ToString();
OpenBalnce = GetStatic.ParseDouble(item.ClosingAmount);
}
//item.ClosingAmount = GetStatic.ShowCommaAmt(item.ClosingAmount);
item.WalletIn = GetStatic.ShowCommaAmt(item.WalletIn);
item.WalletOut = GetStatic.ShowCommaAmt(item.WalletOut);
}
if (liWalletStmtResponse[0].Particular.ToString().ToUpper() == "BALANCE BROUGHT FORWARD")
{
liWalletStmtResponse.RemoveAt(0);
}
liWalletStmtResponse.Add(new WalletStatementResponse()
{
Particular = "BALANCE BROUGHT FORWARD",
ClosingAmount = OpenBalnce.ToString()
});
jsonRx.SetResponse("0", liWalletStmtResponse.Count.ToString() + " wallet txn");
jsonRx.ErrorCode = "0";
jsonRx.Data = liWalletStmtResponse;
List<WalletStatementResponse> list = new List<WalletStatementResponse>();
for (int i = liWalletStmtResponse.Count - 1; i >= 0; i--)
{
list.Add(new WalletStatementResponse()
{
Particular = liWalletStmtResponse[i].Particular,
TransactionDate = liWalletStmtResponse[i].TransactionDate,
WalletIn = liWalletStmtResponse[i].WalletIn,
WalletOut = liWalletStmtResponse[i].WalletOut,
ClosingAmount = GetStatic.ShowCommaAmt(liWalletStmtResponse[i].ClosingAmount)
});
}
jsonRx.Data = list;
Log.Debug("GetWalletStatement | DB RESPONSE : " + JsonConvert.SerializeObject(jsonRx));
return jsonRx;
}
@ -2932,7 +2931,6 @@ namespace Business.Mobile
return jsonRx;
}
else if (type == Common.Model.Config.MappingType.REWARD_POINT)
{
var response1 = _requestServices.GetRewardFee(customerId);
@ -2999,7 +2997,6 @@ namespace Business.Mobile
public List<Option> GetPaymentMethods()
{
var paymentMethods = _requestServices.GetPaymentMethod();
List<Option> options;
string mappingPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ConfigurationManager.AppSettings["PaymentConfigFilePath"].ToString());
using (StreamReader reader = File.OpenText(mappingPath))
@ -3010,17 +3007,13 @@ namespace Business.Mobile
foreach (var paymentMethod in paymentMethods)
{
var matchingOption = options.FirstOrDefault(option => option.Code == paymentMethod.Key);
if (matchingOption != null)
{
matchingOption.Value = paymentMethod.Value;
}
}
return options;
}
public JsonRxResponse ValidateReferralCode(string referralCode)
{
JsonRxResponse jsonRx = new JsonRxResponse();

11
Business/MobileV2/IMobileV2Business.cs

@ -13,11 +13,20 @@ namespace Business.MobileV2
{
JsonRxResponse GetReceiverInformationV2(DateFilterParams search, string customerId, string countryId);
JsonRxResponse RefreshDashboardInformationV2(UserModel model);
CustomerDetailV2 GetCustomerProfile(string userId);
JsonRxResponse CustomerProfile(CustomerProfileV2 profileV2);
JsonRxResponse GetKycSettings(KycRequest kycRequest);
JsonRxResponse SaveKycSettings(KycOption kycRequest);
JsonRxResponse DownLoadStatement(DateFilterParams search, string userId);
JsonRxResponse UpdateCustomerProfile(CustomerDetailV2 profileV2);
//JsonRxResponse UpdateProfile(CustomerDetailV2 req);
}
}

49
Business/MobileV2/MobileV2Business.cs

@ -72,7 +72,7 @@ namespace Business.Mobile
filePath = "https://uat.imelondon.co.uk:1081/images/banners/Imebanner.jpg",
fileTitle = "file1",
Redirect = true,
RedirectURL= "https://imelondon.co.uk/"
RedirectURL = "https://imelondon.co.uk/"
});
dashBoardV2.bannerImages.Add(new BannerImages()
{
@ -110,6 +110,31 @@ namespace Business.Mobile
return jsonResult;
}
public CustomerDetailV2 GetCustomerProfile(string userId)
{
CustomerDetailV2 v2 = new CustomerDetailV2();
try
{
DataRow p = _requestServicesv2.GetProfileDetails(userId);
v2.FullName = p["FullName"].ToString();
v2.UserId = p["UserId"].ToString();
v2.Username = p["email"].ToString();
v2.PostalCode = p["zipCode"].ToString();
v2.Gender = p["gender"].ToString();
v2.DOB = p["dob"].ToString();
v2.MobileNumber = p["mobile"].ToString();
v2.Nationality = p["nativeCountry"].ToString();
v2.City = p["city"].ToString();
v2.Address1 = p["address"].ToString();
v2.Address2 = p["ADDITIONALADDRESS"].ToString();
}
catch (Exception ex)
{
throw;
}
return v2;
}
public JsonRxResponse CustomerProfile(CustomerProfileV2 profileV2)
@ -172,7 +197,6 @@ namespace Business.Mobile
try
{
var response = Utilities.GetKYCSettings(kycRequest);
if (response != null)
@ -287,5 +311,26 @@ namespace Business.Mobile
Log.Debug("Done with Saving ");
return $"{membershipId}/{fileName}";
}
public JsonRxResponse DownLoadStatement(DateFilterParams search, string userId)
{
JsonRxResponse jsonRx = new JsonRxResponse() { ErrorCode = "0", Msg = "Success" };
jsonRx.Data = "http://77.68.15.91:1082/download/sample.pdf";
return jsonRx;
}
public JsonRxResponse UpdateCustomerProfile(CustomerDetailV2 profileV2)
{
JsonRxResponse jsonRx = _requestServicesv2.UpdateCustomerProfile(profileV2);
return jsonRx;
}
}
}

68
Business/SendMoney/SendMoneyBusiness.cs

@ -1,5 +1,6 @@
using Business.KFTCBusiness;
using Business.TPApi;
using Business.Utility;
using Common;
using Common.Helper;
using Common.Language;
@ -22,6 +23,7 @@ using System.IO;
using System.Runtime.Remoting.Messaging;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using Notify = Common.Model.Notification;
namespace Business.SendMoney
@ -492,7 +494,9 @@ namespace Business.SendMoney
TpPCurr = model.TpPCurr,
TransferAmt = model.TransferAmt,
UserName = model.User,
DiscountedFee = model.DiscountedFee
DiscountedFee = model.DiscountedFee,
SiteId = ConfigurationManager.AppSettings["sitereference"].ToString()
};
@ -500,6 +504,7 @@ namespace Business.SendMoney
APIJsonResponse result = _tpApi.ThirdPartyApiGetDataOnly<TpSendMoney, APIJsonResponse>(tp, "TP/mobileSendTxn", out jsonResponse);
Log.Debug("DOTRANSACTION | TPAPI RESPONSE : " + JsonConvert.SerializeObject(result));
response = new JsonRxResponse()
{
ErrorCode = result.ResponseCode,
@ -507,30 +512,52 @@ namespace Business.SendMoney
Msg = result.Msg,
Data = result.Data,
Extra = result.Extra,
Extra2 = result.Extra1,
Extra3 = result.Extra3
Extra2 = result.Extra2,
Extra3 = result.Extra3,
Extra4 = result.Extra4
};
if (response.ErrorCode.Equals("0"))
{
string email = model.User;
//var randomPassword = PasswordGenerator.GenerateRandomPassword(new PasswordGenerator.PasswordOptions()
//{ RequireDigit = true, RequiredLength = 10, RequiredUniqueChars = 2, RequireLowercase = true, RequireNonAlphanumeric = true, RequireUppercase = true });
try
{
UserDetails userDetails = _requestServices.GetUserDetails(email);
string eID = HttpUtility.UrlEncode(AesOperation.EncryptString(ConfigurationManager.AppSettings["encryptKey"].ToString(), result.Id));
string eCn = HttpUtility.UrlEncode(AesOperation.EncryptString(ConfigurationManager.AppSettings["encryptKey"].ToString(), result.Extra));
List<Notify.Mapping> bodyMappings = new List<Notify.Mapping>();
var trustpaymentCallback = ApplicationConfig.ReadWebConfig("trustpaymentCallback");
var trustpaymentSuccess = ApplicationConfig.ReadWebConfig("trustpaymentSuccess");
var trustpaymentFail = ApplicationConfig.ReadWebConfig("trustpaymentFail");
Gateway gateway = new Gateway()
{
Code = result.Extra2,
IsRedirect = result.Extra3.Equals("Y") ? true : false,
//Token = randomPassword,
RedirectURL = result.Extra3.Equals("Y") ? $"{trustpaymentCallback}?id={eID}&ref={response.Extra4}&cn={eCn}&token=" : "",
CheckSuccessURL = result.Extra3.Equals("Y") ? trustpaymentSuccess : "",
CheckFailURL = result.Extra3.Equals("Y") ? trustpaymentFail : ""
};
response.Data = gateway;
bodyMappings.Add(new Notify.Mapping() { SValue = "CustomerName", SText = userDetails.FullName });
string email = model.User;
SendNotificationRequest request = new SendNotificationRequest()
try
{
if (!result.Extra3.Equals("Y"))
{
IsBulkNotification = false,
UserName = userDetails.Email,
ProviderId = "BankTransferTxnPendingStatus",
NotificationTypeId = NOTIFICATION_TYPE.EMAIL.ToString(),
Template = Common.Model.Enum.NotifyTemplate.BANK_TRANSFER_TXN_PENDING,
Recipients = new List<RecipientViewModel>()
UserDetails userDetails = _requestServices.GetUserDetails(email);
List<Notify.Mapping> bodyMappings = new List<Notify.Mapping>();
bodyMappings.Add(new Notify.Mapping() { SValue = "CustomerName", SText = userDetails.FullName });
bodyMappings.Add(new Notify.Mapping() { SValue = "CollectAmt", SText = GetStatic.ShowDecimal(model.CollAmt) });
SendNotificationRequest request = new SendNotificationRequest()
{
IsBulkNotification = false,
UserName = userDetails.Email,
ProviderId = "BankTransferTxnPendingStatus",
NotificationTypeId = NOTIFICATION_TYPE.EMAIL.ToString(),
Template = Common.Model.Enum.NotifyTemplate.BANK_TRANSFER_TXN_PENDING,
Recipients = new List<RecipientViewModel>()
{
new RecipientViewModel()
{
@ -541,8 +568,9 @@ namespace Business.SendMoney
Address= userDetails.Email
}
}
};
NotifierV2.SendNotification(request, NOTIFICATION_TYPE.EMAIL);
};
NotifierV2.SendNotification(request, NOTIFICATION_TYPE.EMAIL);
}
}
catch (Exception ex)
@ -550,8 +578,8 @@ namespace Business.SendMoney
Log.Error("BankTransferTxnPendingStatus", ex);
}
}
return response;
}

6
Business/TPApi/ThirdPartyAPI.cs

@ -62,7 +62,11 @@ namespace Business.TPApi
Msg = jsonResponseData.Msg,
Data = data,
Extra = jsonResponseData.Extra,
Extra1 = jsonResponseData.Extra1
Extra1 = jsonResponseData.Extra1,
Extra2 = jsonResponseData.Extra2,
Extra3 = jsonResponseData.Extra3,
Extra4 = jsonResponseData.Extra4
};
}
}

64
Business/Utility/AesOperation.cs

@ -0,0 +1,64 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace Business.Utility
{
public static class AesOperation
{
public static string EncryptString(string key, string plainText)
{
byte[] iv = new byte[16];
byte[] array;
using (Aes aes = Aes.Create())
{
aes.Key = Encoding.UTF8.GetBytes(key);
aes.IV = iv;
ICryptoTransform encryptor = aes.CreateEncryptor(aes.Key, aes.IV);
using (MemoryStream memoryStream = new MemoryStream())
{
using (CryptoStream cryptoStream = new CryptoStream((Stream)memoryStream, encryptor, CryptoStreamMode.Write))
{
using (StreamWriter streamWriter = new StreamWriter((Stream)cryptoStream))
{
streamWriter.Write(plainText);
}
array = memoryStream.ToArray();
}
}
}
return Convert.ToBase64String(array);
}
public static string DecryptString(string key, string cipherText)
{
byte[] iv = new byte[16];
byte[] buffer = Convert.FromBase64String(cipherText);
using (Aes aes = Aes.Create())
{
aes.Key = Encoding.UTF8.GetBytes(key);
aes.IV = iv;
ICryptoTransform decryptor = aes.CreateDecryptor(aes.Key, aes.IV);
using (MemoryStream memoryStream = new MemoryStream(buffer))
{
using (CryptoStream cryptoStream = new CryptoStream((Stream)memoryStream, decryptor, CryptoStreamMode.Read))
{
using (StreamReader streamReader = new StreamReader((Stream)cryptoStream))
{
return streamReader.ReadToEnd();
}
}
}
}
}
}
}

3
Common/APIJsonResponse.cs

@ -8,7 +8,10 @@
public object Data { get; set; }
public string Extra { get; set; }
public string Extra1 { get; set; }
public string Extra2 { get; set; }
public string Extra3 { get; set; }
public string Extra4 { get; set; }
public string FootNoteMessage { get; set; }
public void SetResponse(string responseCode, string msg, string id = null, string extra = null, string extra1 = null, string extra3 = null, string footNoteMessage = "")

12
Common/Common.csproj

@ -84,7 +84,6 @@
<Compile Include="Model\BalanceTransfer\ConfirmBalanceTransfer.cs" />
<Compile Include="Model\BalanceTransfer\InitBalanceTransfer.cs" />
<Compile Include="Model\BalanceTransfer\PerformBalanceTransfer.cs" />
<Compile Include="Model\BankTransfer\PendingStatusModel.cs" />
<Compile Include="Model\CDDIResponseModel.cs" />
<Compile Include="Model\ChangePassword.cs" />
<Compile Include="Model\Config\Enums.cs" />
@ -217,6 +216,17 @@
<Content Include="Dll\mTranskeyServer.dll" />
<Content Include="Dll\mTranskeyServerCom.dll" />
</ItemGroup>
<ItemGroup>
<COMReference Include="mTranskeyServerComLib">
<Guid>{74401920-6AFF-4916-B0A9-269C1795449A}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>False</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="JsonFileParsing\JsonTable\CountryPriceCode.json" />

47
Common/Helper/Utilities.cs

@ -282,7 +282,7 @@ namespace Common.Helper
{
string[] strChar = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" };
string otpChar = strChar[Random.Next(0, 9)] + strChar[Random.Next(0, 9)] + strChar[Random.Next(0, 9)] + strChar[Random.Next(0, 9)];
string otpChar = strChar[Random.Next(0, 9)] + strChar[Random.Next(0, 9)] + strChar[Random.Next(0, 9)] + strChar[Random.Next(0, 9)] + strChar[Random.Next(0, 9)] + strChar[Random.Next(0, 9)];
return otpChar;
}
@ -648,8 +648,8 @@ namespace Common.Helper
return true;
}
DateTime dt = Convert.ToDateTime(param);
string[] formats = { "yyyy-MM-dd", "yyyy/MM/dd", "MM/dd/yyyy", "MM-dd-yyyy" };
DateTime dt;
string[] formats = { "yyyy-MM-dd", "yyyy/MM/dd", "MM/dd/yyyy", "MM-dd-yyyy", "dd/MM/yyyy" };
if (DateTime.TryParseExact(param, formats, System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out dt))
{
return true;
@ -659,7 +659,7 @@ namespace Common.Helper
return false;
}
}
catch (Exception)
catch (Exception ex)
{
return false;
}
@ -975,5 +975,44 @@ namespace Common.Helper
fullName = string.Format("{0} {1}", (!string.IsNullOrEmpty(mname)) ? fname + " " + mname : fname, lname);
return fullName;
}
public static string getUKFormattedNumber(this string number)
{
string finalNo = number;
if (!number.Contains("+44"))
{
string mobileFirst = number.Substring(0, 1);
if (mobileFirst == "0")
{
if (number.Length == 11)
{
finalNo = "+44" + number.Substring(1, number.Length - 1);
return finalNo;
}
else if (number.Length < 11)
{
finalNo = $"+44{number}";
}
}
else if (number.Substring(0, 1) != "0" && number.Length == 10)
{
finalNo = $"+44{number}";
}
}
else if (number.Contains("+44"))
{
string MobN = number.Substring(4, 1);
if (MobN == "0" && number.Length > 14)
{
finalNo = number.Remove(4, 1);
}
}
if (!finalNo.Substring(0, 1).Contains("+"))
{
finalNo = $"+{finalNo}";
}
return finalNo;
}
}
}

5
Common/Model/CustomerRegister/NewUserRegisterModel.cs

@ -1,4 +1,5 @@
using System.ComponentModel.DataAnnotations;
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations;
namespace Common.Model.CustomerRegister
{
@ -37,5 +38,7 @@ namespace Common.Model.CustomerRegister
public string Nationality { get; set; }
[Required]
public string Gender { get; set; }
}
}

9
Common/Model/JsonRxResponse.cs

@ -8,6 +8,7 @@
private string _extra = "";
private string _extra2 = "";
private string _extra3 = "";
private string _extra4 = "";
private object _data = null;
private string _footNoteMessage = "";
@ -45,6 +46,14 @@
set { _extra3 = value; }
get { return _extra3; }
}
public string Extra4
{
set { _extra4 = value; }
get { return _extra4; }
}
public object Data
{
set { _data = value; }

30
Common/Model/MobileV2/CustomerProfileV2.cs

@ -16,4 +16,34 @@ namespace Common.Model.MobileV2
public string fileName { get; set; }
}
public class CustomerDetailV2
{
public string UserId { get; set; }
public string Username { get; set; }
public string FullName { get; set; }
public string Gender { get; set; }
public string Nationality { get; set; }
public string DOB { get; set; }
public string MobileNumber { get; set; }
public string PostalCode { get; set; }
public string City { get; set; }
public string Address1 { get; set; }
public string Address2 { get; set; }
}
}

5
Common/Model/Notification/SMSRequestModel.cs

@ -1,5 +1,4 @@
using Common.Model.Enum;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -13,7 +12,7 @@ namespace Common.Model.Notification
public string UserName { get; set; }
public string RequestedBy { get; set; }
public string MobileNumber { get; set; }
public NotifyTemplate SMSBody { get; set; }
public string SMSBody { get; set; }
public string method { get; set; }
public string ProviderId { get; set; }
public string ControlNo { get; set; }

4
Common/Model/RequestOTP/RequestOTPModel.cs

@ -12,6 +12,7 @@ namespace Common.Model.RequestOTP
public string mobileNo { get; set; }
public string customerName { get; set; }
public string FcmId { get; set; }
[JsonIgnore]
@ -19,5 +20,8 @@ namespace Common.Model.RequestOTP
[JsonIgnore]
public string Lang { get; set; }
[JsonIgnore]
public string ProcessId { get; set; }
}
}

8
Common/Model/RewardFee.cs

@ -34,4 +34,12 @@ namespace Common.Model
public string Value { get; set; }
public string Icon { get; set; }
}
public class Gateway
{
public string Code { get; set; }
public bool IsRedirect { get; set; }
public string RedirectURL { get; set; }
public string CheckSuccessURL { get; set; }
public string CheckFailURL { get; set; }
}
}

3
Common/Model/TPSendMoney/TpSendMoney.cs

@ -30,6 +30,9 @@
public string ScDiscount { get; set; }
public string SchemeId { get; set; }
public string DiscountedFee { get; set; }
public string SiteId { get; set; }
public string Token { get; set; }
}
public class ReceiverInfo

5
Common/Model/TranHistoryResponse.cs

@ -28,5 +28,10 @@
public string PayoutAgent { get; set; }
public string DisplayActions { get; set; }
public string ColorIcon { get; set; }
public string ColorCode { get; set; }
public string TextCode { get; set; }
}
}

2
Common/Model/TransactionResponse.cs

@ -46,7 +46,7 @@
public string rewardPoints { get; set; }
public string SenderFullName { get; set; }
public string ColorIcon { get; set; }
public PaymentDetails PaymentDetails { get; set; }
}

23
Common/Model/WalletStatementResponse.cs

@ -2,11 +2,24 @@
{
public class WalletStatementResponse
{
public int RowId { get; set; }
// public int RowId { get; set; }
public string TransactionDate { get; set; }
public string Particular { get; set; }
public string WalletIn { get; set; }
public string WalletOut { get; set; }
public string ClosingAmount { get; set; }
public string Particular { get; set; }
public string TranId { get; set; }
public string ControlNo { get; set; }
public string PayoutAmt { get; set; }
public string PCurr { get; set; }
public string CollAmt { get; set; }
public string CollCurr { get; set; }
public string PayStatus { get; set; }
public string PayoutMode { get; set; }
public string ReceiverName { get; set; }
public string PayoutCountry { get; set; }
public string ColorCode { get; set; }
public string TextCode { get; set; }
}
}

2
JsonRx/Api/AuthController.cs

@ -115,7 +115,7 @@ namespace JsonRx.Api
/// <param name="pwdReset"></param>
/// <returns></returns>
[HttpPost]
[ApplicationLevelAuthentication]
// [ApplicationLevelAuthentication]
[Route("mobile/passwordReset")]
public IHttpActionResult ResetPassword(PasswordReset pwdReset)
{

6
JsonRx/Api/MobileController.cs

@ -155,13 +155,15 @@ namespace JsonRx.Api
[Route("mobile/requestOTP")]
public IHttpActionResult RequestOTP(RequestOTPModel requestOTPModel)
{
LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = Guid.NewGuid();
var ProcessId = Guid.NewGuid().ToString();
LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = ProcessId;
LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "RequestOTP";
LogicalThreadContext.Properties[LoggerProperty.CREATEDBY] = requestOTPModel.userId;
LogicalThreadContext.Properties[LoggerProperty.IPADDRESS] = Request.GetClientIpAddress();
requestOTPModel.DeviceType = Util.GetDeviceType(Request);
requestOTPModel.ProcessId = ProcessId;
Log.Debug("RequestOTP | REQUEST : " + JsonConvert.SerializeObject(requestOTPModel));
var staticDataResponse = _requestServices.RequestOTP(requestOTPModel);
return Ok(staticDataResponse);
@ -335,7 +337,7 @@ namespace JsonRx.Api
LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = Guid.NewGuid();
LogicalThreadContext.Properties[LoggerProperty.CREATEDBY] = userId;
LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "walletstatement";
Log.Debug("GetWalletStatement | REQUEST : " + userId);
Log.Debug("GetWalletStatement | REQUEST : " + userId + "|" + JsonConvert.SerializeObject(search));
JsonRxResponse walletStatement = new JsonRxResponse();
if (string.IsNullOrEmpty(userId))
{

59
JsonRx/Api/SendMoneyController.cs

@ -231,6 +231,7 @@ namespace JsonRx.Api
if (_dbRes.ResponseCode == "0")
{
res = _bussiness.SendTransaction(model);
Log.Debug("DOTRANSACTION | RESPONSE : " + JsonConvert.SerializeObject(res));
if (res.ErrorCode == "0")
{
// var fcmid = Util.getJWTTokenClaim(Request.GetJWTToken(), "ClientFcmId");
@ -238,37 +239,40 @@ namespace JsonRx.Api
//Task.Run(() => FcmNotifier.Notify(fcmid, Languages.GetMessage("transaction_success", lang), Languages.GetTitle("transaction", lang)));
LogicalThreadContext.Properties[LoggerProperty.CONTROLNO] = res.Extra;
SendNotificationRequest temp = new SendNotificationRequest();
NotificationDTO rvm = new NotificationDTO();
if (res.Extra3 != null && res.Extra3.ToString() == "N")
{
temp.Template = Common.Model.Enum.NotifyTemplate.TF_NO_BALANCE;
rvm.ClickActivity = "OPEN_ACTIVITY_NOTIFICATION";
SendNotificationRequest request = new SendNotificationRequest()
{
IsBulkNotification = false,
UserName = model.User,
ProcessId = model.ProcessId,
ProviderId = "dotransaction",
Template = temp.Template,
//SendNotificationRequest temp = new SendNotificationRequest();
//NotificationDTO rvm = new NotificationDTO();
//if (res.Extra3 != null && res.Extra3.ToString() == "N")
//{
// temp.Template = Common.Model.Enum.NotifyTemplate.TF_NO_BALANCE;
// rvm.ClickActivity = "OPEN_ACTIVITY_NOTIFICATION";
// SendNotificationRequest request = new SendNotificationRequest()
// {
// IsBulkNotification = false,
// UserName = model.User,
// ProcessId = model.ProcessId,
// ProviderId = "dotransaction",
// Template = temp.Template,
// Template = Common.Model.Enum.NotifyTemplate.TRANSACTION_SUCCESS,
Recipients = new List<RecipientViewModel>()
{
new RecipientViewModel() { Address= Util.GetClientFCMId(Request) ,NotificationContent = new NotificationDTO() { ClickActivity = rvm.ClickActivity} }
},
Language = Util.getJWTTokenClaim(Request.GetJWTToken(), "language")
};
var devicetype = Util.GetDeviceType(Request);
if (devicetype != null && devicetype.Equals("IOS"))
{
Task.Run(() => NotifierV2.SendNotification(request, NOTIFICATION_TYPE.PUSH_NOTIFICATION));
}
}
// Recipients = new List<RecipientViewModel>()
// {
// new RecipientViewModel() { Address= Util.GetClientFCMId(Request) ,NotificationContent = new NotificationDTO() { ClickActivity = rvm.ClickActivity} }
// },
// Language = Util.getJWTTokenClaim(Request.GetJWTToken(), "language")
// };
// var devicetype = Util.GetDeviceType(Request);
// if (devicetype != null && devicetype.Equals("IOS"))
// {
// Task.Run(() => NotifierV2.SendNotification(request, NOTIFICATION_TYPE.PUSH_NOTIFICATION));
// }
//}
}
if (res.ErrorCode.Equals("0"))
{
if (res.Extra3 != null && res.Extra3.ToString() == "N")
enumString = RESPONSE_MSG.SEND_TRANSACTION_SUCCESS.ToString();
else
enumString = "Please proceed to complete your payment.";
}
else if (res.ErrorCode.Equals("1"))
{
@ -354,7 +358,8 @@ namespace JsonRx.Api
var map = Utilities.GetLanguageMapping(enumString, lang);
return Ok(new JsonRxResponse { ErrorCode = res.ErrorCode.Equals("0") ? "0" : "1", Msg = res.ErrorCode.Equals("21")| res.ErrorCode.Equals("1") ? res.Msg : map.Message, Id = res.Id, Extra = res.Extra, FootNoteMessage = "" });
return Ok(new JsonRxResponse { ErrorCode = res.ErrorCode.Equals("0") ? "0" : "1",
Msg = res.ErrorCode.Equals("21") | res.ErrorCode.Equals("1") ? res.Msg : map.Message, Id = res.Id, Extra = res.Extra, Data= res.Data, FootNoteMessage = "" });
// return Ok(res);
}
else

95
JsonRx/ApiV3/MobileV3Controller.cs

@ -114,14 +114,14 @@ namespace JsonRx.ApiV3
[Route("mobile/GetKycSettings")]
public IHttpActionResult GetKycSettings(KycRequest kycRequest)
{
LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = Guid.NewGuid();
LogicalThreadContext.Properties[LoggerProperty.CREATEDBY] = kycRequest.UserId;
LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "GetKycSettings";
Log.Debug("GetKycSettings | REQUEST : " + JsonConvert.SerializeObject(kycRequest));
JsonRxResponse custResponse = new JsonRxResponse();
if (string.IsNullOrEmpty(kycRequest.UserId))
@ -160,6 +160,97 @@ namespace JsonRx.ApiV3
custResponse = _requestServicesV2.SaveKycSettings(kycOption);
return Ok(custResponse);
}
/// <summary>
/// </summary>
/// <param name="user"></param>
/// <returns></returns>
[HttpGet]
[TokenAuthentication]
[Route("mobile/{customer}/GetCustomerProfile")]
public IHttpActionResult GetCustomerProfile(string customer)
{
//= new CustomerProfileV2() { Username = HttpContext.Current.Request["userId"], UserId = customer };
LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = Guid.NewGuid();
LogicalThreadContext.Properties[LoggerProperty.CREATEDBY] = customer;
LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "GetCustomerProfile";
Log.Debug("GetCustomerProfile | REQUEST : " + (customer));
JsonRxResponse custResponse = new JsonRxResponse() { ErrorCode = "0" };
if (string.IsNullOrEmpty(customer))
{
custResponse.ErrorCode = "1";
custResponse.Msg = "UserEmail is missing.";
return Ok(custResponse);
}
custResponse.Data = _requestServicesV2.GetCustomerProfile(customer);
return Ok(custResponse);
}
/// <summary>
/// </summary>
/// <param name="user"></param>
/// <returns></returns>
[HttpPost]
[TokenAuthentication]
[Route("mobile/SaveCustomerProfile")]
public IHttpActionResult SaveCustomerProfile(CustomerDetailV2 request)
{
//= new CustomerProfileV2() { Username = HttpContext.Current.Request["userId"], UserId = customer };
LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = Guid.NewGuid();
LogicalThreadContext.Properties[LoggerProperty.CREATEDBY] = request.Username;
LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "SaveCustomerProfile";
Log.Debug("UpdateCustomerDetail | REQUEST : " + JsonConvert.SerializeObject(request));
JsonRxResponse custResponse = new JsonRxResponse();
if (string.IsNullOrEmpty(request.UserId))
{
custResponse.ErrorCode = "1";
custResponse.Msg = "UserId is missing.";
return Ok(custResponse);
}
custResponse = _requestServicesV2.UpdateCustomerProfile(request);
return Ok(custResponse);
}
/// <summary>
/// </summary>
/// <param name="search"></param>
/// <param name="userId"></param>
/// <returns></returns>
[HttpPost]
[TokenAuthentication]
[Route("mobile/DownLoadStatement/{userId}")]
public IHttpActionResult DownLoadStatement(DateFilterParams search, string userId)
{
LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = Guid.NewGuid();
LogicalThreadContext.Properties[LoggerProperty.CREATEDBY] = userId;
LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "DownLoadStatement";
Log.Debug("DownLoadStatement | REQUEST : " + userId + "|" + JsonConvert.SerializeObject(search));
JsonRxResponse walletStatement = new JsonRxResponse();
if (string.IsNullOrEmpty(userId))
{
walletStatement.ErrorCode = "1";
walletStatement.Msg = "UserId is Missing";
return Ok(walletStatement);
}
walletStatement = _requestServicesV2.DownLoadStatement(search, userId);
return Ok(walletStatement);
}
}
}

17
JsonRx/AuthFilter/TokenAuthenticationAttribute.cs

@ -44,7 +44,7 @@ namespace JsonRx.AuthFilter
//}
var lang = "en-us";
try
{
IEnumerable<string> langs = null;
@ -60,7 +60,7 @@ namespace JsonRx.AuthFilter
HttpResponseMessage httpResponse;
string token;
//determine whether a jwt exists or not
if (!TryRetrieveToken(actionContext.Request, out token))
if (!TryRetrieveToken(actionContext.Request, out token, actionName))
{
//allow requests with no token - whether a action method needs an authentication can be set with the claimsauthorization attribute
// return base.SendAsync(request, cancellationToken);
@ -94,7 +94,7 @@ namespace JsonRx.AuthFilter
//extract and assign the user of the jwt
//Thread.CurrentPrincipal = handler.ValidateToken(token, validationParameters, out securityToken);
//
var cp = handler.ValidateToken(token, validationParameters, out securityToken);
var guid = "";
@ -122,7 +122,7 @@ namespace JsonRx.AuthFilter
}
}
if (string.IsNullOrEmpty(guid))
{
httpResponse = actionContext.Request.CreateResponse(HttpStatusCode.Unauthorized, new JsonRxResponse
@ -166,7 +166,7 @@ namespace JsonRx.AuthFilter
}
catch (Exception ex)
{
Log.Error("TokenAuthenticationAttribute Exception: " + actionName+ "|" + token, ex);
Log.Error("TokenAuthenticationAttribute Exception: " + actionName + "|" + token, ex);
httpResponse = actionContext.Request.CreateResponse(HttpStatusCode.InternalServerError, new JsonRxResponse
{
ErrorCode = "1",
@ -183,8 +183,9 @@ namespace JsonRx.AuthFilter
/// <param name="request"></param>
/// <param name="token"></param>
/// <returns></returns>
private static bool TryRetrieveToken(HttpRequestMessage request, out string token)
private static bool TryRetrieveToken(HttpRequestMessage request, out string token, string action = "")
{
token = null;
IEnumerable<string> authzHeaders;
IEnumerable<string> Token;
@ -195,14 +196,14 @@ namespace JsonRx.AuthFilter
}
if (!request.Headers.TryGetValues("GME-TOKEN", out Token) || Token.Count() > 1)
{
Log.Debug("TryRetrieveToken GME-TOKEN");
Log.Debug("TryRetrieveToken GME-TOKEN| " + action);
return false;
}
var bearerToken = Token.ElementAt(0);
// token = bearerToken.StartsWith("GME-TOKEN ") ? bearerToken.Substring(10) : bearerToken;
if (bearerToken != ConfigurationManager.AppSettings["GME_TOKEN"].ToString())
{
Log.DebugFormat("TryRetrieveToken GME-TOKEN {0}<> bearerToken{1}", ConfigurationManager.AppSettings["GME_TOKEN"].ToString(), bearerToken);
Log.DebugFormat("TryRetrieveToken GME-TOKEN {0}<> bearerToken{1} {2}", ConfigurationManager.AppSettings["GME_TOKEN"].ToString(), bearerToken, action);
return false;
}
bearerToken = authzHeaders.ElementAt(0);

4006
JsonRx/Config/ResponseMsg.json
File diff suppressed because it is too large
View File

14
JsonRx/Helper/Util.cs

@ -7,6 +7,8 @@ using System.IdentityModel.Tokens.Jwt;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Security.Cryptography;
using System.Text;
using System.Web;
namespace JsonRx.Helper
@ -240,15 +242,19 @@ namespace JsonRx.Helper
public static string GetFullName(string fname, string mname, string lname)
{
string fullName = string.Empty;
fullName = string.Format("{0} {1}", (!string.IsNullOrEmpty(mname)) ? fname + " " + mname : fname, lname);
return fullName;
}
}
public static class StringHelper
{
private static CultureInfo ci = new CultureInfo("en-US");
//Convert all first latter
public static string ToTitleCase(this string str)
{
str = str.ToLower();
@ -260,6 +266,7 @@ namespace JsonRx.Helper
}
return ci.TextInfo.ToTitleCase(str);
}
public static string ToTitleCase(this string str, TitleCase tcase)
{
str = str.ToLower();
@ -280,10 +287,15 @@ namespace JsonRx.Helper
}
return ci.TextInfo.ToTitleCase(str);
}
}
public enum TitleCase
{
First,
All
}
}

2
JsonRx/JsonRx.csproj

@ -70,7 +70,7 @@
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>

17
JsonRx/Web.config

@ -11,15 +11,19 @@
</configSections>
<connectionStrings>
<!--<add name="LogDB" connectionString="server=localhost;Database=LogDb; Trusted_Connection = true" providerName="system.data.sqlclient" /> -->
<add name="LogDB" connectionString="server=77.68.15.91\MSSQLSERVER01,1434;Database=LogDb;uid=sa;pwd=DbAmin123;" providerName="system.data.sqlclient" />
<add name="RemittanceDB" connectionString="server=77.68.15.91\MSSQLSERVER01,1434;Database=FastMoneyPro_Remit;uid=sa;pwd=DbAmin123; Max Pool Size=1000;" providerName="system.data.sqlclient" />
<!--<add name="LogDB" connectionString="server=77.68.15.91\MSSQLSERVER01,1434;Database=LogDb;uid=sa;pwd=DbAmin123;" providerName="system.data.sqlclient" />
<add name="RemittanceDB" connectionString="server=77.68.15.91\MSSQLSERVER01,1434;Database=FastMoneyPro_Remit;uid=sa;pwd=DbAmin123; Max Pool Size=1000;" providerName="system.data.sqlclient" />-->
<add name="LogDB" connectionString="server=77.68.90.58,1433;Database=LogDb;uid=sa;pwd=zUge=i-W[8;" providerName="system.data.sqlclient" />
<add name="RemittanceDB" connectionString="server=77.68.90.58,1433;Database=FastMoneyPro_Remit;uid=sa;pwd=zUge=i-W[8; Max Pool Size=1000;" providerName="system.data.sqlclient" />
<!--<add name="LogDB" connectionString="server=34.92.161.102;Database=logdb;uid=remituserjme;pwd=r3M!tU5Er@jM3r3Mit#?; Max Pool Size=1000;" providerName="system.data.sqlclient" />
<add name="RemittanceDB" connectionString="server=34.92.161.102;Database=FastMoneyPro_Remit;uid=remituserjme;pwd=r3M!tU5Er@jM3r3Mit#?; Max Pool Size=1000;" providerName="system.data.sqlclient" />-->
</connectionStrings>
<appSettings>
<!--Third Party Details -->
<add key="ThirdParty_Base_Url" value="http://77.68.15.91:1083/api/v1/" />
<add key="ThirdParty_Base_Url" value="http://77.68.26.191:2082/api/v1/" />
<add key="apiAccessKey" value="KPb1ttRs3CJnORpVU8SmAKUs7a42vtvjzQ47gU0b4u0vxAEI0PgZref6puzkVhLTX2PRNMGCbnb2TglupsjV5AGhYvw8a8POTcUcFSrEdHmTkhkIGNvUvxSpKjUOXGFQWaGU1bxoqqUSaFOmNE5zGojVmwPoMy38CNLwnpQKjdsIuxCKGCApa2gWHJl9gebmIpUODv9jAZgmMEaXqyR4CLg4iSksfTyYNjdqxEE88P5THYt5GuNk8Ti6K2RxIKfPWY49hBOpiYnXcApgSDiKFYqQG9WuZ7cvDGJIWg5WgWKjGle8Y3OydhONXVkN5OMPXDA4VZkK4c5nM363Zkg4w4qdzWuwhsEoAwU4rej6sMRZue3L0BowBJja1OK0iPoTX70EexX8rviMLOZPUDwhxzkL3eODS69VEEbjHb8WSjhho5h3KnCE4tcqCWihwSZ8Yuyhw1rzIMNw2C8pN1GEJyXc6goIFkf7dmK9ynJSxu52D9GjOkKqoD7dFNFulOFVfgeCuhPDYG2A2c2RSvGHv24VDXvmGVaAMLiPtsTz5oD8f0na7fX1xGg0Qveh0KgQL5THnrMK6gm5Ky7O8nbecIxY" />
<add key="sSuperAgent" value="393877" />
<add key="sBranch" value="394395" />
@ -94,6 +98,13 @@
<!--postcodeanywhere-->
<add key="loqatekey" value="CB93-HB26-JC73-WH89" />
<!--TrustPayment-->
<add key="sitereference" value="test_subhidauk71992" />
<add key="encryptKey" value="39d37440c89b668fc422fbadcd541bb8" />
<add key="trustpaymentCallback" value="https://uat.imelondon.co.uk:1081/payment/STPaymentCustomerRedirect.aspx" />
<add key="trustpaymentSuccess" value="https://uat.imelondon.co.uk:1081/payment/STPaymentSuccess.aspx" />
<add key="trustpaymentFail" value="https://uat.imelondon.co.uk:1081/payment/STPaymentFail.aspx" />
</appSettings>
<!--

140
Repository/Mobile/MobileServicesRepo.cs

@ -108,18 +108,19 @@ namespace Repository.Mobile
Msg = _dbRes.Msg,
Id = _dbRes.Id,
Extra = _dbRes.Extra,
Extra2 = _dbRes.Extra2
Extra2 = _dbRes.Extra2,
Extra3 = _dbRes.ResponseCode,
};
//return new JsonRxResponse
//{
// ErrorCode = _dbRes.ResponseCode,
//Msg = _dbRes.Msg,
//Extra = _dbRes.Id
//};
}
//return new JsonRxResponse
//{
// ErrorCode = _dbRes.ResponseCode,
//Msg = _dbRes.Msg,
//Extra = _dbRes.Id
//};
}
public JsonRxResponse GetNotifyInfo(string customerId)
{
var lang = Convert.ToString(CallContext.GetData(Constants.Language));
@ -428,7 +429,7 @@ namespace Repository.Mobile
sql += ", @monthlyIncome = " + _dao.FilterString(kyc.monthlyIncome);
sql += ", @businessType = " + _dao.FilterString(kyc.businessType);
sql += ", @mobile = " + _dao.FilterString(kyc.mobile);
sql += ", @additionalAddress = N" + _dao.FilterString(kyc.additionalAddress);
//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);
@ -1014,17 +1015,19 @@ namespace Repository.Mobile
discountPercent = sRow["discountPercent"].ToString(),
tranStatus = sRow["tranStatus"].ToString(),
rewardPoints = sRow["rewardPoints"].ToString(),
SenderFullName = "a",
ColorIcon = GetColor(sRow["PayStatus"].ToString()),
SenderFullName = sRow["senderName"].ToString(),
PaymentDetails = new PaymentDetails()
{
AccountName = "IME LONDON",
AccountNo = "00000151",
AccountNo = "00000042",
BankName = "Clear bank",
Instruction = "Payment Reference Should be your name . Should you require any assitance, IME team is happy to help. You can track from Home ",
TotalToPay = "XXX",
Reference = "asdad",
SortCode = "asdasdasd"
TotalToPay = GetStatic.ShowDecimal(sRow["cAmt"].ToString()) + " " + sRow["collCurr"].ToString(),
Reference = sRow["senderName"].ToString(),
SortCode = " 04-08-42"
}
};
double discountval = 0, discountpercent = 0;
@ -1045,6 +1048,29 @@ namespace Repository.Mobile
return null;
}
private string GetColor(string status)
{
if (status.Equals("AWAITING PAYMENT") || status.Equals("PENDING"))
{
return "Blue";
}
else if (status.Equals("PROCESSING"))
{
return "Brown";
}
else if (status.Equals("PAID"))
{
return "Green";
}
else if (status.Equals("CANCELLED"))
{
return "Red";
}
else
return "Blue";
}
public JsonRxResponse GetNotificationList(string customerId)
{
var lang = Convert.ToString(CallContext.GetData(Constants.Language));
@ -1292,7 +1318,7 @@ namespace Repository.Mobile
var lang = Convert.ToString(CallContext.GetData(Constants.Language));
var sql = "EXEC JsonRx_Proc_UserRegistration_V2 @flag='sign-up-v2-new-cust' ";
sql += ", @idNumber = " + _dao.FilterString(newUserRegister.ResidenceCardNumber);
sql += ", @idNumber = " + _dao.FilterString("");
sql += ", @nativeCountry = " + _dao.FilterString(newUserRegister.Nationality);
sql += ", @referralCode = " + _dao.FilterString(newUserRegister.ReferralCode);
sql += ", @username = " + _dao.FilterString(newUserRegister.UserId);
@ -1311,8 +1337,8 @@ 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);
if (!string.IsNullOrEmpty(newUserRegister.FullName))
{
var str = newUserRegister.FullName.Trim().Split(' ');
@ -1637,32 +1663,86 @@ namespace Repository.Mobile
WalletStatementResponse walletResponse = null;
List<WalletStatementResponse> lstWalletResponse = new List<WalletStatementResponse>();
JsonRxResponse jsonRx = new JsonRxResponse();
var sql = "EXEC mobile_proc_WalletStatement";
sql += " @UserID = " + _dao.FilterString(userId);
sql += ", @startDate = " + _dao.FilterString(search.FromDate);
sql += ", @endDate = " + _dao.FilterString(search.ToDate);
var sql = "Exec mobile_proc_TranHistory @flag='tran-history'";
sql += ", @userId=" + _dao.FilterString(userId);
sql += ", @fromDate=" + _dao.FilterString(search.FromDate);
sql += ", @toDate=" + _dao.FilterString(search.ToDate);
Log.DebugFormat("GetWalletStatement | SQL : {0}", sql);
var dt = _dao.ExecuteDataTable(sql);
if (dt == null || dt.Rows.Count == 0)
{
return null;
}
foreach (DataRow dr in dt.Rows)
{
walletResponse = new WalletStatementResponse()
WalletStatementResponse tranHistoryResponse = new WalletStatementResponse()
{
TransactionDate = Convert.ToString(dr["TrnDate"]),
Particular = Convert.ToString(dr["Tran_rmks"]),
WalletIn = Convert.ToString(dr["CrTotal"]),
WalletOut = Convert.ToString(dr["DRTotal"]),
ClosingAmount = Convert.ToString(dr["end_clr_balance"]),
RowId = Convert.ToInt32(dr["ID"].ToString())
TranId = Convert.ToString(dr["tranId"]),
ControlNo = Convert.ToString(dr["controlNo"]),
CollAmt = Convert.ToString(dr["collAmount"]),
PayoutAmt = Utilities.ShowDecimal(Convert.ToString(dr["payoutAmt"])),
PCurr = Convert.ToString(dr["pCurr"]),
CollCurr = Convert.ToString(dr["collCurr"]),
PayStatus = Convert.ToString(dr["payStatus"]),
PayoutMode = Convert.ToString(dr["payoutMode"]),
TransactionDate = Convert.ToString(dr["sendDate"]),
ReceiverName= Convert.ToString(dr["ReceiverName"]),
PayoutCountry = Convert.ToString(dr["PayoutCountry"]),
ColorCode = GetColorCode(dr["payStatus"].ToString()),
TextCode = GetTextCode(dr["payStatus"].ToString()),
};
lstWalletResponse.Add(walletResponse);
lstWalletResponse.Add(tranHistoryResponse);
}
return lstWalletResponse;
}
private string GetColorCode(string status)
{
if (status.Equals("AWAITING PAYMENT") || status.Equals("PENDING"))
{
return "#514e82";
}
else if (status.Equals("PROCESSING"))
{
return "#AF804F";
}
else if (status.Equals("PAID"))
{
return "#008000";
}
else if (status.Equals("CANCELLED"))
{
return "#FF0000";
}
else
return "#514e82";
}
private string GetTextCode(string status)
{
if (status.Equals("AWAITING PAYMENT") || status.Equals("PENDING"))
{
return "#964B00";
}
else if (status.Equals("PROCESSING"))
{
return "##262262";
}
else if (status.Equals("PAID"))
{
return "#262262";
}
else if (status.Equals("CANCELLED"))
{
return "#262262";
}
else
return "#FFFFFF";
}
public JsonRxResponse ChangePassword(ChangePassword changePwd)
{

3
Repository/MobileV2/IMobileV2Repo.cs

@ -1,5 +1,6 @@
using Common;
using Common.Model;
using Common.Model.MobileV2;
using System;
using System.Collections.Generic;
using System.Data;
@ -14,7 +15,9 @@ namespace Repository.MobileV2
JsonRxResponse GetReceiverInformationV2(DateFilterParams search,string customerId, string countryid);
JsonRxResponse SaveProfile(string username, string url, string fileName, string fileType);
DataRow GetMembershipId(string userId);
DataRow GetProfileDetails(string customerId);
DataRow GetResidenceType(string customerId);
JsonRxResponse SaveKycSettings(KycOption kycOption);
JsonRxResponse UpdateCustomerProfile(CustomerDetailV2 req);
}
}

154
Repository/MobileV2/MobileV2Repo.cs

@ -7,6 +7,7 @@ using log4net;
using System;
using System.Collections.Generic;
using System.Data;
using System.Globalization;
using System.Linq;
using System.Runtime.Remoting.Messaging;
using System.Text;
@ -32,14 +33,14 @@ namespace Repository.MobileV2
sql += " @flag = " + _dao.FilterString("receiver-info");
sql += ", @customerId = " + _dao.FilterString(customerId);
sql += ", @countryId = " + _dao.FilterString(countryid);
var dataSet = _dao.ExecuteDataset(sql);
List<ReceiverV2> rim = new List<ReceiverV2>();
List<ReceiverV2> receiverInfoModels = new List<ReceiverV2>();
var map = Utilities.GetLanguageMapping(RESPONSE_MSG.GET_RECEIVER_INFORMATION_FAIL_1.ToString(), lang);
if (dataSet.Tables[0].Rows.Count > 0 )
if (dataSet.Tables[0].Rows.Count > 0)
{
foreach (DataRow row in dataSet.Tables[0].Rows)
@ -60,10 +61,24 @@ namespace Repository.MobileV2
z.PaymentMethods = new List<ReceiverPaymentMethod>();
//var r = new ReceiverV2() { fullName = z.fullName, mobile = z.mobile, address = z.address, idNumber = z.idNumber, PaymentMethods = new List<ReceiverPaymentMethod>() };
z.PaymentMethods = receiverInfoModels.Where(a => a.fullName == z.fullName & a.mobile == z.mobile)
.Select(s => new ReceiverPaymentMethod() { receiverId = s.receiverId,
id = s.paymentMethod.id, currency = s.paymentMethod.currency, localizedName = s.paymentMethod.localizedName,
name = s.paymentMethod.name, agent = s.agent , isForceUpdate = s.isForceUpdate, isPartnerChanged= s.isPartnerChanged, ForceUpdateMsg= s.ForceUpdateMsg
, hasVerifiedOTP= s.hasVerifiedOTP, nativeCountry= s.nativeCountry, nativeCountryCode= s.nativeCountryCode, nativeCountryId= s.nativeCountryId, payoutPartner= s.payoutPartner}).ToList();
.Select(s => new ReceiverPaymentMethod()
{
receiverId = s.receiverId,
id = s.paymentMethod.id,
currency = s.paymentMethod.currency,
localizedName = s.paymentMethod.localizedName,
name = s.paymentMethod.name,
agent = s.agent,
isForceUpdate = s.isForceUpdate,
isPartnerChanged = s.isPartnerChanged,
ForceUpdateMsg = s.ForceUpdateMsg
,
hasVerifiedOTP = s.hasVerifiedOTP,
nativeCountry = s.nativeCountry,
nativeCountryCode = s.nativeCountryCode,
nativeCountryId = s.nativeCountryId,
payoutPartner = s.payoutPartner
}).ToList();
rim.Add(z);
@ -81,11 +96,30 @@ namespace Repository.MobileV2
if (search != null)
{
CultureInfo enUS = new CultureInfo("en-US");
if (!string.IsNullOrEmpty(search.FromDate))
sql1 += ", @fromDate=" + _dao.FilterString(search.FromDate);
{
DateTime FromDate;
if (DateTime.TryParseExact(search.FromDate,"dd/MM/yyyy", enUS, DateTimeStyles.AdjustToUniversal, out FromDate))
{
sql1 += ", @fromDate=" + _dao.FilterString(FromDate.ToString("yyyy-MM-dd"));
}
else
sql1 += ", @fromDate=" + _dao.FilterString(search.FromDate);
}
if (!string.IsNullOrEmpty(search.ToDate))
sql1 += ", @toDate=" + _dao.FilterString(search.ToDate);
{
DateTime ToDate;
if (DateTime.TryParseExact(search.ToDate, "dd/MM/yyyy", enUS, DateTimeStyles.AdjustToUniversal, out ToDate))
{
sql1 += ", @toDate=" + _dao.FilterString(ToDate.ToString("yyyy-MM-dd"));
}
else
sql1 += ", @toDate=" + _dao.FilterString(search.ToDate);
}
if (!string.IsNullOrEmpty(search.Page))
sql1 += ", @pageNumber=" + _dao.FilterString(search.Page);
@ -120,7 +154,10 @@ namespace Repository.MobileV2
PayoutMode = Convert.ToString(dr["payoutMode"]),
SendDate = Convert.ToString(dr["sendDate"]),
PaidDate = Convert.ToString(dr["paidDate"]),
DisplayActions = dr["DisplayActions"].ToString()
DisplayActions = dr["DisplayActions"].ToString(),
ColorIcon = GetColor(dr["payStatus"].ToString()),
ColorCode = GetColorCode(dr["payStatus"].ToString()),
TextCode= GetTextCode(dr["payStatus"].ToString()),
// PayoutAgent = Convert.ToString(dr["PayoutAgent"]),
};
myTransferDto.RecentTransactions.Add(tranHistoryResponse);
@ -148,6 +185,75 @@ namespace Repository.MobileV2
}
private string GetColor(string status)
{
if (status.Equals("AWAITING PAYMENT") || status.Equals("PENDING"))
{
return "Blue";
}
else if (status.Equals("PROCESSING"))
{
return "Brown";
}
else if (status.Equals("PAID"))
{
return "Green";
}
else if (status.Equals("CANCELLED"))
{
return "Red";
}
else
return "Blue";
}
private string GetColorCode(string status)
{
if (status.Equals("AWAITING PAYMENT") || status.Equals("PENDING"))
{
return "#514e82";
}
else if (status.Equals("PROCESSING"))
{
return "#AF804F";
}
else if (status.Equals("PAID"))
{
return "#008000";
}
else if (status.Equals("CANCELLED"))
{
return "#FF0000";
}
else
return "#514e82";
// return "#FF0000";
}
private string GetTextCode(string status)
{
if (status.Equals("AWAITING PAYMENT") || status.Equals("PENDING"))
{
return "#FFFFFF";
}
else if (status.Equals("PROCESSING"))
{
return "#262262";
}
else if (status.Equals("PAID"))
{
return "#FFFFFF";
}
else if (status.Equals("CANCELLED"))
{
return "#FFFFFF";
}
else
return "#FFFFFF";
}
private ReceiverV2 GetReceiverInfoModel(DataRow row)
{
ReceiverInfoBranch b = null;
@ -323,6 +429,16 @@ namespace Repository.MobileV2
return _dao.ExecuteDataRow(sql);
}
public DataRow GetProfileDetails(string customerId)
{
var sql = "EXEC mobile_proc_customerMaster @flag= 'get-profile-details'";
sql += ", @email = " + _dao.FilterString(customerId);
Log.DebugFormat("GetProfileDetails | SQL:{0}", sql);
return _dao.ExecuteDataRow(sql);
}
public JsonRxResponse SaveKycSettings(KycOption kycOption)
{
var sql = "EXEC JsonRx_Proc_UserRegistration @flag='save-kyc-option'";
@ -350,5 +466,25 @@ namespace Repository.MobileV2
return _dao.ExecuteDataRow(sql);
}
public JsonRxResponse UpdateCustomerProfile(CustomerDetailV2 req)
{
var sql = "EXEC mobile_proc_online_customerMaster_V1 @flag= 'update-address'";
sql += ", @customerId = " + _dao.FilterString(req.UserId);
sql += ", @postalCode = " + _dao.FilterString(req.PostalCode);
sql += ", @address1 = " + _dao.FilterString(req.Address1);
sql += ", @address2 = " + _dao.FilterString(req.Address2);
Log.DebugFormat("UpdateProfile | SQL:{0}", sql);
var _dbRes = _dao.ParseDbResult(sql);
return new JsonRxResponse
{
ErrorCode = _dbRes.ResponseCode,
Msg = _dbRes.Msg,
Extra = _dbRes.Id
};
}
}
}
Loading…
Cancel
Save