Str::uuid()->getHex()->toString(), 'service' => $service, 'partnerId' => $this->config['partner_id'], 'signType' => 'MD5', 'notifyUrl' => route('yeepay.notify'), ], $data); $data['sign'] = $this->sign($data); $response = Http::asForm()->post($this->config['gateway_url'], $data); $response->throw(); $result = $response->json(); if ($result['success'] && in_array($result['resultCode'], ['EXECUTE_SUCCESS', 'EXECUTE_PROCESSING'])) { return $result; } $message = $result['resultDetail'] ?? $result['resultMessage']; throw new YeePayException($message); } /** * η”Ÿζˆη­Ύε * * @param array $params * @return string */ protected function sign(array $params): string { unset($params['sign']); ksort($params); $str = ''; foreach ($params as $key => $value) { if (blank($value)) { continue; } if ($str !== '') { $str .= '&'; } if (is_array($value)) { $value = json_encode($value); } $str .= "{$key}={$value}"; } $str .= $this->config['secret_key']; return md5($str); } }