diff --git a/webapp/controller/MerchantController.class.php b/webapp/controller/MerchantController.class.php
new file mode 100644
index 0000000..a4d4dd8
--- /dev/null
+++ b/webapp/controller/MerchantController.class.php
@@ -0,0 +1,99 @@
+ self::MER_NO,
+ 'SignInfo' => '',
+ 'PayType' => 'WXZF_ONLINE',
+ 'RandomStr' => $orderid,
+ 'ChannelNo' => '235009412',
+ 'MerchantInfo' => array(
+ 'MerName' => '上海画石网络科技有限公司',
+ 'ShortName' => '画石网络',
+ 'ServicePhone' => '17891958491',
+ 'Business' => '203',
+ 'SubAppID' => 'wx7d6509053659d9ed'
+ )
+ );
+ $params['SignInfo'] = $this->_reaEncode(
+ 'MerNo=' . $params['MerNo'] . '&' .
+ 'PayType=' . $params['PayType'] . '&' .
+ 'RandomStr=' . $params['RandomStr'] .
+ ''
+ );
+ $xml_txt = phpcommon\objectToXml($params, '');
+ $xml_txt = str_replace('', '', $xml_txt);
+ echo $xml_txt;
+ $requestDomain = base64_encode($xml_txt);
+ $response = '';
+ if (phpcommon\HttpClient::post('https://gwapi.yemadai.com/scanpay/merchantIn',
+ 'requestDomain='. urlencode($requestDomain),
+ $response)
+ ) {
+ /* echo json_encode(array(
+ 'errcode' => 101,
+ 'errmsg' => '交易失败:' . $response,
+ ));
+ die();*/
+ }
+ echo $response;
+ var_dump(base64_decode($response));
+ }
+
+ private function merchantInQuery()
+ {
+ $orderid = uniqid();
+ if (empty($orderid)) {
+ die();
+ }
+ $params = array(
+ 'MerNo' => self::MER_NO,
+ 'CompanyNo' => 'sweep-f4fea613fec043f8bd81e9b70375e364',
+ 'SignInfo' => '',
+ 'PayType' => 'WXZF_ONLINE',
+ 'RandomStr' => $orderid,
+ );
+ $params['SignInfo'] = $this->_reaEncode(
+ 'MerNo=' . $params['MerNo'] . '&' .
+ 'CompanyNo=' . $params['CompanyNo'] . '&' .
+ 'PayType=' . $params['PayType'] . '&' .
+ 'RandomStr=' . $params['RandomStr'] .
+ ''
+ );
+ $xml_txt = phpcommon\objectToXml($params, '');
+ $xml_txt = str_replace('', '', $xml_txt);
+ $requestDomain = base64_encode($xml_txt);
+ $response = '';
+ if (phpcommon\HttpClient::post('https://gwapi.yemadai.com/scanpay/merchantInQuery',
+ 'requestDomain='. urlencode($requestDomain),
+ $response)
+ ) {
+ /* echo json_encode(array(
+ 'errcode' => 101,
+ 'errmsg' => '交易失败:' . $response,
+ ));
+ die();*/
+ }
+ var_dump(base64_decode($response));
+ }
+
+}
diff --git a/webapp/controller/PayController.class.php b/webapp/controller/PayController.class.php
index 437d89b..f1fd113 100644
--- a/webapp/controller/PayController.class.php
+++ b/webapp/controller/PayController.class.php
@@ -104,9 +104,9 @@ class PayController {
# echo $xml_txt;
$requestDomain = base64_encode($xml_txt);
$response = '';
- if (phpcommon\HttpClient::post(self::SCAN_PAY_API_URL,
- 'requestDomain='. urlencode($requestDomain),
- $response)
+ if (!phpcommon\HttpClient::post(self::SCAN_PAY_API_URL,
+ 'requestDomain='. urlencode($requestDomain),
+ $response)
) {
echo json_encode(array(
'errcode' => 101,
@@ -133,86 +133,4 @@ class PayController {
}
}
- private function merchantIn()
- {
- $orderid = $this->getOrderId();
- if (empty($orderid)) {
- die();
- }
- $params = array(
- 'MerNo' => self::MER_NO,
- 'SignInfo' => '',
- 'PayType' => 'WXZF_ONLINE',
- 'RandomStr' => $orderid,
- 'ChannelNo' => '235009412',
- 'MerchantInfo' => array(
- 'MerName' => '上海画石网络科技有限公司',
- 'ShortName' => '画石网络',
- 'ServicePhone' => '17891958491',
- 'Business' => '203',
- 'SubAppID' => 'wx7d6509053659d9ed'
- )
- );
- $params['SignInfo'] = $this->_reaEncode(
- 'MerNo=' . $params['MerNo'] . '&' .
- 'PayType=' . $params['PayType'] . '&' .
- 'RandomStr=' . $params['RandomStr'] .
- ''
- );
- $xml_txt = phpcommon\objectToXml($params, '');
- $xml_txt = str_replace('', '', $xml_txt);
- echo $xml_txt;
- $requestDomain = base64_encode($xml_txt);
- $response = '';
- if (phpcommon\HttpClient::post('https://gwapi.yemadai.com/scanpay/merchantIn',
- 'requestDomain='. urlencode($requestDomain),
- $response)
- ) {
- /* echo json_encode(array(
- 'errcode' => 101,
- 'errmsg' => '交易失败:' . $response,
- ));
- die();*/
- }
- echo $response;
- var_dump(base64_decode($response));
- }
-
- private function merchantInQuery()
- {
- $orderid = $this->getOrderId();
- if (empty($orderid)) {
- die();
- }
- $params = array(
- 'MerNo' => self::MER_NO,
- 'CompanyNo' => 'sweep-f4fea613fec043f8bd81e9b70375e364',
- 'SignInfo' => '',
- 'PayType' => 'WXZF_ONLINE',
- 'RandomStr' => $orderid,
- );
- $params['SignInfo'] = $this->_reaEncode(
- 'MerNo=' . $params['MerNo'] . '&' .
- 'CompanyNo=' . $params['CompanyNo'] . '&' .
- 'PayType=' . $params['PayType'] . '&' .
- 'RandomStr=' . $params['RandomStr'] .
- ''
- );
- $xml_txt = phpcommon\objectToXml($params, '');
- $xml_txt = str_replace('', '', $xml_txt);
- $requestDomain = base64_encode($xml_txt);
- $response = '';
- if (phpcommon\HttpClient::post('https://gwapi.yemadai.com/scanpay/merchantInQuery',
- 'requestDomain='. urlencode($requestDomain),
- $response)
- ) {
- /* echo json_encode(array(
- 'errcode' => 101,
- 'errmsg' => '交易失败:' . $response,
- ));
- die();*/
- }
- var_dump(base64_decode($response));
- }
-
}