Sha256: 467938bb84e782ae8c18f85efe84e755965194eb9de50be46eca739cc96c8b59

Contents?: true

Size: 1.11 KB

Versions: 155

Compression:

Stored size: 1.11 KB

Contents

module EffectiveSubscriptionsHelper

  def subscripter_stripe_data(subscripter)
    {
      email: current_user.email,
      image: stripe_site_image_url,
      key: EffectiveOrders.stripe[:publishable_key],
      name: EffectiveOrders.stripe[:site_title],
    }
  end

  def subscripter_stripe_plans(subscripter)
    EffectiveOrders.stripe_plans
  end

  def subscribable_form_with(subscribable)
    raise 'form object must be an acts_as_subscribable object' unless subscribable.respond_to?(:subscripter)

    subscripter = subscribable.subscripter
    # raise 'subscribable.subscribable_buyer must match current_user' unless subscripter.user == current_user

    render('effective/subscripter/form', subscripter: subscripter)
  end

  def customer_form_with(customer)
    raise 'form object must be an Effective::Customer object' unless customer.kind_of?(Effective::Customer)
    raise 'expected customer user to match current user' if customer.user != current_user

    subscripter = Effective::Subscripter.new(customer: customer, user: customer.user)

    render('effective/customers/form', subscripter: subscripter)
  end

end

Version data entries

155 entries across 155 versions & 1 rubygems

Version Path
effective_orders-6.14.2 app/helpers/effective_subscriptions_helper.rb
effective_orders-6.14.1 app/helpers/effective_subscriptions_helper.rb
effective_orders-6.14.0 app/helpers/effective_subscriptions_helper.rb
effective_orders-6.13.3 app/helpers/effective_subscriptions_helper.rb
effective_orders-6.13.2 app/helpers/effective_subscriptions_helper.rb
effective_orders-6.13.1 app/helpers/effective_subscriptions_helper.rb
effective_orders-6.13.0 app/helpers/effective_subscriptions_helper.rb
effective_orders-6.12.4 app/helpers/effective_subscriptions_helper.rb
effective_orders-6.12.3 app/helpers/effective_subscriptions_helper.rb
effective_orders-6.12.2 app/helpers/effective_subscriptions_helper.rb
effective_orders-6.12.1 app/helpers/effective_subscriptions_helper.rb
effective_orders-6.12.0 app/helpers/effective_subscriptions_helper.rb
effective_orders-6.9.10 app/helpers/effective_subscriptions_helper.rb
effective_orders-6.9.9 app/helpers/effective_subscriptions_helper.rb
effective_orders-6.9.8 app/helpers/effective_subscriptions_helper.rb
effective_orders-6.9.7 app/helpers/effective_subscriptions_helper.rb
effective_orders-6.9.6 app/helpers/effective_subscriptions_helper.rb
effective_orders-6.9.5 app/helpers/effective_subscriptions_helper.rb
effective_orders-6.9.4 app/helpers/effective_subscriptions_helper.rb
effective_orders-6.9.2 app/helpers/effective_subscriptions_helper.rb