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.19.1 app/helpers/effective_subscriptions_helper.rb
effective_orders-6.19.0 app/helpers/effective_subscriptions_helper.rb
effective_orders-6.18.4 app/helpers/effective_subscriptions_helper.rb
effective_orders-6.18.3 app/helpers/effective_subscriptions_helper.rb
effective_orders-6.18.2 app/helpers/effective_subscriptions_helper.rb
effective_orders-6.18.1 app/helpers/effective_subscriptions_helper.rb
effective_orders-6.18.0 app/helpers/effective_subscriptions_helper.rb
effective_orders-6.17.2 app/helpers/effective_subscriptions_helper.rb
effective_orders-6.17.1 app/helpers/effective_subscriptions_helper.rb
effective_orders-6.17.0 app/helpers/effective_subscriptions_helper.rb
effective_orders-6.16.4 app/helpers/effective_subscriptions_helper.rb
effective_orders-6.16.3 app/helpers/effective_subscriptions_helper.rb
effective_orders-6.16.2 app/helpers/effective_subscriptions_helper.rb
effective_orders-6.16.1 app/helpers/effective_subscriptions_helper.rb
effective_orders-6.16.0 app/helpers/effective_subscriptions_helper.rb
effective_orders-6.15.0 app/helpers/effective_subscriptions_helper.rb
effective_orders-6.14.6 app/helpers/effective_subscriptions_helper.rb
effective_orders-6.14.5 app/helpers/effective_subscriptions_helper.rb
effective_orders-6.14.4 app/helpers/effective_subscriptions_helper.rb
effective_orders-6.14.3 app/helpers/effective_subscriptions_helper.rb