Module: Reapal::Api::Money::SubAccount

Defined in:
lib/reapal/api/money/sub_account.rb

Instance Method Summary collapse

Instance Method Details

#sub_account(flow_id, sub_type, sub_details, remark = '') ⇒ Hash

2.8 企业分账(API)

Parameters:

  • flow_id (String)

    完成订单号

  • sub_type (String)

    分账类型 1:代还款。2:分账。3:其它

  • sub_details (Array)

    分账明细

    • :serialNo [String] 分账流水号

    • :payeeContracts [String] 收款方协议号

    • :amount [BigDecimal] 金额

    • :remark [String] 备注

  • remark (String) (defaults to: '')

    业务备注信息

Returns:

  • (Hash)

    结果集

    • :result [String] 业务结果:‘S/F/P’

    • :request_params [Hash] 请求参数

    • :response [Object] 请求返回对象

    • :error_code [String] 错误代号

    • :error_msg [String] 错误信息

    • :data: 具体业务返回信息

      * :flow_id [String] 完成订单号
      * :result_code [String] 结果代码 0000:分账成功 0001:失败
      


29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/reapal/api/money/sub_account.rb', line 29

def (flow_id, sub_type, sub_details, remark ='')
  service = 'reapal.trust.subAccount'
  post_path = '/service/depwit.htm'

  params = {
    orderNo: flow_id,
    subType: sub_type,
    subDetails: sub_details,
    remark: remark,
    applyTime: Time.now.strftime('%Y-%m-%d %H:%M:%S'),
  }

  res = operate_post(:operate, service, params, post_path, Http::ErrorCode., ['0000'])

  if 'P' == res[:result] && '0001' == res[:data][:resultCode]
    res[:result] = 'F'
  end

  Reapal.logger.info res

  res
end