Class: Sinopac::FunBiz::Order

Inherits:
Object
  • Object
show all
Defined in:
lib/sinopac/funbiz/order.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(order_no:, amount:, product_name:, **params) ⇒ Order



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/sinopac/funbiz/order.rb', line 6

def initialize(order_no:, amount:, product_name:, **params)
  @order_no = order_no
  @amount = amount
  @product_name = product_name
  @currency = params[:currency] || 'TWD'

  @memo = params[:memo] || ''
  @param1 = params[:param1] || ''
  @param2 = params[:param2] || ''
  @param3 = params[:param3] || ''
end

Instance Attribute Details

#amount ⇒ Object

Returns the value of attribute amount.



3
4
5
# File 'lib/sinopac/funbiz/order.rb', line 3

def amount
  @amount
end

#currency ⇒ Object

Returns the value of attribute currency.



3
4
5
# File 'lib/sinopac/funbiz/order.rb', line 3

def currency
  @currency
end

#memo ⇒ Object

Returns the value of attribute memo.



4
5
6
# File 'lib/sinopac/funbiz/order.rb', line 4

def memo
  @memo
end

#order_no ⇒ Object

Returns the value of attribute order_no.



3
4
5
# File 'lib/sinopac/funbiz/order.rb', line 3

def order_no
  @order_no
end

#param1 ⇒ Object

Returns the value of attribute param1.



4
5
6
# File 'lib/sinopac/funbiz/order.rb', line 4

def param1
  @param1
end

#param2 ⇒ Object

Returns the value of attribute param2.



4
5
6
# File 'lib/sinopac/funbiz/order.rb', line 4

def param2
  @param2
end

#param3 ⇒ Object

Returns the value of attribute param3.



4
5
6
# File 'lib/sinopac/funbiz/order.rb', line 4

def param3
  @param3
end

#product_name ⇒ Object

Returns the value of attribute product_name.



3
4
5
# File 'lib/sinopac/funbiz/order.rb', line 3

def product_name
  @product_name
end

Instance Method Details

#valid? ⇒ Boolean



18
19
20
# File 'lib/sinopac/funbiz/order.rb', line 18

def valid?
  @amount > 0 && @order_no != '' && @product_name != ''
end