/// <summary>
        /// Constructs the Freshbooks API authentication and wrapper class
        /// </summary>
        /// <param name="accountName">The account name for which you are trying to access</param>
        /// <param name="consumerKey">The developer's freshbooks account name</param>
        /// <param name="oauthSecret">The developer's oauth-secret provided by freshbooks</param>
        public FreshbooksApi(string accountName, string consumerKey, string oauthSecret)
        {
            _accountName = accountName;
            _consumerKey = consumerKey;
            _oauthSecret = oauthSecret ?? String.Empty;

            _baseUri = new UriBuilder { Scheme = "https", Host = accountName + ".freshbooks.com" }.Uri;
            _serviceUri = new Uri(_baseUri, "/api/2.1/xml-in");
            Clear();

            UserAgent = String.Format("{0}/{1} ({2})", 
                GetType().Name,
                GetType().Assembly.GetName().Version.ToString(2), 
                GetType().Assembly.FullName);

            Callback = new CallbackService(new ServiceProxy(this, "callback"));
            Category = new CategoryService(new ServiceProxy(this, "category"));
            Client = new ClientService(new ServiceProxy(this, "client"));
            Estimate = new EstimateService(new ServiceProxy(this, "estimate"));
            Expense = new ExpenseService(new ServiceProxy(this, "expense"));
            Gateway = new GatewayService(new ServiceProxy(this, "gateway"));
            Invoice = new InvoiceService(new ServiceProxy(this, "invoice"));
            Item = new ItemService(new ServiceProxy(this, "item"));
            Language = new LanguageService(new ServiceProxy(this, "language"));
            Payment = new PaymentService(new ServiceProxy(this, "payment"));
            Project = new ProjectService(new ServiceProxy(this, "project"));
            Recurring = new RecurringService(new ServiceProxy(this, "recurring"));
            System = new SystemService(new ServiceProxy(this, "system"));
            Staff = new StaffService(new ServiceProxy(this, "staff"));
            Task = new TaskService(new ServiceProxy(this, "task"));
            Tax = new TaxService(new ServiceProxy(this, "tax"));
            TimeEntry = new TimeEntryService(new ServiceProxy(this, "time_entry"));
        }
Ejemplo n.º 2
0
 public void Connect(string apiUrl, string apiKey)
 {
     PaymillWrapper.Paymill.ApiKey = apiKey;
     PaymillWrapper.Paymill.ApiUrl = apiUrl;
     clientService = Paymill.GetService<ClientService>();
     paymentService = Paymill.GetService<PaymentService>();
     transactionService = Paymill.GetService<TransactionService>();
     refundService = Paymill.GetService<RefundService>();
 }
Ejemplo n.º 3
0
        public static PaymentService GetPaymentServiceProxy()
        {
            PaymentService paymentSvc = new PaymentService();
            paymentSvc.Url = @"http://localhost/bbps/additional_services/paymentprocessing.asmx";
            paymentSvc.Credentials = new System.Net.NetworkCredential(USER_NAME, PASSWORD);
            paymentSvc.Timeout = 300000;

            return paymentSvc;
        }
Ejemplo n.º 4
0
        public string CheckStatus()
        {
            using (PaymentService ps = new PaymentService())
            {
                BatchTransactionStatusRequest req = new BatchTransactionStatusRequest();

                Common.SetPSClientInfoHeader(req);

                req.BatchID = this.BatchId;

                BatchTransactionStatusReply r = ps.BatchTransactionStatus(req);

                return r.ResultText;
            }
        }
Ejemplo n.º 5
0
 public override string ProcessFormString(Order order, PaymentService.PageWithPaymentButton page)
 {
     return new PaymentFormHandler
     {
         Url = "http://www.interkassa.com/lib/payment.php",
         InputValues = new Dictionary<string, string>
                               {
                                   {"ik_shop_id", ShopId},
                                   {"ik_payment_amount", order.Sum.ToString("F2").Replace(",",".")},
                                   {"ik_payment_id", order.OrderID.ToString()},
                                   {"ik_payment_desc", GetOrderDescription(order.Number)},
                                   {"ik_paysystem_alias", ""}
                               }
     }.ProcessRequest();
 }
Ejemplo n.º 6
0
        public override string ProcessFormString(Order order, PaymentService.PageWithPaymentButton page)
        {
            var sum = (order.Sum / CurrencyValue).ToString("F2").Replace(",", ".");
            string message = "Orderid=" + order.OrderID + "&Amount=" + sum + "&Currency=" + "&PaymentDetails=" + "&Email=" + "&FirstName=" +
                             "&LastName=" + "&MiddleName=none&Phone=" + "&Address=" + "&Language=" + "&return_url=";

            return new PaymentFormHandler
             {
                 Url = "https://card.cyberplat.ru/cgi-bin/getform.cgi",
                 Page = page,
                 InputValues = new Dictionary<string, string>
                                      {
                                          {"version", "2.0"},
                                          {"message", message}
                                      }
             }.ProcessRequest();
        }
Ejemplo n.º 7
0
        public string Submit()
        {
            using (PaymentService ps = new PaymentService())
            {
                BatchRefundUploadRequest req = new BatchRefundUploadRequest();

                Common.SetPSClientInfoHeader(req);

                req.BatchID = this.BatchId;
                req.FirstRowIsHeader = true;
                req.IsCompressed = false;
                req.TransactionData = GetBatchData();

                BatchRefundUploadReply r = ps.BatchRefundUpload(req);

                return "";
            }
        }
        public void Init()
        {
            this.vetumaUtilities = new Mock<IVetumaUtilities>();
            this.vetumaUtilities.Setup(o => o.GetConfigKey(It.IsAny<VetumaKeys>()))
                .Returns<VetumaKeys>(o => o.ToString());
            this.vetumaUtilities.Setup(o => o.GetConfigUriKey(It.IsAny<VetumaKeys>()))
                .Returns<VetumaKeys>(o => new Uri("htt:\\paymentUri.com"));

            this.serviceMock = new Mock<IVetumaService>();
            this.serviceMock.Setup(o => o.SubmitPaymentRequest(It.IsAny<VetumaPaymentRequest>()))
                .Callback<VetumaPaymentRequest>(o => this.vetumaPaymentRequest = o);

            this.service = new PaymentService(this.serviceMock.Object, this.vetumaUtilities.Object);

            payMentRequestModel = ClassPropertyInitializator.SetProperties<PaymentRequest>(new PaymentRequest());
            payMentRequestModel.Language = TransactionLanguage.EN;
            payMentRequestModel.DirectToPolice = true;
            payMentRequestModel.UriLinks = new VetumaUriModel
            {
                CancelUri = new Uri("htt:\\tester.com"),
                ErrorUri = new Uri("htt:\\tester.com"),
                RedirectUri = new Uri("htt:\\tester.com")
            };
        }
Ejemplo n.º 9
0
 public PaymentViewModel(GroupService groupService, UserService userService, PaymentService paymentService)
 {
     this.groupService   = groupService;
     this.userService    = userService;
     this.paymentService = paymentService;
 }
Ejemplo n.º 10
0
        public ActionResult IPNHandler()
        {
            byte[] param      = Request.BinaryRead(Request.ContentLength);
            var    strRequest = Encoding.UTF8.GetString(param);

            if (!PaymentService.IsPaymentMethodActive(SystemName, Services.StoreContext.CurrentStore.Id))
            {
                Logger.Warn(new SmartException(strRequest), T("Plugins.Payments.PayPal.NoModuleLoading", "IPNHandler"));
                return(Content(string.Empty));
            }

            var sb = new StringBuilder();
            Dictionary <string, string> values;
            var settings = Services.Settings.LoadSetting <TSetting>();

            if (VerifyIPN(settings, strRequest, out values))
            {
                #region values

                decimal total = decimal.Zero;
                try
                {
                    total = decimal.Parse(values["mc_gross"], new CultureInfo("en-US"));
                }
                catch { }

                string payer_status = string.Empty;
                values.TryGetValue("payer_status", out payer_status);
                string payment_status = string.Empty;
                values.TryGetValue("payment_status", out payment_status);
                string pending_reason = string.Empty;
                values.TryGetValue("pending_reason", out pending_reason);
                string mc_currency = string.Empty;
                values.TryGetValue("mc_currency", out mc_currency);
                string txn_id = string.Empty;
                values.TryGetValue("txn_id", out txn_id);
                string txn_type = string.Empty;
                values.TryGetValue("txn_type", out txn_type);
                string rp_invoice_id = string.Empty;
                values.TryGetValue("rp_invoice_id", out rp_invoice_id);
                string payment_type = string.Empty;
                values.TryGetValue("payment_type", out payment_type);
                string payer_id = string.Empty;
                values.TryGetValue("payer_id", out payer_id);
                string receiver_id = string.Empty;
                values.TryGetValue("receiver_id", out receiver_id);
                string invoice = string.Empty;
                values.TryGetValue("invoice", out invoice);
                string payment_fee = string.Empty;
                values.TryGetValue("payment_fee", out payment_fee);

                #endregion

                sb.AppendLine("PayPal IPN:");
                foreach (KeyValuePair <string, string> kvp in values.Where(x => x.Value.HasValue()))
                {
                    sb.AppendLine(kvp.Key + ": " + kvp.Value);
                }

                switch (txn_type)
                {
                case "recurring_payment_profile_created":
                    //do nothing here
                    break;

                case "recurring_payment":
                    #region Recurring payment
                {
                    Guid orderNumberGuid = Guid.Empty;
                    try
                    {
                        orderNumberGuid = new Guid(rp_invoice_id);
                    }
                    catch { }

                    var initialOrder = OrderService.GetOrderByGuid(orderNumberGuid);
                    if (initialOrder != null)
                    {
                        var newPaymentStatus  = GetPaymentStatus(payment_status, pending_reason, total, initialOrder.OrderTotal);
                        var recurringPayments = OrderService.SearchRecurringPayments(0, 0, initialOrder.Id, null);

                        foreach (var rp in recurringPayments)
                        {
                            switch (newPaymentStatus)
                            {
                            case PaymentStatus.Authorized:
                            case PaymentStatus.Paid:
                            {
                                var recurringPaymentHistory = rp.RecurringPaymentHistory;
                                if (recurringPaymentHistory.Count == 0)
                                {
                                    //first payment
                                    var rph = new RecurringPaymentHistory
                                    {
                                        RecurringPaymentId = rp.Id,
                                        OrderId            = initialOrder.Id,
                                        CreatedOnUtc       = DateTime.UtcNow
                                    };
                                    rp.RecurringPaymentHistory.Add(rph);
                                    OrderService.UpdateRecurringPayment(rp);
                                }
                                else
                                {
                                    //next payments
                                    OrderProcessingService.ProcessNextRecurringPayment(rp);
                                }
                            }
                            break;
                            }
                        }

                        Logger.Info(new SmartException(sb.ToString()), T("Plugins.Payments.PayPal.IpnRecurringPaymentInfo"));
                    }
                    else
                    {
                        if (rp_invoice_id.IsEmpty())
                        {
                            Logger.Warn(new SmartException(sb.ToString()), T("Plugins.Payments.PayPal.IpnIrregular", "rp_invoice_id"));
                        }
                        else
                        {
                            Logger.Error(new SmartException(sb.ToString()), T("Plugins.Payments.PayPal.IpnOrderNotFound"));
                        }
                    }
                }
                    #endregion
                    break;

                default:
                    #region Standard payment
                {
                    var orderNumber     = "";
                    var orderNumberGuid = Guid.Empty;
                    if (!values.TryGetValue("custom", out orderNumber) || orderNumber.IsEmpty())
                    {
                        return(Content(string.Empty));
                    }

                    try
                    {
                        orderNumberGuid = new Guid(orderNumber);
                    }
                    catch { }

                    var order = OrderService.GetOrderByGuid(orderNumberGuid);
                    if (order != null)
                    {
                        order.HasNewPaymentNotification = true;

                        OrderService.AddOrderNote(order, sb.ToString());

                        if (settings.IpnChangesPaymentStatus)
                        {
                            var newPaymentStatus = GetPaymentStatus(payment_status, pending_reason, total, order.OrderTotal);

                            switch (newPaymentStatus)
                            {
                            case PaymentStatus.Pending:
                                break;

                            case PaymentStatus.Authorized:
                                if (OrderProcessingService.CanMarkOrderAsAuthorized(order))
                                {
                                    OrderProcessingService.MarkAsAuthorized(order);
                                }
                                break;

                            case PaymentStatus.Paid:
                                if (OrderProcessingService.CanMarkOrderAsPaid(order))
                                {
                                    OrderProcessingService.MarkOrderAsPaid(order);
                                }
                                break;

                            case PaymentStatus.Refunded:
                                if (OrderProcessingService.CanRefundOffline(order))
                                {
                                    OrderProcessingService.RefundOffline(order);
                                }
                                break;

                            case PaymentStatus.PartiallyRefunded:
                                if (OrderProcessingService.CanPartiallyRefundOffline(order, Math.Abs(total)))
                                {
                                    OrderProcessingService.PartiallyRefundOffline(order, Math.Abs(total));
                                }
                                break;

                            case PaymentStatus.Voided:
                                if (OrderProcessingService.CanVoidOffline(order))
                                {
                                    OrderProcessingService.VoidOffline(order);
                                }
                                break;

                            default:
                                break;
                            }
                        }
                    }
                    else
                    {
                        Logger.Error(new SmartException(sb.ToString()), T("Plugins.Payments.PayPal.IpnOrderNotFound"));
                    }
                }
                    #endregion
                    break;
                }
            }
            else
            {
                Logger.Error(new SmartException(strRequest), T("Plugins.Payments.PayPal.IpnFailed"));
            }

            //nothing should be rendered to visitor
            return(Content(""));
        }
