Class: Magpie::Tenpay

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/middles/tenpay.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 = "http://service.tenpay.com/cgi-bin/v3.0/payservice.cgi") ⇒ Tenpay

Returns a new instance of Tenpay.



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

def initialize(app, pay_gateway = "http://service.tenpay.com/cgi-bin/v3.0/payservice.cgi")
  @app = app
  @pay_gateway = pay_gateway
  @red_xpath = "//div[@id='error-info']"
  @error_xpath = "//td[@class='font_14']"
end

Instance Method Details

#call(env) ⇒ Object



16
17
18
19
# File 'lib/middles/tenpay.rb', line 16

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