diff --git a/docs/v2/accounting/index.html b/docs/v2/accounting/index.html index 552ab316..2a6c2d49 100644 --- a/docs/v2/accounting/index.html +++ b/docs/v2/accounting/index.html @@ -2104,6 +2104,11 @@ "type" : "string", "description" : "Tax number of contact – this is also known as the ABN (Australia), GST Number (New Zealand), VAT Number (UK) or Tax ID Number (US and global) in the Xero UI depending on which regionalized version of Xero you are using (max length = 50)" }, + "TaxNumberType" : { + "type" : "string", + "description" : "Identifier of the regional type of tax number, such as US, UK, or other regional tax identifiers", + "enum" : [ "SSN", "EIN", "ITIN", "ATIN" ] + }, "AccountsReceivableTaxType" : { "type" : "string", "description" : "The tax type from TaxRates" diff --git a/docs/v2/payroll_nz/index.html b/docs/v2/payroll_nz/index.html index 8f00a6ea..421d4a83 100644 --- a/docs/v2/payroll_nz/index.html +++ b/docs/v2/payroll_nz/index.html @@ -4295,9 +4295,6 @@
  • updateEmployeeTax
  • -
  • - updatePayRun -
  • updatePaySlipLineItems
  • @@ -14821,193 +14818,6 @@

    Parameters

    } }, "required" : true -} - - - - -
    -
    -
    -
    -

    updatePayRun

    -

    Updates a pay run

    -
    -
    -
    -

    -

    -

    -
    -
    /PayRuns/{PayRunID}
    -

    -

    Usage and SDK Samples

    -

    - -
    - -
    -
    <?php
    -require_once(__DIR__ . '/vendor/autoload.php');
    -
    -// Configure OAuth2 access token for authorization: OAuth2
    -$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       
    -
    -$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    -    new GuzzleHttp\Client(),
    -    $config
    -);
    -$xeroTenantId = "xeroTenantId_example";
    -$payRunID = "38400000-8cf0-11bd-b23e-10b96e4ef00d";
    -$idempotencyKey = "KEY_VALUE";
    -$startDate = new DateTime('2020-10-28');
    -$paymentDate = new DateTime('2020-10-30');
    -
    -$payRunCalendar = new XeroAPI\XeroPHP\Models\PayrollNz\PayRunCalendar;
    -$payRunCalendar->setCalendarType(XeroAPI\XeroPHP\Models\PayrollNz\CalendarType.WEEKLY);
    -$payRunCalendar->setPeriodStartDate($startDate);
    -$payRunCalendar->setPaymentDate($paymentDate);
    -
    -try {
    -  $result = $apiInstance->updatePayRun($xeroTenantId, $payRunID, $payRun, $idempotencyKey);
    -} catch (Exception $e) {
    -  echo 'Exception when calling PayrollNzApi->updatePayRun: ', $e->getMessage(), PHP_EOL;
    -}
    -?>
    -
    -
    -
    -

    Scopes

    - - - - - - - -
    payroll.payrunsGrant read-write access to payroll payruns
    -

    Parameters

    -
    Path parameters
    - - - - - - - - - -
    NameDescription
    PayRunID* - - -
    -
    -
    - - UUID - - - (uuid) - - -
    -Identifier for the pay run -
    -
    -
    - Required -
    -
    -
    -
    -
    Header parameters
    - - - - - - - - - - - - - -
    NameDescription
    Xero-Tenant-Id* - - -
    -
    -
    - - String - - -
    -Xero identifier for Tenant -
    -
    -
    - Required -
    -
    -
    -
    Idempotency-Key - - -
    -
    -
    - - String - - -
    -This allows you to safely retry requests without the risk of duplicate processing. 128 character max. -
    -
    -
    -
    -
    -
    Body parameters
    - - - - - - - -
    NameDescription
    payRun * -
    -
    - - PayRun - -
    - -
    -
    -
    - Required -
    -
    -
    diff --git a/docs/v2/payroll_uk/index.html b/docs/v2/payroll_uk/index.html index 157d372b..c93a88de 100644 --- a/docs/v2/payroll_uk/index.html +++ b/docs/v2/payroll_uk/index.html @@ -3805,9 +3805,6 @@
  • updateEmployeeSalaryAndWage
  • -
  • - updatePayRun -
  • updateTimesheetLine
  • @@ -14088,193 +14085,6 @@

    Parameters

    } }, "required" : true -} - - -
    -
    -
    -
    -
    -
    -

    updatePayRun

    -

    Updates a specific pay run

    -
    -
    -
    -

    -

    -

    -
    -
    /PayRuns/{PayRunID}
    -

    -

    Usage and SDK Samples

    -

    - -
    - -
    -
    <?php
    -require_once(__DIR__ . '/vendor/autoload.php');
    -
    -// Configure OAuth2 access token for authorization: OAuth2
    -$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       
    -
    -$apiInstance = new XeroAPI\XeroPHP\Api\PayrollUkApi(
    -    new GuzzleHttp\Client(),
    -    $config
    -);
    -$xeroTenantId = "xeroTenantId_example";
    -$payRunID = "38400000-8cf0-11bd-b23e-10b96e4ef00d";
    -$idempotencyKey = "KEY_VALUE";
    -$startDate = new DateTime('2020-10-28');
    -$paymentDate = new DateTime('2020-10-30');
    -
    -$payRunCalendar = new XeroAPI\XeroPHP\Models\PayrollUk\PayRunCalendar;
    -$payRunCalendar->setCalendarType(XeroAPI\XeroPHP\Models\PayrollUk\CalendarType.WEEKLY);
    -$payRunCalendar->setPeriodStartDate($startDate);
    -$payRunCalendar->setPaymentDate($paymentDate);
    -
    -try {
    -  $result = $apiInstance->updatePayRun($xeroTenantId, $payRunID, $payRun, $idempotencyKey);
    -} catch (Exception $e) {
    -  echo 'Exception when calling PayrollUkApi->updatePayRun: ', $e->getMessage(), PHP_EOL;
    -}
    -?>
    -
    -
    -
    -

    Scopes

    - - - - - - - -
    payroll.payrunsGrant read-write access to payroll payruns
    -

    Parameters

    -
    Path parameters
    - - - - - - - - - -
    NameDescription
    PayRunID* - - -
    -
    -
    - - UUID - - - (uuid) - - -
    -Identifier for the pay run -
    -
    -
    - Required -
    -
    -
    -
    -
    Header parameters
    - - - - - - - - - - - - - -
    NameDescription
    Xero-Tenant-Id* - - -
    -
    -
    - - String - - -
    -Xero identifier for Tenant -
    -
    -
    - Required -
    -
    -
    -
    Idempotency-Key - - -
    -
    -
    - - String - - -
    -This allows you to safely retry requests without the risk of duplicate processing. 128 character max. -
    -
    -
    -
    -
    -
    Body parameters
    - - - - - - - -
    NameDescription
    payRun * -
    -
    - - PayRun - -
    - -
    -
    -
    - Required -
    -
    -
    diff --git a/lib/Api/AccountingApi.php b/lib/Api/AccountingApi.php index c4463ea4..3410cfd9 100644 --- a/lib/Api/AccountingApi.php +++ b/lib/Api/AccountingApi.php @@ -14,7 +14,7 @@ * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: 9.1.0 + * OpenAPI spec version: 9.1.1 * Contact: api@xero.com * Generated by: https://openapi-generator.tech * OpenAPI Generator version: 5.4.0 diff --git a/lib/Api/AppStoreApi.php b/lib/Api/AppStoreApi.php index dee6d1fe..2b9d3d46 100644 --- a/lib/Api/AppStoreApi.php +++ b/lib/Api/AppStoreApi.php @@ -14,7 +14,7 @@ * * These endpoints are for Xero Partners to interact with the App Store Billing platform * - * OpenAPI spec version: 9.1.0 + * OpenAPI spec version: 9.1.1 * Contact: api@xero.com * Generated by: https://openapi-generator.tech * OpenAPI Generator version: 5.4.0 diff --git a/lib/Api/AssetApi.php b/lib/Api/AssetApi.php index d81cbef3..2e288d9b 100644 --- a/lib/Api/AssetApi.php +++ b/lib/Api/AssetApi.php @@ -14,7 +14,7 @@ * * The Assets API exposes fixed asset related functions of the Xero Accounting application and can be used for a variety of purposes such as creating assets, retrieving asset valuations etc. * - * OpenAPI spec version: 9.1.0 + * OpenAPI spec version: 9.1.1 * Contact: api@xero.com * Generated by: https://openapi-generator.tech * OpenAPI Generator version: 5.4.0 diff --git a/lib/Api/FilesApi.php b/lib/Api/FilesApi.php index 2910ca1a..120b6106 100644 --- a/lib/Api/FilesApi.php +++ b/lib/Api/FilesApi.php @@ -14,7 +14,7 @@ * * These endpoints are specific to Xero Files API * - * OpenAPI spec version: 9.1.0 + * OpenAPI spec version: 9.1.1 * Contact: api@xero.com * Generated by: https://openapi-generator.tech * OpenAPI Generator version: 5.4.0 diff --git a/lib/Api/FinanceApi.php b/lib/Api/FinanceApi.php index 03b2c890..58bccd70 100644 --- a/lib/Api/FinanceApi.php +++ b/lib/Api/FinanceApi.php @@ -14,7 +14,7 @@ * * The Finance API is a collection of endpoints which customers can use in the course of a loan application, which may assist lenders to gain the confidence they need to provide capital. * - * OpenAPI spec version: 9.1.0 + * OpenAPI spec version: 9.1.1 * Contact: api@xero.com * Generated by: https://openapi-generator.tech * OpenAPI Generator version: 5.4.0 diff --git a/lib/Api/IdentityApi.php b/lib/Api/IdentityApi.php index 3f1db960..2ec9c872 100644 --- a/lib/Api/IdentityApi.php +++ b/lib/Api/IdentityApi.php @@ -14,7 +14,7 @@ * * These endpoints are related to managing authentication tokens and identity for Xero API * - * OpenAPI spec version: 9.1.0 + * OpenAPI spec version: 9.1.1 * Contact: api@xero.com * Generated by: https://openapi-generator.tech * OpenAPI Generator version: 5.4.0 diff --git a/lib/Api/PayrollAuApi.php b/lib/Api/PayrollAuApi.php index 2a29ae6f..792a726a 100644 --- a/lib/Api/PayrollAuApi.php +++ b/lib/Api/PayrollAuApi.php @@ -14,7 +14,7 @@ * * This is the Xero Payroll API for orgs in Australia region. * - * OpenAPI spec version: 9.1.0 + * OpenAPI spec version: 9.1.1 * Contact: api@xero.com * Generated by: https://openapi-generator.tech * OpenAPI Generator version: 5.4.0 diff --git a/lib/Api/PayrollNzApi.php b/lib/Api/PayrollNzApi.php index 5f585557..3ff31797 100644 --- a/lib/Api/PayrollNzApi.php +++ b/lib/Api/PayrollNzApi.php @@ -14,7 +14,7 @@ * * This is the Xero Payroll API for orgs in the NZ region. * - * OpenAPI spec version: 9.1.0 + * OpenAPI spec version: 9.1.1 * Contact: api@xero.com * Generated by: https://openapi-generator.tech * OpenAPI Generator version: 5.4.0 @@ -18578,298 +18578,6 @@ protected function updateEmployeeTaxRequest($xero_tenant_id, $employee_id, $empl ); } - /** - * Operation updatePayRun - * Updates a pay run - * @param string $xero_tenant_id Xero identifier for Tenant (required) - * @param string $pay_run_id Identifier for the pay run (required) - * @param \XeroAPI\XeroPHP\Models\PayrollNz\PayRun $pay_run pay_run (required) - * @param string $idempotency_key This allows you to safely retry requests without the risk of duplicate processing. 128 character max. (optional) - * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \XeroAPI\XeroPHP\Models\PayrollNz\PayRunObject|\XeroAPI\XeroPHP\Models\PayrollNz\Problem - */ - public function updatePayRun($xero_tenant_id, $pay_run_id, $pay_run, $idempotency_key = null) - { - list($response) = $this->updatePayRunWithHttpInfo($xero_tenant_id, $pay_run_id, $pay_run, $idempotency_key); - return $response; - } - /** - * Operation updatePayRunWithHttpInfo - * Updates a pay run - * @param string $xero_tenant_id Xero identifier for Tenant (required) - * @param string $pay_run_id Identifier for the pay run (required) - * @param \XeroAPI\XeroPHP\Models\PayrollNz\PayRun $pay_run (required) - * @param string $idempotency_key This allows you to safely retry requests without the risk of duplicate processing. 128 character max. (optional) - * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \XeroAPI\XeroPHP\Models\PayrollNz\PayRunObject|\XeroAPI\XeroPHP\Models\PayrollNz\Problem, HTTP status code, HTTP response headers (array of strings) - */ - public function updatePayRunWithHttpInfo($xero_tenant_id, $pay_run_id, $pay_run, $idempotency_key = null) - { - $request = $this->updatePayRunRequest($xero_tenant_id, $pay_run_id, $pay_run, $idempotency_key); - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - $responseBody = $response->getBody(); - switch($statusCode) { - case 200: - if ('\XeroAPI\XeroPHP\Models\PayrollNz\PayRunObject' === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - } - return [ - PayrollNzObjectSerializer::deserialize($content, '\XeroAPI\XeroPHP\Models\PayrollNz\PayRunObject', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 400: - if ('\XeroAPI\XeroPHP\Models\PayrollNz\Problem' === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - } - return [ - PayrollNzObjectSerializer::deserialize($content, '\XeroAPI\XeroPHP\Models\PayrollNz\Problem', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - $returnType = '\XeroAPI\XeroPHP\Models\PayrollNz\PayRunObject'; - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - } - return [ - PayrollNzObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = PayrollNzObjectSerializer::deserialize( - $e->getResponseBody(), - '\XeroAPI\XeroPHP\Models\PayrollNz\PayRunObject', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = PayrollNzObjectSerializer::deserialize( - $e->getResponseBody(), - '\XeroAPI\XeroPHP\Models\PayrollNz\Problem', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - /** - * Operation updatePayRunAsync - * Updates a pay run - * @param string $xero_tenant_id Xero identifier for Tenant (required) - * @param string $pay_run_id Identifier for the pay run (required) - * @param \XeroAPI\XeroPHP\Models\PayrollNz\PayRun $pay_run (required) - * @param string $idempotency_key This allows you to safely retry requests without the risk of duplicate processing. 128 character max. (optional) - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updatePayRunAsync($xero_tenant_id, $pay_run_id, $pay_run, $idempotency_key = null) - { - return $this->updatePayRunAsyncWithHttpInfo($xero_tenant_id, $pay_run_id, $pay_run, $idempotency_key) - ->then( - function ($response) { - return $response[0]; - } - ); - } - /** - * Operation updatePayRunAsyncWithHttpInfo - * Updates a pay run - * @param string $xero_tenant_id Xero identifier for Tenant (required) - * @param string $pay_run_id Identifier for the pay run (required) - * @param \XeroAPI\XeroPHP\Models\PayrollNz\PayRun $pay_run (required) - * @param string $idempotency_key This allows you to safely retry requests without the risk of duplicate processing. 128 character max. (optional) - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updatePayRunAsyncWithHttpInfo($xero_tenant_id, $pay_run_id, $pay_run, $idempotency_key = null) - { - $returnType = '\XeroAPI\XeroPHP\Models\PayrollNz\PayRunObject'; - $request = $this->updatePayRunRequest($xero_tenant_id, $pay_run_id, $pay_run, $idempotency_key); - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - } - return [ - PayrollNzObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'updatePayRun' - * @param string $xero_tenant_id Xero identifier for Tenant (required) - * @param string $pay_run_id Identifier for the pay run (required) - * @param \XeroAPI\XeroPHP\Models\PayrollNz\PayRun $pay_run (required) - * @param string $idempotency_key This allows you to safely retry requests without the risk of duplicate processing. 128 character max. (optional) - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request */ - protected function updatePayRunRequest($xero_tenant_id, $pay_run_id, $pay_run, $idempotency_key = null) - { - // verify the required parameter 'xero_tenant_id' is set - if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $xero_tenant_id when calling updatePayRun' - ); - } - // verify the required parameter 'pay_run_id' is set - if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $pay_run_id when calling updatePayRun' - ); - } - // verify the required parameter 'pay_run' is set - if ($pay_run === null || (is_array($pay_run) && count($pay_run) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $pay_run when calling updatePayRun' - ); - } - $resourcePath = '/PayRuns/{PayRunID}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - // header params - if ($xero_tenant_id !== null) { - $headerParams['Xero-Tenant-Id'] = PayrollNzObjectSerializer::toHeaderValue($xero_tenant_id); - } - // header params - if ($idempotency_key !== null) { - $headerParams['Idempotency-Key'] = PayrollNzObjectSerializer::toHeaderValue($idempotency_key); - } - // path params - if ($pay_run_id !== null) { - $resourcePath = str_replace( - '{' . 'PayRunID' . '}', - PayrollNzObjectSerializer::toPathValue($pay_run_id), - $resourcePath - ); - } - // body params - $_tempBody = null; - if (isset($pay_run)) { - $_tempBody = $pay_run; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(PayrollNzObjectSerializer::sanitizeForSerialization($_tempBody)); - } else { - $httpBody = $_tempBody; - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = [ - [ - 'Content-type' => 'multipart/form-data', - ] - ]; - - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - return new Request( - 'PUT', - $this->config->getHostPayrollNz() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - /** * Operation updatePaySlipLineItems * Creates an employee pay slip diff --git a/lib/Api/PayrollUkApi.php b/lib/Api/PayrollUkApi.php index af9785ea..735eda2f 100644 --- a/lib/Api/PayrollUkApi.php +++ b/lib/Api/PayrollUkApi.php @@ -14,7 +14,7 @@ * * This is the Xero Payroll API for orgs in the UK region. * - * OpenAPI spec version: 9.1.0 + * OpenAPI spec version: 9.1.1 * Contact: api@xero.com * Generated by: https://openapi-generator.tech * OpenAPI Generator version: 5.4.0 @@ -18164,298 +18164,6 @@ protected function updateEmployeeSalaryAndWageRequest($xero_tenant_id, $employee ); } - /** - * Operation updatePayRun - * Updates a specific pay run - * @param string $xero_tenant_id Xero identifier for Tenant (required) - * @param string $pay_run_id Identifier for the pay run (required) - * @param \XeroAPI\XeroPHP\Models\PayrollUk\PayRun $pay_run pay_run (required) - * @param string $idempotency_key This allows you to safely retry requests without the risk of duplicate processing. 128 character max. (optional) - * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \XeroAPI\XeroPHP\Models\PayrollUk\PayRunObject|\XeroAPI\XeroPHP\Models\PayrollUk\Problem - */ - public function updatePayRun($xero_tenant_id, $pay_run_id, $pay_run, $idempotency_key = null) - { - list($response) = $this->updatePayRunWithHttpInfo($xero_tenant_id, $pay_run_id, $pay_run, $idempotency_key); - return $response; - } - /** - * Operation updatePayRunWithHttpInfo - * Updates a specific pay run - * @param string $xero_tenant_id Xero identifier for Tenant (required) - * @param string $pay_run_id Identifier for the pay run (required) - * @param \XeroAPI\XeroPHP\Models\PayrollUk\PayRun $pay_run (required) - * @param string $idempotency_key This allows you to safely retry requests without the risk of duplicate processing. 128 character max. (optional) - * @throws \XeroAPI\XeroPHP\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \XeroAPI\XeroPHP\Models\PayrollUk\PayRunObject|\XeroAPI\XeroPHP\Models\PayrollUk\Problem, HTTP status code, HTTP response headers (array of strings) - */ - public function updatePayRunWithHttpInfo($xero_tenant_id, $pay_run_id, $pay_run, $idempotency_key = null) - { - $request = $this->updatePayRunRequest($xero_tenant_id, $pay_run_id, $pay_run, $idempotency_key); - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - $responseBody = $response->getBody(); - switch($statusCode) { - case 200: - if ('\XeroAPI\XeroPHP\Models\PayrollUk\PayRunObject' === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - } - return [ - PayrollUkObjectSerializer::deserialize($content, '\XeroAPI\XeroPHP\Models\PayrollUk\PayRunObject', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 400: - if ('\XeroAPI\XeroPHP\Models\PayrollUk\Problem' === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - } - return [ - PayrollUkObjectSerializer::deserialize($content, '\XeroAPI\XeroPHP\Models\PayrollUk\Problem', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - $returnType = '\XeroAPI\XeroPHP\Models\PayrollUk\PayRunObject'; - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - } - return [ - PayrollUkObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = PayrollUkObjectSerializer::deserialize( - $e->getResponseBody(), - '\XeroAPI\XeroPHP\Models\PayrollUk\PayRunObject', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = PayrollUkObjectSerializer::deserialize( - $e->getResponseBody(), - '\XeroAPI\XeroPHP\Models\PayrollUk\Problem', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - /** - * Operation updatePayRunAsync - * Updates a specific pay run - * @param string $xero_tenant_id Xero identifier for Tenant (required) - * @param string $pay_run_id Identifier for the pay run (required) - * @param \XeroAPI\XeroPHP\Models\PayrollUk\PayRun $pay_run (required) - * @param string $idempotency_key This allows you to safely retry requests without the risk of duplicate processing. 128 character max. (optional) - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updatePayRunAsync($xero_tenant_id, $pay_run_id, $pay_run, $idempotency_key = null) - { - return $this->updatePayRunAsyncWithHttpInfo($xero_tenant_id, $pay_run_id, $pay_run, $idempotency_key) - ->then( - function ($response) { - return $response[0]; - } - ); - } - /** - * Operation updatePayRunAsyncWithHttpInfo - * Updates a specific pay run - * @param string $xero_tenant_id Xero identifier for Tenant (required) - * @param string $pay_run_id Identifier for the pay run (required) - * @param \XeroAPI\XeroPHP\Models\PayrollUk\PayRun $pay_run (required) - * @param string $idempotency_key This allows you to safely retry requests without the risk of duplicate processing. 128 character max. (optional) - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updatePayRunAsyncWithHttpInfo($xero_tenant_id, $pay_run_id, $pay_run, $idempotency_key = null) - { - $returnType = '\XeroAPI\XeroPHP\Models\PayrollUk\PayRunObject'; - $request = $this->updatePayRunRequest($xero_tenant_id, $pay_run_id, $pay_run, $idempotency_key); - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - } - return [ - PayrollUkObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'updatePayRun' - * @param string $xero_tenant_id Xero identifier for Tenant (required) - * @param string $pay_run_id Identifier for the pay run (required) - * @param \XeroAPI\XeroPHP\Models\PayrollUk\PayRun $pay_run (required) - * @param string $idempotency_key This allows you to safely retry requests without the risk of duplicate processing. 128 character max. (optional) - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request */ - protected function updatePayRunRequest($xero_tenant_id, $pay_run_id, $pay_run, $idempotency_key = null) - { - // verify the required parameter 'xero_tenant_id' is set - if ($xero_tenant_id === null || (is_array($xero_tenant_id) && count($xero_tenant_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $xero_tenant_id when calling updatePayRun' - ); - } - // verify the required parameter 'pay_run_id' is set - if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $pay_run_id when calling updatePayRun' - ); - } - // verify the required parameter 'pay_run' is set - if ($pay_run === null || (is_array($pay_run) && count($pay_run) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $pay_run when calling updatePayRun' - ); - } - $resourcePath = '/PayRuns/{PayRunID}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - // header params - if ($xero_tenant_id !== null) { - $headerParams['Xero-Tenant-Id'] = PayrollUkObjectSerializer::toHeaderValue($xero_tenant_id); - } - // header params - if ($idempotency_key !== null) { - $headerParams['Idempotency-Key'] = PayrollUkObjectSerializer::toHeaderValue($idempotency_key); - } - // path params - if ($pay_run_id !== null) { - $resourcePath = str_replace( - '{' . 'PayRunID' . '}', - PayrollUkObjectSerializer::toPathValue($pay_run_id), - $resourcePath - ); - } - // body params - $_tempBody = null; - if (isset($pay_run)) { - $_tempBody = $pay_run; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(PayrollUkObjectSerializer::sanitizeForSerialization($_tempBody)); - } else { - $httpBody = $_tempBody; - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = [ - [ - 'Content-type' => 'multipart/form-data', - ] - ]; - - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); - } - } - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - return new Request( - 'PUT', - $this->config->getHostPayrollUk() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - /** * Operation updateTimesheetLine * Updates a specific timesheet line for a specific timesheet diff --git a/lib/Api/ProjectApi.php b/lib/Api/ProjectApi.php index d11dea81..2777d13d 100644 --- a/lib/Api/ProjectApi.php +++ b/lib/Api/ProjectApi.php @@ -14,7 +14,7 @@ * * This is the Xero Projects API * - * OpenAPI spec version: 9.1.0 + * OpenAPI spec version: 9.1.1 * Contact: api@xero.com * Generated by: https://openapi-generator.tech * OpenAPI Generator version: 5.4.0 diff --git a/lib/Configuration.php b/lib/Configuration.php index 1553cb13..a3f3f23b 100644 --- a/lib/Configuration.php +++ b/lib/Configuration.php @@ -696,7 +696,7 @@ public static function toDebugReport() $report = 'PHP SDK (XeroAPI\XeroPHP) Debug Report:' . PHP_EOL; $report .= ' OS: ' . php_uname() . PHP_EOL; $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; - $report .= ' OpenAPI Spec Version: 9.1.0' . PHP_EOL; + $report .= ' OpenAPI Spec Version: 9.1.1' . PHP_EOL; $report .= ' SDK Package Version: 10.1.0' . PHP_EOL; $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; diff --git a/lib/Models/Accounting/Contact.php b/lib/Models/Accounting/Contact.php index 90f40974..d8ab6e6a 100644 --- a/lib/Models/Accounting/Contact.php +++ b/lib/Models/Accounting/Contact.php @@ -71,6 +71,7 @@ class Contact implements ModelInterface, ArrayAccess 'contact_persons' => '\XeroAPI\XeroPHP\Models\Accounting\ContactPerson[]', 'bank_account_details' => 'string', 'tax_number' => 'string', + 'tax_number_type' => 'string', 'accounts_receivable_tax_type' => 'string', 'accounts_payable_tax_type' => 'string', 'addresses' => '\XeroAPI\XeroPHP\Models\Accounting\Address[]', @@ -121,6 +122,7 @@ class Contact implements ModelInterface, ArrayAccess 'contact_persons' => null, 'bank_account_details' => null, 'tax_number' => null, + 'tax_number_type' => null, 'accounts_receivable_tax_type' => null, 'accounts_payable_tax_type' => null, 'addresses' => null, @@ -192,6 +194,7 @@ public static function openAPIFormats() 'contact_persons' => 'ContactPersons', 'bank_account_details' => 'BankAccountDetails', 'tax_number' => 'TaxNumber', + 'tax_number_type' => 'TaxNumberType', 'accounts_receivable_tax_type' => 'AccountsReceivableTaxType', 'accounts_payable_tax_type' => 'AccountsPayableTaxType', 'addresses' => 'Addresses', @@ -242,6 +245,7 @@ public static function openAPIFormats() 'contact_persons' => 'setContactPersons', 'bank_account_details' => 'setBankAccountDetails', 'tax_number' => 'setTaxNumber', + 'tax_number_type' => 'setTaxNumberType', 'accounts_receivable_tax_type' => 'setAccountsReceivableTaxType', 'accounts_payable_tax_type' => 'setAccountsPayableTaxType', 'addresses' => 'setAddresses', @@ -292,6 +296,7 @@ public static function openAPIFormats() 'contact_persons' => 'getContactPersons', 'bank_account_details' => 'getBankAccountDetails', 'tax_number' => 'getTaxNumber', + 'tax_number_type' => 'getTaxNumberType', 'accounts_receivable_tax_type' => 'getAccountsReceivableTaxType', 'accounts_payable_tax_type' => 'getAccountsPayableTaxType', 'addresses' => 'getAddresses', @@ -367,6 +372,10 @@ public function getModelName() const CONTACT_STATUS_ACTIVE = 'ACTIVE'; const CONTACT_STATUS_ARCHIVED = 'ARCHIVED'; const CONTACT_STATUS_GDPRREQUEST = 'GDPRREQUEST'; + const TAX_NUMBER_TYPE_SSN = 'SSN'; + const TAX_NUMBER_TYPE_EIN = 'EIN'; + const TAX_NUMBER_TYPE_ITIN = 'ITIN'; + const TAX_NUMBER_TYPE_ATIN = 'ATIN'; const SALES_DEFAULT_LINE_AMOUNT_TYPE_INCLUSIVE = 'INCLUSIVE'; const SALES_DEFAULT_LINE_AMOUNT_TYPE_EXCLUSIVE = 'EXCLUSIVE'; const SALES_DEFAULT_LINE_AMOUNT_TYPE_NONE = 'NONE'; @@ -390,6 +399,21 @@ public function getContactStatusAllowableValues() ]; } + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTaxNumberTypeAllowableValues() + { + return [ + self::TAX_NUMBER_TYPE_SSN, + self::TAX_NUMBER_TYPE_EIN, + self::TAX_NUMBER_TYPE_ITIN, + self::TAX_NUMBER_TYPE_ATIN, + ]; + } + /** * Gets allowable values of the enum * @@ -447,6 +471,7 @@ public function __construct(array $data = null) $this->container['contact_persons'] = isset($data['contact_persons']) ? $data['contact_persons'] : null; $this->container['bank_account_details'] = isset($data['bank_account_details']) ? $data['bank_account_details'] : null; $this->container['tax_number'] = isset($data['tax_number']) ? $data['tax_number'] : null; + $this->container['tax_number_type'] = isset($data['tax_number_type']) ? $data['tax_number_type'] : null; $this->container['accounts_receivable_tax_type'] = isset($data['accounts_receivable_tax_type']) ? $data['accounts_receivable_tax_type'] : null; $this->container['accounts_payable_tax_type'] = isset($data['accounts_payable_tax_type']) ? $data['accounts_payable_tax_type'] : null; $this->container['addresses'] = isset($data['addresses']) ? $data['addresses'] : null; @@ -527,6 +552,14 @@ public function listInvalidProperties() $invalidProperties[] = "invalid value for 'tax_number', the character length must be smaller than or equal to 50."; } + $allowedValues = $this->getTaxNumberTypeAllowableValues(); + if (!is_null($this->container['tax_number_type']) && !in_array($this->container['tax_number_type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value for 'tax_number_type', must be one of '%s'", + implode("', '", $allowedValues) + ); + } + $allowedValues = $this->getSalesDefaultLineAmountTypeAllowableValues(); if (!is_null($this->container['sales_default_line_amount_type']) && !in_array($this->container['sales_default_line_amount_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( @@ -950,6 +983,42 @@ public function setTaxNumber($tax_number) + /** + * Gets tax_number_type + * + * @return string|null + */ + public function getTaxNumberType() + { + return $this->container['tax_number_type']; + } + + /** + * Sets tax_number_type + * + * @param string|null $tax_number_type Identifier of the regional type of tax number, such as US, UK, or other regional tax identifiers + * + * @return $this + */ + public function setTaxNumberType($tax_number_type) + { + $allowedValues = $this->getTaxNumberTypeAllowableValues(); + if (!is_null($tax_number_type) && !in_array($tax_number_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'tax_number_type', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + + $this->container['tax_number_type'] = $tax_number_type; + + return $this; + } + + + /** * Gets accounts_receivable_tax_type *