public ActionResult PayPerMembership()
        {
            OptionsModel options = new OptionsModel()
            {
                public_key  = "-your public key for Bitcoin box-",
                private_key = "-your private key for Bitcoin box-",
                webdev_key  = "",
                orderID     = "premium_membership",
                userID      = "",
                userFormat  = "COOKIE",
                amount      = 0,
                amountUSD   = (decimal)0.2,
                period      = "1 MONTH",
                language    = "en"
            };

            using (Cryptobox cryptobox = new Cryptobox(options))
            {
                if (cryptobox.is_paid())
                {
                    if (!cryptobox.is_processed())
                    {
                        ViewBag.Message = "Thank you (order #" + options.orderID + ", payment #" +
                                          cryptobox.payment_id() + "). We upgraded your membership to Premium";
                        cryptobox.set_status_processed();
                    }
                    else
                    {
                        ViewBag.Message = "You have a Premium Membership";
                    }
                }
                DisplayCryptoboxModel model = cryptobox.GetDisplayCryptoboxModel();
                return(View(model));
            }
        }
Esempio n. 2
0
        public ActionResult Cryptobox(OptionsModel options)
        {
            using (Cryptobox cryptobox = new Cryptobox(options))
            {
                DisplayCryptoboxModel model = cryptobox.GetDisplayCryptoboxModel();

                return(PartialView("Partial/_Cryptobox", model));
            }
        }
        public ActionResult PayPerPost()
        {
            OptionsModel options = new OptionsModel()
            {
                public_key  = "-your public key for Bitcoin box-",
                private_key = "-your private key for Bitcoin box-",
                webdev_key  = "",
                orderID     = "post1",
                userID      = "",
                userFormat  = "COOKIE",
                amount      = 0,
                amountUSD   = (decimal)0.01,
                period      = "NOEXPIRY",
                language    = "en"
            };

            using (Cryptobox cryptobox = new Cryptobox(options))
            {
                string ftitle = Request.Form["ftitle"] ?? "";
                string ftext  = Request.Form["ftext"] ?? "";
                ViewBag.error      = "";
                ViewBag.successful = false;
                ViewBag.ftitle     = ftitle;
                ViewBag.ftext      = ftext;

                if (Request.Form["ftitle"] != null && Request.Form["ftext"] != null)
                {
                    if (ftitle == "")
                    {
                        ViewBag.error += "<li>Please enter Title</li>";
                    }
                    if (ftext == "")
                    {
                        ViewBag.error += "<li>Please enter Text</li>";
                    }
                    if (!cryptobox.is_paid())
                    {
                        ViewBag.error += "<li>" + cryptobox.coin_name() + "s have not yet been received</li>";
                    }
                    if (ViewBag.error != "")
                    {
                        ViewBag.error = "<br><ul style='color:#eb4847'>" + ViewBag.error + "</ul>";
                    }

                    if (cryptobox.is_paid() && ViewBag.error == "")
                    {
                        ViewBag.successful = true;
                        cryptobox.set_status_processed();
                        cryptobox.cryptobox_reset();
                    }
                }

                DisplayCryptoboxModel model = cryptobox.GetDisplayCryptoboxModel();

                return(View(model));
            }
        }
        public ActionResult Basic()
        {
            OptionsModel options = new OptionsModel()
            {
                public_key  = "-your public key for Bitcoin box-",
                private_key = "-your private key for Bitcoin box-",
                webdev_key  = "",
                orderID     = "your_product1_or_signuppage1_etc",
                userID      = "",
                userFormat  = "COOKIE",
                amount      = 0,
                amountUSD   = 2,
                period      = "24 HOUR",
                iframeID    = "",
                language    = "DE"
            };

            using (Cryptobox cryptobox = new Cryptobox(options))
            {
                DisplayCryptoboxModel model = cryptobox.GetDisplayCryptoboxModel();
                // A. Process Received Payment
                if (cryptobox.is_paid())
                {
                    ViewBag.Message = "A. User will see this message during 24 hours after payment has been made!" +
                                      "<br/>" + cryptobox.amount_paid() + " " + cryptobox.coin_label() +
                                      "  received<br/>";
                    // Your code here to handle a successful cryptocoin payment/captcha verification
                    // For example, give user 24 hour access to your member pages

                    // B. One-time Process Received Payment
                    if (!cryptobox.is_processed())
                    {
                        ViewBag.Message += "B. User will see this message one time after payment has been made!";
                        // Your code here - for example, publish order number for user
                        // ...

                        // Also you can use is_confirmed() - return true if payment confirmed
                        // Average transaction confirmation time - 10-20min for 6 confirmations

                        // Set Payment Status to Processed
                        cryptobox.set_status_processed();

                        // Optional, cryptobox_reset() will delete cookies/sessions with userID and
                        // new cryptobox with new payment amount will be show after page reload.
                        // Cryptobox will recognize user as a new one with new generated userID
                        // cryptobox_reset();
                    }
                }
                ViewBag.Message = "The payment has not been made yet";

                return(View(model));
            }
        }
        public ActionResult PayPerProduct()
        {
            OptionsModel options = new OptionsModel()
            {
                public_key  = "-your public key for Bitcoin box-",
                private_key = "-your private key for Bitcoin box-",
                webdev_key  = "",
                orderID     = "invoice000383",
                userID      = "",
                userFormat  = "COOKIE",
                amount      = 0,
                amountUSD   = (decimal)0.01,
                period      = "NOEXPIRY",
                language    = "en"
            };

            using (Cryptobox cryptobox = new Cryptobox(options))
            {
                if (cryptobox.is_paid())
                {
                    if (!cryptobox.is_confirmed())
                    {
                        ViewBag.message = "Thank you for order (order #" + options.orderID + ", payment #" + cryptobox.payment_id() +
                                          "). Awaiting transaction/payment confirmation";
                    }
                    else
                    {
                        if (!cryptobox.is_processed())
                        {
                            ViewBag.message = "Thank you for order (order #" + options.orderID + ", payment #" + cryptobox.payment_id() + "). Payment Confirmed<br/> (User will see this message one time after payment has been made)";
                            cryptobox.set_status_processed();
                        }
                        else
                        {
                            ViewBag.message = "Thank you for order (order #" + options.orderID + ", payment #" + cryptobox.payment_id() + "). Payment Confirmed<br/> (User will see this message during " + options.period + " period after payment has been made)";
                        }
                    }
                }
                else
                {
                    ViewBag.message = "This invoice has not been paid yet";
                }

                DisplayCryptoboxModel model = cryptobox.GetDisplayCryptoboxModel();

                return(View(model));
            }
        }
        public ActionResult PayPerJson()
        {
            OptionsModel options = new OptionsModel()
            {
                public_key  = "-your gourl.io public key for Bitcoin/Dogecoin/etc box-",
                private_key = "-your gourl.io private key for Bitcoin/Dogecoin/etc box-",
                webdev_key  = "",
                orderID     = "invoice22",
                userID      = "",
                userFormat  = "COOKIE",
                amount      = 0,
                amountUSD   = (decimal)0.01,
                period      = "NOEXPIRY",
                language    = "en"
            };

            using (Cryptobox cryptobox = new Cryptobox(options))
            {
                ViewBag.JsonUrl = cryptobox.cryptobox_json_url();
                ViewBag.Message = "";
                DisplayCryptoboxModel model = cryptobox.GetDisplayCryptoboxModel();
                if (HttpContext.Request.Form["cryptobox_refresh_"] != null)
                {
                    ViewBag.Message = "<div class='gourl_msg'>";
                    if (cryptobox.is_paid())
                    {
                        ViewBag.Message += "<div style=\"margin:50px\" class=\"well\"><i class=\"fa fa-info-circle fa-3x fa-pull-left fa-border\" aria-hidden=\"true\"></i> " + Controls.localisation[model.language].MsgNotReceived.Replace("%coinName%", model.coinName)
                                           .Replace("%coinNames%", model.coinLabel == "BCH" || model.coinLabel == "DASH" ? model.coinName : model.coinName + "s")
                                           .Replace("%coinLabel%", model.coinLabel) + "</div>";
                    }
                    else if (cryptobox.is_processed())
                    {
                        ViewBag.Message += "<div style=\"margin:70px\" class=\"alert alert-success\" role=\"alert\"> " + (model.boxType == "paymentbox"
                        ? Controls.localisation[model.language].MsgReceived
                        : Controls.localisation[model.language].MsgReceived2)
                                           .Replace("%coinName%", model.coinName)
                                           .Replace("%coinLabel%", model.coinLabel)
                                           .Replace("%amountPaid%", model.amoutnPaid.ToString()) + "</div>";
                        cryptobox.set_status_processed();
                    }
                    ViewBag.Message = "</div>";
                }



                return(View(model));
            }
        }
