From 8d05867bb65e3ab357d6945693cd71070f925111 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=90=8D?= <邮箱> Date: Thu, 3 Aug 2023 09:56:02 +0800 Subject: [PATCH] test --- .../plugins/payment/dalianpay/demo/dalianpay.php | 15 +++- mobile/plugins/payment/wxpay.php | 99 ---------------------- 2 files changed, 14 insertions(+), 100 deletions(-) diff --git a/mobile/plugins/payment/dalianpay/demo/dalianpay.php b/mobile/plugins/payment/dalianpay/demo/dalianpay.php index 2b1c564..102082d 100644 --- a/mobile/plugins/payment/dalianpay/demo/dalianpay.php +++ b/mobile/plugins/payment/dalianpay/demo/dalianpay.php @@ -28,9 +28,13 @@ class dalianpay{ // $reqsn = $_GET['reqsn']; // $trxamt = $_GET['trxamt']; - $openid = $this->decrypt($openid_crypt); + // $openid = $this->decrypt($openid_crypt); + $openid = $openid_crypt; $reqsn = $order_sn; $trxamt = $order_amount; + + $string = $openid . ' + ' . $reqsn . ' + ' . $trxamt; + echo $string; // var_dump($openid); // var_dump($reqsn); @@ -160,6 +164,15 @@ class dalianpay{ // exit; } } + +echo "hi there....."; +$new_plugin = new dalianpay(); +$openid_crypt = 'oCTanxBeiVFWlekJT_GiPZM2UiGY'; +$order_sn = '2023080355426'; +$order_amount = '600'; +$response_data = $new_plugin->pay(); +echo $response_data; + ?> diff --git a/mobile/plugins/payment/wxpay.php b/mobile/plugins/payment/wxpay.php index 661562f..0be8c66 100755 --- a/mobile/plugins/payment/wxpay.php +++ b/mobile/plugins/payment/wxpay.php @@ -6,105 +6,6 @@ class wxpay private $parameters; // cft 参数 private $payment; // 配置信息 - - /** - * 调用支付 - */ - public function pay() - { - // 统一支付接口Demo - - // 加载基础类 - require_once('./library/Base.php'); - $Base = new Base(); - - // 获取配置信息 - $config = $Base->getConfig(); - // var_dump('
', $config);
-
-        // 接口URL(测试)
-        $api_url = $config['pay_url'];
-
-        // 加个body字段传中文试试
-
-        // 组装交易报文
-        $reqsn_prefix = date('Ymd');
-        // var_dump("uniq_id(reqsn)");
-        // echo "\r\n";
-        // var_dump(uniqid($reqsn_prefix));
-        $trade_data = array(
-            'orgid' => $config['org_num'],
-            'cusid' => $config['cusid'],
-            'branchno' => $config['branchno'],
-            'termcode' => $config['termcode'],
-            'version' => $config['version'],
-            'trxamt' => '1',
-            'reqsn' => uniqid($reqsn_prefix),
-            'producp' => 'JX0002',
-            'transtype' => 'JSP511',
-            'paytype' => 'W01',
-            'randomstr' => md5( uniqid() ),
-            'body' => 'pages',
-            "acct" => $this->parameters["openid"] # 不知道好不好用...
-        );
-
-            // 生成签名
-        $sign = $Base->Crypt->makeSign($trade_data);
-        if($sign === false)
-        {
-            // echo $Base->Crypt->err_msg;
-            die();
-        }
-        // echo "\r\n";
-        // echo "[sign]: {$sign}";
-        // die();
-
-        // 加密交易报文
-        $crypted_trade_data = $Base->Crypt->encryptTradeData($trade_data);
-        if($crypted_trade_data === false)
-        {
-            // echo $Base->Crypt->err_msg;
-            die();
-        }
-        // echo "\r\n";
-        // echo "[crypted message]: {$crypted_trade_data}";
-        // die();
-
-        // 发送报文
-        // echo "\r\n";
-        // var_dump($api_url);
-        $response = $Base->Request->send($api_url, $crypted_trade_data, $sign);
-        if($response === false)
-        {
-            // echo $Base->Request->err_msg;
-            die();
-        }
-
-        // echo "\r\n";
-        // echo "[response message]: {$response}";
-
-        // 解析响应报文
-        $response = json_decode($response, true);
-        $response_data_crypted = $response['data'];
-        $response_sign = $response['sign'];
-        // echo "\r\n";
-        // echo "[response sign]: {$response_sign}";
-        // echo "\r\n";
-        // echo "[response data (ciphertext)]: {$response_data_crypted}";
-
-        // 解密响应密文
-        $response_data = $Base->Crypt->decryptTradeData($response_data_crypted);
-        if($response_data === false)
-        {
-            // echo $Base->Crypt->err_msg;
-            die();
-        }
-        // echo "\r\n";
-        // echo "[response data(clear text)]: {$response_data}";
-        echo $response_data;
-        // die();
-    }
-
     /**
      * 获取openid
      */