Class: Sinopac::FunBiz::OrderResult
- Inherits:
-
Object
- Object
- Sinopac::FunBiz::OrderResult
- Defined in:
- lib/sinopac/funbiz/order_result.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#order_no ⇒ Object
readonly
Returns the value of attribute order_no.
-
#order_params ⇒ Object
readonly
Returns the value of attribute order_params.
-
#pay_status ⇒ Object
readonly
Returns the value of attribute pay_status.
-
#shop_no ⇒ Object
readonly
Returns the value of attribute shop_no.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#transaction_no ⇒ Object
readonly
Returns the value of attribute transaction_no.
Instance Method Summary collapse
-
#initialize(result) ⇒ OrderResult
constructor
A new instance of OrderResult.
- #success? ⇒ Boolean
Constructor Details
#initialize(result) ⇒ OrderResult
Returns a new instance of OrderResult.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/sinopac/funbiz/order_result.rb', line 6 def initialize(result) @shop_no = result[:ShopNo] @status = result[:Status] @description = result[:Description] @order_params = result[:OrderList].first @transaction_no = order_params[:TSNo] @order_no = order_params[:OrderNo] case order_params[:PayType] when 'A' @pay_type = :atm when 'C' @pay_type = :credit_card else @pay_type = :unknown end @amount = order_params[:Amount].to_i / 100 @pay_status = order_params[:PayStatus] end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
4 5 6 |
# File 'lib/sinopac/funbiz/order_result.rb', line 4 def amount @amount end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
3 4 5 |
# File 'lib/sinopac/funbiz/order_result.rb', line 3 def description @description end |
#order_no ⇒ Object (readonly)
Returns the value of attribute order_no.
4 5 6 |
# File 'lib/sinopac/funbiz/order_result.rb', line 4 def order_no @order_no end |
#order_params ⇒ Object (readonly)
Returns the value of attribute order_params.
3 4 5 |
# File 'lib/sinopac/funbiz/order_result.rb', line 3 def order_params @order_params end |
#pay_status ⇒ Object (readonly)
Returns the value of attribute pay_status.
4 5 6 |
# File 'lib/sinopac/funbiz/order_result.rb', line 4 def pay_status @pay_status end |
#shop_no ⇒ Object (readonly)
Returns the value of attribute shop_no.
3 4 5 |
# File 'lib/sinopac/funbiz/order_result.rb', line 3 def shop_no @shop_no end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
3 4 5 |
# File 'lib/sinopac/funbiz/order_result.rb', line 3 def status @status end |
#transaction_no ⇒ Object (readonly)
Returns the value of attribute transaction_no.
4 5 6 |
# File 'lib/sinopac/funbiz/order_result.rb', line 4 def transaction_no @transaction_no end |
Instance Method Details
#success? ⇒ Boolean
26 27 28 |
# File 'lib/sinopac/funbiz/order_result.rb', line 26 def success? @status == 'S' end |