package com.ym.mec.thirdparty.adapay;

import java.util.HashMap;
import java.util.Map;

import com.huifu.adapay.core.exception.BaseAdaPayException;

public class SettleAccount {

    /**
     * 删除 SettleAccount
     *
     * @param settleCount_id 待删除的settleCount_id
     * @return delete的settleCount 对象
     * @throws Exception 异常
     */
    public static Map<String, Object> executeDeleteSettleAccount(String settleCount_id, String member_id) throws Exception {
        Map<String, Object> settleCountParams = new HashMap<String, Object>(3);
        settleCountParams.put("settle_account_id", settleCount_id);
        settleCountParams.put("member_id", member_id);
        settleCountParams.put("app_id", ConfigInit.appId);
        Map<String, Object> settleCount = com.huifu.adapay.model.SettleAccount.delete(settleCountParams);
        String error_code = (String) settleCount.get("error_code");
        if (null != error_code) {
            String errorMsg = (String) settleCount.get("error_msg");
            throw new BaseAdaPayException(errorMsg);
        }
        return settleCount;
    }


    /**
     * 创建 settleCount
     *
     * @return 创建的settleCount 对象
     * @throws Exception 异常
     */
    public static Map<String, Object> executeCreateSettleAccount(String member_id, Map<String, Object> accountInfo) throws Exception {
        Map<String, Object> settleCountParams = new HashMap<String, Object>(4);
        settleCountParams.put("member_id", member_id);
        settleCountParams.put("app_id", ConfigInit.appId);
        settleCountParams.put("channel", "bank_account");
        settleCountParams.put("account_info", accountInfo);
        Map<String, Object> settleCount = com.huifu.adapay.model.SettleAccount.create(settleCountParams);
        String error_code = (String) settleCount.get("error_code");
        if (null != error_code) {
            String errorMsg = (String) settleCount.get("error_msg");
            throw new BaseAdaPayException(errorMsg);
        }
        return settleCount;
    }

}
