Class: Magpie::ChinabankModel

Inherits:
Object
  • Object
show all
Includes:
Goose, Mouse
Defined in:
lib/models/chinabank.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Mouse

#account, included, #key, #missing_partner?

Methods included from Goose

#errors, included, #initialize, #valid?, #validating

Instance Attribute Details

#remark1Object

Returns the value of attribute remark1.



11
12
13
# File 'lib/models/chinabank.rb', line 11

def remark1
  @remark1
end

#remark2Object

Returns the value of attribute remark2.



11
12
13
# File 'lib/models/chinabank.rb', line 11

def remark2
  @remark2
end

#v_amountObject

Returns the value of attribute v_amount.



11
12
13
# File 'lib/models/chinabank.rb', line 11

def v_amount
  @v_amount
end

#v_md5infoObject

Returns the value of attribute v_md5info.



11
12
13
# File 'lib/models/chinabank.rb', line 11

def v_md5info
  @v_md5info
end

#v_midObject

Returns the value of attribute v_mid.



11
12
13
# File 'lib/models/chinabank.rb', line 11

def v_mid
  @v_mid
end

#v_moneytypeObject

Returns the value of attribute v_moneytype.



11
12
13
# File 'lib/models/chinabank.rb', line 11

def v_moneytype
  @v_moneytype
end

#v_oidObject

Returns the value of attribute v_oid.



11
12
13
# File 'lib/models/chinabank.rb', line 11

def v_oid
  @v_oid
end

#v_urlObject

Returns the value of attribute v_url.



11
12
13
# File 'lib/models/chinabank.rb', line 11

def v_url
  @v_url
end

Instance Method Details

#invalid_sign?Boolean

Returns:

  • (Boolean)


23
24
25
26
27
28
# File 'lib/models/chinabank.rb', line 23

def invalid_sign?
  text = @attributes["v_amount"]+@attributes["v_moneytype"]+@attributes["v_oid"]+@attributes["v_mid"]+@attributes["v_url"]+self.key
  self.sign.upcase == Digest::MD5.hexdigest(text).upcase ? false : true
rescue => e
  true
end

#notifyObject



43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/models/chinabank.rb', line 43

def notify
  @notify ||= { "v_oid" => v_oid,
    "v_pstatus"   => v_pstatus,
    "v_amount"    => v_amount,
    "v_pstring"   => v_pstring,
    "v_pmode"     => v_pmode,
    "v_moneytype" => v_moneytype,
    "v_md5str"    => notify_sign,
    "remark1"     => remark1,
    "remark2"     => remark2
  }.delete_if { |k, v| v.to_s.length == 0}
end

#notify_urlObject

商家系统用来处理网银支付结果的url



39
40
41
# File 'lib/models/chinabank.rb', line 39

def notify_url
  self.v_url
end

#partnerObject



34
35
36
# File 'lib/models/chinabank.rb', line 34

def partner
  self.v_mid
end

#signObject



30
31
32
# File 'lib/models/chinabank.rb', line 30

def sign
  self.v_md5info
end