|
|
|
@@ -6,9 +6,7 @@ import java.security.NoSuchAlgorithmException; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
import com.iformall.common.ErrorCode; |
|
|
|
import com.iformall.douyin.pay.orderQuery.QueryMerchantResult; |
|
|
|
import com.iformall.douyin.pay.orderQuery.QueryRefundResult; |
|
|
|
import com.iformall.douyin.pay.orderQuery.QuerySettleResult; |
|
|
|
import com.iformall.douyin.pay.orderQuery.*; |
|
|
|
import com.iformall.douyin.pay.preOrder.*; |
|
|
|
import com.iformall.enums.EnumPayStatus; |
|
|
|
import com.iformall.exception.MallinkException; |
|
|
|
@@ -16,7 +14,6 @@ import com.iformall.utils.sign.SignUtils; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.iformall.douyin.pay.orderQuery.OrderQueryResult; |
|
|
|
import com.iformall.utils.HttpUtil; |
|
|
|
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
@@ -352,8 +349,9 @@ public class DouYinPayHelper { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//可分账余额查询 |
|
|
|
//https://developer.toutiao.com/api/apps/ecpay/v1/unsettle_amount |
|
|
|
public static void unsettleAmount(String appId,String salt,String outOrderId,String thirdParytyId) { |
|
|
|
public static QueryUnsettleAmount unsettleAmount(String appId, String salt, String outOrderId, String thirdParytyId) { |
|
|
|
Map map = new HashMap(); |
|
|
|
map.put("app_id",appId); |
|
|
|
map.put("salt",salt); |
|
|
|
@@ -363,19 +361,24 @@ public class DouYinPayHelper { |
|
|
|
String response = doPost("https://developer.toutiao.com/api/apps/ecpay/v1/unsettle_amount", map); |
|
|
|
log.info("查询待分账金额 request:"+map.toString()+" response:"+response); |
|
|
|
JSONObject jsonObject = JSON.parseObject(response); |
|
|
|
// Integer code = jsonObject.getInteger("err_no"); |
|
|
|
// if (null != code && code.intValue() == 0 ) { |
|
|
|
// JSONObject info = jsonObject.getJSONObject("settle_info"); |
|
|
|
// QuerySettleResult result = new QuerySettleResult(); |
|
|
|
// result.setSettleNo(info.getString("settle_no")); |
|
|
|
// result.setSettleAmount(info.getInteger("settle_amount")); |
|
|
|
// result.setSettleStatus(info.getString("settle_status")); |
|
|
|
// result.setMsg(jsonObject.getString("err_tips")); |
|
|
|
// return result; |
|
|
|
// }else { |
|
|
|
// log.error("settleQuery reponse error. request: "+JSON.toJSONString(map)+" response:"+response); |
|
|
|
//// return null; |
|
|
|
// } |
|
|
|
Integer code = jsonObject.getInteger("err_no"); |
|
|
|
if (null != code && code.intValue() == 0 ) { |
|
|
|
JSONObject data = jsonObject.getJSONObject("data"); |
|
|
|
QueryUnsettleAmount result = new QueryUnsettleAmount(); |
|
|
|
result.setOutOrderNo(data.getString("out_order_no")); |
|
|
|
result.setUnsettleAmount(data.getInteger("unsettle_amount")); |
|
|
|
JSONObject detail = data.getJSONObject("detail"); |
|
|
|
JSONObject payInfo = detail.getJSONObject("pay_info"); |
|
|
|
result.setOutPayNo(payInfo.getString("out_order_no")); |
|
|
|
result.setAmount(payInfo.getInteger("amount")); |
|
|
|
result.setPaymentRake(detail.getInteger("payment_rake")); |
|
|
|
result.setLifeRake(detail.getInteger("life_rake")); |
|
|
|
result.setCommission(detail.getInteger("commission")); |
|
|
|
return result; |
|
|
|
}else { |
|
|
|
log.error("unsettleAmount reponse error. request: "+JSON.toJSONString(map)+" response:"+response); |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public static void main(String[] args) { |
|
|
|
|