Class: Magpie::Dung
- Inherits:
-
Object
- Object
- Magpie::Dung
- Defined in:
- lib/models/dung.rb
Instance Method Summary (collapse)
-
- (Dung) initialize(am)
constructor
A new instance of Dung.
- - (Object) kind
- - (Object) merchant
- - (Object) notify_to_query
- - (Object) notify_url
- - (Object) price
- - (Object) subject
- - (Object) total_fee
- - (Object) trade_kind
- - (Object) trade_no
Constructor Details
- (Dung) initialize(am)
A new instance of Dung
5 6 7 |
# File 'lib/models/dung.rb', line 5 def initialize(am) @am = am end |
Instance Method Details
- (Object) kind
57 58 59 60 61 62 63 |
# File 'lib/models/dung.rb', line 57 def kind @name ||= case @am when AlipayModel; "alipay" when TenpayModel; "tenpay" when ChinabankModel; "chinabank" end end |
- (Object) merchant
25 26 27 |
# File 'lib/models/dung.rb', line 25 def merchant @merchant ||= "北京锋讯在线信息技术有限公司" end |
- (Object) notify_to_query
53 54 55 |
# File 'lib/models/dung.rb', line 53 def notify_to_query @nq ||= @am.notify.map{ |kv| "%s=%s" % kv }.join("&") end |
- (Object) notify_url
49 50 51 |
# File 'lib/models/dung.rb', line 49 def notify_url @notify_url ||= @am.notify_url end |
- (Object) price
41 42 43 44 45 46 47 |
# File 'lib/models/dung.rb', line 41 def price @price ||= case @am when AlipayModel; @am.price || @am.total_fee when TenpayModel; @am.total_fee.to_f/100 when ChinabankModel; @am.v_amount end end |
- (Object) subject
17 18 19 20 21 22 23 |
# File 'lib/models/dung.rb', line 17 def subject @subjedt ||= case @am when AlipayModel; @am.subject when TenpayModel; @am.desc when ChinabankModel; nil end end |
- (Object) total_fee
9 10 11 12 13 14 15 |
# File 'lib/models/dung.rb', line 9 def total_fee @total_fee ||= case @am when AlipayModel; @am.total_fee when TenpayModel; @am.total_fee.to_f/100 when ChinabankModel; @am.v_amount end end |
- (Object) trade_kind
29 30 31 |
# File 'lib/models/dung.rb', line 29 def trade_kind @trade_kind ||= "即时到帐交易" end |
- (Object) trade_no
33 34 35 36 37 38 39 |
# File 'lib/models/dung.rb', line 33 def trade_no @trade_no ||= case @am when AlipayModel; @am.out_trade_no when TenpayModel; @am.transaction_id when ChinabankModel; @am.v_oid end end |