Class: Magpie::TenpayModel
- Inherits:
-
Object
- Object
- Magpie::TenpayModel
- Defined in:
- lib/models/tenpay.rb
Instance Attribute Summary collapse
-
#attach ⇒ Object
Returns the value of attribute attach.
-
#bank_type ⇒ Object
Returns the value of attribute bank_type.
-
#bargainor_id ⇒ Object
Returns the value of attribute bargainor_id.
-
#cmdno ⇒ Object
Returns the value of attribute cmdno.
-
#date ⇒ Object
Returns the value of attribute date.
-
#desc ⇒ Object
Returns the value of attribute desc.
-
#fee_type ⇒ Object
Returns the value of attribute fee_type.
-
#purchaser_id ⇒ Object
Returns the value of attribute purchaser_id.
-
#return_url ⇒ Object
Returns the value of attribute return_url.
-
#sign ⇒ Object
Returns the value of attribute sign.
-
#sp_billno ⇒ Object
Returns the value of attribute sp_billno.
-
#spbill_create_ip ⇒ Object
Returns the value of attribute spbill_create_ip.
-
#total_fee ⇒ Object
Returns the value of attribute total_fee.
-
#transaction_id ⇒ Object
Returns the value of attribute transaction_id.
Instance Method Summary collapse
- #invalid_request_sign? ⇒ Boolean
- #notify ⇒ Object
- #notify_sign ⇒ Object
- #notify_string ⇒ Object
- #notify_url ⇒ Object
- #partner ⇒ Object
- #pay_result ⇒ Object
Methods included from Mouse
#account, included, #key, #missing_partner?
Methods included from Goose
#errors, included, #initialize, #valid?, #validating
Instance Attribute Details
#attach ⇒ Object
Returns the value of attribute attach.
13 14 15 |
# File 'lib/models/tenpay.rb', line 13 def attach @attach end |
#bank_type ⇒ Object
Returns the value of attribute bank_type.
11 12 13 |
# File 'lib/models/tenpay.rb', line 11 def bank_type @bank_type end |
#bargainor_id ⇒ Object
Returns the value of attribute bargainor_id.
11 12 13 |
# File 'lib/models/tenpay.rb', line 11 def @bargainor_id end |
#cmdno ⇒ Object
Returns the value of attribute cmdno.
11 12 13 |
# File 'lib/models/tenpay.rb', line 11 def cmdno @cmdno end |
#date ⇒ Object
Returns the value of attribute date.
11 12 13 |
# File 'lib/models/tenpay.rb', line 11 def date @date end |
#desc ⇒ Object
Returns the value of attribute desc.
11 12 13 |
# File 'lib/models/tenpay.rb', line 11 def desc @desc end |
#fee_type ⇒ Object
Returns the value of attribute fee_type.
13 14 15 |
# File 'lib/models/tenpay.rb', line 13 def fee_type @fee_type end |
#purchaser_id ⇒ Object
Returns the value of attribute purchaser_id.
11 12 13 |
# File 'lib/models/tenpay.rb', line 11 def purchaser_id @purchaser_id end |
#return_url ⇒ Object
Returns the value of attribute return_url.
13 14 15 |
# File 'lib/models/tenpay.rb', line 13 def return_url @return_url end |
#sign ⇒ Object
Returns the value of attribute sign.
13 14 15 |
# File 'lib/models/tenpay.rb', line 13 def sign @sign end |
#sp_billno ⇒ Object
Returns the value of attribute sp_billno.
11 12 13 |
# File 'lib/models/tenpay.rb', line 11 def sp_billno @sp_billno end |
#spbill_create_ip ⇒ Object
Returns the value of attribute spbill_create_ip.
13 14 15 |
# File 'lib/models/tenpay.rb', line 13 def spbill_create_ip @spbill_create_ip end |
#total_fee ⇒ Object
Returns the value of attribute total_fee.
13 14 15 |
# File 'lib/models/tenpay.rb', line 13 def total_fee @total_fee end |
#transaction_id ⇒ Object
Returns the value of attribute transaction_id.
11 12 13 |
# File 'lib/models/tenpay.rb', line 11 def transaction_id @transaction_id end |
Instance Method Details
#invalid_request_sign? ⇒ Boolean
43 44 45 46 47 48 |
# File 'lib/models/tenpay.rb', line 43 def invalid_request_sign? text = %w(cmdno date bargainor_id transaction_id sp_billno total_fee fee_type return_url attach spbill_create_ip ).map{ |attr| "#{attr}=#{@attributes[attr]}" unless @attributes[attr].blank? }.join("&") + "&key=" + self.key.to_s Digest::MD5.hexdigest(text).upcase != self.sign ? true : false end |
#notify ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/models/tenpay.rb', line 65 def notify @notify ||= { "cmdno" => cmdno, "pay_result" => pay_result, "date" => date, "transaction_id" => transaction_id, "sp_billno" => sp_billno, "total_fee" => total_fee, "fee_type" => fee_type, "attach" => attach, "sign" => notify_sign } end |
#notify_sign ⇒ Object
54 55 56 57 58 59 |
# File 'lib/models/tenpay.rb', line 54 def notify_sign text = %w(cmdno pay_result date transaction_id sp_billno total_fee fee_type attach).map{ |attr| "#{attr}=#{self.send(attr)}" }.join("&") + "&key=" + self.key.to_s Digest::MD5.hexdigest(text).upcase end |
#notify_string ⇒ Object
78 79 80 |
# File 'lib/models/tenpay.rb', line 78 def notify_string @n_str ||= notify.map{ |kv| "%s=%s" % kv }.join("&") end |
#notify_url ⇒ Object
61 62 63 |
# File 'lib/models/tenpay.rb', line 61 def notify_url self.return_url end |
#partner ⇒ Object
50 51 52 |
# File 'lib/models/tenpay.rb', line 50 def partner self. end |
#pay_result ⇒ Object
82 83 84 |
# File 'lib/models/tenpay.rb', line 82 def pay_result @pay_result ||= "0" end |