package com.czg.service.Impl;

import com.czg.CzgPayUtils;
import com.czg.entity.notify.CzgPayNotifyDTO;
import com.czg.entity.notify.CzgRefundNotifyDTO;
import com.czg.entity.req.*;
import com.czg.entity.resp.*;
import com.czg.resp.CzgResult;
import com.czg.service.CzgPayService;
import com.czg.system.enums.SysParamCodeEnum;
import com.czg.system.service.SysParamsService;
import lombok.NonNull;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

/**
 * @author ww
 * @description 1
 */
@Service
public class CzgPayServiceImpl implements CzgPayService {

    @DubboReference
    private SysParamsService sysParamsService;

    @Override
    public CzgResult<CzgH5PayResp> h5Pay(@NonNull String appId, @NonNull String appSecret, CzgH5PayReq bizData) {
        return CzgPayUtils.h5Pay(sysParamsService.getSysParamValue(SysParamCodeEnum.PAY_CZG_DOMAIN.getCode()), appId, appSecret, bizData);
    }

    @Override
    public CzgResult<CzgJsPayResp> jsPay(@NonNull String appId, @NonNull String appSecret, CzgJsPayReq bizData) {
        return CzgPayUtils.jsPay(sysParamsService.getSysParamValue(SysParamCodeEnum.PAY_CZG_DOMAIN.getCode()), appId, appSecret, bizData);
    }

    @Override
    public CzgResult<CzgLtPayResp> ltPay(@NonNull String appId, @NonNull String appSecret, CzgLtPayReq bizData) {
        return CzgPayUtils.ltPay(sysParamsService.getSysParamValue(SysParamCodeEnum.PAY_CZG_DOMAIN.getCode()), appId, appSecret, bizData);
    }

    @Override
    public CzgResult<CzgScanPayResp> scanPay(@NonNull String appId, @NonNull String appSecret, CzgScanPayReq bizData) {
        return CzgPayUtils.scanPay(sysParamsService.getSysParamValue(SysParamCodeEnum.PAY_CZG_DOMAIN.getCode()), appId, appSecret, bizData);
    }

    @Override
    public CzgResult<CzgMicroPayResp> microPay(@NonNull String appId, @NonNull String appSecret, CzgMicroPayReq bizData) {
        return CzgPayUtils.microPay(sysParamsService.getSysParamValue(SysParamCodeEnum.PAY_CZG_DOMAIN.getCode()), appId, appSecret, bizData);
    }

    @Override
    public CzgResult<CzgBaseResp> queryPayOrder(@NonNull String appId, @NonNull String appSecret, String payOrderId, String mchOrderNo) {
        return CzgPayUtils.queryPayOrder(sysParamsService.getSysParamValue(SysParamCodeEnum.PAY_CZG_DOMAIN.getCode()), appId, appSecret, payOrderId, mchOrderNo);
    }

    @Override
    public CzgResult<CzgRefundResp> refundOrder(@NonNull String appId, @NonNull String appSecret, CzgRefundReq bizData) {
        return CzgPayUtils.refundOrder(sysParamsService.getSysParamValue(SysParamCodeEnum.PAY_CZG_DOMAIN.getCode()), appId, appSecret, bizData);
    }

    @Override
    public CzgResult<CzgRefundResp> queryRefundOrder(@NonNull String appId, @NonNull String appSecret, String mchRefundNo, String refundOrderId) {
        return CzgPayUtils.queryRefundOrder(sysParamsService.getSysParamValue(SysParamCodeEnum.PAY_CZG_DOMAIN.getCode()), appId, appSecret, mchRefundNo, refundOrderId);
    }

}
