Sha256: 9dcddb7f6262189b68f571dc357114aa435d6aefe27174bbb56b8cb00f90fd00
Contents?: true
Size: 1.31 KB
Versions: 1
Compression:
Stored size: 1.31 KB
Contents
# coding: utf-8 # 商户余额查询 module JytPay module Api module QueryBalance QUERY_BALANCE_TRAN_CODE = "TC2020" # 查询商户当前余额 # # @param flow_id [ String ] 订单号 # @param mer_viral_acct [String] 代收/代付账号 # # @return [ Hash ] 结果集 # * :result [String] 是否成功,`F`, `S`, `P` # * :msg [String] 结果说明 # * :balance [Float] 余额 # def query_balance(flow_id, mer_viral_acct) params = { mer_viral_acct: mer_viral_acct, } xml_str = JytPay::Xml.generate(@merchant_id, QUERY_BALANCE_TRAN_CODE, params, flow_id) response = Http.post(@merchant_id, @uris[:query_balance], QUERY_BALANCE_TRAN_CODE, xml_str, @rsa_private_key, @rsa_jyt_public_key) res = { result: 'F', msg: response[:head][:resp_desc], balance: 0, } case response[:head][:resp_code] when 'S0000000' res = { result: 'S', msg: response[:head][:resp_desc], balance: response[:body][:balance].to_f, } end res end end # module QueryBalance end # module Api end # module
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jyt_pay-0.3.0 | lib/jyt_pay/api/query_balance.rb |