Sha256: 22a9b4e025ca0c1a7df3c91bfcd67e5b560ac56a62be9138e93448ade67effad

Contents?: true

Size: 713 Bytes

Versions: 3

Compression:

Stored size: 713 Bytes

Contents

# coding: utf-8

# 4.2.13 商户余额查询

module ChanPay
  module Api
    module QueryBalance

      SERVICE_NAME = 'cjt_dsf'

      # 商户余额查询
      #
      # @param flow_id [String] 订单号(需要保证唯一)
      #
      # @return [Hash] 返回结果集
      #
      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

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
chan_pay-0.7.0 lib/chan_pay/api/query_balance.rb
chan_pay-0.6.0 lib/chan_pay/api/query_balance.rb
chan_pay-0.4.0 lib/chan_pay/api/query_balance.rb