Ejemplo n.º 11
0
        public override string ProcessFormString(Order order, PaymentService.PageWithPaymentButton page)
        {
            var sum = (order.Sum * CurrencyValue).ToString("F2").Replace(",", ".");
            var description = GetOrderDescription(order.Number);
            var issuer_id = order.OrderID.ToString();

            var inputValues = new Dictionary<string, string>
                                  {
                                      {"shop_id", ShopID},
                                      {"currency", CurrencyCode},
                                      {"sum", sum},
                                      {"description", description},
                                      {"message", description},
                                      {"issuer_id", issuer_id}
                                  };
            if (KeepUnique) inputValues.Add("keep_uniq", "1");
            inputValues.Add("signature", GetSignature(CurrencyCode + description + issuer_id + (KeepUnique ? "1" : string.Empty) + description + ShopID + sum + CryptoHex));

            return new PaymentFormHandler
              {
                  FormName = "_xclick",
                  Method = FormMethod.POST,
                  Page = page,
                  //Url = "https://demoney.mail.ru/pay/light/", test accaunt
                  Url = "https://money.mail.ru/pay/light/",
                  InputValues = inputValues,
              }.ProcessRequest();
        }
Ejemplo n.º 12
0
        public override string ProcessFormString(Order order, PaymentService.PageWithPaymentButton page)
        {
            var formHandler = new PaymentFormHandler
                {
                    Url = "https://sci.interkassa.com/",
                    InputValues = new Dictionary<string, string>
                        {
                            {"ik_co_id", ShopId},
                            {"ik_pm_no", order.OrderID.ToString()},
                            {"ik_am", (order.Sum / order.OrderCurrency.CurrencyValue).ToString("F2").Replace(",", ".")},
                            {"ik_desc", GetOrderDescription(order.Number)},
                            {"ik_cur", order.OrderCurrency.CurrencyCode}
                        }
                };

            if (IsCheckSign)
                formHandler.InputValues.Add("ik_sign", GetSign(formHandler.InputValues));

            return formHandler.ProcessRequest();
        }
Ejemplo n.º 13
0
        public override string ProcessFormString(Order order, PaymentService.PageWithPaymentButton page)
        {
            var paymentNo = order.OrderID.ToString();
            var sum = string.Format("{0:0.00}", order.Sum / CurrencyValue);
            var description = string.Format("Order #{0} payment", order.Number);

              return  new PaymentFormHandler
            {
                Url = Url,
                Page = page,
                InputValues = new Dictionary<string, string>
                                {

                                    {"VPSProtocol", "2.23"},
                                    {"TxType", "PAYMENT"},
                                    {"Vendor", Vendor},
                                    {"VendorTxCode", paymentNo},
                                    {"Amount", sum},
                                    {"Currency", CurrencyCode},
                                    {"Description", description},
                                    {"SuccessURL", SuccessUrl},
                                    {"FailureURL", FailUrl},
                                    {"Crypt", GetCrypt(paymentNo, sum, CurrencyCode, description, SuccessUrl, FailUrl)}
                                }
            }.ProcessRequest();
        }
Ejemplo n.º 14
0
        private void SaveCreditCard()
        {
            var pm = PaymentService.GetPaymentMethodByName(chbCreditCard.Text);

            if (pm != null)
            {
                PaymentService.DeletePaymentMethod(pm.PaymentMethodId);
            }

            if (rbRobokassaCreditcard.Checked)
            {
                var method = PaymentMethod.Create(PaymentType.Robokassa);
                method.Name        = chbCreditCard.Text;
                method.Description = chbCreditCard.Text;
                method.SortOrder   = 0;
                method.Enabled     = true;

                var id         = PaymentService.AddPaymentMethod(method);
                var parameters = new Dictionary <string, string>
                {
                    { RobokassaTemplate.MerchantLogin, txtLoginRobokassaCreditcard.Text },
                    { RobokassaTemplate.Password, txtPassRobokassaCreditcard.Text },
                    { RobokassaTemplate.CurrencyLabel, "RUR" },
                    { RobokassaTemplate.CurrencyValue, "1" }
                };
                PaymentService.UpdatePaymentParams(id, parameters);
            }

            if (rbAssistCreditcard.Checked)
            {
                var method = PaymentMethod.Create(PaymentType.Assist);
                method.Name        = chbCreditCard.Text;
                method.Description = chbCreditCard.Text;
                method.SortOrder   = 0;
                method.Enabled     = true;

                var id         = PaymentService.AddPaymentMethod(method);
                var parameters = new Dictionary <string, string>
                {
                    { AssistTemplate.Login, txtLoginAssistCreditcard.Text },
                    { AssistTemplate.Password, txtPassAssistCreditcard.Text },
                    { AssistTemplate.MerchantID, txtShopIdAssistCreditcard.Text },
                    { AssistTemplate.Sandbox, false.ToString() },
                    { AssistTemplate.CurrencyCode, "RUB" },
                    { AssistTemplate.CurrencyValue, "1" },
                    //{AssistTemplate.AssistIdCcPayment, false.ToString( ) },
                    //{AssistTemplate.CardPayment, true .ToString( ) },
                    //{AssistTemplate.PayCashPayment, false.ToString( ) },
                    //{AssistTemplate.WebMoneyPayment, false.ToString( ) },
                    //{AssistTemplate.QiwiBeelinePayment, false.ToString( ) }
                };
                PaymentService.UpdatePaymentParams(id, parameters);
            }

            if (rbPlatronCreditcard.Checked)
            {
                var method = PaymentMethod.Create(PaymentType.Platron);
                method.Name        = chbCreditCard.Text;
                method.Description = chbCreditCard.Text;
                method.SortOrder   = 0;
                method.Enabled     = true;

                var id         = PaymentService.AddPaymentMethod(method);
                var parameters = new Dictionary <string, string>
                {
                    { PlatronTemplate.MerchantId, txtSellerIdPlatronCreditcard.Text },
                    { PlatronTemplate.Currency, "RUR" },
                    { PlatronTemplate.PaymentSystem, txtPaySystemCreditcard.Text },
                    { PlatronTemplate.CurrencyValue, "1" },
                    { PlatronTemplate.SecretKey, txtPayPassCreditcard.Text },
                };
                PaymentService.UpdatePaymentParams(id, parameters);
            }

            if (rbZPaymentCreditcard.Checked)
            {
                var method = PaymentMethod.Create(PaymentType.ZPayment);
                method.Name        = chbCreditCard.Text;
                method.Description = chbCreditCard.Text;
                method.SortOrder   = 0;
                method.Enabled     = true;

                var id         = PaymentService.AddPaymentMethod(method);
                var parameters = new Dictionary <string, string>
                {
                    { ZPaymentTemplate.Purse, txtPayPoketCreditcard.Text },
                    { ZPaymentTemplate.Password, txtPassZpaymentCreditcard.Text },
                    { ZPaymentTemplate.SecretKey, txtSecretKeyZpaymentCreditcard.Text },
                    { ZPaymentTemplate.CurrencyValue, "1" },
                };
                PaymentService.UpdatePaymentParams(id, parameters);
            }
        }
