diff --git a/LICENSE.md b/LICENSE.md deleted file mode 100755 index 4793a12..0000000 --- a/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) wjunying - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/NOTICE.md b/NOTICE.md deleted file mode 100755 index 5b3cebe..0000000 --- a/NOTICE.md +++ /dev/null @@ -1,114 +0,0 @@ -# Alibaba Cloud SDK for PHP - - - -Copyright 1999-2019 Alibaba Group. or its affiliates. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"). -You may not use this file except in compliance with the License. -A copy of the License is located at - - - -or in the "license" file accompanying this file. This file is distributed -on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either -express or implied. See the License for the specific language governing -permissions and limitations under the License. - -# Guzzle - - - -Copyright (c) 2011-2018 Michael Dowling, https://github.com/mtdowling - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -# - - - -Copyright (c) 2009-2018 Fabien Potencier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -# Symfony - - - -Copyright (c) 2004-2019 Fabien Potencier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -# EasyWeChat - - - -The MIT License (MIT) - -Copyright (c) overtrue - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100755 index 2c7d861..0000000 --- a/README.md +++ /dev/null @@ -1,83 +0,0 @@ -## EasyAlipay - -EasyAlipay 是基于支付宝OpenAPI开源的PHP语言版本SDK。使用本SDK前你需要具备基础的PHP相关能力,掌握自动加载,[Composer](https://getcomposer.org/)的使用等,并了解[支付宝的相关业务](https://docs.open.alipay.com/api)。 - -## 1.0.0 🎉🎉🎉 -EsayAlipay 1.0.0 首次发布,欢迎加入下方的钉钉群一起交流,我们致力于打造一个方便开发者快速接入支付宝业务的SDK。本SDK针对通用授权、支付、小程序、生活号、营销等场景做了业务模型封装,并在持续增加中。同时对API参数做了最简单处理,以最少可用原则精简了参数,方便开发者更快的使用,降低开发者门槛。 - -## 一、背景 - -开发者在接入支付宝的过程中经常遇到想开发一个功能但是不清楚应该使用哪个API,找到对应API后参数又过于复杂不清楚哪些参数是自己真正要使用的。针对这种情况EsayAlipay主要在方法层面对API进行模型化归类,在参数层面对复杂参数进行简化,用最少的参数覆盖最高频的调用,不求百分百覆盖所有场景。 - -## 二、功能简介 - -EasyAlipay 提供了以下的能力: - -### 2.1 纯PHP语言开发不采用任何框架 - -提供给开发者一个最干净的SDK,开发者在使用时候可以直接引入到任何PHP框架中。 - -### 2.2 Composer管理 - -本SDK相关依赖全部采用Composer管理。 - -### 2.3 业务场景封装 - -对通用授权、支付、小程序、生活号、营销等场景做了简单业务封装,并在持续增加中。 - -### 2.4 参数精简 - -基于最少可用原则对参数做了精简,每个方法对应对原生OpenAPI都在对应场景目录下Model目录中的每个文件中做了注释说明,如果精简后的参数不能满足您的使用需求,可直接在文件中添加对应参数。 -## 三、环境需求 -```php -PHP >= 7.0 -PHP cURL 扩展 -PHP OpenSSL 扩展 -PHP fileinfo 扩展 -``` -## 四、快速开始 -```php -use EasyAlipay\Factory; - -$options = [ - 'app_id' => '你的应用APPID', - 'gateway_url' => "网关地址",//沙箱环境网关gateway_url:https://openapi.alipaydev.com/gateway.do,线上网关gateway_url:https://openapi.alipay.com/gateway.do - 'sign_type' => "RSA2", - 'charset' => "UTF-8", - 'alipay_public_key' => '支付宝公钥', - 'merchant_private_key' => '应用私钥', - // ... -]; - -//通用基础 -$app = Factory::base($options); -//营销 -$app = Factory::marketing($options); -//小程序 -$app = Factory::mini($options); -//生活号 -$app = Factory::openPublic($options); -//支付 -$app = Factory::payment($options); - -``` -支付宝公钥与应用私钥配置请参考:[三步搞定签名](https://docs.open.alipay.com/291/106103/) - -创建应用地址:[支付宝开放平台](https://openhome.alipay.com) - -支付宝小程序门户:[小程序开发平台](https://mini.open.alipay.com) - -## 五、文档与示例 - -请参考 docs目录下的相关文档,里面有具体每个方法每个参数的详细说明,文档目录与代码结构保持一致方便开发者理解。在工程的 tests 目录下 test.php文件中提供了一个沙箱环境交易查询的示例。 - -## 六、开源许可 - -EasyAlipay 参考依赖了一些三方组件,在NOTICE中引入了他们的开源协议。 - - -## 七、信息交流 - -欢迎加入EasyAlipay钉钉交流群:23311489 - - \ No newline at end of file diff --git a/docs/Base/Oauth.md b/docs/Base/Oauth.md deleted file mode 100755 index 6d0e380..0000000 --- a/docs/Base/Oauth.md +++ /dev/null @@ -1,27 +0,0 @@ -## 换取授权访问令牌 - -##### 配置 -```php -use EasyAlipay\Factory; - -$options = [ - - 'app_id' => '2016051900098985', - 'alipay_public_key' => '支付宝公钥', - 'merchant_private_key' => '应用私钥', - // ... -]; - -$app = Factory::base($options); - -$app['oauth']->getToken($grant_type, $code,$refresh_token); - -``` - -参数说明 - -grant_type:值为authorization_code时,代表用code换取;值为refresh_token时,代表用refresh_token换取 - -code:授权码,用户对应用授权后得到。 - -refresh_token:刷刷新令牌,上次换取访问令牌时得到。见出参的refresh_token字段,可传null。 \ No newline at end of file diff --git a/docs/Marketing/Pass.md b/docs/Marketing/Pass.md deleted file mode 100755 index 4356574..0000000 --- a/docs/Marketing/Pass.md +++ /dev/null @@ -1,162 +0,0 @@ -## 支付宝卡包 -产品文档:https://docs.alipay.com/mini/introduce/voucher - -#### 配置 -```php -use EasyAlipay\Factory; - -$options = [ - - 'app_id' => '2016051900098985', - 'alipay_public_key' => '支付宝公钥', - 'merchant_private_key' => '应用私钥', - // ... -]; - -$app = Factory::marketing($options); -``` - -#### 卡券模板创建 -```php -$app['pass']->createTemplate($tpl_id,$tpl_content); -``` -参数说明 - -tpl_id:商户用于控制模版的唯一性,长度不超过999。(可以使用时间戳保证唯一性),长度不超过30。例如:20140709150010 - -tpl_content:模板内容信息,遵循JSON规范,长度不超过99999。详情参见:[tpl_content参数说明](https://doc.open.alipay.com/doc2/detail.htm?treeId=193&articleId=105249&docType=1#tpl_content) - -#### 卡券模板更新 -```php -$app['pass']->updateTemplate($tpl_id,$tpl_content); -``` -tpl_id:商户用于控制模版的唯一性,长度不超过999。(可以使用时间戳保证唯一性),长度不超过30。例如:20140709150010 - -tpl_content:模板内容信息,遵循JSON规范,长度不超过99999。详情参见:[tpl_content参数说明](https://doc.open.alipay.com/doc2/detail.htm?treeId=193&articleId=105249&docType=1#tpl_content) - - -#### 卡券实例发放 -```php -$app['pass']->addInstance($tpl_id,$tpl_params,$recognition_type,$recognition_info); -``` -tpl_id:商户用于控制模版的唯一性,长度不超过999。例如:20140709150010 - -tpl_params:模版动态参数信息:对应模板中$变量名$的动态参数,见模板创建接口返回值中的tpl_params字段,长度不超过99999。 - -recognition_type:Alipass添加对象识别类型:1–订单信息。长度不超过999。 - -recognition_info:支付宝用户识别信息,长度不超过999。 包括partner_id(商户的签约账号)和out_trade_no(某笔订单号)。例如:{"partner_id":"2088102114633762","out_trade_no":"1234567"} - -#### 卡券实例更新 -```php -$app['pass']->updateInstance($serial_number,$channel_id,$tpl_params,$status,$verify_code,$verify_type); -``` -参数说明 - -serial_number:商户指定卡券唯一值,卡券JSON模板中fileInfo->serialNumber字段对应的值,长度不超过999。 - -channel_id:代理商代替商户发放卡券后,再代替商户更新卡券时,此值为商户的pid/appid,长度不超过999。 - -tpl_params:对应模板中$变量名$的动态参数,见模板创建接口返回值中的tpl_params字段,长度不超过99999。 - -status:券状态,支持更新为USED、CLOSED两种状态 - -verify_code:核销码串值【当状态变更为USED时,建议传】。该值正常为模板中核销区域(Operation)对应的message值。长度不超过999。 - -verify_type:核销方式,该值正常为模板中核销区域(Operation)对应的format值。verify_code和verify_type需同时传入,长度不超过99999。 - -#### tpl_content示例 -```php -{ - "logo": "https://alipass.alipay.com//temps/free/logo.png", - "strip": "https://alipass.alipay.com//temps/free/strip.png", - "icon": "http://alipassprod.test.alipay.net/temps/free/icon.png", - "content": { - "evoucherInfo": { - "title": "优惠券", - "type": "boardingPass", - "product": "free", - "startDate": "2019-07-25 15:05:22", - "endDate": "2029-12-31 23:59:59", - "operation": [{ - "message": "$ackCode$", - "messageEncoding": "UTF-8", - "format": "barcode", - "altText": "$ackCode$" - }], - "einfo": { - "logoText": "优惠券", - "headFields": [{ - "key": "status", - "label": "状态", - "value": "可使用", - "type": "text" - }], - "primaryFields": [{ - "key": "strip", - "label": "", - "value": "凭此券即可抵扣1元", - "type": "text" - }], - "secondaryFields": [{ - "key": "validDate", - "label": "有效期至:", - "value": "2029-12-31 23:59:59", - "type": "text" - }], - "auxiliaryFields": [{ - "key": "key_1", - "label": "", - "value": "卡券Demo演示", - "type": "text" - }], - "backFields": [{ - "key": "description", - "label": "详情描述", - "value": "1.该优惠有效期:截止至2029年12月31日;2.凭此券可以享受以下优惠:享门抵扣1元不与其他优惠同享。详询商家。", - "type": "text" - }] - }, - "locations": [], - "remindInfo": { - "offset": "2" - } - }, - "merchant": { - "mname": "君泓测试", - "mtel": "", - "minfo": "" - }, - "platform": { - "channelID": "2088201564809153", - "webServiceUrl": "https://alipass.alipay.com/builder/syncRecord.htm?tempId=2019030622051381011176571" - }, - "style": { - "backgroundColor": "RGB(255,126,0)" - }, - "fileInfo": { - "formatVersion": "2", - "canShare": true, - "canBuy": false, - "canPresent": false, - "serialNumber": "$serialNumber$", - "supportTaxi": "false", - "taxiSchemaUrl": "alipays://platformapi/startapp?appId=20000778&bizid=260&channel=71322" - }, - "appInfo": { - "app": { - "android_appid": "com.taobao.ecoupon", - "ios_appid": "taobaolife://", - "android_launch": "com.taobao.ecoupon", - "ios_launch": "taobaolife://", - "android_download": "http://download.taobaocdn.com/freedom/17988/andriod/Ecoupon_2.0.1_taobao_wap.apk", - "ios_download": "https://itunes.apple.com/cn/app/id583295537" - }, - "label": "券券APP", - "message": "点击调起APP" - }, - "source": "alipassprod", - "alipayVerify": ["qrcode", "barcode", "text", "wave"] - } -} -``` \ No newline at end of file diff --git a/docs/Mini/Identification.md b/docs/Mini/Identification.md deleted file mode 100755 index 6e7caee..0000000 --- a/docs/Mini/Identification.md +++ /dev/null @@ -1,43 +0,0 @@ -## 小程序人脸采集与刷脸认证 - -##### 配置 -```php -use EasyAlipay\Factory; - -$options = [ - - 'app_id' => '2016051900098985', - 'alipay_public_key' => '支付宝公钥', - 'merchant_private_key' => '应用私钥', - // ... -]; - -$app = Factory::mini($options); -``` - -##### 人脸采集 - -产品文档地址:https://docs.alipay.com/mini/introduce/facecapture -```php -$app['identification']->queryUserWeb($biz_id,$zim_id,$extern_param); -``` -参数说明 - -biz_id:业务流水号,需要保证唯一性,长度不超过64。例如:5456897876546767654 - -zim_id:刷脸认证标识,长度不超过64。例如:731be7f204a962b0486a9b64ea3050ae - -extern_param:扩展参数,长度不超过1024。 - - -##### 刷脸认证 - -产品文档地址:https://docs.alipay.com/mini/introduce/alipay-face-verify -```php -$app['identification']->queryCertifyzhub($biz_id,$zim_id,$face_type,$need_img); -``` -参数说明 - -biz_id:业务流水号,需要保证唯一性,长度不超过64。 - -zim_id:刷脸认证标识,长度不超过64。 diff --git a/docs/Mini/Qrcode.md b/docs/Mini/Qrcode.md deleted file mode 100755 index b708662..0000000 --- a/docs/Mini/Qrcode.md +++ /dev/null @@ -1,27 +0,0 @@ -## 小程序二维码 - -产品文档地址:https://docs.alipay.com/mini/introduce/qrcode - -##### 配置 -```php -use EasyAlipay\Factory; - -$options = [ - - 'app_id' => '2016051900098985', - 'alipay_public_key' => '支付宝公钥', - 'merchant_private_key' => '应用私钥', - // ... -]; - -$app = Factory::mini($options); - -$app['qrcode']->create($url_param,$query_param,$describe); -``` -参数说明 - -url_param:小程序中能访问到的页面路径,长度不超过256。例如:page/component/component-pages/view/view - -query_param:小程序的启动参数,打开小程序的query ,在小程序 onLaunch的方法中获取,长度不超过256。例如:x=1 - -describe:对应的二维码描述,长度不超过32。 diff --git a/docs/Mini/Risk.md b/docs/Mini/Risk.md deleted file mode 100755 index 3c089ab..0000000 --- a/docs/Mini/Risk.md +++ /dev/null @@ -1,24 +0,0 @@ -## 小程序文本风险识别 - -产品文档地址:https://docs.alipay.com/mini/introduce/text-identification -基于alipay.security.risk.content.detect接口进行封装 - -##### 配置 -```php -use EasyAlipay\Factory; - -$options = [ - - 'app_id' => '2016051900098985', - 'alipay_public_key' => '支付宝公钥', - 'merchant_private_key' => '应用私钥', - // ... -]; - -$app = Factory::mini($options); - -$app['risk']->detectContent($content); -``` -参数说明 - -content:需要识别的文本,不要包含特殊字符以及双引号等可能引起json格式化错误问题的字符,长度不超过2000。例如:代办毕业证,我们最专业 \ No newline at end of file diff --git a/docs/Mini/TemplateMessage.md b/docs/Mini/TemplateMessage.md deleted file mode 100755 index 7f80a8c..0000000 --- a/docs/Mini/TemplateMessage.md +++ /dev/null @@ -1,33 +0,0 @@ -## 小程序模版消息 - -产品文档地址:https://docs.alipay.com/mini/introduce/message - -##### 配置 -```php -use EasyAlipay\Factory; - -$options = [ - - 'app_id' => '2016051900098985', - 'alipay_public_key' => '支付宝公钥', - 'merchant_private_key' => '应用私钥', - // ... -]; - -$app = Factory::mini($options); - -$app['templateMessage']->send($to_user_id,$form_id,$user_template_id,$page,$data); -``` -参数说明 - -to_user_id:发送消息的用户userid,长度不超过20。例如:2088102122458832 - -form_id:用户发生的交易行为的交易号,或者用户在小程序产生表单提交的表单号,用于信息发送的校验,长度不超过64。例如:2017010100000000580012345678 - -user_template_id:用户申请的模板id号,固定的模板id会发送固定的消息,长度不超过64。例如:MDI4YzIxMDE2M2I5YTQzYjUxNWE4MjA4NmU1MTIyYmM= - -page:小程序的跳转页面,用于消息中心用户点击之后详细跳转的小程序页面,长度不超过128。例如:page/component/index - -data:开发者需要发送模板消息中的自定义部分来替换模板的占位符,长度不超过2048。例如:{"keyword1": {"value" : "12:00"},"keyword2": {"value" : "20180808"},"keyword3": {"value" : "支付宝"}} - - diff --git a/docs/OpenLife/Message.md b/docs/OpenLife/Message.md deleted file mode 100755 index bcdc5d5..0000000 --- a/docs/OpenLife/Message.md +++ /dev/null @@ -1,107 +0,0 @@ -## 生活号消息 - -#### 配置 -```php -use EasyAlipay\Factory; - -$options = [ - - 'app_id' => '2016051900098985', - 'alipay_public_key' => '支付宝公钥', - 'merchant_private_key' => '应用私钥', - // ... -]; - -$app = Factory::openPublic($options); -``` -#### 创建图文消息内容 -```php -$app['message']->createImageTextContent($title, $cover, $content, $could_comment, $ctype, $benefit, $ext_tags, $login_ids); -``` -参数说明 - -title:标题,长度不超过32。 - -cover:封面图url,长度不超过255,图片尺寸为996*450,最大不超过3M,支持格式:.jpg、.png ,请先调用图片上传接口获得图片url https://oalipay-dl-django.alicdn.com/rest/1.0/image?fileIds=xxx&zoom=xxx - -content:消息正文(支持富文本),长度不超过10000。 - -could_comment:是否允许评论 T:允许 F:不允许,默认不允许 T - -ctype:图文类型 activity: 活动图文,不填默认普通图文 - -benefit:活动利益点,图文类型ctype为activity类型时才需要传,长度不超过10。例如:满**减** - -ext_tags:关键词列表,英文逗号分隔,最多不超过5个,长度不超过50。例如:关键,热度 - -login_ids:可预览支付宝账号列表,需要预览时才填写, 英文逗号分隔,最多不超过10个,长度不超过10000。例如:13434343432,xxx@163.com - - -#### 更新图文消息内容 -```php -$app['message']->modifyImageTextContent($content_id, $title, $cover, $content, $could_comment, $ctype, $benefit, $ext_tags, $login_ids); -``` -参数说明 - -content_id:内容id,长度不超过100。 - -title:标题,长度不超过32。 - -cover:封面图url,长度不超过255,图片尺寸为996*450,最大不超过3M,支持格式:.jpg、.png ,请先调用图片上传接口获得图片url https://docs.open.alipay.com/api_3/alipay.offline.material.image.upload - -content:消息正文(支持富文本),长度不超过10000。 - -could_comment:是否允许评论 T:允许 F:不允许,默认不允许 T - -ctype:图文类型 activity: 活动图文,不填默认普通图文 - -benefit:活动利益点,图文类型ctype为activity类型时才需要传,长度不超过10。例如:满**减** - -ext_tags:关键词列表,英文逗号分隔,最多不超过5个,长度不超过50。例如:关键,热度 - -login_ids:可预览支付宝账号列表,需要预览时才填写, 英文逗号分隔,最多不超过10个,长度不超过10000。例如:13434343432,xxx@163.com - - -#### 群发文本消息 -```php -$app['message']->sendText($text); -``` -参数说明 - -text:文本消息内容 - - -#### 群发图文消息 -```php -$app['message']->sendImageText($articles); -``` -参数说明 - -articles示例如下 -```php -"articles":[{ - "title":"图文消息标题(长度不超过100)", - "desc":"图文消息内容(长度不超过512)", - "image_url":"图片链接,例如:http://example.com/abc.jpg(长度不超过100)", - "url":"点击图文消息跳转的链接,例如:https://www.example.com/b.php(长度不超过100)", - "action_name":"链接文字,例如:查看详情" - }] -``` -#### 查询已发送消息 -```php -$app['message']->query($message_ids); -``` -参数说明 - -message_ids:消息id集,长度不超过64,限制最多传入20个message_id。message_id在调用群发、组发消息接口时会返回,需调用方保存。例如:2017080301329810fa9f7ca2-4634-481b-bca2-54092fd4be72 - - -#### 消息撤回 -```php -$app['message']->recall($message_id); -``` -参数说明 - -message_id:消息id,长度不超过64。例如:2016000000000000 - - diff --git a/docs/OpenLife/Template.md b/docs/OpenLife/Template.md deleted file mode 100755 index 5de609f..0000000 --- a/docs/OpenLife/Template.md +++ /dev/null @@ -1,44 +0,0 @@ -## 生活号消息模版 - -#### 配置 -```php -use EasyAlipay\Factory; - -$options = [ - - 'app_id' => '2016051900098985', - 'alipay_public_key' => '支付宝公钥', - 'merchant_private_key' => '应用私钥', - // ... -]; - -$app = Factory::openPublic($options); -``` -#### 模板消息行业设置修改 -```php -$app['template']->setIndustry($primary_industry_name,$primary_industry_code,$secondary_industry_code,$secondary_industry_name); -``` -参数说明 - -primary_industry_name:服务窗消息模板所属主行业一/二级名称,长度不超过30。例如:IT科技/IT软件与服务。查看行业信息:https://alipay.open.taobao.com/doc2/detail?treeId=197&docType=1&articleId=105043 - -primary_industry_code:服务窗消息模板所属主行业一/二级编码,长度不超过20。例如:10001/20102 - -secondary_industry_code:服务窗消息模板所属副行业一/二级编码,长度不超过20。例如:10001/20102 - -secondary_industry_name:服务窗消息模板所属副行业一/二级名称,长度不超过30。例如:IT科技/IT软件与服务 - - -#### 查询行业设置 -```php -$app['template']->getIndustry(); -``` - -#### 消息模板领取 -```php -$app['template']->getTemplate($template_id); -``` -参数说明 - -template_id:消息母板id,长度不超过20。登陆生活号后台(fuwu.alipay.com),点击菜单“模板消息”,点击“模板库”,即可看到相应模板的消息母板id。 - diff --git a/docs/Payment/Cancel.md b/docs/Payment/Cancel.md deleted file mode 100755 index daa15fd..0000000 --- a/docs/Payment/Cancel.md +++ /dev/null @@ -1,22 +0,0 @@ -## 交易取消 - -##### 配置 -```php -use EasyAlipay\Factory; - -$options = [ - - 'app_id' => '2016051900098985', - 'alipay_public_key' => '支付宝公钥', - 'merchant_private_key' => '应用私钥', - // ... -]; - -$app = Factory::payment($options); - -$app['cancel']->cancel($out_trade_no); -``` -参数说明 - -out_trade_no:订单支付时传入的商户订单号,长度不超过64。 - diff --git a/docs/Payment/Close.md b/docs/Payment/Close.md deleted file mode 100755 index d2c74ce..0000000 --- a/docs/Payment/Close.md +++ /dev/null @@ -1,24 +0,0 @@ -## 交易关闭 - -用于交易创建后,用户在一定时间内未进行支付,可调用该接口直接将未付款的交易进行关闭。 - -##### 配置 -```php -use EasyAlipay\Factory; - -$options = [ - - 'app_id' => '2016051900098985', - 'alipay_public_key' => '支付宝公钥', - 'merchant_private_key' => '应用私钥', - // ... -]; - -$app = Factory::payment($options); - -$app['close']->close($out_trade_no); -``` -参数说明 - -out_trade_no:订单支付时传入的商户订单号,长度不超过64。 - diff --git a/docs/Payment/Create.md b/docs/Payment/Create.md deleted file mode 100755 index f154577..0000000 --- a/docs/Payment/Create.md +++ /dev/null @@ -1,29 +0,0 @@ -## 交易创建 - -#### 配置 -```php -use EasyAlipay\Factory; - -$options = [ - - 'app_id' => '2016051900098985', - 'alipay_public_key' => '支付宝公钥', - 'merchant_private_key' => '应用私钥', - // ... -]; - -$app = Factory::payment($options); - -$app['create']-> create($subject,$out_trade_no,$total_amount,$buyer_id); - -``` -参数说明 - -subject:订单标题,长度不超过256。 - -out_trade_no:订单支付时传入的商户订单号,长度不超过64。 - -total_amount:订单总金额,单位为元,精确到小数点后两位,取值范围[0.01,100000000] - -buyer_id:买家的支付宝唯一用户号(2088开头的16位纯数字) - diff --git a/docs/Payment/Pay.md b/docs/Payment/Pay.md deleted file mode 100755 index fc2e506..0000000 --- a/docs/Payment/Pay.md +++ /dev/null @@ -1,29 +0,0 @@ -## 交易支付 - -#### 配置 -```php -use EasyAlipay\Factory; - -$options = [ - - 'app_id' => '2016051900098985', - 'alipay_public_key' => '支付宝公钥', - 'merchant_private_key' => '应用私钥', - // ... -]; - -$app = Factory::payment($options); - -$app['pay']->pay($subject,$out_trade_no,$total_amount,$auth_code); -``` - -参数说明 - -subject:订单标题,长度不超过256。 - -out_trade_no:订单支付时传入的商户订单号,长度不超过64。 - -total_amount:订单总金额,单位为元,精确到小数点后两位,取值范围[0.01,100000000] - -auth_code:支付授权码,25~30开头的长度为16~24位的数字,实际字符串长度以开发者获取的付款码长度为准 - diff --git a/docs/Payment/Query.md b/docs/Payment/Query.md deleted file mode 100755 index b99d7a7..0000000 --- a/docs/Payment/Query.md +++ /dev/null @@ -1,23 +0,0 @@ -## 交易查询 - -#### 配置 -```php -use EasyAlipay\Factory; - -$options = [ - - 'app_id' => '2016051900098985', - 'alipay_public_key' => '支付宝公钥', - 'merchant_private_key' => '应用私钥', - // ... -]; - -$app = Factory::payment($options); - -$app['query']->query($out_trade_no));` -``` -参数说明 - -out_trade_no:out_trade_no:订单支付时传入的商户订单号,长度不超过64。 - - diff --git a/docs/Payment/Refund.md b/docs/Payment/Refund.md deleted file mode 100755 index d8d50a3..0000000 --- a/docs/Payment/Refund.md +++ /dev/null @@ -1,26 +0,0 @@ -## 交易退款 - -当交易发生之后一段时间内,由于买家或者卖家的原因需要退款时,卖家可以通过退款接口将支付款退还给买家,支付宝将在收到退款请求并且验证成功之后,按照退款规则将支付款按原路退到买家帐号上。 交易超过约定时间(签约时设置的可退款时间)的订单无法进行退款。一笔退款失败后重新提交,要采用原来的退款单号。总退款金额不能超过用户实际支付金额。 - -##### 配置 -```php -use EasyAlipay\Factory; - -$options = [ - - 'app_id' => '2016051900098985', - 'alipay_public_key' => '支付宝公钥', - 'merchant_private_key' => '应用私钥', - // ... -]; - -$app = Factory::payment($options); - -$app['refund']->refund($out_trade_no, $refund_amount); -``` -参数说明 - -out_trade_no:订单支付时传入的商户订单号,长度不超过64。 -refund_amount:需要退款的金额,该金额不能大于订单金额,单位为元,支持两位小数 - - diff --git a/src/Base/Oauth/Client.php b/src/Base/Oauth/Client.php index 3066889..4b51099 100755 --- a/src/Base/Oauth/Client.php +++ b/src/Base/Oauth/Client.php @@ -46,4 +46,9 @@ class Client extends AppClient $request->setApiMethodName('alipay.user.info.share'); return ($this->execute($request)); } + + public function decryptData() + { + + } } diff --git a/src/Payment/Application.php b/src/Payment/Application.php index 74e8948..c4adf22 100755 --- a/src/Payment/Application.php +++ b/src/Payment/Application.php @@ -13,6 +13,7 @@ use EasyAlipay\Kernel\ServiceContainer; * @property \EasyAlipay\Payment\Pay\Client $pay * @property \EasyAlipay\Payment\Query\Client $query * @property \EasyAlipay\Payment\Refund\Client $refund + * @property \EasyAlipay\Payment\Fund\Client $fund */ class Application extends ServiceContainer diff --git a/src/Payment/Close/Client.php b/src/Payment/Close/Client.php index abe5e0e..e0cffb2 100755 --- a/src/Payment/Close/Client.php +++ b/src/Payment/Close/Client.php @@ -4,13 +4,13 @@ namespace EasyAlipay\Payment\Close; use EasyAlipay\Kernel\AppClient; use EasyAlipay\Kernel\AppRequest; +use EasyAlipay\Payment\Model\AlipayFundTransUniTransferContentBuilder; use EasyAlipay\Payment\Model\AlipayTradeCloseContentBuilder; class Client extends AppClient { /** - * 关闭订单 - * @param string $out_trade_no + * @param array $payload * @return \EasyAlipay\Kernel\Support\Collection * @throws \EasyAlipay\Kernel\Exceptions\BadRequestException * @throws \EasyAlipay\Kernel\Exceptions\InvalidArgumentException @@ -18,14 +18,37 @@ class Client extends AppClient * @throws \EasyAlipay\Kernel\Exceptions\InvalidSignException * @throws \GuzzleHttp\Exception\GuzzleException */ - public function close(string $out_trade_no) + public function transfer(array $payload) { //构造查询业务请求参数对象 - $closeContentBuilder = new AlipayTradeCloseContentBuilder(); - $closeContentBuilder->setOutTradeNo($out_trade_no); + $contentBuilder = new AlipayFundTransUniTransferContentBuilder(); + $contentBuilder->setOutBizNo($payload['out_biz_no']); + $contentBuilder->setTransAmount($payload['trans_amount']); + $contentBuilder->setIdentity($payload['identity']); + if (isset($payload['identity_type'])) { + $contentBuilder->setIdentity($payload['identity_type']); + } + if (isset($payload['name'])) { + $contentBuilder->setIdentityName($payload['name']); + } + if (isset($payload['remark'])) { + $contentBuilder->setRemark($payload['remark']); + } + if (isset($payload['biz_scene'])) { + $contentBuilder->setBizScene($payload['biz_scene']); + } + if (isset($payload['order_title'])) { + $contentBuilder->setOrderTitle($payload['order_title']); + } + if (isset($payload['original_order_id'])) { + $contentBuilder->setOriginalOrderId($payload['original_order_id']); + } + if (isset($payload['business_params'])) { + $contentBuilder->setBusinessParams($payload['business_params']); + } $request = new AppRequest (); - $request->setBizContent($closeContentBuilder->getBizContent()); - $request->setApiMethodName("alipay.trade.close"); - return($this->execute($request)) ; + $request->setBizContent($contentBuilder->getBizContent()); + $request->setApiMethodName("alipay.fund.trans.uni.transfer"); + return ($this->execute($request)); } } diff --git a/src/Payment/Fund/Client.php b/src/Payment/Fund/Client.php new file mode 100755 index 0000000..87a6159 --- /dev/null +++ b/src/Payment/Fund/Client.php @@ -0,0 +1,31 @@ +setOutTradeNo($out_trade_no); + $request = new AppRequest (); + $request->setBizContent($closeContentBuilder->getBizContent()); + $request->setApiMethodName("alipay.trade.close"); + return($this->execute($request)) ; + } +} diff --git a/src/Payment/Fund/ServiceProvider.php b/src/Payment/Fund/ServiceProvider.php new file mode 100755 index 0000000..3c124ef --- /dev/null +++ b/src/Payment/Fund/ServiceProvider.php @@ -0,0 +1,16 @@ + '', + 'identity_type' => 'ALIPAY_USER_ID', + 'name' => '' + ]; + /** + * 业务备注 + * @var string + */ + protected $remark; + /** + * 转账标题 + * @var string + */ + protected $orderTitle; + /** + * 转账业务请求的扩展参数 + * @var string + */ + protected $businessParams; + + /** + * 获取唯一订单号 + * @return string + */ + public function getOutBizNo() + { + return $this->outBizNo; + } + + /** + * 设置唯一订单号 + * @param $outBizNo + */ + public function setOutBizNo($outBizNo) + { + $this->outBizNo = $outBizNo; + $this->bizContentarr['out_biz_no'] = $outBizNo; + } + + public function getTransAmount() + { + return $this->transAmount; + } + + public function setTransAmount($transAmount) + { + $this->transAmount = $transAmount; + $this->bizContentarr['trans_amount'] = $transAmount; + } + + public function getBizScene() + { + return $this->bizScene; + } + + public function setBizScene($bizScene) + { + $this->bizScene = $bizScene; + $this->bizContentarr['biz_scene'] = $bizScene; + } + + public function getOrderTitle() + { + return $this->orderTitle; + } + + public function setOrderTitle($orderTitle) + { + $this->orderTitle = $orderTitle; + $this->bizContentarr['order_title'] = $orderTitle; + } + + public function getOriginalOrderId() + { + return $this->originalOrderId; + } + + public function setOriginalOrderId($originalOrderId) + { + $this->originalOrderId = $originalOrderId; + $this->bizContentarr['original_order_id'] = $originalOrderId; + } + + public function setIdentity($identity) + { + $this->payeeInfo['identity'] = $identity; + $this->bizContentarr['payee_info'] = $this->payeeInfo; + } + + public function setIdentityType($identityType) + { + $this->payeeInfo['identity_type'] = $identityType; + $this->bizContentarr['payee_info'] = $this->payeeInfo; + } + + public function setIdentityName($name) + { + $this->payeeInfo['name'] = $name; + $this->bizContentarr['payee_info'] = $this->payeeInfo; + } + + public function getRemark() + { + return $this->remark; + } + + public function setRemark($remark) + { + $this->remark = $remark; + $this->bizContentarr['remark'] = $remark; + } + + public function getBusinessParams() + { + return $this->remark; + } + + public function setBusinessParams($businessParams) + { + $this->businessParams = $businessParams; + $this->bizContentarr['business_params'] = $businessParams; + } +} \ No newline at end of file