Module: ChanPay::Api::QueryBalance

Included in:
Client
Defined in:
lib/chan_pay/api/query_balance.rb

Constant Summary collapse

SERVICE_NAME =
'cjt_dsf'

Instance Method Summary collapse

Instance Method Details

#query_balance(flow_id) ⇒ Hash

商户余额查询

Parameters:

  • flow_id (String)

    订单号(需要保证唯一)

Returns:

  • (Hash)

    返回结果集



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/chan_pay/api/query_balance.rb', line 17

def query_balance(flow_id)
  params = {
    :TransCode => 'C00005',
    :OutTradeNo => flow_id,
  }

  response = Http.post(@partner_id, @private_key, @public_key, @server_uri, SERVICE_NAME, params)

  {
    result: response[:AcceptStatus],
    balance: response[:RecBalance].to_f,
    pay_balance: response[:PayBalance].to_f,
  }
end