<?php

namespace Modules\Payment\Models\Traits;

use Modules\Payment\Models\Setting;

trait WithConfig
{

    /**
     * Notes: 获取配置文件
     * @Author: 玄尘
     * @Date  : 2021/11/2 15:27
     * @param  string  $driver
     * @return array
     * @throws \Exception
     */
    public function getPayConfig(string $driver, $gateway = '')
    {
        $defaule_config = Setting::getDefaultConfig($driver);

        if (config('payment.version', 2) == 3) {
            $config = [
                $driver  => [
                    'default' => $defaule_config,
                ],
                'logger' => array_merge($defaule_config['logger'], [
                    'enable' => config('payment.logger', true),
                ]),
            ];
        }

        return $config;

    }

}