Esempio n. 1
0
        static void Main(string[] args)
        {
            SaleServiceSoapClient saleClient = new SaleServiceSoapClient();
            var result = saleClient.GetContracts(new GetContractsRequest());
            SiteServiceSoapClient siteClient = new SiteServiceSoapClient();

            //Should not be void
            siteClient.GetLocations();
            Console.WriteLine("Hello World!");
        }
Esempio n. 2
0
 public ActionResult TransactionQueryByMPAY(string MPAY)
 {
     _getSaleResultMpayService = new SaleServiceSoapClient(SaleServiceSoapClient.EndpointConfiguration.SaleServiceSoap);
     SaleService.MAuthToken token = new SaleService.MAuthToken();
     #region Token
     token.UserCode = base.settings.UserCode;
     token.Pin      = base.settings.Pin;
     #endregion
     var response = _getSaleResultMpayService.GetSaleResultMPAYAsync(token, MPAY).GetAwaiter().GetResult();
     return(View(response));
 }
Esempio n. 3
0
 public ActionResult TransactionQueryByMPAY(string MPAY)
 {
     _getSaleResultMpayService = new SaleServiceSoapClient();
     Core.ApiPlusAndProApiService.MAuthToken token = new Core.ApiPlusAndProApiService.MAuthToken();
     #region Token
     token.UserCode = base.settings.UserCode;
     token.Pin      = base.settings.Pin;
     #endregion
     var response = _getSaleResultMpayService.GetSaleResultMPAY(token, MPAY);
     return(View(response));
 }
Esempio n. 4
0
 public ActionResult TransactionQueryByOrderId(string orderId)
 {
     _getSaleResultOrderService = new SaleServiceSoapClient(SaleServiceSoapClient.EndpointConfiguration.SaleServiceSoap);
     SaleService.MAuthToken token = new SaleService.MAuthToken();
     #region Token
     token.UserCode = base.settings.UserCode;
     token.Pin      = base.settings.Pin;
     #endregion
     var guid     = new Guid(orderId.ToString());
     var response = _getSaleResultOrderService.GetSaleResultAsync(token, guid).GetAwaiter().GetResult();
     return(View(response));
 }
Esempio n. 5
0
 public ActionResult TransactionQueryByOrderId(string orderId)
 {
     _getSaleResultOrderService = new SaleServiceSoapClient();
     Core.ApiPlusAndProApiService.MAuthToken token = new Core.ApiPlusAndProApiService.MAuthToken();
     #region Token
     token.UserCode = base.settings.UserCode;
     token.Pin      = base.settings.Pin;
     #endregion
     var guid     = new Guid(orderId.ToString());
     var response = _getSaleResultOrderService.GetSaleResult(token, guid);
     return(View(response));
 }
Esempio n. 6
0
        public ActionResult ProApi(int paymentTypeId, int productCategoryId)
        {
            var url = Request.Path;

            _proApiApiPlusService = new SaleServiceSoapClient(SaleServiceSoapClient.EndpointConfiguration.SaleServiceSoap);
            #region Token
            SaleService.MAuthToken token = new SaleService.MAuthToken();
            token.UserCode = base.settings.UserCode;
            token.Pin      = base.settings.Pin;
            #endregion
            #region MSaleProduct

            MSaleProduct product = new MSaleProduct();
            product.ProductId          = 0;
            product.ProductCategory    = productCategoryId;
            product.ProductDescription = "Telefon";
            product.Price = 0.01;
            product.Unit  = 1;


            #endregion
            #region MSaleTicketInput
            MSaleTicketInput input = new MSaleTicketInput();
            input.MPAY                = "01";
            input.Content             = "TLFN01-Telefon";
            input.SendOrderResult     = true;
            input.PaymentTypeId       = paymentTypeId;
            input.ReceivedSMSObjectId = new Guid("00000000-0000-0000-0000-000000000000");
            input.ProductList         = new[] { product };
            input.SendNotificationSMS = true;
            input.OnSuccessfulSMS     = "basarili odeme yaptiniz";
            input.OnErrorSMS          = "basarisiz odeme yaptiniz";
            input.Url = url;
            input.RequestGsmOperator = 0;
            input.RequestGsmType     = 0;
            input.SuccessfulPageUrl  = "http://localhost:32123/Home/Success";
            input.ErrorPageUrl       = "http://localhost:32123/Home/Fail";
            input.Country            = "";
            input.Currency           = "";
            input.Extra             = "";
            input.TurkcellServiceId = "";
            #endregion
            var saleWithTicketResult = _proApiApiPlusService.SaleWithTicketAsync(token, input).GetAwaiter().GetResult();
            return(Redirect(saleWithTicketResult.RedirectUrl));
        }
