mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-30 06:11:38 +08:00
* 更新H5支付方式 * Merge remote-tracking branch 'remotes/gitee/master' into develop * !19 v1.2.0阶段性合并 * update app/Http/Admin/Controllers/UploadController.php. * Merge branch 'develop' of https://gitee.com/koogua/course-tencent-cloud * Merge branch 'master' of https://gitee.com/koogua/course-tencent-cloud * add LICENSE. * 删除文件 LICENSE * !14 修正点击退款404 * !13 修正退款项目空白以及弹窗自适应 * !12 修正退款项目空白以及弹窗自适应 * Merge branch 'master' of https://gitee.com/koogua/course-tencent-cloud * !9 修正插入数据不一致以及后台菜单参数类型报错 * !7 纠正迁移文件和代码实际使用字段不一致 * Merge branch 'master' of https://gitee.com/koogua/course-tencent-cloud * !6 develop->master 1.1.0
67 lines
1.7 KiB
PHP
67 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Services\Pay;
|
|
|
|
use App\Services\Service;
|
|
use Yansongda\Pay\Gateways\Alipay;
|
|
use Yansongda\Pay\Pay;
|
|
|
|
class AlipayGateway extends Service
|
|
{
|
|
|
|
/**
|
|
* @var array
|
|
*/
|
|
protected $settings;
|
|
|
|
public function __construct($options = [])
|
|
{
|
|
$defaults = $this->getSettings('pay.alipay');
|
|
|
|
$this->settings = array_merge($defaults, $options);
|
|
}
|
|
|
|
public function setReturnUrl($returnUrl)
|
|
{
|
|
$this->settings['return_url'] = $returnUrl;
|
|
}
|
|
|
|
public function setNotifyUrl($notifyUrl)
|
|
{
|
|
$this->settings['notify_url'] = $notifyUrl;
|
|
}
|
|
|
|
/**
|
|
* @return Alipay
|
|
*/
|
|
public function getInstance()
|
|
{
|
|
$config = $this->getConfig();
|
|
|
|
$level = $config->get('env') == ENV_DEV ? 'debug' : 'info';
|
|
|
|
$options = [
|
|
'app_id' => $this->settings['app_id'],
|
|
'private_key' => $this->settings['private_key'],
|
|
'ali_public_key' => config_path('alipay/alipayCertPublicKey.crt'), // 支付宝公钥证书
|
|
'alipay_root_cert' => config_path('alipay/alipayRootCert.crt'), // 支付宝根证书
|
|
'app_cert_public_key' => config_path('alipay/appCertPublicKey.crt'), // 应用公钥证书
|
|
'notify_url' => $this->settings['notify_url'],
|
|
'return_url' => $this->settings['return_url'],
|
|
'log' => [
|
|
'file' => log_path('alipay.log'),
|
|
'level' => $level,
|
|
'type' => 'daily',
|
|
'max_file' => 30,
|
|
],
|
|
];
|
|
|
|
if ($config->get('env') == ENV_DEV) {
|
|
$options['mode'] = 'dev';
|
|
}
|
|
|
|
return Pay::alipay($options);
|
|
}
|
|
|
|
}
|