main_app/app/models/purchase.rb
#email is temp until we introduce an autogenerated user for purchases
email is temp until we introduce an autogenerated user for purchases
email is temp until we introduce an autogenerated user for purchases
def perform_purchase!(options = {})
    amount = options[:amount] || self.link.price
    currency = options[:currency] || DEFAULT_CURRENCY
    description = options[:description] || "LINK #{self.link.id} PURCHASE" 
    charge = Stripe::Charge.create(
                                   :amount => (self.link.price * 100).round,
                                   :currency => currency,
                                   :card => self.token,
                                   :description => description
                                   )
    self.update_attributes(:link_name => self.link.name, :link_price => self.link.price)
    self.create_purchase_transaction!(:link_id => self.link_id, :response_data => charge.as_json)
  end
def perform_purchase! ( options = { } ) amount = options [ :amount ] || self . link . price currency = options [ :currency ] || DEFAULT_CURRENCY description = options [ :description ] || "LINK #{self.link.id} PURCHASE" charge = Stripe :: Charge . create ( :amount => ( self . link . price * 100 ) . round , :currency => currency , :card => self . token , :description => description ) self . update_attributes ( :link_name => self . link . name , :link_price => self . link . price ) self . create_purchase_transaction! ( :link_id => self . link_id , :response_data => charge . as_json ) end
email is temp until we introduce an autogenerated user for purchases
email is temp until we introduce an autogenerated user for purchases
options
<not_specific>