Class: Magpie::Chinabank
- Inherits:
-
Object
- Object
- Magpie::Chinabank
- Includes:
- Utils
- Defined in:
- lib/middles/chinabank.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, pay_gateway = "https://pay3.chinabank.com.cn/PayGate") ⇒ Chinabank
constructor
A new instance of Chinabank.
Constructor Details
#initialize(app, pay_gateway = "https://pay3.chinabank.com.cn/PayGate") ⇒ Chinabank
Returns a new instance of Chinabank.
9 10 11 12 |
# File 'lib/middles/chinabank.rb', line 9 def initialize(app, pay_gateway = "https://pay3.chinabank.com.cn/PayGate") @app = app @pay_gateway = pay_gateway end |
Instance Method Details
#call(env) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/middles/chinabank.rb', line 14 def call(env) status, header, body = @app.call(env) req = Rack::Request.new(env) doc = send_req_to @pay_gateway, req red_text = Iconv.iconv("UTF-8//IGNORE","GBK//IGNORE", (doc/"//strong[@class='red']").inner_text).to_s am = ChinabankModel.new(req.params) [status, header, get_xml_body(env, am, red_text)] end |