Class: Magpie::AlipayModel
- Inherits:
-
Object
- Object
- Magpie::AlipayModel
- Defined in:
- lib/models/alipay.rb
Instance Attribute Summary collapse
-
#_input_charset ⇒ Object
Returns the value of attribute _input_charset.
-
#body ⇒ Object
Returns the value of attribute body.
-
#notify_url ⇒ Object
Returns the value of attribute notify_url.
-
#out_trade_no ⇒ Object
Returns the value of attribute out_trade_no.
-
#partner ⇒ Object
Returns the value of attribute partner.
-
#payment_type ⇒ Object
Returns the value of attribute payment_type.
-
#price ⇒ Object
Returns the value of attribute price.
-
#quantity ⇒ Object
Returns the value of attribute quantity.
-
#return_url ⇒ Object
Returns the value of attribute return_url.
-
#seller_email ⇒ Object
Returns the value of attribute seller_email.
-
#seller_id ⇒ Object
Returns the value of attribute seller_id.
-
#service ⇒ Object
Returns the value of attribute service.
-
#show_url ⇒ Object
Returns the value of attribute show_url.
-
#sign ⇒ Object
Returns the value of attribute sign.
-
#sign_type ⇒ Object
Returns the value of attribute sign_type.
-
#subject ⇒ Object
Returns the value of attribute subject.
-
#total_fee ⇒ Object
Returns the value of attribute total_fee.
Instance Method Summary collapse
- #invalid_sign? ⇒ Boolean
- #money_blank? ⇒ Boolean
- #notify ⇒ Object
- #price_missing_quantity? ⇒ Boolean
- #repeat_money? ⇒ Boolean
- #seller_blank? ⇒ Boolean
Methods included from Mouse
#account, included, #key, #missing_partner?
Methods included from Goose
#errors, included, #initialize, #valid?, #validating
Instance Attribute Details
#_input_charset ⇒ Object
Returns the value of attribute _input_charset.
16 17 18 |
# File 'lib/models/alipay.rb', line 16 def _input_charset @_input_charset end |
#body ⇒ Object
Returns the value of attribute body.
14 15 16 |
# File 'lib/models/alipay.rb', line 14 def body @body end |
#notify_url ⇒ Object
Returns the value of attribute notify_url.
12 13 14 |
# File 'lib/models/alipay.rb', line 12 def notify_url @notify_url end |
#out_trade_no ⇒ Object
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 |
#partner ⇒ Object
Returns the value of attribute partner.
12 13 14 |
# File 'lib/models/alipay.rb', line 12 def partner @partner end |
#payment_type ⇒ Object
Returns the value of attribute payment_type.
14 15 16 |
# File 'lib/models/alipay.rb', line 14 def payment_type @payment_type end |
#price ⇒ Object
Returns the value of attribute price.
14 15 16 |
# File 'lib/models/alipay.rb', line 14 def price @price end |
#quantity ⇒ Object
Returns the value of attribute quantity.
14 15 16 |
# File 'lib/models/alipay.rb', line 14 def quantity @quantity end |
#return_url ⇒ Object
Returns the value of attribute return_url.
12 13 14 |
# File 'lib/models/alipay.rb', line 12 def return_url @return_url end |
#seller_email ⇒ Object
Returns the value of attribute seller_email.
14 15 16 |
# File 'lib/models/alipay.rb', line 14 def seller_email @seller_email end |
#seller_id ⇒ Object
Returns the value of attribute seller_id.
14 15 16 |
# File 'lib/models/alipay.rb', line 14 def seller_id @seller_id end |
#service ⇒ Object
Returns the value of attribute service.
12 13 14 |
# File 'lib/models/alipay.rb', line 12 def service @service end |
#show_url ⇒ Object
Returns the value of attribute show_url.
14 15 16 |
# File 'lib/models/alipay.rb', line 14 def show_url @show_url end |
#sign ⇒ Object
Returns the value of attribute sign.
12 13 14 |
# File 'lib/models/alipay.rb', line 12 def sign @sign end |
#sign_type ⇒ Object
Returns the value of attribute sign_type.
12 13 14 |
# File 'lib/models/alipay.rb', line 12 def sign_type @sign_type end |
#subject ⇒ Object
Returns the value of attribute subject.
12 13 14 |
# File 'lib/models/alipay.rb', line 12 def subject @subject end |
#total_fee ⇒ Object
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
#invalid_sign? ⇒ 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 |
#money_blank? ⇒ Boolean
40 41 42 |
# File 'lib/models/alipay.rb', line 40 def money_blank? self.price.blank? and self.total_fee.blank? end |
#notify ⇒ Object
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 |
#price_missing_quantity? ⇒ 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 |
#repeat_money? ⇒ 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 |
#seller_blank? ⇒ Boolean
36 37 38 |
# File 'lib/models/alipay.rb', line 36 def seller_blank? self.seller_id.blank? and self.seller_email.blank? end |