Class: Magpie::Chinabank

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/middles/chinabank.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://pay3.chinabank.com.cn/PayGate") ⇒ Chinabank

Returns a new instance of Chinabank.



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

def initialize(app, pay_gateway = "https://pay3.chinabank.com.cn/PayGate")
  @app = app
  @pay_gateway = pay_gateway
  @red_xpath = "//strong[@class='red']"
end

Instance Method Details

#call(env) ⇒ Object



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

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