Ejemplo n.º 15
0
        public override bool TakeAction()
        {
            TraceLog.ReleaseWriteFatal(_orderInfo);
            //string AppUrl = ConfigUtils.GetSetting("AppStoreUrl");
            if (AppUrl == string.Empty || _orderInfo.IndexOf("Sandbox") > 0)
            {
                AppUrl = "https://sandbox.itunes.apple.com/verifyReceipt";
            }
            HttpWebRequest req = (HttpWebRequest)WebRequest.Create(AppUrl);

            req.Method = "POST";
            byte[] ReceiptData = Encoding.UTF8.GetBytes(_orderInfo);
            Dictionary <string, string> dict = new Dictionary <string, string>();

            dict.Add("receipt-data", Convert.ToBase64String(ReceiptData));
            byte[] content = Encoding.UTF8.GetBytes(JsonUtils.Serialize(dict));
            req.ContentLength = content.Length;
            Stream stream = req.GetRequestStream();

            stream.Write(content, 0, content.Length);
            stream.Close();
            WebResponse resp = req.GetResponse();

            stream = resp.GetResponseStream();

            StreamReader reader   = new StreamReader(stream);
            string       response = reader.ReadToEnd();

            req.Abort();
            resp.Close();
            TraceLog.ReleaseWriteFatal(response);

            AppStoreInfo appStoreInfo = new AppStoreInfo();

            try
            {
                appStoreInfo = JsonUtils.Deserialize <AppStoreInfo>(response);
            }
            catch (Exception ex)
            {
                this.SaveLog(ex);
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().LoadDataError;
                return(false);
            }
            if (appStoreInfo.status != 0)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St1066_PayError;
                return(false);
            }
            //int silver = AppStoreHelper.GetSilverPiece(appStoreInfo.receipt.product_id, _gameID);
            //PaymentService.GetAppStore(_gameID, _serviceID, _passportId, silver, appStoreInfo.receipt.transaction_id, _deviceId);

            AppStoreHelper appStore = AppStoreHelper.GetSilverPiece(appStoreInfo.receipt.product_id, _gameID);

            PaymentService.GetAppStore(_gameID, _serviceID, _passportId, appStore.SilverPiece, appStore.RMB, appStoreInfo.receipt.transaction_id, _deviceId);
            // TraceLog.ReleaseWriteFatal("appstore完成");
            //TraceLog.ReleaseWriteFatal("GameID" + _gameID + "ServerID" + _serviceID);

            //int silver = 10;
            //string test = "1234567894561111111";
            //PaymentService.GetAppStore(_gameID, _serviceID, _passportId, silver, test, _deviceId);
            return(true);
        }
Ejemplo n.º 16
0
 /// <summary>
 /// Calls the PagSeguro web service and register this request for payment
 /// </summary>
 /// <param name="credentials">PagSeguro credentials</param>
 /// <returns>The Uri to where the user needs to be redirected to in order to complete the payment process</returns>
 public Uri Register(Credentials credentials)
 {
     return(PaymentService.CreateCheckoutRequest(credentials, this));
 }
Ejemplo n.º 17
0
 public SaleController(ApplicationContext db, UserService userService, PaymentService paymentService)
 {
     _db             = db;
     _userService    = userService;
     _paymentService = paymentService;
 }