Esempio n. 7
0
        public static string cryptobox_hash(DisplayCryptoboxModel model, bool json = false, int width = 0, int height = 0)
        {
            string hash_str = "";

            if (json)
            {
                hash_str = string.Join("|",
                                       model.boxID,
                                       model.coinName,
                                       model.public_key,
                                       model.private_key,
                                       model.webdev_key,
                                       model.amount.ToString("0.####", CultureInfo.InvariantCulture),
                                       model.amountUSD.ToString("0.####", CultureInfo.InvariantCulture),
                                       model.period,
                                       model.language,
                                       model.orderID,
                                       model.userID,
                                       model.userFormat,
                                       HttpContext.Current.Request.UserHostAddress);
            }
            else
            {
                hash_str = string.Join("|",
                                       model.boxID,
                                       model.coinName,
                                       model.public_key,
                                       model.private_key,
                                       model.webdev_key,
                                       model.amount.ToString("0.####", CultureInfo.InvariantCulture),
                                       model.amountUSD.ToString("0.####", CultureInfo.InvariantCulture),
                                       model.period,
                                       model.language,
                                       model.orderID,
                                       model.userID,
                                       model.userFormat,
                                       model.iframeID,
                                       width,
                                       height);
            }
            return(Calculator.md5(hash_str));
        }
        public ActionResult PayPerPage()
        {
            OptionsModel options = new OptionsModel()
            {
                public_key  = "-your public key for Bitcoin box-",
                private_key = "-your private key for Bitcoin box-",
                webdev_key  = "",
                orderID     = "page1",
                userID      = "",
                userFormat  = "COOKIE",
                amount      = 0,
                amountUSD   = (decimal)0.01,
                period      = "24 HOUR",
                language    = "en"
            };

            using (Cryptobox cryptobox = new Cryptobox(options))
            {
                DisplayCryptoboxModel model = cryptobox.GetDisplayCryptoboxModel();

                return(View(model));
            }
        }
        public ActionResult PayPerDownload()
        {
            ViewBag.filename = "my_file1.zip";
            string       dir     = "protected";
            OptionsModel options = new OptionsModel()
            {
                public_key  = "-your public key for Bitcoin box-",
                private_key = "-your private key for Bitcoin box-",
                webdev_key  = "",
                orderID     = Calculator.md5(dir + ViewBag.filename),
                userID      = "",
                userFormat  = "COOKIE",
                amount      = 0,
                amountUSD   = (decimal)0.2,
                period      = "24 HOUR",
                iframeID    = "",
                language    = "EN"
            };

            using (Cryptobox cryptobox = new Cryptobox(options))
            {
                if (cryptobox.is_paid())
                {
                    ViewBag.DownloadLink = "href = " + Url.Action("Download");
                    cryptobox.set_status_processed();
                }
                else
                {
                    ViewBag.DownloadLink = "onclick='alert(\"You need to send " + cryptobox.coin_name() +
                                           "s first !\")' href='#a'";
                }

                DisplayCryptoboxModel model = cryptobox.GetDisplayCryptoboxModel();

                return(View(model));
            }
        }
