Class: Magpie::TenpayModel
- Inherits:
-
Object
- Object
- Magpie::TenpayModel
- Includes:
- Goose, Mouse
- Defined in:
- lib/models/tenpay.rb
Instance Attribute Summary (collapse)
-
- (Object) attach
Returns the value of attribute attach.
-
- (Object) bank_type
Returns the value of attribute bank_type.
-
- (Object) bargainor_id
Returns the value of attribute bargainor_id.
-
- (Object) cmdno
Returns the value of attribute cmdno.
-
- (Object) date
Returns the value of attribute date.
-
- (Object) desc
Returns the value of attribute desc.
-
- (Object) fee_type
Returns the value of attribute fee_type.
-
- (Object) purchaser_id
Returns the value of attribute purchaser_id.
-
- (Object) return_url
Returns the value of attribute return_url.
-
- (Object) sign
Returns the value of attribute sign.
-
- (Object) sp_billno
Returns the value of attribute sp_billno.
-
- (Object) spbill_create_ip
Returns the value of attribute spbill_create_ip.
-
- (Object) total_fee
Returns the value of attribute total_fee.
-
- (Object) transaction_id
Returns the value of attribute transaction_id.
Instance Method Summary (collapse)
- - (Boolean) invalid_request_sign?
- - (Object) notify
- - (Object) notify_sign
- - (Object) notify_string
- - (Object) notify_url
- - (Object) partner
- - (Object) pay_result
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) attach
Returns the value of attribute attach
13 14 15 |
# File 'lib/models/tenpay.rb', line 13 def attach @attach end |
- (Object) bank_type
Returns the value of attribute bank_type
11 12 13 |
# File 'lib/models/tenpay.rb', line 11 def bank_type @bank_type end |
- (Object) bargainor_id
Returns the value of attribute bargainor_id
11 12 13 |
# File 'lib/models/tenpay.rb', line 11 def end |
- (Object) cmdno
Returns the value of attribute cmdno
11 12 13 |
# File 'lib/models/tenpay.rb', line 11 def cmdno @cmdno end |
- (Object) date
Returns the value of attribute date
11 12 13 |
# File 'lib/models/tenpay.rb', line 11 def date @date end |
- (Object) desc
Returns the value of attribute desc
11 12 13 |
# File 'lib/models/tenpay.rb', line 11 def desc @desc end |
- (Object) fee_type
Returns the value of attribute fee_type
13 14 15 |
# File 'lib/models/tenpay.rb', line 13 def fee_type @fee_type end |
- (Object) purchaser_id
Returns the value of attribute purchaser_id
11 12 13 |
# File 'lib/models/tenpay.rb', line 11 def purchaser_id @purchaser_id end |
- (Object) return_url
Returns the value of attribute return_url
13 14 15 |
# File 'lib/models/tenpay.rb', line 13 def return_url @return_url end |
- (Object) sign
Returns the value of attribute sign
13 14 15 |
# File 'lib/models/tenpay.rb', line 13 def sign @sign end |
- (Object) sp_billno
Returns the value of attribute sp_billno
11 12 13 |
# File 'lib/models/tenpay.rb', line 11 def sp_billno @sp_billno end |
- (Object) spbill_create_ip
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 |
- (Object) total_fee
Returns the value of attribute total_fee
13 14 15 |
# File 'lib/models/tenpay.rb', line 13 def total_fee @total_fee end |
- (Object) transaction_id
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
- (Boolean) invalid_request_sign?
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 |
- (Object) notify
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 |
- (Object) notify_sign
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 |
- (Object) notify_string
78 79 80 |
# File 'lib/models/tenpay.rb', line 78 def notify_string @n_str ||= notify.map{ |kv| "%s=%s" % kv }.join("&") end |
- (Object) notify_url
61 62 63 |
# File 'lib/models/tenpay.rb', line 61 def notify_url self.return_url end |
- (Object) partner
50 51 52 |
# File 'lib/models/tenpay.rb', line 50 def partner self. end |
- (Object) pay_result
82 83 84 |
# File 'lib/models/tenpay.rb', line 82 def pay_result @pay_result ||= "0" end |