Class: Gateway::AlipayTradeDirect
- Inherits:
-
Gateway
- Object
- Gateway
- Gateway::AlipayTradeDirect
- Defined in:
- app/models/spree/gateway/alipay_trade_direct.rb
Instance Method Summary collapse
- #auto_capture? ⇒ Boolean
- #method_type ⇒ Object
- #provider ⇒ Object
- #provider_class ⇒ Object
- #purchase(money, source, gateway_options) ⇒ Object
- #set_partner_trade(out_trade_no, order, return_url, notify_url, gateway_options = {}) ⇒ Object
- #source_required? ⇒ Boolean
- #supports?(source) ⇒ Boolean
Instance Method Details
#auto_capture? ⇒ Boolean
23 24 25 |
# File 'app/models/spree/gateway/alipay_trade_direct.rb', line 23 def auto_capture? true end |
#method_type ⇒ Object
31 32 33 |
# File 'app/models/spree/gateway/alipay_trade_direct.rb', line 31 def method_type 'alipay_trade_direct' end |
#provider ⇒ Object
18 19 20 21 |
# File 'app/models/spree/gateway/alipay_trade_direct.rb', line 18 def provider setup_alipay ::Alipay::Service end |
#provider_class ⇒ Object
14 15 16 |
# File 'app/models/spree/gateway/alipay_trade_direct.rb', line 14 def provider_class ::Alipay::Service end |
#purchase(money, source, gateway_options) ⇒ Object
36 37 38 |
# File 'app/models/spree/gateway/alipay_trade_direct.rb', line 36 def purchase(money, source, ) nil end |
#set_partner_trade(out_trade_no, order, return_url, notify_url, gateway_options = {}) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'app/models/spree/gateway/alipay_trade_direct.rb', line 40 def set_partner_trade(out_trade_no, order, return_url, notify_url, ={}) alipay_key= preferred_key time = Time.now.strftime('%Y%m%d%H%M%S%L') #https://mapi.alipay.com/gateway.do?service=trade_create_by_buyer&_input_charset=utf-8&partner=2088002627298374&seller_email=areq22%40aliyun.com&payment_type=1&out_trade_no=aquarius20141210165948670&subject=Iphone+6&logistics_type=DIRECT&logistics_fee=0&logistics_payment=SELLER_PAY&price=0.01&quantity=1&discount=0.00&return_url=http%3A%2F%2Flocalhost%3A3000%2Freturn¬ify_url=http%3A%2F%2Flocalhost%3A3000%2Fnotify&sign_type=MD5&sign=b74cdf8eea44cfe174c95a2e27c70a5a url="https://mapi.alipay.com/gateway.do" subject = [:subject] || order.number ={ :service=>"trade_create_by_buyer", :_input_charset=>"utf-8", :partner=>preferred_pid, :seller_email=>preferred_seller_email, :payment_type=>1, :out_trade_no=>out_trade_no, :subject=>subject, :logistics_type=>"EXPRESS", :logistics_fee=>0, :logistics_payment=>"BUYER_PAY", :price=>order.amount, :quantity=>1, :discount=>0.00, :return_url=>return_url, :notify_url=>notify_url } sign="" paymentlink=url<<"?" .each do |key,value| paymentlink<<"#{key}=#{value}&" end md5sign=_sign(,alipay_key) paymentlink<<"sign_type=MD5&sign=#{md5sign}" return paymentlink end |
#source_required? ⇒ Boolean
27 28 29 |
# File 'app/models/spree/gateway/alipay_trade_direct.rb', line 27 def source_required? false end |
#supports?(source) ⇒ Boolean
10 11 12 |
# File 'app/models/spree/gateway/alipay_trade_direct.rb', line 10 def supports?(source) true end |