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

Constructor Details

This class inherits a constructor from Magpie::Goose

Instance Attribute Details

- (Object) remark1

Returns the value of attribute remark1



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

def remark1
  @remark1
end

- (Object) remark2

Returns the value of attribute remark2



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

def remark2
  @remark2
end

- (Object) v_amount

Returns the value of attribute v_amount



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

def v_amount
  @v_amount
end

- (Object) v_md5info

Returns the value of attribute v_md5info



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

def v_md5info
  @v_md5info
end

- (Object) v_mid

Returns the value of attribute v_mid



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

def v_mid
  @v_mid
end

- (Object) v_moneytype

Returns the value of attribute v_moneytype



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

def v_moneytype
  @v_moneytype
end

- (Object) v_oid

Returns the value of attribute v_oid



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

def v_oid
  @v_oid
end

- (Object) v_url

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

- (Boolean) invalid_sign?

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

- (Object) notify



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

- (Object) notify_url

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



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

def notify_url
  self.v_url
end

- (Object) partner



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

def partner
  self.v_mid
end

- (Object) sign



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

def sign
  self.v_md5info
end