Sha256: a734392e446d0a864f601aefa9437cf9e1fe522361d21a1f80e6ca644073b017

Contents?: true

Size: 645 Bytes

Versions: 59

Compression:

Stored size: 645 Bytes

Contents


class Ish::Payment
  include Mongoid::Document
  include Mongoid::Timestamps

  belongs_to :invoice, :class_name => 'Ish::Invoice', optional: true
  belongs_to :profile, :class_name => 'Ish::UserProfile' # , :optional => true

  field :amount, :type => Integer # in cents
  field :charge, :type => Hash
  field :email,  :type => String

  field :client_secret
  field :payment_intent_id

  field :status, type: Symbol

  after_create :compute_paid_invoice_amount

  protected

  def compute_paid_invoice_amount
    if self.invoice
      self.invoice.update_attributes :paid_amount => self.invoice.paid_amount + self.amount
    end
  end

end

Version data entries

59 entries across 59 versions & 1 rubygems

Version Path
ish_models-0.0.33.222 lib/ish/payment.rb
ish_models-0.0.33.221 lib/ish/payment.rb
ish_models-0.0.33.219 lib/ish/payment.rb
ish_models-0.0.33.217 lib/ish/payment.rb
ish_models-0.0.33.215 lib/ish/payment.rb
ish_models-0.0.33.214 lib/ish/payment.rb
ish_models-0.0.33.213 lib/ish/payment.rb
ish_models-0.0.33.212 lib/ish/payment.rb
ish_models-0.0.33.211 lib/ish/payment.rb
ish_models-0.0.33.210 lib/ish/payment.rb
ish_models-0.0.33.209 lib/ish/payment.rb
ish_models-0.0.33.208 lib/ish/payment.rb
ish_models-0.0.33.207 lib/ish/payment.rb
ish_models-0.0.33.206 lib/ish/payment.rb
ish_models-0.0.33.205 lib/ish/payment.rb
ish_models-0.0.33.204 lib/ish/payment.rb
ish_models-0.0.33.203 lib/ish/payment.rb
ish_models-0.0.33.202 lib/ish/payment.rb
ish_models-0.0.33.201 lib/ish/payment.rb
ish_models-0.0.33.200 lib/ish/payment.rb