From faa9b8d0f17630dabe56a068a578b4eb0fe9b4d8 Mon Sep 17 00:00:00 2001 From: Anyon Date: Tue, 30 Oct 2018 18:06:47 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=9B=B4=E6=96=B0]=E5=A2=9E=E5=8A=A0=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E5=AE=9D=E5=8A=A0=E8=BD=BD=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AliPay/Transfer.php | 2 +- Test/alipay-app.php | 3 ++- Test/alipay-bill.php | 3 ++- Test/alipay-notify.php | 3 ++- Test/alipay-pos.php | 3 ++- Test/alipay-refund.php | 3 ++- Test/alipay-scan.php | 3 ++- Test/alipay-transfer.php | 3 ++- Test/alipay-wap.php | 3 ++- Test/alipay-web.php | 3 ++- We.php | 11 +++++++++++ 11 files changed, 30 insertions(+), 10 deletions(-) diff --git a/AliPay/Transfer.php b/AliPay/Transfer.php index 9aabc0c..1db65ee 100644 --- a/AliPay/Transfer.php +++ b/AliPay/Transfer.php @@ -17,7 +17,7 @@ namespace AliPay; use AliPay\Contracts\AliPay; /** - * 支付宝转账 + * 支付宝转账到账户 * Class Transfer * @package AliPay */ diff --git a/Test/alipay-app.php b/Test/alipay-app.php index e36e0f2..a905328 100644 --- a/Test/alipay-app.php +++ b/Test/alipay-app.php @@ -20,7 +20,8 @@ $config = include "./alipay.php"; try { // 实例支付对象 - $pay = new \AliPay\App($config); + $pay = \We::AliPayApp($config); + // $pay = new \AliPay\App($config); // 请参考(请求参数):https://docs.open.alipay.com/api_1/alipay.trade.app.pay $result = $pay->apply([ 'out_trade_no' => time(), // 商户订单号 diff --git a/Test/alipay-bill.php b/Test/alipay-bill.php index 42f7615..bade9d4 100644 --- a/Test/alipay-bill.php +++ b/Test/alipay-bill.php @@ -20,7 +20,8 @@ $config = include "./alipay.php"; try { // 实例支付对象 - $pay = new \AliPay\Bill($config); + $pay = \We::AliPayBill($config); + // $pay = new \AliPay\Bill($config); // 请参考(请求参数):https://docs.open.alipay.com/api_15/alipay.data.dataservice.bill.downloadurl.query $result = $pay->apply([ 'bill_date' => '2017-11-03', // 账单时间(日账单yyyy-MM-dd,月账单 yyyy-MM) diff --git a/Test/alipay-notify.php b/Test/alipay-notify.php index 8824f60..9e9b84b 100644 --- a/Test/alipay-notify.php +++ b/Test/alipay-notify.php @@ -19,7 +19,8 @@ include "../include.php"; $config = include "./alipay.php"; // 实例支付对象 -$pay = new \AliPay\App($config); +$pay = \We::AliPayApp($config); +// $pay = new \AliPay\App($config); if ($pay->verify($_POST)) { file_put_contents('notify.txt', "收到来自支付宝的异步通知\r\n", FILE_APPEND); file_put_contents('notify.txt', '订单号:' . $_POST['out_trade_no'] . "\r\n", FILE_APPEND); diff --git a/Test/alipay-pos.php b/Test/alipay-pos.php index 509e72f..4900374 100644 --- a/Test/alipay-pos.php +++ b/Test/alipay-pos.php @@ -20,7 +20,8 @@ $config = include "./alipay.php"; try { // 实例支付对象 - $pay = new \AliPay\Pos($config); + $pay = We::AliPayPos($config); + // $pay = new \AliPay\Pos($config); // 参数链接:https://docs.open.alipay.com/api_1/alipay.trade.pay $result = $pay->apply([ 'out_trade_no' => '4312412343', // 订单号 diff --git a/Test/alipay-refund.php b/Test/alipay-refund.php index 22579ef..57fb0bf 100644 --- a/Test/alipay-refund.php +++ b/Test/alipay-refund.php @@ -25,7 +25,8 @@ $refund_fee = '1.00'; try { // 实例支付对象 - $pay = new \AliPay\App($config); + $pay = We::AliPayApp($config); + // $pay = new \AliPay\App($config); // 参考链接:https://docs.open.alipay.com/api_1/alipay.trade.refund $result = $pay->refund($out_trade_no, $refund_fee); echo '
';
diff --git a/Test/alipay-scan.php b/Test/alipay-scan.php
index 4157b33..0a11076 100644
--- a/Test/alipay-scan.php
+++ b/Test/alipay-scan.php
@@ -20,7 +20,8 @@ $config = include "./alipay.php";
 
 try {
     // 实例支付对象
-    $pay = new \AliPay\Scan($config);
+    $pay = We::AliPayScan($config);
+    // $pay = new \AliPay\Scan($config);
     // 参考链接:https://docs.open.alipay.com/api_1/alipay.trade.precreate
     $result = $pay->apply([
         'out_trade_no' => '14321412', // 订单号
diff --git a/Test/alipay-transfer.php b/Test/alipay-transfer.php
index 21a3d8b..54ba8ac 100644
--- a/Test/alipay-transfer.php
+++ b/Test/alipay-transfer.php
@@ -20,7 +20,8 @@ $config = include "./alipay.php";
 
 try {
     // 实例支付对象
-    $pay = new \AliPay\Scan($config);
+    $pay = We::AliPayTransfer($config);
+    // $pay = new \AliPay\Scan($config);
     // 参考链接:https://docs.open.alipay.com/api_28/alipay.fund.trans.toaccount.transfer
     $result = $pay->apply([
         'out_biz_no'      => '', // 订单号
diff --git a/Test/alipay-wap.php b/Test/alipay-wap.php
index ba8f616..8a0aab3 100644
--- a/Test/alipay-wap.php
+++ b/Test/alipay-wap.php
@@ -23,7 +23,8 @@ $config['return_url'] = 'http://pay.thinkadmin.top/test/alipay-success.php';
 
 try {
     // 实例支付对象
-    $pay = new \AliPay\Wap($config);
+    $pay = We::AliPayWap($config);
+    // $pay = new \AliPay\Wap($config);
     // 参考链接:https://docs.open.alipay.com/api_1/alipay.trade.wap.pay
     $result = $pay->apply([
         'out_trade_no' => time(), // 商户订单号
diff --git a/Test/alipay-web.php b/Test/alipay-web.php
index dd52fe7..2225f11 100644
--- a/Test/alipay-web.php
+++ b/Test/alipay-web.php
@@ -24,7 +24,8 @@ $config['return_url'] = 'http://pay.thinkadmin.top/test/alipay-success.php';
 
 try {
     // 实例支付对象
-    $pay = new \AliPay\Web($config);
+    $pay = We::AliPayWeb($config);
+    // $pay = new \AliPay\Web($config);
     // 参考链接:https://docs.open.alipay.com/api_1/alipay.trade.page.pay
     $result = $pay->apply([
         'out_trade_no' => time(), // 商户订单号
diff --git a/We.php b/We.php
index f8891d9..74e2b6b 100644
--- a/We.php
+++ b/We.php
@@ -58,6 +58,15 @@ use WeChat\Exceptions\InvalidInstanceException;
  * @method \WePay\Redpack WePayRedpack($options = []) static 微信红包支持
  * @method \WePay\Transfers WePayTransfers($options = []) static 微信商户打款到零钱
  * @method \WePay\TransfersBank WePayTransfersBank($options = []) static 微信商户打款到银行卡
+ *
+ * ----- AliPay ----
+ * @method \AliPay\App AliPayApp($options) static 支付宝App支付网关
+ * @method \AliPay\Bill AliPayBill($options) static 支付宝电子面单下载
+ * @method \AliPay\Pos AliPayPos($options) static 支付宝刷卡支付
+ * @method \AliPay\Scan AliPayScan($options) static 支付宝扫码支付
+ * @method \AliPay\Transfer AliPayTransfer($options) static 支付宝转账到账户
+ * @method \AliPay\Wap AliPayWap($options) static 支付宝手机网站支付
+ * @method \AliPay\Web AliPayWeb($options) static 支付宝网站支付
  */
 class We
 {
@@ -104,6 +113,8 @@ class We
             $class = 'WeMini\\' . substr($name, 6);
         } elseif (substr($name, 0, 5) === 'WePay') {
             $class = 'WePay\\' . substr($name, 5);
+        } elseif (substr($name, 0, 6) === 'AliPay') {
+            $class = 'AliPay\\' . substr($name, 6);
         }
         if (!empty($class) && class_exists($class)) {
             $option = array_shift($arguments);