-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
154 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
vendor/ | ||
composer.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"name": "yansongda/laravel-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": "yansongda", | ||
"email": "me@yansongda.cn" | ||
} | ||
], | ||
"require": { | ||
"illuminate/support": "^5.1", | ||
"yansongda/pay": "^1.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Yansongda\\LaravelPay\\": "src" | ||
} | ||
}, | ||
"license": "MIT" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
return [ | ||
'alipay' => [ | ||
// 支付宝分配的 APPID | ||
'app_id' => '', | ||
|
||
// 支付宝异步通知地址 | ||
'notify_url' => '', | ||
|
||
// 支付成功后同步通知地址 | ||
'return_url' => '', | ||
|
||
// 阿里公共密钥,验证签名时使用 | ||
'ali_public_key' => '', | ||
|
||
// 自己的私钥,签名时使用 | ||
'private_key' => '', | ||
], | ||
|
||
'wechat' => [ | ||
// 公众号APPID | ||
'app_id' => '', | ||
|
||
// 小程序APPID | ||
'miniapp_id' => '', | ||
|
||
// APP 引用的 appid | ||
'appid' => '', | ||
|
||
// 微信支付分配的微信商户号 | ||
'mch_id' => '', | ||
|
||
// 微信支付异步通知地址 | ||
'notify_url' => '', | ||
|
||
// 微信支付签名秘钥 | ||
'key' => '', | ||
|
||
// 客户端证书路径,退款时需要用到。请填写绝对路径,linux 请确保权限问题。pem 格式。 | ||
'cert_client' => '', | ||
|
||
// 客户端秘钥路径,退款时需要用到。请填写绝对路径,linux 请确保权限问题。pem 格式。 | ||
'cert_key' => '', | ||
], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace Yansongda\LaravelPay\Facades; | ||
|
||
use Illuminate\Support\Facades\Facade; | ||
|
||
|
||
class Pay extends Facade | ||
{ | ||
/** | ||
* Return the facade accessor. | ||
* | ||
* @return string | ||
*/ | ||
public static function getFacadeAccessor() | ||
{ | ||
return 'pay'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
|
||
namespace Yansongda\LaravelPay; | ||
|
||
use Yansongda\Pay\Pay; | ||
use Illuminate\Support\ServiceProvider; | ||
|
||
class PayServiceProvider extends ServiceProvider | ||
{ | ||
/** | ||
* 显示是否延迟提供程序的加载. | ||
* | ||
* @var bool | ||
*/ | ||
protected $defer = true; | ||
|
||
/** | ||
* boot a service. | ||
* | ||
* @author yansongda <me@yansongda.cn> | ||
* | ||
* @version 2017-08-20 | ||
* | ||
* @return [type] [description] | ||
*/ | ||
public function boot() | ||
{ | ||
if (!file_exists(config_path('pay.php'))) { | ||
$this->publishes([ | ||
dirname(__DIR__) . '/config/pay.php' => config_path('pay.php'), | ||
], 'config'); | ||
} | ||
|
||
|
||
} | ||
|
||
/** | ||
* 在容器中注册绑定. | ||
* | ||
* @return void | ||
*/ | ||
public function register() | ||
{ | ||
$this->mergeConfigFrom(dirname(__DIR__).'/config/pay.php', 'pay'); | ||
|
||
$this->app->singleton(Pay::class, function ($app) { | ||
return new Pay(config('pay')); | ||
}); | ||
|
||
$this->app->alias(Pay::class, 'pay'); | ||
} | ||
|
||
/** | ||
* 获取提供者提供的服务. | ||
* | ||
* @return array | ||
*/ | ||
public function provides() | ||
{ | ||
return [Pay::class, 'pay']; | ||
} | ||
} |