Skip to content

Commit

Permalink
add: test alipay code
Browse files Browse the repository at this point in the history
  • Loading branch information
falstack committed Jun 3, 2019
1 parent 29ff023 commit c89673d
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use Illuminate\Support\Facades\Crypt;
use Illuminate\Http\Request;

class CallbackController extends Controller
class AuthController extends Controller
{
/**
* QQ第三方登录调用授权
Expand Down
34 changes: 34 additions & 0 deletions app/Http/Controllers/PayController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
/**
* Created by PhpStorm.
* User: yuistack
* Date: 2019-05-10
* Time: 16:08
*/

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Yansongda\LaravelPay\Facades\Pay;

class PayController extends Controller
{
public function createAlipayOrder(Request $request)
{
$order = [
'out_trade_no' => time(),
'total_amount' => '0.01',
'subject' => 'test subject - 测试',
'http_method' => 'GET'
];

$alipay = Pay::alipay()->web($order);

return $alipay;
}

public function alipayCallback(Request $request)
{
return $this->resOK($request->all());
}
}
4 changes: 2 additions & 2 deletions config/pay.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
'notify_url' => '',

// 支付成功后同步通知地址
'return_url' => '',
'return_url' => 'https://api.calibur.tv/callback/alipay/pay_v1',

// 阿里公共密钥,验证签名时使用
'ali_public_key' => env('ALI_PUBLIC_KEY', ''),
Expand All @@ -26,7 +26,7 @@
],

// optional,设置此参数,将进入沙箱模式
// 'mode' => 'dev',
'mode' => 'dev',
],

'wechat' => [
Expand Down
19 changes: 13 additions & 6 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,28 @@

$route->group(['prefix' => '/callback'], function () use ($route)
{
$route->group(['prefix' => '/alipay'], function () use ($route)
{
$route->get('/create_order', 'PayController@createAlipayOrder');

$route->get('/pay_v1', 'PayController@alipayCallback');
});

$route->group(['prefix' => '/auth'], function () use ($route)
{
$route->get('/qq', 'CallbackController@qqAuthRedirect');
$route->get('/qq', 'AuthController@qqAuthRedirect');

$route->get('/wechat', 'CallbackController@wechatAuthRedirect');
$route->get('/wechat', 'AuthController@wechatAuthRedirect');

$route->get('/weixin', 'CallbackController@weixinAuthRedirect');
$route->get('/weixin', 'AuthController@weixinAuthRedirect');
});

$route->group(['prefix' => '/oauth2'], function () use ($route)
{
$route->get('/qq', 'CallbackController@qqAuthEntry');
$route->get('/qq', 'AuthController@qqAuthEntry');

$route->get('/wechat', 'CallbackController@wechatAuthEntry');
$route->get('/wechat', 'AuthController@wechatAuthEntry');

$route->get('/weixin', 'CallbackController@weixinAuthEntry');
$route->get('/weixin', 'AuthController@weixinAuthEntry');
});
});

0 comments on commit c89673d

Please sign in to comment.