- A
- C
- L
- P
- S
- ApplicationHelper
- Member::ApplicationHelper
- ActionView::Helpers::SanitizeHelper
Instance Public methods
agency_upsell() Link
Source: show
# File engines/member/app/controllers/member/plans_controller.rb, line 22 def agency_upsell # The widget detects & manipulates these iframes head :ok end
all() Link
Source: show
# File engines/member/app/controllers/member/plans_controller.rb, line 35 def all js_redirect_to(current_site.widget_url(request.path)) end
clean_session() Link
Source: show
# File engines/member/app/controllers/member/plans_controller.rb, line 117 def clean_session session[:previous_url] = nil session[:protected] = nil head :ok end
complete_payment() Link
Source: show
# File engines/member/app/controllers/member/plans_controller.rb, line 123 def complete_payment # TODO Remove after deployment has stabilized # This is for backwards compatibily with StripeCardForm if params[:payment_intent_id].present? return legacy_complete_purchase end subscription = current_member.subscriptions.find_by(payment_gateway_id: params[:payment_gateway_id]) return render json: {error: I18n.t("member.payment_forms.unexpected_error", site_id: current_site.id)}, status: :conflict unless subscription begin subscription.update(status: PaymentGateway.subscription_status(model: subscription)) rescue Stripe::StripeError # This is just a UI convinience # The webhook will take care of the failure end render json: { stripe_order: {id: subscription.payment_gateway_id, status: subscription.status} } end
complete_purchase() Link
Source: show
# File engines/member/app/controllers/member/plans_controller.rb, line 176 def complete_purchase subscription = current_member.subscriptions.find_by(payment_gateway_id: params[:payment_gateway_id]) return render json: {error: I18n.t("member.payment_forms.unexpected_error", site_id: current_site.id)}, status: :conflict unless subscription provisioner = Action::PlanProvisioner.new( member: current_member, subscription: subscription ) if provisioner.provision render json: { stripe_order: {id: subscription.payment_gateway_id, status: subscription.status} } else render json: {error: provisioner.error}, status: :unprocessable_entity end end
legacy_complete_purchase() Link
This is to support outdated calls to complete_payment
Source: show
# File engines/member/app/controllers/member/plans_controller.rb, line 146 def legacy_complete_purchase payment_intent = begin PaymentGateway.retrieve_payment_intent( id: params[:payment_intent_id], site: current_member.site, expand: ["invoice"] ) rescue Stripe::StripeError # This is just a UI convinience # The webhook will take care of the failure end return render json: {error: I18n.t("member.payment_forms.unexpected_error", site_id: current_site.id)}, status: :conflict unless payment_intent subscription = current_member.subscriptions.find_by(payment_gateway_id: payment_intent.invoice.subscription) provisioner = Action::PlanProvisioner.new( member: current_member, subscription: subscription ) if provisioner.provision render json: { stripe_order: {id: subscription.payment_gateway_id, status: subscription.status} } else render json: {error: provisioner.error}, status: :unprocessable_entity end end
pay() Link
Source: show
# File engines/member/app/controllers/member/plans_controller.rb, line 63 def pay @payment_intent = PaymentGateway.retrieve_payment_intent( id: plans_params[:pi_id], site: current_site, expand: ["invoice"] ) unless Action::Billing::Charge::CANCELABLE_STATUSES.include?(@payment_intent.status) redirect_to account_path end @stripe_customer = StripeCustomer.new(member: current_member) @payment_method_id = @stripe_customer.default_payment_method&.id @subscription = current_member.subscriptions.find_by(pending_intent_id: plans_params[:pi_id]) end
plan_details() Link
Source: show
# File engines/member/app/controllers/member/plans_controller.rb, line 39 def plan_details @stripe_customer = StripeCustomer.new(member: current_member) raise "Plan was not found." if !@plan || @plan.try(:archived?) render layout: false end
purchase() Link
Source: show
# File engines/member/app/controllers/member/plans_controller.rb, line 79 def purchase render "show" && return unless @plan.enabled? if plan_purchaser.purchase! respond_to do |format| format.json { render json: plan_order, status: plan_order.status } format.html { js_redirect_to(after_purchase_uri.to_s) } end else respond_to do |format| format.json { render json: {error: plan_purchaser.error}, status: :unprocessable_entity } format.html { flash[:error] = plan_purchaser.error render :show } end end end
purchased() Link
Source: show
# File engines/member/app/controllers/member/plans_controller.rb, line 98 def purchased @plan = DB::Plan.find(plans_params[:id]) @order = Decorator::StripeOrder.new(plans_params[:order_id], @plan.public_id) @tracker_preparer = Service::TrackerPreparer.new( { plan: @plan, member: current_member, order: @order, code: current_site.tracker.conversion_code } ) @iframe_url = current_site.url @after_login_url = current_site.after_registration_url include_custom_field_form end
show() Link
Source: show
# File engines/member/app/controllers/member/plans_controller.rb, line 27 def show return js_redirect_to_after_login_url if already_on_plan? return purchase if @plan.free_plan? @stripe_customer = StripeCustomer.new(member: current_member) record_analytics("views", @plan) end
sign_up_reminder() Link
Source: show
# File engines/member/app/controllers/member/plans_controller.rb, line 46 def sign_up_reminder @locals = {iframe_url: @iframe_url} @stripe_customer = StripeCustomer.new(member: current_member) get_plans return js_redirect_to_after_login_url if already_on_plan? if @plan.present? && @plan.enabled? && !@plan.archived? @locals[:plan] = @plan @partial = "plan_form" else @locals[:plans] = plans_association.where(search) & current_entity.available_plans @locals[:plans_for_content] = nil @partial = "plans_selector" end end