创建刷卡支付参数包
@param string $auth_code 授权Code号
@param string $out_trade_no 商户订单号
@param int $total_fee 支付费用
@param string $body 订单标识
@param null $goods_tag 商品标签
@return array|bool
516110
public function createMicroPay($auth_code, $out_trade_no, $total_fee, $body, $goods_tag = null)
    {
        $data = array(
            "appid"            => $this->appid,
            "mch_id"           => $this->mch_id,
            "body"             => $body,
            "out_trade_no"     => $out_trade_no,
            "total_fee"        => $total_fee,
            "auth_code"        => $auth_code,
            "spbill_create_ip" => Tools::getAddress(),
        );
        empty($goods_tag) || $data['goods_tag'] = $goods_tag;
        $json = Tools::xml2arr($this->postXml($data, self::MCH_BASE_URL . '/pay/micropay'));
        if (!empty($json) && false === $this->_parseResult($json)) {
            return false;
        }
        return $json;
    }
961962
public function closeOrder($out_trade_no)
    {
        $pay = new Order($this->config->get());
        return $pay->close($out_trade_no);
    }
1215185
function ot_gv() {
    global $currencies;
    $this->code = 'ot_gv';
    $this->title = MODULE_ORDER_TOTAL_GV_TITLE;
    $this->header = MODULE_ORDER_TOTAL_GV_HEADER;
    $this->description = MODULE_ORDER_TOTAL_GV_DESCRIPTION;
    $this->user_prompt = MODULE_ORDER_TOTAL_GV_USER_PROMPT;
    $this->sort_order = MODULE_ORDER_TOTAL_GV_SORT_ORDER;
    $this->include_shipping = MODULE_ORDER_TOTAL_GV_INC_SHIPPING;
    $this->include_tax = MODULE_ORDER_TOTAL_GV_INC_TAX;
    $this->calculate_tax = MODULE_ORDER_TOTAL_GV_CALC_TAX;
    $this->credit_tax = MODULE_ORDER_TOTAL_GV_CREDIT_TAX;
    $this->tax_class  = MODULE_ORDER_TOTAL_GV_TAX_CLASS;
    $this->show_redeem_box = MODULE_ORDER_TOTAL_GV_REDEEM_BOX;
    $this->credit_class = true;
    if (!zen_not_null(ltrim($_SESSION['cot_gv'], ' 0')) || $_SESSION['cot_gv'] == '0') $_SESSION['cot_gv'] = '0.00';
    $this->checkbox = $this->user_prompt . '<input type="text" size="6" onkeyup="submitFunction()" name="cot_gv" value="' . number_format($_SESSION['cot_gv'], 2) . '" onfocus="if (this.value == \'' . number_format($_SESSION['cot_gv'], 2) . '\') this.value = \'\';" />' . ($this->user_has_gv_account($_SESSION['customer_id']) > 0 ? '<br />' . MODULE_ORDER_TOTAL_GV_USER_BALANCE . $currencies->format($this->user_has_gv_account($_SESSION['customer_id'])) : '');
    $this->output = array();
    if (IS_ADMIN_FLAG === true) {
      if ($this->include_tax == 'true' && $this->calculate_tax != "None") {
        $this->title .= '<span class="alert">' . MODULE_ORDER_TOTAL_GV_INCLUDE_ERROR . '</span>';
      }
    }
  }
1283116
public function handleAuthorize(string $authCode = null)
    {
        $params = [
            'component_appid' => $this->app['config']['app_id'],
            'authorization_code' => $authCode ?? $this->app['request']->get('auth_code'),
        ];

        return $this->httpPostJson('cgi-bin/component/api_query_auth', $params);
    }
976565
function DoVFTInquiry($ccno,
                          $amount,
                          $instnumber,
                          $vftcode) {

        $posnetRequest = new PosnetRequest();

        $posnetRequest->ccno = $ccno;
        $posnetRequest->amount = $amount;
        $posnetRequest->instnumber = $instnumber;
        $posnetRequest->vftcode = $vftcode;

        return $this->DoTran($posnetRequest, "vftinquiry");
    }
