protected function checkRequest()
 {
     //1.验证是否为空
     if (!DataVerifier::isValidString($this->request["OrderNo"], ILength::ORDERID_LEN)) {
         throw new TrxException(TrxException::TRX_EXC_CODE_1100, TrxException::TRX_EXC_MSG_1101, "交易编号不合法");
     }
     if (!DataVerifier::isValidBankCardNo($this->request["CardNo"])) {
         throw new TrxException(TrxException::TRX_EXC_CODE_1100, TrxException::TRX_EXC_MSG_1101, "签约账号不合法");
     }
 }
 protected function checkRequest()
 {
     //1.验证是否为空
     if (!DataVerifier::isValidString($this->request["OrderNo"], ILength::ORDERID_LEN)) {
         throw new TrxException(TrxException::TRX_EXC_CODE_1100, TrxException::TRX_EXC_MSG_1101, "交易编号长度不合法");
     }
     if (!DataVerifier::isValidBankCardNo($this->request["CardNo"])) {
         throw new TrxException(TrxException::TRX_EXC_CODE_1100, TrxException::TRX_EXC_MSG_1101, "签约账号不合法");
     }
     if (!DataVerifier::isValid($this->request["MobileNo"])) {
         throw new TrxException(TrxException::TRX_EXC_CODE_1100, TrxException::TRX_EXC_MSG_1101, "签约手机号不合法");
     }
     //5::校验定单日期合法性
     if (!DataVerifier::isValidDate($this->request["OrderDate"])) {
         throw new TrxException(TrxException::TRX_EXC_CODE_1101, TrxException::TRX_EXC_MSG_1101, "订单日期格式不正确");
     }
     //6.校验定单日期合法性
     if (!DataVerifier::isValidTime($this->request["OrderTime"])) {
         throw new TrxException(TrxException::TRX_EXC_CODE_1101, TrxException::TRX_EXC_MSG_1101, "订单时间格式不正确");
     }
     if (!DataVerifier::isValidDate($this->request["InvaidDate"])) {
         throw new TrxException(TrxException::TRX_EXC_CODE_1101, TrxException::TRX_EXC_MSG_1101, "签约有效期格式不正确");
     }
     if (!($this->request["IsSign"] === "Sign")) {
         throw new TrxException(TrxException::TRX_EXC_CODE_1101, TrxException::TRX_EXC_MSG_1101, "设置签约标识不合法");
     }
     //检验证件类型、证件号码合法性
     if (!DataVerifier::isValidCertificate($this->request["CertificateType"], $this->request["CertificateNo"])) {
         throw new TrxException(TrxException::TRX_EXC_CODE_1101, TrxException::TRX_EXC_MSG_1101, "证件类型、证件号码不合法");
     }
     //验证客户姓名
     if ($this->request["AccName"] == null) {
         throw new TrxException(TrxException::TRX_EXC_CODE_1100, TrxException::TRX_EXC_MSG_1100, "客户姓名未设置");
     }
     if ($this->request["CardType"] === 3) {
         //验证贷记卡CVV2
         if (!DataVerifier::isValidString($this->request["CVV2"], 3)) {
             throw new TrxException(TrxException::TRX_EXC_CODE_1100, TrxException::TRX_EXC_MSG_1100, "贷记卡CVV2未设置");
         }
         //验证贷记卡有效期
         if (!DataVerifier::isValidString($this->request["CardDueDate"], 4)) {
             throw new TrxException(TrxException::TRX_EXC_CODE_1100, TrxException::TRX_EXC_MSG_1100, "贷记卡有效期未设置");
         }
     }
 }
 protected function checkRequest()
 {
     $customType = $this->request["CustomType"];
     if (!($customType === "0") && !($customType === "1")) {
         throw new TrxException(TrxException::TRX_EXC_CODE_1100, TrxException::TRX_EXC_MSG_1101, "客户类型不合法");
     }
     if (!DataVerifier::isValidURL($this->request["ResultNotifyURL"])) {
         throw new TrxException(TrxException::TRX_EXC_CODE_1100, TrxException::TRX_EXC_MSG_1101, "验证结果回传网址不合法");
     }
     if (!DataVerifier::isValidDate($this->request["OrderDate"])) {
         throw new TrxException(TrxException::TRX_EXC_CODE_1100, TrxException::TRX_EXC_MSG_1101, "订单日期不合法");
     }
     if (!DataVerifier::isValidTime($this->request["OrderTime"])) {
         throw new TrxException(TrxException::TRX_EXC_CODE_1100, TrxException::TRX_EXC_MSG_1101, "订单时间不合法");
     }
     if (!DataVerifier::isValidBankCardNo($this->request["BankCardNo"])) {
         throw new TrxException(TrxException::TRX_EXC_CODE_1101, TrxException::TRX_EXC_MSG_1101, "银行卡号不合法");
     }
     if (!DataVerifier::isValidCertificate($this->request["CertificateType"], $this->request["CertificateNo"])) {
         throw new TrxException(TrxException::TRX_EXC_CODE_1101, TrxException::TRX_EXC_MSG_1101, "证件类型、证件号码不合法");
     }
 }
 protected function checkRequest()
 {
     $customType = $this->request["CustomType"];
     if (!($customType === "0") && !($customType === "1")) {
         throw new TrxException(TrxException::TRX_EXC_CODE_1100, TrxException::TRX_EXC_MSG_1101, "客户类型不合法");
     }
     // 检验卡号合法性
     if (!DataVerifier::isValidBankCardNo($this->request["AccNo"])) {
         throw new TrxException(TrxException::TRX_EXC_CODE_1101, TrxException::TRX_EXC_MSG_1101, "银行卡号不合法");
     }
     // 检验证件类型、证件号码合法性
     if (!DataVerifier::isValidCertificate($this->request["CertificateType"], $this->request["CertificateNo"])) {
         throw new TrxException(TrxException::TRX_EXC_CODE_1101, TrxException::TRX_EXC_MSG_1101, "证件类型、证件号码不合法");
     }
     // 检验证件类型、证件号码合法性
     if ($this->request["ClientName"] == null) {
         throw new TrxException(TrxException::TRX_EXC_CODE_1101, TrxException::TRX_EXC_MSG_1101, "客户姓名不合法");
     }
     //验证手机号
     if (!DataVerifier::isValid($this->request["MobileNo"])) {
         throw new TrxException(TrxException::TRX_EXC_CODE_1101, TrxException::TRX_EXC_MSG_1101, "手机号不合法!");
     }
 }
 private function isValid()
 {
     #region 验证$this->request信息
     if (!DataVerifier::isValidBankCardNo($this->request["CardNo"])) {
         return "支付账号不合法!";
     }
     if (!DataVerifier::isValid($this->request["MobileNo"])) {
         return "手机号不合法!";
     }
     if (!ICommodityType::InArray($this->request["CommodityType"])) {
         return "商品种类不合法";
     }
     if (!$this->request["Installment"] === IInstallmentmark::INSTALLMENTMARK_YES && !$this->request["Installment"] === IInstallmentmark::INSTALLMENTMARK_NO) {
         return "分期标识为空或输入非法";
     }
     $payTypeId = $this->order["PayTypeID"];
     if ($payTypeId === IPayTypeID::PAY_TYPE_INSTALLMENTPAY) {
         if ($this->request["Installment"] === IInstallmentmark::INSTALLMENTMARK_YES) {
             if (strlen($this->request["ProjectID"]) !== 8) {
                 return "分期代码长度应该为8位";
             }
             if (!DataVerifier::isValid($this->request["Period"]) || strlen($this->request["Period"]) > 2) {
                 return "分期期数非有效数字或者长度超过2";
             }
         }
     }
     if ($this->request["IsBreakAccount"] !== IIsBreakAccountType::IsBreak_TYPE_YES && $this->request["IsBreakAccount"] !== IIsBreakAccountType::IsBreak_TYPE_NO) {
         return "交易是否分账设置异常,必须为:0或1";
     }
     #endregion
     #region 验证order信息
     if (!$this->order["PayTypeID"] === IPayTypeID::PAY_TYPE_DIRECTPAY && !$this->order["PayTypeID"] === IPayTypeID::PAY_TYPE_INSTALLMENTPAY) {
         return "设定交易类型错误";
     }
     if ($this->order["OrderAmount"] <= 0) {
         return "订单金额小于等于零";
     }
     if (!DataVerifier::isValidString($this->order["OrderNo"], ILength::ORDERID_LEN)) {
         return "交易编号不合法";
     }
     if (strlen($this->order["OrderDesc"]) > ILength::ORDER_DESC_LEN) {
         return "订单说明超长";
     }
     if (!DataVerifier::isValidDate($this->order["OrderDate"])) {
         return "订单日期不合法";
     }
     if (!DataVerifier::isValidTime($this->order["OrderTime"])) {
         return "订单时间不合法";
     }
     if (!DataVerifier::isValidAmount($this->order["OrderAmount"], 2)) {
         return "订单金额不合法";
     }
     if ($this->order["CurrencyCode"] !== "156") {
         return "设定交易币种错误";
     }
     #endregion
     #region 验证$orderitems信息(订单明细)
     if (count($this->orderitems, COUNT_NORMAL) < 1) {
         return "商品明细为空";
     }
     foreach ($this->orderitems as $orderitem) {
         if (!DataVerifier::isValidString($orderitem["ProductName"], ILength::PRODUCTNAME_LEN)) {
             return "产品名称不合法";
         }
     }
     #endregion
     return "";
 }