Ejemplo n.º 18
0
        public static void Main(string[] args)
        {
            UserService         UserService         = new UserService();
            BookingService      BookingService      = new BookingService();
            OfferService        OfferService        = new OfferService();
            OfferRequestService OfferRequestService = new OfferRequestService();
            PaymentService      PaymentService      = new PaymentService();
            LocationService     LocationService     = new LocationService();

            while (true)
            {
Login:
                Console.WriteLine("1 -> SignUp\n2 -> SignIn\n0 -> Exit");

                IEnums.CarPoolOptions Option = (IEnums.CarPoolOptions)Convert.ToInt32(Console.ReadLine());
                switch (Option)
                {
                case IEnums.CarPoolOptions.SignUp:
                {
                    Console.WriteLine("enter name:");
                    string Name = Console.ReadLine();
                    Console.WriteLine("enter Password:"******"Name: " + NewUser.Name);
                    Console.WriteLine("UserId: " + NewUser.UserId);
                    Console.WriteLine("Account Created Successfully!!");
                    break;
                }

                case IEnums.CarPoolOptions.SignIn:
                {
                    Console.WriteLine("enter UserId:");
                    string UserId = Console.ReadLine();
                    Console.WriteLine("enter Password:"******"Your Booking Status: " + Booking.Status);
                                if (Booking.Status.Equals(IEnums.BookingStatus.Confirmed))
                                {
                                    Offer Offer = OfferService.GetDriverDetails(Booking.RiderId);
                                    Console.WriteLine("Drivername: " + Offer.DriverName + ", VehicleNumber: " + Offer.VehicleRegNumber + ", VehicleModel: " + Offer.VehicleModel);
                                }
                                Console.ReadKey();
                                Console.WriteLine("1 -> Book a Ride\n5 -> Display bookings history\n6 -> Display created offers history\n7 -> Cancel Ride\n10 -> Pay\n11 -> Add money to wallet\n" +
                                                  "13 -> wallet Balance\n14 -> display payment History\n0 -> Logout");
                            }
                            else if (OfferService.AnyActiveOffer(UserId))
                            {
                                Console.WriteLine("4 -> Display Offer requests\n5 -> Display bookings history\n" +
                                                  "6 -> Display offers history\n8 -> Cancel Offer\n9 -> End Ride\n15 -> End Offer\n10 -> Pay\n11 -> Add money to wallet\n" +
                                                  "13 -> wallet Balance\n14 -> display payment History\n0 -> Logout");
                            }
                            else
                            {
                                Console.WriteLine("1 -> Book a Ride\n2 -> Offer a Ride\n5 -> Display booking history\n" +
                                                  "6 -> Display offers history\n10 -> Pay\n11 -> Add money to wallet\n" +
                                                  "13 -> wallet Balance\n14 -> display payment History\n0 -> Logout");
                            }

                            IEnums.UserOptions UserOption = (IEnums.UserOptions)Convert.ToInt32(Console.ReadLine());
                            switch (UserOption)
                            {
                            case IEnums.UserOptions.BookARide:
                            {
                                if (PaymentService.IsEligibleToBook(UserId))
                                {
                                    Console.WriteLine("enter pick-up location:");
                                    string   PickUpLocation = Console.ReadLine();
                                    Location FromLocation   = LocationService.GetLocation(PickUpLocation.ToUpper());
                                    if (FromLocation != null)
                                    {
                                        Console.WriteLine("enter Destination:");
                                        string   Destination = Console.ReadLine();
                                        Location ToLocation  = LocationService.GetLocation(Destination.ToUpper());
                                        if (ToLocation != null)
                                        {
                                            Console.WriteLine("number of passengers:");
                                            int          NumberOfPassengers = Convert.ToInt32(Console.ReadLine());
                                            List <Offer> ActiveOffers       = OfferService.DisplayActiveOffers(PickUpLocation.ToUpper(), Destination.ToUpper(), NumberOfPassengers);
                                            if (ActiveOffers.Count == 0)
                                            {
                                                Console.WriteLine("no active offers");
                                            }
                                            else
                                            {
                                                foreach (var offer in ActiveOffers)
                                                {
                                                    Console.WriteLine("Drivername: " + offer.DriverName + " RiderId " + offer.RiderId + " Vehicle Number: " + offer.VehicleRegNumber + " Vehicle Model: " + offer.VehicleModel + " Phone Number: " + offer.PhoneNumber);
                                                }
                                                Console.WriteLine("enter Riders userId to select the offer\nRider UserId:");
                                                string RiderId = Console.ReadLine();
                                                OfferRequestService.SendRideRequest(FromLocation, ToLocation, NumberOfPassengers, RiderId.ToUpper(), UserId.ToUpper());
                                                Booking NewBooking = BookingService.CreateBooking(RiderId, UserId, FromLocation, ToLocation, NumberOfPassengers);
                                            }
                                        }
                                        else
                                        {
                                            Console.WriteLine(Destination + " not found");
                                        }
                                    }
                                    else
                                    {
                                        Console.WriteLine(PickUpLocation + " not found");
                                    }
                                }
                                else
                                {
                                    Console.WriteLine("pay your pending dues to book for next ride");
                                    Console.WriteLine("do you want to pay now?");
                                    Console.WriteLine("1 -> paynow\n2 -> later");
                                    IEnums.PaymentDecision Decision = (IEnums.PaymentDecision)Convert.ToInt32(Console.ReadLine());
                                    if (Decision.Equals(IEnums.PaymentDecision.Now))
                                    {
                                        List <Payment> PaymentDues = PaymentService.DisplayPendingDues(UserId);
                                        foreach (var payment in PaymentDues)
                                        {
                                            Console.WriteLine("BookingId: " + payment.PaymentID + ", amount to be paid: " + payment.Fair);
                                        }
                                        Console.WriteLine("enter paymentId: ");
                                        string PaymentId = Console.ReadLine();
                                        if (PaymentService.Pay(PaymentId))
                                        {
                                            Console.WriteLine("payment done successfully!!");
                                        }
                                        else
                                        {
                                            Console.WriteLine("insufficient wallet balance");
                                            Console.WriteLine("Do you want to add money to the wallet?");
                                            Console.WriteLine("1 -> yes\n2 -> no");
                                            IEnums.YesOrNo Choice = (IEnums.YesOrNo)Convert.ToInt32(Console.ReadLine());
                                            if (Choice.Equals(IEnums.YesOrNo.Yes))
                                            {
                                                Console.WriteLine("enter amount: ");
                                                double Amount = Convert.ToDouble(Console.ReadLine());
                                                UserService.AddMoneyToWallet(Amount, UserId);
                                                Console.WriteLine("Money added successfully!!");
                                            }
                                        }
                                    }
                                }
                                break;
                            }

                            case IEnums.UserOptions.OfferARide:
                            {
                                Console.WriteLine("enter name:");
                                string Name = Console.ReadLine();
                                Console.WriteLine("enter From location:");
                                string   FromLocation = Console.ReadLine();
                                Location StartPoint   = LocationService.GetLocation(FromLocation.ToUpper());
                                if (StartPoint != null)
                                {
                                    Console.WriteLine("enter To location:");
                                    string   ToLocation = Console.ReadLine();
                                    Location EndPoint   = LocationService.GetLocation(ToLocation.ToUpper());
                                    if (EndPoint != null)
                                    {
                                        Console.WriteLine("enter Availability");
                                        int Availability = Convert.ToInt32(Console.ReadLine());
                                        Console.WriteLine("enter Vehicle Number");
                                        string VehicleNumber = Console.ReadLine();
                                        Console.WriteLine("enter Vehicle Model");
                                        string VehicleModel = Console.ReadLine();
                                        if (OfferService.VehicleVerification(VehicleNumber))
                                        {
                                            Offer           Offer     = OfferService.CreateOffer(Name.ToUpper(), UserId, StartPoint, EndPoint, Availability, VehicleNumber.ToUpper(), VehicleModel.ToUpper());
                                            List <Location> ViaPoints = LocationService.GetViaPoints(StartPoint, EndPoint);
                                            if (ViaPoints.Count != 0)
                                            {
                                                int SelectViaPoint = 0;
                                                do
                                                {
                                                    Console.WriteLine("you might touch these locations: ");
                                                    foreach (var location in ViaPoints)
                                                    {
                                                        Console.WriteLine(location.Index + " -> " + location.Name);
                                                    }
                                                    Console.WriteLine("0 -> end");
                                                    Console.WriteLine("selects the locations: ");
                                                    SelectViaPoint = Convert.ToInt32(Console.ReadLine());
                                                    IEnums.LocationIndex LocationIndex = (IEnums.LocationIndex)SelectViaPoint;
                                                    OfferService.AddViaPoint(Offer, LocationIndex);
                                                } while (SelectViaPoint != 0);

                                                Console.WriteLine("offer created successfully!!");
                                            }
                                            else
                                            {
                                                Console.WriteLine("Cannot use same vehicle for two offers");
                                            }
                                        }
                                    }
                                    else
                                    {
                                        Console.WriteLine(ToLocation + " not found");
                                    }
                                }
                                else
                                {
                                    Console.WriteLine(FromLocation + " not found");
                                }
                                break;
                            }

                            case IEnums.UserOptions.DisplayCurrentBookingStatus:
                            {
                                Booking Booking = BookingService.ViewBookingStatus(UserId);
                                if (Booking != null)
                                {
                                    Console.WriteLine("Rider: " + Booking.RiderId + " From " + Booking.FromLocation + " To " + Booking.ToLocation + " Status " + Booking.Status);
                                }
                                else
                                {
                                    Console.WriteLine("you have no current bookings");
                                }
                                break;
                            }

                            case IEnums.UserOptions.DisplayOfferRequests:
                            {
                                if (OfferRequestService.AnyOfferRequest(UserId))
                                {
                                    List <OfferRequest> OfferRequests = OfferRequestService.DisplayOfferRequests(UserId);
                                    foreach (var offerRequest in OfferRequests)
                                    {
                                        Console.WriteLine("RequestId: " + offerRequest.RequestId + " from " + offerRequest.FromLocation + " to " + offerRequest.ToLocation);
                                    }
                                    Console.WriteLine("enter the RequestId to accept or reject offer request");
                                    string RequestId = Console.ReadLine();
                                    Console.WriteLine("1 -> Accept offer\n2 -> reject offer");
                                    IEnums.Decisions Decision = (IEnums.Decisions)Convert.ToInt32(Console.ReadLine());
                                    OfferRequestService.OfferRequestApproval(RequestId.ToUpper(), Decision);
                                }
                                else
                                {
                                    Console.WriteLine("no offers requests to display");
                                }
                                break;
                            }

                            case IEnums.UserOptions.DisplayBookingHistory:
                            {
                                List <Booking> AllBookings = BookingService.DisplayBookingsHistory(UserId);
                                if (AllBookings != null)
                                {
                                    foreach (var booking in AllBookings)
                                    {
                                        Console.WriteLine("From: " + booking.FromLocation.Name + " to " + booking.ToLocation.Name + " Status: " + booking.Status);
                                    }
                                }
                                else
                                {
                                    Console.WriteLine("no bookings to display");
                                }
                                break;
                            }

                            case IEnums.UserOptions.DisplayOfferHistory:
                            {
                                List <Offer> AllOffers = OfferService.DisplayOffersHistory(UserId);
                                if (AllOffers != null)
                                {
                                    foreach (var offer in AllOffers)
                                    {
                                        Console.WriteLine("From: " + offer.FromLocation.Name + " to " + offer.ToLocation.Name + " Status: " + offer.Status);
                                    }
                                }
                                else
                                {
                                    Console.WriteLine("no offers to display");
                                }
                                break;
                            }

                            case IEnums.UserOptions.CancelRide:
                            {
                                List <Booking> ActiveBookings = BookingService.DisplayActiveBookings(UserId);
                                if (ActiveBookings != null)
                                {
                                    foreach (var booking in ActiveBookings)
                                    {
                                        Console.WriteLine("RiderId: " + booking.RiderId + " From " + booking.FromLocation.Name + " to " + booking.ToLocation.Name + " Status: " + booking.Status);
                                    }
                                    Console.WriteLine("enter RiderId to cancel: ");
                                    string RiderId = Console.ReadLine();
                                    BookingService.CancelRide(RiderId);
                                    Console.WriteLine("Ride Cancelled");
                                }
                                else
                                {
                                    Console.WriteLine("no active bookings to cancel");
                                }
                                break;
                            }

                            case IEnums.UserOptions.CancelOffer:
                            {
                                OfferService.CancelOffer(UserId);
                                Console.WriteLine("Offer Cancelled");
                                break;
                            }

                            case IEnums.UserOptions.EndRide:
                            {
                                List <string> PassengersInVehicle = BookingService.DisplayPassengersInVehicle(UserId);
                                foreach (var Passenger in PassengersInVehicle)
                                {
                                    Console.WriteLine("RideeId: " + Passenger);
                                }
                                Console.WriteLine("enter ridee Id");
                                string RideeId = Console.ReadLine();
                                BookingService.EndRide(UserId, RideeId);
                                break;
                            }

                            case IEnums.UserOptions.Pay:
                            {
                                List <Payment> PendingPayments = PaymentService.DisplayPendingDues(UserId);
                                if (PendingPayments.Count != 0)
                                {
                                    foreach (var payment in PendingPayments)
                                    {
                                        Console.WriteLine("PaymentId: " + payment.PaymentID + ", Fair: " + payment.Fair);
                                    }
                                    Console.WriteLine("enter paymentId: ");
                                    string PaymentId = Console.ReadLine();
                                    if (PaymentService.Pay(PaymentId))
                                    {
                                        Console.WriteLine("payment done successfully!!");
                                    }
                                    else
                                    {
                                        Console.WriteLine("insufficient wallet balance");
                                        Console.WriteLine("Do you want to add money to the wallet?");
                                        Console.WriteLine("1 -> yes\n2 -> no");
                                        IEnums.YesOrNo Choice = (IEnums.YesOrNo)Convert.ToInt32(Console.ReadLine());
                                        if (Choice.Equals(IEnums.YesOrNo.Yes))
                                        {
                                            Console.WriteLine("enter amount: ");
                                            double Amount = Convert.ToDouble(Console.ReadLine());
                                            UserService.AddMoneyToWallet(Amount, UserId);
                                            Console.WriteLine("Money added successfully!!");
                                        }
                                    }
                                }
                                else
                                {
                                    Console.WriteLine("no pending dues");
                                }
                                break;
                            }

                            case IEnums.UserOptions.AddMoneyToWallet:
                            {
                                Console.WriteLine("enter amount: ");
                                double Amount = Convert.ToDouble(Console.ReadLine());
                                UserService.AddMoneyToWallet(Amount, UserId);
                                Console.WriteLine("Money added successfully!!");
                                break;
                            }

                            case IEnums.UserOptions.WalletBalance:
                            {
                                Console.WriteLine("your wallet balance: " + UserService.DisplayWalletBalance(UserId));
                                break;
                            }

                            case IEnums.UserOptions.DisplayPaymentHistory:
                            {
                                List <Payment> AllPayments = PaymentService.DisplayPaymentHistory(UserId);
                                if (AllPayments.Count != 0)
                                {
                                    foreach (var payment in AllPayments)
                                    {
                                        if (payment.RideeId.Equals(UserId))
                                        {
                                            Console.WriteLine("PaymentId: " + payment.PaymentID + " to " + payment.RiderId + " Status: " + payment.Status);
                                        }
                                        else if (payment.RiderId.Equals(UserId))
                                        {
                                            Console.WriteLine("PaymentId: " + payment.PaymentID + " from " + payment.RideeId + " Status: " + payment.Status);
                                        }
                                    }
                                }
                                else
                                {
                                    Console.WriteLine("you have no payments to display");
                                }
                                break;
                            }

                            case IEnums.UserOptions.Logout:
                            {
                                goto Login;
                            }
                            }
                        }
                    }
                    else
                    {
                        Console.WriteLine("Incorrect userId or password");
                    }
                    break;
                }

                case IEnums.CarPoolOptions.Exit:
                {
                    System.Environment.Exit(0);
                    break;
                }
                }
            }
        }
Ejemplo n.º 19
0
 public override bool TakeAction()
 {
     SaveLog(string.Format("91SKD充值>>Order:{0},Pid:{1},servicename:{2}", OrderID, passportId, servicename));
     PaymentService.Get91Payment(gameID, serviceID, passportId, servicename, OrderID);
     return(true);
 }
 public ExpenditureController(ExpenditureService expenditureService, CategoryService categoryService, PaymentService paymentService)
 {
     _expenditureService = expenditureService;
     _categoryService    = categoryService;
     _paymentService     = paymentService;
 }
Ejemplo n.º 21
0
        private async void MakeRequest()
        {
            IsLoading = true;
            PaymentService paymentApi = new PaymentService();
            ApiService     api        = new ApiService();

            var account          = MainViewModel.GetInstance().MenuVM.AccountInstance;
            var personalResponse = await api.Get <PersonalAccount>(Constants.PERSONAL_ACCOUNT, account.PhoneNumber);

            if (!personalResponse.IsSuccess)
            {
                await Application.Current.MainPage.DisplayAlert(
                    "¡Ups!",
                    "Algo salió intentando recopilar tu información",
                    "Ok");

                await Application.Current.MainPage.Navigation.PushModalAsync(new MenuPage());

                return;
            }

            var personalAccount = (PersonalAccount)personalResponse.Result;

            var authentication = new Authentication(Key.PlaceToPayLogin, Key.PlaceToPaySecretKey);

            PaymentInfo paymentInfo = new PaymentInfo
            {
                buyer = new Buyer
                {
                    document     = personalAccount.IdNumber,
                    documentType = "CI",
                    email        = account.Email,
                    mobile       = account.PhoneNumber,
                    name         = personalAccount.Name,
                    surname      = personalAccount.Lastname
                },
                payment = new Payment
                {
                    reference   = ServiceSummaryInstance.service_name,
                    description = "LOCKEC",
                    amount      = new Amount
                    {
                        currency = "USD",
                        total    = ServiceSummaryInstance.service_cost
                    },
                },
                expiration    = (DateTime.Now.AddMinutes(15)).ToString("yyyy-MM-ddTHH:mm:sszzz"),
                ipAddress     = GetLocalAddress(),
                returnUrl     = "https://www.google.com/",
                userAgent     = "Xamarin Forms Web View",
                paymentMethod = "",
                auth          = new Auth
                {
                    login   = Key.PlaceToPayLogin,
                    tranKey = authentication.getTranKey(),
                    nonce   = authentication.getNonce(),
                    seed    = authentication.getSeed()
                }
            };

            var paymentResponse = await paymentApi.Post <PaymentInfo, PaymentStatus>(paymentInfo);

            if (!paymentResponse.IsSuccess)
            {
                await Application.Current.MainPage.DisplayAlert(
                    "¡Ups!",
                    "Algo salió mal intentando generar el pago",
                    "Ok");

                await Application.Current.MainPage.Navigation.PushModalAsync(new MenuPage());

                return;
            }

            var payment = (PaymentStatus)paymentResponse.Result;

            PaymentURL = payment.processUrl;
            IsLoading  = false;
            return;
        }
