app/helpers/charges_helper.rb
# reusable helper to charge given customer_id for given order
# orders save the charge_id, so customers may be re-charged using that
# (has_charge helper will return the latest charge for a user and .customer will give it's id)
# Throws any StripeError , specifically CardError
#
reusable helper to charge given customer_id for given order
orders save the charge_id, so customers may be re-charged using that
(has_charge helper will return the latest charge for a user and .customer will give it's id)
Throws any StripeError , specifically CardError
reusable helper to charge given customer_id for given order orders save the charge_id so customers may be re - charged using that ( has_charge helper will return the latest charge for a user and . customer will give it ' s id ) Throws any StripeError specifically CardError
def charge_customer customer_id , order
    charge = Stripe::Charge.create(
      :customer    => customer_id,
      :amount      => (order.total_price*100).to_i,
      :description => t(:order) + " : " + order.number ,
      :currency    => 'eur'
    )
    order.pay_now
    order.payment_info = charge.id
    order.payment_type = "stripe"
    order.save
  end
def charge_customer customer_id , order charge = Stripe :: Charge . create ( :customer => customer_id , :amount => ( order . total_price * 100 ) . to_i , :description => t ( :order ) + " : " + order . number , :currency => 'eur' ) order . pay_now order . payment_info = charge . id order . payment_type = "stripe" order . save end
reusable helper to charge given customer_id for given order
orders save the charge_id, so customers may be re-charged using that
(has_charge helper will return the latest charge for a user and .customer will give it's id)
Throws any StripeError , specifically CardError
reusable helper to charge given customer_id for given order orders save the charge_id so customers may be re - charged using that ( has_charge helper will return the latest charge for a user and . customer will give it ' s id ) Throws any StripeError specifically CardError
customer_id
<not_specific>
order
<not_specific>