711874
public static function readTransaction($str_xml)
    {

        // Parser
        $parser = new PagSeguroXmlParser($str_xml);

        // <transaction>
        $data = $parser->getResult('transaction');

        $transaction = new PagSeguroTransaction();

        // <transaction> <lastEventDate>
        if (isset($data["lastEventDate"])) {
            $transaction->setLastEventDate($data["lastEventDate"]);
        }

        // <transaction> <date>
        if (isset($data["date"])) {
            $transaction->setDate($data["date"]);
        }

        // <transaction> <code>
        if (isset($data["code"])) {
            $transaction->setCode($data["code"]);
        }

        // <transaction> <reference>
        if (isset($data["reference"])) {
            $transaction->setReference($data["reference"]);
        }

        // <transaction> <recoveryCode>
        if (isset($data["recoveryCode"])) {
            $transaction->setRecoveryCode($data["recoveryCode"]);
        }

        // <transaction> <type>
        if (isset($data["type"])) {
            $transaction->setType(new PagSeguroTransactionType($data["type"]));
        }

        // <transaction> <status>
        if (isset($data["status"])) {
            $transaction->setStatus(new PagSeguroTransactionStatus($data["status"]));
        }

        // <transaction> <cancellationSource>
        if (isset($data["cancellationSource"])) {
            $transaction->setCancellationSource(
                new PagSeguroTransactionCancellationSource($data["cancellationSource"])
            );
        }

        if (isset($data["paymentMethod"]) && is_array($data["paymentMethod"])) {
            // <transaction> <paymentMethod>
            $paymentMethod = new PagSeguroPaymentMethod();

            // <transaction> <paymentMethod> <type>
            if (isset($data["paymentMethod"]['type'])) {
                $paymentMethod->setType(new PagSeguroPaymentMethodType($data["paymentMethod"]['type']));
            }

            // <transaction> <paymentMethod> <code>
            if (isset($data["paymentMethod"]['code'])) {
                $paymentMethod->setCode(new PagSeguroPaymentMethodCode($data["paymentMethod"]['code']));
            }

            $transaction->setPaymentMethod($paymentMethod);
        }

        // <transaction> <paymentLink>
        if (isset($data["paymentLink"])) {
            $transaction->setPaymentLink($data["paymentLink"]);
        }

        // <transaction> <grossAmount>
        if (isset($data["grossAmount"])) {
            $transaction->setGrossAmount($data["grossAmount"]);
        }

        // <transaction> <discountAmount>
        if (isset($data["discountAmount"])) {
            $transaction->setDiscountAmount($data["discountAmount"]);
        }

        // <transaction> <feeAmount>
        if (isset($data["feeAmount"])) {
            $transaction->setFeeAmount($data["feeAmount"]);
        }

        // <transaction> <netAmount>
        if (isset($data["netAmount"])) {
            $transaction->setNetAmount($data["netAmount"]);
        }

        //<transaction><escrowEndDate>
        if (isset($data["escrowEndDate"])) {
            $transaction->setEscrowEndDate($data["escrowEndDate"]);
        }

        // <transaction> <extraAmount>
        if (isset($data["extraAmount"])) {
            $transaction->setExtraAmount($data["extraAmount"]);
        }

        // <transaction> <installmentCount>
        if (isset($data["installmentCount"])) {
            $transaction->setInstallmentCount($data["installmentCount"]);
        }

        // <transaction> <creditorFees>
        if (isset($data["creditorFees"])) {
            $transaction->setCreditorFees(new PagSeguroTransactionCreditorFees($data["creditorFees"]));
        }

        //<transaction><operationalFeeAmount>
        if (isset($data["operationalFeeAmount"])) {
            $transaction->setOperationalFeeAmount($data["operationalFeeAmount"]);
        }

        //<transaction><installmentFeeAmount>
        if (isset($data["installmentFeeAmount"])) {
            $transaction->setInstallmentFeeAmount($data["installmentFeeAmount"]);
        }

        //<transaction><intermediationRateAmount>
        if (isset($data["intermediationRateAmount"])) {
            $transaction->setIntermediationRateAmount($data["intermediationRateAmount"]);
        }

        //<transaction><intermediationFeeAmount>
        if (isset($data["intermediationFeeAmount"])) {
            $transaction->setIntermediationFeeAmount($data["intermediationFeeAmount"]);
        }

        //<transaction><items>
        if (isset($data["items"]['item']) && is_array($data["items"]['item'])) {
            $items = array();
            $i = 0;

            if (isset($data["items"]['item'][0])) {
                foreach ($data["items"]['item'] as $key => $value) {
                    $item = self::parseTransactionItem($value);
                    $items[$i] = $item;
                    $i++;
                }
            } else {
                $items[0] = self::parseTransactionItem($data["items"]['item']);
            }

            // <transaction> <items>
            $transaction->setItems($items);
        }

        if (isset($data["sender"])) {
            // <transaction> <sender>
            $sender = new PagSeguroSender();

            // <transaction> <sender> <name>
            if (isset($data["sender"]["name"])) {
                $sender->setName($data["sender"]["name"]);
            }

            // <transaction> <sender> <email>
            if (isset($data["sender"]["email"])) {
                $sender->setEmail($data["sender"]["email"]);
            }

            if (isset($data["sender"]["phone"])) {
                // <transaction> <sender> <phone>
                $phone = new PagSeguroPhone();

                // <transaction> <sender> <phone> <areaCode>
                if (isset($data["sender"]["phone"]["areaCode"])) {
                    $phone->setAreaCode($data["sender"]["phone"]["areaCode"]);
                }

                // <transaction> <sender> <phone> <number>
                if (isset($data["sender"]["phone"]["number"])) {
                    $phone->setNumber($data["sender"]["phone"]["number"]);
                }

                $sender->setPhone($phone);
            }

            // <transaction><sender><documents>
            if (isset($data["sender"]['documents']) && is_array($data["sender"]['documents'])) {
                $documents = $data["sender"]['documents'];
                if (count($documents) > 0) {
                    foreach ($documents as $document) {
                        $sender->addDocument($document['type'], $document['value']);
                    }
                }
            }

            $transaction->setSender($sender);
        }

        if (isset($data["shipping"]) && is_array($data["shipping"])) {
            // <transaction> <shipping>
            $shipping = new PagSeguroShipping();

            // <transaction> <shipping> <type>
            if (isset($data["shipping"]["type"])) {
                $shipping->setType(new PagSeguroShippingType($data["shipping"]["type"]));
            }

            // <transaction> <shipping> <cost>
            if (isset($data["shipping"]["cost"])) {
                $shipping->setCost($data["shipping"]["cost"]);
            }

            if (isset($data["shipping"]["address"]) && is_array($data["shipping"]["address"])) {
                // <transaction> <shipping> <address>
                $address = new PagSeguroAddress();

                // <transaction> <shipping> <address> <street>
                if (isset($data["shipping"]["address"]["street"])) {
                    $address->setStreet($data["shipping"]["address"]["street"]);
                }

                // <transaction> <shipping> <address> <number>
                if (isset($data["shipping"]["address"]["number"])) {
                    $address->setNumber($data["shipping"]["address"]["number"]);
                }

                // <transaction> <shipping> <address> <complement>
                if (isset($data["shipping"]["address"]["complement"])) {
                    $address->setComplement($data["shipping"]["address"]["complement"]);
                }

                // <transaction> <shipping> <address> <city>
                if (isset($data["shipping"]["address"]["city"])) {
                    $address->setCity($data["shipping"]["address"]["city"]);
                }

                // <transaction> <shipping> <address> <state>
                if (isset($data["shipping"]["address"]["state"])) {
                    $address->setState($data["shipping"]["address"]["state"]);
                }

                // <transaction> <shipping> <address> <district>
                if (isset($data["shipping"]["address"]["district"])) {
                    $address->setDistrict($data["shipping"]["address"]["district"]);
                }

                // <transaction> <shipping> <address> <postalCode>
                if (isset($data["shipping"]["address"]["postalCode"])) {
                    $address->setPostalCode($data["shipping"]["address"]["postalCode"]);
                }

                // <transaction> <shipping> <address> <country>
                if (isset($data["shipping"]["address"]["country"])) {
                    $address->setCountry($data["shipping"]["address"]["country"]);
                }

                $shipping->setAddress($address);
            }

            // <transaction> <shipping>
            $transaction->setShipping($shipping);
        }

        return $transaction;
    }
