diff --git a/v3/docs/Api/AlipayEbppInvoiceApplystatusApi.md b/v3/docs/Api/AlipayEbppInvoiceApplystatusApi.md deleted file mode 100644 index 50cdbea39..000000000 --- a/v3/docs/Api/AlipayEbppInvoiceApplystatusApi.md +++ /dev/null @@ -1,78 +0,0 @@ -# Alipay\OpenAPISDK\AlipayEbppInvoiceApplystatusApi - -All URIs are relative to https://openapi.alipay.com. - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**query()**](AlipayEbppInvoiceApplystatusApi.md#query) | **POST** /v3/alipay/ebpp/invoice/applystatus/query | 根据外部订单号查询开票状态 - - -## `query()` - -```php -query($alipayEbppInvoiceApplystatusQueryModel): \Alipay\OpenAPISDK\Model\AlipayEbppInvoiceApplystatusQueryResponseModel -``` - -根据外部订单号查询开票状态 - -根据外部订单号查询开票状态,仅有申请状态无完整票据信息 - -### Example - -```php -setAppId('app_id'); -$alipayConfig->setPrivateKey('private_key'); -// 密钥模式 -$alipayConfig->setAlipayPublicKey('alipay_public_key'); -// 证书模式 -// $alipayConfig->setAppCertPath('../appCertPublicKey.crt'); -// $alipayConfig->setAlipayPublicCertPath('../alipayCertPublicKey_RSA2.crt'); -// $alipayConfig->setRootCertPath('../alipayRootCert.crt'); -$alipayConfig->setEncryptKey('encrypt_key'); -$alipayConfigUtil = new \Alipay\OpenAPISDK\Util\AlipayConfigUtil($alipayConfig); -$apiInstance->setAlipayConfigUtil($alipayConfigUtil); - -$alipayEbppInvoiceApplystatusQueryModel = new \Alipay\OpenAPISDK\Model\AlipayEbppInvoiceApplystatusQueryModel(); // \Alipay\OpenAPISDK\Model\AlipayEbppInvoiceApplystatusQueryModel - -try { - $result = $apiInstance->query($alipayEbppInvoiceApplystatusQueryModel); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling AlipayEbppInvoiceApplystatusApi->query: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **alipayEbppInvoiceApplystatusQueryModel** | **\Alipay\OpenAPISDK\Model\AlipayEbppInvoiceApplystatusQueryModel**| | [optional] - -### Return type - -**\Alipay\OpenAPISDK\Model\AlipayEbppInvoiceApplystatusQueryResponseModel** - -### Authorization - -No authorization required - -### HTTP request headers - -- **Content-Type**: `application/json` -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../../README.md#api-endpoints) -[[Back to README]](../../README.md) diff --git a/v3/src/Api/AlipayEbppInvoiceApplystatusApi.php b/v3/src/Api/AlipayEbppInvoiceApplystatusApi.php deleted file mode 100644 index 5b57bea39..000000000 --- a/v3/src/Api/AlipayEbppInvoiceApplystatusApi.php +++ /dev/null @@ -1,568 +0,0 @@ -client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); - $this->headerSelector = $selector ?: new HeaderSelector(); - $this->hostIndex = $hostIndex; - $this->alipayConfigUtil = $alipayConfigUtil ?: new AlipayConfigUtil(); - } - - /** - * @return AlipayConfigUtil - */ - public function getAlipayConfigUtil(): AlipayConfigUtil - { - return $this->alipayConfigUtil; - } - - /** - * @param AlipayConfigUtil $alipayConfigUtil - */ - public function setAlipayConfigUtil(AlipayConfigUtil $alipayConfigUtil): void - { - $this->alipayConfigUtil = $alipayConfigUtil; - } - - /** - * Set the host index - * - * @param int $hostIndex Host index (required) - */ - public function setHostIndex($hostIndex): void - { - $this->hostIndex = $hostIndex; - } - - /** - * Get the host index - * - * @return int Host index - */ - public function getHostIndex() - { - return $this->hostIndex; - } - - /** - * @return Configuration - */ - public function getConfig() - { - return $this->config; - } - - /** - * Operation query - * - * 根据外部订单号查询开票状态 - * - * @param \Alipay\OpenAPISDK\Model\AlipayEbppInvoiceApplystatusQueryModel $alipayEbppInvoiceApplystatusQueryModel alipayEbppInvoiceApplystatusQueryModel (optional) - * @param CustomizedParams $customizedParams - * - * @throws \Alipay\OpenAPISDK\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Alipay\OpenAPISDK\Model\AlipayEbppInvoiceApplystatusQueryResponseModel|\Alipay\OpenAPISDK\Model\AlipayEbppInvoiceApplystatusQueryDefaultResponse - */ - public function query($alipayEbppInvoiceApplystatusQueryModel = null, CustomizedParams $customizedParams = null) - { - list($response) = $this->queryWithHttpInfo($alipayEbppInvoiceApplystatusQueryModel, $customizedParams); - return $response; - } - - /** - * Operation queryWithHttpInfo - * - * 根据外部订单号查询开票状态 - * - * @param \Alipay\OpenAPISDK\Model\AlipayEbppInvoiceApplystatusQueryModel $alipayEbppInvoiceApplystatusQueryModel (optional) - * @param CustomizedParams $customizedParams - * - * @throws \Alipay\OpenAPISDK\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Alipay\OpenAPISDK\Model\AlipayEbppInvoiceApplystatusQueryResponseModel|\Alipay\OpenAPISDK\Model\AlipayEbppInvoiceApplystatusQueryDefaultResponse, HTTP status code, HTTP response headers (array of strings) - */ - public function queryWithHttpInfo($alipayEbppInvoiceApplystatusQueryModel = null, CustomizedParams $customizedParams = null) - { - $request = $this->queryRequest($alipayEbppInvoiceApplystatusQueryModel, $customizedParams); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - if ($e->getResponse()) { - //验签 - $this->alipayConfigUtil->verifyResponse((string)$e->getResponse()->getBody(), - $e->getResponse()->getHeaders(), true); - } - AlipayLogger::logBizError("code:{$e->getCode()}, message:{$e->getMessage()}"); - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - AlipayLogger::logBizError("code:{$e->getCode()}, message:{$e->getMessage()}"); - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - //验签 - $bodyStr = (string)$response->getBody(); - $this->alipayConfigUtil->verifyResponse($bodyStr, $response->getHeaders(), true); - AlipayLogger::logBizError("code:{$statusCode}, message:{$bodyStr}"); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $bodyStr - ); - } - - switch($statusCode) { - case 200: - if ('\Alipay\OpenAPISDK\Model\AlipayEbppInvoiceApplystatusQueryResponseModel' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - //验签 - $this->alipayConfigUtil->verifyResponse($content, $response->getHeaders(), false); - //解密 - $content = $this->alipayConfigUtil->decrypt($content); - if ('\Alipay\OpenAPISDK\Model\AlipayEbppInvoiceApplystatusQueryResponseModel' !== 'string') { - $content = json_decode($content); - } - } - AlipayLogger::logBizResponseInfo($response->getStatusCode(), $content, $response->getHeaders()); - - return [ - ObjectSerializer::deserialize($content, '\Alipay\OpenAPISDK\Model\AlipayEbppInvoiceApplystatusQueryResponseModel', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - default: - if ('\Alipay\OpenAPISDK\Model\AlipayEbppInvoiceApplystatusQueryDefaultResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - //验签 - $this->alipayConfigUtil->verifyResponse($content, $response->getHeaders(), true); - if ('\Alipay\OpenAPISDK\Model\AlipayEbppInvoiceApplystatusQueryDefaultResponse' !== 'string') { - $content = json_decode($content); - } - } - AlipayLogger::logBizResponseInfo($response->getStatusCode(), $content, $response->getHeaders()); - - return [ - //ObjectSerializer::deserialize($content, '\Alipay\OpenAPISDK\Model\AlipayEbppInvoiceApplystatusQueryDefaultResponse', []), - $content, - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\Alipay\OpenAPISDK\Model\AlipayEbppInvoiceApplystatusQueryResponseModel'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - //验签 - $this->alipayConfigUtil->verifyResponse($content, $response->getHeaders(), false); - //解密 - $content = $this->alipayConfigUtil->decrypt($content); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - AlipayLogger::logBizResponseInfo($response->getStatusCode(), $content, $response->getHeaders()); - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Alipay\OpenAPISDK\Model\AlipayEbppInvoiceApplystatusQueryResponseModel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - - default: - //$data = ObjectSerializer::deserialize( - // $e->getResponseBody(), - // '\Alipay\OpenAPISDK\Model\AlipayEbppInvoiceApplystatusQueryDefaultResponse', - // $e->getResponseHeaders() - //); - //$e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation queryAsync - * - * 根据外部订单号查询开票状态 - * - * @param \Alipay\OpenAPISDK\Model\AlipayEbppInvoiceApplystatusQueryModel $alipayEbppInvoiceApplystatusQueryModel (optional) - * @param CustomizedParams $customizedParams - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - * @deprecated - */ - public function queryAsync($alipayEbppInvoiceApplystatusQueryModel = null, CustomizedParams $customizedParams = null) - { - return $this->queryAsyncWithHttpInfo($alipayEbppInvoiceApplystatusQueryModel, $customizedParams) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation queryAsyncWithHttpInfo - * - * 根据外部订单号查询开票状态 - * - * @param \Alipay\OpenAPISDK\Model\AlipayEbppInvoiceApplystatusQueryModel $alipayEbppInvoiceApplystatusQueryModel (optional) - * @param CustomizedParams $customizedParams - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - * @deprecated - */ - public function queryAsyncWithHttpInfo($alipayEbppInvoiceApplystatusQueryModel = null, CustomizedParams $customizedParams = null) - { - $returnType = '\Alipay\OpenAPISDK\Model\AlipayEbppInvoiceApplystatusQueryResponseModel'; - $request = $this->queryRequest($alipayEbppInvoiceApplystatusQueryModel, $customizedParams); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - //验签 - $this->alipayConfigUtil->verifyResponse($content, $response->getHeaders(), false); - //解密 - $content = $this->alipayConfigUtil->decrypt($content); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - //验签 - $this->alipayConfigUtil->verifyResponse((string)$response->getBody(), $response->getHeaders(), true); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'query' - * - * @param \Alipay\OpenAPISDK\Model\AlipayEbppInvoiceApplystatusQueryModel $alipayEbppInvoiceApplystatusQueryModel (optional) - * @param CustomizedParams $customizedParams - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function queryRequest($alipayEbppInvoiceApplystatusQueryModel = null, CustomizedParams $customizedParams = null) - { - - $resourcePath = '/v3/alipay/ebpp/invoice/applystatus/query'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - $signContent = ''; - $isEncrypt = $this->alipayConfigUtil->isEncrypt(); - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - if ($headers['Content-Type'] === 'multipart/form-data') { - $multipart = true; - unset($headers['Content-Type']); - } - - // for model (json/xml) - //自定义body内容 - if (($customizedParams != null && !$this->getAlipayConfigUtil()->checkEmpty($customizedParams->getBodyContent())) - && ($headers['Content-Type'] === 'application/json' || $isEncrypt)) { - $signContent = $this->alipayConfigUtil->encrypt($customizedParams->getBodyContent(), $headers, $multipart); - $httpBody = $signContent; - } elseif (isset($alipayEbppInvoiceApplystatusQueryModel)) { - $signContent = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($alipayEbppInvoiceApplystatusQueryModel), JSON_UNESCAPED_UNICODE); - if ($headers['Content-Type'] === 'application/json' || $isEncrypt) { - $signContent = $this->alipayConfigUtil->encrypt($signContent, $headers, $multipart); - $httpBody = $signContent; - } else { - $httpBody = $alipayEbppInvoiceApplystatusQueryModel; - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - if (is_string($formParamValueItem)) { - $signContent = $formParamValueItem; - } - //加密时非文件字段对应的Content-Type类型为text/plain - if ($isEncrypt && is_string($formParamValueItem)) { - $signContent = $this->alipayConfigUtil->encrypt($formParamValueItem, $headers, true); - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $signContent, - 'headers' => ['Content-Type' => 'text/plain'] - ]; - } else { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem, - 'headers' => ['Content-Type' => 'application/json'] - ]; - } - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $signContent = $this->alipayConfigUtil->encrypt(\GuzzleHttp\json_encode($formParams, JSON_UNESCAPED_UNICODE), $headers); - $httpBody = $signContent; - - } else { - // for HTTP post (form) - $signContent = $this->alipayConfigUtil->encrypt(ObjectSerializer::buildQuery($formParams), $headers); - $httpBody = $signContent; - } - } - - - if ($isEncrypt) { - $headers['alipay-encrypt-type'] = $this->alipayConfigUtil->getEncryptType(); - //除文件上传接口,加密后Content-Type均为"text/plain" - if (!$multipart) { - $headers['Content-Type'] = 'text/plain'; - } - } - - if ($customizedParams != null) { - //额外query参数 - if (is_array($customizedParams->getQueryParams()) && count($customizedParams->getQueryParams()) >= 0) { - foreach ($customizedParams->getQueryParams() as $k => $v) { - if (is_array($v)) { - $v = ObjectSerializer::serializeCollection($v, 'form'); - } - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue($v, $k) ?? []); - } - } - - if (!$this->alipayConfigUtil->checkEmpty($customizedParams->getAppAuthToken())) { - $headerParams["alipay-app-auth-token"] = $customizedParams->getAppAuthToken(); - } - - //额外非全局header参数 - if (is_array($customizedParams->getHeaderParams()) && count($customizedParams->getHeaderParams()) >= 0) { - foreach ($customizedParams->getHeaderParams() as $k => $v) { - if (is_array($v)) { - $v = ObjectSerializer::serializeCollection($v, 'form'); - } - $headerParams[$k] = ObjectSerializer::toHeaderValue($v); - } - } - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - if ($this->config->getSdkVersion()) { - $defaultHeaders['alipay-sdk-version'] = $this->config->getSdkVersion(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - if (!array_key_exists('alipay-request-id', $headers)) { - $headers['alipay-request-id'] = $this->alipayConfigUtil->createUuid(); - } - - $query = ObjectSerializer::buildQuery($queryParams); - $url = $resourcePath . ($query ? "?{$query}" : ''); - //加签 - $this->alipayConfigUtil->sign('POST', $url, $signContent, $headers); - - $basePath = $this->alipayConfigUtil->checkEmpty($this->alipayConfigUtil->getServerUrl()) ? $this->config->getHost() : $this->alipayConfigUtil->getServerUrl(); - AlipayLogger::logBizInfo($basePath . $url, $signContent, 'POST', $multipart ? "multipart/form-data" : $headers['Content-Type'], $headers['alipay-request-id']); - return new Request( - 'POST', - $basePath . $url, - $headers, - $httpBody - ); - } - - /** - * Create http client option - * - * @throws \RuntimeException on file opening failure - * @return array of http client options - */ - protected function createHttpClientOption() - { - $options = []; - if ($this->config->getDebug()) { - $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); - if (!$options[RequestOptions::DEBUG]) { - throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); - } - } - - return $options; - } -}