123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- <?php
- date_default_timezone_set('Asia/Shanghai');
- header('Content-type:text/html;charset=utf-8');
- require './class/common.php';
- require './class/WechatPay.php';
- class Test
- {
-
- public function orderPay()
- {
- $client = new WechatPay;
-
- $client->body = array(
- 'orderCode' => 'Y20181204170925675836',
- 'totalAmount' => '000000000101',
- 'subject' => '1.01商品',
- 'body' => '1.01商品',
- 'payMode' => 'sand_wx',
- 'payExtra' => array(
- 'subAppid' => 'wx86466ERH8461',
- 'userId' => 'oEl4G1XFFERHIHSXS63P-_09y',
- ),
- 'clientIp' => '127.0.0.1',
- 'notifyUrl' => 'http://192.168.22.171/sandpay-qr-phpdemo.bak',
- 'frontUrl' => 'http://192.168.22.171/sandpay-qr-phpdemo.bak',
- );
-
- $ret = $client->request('orderPay');
- echo '<pre>';
- print_r($ret);
- echo '</pre>';
- }
-
- public function orderQuery()
- {
- $client = new WechatPay;
-
- $client->body = array(
- 'orderCode' => '2017091551423473',
- 'extend' => ''
- );
-
- $ret = $client->request('orderQuery');
- echo '<pre>';
- print_r($ret);
- echo '</pre>';
- }
-
- public function orderRefund()
- {
- $client = new WechatPay;
-
- $client->body = array(
- 'orderCode' => 'Y20181204170925675836',
- 'oriOrderCode' => '2017091551421977',
- 'refundAmount' => '000000000012',
- 'refundMarketAmount' => '000000000012',
- 'notifyUrl' => 'http://192.168.22.171/sandpay-qr-phpdemo.bak/test/dist/notifyUrl.php',
- 'refundReason' => 'test',
- 'extend' => ''
- );
-
- $ret = $client->request('orderRefund');
- echo '<pre>';
- print_r($ret);
- echo '</pre>';
- }
-
- public function notify()
- {
-
- $client = new WechatPay;
- $sign = $_POST['sign'];
- $data = stripslashes($_POST['data']);
-
- try {
- $verifyFlag = $client->verify($data, $sign);
- if (!$verifyFlag) throw new Exception('签名失败');
- } catch (\Exception $e) {
- exit('签名失败');
- }
-
- echo '<pre>';
- print_r($data);
- echo '</pre>';
- }
-
- public function clearfileDownload()
- {
-
- $client = new WechatPay;
-
- $client->body = array(
- 'clearDate' => '20200611',
- 'fileType' => '1',
- 'extend' => ''
- );
-
- $ret = $client->request('clearfileDownload');
- echo '<pre>';
- print_r($ret);
- echo '</pre>';
- }
- }
- $test = new Test();
- $test->clearfileDownload();
|