notify($request->input()); if (!$verify) return $this->fail([422, 'verify error']); if (!$this->handle($verify['trade_no'], $verify['callback_no'])) { return $this->fail([400, 'handle error']); } return (isset($verify['custom_result']) ? $verify['custom_result'] : 'success'); } catch (\Exception $e) { \Log::error($e); return $this->fail([500, 'fail']); } } private function handle($tradeNo, $callbackNo) { $order = Order::where('trade_no', $tradeNo)->first(); if (!$order) { return $this->fail([400202, 'order is not found']); } if ($order->status !== Order::STATUS_PENDING) return true; $orderService = new OrderService($order); if (!$orderService->paid($callbackNo)) { return false; } $payment = Payment::where('id', $order->payment_id)->first(); $telegramService = new TelegramService(); $message = sprintf( "๐Ÿ’ฐๆˆๅŠŸๆ”ถๆฌพ%sๅ…ƒ\n" . "โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”\n" . "ๆ”ฏไป˜ๆŽฅๅฃ๏ผš%s\n" . "ๆ”ฏไป˜ๆธ ้“๏ผš%s\n" . "ๆœฌ็ซ™่ฎขๅ•๏ผš`%s`" , $order->total_amount / 100, $payment->payment, $payment->name, $order->trade_no ); $telegramService->sendMessageWithAdmin($message); return true; } }