Class: Chinapay::Response::Alipay
- Inherits:
-
Object
- Object
- Chinapay::Response::Alipay
- Defined in:
- lib/chinapay/response/alipay.rb
Instance Attribute Summary collapse
-
#attach ⇒ Object
readonly
Returns the value of attribute attach.
-
#pay_type ⇒ Object
readonly
Returns the value of attribute pay_type.
-
#total_fee ⇒ Object
readonly
Returns the value of attribute total_fee.
-
#trade_no ⇒ Object
readonly
Returns the value of attribute trade_no.
Instance Method Summary collapse
-
#initialize(params) ⇒ Alipay
constructor
A new instance of Alipay.
- #success_response(redirect_url = "") ⇒ Object
- #successful? ⇒ Boolean
Constructor Details
#initialize(params) ⇒ Alipay
7 8 9 10 11 12 13 14 |
# File 'lib/chinapay/response/alipay.rb', line 7 def initialize(params) @params = params @trade_no = params["out_trade_no"] @total_fee = params["total_fee"].to_f @attach = params["extra_common_param"] @pay_type = "支付宝" end |
Instance Attribute Details
#attach ⇒ Object (readonly)
Returns the value of attribute attach.
5 6 7 |
# File 'lib/chinapay/response/alipay.rb', line 5 def attach @attach end |
#pay_type ⇒ Object (readonly)
Returns the value of attribute pay_type.
5 6 7 |
# File 'lib/chinapay/response/alipay.rb', line 5 def pay_type @pay_type end |
#total_fee ⇒ Object (readonly)
Returns the value of attribute total_fee.
5 6 7 |
# File 'lib/chinapay/response/alipay.rb', line 5 def total_fee @total_fee end |
#trade_no ⇒ Object (readonly)
Returns the value of attribute trade_no.
5 6 7 |
# File 'lib/chinapay/response/alipay.rb', line 5 def trade_no @trade_no end |
Instance Method Details
#success_response(redirect_url = "") ⇒ Object
20 21 22 |
# File 'lib/chinapay/response/alipay.rb', line 20 def success_response(redirect_url = "") "success" end |
#successful? ⇒ Boolean
16 17 18 |
# File 'lib/chinapay/response/alipay.rb', line 16 def successful? (@params["trade_status"] == "TRADE_SUCCESS") && (md5_sort(filter_params(@params)) == @params.sign) end |