Class: Sinopac::FunBiz::Result
- Inherits:
-
Object
- Object
- Sinopac::FunBiz::Result
- Defined in:
- lib/sinopac/funbiz/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.
-
#param1 ⇒ Object
readonly
Returns the value of attribute param1.
-
#param2 ⇒ Object
readonly
Returns the value of attribute param2.
-
#param3 ⇒ Object
readonly
Returns the value of attribute param3.
-
#pay_type ⇒ Object
readonly
Returns the value of attribute pay_type.
-
#payment_params ⇒ Object
readonly
Returns the value of attribute payment_params.
-
#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) ⇒ Result
constructor
A new instance of Result.
- #payment_url ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(result) ⇒ Result
Returns a new instance of Result.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/sinopac/funbiz/result.rb', line 5 def initialize(result) @order_no = result[:OrderNo] @shop_no = result[:ShopNo] @transaction_no = result[:TSNo] @amount = result[:Amount] / 100 @status = result[:Status] @description = result[:Description] @param1 = result[:Param1] @param2 = result[:Param2] @param3 = result[:Param3] case result[:PayType] when 'A' @pay_type = :atm @payment_params = result[:ATMParam] when 'C' @pay_type = :credit_card @payment_params = result[:CardParam] else @pay_type = :unknown @payment_params = {} end end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
3 4 5 |
# File 'lib/sinopac/funbiz/result.rb', line 3 def amount @amount end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
3 4 5 |
# File 'lib/sinopac/funbiz/result.rb', line 3 def description @description end |
#order_no ⇒ Object (readonly)
Returns the value of attribute order_no.
3 4 5 |
# File 'lib/sinopac/funbiz/result.rb', line 3 def order_no @order_no end |
#param1 ⇒ Object (readonly)
Returns the value of attribute param1.
4 5 6 |
# File 'lib/sinopac/funbiz/result.rb', line 4 def param1 @param1 end |
#param2 ⇒ Object (readonly)
Returns the value of attribute param2.
4 5 6 |
# File 'lib/sinopac/funbiz/result.rb', line 4 def param2 @param2 end |
#param3 ⇒ Object (readonly)
Returns the value of attribute param3.
4 5 6 |
# File 'lib/sinopac/funbiz/result.rb', line 4 def param3 @param3 end |
#pay_type ⇒ Object (readonly)
Returns the value of attribute pay_type.
4 5 6 |
# File 'lib/sinopac/funbiz/result.rb', line 4 def pay_type @pay_type end |
#payment_params ⇒ Object (readonly)
Returns the value of attribute payment_params.
4 5 6 |
# File 'lib/sinopac/funbiz/result.rb', line 4 def payment_params @payment_params end |
#shop_no ⇒ Object (readonly)
Returns the value of attribute shop_no.
3 4 5 |
# File 'lib/sinopac/funbiz/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/result.rb', line 3 def status @status end |
#transaction_no ⇒ Object (readonly)
Returns the value of attribute transaction_no.
3 4 5 |
# File 'lib/sinopac/funbiz/result.rb', line 3 def transaction_no @transaction_no end |
Instance Method Details
#payment_url ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/sinopac/funbiz/result.rb', line 33 def payment_url case @pay_type when :atm @payment_params[:WebAtmURL] when :credit_card @payment_params[:CardPayURL] else raise 'not supported' end end |
#success? ⇒ Boolean
29 30 31 |
# File 'lib/sinopac/funbiz/result.rb', line 29 def success? @status == 'S' end |