Ejemplo n.º 22
0
        public override string ProcessFormString(Order order, PaymentService.PageWithPaymentButton page)
        {
            string sum = System.Math.Round((order.Sum * CurrencyValue), 1).ToString().Replace(",", ".");
            if (CheckMd5)
            {
                return new PaymentFormHandler
                 {
                     FormName = "_xclick",
                     Method = FormMethod.GET,
                     Page = page,
                     Url = "http://secure.onpay.ru/pay/" + FormPay,
                     InputValues = new Dictionary<string, string>
                                      {
                                          {"url_success", SuccessUrl},
                                          {"pay_mode", "fix"},
                                          {"price", sum},
                                          {"currency", CurrencyLabel},
                                          {"pay_for", order.OrderID.ToString()},
                                          {
                                             "md5",
                                             ("fix" + sum + ";" + CurrencyLabel + ";" + order.Number + ";yes;" + SecretKey).Md5()
                                             }
                                      }
                 }.ProcessRequest();
            }

            else
            {
                return new PaymentFormHandler
                 {
                     FormName = "_xclick",
                     Method = FormMethod.GET,
                     Page = page,
                     Url = "http://secure.onpay.ru/pay/" + FormPay,
                     InputValues = new Dictionary<string, string>
                                      {
                                          {"url_success", SuccessUrl},
                                          {"pay_mode", "fix"},
                                          {"price", sum},
                                          {"currency", CurrencyLabel},
                                          {"pay_for", order.OrderID.ToString()}
                                      }
                 }.ProcessRequest();
            }
        }
 public OrderingProcessManager(OrderService orderService, PaymentService paymentService)
 {
     _orderService   = orderService;
     _paymentService = paymentService;
 }
Ejemplo n.º 24
0
 public override string ProcessFormString(Order order, PaymentService.PageWithPaymentButton page)
 {
     var paymentNo = order.OrderID.ToString();
     var sum = (order.Sum / CurrencyValue).ToString("F2").Replace(",", ".");
     var tempRandomString = new Guid().ToString();
     return new PaymentFormHandler
       {
           Url = Url,
           Page = page,
           InputValues = new Dictionary<string, string>
                               {
                                   {"pg_amount", sum},
                                   {"pg_currency", Currency},
                                   {"pg_description",Resources.Resource.Client_OrderConfirmation_PayOrder + " #" +order.OrderID},
                                   {"pg_merchant_id", MerchantId},
                                   {"pg_order_id", paymentNo},
                                   {"pg_salt", tempRandomString},
                                   {"pg_sig", GetSignature("payment.php"+Separator
                                                            + sum + Separator
                                                            + Currency + Separator
                                                            + Resources.Resource.Client_OrderConfirmation_PayOrder + " #" + order.OrderID + Separator
                                                            + MerchantId + Separator
                                                            + paymentNo + Separator
                                                            + tempRandomString )}
                               }
       }.ProcessRequest();
 }
Ejemplo n.º 25
0
        public JsonResult UpdatePendingDiets(int caseId, int caseDetailId, int transactionId, DateTime?fechadecision, DateTime?fechavisita,
                                             DateTime?fechanotificacion, string numerocaso, decimal?montototal, string periods, string comment, string caseNumber)
        {
            DateTime workingDate = DateTime.Now;

            var transaction = TransactionService.FindTransactionById(transactionId);

            transaction.CaseDetailId       = caseDetailId;
            transaction.TransactionAmount  = montototal;
            transaction.Comment            = comment;
            transaction.TransactionDate    = workingDate;
            transaction.ICCaseNumber       = numerocaso;
            transaction.NotificationDateIC = fechanotificacion;
            transaction.HearingDateIC      = fechavisita;

            TransactionService.ModifyTransaction(transaction);

            var serializedPeriods = JsonConvert.DeserializeObject <List <PeriodDiet> >(periods);

            foreach (var period in serializedPeriods)
            {
                short totalDays = (short)(period.Hasta - period.Desde).TotalDays;

                bool isNewPayment = period.PaymentId == 0;
                if (isNewPayment)
                {
                    var payment = new Payment()
                    {
                        CaseId           = transaction.CaseDetail.CaseId,
                        CaseDetailId     = transaction.CaseDetailId,
                        CaseNumber       = transaction.CaseDetail.CaseNumber,
                        TransactionId    = transaction.TransactionId,
                        ConceptId        = 2,
                        ClassId          = 11,
                        Amount           = montototal,
                        StatusId         = 12,
                        IssueDate        = fechadecision,
                        StatusChangeDate = workingDate,
                        FromDate         = period.Desde,
                        ToDate           = period.Hasta,
                        Discount         = period.Descuento,
                        PaymentDay       = totalDays
                    };

                    PaymentService.CreatePayment(payment);
                }
                else
                {
                    var existingPayment = PaymentService.FindPaymentById(period.PaymentId);
                    existingPayment.IssueDate        = fechadecision;
                    existingPayment.StatusChangeDate = workingDate;
                    existingPayment.FromDate         = period.Desde;
                    existingPayment.ToDate           = period.Hasta;
                    existingPayment.Discount         = period.Descuento;
                    existingPayment.PaymentDay       = totalDays;

                    PaymentService.ModifyPayment(existingPayment);
                }
            }

            return(Json(new BasicDataTablesResult(new { Status = "OK" })));
        }
Ejemplo n.º 26
0
 public BalanceServiceTest()
 {
     paymentService = new PaymentService();
     loanService    = new LoanService();
 }
Ejemplo n.º 27
0
 public override string ProcessFormString(Order order, PaymentService.PageWithPaymentButton page)
 {
     var sum = String.Format(CultureInfo.InvariantCulture, "{0:0.00}", order.Sum);
     return new PaymentFormHandler
      {
          Url = Url,
          Page = page,
          InputValues = new Dictionary<string, string>
                               {
                                   {"product_id", ProductId  },
                                   {"product_name",ProductName },
                                   {"product_price",sum},
                                   {"product_price_currency",order.OrderCurrency.CurrencyCode },
                                   {"cb_url", NotificationUrl},
                                   {"decline_url", CancelUrl},
                                   {"cb_type", "P"},
                                   {"cs1",order.OrderID.ToString()},
                                   {"sign",String.Format("{0}-{1}-{2}", ProductId, sum, SharedSecret).Md5()}
                               }
      }.ProcessRequest();
 }
Ejemplo n.º 28
0
        public override string ProcessFormString(Order order, PaymentService.PageWithPaymentButton page)
        {
            int index = 0;
            if (!string.IsNullOrEmpty(order.BillingContact.Name)) index = order.BillingContact.Name.IndexOf(" ");
            string first_name = string.Empty;
            string last_name = string.Empty;
            if (index > 0)
            {
                first_name = order.BillingContact.Name.Substring(0, index).Trim();
                last_name = order.BillingContact.Name.Substring(index + 1).Trim();
            }
            else
                first_name = order.BillingContact.Name.Trim();

            return new PaymentFormHandler
               {
                   FormName = "_xclick",
                   Method = FormMethod.POST,
                   Url = GetUrl(),
                   Page = page,
                   InputValues = new Dictionary<string, string>
                                      {
                                          {"cmd", Command},
                                          {"business", EMail},
                                          {"charset", "utf-8"},
                                          {"currency_code", CurrencyCode},
                                          {"item_name", string.Format("Order #{0}", order.OrderID)},
                                          {"invoice", order.Number},
                                          {"amount", CurrencyService.ConvertCurrency(ShowTaxAndShipping ? order.Sum - order.TaxCost - order.ShippingCost : order.Sum, CurrencyValue,order.OrderCurrency.CurrencyValue).ToString("F2").Replace(",", ".")},
                                          {"tax", CurrencyService.ConvertCurrency(ShowTaxAndShipping ? order.TaxCost : 0, CurrencyValue,order.OrderCurrency.CurrencyValue).ToString("F2").Replace(",", ".")},
                                          {"shipping", CurrencyService.ConvertCurrency(ShowTaxAndShipping ? order.ShippingCost : 0, CurrencyValue,order.OrderCurrency.CurrencyValue).ToString("F2").Replace(",", ".")},
                                          {"address1", (order.BillingContact.Address ?? string.Empty).Replace("\n", "")},
                                          {"city", order.BillingContact.City ?? string.Empty},
                                          {"country", AdvantShop.Repository.CountryService.GetIso2(order.BillingContact.Country ?? string.Empty) ?? string.Empty},
                                          {"lc", AdvantShop.Repository.CountryService.GetIso2(order.BillingContact.Country ?? string.Empty) ?? string.Empty},
                                          //{"email", order.BillingContact.Email ?? string.Empty},
                                          {"email", order.OrderCustomer .Email ?? string.Empty},
                                          {"first_name", first_name ?? string.Empty},
                                          {"last_name", last_name ?? string.Empty},
                                          {"zip", order.BillingContact.Zip ?? string.Empty},
                                          {"state", order.BillingContact.Zone ?? string.Empty},
                                          {"return", SuccessUrl},
                                          {"notify_url", NotificationUrl},
                                          {"cancel_return", CancelUrl}
                                      }
               }.ProcessRequest();
        }
Ejemplo n.º 29
0
 public override string ProcessFormString(Order order, PaymentService.PageWithPaymentButton page)
 {
     return new PaymentFormHandler
      {
          Url = "https://merchant.webmoney.ru/lmi/payment.asp",
          Page = page,
          InputValues = new Dictionary<string, string>
                               {
                                   {"LMI_PAYEE_PURSE", Purse},
                                   {"LMI_PAYMENT_NO", order.OrderID.ToString()},
                                   {"LMI_PAYMENT_DESC", Resources.Resource.Client_OrderConfirmation_PayOrder + " #" + order.OrderID},
                                   {"LMI_PAYMENT_AMOUNT", (order.Sum / CurrencyValue).ToString("F2").Replace(",",".")},
                                   {"LMI_RESULT_URL", NotificationUrl},
                                   {"LMI_SUCCESS_URL", SuccessUrl},
                                   {"LMI_SUCCESS_METHOD", "LINK"},
                                   {"LMI_FAIL_URL", FailUrl},
                                   {"LMI_FAIL_METHOD", "LINK"}
                               }
      }.ProcessRequest(true);
 }
