api: 钱包余额全部提现
This commit is contained in:
parent
02889ae85f
commit
bd8dbc9199
|
|
@ -258,6 +258,30 @@ public class AdapayService {
|
||||||
return (JSONObject) SettleAccount.balance(queryParams, deptId.toString());
|
return (JSONObject) SettleAccount.balance(queryParams, deptId.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提现钱包里的所有余额(仅用于商户下的用户)
|
||||||
|
*
|
||||||
|
* @param deptId [必填]商户ID
|
||||||
|
* @param memberId [必填]商户用户对象 id,只能为英文、数字或者下划线的一种或多种组合
|
||||||
|
* @param settleAccountId [必填]由Adapay生成的结算账户对象id
|
||||||
|
* @return 可用余额不足时 return null;
|
||||||
|
* 其它同 {@link AdapayService#drawCash(Long, String, String, String, String, String, String)}
|
||||||
|
*/
|
||||||
|
public JSONObject drawCashAll(@NotNull Long deptId, @NotNull String memberId, @NotNull String settleAccountId) throws BaseAdaPayException {
|
||||||
|
JSONObject balance = queryAccountBalance(deptId, memberId, settleAccountId, null);
|
||||||
|
if (AdapayStatusEnum.succeeded.code.equals(balance.getString("status"))) {
|
||||||
|
// 可用余额
|
||||||
|
String avlBalance = balance.getString("avl_balance");
|
||||||
|
if (StringUtils.isBlank(avlBalance) || "0.00".equals(avlBalance) || avlBalance.startsWith("-")) {
|
||||||
|
// 可用余额不足
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return drawCash(deptId, "", "T1", avlBalance, memberId, "", null);
|
||||||
|
} else {
|
||||||
|
throw new BaseAdaPayException(balance.getString("error_code") + ": " + balance.getString("error_msg"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除结算账户对象 https://docs.adapay.tech/api/trade.html#id50
|
* 删除结算账户对象 https://docs.adapay.tech/api/trade.html#id50
|
||||||
* 删除结算账户对象是对已创建完成的结算账户对象进行删除操作。
|
* 删除结算账户对象是对已创建完成的结算账户对象进行删除操作。
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue