Browse Source

Add new methods

DownloadStatement
Update Profile
Mobile-pdf
shakun 11 months ago
parent
commit
ca9d4f00bc
  1. 1
      Business/Business.csproj
  2. 74
      Business/Mobile/MobileServices.cs
  3. 9
      Business/MobileV2/IMobileV2Business.cs
  4. 28
      Business/MobileV2/MobileV2Business.cs
  5. 19
      Business/SendMoney/SendMoneyBusiness.cs
  6. 64
      Business/Utility/AesOperation.cs
  7. 2
      Common/APIJsonResponse.cs
  8. 9
      Common/Model/JsonRxResponse.cs
  9. 3
      Common/Model/TPSendMoney/TpSendMoney.cs
  10. 5
      Common/Model/TranHistoryResponse.cs
  11. 2
      Common/Model/TransactionResponse.cs
  12. 23
      Common/Model/WalletStatementResponse.cs
  13. 1
      JsonRx/Api/CustomerController.cs
  14. 33
      JsonRx/ApiV3/MobileV3Controller.cs
  15. 17
      JsonRx/AuthFilter/TokenAuthenticationAttribute.cs
  16. 7
      JsonRx/Helper/Util.cs
  17. 4
      JsonRx/Web.config
  18. 117
      Repository/Mobile/MobileServicesRepo.cs
  19. 2
      Repository/MobileV2/IMobileV2Repo.cs
  20. 144
      Repository/MobileV2/MobileV2Repo.cs

1
Business/Business.csproj

@ -125,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>

74
Business/Mobile/MobileServices.cs

@ -1014,26 +1014,29 @@ namespace Business.Mobile
// kyc.mobile = jsonRxMobile.Extra;
//}
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(kyc.type.Equals("0"))
{
if (string.IsNullOrEmpty(kyc.otherOccupation))
if (string.IsNullOrEmpty(kyc.otherOccupation) && string.IsNullOrEmpty(kyc.occupation))
{
enumString = RESPONSE_MSG.VALIDATE_FORM_9.ToString();
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;
}
}
}
//if (string.IsNullOrEmpty(kyc.idNumber))
//{
@ -2030,7 +2033,6 @@ namespace Business.Mobile
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 });
@ -2125,56 +2127,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;
}

9
Business/MobileV2/IMobileV2Business.cs

@ -14,8 +14,7 @@ namespace Business.MobileV2
JsonRxResponse GetReceiverInformationV2(DateFilterParams search, string customerId, string countryId);
JsonRxResponse RefreshDashboardInformationV2(UserModel model);
CustomerDetailV2 GetCustomerProfile(string userId);
JsonRxResponse SaveCustomerProfile(CustomerDetailV2 profileV2);
JsonRxResponse CustomerProfile(CustomerProfileV2 profileV2);
@ -23,5 +22,11 @@ namespace Business.MobileV2
JsonRxResponse SaveKycSettings(KycOption kycRequest);
JsonRxResponse DownLoadStatement(DateFilterParams search, string userId);
JsonRxResponse UpdateCustomerProfile(CustomerDetailV2 profileV2);
//JsonRxResponse UpdateProfile(CustomerDetailV2 req);
}
}

28
Business/MobileV2/MobileV2Business.cs

@ -136,13 +136,6 @@ namespace Business.Mobile
return v2;
}
public JsonRxResponse SaveCustomerProfile(CustomerDetailV2 profileV2)
{
JsonRxResponse jsonRx = new JsonRxResponse() { ErrorCode ="0", Msg = "Success" };
return jsonRx;
}
public JsonRxResponse CustomerProfile(CustomerProfileV2 profileV2)
{
@ -318,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;
}
}
}