472086
public function refundSet($out_trade_no, $refund_amount)
    {
        unset($this->commonParams['notify_url']);

        $this->commonParams['app_id']     = $this->appid;
        $this->commonParams['method']     = 'alipay.trade.refund';
        $this->commonParams['timestamp']  = date('Y-m-d H:i:s');

        $micro_time = explode(' ', microtime());

        $this->refundRequestParams['out_trade_no']    = $out_trade_no;
        $this->refundRequestParams['refund_amount']   = $refund_amount;
        $this->refundRequestParams['out_request_no']  = $micro_time[1] . ltrim($micro_time[0], '0.');
    }
265831
public function notice(Request $request, &$paymentId, &$money, &$message, &$payId)
    {
        $xml = $request->getRawBody();

        //如果返回成功则验证签名
        try {
            $params = $this->convertXmlToArray($xml);
            $paymentId = $params['out_trade_no'];
            $money = $params['total_fee'];
            $message = $params['return_code'];
            $payId = $params['transaction_id'];
            if ($params['return_code'] == 'SUCCESS') {
                if ($params['sign'] == $this->createSign($params)) {
                    echo '<xml>
  <return_code><![CDATA[SUCCESS]]></return_code>
  <return_msg><![CDATA[OK]]></return_msg>
</xml>';
                    return true;
                }
            }
        } catch (\Exception $e) {

        }
        echo '<xml>
  <return_code><![CDATA[FAIL]]></return_code>
  <return_msg><![CDATA[FAIL]]></return_msg>
</xml>';
        return false;
    }