Esempio n. 10
0
        public ActionResult SecuredPayment(double cryptoamount)
        {
            var transaction = new CryptoTransaction();
            var account     = new CryptoAccount();
            var accountId   = AccountId();

            transaction.Create(new TransactionVm()
            {
                Status             = TransactionStatus.PENDING,
                Amount             = Convert.ToDecimal(cryptoamount),
                accountId          = AccountId(),
                CurrencyDomination = "BTC",
                TransactionType    = TransactionTypeStatus.Credit
            });
            OptionsModel options = new OptionsModel()
            {
                public_key  = GoUrlKeys.PublicKey,
                private_key = GoUrlKeys.PrivateKey,
                webdev_key  = "",
                orderID     = transaction.savedId.ToString(),
                userID      = UserId(),
                userFormat  = "COOKIE",
                //amount = 0,
                amountUSD = Convert.ToDecimal(cryptoamount),
                period    = "2 HOUR",
                language  = "en"
            };

            ViewBag.transId = transaction.savedId.ToString();
            using (Cryptobox cryptobox = new Cryptobox(options))
            {
                ViewBag.JsonUrl = cryptobox.cryptobox_json_url();
                ViewBag.Message = "";
                DisplayCryptoboxModel model = cryptobox.GetDisplayCryptoboxModel();
                if (HttpContext.Request.Form["cryptobox_refresh_"] != null)
                {
                    ViewBag.Message = "<div class='gourl_msg'>";
                    if (cryptobox.is_paid())
                    {
                        ViewBag.Message +=
                            "<div style=\"margin:50px\" class=\"well\"><i class=\"fa fa-info-circle fa-3x fa-pull-left fa-border\" aria-hidden=\"true\"></i> " +
                            Controls.localisation[model.language].MsgNotReceived.Replace("%coinName%", model.coinName)
                            .Replace("%coinNames%",
                                     model.coinLabel == "BCH" || model.coinLabel == "DASH"
                                        ? model.coinName
                                        : model.coinName + "s")
                            .Replace("%coinLabel%", model.coinLabel) + "</div>";
                        transaction.SetStatus(transaction.savedId, TransactionStatus.INPROGESS);
                    }
                    else if (cryptobox.is_processed())
                    {
                        ViewBag.Message += "<div style=\"margin:70px\" class=\"alert alert-success\" role=\"alert\"> " +
                                           (model.boxType == "paymentbox"
                                               ? Controls.localisation[model.language].MsgReceived
                                               : Controls.localisation[model.language].MsgReceived2)
                                           .Replace("%coinName%", model.coinName)
                                           .Replace("%coinLabel%", model.coinLabel)
                                           .Replace("%amountPaid%", model.amoutnPaid.ToString()) + "</div>";
                        cryptobox.set_status_processed();
                        transaction.SetStatus(transaction.savedId, TransactionStatus.SUCCESSFUL);
                    }

                    ViewBag.Message = "</div>";
                }



                return(View(model));
            }
        }