19
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()
};
@ -509,7 +513,8 @@ namespace Business.SendMoney
Data = result.Data,
Extra = result.Extra,
Extra2 = result.Extra2,
Extra3 = result.Extra3
Extra3 = result.Extra3,
Extra4 = result.Extra4
};
if (response.ErrorCode.Equals("0"))
@ -517,14 +522,16 @@ namespace Business.SendMoney
//var randomPassword = PasswordGenerator.GenerateRandomPassword(new PasswordGenerator.PasswordOptions()
//{ RequireDigit = true, RequiredLength = 10, RequiredUniqueChars = 2, RequireLowercase = true, RequireNonAlphanumeric = true, RequireUppercase = true });
string eID = HttpUtility.UrlEncode( AesOperation.EncryptString(ConfigurationManager.AppSettings["encryptKey"].ToString(), result.Id));
string eCn = HttpUtility.UrlEncode(AesOperation.EncryptString(ConfigurationManager.AppSettings["encryptKey"].ToString(), result.Extra));
Gateway gateway = new Gateway()
{
Code = result.Extra2,
IsRedirect = result.Extra3.Equals("Y") ? true : false,
//Token = randomPassword,
RedirectURL = $"https:////uat.imelondon.co.uk:1081/payment/STPaymentCustomerRedirect.aspx?id={result.Id}&ref={Guid.NewGuid()}&token=",
CheckSuccessURL = "https://uat.imelondon.co.uk:1081/payment/STPaymentSuccess.aspx",
CheckFailURL = "https://uat.imelondon.co.uk:1081/payment/STPaymentFail.aspx"
RedirectURL = result.Extra3.Equals("Y") ? $"https:////uat.imelondon.co.uk:1081/payment/STPaymentCustomerRedirect.aspx?id={eID}&ref={response.Extra4}&cn={response.Extra}&token=" : "",
CheckSuccessURL = result.Extra3.Equals("Y") ? "https://uat.imelondon.co.uk:1081/payment/STPaymentSuccess.aspx" : "",
CheckFailURL = result.Extra3.Equals("Y") ? "https://uat.imelondon.co.uk:1081/payment/STPaymentFail.aspx" : ""
};
response.Data = gateway;
@ -533,9 +540,7 @@ namespace Business.SendMoney
try
{
UserDetails userDetails = _requestServices.GetUserDetails(email);
List<Notify.Mapping> bodyMappings = new List<Notify.Mapping>();
bodyMappings.Add(new Notify.Mapping() { SValue = "CustomerName", SText = userDetails.FullName });
SendNotificationRequest request = new SendNotificationRequest()

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();
}
}
}
}
}
}
}

2
Common/APIJsonResponse.cs

@ -10,6 +10,8 @@
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 = "")

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; }

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; }
}
}

1
JsonRx/Api/CustomerController.cs

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

33
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))
@ -221,8 +221,35 @@ namespace JsonRx.ApiV3
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);

7
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,7 +242,7 @@ 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;
}
@ -283,7 +285,10 @@ namespace JsonRx.Helper
}
return ci.TextInfo.ToTitleCase(str);
}
}
public enum TitleCase
{

4
JsonRx/Web.config

@ -96,6 +96,10 @@
<!--postcodeanywhere-->
<add key="loqatekey" value="CB93-HB26-JC73-WH89" />
<!--TrustPayment-->
<add key="sitereference" value="test_subhidauk71992" />
<add key="encryptKey" value="39d37440c89b668fc422fbadcd541bb8" />
</appSettings>
<!--

117
Repository/Mobile/MobileServicesRepo.cs

@ -1014,17 +1014,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",
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["tAmt"].ToString()) + " " + sRow["collCurr"].ToString(),
Reference = sRow["senderName"].ToString(),
SortCode = " 04-06-93"
}
};
double discountval = 0, discountpercent = 0;
@ -1045,6 +1047,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));
@ -1311,8 +1336,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 +1662,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)
{

2
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;
@ -17,5 +18,6 @@ namespace Repository.MobileV2
DataRow GetProfileDetails(string customerId);
DataRow GetResidenceType(string customerId);
JsonRxResponse SaveKycSettings(KycOption kycOption);
JsonRxResponse UpdateCustomerProfile(CustomerDetailV2 req);
}
}

144
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;
@ -360,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