mirror of
				https://github.com/v2board/v2board.git
				synced 2025-10-31 09:21:46 +08:00 
			
		
		
		
	update: payment service
This commit is contained in:
		| @@ -2,6 +2,7 @@ | |||||||
|  |  | ||||||
| namespace App\Console\Commands; | namespace App\Console\Commands; | ||||||
|  |  | ||||||
|  | use App\Payments\AlipayF2F; | ||||||
| use App\Services\PaymentService; | use App\Services\PaymentService; | ||||||
| use Illuminate\Console\Command; | use Illuminate\Console\Command; | ||||||
|  |  | ||||||
| @@ -38,7 +39,5 @@ class Test extends Command | |||||||
|      */ |      */ | ||||||
|     public function handle() |     public function handle() | ||||||
|     { |     { | ||||||
|         $paymentService = new PaymentService('MGate'); |  | ||||||
|         var_dump($paymentService->form()); |  | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -20,7 +20,7 @@ class PaymentController extends Controller | |||||||
|             if (!$this->handle($verify['trade_no'], $verify['callback_no'])) { |             if (!$this->handle($verify['trade_no'], $verify['callback_no'])) { | ||||||
|                 abort(500, 'handle error'); |                 abort(500, 'handle error'); | ||||||
|             } |             } | ||||||
|             die('success'); |             die(isset($paymentService->customResult) ? $paymentService->customResult : 'success'); | ||||||
|         } catch (\Exception $e) { |         } catch (\Exception $e) { | ||||||
|             abort(500, 'fail'); |             abort(500, 'fail'); | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -7,6 +7,12 @@ use App\Models\Payment; | |||||||
|  |  | ||||||
| class PaymentService | class PaymentService | ||||||
| { | { | ||||||
|  |     public $method; | ||||||
|  |     public $customResult; | ||||||
|  |     protected $class; | ||||||
|  |     protected $config; | ||||||
|  |     protected $payment; | ||||||
|  |  | ||||||
|     public function __construct($method, $id = NULL, $uuid = NULL) |     public function __construct($method, $id = NULL, $uuid = NULL) | ||||||
|     { |     { | ||||||
|         $this->method = $method; |         $this->method = $method; | ||||||
| @@ -22,6 +28,7 @@ class PaymentService | |||||||
|             $this->config['uuid'] = $payment['uuid']; |             $this->config['uuid'] = $payment['uuid']; | ||||||
|         }; |         }; | ||||||
|         $this->payment = new $this->class($this->config); |         $this->payment = new $this->class($this->config); | ||||||
|  |         if (isset($this->payment->customResult)) $this->customResult = $this->payment->customResult; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public function notify($params) |     public function notify($params) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user