Sha256: cb6468b2169d375500d534a80dc68416d7e2091fe93ad3d83dfdd0442ae636b6

Contents?: true

Size: 1.72 KB

Versions: 1

Compression:

Stored size: 1.72 KB

Contents

# coding: utf-8

module Reapal
  module Api
    module Money
      module SubAccount

        # 2.11 企业分账(API)
        #
        # @param flow_id [ String ] 完成订单号
        # @param sub_type [ String ] 分账类型 1:代还款。2:分账。3:其它
        # @param sub_details [ Array ] 分账明细
        #          * serial_no [String] 分账流水号
        #          * payee_contracts [String] 收款方协议号
        #          * amount [BigDecimal] 金额
        #          * mark [String] 备注
        # @param remark [ String ] 业务备注信息
        #
        # @return [ 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:失败
        #
        def sub_account(flow_id, sub_type, sub_details, remark ='')
          service = 'reapal.trust.subAccount'
          post_path = '/reagw/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.sub_account, ['0000'])

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

      end # module
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
reapal-0.3.0 lib/reapal/api/money/sub_account.rb