コード例 #1
0
        private void InitWalletStripe()
        {
            try
            {
                var stripePublishableKey = ListUtils.MySettingsList?.StripeId ?? "";
                if (!string.IsNullOrEmpty(stripePublishableKey))
                {
                    PaymentConfiguration.Init(stripePublishableKey);
                    Stripe = new Stripe(this, stripePublishableKey);

                    MPaymentsClient = WalletClass.GetPaymentsClient(this, new WalletClass.WalletOptions.Builder()
                                                                    .SetEnvironment(WalletConstants.EnvironmentTest)
                                                                    .SetTheme(WalletConstants.ThemeLight)
                                                                    .Build());

                    IsReadyToPay();
                }
                else
                {
                    Toast.MakeText(this, GetText(Resource.String.Lbl_ErrorConnectionSystemStripe), ToastLength.Long).Show();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
コード例 #2
0
        private void InitWalletStripe()
        {
            try
            {
                var stripePublishableKey = ListUtils.SettingsSiteList.FirstOrDefault()?.StripeId ?? "";
                if (!string.IsNullOrEmpty(stripePublishableKey))
                {
                    PaymentConfiguration.Init(stripePublishableKey);
                    Stripe = new Stripe(this, stripePublishableKey);

                    MPaymentsClient = WalletClass.GetPaymentsClient(this, new WalletClass.WalletOptions.Builder()
                                                                    .SetEnvironment(WalletConstants.EnvironmentTest)
                                                                    .SetTheme(WalletConstants.ThemeLight)
                                                                    .Build());

                    IsReadyToPay();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
コード例 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["userID"] != null)
            {
                String   que   = Request.QueryString["ID"];
                String[] param = que.Split('@');
                String   proId = param[0];
                String   instr = param[1];

                int ID     = Convert.ToInt32(proId);
                var pro    = client.productinfor_retrieval_ID(ID);
                int userId = Convert.ToInt32(Session["userID"].ToString());
                if (instr.Equals("Add"))
                {
                    bool val = client.Add_to_Cart(pro, userId, 1);
                    if (val)
                    {
                        Response.Redirect(Request.UrlReferrer.ToString());
                    }
                    else
                    {
                        Response.Redirect("Home.aspx");
                    }
                }
                else if (instr.Equals("Remove"))
                {
                    bool ver = client.removeItem(userId, Convert.ToInt32(proId));
                    if (ver)
                    {
                        Response.Redirect(Request.UrlReferrer.ToString());
                    }
                }
                else if (instr.Equals("Increase"))
                {
                    bool ver = client.increaseQue(Convert.ToInt32(proId), userId, 1);
                    if (ver)
                    {
                        Response.Redirect(Request.UrlReferrer.ToString());
                    }
                }
                else if (instr.Equals("Decrease"))
                {
                    bool ver = client.increaseQue(Convert.ToInt32(proId), userId, -1);
                    if (ver)
                    {
                        Response.Redirect(Request.UrlReferrer.ToString());
                    }
                }
                else if (instr.Equals("CANCEL"))
                {
                    var Order = client.getOrder(Convert.ToInt32(proId));
                    if (Order != null)
                    {
                        int payId   = Order.PaymentId;
                        var payment = client.getpayement(Convert.ToInt32(Session["userID"].ToString()));
                        if (payment != null)
                        {
                            Decimal Refund = payment.Total;

                            WalletClass wallet = new WalletClass
                            {
                                userID = Convert.ToInt32(Session["userID"].ToString()),
                                amount = Convert.ToDouble(Refund),
                                status = "REFUND FROM CANCELLED ORDER"
                            };
                            bool ver = client.AddToWallet(Convert.ToInt32(Session["userID"].ToString()), wallet);
                            if (ver)
                            {
                                bool delo = client.deleteOrder(Order.OrderNumber);
                                if (delo)
                                {
                                    bool paydel = client.deletepay(payId);
                                    if (paydel)
                                    {
                                        bool invoiceDel = client.deleteInvoice(Order.OrderNumber);
                                        if (invoiceDel)
                                        {
                                            Response.Redirect("Catalog.aspx?ID=ALL");
                                        }
                                        else
                                        {
                                            Response.Redirect("Home.aspx");
                                        }
                                    }
                                }
                                else
                                {
                                    Response.Redirect("Catalog.aspx?ID=ALL");
                                }
                            }
                            else
                            {
                                Response.Redirect("Home.aspx");
                            }
                        }
                        else
                        {
                            Response.Redirect("Home.aspx");
                        }
                    }
                    else
                    {
                        Response.Redirect("Home.aspx");
                    }
                }
            }
            else
            {
                Response.Redirect("LogIn.aspx");
            }
        }