1337566
public static final void checkTxAttrs(TransactionAttribute[] txAttrs,
                                          String[] methodNames, String[] methodSignatures,//PQ63130
                                          String[] checkedNames, String[] checkedSignatures,//PQ63130

                                          TransactionAttribute prescribedAttr)
    {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
        if (isTraceOn && tc.isEntryEnabled())
            Tr.entry(tc, "checkTxAttrs");
        for (int i = 0; i < methodNames.length; ++i) {
            for (int j = 0; j < checkedNames.length; ++j) {

                //PQ63130 added check of method signature
                if (((methodNames[i].equals(checkedNames[j])) && (methodSignatures[i].equals(checkedSignatures[j]))) | checkedNames[j].equals("*")) {

                    txAttrs[i] = prescribedAttr;
                    break;
                }
            }
        }

        if (isTraceOn && tc.isEntryEnabled())
            Tr.exit(tc, "checkTxAttrs");

    }
703290
public function deposit($card_id, $code = [])
    {
        if (!is_string($card_id) || !is_array($code)) {
            $this->setError('参数错误');

            return false;
        }

        $queryStr            = [];
        $queryStr['card_id'] = $card_id;
        $queryStr['code']    = $code;

        $this->apitype = 'card';
        $this->module  = 'code';
        $res           = $this->_post('deposit', $queryStr);

        return $res;
    }
893058
public function handleAutocomplete(Request $request, $auth_type, $count) {
    $results = [];
    //@TODO pass count to the actual fetchers
    //@TODO maybe refactor into plugins so others can write any other reconciliators
    //@TODO if so, we can query the plugins and show in the webform builder options
    // Get the typed string from the URL, if it exists.
    if ($input = $request->query->get('q')) {
      switch($auth_type) {
        case 'loc':  $results = $this->loc($input);
        break;
        case 'wikidata': $results = $this->wikidata($input);
        break;
      }


    }

    return new JsonResponse($results);
  }
