commit
1218435448
@ -0,0 +1,3 @@
|
||||
vendor/
|
||||
composer.lock
|
||||
.idea
|
@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017 yansongda <me@yansongda.cn>
|
||||
|
||||
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.
|
@ -0,0 +1,35 @@
|
||||
{
|
||||
"name": "feizhiyi/pay",
|
||||
"description": "专注 Alipay 和 WeChat 的 laravel 支付扩展包",
|
||||
"keywords": ["alipay", "wechat", "pay", "laravel", "package"],
|
||||
"support": {
|
||||
"issues": "https://github.com/yansongda/laravel-pay/issues",
|
||||
"source": "https://github.com/yansongda/laravel-pay"
|
||||
},
|
||||
"authors": [
|
||||
{
|
||||
"name": "feizhiyi",
|
||||
"email": "me@feizhiyi.cn"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"illuminate/support": "^5.1 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0",
|
||||
"yansongda/pay": "^2.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Yansongda\\LaravelPay\\": "src"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Yansongda\\LaravelPay\\PayServiceProvider"
|
||||
],
|
||||
"aliases": {
|
||||
"Pay": "Yansongda\\LaravelPay\\Facades\\Pay"
|
||||
}
|
||||
}
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace Yansongda\LaravelPay\Facades;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
use Yansongda\Pay\Gateways\Alipay;
|
||||
use Yansongda\Pay\Gateways\Wechat;
|
||||
|
||||
class Pay extends Facade
|
||||
{
|
||||
/**
|
||||
* Return the facade accessor.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getFacadeAccessor()
|
||||
{
|
||||
return 'pay.alipay';
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the facade accessor.
|
||||
*
|
||||
* @return Alipay
|
||||
*/
|
||||
public static function alipay()
|
||||
{
|
||||
return app('pay.alipay');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the facade accessor.
|
||||
*
|
||||
* @return Wechat
|
||||
*/
|
||||
public static function wechat()
|
||||
{
|
||||
return app('pay.wechat');
|
||||
}
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace Yansongda\LaravelPay;
|
||||
|
||||
use Illuminate\Foundation\Application as LaravelApplication;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Laravel\Lumen\Application as LumenApplication;
|
||||
use Yansongda\Pay\Pay;
|
||||
|
||||
class PayServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* If is defer.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $defer = true;
|
||||
|
||||
/**
|
||||
* Boot the service.
|
||||
*
|
||||
* @author yansongda <me@yansongda.cn>
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
if ($this->app instanceof LaravelApplication && $this->app->runningInConsole()) {
|
||||
$this->publishes([
|
||||
dirname(__DIR__).'/config/pay.php' => config_path('pay.php'), ],
|
||||
'laravel-pay'
|
||||
);
|
||||
} elseif ($this->app instanceof LumenApplication) {
|
||||
$this->app->configure('pay');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the service.
|
||||
*
|
||||
* @author yansongda <me@yansongda.cn>
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->mergeConfigFrom(dirname(__DIR__).'/config/pay.php', 'pay');
|
||||
|
||||
$this->app->singleton('pay.alipay', function () {
|
||||
return Pay::alipay(config('pay.alipay'));
|
||||
});
|
||||
$this->app->singleton('pay.wechat', function () {
|
||||
return Pay::wechat(config('pay.wechat'));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get services.
|
||||
*
|
||||
* @author yansongda <me@yansongda.cn>
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provides()
|
||||
{
|
||||
return ['pay.alipay', 'pay.wechat'];
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue