notifyApi = new LakalaNotifyApi($this->config->getV3Config()); } public function notify(): void { $headers = getallheaders(); $body = file_get_contents('php://input'); $this->log->debug('lakala notify headers:{headers} body:{body}', [ 'headers' => json_encode($headers), 'body' => $body ]); $notify = $this->notifyApi->notiApi($headers, $body); $inBody = $notify->getOriginalText(); if (!json_validate($inBody)) { throw_logic_exception('lakala notify json error'); } $bodyArr = json_decode($inBody, true); $payment = ExtensionPaymentModel::where(['transaction_id' => $bodyArr['trade_no']])->findOrEmpty(); if ($payment->isEmpty()) { throw_logic_exception('lakala notify transaction_id error'); } if ($payment->status != PaymentStatusEnum::PENDING) { throw_logic_exception('lakala notify transaction_id status error'); } $this->paymentProvider->query($payment->id); $this->log->debug('lakala notified success {transaction_id}', ['transaction_id' => $payment->transaction_id]); } }