Sha256: 52f09c3fe715190d69bc55f324d32d924865c9151a72680376584b36f2a832e9

Contents?: true

Size: 649 Bytes

Versions: 17

Compression:

Stored size: 649 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 => 'IshModels::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.140 lib/ish/payment.rb
ish_models-0.0.33.139 lib/ish/payment.rb
ish_models-0.0.33.138 lib/ish/payment.rb
ish_models-0.0.33.137 lib/ish/payment.rb
ish_models-0.0.33.136 lib/ish/payment.rb
ish_models-0.0.33.135 lib/ish/payment.rb
ish_models-0.0.33.134 lib/ish/payment.rb
ish_models-0.0.33.133 lib/ish/payment.rb
ish_models-0.0.33.132 lib/ish/payment.rb
ish_models-0.0.33.131 lib/ish/payment.rb
ish_models-0.0.33.130 lib/ish/payment.rb
ish_models-0.0.33.129 lib/ish/payment.rb
ish_models-0.0.33.128 lib/ish/payment.rb
ish_models-0.0.33.127 lib/ish/payment.rb
ish_models-0.0.33.124 lib/ish/payment.rb
ish_models-0.0.33.123 lib/ish/payment.rb
ish_models-0.0.33.122 lib/ish/payment.rb