-
Notifications
You must be signed in to change notification settings - Fork 675
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Conflicts: # README.md # src/Common/Ali/Data/Charge/ChargeBaseData.php # src/Common/Weixin/Data/RefundData.php # src/Common/Weixin/WxBaseStrategy.php # src/Notify/WxNotify.php
- Loading branch information
Showing
257 changed files
with
10,455 additions
and
9,266 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,7 @@ | ||
.idea | ||
.DS_Store | ||
/codecept.phar | ||
/examples/test.php | ||
/examples/wx/pem | ||
/vendor/ | ||
/examples_bak/ | ||
/composer.lock | ||
/examples/wxconfig-bak.php | ||
/examples/wx/pem/ | ||
composer.lock | ||
/examples/config | ||
/examples/wx/pem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
return [ | ||
// 目标版本 | ||
'target_php_version' => '7.0', | ||
|
||
// 需要检查的目录 | ||
'directory_list' => [ | ||
'src', | ||
], | ||
|
||
// 忽略分析的目录 | ||
'exclude_analysis_directory_list' => [ | ||
'vendor/', | ||
'examples/', | ||
], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
<?php | ||
$header = <<<EOF | ||
The file is part of the payment lib. | ||
(c) Leo <[email protected]> | ||
This source file is subject to the MIT license that is bundled | ||
with this source code in the file LICENSE. | ||
EOF; | ||
|
||
$finder = PhpCsFixer\Finder::create() | ||
->exclude('vendor/') | ||
->in(__DIR__); | ||
|
||
$rules = [ | ||
// PSR2为基准 | ||
'@PSR2' => true, | ||
|
||
// 数组统一:[ ] | ||
'array_syntax' => ['syntax' => 'short'], | ||
|
||
// namespace 之后空一行 | ||
'blank_line_after_namespace' => true, | ||
|
||
// new: namespace 之前不能有空行 | ||
'no_blank_lines_before_namespace' => true, | ||
|
||
// 合并多条连续的 unset 方法 | ||
'combine_consecutive_unsets' => true, | ||
|
||
// 字符串连接空格 | ||
'concat_space' => ['spacing' => 'one'], | ||
|
||
// case 空格 | ||
'cast_spaces' => true, | ||
|
||
// else if 转换为 elseif | ||
'elseif' => true, | ||
|
||
// utf8 无bom头编码 | ||
'encoding' => true, | ||
|
||
// 必须使用<?php 或者 <?= | ||
'full_opening_tag' => true, | ||
|
||
// 单行注释使用 双斜杠 | ||
'hash_to_slash_comment' => true, | ||
|
||
// 头部的注释信息,统一 | ||
'header_comment' => ['header' => $header], | ||
|
||
// 代码必须使用配置的缩进类型 | ||
'indentation_type' => true, | ||
|
||
// 所有PHP文件必须使用相同的行结束 | ||
'line_ending' => true, | ||
|
||
// true, false, and null 必须为小写 | ||
'lowercase_constants' => true, | ||
|
||
// 在方法参数和方法调用中,每个逗号之间绝对不能为空格,每个逗号之后必须有一个空格 | ||
'method_argument_space' => true, | ||
|
||
// class 大括号后不应有空行 | ||
'no_blank_lines_after_class_opening' => true, | ||
|
||
// 删除空注释 | ||
'no_empty_comment' => true, | ||
|
||
// 删除无用的空语句 | ||
'no_empty_statement' => true, | ||
|
||
// 命名空间声明行不应包含前导空 | ||
'no_leading_namespace_whitespace' => true, | ||
|
||
// => 不应该被多行空格包围 | ||
'no_multiline_whitespace_around_double_arrow' => true, | ||
|
||
// 在开始的括号之后,绝对不能是一个空格。在右括号之前绝对不能是空格 | ||
'no_spaces_inside_parenthesis' => true, | ||
|
||
// 绝对不能在offset 周围空格 | ||
'no_spaces_around_offset' => ['inside', 'outside'], | ||
|
||
// 禁止在关闭分号之前的单行空格 | ||
'no_singleline_whitespace_before_semicolons' => true, | ||
|
||
// 删除列表函数调用中的逗号 | ||
'no_trailing_comma_in_list_call' => true, | ||
|
||
// PHP单行数组不应该有逗号 | ||
'no_trailing_comma_in_singleline_array' => true, | ||
|
||
// 注释和phpdocs中必须没有尾随空格 | ||
'no_trailing_whitespace_in_comment' => true, | ||
|
||
// 删除空白行末尾的尾随空格 | ||
'no_whitespace_in_blank_line' => true, | ||
|
||
// 在数组声明中,每个逗号之前绝对不能是空格 | ||
'no_whitespace_before_comma_in_array' => true, | ||
|
||
// 必须删除未使用的使用语句 | ||
'no_unused_imports' => true, | ||
|
||
// 删除无用的else | ||
'no_useless_else' => true, | ||
|
||
// 删除无用的return | ||
'no_useless_return' => true, | ||
|
||
// 导入列表排序 | ||
'ordered_imports' => true, | ||
|
||
// 没有结束标记的PHP文件必须始终以单个空行内容结尾 | ||
'single_blank_line_at_eof' => true, | ||
|
||
// 每个声明必须是一个使用关键字 | ||
'single_import_per_statement' => true, | ||
|
||
// 将简单字符串的 双引号 转换为 单引号 | ||
'single_quote' => true, | ||
|
||
// 三元操作符空格 | ||
'ternary_operator_spaces' => true, | ||
|
||
// 数组去空格 | ||
'trim_array_spaces' => true, | ||
|
||
// 一元运算符靠着操作数 | ||
'unary_operator_spaces' => true, | ||
|
||
/** 可见性必须在所有属性和方法上声明; | ||
* 抽象和最终必须在可见性之前声明; | ||
* 静态必须在可见性之后声明 | ||
**/ | ||
'visibility_required' => true, | ||
|
||
// 数组箭头对齐 | ||
'binary_operator_spaces' => [ | ||
'operators' => [ | ||
'=' => 'align_single_space_minimal', | ||
'=>' => 'align_single_space_minimal', | ||
], | ||
], | ||
|
||
// 数组的逗号后面有一个空格 | ||
'whitespace_after_comma_in_array' => true, | ||
]; | ||
|
||
return PhpCsFixer\Config::create() | ||
->setRules($rules) | ||
->setFinder($finder); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,82 +1 @@ | ||
Payment只有在大家的使用反馈中才能得到不断的完善。 | ||
|
||
我希望通过真实的项目来驱动它不断发展,在为工作带来方便的同时尽力保持它的简洁。 | ||
|
||
# issue报Bug | ||
由于Payment高度依赖第三方接口,因此第三方一个小的变动也会导致项目产生一个大版本号。当前主要有: | ||
- 2.x 应该没多少人使用了,已经放弃维护 | ||
- 3.x 继续维护,只修bug,不做接口更新 | ||
- 4.x 当前开发版本,均保持当前第三方的最新接口 | ||
|
||
由于版本比较多。因此报bug建议采用以下格式: | ||
|
||
[3/4.x]版本,在什么环境下(沙盒还是正式),调用了什么接口,出现了什么错误(最好有截图)。自己尝试过哪些办法去解决未达到预期效果 | ||
|
||
推荐所有的bug在提交时,先使用demo代码运行一下,看看能否通过。 | ||
|
||
**只提供标题,或者没有重现步骤的,将不处理** | ||
|
||
# 贡献代码 | ||
请代码书写遵循以下规则: | ||
|
||
- [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) | ||
- 使用4个空格作为缩紧(不是tab) | ||
- 命名使用驼峰命名(不准使用拼音) | ||
- 请给类、方法、变量添加注释,注释需要包含:日期、修改人、含义 | ||
|
||
## 开发流程 | ||
|
||
1. Fork [helei112g/payment](https://github.com/helei112g/payment) 到本地 | ||
2. 创建新的分支: | ||
|
||
```shell | ||
$ git checkout -b new_feature | ||
``` | ||
|
||
3. 编写代码 | ||
4. Push 到你的分支: | ||
|
||
```shell | ||
$ git push origin new_feature | ||
``` | ||
|
||
5. 创建 Pull Request 并描述你完成的功能或者做出的修改 | ||
|
||
所提交的部分一定自己真实测试完毕,如果是新的支付功能,需要添加对应的demo以及 | ||
|
||
相关功能的文档(暂无开源文档地址,请根据功能名称,提供 `.md`的说明文档)。 | ||
|
||
## 代码说明 | ||
为了让大家快速理解代码结构,将项目相关结构图进行说明,这里从调用者的角度出发进行描述 | ||
![image](http://ol59nqr1i.bkt.clouddn.com/jiegou.jpeg) | ||
|
||
这张图表现的是库的一个层次。用支付宝手机wap支付为例: | ||
调用这只需要通过 | ||
```php | ||
Charge::run() | ||
``` | ||
这个方法即可完成所有调用。剩下的所有东西对调用者都应该是透明的 | ||
|
||
这个方法内部会首先通过 | ||
```php | ||
ChargeContext::initCharge() | ||
``` | ||
进行上下文的初始化,完成准备工作,并返回一个具体的对应支付实例,在这里是:`AliAppCharge` | ||
|
||
接着内部会调用 | ||
```php | ||
AliAppCharge::charge() | ||
``` | ||
完成支付的请求,他会把结果返回给调用者 | ||
|
||
在 `AliAppCharge::charge()` 调用中完成了请求数据的组装,请求数据的签名,如果需要网络请求,会发送网络请求到支付宝网关。并把结果逐步返回。 | ||
## 核心类图 | ||
本库的所有功能,层次结构比较一致。这里以支付宝app支付为例,进行一下类图描述,方便大家以此进行类比 | ||
![uml](http://ol59nqr1i.bkt.clouddn.com/payment-uml.png) | ||
如果看不清楚,可[点击下载](http://ol59nqr1i.bkt.clouddn.com/payment-uml.png) | ||
--------- | ||
**`遇到bug,90%都是秘钥相关导致的,微信可能与后台配置有关。请仔细检查。`** | ||
重构中...... |
Oops, something went wrong.