Esempio n. 7
0
        public ActionResult ApiPlus(string gsmNumber, int paymentTypeId, int productCategoryId)
        {
            var url = Request.Path;

            _proApiApiPlusService = new SaleServiceSoapClient(SaleServiceSoapClient.EndpointConfiguration.SaleServiceSoap);
            #region Token
            var token = new SaleService.MAuthToken();
            token.UserCode = base.settings.UserCode;
            token.Pin      = base.settings.Pin;
            #endregion
            #region Product
            MSaleProduct product = new MSaleProduct();
            product.ProductId          = 0;
            product.ProductCategory    = productCategoryId;
            product.ProductDescription = "Telefon";
            product.Price = 0.01;
            product.Unit  = 1;
            #endregion
            #region MSaleInput
            MSaleInput input = new MSaleInput();
            input.MPAY                = "01";
            input.Gsm                 = gsmNumber;
            input.Content             = "TLFN-Telefon";
            input.SendOrderResult     = true;
            input.PaymentTypeId       = paymentTypeId;
            input.Url                 = url;
            input.ReceivedSMSObjectId = new Guid("00000000-0000-0000-0000-000000000000");
            input.ProductList         = new[] { product };
            input.SendNotificationSMS = true;
            input.OnSuccessfulSMS     = "basarili odeme yaptiniz";
            input.OnErrorSMS          = "basarisiz odeme yaptiniz";
            input.RequestGsmOperator  = 0;
            input.RequestGsmType      = 0;
            input.CustomerIpAddress   = "127.0.0.1";
            input.Extra               = "";
            input.TurkcellServiceId   = "";
            #endregion
            var result = _proApiApiPlusService.SaleWithConfirmAsync(token, input).GetAwaiter().GetResult();
            return(View(result));
        }
        public ActionResult Pay(long paymentId, string callbackUrl)
        {
#if DEBUG
            var payment = _paymentRepository.Find(paymentId);
            if (payment == null)
            {
                //show error page
                @ViewBag.hasError     = true;
                @ViewBag.errorMessage = "فاکتور مورد نظر یافت نشد";
                return(View());
            }
            var factor = _factorRepository.Find(payment.FactorId);
            @ViewBag.factorId = factor.Id;
            if (factor.HaveFactorRawPercentDiscount())
            {
                if (_factorDomainService.HavePercentDiscountToday(factor.Customer))
                {
                    @ViewBag.hasError     = true;
                    @ViewBag.errorMessage = "شما مجاز به انتخاب یک کالای دارای تخفیف درصدی در هر روز می باشید";
                    return(View());
                }
            }


            var invoice = new Invoice(paymentId, payment.Amount, callbackUrl);
            var result  = Parbad.Payment.Request(Gateway.ParbadVirtualGateway, invoice);
            switch (result.Status)
            {
            case RequestResultStatus.Success:
                // کاربر را به سمت وب سایت درگاه پرداخت هدایت میکند
                return(new RequestActionResult(result));

            case RequestResultStatus.DuplicateOrderNumber:
                @ViewBag.hasError     = true;
                @ViewBag.errorMessage = "کد تراکنش تکراری می باشد";
                break;

            case RequestResultStatus.Failed:
                @ViewBag.hasError     = true;
                @ViewBag.errorMessage = "عدم ارتباط با پذیرنده";
                break;

            default:
                @ViewBag.hasError     = true;
                @ViewBag.errorMessage = "عدم ارتباط با پذیرنده";
                break;
            }
            @ViewBag.result = result;

            return(View());
#else
            try
            {
                var payment = _paymentRepository.Find(paymentId);
                if (payment == null)
                {
                    //show error page
                    @ViewBag.hasError     = true;
                    @ViewBag.errorMessage = "فاکتور مورد نظر یافت نشد";
                    return(View());
                }
                var factor = _factorRepository.Find(payment.FactorId);
                @ViewBag.factorId = factor.Id;

                var service  = new SaleServiceSoapClient();
                var response = service.SalePaymentRequest(new ClientSaleRequestData
                {
                    Amount       = payment.Amount,
                    CallBackUrl  = callbackUrl,
                    OrderId      = paymentId,
                    LoginAccount = LoginAccount
                });
                if (response.Status == 0)
                {
                    // کاربر را به سمت وب سایت درگاه پرداخت هدایت میکند
                    var ipgUrl = ConfigurationManager.AppSettings["ParsianIpgURL"];
                    return(Redirect(ipgUrl + response.Token));
                }
                @ViewBag.hasError     = true;
                @ViewBag.errorMessage = response.Message;
                return(View());
            }
            catch (Exception)
            {
                @ViewBag.hasError     = true;
                @ViewBag.errorMessage = "خطای داخلی سرور";
                return(View());
            }
#endif
        }