示例#1
0
        public HttpResponseMessage GetMoneyWalletReminderCharge()
        {
            ATISMobileWebApi WebAPi = new ATISMobileWebApi();

            try
            {
                //تایید اعتبار کلاینت
                WebAPi.AuthenticateClientApikeyNonce(Request, ATISMobileWebApiLogTypes.WebApiClientMoneyWalletIDandReminderChargeRequest);

                var   NSSSoftwareuser       = WebAPi.GetNSSSoftwareUser(Request);
                var   InstanceTerraficCards = new R2CoreTransportationAndLoadNotificationInstanceTerraficCardsManager();
                var   InstanceMoneyWallets  = new R2CoreParkingSystemInstanceMoneyWalletManager();
                var   NSSTrafficCard        = InstanceTerraficCards.GetNSSTerafficCard(NSSSoftwareuser);
                Int64 ReminderCharge        = InstanceMoneyWallets.GetMoneyWalletCharge(NSSTrafficCard);

                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK);
                response.Content = new StringContent(JsonConvert.SerializeObject(new MessageStruct {
                    ErrorCode = false, Message1 = ReminderCharge.ToString(), Message2 = string.Empty, Message3 = string.Empty
                }), Encoding.UTF8, "application/json");
                return(response);
            }
            catch (UserNotExistByApiKeyException ex)
            { return(WebAPi.CreateErrorContentMessage(ex)); }
            catch (Exception ex)
            { return(WebAPi.CreateErrorContentMessage(ex)); }
        }
        public HttpResponseMessage RegisterMobileNumber()
        {
            ATISMobileWebApi WebAPi = new ATISMobileWebApi();
            try
            {
                //تایید اعتبار کلاینت
                WebAPi.AuthenticateClientRegisteringMobileNumber(Request);

                var InstanceSoftwareusers = new R2CoreInstanseSoftwareUsersManager();
                var InstanceConfiguration = new R2CoreInstanceConfigurationManager();
                var MobileNumber = JsonConvert.DeserializeObject<string>(Request.Content.ReadAsStringAsync().Result);
                var NSSSoftwareUser = InstanceSoftwareusers.RegisteringMobileNumber(MobileNumber);
                //کسر هزینه فعال سازی - از بابت اس ام اس
                var InstanceTerraficCards = new R2CoreTransportationAndLoadNotificationInstanceTerraficCardsManager();
                var InstanceMoneyWallets = new R2CoreParkingSystemInstanceMoneyWalletManager();
                var NSSTrafficCard = InstanceTerraficCards.GetNSSTerafficCard(NSSSoftwareUser);
                if (InstanceConfiguration.GetConfigBoolean(R2CoreConfigurations.DefaultConfigurationOfSoftwareUserSecurity, 10))
                { if (!NSSTrafficCard.NoMoney) { InstanceMoneyWallets.ActMoneyWalletNextStatus(NSSTrafficCard, BagPayType.MinusMoney, InstanceConfiguration.GetConfigInt64(R2CoreConfigurations.DefaultConfigurationOfSoftwareUserSecurity, 11), R2CoreParkingSystemAccountings.RegisteringSoftwareUserSMSCost, InstanceSoftwareusers.GetNSSSystemUser()); } }
                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK);
                response.Content = new StringContent(JsonConvert.SerializeObject(string.Empty), Encoding.UTF8, "application/json");
                return response;
            }
            catch (SoftwareUserMoneyWalletNotFoundException ex)
            { return WebAPi.CreateErrorContentMessage(ex); }
            catch (MobileNumberIsInvalidException ex)
            { return WebAPi.CreateErrorContentMessage((new R2CoreMClassPredefinedMessagesManager()).GetNSS(R2CorePredefinedMessages.MobileNumberIsInvalid).MsgContent); }
            catch (MobileNumberNotFoundException ex)
            { return WebAPi.CreateErrorContentMessage((new R2CoreMClassPredefinedMessagesManager()).GetNSS(R2CorePredefinedMessages.MobileNumberNotFoundException).MsgContent); }
            catch (Exception ex)
            { return WebAPi.CreateErrorContentMessage(ex); }
        }
        public HttpResponseMessage GetMoneyWalletAccounting()
        {
            ATISMobileWebApi WebAPi = new ATISMobileWebApi();

            try
            {
                //تایید اعتبار کلاینت
                WebAPi.AuthenticateClientApikeyNonce(Request, ATISMobileWebApiLogTypes.WebApiClientMoneyWalletAccountingRequest);

                var InstanceTerraficCards    = new R2CoreTransportationAndLoadNotificationInstanceTerraficCardsManager();
                var NSSSoftwareUser          = WebAPi.GetNSSSoftwareUser(Request);
                var InstanceAccounting       = new R2CoreParkingSystemInstanceAccountingManager();
                var InstancePublicProcedures = new R2CoreInstancePublicProceduresManager();
                var NSSTrafficCard           = InstanceTerraficCards.GetNSSTerafficCard(NSSSoftwareUser);
                List <Models.MoneyWalletAccounting> _MoneyWalletAccountings = new List <Models.MoneyWalletAccounting>();
                var Lst = InstanceAccounting.GetAccountingCollection(NSSTrafficCard, 50);
                for (int Loopx = 0; Loopx <= Lst.Count - 1; Loopx++)
                {
                    var Item = new Models.MoneyWalletAccounting();
                    Item.AccountName         = Lst[Loopx].AccountName;
                    Item.AccountDateTime     = Lst[Loopx].DateShamsiA + "\n" + Lst[Loopx].TimeA;
                    Item.CurrentCharge       = InstancePublicProcedures.ParseSignDigitToSignString(Lst[Loopx].CurrentChargeA);
                    Item.Mblgh               = InstancePublicProcedures.ParseSignDigitToSignString(Lst[Loopx].MblghA);
                    Item.ReminderCharge      = InstancePublicProcedures.ParseSignDigitToSignString(Lst[Loopx].ReminderChargeA);
                    Item.ComputerName        = Lst[Loopx].ComputerName;
                    Item.UserName            = Lst[Loopx].UserName;
                    Item.BackGroundColorName = Lst[Loopx].ColorName;
                    Item.ForeGroundColorName = InstancePublicProcedures.IdealBlackWhiteTextColor(Color.FromName(Lst[Loopx].ColorName)).Name;
                    _MoneyWalletAccountings.Add(Item);
                }

                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK);
                response.Content = new StringContent(JsonConvert.SerializeObject(_MoneyWalletAccountings), Encoding.UTF8, "application/json");
                return(response);
            }
            catch (UserNotExistByApiKeyException ex)
            { return(WebAPi.CreateErrorContentMessage(ex)); }
            catch (Exception ex)
            { return(WebAPi.CreateErrorContentMessage(ex)); }
        }
示例#4
0
        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());
        }