64151
function _doCapt($oID, $amt = 0, $currency = 'USD') {
    global $db, $messageStack;
    $_POST['captamt'] = preg_replace('/[^0-9.%]/', '', $_POST['captamt']);

    //@TODO: Read current order status and determine best status to set this to
    $new_order_status = (int)MODULE_PAYMENT_LINKPOINT_API_ORDER_STATUS_ID;
    if ($new_order_status == 0) $new_order_status = 1;

    $proceedToCapture = true;
    $captureNote = strip_tags(zen_db_input($_POST['captnote']));
    if (isset($_POST['captconfirm']) && $_POST['captconfirm'] == 'on') {
    } else {
      $messageStack->add_session(MODULE_PAYMENT_LINKPOINT_API_TEXT_CAPTURE_CONFIRM_ERROR, 'error');
      $proceedToCapture = false;
    }

    $lp_trans_num = (isset($_POST['captauthid']) && $_POST['captauthid'] != '') ? strip_tags(zen_db_input($_POST['captauthid'])) : '';
    $sql = "select lp_trans_num, chargetotal from " . TABLE_LINKPOINT_API . " where order_id = " . (int)$oID . " and transaction_result = 'APPROVED' order by date_added";
    if ($lp_trans_num != '') $sql = "select lp_trans_num, chargetotal from " . TABLE_LINKPOINT_API . " where lp_trans_num = :trans_num: and transaction_result = 'APPROVED' order by date_added";
    $sql = $db->bindVars($sql, ':trans_num:', $lp_trans_num, 'string');
    $query = $db->Execute($sql);
    if ($query->RecordCount() < 1) {
      $messageStack->add_session(MODULE_PAYMENT_LINKPOINT_API_TEXT_NO_MATCHING_ORDER_FOUND, 'error');
      $proceedToCapture = false;
    }
    $captureAmt = (isset($_POST['captamt']) && $_POST['captamt'] != '') ? (float)strip_tags(zen_db_input($_POST['captamt'])) : $query->fields['chargetotal'];
    if (isset($_POST['btndocapture']) && $_POST['btndocapture'] == MODULE_PAYMENT_LINKPOINT_API_ENTRY_CAPTURE_BUTTON_TEXT) {
      if ($captureAmt == 0) {
        $messageStack->add_session(MODULE_PAYMENT_LINKPOINT_API_TEXT_INVALID_CAPTURE_AMOUNT, 'error');
        $proceedToCapture = false;
      }
    }
    /**
     * Submit capture request to Gateway
     */
    if ($proceedToCapture) {
      unset($myorder);
      $myorder["ordertype"] = 'POSTAUTH';
      $myorder["oid"] = $query->fields['lp_trans_num'];
      $myorder["chargetotal"] = number_format($captureAmt, 2, '.', '');
      $myorder["comments"]  = htmlentities($captureNote, ENT_QUOTES, 'UTF-8');

      $result = $this->_sendRequest($myorder);
      $response_alert = $result['r_approved'] . ' ' . $result['r_error'] . ($this->commError == '' ? '' : ' Communications Error - Please notify webmaster.');
      $failure = ($result["r_approved"] != "APPROVED");
      if ($failure) {
        $messageStack->add_session($response_alert, 'error');
      } else {
        // Success, so save the results
        $this->_updateOrderStatus($oID, $new_order_status, 'FUNDS COLLECTED. Auth Code: ' . substr($result['r_code'], 0, 6) . ' - ' . 'Trans ID: ' . $result['r_tdate'] . "\n" . ' Amount: ' . number_format($captureAmt, 2) . "\n" . $captureNote);
        $messageStack->add_session(sprintf(MODULE_PAYMENT_LINKPOINT_API_TEXT_CAPT_INITIATED, $captureAmt, $result['r_tdate'], substr($result['r_code'], 0, 6)), 'success');
        return true;
      }
    }
    return false;
  }
1161053
public function createJsBizPackage($totalFee, $outTradeNo, $orderName, $notifyUrl, $wapUrl, $wapName)
    {
        $config = array(
            'mch_id' => $this->mchid,
            'appid' => $this->appid,
            'key' => $this->apiKey,
        );
        $scene_info = array(
            'h5_info' =>array(
                'type'=>'Wap',
                'wap_url'=>$wapUrl,
                'wap_name'=>$wapName,
            )
        );
        $unified = array(
            'appid' => $config['appid'],
            'attach' => 'pay',             //商家数据包，原样返回，如果填写中文，请注意转换为utf-8
            'body' => $orderName,
            'mch_id' => $config['mch_id'],
            'nonce_str' => self::createNonceStr(),
            'notify_url' => $notifyUrl,
            'out_trade_no' => $outTradeNo,
            'spbill_create_ip' => $_SERVER['REMOTE_ADDR'],
            'total_fee' => intval($totalFee * 100),       //单位 转为分
            'trade_type' => 'MWEB',
            'scene_info'=>json_encode($scene_info)
        );
        $unified['sign'] = self::getSign($unified, $config['key']);
        $responseXml = self::curlPost('https://api.mch.weixin.qq.com/pay/unifiedorder', self::arrayToXml($unified));
        $unifiedOrder = simplexml_load_string($responseXml, 'SimpleXMLElement', LIBXML_NOCDATA);
        if ($unifiedOrder->return_code != 'SUCCESS') {
            die($unifiedOrder->return_msg);
        }
        if($unifiedOrder->mweb_url){
            return $unifiedOrder->mweb_url;
        }
        exit('error');
    }
