Class: Magpie::AlipayModel

Inherits:
Object
  • Object
show all
Includes:
Goose, Mouse
Defined in:
lib/models/alipay.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) _input_charset

Returns the value of attribute _input_charset



16
17
18
# File 'lib/models/alipay.rb', line 16

def _input_charset
  @_input_charset
end

- (Object) body

Returns the value of attribute body



14
15
16
# File 'lib/models/alipay.rb', line 14

def body
  @body
end

- (Object) notify_url

Returns the value of attribute notify_url



12
13
14
# File 'lib/models/alipay.rb', line 12

def notify_url
  @notify_url
end

- (Object) out_trade_no

Returns the value of attribute out_trade_no



12
13
14
# File 'lib/models/alipay.rb', line 12

def out_trade_no
  @out_trade_no
end

- (Object) partner

Returns the value of attribute partner



12
13
14
# File 'lib/models/alipay.rb', line 12

def partner
  @partner
end

- (Object) payment_type

Returns the value of attribute payment_type



14
15
16
# File 'lib/models/alipay.rb', line 14

def payment_type
  @payment_type
end

- (Object) price

Returns the value of attribute price



14
15
16
# File 'lib/models/alipay.rb', line 14

def price
  @price
end

- (Object) quantity

Returns the value of attribute quantity



14
15
16
# File 'lib/models/alipay.rb', line 14

def quantity
  @quantity
end

- (Object) return_url

Returns the value of attribute return_url



12
13
14
# File 'lib/models/alipay.rb', line 12

def return_url
  @return_url
end

- (Object) seller_email

Returns the value of attribute seller_email



14
15
16
# File 'lib/models/alipay.rb', line 14

def seller_email
  @seller_email
end

- (Object) seller_id

Returns the value of attribute seller_id



14
15
16
# File 'lib/models/alipay.rb', line 14

def seller_id
  @seller_id
end

- (Object) service

Returns the value of attribute service



12
13
14
# File 'lib/models/alipay.rb', line 12

def service
  @service
end

- (Object) show_url

Returns the value of attribute show_url



14
15
16
# File 'lib/models/alipay.rb', line 14

def show_url
  @show_url
end

- (Object) sign

Returns the value of attribute sign



12
13
14
# File 'lib/models/alipay.rb', line 12

def sign
  @sign
end

- (Object) sign_type

Returns the value of attribute sign_type



12
13
14
# File 'lib/models/alipay.rb', line 12

def sign_type
  @sign_type
end

- (Object) subject

Returns the value of attribute subject



12
13
14
# File 'lib/models/alipay.rb', line 12

def subject
  @subject
end

- (Object) total_fee

Returns the value of attribute total_fee



14
15
16
# File 'lib/models/alipay.rb', line 14

def total_fee
  @total_fee
end

Instance Method Details

- (Boolean) invalid_sign?

Returns:

  • (Boolean)


44
45
46
47
48
49
50
# File 'lib/models/alipay.rb', line 44

def invalid_sign?
  attrs = @attributes.dup
  attrs.delete("sign")
  attrs.delete("sign_type")
  text = attrs.delete_if{ |k, v| v.blank? }.sort.collect{ |s| s[0] + "=" + URI.decode(s[1]) }.join("&") + self.key
  self.sign == Digest::MD5.hexdigest(text) ? false : true
end

- (Boolean) money_blank?

Returns:

  • (Boolean)


40
41
42
# File 'lib/models/alipay.rb', line 40

def money_blank?
  self.price.blank? and self.total_fee.blank?
end

- (Object) notify



52
53
54
55
56
57
# File 'lib/models/alipay.rb', line 52

def notify
  @notify ||= notify_attrs.inject({ }){ |notify, attr|
    notify[attr] = self.send(attr)
    notify
  }.merge("sign_type" => sign_type, "sign" => notify_sign)
end

- (Boolean) price_missing_quantity?

Returns:

  • (Boolean)


32
33
34
# File 'lib/models/alipay.rb', line 32

def price_missing_quantity?
  self.price.to_s.length > 0 and self.quantity.blank?
end

- (Boolean) repeat_money?

Returns:

  • (Boolean)


28
29
30
# File 'lib/models/alipay.rb', line 28

def repeat_money?
  self.price.to_s.length > 0 and self.total_fee.to_s.length > 0
end

- (Boolean) seller_blank?

Returns:

  • (Boolean)


36
37
38
# File 'lib/models/alipay.rb', line 36

def seller_blank?
  self.seller_id.blank? and self.seller_email.blank?
end