Ejemplo n.º 30
0
 public UserController(PaymentService paymentService, PkiManager pkiManager)
 {
     _paymentService = paymentService;
     _pkiManager     = pkiManager;
 }
Ejemplo n.º 31
0
 public override string ProcessFormString(Order order, PaymentService.PageWithPaymentButton page)
 {
     string sum = (order.Sum * CurrencyValue).ToString("#0.##").Replace(',', '.');
     // порядок из формата
     var values = new Dictionary<string, string>
         {
             {"AMOUNT", sum},
             {"CURRENCY", CurrencyLabel},
             {"ORDER", GetOrderIdString(order.OrderID)},
             {"DESC", string.Format("order #{0} payment", order.Number)},
             {"MERCH_NAME", MerchName},
             {"MERCH_URL", SettingsMain.SiteUrl.ToLower()},
             {"MERCHANT", Merchant},
             {"TERMINAL", Terminal},
             {"EMAIL", Email},
             {"TRTYPE", "1"},
             {"COUNTRY", Culture.Language == Culture.ListLanguage.Russian ? "RU" : "EN"},
             {"MERCH_GMT", (DateTime.Now - DateTime.UtcNow).Hours.ToString()},
             {"TIMESTAMP", DateTime.UtcNow.ToString("yyyyMMddHHmmss")},
             {"NONCE", GenerateNonce()},
             {"BACKREF", SuccessUrl}
         };
     values.Add("P_SIGN", GetPSign(values));
     return new PaymentFormHandler
     {
         FormName = "_xclick",
         Method = FormMethod.POST,
         Page = page,
         Url = "https://3ds2.mmbank.ru/cgi-bin/cgi_link",
         InputValues = values
     }.ProcessRequest();
 }
Ejemplo n.º 32
0
 /// <summary>
 /// Prevents a default instance of the <see cref="PayUPayments"/> class from being created.
 /// </summary>
 private PayUPayments()
 {
     this.paymentService = new PaymentService();
 }
Ejemplo n.º 33
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (!Visible)
        {
            return;
        }

        if (ValidateFormData())
        {
            var parameters = _ucSpecific == null ? null : _ucSpecific.Parameters;

            if (parameters != null)
            {
                var method = new ShippingMethod
                {
                    Type             = ShippingType,
                    ShippingMethodId = ShippingMethodID,
                    Name             = txtName.Text,
                    Description      = txtDescription.Text,
                    SortOrder        = txtSortOrder.Text.TryParseInt(),
                    Enabled          = chkEnabled.Checked && (_ucSpecific == null || _ucSpecific.Parameters != null)
                };
                if (ShippingMethodService.UpdateShippingMethod(method))
                {
                    if (ShippingType == ShippingType.eDost)
                    {
                        //COD
                        if (Convert.ToBoolean(parameters[EdostTemplate.EnabledCOD]))
                        {
                            int idShip = 0;
                            Int32.TryParse(parameters[EdostTemplate.ShipIdCOD], out idShip);
                            var payment = PaymentService.GetPaymentMethod(idShip);
                            if (payment == null)
                            {
                                var payMethod = PaymentMethod.Create(PaymentType.CashOnDelivery);
                                payMethod.Name    = Resources.Resource.CashOnDeliveryName;
                                payMethod.Enabled = true;
                                if (payMethod.Parameters.ContainsKey(CashOnDelivery.ShippingMethodTemplate))
                                {
                                    payMethod.Parameters[CashOnDelivery.ShippingMethodTemplate] = ShippingMethodID.ToString();
                                }
                                else
                                {
                                    payMethod.Parameters.Add(CashOnDelivery.ShippingMethodTemplate,
                                                             ShippingMethodID.ToString());
                                }

                                var id = PaymentService.AddPaymentMethod(payMethod);
                                parameters[EdostTemplate.ShipIdCOD] = id.ToString();
                            }
                        }
                        else
                        {
                            int idShip = 0;
                            Int32.TryParse(parameters[EdostTemplate.ShipIdCOD], out idShip);
                            PaymentService.DeletePaymentMethod(idShip);
                        }

                        //PickPoint
                        if (Convert.ToBoolean(parameters[EdostTemplate.EnabledPickPoint]))
                        {
                            int idShip = 0;
                            Int32.TryParse(parameters[EdostTemplate.ShipIdPickPoint], out idShip);
                            var payment = PaymentService.GetPaymentMethod(idShip);
                            if (payment == null)
                            {
                                var payMethod = PaymentMethod.Create(PaymentType.PickPoint);
                                payMethod.Name    = Resources.Resource.OrderPickPointMessage;
                                payMethod.Enabled = true;
                                if (payMethod.Parameters.ContainsKey(PickPoint.ShippingMethodTemplate))
                                {
                                    payMethod.Parameters[PickPoint.ShippingMethodTemplate] = ShippingMethodID.ToString();
                                }
                                else
                                {
                                    payMethod.Parameters.Add(PickPoint.ShippingMethodTemplate, ShippingMethodID.ToString());
                                }
                                var id = PaymentService.AddPaymentMethod(payMethod);
                                parameters[EdostTemplate.ShipIdPickPoint] = id.ToString();
                            }
                        }
                        else
                        {
                            int idShip = 0;
                            Int32.TryParse(parameters[EdostTemplate.ShipIdPickPoint], out idShip);
                            PaymentService.DeletePaymentMethod(idShip);
                        }
                    }

                    var payments = new System.Collections.Generic.List <int>();
                    foreach (RepeaterItem item in rptrPayments.Items)
                    {
                        if (!((CheckBox)item.FindControl("ckbUsePayment")).Checked)
                        {
                            payments.Add(Convert.ToInt32(((HiddenField)item.FindControl("hfPaymentId")).Value));
                        }
                    }
                    ShippingMethodService.UpdateShippingPayments(ShippingMethodID, payments);

                    if (ShippingMethodService.UpdateShippingParams(method.ShippingMethodId, parameters))
                    {
                        Method = ShippingMethodService.GetShippingMethod(method.ShippingMethodId);
                        LoadFormData(_ucSpecific != null && _ucSpecific.Parameters != null);
                        OnSaved(new SavedEventArgs {
                            Enabled = method.Enabled, Name = method.Name
                        });
                    }
                }
            }
        }
    }
Ejemplo n.º 34
0
 public StripePaymentProvider(PaymentService paymentService)
 {
     _paymentService = paymentService;
 }
Ejemplo n.º 35
0
 public BettingPlatformEmulator()
 {
     Account        = new Account("USD");
     betService     = new BetService();
     paymentService = new PaymentService();
 }
 public HistoryViewModel(PaymentService paymentService)
 {
     this.paymentService = paymentService;
 }
Ejemplo n.º 37
0
 public PaymentController(PaymentService service) => _service = service;
Ejemplo n.º 38
0
        public override string ProcessFormString(Order order, PaymentService.PageWithPaymentButton page)
        {
            var paymentNo = order.OrderID.ToString();
            var sum = string.Format("{0:0.00}", order.Sum / CurrencyValue);
            var description = string.Format("Order #{0} payment", order.Number);

            return new PaymentFormHandler
              {
                  Url = Url,
                  Page = page,
                  InputValues = new Dictionary<string, string>
                                      {

                                          {"instId", InstID.ToString()},
                                          {"cartId", paymentNo},
                                          {"Amount", sum},
                                          {"currency", CurrencyCode},
                                          {"desc", description},
                                          {"SuccessURL", SuccessUrl},
                                          {"FailureURL", FailUrl},
                                          //FIELDS TO ENCRYPTION instId:amount:currency:cartId
                                          {"signature", (InstID.ToString() + sum + CurrencyCode + paymentNo).Md5()},
                                          {"MC_code", (sum + CurrencyCode + paymentNo).Md5()}
                                      }
              }.ProcessRequest();
        }
Ejemplo n.º 39
0
 public PaymentController(PaymentService paymentService, DanceCampService danceCampService, IOptionsSnapshot <DanceCampOptions> danceCampOptions, ILogger logger)
 {
     _paymentService   = paymentService;
     _danceCampService = danceCampService;
     _logger           = logger;
 }
Ejemplo n.º 40
0
        /// <summary>
        /// Saves the specified payment service settings.
        /// </summary>
        /// <param name="paymentServiceSettings">The payment service settings.</param>
        public int Save(PaymentServiceSettings paymentServiceSettings, string userName)
        {
            int id = PaymentService.Save(paymentServiceSettings, userName);

            return(id);
        }
Ejemplo n.º 41
0
 protected void Page_Init(object sender, EventArgs e)
 {
     _allPaymentMethods = PaymentService.GetAllPaymentMethods(true).Select(item => (PaymentItem)item).ToList();
 }
Ejemplo n.º 42
0
        public override string ProcessFormString(Order order, PaymentService.PageWithPaymentButton page)
        {
            var paymentNo = order.OrderID.ToString();
            var sum = (order.Sum / CurrencyValue).ToString("F2").Replace(",", ".");

            return new PaymentFormHandler
                {
                    Url = Url,
                    Page = page,
                    InputValues = new Dictionary<string, string>
                                      {
                                          {"MerchantId", MerchantId},
                                          {"OrderId", paymentNo},
                                          {"Amount",sum},
                                          {"Currency",Currency},
                                          {"SecurityKey",GetMd5("MerchantId="+MerchantId+"&OrderId="+paymentNo+"&Amount="+sum+"&Currency="+Currency+"&PrivateSecurityKey="+SecretKey) },
                                          {"ReturnUrl", HttpUtility.UrlDecode(SuccessUrl)},
                                          {"FailUrl", HttpUtility.UrlDecode(FailUrl)}
                                         }
                }.ProcessRequest();
        }
