Skip to content

Commit

Permalink
Release v3.3.0 (#757)
Browse files Browse the repository at this point in the history
  • Loading branch information
yansongda committed May 21, 2023
1 parent 471c65a commit ead4d7e
Show file tree
Hide file tree
Showing 20 changed files with 503 additions and 397 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## TBD-v3.3.0
## v3.3.0

### added

Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ yansongda/pay 100% 兼容 支付宝/微信/银联 所有功能(包括服务商
- H5 支付
- 扫码支付
- APP 支付
- 刷卡支付
- ...
- ~~刷卡支付,微信v3版暂不支持,计划后续内置支持v2版,或直接使用 Pay v2 版本~~
- ~~普通红包,微信v3版暂不支持,计划后续内置支持v2版,或直接使用 Pay v2 版本~~
- ~~分裂红包,微信v3版暂不支持,计划后续内置支持v2版,或直接使用 Pay v2 版本~~

Expand All @@ -88,7 +88,7 @@ yansongda/pay 100% 兼容 支付宝/微信/银联 所有功能(包括服务商

## 安装
```shell
composer require yansongda/pay:~3.2.0 -vvv
composer require yansongda/pay:~3.3.0 -vvv
```

## 深情一撇
Expand Down Expand Up @@ -197,7 +197,9 @@ class WechatController
'default' => [
// 必填-商户号
'mch_id' => '',
// 必填-商户秘钥
// 选填-v2商户私钥
'mch_secret_key_v2' => '',
// 必填-v3商户秘钥
'mch_secret_key' => '',
// 必填-商户私钥 字符串或路径
'mch_secret_cert' => '',
Expand Down
4 changes: 2 additions & 2 deletions web/docs/v3/alipay/find.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Pay::config($this->config);
$order = [
'out_trade_no' => '1514027114',
'out_request_no' => '1514027114',
'_type' => 'refund',
'_action' => 'refund',
];

$result = Pay::alipay()->find($order);
Expand All @@ -46,7 +46,7 @@ Pay::config($this->config);

$order = [
'out_biz_no' => '202209032319',
'_type' => 'transfer'
'_action' => 'transfer'
];

$result = Pay::alipay()->find($order);
Expand Down
2 changes: 1 addition & 1 deletion web/docs/v3/kernel/rocket.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ yansongda/pay 将 `输入参数`、`请求`、`原始响应`、`最终响应`
[
'out_trade_no' => '1514027114',
'out_request_no' => '1514027114',
'_type' => 'refund',
'_action' => 'refund',
];
```

Expand Down
4 changes: 3 additions & 1 deletion web/docs/v3/quick-start/init.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ $config = [
// 必填-商户号,服务商模式下为服务商商户号
// 可在 https://pay.weixin.qq.com/ 账户中心->商户信息 查看
'mch_id' => '',
// 必填-商户秘钥
// 选填-v2商户私钥
'mch_secret_key_v2' => '',
// 必填-v3 商户秘钥
// 即 API v3 密钥(32字节,形如md5值),可在 账户中心->API安全 中设置
'mch_secret_key' => '',
// 必填-商户私钥 字符串或路径
Expand Down
14 changes: 7 additions & 7 deletions web/docs/v3/quick-start/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@
### hyperf/laravel 用户

```shell
composer require yansongda/pay:~3.2.0 -vvv
composer require yansongda/pay:~3.3.0 -vvv
composer require guzzlehttp/guzzle:^7.0 # 默认情况下,此包框架已自带,无需额外安装
```

### 其它框架/无框架 用户

```shell
composer require yansongda/pay:~3.2.0 -vvv
composer require yansongda/pay:~3.3.0 -vvv
composer require guzzlehttp/guzzle:^7.0
composer require php-di/php-di -W
composer require hyperf/pimple
```

## 详细安装介绍

```shell
composer require yansongda/pay:~3.2.0 -vvv
composer require yansongda/pay:~3.3.0 -vvv
```

由于 `yansongda/pay` 支持 PSR2、PSR3、PSR4、PSR7、PSR11、PSR14、PSR18 等各项标准,因此这里额外介绍下 PSR-11、PSR-18 的安装与使用。
Expand All @@ -39,7 +39,7 @@ composer require yansongda/pay:~3.2.0 -vvv

1、hyperf/laravel 用户直接忽略此部分内容;

2、其它用户(包括 thinkphp 用户)在安装完 `Pay` 后直接无脑 `composer require php-di/php-di` 即可
2、其它用户(包括 thinkphp 用户)在安装完 `Pay` 后直接无脑 `composer require hyperf/pimple` 即可
:::

#### hyperf/laravel 用户
Expand All @@ -48,10 +48,10 @@ composer require yansongda/pay:~3.2.0 -vvv

#### 其它框架/无框架 用户

如果您不想操心那么多,SDK 自带了一套开箱即用的 Container,但仍然需要手动安装 php-di:
如果您不想操心那么多,SDK 自带了一套开箱即用的 Container,但仍然需要手动安装 container:

```shell
composer require php-di/php-di
composer require hyperf/pimple
```


Expand Down
8 changes: 4 additions & 4 deletions web/docs/v3/quick-start/unipay.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ $result = Pay::unipay()->scan([
'txnTime' => date('YmdHis'),
'txnAmt' => 1,
'orderId' => 'scan'.date('YmdHis'),
// '_type' => 'pre_auth', // 预授权
// '_type' => 'pre_order', // 统一下单
// '_type' => 'fee', // 缴费二维码
// '_action' => 'pre_auth', // 预授权
// '_action' => 'pre_order', // 统一下单
// '_action' => 'fee', // 缴费二维码
]);

return $result->qrCode; // 二维码 url
Expand All @@ -53,6 +53,6 @@ $result = Pay::unipay()->pos([
'txnTime' => date('YmdHis'),
'txnAmt' => 1,
'orderId' => 'pos'.date('YmdHis'),
// '_type' => 'pre_auth', // 预授权
// '_action' => 'pre_auth', // 预授权
]);
```
16 changes: 13 additions & 3 deletions web/docs/v3/quick-start/wechat.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,19 @@ $result = Pay::wechat()->transfer($order);

## 刷卡支付(付款码,被扫码)

:::warning
微信支付 v3 版 api 并不支持刷卡支付,后续将接入微信支付 v2 版 API,敬请期待。如果确实有此需求,可以使用 [Pay 的 v2 版](/docs/v2/wechat/)
:::
```php
Pay::config($config);

$order = [
'out_trade_no' => time().'',
'body' => 'subject-测试',
'total_fee' => 1,
'spbill_create_ip' => '1.2.4.8',
'auth_code' => '134567890123456789',
];

$result = Pay::wechat()->pos($order);
```

## 普通红包

Expand Down
1 change: 1 addition & 0 deletions web/docs/v3/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ exports = module.exports = [
text: '升级指南',
collapsible: true,
items: [
{ text: 'v3.3 升级指南', link: '/docs/v3/upgrade/v3.3'},
{ text: 'v3.2 升级指南', link: '/docs/v3/upgrade/v3.2'},
{ text: 'v3.1 升级指南', link: '/docs/v3/upgrade/v3.1'},
{ text: 'v3.0 升级指南', link: '/docs/v3/upgrade/v3.0'}
Expand Down
2 changes: 1 addition & 1 deletion web/docs/v3/unipay/cancel.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ $order = [
'txnAmt' => 1,
'orderId' => 'cancel'.date('YmdHis'),
'origQryId' => '062209121414535249018',
'_type' => 'qr_code',
'_action' => 'qr_code',
];

$result = Pay::unipay()->cancel($order);
Expand Down
2 changes: 1 addition & 1 deletion web/docs/v3/unipay/find.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Pay::config($this->config);
$order = [
'txnTime' => '20220911041647',
'orderId' => 'pay20220911041647',
'_type' => 'qr_code',
'_action' => 'qr_code',
];

$result = Pay::unipay()->find($order);
Expand Down
6 changes: 3 additions & 3 deletions web/docs/v3/unipay/pay.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ $result = Pay::unipay()->scan([
'txnTime' => date('YmdHis'),
'txnAmt' => 1,
'orderId' => 'scan'.date('YmdHis'),
// '_type' => 'pre_auth', // 预授权
// '_type' => 'pre_order', // 统一下单
// '_type' => 'fee', // 缴费二维码
// '_action' => 'pre_auth', // 预授权
// '_action' => 'pre_order', // 统一下单
// '_action' => 'fee', // 缴费二维码
]);

return $result->qrCode; // 二维码 url
Expand Down
2 changes: 1 addition & 1 deletion web/docs/v3/unipay/refund.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ $result = Pay::unipay()->refund([
'txnAmt' => 1,
'orderId' => 'refund'.date('YmdHis'),
'origQryId' => '392209121420295251518',
'_type' => 'qr_code',
'_action' => 'qr_code',
]);
```

Expand Down
24 changes: 24 additions & 0 deletions web/docs/v3/upgrade/v3.3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# v3.3 升级指南

## 非 hyperf/laravel 框架 或 无框架用户

由于默认 container 由 `php-di/php-di` 改为 `hyperf/pimple`,因此需要手动安装 `hyperf/pimple` 并移除 `php-di/php-di` 依赖:

```shell
composer remove php-di/php-di && composer require hyperf/pimple
```

## 更改版本号

将 composer.json 的 yansongda/pay 版本号更改为 `~3.3.0`,随后 `composer update` 即可。

### BREAKING CHANGES

- delete: 移除废弃的类(#752)
- change: 所有的 `Find*Plugin` 调整为 `Query*Plugin`(#756)
- change: 插件开始装载日志由 `info` 调整为 `debug`(#755)
- change: ParserInterface 签名由 `?ResponseInterface $response` 变更为 `PackerInterface $packer, ?ResponseInterface $response`(#754)
- change: `\Yansongda\Pay\Plugin\Wechat\RadarSignPlugin` 增加 `__construct(JsonPacker $jsonPacker, XmlPacker $xmlPacker)` 方法(#753)
- change: 所有 Parser 更名为 Direction(#770, #774)
- change: '_type' 类型统一定义为渠道id,如: 小程序id,公众号id等;增加 '_action' 为操作类型用于 shortcut(#781)
- change: 默认 container 由 `php-di/php-di` 改为 `hyperf/pimple`(#786)
2 changes: 1 addition & 1 deletion web/docs/v3/wechat/close.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ $order = [
//$order = [
// 'out_trade_no' => '1514027114',
// 'sub_orders' => '123456',
// '_type' => 'combine',
// '_action' => 'combine',
//];

$result = Pay::wechat()->close($order);
Expand Down
4 changes: 2 additions & 2 deletions web/docs/v3/wechat/find.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Pay::config($config);

$order = [
'transaction_id' => '1217752501201407033233368018',
'_type' => 'refund'
'_action' => 'refund'
];

$result = Pay::wechat()->find($order);
Expand All @@ -48,7 +48,7 @@ $order = [
];
//$order = [
// 'transaction_id' => '1217752501201407033233368018',
// '_type' => 'combine',
// '_action' => 'combine',
//];

$result = Pay::wechat()->find($order);
Expand Down
80 changes: 77 additions & 3 deletions web/docs/v3/wechat/more.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ $result = Pay::wechat()->pay($allPlugins, $params);

### 查询退款

- `Yansongda\Pay\Plugin\Wechat\Pay\Combine\FindRefundPlugin`
- `Yansongda\Pay\Plugin\Wechat\Pay\Combine\QueryRefundPlugin`

### 申请交易账单

Expand Down Expand Up @@ -286,12 +286,86 @@ $result = Pay::wechat()->pay($allPlugins, $params);

#### 查询退款

- `Yansongda\Pay\Plugin\Wechat\Ecommerce\Refund\FindPlugin`
- `Yansongda\Pay\Plugin\Wechat\Ecommerce\Refund\QueryPlugin`

#### 查询垫付回补结果

- `Yansongda\Pay\Plugin\Wechat\Ecommerce\Refund\FindReturnAdvancePlugin`
- `Yansongda\Pay\Plugin\Wechat\Ecommerce\Refund\QueryReturnAdvancePlugin`

#### 垫付退款回补

- `Yansongda\Pay\Plugin\Wechat\Ecommerce\Refund\ReturnAdvancePlugin`


## 委托代扣

[文档](https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/papay/chapter1_1.shtml)

### 只签约

> 具体签约相关参数,请参阅委托代扣的文档
```php
Pay::config($config);

$result = Pay::wechat()->papay([
'_action' => 'contract',
'_no_common_plugins' => true,
'_type' => 'mini', // 通过小程序签约
'contract_code' => '我方签约号',
'contract_display_account' => '签约人',
'mch_id' => '商户号',
'notify_url' => '签约成功回调地址',
'plan_id' => '委托代扣后台创建的模板ID',
'request_serial' => '请求序列号',
'timestamp' => time(),
'outerid' => '我方用户ID',
])->toArray();
```

### 支付中签约

> 具体签约相关参数,请参阅委托代扣的文档
```php
Pay::config($config);

$result = Pay::wechat()->papay([
'_no_common_plugins' => true,
'_type' => 'mini',
'contract_mchid' => '签约商户ID',
'contract_appid' => '签约AppID',
'out_trade_no' => '我方订单号',
'body' => '委托代扣',
'notify_url' => '支付回调地址',
'total_fee' => 1000,
'spbill_create_ip' => '127.0.0.1',
'trade_type' => 'JSAPI',
'plan_id' => '委托代扣后台创建的模板ID',
'openid' => '用户OpenID',
'contract_code' => "我方签约号",
'request_serial' => '请求序列号',
'contract_display_account' => '签约人',
'contract_notify_url' => '签约成功回调地址',
])->toArray();
```

### 代扣

> 具体代扣相关参数,请参阅委托代扣的文档
```php
Pay::config($config);

$result = Pay::wechat()->papay([
'_action' => 'apply',
'_no_common_plugins' => true,
'_type' => 'mini',
'body' => '委托代扣',
'out_trade_no' => '我方订单号',
'total_fee' => 1000,
'spbill_create_ip' => '127.0.0.1',
'notify_url' => '代扣成功回调地址',
'contract_id' => '签约ID',
])->toArray();
```
Loading

0 comments on commit ead4d7e

Please sign in to comment.