@Component("lklCbPayClient")
public class LklCbPayClient {

    private static final Logger logger = LoggerFactory.getLogger(LklCbPayClient.class);

    @Autowired
    private LklCrossPayRestfulClent payRestfulClent;


    /**
     * <p>
     * 商  交订单
     * </p>
     *
     * @param order    商 订单
     * @param dataHead 文头
     * @return SubmitOrderRes
     * @throws LklClientException
     */
    public SubmitOrderRes submitOrder(SubmitOrderReq order, LklCrossPaySuperReq dataHead) throws LklClientException {
        SubmitOrderRes res = null;
        LklCrossPayEncryptReq req = LklMsgUtil.encryptMsg(order, dataHead);
        try {
            LklCrossPayEncryptRes encryptRes = payRestfulClent.doPost(LklCrossPayEncryptRes.class, req, "/ppayGate/merCrossBorderAction.do");
            if ("0000".equals(encryptRes.getRetCode())) {
                res = LklMsgUtil.decrypt(encryptRes, SubmitOrderRes.class);
            } else {
                res = new SubmitOrderRes();
            }
            res.setRetCode(encryptRes.getRetCode());
            res.setRetMsg(encryptRes.getRetMsg());
            res.setVer(encryptRes.getVer());
            res.setPayTypeId(encryptRes.getPayTypeId());
            res.setReqType(encryptRes.getReqType());
            res.setTs(encryptRes.getTs());
            res.setMerId(encryptRes.getMerId());
        } catch (Exception e) {
            logger.error("拉卡拉跨境支付-商户提交订单 error", e);
            throw new LklClientException(e.getMessage(), e);
        }
        return res;
    }

    /**
     * <p>
     * 确认支付
     * </p>
     *
     * @param payOrder 业务参数
     * @param dataHead 文头
     * @return PaymentRes
     * @throws LklClientException
     */
    public PaymentRes pay(PaymentReq payOrder, LklCrossPaySuperReq dataHead) throws LklClientException {
        PaymentRes res = null;
        LklCrossPayEncryptReq req = LklMsgUtil.encryptMsg(payOrder, dataHead);
        try {
            LklCrossPayEncryptRes encryptRes = payRestfulClent.doPost(LklCrossPayEncryptRes.class, req, "/ppayGate/merCrossBorderAction.do");

            if ("0000".equals(encryptRes.getRetCode())) {
                res = LklMsgUtil.decrypt(encryptRes, PaymentRes.class);
            } else {
                res = new PaymentRes();
            }
            res.setRetCode(encryptRes.getRetCode());
            res.setRetMsg(encryptRes.getRetMsg());
            res.setVer(encryptRes.getVer());
            res.setPayTypeId(encryptRes.getPayTypeId());
            res.setReqType(encryptRes.getReqType());
            res.setTs(encryptRes.getTs());
            res.setMerId(encryptRes.getMerId());
        } catch (Exception e) {
            logger.error("拉卡拉跨境支付-确认支付 error", e);
            throw new LklClientException(e.getMessage(), e);
        }
        return res;
    }

    /**
     * <p>
     * 卡 跨境支付-支付短信 证码重新获取
     * </p>
     *
     * @param otpReq
     * @param dataHead
     * @return
     * @throws LklClientException
     */
    public LklOtpRes sendOtp(LklOtpReq otpReq, LklCrossPaySuperReq dataHead) throws LklClientException {
        LklOtpRes res = null;
        LklCrossPayEncryptReq req = LklMsgUtil.encryptMsg(otpReq, dataHead);
        try {
            LklCrossPayEncryptRes encryptRes = payRestfulClent.doPost(LklCrossPayEncryptRes.class, req, "/ppayGate/merCrossBorderAction.do");

            if ("0000".equals(encryptRes.getRetCode())) {
                res = LklMsgUtil.decrypt(encryptRes, LklOtpRes.class);
            } else {
                res = new LklOtpRes();
            }
            res.setRetCode(encryptRes.getRetCode());
            res.setRetMsg(encryptRes.getRetMsg());
            res.setVer(encryptRes.getVer());
            res.setPayTypeId(encryptRes.getPayTypeId());
            res.setReqType(encryptRes.getReqType());
            res.setTs(encryptRes.getTs());
            res.setMerId(encryptRes.getMerId());
        } catch (Exception e) {
            logger.error("拉卡拉跨境支付-支付短信验证码重新获取 error", e);
            throw new LklClientException(e.getMessage(), e);
        }
        return res;
    }

    /**
     * <p>
     * 卡 跨境支付-单笔实时收款
     * </p>
     *
     * @param gatherOrder
     * @param dataHead
     * @return
     * @throws LklClientException
     */
    public LklGatherRes gather(LklGatherReq gatherOrder, LklCrossPaySuperReq dataHead) throws LklClientException {
        LklGatherRes res = null;
        LklCrossPayEncryptReq req = LklMsgUtil.encryptMsg(gatherOrder, dataHead);
        try {
            LklCrossPayEncryptRes encryptRes = payRestfulClent.doPost(LklCrossPayEncryptRes.class, req, "/ppayGate/merCrossBorderAction.do");

            if ("0000".equals(encryptRes.getRetCode())) {
                res = LklMsgUtil.decrypt(encryptRes, LklGatherRes.class);
            } else {
                res = new LklGatherRes();
            }
            res.setRetCode(encryptRes.getRetCode());
            res.setRetMsg(encryptRes.getRetMsg());
            res.setVer(encryptRes.getVer());
            res.setPayTypeId(encryptRes.getPayTypeId());
            res.setReqType(encryptRes.getReqType());
            res.setTs(encryptRes.getTs());
            res.setMerId(encryptRes.getMerId());
        } catch (Exception e) {
            logger.error("拉卡拉跨境支付-单笔实时收款 error", e);
            throw new LklClientException(e.getMessage(), e);
        }
        return res;
    }

    /**
     * 卡 跨境支付-单笔实时代付
     *
     * @param agentPayReq
     * @param dataHead
     * @return
     * @throws LklClientException
     */
    public LklPayAgentRes agentPay(LklPayAgentReq agentPayReq, LklCrossPaySuperReq dataHead) throws LklClientException {
        LklPayAgentRes res = null;
        LklCrossPayEncryptReq req = LklMsgUtil.encryptMsg(agentPayReq, dataHead);
        try {
            LklCrossPayEncryptRes encryptRes = payRestfulClent.doPost(LklCrossPayEncryptRes.class, req, "/gate/addOrder");

            if ("0000".equals(encryptRes.getRetCode())) {
                res = LklMsgUtil.decrypt(encryptRes, LklPayAgentRes.class);
            } else {
                res = new LklPayAgentRes();
            }

            res.setRetCode(encryptRes.getRetCode());
            res.setRetMsg(encryptRes.getRetMsg());
            res.setVer(encryptRes.getVer());
            res.setPayTypeId(encryptRes.getPayTypeId());
            res.setReqType(encryptRes.getReqType());
            res.setTs(encryptRes.getTs());
            res.setMerId(encryptRes.getMerId());
        } catch (Exception e) {
            logger.error("拉卡拉跨境支付-单笔实时代付 error", e);
            throw new LklClientException(e.getMessage(), e);
        }
        return res;
    }

    /**
     * <p>
     * 卡 跨境支付-退款 口
     * </p>
     *
     * @param refundReq
     * @param dataHead
     * @return
     * @throws LklClientException
     */
    public RefundRes refun(RefundReq refundReq, LklCrossPaySuperReq dataHead) throws LklClientException {
        RefundRes res = null;
        LklCrossPayEncryptReq req = LklMsgUtil.encryptMsg(refundReq, dataHead);
        try {
            LklCrossPayEncryptRes encryptRes = payRestfulClent.doPost(LklCrossPayEncryptRes.class, req, "/ppayGate/merCrossBorderAction.do");

            if ("0000".equals(encryptRes.getRetCode())) {
                res = LklMsgUtil.decrypt(encryptRes, RefundRes.class);
            } else {
                res = new RefundRes();
            }

            res.setRetCode(encryptRes.getRetCode());
            res.setRetMsg(encryptRes.getRetMsg());
            res.setVer(encryptRes.getVer());
            res.setPayTypeId(encryptRes.getPayTypeId());
            res.setReqType(encryptRes.getReqType());
            res.setTs(encryptRes.getTs());
            res.setMerId(encryptRes.getMerId());
        } catch (Exception e) {
            logger.error("拉卡拉跨境支付-退款接口 error", e);
            throw new LklClientException(e.getMessage(), e);
        }
        return res;
    }

    /**
     * <p>
     * 拉卡拉跨境支付-对账文件预约下载
     * </p>
     *
     * @param reconSubscribeReq
     * @param dataHead
     * @return
     * @throws LklClientException
     */
    public ReconSubscribeRes reconSubscribe(ReconSubscribeReq reconSubscribeReq, LklCrossPaySuperReq dataHead) throws LklClientException {

        ReconSubscribeRes res = null;
        LklCrossPayEncryptReq req = LklMsgUtil.encryptMsg(reconSubscribeReq, dataHead);
        try {
            LklCrossPayEncryptRes encryptRes = payRestfulClent.doPost(LklCrossPayEncryptRes.class, req, "/ppayGate/merCrossBorderAction.do");

            if ("0000".equals(encryptRes.getRetCode())) {
                res = LklMsgUtil.decrypt(encryptRes, ReconSubscribeRes.class);
            } else {
                res = new ReconSubscribeRes();
            }

            res.setRetCode(encryptRes.getRetCode());
            res.setRetMsg(encryptRes.getRetMsg());
            res.setVer(encryptRes.getVer());
            res.setPayTypeId(encryptRes.getPayTypeId());
            res.setReqType(encryptRes.getReqType());
            res.setTs(encryptRes.getTs());
            res.setMerId(encryptRes.getMerId());
        } catch (Exception e) {
            logger.error("拉卡拉跨境支付-退款接口 error", e);
            throw new LklClientException(e.getMessage(), e);
        }
        return res;
    }
} @Component
public class LklCbPayQueryClient {

    private static final Logger logger = LoggerFactory.getLogger(LklCbPayQueryClient.class);
    @Autowired
    private LklCrossPayRestfulClent payRestfulClent;


