Class: Billing::Payment

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
BillItem
Defined in:
app/models/billing/payment.rb

Constant Summary collapse

PAYMENT_WITH_TYPE =
'Billing::PaymentWithType'.freeze
PAYMENT_EXTERNAL =
'Billing::PaymentExternal'.freeze
PAYPAL_EXPRESS =
'Billing::PaypalExpress'.freeze
ROOM_TRANSFER =
'Billing::RoomTransfer'.freeze
PAYMENT_MODELS =
[PAYMENT_WITH_TYPE, PAYMENT_EXTERNAL, PAYPAL_EXPRESS, ROOM_TRANSFER].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#originObject



37
38
39
# File 'app/models/billing/payment.rb', line 37

def origin
  @origin || origins.find_by_id(@origin_id)
end

#origin_idObject

Returns the value of attribute origin_id.



12
13
14
# File 'app/models/billing/payment.rb', line 12

def origin_id
  @origin_id
end

Class Method Details

.wild_args(*args) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'app/models/billing/payment.rb', line 43

def wild_args(*args)
  h = {}
  case when args.blank? || args.first.kind_of?(Hash) then
    args.blank? ? h : h.merge(*args)
  when args.first.kind_of?(String) then
      #TODO parse
  else
    h.merge!(payment_type_id: args.shift.to_param)
    if args.any? && (args.first.kind_of?(Hash) || args.first.kind_of?(String))
      h.merge(args(*args))
    else
      if args.blank?
        h
      else
        h.merge!( value: args.shift.to_money )
        args.any? ? h.merge(*args) : h
      end
    end
  end
end

Instance Method Details

#cash?Boolean

Returns:

  • (Boolean)


34
# File 'app/models/billing/payment.rb', line 34

def cash?; false; end

#external?Boolean

Returns:

  • (Boolean)


35
# File 'app/models/billing/payment.rb', line 35

def external?; false; end

#fiscal?Boolean

Returns:

  • (Boolean)


33
# File 'app/models/billing/payment.rb', line 33

def fiscal?; false; end