Пример #1
0
        public plans_fixture()
        {
            PlanCreateOptions = new StripePlanCreateOptions()
            {
                // Add a space at the end to ensure the ID is properly URL encoded
                // when passed in the URL for other methods
                Id       = "test-plan-" + Guid.NewGuid().ToString() + " ",
                Name     = "plan-name",
                Amount   = 5000,
                Currency = "usd",
                Interval = "month",
            };

            PlanUpdateOptions = new StripePlanUpdateOptions {
                Name = "plan-name-2"
            };

            var service = new StripePlanService(Cache.ApiKey);

            Plan          = service.Create(PlanCreateOptions);
            PlanRetrieved = service.Get(Plan.Id);
            PlanUpdated   = service.Update(Plan.Id, PlanUpdateOptions);
            PlansList     = service.List();
            PlanDeleted   = service.Delete(Plan.Id);
        }
Пример #2
0
        public ActionResult DeletePlans(string Plan_ID)
        {
            objResponse Response = new objResponse();

            try
            {
                Response = objSubscriptionManager.DeletePlan(Convert.ToInt64(Plan_ID));

                if (Response.ErrorCode == 0)
                {
                    var planService = new StripePlanService();
                    planService.Delete(Plan_ID);

                    PlanModel objPlanModel = new PlanModel();
                    objPlanModel.plans = objSubscriptionManager.GetPlans();
                    return(View("AjaxAddPlan", objPlanModel));
                }
                else
                {
                    return(Json("", JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                BAL.Common.LogManager.LogError("DeletePlan Post method", 1, Convert.ToString(ex.Source), Convert.ToString(ex.StackTrace), Convert.ToString(ex.Message));
                return(Json("", JsonRequestBehavior.AllowGet));
            }
        }
Пример #3
0
        /// <summary>
        /// Deletes a plan from Stripe
        /// NOTE: Delete the model from the underlying context after calling this method
        /// </summary>
        /// <param name="plan"></param>
        public static void DeletePlan(IPlanEntity plan)
        {
            var planService = new StripePlanService();

            planService.Delete(plan.PaymentSystemId);

            Logger.Log <StripeManager>("Deleting plan in stripe: '{0}' with id '{1}", LogLevel.Information, plan.Title, plan.PaymentSystemId);
        }
Пример #4
0
        /// <summary>
        /// Deletes a plan from Stripe
        /// NOTE: Delete the model from the underlying context after calling this method
        /// </summary>
        /// <param name="plan"></param>
        public static void DeletePlan(IStripeSubscriptionPlan plan)
        {
            var planService = new StripePlanService();

            planService.Delete(plan.PaymentSystemId);

            System.Diagnostics.Trace.TraceInformation("Deleting plan in stripe: '{0}' with id '{1}", plan.Title, plan.PaymentSystemId);

            plan.PaymentSystemId = null;
        }
Пример #5
0
        public ActionResult DeleteConfirmed(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var planService = new StripePlanService();

            planService.Delete(id);

            return(RedirectToAction("Index"));
        }
        public void DeletePlan(string Api_Key, string planId, ref string Response, ref string Errors, ref int ErrorCode)
        {
            try
            {
                StripeConfiguration.SetApiKey(Api_Key);

                var           planService = new StripePlanService();
                StripeDeleted deletedPlan = planService.Delete(planId);
                Response  = deletedPlan.StripeResponse.ResponseJson;
                ErrorCode = 0;
            }
            catch (StripeException e)
            {
                ErrorCode = 1;
                Serializer  serializer  = new Serializer();
                StripeError stripeError = e.StripeError;
                Errors = serializer.Serialize <StripeError>(stripeError);
            }
        }