    /**
     * <p>
     * 拉卡拉跨境支付-汇率查询
     * </p>
     *
     * @param exchangeRateQueryReq
     * @param dataHead
     * @return
     * @throws LklClientException
     */
    public ExchangeRateQueryRes exchangeRateQuery(ExchangeRateQueryReq exchangeRateQueryReq, LklCrossPaySuperReq dataHead) throws LklClientException {
        ExchangeRateQueryRes res = null;
        LklCrossPayEncryptReq req = LklMsgUtil.encryptMsg(exchangeRateQueryReq, dataHead);
        try {
            LklCrossPayEncryptRes encryptRes = payRestfulClent.doPost(LklCrossPayEncryptRes.class, req, "/ppayGate/merCrossBorderAction.do");

            if ("0000".equals(encryptRes.getRetCode())) {
                res = LklMsgUtil.decrypt(encryptRes, ExchangeRateQueryRes.class);
            } else {
                res = new ExchangeRateQueryRes();
            }
            res.setRetCode(encryptRes.getRetCode());
            res.setRetMsg(encryptRes.getRetMsg());
            res.setVer(encryptRes.getVer());
            res.setPayTypeId(encryptRes.getPayTypeId());
            res.setReqType(encryptRes.getReqType());
            res.setTs(encryptRes.getTs());
            res.setMerId(encryptRes.getMerId());
        } catch (Exception e) {
            logger.error("拉卡拉跨境支付-汇率查询 error", e);
            throw new LklClientException(e.getMessage(), e);
        }
        return res;
    }

    /**
     * <p>
     * 拉卡拉跨境支付-订单查询
     * </p>
     *
     * @param orderQueryReq
     * @param dataHead
     * @return
     * @throws LklClientException
     */
    public OrderQueryRes orderQuery(OrderQueryReq orderQueryReq, LklCrossPaySuperReq dataHead) throws LklClientException {
        OrderQueryRes res = null;
        LklCrossPayEncryptReq req = LklMsgUtil.encryptMsg(orderQueryReq, dataHead);
        try {
            LklCrossPayEncryptRes encryptRes = payRestfulClent.doPost(LklCrossPayEncryptRes.class, req, "/ppayGate/merCrossBorderAction.do");

            if ("0000".equals(encryptRes.getRetCode())) {
                res = LklMsgUtil.decrypt(encryptRes, OrderQueryRes.class);
            } else {
                res = new OrderQueryRes();
            }
            res.setRetCode(encryptRes.getRetCode());
            res.setRetMsg(encryptRes.getRetMsg());
            res.setVer(encryptRes.getVer());
            res.setPayTypeId(encryptRes.getPayTypeId());
            res.setReqType(encryptRes.getReqType());
            res.setTs(encryptRes.getTs());
            res.setMerId(encryptRes.getMerId());
        } catch (Exception e) {
            logger.error("拉卡拉跨境支付-订单查询 error", e);
            throw new LklClientException(e.getMessage(), e);
        }
        return res;
    }

    /**
     * <p>拉卡拉跨境支付-签约查询</p>
     *
     * @param signQueryReq
     * @param dataHead
     * @return
     * @throws LklClientException
     */
    public SignQueryRes signQuery(SignQueryReq signQueryReq, LklCrossPaySuperReq dataHead) throws LklClientException {
        SignQueryRes res = null;
        LklCrossPayEncryptReq req = LklMsgUtil.encryptMsg(signQueryReq, dataHead);
        try {
            LklCrossPayEncryptRes encryptRes = payRestfulClent.doPost(LklCrossPayEncryptRes.class, req, "/ppayGate/merCrossBorderAction.do");

            if ("0000".equals(encryptRes.getRetCode())) {
                res = LklMsgUtil.decrypt(encryptRes, SignQueryRes.class);
            } else {
                res = new SignQueryRes();
            }
            res.setRetCode(encryptRes.getRetCode());
            res.setRetMsg(encryptRes.getRetMsg());
            res.setVer(encryptRes.getVer());
            res.setPayTypeId(encryptRes.getPayTypeId());
            res.setReqType(encryptRes.getReqType());
            res.setTs(encryptRes.getTs());
            res.setMerId(encryptRes.getMerId());
        } catch (Exception e) {
            logger.error("拉卡拉跨境支付-签约查询 error", e);
            throw new LklClientException(e.getMessage(), e);
        }
        return res;
    }

    /**
     * <p>
     * 拉卡拉跨境支付-单笔试试代付状态查询
     * </p>
     *
     * @param queryReq
     * @param dataHead
     * @return
     * @throws LklClientException
     */
    public AgentPayStatusQueryRes agentPayStatusQuery(AgentPayStatusQueryReq queryReq, LklCrossPaySuperReq dataHead) throws LklClientException {
        AgentPayStatusQueryRes res = null;
        LklCrossPayEncryptReq req = LklMsgUtil.encryptMsg(queryReq, dataHead);
        try {
            LklCrossPayEncryptRes encryptRes = payRestfulClent.doPost(LklCrossPayEncryptRes.class, req, "/gate/queryStatus");

            if ("0000".equals(encryptRes.getRetCode())) {
                res = LklMsgUtil.decrypt(encryptRes, AgentPayStatusQueryRes.class);
            } else {
                res = new AgentPayStatusQueryRes();
            }
            res.setRetCode(encryptRes.getRetCode());
            res.setRetMsg(encryptRes.getRetMsg());
            res.setVer(encryptRes.getVer());
            res.setPayTypeId(encryptRes.getPayTypeId());
            res.setReqType(encryptRes.getReqType());
            res.setTs(encryptRes.getTs());
            res.setMerId(encryptRes.getMerId());
        } catch (Exception e) {
            logger.error("拉卡拉跨境支付-签约查询 error", e);
            throw new LklClientException(e.getMessage(), e);
        }
        return res;
    }

    /**
     * <p>
     * 拉卡拉跨境支付-商户代付账户余额查询
     * </p>
     *
     * @param balanceQueryReq
     * @param dataHead
     * @return
     * @throws LklClientException
     */
    public AgentPayAcctBalanceQueryRes agentPayAcctBalanceQuery(AgentPayAcctBalanceQueryReq balanceQueryReq, LklCrossPaySuperReq dataHead) throws LklClientException {
        AgentPayAcctBalanceQueryRes res = null;
        LklCrossPayEncryptReq req = LklMsgUtil.encryptMsg(balanceQueryReq, dataHead);
        try {
            LklCrossPayEncryptRes encryptRes = payRestfulClent.doPost(LklCrossPayEncryptRes.class, req, "/gate/balanceSearch");

            if ("0000".equals(encryptRes.getRetCode())) {
                res = LklMsgUtil.decrypt(encryptRes, AgentPayAcctBalanceQueryRes.class);
            } else {
                res = new AgentPayAcctBalanceQueryRes();
            }
            res.setRetCode(encryptRes.getRetCode());
            res.setRetMsg(encryptRes.getRetMsg());
            res.setVer(encryptRes.getVer());
            res.setPayTypeId(encryptRes.getPayTypeId());
            res.setReqType(encryptRes.getReqType());
            res.setTs(encryptRes.getTs());
            res.setMerId(encryptRes.getMerId());
        } catch (Exception e) {
            logger.error("拉卡拉跨境支付-签约查询 error", e);
            throw new LklClientException(e.getMessage(), e);
        }
        return res;
    }
} @Component
public class LklCbPaySignClient {
    private static final Logger logger = LoggerFactory.getLogger(LklCbPaySignClient.class);
    @Autowired
    private LklCrossPayRestfulClent payRestfulClent;

    /**
     * <p>
     * 拉卡拉跨境支付-用户签约
     * </p>
     *
     * @param signReq
     * @param dataHead
     * @return
     * @throws LklClientException
     */
    public SignRes sign(SignReq signReq, LklCrossPaySuperReq dataHead) throws LklClientException {
        SignRes res = null;
        LklCrossPayEncryptReq req = LklMsgUtil.encryptMsg(signReq, dataHead);
        try {
            LklCrossPayEncryptRes encryptRes = payRestfulClent.doPost(LklCrossPayEncryptRes.class, req, "/ppayGate/merCrossBorderAction.do");

            if ("0000".equals(encryptRes.getRetCode())) {
                res = LklMsgUtil.decrypt(encryptRes, SignRes.class);
            } else {
                res = new SignRes();
            }
            res.setRetCode(encryptRes.getRetCode());
            res.setRetMsg(encryptRes.getRetMsg());
            res.setVer(encryptRes.getVer());
            res.setPayTypeId(encryptRes.getPayTypeId());
            res.setReqType(encryptRes.getReqType());
            res.setTs(encryptRes.getTs());
            res.setMerId(encryptRes.getMerId());
        } catch (Exception e) {
            logger.error("拉卡拉跨境支付-用户签约 error", e);
            throw new LklClientException(e.getMessage(), e);
        }
        return res;
    }

