Issues (42)

example/Wechat/MiniTest.php (1 issue)

Labels
Severity
1
<?php
2
include_once '../../vendor/autoload.php';
3
4
use tinymeng\Chinaums\Factory;
5
6
date_default_timezone_set('PRC');
7
8
$config = include_once '../../config/chinaums.php';
9
10
$data = [];
11
// 报文请求时间
12
$data['requestTimestamp'] = date("YmdHis", time());
13
// 订单号
14
$data['merOrderId'] = '33XF'.time() . uniqid();
15
// 业务类型 机构商户号 MINIDEFAULT|QRPAYDEFAULT|YUEDANDEFAULT
16
$data['instMid'] = 'MINIDEFAULT';
17
 // 订单描述 展示在支付截图中
18
$data['orderDesc'] = '账单描述';
19
// 支付总金额
20
$data['totalAmount'] = 2; 
21
// 微信必填
22
$data['subAppId'] = 'wxca3a56d63895b431';  
23
// 微信必填  前端获取用户的openid 传给后台
24
$data['subOpenId'] = 'o4Sic5HPuB3j-LmnQTVIC4G_oYqY';
25
$data['tradeType'] = 'JSAPI';
26
27
//分账
28
// $subOrders = [];
29
// $sub['totalAmount'] = 1;      // 支付子金额
30
// $sub['mid'] = "898127210280001";      //
31
// $sub1['totalAmount'] = 1;      // 支付子金额
32
// $sub1['mid'] = "988460101800201";      //
33
// $subOrders[] = $sub;
34
// $subOrders[] = $sub1;
35
// $data['divisionFlag'] = 'true'; //分账标识
36
// $data['subOrders'] = $subOrders;      //
37
38
// 使用方法1
39
Factory::config($config);
40
$response = Factory::Wechat()->mini($data);
41
echo 'response:' . $response . PHP_EOL;
0 ignored issues
show
Are you sure $response of type tinymeng\Chinaums\Service\Alipay\Mini can be used in concatenation? Consider adding a __toString()-method. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

41
echo 'response:' . /** @scrutinizer ignore-type */ $response . PHP_EOL;
Loading history...
42
43
44
// 使用方法2
45
// Factory::config($config);
46
// $response = Factory::Wechat()->pay($data);
47
// echo 'response:' . $response . PHP_EOL;
48