Methods
Instance Public methods
destroy() Link
Source: show
# File engines/admin/app/controllers/admin/members/subscriptions_controller.rb, line 8 def destroy manager = Service::SubscriptionManager.new(subscription: @subscription) reason = subscriptions_params[:cancelation_reason] at_period_end = ActiveModel::Type::Boolean.new.cast(subscriptions_params[:at_period_end]) if manager.cancel(reason, at_period_end: at_period_end) member.reload member.plan_removed(@subscription, reason, current_member.full_name) respond_to do |format| message = I18n.t("member.alerts.subscription_cancellation_success", site_id: current_site.id) format.json { render json: Decorator::MemberPlanData.new(member).to_hash } format.html do flash[:success] = message redirect_to account_plans_path end end else respond_to do |format| format.json { render status: manager.error.code, json: {errors: [manager.error.message]} } format.html do flash.now[:error] = manager.error.message render :cancel end end end end
get_stripe_subscription_cancellation_date() Link
Source: show
# File engines/admin/app/controllers/admin/members/subscriptions_controller.rb, line 36 def get_stripe_subscription_cancellation_date render json: { current_period_end: PaymentGateway.subscription_attribute( :current_period_end, model: @subscription ) } rescue Stripe::StripeError => e render json: {error: e.message}, status: e.http_status end