Class: Magpie::Alipay

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/middles/alipay.rb

Instance Method Summary collapse

Methods included from Utils

#build_xml, #dig, #get_notify_res, #get_query, #get_xml_body, #hash_to_xml, #log_errors, #log_notify, #post_query, #send_notify, #send_req_to, #start_http

Constructor Details

#initialize(app, pay_gateway = "https://www.alipay.com/cooperate/gateway.do") ⇒ Alipay

Returns a new instance of Alipay.



9
10
11
12
13
# File 'lib/middles/alipay.rb', line 9

def initialize(app, pay_gateway = "https://www.alipay.com/cooperate/gateway.do")
  @app = app
  @pay_gateway = pay_gateway
  @red_xpath = "//div[@id='Info']/div[@class='ErrorInfo']/div[@class='Todo']"
end

Instance Method Details

#call(env) ⇒ Object



15
16
17
18
# File 'lib/middles/alipay.rb', line 15

def call(env)
  status, header, body, req, red_text = dig env
  [status, header, get_xml_body(env, AlipayModel.new(req.params), red_text)]
end