lib/reapal/api/user/bind_card_query.rb in reapal-0.2.2 vs lib/reapal/api/user/bind_card_query.rb in reapal-0.3.0

- old
+ new

@@ -16,11 +16,11 @@ # * :response [Object] 请求返回对象 # * :error_code [String] 错误代号 # * :error_msg [String] 错误信息 # * :data: 具体业务返回信息 # * :contracts [String] 用户协议号 - # * :bank_cards [Array] 银行卡信息数组 + # * :bank_cards [Array] 银行卡信息数组 # * :bank_name 银行名称 # * :bank_code 银行代码 # * :bank_card 银行卡后四位 # * :type 业务类型 A: 充值和提现; D: 充值; W: 提现 # * :is_safety 绑卡类别 0: 普通卡; 1:安全卡 @@ -38,26 +38,15 @@ contracts: contracts, type: type, queryTime: Time.now.strftime('%Y-%m-%d %H:%M:%S') } - response = Http.post(service, params, @config, post_path) + res = operate_post(:query, service, params, post_path, Http::ErrorCode.bind_card, ['0000']) - res = Reapal::Utils.api_result(params, response) - - # 查询类 api,http 没成功都返回 pending - return res unless response.http_success? - - if Api::ErrorCode.bind_card.include?(response.data[:errorCode]) - res[:result] = 'F' - return res + if 'S' == res[:result] + # TODO: (tony) 返回的银行字符串解析成数据,便于使用方 + # res[:data][:bank_cards] = parse_cards_info(res[:data][:bank_cards]) end - - # 其余 api 错误不知道 - return res unless response.data[:errorCode].nil? - - res[:result] = 'S' - res[:data][:bank_cards] = parse_cards_info(res[:data][:bank_cards]) res end end # module