Esempio n. 11
0
        public ActionResult MakePayment(double cryptoamount)
        {
            var transaction = new CryptoTransaction();
            var account     = new CryptoAccount();
            var accountId   = AccountId();

            transaction.Create(new TransactionVm()
            {
                Status             = TransactionStatus.PENDING,
                Amount             = Convert.ToDecimal(cryptoamount),
                accountId          = accountId,
                CurrencyDomination = "BTC",
                TransactionType    = TransactionTypeStatus.Credit
            });
            OptionsModel options = new OptionsModel()
            {
                public_key  = GoUrlKeys.PublicKey,
                private_key = GoUrlKeys.PrivateKey,
                webdev_key  = "",
                orderID     = transaction.savedId.ToString(),
                userID      = UserId(),
                userFormat  = "COOKIE",
                //amount = 0,
                amountUSD = Convert.ToDecimal(cryptoamount),
                period    = "2 HOUR",
                language  = "en"
            };

            using (Cryptobox cryptobox = new Cryptobox(options))
            {
                if (cryptobox.is_paid())
                {
                    //initiate a pendint transaction

                    if (!cryptobox.is_confirmed())
                    {
                        ViewBag.message = "Thank you for order (order #" + options.orderID + ", payment #" + cryptobox.payment_id() +
                                          "). Awaiting transaction/payment confirmation";
                    }
                    else
                    {
                        if (!cryptobox.is_processed())
                        {
                            ViewBag.message = "Thank you for order (order #" + options.orderID + ", payment #" + cryptobox.payment_id() + "). Payment Confirmed<br/> (User will see this message one time after payment has been made)";
                            cryptobox.set_status_processed();
                            transaction.SetStatus(transaction.savedId, TransactionStatus.SUCCESSFUL);
                        }
                        else
                        {
                            ViewBag.message = "Thank you for order (order #" + options.orderID + ", payment #" + cryptobox.payment_id() + "). Payment Confirmed<br/> (User will see this message during " + options.period + " period after payment has been made)";
                            transaction.SetStatus(transaction.savedId, TransactionStatus.INPROGESS);
                        }
                    }
                }
                else
                {
                    ViewBag.message = "This invoice has not been paid yet";
                    transaction.SetStatus(transaction.savedId, TransactionStatus.PENDING);
                }

                DisplayCryptoboxModel model = cryptobox.GetDisplayCryptoboxModel();

                return(View(model));
            }
        }
