Sha256: b13fb4e120c5a083d941db730b4827e287728c313f99acd091d457998e21d986

Contents?: true

Size: 643 Bytes

Versions: 17

Compression:

Stored size: 643 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

17 entries across 17 versions & 1 rubygems

Version Path
ish_models-0.0.33.158 lib/ish/payment.rb
ish_models-0.0.33.157 lib/ish/payment.rb
ish_models-0.0.33.156 lib/ish/payment.rb
ish_models-0.0.33.154 lib/ish/payment.rb
ish_models-0.0.33.153 lib/ish/payment.rb
ish_models-0.0.33.152 lib/ish/payment.rb
ish_models-0.0.33.151 lib/ish/payment.rb
ish_models-0.0.33.150 lib/ish/payment.rb
ish_models-0.0.33.149 lib/ish/payment.rb
ish_models-0.0.33.148 lib/ish/payment.rb
ish_models-0.0.33.147 lib/ish/payment.rb
ish_models-0.0.33.146 lib/ish/payment.rb
ish_models-0.0.33.145 lib/ish/payment.rb
ish_models-0.0.33.144 lib/ish/payment.rb
ish_models-0.0.33.143 lib/ish/payment.rb
ish_models-0.0.33.142 lib/ish/payment.rb
ish_models-0.0.33.141 lib/ish/payment.rb