Ejemplo n.º 43
0
        public JsonResult UpdateInvestments(UpdateInvestmentRequest model)
        {
            var transaction = TransactionService.FindTransactionById(model.TransactionId);
            var workingDate = DateTime.Now;
            var amount      = decimal.Zero;

            var modelPayments = ConvertToPaymentModel(model);

            var paymentsToUpdate = BuildInvestmentPaymentSets(modelPayments, transaction.Payments);

            foreach (var newPayment in paymentsToUpdate["new"])
            {
                var newEntity = new Entity
                {
                    FullName = newPayment.Remitter.FullName,
                    SourceId = 9
                };

                EntityService.CreateEntity(newEntity);

                var payment = new Payment
                {
                    CaseId           = model.CaseId,
                    CaseDetailId     = model.CaseDetailId,
                    TransactionId    = transaction.TransactionId,
                    CaseNumber       = model.CaseNumber,
                    ConceptId        = 2,
                    ClassId          = 3,
                    Amount           = newPayment.Amount,
                    EntityId_RemitTo = newEntity.EntityId,
                    Remitter         = newEntity,
                    ToDate           = transaction.TransactionDate,
                    TransactionNum   = transaction.TransactionId.ToString().PadLeft(9, '0'),
                    CheckBk          = 0,
                    StatusId         = 2,
                    IssueDate        = workingDate,
                    StatusChangeDate = workingDate
                };

                PaymentService.CreatePayment(payment);

                amount += payment.Amount.GetValueOrDefault(decimal.Zero);
            }

            foreach (var changedPayment in paymentsToUpdate["changed"])
            {
                if (changedPayment != null && changedPayment.EntityId_RemitTo == null)
                {
                    continue;
                }
                if (changedPayment == null)
                {
                    continue;
                }
                var existingEntity = EntityService.GetById(changedPayment.EntityId_RemitTo.Value);
                var payment        = PaymentService.FindPaymentById(changedPayment.PaymentId);

                if (changedPayment.Remitter != null)
                {
                    existingEntity.FullName = changedPayment.Remitter.FullName;
                }
                EntityService.ModifyEntity(existingEntity);

                payment.Amount = payment.Amount.GetValueOrDefault(decimal.Zero);
                PaymentService.ModifyPayment(payment);

                amount += payment.Amount.Value;
            }

            foreach (var removedPayment in paymentsToUpdate["removed"])
            {
                if (removedPayment == null)
                {
                    continue;
                }
                var transactionId = removedPayment.TransactionId;
                PaymentService.Delete(removedPayment.PaymentId);
                if (removedPayment.EntityId_RemitTo != null)
                {
                    EntityService.Delete(removedPayment.EntityId_RemitTo);
                }
                if (transactionId != null)
                {
                    TransactionService.Delete(transactionId.Value);
                }
            }

            transaction.TransactionAmount = amount;
            transaction.Comment           = model.Comment;

            TransactionService.ModifyTransaction(transaction);

            return(Json(new BasicDataTablesResult(new { Status = "OK" })));
        }
Ejemplo n.º 44
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try // Orders info
        {
            //-------------------------------------------

            using (var db = new SQLDataAccess())
            {
                db.cmd.CommandText = "[Order].[sp_GetOrderAvg]";
                db.cmd.CommandType = CommandType.StoredProcedure;
                db.cmd.Parameters.Clear();
                db.cnOpen();
                using (SqlDataReader reader = db.cmd.ExecuteReader())
                    while (reader.Read())
                    {
                        if (SQLDataHelper.GetString(reader, "flag") == "ByDay")
                        {
                            lblAvOrders.Text = SQLDataHelper.GetString(reader, "Count") ?? "0";
                        }
                        else
                        {
                            lblAvItems.Text = SQLDataHelper.GetString(reader, "Count") ?? "0";
                        }
                    }

                db.cmd.CommandText = "SELECT avg([Sum]) FROM [Order].[Order] WHERE [PaymentDate] is not null";
                db.cmd.CommandType = CommandType.Text;
                object value = db.cmd.ExecuteScalar();
                if (value != DBNull.Value)
                {
                    lblAvCheck.Text = AdvantShop.Catalog.CatalogService.GetStringPrice((decimal)(value));
                }
                else
                {
                    lblAvCheck.Text = AdvantShop.Catalog.CatalogService.GetStringPrice(0);
                }
                db.cmd.CommandText = "select top 1 [PaymentMethodID] from [Order].[Order] where [PaymentDate] is not null group by [PaymentMethodID] order by count(*) desc";
                value = db.cmd.ExecuteScalar();

                if (value != DBNull.Value && value != null)
                {
                    LblPopPayment.Text = PaymentService.GetPaymentMethod((int)value).Name;
                }

                db.cmd.CommandText = "select top 1 [ShippingMethodID] from [Order].[Order]  where [PaymentDate] is not null group by [ShippingMethodID] order by count(*) desc";
                value = db.cmd.ExecuteScalar();
                if (value != DBNull.Value && value != null)
                {
                    LblPopShipping.Text = ShippingMethodService.GetShippingMethod((int)value).Name;
                }


                //db.cmd.CommandText = "select (sum([Sum]) - SUM([SupplyTotal]) - sum([TaxCost])- sum([ShippingCost])) as 'Profit' , sum([Sum]) as 'Sum' from [Order].[Order] WHERE [PaymentDate] is not null";
                //db.cmd.CommandText = "select (1 -  (SUM([SupplyTotal]) /( sum([Sum]) - sum([TaxCost]) - sum([ShippingCost])))) *100 from [Order].[Order] WHERE [PaymentDate] is not null";
                db.cmd.CommandText = "select case when sum([Sum]) - sum([TaxCost]) - sum([ShippingCost])= 0 then 0 else (1 -  (SUM([SupplyTotal]) /( sum([Sum]) - sum([TaxCost]) - sum([ShippingCost])))) *100 end from [Order].[Order] WHERE [PaymentDate] is not null";
                //(sum([Sum] - sum([TaxCost]) - [Shipping] + [ExtraCharge])/([Sum] - [Tax] - [Shipping])*100 as 'Profitability'

                value = db.cmd.ExecuteScalar();
                if (value != DBNull.Value && value != null)
                {
                    LblProfitability.Text = Convert.ToDecimal(value).ToString("F2") + "%";
                }
                else
                {
                    LblProfitability.Text = @"0%";
                }


                db.cmd.CommandText = "select top 1 [Country] from [Order].[OrderContact] inner join [Order].[Order] on [Order].[ShippingContactID] = [OrderContact].[OrderContactID] WHERE [OrderID] in (select top 1 [OrderID] from [Order].[Order] where [PaymentDate] is not null ) group by [Country] order by count (*) desc";
                value = db.cmd.ExecuteScalar();
                if (value != DBNull.Value && value != null)
                {
                    LblCountry.Text = (string)(value);
                }
                db.cmd.CommandText = "select top 1 [Zone] from [Order].[OrderContact] inner join [Order].[Order] on [Order].[ShippingContactID] = [OrderContact].[OrderContactID] WHERE [OrderID] in (select top 1 [OrderID] from [Order].[Order] where [PaymentDate] is not null ) group by [Zone] order by count (*) desc";
                value = db.cmd.ExecuteScalar();
                if (value != DBNull.Value && value != null)
                {
                    LblRegion.Text = (string)(value);
                }

                db.cmd.CommandText = "[Order].[sp_GetUserPercent]";
                db.cmd.CommandType = CommandType.StoredProcedure;
                decimal unreg = 200;
                value = db.cmd.ExecuteScalar();
                if (value != DBNull.Value)
                {
                    unreg = Convert.ToDecimal(value);
                }
                if (unreg == 200)
                {
                    LblReg.Text   = @"0%";
                    LblUnreg.Text = @"0%";
                }
                else
                {
                    LblReg.Text   = (100 - unreg).ToString("F0") + '%';
                    LblUnreg.Text = unreg.ToString("F0") + '%';
                }
                db.cnClose();
            }
        }
        catch (Exception ex)
        {
            MsgErr(ex.Message + " atLoad Orders Info");
            Debug.LogError(ex);
        }
    }
Ejemplo n.º 45
0
        public void HandlePaymentCashTest()
        {
            PaymentService pymnt = new PaymentService();

            pymnt.DoPayment(Models.PaymentModel.PaymentType.CASH, 4000);
        }
Ejemplo n.º 46
0
 public PayDepositHandler(IPaymentRepository paymentRepository, PaymentService paymentService)
 {
     _paymentRepository = paymentRepository;
     _paymentService    = paymentService;
 }
Ejemplo n.º 47
0
 public override string ProcessFormString(Order order, PaymentService.PageWithPaymentButton page)
 {
     var paymentNo = order.OrderID.ToString();
     var sum = (order.Sum / CurrencyValue).ToString("F2").Replace(",", ".");
     return new PaymentFormHandler
       {
           Url = Url,
           Page = page,
           InputValues = new Dictionary<string, string>
                               {
                                   {"LMI_PAYEE_PURSE", Purse},
                                   {"LMI_PAYMENT_NO", paymentNo},
                                   {"LMI_PAYMENT_DESC", Resources.Resource.Client_OrderConfirmation_PayOrder + " #" + order.OrderID},
                                   {"LMI_PAYMENT_AMOUNT", sum},
                                   {"ZP_SIGN", GetSign(paymentNo,sum)}
                               }
       }.ProcessRequest(true);
 }
 public PaymentController()
 {
     _PaymentService = new PaymentService();
     _GameServices   = new GameService();
 }
Ejemplo n.º 49
0
 public override string ProcessFormString(Order order, PaymentService.PageWithPaymentButton page)
 {
     var paymentNo = order.OrderID.ToString();
     var sum = string.Format("{0:0.00}", order.Sum / CurrencyValue);
     return new PaymentFormHandler
      {
          Url = Url,
          Page = page,
          InputValues = new Dictionary<string, string>
                         {
                             {"merchant", Merchant},
                             {"trans_id", paymentNo},
                             {"amount", sum},
                             {"callback", SuccessUrl},
                             {"currency", CurrencyCode},
                             {"digest", (paymentNo + sum + Password).Md5()}
                         }
      }.ProcessRequest();
 }
Ejemplo n.º 50
0
 public override string ProcessFormString(Order order, PaymentService.PageWithPaymentButton page)
 {
     return new PaymentFormHandler
      {
          Url = Sandbox ? "https://au.ewaygateway.com/Request/" : "https://www.eway.com.au/gateway/payment.asp",
          Page = page,
          InputValues = new Dictionary<string, string>
                               {
                                   {"ewayCustomerID", CustomerID},
                                   {"eWAYURL", SuccessUrl},
                                   {"ewayTotalAmount", ((order.Sum / CurrencyValue) * 100) .ToString("F0")},
                                   {"ewayCustomerInvoiceDescription", Resources.Resource.Client_OrderConfirmation_PayOrder + " #" + order.OrderID},
                                   {"ewayTrxnNumber", order.Number}
                               }
      }.ProcessRequest();
 }
Ejemplo n.º 51
0
 public override string ProcessFormString(Order order, PaymentService.PageWithPaymentButton page)
 {
     return new PaymentFormHandler
     {
         Url = "http://www.qppi.ru/Pay/Listener",
         InputValues = new Dictionary<string, string>
                               {
                                   {"MerchantXid", MerchantXid},
                                   {"PrivateSecurityKey", PrivateSecurityKey},
                                   {"ExternalProjectID", order.OrderID.ToString()},
                                   {"ExternalProjectName", ExternalProjectName},
                                   {"ExternalUserID", order.OrderCustomer.Email},
                                   {"CurrencySid", "RUR"},
                                   {"MerchantOrderNo", order.OrderID.ToString()},
                                   {"Amount", order.Sum.ToString()},
                                   {"IsTestMode", Sandbox.ToString()},
                                   {"SecurityKey", string.Format("{0}{1}{2}{3}{4}{5}", order.OrderID, DateTime.Now.ToString("yyyyMMddHHmmss"), PrivateSecurityKey, order.Sum, order.OrderCustomer.Email, Sandbox).Md5(false, Encoding.ASCII)},
                                   {"NowUtc", DateTime.Now.ToString("yyyyMMddHHmmss")}
                               }
     }.ProcessRequest();
 }