    /**
     * <p>
     * 拉卡拉跨境支付-用户签约验证
     * </p>
     *
     * @param signVerifyReq
     * @param dataHead
     * @return
     * @throws LklClientException
     */
    public SignVerifyRes signVerify(SignVerifyReq signVerifyReq, LklCrossPaySuperReq dataHead) throws LklClientException {
        SignVerifyRes res = null;
        LklCrossPayEncryptReq req = LklMsgUtil.encryptMsg(signVerifyReq, dataHead);
        try {
            LklCrossPayEncryptRes encryptRes = payRestfulClent.doPost(LklCrossPayEncryptRes.class, req, "/ppayGate/merCrossBorderAction.do");

            if ("0000".equals(encryptRes.getRetCode())) {
                res = LklMsgUtil.decrypt(encryptRes, SignVerifyRes.class);
            } else {
                res = new SignVerifyRes();
            }
            res.setRetCode(encryptRes.getRetCode());
            res.setRetMsg(encryptRes.getRetMsg());
            res.setVer(encryptRes.getVer());
            res.setPayTypeId(encryptRes.getPayTypeId());
            res.setReqType(encryptRes.getReqType());
            res.setTs(encryptRes.getTs());
            res.setMerId(encryptRes.getMerId());
        } catch (Exception e) {
            logger.error("拉卡拉跨境支付-用户签约 error", e);
            throw new LklClientException(e.getMessage(), e);
        }
        return res;
    }

} public class LklCrossPaySuperReq implements Serializable {
    private static final long serialVersionUID = 2755358811399044775L;

    /**
     * 报文协议版本号,默认为1.0.0
     */
    private String ver = "1.0.0";
    /**
     * 商户号
     */
    private String merId;
    /**
     * 1.0.0版本报文-支付类型
     */
    private String payTypeId;

    /**
     * 请求业务类型
     */
    private String reqType;

    /**
     * 时间戳，yyyyMMddHHmmss+6位不重复随机数或序列
     */
    private String ts;

    public String getPayTypeId() {
        return payTypeId;
    }

    public void setPayTypeId(String payTypeId) {
        this.payTypeId = payTypeId;
    }

    public String getVer() {
        return ver;
    }

    public void setVer(String ver) {
        this.ver = ver;
    }

    public String getReqType() {
        return reqType;
    }

    public void setReqType(String reqType) {
        this.reqType = reqType;
    }

    public String getMerId() {
        return merId;
    }

    public void setMerId(String merId) {
        this.merId = merId;
    }

    public String getTs() {
        return ts;
    }

    public void setTs(String ts) {
        this.ts = ts;
    }

    @Override
    public String toString() {
        final StringBuffer sb = new StringBuffer("LklCrossPaySuperReq{");
        sb.append("ver='").append(ver).append('\'');
        sb.append(", merId='").append(merId).append('\'');
        sb.append(", payTypeId='").append(payTypeId).append('\'');
        sb.append(", reqType='").append(reqType).append('\'');
        sb.append(", ts='").append(ts).append('\'');
        sb.append('}');
        return sb.toString();
    }
} public class LklGatherReq implements Serializable {

    private static final long serialVersionUID = 7098772610763637561L;

    /**
     * 商户订单号
     */
    private String merOrderId;

    /**
     * 订单币种 {@link LklCurrency}
     */
    private String currency;

    /**
     * 订单金额。单位：元，小数点后两位
     */
    private String orderAmount;

    /**
     * 主收款方应收金额。单位：元，小数点后两位
     */
    private String payeeAmount;
    /**
     * 持卡人姓名
     */
    private String clientName;

    /**
     * 证件类型 {@link CertType}
     */
    private String certType;

    /**
     * 证件号
     */
    private String clientId;

    /**
     * 支付卡卡号
     */
    private String cardNo;

    /**
     * 支付卡有效期，YYMM，信用卡必填
     */
    private String dateOfExpire;
    /**
     * cvv,信用卡必填
     */
    private String cvv;

    /**
     * 银行预留手机号
     */
    private String mobile;

    /**
     * 订单概要
     */
    private String orderSummary;

    /**
     * 订单日期,yyyyMMddHHmmss
     */
    private String orderTime;

    /**
     * 订单有效时间yyyyMMddHHmmss
     */
    private String orderEffTime;

    /**
     * 商户服务器所在时区
     */
    private String timeZone;
    /**
     * 杭虎后台应答地址，需是完整的http或https的url
     */
    private String bgUrl;
    /**
     * 跨境业务类型 {@link CrossBorderBizType}
     */
    private String busiCode;

    /**
     * 是否启用白名单
     */
    private String isDirectPay;
    /**
     * 商户会员ID
     */
    private String merClientId;

    /**
     * 白名单签约协议号，若启用白名单则商户会员ID以及协议号必填
     */
    private String signDealNumber;

    private String ext1;

    private String ext2;

    /**
     * 商户客户会员ID,必填 无会员填写“NA”
     */
    private String customNumberId;

    /**
     * 扩展信息，字段参见接口文档对应章节
     */
    private Map<String, String> extension;

    public String getMerOrderId() {
        return merOrderId;
    }

    public void setMerOrderId(String merOrderId) {
        this.merOrderId = merOrderId;
    }

    public String getCurrency() {
        return currency;
    }

    public void setCurrency(String currency) {
        this.currency = currency;
    }

    public String getOrderAmount() {
        return orderAmount;
    }

    public void setOrderAmount(String orderAmount) {
        this.orderAmount = orderAmount;
    }

    public String getPayeeAmount() {
        return payeeAmount;
    }

    public void setPayeeAmount(String payeeAmount) {
        this.payeeAmount = payeeAmount;
    }

    public String getClientName() {
        return clientName;
    }

    public void setClientName(String clientName) {
        this.clientName = clientName;
    }

    public String getCertType() {
        return certType;
    }

    public void setCertType(String certType) {
        this.certType = certType;
    }

    public String getClientId() {
        return clientId;
    }

    public void setClientId(String clientId) {
        this.clientId = clientId;
    }

    public String getCardNo() {
        return cardNo;
    }

    public void setCardNo(String cardNo) {
        this.cardNo = cardNo;
    }

    public String getDateOfExpire() {
        return dateOfExpire;
    }

    public void setDateOfExpire(String dateOfExpire) {
        this.dateOfExpire = dateOfExpire;
    }

    public String getCvv() {
        return cvv;
    }

    public void setCvv(String cvv) {
        this.cvv = cvv;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getOrderSummary() {
        return orderSummary;
    }

    public void setOrderSummary(String orderSummary) {
        this.orderSummary = orderSummary;
    }

    public String getOrderTime() {
        return orderTime;
    }

    public void setOrderTime(String orderTime) {
        this.orderTime = orderTime;
    }

    public String getOrderEffTime() {
        return orderEffTime;
    }

    public void setOrderEffTime(String orderEffTime) {
        this.orderEffTime = orderEffTime;
    }

    public String getTimeZone() {
        return timeZone;
    }

    public void setTimeZone(String timeZone) {
        this.timeZone = timeZone;
    }

    public String getBgUrl() {
        return bgUrl;
    }

    public void setBgUrl(String bgUrl) {
        this.bgUrl = bgUrl;
    }

    public String getBusiCode() {
        return busiCode;
    }

    public void setBusiCode(String busiCode) {
        this.busiCode = busiCode;
    }

    public String getIsDirectPay() {
        return isDirectPay;
    }

    public void setIsDirectPay(String isDirectPay) {
        this.isDirectPay = isDirectPay;
    }

    public String getMerClientId() {
        return merClientId;
    }

    public void setMerClientId(String merClientId) {
        this.merClientId = merClientId;
    }

    public String getSignDealNumber() {
        return signDealNumber;
    }

    public void setSignDealNumber(String signDealNumber) {
        this.signDealNumber = signDealNumber;
    }

    public String getExt1() {
        return ext1;
    }

    public void setExt1(String ext1) {
        this.ext1 = ext1;
    }

    public String getExt2() {
        return ext2;
    }

    public void setExt2(String ext2) {
        this.ext2 = ext2;
    }

    public Map<String, String> getExtension() {
        return extension;
    }

    public void setExtension(Map<String, String> extension) {
        this.extension = extension;
    }

    public String getCustomNumberId() {
        return customNumberId;
    }

    public void setCustomNumberId(String customNumberId) {
        this.customNumberId = customNumberId;
    }

    @Override
    public String toString() {
        final StringBuffer sb = new StringBuffer("LklGatherReq{");
        sb.append("merOrderId='").append(merOrderId).append('\'');
        sb.append(", currency='").append(currency).append('\'');
        sb.append(", orderAmount='").append(orderAmount).append('\'');
        sb.append(", payeeAmount='").append(payeeAmount).append('\'');
        sb.append(", clientName='").append(clientName).append('\'');
        sb.append(", certType='").append(certType).append('\'');
        sb.append(", clientId='").append(clientId).append('\'');
        sb.append(", cardNo='").append(cardNo).append('\'');
        sb.append(", dateOfExpire='").append(dateOfExpire).append('\'');
        sb.append(", cvv='").append(cvv).append('\'');
        sb.append(", mobile='").append(mobile).append('\'');
        sb.append(", orderSummary='").append(orderSummary).append('\'');
        sb.append(", orderTime='").append(orderTime).append('\'');
        sb.append(", orderEffTime='").append(orderEffTime).append('\'');
        sb.append(", timeZone='").append(timeZone).append('\'');
        sb.append(", bgUrl='").append(bgUrl).append('\'');
        sb.append(", busiCode='").append(busiCode).append('\'');
        sb.append(", isDirectPay='").append(isDirectPay).append('\'');
        sb.append(", merClientId='").append(merClientId).append('\'');
        sb.append(", signDealNumber='").append(signDealNumber).append('\'');
        sb.append(", ext1='").append(ext1).append('\'');
        sb.append(", ext2='").append(ext2).append('\'');
        sb.append(", extension=").append(extension);
        sb.append('}');
        return sb.toString();
    }
} public class LklGatherRes extends LklCrossPaySuperRes {

    private static final long serialVersionUID = -3562644471870585474L;

    /**
     * 商户订单号
     */
    private String merOrderId;

    /**
     * 商户提交订单时间yyyyMMddHHmmss
     */
    private String orderTime;

    /**
     * 订单金额，单元：元，小数点后两位
     */
    private String orderAmount;

    /**
     * 订单币种 {@link LklCurrency}
     */
    private String currency;

    /**
     * 人民币实付金额，单位：元，小数点后两位
     */
    private String cnyAmount;

    /**
     * 购汇汇率
     */
    private String exchangeRate;

    /**
     * 拉卡拉流水号
     */
    private String transactionId;

    /**
     * 支付平台处理时间yyyyMMddHHmmss
     */
    private String dealTime;

    /**
     * 手续费，单位：元，小数点后两位
     */
    private String orderFee;

    /**
     * 支付状态
     * <ul>
     * <li>1.支付成功</li>
     * </ul>
     */
    private String payResult;

    private String ext1;

    private String ext2;

    public String getMerOrderId() {
        return merOrderId;
    }

    public void setMerOrderId(String merOrderId) {
        this.merOrderId = merOrderId;
    }

    public String getOrderTime() {
        return orderTime;
    }

    public void setOrderTime(String orderTime) {
        this.orderTime = orderTime;
    }

    public String getOrderAmount() {
        return orderAmount;
    }

    public void setOrderAmount(String orderAmount) {
        this.orderAmount = orderAmount;
    }

    public String getCurrency() {
        return currency;
    }

    public void setCurrency(String currency) {
        this.currency = currency;
    }

    public String getCnyAmount() {
        return cnyAmount;
    }

    public void setCnyAmount(String cnyAmount) {
        this.cnyAmount = cnyAmount;
    }

    public String getExchangeRate() {
        return exchangeRate;
    }

    public void setExchangeRate(String exchangeRate) {
        this.exchangeRate = exchangeRate;
    }

    public String getTransactionId() {
        return transactionId;
    }

    public void setTransactionId(String transactionId) {
        this.transactionId = transactionId;
    }

    public String getDealTime() {
        return dealTime;
    }

    public void setDealTime(String dealTime) {
        this.dealTime = dealTime;
    }

    public String getOrderFee() {
        return orderFee;
    }

    public void setOrderFee(String orderFee) {
        this.orderFee = orderFee;
    }

    public String getPayResult() {
        return payResult;
    }

    public void setPayResult(String payResult) {
        this.payResult = payResult;
    }

    public String getExt1() {
        return ext1;
    }

    public void setExt1(String ext1) {
        this.ext1 = ext1;
    }

    public String getExt2() {
        return ext2;
    }

    public void setExt2(String ext2) {
        this.ext2 = ext2;
    }

    @Override
    public String toString() {
        final StringBuffer sb = new StringBuffer("LklGatherRes{");
        sb.append("super='").append(merOrderId).append('\'');
        sb.append(super.toString());
        sb.append("merOrderId='").append(merOrderId).append('\'');
        sb.append(", orderTime='").append(orderTime).append('\'');
        sb.append(", orderAmount='").append(orderAmount).append('\'');
        sb.append(", currency='").append(currency).append('\'');
        sb.append(", cnyAmount='").append(cnyAmount).append('\'');
        sb.append(", exchangeRate='").append(exchangeRate).append('\'');
        sb.append(", transactionId='").append(transactionId).append('\'');
        sb.append(", dealTime='").append(dealTime).append('\'');
        sb.append(", orderFee='").append(orderFee).append('\'');
        sb.append(", payResult='").append(payResult).append('\'');
        sb.append(", ext1='").append(ext1).append('\'');
        sb.append(", ext2='").append(ext2).append('\'');
        sb.append('}');
        return sb.toString();
    }
} public class LklOtpReq implements Serializable {

    private static final long serialVersionUID = 5493020637048469522L;

    /**
     * 订单日期,格式yyyyMMddHHmmss
     */
    private String oderTime;

    /**
     * 商户订单号
     */
    private String merOrderId;

    /**
     * 拉卡拉流水号
     */
    private String transactionId;

    private String ip;

    private String ext1;

    private String ext2;

    public String getOderTime() {
        return oderTime;
    }

    public void setOderTime(String oderTime) {
        this.oderTime = oderTime;
    }

    public String getMerOrderId() {
        return merOrderId;
    }

    public void setMerOrderId(String merOrderId) {
        this.merOrderId = merOrderId;
    }

    public String getTransactionId() {
        return transactionId;
    }

    public void setTransactionId(String transactionId) {
        this.transactionId = transactionId;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public String getExt1() {
        return ext1;
    }

    public void setExt1(String ext1) {
        this.ext1 = ext1;
    }

    public String getExt2() {
        return ext2;
    }

    public void setExt2(String ext2) {
        this.ext2 = ext2;
    }

    @Override
    public String toString() {
        final StringBuffer sb = new StringBuffer("LklOtpReq{");
        sb.append("oderTime='").append(oderTime).append('\'');
        sb.append(", merOrderId='").append(merOrderId).append('\'');
        sb.append(", transactionId='").append(transactionId).append('\'');
        sb.append(", ip='").append(ip).append('\'');
        sb.append(", ext1='").append(ext1).append('\'');
        sb.append(", ext2='").append(ext2).append('\'');
        sb.append('}');
        return sb.toString();
    }
} public class LklOtpRes extends LklCrossPaySuperRes {

    private static final long serialVersionUID = 5356543978557058165L;

    /**
     * 订单提交日期，格式yyyyMMddHHmmss
     */
    private String orderTime;

    /**
     * 商户订单号
     */
    private String merOrderId;

    /**
     * 拉卡拉流水号
     */
    private String transactionId;

    /**
     * 短信发送状态
     * <ul>
     * <li>
     * 1.已发送
     * </li>
     * <li>
     * 0.未发送
     * </li>
     * <p/>
     * </ul>
     */
    private String smsStatus;

    private String ext1;

    private String ext2;

    public String getOrderTime() {
        return orderTime;
    }

    public void setOrderTime(String orderTime) {
        this.orderTime = orderTime;
    }

    public String getMerOrderId() {
        return merOrderId;
    }

    public void setMerOrderId(String merOrderId) {
        this.merOrderId = merOrderId;
    }

    public String getTransactionId() {
        return transactionId;
    }

    public void setTransactionId(String transactionId) {
        this.transactionId = transactionId;
    }

    public String getSmsStatus() {
        return smsStatus;
    }

    public void setSmsStatus(String smsStatus) {
        this.smsStatus = smsStatus;
    }

    public String getExt1() {
        return ext1;
    }

    public void setExt1(String ext1) {
        this.ext1 = ext1;
    }

    public String getExt2() {
        return ext2;
    }

    public void setExt2(String ext2) {
        this.ext2 = ext2;
    }

    @Override
    public String toString() {
        final StringBuffer sb = new StringBuffer("LklOtpRes{");
        sb.append("orderTime='").append(orderTime).append('\'');
        sb.append(", merOrderId='").append(merOrderId).append('\'');
        sb.append(", transactionId='").append(transactionId).append('\'');
        sb.append(", smsStatus='").append(smsStatus).append('\'');
        sb.append(", ext1='").append(ext1).append('\'');
        sb.append(", ext2='").append(ext2).append('\'');
        sb.append('}');
        return sb.toString();
    }
} public class LklPayAgentReq implements Serializable {

    private static final long serialVersionUID = 9103610311447066042L;

    /**
     * 商户订单号
     */
    private String merOrderId;

    /**
     * 支付方式:5代付
     */
    private String payTypeId = "5";

    /**
     * 订单币种，目前只支持人民币 {@link LklCurrency}
     */
    private String currency;

    /**
     * 订单金额，单元：元，小数点后两位
     */
    private String orderAmount;

    /**
     * 账户名
     */
    private String accountName;

    /**
     * 账户号
     */
    private String accountNumber;

    /**
     * 证件类型 {@link CertType}
     */
    private String certType;

    /**
     * 证件号
     */
    private String clientId;

    /**
     * 支付卡有效期：YYMM
     */
    private String dateOfExpire;
    /**
     * 信用卡cvv，信用卡必填
     */
    private String cvv;

    /**
     * 银行预留手机号
     */
    private String mobile;

    /**
     * 订单概要
     */
    private String orderSummary;

    /**
     * 银行代码
     */
    private String bankCode;

    /**
     * 账户类型：1-对私账户
     */
    private String accountType;

    /**
     * 开户行名称
     */
    private String bankName;

    /**
     * 支付行号
     */
    private String interBankCode;

    /**
     * 银行摘要
     */
    private String bankRemark;

    /**
     * 订单日期yyyyMMddHHmmss
     */
    private String orderTime;

    /**
     * 订单有效时间yyyyMMddHHmmss
     */
    private String orderEffTime;

    /**
     *
     */
    private String pageUrl;

    /**
     * 商户后台应答地址
     */
    private String bgUrl;

    /**
     * 商户客户会员ID,必填 无会员填写“NA”
     */
    private String customNumberId;

    public String getMerOrderId() {
        return merOrderId;
    }

    public void setMerOrderId(String merOrderId) {
        this.merOrderId = merOrderId;
    }

    public String getPayTypeId() {
        return payTypeId;
    }

    public void setPayTypeId(String payTypeId) {
        this.payTypeId = payTypeId;
    }

    public String getCurrency() {
        return currency;
    }

    public void setCurrency(String currency) {
        this.currency = currency;
    }

    public String getOrderAmount() {
        return orderAmount;
    }

    public void setOrderAmount(String orderAmount) {
        this.orderAmount = orderAmount;
    }

    public String getAccountName() {
        return accountName;
    }

    public void setAccountName(String accountName) {
        this.accountName = accountName;
    }

    public String getAccountNumber() {
        return accountNumber;
    }

    public void setAccountNumber(String accountNumber) {
        this.accountNumber = accountNumber;
    }

    public String getCertType() {
        return certType;
    }

    public void setCertType(String certType) {
        this.certType = certType;
    }

    public String getClientId() {
        return clientId;
    }

    public void setClientId(String clientId) {
        this.clientId = clientId;
    }

    public String getDateOfExpire() {
        return dateOfExpire;
    }

    public void setDateOfExpire(String dateOfExpire) {
        this.dateOfExpire = dateOfExpire;
    }

    public String getCvv() {
        return cvv;
    }

    public void setCvv(String cvv) {
        this.cvv = cvv;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getOrderSummary() {
        return orderSummary;
    }

    public void setOrderSummary(String orderSummary) {
        this.orderSummary = orderSummary;
    }

    public String getBankCode() {
        return bankCode;
    }

    public void setBankCode(String bankCode) {
        this.bankCode = bankCode;
    }

    public String getAccountType() {
        return accountType;
    }

    public void setAccountType(String accountType) {
        this.accountType = accountType;
    }

    public String getBankName() {
        return bankName;
    }

    public void setBankName(String bankName) {
        this.bankName = bankName;
    }

    public String getInterBankCode() {
        return interBankCode;
    }

    public void setInterBankCode(String interBankCode) {
        this.interBankCode = interBankCode;
    }

    public String getBankRemark() {
        return bankRemark;
    }

    public void setBankRemark(String bankRemark) {
        this.bankRemark = bankRemark;
    }

    public String getOrderTime() {
        return orderTime;
    }

    public void setOrderTime(String orderTime) {
        this.orderTime = orderTime;
    }

    public String getOrderEffTime() {
        return orderEffTime;
    }

    public void setOrderEffTime(String orderEffTime) {
        this.orderEffTime = orderEffTime;
    }

    public String getPageUrl() {
        return pageUrl;
    }

    public void setPageUrl(String pageUrl) {
        this.pageUrl = pageUrl;
    }

    public String getBgUrl() {
        return bgUrl;
    }

    public void setBgUrl(String bgUrl) {
        this.bgUrl = bgUrl;
    }

    public String getCustomNumberId() {
        return customNumberId;
    }

    public void setCustomNumberId(String customNumberId) {
        this.customNumberId = customNumberId;
    }

    @Override
    public String toString() {
        final StringBuffer sb = new StringBuffer("LklPayAgentReq{");
        sb.append("merOrderId='").append(merOrderId).append('\'');
        sb.append(", payTypeId='").append(payTypeId).append('\'');
        sb.append(", currency='").append(currency).append('\'');
        sb.append(", orderAmount='").append(orderAmount).append('\'');
        sb.append(", accountName='").append(accountName).append('\'');
        sb.append(", accountNumber='").append(accountNumber).append('\'');
        sb.append(", certType='").append(certType).append('\'');
        sb.append(", clientId='").append(clientId).append('\'');
        sb.append(", dateOfExpire='").append(dateOfExpire).append('\'');
        sb.append(", cvv='").append(cvv).append('\'');
        sb.append(", mobile='").append(mobile).append('\'');
        sb.append(", orderSummary='").append(orderSummary).append('\'');
        sb.append(", bankCode='").append(bankCode).append('\'');
        sb.append(", accountType='").append(accountType).append('\'');
        sb.append(", bankName='").append(bankName).append('\'');
        sb.append(", interBankCode='").append(interBankCode).append('\'');
        sb.append(", bankRemark='").append(bankRemark).append('\'');
        sb.append(", orderTime='").append(orderTime).append('\'');
        sb.append(", orderEffTime='").append(orderEffTime).append('\'');
        sb.append(", pageUrl='").append(pageUrl).append('\'');
        sb.append(", bgUrl='").append(bgUrl).append('\'');
        sb.append('}');
        return sb.toString();
    }
} public class LklPayAgentRes extends LklCrossPaySuperRes {

    private static final long serialVersionUID = -327453260441905785L;

    /**
     * 商户订单号
     */
    private String merOrderId;

    /**
     * 订单日期yyyyMMddHHmmss
     */
    private String orderTime;

    /**
     * 订单币种，目前只支持人民币
     */
    private String currency;

    /**
     * 实付金额，单位：元，小数点后两位
     */
    private String amount;

    /**
     * 手续费，单位：元，小数点后两位
     */
    private String fee;

    /**
     * 拉卡拉流水号
     */
    private String transactionId;

    public String getMerOrderId() {
        return merOrderId;
    }

    public void setMerOrderId(String merOrderId) {
        this.merOrderId = merOrderId;
    }

    public String getOrderTime() {
        return orderTime;
    }

    public void setOrderTime(String orderTime) {
        this.orderTime = orderTime;
    }

    public String getCurrency() {
        return currency;
    }

    public void setCurrency(String currency) {
        this.currency = currency;
    }

    public String getAmount() {
        return amount;
    }

    public void setAmount(String amount) {
        this.amount = amount;
    }

    public String getFee() {
        return fee;
    }

    public void setFee(String fee) {
        this.fee = fee;
    }

    public String getTransactionId() {
        return transactionId;
    }

    public void setTransactionId(String transactionId) {
        this.transactionId = transactionId;
    }

    @Override
    public String toString() {
        final StringBuffer sb = new StringBuffer("LklPayAgentRes{");
        sb.append("super=").append(super.toString());
        sb.append("merOrderId='").append(merOrderId).append('\'');
        sb.append(", orderTime='").append(orderTime).append('\'');
        sb.append(", currency='").append(currency).append('\'');
        sb.append(", amount='").append(amount).append('\'');
        sb.append(", fee='").append(fee).append('\'');
        sb.append(", transactionId='").append(transactionId).append('\'');
        sb.append('}');
        return sb.toString();
    }
} public class PaymentReq implements Serializable {

    private static final long serialVersionUID = 2432428418568613160L;

    /**
     * 商户订单号
     */
    private String merOrderId;

    /**
     * 订单金额
     */
    private String orderAmount;

    /**
     * 订单币种 {@link LklCurrency}
     */
    private String currency;

    /**
     * 主收款方应收金额
     */
    private String payeeAmount;

    /**
     * 短信验证码
     */
    private String msgCode;

    /**
     * 拉卡拉流水号
     */
    private String transactionId;

    /**
     * 扩展字段1
     */
    private String ext1;

    /**
     * 扩展字段2
     */
    private String ext2;

    public String getMerOrderId() {
        return merOrderId;
    }

    public void setMerOrderId(String merOrderId) {
        this.merOrderId = merOrderId;
    }

    public String getOrderAmount() {
        return orderAmount;
    }

    public void setOrderAmount(String orderAmount) {
        this.orderAmount = orderAmount;
    }

    public String getCurrency() {
        return currency;
    }

    public void setCurrency(String currency) {
        this.currency = currency;
    }

    public String getPayeeAmount() {
        return payeeAmount;
    }

    public void setPayeeAmount(String payeeAmount) {
        this.payeeAmount = payeeAmount;
    }

    public String getMsgCode() {
        return msgCode;
    }

    public void setMsgCode(String msgCode) {
        this.msgCode = msgCode;
    }

    public String getTransactionId() {
        return transactionId;
    }

    public void setTransactionId(String transactionId) {
        this.transactionId = transactionId;
    }

    public String getExt1() {
        return ext1;
    }

    public void setExt1(String ext1) {
        this.ext1 = ext1;
    }

    public String getExt2() {
        return ext2;
    }

    public void setExt2(String ext2) {
        this.ext2 = ext2;
    }

    @Override
    public String toString() {
        final StringBuffer sb = new StringBuffer("PaymentReq{");
        sb.append("merOrderId='").append(merOrderId).append('\'');
        sb.append(", orderAmount='").append(orderAmount).append('\'');
        sb.append(", currency='").append(currency).append('\'');
        sb.append(", payeeAmount='").append(payeeAmount).append('\'');
        sb.append(", msgCode='").append(msgCode).append('\'');
        sb.append(", transactionId='").append(transactionId).append('\'');
        sb.append(", ext1='").append(ext1).append('\'');
        sb.append(", ext2='").append(ext2).append('\'');
        sb.append('}');
        return sb.toString();
    }
} public class PaymentRes extends LklCrossPaySuperRes {

    private static final long serialVersionUID = 3840923652856524634L;

    /**
     * 订单日期,格式yyyyMMddHHmmss
     */
    private String orderTime;

    /**
     * 商户订单号
     */
    private String merOrderId;

    /**
     * 拉卡拉支付平台时间，格式yyyyMMddHHmmss
     */
    private String dealTime;
    /**
     * 手续费
     */
    private String orderFee;

    /**
     * 人民币实收金额,单位：元，小数点后两位
     */
    private String cnyAmount;

    /**
     * 购汇汇率
     */
    private String exchangeRate;

    /**
     * 拉卡拉流水号
     */
    private String transactionId;

    /**
     * <ul>
     * <li>
     * 1-支付成功
     * </li>
     * </ul>
     */
    private String payResult;

    private String ext1;

    private String ext2;

    public String getOrderTime() {
        return orderTime;
    }

    public void setOrderTime(String orderTime) {
        this.orderTime = orderTime;
    }

    public String getMerOrderId() {
        return merOrderId;
    }

    public void setMerOrderId(String merOrderId) {
        this.merOrderId = merOrderId;
    }

    public String getDealTime() {
        return dealTime;
    }

    public void setDealTime(String dealTime) {
        this.dealTime = dealTime;
    }

    public String getOrderFee() {
        return orderFee;
    }

    public void setOrderFee(String orderFee) {
        this.orderFee = orderFee;
    }

    public String getCnyAmount() {
        return cnyAmount;
    }

    public void setCnyAmount(String cnyAmount) {
        this.cnyAmount = cnyAmount;
    }

    public String getExchangeRate() {
        return exchangeRate;
    }

    public void setExchangeRate(String exchangeRate) {
        this.exchangeRate = exchangeRate;
    }

    public String getTransactionId() {
        return transactionId;
    }

    public void setTransactionId(String transactionId) {
        this.transactionId = transactionId;
    }

    public String getPayResult() {
        return payResult;
    }

    public void setPayResult(String payResult) {
        this.payResult = payResult;
    }

    public String getExt1() {
        return ext1;
    }

    public void setExt1(String ext1) {
        this.ext1 = ext1;
    }

    public String getExt2() {
        return ext2;
    }

    public void setExt2(String ext2) {
        this.ext2 = ext2;
    }
} public class ReconSubscribeReq implements Serializable {

    private static final long serialVersionUID = 3957882917136902801L;

    /**
     * 商户号
     */
    private String merId;

    /**
     * 开始日期,格式yyyyMMdd
     */
    private String startDate;

    /**
     * 结束日期，格式yyyyMMddHHmmss
     */
    private String endDate;

    /**
     * 商户接受拉卡拉对账文件下载通知接口url
     */
    private String notifyAddr;

    public String getMerId() {
        return merId;
    }

    public void setMerId(String merId) {
        this.merId = merId;
    }

    public String getStartDate() {
        return startDate;
    }

    public void setStartDate(String startDate) {
        this.startDate = startDate;
    }

    public String getEndDate() {
        return endDate;
    }

    public void setEndDate(String endDate) {
        this.endDate = endDate;
    }

    public String getNotifyAddr() {
        return notifyAddr;
    }

    public void setNotifyAddr(String notifyAddr) {
        this.notifyAddr = notifyAddr;
    }

    @Override
    public String toString() {
        final StringBuffer sb = new StringBuffer("ReconSubscribeReq{");
        sb.append("merId='").append(merId).append('\'');
        sb.append(", startDate='").append(startDate).append('\'');
        sb.append(", endDate='").append(endDate).append('\'');
        sb.append(", notifyAddr='").append(notifyAddr).append('\'');
        sb.append('}');
        return sb.toString();
    }
} public class ReconSubscribeRes extends LklCrossPaySuperRes {

    private static final long serialVersionUID = -3576788035004252867L;

    /**
     * 开始日期,格式yyyyMMdd
     */
    private String startDate;

    /**
     * 结束日期，格式yyyyMMdd
     */
    private String endDate;

    public String getStartDate() {
        return startDate;
    }

    public void setStartDate(String startDate) {
        this.startDate = startDate;
    }

    public String getEndDate() {
        return endDate;
    }

    public void setEndDate(String endDate) {
        this.endDate = endDate;
    }

    @Override
    public String toString() {
        final StringBuffer sb = new StringBuffer("ReconSubscribeRes{");
        sb.append("super=").append(super.toString());
        sb.append("startDate='").append(startDate).append('\'');
        sb.append(", endDate='").append(endDate).append('\'');
        sb.append('}');
        return sb.toString();
    }
} public class RefundReq implements Serializable {

    private static final long serialVersionUID = -4618325348304644427L;

    /**
     * 原支付提交的商户订单号
     */
    private String merOrderId;

    /**
     * 商户退款订单号
     */
    private String seqId;

    /**
     * 订单币种
     *
     * @see LklCurrency
     */
    private String currency;

    /**
     * 原订单金额,单位：元，小数点后两位
     */
    private String orderAmount;

    /**
     * 退款时间,格式yyyyMMddHHmmss
     */
    private String retTime;

    /**
     * 退款金额，单位：元，小数点后两位
     */
    private String retAmt;

    /**
     * 退款币种
     *
     * @see LklCurrency
     */
    private String retCny;

    private String ext1;

    private String ext2;


    public String getMerOrderId() {
        return merOrderId;
    }

    public void setMerOrderId(String merOrderId) {
        this.merOrderId = merOrderId;
    }

    public String getSeqId() {
        return seqId;
    }

    public void setSeqId(String seqId) {
        this.seqId = seqId;
    }

    public String getCurrency() {
        return currency;
    }

    public void setCurrency(String currency) {
        this.currency = currency;
    }

    public String getOrderAmount() {
        return orderAmount;
    }

    public void setOrderAmount(String orderAmount) {
        this.orderAmount = orderAmount;
    }

    public String getRetTime() {
        return retTime;
    }

    public void setRetTime(String retTime) {
        this.retTime = retTime;
    }

    public String getRetAmt() {
        return retAmt;
    }

    public void setRetAmt(String retAmt) {
        this.retAmt = retAmt;
    }

    public String getRetCny() {
        return retCny;
    }

    public void setRetCny(String retCny) {
        this.retCny = retCny;
    }

    public String getExt1() {
        return ext1;
    }

    public void setExt1(String ext1) {
        this.ext1 = ext1;
    }

    public String getExt2() {
        return ext2;
    }

    public void setExt2(String ext2) {
        this.ext2 = ext2;
    }

    @Override
    public String toString() {
        final StringBuffer sb = new StringBuffer("RefundReq{");
        sb.append("merOrderId='").append(merOrderId).append('\'');
        sb.append(", seqId='").append(seqId).append('\'');
        sb.append(", currency='").append(currency).append('\'');
        sb.append(", orderAmount='").append(orderAmount).append('\'');
        sb.append(", retTime='").append(retTime).append('\'');
        sb.append(", retAmt='").append(retAmt).append('\'');
        sb.append(", retCny='").append(retCny).append('\'');
        sb.append(", ext1='").append(ext1).append('\'');
        sb.append(", ext2='").append(ext2).append('\'');
        sb.append('}');
        return sb.toString();
    }
} public class RefundRes extends LklCrossPaySuperRes {

    private static final long serialVersionUID = -6007239512051704490L;

    /**
     * 退款请求中的retTime,格 相同
     */
    private String orderTime;

    /**
     * 商 原订单号
     */
    private String merOrderId;

    /**
     * 退款订单号
     */
    private String seqId;

    /**
     * 卡 流水号
     */
    private String transactionId;

    /**
     * 退款状
     * <ul>
     * <li>0-退款 功</li>
     * <li>1-处理中</li>
     * <li>2-失败</li>
     * </ul>
     */
    private String retStatu;

    private String ext1;

    private String ext2;

    public String getOrderTime() {
        return orderTime;
    }

    public void setOrderTime(String orderTime) {
        this.orderTime = orderTime;
    }

    public String getMerOrderId() {
        return merOrderId;
    }

    public void setMerOrderId(String merOrderId) {
        this.merOrderId = merOrderId;
    }

    public String getSeqId() {
        return seqId;
    }

    public void setSeqId(String seqId) {
        this.seqId = seqId;
    }

    public String getTransactionId() {
        return transactionId;
    }

    public void setTransactionId(String transactionId) {
        this.transactionId = transactionId;
    }

    public String getRetStatu() {
        return retStatu;
    }

    public void setRetStatu(String retStatu) {
        this.retStatu = retStatu;
    }

    public String getExt1() {
        return ext1;
    }

    public void setExt1(String ext1) {
        this.ext1 = ext1;
    }

    public String getExt2() {
        return ext2;
    }

    public void setExt2(String ext2) {
        this.ext2 = ext2;
    }

    @Override
    public String toString() {
        final StringBuffer sb = new StringBuffer("RefundRes{");
        sb.append("super=").append(super.toString());
        sb.append("orderTime='").append(orderTime).append('\'');
        sb.append(", merOrderId='").append(merOrderId).append('\'');
        sb.append(", seqId='").append(seqId).append('\'');
        sb.append(", transactionId='").append(transactionId).append('\'');
        sb.append(", retStatu='").append(retStatu).append('\'');
        sb.append(", ext1='").append(ext1).append('\'');
        sb.append(", ext2='").append(ext2).append('\'');
        sb.append('}');
        return sb.toString();
    }
} public class SignReq implements Serializable {

    private static final long serialVersionUID = 3424932025571739437L;

    /**
     * 签约银行卡卡号
     */
    private String cardNo;

    /**
     * 持卡人姓名
     */
    private String clientName;

    /**
     * 证件类型
     *
     * @see LklCurrency
     */
    private String certType;

    /**
     * 证件号
     */
    private String clientId;

    /**
     * 支付卡有效期,YYMM
     */
    private String dateOfExpire;

    /**
     * 信用卡cvv
     */
    private String cvv;

    /**
     * 银行预留手机号
     */
    private String mobile;

    private String ext1;

    private String ext2;

    public String getCardNo() {
        return cardNo;
    }

    public void setCardNo(String cardNo) {
        this.cardNo = cardNo;
    }

    public String getClientName() {
        return clientName;
    }

    public void setClientName(String clientName) {
        this.clientName = clientName;
    }

    public String getCertType() {
        return certType;
    }

    public void setCertType(String certType) {
        this.certType = certType;
    }

    public String getClientId() {
        return clientId;
    }

    public void setClientId(String clientId) {
        this.clientId = clientId;
    }

    public String getDateOfExpire() {
        return dateOfExpire;
    }

    public void setDateOfExpire(String dateOfExpire) {
        this.dateOfExpire = dateOfExpire;
    }

    public String getCvv() {
        return cvv;
    }

    public void setCvv(String cvv) {
        this.cvv = cvv;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getExt1() {
        return ext1;
    }

    public void setExt1(String ext1) {
        this.ext1 = ext1;
    }

    public String getExt2() {
        return ext2;
    }

    public void setExt2(String ext2) {
        this.ext2 = ext2;
    }

    @Override
    public String toString() {
        final StringBuffer sb = new StringBuffer("SignReq{");
        sb.append("cardNo='").append(cardNo).append('\'');
        sb.append(", clientName='").append(clientName).append('\'');
        sb.append(", certType='").append(certType).append('\'');
        sb.append(", clientId='").append(clientId).append('\'');
        sb.append(", dateOfExpire='").append(dateOfExpire).append('\'');
        sb.append(", cvv='").append(cvv).append('\'');
        sb.append(", mobile='").append(mobile).append('\'');
        sb.append(", ext1='").append(ext1).append('\'');
        sb.append(", ext2='").append(ext2).append('\'');
        sb.append('}');
        return sb.toString();
    }
} public class SignRes extends LklCrossPaySuperRes {

    private static final long serialVersionUID = 634660926130315211L;

    private String ext1;

    private String ext2;

} public class SignVerifyReq implements Serializable {

    private static final long serialVersionUID = 8621673032393440806L;

    /**
     * 签约卡号
     */
    private String cardNo;

    /**
     * 持卡人姓名
     */
    private String clientName;

    /**
     * 证件类型
     *
     * @see CertType
     */
    private String certType;

    /**
     * 证件号
     */
    private String clientId;

    /**
     * 银行预留手机号
     */
    private String mobile;

    /**
     * 短信验证码
     */
    private String smsCode;

    private String ext1;

    private String ext2;

    public String getCardNo() {
        return cardNo;
    }

    public void setCardNo(String cardNo) {
        this.cardNo = cardNo;
    }

    public String getClientName() {
        return clientName;
    }

    public void setClientName(String clientName) {
        this.clientName = clientName;
    }

    public String getCertType() {
        return certType;
    }

    public void setCertType(String certType) {
        this.certType = certType;
    }

    public String getClientId() {
        return clientId;
    }

    public void setClientId(String clientId) {
        this.clientId = clientId;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getSmsCode() {
        return smsCode;
    }

    public void setSmsCode(String smsCode) {
        this.smsCode = smsCode;
    }

    public String getExt1() {
        return ext1;
    }

    public void setExt1(String ext1) {
        this.ext1 = ext1;
    }

    public String getExt2() {
        return ext2;
    }

    public void setExt2(String ext2) {
        this.ext2 = ext2;
    }

    @Override
    public String toString() {
        final StringBuffer sb = new StringBuffer("SignVerifyReq{");
        sb.append("cardNo='").append(cardNo).append('\'');
        sb.append(", clientName='").append(clientName).append('\'');
        sb.append(", certType='").append(certType).append('\'');
        sb.append(", clientId='").append(clientId).append('\'');
        sb.append(", mobile='").append(mobile).append('\'');
        sb.append(", smsCode='").append(smsCode).append('\'');
        sb.append(", ext1='").append(ext1).append('\'');
        sb.append(", ext2='").append(ext2).append('\'');
        sb.append('}');
        return sb.toString();
    }
} public class SignVerifyRes extends LklCrossPaySuperRes {

    private static final long serialVersionUID = -159828328952989472L;

    /**
     * 银行预留手机
     */
    private String mobile;

    /**
     * 签约状态
     * <ul>
     * <li>1-已签约或签约成功</li>
     * <li>2-审批中</li>
     * <li>9-签约失败</li>
     * <li>0-已解约</li>
     * </ul>
     * retCode为非0000，agstat返回1时，表示用户已签约
     * retCode为0000，agstat返回1时，表示用户签约成功
     */
    private String agstat;

    private String ext1;

    private String ext2;

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getAgstat() {
        return agstat;
    }

    public void setAgstat(String agstat) {
        this.agstat = agstat;
    }

    public String getExt1() {
        return ext1;
    }

    public void setExt1(String ext1) {
        this.ext1 = ext1;
    }

    public String getExt2() {
        return ext2;
    }

    public void setExt2(String ext2) {
        this.ext2 = ext2;
    }

    @Override
    public String toString() {
        final StringBuffer sb = new StringBuffer("SignVerifyRes{");
        sb.append("super=").append(super.toString());
        sb.append("mobile='").append(mobile).append('\'');
        sb.append(", agstat='").append(agstat).append('\'');
        sb.append(", ext1='").append(ext1).append('\'');
        sb.append(", ext2='").append(ext2).append('\'');
        sb.append('}');
        return sb.toString();
    }
} public class SubmitOrderReq implements Serializable {

    private static final long serialVersionUID = -8580114171972496490L;
    /**
     * 订单号
     */
    private String merOrderId;

    /**
     * 订单币种 {@link LklCurrency}
     */
    private String currency;

    /**
     * 订单金额。小数点后两位。单位：元
     */
    private String orderAmount;

    /**
     * 主收款方应收金额。小数点后两位。单位：元
     */
    private String payeeAmount;

    /**
     * 持卡人姓名
     */
    private String clientName;

    /**
     * 证件类型 {@link CertType}
     */
    private String certType;

    /**
     * 证件号
     */
    private String clientId;

    /**
     * 支付卡卡号
     */
    private String cardNo;

    /**
     * 贷记卡有效期 YYMM,贷记卡必填
     */
    private String dateOfExpire;

    /**
     * 贷记卡cvv，贷记卡必填
     */
    private String cvv;

    /**
     * 银行预留手机号码
     */
    private String mobile;

    /**
     * 订单概要
     */
    private String orderSummary;

    /**
     * 订单日期：yyyyMMddHHmmss
     */
    private String orderTime;

    /**
     * 订单有效时间 yyyyMMddHHmmss
     */
    private String orderEffTime;


    private String timeZone;

    /**
     * 支付完成后跳转到商户的方的页面
     */
    private String pageUrl;

    /**
     * 商户后台通知url
     */
    private String bgUrl;

    /**
     * 跨境业务类型 {@link CrossBorderBizType}
     */
    private String busiCode;

    /**
     * 是否合并“签约+支付”
     */
    private String isMergeSign;

    /**
     * 商户客户会员ID,必填 无会员填写“NA”
     */
    private String customNumberId;

    private String ext1;

    /**
     * 扩展字段2
     */
    private String ext2;

    /**
     * 扩展信息
     */
    private Map<String, String> extension;

    public String getMerOrderId() {
        return merOrderId;
    }

    public void setMerOrderId(String merOrderId) {
        this.merOrderId = merOrderId;
    }

    public String getCurrency() {
        return currency;
    }

    public void setCurrency(String currency) {
        this.currency = currency;
    }

    public String getOrderAmount() {
        return orderAmount;
    }

    public void setOrderAmount(String orderAmount) {
        this.orderAmount = orderAmount;
    }

    public String getPayeeAmount() {
        return payeeAmount;
    }

    public void setPayeeAmount(String payeeAmount) {
        this.payeeAmount = payeeAmount;
    }

    public String getClientName() {
        return clientName;
    }

    public void setClientName(String clientName) {
        this.clientName = clientName;
    }

    public String getCertType() {
        return certType;
    }

    public void setCertType(String certType) {
        this.certType = certType;
    }

    public String getClientId() {
        return clientId;
    }

    public void setClientId(String clientId) {
        this.clientId = clientId;
    }

    public String getCardNo() {
        return cardNo;
    }

    public void setCardNo(String cardNo) {
        this.cardNo = cardNo;
    }

    public String getDateOfExpire() {
        return dateOfExpire;
    }

    public void setDateOfExpire(String dateOfExpire) {
        this.dateOfExpire = dateOfExpire;
    }

    public String getCvv() {
        return cvv;
    }

    public void setCvv(String cvv) {
        this.cvv = cvv;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getOrderSummary() {
        return orderSummary;
    }

    public void setOrderSummary(String orderSummary) {
        this.orderSummary = orderSummary;
    }

    public String getOrderTime() {
        return orderTime;
    }

    public void setOrderTime(String orderTime) {
        this.orderTime = orderTime;
    }

    public String getOrderEffTime() {
        return orderEffTime;
    }

    public void setOrderEffTime(String orderEffTime) {
        this.orderEffTime = orderEffTime;
    }

    public String getTimeZone() {
        return timeZone;
    }

    public void setTimeZone(String timeZone) {
        this.timeZone = timeZone;
    }

    public String getPageUrl() {
        return pageUrl;
    }

    public void setPageUrl(String pageUrl) {
        this.pageUrl = pageUrl;
    }

    public String getBgUrl() {
        return bgUrl;
    }

    public void setBgUrl(String bgUrl) {
        this.bgUrl = bgUrl;
    }

    public String getBusiCode() {
        return busiCode;
    }

    public void setBusiCode(String busiCode) {
        this.busiCode = busiCode;
    }

    public String getIsMergeSign() {
        return isMergeSign;
    }

    public void setIsMergeSign(String isMergeSign) {
        this.isMergeSign = isMergeSign;
    }

    public String getExt1() {
        return ext1;
    }

    public void setExt1(String ext1) {
        this.ext1 = ext1;
    }

    public String getExt2() {
        return ext2;
    }

    public void setExt2(String ext2) {
        this.ext2 = ext2;
    }

    public Map<String, String> getExtension() {
        return extension;
    }

    public void setExtension(Map<String, String> extension) {
        this.extension = extension;
    }

    public String getCustomNumberId() {
        return customNumberId;
    }

    public void setCustomNumberId(String customNumberId) {
        this.customNumberId = customNumberId;
    }
} public class SubmitOrderRes extends LklCrossPaySuperRes {

    private static final long serialVersionUID = -1447455521273385588L;


    /**
     * 商户订单号
     */
    private String merOrderId;
    /**
     * 订单日期 yyyyMMDDHHMMSS
     */
    private String orderTime;

    /**
     * 订单币种
     */
    private String currency;

    /**
     * 人民币实付金额 ，小数点后两位，单位：元
     */
    private String cnyAmount;

    /**
     * 购汇汇率
     */
    private String exchangeRate;

    /**
     * 拉卡拉流水号
     */
    private String transactionId;

    /**
     * 短信送达状态：1-已送达；0-未送达
     */
    private String smsStatus;

    /**
     * 扩展字段1
     */
    private String ext1;

    /**
     * 扩展字段2
     */
    private String ext2;


    public String getMerOrderId() {
        return merOrderId;
    }

    public void setMerOrderId(String merOrderId) {
        this.merOrderId = merOrderId;
    }

    public String getOrderTime() {
        return orderTime;
    }

    public void setOrderTime(String orderTime) {
        this.orderTime = orderTime;
    }

    public String getCurrency() {
        return currency;
    }

    public void setCurrency(String currency) {
        this.currency = currency;
    }

    public String getCnyAmount() {
        return cnyAmount;
    }

    public void setCnyAmount(String cnyAmount) {
        this.cnyAmount = cnyAmount;
    }

    public String getExchangeRate() {
        return exchangeRate;
    }

    public void setExchangeRate(String exchangeRate) {
        this.exchangeRate = exchangeRate;
    }

    public String getTransactionId() {
        return transactionId;
    }

    public void setTransactionId(String transactionId) {
        this.transactionId = transactionId;
    }

    public String getSmsStatus() {
        return smsStatus;
    }

    public void setSmsStatus(String smsStatus) {
        this.smsStatus = smsStatus;
    }

    public String getExt1() {
        return ext1;
    }

    public void setExt1(String ext1) {
        this.ext1 = ext1;
    }

    public String getExt2() {
        return ext2;
    }

    public void setExt2(String ext2) {
        this.ext2 = ext2;
    }

    @Override
    public String toString() {
        final StringBuffer sb = new StringBuffer("SubmitOrderRes{");
        sb.append("super=[").append(super.toString()).append("]");
        sb.append(", merOrderId='").append(merOrderId).append('\'');
        sb.append(", orderTime='").append(orderTime).append('\'');
        sb.append(", currency='").append(currency).append('\'');
        sb.append(", cnyAmount='").append(cnyAmount).append('\'');
        sb.append(", exchangeRate='").append(exchangeRate).append('\'');
        sb.append(", transactionId='").append(transactionId).append('\'');
        sb.append(", smsStatus='").append(smsStatus).append('\'');
        sb.append(", ext1='").append(ext1).append('\'');
        sb.append(", ext2='").append(ext2).append('\'');
        sb.append('}');
        return sb.toString();
    }
} public enum CertType {

    ID("01", "身份证"),
    PASSPORT("03", "护照"),
    HUIXIANGZHENG("04", "港澳回乡证"),
    TAIBAOZHENG("05", "台胞证"),
    HUKOUBU("07", "户口簿"),
    JUNGUANZHENG("27", "军官证"),
    ORG_CODE("51", "组织机构代码"),
    BIZ_LICENCE("55", "企业法人营业执照");


    CertType(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    private String code;

    private String desc;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }
} public enum CrossBorderBizType {
    HOTEL("223029", "酒店住宿、旅游服务"),
    AIRPORT_TICKET("222024", "航空机票"),
    CARGO_TRADE("121010", "货物贸易"),
    EXPO("228025", "国际展览"),
    STUDY_ABROAD_YEAR_BELOW("223023", "留学教育（一年及以下）"),
    STUDY_ABROAD_YEAR_ABOVE("223022", "留学教育（一年以上）");

    CrossBorderBizType(String code, String desc) {
        this.code = code;
        this.desc = desc;

    }

    private String code;

    private String desc;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }
} public enum LklCurrency {
    USD("USD", "美元"),
    HKD("HKD", "港币"),
    EUR("EUR", "欧元"),
    JPY("JPY", "日元"),
    GBP("GBP", "英镑"),
    CHF("CHF", "瑞士法郎"),
    SGD("SGD", "新加坡元"),
    AUD("AUD", "澳元"),
    CAD("CAD", "加元"),
    KRW("KRW", "韩元"),
    MYR("MYR", "马来西亚林吉特"),
    NZD("NZD", "新西兰"),
    RUB("RUB", "卢布"),
    THB("THB", "泰铢"),
    TWD("TWD", "新台币"),
    CNY("CNY", "人民币");

    LklCurrency(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    private String code;

    private String desc;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }
} public enum LklEnv {

    SANDBOX("sandbox"),
    LIVE("live");

    LklEnv(String env) {
        this.env = env;
    }

    private String env;

    public String getEnv() {
        return env;
    }

    public void setEnv(String env) {
        this.env = env;
    }
} public class DateUtil {
    private static String ymdhms = "yyyyMMddHHmmssssssss";
    private static SimpleDateFormat yyyyMMddHHmmssssssss = new SimpleDateFormat(ymdhms);

    /**
     * 获得当前时间
     * 格式：yyyyMMddHHmmssssssss
     *
     * @return String
     */
    public static String getCurrentTime() {

        return yyyyMMddHHmmssssssss.format(new Date());
    }

    /**
     * 返回一个格式化的日期字符串
     *
     * @param pattern 日期格式，若为空则默认为yyyyMMdd
     * @return
     */
    public static String getCurrentDate(String pattern) {
        SimpleDateFormat datePattern = null;
        if (null == pattern || "".equals(pattern)) {
            datePattern = new SimpleDateFormat("yyyyMMdd");
        } else {
            datePattern = new SimpleDateFormat(pattern);
        }
        return datePattern.format(new Date());
    }
} @Component
public class LklCrossPayEnv {

    @Autowired
    @Qualifier("yamlMap")
    private Map<String, Object> yamlMap;

    private static Map<String, Object> YML_MAP;

    private static final Map<LklEnv, LklCrossPayClientConfig> ENV_CONFIG = new ConcurrentHashMap<LklEnv, LklCrossPayClientConfig>();

    @PostConstruct
    public void afterPropertiesSet() throws Exception {
//        YML_MAP = ctx.getBean("yamlMap", Map.class);
        YML_MAP = (Map<String, Object>) yamlMap.get("yamlMap");
    }


    /**
     * 获取当前环境的配置信息
     *
     * @return
     */
    public static LklCrossPayClientConfig getEnvConfig() {
        Iterator<Map.Entry<LklEnv, LklCrossPayClientConfig>> it = ENV_CONFIG.entrySet().iterator();
        LklCrossPayClientConfig config = null;
        if (it.hasNext()) {
            config = it.next().getValue();
        }
        return config;

    }

    /**
     * 注册拉卡拉支付平台环境,一个应用实例只能注册一个环境
     *
     * @param env        拉卡拉环境枚举 {@link LklEnv}
     * @param merId      该环境对应的商户号
     * @param privateKey 该环境对应的私钥
     * @param publicKey  该环境对应的公钥
     */
    public synchronized void registerEnv(LklEnv env, String merId, String privateKey, String publicKey) {
        String envValue = env.getEnv();
        //一个实例只允许注册一个环境
        if (!ENV_CONFIG.isEmpty()) {
            return;
        } else {
            LklCrossPayClientConfig config = new LklCrossPayClientConfig();
            Map<String, String> envObj = (LinkedHashMap<String, String>) YML_MAP.get(envValue);
            config.setPort(String.valueOf(envObj.get("port")));
            config.setPrivateKey(privateKey);
            config.setPublicKey(publicKey);
            config.setServer(String.valueOf(envObj.get("server")));
            config.setMerId(merId);
            ENV_CONFIG.put(env, config);

        }
    }
}
import com.lakala.crossborder.client.LklCbPayClient;
import com.lakala.crossborder.client.LklCbPayQueryClient;
import com.lakala.crossborder.client.LklCbPaySignClient;
import com.lakala.crossborder.client.entities.LklCrossPaySuperReq;
import com.lakala.crossborder.client.entities.gather.LklGatherReq;
import com.lakala.crossborder.client.entities.gather.LklGatherRes;
import com.lakala.crossborder.client.entities.otp.LklOtpReq;
import com.lakala.crossborder.client.entities.otp.LklOtpRes;
import com.lakala.crossborder.client.entities.payAgent.LklPayAgentReq;
import com.lakala.crossborder.client.entities.payAgent.LklPayAgentRes;
import com.lakala.crossborder.client.entities.payment.PaymentReq;
import com.lakala.crossborder.client.entities.payment.PaymentRes;
import com.lakala.crossborder.client.entities.query.*;
import com.lakala.crossborder.client.entities.recon.ReconSubscribeReq;
import com.lakala.crossborder.client.entities.recon.ReconSubscribeRes;
import com.lakala.crossborder.client.entities.refund.RefundReq;
import com.lakala.crossborder.client.entities.refund.RefundRes;
import com.lakala.crossborder.client.entities.sign.SignReq;
import com.lakala.crossborder.client.entities.sign.SignRes;
import com.lakala.crossborder.client.entities.sign.SignVerifyReq;
import com.lakala.crossborder.client.entities.sign.SignVerifyRes;
import com.lakala.crossborder.client.entities.submit.SubmitOrderReq;
import com.lakala.crossborder.client.entities.submit.SubmitOrderRes;
import com.lakala.crossborder.client.enums.CertType;
import com.lakala.crossborder.client.enums.CrossBorderBizType;
import com.lakala.crossborder.client.enums.LklCurrency;
import com.lakala.crossborder.client.enums.LklEnv;
import com.lakala.crossborder.client.util.DateUtil;
import com.lakala.crossborder.client.util.LklCrossPayEnv;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.web.client.RestTemplate;
import java.util.HashMap;
import java.util.Map;

    /**
     * 单笔实时代付状态查询
     */
    @Test
    public void testAgentpayStausQuery() {
        AgentPayStatusQueryReq req = new AgentPayStatusQueryReq();
        req.setMerOrderId("SH20160420195553");

        LklCrossPaySuperReq head = new LklCrossPaySuperReq();
        head.setVer("2.0.0");
        head.setTs(DateUtil.getCurrentTime());
        head.setMerId(LklCrossPayEnv.getEnvConfig().getMerId());

        AgentPayStatusQueryRes res = queryClient.agentPayStatusQuery(req, head);
        logger.debug("单笔实时代付状态查询={}", res);
    }

    /**
     * 商户代付账户余额查询
     */
    @Test
    public void testAgentPayBalanceQuery() {
        AgentPayAcctBalanceQueryReq req = new AgentPayAcctBalanceQueryReq();
        req.setCurrency(LklCurrency.CNY.getCode());

        LklCrossPaySuperReq head = new LklCrossPaySuperReq();
        head.setVer("2.0.0");
        head.setTs(DateUtil.getCurrentTime());
        head.setMerId(LklCrossPayEnv.getEnvConfig().getMerId());

        AgentPayAcctBalanceQueryRes res = queryClient.agentPayAcctBalanceQuery(req, head);
        logger.debug("商户代付账户余额查询={}", res);
    }

    /**
     * 退款接口
     */
    @Test
    public void testRefund() {
        RefundReq req = new RefundReq();
        req.setMerOrderId("SH20160420194753");
        req.setSeqId("WH20160430195553");
        req.setCurrency(LklCurrency.CNY.getCode());
        req.setOrderAmount("0.02");
        req.setRetTime(DateUtil.getCurrentTime());
        req.setRetAmt("0.02");
        req.setRetCny(LklCurrency.CNY.getCode());

        LklCrossPaySuperReq head = new LklCrossPaySuperReq();
        head.setTs(DateUtil.getCurrentTime());
        head.setReqType("B0006");
        head.setMerId(LklCrossPayEnv.getEnvConfig().getMerId());

        RefundRes res = payClient.refun(req, head);
        logger.debug("退款接口={}", res);
    }

    /**
     * 用户签约
     */
    @Test
    public void testSign() {
        SignReq req = new SignReq();
        req.setCardNo("6222021001116245702");
        req.setClientName("孙xx");
        req.setCertType(CertType.ID.getCode());
        req.setClientId("360000000000000000");
        req.setDateOfExpire("1602");
        req.setMobile("15000000000");

        LklCrossPaySuperReq head = new LklCrossPaySuperReq();
        head.setTs(DateUtil.getCurrentTime());
        head.setReqType("B0010");
        head.setMerId(LklCrossPayEnv.getEnvConfig().getMerId());

        SignRes res = signClient.sign(req, head);
        logger.debug("用户签约={}", res);

    }

    /**
     * 用户签约验证
     */
    @Test
    public void testSignVerify() {
        SignVerifyReq req = new SignVerifyReq();

        req.setCardNo("6222021001116245702");
        req.setClientName("孙xx");
        req.setCertType(CertType.ID.getCode());
        req.setClientId("360000000000000000");
        req.setMobile("15000000000");
        req.setSmsCode("111111");

        LklCrossPaySuperReq head = new LklCrossPaySuperReq();
        head.setTs(DateUtil.getCurrentTime());
        head.setReqType("B0011");
        head.setMerId(LklCrossPayEnv.getEnvConfig().getMerId());

        SignVerifyRes res = signClient.signVerify(req, head);
        logger.debug("用户签约验证={}", res);
    }

    /**
     * 对账文件预约下载
     */
    @Test
    public void testReconSubscribe() {
        ReconSubscribeReq req = new ReconSubscribeReq();
        req.setMerId(LklCrossPayEnv.getEnvConfig().getMerId());
        req.setStartDate("20160415");
        req.setEndDate("20160425");
        req.setNotifyAddr("http://baidu.com");

        LklCrossPaySuperReq head = new LklCrossPaySuperReq();
        head.setTs(DateUtil.getCurrentTime());
        head.setReqType("B0008");
        head.setMerId(LklCrossPayEnv.getEnvConfig().getMerId());

        ReconSubscribeRes res = payClient.reconSubscribe(req, head);