12345678910111213141516171819202122232425262728293031323334 |
- <?php
- namespace app\common\payment;
- use Payment\Client\Refund;
- use Payment\Config;
- use Payment\Common\PayException;
- use support\Cache;
- class Tlpay
- {
- protected $config;
- public function __construct()
- {
- $this->config = config('payment.tl');
- }
- public function refund($data)
- {
- if (!$data){
- return json_fail('参数异常');
- }
- try {
- $ret = Refund::run(Config::TL_REFUND, $this->config, $data);
- file_put_contents(runtime_path('logs/tlpay.log'),json_encode($ret, JSON_UNESCAPED_UNICODE));
- return $ret;
- } catch (PayException $e) {
- throw new PayException("发起退款失败");
- }
- }
- }
|