function get_auth_dbcurlenc($MerchantID, $TerminalID, $lidm, $purchAmt, $txType, $Option, $Key, $storeName, $AuthResURL, $billShortDesc, $note, $InMac, $debug) { $encStr = "MerchantID=" . $MerchantID . "&" . "TerminalID=" . $TerminalID . "&" . "lidm=" . $lidm . "&" . "purchAmt=" . $purchAmt . "&" . "txType=" . $txType . "&" . "InMac=" . $InMac . "&" . "AuthResURL=" . $AuthResURL . "&" . "billShortDesc=" . $billShortDesc . "&" . "note=" . $note . "&" . "storeName=" . $storeName; $URLEnc = DESMAC($encStr, $Key, $debug); return $URLEnc; }
/** * 取得壓碼值 * * @param key * 金鑰 * @return * @author Edward Tien */ function getMacValue($key) { $sb; if ($this->getMerId() == 0) { $sb = $sb . "merId=" . "" . "&"; } else { $sb = $sb . "merId=" . $this->getMerId() . "&"; } $sb = $sb . "lidm=" . $this->defaultString($this->getLidm(), "") . "&"; $sb = $sb . "purchAmt=" . $this->defaultString($this->getPurchAmt(), "") . "&"; $sb = $sb . "xid=" . $this->defaultString($this->getXid(), "") . "&"; $sb = $sb . "respCode=" . $this->defaultString($this->getRespCode(), "") . "&"; $sb = $sb . "respMsg=" . $this->defaultString($this->getRespMsg(), "") . "&"; $sb = $sb . "respTime=" . $this->defaultString($this->getRespTime(), "") . "&"; $sb = $sb . "requestTime=" . $this->defaultString($this->getRequestTime(), "") . "&"; $sb = $sb . "orderStatus=" . $this->defaultString($this->getOrderStatus(), "") . "&"; $sb = $sb . "traceNumber=" . $this->defaultString($this->getTraceNumber(), "") . "&"; $sb = $sb . "traceTime=" . $this->defaultString($this->getTraceTime(), "") . "&"; $sb = $sb . "qid=" . $this->defaultString($this->getQid(), "") . "&"; $sb = $sb . "settleAmount=" . $this->defaultString($this->getSettleAmount(), "") . "&"; $sb = $sb . "settleCurrency=" . $this->defaultString($this->getSettleCurrency(), "") . "&"; $sb = $sb . "settleDate=" . $this->defaultString($this->getSettleDate(), "") . "&"; $sb = $sb . "exchangeRate=" . $this->defaultString($this->getExchangeRate(), "") . "&"; $sb = $sb . "exchangeDate=" . $this->defaultString($this->getExchangeDate(), "") . "&"; $sb = $sb . "reserved=" . $this->defaultString($this->getReserved(), "") . "&"; $debug = 0; //1 debug ;0 NotDebug if ($this->isDebug) { $debug = 0; } //$sb='merId=&lidm=1234567890&purchAmt=&xid=&respCode=&respMsg=&respTime=&requestTime=&orderStatus=&traceNumber=&traceTime=&qid=&settleAmount=&settleCurrency=&settleDate=&exchangeRate=&exchangeDate=&reserved=&'; //$key = 'O698H1WGVSDYLqJFRuwCwxJa'; $sbInMAc = DESMAC($sb, $key, $debug); $sbInMAc = substr($sbInMAc, -48, 48); if ($this->isDebug) { echo "<BR/>[壓碼字串]sb:<BR/>" . $sb; echo "<BR/>[壓碼鍵值]key:<BR/>" . $key; echo "<BR/>[壓碼結果]sbInMAc:<BR/>" . $sbInMAc . "<hr/>"; } return $sbInMAc; }