src/Common/Weixin/Data/RefundData.php
protected function checkDataParam()
    {
        $refundNo = $this->refund_no;// 商户退款单号
        $transactionId = $this->transaction_id;
        $outTradeNo = $this->out_trade_no;
        $totalFee = $this->total_fee;
        $refundFee = $this->refund_fee;
        $operatorId = $this->operator_id;
        $refundAccount = $this->refund_account;// 退款账户

        if (empty($refundNo)) {
            throw new PayException('请设置退款单号 refund_no');
        }

        // 二者不能同时为空
        if (empty($transactionId) && empty($outTradeNo)) {
            throw new PayException('必须提供微信交易号或商户网站唯一订单号。建议使用微信交易号');
        }

        $this->total_fee = bcmul($totalFee, 100, 0);// 微信以分为单位
        $this->refund_fee = bcmul($refundFee, 100, 0);

        if (bccomp($refundFee, $totalFee, 2) === 1) {
            throw new PayException('退款金额不能大于订单总金额');
        }

        if (! in_array($refundAccount, [WxConfig::REFUND_RECHARGE, WxConfig::REFUND_UNSETTLED])) {
            $this->refund_account = WxConfig::REFUND_UNSETTLED;
        }

        // 该接口，微信配置文件，必须提供cert  key  两个pem文件
        $certPath = $this->appCertPem;
        $keyPath = $this->appKeyPem;
        if (empty($certPath)) {
            throw new PayException('退款接口，必须提供 apiclient_cert.pem 证书');
        }

        if (empty($keyPath)) {
            throw new PayException('退款接口，必须提供 apiclient_key.pem 证书');
        }

        if (empty($operatorId)) {
            $this->operator_id = $this->mchId;
        }
    }
protected function checkDataParam()
    {
        $refundNo = $this->refund_no;// 商户退款单号
        $transactionId = $this->transaction_id;
        $outTradeNo = $this->out_trade_no;
        $totalFee = $this->total_fee;
        $refundFee = $this->refund_fee;
        $operatorId = $this->operator_id;
        $refundAccount = $this->refund_account;// 退款账户

        if (empty($refundNo)) {
            throw new PayException('请设置退款单号 refund_no');
        }

        // 二者不能同时为空
        if (empty($transactionId) && empty($outTradeNo)) {
            throw new PayException('必须提供微信交易号或商户网站唯一订单号。建议使用微信交易号');
        }

        $this->total_fee = bcmul($totalFee, 100, 0);// 微信以分为单位
        $this->refund_fee = bcmul($refundFee, 100, 0);

        if (bccomp($refundFee, $totalFee, 2) === 1) {
            throw new PayException('退款金额不能大于订单总金额');
        }

        if (! in_array($refundAccount, [WxConfig::REFUND_RECHARGE, WxConfig::REFUND_UNSETTLED])) {
            $this->refund_account = WxConfig::REFUND_UNSETTLED;
        }

        // 该接口，微信配置文件，必须提供cert  key  两个pem文件
        $certPath = $this->appCertPem;
        $keyPath = $this->appKeyPem;
        if (empty($certPath)) {
            throw new PayException('退款接口，必须提供 apiclient_cert.pem 证书');
        }

        if (empty($keyPath)) {
            throw new PayException('退款接口，必须提供 apiclient_key.pem 证书');
        }

        if (empty($operatorId)) {
            $this->operator_id = $this->mchId;
        }
    }
protected function checkDataParam ( ) { $ refundNo = $ this -> refund_no ; // 商户退款单号 $ transactionId = $ this -> transaction_id ; $ outTradeNo = $ this -> out_trade_no ; $ totalFee = $ this -> total_fee ; $ refundFee = $ this -> refund_fee ; $ operatorId = $ this -> operator_id ; $ refundAccount = $ this -> refund_account ; // 退款账户 if ( empty ( $ refundNo ) ) { throw new PayException ( '请设置退款单号 refund_no'); } // 二者不能同时为空 if ( empty ( $ transactionId ) && empty ( $ outTradeNo ) ) { throw new PayException ( '必须提供微信交易号或商户网站唯一订单号。建议使用微信交易号'); } $ this -> total_fee = bcmul ( $ totalFee , 100 , 0 ) ; // 微信以分为单位 $ this -> refund_fee = bcmul ( $ refundFee , 100 , 0 ) ; if ( bccomp ( $ refundFee , $ totalFee , 2 ) === 1 ) { throw new PayException ( '退款金额不能大于订单总金额'); } if ( ! in_array ( $ refundAccount , [ WxConfig :: REFUND_RECHARGE , WxConfig :: REFUND_UNSETTLED ] ) ) { $ this -> refund_account = WxConfig :: REFUND_UNSETTLED ; } // 该接口，微信配置文件，必须提供cert  key  两个pem文件 $ certPath = $ this -> appCertPem ; $ keyPath = $ this -> appKeyPem ; if ( empty ( $ certPath ) ) { throw new PayException ( '退款接口，必须提供 apiclient_cert.pem 证书'); } if ( empty ( $ keyPath ) ) { throw new PayException ( '退款接口，必须提供 apiclient_key.pem 证书'); } if ( empty ( $ operatorId ) ) { $ this -> operator_id = $ this -> mchId ; } }
检查参数
@author helei
检查参数