[更新]增加支付宝加载机制

This commit is contained in:
Anyon 2018-10-30 18:06:47 +08:00
parent 1505a043ba
commit faa9b8d0f1
11 changed files with 30 additions and 10 deletions

View File

@ -17,7 +17,7 @@ namespace AliPay;
use AliPay\Contracts\AliPay;
/**
* 支付宝转账
* 支付宝转账到账户
* Class Transfer
* @package AliPay
*/

View File

@ -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(), // 商户订单号

View File

@ -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)

View File

@ -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);

View File

@ -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', // 订单号

View File

@ -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 '<pre>';

View File

@ -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', // 订单号

View File

@ -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' => '', // 订单号

View File

@ -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(), // 商户订单号

View File

@ -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(), // 商户订单号

11
We.php
View File

@ -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);