mirror of
				https://github.com/v2board/v2board.git
				synced 2025-10-31 17:31:49 +08:00 
			
		
		
		
	update
This commit is contained in:
		| @@ -68,10 +68,16 @@ class OrderController extends Controller | ||||
|         } catch (\Stripe\Error\SignatureVerification $e) { | ||||
|             abort(400); | ||||
|         } | ||||
|  | ||||
|         $obj = $event->data->object; | ||||
|         if ($obj['status'] == 'chargeable') { | ||||
|             $trade_no = Redis::get($obj['id']); | ||||
|         switch ($event->type) { | ||||
|             case 'source.chargeable': | ||||
|                 $source = $event->data->object; | ||||
|                 $charge = Charge::create([ | ||||
|                     'amount' => $source['amount'], | ||||
|                     'currency' => $source['currency'], | ||||
|                     'source' => $source['id'], | ||||
|                 ]); | ||||
|                 if ($charge['status'] == 'succeeded') { | ||||
|                     $trade_no = Redis::get($source['id']); | ||||
|                     if (!$trade_no) { | ||||
|                         abort(500, 'redis is not found trade no by stripe source id.'); | ||||
|                     } | ||||
| @@ -83,13 +89,17 @@ class OrderController extends Controller | ||||
|                         die('order is paid'); | ||||
|                     } | ||||
|                     $order->status = 1; | ||||
|             $order->callback_no = $obj['id']; | ||||
|                     $order->callback_no = $source['id']; | ||||
|                     if (!$order->save()) { | ||||
|                         abort(500, 'fail'); | ||||
|                     } | ||||
|             Redis::del($obj['id']); | ||||
|                     Redis::del($source['id']); | ||||
|                     die('success'); | ||||
|                 } | ||||
|                 break; | ||||
|             default: | ||||
|                 abort(500, 'event is not support'); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public function stripeReturn (Request $request) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user