|
|
@@ -15,6 +15,10 @@ using System.Web;
|
|
|
using System.Net;
|
|
|
using NEducation.Code;
|
|
|
using NEducation.Content.Texts;
|
|
|
+using System.Web.SessionState;
|
|
|
+using Microsoft.EntityFrameworkCore.Metadata.Internal;
|
|
|
+using Newtonsoft.Json;
|
|
|
+using Devart.Common;
|
|
|
|
|
|
namespace NEducation.Controllers
|
|
|
{
|
|
|
@@ -35,9 +39,7 @@ namespace NEducation.Controllers
|
|
|
String wsUser;
|
|
|
String wsPass;
|
|
|
|
|
|
- //static public String wsUrl = "http://paymentgateway.metfone.com.kh/MPS/";
|
|
|
- //static public String wsUrlRes = "http://happycall.fun/Wap/ResponseFromWap";
|
|
|
- ////static public String wsUrlRes = "https://localhost:44310/Wap/ResponseFromWap";
|
|
|
+
|
|
|
static private String PRO = "GTS";
|
|
|
static private String SER = "GTS_MEDU";
|
|
|
//static private String SUB = "GTS_HappyCalling_Daily";
|
|
|
@@ -47,8 +49,15 @@ namespace NEducation.Controllers
|
|
|
|
|
|
GenKeyWs.WsGenKeyClient wsClient = new GenKeyWs.WsGenKeyClient();
|
|
|
|
|
|
-
|
|
|
- public async Task<ActionResult> ResponseFromWapAsync(string DATA, string SIG)
|
|
|
+ private void CreateAuthToken()
|
|
|
+ {
|
|
|
+ // create session authen
|
|
|
+ SessionIDManager manager = new SessionIDManager();
|
|
|
+ string newSessionId = manager.CreateSessionID(System.Web.HttpContext.Current);
|
|
|
+ Response.Cookies["AuthToken"].Value = newSessionId;
|
|
|
+ Session["AuthToken"] = newSessionId;
|
|
|
+ }
|
|
|
+ public async Task<ActionResult> ResponseFromWap(string DATA, string SIG)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
@@ -60,7 +69,7 @@ namespace NEducation.Controllers
|
|
|
var sigGet = Uri.EscapeDataString(SIG).ToString();
|
|
|
var data = "DATA=" + dataGet + "&SIG=" + sigGet;
|
|
|
|
|
|
- log.Debug("data " + data);
|
|
|
+ log.Info("data_ResponseFromWap " + data);
|
|
|
|
|
|
// Load configuration settings
|
|
|
String wsUrlRes = ConfigurationManager.AppSettings["domainRes"];
|
|
|
@@ -71,7 +80,7 @@ namespace NEducation.Controllers
|
|
|
String packNameCannel_ToBe = ConfigurationManager.AppSettings["packNameCannel_ToBe"];
|
|
|
String DIR = ConfigurationManager.AppSettings["directoryPath"];
|
|
|
|
|
|
- log.Debug("DIR_Wap " + DIR);
|
|
|
+ log.Info("DIR_Wap " + DIR);
|
|
|
|
|
|
if (packageName == null)
|
|
|
{
|
|
|
@@ -83,27 +92,27 @@ namespace NEducation.Controllers
|
|
|
// Decrypt the key
|
|
|
GenKeyWs.wsDecryptKeyResponse decrypt = await wsClient.wsDecryptKeyAsync(null, null, DIR + packageName.ToUpper() + "\\", wsUrl, data);
|
|
|
|
|
|
- log.Debug("errorCode " + decrypt.@return.errorCode);
|
|
|
- log.Debug("decrypt " + decrypt.@return.descrypt);
|
|
|
+ log.Info("errorCode " + decrypt.@return.errorCode);
|
|
|
+ log.Info("decrypt " + decrypt.@return.descrypt);
|
|
|
|
|
|
// Log details if available
|
|
|
if (decrypt.@return.mpsResponse != null)
|
|
|
{
|
|
|
- log.Debug("CMD " + decrypt.@return.mpsResponse.CMD);
|
|
|
- log.Debug("MOBILE " + decrypt.@return.mpsResponse.MOBILE);
|
|
|
- log.Debug("PRICE " + decrypt.@return.mpsResponse.PRICE);
|
|
|
- log.Debug("RES " + decrypt.@return.mpsResponse.RES);
|
|
|
- log.Debug("REQ " + decrypt.@return.mpsResponse.REQ);
|
|
|
- log.Debug("SOURCE " + decrypt.@return.mpsResponse.SOURCE);
|
|
|
- log.Debug("STATUS " + decrypt.@return.mpsResponse.STATUS);
|
|
|
- log.Debug("SUB_END_DATE " + decrypt.@return.mpsResponse.SUB_END_DATE);
|
|
|
- log.Debug("SUB_NEW " + decrypt.@return.mpsResponse.SUB_NEW);
|
|
|
- log.Debug("SUB_SERVICE " + decrypt.@return.mpsResponse.SUB_SERVICE);
|
|
|
- log.Debug("SUB_START_DATE " + decrypt.@return.mpsResponse.SUB_START_DATE);
|
|
|
+ log.Info("CMD " + decrypt.@return.mpsResponse.CMD);
|
|
|
+ log.Info("MOBILE " + decrypt.@return.mpsResponse.MOBILE);
|
|
|
+ log.Info("PRICE " + decrypt.@return.mpsResponse.PRICE);
|
|
|
+ log.Info("RES " + decrypt.@return.mpsResponse.RES);
|
|
|
+ log.Info("REQ " + decrypt.@return.mpsResponse.REQ);
|
|
|
+ log.Info("SOURCE " + decrypt.@return.mpsResponse.SOURCE);
|
|
|
+ log.Info("STATUS " + decrypt.@return.mpsResponse.STATUS);
|
|
|
+ log.Info("SUB_END_DATE " + decrypt.@return.mpsResponse.SUB_END_DATE);
|
|
|
+ log.Info("SUB_NEW " + decrypt.@return.mpsResponse.SUB_NEW);
|
|
|
+ log.Info("SUB_SERVICE " + decrypt.@return.mpsResponse.SUB_SERVICE);
|
|
|
+ log.Info("SUB_START_DATE " + decrypt.@return.mpsResponse.SUB_START_DATE);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- log.Debug("mpsResponse null ");
|
|
|
+ log.Info("mpsResponse null ");
|
|
|
}
|
|
|
|
|
|
if (decrypt.@return.errorCode == UtilsController.WapConstant.SUCCESS)
|
|
|
@@ -124,15 +133,16 @@ namespace NEducation.Controllers
|
|
|
// Perform registration request
|
|
|
UserRequest userRequest = new UserRequest
|
|
|
{
|
|
|
- users = decrypt.@return.mpsResponse.MOBILE,
|
|
|
- msisdn = decrypt.@return.mpsResponse.MOBILE,
|
|
|
+ users = phoneNumber,
|
|
|
+ msisdn = phoneNumber,
|
|
|
subServiceCode = packNameREGISTER_ToBe + "|" + decrypt.@return.mpsResponse.PRICE,
|
|
|
requestId = "-1",
|
|
|
otp = decrypt.@return.mpsResponse.RES,
|
|
|
serviceId = "3"
|
|
|
};
|
|
|
-
|
|
|
+ log.Info("MpsRequest_web: " + JsonConvert.SerializeObject(userRequest));
|
|
|
String rs = UtilsController.SendPost(userRequest, Session.SessionID, UtilsController.WsType.MpsRequest);
|
|
|
+ log.Info("MpsResult_web: " + rs);
|
|
|
UserActionResult ress = new UserActionResult(rs);
|
|
|
|
|
|
if (ress.responseCode == UtilsController.Constant.SUCCESS)
|
|
|
@@ -143,6 +153,90 @@ namespace NEducation.Controllers
|
|
|
Session["package"] = packNameCannel;
|
|
|
Session["CHARGE_ACTION"] = UtilsController.Constant.REGISTER;
|
|
|
Session["CHARGE_DATA"] = userRequest;
|
|
|
+ if (decrypt.@return.mpsResponse.RES == "0")
|
|
|
+ {
|
|
|
+ log.Info("decrypt.@return.mpsResponse.RES " + decrypt.@return.mpsResponse.RES);
|
|
|
+ // auto login
|
|
|
+ // reload user info
|
|
|
+ HttpContext.Session.Remove("regInfos");
|
|
|
+ Session["msisdnDetect"] = phoneNumber;
|
|
|
+ // dang ky tren app
|
|
|
+ Session["WHICHDEVICE"] = UtilsController.Constant.REGISTER_ON_WEB;
|
|
|
+
|
|
|
+
|
|
|
+ // check user has account
|
|
|
+ GetUserProfileReq req = new GetUserProfileReq();
|
|
|
+ req.users = phoneNumber;
|
|
|
+
|
|
|
+ String rss = UtilsController.SendPost(req, System.Web.HttpContext.Current.Session.SessionID, UtilsController.WsType.UsersGetProfile);
|
|
|
+ UserProfile profile = new UserProfile(rs);
|
|
|
+ if (profile.id != null)
|
|
|
+ {
|
|
|
+ System.Web.HttpContext.Current.Session["profile"] = profile;
|
|
|
+
|
|
|
+ // create new auth
|
|
|
+ CreateAuthToken();
|
|
|
+ String sessionId = Session.SessionID;
|
|
|
+ // login success --> store session
|
|
|
+ Session["msisdn"] = phoneNumber;
|
|
|
+ // get sub
|
|
|
+ UtilsController.ReloadSubInfo();
|
|
|
+
|
|
|
+ // all info of user was loaded from server
|
|
|
+ //UserProfile profile = Session["profile"] as UserProfile;
|
|
|
+ String typeLanguage = Session["typeLanguage"] as String;
|
|
|
+ return Redirect("/Home/Index");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // Create a free account for the user
|
|
|
+ UserRequest userRequests = new UserRequest
|
|
|
+ {
|
|
|
+ users = phoneNumber,
|
|
|
+ msisdn = phoneNumber,
|
|
|
+ command = "REGIST",
|
|
|
+ channel = "WEB"
|
|
|
+ };
|
|
|
+
|
|
|
+ string rsRegister = UtilsController.SendPost(userRequest, Session.SessionID, UtilsController.WsType.UsersRegister);
|
|
|
+ UserActionResult resRegister = new UserActionResult(rsRegister);
|
|
|
+ Session["isSub"] = "false";
|
|
|
+
|
|
|
+ if (resRegister.status == UtilsController.Constant.SUCCESS)
|
|
|
+ {
|
|
|
+ // Load profile
|
|
|
+ GetUserProfileReq reqProfile = new GetUserProfileReq { users = phoneNumber };
|
|
|
+ string rsProfile = UtilsController.SendPost(reqProfile, Session.SessionID, UtilsController.WsType.UsersGetProfile);
|
|
|
+ UserProfile profileGet = new UserProfile(rsProfile);
|
|
|
+
|
|
|
+ if (profileGet.id != null)
|
|
|
+ {
|
|
|
+ Session["profile"] = profileGet;
|
|
|
+
|
|
|
+ UserInfoRequest reqStatus = new UserInfoRequest { users = phoneNumber };
|
|
|
+ string rsStatus = UtilsController.SendPost(reqStatus, Session.SessionID, UtilsController.WsType.UsersCheckStatus);
|
|
|
+ UserActionResult resStatus = new UserActionResult(rsStatus);
|
|
|
+
|
|
|
+ if (resStatus.status == UtilsController.Constant.SUCCESS)
|
|
|
+ {
|
|
|
+ UserInfo userInfo = new UserInfo(rsStatus);
|
|
|
+ Session["userInfo"] = userInfo;
|
|
|
+ // Create new auth
|
|
|
+ CreateAuthToken();
|
|
|
+ Session["msisdn"] = phoneNumber;
|
|
|
+
|
|
|
+ // Reload user info
|
|
|
+ UtilsController.ReloadSubInfo();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return Redirect("/Home/Index");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return Redirect("/Home/Index");
|
|
|
+ }
|
|
|
}
|
|
|
else if (ress.status == "2")
|
|
|
{
|
|
|
@@ -152,7 +246,7 @@ namespace NEducation.Controllers
|
|
|
error_content = UtilsController.GetErrorCodeCharging(ress.status)
|
|
|
});
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
return Json(new
|
|
|
{
|
|
|
error_code = ress.responseCode,
|
|
|
@@ -208,6 +302,31 @@ namespace NEducation.Controllers
|
|
|
Session["package"] = packageName;
|
|
|
Session["CHARGE_ACTION"] = UtilsController.Constant.REGISTER;
|
|
|
Session["CHARGE_DATA"] = userRequest;
|
|
|
+ // Load profile
|
|
|
+ GetUserProfileReq reqProfile = new GetUserProfileReq { users = phoneNumber };
|
|
|
+ string rsProfile = UtilsController.SendPost(reqProfile, Session.SessionID, UtilsController.WsType.UsersGetProfile);
|
|
|
+ UserProfile profileGet = new UserProfile(rsProfile);
|
|
|
+
|
|
|
+ if (profileGet.id != null)
|
|
|
+ {
|
|
|
+ Session["profile"] = profileGet;
|
|
|
+
|
|
|
+ UserInfoRequest reqStatus = new UserInfoRequest { users = phoneNumber };
|
|
|
+ string rsStatus = UtilsController.SendPost(reqStatus, Session.SessionID, UtilsController.WsType.UsersCheckStatus);
|
|
|
+ UserActionResult resStatus = new UserActionResult(rsStatus);
|
|
|
+
|
|
|
+ if (resStatus.status == UtilsController.Constant.SUCCESS)
|
|
|
+ {
|
|
|
+ UserInfo userInfo = new UserInfo(rsStatus);
|
|
|
+ Session["userInfo"] = userInfo;
|
|
|
+ // Create new auth
|
|
|
+ CreateAuthToken();
|
|
|
+ Session["msisdn"] = phoneNumber;
|
|
|
+
|
|
|
+ // Reload user info
|
|
|
+ UtilsController.ReloadSubInfo();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
else if (ress.status == "2")
|
|
|
{
|
|
|
@@ -316,7 +435,7 @@ namespace NEducation.Controllers
|
|
|
GenKeyWs.wsEncryptKeyResponse makeUrl = await wsClient.wsEncryptKeyAsync(null, null, DIR, wsUrl + "mobile.html?", PRO, SER, mpsparams.SUB,
|
|
|
mpsparams.CMD, "WAP", mpsparams.CATE, mpsparams.ITEM, SUP_CP, CONT, mpsparams.PRICE, mpsparams.MOBILE, TYPE);
|
|
|
|
|
|
- log.Debug("UserDetecting build req: " + makeUrl.@return.enscrypt);
|
|
|
+ log.Info("UserDetecting build req: " + makeUrl.@return.enscrypt);
|
|
|
//HttpContext.Session.SetComplexData("mps-params", mpsparams);
|
|
|
|
|
|
return makeUrl.@return;
|
|
|
@@ -327,15 +446,15 @@ namespace NEducation.Controllers
|
|
|
GenKeyWs.response response = new GenKeyWs.response();
|
|
|
response.errorCode = UtilsController.WapConstant.FAILURE;
|
|
|
String DIR = ConfigurationManager.AppSettings["directoryPath"] + mpsparams.SUB.ToUpper() + "/";
|
|
|
- log.Debug("UserRegistering build DIR: " + DIR);
|
|
|
+ log.Info("UserRegistering build DIR: " + DIR);
|
|
|
String wsUrl = ConfigurationManager.AppSettings["paymentUrl"];
|
|
|
//String DIR = configuration.GetSection("directoryPath").Value + mpsparams.SUB.ToUpper() + "/";
|
|
|
//String wsUrl = configuration.GetSection("paymentUrl").Value;
|
|
|
- log.Debug("UserRegistering makeUrl:");
|
|
|
+ log.Info("UserRegistering makeUrl:");
|
|
|
GenKeyWs.wsEncryptKeyResponse makeUrl = await wsClient.wsEncryptKeyAsync(null, null, DIR, wsUrl + "charge.html?", PRO, SER, mpsparams.SUB,
|
|
|
mpsparams.CMD, "WAP", mpsparams.CATE, mpsparams.ITEM, SUP_CP, CONT, mpsparams.PRICE, mpsparams.MOBILE, TYPE);
|
|
|
|
|
|
- log.Debug("UserRegistering build req: " + makeUrl.@return.enscrypt);
|
|
|
+ log.Info("UserRegistering build req: " + makeUrl.@return.enscrypt);
|
|
|
// save session
|
|
|
//HttpContext.Session.SetComplexData("mps-params", mpsparams);
|
|
|
|
|
|
@@ -355,7 +474,7 @@ namespace NEducation.Controllers
|
|
|
GenKeyWs.wsEncryptKeyResponse makeUrl = await wsClient.wsEncryptKeyAsync(null, null, DIR, wsUrl + "charge.html?", PRO, SER, mpsparams.SUB,
|
|
|
mpsparams.CMD, "WAP", mpsparams.CATE, mpsparams.ITEM, SUP_CP, CONT, mpsparams.PRICE, mpsparams.MOBILE, TYPE);
|
|
|
|
|
|
- log.Debug("UserCharging build req: " + makeUrl.@return.enscrypt);
|
|
|
+ log.Info("UserCharging build req: " + makeUrl.@return.enscrypt);
|
|
|
//HttpContext.Session.SetComplexData("mps-params", mpsparams);
|
|
|
|
|
|
return makeUrl.@return;
|
|
|
@@ -374,7 +493,7 @@ namespace NEducation.Controllers
|
|
|
GenKeyWs.wsEncryptKeyResponse makeUrl = await wsClient.wsEncryptKeyAsync(null, null, DIR, wsUrl + "charge.html?", PRO, SER, mpsparams.SUB,
|
|
|
mpsparams.CMD, "WAP", mpsparams.CATE, mpsparams.ITEM, SUP_CP, CONT, mpsparams.PRICE, mpsparams.MOBILE, TYPE);
|
|
|
|
|
|
- log.Debug("UserCanceling build req: " + makeUrl.@return.enscrypt);
|
|
|
+ log.Info("UserCanceling build req: " + makeUrl.@return.enscrypt);
|
|
|
// save session
|
|
|
//HttpContext.Session.SetComplexData("mps-params", mpsparams);
|
|
|
|
|
|
@@ -385,7 +504,7 @@ namespace NEducation.Controllers
|
|
|
{
|
|
|
String url = mpsurl;
|
|
|
|
|
|
- log.Debug("Request: " + url);
|
|
|
+ log.Info("Request: " + url);
|
|
|
|
|
|
using (var client = new HttpClient())
|
|
|
{
|
|
|
@@ -395,7 +514,7 @@ namespace NEducation.Controllers
|
|
|
var responseContent = response.Content;
|
|
|
// by calling .Result you are synchronously reading the result
|
|
|
string responseString = responseContent.ReadAsStringAsync().Result;
|
|
|
- log.Debug("Response: " + responseString);
|
|
|
+ log.Info("Response: " + responseString);
|
|
|
return responseString;
|
|
|
}
|
|
|
else
|
|
|
@@ -449,6 +568,9 @@ namespace NEducation.Controllers
|
|
|
[ValidateAntiForgeryToken]
|
|
|
public ActionResult RegisterFromWap(String code, String refId, String turn, String price, String content, String msisdn, String packg, String action)
|
|
|
{
|
|
|
+ String packNameREGISTER_ToBe = ConfigurationManager.AppSettings["packNameREGISTER_ToBe"];
|
|
|
+ String packNameCannel_ToBe = ConfigurationManager.AppSettings["packNameCannel_ToBe"];
|
|
|
+ String packageName = ConfigurationManager.AppSettings["packname"];
|
|
|
// khi đăng ký thành công từ camID thì gọi hàm này để gọi Be
|
|
|
log.Info("CALLBACK: " + msisdn + ", packg: " + packg + ", code: " + code + ", content: "
|
|
|
+ content + ", turn: " + turn + ", action: " + action + ", price: " + price);
|
|
|
@@ -458,34 +580,49 @@ namespace NEducation.Controllers
|
|
|
}
|
|
|
try
|
|
|
{
|
|
|
+ //code = "0";
|
|
|
+ //refId = "56f6a1e9c6714cbab5c62bb65988d128";
|
|
|
if (code == "0")
|
|
|
{
|
|
|
-
|
|
|
- // success
|
|
|
- string res = null;
|
|
|
-
|
|
|
- // check phone number
|
|
|
- msisdn = UtilsController.validateMsisdn(msisdn);
|
|
|
- if (msisdn != "" && msisdn == (String)Session["msisdn"])
|
|
|
+ CheckTransactionRequest checkTransactionRequest = new CheckTransactionRequest
|
|
|
{
|
|
|
- String packNameREGISTER_ToBe = ConfigurationManager.AppSettings["packNameREGISTER_ToBe"];
|
|
|
- String packNameCannel_ToBe = ConfigurationManager.AppSettings["packNameCannel_ToBe"];
|
|
|
- String packageName = ConfigurationManager.AppSettings["packname"];
|
|
|
- if (action == "CANCEL")
|
|
|
+ token = "",
|
|
|
+ session = Session.SessionID,
|
|
|
+ wsCode = "validateMps",
|
|
|
+ wsRequest = new WsRequest
|
|
|
{
|
|
|
- log.Info("Cancel package: " + msisdn + ", packg: " + packg);
|
|
|
+ msisdn = msisdn,
|
|
|
+ refId = refId
|
|
|
+ }
|
|
|
+ };
|
|
|
+ log.Info("checkTransactionRequest: " + JsonConvert.SerializeObject(checkTransactionRequest));
|
|
|
+ String responseJson = UtilsController.SendPost(checkTransactionRequest, Session.SessionID, UtilsController.WsType.wsCheckTransaction);
|
|
|
+ CheckTransactionResponse response = new CheckTransactionResponse(responseJson);
|
|
|
|
|
|
- Session["msisdn-detecting"] = msisdn;
|
|
|
+ log.Info("responseCheckTransactionRequest: " + responseJson);
|
|
|
+ if (response.result != null && response.result.errorCode == "0")
|
|
|
+ {
|
|
|
+ string res = null;
|
|
|
+ // check phone number
|
|
|
+ msisdn = UtilsController.validateMsisdn(msisdn);
|
|
|
+ if (msisdn != "" && msisdn == (String)Session["msisdn"])
|
|
|
+ {
|
|
|
|
|
|
- var checkSub = UtilsController.checkAccountSub(msisdn, packNameCannel_ToBe);
|
|
|
- if (!checkSub)
|
|
|
+ if (action == "CANCEL")
|
|
|
{
|
|
|
+ log.Info("Cancel package: " + msisdn + ", packg: " + packg);
|
|
|
+
|
|
|
+ Session["msisdn-detecting"] = msisdn;
|
|
|
+
|
|
|
+ //var checkSub = UtilsController.checkAccountSub(msisdn, packNameCannel_ToBe);
|
|
|
+ //if (!checkSub)
|
|
|
+ //{
|
|
|
UserRequest userRequest = new UserRequest
|
|
|
{
|
|
|
users = msisdn,
|
|
|
msisdn = msisdn,
|
|
|
subServiceCode = packNameCannel_ToBe + "|" + price,
|
|
|
- requestId = "-1",
|
|
|
+ requestId = refId,
|
|
|
otp = code,
|
|
|
serviceId = "3"
|
|
|
};
|
|
|
@@ -498,9 +635,38 @@ namespace NEducation.Controllers
|
|
|
Charging charging = new Charging(rs);
|
|
|
Session["charging"] = charging;
|
|
|
Session["msisdn"] = msisdn;
|
|
|
- Session["package"] = packageName;
|
|
|
+ Session["package"] = packNameCannel_ToBe;
|
|
|
Session["CHARGE_ACTION"] = UtilsController.Constant.REGISTER;
|
|
|
Session["CHARGE_DATA"] = userRequest;
|
|
|
+ // Load profile
|
|
|
+ GetUserProfileReq reqProfile = new GetUserProfileReq { users = msisdn };
|
|
|
+ string rsProfile = UtilsController.SendPost(reqProfile, Session.SessionID, UtilsController.WsType.UsersGetProfile);
|
|
|
+ UserProfile profileGet = new UserProfile(rsProfile);
|
|
|
+
|
|
|
+ if (profileGet.id != null)
|
|
|
+ {
|
|
|
+ Session["profile"] = profileGet;
|
|
|
+
|
|
|
+ UserInfoRequest reqStatus = new UserInfoRequest { users = msisdn };
|
|
|
+ string rsStatus = UtilsController.SendPost(reqStatus, Session.SessionID, UtilsController.WsType.UsersCheckStatus);
|
|
|
+ UserActionResult resStatus = new UserActionResult(rsStatus);
|
|
|
+
|
|
|
+ if (resStatus.status == UtilsController.Constant.SUCCESS)
|
|
|
+ {
|
|
|
+ UserInfo userInfo = new UserInfo(rsStatus);
|
|
|
+ Session["userInfo"] = userInfo;
|
|
|
+
|
|
|
+ Session["msisdn"] = msisdn;
|
|
|
+
|
|
|
+ // Reload user info
|
|
|
+ UtilsController.ReloadSubInfo();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return Json(new
|
|
|
+ {
|
|
|
+ error_code = ress.responseCode,
|
|
|
+ error_content = UtilsController.GetErrorCodeCharging(ress.responseCode)
|
|
|
+ });
|
|
|
}
|
|
|
else if (ress.status == "2")
|
|
|
{
|
|
|
@@ -516,39 +682,40 @@ namespace NEducation.Controllers
|
|
|
error_code = ress.responseCode,
|
|
|
error_content = UtilsController.GetErrorCodeCharging(ress.responseCode)
|
|
|
});
|
|
|
+ //}
|
|
|
+ //else
|
|
|
+ //{
|
|
|
+ // return Json(new
|
|
|
+ // {
|
|
|
+ // error_code = UtilsController.Constant.USER_EXISTED,
|
|
|
+ // error_content = UtilsController.GetErrorCodeCharging(UtilsController.Constant.USER_EXISTED)
|
|
|
+ // });
|
|
|
+ //}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- return Json(new
|
|
|
- {
|
|
|
- error_code = UtilsController.Constant.USER_EXISTED,
|
|
|
- error_content = UtilsController.GetErrorCodeCharging(UtilsController.Constant.USER_EXISTED)
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- log.Info("Check package: " + msisdn + ", packg: " + packg);
|
|
|
+ log.Info("Check package: " + msisdn + ", packg: " + packg);
|
|
|
|
|
|
- Session["msisdn-detecting"] = msisdn;
|
|
|
-
|
|
|
+ Session["msisdn-detecting"] = msisdn;
|
|
|
+
|
|
|
+
|
|
|
+ //var checkSub = UtilsController.checkAccountSub(msisdn, packNameCannel_ToBe);
|
|
|
+ //if (!checkSub)
|
|
|
+ //{
|
|
|
|
|
|
- var checkSub = UtilsController.checkAccountSub(msisdn, packNameCannel_ToBe);
|
|
|
- if (!checkSub)
|
|
|
- {
|
|
|
UserRequest userRequest = new UserRequest
|
|
|
{
|
|
|
users = msisdn,
|
|
|
msisdn = msisdn,
|
|
|
- subServiceCode = packNameCannel_ToBe + "|" + price,
|
|
|
- requestId = "-1",
|
|
|
+ subServiceCode = packNameREGISTER_ToBe + "|" + price,
|
|
|
+ requestId = refId,
|
|
|
otp = code,
|
|
|
serviceId = "3"
|
|
|
};
|
|
|
-
|
|
|
+ log.Info("userRequest_CAMID: " + JsonConvert.SerializeObject(userRequest));
|
|
|
String rs = UtilsController.SendPost(userRequest, Session.SessionID, UtilsController.WsType.MpsRequest);
|
|
|
UserActionResult ress = new UserActionResult(rs);
|
|
|
-
|
|
|
+ log.Info("MpsResult: " + rs);
|
|
|
if (ress.responseCode == UtilsController.Constant.SUCCESS)
|
|
|
{
|
|
|
Charging charging = new Charging(rs);
|
|
|
@@ -557,43 +724,81 @@ namespace NEducation.Controllers
|
|
|
Session["package"] = packageName;
|
|
|
Session["CHARGE_ACTION"] = UtilsController.Constant.REGISTER;
|
|
|
Session["CHARGE_DATA"] = userRequest;
|
|
|
+ // Load profile
|
|
|
+ GetUserProfileReq reqProfile = new GetUserProfileReq { users = msisdn };
|
|
|
+ string rsProfile = UtilsController.SendPost(reqProfile, Session.SessionID, UtilsController.WsType.UsersGetProfile);
|
|
|
+ log.Info("rsProfile: " + rsProfile);
|
|
|
+ UserProfile profileGet = new UserProfile(rsProfile);
|
|
|
+
|
|
|
+ if (profileGet.id != null)
|
|
|
+ {
|
|
|
+ Session["profile"] = profileGet;
|
|
|
+
|
|
|
+ UserInfoRequest reqStatus = new UserInfoRequest { users = msisdn };
|
|
|
+ string rsStatus = UtilsController.SendPost(reqStatus, Session.SessionID, UtilsController.WsType.UsersCheckStatus);
|
|
|
+ UserActionResult resStatus = new UserActionResult(rsStatus);
|
|
|
+
|
|
|
+ if (resStatus.status == UtilsController.Constant.SUCCESS)
|
|
|
+ {
|
|
|
+ UserInfo userInfo = new UserInfo(rsStatus);
|
|
|
+ Session["userInfo"] = userInfo;
|
|
|
+
|
|
|
+ Session["msisdn"] = msisdn;
|
|
|
+
|
|
|
+ // Reload user info
|
|
|
+ UtilsController.ReloadSubInfo();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //}
|
|
|
+ //else if (ress.status == "2")
|
|
|
+ //{
|
|
|
+ // return Json(new
|
|
|
+ // {
|
|
|
+ // error_code = ress.status,
|
|
|
+ // error_content = UtilsController.GetErrorCodeCharging(ress.status)
|
|
|
+ // });
|
|
|
+ //}
|
|
|
+
|
|
|
+ return Json(new
|
|
|
+ {
|
|
|
+ error_code = ress.responseCode,
|
|
|
+ error_content = UtilsController.GetErrorCodeCharging(ress.responseCode)
|
|
|
+ });
|
|
|
}
|
|
|
- else if (ress.status == "2")
|
|
|
+ else
|
|
|
{
|
|
|
return Json(new
|
|
|
{
|
|
|
- error_code = ress.status,
|
|
|
- error_content = UtilsController.GetErrorCodeCharging(ress.status)
|
|
|
+ error_code = UtilsController.Constant.USER_EXISTED,
|
|
|
+ error_content = UtilsController.GetErrorCodeCharging(UtilsController.Constant.USER_EXISTED)
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- return Json(new
|
|
|
- {
|
|
|
- error_code = ress.responseCode,
|
|
|
- error_content = UtilsController.GetErrorCodeCharging(ress.responseCode)
|
|
|
- });
|
|
|
}
|
|
|
- else
|
|
|
+ //ReloadAccountInfo(msisdn);
|
|
|
+ return Json(new
|
|
|
{
|
|
|
- return Json(new
|
|
|
- {
|
|
|
- error_code = UtilsController.Constant.USER_EXISTED,
|
|
|
- error_content = UtilsController.GetErrorCodeCharging(UtilsController.Constant.USER_EXISTED)
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
+ error = code,
|
|
|
+ content = res,
|
|
|
+ msisdn = msisdn.Substring(3)
|
|
|
+ });
|
|
|
}
|
|
|
- //ReloadAccountInfo(msisdn);
|
|
|
- return Json(new
|
|
|
+ else
|
|
|
{
|
|
|
- error = code,
|
|
|
- content = res,
|
|
|
- msisdn = msisdn.Substring(3)
|
|
|
- });
|
|
|
+ log.Info("REGISTER Can not detecting");
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- log.Info("REGISTER Can not detecting");
|
|
|
+ // Handle error case
|
|
|
+ string errorCode = response.errorCode ?? response.result?.errorCode;
|
|
|
+ string errorMessage = response.errorMessage ?? response.result?.message;
|
|
|
+ return Json(new
|
|
|
+ {
|
|
|
+ error_code = errorCode,
|
|
|
+ error_content = errorMessage
|
|
|
+ });
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
else
|