diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index cda6cdf..d6f4630 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -43,7 +43,7 @@ jobs: uses: mockoon/cli-action@v1 with: version: 'latest' - data-file: 'https://raw.githubusercontent.com/conekta/openapi/20230613/mocks/conekta_api.json' + data-file: 'https://raw.githubusercontent.com/conekta/openapi/20231013/mocks/conekta_api.json' port: 3000 - name: Run PHPUnit run: vendor/bin/phpunit diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index a8c32d3..55f0edd 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -53,6 +53,7 @@ docs/Model/ChargeResponsePaymentMethod.md docs/Model/ChargeResponseRefunds.md docs/Model/ChargeResponseRefundsAllOf.md docs/Model/ChargeResponseRefundsData.md +docs/Model/ChargeUpdateRequest.md docs/Model/ChargesDataResponse.md docs/Model/Checkout.md docs/Model/CheckoutOrderTemplate.md @@ -82,7 +83,6 @@ docs/Model/CustomerFiscalEntitiesResponseAllOf.md docs/Model/CustomerInfo.md docs/Model/CustomerInfoJustCustomerId.md docs/Model/CustomerInfoJustCustomerIdResponse.md -docs/Model/CustomerInfoResponse.md docs/Model/CustomerPaymentMethodRequest.md docs/Model/CustomerPaymentMethods.md docs/Model/CustomerPaymentMethodsData.md @@ -115,6 +115,7 @@ docs/Model/Error.md docs/Model/ErrorAllOf.md docs/Model/EventResponse.md docs/Model/EventsResendResponse.md +docs/Model/FiscalEntityAddress.md docs/Model/GetApiKeysResponse.md docs/Model/GetApiKeysResponseAllOf.md docs/Model/GetChargesResponse.md @@ -143,7 +144,12 @@ docs/Model/LogResponse.md docs/Model/LogsResponse.md docs/Model/LogsResponseData.md docs/Model/OrderCaptureRequest.md +docs/Model/OrderCustomerInfoResponse.md docs/Model/OrderDiscountLinesRequest.md +docs/Model/OrderFiscalEntityAddressResponse.md +docs/Model/OrderFiscalEntityAddressResponseAllOf.md +docs/Model/OrderFiscalEntityRequest.md +docs/Model/OrderFiscalEntityResponse.md docs/Model/OrderRefundRequest.md docs/Model/OrderRequest.md docs/Model/OrderRequestCustomerInfo.md @@ -155,14 +161,12 @@ docs/Model/OrderResponseCustomerInfo.md docs/Model/OrderResponseCustomerInfoAllOf.md docs/Model/OrderResponseDiscountLines.md docs/Model/OrderResponseDiscountLinesAllOf.md -docs/Model/OrderResponseFiscalEntity.md -docs/Model/OrderResponseFiscalEntityAddress.md -docs/Model/OrderResponseFiscalEntityAddressAllOf.md docs/Model/OrderResponseProducts.md docs/Model/OrderResponseProductsAllOf.md docs/Model/OrderResponseShippingContact.md docs/Model/OrderResponseShippingContactAllOf.md docs/Model/OrderTaxRequest.md +docs/Model/OrderUpdateFiscalEntityRequest.md docs/Model/OrderUpdateRequest.md docs/Model/OrderUpdateRequestCustomerInfo.md docs/Model/OrdersResponse.md @@ -281,6 +285,7 @@ lib/Model/ChargeResponsePaymentMethod.php lib/Model/ChargeResponseRefunds.php lib/Model/ChargeResponseRefundsAllOf.php lib/Model/ChargeResponseRefundsData.php +lib/Model/ChargeUpdateRequest.php lib/Model/ChargesDataResponse.php lib/Model/Checkout.php lib/Model/CheckoutOrderTemplate.php @@ -310,7 +315,6 @@ lib/Model/CustomerFiscalEntitiesResponseAllOf.php lib/Model/CustomerInfo.php lib/Model/CustomerInfoJustCustomerId.php lib/Model/CustomerInfoJustCustomerIdResponse.php -lib/Model/CustomerInfoResponse.php lib/Model/CustomerPaymentMethodRequest.php lib/Model/CustomerPaymentMethods.php lib/Model/CustomerPaymentMethodsData.php @@ -343,6 +347,7 @@ lib/Model/Error.php lib/Model/ErrorAllOf.php lib/Model/EventResponse.php lib/Model/EventsResendResponse.php +lib/Model/FiscalEntityAddress.php lib/Model/GetApiKeysResponse.php lib/Model/GetApiKeysResponseAllOf.php lib/Model/GetChargesResponse.php @@ -372,7 +377,12 @@ lib/Model/LogsResponse.php lib/Model/LogsResponseData.php lib/Model/ModelInterface.php lib/Model/OrderCaptureRequest.php +lib/Model/OrderCustomerInfoResponse.php lib/Model/OrderDiscountLinesRequest.php +lib/Model/OrderFiscalEntityAddressResponse.php +lib/Model/OrderFiscalEntityAddressResponseAllOf.php +lib/Model/OrderFiscalEntityRequest.php +lib/Model/OrderFiscalEntityResponse.php lib/Model/OrderRefundRequest.php lib/Model/OrderRequest.php lib/Model/OrderRequestCustomerInfo.php @@ -384,14 +394,12 @@ lib/Model/OrderResponseCustomerInfo.php lib/Model/OrderResponseCustomerInfoAllOf.php lib/Model/OrderResponseDiscountLines.php lib/Model/OrderResponseDiscountLinesAllOf.php -lib/Model/OrderResponseFiscalEntity.php -lib/Model/OrderResponseFiscalEntityAddress.php -lib/Model/OrderResponseFiscalEntityAddressAllOf.php lib/Model/OrderResponseProducts.php lib/Model/OrderResponseProductsAllOf.php lib/Model/OrderResponseShippingContact.php lib/Model/OrderResponseShippingContactAllOf.php lib/Model/OrderTaxRequest.php +lib/Model/OrderUpdateFiscalEntityRequest.php lib/Model/OrderUpdateRequest.php lib/Model/OrderUpdateRequestCustomerInfo.php lib/Model/OrdersResponse.php diff --git a/README.md b/README.md index b351ac8..62d01a3 100644 --- a/README.md +++ b/README.md @@ -89,9 +89,10 @@ Class | Method | HTTP request | Description *ApiKeysApi* | [**getApiKey**](docs/Api/ApiKeysApi.md#getapikey) | **GET** /api_keys/{id} | Get Api Key *ApiKeysApi* | [**getApiKeys**](docs/Api/ApiKeysApi.md#getapikeys) | **GET** /api_keys | Get list of Api Keys *ApiKeysApi* | [**updateApiKey**](docs/Api/ApiKeysApi.md#updateapikey) | **PUT** /api_keys/{id} | Update Api Key -*BalancesApi* | [**getBalance**](docs/Api/BalancesApi.md#getbalance) | **GET** /balances | Get a company's balance +*BalancesApi* | [**getBalance**](docs/Api/BalancesApi.md#getbalance) | **GET** /balance | Get a company's balance *ChargesApi* | [**getCharges**](docs/Api/ChargesApi.md#getcharges) | **GET** /charges | Get A List of Charges *ChargesApi* | [**ordersCreateCharge**](docs/Api/ChargesApi.md#orderscreatecharge) | **POST** /orders/{id}/charges | Create charge +*ChargesApi* | [**updateCharge**](docs/Api/ChargesApi.md#updatecharge) | **PUT** /charges/{id} | Update a charge *CompaniesApi* | [**getCompanies**](docs/Api/CompaniesApi.md#getcompanies) | **GET** /companies | Get List of Companies *CompaniesApi* | [**getCompany**](docs/Api/CompaniesApi.md#getcompany) | **GET** /companies/{id} | Get Company *CustomersApi* | [**createCustomer**](docs/Api/CustomersApi.md#createcustomer) | **POST** /customers | Create customer @@ -194,6 +195,7 @@ Class | Method | HTTP request | Description - [ChargeResponseRefunds](docs/Model/ChargeResponseRefunds.md) - [ChargeResponseRefundsAllOf](docs/Model/ChargeResponseRefundsAllOf.md) - [ChargeResponseRefundsData](docs/Model/ChargeResponseRefundsData.md) +- [ChargeUpdateRequest](docs/Model/ChargeUpdateRequest.md) - [ChargesDataResponse](docs/Model/ChargesDataResponse.md) - [Checkout](docs/Model/Checkout.md) - [CheckoutOrderTemplate](docs/Model/CheckoutOrderTemplate.md) @@ -223,7 +225,6 @@ Class | Method | HTTP request | Description - [CustomerInfo](docs/Model/CustomerInfo.md) - [CustomerInfoJustCustomerId](docs/Model/CustomerInfoJustCustomerId.md) - [CustomerInfoJustCustomerIdResponse](docs/Model/CustomerInfoJustCustomerIdResponse.md) -- [CustomerInfoResponse](docs/Model/CustomerInfoResponse.md) - [CustomerPaymentMethodRequest](docs/Model/CustomerPaymentMethodRequest.md) - [CustomerPaymentMethods](docs/Model/CustomerPaymentMethods.md) - [CustomerPaymentMethodsData](docs/Model/CustomerPaymentMethodsData.md) @@ -256,6 +257,7 @@ Class | Method | HTTP request | Description - [ErrorAllOf](docs/Model/ErrorAllOf.md) - [EventResponse](docs/Model/EventResponse.md) - [EventsResendResponse](docs/Model/EventsResendResponse.md) +- [FiscalEntityAddress](docs/Model/FiscalEntityAddress.md) - [GetApiKeysResponse](docs/Model/GetApiKeysResponse.md) - [GetApiKeysResponseAllOf](docs/Model/GetApiKeysResponseAllOf.md) - [GetChargesResponse](docs/Model/GetChargesResponse.md) @@ -284,7 +286,12 @@ Class | Method | HTTP request | Description - [LogsResponse](docs/Model/LogsResponse.md) - [LogsResponseData](docs/Model/LogsResponseData.md) - [OrderCaptureRequest](docs/Model/OrderCaptureRequest.md) +- [OrderCustomerInfoResponse](docs/Model/OrderCustomerInfoResponse.md) - [OrderDiscountLinesRequest](docs/Model/OrderDiscountLinesRequest.md) +- [OrderFiscalEntityAddressResponse](docs/Model/OrderFiscalEntityAddressResponse.md) +- [OrderFiscalEntityAddressResponseAllOf](docs/Model/OrderFiscalEntityAddressResponseAllOf.md) +- [OrderFiscalEntityRequest](docs/Model/OrderFiscalEntityRequest.md) +- [OrderFiscalEntityResponse](docs/Model/OrderFiscalEntityResponse.md) - [OrderRefundRequest](docs/Model/OrderRefundRequest.md) - [OrderRequest](docs/Model/OrderRequest.md) - [OrderRequestCustomerInfo](docs/Model/OrderRequestCustomerInfo.md) @@ -296,14 +303,12 @@ Class | Method | HTTP request | Description - [OrderResponseCustomerInfoAllOf](docs/Model/OrderResponseCustomerInfoAllOf.md) - [OrderResponseDiscountLines](docs/Model/OrderResponseDiscountLines.md) - [OrderResponseDiscountLinesAllOf](docs/Model/OrderResponseDiscountLinesAllOf.md) -- [OrderResponseFiscalEntity](docs/Model/OrderResponseFiscalEntity.md) -- [OrderResponseFiscalEntityAddress](docs/Model/OrderResponseFiscalEntityAddress.md) -- [OrderResponseFiscalEntityAddressAllOf](docs/Model/OrderResponseFiscalEntityAddressAllOf.md) - [OrderResponseProducts](docs/Model/OrderResponseProducts.md) - [OrderResponseProductsAllOf](docs/Model/OrderResponseProductsAllOf.md) - [OrderResponseShippingContact](docs/Model/OrderResponseShippingContact.md) - [OrderResponseShippingContactAllOf](docs/Model/OrderResponseShippingContactAllOf.md) - [OrderTaxRequest](docs/Model/OrderTaxRequest.md) +- [OrderUpdateFiscalEntityRequest](docs/Model/OrderUpdateFiscalEntityRequest.md) - [OrderUpdateRequest](docs/Model/OrderUpdateRequest.md) - [OrderUpdateRequestCustomerInfo](docs/Model/OrderUpdateRequestCustomerInfo.md) - [OrdersResponse](docs/Model/OrdersResponse.md) @@ -400,5 +405,5 @@ engineering@conekta.com This PHP package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: - API version: `2.1.0` - - Package version: `6.0.1` + - Package version: `6.0.2` - Build package: `org.openapitools.codegen.languages.PhpClientCodegen` diff --git a/VERSION b/VERSION index 5fe6072..9b9a244 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -6.0.1 +6.0.2 diff --git a/composer.json b/composer.json index 7e0e5a5..a41e83e 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "conekta/conekta-php", - "version": "6.0.1", + "version": "6.0.2", "description": "Conekta PHP Library", "type": "library", "keywords": [ diff --git a/docs/Api/BalancesApi.md b/docs/Api/BalancesApi.md index 4b488c4..dfadd1a 100644 --- a/docs/Api/BalancesApi.md +++ b/docs/Api/BalancesApi.md @@ -4,7 +4,7 @@ All URIs are relative to https://api.conekta.io, except if the operation defines | Method | HTTP request | Description | | ------------- | ------------- | ------------- | -| [**getBalance()**](BalancesApi.md#getBalance) | **GET** /balances | Get a company's balance | +| [**getBalance()**](BalancesApi.md#getBalance) | **GET** /balance | Get a company's balance | ## `getBalance()` diff --git a/docs/Api/ChargesApi.md b/docs/Api/ChargesApi.md index 2f591bf..40dd56c 100644 --- a/docs/Api/ChargesApi.md +++ b/docs/Api/ChargesApi.md @@ -6,6 +6,7 @@ All URIs are relative to https://api.conekta.io, except if the operation defines | ------------- | ------------- | ------------- | | [**getCharges()**](ChargesApi.md#getCharges) | **GET** /charges | Get A List of Charges | | [**ordersCreateCharge()**](ChargesApi.md#ordersCreateCharge) | **POST** /orders/{id}/charges | Create charge | +| [**updateCharge()**](ChargesApi.md#updateCharge) | **PUT** /charges/{id} | Update a charge | ## `getCharges()` @@ -141,3 +142,67 @@ try { [[Back to top]](#) [[Back to API list]](../../README.md#endpoints) [[Back to Model list]](../../README.md#models) [[Back to README]](../../README.md) + +## `updateCharge()` + +```php +updateCharge($id, $charge_update_request, $accept_language, $x_child_company_id): \Conekta\Model\ChargeResponse +``` + +Update a charge + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Conekta\Api\ChargesApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$id = 6307a60c41de27127515a575; // string | Identifier of the resource +$charge_update_request = new \Conekta\Model\ChargeUpdateRequest(); // \Conekta\Model\ChargeUpdateRequest | requested field for update a charge +$accept_language = es; // string | Use for knowing which language to use +$x_child_company_id = 6441b6376b60c3a638da80af; // string | In the case of a holding company, the company id of the child company to which will process the request. + +try { + $result = $apiInstance->updateCharge($id, $charge_update_request, $accept_language, $x_child_company_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ChargesApi->updateCharge: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| Identifier of the resource | | +| **charge_update_request** | [**\Conekta\Model\ChargeUpdateRequest**](../Model/ChargeUpdateRequest.md)| requested field for update a charge | | +| **accept_language** | **string**| Use for knowing which language to use | [optional] [default to 'es'] | +| **x_child_company_id** | **string**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**\Conekta\Model\ChargeResponse**](../Model/ChargeResponse.md) + +### Authorization + +[bearerAuth](../../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/vnd.conekta-v2.1.0+json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Model/ChargeRequest.md b/docs/Model/ChargeRequest.md index 21e221e..33183ea 100644 --- a/docs/Model/ChargeRequest.md +++ b/docs/Model/ChargeRequest.md @@ -5,7 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **amount** | **int** | | [optional] -**monthly_installments** | **int** | How many months without interest to apply, it can be 3, 6, 9, 12 or 18 | [optional] **payment_method** | [**\Conekta\Model\ChargeRequestPaymentMethod**](ChargeRequestPaymentMethod.md) | | **reference_id** | **string** | Custom reference to add to the charge | [optional] diff --git a/docs/Model/ChargeRequestPaymentMethod.md b/docs/Model/ChargeRequestPaymentMethod.md index 2d62ac7..1354b25 100644 --- a/docs/Model/ChargeRequestPaymentMethod.md +++ b/docs/Model/ChargeRequestPaymentMethod.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **expires_at** | **int** | Method expiration date as unix timestamp | [optional] +**monthly_installments** | **int** | How many months without interest to apply, it can be 3, 6, 9, 12 or 18 | [optional] **type** | **string** | | **token_id** | **string** | | [optional] **payment_source_id** | **string** | | [optional] diff --git a/docs/Model/ChargeUpdateRequest.md b/docs/Model/ChargeUpdateRequest.md new file mode 100644 index 0000000..6543553 --- /dev/null +++ b/docs/Model/ChargeUpdateRequest.md @@ -0,0 +1,9 @@ +# # ChargeUpdateRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**reference_id** | **string** | custom reference id | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CustomerInfoResponse.md b/docs/Model/CustomerInfoResponse.md index c25d71e..8272acd 100644 --- a/docs/Model/CustomerInfoResponse.md +++ b/docs/Model/CustomerInfoResponse.md @@ -4,6 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**customer_custom_reference** | **string** | Custom reference | [optional] **name** | **string** | | [optional] **email** | **string** | | [optional] **phone** | **string** | | [optional] diff --git a/docs/Model/CustomerResponse.md b/docs/Model/CustomerResponse.md index daf4781..32c34b3 100644 --- a/docs/Model/CustomerResponse.md +++ b/docs/Model/CustomerResponse.md @@ -5,20 +5,21 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **antifraud_info** | [**\Conekta\Model\CustomerAntifraudInfoResponse**](CustomerAntifraudInfoResponse.md) | | [optional] -**corporate** | **bool** | | [optional] -**created_at** | **int** | | -**custom_reference** | **string** | | [optional] +**corporate** | **bool** | true if the customer is a company | [optional] +**created_at** | **int** | Creation date of the object | +**custom_reference** | **string** | Custom reference | [optional] **default_fiscal_entity_id** | **string** | | [optional] **default_shipping_contact_id** | **string** | | [optional] **default_payment_source_id** | **string** | | [optional] **email** | **string** | | [optional] **fiscal_entities** | [**\Conekta\Model\CustomerFiscalEntitiesResponse**](CustomerFiscalEntitiesResponse.md) | | [optional] -**id** | **string** | | -**livemode** | **bool** | | -**name** | **string** | | [optional] +**id** | **string** | Customer's ID | +**livemode** | **bool** | true if the object exists in live mode or the value false if the object exists in test mode | +**name** | **string** | Customer's name | +**metadata** | **array** | | [optional] **object** | **string** | | **payment_sources** | [**\Conekta\Model\CustomerPaymentMethodsResponse**](CustomerPaymentMethodsResponse.md) | | [optional] -**phone** | **string** | | [optional] +**phone** | **string** | Customer's phone number | [optional] **shipping_contacts** | [**\Conekta\Model\CustomerResponseShippingContacts**](CustomerResponseShippingContacts.md) | | [optional] **subscription** | [**\Conekta\Model\SubscriptionResponse**](SubscriptionResponse.md) | | [optional] diff --git a/docs/Model/CustomerShippingContacts.md b/docs/Model/CustomerShippingContacts.md index ed01a89..ce3b411 100644 --- a/docs/Model/CustomerShippingContacts.md +++ b/docs/Model/CustomerShippingContacts.md @@ -11,5 +11,6 @@ Name | Type | Description | Notes **parent_id** | **string** | | [optional] **default** | **bool** | | [optional] **deleted** | **bool** | | [optional] +**metadata** | **array** | Metadata associated with the shipping contact | [optional] [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CustomerShippingContactsDataResponse.md b/docs/Model/CustomerShippingContactsDataResponse.md index d9edbe3..74cfdde 100644 --- a/docs/Model/CustomerShippingContactsDataResponse.md +++ b/docs/Model/CustomerShippingContactsDataResponse.md @@ -11,6 +11,7 @@ Name | Type | Description | Notes **parent_id** | **string** | | [optional] **default** | **bool** | | [optional] **deleted** | **bool** | | [optional] +**metadata** | **array** | Metadata associated with the shipping contact | [optional] **id** | **string** | | **object** | **string** | | **created_at** | **int** | | diff --git a/docs/Model/CustomerShippingContactsResponse.md b/docs/Model/CustomerShippingContactsResponse.md index 922680f..dd11c25 100644 --- a/docs/Model/CustomerShippingContactsResponse.md +++ b/docs/Model/CustomerShippingContactsResponse.md @@ -12,6 +12,7 @@ Name | Type | Description | Notes **default** | **bool** | | [optional] **id** | **string** | | [optional] **created_at** | **int** | | [optional] +**metadata** | **array** | Metadata associated with the shipping contact | [optional] **object** | **string** | | [optional] **deleted** | **bool** | | [optional] diff --git a/docs/Model/FiscalEntityAddress.md b/docs/Model/FiscalEntityAddress.md new file mode 100644 index 0000000..f61b461 --- /dev/null +++ b/docs/Model/FiscalEntityAddress.md @@ -0,0 +1,15 @@ +# # FiscalEntityAddress + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**street1** | **string** | Street name and number | +**street2** | **string** | Street name and number | [optional] +**postal_code** | **string** | Postal code | +**city** | **string** | City | +**state** | **string** | State | [optional] +**country** | **string** | this field follows the [ISO 3166-1 alpha-2 standard](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) | +**external_number** | **string** | External number | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OrderCustomerInfoResponse.md b/docs/Model/OrderCustomerInfoResponse.md new file mode 100644 index 0000000..bf0e7d9 --- /dev/null +++ b/docs/Model/OrderCustomerInfoResponse.md @@ -0,0 +1,14 @@ +# # OrderCustomerInfoResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**customer_custom_reference** | **string** | Custom reference | [optional] +**name** | **string** | | [optional] +**email** | **string** | | [optional] +**phone** | **string** | | [optional] +**corporate** | **bool** | | [optional] [default to false] +**object** | **string** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OrderFiscalEntityAddressResponse.md b/docs/Model/OrderFiscalEntityAddressResponse.md new file mode 100644 index 0000000..864b837 --- /dev/null +++ b/docs/Model/OrderFiscalEntityAddressResponse.md @@ -0,0 +1,16 @@ +# # OrderFiscalEntityAddressResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**street1** | **string** | Street name and number | +**street2** | **string** | Street name and number | [optional] +**postal_code** | **string** | Postal code | +**city** | **string** | City | +**state** | **string** | State | [optional] +**country** | **string** | this field follows the [ISO 3166-1 alpha-2 standard](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) | +**external_number** | **string** | External number | +**object** | **string** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OrderFiscalEntityAddressResponseAllOf.md b/docs/Model/OrderFiscalEntityAddressResponseAllOf.md new file mode 100644 index 0000000..6740616 --- /dev/null +++ b/docs/Model/OrderFiscalEntityAddressResponseAllOf.md @@ -0,0 +1,9 @@ +# # OrderFiscalEntityAddressResponseAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OrderFiscalEntityRequest.md b/docs/Model/OrderFiscalEntityRequest.md new file mode 100644 index 0000000..4b27d5f --- /dev/null +++ b/docs/Model/OrderFiscalEntityRequest.md @@ -0,0 +1,14 @@ +# # OrderFiscalEntityRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**address** | [**\Conekta\Model\FiscalEntityAddress**](FiscalEntityAddress.md) | | +**email** | **string** | Email of the fiscal entity | [optional] +**metadata** | **array** | Metadata associated with the fiscal entity | [optional] +**name** | **string** | Name of the fiscal entity | [optional] +**phone** | **string** | Phone of the fiscal entity | [optional] +**tax_id** | **string** | Tax ID of the fiscal entity | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OrderFiscalEntityResponse.md b/docs/Model/OrderFiscalEntityResponse.md new file mode 100644 index 0000000..eb3f4e5 --- /dev/null +++ b/docs/Model/OrderFiscalEntityResponse.md @@ -0,0 +1,17 @@ +# # OrderFiscalEntityResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**address** | [**\Conekta\Model\OrderFiscalEntityAddressResponse**](OrderFiscalEntityAddressResponse.md) | | +**email** | **string** | Email of the fiscal entity | [optional] +**metadata** | **array** | Metadata associated with the fiscal entity | [optional] +**name** | **string** | Name of the fiscal entity | [optional] +**tax_id** | **string** | Tax ID of the fiscal entity | [optional] +**id** | **string** | ID of the fiscal entity | +**created_at** | **int** | The time at which the object was created in seconds since the Unix epoch | +**object** | **string** | | +**phone** | **string** | Phone of the fiscal entity | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OrderRequest.md b/docs/Model/OrderRequest.md index a88b60b..8c04bfd 100644 --- a/docs/Model/OrderRequest.md +++ b/docs/Model/OrderRequest.md @@ -9,6 +9,7 @@ Name | Type | Description | Notes **currency** | **string** | Currency with which the payment will be made. It uses the 3-letter code of the [International Standard ISO 4217.](https://es.wikipedia.org/wiki/ISO_4217) | **customer_info** | [**\Conekta\Model\OrderRequestCustomerInfo**](OrderRequestCustomerInfo.md) | | **discount_lines** | [**\Conekta\Model\OrderDiscountLinesRequest[]**](OrderDiscountLinesRequest.md) | List of [discounts](https://developers.conekta.com/v2.1.0/reference/orderscreatediscountline) that are applied to the order. You must have at least one discount. | [optional] +**fiscal_entity** | [**\Conekta\Model\OrderFiscalEntityRequest**](OrderFiscalEntityRequest.md) | | [optional] **line_items** | [**\Conekta\Model\Product[]**](Product.md) | List of [products](https://developers.conekta.com/v2.1.0/reference/orderscreateproduct) that are sold in the order. You must have at least one product. | **metadata** | **array** | Metadata associated with the order | [optional] **needs_shipping_contact** | **bool** | Allows you to fill out the shipping information at checkout | [optional] diff --git a/docs/Model/OrderResponse.md b/docs/Model/OrderResponse.md index 56c8ed3..d5ec926 100644 --- a/docs/Model/OrderResponse.md +++ b/docs/Model/OrderResponse.md @@ -13,7 +13,7 @@ Name | Type | Description | Notes **currency** | **string** | The three-letter ISO 4217 currency code. The currency of the order. | [optional] **customer_info** | [**\Conekta\Model\OrderResponseCustomerInfo**](OrderResponseCustomerInfo.md) | | [optional] **discount_lines** | [**\Conekta\Model\OrderResponseDiscountLines**](OrderResponseDiscountLines.md) | | [optional] -**fiscal_entity** | [**\Conekta\Model\OrderResponseFiscalEntity**](OrderResponseFiscalEntity.md) | | [optional] +**fiscal_entity** | [**\Conekta\Model\OrderFiscalEntityResponse**](OrderFiscalEntityResponse.md) | | [optional] **id** | **string** | | [optional] **is_refundable** | **bool** | | [optional] **line_items** | [**\Conekta\Model\OrderResponseProducts**](OrderResponseProducts.md) | | [optional] diff --git a/docs/Model/OrderResponseCustomerInfo.md b/docs/Model/OrderResponseCustomerInfo.md index fdf71c7..9a656b9 100644 --- a/docs/Model/OrderResponseCustomerInfo.md +++ b/docs/Model/OrderResponseCustomerInfo.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **object** | **string** | | [optional] +**customer_custom_reference** | **string** | Custom reference | [optional] **name** | **string** | | [optional] **email** | **string** | | [optional] **phone** | **string** | | [optional] diff --git a/docs/Model/OrderResponseShippingContact.md b/docs/Model/OrderResponseShippingContact.md index 153b289..1d7edbd 100644 --- a/docs/Model/OrderResponseShippingContact.md +++ b/docs/Model/OrderResponseShippingContact.md @@ -13,6 +13,7 @@ Name | Type | Description | Notes **address** | [**\Conekta\Model\CustomerShippingContactsResponseAddress**](CustomerShippingContactsResponseAddress.md) | | [optional] **parent_id** | **string** | | [optional] **default** | **bool** | | [optional] +**metadata** | **array** | Metadata associated with the shipping contact | [optional] **deleted** | **bool** | | [optional] [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OrderUpdateFiscalEntityRequest.md b/docs/Model/OrderUpdateFiscalEntityRequest.md new file mode 100644 index 0000000..fbca115 --- /dev/null +++ b/docs/Model/OrderUpdateFiscalEntityRequest.md @@ -0,0 +1,14 @@ +# # OrderUpdateFiscalEntityRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**address** | [**\Conekta\Model\FiscalEntityAddress**](FiscalEntityAddress.md) | | +**email** | **string** | Email of the fiscal entity | [optional] +**name** | **string** | Name of the fiscal entity | [optional] +**metadata** | **array** | Metadata associated with the fiscal entity | [optional] +**phone** | **string** | Phone of the fiscal entity | [optional] +**tax_id** | **string** | Tax ID of the fiscal entity | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OrderUpdateRequest.md b/docs/Model/OrderUpdateRequest.md index eaaf86e..97b3fee 100644 --- a/docs/Model/OrderUpdateRequest.md +++ b/docs/Model/OrderUpdateRequest.md @@ -9,6 +9,7 @@ Name | Type | Description | Notes **currency** | **string** | Currency with which the payment will be made. It uses the 3-letter code of the [International Standard ISO 4217.](https://es.wikipedia.org/wiki/ISO_4217) | [optional] **customer_info** | [**\Conekta\Model\OrderUpdateRequestCustomerInfo**](OrderUpdateRequestCustomerInfo.md) | | [optional] **discount_lines** | [**\Conekta\Model\OrderDiscountLinesRequest[]**](OrderDiscountLinesRequest.md) | List of [discounts](https://developers.conekta.com/v2.1.0/reference/orderscreatediscountline) that are applied to the order. You must have at least one discount. | [optional] +**fiscal_entity** | [**\Conekta\Model\OrderUpdateFiscalEntityRequest**](OrderUpdateFiscalEntityRequest.md) | | [optional] **line_items** | [**\Conekta\Model\Product[]**](Product.md) | List of [products](https://developers.conekta.com/v2.1.0/reference/orderscreateproduct) that are sold in the order. You must have at least one product. | [optional] **metadata** | **array** | | [optional] **pre_authorize** | **bool** | Indicates whether the order charges must be preauthorized | [optional] [default to false] diff --git a/docs/Model/WebhookUpdateRequest.md b/docs/Model/WebhookUpdateRequest.md index cacf202..97c0c65 100644 --- a/docs/Model/WebhookUpdateRequest.md +++ b/docs/Model/WebhookUpdateRequest.md @@ -6,6 +6,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **url** | **string** | Here you must place the URL of your Webhook remember that you must program what you will do with the events received. Also do not forget to handle the HTTPS protocol for greater security. | **synchronous** | **bool** | It is a value that allows to decide if the events will be synchronous or asynchronous. We recommend asynchronous = false | [optional] [default to false] -**subscribed_events** | **string[]** | | [optional] +**events** | **string[]** | | [optional] [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/lib/Api/BalancesApi.php b/lib/Api/BalancesApi.php index 16af163..efb6912 100644 --- a/lib/Api/BalancesApi.php +++ b/lib/Api/BalancesApi.php @@ -374,7 +374,7 @@ public function getBalanceRequest($accept_language = 'es', string $contentType = - $resourcePath = '/balances'; + $resourcePath = '/balance'; $formParams = []; $queryParams = []; $headerParams = []; diff --git a/lib/Api/ChargesApi.php b/lib/Api/ChargesApi.php index 9f2909e..9908f6c 100644 --- a/lib/Api/ChargesApi.php +++ b/lib/Api/ChargesApi.php @@ -78,6 +78,9 @@ class ChargesApi 'ordersCreateCharge' => [ 'application/json', ], + 'updateCharge' => [ + 'application/json', + ], ]; /** @@ -951,6 +954,405 @@ public function ordersCreateChargeRequest($id, $charge_request, $accept_language ); } + /** + * Operation updateCharge + * + * Update a charge + * + * @param string $id Identifier of the resource (required) + * @param \Conekta\Model\ChargeUpdateRequest $charge_update_request requested field for update a charge (required) + * @param string $accept_language Use for knowing which language to use (optional, default to 'es') + * @param string $x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCharge'] to see the possible values for this operation + * + * @throws \Conekta\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Conekta\Model\ChargeResponse|\Conekta\Model\Error|\Conekta\Model\Error|\Conekta\Model\Error + */ + public function updateCharge($id, $charge_update_request, $accept_language = 'es', $x_child_company_id = null, string $contentType = self::contentTypes['updateCharge'][0]) + { + list($response) = $this->updateChargeWithHttpInfo($id, $charge_update_request, $accept_language, $x_child_company_id, $contentType); + return $response; + } + + /** + * Operation updateChargeWithHttpInfo + * + * Update a charge + * + * @param string $id Identifier of the resource (required) + * @param \Conekta\Model\ChargeUpdateRequest $charge_update_request requested field for update a charge (required) + * @param string $accept_language Use for knowing which language to use (optional, default to 'es') + * @param string $x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCharge'] to see the possible values for this operation + * + * @throws \Conekta\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Conekta\Model\ChargeResponse|\Conekta\Model\Error|\Conekta\Model\Error|\Conekta\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function updateChargeWithHttpInfo($id, $charge_update_request, $accept_language = 'es', $x_child_company_id = null, string $contentType = self::contentTypes['updateCharge'][0]) + { + $request = $this->updateChargeRequest($id, $charge_update_request, $accept_language, $x_child_company_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + 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) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Conekta\Model\ChargeResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Conekta\Model\ChargeResponse' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\Conekta\Model\ChargeResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\Conekta\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Conekta\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\Conekta\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\Conekta\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Conekta\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\Conekta\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Conekta\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Conekta\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\Conekta\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Conekta\Model\ChargeResponse'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Conekta\Model\ChargeResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Conekta\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Conekta\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Conekta\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateChargeAsync + * + * Update a charge + * + * @param string $id Identifier of the resource (required) + * @param \Conekta\Model\ChargeUpdateRequest $charge_update_request requested field for update a charge (required) + * @param string $accept_language Use for knowing which language to use (optional, default to 'es') + * @param string $x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCharge'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateChargeAsync($id, $charge_update_request, $accept_language = 'es', $x_child_company_id = null, string $contentType = self::contentTypes['updateCharge'][0]) + { + return $this->updateChargeAsyncWithHttpInfo($id, $charge_update_request, $accept_language, $x_child_company_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateChargeAsyncWithHttpInfo + * + * Update a charge + * + * @param string $id Identifier of the resource (required) + * @param \Conekta\Model\ChargeUpdateRequest $charge_update_request requested field for update a charge (required) + * @param string $accept_language Use for knowing which language to use (optional, default to 'es') + * @param string $x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCharge'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateChargeAsyncWithHttpInfo($id, $charge_update_request, $accept_language = 'es', $x_child_company_id = null, string $contentType = self::contentTypes['updateCharge'][0]) + { + $returnType = '\Conekta\Model\ChargeResponse'; + $request = $this->updateChargeRequest($id, $charge_update_request, $accept_language, $x_child_company_id, $contentType); + + 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(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::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(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'updateCharge' + * + * @param string $id Identifier of the resource (required) + * @param \Conekta\Model\ChargeUpdateRequest $charge_update_request requested field for update a charge (required) + * @param string $accept_language Use for knowing which language to use (optional, default to 'es') + * @param string $x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCharge'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateChargeRequest($id, $charge_update_request, $accept_language = 'es', $x_child_company_id = null, string $contentType = self::contentTypes['updateCharge'][0]) + { + + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling updateCharge' + ); + } + + // verify the required parameter 'charge_update_request' is set + if ($charge_update_request === null || (is_array($charge_update_request) && count($charge_update_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $charge_update_request when calling updateCharge' + ); + } + + + + + $resourcePath = '/charges/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // header params + if ($accept_language !== null) { + $headerParams['Accept-Language'] = ObjectSerializer::toHeaderValue($accept_language); + } + // header params + if ($x_child_company_id !== null) { + $headerParams['X-Child-Company-Id'] = ObjectSerializer::toHeaderValue($x_child_company_id); + } + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/vnd.conekta-v2.1.0+json', ], + $contentType, + $multipart + ); + $headers = array_merge( + $this->headerSelector->getConektaUserAgent(), + $headers + ); + + // for model (json/xml) + if (isset($charge_update_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($charge_update_request)); + } else { + $httpBody = $charge_update_request; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + /** * Create http client option * diff --git a/lib/Configuration.php b/lib/Configuration.php index f85c10d..31ab5f6 100644 --- a/lib/Configuration.php +++ b/lib/Configuration.php @@ -101,7 +101,7 @@ class Configuration * * @var string */ - protected $userAgent = 'Conekta/v2 PhpBindings/6.0.1'; + protected $userAgent = 'Conekta/v2 PhpBindings/6.0.2'; /** * Debug switch (default set to false) @@ -456,7 +456,7 @@ public static function toDebugReport() $report .= ' OS: ' . $uname . PHP_EOL; $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; $report .= ' The version of the OpenAPI document: 2.1.0' . PHP_EOL; - $report .= ' SDK Package Version: 6.0.1' . PHP_EOL; + $report .= ' SDK Package Version: 6.0.2' . PHP_EOL; $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; return $report; diff --git a/lib/HeaderSelector.php b/lib/HeaderSelector.php index b723873..ee50996 100644 --- a/lib/HeaderSelector.php +++ b/lib/HeaderSelector.php @@ -262,7 +262,7 @@ public function getConektaUserAgent(): array $uname = $uname_disabled ? '(disabled)' : \php_uname(); $userAgent = [ - 'bindings_version' => "6.0.1", + 'bindings_version' => "6.0.2", 'lang' => 'php', 'lang_version' => phpversion(), 'publisher' => 'conekta', diff --git a/lib/Model/ChargeRequest.php b/lib/Model/ChargeRequest.php index 5230338..aaa5281 100644 --- a/lib/Model/ChargeRequest.php +++ b/lib/Model/ChargeRequest.php @@ -60,7 +60,6 @@ class ChargeRequest implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static $openAPITypes = [ 'amount' => 'int', - 'monthly_installments' => 'int', 'payment_method' => '\Conekta\Model\ChargeRequestPaymentMethod', 'reference_id' => 'string' ]; @@ -74,7 +73,6 @@ class ChargeRequest implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static $openAPIFormats = [ 'amount' => null, - 'monthly_installments' => 'int8', 'payment_method' => null, 'reference_id' => null ]; @@ -86,7 +84,6 @@ class ChargeRequest implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'amount' => false, - 'monthly_installments' => false, 'payment_method' => false, 'reference_id' => false ]; @@ -178,7 +175,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'amount' => 'amount', - 'monthly_installments' => 'monthly_installments', 'payment_method' => 'payment_method', 'reference_id' => 'reference_id' ]; @@ -190,7 +186,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'amount' => 'setAmount', - 'monthly_installments' => 'setMonthlyInstallments', 'payment_method' => 'setPaymentMethod', 'reference_id' => 'setReferenceId' ]; @@ -202,7 +197,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'amount' => 'getAmount', - 'monthly_installments' => 'getMonthlyInstallments', 'payment_method' => 'getPaymentMethod', 'reference_id' => 'getReferenceId' ]; @@ -265,7 +259,6 @@ public function getModelName() public function __construct(array $data = null) { $this->setIfExists('amount', $data ?? [], null); - $this->setIfExists('monthly_installments', $data ?? [], null); $this->setIfExists('payment_method', $data ?? [], null); $this->setIfExists('reference_id', $data ?? [], null); } @@ -342,33 +335,6 @@ public function setAmount($amount) return $this; } - /** - * Gets monthly_installments - * - * @return int|null - */ - public function getMonthlyInstallments() - { - return $this->container['monthly_installments']; - } - - /** - * Sets monthly_installments - * - * @param int|null $monthly_installments How many months without interest to apply, it can be 3, 6, 9, 12 or 18 - * - * @return self - */ - public function setMonthlyInstallments($monthly_installments) - { - if (is_null($monthly_installments)) { - throw new \InvalidArgumentException('non-nullable monthly_installments cannot be null'); - } - $this->container['monthly_installments'] = $monthly_installments; - - return $this; - } - /** * Gets payment_method * diff --git a/lib/Model/ChargeRequestPaymentMethod.php b/lib/Model/ChargeRequestPaymentMethod.php index af41beb..4f0142b 100644 --- a/lib/Model/ChargeRequestPaymentMethod.php +++ b/lib/Model/ChargeRequestPaymentMethod.php @@ -60,6 +60,7 @@ class ChargeRequestPaymentMethod implements ModelInterface, ArrayAccess, \JsonSe */ protected static $openAPITypes = [ 'expires_at' => 'int', + 'monthly_installments' => 'int', 'type' => 'string', 'token_id' => 'string', 'payment_source_id' => 'string', @@ -75,6 +76,7 @@ class ChargeRequestPaymentMethod implements ModelInterface, ArrayAccess, \JsonSe */ protected static $openAPIFormats = [ 'expires_at' => 'int64', + 'monthly_installments' => 'int8', 'type' => null, 'token_id' => null, 'payment_source_id' => null, @@ -88,6 +90,7 @@ class ChargeRequestPaymentMethod implements ModelInterface, ArrayAccess, \JsonSe */ protected static array $openAPINullables = [ 'expires_at' => false, + 'monthly_installments' => false, 'type' => false, 'token_id' => false, 'payment_source_id' => false, @@ -181,6 +184,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'expires_at' => 'expires_at', + 'monthly_installments' => 'monthly_installments', 'type' => 'type', 'token_id' => 'token_id', 'payment_source_id' => 'payment_source_id', @@ -194,6 +198,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'expires_at' => 'setExpiresAt', + 'monthly_installments' => 'setMonthlyInstallments', 'type' => 'setType', 'token_id' => 'setTokenId', 'payment_source_id' => 'setPaymentSourceId', @@ -207,6 +212,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'expires_at' => 'getExpiresAt', + 'monthly_installments' => 'getMonthlyInstallments', 'type' => 'getType', 'token_id' => 'getTokenId', 'payment_source_id' => 'getPaymentSourceId', @@ -271,6 +277,7 @@ public function getModelName() public function __construct(array $data = null) { $this->setIfExists('expires_at', $data ?? [], null); + $this->setIfExists('monthly_installments', $data ?? [], null); $this->setIfExists('type', $data ?? [], null); $this->setIfExists('token_id', $data ?? [], null); $this->setIfExists('payment_source_id', $data ?? [], null); @@ -357,6 +364,33 @@ public function setExpiresAt($expires_at) return $this; } + /** + * Gets monthly_installments + * + * @return int|null + */ + public function getMonthlyInstallments() + { + return $this->container['monthly_installments']; + } + + /** + * Sets monthly_installments + * + * @param int|null $monthly_installments How many months without interest to apply, it can be 3, 6, 9, 12 or 18 + * + * @return self + */ + public function setMonthlyInstallments($monthly_installments) + { + if (is_null($monthly_installments)) { + throw new \InvalidArgumentException('non-nullable monthly_installments cannot be null'); + } + $this->container['monthly_installments'] = $monthly_installments; + + return $this; + } + /** * Gets type * diff --git a/lib/Model/ChargeUpdateRequest.php b/lib/Model/ChargeUpdateRequest.php new file mode 100644 index 0000000..bfaf234 --- /dev/null +++ b/lib/Model/ChargeUpdateRequest.php @@ -0,0 +1,411 @@ + + */ +class ChargeUpdateRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'charge_update_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'reference_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'reference_id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'reference_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'reference_id' => 'reference_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'reference_id' => 'setReferenceId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'reference_id' => 'getReferenceId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('reference_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets reference_id + * + * @return string|null + */ + public function getReferenceId() + { + return $this->container['reference_id']; + } + + /** + * Sets reference_id + * + * @param string|null $reference_id custom reference id + * + * @return self + */ + public function setReferenceId($reference_id) + { + if (is_null($reference_id)) { + throw new \InvalidArgumentException('non-nullable reference_id cannot be null'); + } + $this->container['reference_id'] = $reference_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/CustomerInfoResponse.php b/lib/Model/CustomerInfoResponse.php index f54b616..35e0574 100644 --- a/lib/Model/CustomerInfoResponse.php +++ b/lib/Model/CustomerInfoResponse.php @@ -58,6 +58,7 @@ class CustomerInfoResponse implements ModelInterface, ArrayAccess, \JsonSerializ * @var string[] */ protected static $openAPITypes = [ + 'customer_custom_reference' => 'string', 'name' => 'string', 'email' => 'string', 'phone' => 'string', @@ -73,6 +74,7 @@ class CustomerInfoResponse implements ModelInterface, ArrayAccess, \JsonSerializ * @psalm-var array */ protected static $openAPIFormats = [ + 'customer_custom_reference' => null, 'name' => null, 'email' => 'email', 'phone' => null, @@ -86,7 +88,8 @@ class CustomerInfoResponse implements ModelInterface, ArrayAccess, \JsonSerializ * @var boolean[] */ protected static array $openAPINullables = [ - 'name' => false, + 'customer_custom_reference' => true, + 'name' => false, 'email' => false, 'phone' => false, 'corporate' => false, @@ -179,6 +182,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ + 'customer_custom_reference' => 'customer_custom_reference', 'name' => 'name', 'email' => 'email', 'phone' => 'phone', @@ -192,6 +196,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ + 'customer_custom_reference' => 'setCustomerCustomReference', 'name' => 'setName', 'email' => 'setEmail', 'phone' => 'setPhone', @@ -205,6 +210,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ + 'customer_custom_reference' => 'getCustomerCustomReference', 'name' => 'getName', 'email' => 'getEmail', 'phone' => 'getPhone', @@ -269,6 +275,7 @@ public function getModelName() */ public function __construct(array $data = null) { + $this->setIfExists('customer_custom_reference', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); $this->setIfExists('email', $data ?? [], null); $this->setIfExists('phone', $data ?? [], null); @@ -318,6 +325,40 @@ public function valid() } + /** + * Gets customer_custom_reference + * + * @return string|null + */ + public function getCustomerCustomReference() + { + return $this->container['customer_custom_reference']; + } + + /** + * Sets customer_custom_reference + * + * @param string|null $customer_custom_reference Custom reference + * + * @return self + */ + public function setCustomerCustomReference($customer_custom_reference) + { + if (is_null($customer_custom_reference)) { + array_push($this->openAPINullablesSetToNull, 'customer_custom_reference'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customer_custom_reference', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customer_custom_reference'] = $customer_custom_reference; + + return $this; + } + /** * Gets name * diff --git a/lib/Model/CustomerResponse.php b/lib/Model/CustomerResponse.php index a35c078..7a07d13 100644 --- a/lib/Model/CustomerResponse.php +++ b/lib/Model/CustomerResponse.php @@ -71,6 +71,7 @@ class CustomerResponse implements ModelInterface, ArrayAccess, \JsonSerializable 'id' => 'string', 'livemode' => 'bool', 'name' => 'string', + 'metadata' => 'array', 'object' => 'string', 'payment_sources' => '\Conekta\Model\CustomerPaymentMethodsResponse', 'phone' => 'string', @@ -98,6 +99,7 @@ class CustomerResponse implements ModelInterface, ArrayAccess, \JsonSerializable 'id' => null, 'livemode' => null, 'name' => null, + 'metadata' => null, 'object' => null, 'payment_sources' => null, 'phone' => null, @@ -123,6 +125,7 @@ class CustomerResponse implements ModelInterface, ArrayAccess, \JsonSerializable 'id' => false, 'livemode' => false, 'name' => false, + 'metadata' => false, 'object' => false, 'payment_sources' => false, 'phone' => false, @@ -228,6 +231,7 @@ public function isNullableSetToNull(string $property): bool 'id' => 'id', 'livemode' => 'livemode', 'name' => 'name', + 'metadata' => 'metadata', 'object' => 'object', 'payment_sources' => 'payment_sources', 'phone' => 'phone', @@ -253,6 +257,7 @@ public function isNullableSetToNull(string $property): bool 'id' => 'setId', 'livemode' => 'setLivemode', 'name' => 'setName', + 'metadata' => 'setMetadata', 'object' => 'setObject', 'payment_sources' => 'setPaymentSources', 'phone' => 'setPhone', @@ -278,6 +283,7 @@ public function isNullableSetToNull(string $property): bool 'id' => 'getId', 'livemode' => 'getLivemode', 'name' => 'getName', + 'metadata' => 'getMetadata', 'object' => 'getObject', 'payment_sources' => 'getPaymentSources', 'phone' => 'getPhone', @@ -354,6 +360,7 @@ public function __construct(array $data = null) $this->setIfExists('id', $data ?? [], null); $this->setIfExists('livemode', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); $this->setIfExists('object', $data ?? [], null); $this->setIfExists('payment_sources', $data ?? [], null); $this->setIfExists('phone', $data ?? [], null); @@ -397,6 +404,13 @@ public function listInvalidProperties() if ($this->container['livemode'] === null) { $invalidProperties[] = "'livemode' can't be null"; } + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if (!is_null($this->container['metadata']) && (count($this->container['metadata']) > 100)) { + $invalidProperties[] = "invalid value for 'metadata', number of items must be less than or equal to 100."; + } + if ($this->container['object'] === null) { $invalidProperties[] = "'object' can't be null"; } @@ -462,7 +476,7 @@ public function getCorporate() /** * Sets corporate * - * @param bool|null $corporate corporate + * @param bool|null $corporate true if the customer is a company * * @return self */ @@ -489,7 +503,7 @@ public function getCreatedAt() /** * Sets created_at * - * @param int $created_at created_at + * @param int $created_at Creation date of the object * * @return self */ @@ -516,7 +530,7 @@ public function getCustomReference() /** * Sets custom_reference * - * @param string|null $custom_reference custom_reference + * @param string|null $custom_reference Custom reference * * @return self */ @@ -692,7 +706,7 @@ public function getId() /** * Sets id * - * @param string $id id + * @param string $id Customer's ID * * @return self */ @@ -719,7 +733,7 @@ public function getLivemode() /** * Sets livemode * - * @param bool $livemode livemode + * @param bool $livemode true if the object exists in live mode or the value false if the object exists in test mode * * @return self */ @@ -736,7 +750,7 @@ public function setLivemode($livemode) /** * Gets name * - * @return string|null + * @return string */ public function getName() { @@ -746,7 +760,7 @@ public function getName() /** * Sets name * - * @param string|null $name name + * @param string $name Customer's name * * @return self */ @@ -760,6 +774,37 @@ public function setName($name) return $this; } + /** + * Gets metadata + * + * @return array|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param array|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + throw new \InvalidArgumentException('non-nullable metadata cannot be null'); + } + + if ((count($metadata) > 100)) { + throw new \InvalidArgumentException('invalid value for $metadata when calling CustomerResponse., number of items must be less than or equal to 100.'); + } + $this->container['metadata'] = $metadata; + + return $this; + } + /** * Gets object * @@ -827,7 +872,7 @@ public function getPhone() /** * Sets phone * - * @param string|null $phone phone + * @param string|null $phone Customer's phone number * * @return self */ diff --git a/lib/Model/CustomerShippingContacts.php b/lib/Model/CustomerShippingContacts.php index fe65325..65b7b1f 100644 --- a/lib/Model/CustomerShippingContacts.php +++ b/lib/Model/CustomerShippingContacts.php @@ -65,7 +65,8 @@ class CustomerShippingContacts implements ModelInterface, ArrayAccess, \JsonSeri 'address' => '\Conekta\Model\CustomerShippingContactsAddress', 'parent_id' => 'string', 'default' => 'bool', - 'deleted' => 'bool' + 'deleted' => 'bool', + 'metadata' => 'array' ]; /** @@ -82,7 +83,8 @@ class CustomerShippingContacts implements ModelInterface, ArrayAccess, \JsonSeri 'address' => null, 'parent_id' => null, 'default' => null, - 'deleted' => null + 'deleted' => null, + 'metadata' => null ]; /** @@ -97,7 +99,8 @@ class CustomerShippingContacts implements ModelInterface, ArrayAccess, \JsonSeri 'address' => false, 'parent_id' => false, 'default' => true, - 'deleted' => true + 'deleted' => true, + 'metadata' => false ]; /** @@ -192,7 +195,8 @@ public function isNullableSetToNull(string $property): bool 'address' => 'address', 'parent_id' => 'parent_id', 'default' => 'default', - 'deleted' => 'deleted' + 'deleted' => 'deleted', + 'metadata' => 'metadata' ]; /** @@ -207,7 +211,8 @@ public function isNullableSetToNull(string $property): bool 'address' => 'setAddress', 'parent_id' => 'setParentId', 'default' => 'setDefault', - 'deleted' => 'setDeleted' + 'deleted' => 'setDeleted', + 'metadata' => 'setMetadata' ]; /** @@ -222,7 +227,8 @@ public function isNullableSetToNull(string $property): bool 'address' => 'getAddress', 'parent_id' => 'getParentId', 'default' => 'getDefault', - 'deleted' => 'getDeleted' + 'deleted' => 'getDeleted', + 'metadata' => 'getMetadata' ]; /** @@ -289,6 +295,7 @@ public function __construct(array $data = null) $this->setIfExists('parent_id', $data ?? [], null); $this->setIfExists('default', $data ?? [], null); $this->setIfExists('deleted', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); } /** @@ -321,6 +328,10 @@ public function listInvalidProperties() if ($this->container['address'] === null) { $invalidProperties[] = "'address' can't be null"; } + if (!is_null($this->container['metadata']) && (count($this->container['metadata']) > 100)) { + $invalidProperties[] = "invalid value for 'metadata', number of items must be less than or equal to 100."; + } + return $invalidProperties; } @@ -538,6 +549,37 @@ public function setDeleted($deleted) return $this; } + + /** + * Gets metadata + * + * @return array|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param array|null $metadata Metadata associated with the shipping contact + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + throw new \InvalidArgumentException('non-nullable metadata cannot be null'); + } + + if ((count($metadata) > 100)) { + throw new \InvalidArgumentException('invalid value for $metadata when calling CustomerShippingContacts., number of items must be less than or equal to 100.'); + } + $this->container['metadata'] = $metadata; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/lib/Model/CustomerShippingContactsDataResponse.php b/lib/Model/CustomerShippingContactsDataResponse.php index f49d350..71b7c67 100644 --- a/lib/Model/CustomerShippingContactsDataResponse.php +++ b/lib/Model/CustomerShippingContactsDataResponse.php @@ -65,6 +65,7 @@ class CustomerShippingContactsDataResponse implements ModelInterface, ArrayAcces 'parent_id' => 'string', 'default' => 'bool', 'deleted' => 'bool', + 'metadata' => 'array', 'id' => 'string', 'object' => 'string', 'created_at' => 'int' @@ -85,6 +86,7 @@ class CustomerShippingContactsDataResponse implements ModelInterface, ArrayAcces 'parent_id' => null, 'default' => null, 'deleted' => null, + 'metadata' => null, 'id' => null, 'object' => null, 'created_at' => 'int64' @@ -103,6 +105,7 @@ class CustomerShippingContactsDataResponse implements ModelInterface, ArrayAcces 'parent_id' => false, 'default' => true, 'deleted' => true, + 'metadata' => false, 'id' => false, 'object' => false, 'created_at' => false @@ -201,6 +204,7 @@ public function isNullableSetToNull(string $property): bool 'parent_id' => 'parent_id', 'default' => 'default', 'deleted' => 'deleted', + 'metadata' => 'metadata', 'id' => 'id', 'object' => 'object', 'created_at' => 'created_at' @@ -219,6 +223,7 @@ public function isNullableSetToNull(string $property): bool 'parent_id' => 'setParentId', 'default' => 'setDefault', 'deleted' => 'setDeleted', + 'metadata' => 'setMetadata', 'id' => 'setId', 'object' => 'setObject', 'created_at' => 'setCreatedAt' @@ -237,6 +242,7 @@ public function isNullableSetToNull(string $property): bool 'parent_id' => 'getParentId', 'default' => 'getDefault', 'deleted' => 'getDeleted', + 'metadata' => 'getMetadata', 'id' => 'getId', 'object' => 'getObject', 'created_at' => 'getCreatedAt' @@ -306,6 +312,7 @@ public function __construct(array $data = null) $this->setIfExists('parent_id', $data ?? [], null); $this->setIfExists('default', $data ?? [], null); $this->setIfExists('deleted', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); $this->setIfExists('object', $data ?? [], null); $this->setIfExists('created_at', $data ?? [], null); @@ -341,6 +348,10 @@ public function listInvalidProperties() if ($this->container['address'] === null) { $invalidProperties[] = "'address' can't be null"; } + if (!is_null($this->container['metadata']) && (count($this->container['metadata']) > 100)) { + $invalidProperties[] = "invalid value for 'metadata', number of items must be less than or equal to 100."; + } + if ($this->container['id'] === null) { $invalidProperties[] = "'id' can't be null"; } @@ -568,6 +579,37 @@ public function setDeleted($deleted) return $this; } + /** + * Gets metadata + * + * @return array|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param array|null $metadata Metadata associated with the shipping contact + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + throw new \InvalidArgumentException('non-nullable metadata cannot be null'); + } + + if ((count($metadata) > 100)) { + throw new \InvalidArgumentException('invalid value for $metadata when calling CustomerShippingContactsDataResponse., number of items must be less than or equal to 100.'); + } + $this->container['metadata'] = $metadata; + + return $this; + } + /** * Gets id * diff --git a/lib/Model/CustomerShippingContactsResponse.php b/lib/Model/CustomerShippingContactsResponse.php index 4216f25..f493fe0 100644 --- a/lib/Model/CustomerShippingContactsResponse.php +++ b/lib/Model/CustomerShippingContactsResponse.php @@ -67,6 +67,7 @@ class CustomerShippingContactsResponse implements ModelInterface, ArrayAccess, \ 'default' => 'bool', 'id' => 'string', 'created_at' => 'int', + 'metadata' => 'array', 'object' => 'string', 'deleted' => 'bool' ]; @@ -87,6 +88,7 @@ class CustomerShippingContactsResponse implements ModelInterface, ArrayAccess, \ 'default' => null, 'id' => null, 'created_at' => 'int64', + 'metadata' => null, 'object' => null, 'deleted' => null ]; @@ -105,6 +107,7 @@ class CustomerShippingContactsResponse implements ModelInterface, ArrayAccess, \ 'default' => false, 'id' => false, 'created_at' => false, + 'metadata' => false, 'object' => false, 'deleted' => false ]; @@ -203,6 +206,7 @@ public function isNullableSetToNull(string $property): bool 'default' => 'default', 'id' => 'id', 'created_at' => 'created_at', + 'metadata' => 'metadata', 'object' => 'object', 'deleted' => 'deleted' ]; @@ -221,6 +225,7 @@ public function isNullableSetToNull(string $property): bool 'default' => 'setDefault', 'id' => 'setId', 'created_at' => 'setCreatedAt', + 'metadata' => 'setMetadata', 'object' => 'setObject', 'deleted' => 'setDeleted' ]; @@ -239,6 +244,7 @@ public function isNullableSetToNull(string $property): bool 'default' => 'getDefault', 'id' => 'getId', 'created_at' => 'getCreatedAt', + 'metadata' => 'getMetadata', 'object' => 'getObject', 'deleted' => 'getDeleted' ]; @@ -308,6 +314,7 @@ public function __construct(array $data = null) $this->setIfExists('default', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); $this->setIfExists('object', $data ?? [], null); $this->setIfExists('deleted', $data ?? [], null); } @@ -339,6 +346,10 @@ public function listInvalidProperties() { $invalidProperties = []; + if (!is_null($this->container['metadata']) && (count($this->container['metadata']) > 100)) { + $invalidProperties[] = "invalid value for 'metadata', number of items must be less than or equal to 100."; + } + return $invalidProperties; } @@ -577,6 +588,37 @@ public function setCreatedAt($created_at) return $this; } + /** + * Gets metadata + * + * @return array|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param array|null $metadata Metadata associated with the shipping contact + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + throw new \InvalidArgumentException('non-nullable metadata cannot be null'); + } + + if ((count($metadata) > 100)) { + throw new \InvalidArgumentException('invalid value for $metadata when calling CustomerShippingContactsResponse., number of items must be less than or equal to 100.'); + } + $this->container['metadata'] = $metadata; + + return $this; + } + /** * Gets object * diff --git a/lib/Model/FiscalEntityAddress.php b/lib/Model/FiscalEntityAddress.php new file mode 100644 index 0000000..e7bc95f --- /dev/null +++ b/lib/Model/FiscalEntityAddress.php @@ -0,0 +1,637 @@ + + */ +class FiscalEntityAddress implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'fiscal_entity_address'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'street1' => 'string', + 'street2' => 'string', + 'postal_code' => 'string', + 'city' => 'string', + 'state' => 'string', + 'country' => 'string', + 'external_number' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'street1' => null, + 'street2' => null, + 'postal_code' => null, + 'city' => null, + 'state' => null, + 'country' => null, + 'external_number' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'street1' => false, + 'street2' => true, + 'postal_code' => false, + 'city' => false, + 'state' => false, + 'country' => false, + 'external_number' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'street1' => 'street1', + 'street2' => 'street2', + 'postal_code' => 'postal_code', + 'city' => 'city', + 'state' => 'state', + 'country' => 'country', + 'external_number' => 'external_number' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'street1' => 'setStreet1', + 'street2' => 'setStreet2', + 'postal_code' => 'setPostalCode', + 'city' => 'setCity', + 'state' => 'setState', + 'country' => 'setCountry', + 'external_number' => 'setExternalNumber' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'street1' => 'getStreet1', + 'street2' => 'getStreet2', + 'postal_code' => 'getPostalCode', + 'city' => 'getCity', + 'state' => 'getState', + 'country' => 'getCountry', + 'external_number' => 'getExternalNumber' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('street1', $data ?? [], null); + $this->setIfExists('street2', $data ?? [], null); + $this->setIfExists('postal_code', $data ?? [], null); + $this->setIfExists('city', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('country', $data ?? [], null); + $this->setIfExists('external_number', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['street1'] === null) { + $invalidProperties[] = "'street1' can't be null"; + } + if ($this->container['postal_code'] === null) { + $invalidProperties[] = "'postal_code' can't be null"; + } + if ($this->container['city'] === null) { + $invalidProperties[] = "'city' can't be null"; + } + if ($this->container['country'] === null) { + $invalidProperties[] = "'country' can't be null"; + } + if ($this->container['external_number'] === null) { + $invalidProperties[] = "'external_number' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets street1 + * + * @return string + */ + public function getStreet1() + { + return $this->container['street1']; + } + + /** + * Sets street1 + * + * @param string $street1 Street name and number + * + * @return self + */ + public function setStreet1($street1) + { + if (is_null($street1)) { + throw new \InvalidArgumentException('non-nullable street1 cannot be null'); + } + $this->container['street1'] = $street1; + + return $this; + } + + /** + * Gets street2 + * + * @return string|null + */ + public function getStreet2() + { + return $this->container['street2']; + } + + /** + * Sets street2 + * + * @param string|null $street2 Street name and number + * + * @return self + */ + public function setStreet2($street2) + { + if (is_null($street2)) { + array_push($this->openAPINullablesSetToNull, 'street2'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('street2', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['street2'] = $street2; + + return $this; + } + + /** + * Gets postal_code + * + * @return string + */ + public function getPostalCode() + { + return $this->container['postal_code']; + } + + /** + * Sets postal_code + * + * @param string $postal_code Postal code + * + * @return self + */ + public function setPostalCode($postal_code) + { + if (is_null($postal_code)) { + throw new \InvalidArgumentException('non-nullable postal_code cannot be null'); + } + $this->container['postal_code'] = $postal_code; + + return $this; + } + + /** + * Gets city + * + * @return string + */ + public function getCity() + { + return $this->container['city']; + } + + /** + * Sets city + * + * @param string $city City + * + * @return self + */ + public function setCity($city) + { + if (is_null($city)) { + throw new \InvalidArgumentException('non-nullable city cannot be null'); + } + $this->container['city'] = $city; + + return $this; + } + + /** + * Gets state + * + * @return string|null + */ + public function getState() + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param string|null $state State + * + * @return self + */ + public function setState($state) + { + if (is_null($state)) { + throw new \InvalidArgumentException('non-nullable state cannot be null'); + } + $this->container['state'] = $state; + + return $this; + } + + /** + * Gets country + * + * @return string + */ + public function getCountry() + { + return $this->container['country']; + } + + /** + * Sets country + * + * @param string $country this field follows the [ISO 3166-1 alpha-2 standard](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) + * + * @return self + */ + public function setCountry($country) + { + if (is_null($country)) { + throw new \InvalidArgumentException('non-nullable country cannot be null'); + } + $this->container['country'] = $country; + + return $this; + } + + /** + * Gets external_number + * + * @return string + */ + public function getExternalNumber() + { + return $this->container['external_number']; + } + + /** + * Sets external_number + * + * @param string $external_number External number + * + * @return self + */ + public function setExternalNumber($external_number) + { + if (is_null($external_number)) { + throw new \InvalidArgumentException('non-nullable external_number cannot be null'); + } + $this->container['external_number'] = $external_number; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/OrderCustomerInfoResponse.php b/lib/Model/OrderCustomerInfoResponse.php new file mode 100644 index 0000000..8d2778e --- /dev/null +++ b/lib/Model/OrderCustomerInfoResponse.php @@ -0,0 +1,587 @@ + + */ +class OrderCustomerInfoResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'order_customer_info_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'customer_custom_reference' => 'string', + 'name' => 'string', + 'email' => 'string', + 'phone' => 'string', + 'corporate' => 'bool', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'customer_custom_reference' => null, + 'name' => null, + 'email' => 'email', + 'phone' => null, + 'corporate' => null, + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'customer_custom_reference' => true, + 'name' => false, + 'email' => false, + 'phone' => false, + 'corporate' => false, + 'object' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'customer_custom_reference' => 'customer_custom_reference', + 'name' => 'name', + 'email' => 'email', + 'phone' => 'phone', + 'corporate' => 'corporate', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'customer_custom_reference' => 'setCustomerCustomReference', + 'name' => 'setName', + 'email' => 'setEmail', + 'phone' => 'setPhone', + 'corporate' => 'setCorporate', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'customer_custom_reference' => 'getCustomerCustomReference', + 'name' => 'getName', + 'email' => 'getEmail', + 'phone' => 'getPhone', + 'corporate' => 'getCorporate', + 'object' => 'getObject' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('customer_custom_reference', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('phone', $data ?? [], null); + $this->setIfExists('corporate', $data ?? [], false); + $this->setIfExists('object', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets customer_custom_reference + * + * @return string|null + */ + public function getCustomerCustomReference() + { + return $this->container['customer_custom_reference']; + } + + /** + * Sets customer_custom_reference + * + * @param string|null $customer_custom_reference Custom reference + * + * @return self + */ + public function setCustomerCustomReference($customer_custom_reference) + { + if (is_null($customer_custom_reference)) { + array_push($this->openAPINullablesSetToNull, 'customer_custom_reference'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customer_custom_reference', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customer_custom_reference'] = $customer_custom_reference; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets email + * + * @return string|null + */ + public function getEmail() + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email email + * + * @return self + */ + public function setEmail($email) + { + if (is_null($email)) { + throw new \InvalidArgumentException('non-nullable email cannot be null'); + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets phone + * + * @return string|null + */ + public function getPhone() + { + return $this->container['phone']; + } + + /** + * Sets phone + * + * @param string|null $phone phone + * + * @return self + */ + public function setPhone($phone) + { + if (is_null($phone)) { + throw new \InvalidArgumentException('non-nullable phone cannot be null'); + } + $this->container['phone'] = $phone; + + return $this; + } + + /** + * Gets corporate + * + * @return bool|null + */ + public function getCorporate() + { + return $this->container['corporate']; + } + + /** + * Sets corporate + * + * @param bool|null $corporate corporate + * + * @return self + */ + public function setCorporate($corporate) + { + if (is_null($corporate)) { + throw new \InvalidArgumentException('non-nullable corporate cannot be null'); + } + $this->container['corporate'] = $corporate; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object object + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + throw new \InvalidArgumentException('non-nullable object cannot be null'); + } + $this->container['object'] = $object; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/OrderFiscalEntityAddressResponse.php b/lib/Model/OrderFiscalEntityAddressResponse.php new file mode 100644 index 0000000..894e5f8 --- /dev/null +++ b/lib/Model/OrderFiscalEntityAddressResponse.php @@ -0,0 +1,671 @@ + + */ +class OrderFiscalEntityAddressResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'order_fiscal_entity_address_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'street1' => 'string', + 'street2' => 'string', + 'postal_code' => 'string', + 'city' => 'string', + 'state' => 'string', + 'country' => 'string', + 'external_number' => 'string', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'street1' => null, + 'street2' => null, + 'postal_code' => null, + 'city' => null, + 'state' => null, + 'country' => null, + 'external_number' => null, + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'street1' => false, + 'street2' => true, + 'postal_code' => false, + 'city' => false, + 'state' => false, + 'country' => false, + 'external_number' => false, + 'object' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'street1' => 'street1', + 'street2' => 'street2', + 'postal_code' => 'postal_code', + 'city' => 'city', + 'state' => 'state', + 'country' => 'country', + 'external_number' => 'external_number', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'street1' => 'setStreet1', + 'street2' => 'setStreet2', + 'postal_code' => 'setPostalCode', + 'city' => 'setCity', + 'state' => 'setState', + 'country' => 'setCountry', + 'external_number' => 'setExternalNumber', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'street1' => 'getStreet1', + 'street2' => 'getStreet2', + 'postal_code' => 'getPostalCode', + 'city' => 'getCity', + 'state' => 'getState', + 'country' => 'getCountry', + 'external_number' => 'getExternalNumber', + 'object' => 'getObject' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('street1', $data ?? [], null); + $this->setIfExists('street2', $data ?? [], null); + $this->setIfExists('postal_code', $data ?? [], null); + $this->setIfExists('city', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('country', $data ?? [], null); + $this->setIfExists('external_number', $data ?? [], null); + $this->setIfExists('object', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['street1'] === null) { + $invalidProperties[] = "'street1' can't be null"; + } + if ($this->container['postal_code'] === null) { + $invalidProperties[] = "'postal_code' can't be null"; + } + if ($this->container['city'] === null) { + $invalidProperties[] = "'city' can't be null"; + } + if ($this->container['country'] === null) { + $invalidProperties[] = "'country' can't be null"; + } + if ($this->container['external_number'] === null) { + $invalidProperties[] = "'external_number' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets street1 + * + * @return string + */ + public function getStreet1() + { + return $this->container['street1']; + } + + /** + * Sets street1 + * + * @param string $street1 Street name and number + * + * @return self + */ + public function setStreet1($street1) + { + if (is_null($street1)) { + throw new \InvalidArgumentException('non-nullable street1 cannot be null'); + } + $this->container['street1'] = $street1; + + return $this; + } + + /** + * Gets street2 + * + * @return string|null + */ + public function getStreet2() + { + return $this->container['street2']; + } + + /** + * Sets street2 + * + * @param string|null $street2 Street name and number + * + * @return self + */ + public function setStreet2($street2) + { + if (is_null($street2)) { + array_push($this->openAPINullablesSetToNull, 'street2'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('street2', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['street2'] = $street2; + + return $this; + } + + /** + * Gets postal_code + * + * @return string + */ + public function getPostalCode() + { + return $this->container['postal_code']; + } + + /** + * Sets postal_code + * + * @param string $postal_code Postal code + * + * @return self + */ + public function setPostalCode($postal_code) + { + if (is_null($postal_code)) { + throw new \InvalidArgumentException('non-nullable postal_code cannot be null'); + } + $this->container['postal_code'] = $postal_code; + + return $this; + } + + /** + * Gets city + * + * @return string + */ + public function getCity() + { + return $this->container['city']; + } + + /** + * Sets city + * + * @param string $city City + * + * @return self + */ + public function setCity($city) + { + if (is_null($city)) { + throw new \InvalidArgumentException('non-nullable city cannot be null'); + } + $this->container['city'] = $city; + + return $this; + } + + /** + * Gets state + * + * @return string|null + */ + public function getState() + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param string|null $state State + * + * @return self + */ + public function setState($state) + { + if (is_null($state)) { + throw new \InvalidArgumentException('non-nullable state cannot be null'); + } + $this->container['state'] = $state; + + return $this; + } + + /** + * Gets country + * + * @return string + */ + public function getCountry() + { + return $this->container['country']; + } + + /** + * Sets country + * + * @param string $country this field follows the [ISO 3166-1 alpha-2 standard](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) + * + * @return self + */ + public function setCountry($country) + { + if (is_null($country)) { + throw new \InvalidArgumentException('non-nullable country cannot be null'); + } + $this->container['country'] = $country; + + return $this; + } + + /** + * Gets external_number + * + * @return string + */ + public function getExternalNumber() + { + return $this->container['external_number']; + } + + /** + * Sets external_number + * + * @param string $external_number External number + * + * @return self + */ + public function setExternalNumber($external_number) + { + if (is_null($external_number)) { + throw new \InvalidArgumentException('non-nullable external_number cannot be null'); + } + $this->container['external_number'] = $external_number; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object object + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + throw new \InvalidArgumentException('non-nullable object cannot be null'); + } + $this->container['object'] = $object; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/OrderFiscalEntityAddressResponseAllOf.php b/lib/Model/OrderFiscalEntityAddressResponseAllOf.php new file mode 100644 index 0000000..a773339 --- /dev/null +++ b/lib/Model/OrderFiscalEntityAddressResponseAllOf.php @@ -0,0 +1,410 @@ + + */ +class OrderFiscalEntityAddressResponseAllOf implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'order_fiscal_entity_address_response_allOf'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('object', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object object + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + throw new \InvalidArgumentException('non-nullable object cannot be null'); + } + $this->container['object'] = $object; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/OrderFiscalEntityRequest.php b/lib/Model/OrderFiscalEntityRequest.php new file mode 100644 index 0000000..a44401d --- /dev/null +++ b/lib/Model/OrderFiscalEntityRequest.php @@ -0,0 +1,606 @@ + + */ +class OrderFiscalEntityRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'order_fiscal_entity_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'address' => '\Conekta\Model\FiscalEntityAddress', + 'email' => 'string', + 'metadata' => 'array', + 'name' => 'string', + 'phone' => 'string', + 'tax_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'address' => null, + 'email' => null, + 'metadata' => null, + 'name' => null, + 'phone' => null, + 'tax_id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'address' => false, + 'email' => false, + 'metadata' => false, + 'name' => true, + 'phone' => false, + 'tax_id' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'address' => 'address', + 'email' => 'email', + 'metadata' => 'metadata', + 'name' => 'name', + 'phone' => 'phone', + 'tax_id' => 'tax_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'address' => 'setAddress', + 'email' => 'setEmail', + 'metadata' => 'setMetadata', + 'name' => 'setName', + 'phone' => 'setPhone', + 'tax_id' => 'setTaxId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'address' => 'getAddress', + 'email' => 'getEmail', + 'metadata' => 'getMetadata', + 'name' => 'getName', + 'phone' => 'getPhone', + 'tax_id' => 'getTaxId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('address', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('phone', $data ?? [], null); + $this->setIfExists('tax_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['address'] === null) { + $invalidProperties[] = "'address' can't be null"; + } + if (!is_null($this->container['metadata']) && (count($this->container['metadata']) > 100)) { + $invalidProperties[] = "invalid value for 'metadata', number of items must be less than or equal to 100."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets address + * + * @return \Conekta\Model\FiscalEntityAddress + */ + public function getAddress() + { + return $this->container['address']; + } + + /** + * Sets address + * + * @param \Conekta\Model\FiscalEntityAddress $address address + * + * @return self + */ + public function setAddress($address) + { + if (is_null($address)) { + throw new \InvalidArgumentException('non-nullable address cannot be null'); + } + $this->container['address'] = $address; + + return $this; + } + + /** + * Gets email + * + * @return string|null + */ + public function getEmail() + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email Email of the fiscal entity + * + * @return self + */ + public function setEmail($email) + { + if (is_null($email)) { + throw new \InvalidArgumentException('non-nullable email cannot be null'); + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets metadata + * + * @return array|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param array|null $metadata Metadata associated with the fiscal entity + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + throw new \InvalidArgumentException('non-nullable metadata cannot be null'); + } + + if ((count($metadata) > 100)) { + throw new \InvalidArgumentException('invalid value for $metadata when calling OrderFiscalEntityRequest., number of items must be less than or equal to 100.'); + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name of the fiscal entity + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets phone + * + * @return string|null + */ + public function getPhone() + { + return $this->container['phone']; + } + + /** + * Sets phone + * + * @param string|null $phone Phone of the fiscal entity + * + * @return self + */ + public function setPhone($phone) + { + if (is_null($phone)) { + throw new \InvalidArgumentException('non-nullable phone cannot be null'); + } + $this->container['phone'] = $phone; + + return $this; + } + + /** + * Gets tax_id + * + * @return string|null + */ + public function getTaxId() + { + return $this->container['tax_id']; + } + + /** + * Sets tax_id + * + * @param string|null $tax_id Tax ID of the fiscal entity + * + * @return self + */ + public function setTaxId($tax_id) + { + if (is_null($tax_id)) { + array_push($this->openAPINullablesSetToNull, 'tax_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tax_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['tax_id'] = $tax_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/OrderFiscalEntityResponse.php b/lib/Model/OrderFiscalEntityResponse.php new file mode 100644 index 0000000..d07a0ea --- /dev/null +++ b/lib/Model/OrderFiscalEntityResponse.php @@ -0,0 +1,731 @@ + + */ +class OrderFiscalEntityResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'order_fiscal_entity_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'address' => '\Conekta\Model\OrderFiscalEntityAddressResponse', + 'email' => 'string', + 'metadata' => 'array', + 'name' => 'string', + 'tax_id' => 'string', + 'id' => 'string', + 'created_at' => 'int', + 'object' => 'string', + 'phone' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'address' => null, + 'email' => null, + 'metadata' => null, + 'name' => null, + 'tax_id' => null, + 'id' => null, + 'created_at' => 'int64', + 'object' => null, + 'phone' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'address' => false, + 'email' => true, + 'metadata' => false, + 'name' => true, + 'tax_id' => true, + 'id' => false, + 'created_at' => false, + 'object' => false, + 'phone' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'address' => 'address', + 'email' => 'email', + 'metadata' => 'metadata', + 'name' => 'name', + 'tax_id' => 'tax_id', + 'id' => 'id', + 'created_at' => 'created_at', + 'object' => 'object', + 'phone' => 'phone' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'address' => 'setAddress', + 'email' => 'setEmail', + 'metadata' => 'setMetadata', + 'name' => 'setName', + 'tax_id' => 'setTaxId', + 'id' => 'setId', + 'created_at' => 'setCreatedAt', + 'object' => 'setObject', + 'phone' => 'setPhone' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'address' => 'getAddress', + 'email' => 'getEmail', + 'metadata' => 'getMetadata', + 'name' => 'getName', + 'tax_id' => 'getTaxId', + 'id' => 'getId', + 'created_at' => 'getCreatedAt', + 'object' => 'getObject', + 'phone' => 'getPhone' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('address', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('tax_id', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('object', $data ?? [], null); + $this->setIfExists('phone', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['address'] === null) { + $invalidProperties[] = "'address' can't be null"; + } + if (!is_null($this->container['metadata']) && (count($this->container['metadata']) > 100)) { + $invalidProperties[] = "invalid value for 'metadata', number of items must be less than or equal to 100."; + } + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['object'] === null) { + $invalidProperties[] = "'object' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets address + * + * @return \Conekta\Model\OrderFiscalEntityAddressResponse + */ + public function getAddress() + { + return $this->container['address']; + } + + /** + * Sets address + * + * @param \Conekta\Model\OrderFiscalEntityAddressResponse $address address + * + * @return self + */ + public function setAddress($address) + { + if (is_null($address)) { + throw new \InvalidArgumentException('non-nullable address cannot be null'); + } + $this->container['address'] = $address; + + return $this; + } + + /** + * Gets email + * + * @return string|null + */ + public function getEmail() + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email Email of the fiscal entity + * + * @return self + */ + public function setEmail($email) + { + if (is_null($email)) { + array_push($this->openAPINullablesSetToNull, 'email'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('email', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets metadata + * + * @return array|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param array|null $metadata Metadata associated with the fiscal entity + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + throw new \InvalidArgumentException('non-nullable metadata cannot be null'); + } + + if ((count($metadata) > 100)) { + throw new \InvalidArgumentException('invalid value for $metadata when calling OrderFiscalEntityResponse., number of items must be less than or equal to 100.'); + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name of the fiscal entity + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets tax_id + * + * @return string|null + */ + public function getTaxId() + { + return $this->container['tax_id']; + } + + /** + * Sets tax_id + * + * @param string|null $tax_id Tax ID of the fiscal entity + * + * @return self + */ + public function setTaxId($tax_id) + { + if (is_null($tax_id)) { + array_push($this->openAPINullablesSetToNull, 'tax_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tax_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['tax_id'] = $tax_id; + + return $this; + } + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id ID of the fiscal entity + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets created_at + * + * @return int + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param int $created_at The time at which the object was created in seconds since the Unix epoch + * + * @return self + */ + public function setCreatedAt($created_at) + { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets object + * + * @return string + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string $object object + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + throw new \InvalidArgumentException('non-nullable object cannot be null'); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets phone + * + * @return string|null + */ + public function getPhone() + { + return $this->container['phone']; + } + + /** + * Sets phone + * + * @param string|null $phone Phone of the fiscal entity + * + * @return self + */ + public function setPhone($phone) + { + if (is_null($phone)) { + array_push($this->openAPINullablesSetToNull, 'phone'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('phone', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['phone'] = $phone; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/OrderRequest.php b/lib/Model/OrderRequest.php index 6f7cea4..9994b70 100644 --- a/lib/Model/OrderRequest.php +++ b/lib/Model/OrderRequest.php @@ -64,6 +64,7 @@ class OrderRequest implements ModelInterface, ArrayAccess, \JsonSerializable 'currency' => 'string', 'customer_info' => '\Conekta\Model\OrderRequestCustomerInfo', 'discount_lines' => '\Conekta\Model\OrderDiscountLinesRequest[]', + 'fiscal_entity' => '\Conekta\Model\OrderFiscalEntityRequest', 'line_items' => '\Conekta\Model\Product[]', 'metadata' => 'array', 'needs_shipping_contact' => 'bool', @@ -87,6 +88,7 @@ class OrderRequest implements ModelInterface, ArrayAccess, \JsonSerializable 'currency' => null, 'customer_info' => null, 'discount_lines' => null, + 'fiscal_entity' => null, 'line_items' => null, 'metadata' => null, 'needs_shipping_contact' => null, @@ -108,6 +110,7 @@ class OrderRequest implements ModelInterface, ArrayAccess, \JsonSerializable 'currency' => false, 'customer_info' => false, 'discount_lines' => false, + 'fiscal_entity' => false, 'line_items' => false, 'metadata' => false, 'needs_shipping_contact' => false, @@ -209,6 +212,7 @@ public function isNullableSetToNull(string $property): bool 'currency' => 'currency', 'customer_info' => 'customer_info', 'discount_lines' => 'discount_lines', + 'fiscal_entity' => 'fiscal_entity', 'line_items' => 'line_items', 'metadata' => 'metadata', 'needs_shipping_contact' => 'needs_shipping_contact', @@ -230,6 +234,7 @@ public function isNullableSetToNull(string $property): bool 'currency' => 'setCurrency', 'customer_info' => 'setCustomerInfo', 'discount_lines' => 'setDiscountLines', + 'fiscal_entity' => 'setFiscalEntity', 'line_items' => 'setLineItems', 'metadata' => 'setMetadata', 'needs_shipping_contact' => 'setNeedsShippingContact', @@ -251,6 +256,7 @@ public function isNullableSetToNull(string $property): bool 'currency' => 'getCurrency', 'customer_info' => 'getCustomerInfo', 'discount_lines' => 'getDiscountLines', + 'fiscal_entity' => 'getFiscalEntity', 'line_items' => 'getLineItems', 'metadata' => 'getMetadata', 'needs_shipping_contact' => 'getNeedsShippingContact', @@ -323,6 +329,7 @@ public function __construct(array $data = null) $this->setIfExists('currency', $data ?? [], null); $this->setIfExists('customer_info', $data ?? [], null); $this->setIfExists('discount_lines', $data ?? [], null); + $this->setIfExists('fiscal_entity', $data ?? [], null); $this->setIfExists('line_items', $data ?? [], null); $this->setIfExists('metadata', $data ?? [], null); $this->setIfExists('needs_shipping_contact', $data ?? [], null); @@ -531,6 +538,33 @@ public function setDiscountLines($discount_lines) return $this; } + /** + * Gets fiscal_entity + * + * @return \Conekta\Model\OrderFiscalEntityRequest|null + */ + public function getFiscalEntity() + { + return $this->container['fiscal_entity']; + } + + /** + * Sets fiscal_entity + * + * @param \Conekta\Model\OrderFiscalEntityRequest|null $fiscal_entity fiscal_entity + * + * @return self + */ + public function setFiscalEntity($fiscal_entity) + { + if (is_null($fiscal_entity)) { + throw new \InvalidArgumentException('non-nullable fiscal_entity cannot be null'); + } + $this->container['fiscal_entity'] = $fiscal_entity; + + return $this; + } + /** * Gets line_items * diff --git a/lib/Model/OrderResponse.php b/lib/Model/OrderResponse.php index 2a56b02..57f727f 100644 --- a/lib/Model/OrderResponse.php +++ b/lib/Model/OrderResponse.php @@ -68,7 +68,7 @@ class OrderResponse implements ModelInterface, ArrayAccess, \JsonSerializable 'currency' => 'string', 'customer_info' => '\Conekta\Model\OrderResponseCustomerInfo', 'discount_lines' => '\Conekta\Model\OrderResponseDiscountLines', - 'fiscal_entity' => '\Conekta\Model\OrderResponseFiscalEntity', + 'fiscal_entity' => '\Conekta\Model\OrderFiscalEntityResponse', 'id' => 'string', 'is_refundable' => 'bool', 'line_items' => '\Conekta\Model\OrderResponseProducts', @@ -126,7 +126,7 @@ class OrderResponse implements ModelInterface, ArrayAccess, \JsonSerializable 'currency' => false, 'customer_info' => false, 'discount_lines' => false, - 'fiscal_entity' => false, + 'fiscal_entity' => true, 'id' => false, 'is_refundable' => false, 'line_items' => false, @@ -674,7 +674,7 @@ public function setDiscountLines($discount_lines) /** * Gets fiscal_entity * - * @return \Conekta\Model\OrderResponseFiscalEntity|null + * @return \Conekta\Model\OrderFiscalEntityResponse|null */ public function getFiscalEntity() { @@ -684,14 +684,21 @@ public function getFiscalEntity() /** * Sets fiscal_entity * - * @param \Conekta\Model\OrderResponseFiscalEntity|null $fiscal_entity fiscal_entity + * @param \Conekta\Model\OrderFiscalEntityResponse|null $fiscal_entity fiscal_entity * * @return self */ public function setFiscalEntity($fiscal_entity) { if (is_null($fiscal_entity)) { - throw new \InvalidArgumentException('non-nullable fiscal_entity cannot be null'); + array_push($this->openAPINullablesSetToNull, 'fiscal_entity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('fiscal_entity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } } $this->container['fiscal_entity'] = $fiscal_entity; diff --git a/lib/Model/OrderResponseCustomerInfo.php b/lib/Model/OrderResponseCustomerInfo.php index 13d7d2a..ef7f8b2 100644 --- a/lib/Model/OrderResponseCustomerInfo.php +++ b/lib/Model/OrderResponseCustomerInfo.php @@ -59,6 +59,7 @@ class OrderResponseCustomerInfo implements ModelInterface, ArrayAccess, \JsonSer */ protected static $openAPITypes = [ 'object' => 'string', + 'customer_custom_reference' => 'string', 'name' => 'string', 'email' => 'string', 'phone' => 'string', @@ -75,6 +76,7 @@ class OrderResponseCustomerInfo implements ModelInterface, ArrayAccess, \JsonSer */ protected static $openAPIFormats = [ 'object' => null, + 'customer_custom_reference' => null, 'name' => null, 'email' => 'email', 'phone' => null, @@ -89,6 +91,7 @@ class OrderResponseCustomerInfo implements ModelInterface, ArrayAccess, \JsonSer */ protected static array $openAPINullables = [ 'object' => false, + 'customer_custom_reference' => true, 'name' => false, 'email' => false, 'phone' => false, @@ -183,6 +186,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'object' => 'object', + 'customer_custom_reference' => 'customer_custom_reference', 'name' => 'name', 'email' => 'email', 'phone' => 'phone', @@ -197,6 +201,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'object' => 'setObject', + 'customer_custom_reference' => 'setCustomerCustomReference', 'name' => 'setName', 'email' => 'setEmail', 'phone' => 'setPhone', @@ -211,6 +216,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'object' => 'getObject', + 'customer_custom_reference' => 'getCustomerCustomReference', 'name' => 'getName', 'email' => 'getEmail', 'phone' => 'getPhone', @@ -276,6 +282,7 @@ public function getModelName() public function __construct(array $data = null) { $this->setIfExists('object', $data ?? [], null); + $this->setIfExists('customer_custom_reference', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); $this->setIfExists('email', $data ?? [], null); $this->setIfExists('phone', $data ?? [], null); @@ -352,6 +359,40 @@ public function setObject($object) return $this; } + /** + * Gets customer_custom_reference + * + * @return string|null + */ + public function getCustomerCustomReference() + { + return $this->container['customer_custom_reference']; + } + + /** + * Sets customer_custom_reference + * + * @param string|null $customer_custom_reference Custom reference + * + * @return self + */ + public function setCustomerCustomReference($customer_custom_reference) + { + if (is_null($customer_custom_reference)) { + array_push($this->openAPINullablesSetToNull, 'customer_custom_reference'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customer_custom_reference', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customer_custom_reference'] = $customer_custom_reference; + + return $this; + } + /** * Gets name * diff --git a/lib/Model/OrderResponseShippingContact.php b/lib/Model/OrderResponseShippingContact.php index 793993a..ed5898b 100644 --- a/lib/Model/OrderResponseShippingContact.php +++ b/lib/Model/OrderResponseShippingContact.php @@ -67,6 +67,7 @@ class OrderResponseShippingContact implements ModelInterface, ArrayAccess, \Json 'address' => '\Conekta\Model\CustomerShippingContactsResponseAddress', 'parent_id' => 'string', 'default' => 'bool', + 'metadata' => 'array', 'deleted' => 'bool' ]; @@ -87,6 +88,7 @@ class OrderResponseShippingContact implements ModelInterface, ArrayAccess, \Json 'address' => null, 'parent_id' => null, 'default' => null, + 'metadata' => null, 'deleted' => null ]; @@ -105,6 +107,7 @@ class OrderResponseShippingContact implements ModelInterface, ArrayAccess, \Json 'address' => false, 'parent_id' => false, 'default' => false, + 'metadata' => false, 'deleted' => false ]; @@ -203,6 +206,7 @@ public function isNullableSetToNull(string $property): bool 'address' => 'address', 'parent_id' => 'parent_id', 'default' => 'default', + 'metadata' => 'metadata', 'deleted' => 'deleted' ]; @@ -221,6 +225,7 @@ public function isNullableSetToNull(string $property): bool 'address' => 'setAddress', 'parent_id' => 'setParentId', 'default' => 'setDefault', + 'metadata' => 'setMetadata', 'deleted' => 'setDeleted' ]; @@ -239,6 +244,7 @@ public function isNullableSetToNull(string $property): bool 'address' => 'getAddress', 'parent_id' => 'getParentId', 'default' => 'getDefault', + 'metadata' => 'getMetadata', 'deleted' => 'getDeleted' ]; @@ -308,6 +314,7 @@ public function __construct(array $data = null) $this->setIfExists('address', $data ?? [], null); $this->setIfExists('parent_id', $data ?? [], null); $this->setIfExists('default', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); $this->setIfExists('deleted', $data ?? [], null); } @@ -338,6 +345,10 @@ public function listInvalidProperties() { $invalidProperties = []; + if (!is_null($this->container['metadata']) && (count($this->container['metadata']) > 100)) { + $invalidProperties[] = "invalid value for 'metadata', number of items must be less than or equal to 100."; + } + return $invalidProperties; } @@ -603,6 +614,37 @@ public function setDefault($default) return $this; } + /** + * Gets metadata + * + * @return array|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param array|null $metadata Metadata associated with the shipping contact + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + throw new \InvalidArgumentException('non-nullable metadata cannot be null'); + } + + if ((count($metadata) > 100)) { + throw new \InvalidArgumentException('invalid value for $metadata when calling OrderResponseShippingContact., number of items must be less than or equal to 100.'); + } + $this->container['metadata'] = $metadata; + + return $this; + } + /** * Gets deleted * diff --git a/lib/Model/OrderUpdateFiscalEntityRequest.php b/lib/Model/OrderUpdateFiscalEntityRequest.php new file mode 100644 index 0000000..12823b6 --- /dev/null +++ b/lib/Model/OrderUpdateFiscalEntityRequest.php @@ -0,0 +1,606 @@ + + */ +class OrderUpdateFiscalEntityRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'order_update_fiscal_entity_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'address' => '\Conekta\Model\FiscalEntityAddress', + 'email' => 'string', + 'name' => 'string', + 'metadata' => 'array', + 'phone' => 'string', + 'tax_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'address' => null, + 'email' => null, + 'name' => null, + 'metadata' => null, + 'phone' => null, + 'tax_id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'address' => false, + 'email' => false, + 'name' => true, + 'metadata' => false, + 'phone' => false, + 'tax_id' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'address' => 'address', + 'email' => 'email', + 'name' => 'name', + 'metadata' => 'metadata', + 'phone' => 'phone', + 'tax_id' => 'tax_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'address' => 'setAddress', + 'email' => 'setEmail', + 'name' => 'setName', + 'metadata' => 'setMetadata', + 'phone' => 'setPhone', + 'tax_id' => 'setTaxId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'address' => 'getAddress', + 'email' => 'getEmail', + 'name' => 'getName', + 'metadata' => 'getMetadata', + 'phone' => 'getPhone', + 'tax_id' => 'getTaxId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('address', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('phone', $data ?? [], null); + $this->setIfExists('tax_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['address'] === null) { + $invalidProperties[] = "'address' can't be null"; + } + if (!is_null($this->container['metadata']) && (count($this->container['metadata']) > 100)) { + $invalidProperties[] = "invalid value for 'metadata', number of items must be less than or equal to 100."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets address + * + * @return \Conekta\Model\FiscalEntityAddress + */ + public function getAddress() + { + return $this->container['address']; + } + + /** + * Sets address + * + * @param \Conekta\Model\FiscalEntityAddress $address address + * + * @return self + */ + public function setAddress($address) + { + if (is_null($address)) { + throw new \InvalidArgumentException('non-nullable address cannot be null'); + } + $this->container['address'] = $address; + + return $this; + } + + /** + * Gets email + * + * @return string|null + */ + public function getEmail() + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email Email of the fiscal entity + * + * @return self + */ + public function setEmail($email) + { + if (is_null($email)) { + throw new \InvalidArgumentException('non-nullable email cannot be null'); + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name of the fiscal entity + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets metadata + * + * @return array|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param array|null $metadata Metadata associated with the fiscal entity + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + throw new \InvalidArgumentException('non-nullable metadata cannot be null'); + } + + if ((count($metadata) > 100)) { + throw new \InvalidArgumentException('invalid value for $metadata when calling OrderUpdateFiscalEntityRequest., number of items must be less than or equal to 100.'); + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets phone + * + * @return string|null + */ + public function getPhone() + { + return $this->container['phone']; + } + + /** + * Sets phone + * + * @param string|null $phone Phone of the fiscal entity + * + * @return self + */ + public function setPhone($phone) + { + if (is_null($phone)) { + throw new \InvalidArgumentException('non-nullable phone cannot be null'); + } + $this->container['phone'] = $phone; + + return $this; + } + + /** + * Gets tax_id + * + * @return string|null + */ + public function getTaxId() + { + return $this->container['tax_id']; + } + + /** + * Sets tax_id + * + * @param string|null $tax_id Tax ID of the fiscal entity + * + * @return self + */ + public function setTaxId($tax_id) + { + if (is_null($tax_id)) { + array_push($this->openAPINullablesSetToNull, 'tax_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tax_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['tax_id'] = $tax_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/OrderUpdateRequest.php b/lib/Model/OrderUpdateRequest.php index 7f78711..f9fa6c2 100644 --- a/lib/Model/OrderUpdateRequest.php +++ b/lib/Model/OrderUpdateRequest.php @@ -64,6 +64,7 @@ class OrderUpdateRequest implements ModelInterface, ArrayAccess, \JsonSerializab 'currency' => 'string', 'customer_info' => '\Conekta\Model\OrderUpdateRequestCustomerInfo', 'discount_lines' => '\Conekta\Model\OrderDiscountLinesRequest[]', + 'fiscal_entity' => '\Conekta\Model\OrderUpdateFiscalEntityRequest', 'line_items' => '\Conekta\Model\Product[]', 'metadata' => 'array', 'pre_authorize' => 'bool', @@ -85,6 +86,7 @@ class OrderUpdateRequest implements ModelInterface, ArrayAccess, \JsonSerializab 'currency' => null, 'customer_info' => null, 'discount_lines' => null, + 'fiscal_entity' => null, 'line_items' => null, 'metadata' => null, 'pre_authorize' => null, @@ -104,6 +106,7 @@ class OrderUpdateRequest implements ModelInterface, ArrayAccess, \JsonSerializab 'currency' => false, 'customer_info' => false, 'discount_lines' => false, + 'fiscal_entity' => false, 'line_items' => false, 'metadata' => false, 'pre_authorize' => false, @@ -203,6 +206,7 @@ public function isNullableSetToNull(string $property): bool 'currency' => 'currency', 'customer_info' => 'customer_info', 'discount_lines' => 'discount_lines', + 'fiscal_entity' => 'fiscal_entity', 'line_items' => 'line_items', 'metadata' => 'metadata', 'pre_authorize' => 'pre_authorize', @@ -222,6 +226,7 @@ public function isNullableSetToNull(string $property): bool 'currency' => 'setCurrency', 'customer_info' => 'setCustomerInfo', 'discount_lines' => 'setDiscountLines', + 'fiscal_entity' => 'setFiscalEntity', 'line_items' => 'setLineItems', 'metadata' => 'setMetadata', 'pre_authorize' => 'setPreAuthorize', @@ -241,6 +246,7 @@ public function isNullableSetToNull(string $property): bool 'currency' => 'getCurrency', 'customer_info' => 'getCustomerInfo', 'discount_lines' => 'getDiscountLines', + 'fiscal_entity' => 'getFiscalEntity', 'line_items' => 'getLineItems', 'metadata' => 'getMetadata', 'pre_authorize' => 'getPreAuthorize', @@ -311,6 +317,7 @@ public function __construct(array $data = null) $this->setIfExists('currency', $data ?? [], null); $this->setIfExists('customer_info', $data ?? [], null); $this->setIfExists('discount_lines', $data ?? [], null); + $this->setIfExists('fiscal_entity', $data ?? [], null); $this->setIfExists('line_items', $data ?? [], null); $this->setIfExists('metadata', $data ?? [], null); $this->setIfExists('pre_authorize', $data ?? [], false); @@ -504,6 +511,33 @@ public function setDiscountLines($discount_lines) return $this; } + /** + * Gets fiscal_entity + * + * @return \Conekta\Model\OrderUpdateFiscalEntityRequest|null + */ + public function getFiscalEntity() + { + return $this->container['fiscal_entity']; + } + + /** + * Sets fiscal_entity + * + * @param \Conekta\Model\OrderUpdateFiscalEntityRequest|null $fiscal_entity fiscal_entity + * + * @return self + */ + public function setFiscalEntity($fiscal_entity) + { + if (is_null($fiscal_entity)) { + throw new \InvalidArgumentException('non-nullable fiscal_entity cannot be null'); + } + $this->container['fiscal_entity'] = $fiscal_entity; + + return $this; + } + /** * Gets line_items * diff --git a/lib/Model/WebhookUpdateRequest.php b/lib/Model/WebhookUpdateRequest.php index decf955..4174140 100644 --- a/lib/Model/WebhookUpdateRequest.php +++ b/lib/Model/WebhookUpdateRequest.php @@ -61,7 +61,7 @@ class WebhookUpdateRequest implements ModelInterface, ArrayAccess, \JsonSerializ protected static $openAPITypes = [ 'url' => 'string', 'synchronous' => 'bool', - 'subscribed_events' => 'string[]' + 'events' => 'string[]' ]; /** @@ -74,7 +74,7 @@ class WebhookUpdateRequest implements ModelInterface, ArrayAccess, \JsonSerializ protected static $openAPIFormats = [ 'url' => 'url', 'synchronous' => null, - 'subscribed_events' => null + 'events' => null ]; /** @@ -85,7 +85,7 @@ class WebhookUpdateRequest implements ModelInterface, ArrayAccess, \JsonSerializ protected static array $openAPINullables = [ 'url' => false, 'synchronous' => false, - 'subscribed_events' => false + 'events' => false ]; /** @@ -176,7 +176,7 @@ public function isNullableSetToNull(string $property): bool protected static $attributeMap = [ 'url' => 'url', 'synchronous' => 'synchronous', - 'subscribed_events' => 'subscribed_events' + 'events' => 'events' ]; /** @@ -187,7 +187,7 @@ public function isNullableSetToNull(string $property): bool protected static $setters = [ 'url' => 'setUrl', 'synchronous' => 'setSynchronous', - 'subscribed_events' => 'setSubscribedEvents' + 'events' => 'setEvents' ]; /** @@ -198,7 +198,7 @@ public function isNullableSetToNull(string $property): bool protected static $getters = [ 'url' => 'getUrl', 'synchronous' => 'getSynchronous', - 'subscribed_events' => 'getSubscribedEvents' + 'events' => 'getEvents' ]; /** @@ -260,7 +260,7 @@ public function __construct(array $data = null) { $this->setIfExists('url', $data ?? [], null); $this->setIfExists('synchronous', $data ?? [], false); - $this->setIfExists('subscribed_events', $data ?? [], null); + $this->setIfExists('events', $data ?? [], null); } /** @@ -372,28 +372,28 @@ public function setSynchronous($synchronous) } /** - * Gets subscribed_events + * Gets events * * @return string[]|null */ - public function getSubscribedEvents() + public function getEvents() { - return $this->container['subscribed_events']; + return $this->container['events']; } /** - * Sets subscribed_events + * Sets events * - * @param string[]|null $subscribed_events subscribed_events + * @param string[]|null $events events * * @return self */ - public function setSubscribedEvents($subscribed_events) + public function setEvents($events) { - if (is_null($subscribed_events)) { - throw new \InvalidArgumentException('non-nullable subscribed_events cannot be null'); + if (is_null($events)) { + throw new \InvalidArgumentException('non-nullable events cannot be null'); } - $this->container['subscribed_events'] = $subscribed_events; + $this->container['events'] = $events; return $this; } diff --git a/test/Api/ChargesApiTest.php b/test/Api/ChargesApiTest.php index 1ae1717..934dfce 100644 --- a/test/Api/ChargesApiTest.php +++ b/test/Api/ChargesApiTest.php @@ -29,10 +29,14 @@ namespace Conekta\Test\Api; use Conekta\Api\ChargesApi; +use Conekta\ApiException; use \Conekta\Configuration; use Conekta\Model\ChargeRequest; +use Conekta\Model\ChargeUpdateRequest; use PHPUnit\Framework\TestCase; +use function PHPSTORM_META\type; + /** * ChargesApiTest Class Doc Comment * @@ -81,6 +85,7 @@ public static function tearDownAfterClass(): void * * Get A List of Charges. * + * @throws ApiException */ public function testGetCharges() { @@ -94,8 +99,27 @@ public function testGetCharges() * * Create charge. * + * @throws ApiException */ public function testOrdersCreateCharge() + { + $accept_language = 'es'; + $rq = new ChargeRequest([ + 'payment_method' => [ + 'type' => 'card', + 'token_id' => 'tok_test_visa_4242', + 'monthly_installments' => 3 + ] + ]); + $result = self::$apiInstance->ordersCreateCharge('ord_2uiGPHDV6Zzribeqy', $rq, $accept_language); + $this->assertEquals($result->getOrderId(), "ord_2uiGPHDV6Zzribeqy"); + $this->assertEquals($result->getMonthlyInstallments(), $rq["payment_method"]["monthly_installments"]); + } + + /** + * @throws ApiException + */ + public function testOrdersCreateChargeWithMonthlyInstallments() { $accept_language = 'es'; $rq = new ChargeRequest([ @@ -104,4 +128,18 @@ public function testOrdersCreateCharge() $result = self::$apiInstance->ordersCreateCharge('ord_2tUigJ8DgBhbp6w5D', $rq, $accept_language); $this->assertNotEmpty($result, 'expected not empty result'); } + + /** + * @throws ApiException + */ + public function testOrdersUpdateCharge(){ + $accept_language = 'es'; + $request = new ChargeUpdateRequest([ + 'reference_id' => "762346234" + ]); + $result = self::$apiInstance->updateCharge('6524722f28c7ba0016a5b17d', $request, $accept_language); + + $this->assertEquals("6524722f28c7ba0016a5b17d", $result->getId()); + $this->assertEquals($request->getReferenceId(), $result->getReferenceId()); + } } diff --git a/test/Api/OrdersApiTest.php b/test/Api/OrdersApiTest.php index cf93d47..f33c9c9 100644 --- a/test/Api/OrdersApiTest.php +++ b/test/Api/OrdersApiTest.php @@ -30,12 +30,9 @@ use Conekta\Api\OrdersApi; use \Conekta\Configuration; -use \Conekta\ApiException; use Conekta\Model\OrderRefundRequest; use Conekta\Model\OrderRequest; -use Conekta\Model\OrderResponse; use Conekta\Model\OrderUpdateRequest; -use \Conekta\ObjectSerializer; use PHPUnit\Framework\TestCase; /** @@ -104,10 +101,56 @@ public function testCreateOrder() { $accept_language = 'es'; $rq = new OrderRequest([ - 'currency' => 'MXN' + 'currency' => 'MXN', + 'customer_info' => [ + 'customer_id' => 'cus_2tKcHxhTz7xU5SymF' + ], + 'fiscal_entity' => [ + 'tax_id' => '324234234', + 'name' => 'Juan Perez', + 'email' => 'm@gmail.com', + 'phone' => '3143159054', + 'address' => [ + 'street1' => 'avenida siempre viva', + "street2" =>"fake street", + 'city' => 'Ciudad de Mexico', + 'state' => 'Ciudad de Mexico', + 'country' => 'MX', + 'postal_code' => '06100' + ], + 'metadata' => [ + 'region_id' => '935', + 'company' => 'conekta' + ] + ], + 'shipping_contact' => [ + 'phone' => '3143159054', + 'receiver' => 'Marvin Fuller', + 'between_streets' => 'Ackerman Crescent', + 'address' => [ + 'street1' => 'avenida siempre viva', + "street2" =>"fake street", + 'city' => 'Ciudad de Mexico', + 'state' => 'Ciudad de Mexico', + 'country' => 'MX', + 'postal_code' => '06100' + ], + 'metadata' => [ + 'region_id' => '935', + 'company' => 'conekta' + ] + ] ]); $result = self::$apiInstance->createOrder($rq, $accept_language); - $this->assertNotEmpty($result, 'expected not empty result'); + + $this->assertTrue($result->getLivemode()); + $this->assertEquals($rq->getCurrency(), $result->getCurrency(), 'expected currency to be the same'); + $this->assertEquals(2000, $result->getAmount(), 'expected amount to be the same'); + $this->assertEquals('MXN', $result->getCurrency(), 'expected currency to be the same'); + $this->assertEquals($rq->getFiscalEntity()["metadata"], $result->getFiscalEntity()["metadata"], 'expected metadata to be the same'); + $this->assertEquals($rq->getShippingContact()["metadata"], $result->getShippingContact()["metadata"], 'expected metadata to be the same'); + $this->assertEquals($rq->getFiscalEntity()["email"], $result->getFiscalEntity()["email"], 'expected metadata to be the same'); + $this->assertEquals($rq->getFiscalEntity()["phone"], $result->getFiscalEntity()["phone"], 'expected metadata to be the same'); } /**