Module: Allinpay::Query

Extended by:
ActiveSupport::Concern
Included in:
Client
Defined in:
lib/allinpay/query.rb

Instance Method Summary collapse

Instance Method Details

#query_batch_pay(sn, options = {}) ⇒ Object

交易结果查询 交易代码:200004

Parameters:

  • sn (String)

    要查询的交易流水, 若不填时间必填

  • options (Hash) (defaults to: {})

    其它信息

Options Hash (options):

  • :type (String)

    查询类型, 如果使用0查询,未完成交易将查不到

  • :status (String)

    状态, 如果开始时间和结束时间不为空,该字段生效,不可为空

  • :start_day (String)

    开始时间, 若不填QUERY_SN则必填

  • :end_day (String)

    结束时间, 填了开始时间必填



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/allinpay/query.rb', line 22

def query_batch_pay(sn, options = {})
  params = set_infomation('200004')
  tran_body = { MERCHANT_ID: merchant, QUERY_SN: sn }
  rean_body[:TYPE] = options[:type] if options[:type]
  rean_body[:STATUS] = options[:status] if options[:status]
  rean_body[:START_DAY] = options[:start_day] if options[:start_day]
  rean_body[:END_DAY] = options[:end_day] if options[:end_day]
  params[:QTRANSREQ] = tran_body
  res = conn.request(params)
  return result_wrap(:fail, res) if res["INFO"]["RET_CODE"] != "0000"
  return result_wrap(:success, res, params)
end