Class: Workarea::PaymentReference

Inherits:
Object
  • Object
show all
Defined in:
app/models/workarea/payment_reference.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user, order = nil) ⇒ PaymentReference

Returns a new instance of PaymentReference.



5
6
7
8
# File 'app/models/workarea/payment_reference.rb', line 5

def initialize(user, order = nil)
  @user = user
  @order = order
end

Instance Attribute Details

#orderObject (readonly)

Returns the value of attribute order.



3
4
5
# File 'app/models/workarea/payment_reference.rb', line 3

def order
  @order
end

#userObject (readonly)

Returns the value of attribute user.



3
4
5
# File 'app/models/workarea/payment_reference.rb', line 3

def user
  @user
end

Instance Method Details

#emailObject



10
11
12
# File 'app/models/workarea/payment_reference.rb', line 10

def email
  (@user.try(:email) || @order.try(:email)).try(:downcase)
end

#idObject



14
15
16
# File 'app/models/workarea/payment_reference.rb', line 14

def id
  @user.try(:id) || @order.try(:user_id).presence || @order.try(:id)
end