package com.hzs.third.bankcard.provider;

import com.hzs.common.core.domain.R;
import com.hzs.common.core.utils.StringUtils;
import com.hzs.third.bankcard.IBankCardServiceApi;
import com.hzs.third.bankcard.dto.BankCardParam;
import com.hzs.third.bankcard.service.BankCardService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * 银行卡四要素验证服务
 *
 * @Description:
 * @Author: ljc
 * @Time: 2023/2/9 9:05
 * @Classname: BankCardValidateProvider
 * @Package_name: com.hzs.third.bankCard.provider
 */

@DubboService
public class BankCardValidateProvider implements IBankCardServiceApi {

    @Autowired
    BankCardService bankCardService;

    @Override
    public R verifyBankCard(BankCardParam bankCardParam) {

        if (StringUtils.isEmpty(bankCardParam.getIdCard())) {
            return R.fail("身份证号码不能为空！");
        }
        if (StringUtils.isEmpty(bankCardParam.getName())) {
            return R.fail("开户姓名不能为空！");
        }
        if (StringUtils.isEmpty(bankCardParam.getMobile())) {
            return R.fail("手机号不能为空！");
        }

        if (StringUtils.isEmpty(bankCardParam.getBankCard())) {
            return R.fail("银行卡号不能为空！");
        }
        return bankCardService.verifyBankCard(bankCardParam);
    }


}