Ejemplo n.º 52
0
        public override string ProcessFormString(Order order, PaymentService.PageWithPaymentButton page)
        {
            var xml = GetOperationXml(order);

            return new PaymentFormHandler
            {
                Url = "https://www.liqpay.com/?do=clickNbuy",
                InputValues = new Dictionary<string, string>
                                      {
                                          {"operation_xml", GetOperation(xml)},
                                          {"signature", GetSignature(xml)}
                                      }
            }.ProcessRequest();
        }
Ejemplo n.º 53
0
        public static string ProcessOrder(Order order, PaymentService.PageWithPaymentButton page)
        {
            if (order != null)
            {
                var paymentMethod = order.PaymentMethod;
                if (paymentMethod == null)
                    return string.Empty;
                if (paymentMethod.ProcessType == ProcessType.FormPost)
                {
                    //paymentMethod.ProcessForm(order);
                    //return null;

                    return paymentMethod.ProcessFormString(order, page);
                }
                if (paymentMethod.ProcessType == ProcessType.ServerRequest)
                {
                    string href = paymentMethod.ProcessServerRequest(order);

                    if (page == PaymentService.PageWithPaymentButton.myaccount)
                    {
                        return Button.RenderHtml(Resource.Client_OrderConfirmation_PayOrder,
                                                 Button.eType.Confirm, Button.eSize.Small,
                                                 href: href);
                    }
                    else
                    {
                        return Button.RenderHtml(Resource.Client_OrderConfirmation_PayOrder,
                                                 Button.eType.Submit, Button.eSize.Middle,
                                                 href: href);
                    }
                }

                if (paymentMethod.ProcessType == ProcessType.Javascript)
                {
                    string[] companyAccount = {
                                                  order.PaymentDetails != null ? HttpUtility.HtmlEncode(order.PaymentDetails.CompanyName): string.Empty,
                                                  order.PaymentDetails != null ? HttpUtility.HtmlEncode(order.PaymentDetails.INN) : string.Empty
                                              };

                    var pm = (order.PaymentMethod == null)
                        ? PaperPaymentType.NonPaperMethod
                        : order.PaymentMethod.Type.ToEnum<PaperPaymentType>();

                    var printButtonText = new Dictionary<PaperPaymentType, string>
                                      {
                                          {PaperPaymentType.NonPaperMethod, Resource.Client_OrderConfirmation_PayNonPaperMethod},
                                          {PaperPaymentType.SberBank, Resource.Client_OrderConfirmation_PrintLuggage},
                                          {PaperPaymentType.Bill, Resource.Client_OrderConfirmation_PrintBill},
                                          {PaperPaymentType.Check, Resource.Client_OrderConfirmation_PrintCheck},
                                          {PaperPaymentType.BillUa, Resource.Client_OrderConfirmation_PrintBill}
                                      };
                    if (page == PaymentService.PageWithPaymentButton.myaccount)
                    {
                        return paymentMethod.ProcessJavascript(order) + " " + Button.RenderHtml(printButtonText[pm],
                                                                                                Button.eType.Confirm, Button.eSize.Small,
                                                                                                onClientClick: paymentMethod.ProcessJavascriptButton(order));
                    }
                    else
                    {
                        return paymentMethod.ProcessJavascript(order) + " " + Button.RenderHtml(printButtonText[pm],
                                                                                                Button.eType.Submit, Button.eSize.Middle,
                                                                                                onClientClick: paymentMethod.ProcessJavascriptButton(order));
                    }
                }
            }
            return string.Empty;
        }
Ejemplo n.º 54
0
 public HomeController(PaymentService paymentService, AccountManager accountManager)
 {
     this.paymentService = paymentService;
     this.accountManager = accountManager;
 }
Ejemplo n.º 55
0
        public override string ProcessFormString(Order order, PaymentService.PageWithPaymentButton page)
        {
            var sum = (order.Sum / CurrencyValue).ToString("F2").Replace(",", ".");
            var shopName = Configuration.SettingsMain.ShopName;
            if (shopName.Length > 30)
                shopName = shopName.Substring(0, 26) + "...";
            return new PaymentFormHandler
              {
                  Url = Url,
                  Page = page,
                  InputValues = new Dictionary<string, string>
                                      {
                                          {"pay_to_email", PayToEmai },
                                          {"recipient_description", shopName },
                                          {"transaction_id",order.OrderID.ToString()},
                                          {"return_url", SuccessUrl},
                                          {"cancel_url", CancelUrl},
                                          {"status_url", NotificationUrl},
                                          {"language","en_US" },
                                          {"amount",sum },
                                          {"currency", CurrencyCode },
                                          {"detail1_description", "Order ID:"},
                                          {"detail1_text", order.OrderID.ToString()},

                                      }
              }.ProcessRequest();
        }
Ejemplo n.º 56
0
        public override string ProcessFormString(Order order, PaymentService.PageWithPaymentButton page)
        {
            int sequence = new Random().Next(0, 1000);

            // a time stamp is generated (using a function from simlib.asp)
            int timeStamp = SQLDataHelper.GetInt((DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds);

            //generate a fingerprint
            string fingerprint = HMAC_MD5(TransactionKey,
                                          Login + "^" + sequence + "^" + timeStamp + "^" + order.Sum + "^");

            //TODO deal with POST

              return  new PaymentFormHandler
            {
                FormName = "_xclick",
                Method = FormMethod.POST,
                Page = page,
                Url =
                    string.Format("https://{0}/gateway/transact.dll",
                                  Sandbox ? "test.authorize.net" : "secure.authorize.net"),
                InputValues = new Dictionary<string, string>
                                      {
                                          {"x_login", Login},
                                          {"x_fp_sequence", sequence.ToString()},
                                          {"x_fp_timestamp", timeStamp.ToString()},
                                          {"x_fp_hash", fingerprint},
                                          {"x_relay_url", SuccessUrl},
                                          {"x_invoice_num", order.Number},
                                          {"x_test_request", "false"},
                                          {"x_show_form", "PAYMENT_FORM"},
                                          {"x_description", string.Format("Order #{0}", order.Number)},
                                          {"x_amount", order.Sum.ToString()},
                                          {"x_first_name", order.OrderCustomer.FirstName},
                                          {"x_last_name", order.OrderCustomer.LastName},
                                          {"x_address", order.BillingContact.Address},
                                          {"x_city", order.BillingContact.City},
                                          {"x_zip", order.BillingContact.Zip},
                                          {"x_phone", order.OrderCustomer.MobilePhone},
                                          {"x_email", order.OrderCustomer .Email},
                                      }
            }.ProcessRequest();
        }
Ejemplo n.º 57
0
        public override string ProcessFormString(Order order, PaymentService.PageWithPaymentButton page)
        {
            Dictionary<string, string> dict = new Dictionary<string, string>
                {
                    {"sid", Sid},
                    {"mode", "2CO"},
                    //{"cart_order_id", order.Number},
                    //{"merchant_order_id", order.Number},
                    //{"total", (order.Sum/CurrencyValue).ToString("F2").Replace(",", ".")},
                    {"demo", Sandbox ? "Y" : "N"},
                    //{"return_url", SuccessUrl},
                    //{"x_receipt_link_url", SuccessUrl},
                    //{"id_type", "1"},
                    //{"lang", "en"}
                };

            for (int i = 0; i < order.OrderItems.Count; i++)
            {
                dict.Add("li_" + i + "_type", "product");
                dict.Add("li_" + i + "_name", order.OrderItems[i].Name.Replace(">", "").Replace("<", ""));
                dict.Add("li_" + i + "_quantity", order.OrderItems[i].Amount.ToString());
                dict.Add("li_" + i + "_price", order.OrderItems[i].Price.ToString("F2"));
                dict.Add("li_" + i + "_tangible", "Y");
            }

            return new PaymentFormHandler
             {
                 Url = "https://www.2checkout.com/checkout/purchase",
                 Page = page,
                 InputValues = dict
             }.ProcessRequest();
        }
Ejemplo n.º 58
0
 public override string ProcessFormString(Order order, PaymentService.PageWithPaymentButton page)
 {
     return new PaymentFormHandler
     {
         Url = "https://bitpay.com/api/invoice/",
         InputValues = new Dictionary<string, string>
                               {
                                   //{"posData", GetPosData(order.OrderItems)},
                                   {"price", order.Sum.ToString("F2").Replace(",", ".")},
                                   {"currency", Currency},
                                   {"orderID", order.OrderID.ToString()},
                                   {"itemDesc", string.Format(Resources.Resource.Payment_OrderDescription, order.Number)},
                                   {"physical", "true"}
                               }
     }.ProcessRequest();
 }
Ejemplo n.º 59
0
 public override string ProcessFormString(Order order, PaymentService.PageWithPaymentButton page)
 {
     return new PaymentFormHandler
      {
          FormName = "pay",
          Method = FormMethod.POST,
          Page = page,
          Url =
              string.Format("https://{0}/api/checkout/v2/checkoutForm/Merchant/{1}",
                            Sandbox ? "sandbox.google.com/checkout" : "checkout.google.com", MerchantID),
          InputValues = new Dictionary<string, string>
                               {
                                   {"item_currency_1", CurrencyCode},
                                   {
                                       "item_name_1",
                                       Resource.Client_OrderConfirmation_PayOrder + " #" + order.Number
                                       },
                                   {
                                       "item_description_1",
                                       Resource.Client_OrderConfirmation_PayOrder + " #" + order.Number
                                       },
                                   {"item_quantity_1", "1"},
                                   {
                                       "item_price_1",
                                       CurrencyService.ConvertCurrency(order.Sum, CurrencyValue,
                                                                       order.OrderCurrency.CurrencyValue).
                                       ToString().Replace(",", ".")
                                       },
                                   {"item_merchant_id_1", order.Number},
                                   {"return", SuccessUrl},
                                   {"cancel_return", CancelUrl},
                                   {"_charset_", ""}
                               }
      }.ProcessRequest();
 }
Ejemplo n.º 60
0
 public void SetupScenario()
 {
     _transactionNotifications = A.Fake <ITransactionNotifications>();
     _paymentService           = new PaymentService(_transactionNotifications);
 }