Class: Chinapay::Response::Alipay

Inherits:
Object
  • Object
show all
Defined in:
lib/chinapay/response/alipay.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#attachObject (readonly)

Returns the value of attribute attach.



5
6
7
# File 'lib/chinapay/response/alipay.rb', line 5

def attach
  @attach
end

#pay_typeObject (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_feeObject (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_noObject (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