public HttpResponseMessage RealTimeTurnRegisterRequest() { ATISMobileWebApi WebAPi = new ATISMobileWebApi(); try { //تایید اعتبار کلاینت WebAPi.AuthenticateClientApikeyNoncePersonalNonceWith2Parameter(Request, ATISMobileWebApiLogTypes.WebApiClientRealTimeTurnRegisterRequest); var NSSSoftwareuser = WebAPi.GetNSSSoftwareUser(Request); var InstanceConfiguration = new R2CoreInstanceConfigurationManager(); var InstanceSoftwareusers = new R2CoreInstanseSoftwareUsersManager(); var InstanceAES = new AESAlgorithmsManager(); var Content = JsonConvert.DeserializeObject <string>(Request.Content.ReadAsStringAsync().Result); var MobileNumber = InstanceAES.Decrypt(Content.Split(';')[0], InstanceConfiguration.GetConfigString(R2CoreConfigurations.PublicSecurityConfiguration, 3)); var LPPelak = Content.Split(';')[2]; var LPSerial = Content.Split(';')[3]; var InstanceTurnRegisterRequest = new PayanehClassLibraryMClassTurnRegisterRequestManager(); InstanceTurnRegisterRequest.RealTimeTurnRegisterRequestWithLicensePlate(LPPelak, LPSerial, NSSSoftwareuser, R2CoreTransportationAndLoadNotificationRequesters.ATISRestfullTurnControllerRealTimeTurnRegisterRequest, TurnType.Permanent); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK); return(response); } catch (UserNotExistByApiKeyException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (UserLast5DigitNotMatchingException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (UserIdNotExistException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (Exception ex) { return(WebAPi.CreateErrorContentMessage(ex)); } }
public HttpResponseMessage TurnsCancellation() { ATISMobileWebApi WebAPi = new ATISMobileWebApi(); try { //تایید اعتبار کلاینت WebAPi.AuthenticateClientApikeyNoncePersonalNonceWith2Parameter(Request, ATISMobileWebApiLogTypes.WebApiClientTurnsCancellation); var NSSSoftwareuser = WebAPi.GetNSSSoftwareUser(Request); var InstanceConfiguration = new R2CoreInstanceConfigurationManager(); var InstanceSoftwareusers = new R2CoreInstanseSoftwareUsersManager(); var InstanceSequentialTrun = new R2CoreTransportationAndLoadNotificationInstanceSequentialTurnsManager(); var InstanceAES = new AESAlgorithmsManager(); var Content = JsonConvert.DeserializeObject <string>(Request.Content.ReadAsStringAsync().Result); var MobileNumber = InstanceAES.Decrypt(Content.Split(';')[0], InstanceConfiguration.GetConfigString(R2CoreConfigurations.PublicSecurityConfiguration, 3)); var TopSequentialTurnNumber = Content.Split(';')[2]; var YearShamsi = Content.Split(';')[3]; var InstanceCarTruckNobat = new PayanehClassLibraryMClassCarTruckNobatManager(); InstanceCarTruckNobat.TurnsCancellation(TopSequentialTurnNumber, InstanceSequentialTrun.GetNSSSequentialTurn(2), YearShamsi, NSSSoftwareuser); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK); return(response); } catch (UserNotExistByApiKeyException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (UserLast5DigitNotMatchingException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (UserIdNotExistException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (Exception ex) { return(WebAPi.CreateErrorContentMessage(ex)); } }
public HttpResponseMessage GetFirstActiveTurn() { ATISMobileWebApi WebAPi = new ATISMobileWebApi(); try { //تایید اعتبار کلاینت WebAPi.AuthenticateClientApikeyNonce(Request, ATISMobileWebApiLogTypes.WebApiClientGetLastTurnIdWhichCancelledDuringTurnsCancellationProcess); var NSSSoftwareuser = WebAPi.GetNSSSoftwareUser(Request); var InstanceConfiguration = new R2CoreInstanceConfigurationManager(); var InstanceSoftwareusers = new R2CoreInstanseSoftwareUsersManager(); var InstanceSequentialTrun = new R2CoreTransportationAndLoadNotificationInstanceSequentialTurnsManager(); var InstanceAES = new AESAlgorithmsManager(); var Content = JsonConvert.DeserializeObject <string>(Request.Content.ReadAsStringAsync().Result); var MobileNumber = InstanceAES.Decrypt(Content.Split(';')[0], InstanceConfiguration.GetConfigString(R2CoreConfigurations.PublicSecurityConfiguration, 3)); var InstanceTurns = new R2CoreTransportationAndLoadNotificationInstanceTurnsManager(); var InstanceSequentialTurns = new R2CoreTransportationAndLoadNotificationInstanceSequentialTurnsManager(); var NSSTurn = InstanceTurns.GetFirstActiveTurn(InstanceSequentialTurns.GetNSSSequentialTurn(Convert.ToInt64(SequentialTurns.SequentialTurnZobi))); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK); response.Content = new StringContent(JsonConvert.SerializeObject(NSSTurn.OtaghdarTurnNumber), Encoding.UTF8, "application/json"); return(response); } catch (UserNotExistByApiKeyException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (UserLast5DigitNotMatchingException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (UserIdNotExistException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (Exception ex) { return(WebAPi.CreateErrorContentMessage(ex)); } }
public HttpResponseMessage TruckDriverInqueryWithLicensePlate() { ATISMobileWebApi WebAPi = new ATISMobileWebApi(); try { //تایید اعتبار کلاینت WebAPi.AuthenticateClientApikeyNoncePersonalNonceWith2Parameter(Request, ATISMobileWebApiLogTypes.WebApiClientTruckDriverInqueryWithLicensePlate); var NSSSoftwareuser = WebAPi.GetNSSSoftwareUser(Request); var InstanceConfiguration = new R2CoreInstanceConfigurationManager(); var InstanceSoftwareusers = new R2CoreInstanseSoftwareUsersManager(); var InstanceAES = new AESAlgorithmsManager(); var Content = JsonConvert.DeserializeObject <string>(Request.Content.ReadAsStringAsync().Result); var MobileNumber = InstanceAES.Decrypt(Content.Split(';')[0], InstanceConfiguration.GetConfigString(R2CoreConfigurations.PublicSecurityConfiguration, 3)); var LPPelak = Content.Split(';')[2]; var LPSerial = Content.Split(';')[3]; var InstanceTruckDrivers = new R2CoreTransportationAndLoadNotificationInstanceTruckDriversManager(); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK); response.Content = new StringContent(JsonConvert.SerializeObject(InstanceTruckDrivers.GetNSSTruckDriverWithLicensePlate(new R2CoreTransportationAndLoadNotificationStandardTruckStructure(new R2StandardCarStructure(null, null, LPPelak, LPSerial, null), null)).NSSDriver.StrPersonFullName), Encoding.UTF8, "application/json"); return(response); } catch (UserNotExistByApiKeyException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (UserLast5DigitNotMatchingException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (UserIdNotExistException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (Exception ex) { return(WebAPi.CreateErrorContentMessage(ex)); } }
public HttpResponseMessage SendTruckChangeRequestMessage() { ATISMobileWebApi WebAPi = new ATISMobileWebApi(); try { //تایید اعتبار کلاینت WebAPi.AuthenticateClientApikeyNoncePersonalNonceWith3Parameter(Request, ATISMobileWebApiLogTypes.WebApiClientSendTruckChangeMessageRequest); var NSSSoftwareuser = WebAPi.GetNSSSoftwareUser(Request); var InstanceConfiguration = new R2CoreInstanceConfigurationManager(); var InstanceSoftwareusers = new R2CoreInstanseSoftwareUsersManager(); var InstanceAES = new AESAlgorithmsManager(); var Content = JsonConvert.DeserializeObject <string>(Request.Content.ReadAsStringAsync().Result); var MobileNumber = InstanceAES.Decrypt(Content.Split(';')[0], InstanceConfiguration.GetConfigString(R2CoreConfigurations.PublicSecurityConfiguration, 3)); var LPPelak = Content.Split(';')[2]; var LPSerial = Content.Split(';')[3]; var NewTruckLicensePlate = Content.Split(';')[4]; var InstanceCarTrucks = new PayanehClassLibraryMClassCarTrucksManager(); var InstanceTrucks = new R2CoreTransportationAndLoadNotificationInstanceTrucksManager(); InstanceCarTrucks.SendTruckChangeRequestMessage(InstanceTrucks.GetNSSTruckWithLicensePlate(new R2CoreTransportationAndLoadNotificationStandardTruckStructure(new R2StandardCarStructure(null, null, LPPelak, LPSerial, null), null)), NewTruckLicensePlate, NSSSoftwareuser); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK); return(response); } catch (UserNotExistByApiKeyException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (UserLast5DigitNotMatchingException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (UserIdNotExistException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (Exception ex) { return(WebAPi.CreateErrorContentMessage(ex)); } }
public HttpResponseMessage LoginSoftwareUser() { ATISMobileWebApi WebAPi = new ATISMobileWebApi(); try { //تایید اعتبار کلاینت WebAPi.AuthenticateClientVerificationCode(Request); var InstanceAES = new AESAlgorithmsManager(); var InstanceConfiguration = new R2CoreInstanceConfigurationManager(); var InstanceSoftwareusers = new R2CoreInstanseSoftwareUsersManager(); var InstanceSoftwareUser = new R2CoreInstanseSoftwareUsersManager(); var Content = JsonConvert.DeserializeObject<string>(Request.Content.ReadAsStringAsync().Result); var MobileNumber = Content.Split(';')[0]; var NSSSoftwareuser = InstanceSoftwareUser.GetNSSUser(new R2CoreSoftwareUserMobile(MobileNumber)); InstanceSoftwareusers.LoginSoftwareUser(NSSSoftwareuser.MobileNumber); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK); var AMUStatus = InstanceAES.Encrypt(NSSSoftwareuser.MobileNumber, InstanceConfiguration.GetConfigString(R2CoreConfigurations.PublicSecurityConfiguration, 3)) + ";" + InstanceAES.Encrypt(NSSSoftwareuser.ApiKey, InstanceConfiguration.GetConfigString(R2CoreConfigurations.PublicSecurityConfiguration, 3)); response.Content = new StringContent(JsonConvert.SerializeObject(AMUStatus), Encoding.UTF8, "application/json"); return response; } catch (SoftwareUserNotMatchException ex) { return WebAPi.CreateErrorContentMessage(ex); } catch (Exception ex) { return WebAPi.CreateErrorContentMessage(ex); } }
public HttpResponseMessage GetPersonalNonce() { ATISMobileWebApi WebAPi = new ATISMobileWebApi(); try { //تایید اعتبار کلاینت WebAPi.AuthenticateClientGetPersonalNonce(Request); var InstanceConfiguration = new R2CoreInstanceConfigurationManager(); var InstanceSoftwareusers = new R2CoreInstanseSoftwareUsersManager(); var InstanceAES = new AESAlgorithmsManager(); var Content = JsonConvert.DeserializeObject<string>(Request.Content.ReadAsStringAsync().Result); var MobileNumber = InstanceAES.Decrypt(Content.Split(';')[0], InstanceConfiguration.GetConfigString(R2CoreConfigurations.PublicSecurityConfiguration, 3)); var NSSSoftwareuser = WebAPi.GetNSSSoftwareUser(Request); var PersonalNonce = InstanceSoftwareusers.GetPersonalNonceforSoftwareUser(NSSSoftwareuser); InvalidateCaptcha(Request); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK); response.Content = new StringContent(JsonConvert.SerializeObject(PersonalNonce), Encoding.UTF8, "application/json"); return response; } catch (Exception ex) { InvalidateCaptcha(Request); return WebAPi.CreateErrorContentMessage(ex); } }
public HttpResponseMessage LoadAllocationAgent() { ATISMobileWebApi WebAPi = new ATISMobileWebApi(); try { //تایید اعتبار کلاینت WebAPi.AuthenticateClientApikeyNoncePersonalNonceWith1Parameter(Request, ATISMobileWebApiLogTypes.WebApiClientLoadAllocationRegisteringRequest); var NSSSoftwareuser = WebAPi.GetNSSSoftwareUser(Request); var InstanceConfiguration = new R2CoreInstanceConfigurationManager(); var InstanceSoftwareusers = new R2CoreInstanseSoftwareUsersManager(); var InstanceAES = new AESAlgorithmsManager(); var Content = JsonConvert.DeserializeObject <string>(Request.Content.ReadAsStringAsync().Result); var MobileNumber = InstanceAES.Decrypt(Content.Split(';')[0], InstanceConfiguration.GetConfigString(R2CoreConfigurations.PublicSecurityConfiguration, 3)); var nEstelamId = Convert.ToInt64(Content.Split(';')[2]); var InstanceLoadCapacitorLoad = new R2CoreTransportationAndLoadNotificationInstanceLoadCapacitorLoadManager(); var NSSLoadCapacitorLoad = InstanceLoadCapacitorLoad.GetNSSLoadCapacitorLoad(InstanceLoadCapacitorLoad.GetNSSLoadCapacitorLoad(nEstelamId).nEstelamKey); Int64 myTurnId = Int64.MinValue; try { var InstanceTurns = new R2CoreTransportationAndLoadNotificationInstanceTurnsManager(); myTurnId = InstanceTurns.GetNSSTurn(NSSSoftwareuser).nEnterExitId; } catch (Exception ex) { throw ex; } var InstanceLoadAllocation = new R2CoreTransportationAndLoadNotificationInstanceLoadAllocationManager(); Int64 LAId = InstanceLoadAllocation.LoadAllocationRegistering(NSSLoadCapacitorLoad.nEstelamId, myTurnId, NSSSoftwareuser, R2CoreTransportationAndLoadNotificationRequesters.ATISRestfullLoadAllocationRegisteringAgent); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK); return(response); } catch (LoadAllocationNotAllowedBecauseCarHasBlackListException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (LoadAllocationRegisteringReachedEndTimeException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (RequesterHasNotPermissionforLoadAllocationRegisteringException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (LoadCapacitorLoadNotFoundException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (LoadAllocationNotAllowedBecuaseAHSGLoadAllocationIsUnactiveException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (TurnNotFoundException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (UserNotExistByApiKeyException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (TruckDriverNotFoundException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (UserLast5DigitNotMatchingException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (UserIdNotExistException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (Exception ex) { return(WebAPi.CreateErrorContentMessage(ex)); } }
public HttpResponseMessage GetLoadPermissionsViaLicensePlate() { ATISMobileWebApi WebAPi = new ATISMobileWebApi(); try { //تایید اعتبار کلاینت WebAPi.AuthenticateClientApikeyNonceWith2Parameter(Request, ATISMobileWebApiLogTypes.WebApiClientGetLoadPermissionsViaLicensePlate); var NSSSoftwareuser = WebAPi.GetNSSSoftwareUser(Request); var InstanceConfiguration = new R2CoreInstanceConfigurationManager(); var InstanceSoftwareusers = new R2CoreInstanseSoftwareUsersManager(); var InstanceAES = new AESAlgorithmsManager(); var Content = JsonConvert.DeserializeObject <string>(Request.Content.ReadAsStringAsync().Result); var MobileNumber = InstanceAES.Decrypt(Content.Split(';')[0], InstanceConfiguration.GetConfigString(R2CoreConfigurations.PublicSecurityConfiguration, 3)); var LPPelak = Content.Split(';')[2]; var LPSerial = Content.Split(';')[3]; var InstanceLoadAllocation = new R2CoreTransportationAndLoadNotificationInstanceLoadAllocationManager(); List <Models.LoadAllocationsforTruckDriver> _LoadAllocations = new List <Models.LoadAllocationsforTruckDriver>(); var Lst = InstanceLoadAllocation.GetLoadPermissionsViaLicensePlate(LPPelak, LPSerial); StringBuilder SB = new StringBuilder(); for (int Loopx = 0; Loopx <= Lst.Count - 1; Loopx++) { var Item = new Models.LoadAllocationsforTruckDriver(); SB.Clear(); SB.Append("شرکت حمل و نقل: " + Lst[Loopx].TransportCompanyTitle.Trim() + " " + Lst[Loopx].TransportCompanyTel.Trim() + "\r\n"); SB.Append("کد مرجع: " + Lst[Loopx].LoadCapacitorLoadnEstelamId + "\r\n"); SB.Append(Lst[Loopx].LoadCapacitorLoadGoodTitle.Trim() + " " + Lst[Loopx].LoadCapacitorLoadTargetTitle.Trim() + " تعدادبار: " + Lst[Loopx].LoadCapacitorLoadnCarNumKol.Trim() + "\r\n"); SB.Append("تعرفه: " + Lst[Loopx].LoadCapacitorLoadStrPriceSug.Trim() + "\r\n"); SB.Append("توضیحات بار: " + Lst[Loopx].LoadCapacitorLoadStrDescription.Trim() + " " + Lst[Loopx].LoadCapacitorLoadStrBarName.Trim() + " " + Lst[Loopx].LoadCapacitorLoadStrAddress.Trim() + "\r\n"); SB.Append("وضعیت تخصیص بار: " + Lst[Loopx].LoadAllocationStatusTitle.Trim() + "\r\n"); SB.Append("تاریخ تخصیص بار: " + Lst[Loopx].LoadPermissionDate + " - " + Lst[Loopx].LoadPermissionTime + "\r\n"); SB.Append("توضیحات تخصیص: " + Lst[Loopx].LoadAllocationNote.Trim() + "\r\n"); SB.Append("طول سفر: " + Lst[Loopx].LoadCapacitorLoadTargetTravelength.Trim() + "\r\n"); Item.Description = SB.ToString(); Item.DescriptionColor = Lst[Loopx].LoadAllocationStatusColor; Item.LoadAllocationId = "شماره تخصیص:" + Lst[Loopx].LoadAllocationId + " - " + "اولویت:" + Lst[Loopx].LoadAllocationPriority; _LoadAllocations.Add(Item); } HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK); response.Content = new StringContent(JsonConvert.SerializeObject(_LoadAllocations), Encoding.UTF8, "application/json"); return(response); } catch (UserNotExistByApiKeyException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (LoadAllocationNotFoundException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (Exception ex) { return(WebAPi.CreateErrorContentMessage(ex)); } }
private void InvalidateCaptcha(HttpRequestMessage YourRequest) { try { var InstanceConfiguration = new R2CoreInstanceConfigurationManager(); var InstanceSoftwareusers = new R2CoreInstanseSoftwareUsersManager(); var InstanceAES = new AESAlgorithmsManager(); var Content = JsonConvert.DeserializeObject<string>(YourRequest.Content.ReadAsStringAsync().Result); var MobileNumber = InstanceAES.Decrypt(Content.Split(';')[0], InstanceConfiguration.GetConfigString(R2CoreConfigurations.PublicSecurityConfiguration, 3)); InstanceSoftwareusers.CaptchaInvalidateforSoftwareUser(new R2CoreSoftwareUserMobile(MobileNumber)); } catch (Exception ex) { throw ex; } }
public HttpResponseMessage PaymentRequest() { ATISMobileWebApi WebAPi = new ATISMobileWebApi(); try { //تایید اعتبار کلاینت WebAPi.AuthenticateClientApikeyNoncePersonalNonceWith1Parameter(Request, ATISMobileWebApiLogTypes.WebApiClientMoneyWalletPaymentRequest); var InstanceConfiguration = new R2CoreInstanceConfigurationManager(); var InstanceSoftwareusers = new R2CoreInstanseSoftwareUsersManager(); var InstanceAES = new AESAlgorithmsManager(); var Content = JsonConvert.DeserializeObject <string>(Request.Content.ReadAsStringAsync().Result); var MobileNumber = InstanceAES.Decrypt(Content.Split(';')[0], InstanceConfiguration.GetConfigString(R2CoreConfigurations.PublicSecurityConfiguration, 3)); var NSSSoftwareuser = InstanceSoftwareusers.GetNSSUser(new R2CoreSoftwareUserMobile(MobileNumber)); var Amount = Convert.ToInt32(Content.Split(';')[2]) * 10; if (Amount > 1000000) { throw new ChargingAmountInvalidException(); } var WS = new R2Core.R2PrimaryWS.R2PrimaryWebService(); var PayId = WS.WebMethodPaymentRequest(R2CoreMonetaryCreditSupplySources.ZarrinPalPaymentGate, Amount, NSSSoftwareuser.UserId, WS.WebMethodLogin(R2CoreMClassSoftwareUsersManagement.GetNSSSystemUser().UserShenaseh, R2CoreMClassSoftwareUsersManagement.GetNSSSystemUser().UserPassword)); var InstancePaymentRequests = new R2CoreInstansePaymentRequestsManager(); var NSSPaymentRequest = InstancePaymentRequests.GetNSSPayment(PayId); while ((NSSPaymentRequest.Authority == string.Empty) & (NSSPaymentRequest.PaymentErrors == string.Empty)) { System.Threading.Thread.Sleep(500); NSSPaymentRequest = InstancePaymentRequests.GetNSSPayment(PayId); } if (NSSPaymentRequest.Authority != string.Empty) { HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK); response.Content = new StringContent(JsonConvert.SerializeObject(new MessageStruct { ErrorCode = false, Message1 = NSSPaymentRequest.Authority, Message2 = InstanceConfiguration.GetConfigString(R2CoreConfigurations.ZarrinPalPaymentGate, 2), Message3 = string.Empty }), Encoding.UTF8, "application/json"); return(response); } else { throw new Exception(NSSPaymentRequest.PaymentErrors); } } catch (UserNotExistByApiKeyException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (Exception ex) { return(WebAPi.CreateErrorContentMessage(ex)); } }
public HttpResponseMessage LoadAllocationCancelling() { ATISMobileWebApi WebAPi = new ATISMobileWebApi(); try { //تایید اعتبار کلاینت WebAPi.AuthenticateClientApikeyNoncePersonalNonceWith1Parameter(Request, ATISMobileWebApiLogTypes.WebApiClientLoadAllocationCancellingRequest); var InstanceConfiguration = new R2CoreInstanceConfigurationManager(); var InstanceSoftwareusers = new R2CoreInstanseSoftwareUsersManager(); var InstanceAES = new AESAlgorithmsManager(); var Content = JsonConvert.DeserializeObject <string>(Request.Content.ReadAsStringAsync().Result); var MobileNumber = InstanceAES.Decrypt(Content.Split(';')[0], InstanceConfiguration.GetConfigString(R2CoreConfigurations.PublicSecurityConfiguration, 3)); var NSSSoftwareuser = InstanceSoftwareusers.GetNSSUser(new R2CoreSoftwareUserMobile(MobileNumber)); var LoadAllocationId = Convert.ToInt64(Content.Split(';')[2]); AuthorizationLoadAllocationIdWithSoftwareUser(NSSSoftwareuser, LoadAllocationId); var InstanceLoadAllocation = new R2CoreTransportationAndLoadNotificationInstanceLoadAllocationManager(); InstanceLoadAllocation.LoadAllocationCancelling(LoadAllocationId, R2CoreTransportationAndLoadNotificationLoadAllocationStatuses.CancelledUser, NSSSoftwareuser); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK); return(response); } catch (TimingNotReachedException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (TurnHandlingNotAllowedBecuaseTurnStatusException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (LoadAllocationCancellingNotAllowedBecauseLoadAllocationStatusException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (LoadAllocationCancellingNotAllowedBecauseTurnStatusException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (UserNotExistByApiKeyException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (UserLast5DigitNotMatchingException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (UserIdNotExistException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (LoadAllocationNotFoundException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (LoadCapacitorLoadNotFoundException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (TurnNotFoundException ex) { return(WebAPi.CreateErrorContentMessage(ex)); } catch (Exception ex) { return(WebAPi.CreateErrorContentMessage(ex)); } }
public ActionResult PaymentVerification() { ATISMobileWebApi WebAPi = new ATISMobileWebApi(); try { //تایید اعتبار کلاینت WebAPi.AuthenticateClientPaymentVerification(Request, Request.QueryString["Authority"]); var InstanceTrafficCards = new R2CoreTransportationAndLoadNotificationInstanceTerraficCardsManager(); var InstanceMoneyWallets = new R2CoreParkingSystemInstanceMoneyWalletManager(); var InstanceMoneyWalletCharge = new R2CoreParkingSystemInstanceMoneyWalletChargeManager(); var InstanceSoftwareUsers = new R2CoreInstanseSoftwareUsersManager(); if (Request.QueryString["Status"] != "" && Request.QueryString["Status"] != null && Request.QueryString["Authority"] != "" && Request.QueryString["Authority"] != null) { if (Request.QueryString["Status"].ToString().Equals("OK")) { var WS = new R2Core.R2PrimaryWS.R2PrimaryWebService(); var PayId = WS.WebMethodVerificationRequest(R2CoreMonetaryCreditSupplySources.ZarrinPalPaymentGate, Request.QueryString["Authority"].ToString(), WS.WebMethodLogin(R2CoreMClassSoftwareUsersManagement.GetNSSSystemUser().UserShenaseh, R2CoreMClassSoftwareUsersManagement.GetNSSSystemUser().UserPassword)); var InstancePaymentRequests = new R2CoreInstansePaymentRequestsManager(); var NSSPaymentRequest = InstancePaymentRequests.GetNSSPayment(PayId); while ((NSSPaymentRequest.RefId == string.Empty) & (NSSPaymentRequest.VerificationErrors == string.Empty)) { System.Threading.Thread.Sleep(500); NSSPaymentRequest = InstancePaymentRequests.GetNSSPayment(PayId); } if (NSSPaymentRequest.RefId != string.Empty) { var InstanceAES = new AESAlgorithmsManager(); var InstanceConfiguration = new R2CoreInstanceConfigurationManager(); var NSSSoftwareUser = InstanceSoftwareUsers.GetNSSUser(NSSPaymentRequest.SoftwareUserId); var NSSTrafficCard = InstanceTrafficCards.GetNSSTerafficCard(NSSSoftwareUser); Int64 CurrentCharge = InstanceMoneyWallets.GetMoneyWalletCharge(NSSTrafficCard); InstanceMoneyWallets.ActMoneyWalletNextStatus(NSSTrafficCard, BagPayType.AddMoney, NSSPaymentRequest.Amount, R2CoreParkingSystemAccountings.ChargeType, R2CoreMClassSoftwareUsersManagement.GetNSSSystemUser()); InstanceMoneyWalletCharge.SabtCharge(new R2StandardMoneyWalletChargeStructure(NSSTrafficCard, NSSPaymentRequest.Amount, InstanceSoftwareUsers.GetNSSSystemUser().UserId, "", _R2DateTime.GetCurrentDateTimeMilladi(), _R2DateTime.GetCurrentDateShamsiFull(), NSSPaymentRequest.Amount + CurrentCharge, 0, _R2DateTime.GetCurrentTime())); Int64 LastCharge = InstanceMoneyWallets.GetMoneyWalletCharge(NSSTrafficCard); ViewBag.IsSuccess = true; ViewBag.RefId = NSSPaymentRequest.RefId; ViewBag.Message1 = NSSTrafficCard.CardNo + " شاخص کیف پول "; ViewBag.Message2 = CurrentCharge.ToString() + " موجودی قبلی "; ViewBag.Message3 = NSSPaymentRequest.Amount.ToString() + " مبلغ شارژ "; ViewBag.Message4 = LastCharge.ToString() + " موجودی نهایی "; } else { ViewBag.IsSuccess = false; ViewBag.Message = NSSPaymentRequest.VerificationErrors; } } else { ViewBag.IsSuccess = false; ViewBag.Message = "Error! : Status: " + Request.QueryString["Status"].ToString(); } } else { ViewBag.IsSuccess = false; ViewBag.Message = "Invalid Input"; } } catch (Exception ex) { ViewBag.IsSuccess = false; ViewBag.Message = ex.Message; } return(View()); }