Esempio n. 12
0
        /// <summary>
        /// Display Cryptocoin Payment Box; the cryptobox will automatically displays successful message if payment has been received
        ///
        /// Usually user will see on bottom of payment box button 'Click Here if you have already sent coins' (when submit_btn = true)
        /// and when they click on that button, script will connect to our remote cryptocoin payment box server
        /// and check user payment.
        ///
        /// As backup, our server will also inform your server automatically through IPN every time a payment is received
        /// (Action Callback in GoUrlController). I.e. if the user does not click on the button or you have not displayed the button,
        /// your website will receive a notification about a given user anyway and save it to your database.

        /// Next time your user goes to your website/reloads page they will automatically see the message
        /// that their payment has been received successfully.
        /// </summary>
        /// <param name="helper"></param>
        /// <param name="model"></param>
        /// <param name="submit_btn"></param>
        /// <param name="width"></param>
        /// <param name="height"></param>
        /// <param name="box_style"></param>
        /// <param name="message_style"></param>
        /// <param name="anchor"></param>
        /// <returns></returns>
        public static MvcHtmlString Cryptobox(this HtmlHelper helper, DisplayCryptoboxModel model,
                                              bool submit_btn = true, int width = 540, int height = 230, object box_style = null, object message_style = null, string anchor = "")
        {
            Random rand = new Random();

            if (box_style == null || box_style.ToString().IsEmpty())
            {
                box_style = new { style = "border-radius:15px;box-shadow:0 0 12px #aaa;-moz-box-shadow:0 0 12px #aaa;-webkit-box-shadow:0 0 12px #aaa;padding:3px 6px;margin:10px" };
            }
            if (message_style == null || message_style.ToString().IsEmpty())
            {
                message_style = new { style = "display:inline-block;max-width:580px;padding:15px 20px;box-shadow:0 0 10px #aaa;-moz-box-shadow: 0 0 10px #aaa;margin:7px;font-size:13px;font-weight:normal;line-height:21px;font-family: Verdana, Arial, Helvetica, sans-serif;" };
            }

            //string hashResult = Calculator.md5(model.boxID + model.coinName + model.public_key + model.private_key + model.webdev_key + model.amount.ToString(CultureInfo.InvariantCulture) + model.period + model.amountUSD.ToString(CultureInfo.InvariantCulture) + model.language + model.amount.ToString(CultureInfo.InvariantCulture) + model.iframeID + model.amountUSD.ToString(CultureInfo.InvariantCulture) + model.userID + model.userFormat + model.orderID + width + height);
            string hashResult = Calculator.cryptobox_hash(model, false, width, height);
            string val        = Calculator.md5(model.iframeID + model.private_key + model.userID);
            string result     = "";

            if (submit_btn && helper.ViewContext.HttpContext.Request["cryptobox_live_"] != null &&
                helper.ViewContext.HttpContext.Request["cryptobox_live_"] == val)
            {
                string id = Calculator.md5(rand.Next().ToString());
                if (!model.is_paid)
                {
                    TagBuilder aBuilder = new TagBuilder("a");
                    aBuilder.MergeAttribute("name", "c" + model.iframeID);
                    aBuilder.GenerateId("c" + model.iframeID);
                    result += aBuilder;
                }
                result += "<br />";
                TagBuilder div00 = new TagBuilder("div");
                div00.MergeAttribute("align", "center");
                div00.MergeAttribute("id", id);
                TagBuilder div0 = new TagBuilder("div");
                string[]   ln   = { "ar", "fa" };
                if (ln.Contains(model.language))
                {
                    div0.MergeAttribute("dir", "rtl");
                }
                div0.MergeAttributes(new RouteValueDictionary(message_style));
                if (model.is_paid)
                {
                    TagBuilder spanBuilder = new TagBuilder("span");
                    spanBuilder.MergeAttribute("style", "color:#339e2e;white-space:nowrap;");
                    spanBuilder.InnerHtml = (model.boxType == "paymentbox"
                        ? localisation[model.language].MsgReceived
                        : localisation[model.language].MsgReceived2)
                                            .Replace("%coinName%", model.coinName)
                                            .Replace("%coinLabel%", model.coinLabel)
                                            .Replace("%amountPaid%", model.amoutnPaid.ToString());

                    div0.InnerHtml = spanBuilder.ToString();
                }
                else
                {
                    TagBuilder spanBuilder = new TagBuilder("span");
                    spanBuilder.MergeAttribute("style", "color:#eb4847");
                    spanBuilder.InnerHtml = localisation[model.language].MsgNotReceived
                                            .Replace("%coinName%", model.coinName)
                                            .Replace("%coinNames%", model.coinLabel == "BCH" || model.coinLabel == "DASH" ? model.coinName : model.coinName + "s")
                                            .Replace("%coinLabel%", model.coinLabel);

                    TagBuilder scrptBuilder = new TagBuilder("script");
                    scrptBuilder.MergeAttribute("type", "text/javascript");
                    scrptBuilder.InnerHtml = "cryptobox_msghide('" + id + "')";

                    div0.InnerHtml = spanBuilder.ToString() + scrptBuilder.ToString();
                }

                div00.InnerHtml = div0.ToString();
                result         += div00;
            }

            TagBuilder div1 = new TagBuilder("div");

            div1.MergeAttribute("align", "center");
            div1.Attributes["style"] = "min-width:" + width + "px";

            TagBuilder iframeBuilder = new TagBuilder("iframe");

            iframeBuilder.GenerateId(model.iframeID);
            iframeBuilder.MergeAttributes(new RouteValueDictionary(box_style));
            iframeBuilder.MergeAttribute("scrolling", "no");
            iframeBuilder.MergeAttribute("marginheight", "0");
            iframeBuilder.MergeAttribute("marginwidth", "0");
            iframeBuilder.MergeAttribute("frameborder", "0");
            iframeBuilder.MergeAttribute("width", width.ToString());
            iframeBuilder.MergeAttribute("height", height.ToString());
            div1.InnerHtml = iframeBuilder.ToString();

            result += div1;

            TagBuilder div2          = new TagBuilder("div");
            TagBuilder scriptBuilder = new TagBuilder("script");

            scriptBuilder.MergeAttribute("type", "text/javascript");
            scriptBuilder.InnerHtml = "cryptobox_show(" + model.boxID + ", '" + model.coinName + "', '" + model.public_key + "', " + model.amount.ToString(CultureInfo.InvariantCulture) + ", " + model.amountUSD.ToString(CultureInfo.InvariantCulture) + ", '" + model.period + "', '" + model.language + "', '" + model.iframeID + "', '" + model.userID + "', '" + model.userFormat + "', '" + model.orderID + "', '" + model.cookieName + "', '" + model.webdev_key + "', '" + hashResult + "', " + width + ", " + height + "); ";
            div2.InnerHtml          = scriptBuilder.ToString();

            result += div2.ToString();

            if (submit_btn && !model.is_paid)
            {
                TagBuilder formBuilder = new TagBuilder("form");

                formBuilder.MergeAttribute("action",
                                           helper.ViewContext.HttpContext.Request.RawUrl + "#" +
                                           (anchor != String.Empty ? anchor : "c") + model.iframeID);
                formBuilder.MergeAttribute("method", "post");
                TagBuilder inputBuilder = new TagBuilder("input");
                inputBuilder.MergeAttribute("type", "hidden");
                inputBuilder.GenerateId("cryptobox_live_");
                inputBuilder.MergeAttribute("name", "cryptobox_live_");
                inputBuilder.MergeAttribute("value", val);
                TagBuilder div3 = new TagBuilder("div");
                div3.MergeAttribute("align", "center");
                TagBuilder buttonBuilder = new TagBuilder("button");
                if (model.language == "ar" || model.language == "fa")
                {
                    buttonBuilder.MergeAttribute("dir", "rtl");
                }
                buttonBuilder.MergeAttribute("style", "color:#555;border-color:#ccc;background:#f7f7f7;-webkit-box-shadow:inset 0 1px 0 #fff,0 1px 0 rgba(0,0,0,.08);box-shadow:inset 0 1px 0 #fff,0 1px 0 rgba(0,0,0,.08);vertical-align:top;display:inline-block;text-decoration:none;font-size:13px;line-height:26px;min-height:28px;margin:20px 0 25px 0;padding:0 10px 1px;cursor:pointer;border-width:1px;border-style:solid;-webkit-appearance:none;-webkit-border-radius:3px;border-radius:3px;white-space:nowrap;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;font-family:\"Open Sans\",sans-serif;font-size: 13px;font-weight: normal;text-transform: none;");
                buttonBuilder.InnerHtml = localisation[model.language].Button
                                          .Replace("%coinName%", model.coinName)
                                          .Replace("%coinNames%", model.coinLabel == "BCH" || model.coinLabel == "DASH" ? model.coinName : model.coinName + "s")
                                          .Replace("%coinLabel%", model.coinLabel) +
                                          (model.language != "ar" ? " &#187;" : "") + " &#160;";

                div3.InnerHtml        = buttonBuilder.ToString();
                formBuilder.InnerHtml = inputBuilder.ToString() + div3.ToString();

                result += formBuilder.ToString();
            }

            return(MvcHtmlString.Create(result + "<br/>"));
        }
        public ActionResult PayPerRegistrationMulti()
        {
            string defPaiment = "bitcoin";

            string[] available_payments = new[] { "bitcoin", "dogecoin" };
            IDictionary <string, IDictionary <string, string> > all_keys = new Dictionary
                                                                           <string, IDictionary <string, string> >()
            {
                {
                    "bitcoin", new Dictionary <string, string>()
                    {
                        { "public_key", "-your public key for Bitcoin box-" },
                        { "private_key", "-your private key for Bitcoin box-" }
                    }
                },
                {
                    "dogecoin", new Dictionary <string, string>()
                    {
                        { "public_key", "-your public key for Dogecoin box-" },
                        { "private_key", "-your private key for Dogecoin box-" }
                    }
                }
            };

            foreach (KeyValuePair <string, IDictionary <string, string> > valuePair in all_keys)
            {
                if (valuePair.Value["public_key"] == null || valuePair.Value["private_key"] == null ||
                    valuePair.Value["public_key"] == "" || valuePair.Value["private_key"] == "")
                {
                    return
                        (new ContentResult()
                    {
                        Content = "Please add your public/private keys for " + valuePair.Key +
                                  " in all_keys variable"
                    });
                }
                else if (!valuePair.Value["public_key"].Contains("PUB"))
                {
                    return
                        (new ContentResult()
                    {
                        Content = "Invalid public key for " + valuePair.Key +
                                  " in all_keys variable"
                    });
                }
                else if (!valuePair.Value["private_key"].Contains("PRV"))
                {
                    return
                        (new ContentResult()
                    {
                        Content = "Invalid private key for " + valuePair.Key +
                                  " in all_keys variable"
                    });
                }
                else if (!ConfigurationManager.AppSettings["PrivateKeys"].Contains(valuePair.Value["private_key"]))
                {
                    return
                        (new ContentResult()
                    {
                        Content = "Please add your private key for " + valuePair.Key +
                                  " in Web.config."
                    });
                }
            }

            string       coinName = CryptoHelper.cryptobox_selcoin(available_payments, defPaiment);
            OptionsModel options  = new OptionsModel()
            {
                public_key  = all_keys[coinName]["public_key"],
                private_key = all_keys[coinName]["private_key"],
                webdev_key  = "",
                orderID     = "signuppage",
                userID      = "",
                userFormat  = "COOKIE",
                amount      = 0,
                amountUSD   = (decimal)0.01,
                period      = "NOEXPIRY",
                language    = "en"
            };

            using (Cryptobox cryptobox = new Cryptobox(options))
            {
                ViewBag.Coins   = available_payments;
                ViewBag.DefCoin = defPaiment;
                ViewBag.DefLang = options.language;

                string fname     = Request.Form["fname"] ?? "";
                string femail    = Request.Form["femail"] ?? "";
                string fpassword = Request.Form["fpassword"] ?? "";
                ViewBag.error      = "";
                ViewBag.successful = false;
                ViewBag.fname      = fname;
                ViewBag.femail     = femail;
                ViewBag.fpassword  = fpassword;

                if (Request.Form["fname"] != null && Request.Form["fname"] != "")
                {
                    if (fname == "")
                    {
                        ViewBag.error += "<li>Please enter Your Name</li>";
                    }
                    if (femail == "")
                    {
                        ViewBag.error += "<li>Please enter Your Email</li>";
                    }
                    if (fpassword == "")
                    {
                        ViewBag.error += "<li>Please enter Your Password</li>";
                    }
                    if (!cryptobox.is_paid())
                    {
                        ViewBag.error += "<li>" + cryptobox.coin_name() + "s have not yet been received</li>";
                    }
                    if (ViewBag.error != "")
                    {
                        ViewBag.error = "<br><ul style='color:#eb4847'>" + ViewBag.error + "</ul>";
                    }

                    if (cryptobox.is_paid() && ViewBag.error == "")
                    {
                        ViewBag.successful = true;
                        cryptobox.set_status_processed();
                        cryptobox.cryptobox_reset();
                    }
                }

                DisplayCryptoboxModel model = cryptobox.GetDisplayCryptoboxModel();

                return(View(model));
            }
        }
        public ActionResult PayPerProductMulti()
        {
            string defPaiment = "bitcoin";

            string[] available_payments = new[] { "bitcoin", "dogecoin" };
            IDictionary <string, IDictionary <string, string> > all_keys = new Dictionary
                                                                           <string, IDictionary <string, string> >()
            {
                {
                    "bitcoin", new Dictionary <string, string>()
                    {
                        { "public_key", "-your public key for Bitcoin box-" },
                        { "private_key", "-your private key for Bitcoin box-" }
                    }
                },
                {
                    "dogecoin", new Dictionary <string, string>()
                    {
                        { "public_key", "-your public key for Dogecoin box-" },
                        { "private_key", "-your private key for Dogecoin box-" }
                    }
                }
            };

            foreach (KeyValuePair <string, IDictionary <string, string> > valuePair in all_keys)
            {
                if (valuePair.Value["public_key"] == null || valuePair.Value["private_key"] == null ||
                    valuePair.Value["public_key"] == "" || valuePair.Value["private_key"] == "")
                {
                    return
                        (new ContentResult()
                    {
                        Content = "Please add your public/private keys for " + valuePair.Key +
                                  " in all_keys variable"
                    });
                }
                else if (!valuePair.Value["public_key"].Contains("PUB"))
                {
                    return
                        (new ContentResult()
                    {
                        Content = "Invalid public key for " + valuePair.Key +
                                  " in all_keys variable"
                    });
                }
                else if (!valuePair.Value["private_key"].Contains("PRV"))
                {
                    return
                        (new ContentResult()
                    {
                        Content = "Invalid private key for " + valuePair.Key +
                                  " in all_keys variable"
                    });
                }
                else if (!ConfigurationManager.AppSettings["PrivateKeys"].Contains(valuePair.Value["private_key"]))
                {
                    return
                        (new ContentResult()
                    {
                        Content = "Please add your private key for " + valuePair.Key +
                                  " in Web.config."
                    });
                }
            }

            string       coinName = CryptoHelper.cryptobox_selcoin(available_payments, defPaiment);
            OptionsModel options  = new OptionsModel()
            {
                public_key  = all_keys[coinName]["public_key"],
                private_key = all_keys[coinName]["private_key"],
                webdev_key  = "",
                orderID     = "invoice000383",
                userID      = "",
                userFormat  = "COOKIE",
                amount      = 0,
                amountUSD   = (decimal)0.01,
                period      = "NOEXPIRY",
                language    = "en"
            };

            using (Cryptobox cryptobox = new Cryptobox(options))
            {
                ViewBag.Coins   = available_payments;
                ViewBag.DefCoin = defPaiment;
                ViewBag.DefLang = options.language;

                if (cryptobox.is_paid())
                {
                    if (!cryptobox.is_confirmed())
                    {
                        ViewBag.message = "Thank you for order (order #" + options.orderID + ", payment #" + cryptobox.payment_id() +
                                          "). Awaiting transaction/payment confirmation";
                    }
                    else
                    {
                        if (!cryptobox.is_processed())
                        {
                            ViewBag.message = "Thank you for order (order #" + options.orderID + ", payment #" + cryptobox.payment_id() + "). Payment Confirmed<br/> (User will see this message one time after payment has been made)";
                            cryptobox.set_status_processed();
                        }
                        else
                        {
                            ViewBag.message = "Thank you for order (order #" + options.orderID + ", payment #" + cryptobox.payment_id() + "). Payment Confirmed<br/> (User will see this message during " + options.period + " period after payment has been made)";
                        }
                    }
                }
                else
                {
                    ViewBag.message = "This invoice has not been paid yet";
                }

                DisplayCryptoboxModel model = cryptobox.GetDisplayCryptoboxModel();

                return(View(model));
            }
        }
        public ActionResult PayPerPageMulti()
        {
            string defPaiment = "bitcoin";

            string[] available_payments = new[] { "bitcoin", "dogecoin" };
            IDictionary <string, IDictionary <string, string> > all_keys = new Dictionary
                                                                           <string, IDictionary <string, string> >()
            {
                {
                    "bitcoin", new Dictionary <string, string>()
                    {
                        { "public_key", "-your public key for Bitcoin box-" },
                        { "private_key", "-your private key for Bitcoin box-" }
                    }
                },
                {
                    "dogecoin", new Dictionary <string, string>()
                    {
                        { "public_key", "-your public key for Dogecoin box-" },
                        { "private_key", "-your private key for Dogecoin box-" }
                    }
                }
            };

            foreach (KeyValuePair <string, IDictionary <string, string> > valuePair in all_keys)
            {
                if (valuePair.Value["public_key"] == null || valuePair.Value["private_key"] == null ||
                    valuePair.Value["public_key"] == "" || valuePair.Value["private_key"] == "")
                {
                    return
                        (new ContentResult()
                    {
                        Content = "Please add your public/private keys for " + valuePair.Key +
                                  " in all_keys variable"
                    });
                }
                else if (!valuePair.Value["public_key"].Contains("PUB"))
                {
                    return
                        (new ContentResult()
                    {
                        Content = "Invalid public key for " + valuePair.Key +
                                  " in all_keys variable"
                    });
                }
                else if (!valuePair.Value["private_key"].Contains("PRV"))
                {
                    return
                        (new ContentResult()
                    {
                        Content = "Invalid private key for " + valuePair.Key +
                                  " in all_keys variable"
                    });
                }
                else if (!ConfigurationManager.AppSettings["PrivateKeys"].Contains(valuePair.Value["private_key"]))
                {
                    return
                        (new ContentResult()
                    {
                        Content = "Please add your private key for " + valuePair.Key +
                                  " in Web.config."
                    });
                }
            }

            string       coinName = CryptoHelper.cryptobox_selcoin(available_payments, defPaiment);
            OptionsModel options  = new OptionsModel()
            {
                public_key  = all_keys[coinName]["public_key"],
                private_key = all_keys[coinName]["private_key"],
                webdev_key  = "",
                orderID     = "page1",
                userID      = "",
                userFormat  = "COOKIE",
                amount      = 0,
                amountUSD   = (decimal)0.01,
                period      = "24 HOUR",
                language    = "en"
            };

            using (Cryptobox cryptobox = new Cryptobox(options))
            {
                if (!cryptobox.is_paid())
                {
                    ViewBag.Coins   = available_payments;
                    ViewBag.DefCoin = defPaiment;
                    ViewBag.DefLang = options.language;
                }

                DisplayCryptoboxModel model = cryptobox.GetDisplayCryptoboxModel();

                return(View(model));
            }
        }
        public ActionResult PayPerDownloadMulti()
        {
            ViewBag.filename = "my_file1.zip";
            string dir = "protected";

            string defPaiment = "bitcoin";

            string[] available_payments = new[] { "bitcoin", "dogecoin" };
            IDictionary <string, IDictionary <string, string> > all_keys = new Dictionary
                                                                           <string, IDictionary <string, string> >()
            {
                {
                    "bitcoin", new Dictionary <string, string>()
                    {
                        { "public_key", "-your public key for Bitcoin box-" },
                        { "private_key", "-your private key for Bitcoin box-" }
                    }
                },
                {
                    "dogecoin", new Dictionary <string, string>()
                    {
                        { "public_key", "-your public key for Dogecoin box-" },
                        { "private_key", "-your private key for Dogecoin box-" }
                    }
                }
            };

            foreach (KeyValuePair <string, IDictionary <string, string> > valuePair in all_keys)
            {
                if (valuePair.Value["public_key"] == null || valuePair.Value["private_key"] == null ||
                    valuePair.Value["public_key"] == "" || valuePair.Value["private_key"] == "")
                {
                    return
                        (new ContentResult()
                    {
                        Content = "Please add your public/private keys for " + valuePair.Key +
                                  " in all_keys variable"
                    });
                }
                else if (!valuePair.Value["public_key"].Contains("PUB"))
                {
                    return
                        (new ContentResult()
                    {
                        Content = "Invalid public key for " + valuePair.Key +
                                  " in all_keys variable"
                    });
                }
                else if (!valuePair.Value["private_key"].Contains("PRV"))
                {
                    return
                        (new ContentResult()
                    {
                        Content = "Invalid private key for " + valuePair.Key +
                                  " in all_keys variable"
                    });
                }
                else if (!ConfigurationManager.AppSettings["PrivateKeys"].Contains(valuePair.Value["private_key"]))
                {
                    return
                        (new ContentResult()
                    {
                        Content = "Please add your private key for " + valuePair.Key +
                                  " in Web.config."
                    });
                }
            }

            string       coinName = CryptoHelper.cryptobox_selcoin(available_payments, defPaiment);
            OptionsModel options  = new OptionsModel()
            {
                public_key  = all_keys[coinName]["public_key"],
                private_key = all_keys[coinName]["private_key"],
                webdev_key  = "",
                orderID     = Calculator.md5(dir + ViewBag.filename),
                userID      = "",
                userFormat  = "COOKIE",
                amount      = 0,
                amountUSD   = (decimal)0.01,
                period      = "24 HOUR",
                language    = "en"
            };

            using (Cryptobox cryptobox = new Cryptobox(options))
            {
                if (cryptobox.is_paid())
                {
                    ViewBag.DownloadLink = "href = " + Url.Action("Download");
                    cryptobox.set_status_processed();
                }
                else
                {
                    ViewBag.DownloadLink = "onclick='alert(\"You need to send " + cryptobox.coin_name() +
                                           "s first !\")' href='#a'";
                }

                DisplayCryptoboxModel model = cryptobox.GetDisplayCryptoboxModel();
                ViewBag.Coins   = available_payments;
                ViewBag.DefCoin = defPaiment;
                ViewBag.DefLang = options.language;

                return(View(model));
            }
        }