305905
function pre_confirmation_check($order_total) {
    global $order, $currencies, $messageStack;
    // clean out negative values and strip common currency symbols
    $_SESSION['cot_gv'] = preg_replace('/[^0-9.%]/', '', $_SESSION['cot_gv']);
    $_SESSION['cot_gv'] = abs($_SESSION['cot_gv']);

    if ($_SESSION['cot_gv'] > 0) {
      // if cot_gv value contains any nonvalid characters, throw error
      if (preg_match('/[^0-9\.]/', trim($_SESSION['cot_gv']))) {
        $messageStack->add_session('checkout_payment', TEXT_INVALID_REDEEM_AMOUNT, error);
        zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
      }
      // if requested redemption amount is greater than value of credits on account, throw error
      if ($_SESSION['cot_gv'] > $currencies->value($this->user_has_gv_account($_SESSION['customer_id']))) {
        $messageStack->add_session('checkout_payment', TEXT_INVALID_REDEEM_AMOUNT, error);
        zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
      }
      $od_amount = $this->calculate_deductions($order_total);
      $order->info['total'] = $order->info['total'] - $od_amount['total'];
      if (DISPLAY_PRICE_WITH_TAX != 'true') {
        $order->info['total'] -= $tax;
      }
      return $od_amount['total'] + $od_amount['tax'];
    }
    return 0;
  }
1131785
function nullify($authorizationCode, $authorizedAmount, $buyOrder, $nullifyAmount, $commercecode) {

        try {
            $nullificationInput = new nullificationInput();

            /** Código de autorización de la transacción que se requiere anular. Para el caso que se esté anulando una transacción de captura en línea,
             *  este código corresponde al código de autorización de la captura */
            $nullificationInput->authorizationCode = $authorizationCode; // string

            /** Monto autorizado de la transacción que se requiere anular.
             * Para el caso que se esté anulando una transacción de captura en línea,
             * este monto corresponde al monto de la captura */
            $nullificationInput->authorizedAmount = $authorizedAmount; // decimal

            $nullificationInput->buyOrder = $buyOrder; // string

            if ($commercecode == null){
                $nullificationInput->commerceId = floatval($this->config->getCommerceCode());
            } else {
                $nullificationInput->commerceId = floatval($commercecode);
            }

            $nullificationInput->nullifyAmount = $nullifyAmount;

            $nullifyResponse = $this->_nullify(
                    array("nullificationInput" => $nullificationInput));

            /** Validación de firma del requerimiento de respuesta enviado por Webpay */
            $xmlResponse = $this->soapClient->__getLastResponse();
            $soapValidation = new SoapValidation($xmlResponse, $this->config->getWebpayCert());
            $validationResult = $soapValidation->getValidationResult();

            /** Valida conexion a Webpay */
            if ($validationResult === TRUE) {

                $nullificationOutput = $nullifyResponse->return;
                return $nullificationOutput;
            } else {
                $error["error"] = "Error validando conexión a Webpay";
                $error["error"] = "No se pudo completar la conexión con Webpay";
            }

        } catch (\Exception $e) {

            $error["error"] = "Error conectando a Webpay (Verificar que la informaci&oacute;n del certificado sea correcta)";

            $replaceArray = array('<!--' => '', '-->' => '');
            $error["detail"] = str_replace(array_keys($replaceArray), array_values($replaceArray), $e->getMessage());
        }

        return $error;
    }
569120
public function closeOrder($out_trade_no)
    {
        $data = array('out_trade_no' => $out_trade_no);
        $result = $this->getArrayResult($data, self::MCH_BASE_URL . '/pay/closeorder');
        if (false === $this->_parseResult($result)) {
            return false;
        }
        return ($result['return_code'] === 'SUCCESS');
    }
1146949
private function ValidateMerchantTradeNo()
        {
            $Name = 'MerchantTradeNo'; // 參數名稱
            $Value = $this->PostParams['MerchantTradeNo']; // 參數內容
            $AllowEmpty = false; // 是否允許空值

            if (empty($Value)) {
                // 是否允許空值
                $this->IsAllowEmpty($Name, $AllowEmpty);
            } else {
                // 格式檢查
                $this->IsValidFormat($Name, '/^[a-zA-Z0-9]{1,20}$/', $Value);
            }
        }