diff --git a/composer.json b/composer.json index 2963924e..949a3f46 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "square/square", "description": "Use Square APIs to manage and run business including payment, customer, product, inventory, and employee management.", - "version": "19.1.0.20220616", + "version": "19.1.1.20220616", "type": "library", "keywords": [ "Square", @@ -22,8 +22,8 @@ "ext-curl": "*", "ext-json": "*", "ext-mbstring": "*", - "apimatic/unirest-php": "^2.2.2", - "apimatic/jsonmapper": "^3.0.3" + "apimatic/unirest-php": "^2.3.0", + "apimatic/jsonmapper": "^3.0.4" }, "require-dev": { "squizlabs/php_codesniffer": "^3.5", diff --git a/doc/apis/catalog.md b/doc/apis/catalog.md index d2eb8c71..2eb2e01e 100644 --- a/doc/apis/catalog.md +++ b/doc/apis/catalog.md @@ -268,7 +268,7 @@ function createCatalogImage( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `request` | [`?CreateCatalogImageRequest`](../../doc/models/create-catalog-image-request.md) | Form, Optional | - | +| `request` | [`?CreateCatalogImageRequest`](../../doc/models/create-catalog-image-request.md) | Form (JSON-Encoded), Optional | - | | `imageFile` | `?FileWrapper` | Form, Optional | - | ## Response Type @@ -325,7 +325,7 @@ function updateCatalogImage( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `imageId` | `string` | Template, Required | The ID of the `CatalogImage` object to update the encapsulated image file. | -| `request` | [`?UpdateCatalogImageRequest`](../../doc/models/update-catalog-image-request.md) | Form, Optional | - | +| `request` | [`?UpdateCatalogImageRequest`](../../doc/models/update-catalog-image-request.md) | Form (JSON-Encoded), Optional | - | | `imageFile` | `?FileWrapper` | Form, Optional | - | ## Response Type diff --git a/doc/apis/disputes.md b/doc/apis/disputes.md index 43fbf327..e3ae42cb 100644 --- a/doc/apis/disputes.md +++ b/doc/apis/disputes.md @@ -192,7 +192,7 @@ function createDisputeEvidenceFile( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `disputeId` | `string` | Template, Required | The ID of the dispute you want to upload evidence for. | -| `request` | [`?CreateDisputeEvidenceFileRequest`](../../doc/models/create-dispute-evidence-file-request.md) | Form, Optional | Defines the parameters for a `CreateDisputeEvidenceFile` request. | +| `request` | [`?CreateDisputeEvidenceFileRequest`](../../doc/models/create-dispute-evidence-file-request.md) | Form (JSON-Encoded), Optional | Defines the parameters for a `CreateDisputeEvidenceFile` request. | | `imageFile` | `?FileWrapper` | Form, Optional | - | ## Response Type diff --git a/doc/apis/subscriptions.md b/doc/apis/subscriptions.md index 9ba15d4c..a832684e 100644 --- a/doc/apis/subscriptions.md +++ b/doc/apis/subscriptions.md @@ -202,12 +202,6 @@ function updateSubscription(string $subscriptionId, UpdateSubscriptionRequest $b ```php $subscriptionId = 'subscription_id0'; $body = new Models\UpdateSubscriptionRequest; -$body->setSubscription(new Models\Subscription); -$body->getSubscription()->setTaxPercentage('null'); -$body->getSubscription()->setPriceOverrideMoney(new Models\Money); -$body->getSubscription()->getPriceOverrideMoney()->setAmount(2000); -$body->getSubscription()->getPriceOverrideMoney()->setCurrency(Models\Currency::USD); -$body->getSubscription()->setVersion(1594155459464); $apiResponse = $subscriptionsApi->updateSubscription($subscriptionId, $body); diff --git a/doc/models/list-bookings-response.md b/doc/models/list-bookings-response.md index 5a7eb324..6a67a17d 100644 --- a/doc/models/list-bookings-response.md +++ b/doc/models/list-bookings-response.md @@ -17,30 +17,9 @@ ```json { - "bookings": [ - { - "appointment_segments": [ - { - "duration_minutes": 60, - "service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC", - "service_variation_version": 1599775456731, - "team_member_id": "TMXUrsBWWcHTt79t" - } - ], - "created_at": "2020-10-28T15:47:41Z", - "customer_id": "EX2QSVGTZN4K1E5QE1CBFNVQ8M", - "customer_note": "", - "id": "zkras0xv0xwswx", - "location_id": "LEQHH0YY8B42M", - "seller_note": "", - "start_at": "2020-11-26T13:00:00Z", - "status": "ACCEPTED", - "updated_at": "2020-10-28T15:49:25Z", - "version": 1 - } - ], - "cursor": "null", - "errors": [] + "bookings": null, + "cursor": null, + "errors": null } ``` diff --git a/doc/models/update-subscription-request.md b/doc/models/update-subscription-request.md index b976be13..4ba6eff8 100644 --- a/doc/models/update-subscription-request.md +++ b/doc/models/update-subscription-request.md @@ -18,14 +18,7 @@ Defines input parameters in a request to the ```json { - "subscription": { - "price_override_money": { - "amount": 2000, - "currency": "USD" - }, - "tax_percentage": "null", - "version": 1594155459464 - } + "subscription": null } ``` diff --git a/src/ApiHelper.php b/src/ApiHelper.php index 9f7a6cde..8a3536b4 100644 --- a/src/ApiHelper.php +++ b/src/ApiHelper.php @@ -124,30 +124,6 @@ public static function mapClass( } } - /** - * Try mapping the class onto the value, - * If mapping failed due to the invalid oneOf or anyOf types, - * throw ApiException - * - * @param array $json value to be verified against the types - * @param string $classname name of the class to map - * @param string $namespace namespace name for the model classes, Default: global namespace - * - * @throws InvalidArgumentException - */ - public static function verifyClass( - array $json, - string $classname, - string $namespace = 'Square\Models' - ) { - try { - $value = empty($json) ? new stdClass() : json_decode(json_encode($json)); - self::getJsonMapper()->mapClass($value, "$namespace\\$classname"); - } catch (Exception $e) { - throw new InvalidArgumentException($e->getMessage()); - } - } - /** * Map the types onto the value, * If mapping failed due to the invalid oneOf or anyOf types, @@ -179,17 +155,14 @@ public static function mapTypes( } /** - * Try mapping the types onto the value, - * If mapping failed due to the invalid oneOf or anyOf types, - * throw InvalidArgumentException + * Checks if type of the given value is present in the type group, also updates the value when + * $serializationMethods for the value's type are given. * - * @param mixed $value value to be verified against the types - * @param string $types types to be mapped in format OneOf(...) or AnyOf(...) - * @param string[] $serializationMethods Specify methods required for serialization instead of json_encode, - * should be a string path to the accessible method along with the type, - * separated by a space. - * @param string[] $facMethods Specify if any methods are required to map this value into any type - * @param string $namespace namespace name for the model classes, Default: global namespace + * @param mixed $value value to be verified against the types + * @param string $types types to be mapped in format OneOf(...) or AnyOf(...) + * @param string[] $serializationMethods Specify methods required for serialization of specific types in + * in the type group, should be an array in the format: + * ['path/to/method argumentType', ...]. Default: [] * * @return mixed * @throws InvalidArgumentException @@ -197,17 +170,28 @@ public static function mapTypes( public static function verifyTypes( $value, string $types, - array $serializationMethods = [], - array $facMethods = [], - string $namespace = 'Square\Models' + array $serializationMethods = [] ) { try { - $value = self::applySerializationMethods($value, $serializationMethods); - self::getJsonMapper()->mapFor(json_decode(json_encode($value)), $types, $namespace, $facMethods); + return self::getJsonMapper()->checkTypeGroupFor($types, $value, $serializationMethods); } catch (Exception $e) { throw new InvalidArgumentException($e->getMessage()); } - return $value; + } + + /** + * Serialize any given mixed value. + * + * @param mixed $value Any value to be serialized + * + * @return string|null serialized value + */ + public static function serialize($value): ?string + { + if (is_string($value) || is_null($value)) { + return $value; + } + return json_encode($value); } /** @@ -235,93 +219,6 @@ public static function checkValueInEnum($value, string $enumName, array $enumVal } } - /** - * Extract type from any given value. - * - * @param mixed $value should be an array to be checked for inner type - * @param string $start string to be appended at the start of the extracted type, Default: '' - * @param string $end string to be appended at the end of the extracted type, Default: '' - * - * @return string Returns the type that could be mapped on the given value. - */ - private static function getType($value, string $start = '', string $end = ''): string - { - if (is_array($value)) { - if (self::isAssociative($value)) { - // if value is associative array - $start .= 'arraygetMessage()); - } - return $value; - } - - /** - * Serialize any given mixed value. - * - * @param mixed $value Any value to be serialized - * - * @return string|null serialized value - */ - public static function serialize($value): ?string - { - if (is_string($value) || is_null($value)) { - return $value; - } - return json_encode($value); - } - /** * Deserialize a Json string * diff --git a/src/Apis/BaseApi.php b/src/Apis/BaseApi.php index dcb64a1e..cfe1e4ea 100644 --- a/src/Apis/BaseApi.php +++ b/src/Apis/BaseApi.php @@ -43,7 +43,7 @@ class BaseApi */ protected $internalUserAgent; - private static $userAgent = 'Square-PHP-SDK/19.1.0.20220616 ({api-version}) {engine}/{engine-version} ({os-info}) {detail}'; + private static $userAgent = 'Square-PHP-SDK/19.1.1.20220616 ({api-version}) {engine}/{engine-version} ({os-info}) {detail}'; /** * Constructor that sets the timeout of requests diff --git a/src/Apis/CardsApi.php b/src/Apis/CardsApi.php index eb62e78e..cdd9eb02 100644 --- a/src/Apis/CardsApi.php +++ b/src/Apis/CardsApi.php @@ -63,7 +63,7 @@ public function listCards( 'include_disabled' => (null != $includeDisabled) ? var_export($includeDisabled, true) : false, 'reference_id' => $referenceId, - 'sort_order' => Models\SortOrder::checkValue($sortOrder), + 'sort_order' => $sortOrder, ]); //prepare headers diff --git a/src/Apis/CashDrawersApi.php b/src/Apis/CashDrawersApi.php index 1932e649..bbe68cb3 100644 --- a/src/Apis/CashDrawersApi.php +++ b/src/Apis/CashDrawersApi.php @@ -7,7 +7,6 @@ use Square\Exceptions\ApiException; use Square\ConfigurationInterface; use Square\ApiHelper; -use Square\Models; use Square\Http\ApiResponse; use Square\Http\HttpRequest; use Square\Http\HttpResponse; @@ -57,7 +56,7 @@ public function listCashDrawerShifts( //process query parameters ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ 'location_id' => $locationId, - 'sort_order' => Models\SortOrder::checkValue($sortOrder), + 'sort_order' => $sortOrder, 'begin_time' => $beginTime, 'end_time' => $endTime, 'limit' => $limit, diff --git a/src/Apis/CustomersApi.php b/src/Apis/CustomersApi.php index 3d321197..111c842c 100644 --- a/src/Apis/CustomersApi.php +++ b/src/Apis/CustomersApi.php @@ -67,8 +67,8 @@ public function listCustomers( ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ 'cursor' => $cursor, 'limit' => $limit, - 'sort_field' => Models\CustomerSortField::checkValue($sortField), - 'sort_order' => Models\SortOrder::checkValue($sortOrder), + 'sort_field' => $sortField, + 'sort_order' => $sortOrder, ]); //prepare headers @@ -272,8 +272,8 @@ public function searchCustomers(Models\SearchCustomersRequest $body): ApiRespons } /** - * Deletes a customer profile from a business. This operation also unlinks any associated cards on - * file. + * Deletes a customer profile from a business. This operation also unlinks any associated cards on file. + * * * As a best practice, you should include the `version` field in the request to enable [optimistic * concurrency](https://developer.squareup.com/docs/working-with-apis/optimistic-concurrency) control. diff --git a/src/Apis/DevicesApi.php b/src/Apis/DevicesApi.php index 76e2d88a..af59a4a1 100644 --- a/src/Apis/DevicesApi.php +++ b/src/Apis/DevicesApi.php @@ -57,8 +57,8 @@ public function listDeviceCodes( ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ 'cursor' => $cursor, 'location_id' => $locationId, - 'product_type' => Models\ProductType::checkValue($productType), - 'status' => Models\DeviceCodeStatus::checkValue($status), + 'product_type' => $productType, + 'status' => $status, ]); //prepare headers diff --git a/src/Apis/DisputesApi.php b/src/Apis/DisputesApi.php index 6e2bc35d..3ce58d49 100644 --- a/src/Apis/DisputesApi.php +++ b/src/Apis/DisputesApi.php @@ -55,7 +55,7 @@ public function listDisputes( //process query parameters ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ 'cursor' => $cursor, - 'states' => Models\DisputeState::checkValue($states), + 'states' => $states, 'location_id' => $locationId, ]); diff --git a/src/Apis/EmployeesApi.php b/src/Apis/EmployeesApi.php index cecc9f84..ec930193 100644 --- a/src/Apis/EmployeesApi.php +++ b/src/Apis/EmployeesApi.php @@ -7,7 +7,6 @@ use Square\Exceptions\ApiException; use Square\ConfigurationInterface; use Square\ApiHelper; -use Square\Models; use Square\Http\ApiResponse; use Square\Http\HttpRequest; use Square\Http\HttpResponse; @@ -51,7 +50,7 @@ public function listEmployees( //process query parameters ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ 'location_id' => $locationId, - 'status' => Models\EmployeeStatus::checkValue($status), + 'status' => $status, 'limit' => $limit, 'cursor' => $cursor, ]); diff --git a/src/Apis/LocationsApi.php b/src/Apis/LocationsApi.php index d73d52f5..0dcff050 100644 --- a/src/Apis/LocationsApi.php +++ b/src/Apis/LocationsApi.php @@ -24,8 +24,8 @@ public function __construct(ConfigurationInterface $config, array $authManagers, } /** - * Provides details about all of the seller's [locations](https://developer.squareup. - * com/docs/locations-api), + * Provides details about all of the seller's [locations](https://developer.squareup.com/docs/locations- + * api), * including those with an inactive status. * * @return ApiResponse Response from the API call diff --git a/src/Apis/OrdersApi.php b/src/Apis/OrdersApi.php index bb895855..85943736 100644 --- a/src/Apis/OrdersApi.php +++ b/src/Apis/OrdersApi.php @@ -236,8 +236,8 @@ public function calculateOrder(Models\CalculateOrderRequest $body): ApiResponse } /** - * Creates a new order, in the `DRAFT` state, by duplicating an existing order. The newly created - * order has + * Creates a new order, in the `DRAFT` state, by duplicating an existing order. The newly created order + * has * only the core fields (such as line items, taxes, and discounts) copied from the original order. * * @param Models\CloneOrderRequest $body An object containing the fields to POST for the diff --git a/src/Apis/PayoutsApi.php b/src/Apis/PayoutsApi.php index ac6c93f1..1488fd4a 100644 --- a/src/Apis/PayoutsApi.php +++ b/src/Apis/PayoutsApi.php @@ -7,7 +7,6 @@ use Square\Exceptions\ApiException; use Square\ConfigurationInterface; use Square\ApiHelper; -use Square\Models; use Square\Http\ApiResponse; use Square\Http\HttpRequest; use Square\Http\HttpResponse; @@ -72,10 +71,10 @@ public function listPayouts( //process query parameters ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ 'location_id' => $locationId, - 'status' => Models\PayoutStatus::checkValue($status), + 'status' => $status, 'begin_time' => $beginTime, 'end_time' => $endTime, - 'sort_order' => Models\SortOrder::checkValue($sortOrder), + 'sort_order' => $sortOrder, 'cursor' => $cursor, 'limit' => $limit, ]); @@ -233,7 +232,7 @@ public function listPayoutEntries( //process query parameters ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ - 'sort_order' => Models\SortOrder::checkValue($sortOrder), + 'sort_order' => $sortOrder, 'cursor' => $cursor, 'limit' => $limit, ]); diff --git a/src/Apis/TerminalApi.php b/src/Apis/TerminalApi.php index bbe2bcf8..50e1caf0 100644 --- a/src/Apis/TerminalApi.php +++ b/src/Apis/TerminalApi.php @@ -433,8 +433,8 @@ public function searchTerminalCheckouts(Models\SearchTerminalCheckoutsRequest $b } /** - * Retrieves a Terminal checkout request by `checkout_id`. Terminal checkout requests are available - * for 30 days. + * Retrieves a Terminal checkout request by `checkout_id`. Terminal checkout requests are available for + * 30 days. * * @param string $checkoutId The unique ID for the desired `TerminalCheckout`. * @@ -706,8 +706,7 @@ public function searchTerminalRefunds(Models\SearchTerminalRefundsRequest $body) } /** - * Retrieves an Interac Terminal refund object by ID. Terminal refund objects are available for 30 - * days. + * Retrieves an Interac Terminal refund object by ID. Terminal refund objects are available for 30 days. * * @param string $terminalRefundId The unique ID for the desired `TerminalRefund`. * @@ -773,8 +772,8 @@ public function getTerminalRefund(string $terminalRefundId): ApiResponse } /** - * Cancels an Interac Terminal refund request by refund request ID if the status of the request - * permits it. + * Cancels an Interac Terminal refund request by refund request ID if the status of the request permits + * it. * * @param string $terminalRefundId The unique ID for the desired `TerminalRefund`. * diff --git a/src/Apis/TransactionsApi.php b/src/Apis/TransactionsApi.php index 9d95df37..d99ff874 100644 --- a/src/Apis/TransactionsApi.php +++ b/src/Apis/TransactionsApi.php @@ -7,7 +7,6 @@ use Square\Exceptions\ApiException; use Square\ConfigurationInterface; use Square\ApiHelper; -use Square\Models; use Square\Http\ApiResponse; use Square\Http\HttpRequest; use Square\Http\HttpResponse; @@ -82,7 +81,7 @@ public function listTransactions( ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ 'begin_time' => $beginTime, 'end_time' => $endTime, - 'sort_order' => Models\SortOrder::checkValue($sortOrder), + 'sort_order' => $sortOrder, 'cursor' => $cursor, ]); diff --git a/src/Apis/V1TransactionsApi.php b/src/Apis/V1TransactionsApi.php index 3870b7b1..ba53927f 100644 --- a/src/Apis/V1TransactionsApi.php +++ b/src/Apis/V1TransactionsApi.php @@ -58,7 +58,7 @@ public function listOrders( //process query parameters ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ - 'order' => Models\SortOrder::checkValue($order), + 'order' => $order, 'limit' => $limit, 'batch_token' => $batchToken, ]); @@ -308,7 +308,7 @@ public function listPayments( //process query parameters ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ - 'order' => Models\SortOrder::checkValue($order), + 'order' => $order, 'begin_time' => $beginTime, 'end_time' => $endTime, 'limit' => $limit, @@ -474,7 +474,7 @@ public function listRefunds( //process query parameters ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ - 'order' => Models\SortOrder::checkValue($order), + 'order' => $order, 'begin_time' => $beginTime, 'end_time' => $endTime, 'limit' => $limit, @@ -659,11 +659,11 @@ public function listSettlements( //process query parameters ApiHelper::appendUrlWithQueryParameters($_queryUrl, [ - 'order' => Models\SortOrder::checkValue($order), + 'order' => $order, 'begin_time' => $beginTime, 'end_time' => $endTime, 'limit' => $limit, - 'status' => Models\V1ListSettlementsRequestStatus::checkValue($status), + 'status' => $status, 'batch_token' => $batchToken, ]); diff --git a/src/Apis/VendorsApi.php b/src/Apis/VendorsApi.php index 61a1dd9e..011f763f 100644 --- a/src/Apis/VendorsApi.php +++ b/src/Apis/VendorsApi.php @@ -296,8 +296,8 @@ public function createVendor(Models\CreateVendorRequest $body): ApiResponse } /** - * Searches for vendors using a filter against supported [Vendor]($m/Vendor) properties and a - * supported sorter. + * Searches for vendors using a filter against supported [Vendor]($m/Vendor) properties and a supported + * sorter. * * @param Models\SearchVendorsRequest $body An object containing the fields to POST for the * request. diff --git a/src/Environment.php b/src/Environment.php index e3e7f1e7..5805897a 100644 --- a/src/Environment.php +++ b/src/Environment.php @@ -4,10 +4,6 @@ namespace Square; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Environments available for API */ @@ -18,22 +14,4 @@ class Environment public const SANDBOX = 'sandbox'; public const CUSTOM = 'custom'; - - private const _ALL_VALUES = [self::PRODUCTION, self::SANDBOX, self::CUSTOM]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/ActionCancelReason.php b/src/Models/ActionCancelReason.php index 6e8acfd4..55fdabe5 100644 --- a/src/Models/ActionCancelReason.php +++ b/src/Models/ActionCancelReason.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - class ActionCancelReason { /** @@ -24,22 +20,4 @@ class ActionCancelReason * The `TerminalCheckout` timed out (see `deadline_duration` on the `TerminalCheckout`). */ public const TIMED_OUT = 'TIMED_OUT'; - - private const _ALL_VALUES = [self::BUYER_CANCELED, self::SELLER_CANCELED, self::TIMED_OUT]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/ActivityType.php b/src/Models/ActivityType.php index 58a2ac81..38aca679 100644 --- a/src/Models/ActivityType.php +++ b/src/Models/ActivityType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - class ActivityType { /** @@ -189,57 +185,4 @@ class ActivityType * Refunded fees from a third-party platform. */ public const THIRD_PARTY_FEE_REFUND = 'THIRD_PARTY_FEE_REFUND'; - - private const _ALL_VALUES = [ - self::ADJUSTMENT, - self::APP_FEE_REFUND, - self::APP_FEE_REVENUE, - self::AUTOMATIC_SAVINGS, - self::AUTOMATIC_SAVINGS_REVERSED, - self::CHARGE, - self::DEPOSIT_FEE, - self::DISPUTE, - self::ESCHEATMENT, - self::FEE, - self::FREE_PROCESSING, - self::HOLD_ADJUSTMENT, - self::INITIAL_BALANCE_CHANGE, - self::MONEY_TRANSFER, - self::MONEY_TRANSFER_REVERSAL, - self::OPEN_DISPUTE, - self::OTHER, - self::OTHER_ADJUSTMENT, - self::PAID_SERVICE_FEE, - self::PAID_SERVICE_FEE_REFUND, - self::REDEMPTION_CODE, - self::REFUND, - self::RELEASE_ADJUSTMENT, - self::RESERVE_HOLD, - self::RESERVE_RELEASE, - self::RETURNED_PAYOUT, - self::SQUARE_CAPITAL_PAYMENT, - self::SQUARE_CAPITAL_REVERSED_PAYMENT, - self::SUBSCRIPTION_FEE, - self::SUBSCRIPTION_FEE_PAID_REFUND, - self::SUBSCRIPTION_FEE_REFUND, - self::TAX_ON_FEE, - self::THIRD_PARTY_FEE, - self::THIRD_PARTY_FEE_REFUND, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/Address.php b/src/Models/Address.php index 6469f799..ef289990 100644 --- a/src/Models/Address.php +++ b/src/Models/Address.php @@ -227,7 +227,6 @@ public function getCountry(): ?string * Values are in [ISO 3166-1-alpha-2 format](http://www.iso.org/iso/home/standards/country_codes.htm). * * @maps country - * @factory \Square\Models\Country::checkValue */ public function setCountry(?string $country): void { @@ -268,7 +267,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['postal_code'] = $this->postalCode; } if (isset($this->country)) { - $json['country'] = Country::checkValue($this->country); + $json['country'] = $this->country; } $json = array_filter($json, function ($val) { return $val !== null; diff --git a/src/Models/ApplicationDetails.php b/src/Models/ApplicationDetails.php index a25e3950..2d87446e 100644 --- a/src/Models/ApplicationDetails.php +++ b/src/Models/ApplicationDetails.php @@ -35,7 +35,6 @@ public function getSquareProduct(): ?string * A list of products to return to external callers. * * @maps square_product - * @factory \Square\Models\ApplicationDetailsExternalSquareProduct::checkValue */ public function setSquareProduct(?string $squareProduct): void { @@ -87,7 +86,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; if (isset($this->squareProduct)) { - $json['square_product'] = ApplicationDetailsExternalSquareProduct::checkValue($this->squareProduct); + $json['square_product'] = $this->squareProduct; } if (isset($this->applicationId)) { $json['application_id'] = $this->applicationId; diff --git a/src/Models/ApplicationDetailsExternalSquareProduct.php b/src/Models/ApplicationDetailsExternalSquareProduct.php index 3e2cc161..3b097e39 100644 --- a/src/Models/ApplicationDetailsExternalSquareProduct.php +++ b/src/Models/ApplicationDetailsExternalSquareProduct.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * A list of products to return to external callers. */ @@ -32,33 +28,4 @@ class ApplicationDetailsExternalSquareProduct public const TERMINAL_API = 'TERMINAL_API'; public const VIRTUAL_TERMINAL = 'VIRTUAL_TERMINAL'; - - private const _ALL_VALUES = [ - self::APPOINTMENTS, - self::ECOMMERCE_API, - self::INVOICES, - self::ONLINE_STORE, - self::OTHER, - self::RESTAURANTS, - self::RETAIL, - self::SQUARE_POS, - self::TERMINAL_API, - self::VIRTUAL_TERMINAL, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/BankAccount.php b/src/Models/BankAccount.php index ff62aff7..94dc979f 100644 --- a/src/Models/BankAccount.php +++ b/src/Models/BankAccount.php @@ -193,7 +193,6 @@ public function getCountry(): string * * @required * @maps country - * @factory \Square\Models\Country::checkValue */ public function setCountry(string $country): void { @@ -217,7 +216,6 @@ public function getCurrency(): string * * @required * @maps currency - * @factory \Square\Models\Currency::checkValue */ public function setCurrency(string $currency): void { @@ -239,7 +237,6 @@ public function getAccountType(): string * * @required * @maps account_type - * @factory \Square\Models\BankAccountType::checkValue */ public function setAccountType(string $accountType): void { @@ -393,7 +390,6 @@ public function getStatus(): string * * @required * @maps status - * @factory \Square\Models\BankAccountStatus::checkValue */ public function setStatus(string $status): void { @@ -524,9 +520,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json = []; $json['id'] = $this->id; $json['account_number_suffix'] = $this->accountNumberSuffix; - $json['country'] = Country::checkValue($this->country); - $json['currency'] = Currency::checkValue($this->currency); - $json['account_type'] = BankAccountType::checkValue($this->accountType); + $json['country'] = $this->country; + $json['currency'] = $this->currency; + $json['account_type'] = $this->accountType; $json['holder_name'] = $this->holderName; $json['primary_bank_identification_number'] = $this->primaryBankIdentificationNumber; if (isset($this->secondaryBankIdentificationNumber)) { @@ -541,7 +537,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (isset($this->locationId)) { $json['location_id'] = $this->locationId; } - $json['status'] = BankAccountStatus::checkValue($this->status); + $json['status'] = $this->status; $json['creditable'] = $this->creditable; $json['debitable'] = $this->debitable; if (isset($this->fingerprint)) { diff --git a/src/Models/BankAccountStatus.php b/src/Models/BankAccountStatus.php index c7892d63..25144eaa 100644 --- a/src/Models/BankAccountStatus.php +++ b/src/Models/BankAccountStatus.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates the current verification status of a `BankAccount` object. */ @@ -31,22 +27,4 @@ class BankAccountStatus * attempt or a failed deposit attempt. */ public const DISABLED = 'DISABLED'; - - private const _ALL_VALUES = [self::VERIFICATION_IN_PROGRESS, self::VERIFIED, self::DISABLED]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/BankAccountType.php b/src/Models/BankAccountType.php index e53697e3..f888e93a 100644 --- a/src/Models/BankAccountType.php +++ b/src/Models/BankAccountType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates the financial purpose of the bank account. */ @@ -42,22 +38,4 @@ class BankAccountType * drawn specifically for business purposes (non-personal use). */ public const BUSINESS_CHECKING = 'BUSINESS_CHECKING'; - - private const _ALL_VALUES = [self::CHECKING, self::SAVINGS, self::INVESTMENT, self::OTHER, self::BUSINESS_CHECKING]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/BatchRetrieveInventoryChangesRequest.php b/src/Models/BatchRetrieveInventoryChangesRequest.php index 16a27002..d81d162d 100644 --- a/src/Models/BatchRetrieveInventoryChangesRequest.php +++ b/src/Models/BatchRetrieveInventoryChangesRequest.php @@ -118,7 +118,6 @@ public function getTypes(): ?array * The default value is `[PHYSICAL_COUNT, ADJUSTMENT]`. * * @maps types - * @factory \Square\Models\InventoryChangeType::checkValue * * @param string[]|null $types */ @@ -147,7 +146,6 @@ public function getStates(): ?array * The default value is null. * * @maps states - * @factory \Square\Models\InventoryState::checkValue * * @param string[]|null $states */ @@ -269,10 +267,10 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['location_ids'] = $this->locationIds; } if (isset($this->types)) { - $json['types'] = InventoryChangeType::checkValue($this->types); + $json['types'] = $this->types; } if (isset($this->states)) { - $json['states'] = InventoryState::checkValue($this->states); + $json['states'] = $this->states; } if (isset($this->updatedAfter)) { $json['updated_after'] = $this->updatedAfter; diff --git a/src/Models/BatchRetrieveInventoryCountsRequest.php b/src/Models/BatchRetrieveInventoryCountsRequest.php index dbe9c337..b9eafe8b 100644 --- a/src/Models/BatchRetrieveInventoryCountsRequest.php +++ b/src/Models/BatchRetrieveInventoryCountsRequest.php @@ -162,7 +162,6 @@ public function getStates(): ?array * The default is null. * * @maps states - * @factory \Square\Models\InventoryState::checkValue * * @param string[]|null $states */ @@ -214,7 +213,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['cursor'] = $this->cursor; } if (isset($this->states)) { - $json['states'] = InventoryState::checkValue($this->states); + $json['states'] = $this->states; } if (isset($this->limit)) { $json['limit'] = $this->limit; diff --git a/src/Models/Booking.php b/src/Models/Booking.php index eee4a456..6fe9374d 100644 --- a/src/Models/Booking.php +++ b/src/Models/Booking.php @@ -147,7 +147,6 @@ public function getStatus(): ?string * Supported booking statuses. * * @maps status - * @factory \Square\Models\BookingStatus::checkValue */ public function setStatus(?string $status): void { @@ -386,7 +385,6 @@ public function getLocationType(): ?string * Supported types of location where service is provided. * * @maps location_type - * @factory \Square\Models\BusinessAppointmentSettingsBookingLocationType::checkValue */ public function setLocationType(?string $locationType): void { @@ -427,7 +425,6 @@ public function getSource(): ?string * Supported sources a booking was created from. * * @maps source - * @factory \Square\Models\BookingBookingSource::checkValue */ public function setSource(?string $source): void { @@ -453,7 +450,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['version'] = $this->version; } if (isset($this->status)) { - $json['status'] = BookingStatus::checkValue($this->status); + $json['status'] = $this->status; } if (isset($this->createdAt)) { $json['created_at'] = $this->createdAt; @@ -486,16 +483,13 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['all_day'] = $this->allDay; } if (isset($this->locationType)) { - $json['location_type'] = - BusinessAppointmentSettingsBookingLocationType::checkValue( - $this->locationType - ); + $json['location_type'] = $this->locationType; } if (isset($this->creatorDetails)) { $json['creator_details'] = $this->creatorDetails; } if (isset($this->source)) { - $json['source'] = BookingBookingSource::checkValue($this->source); + $json['source'] = $this->source; } $json = array_filter($json, function ($val) { return $val !== null; diff --git a/src/Models/BookingBookingSource.php b/src/Models/BookingBookingSource.php index 48f74222..d9f97ef2 100644 --- a/src/Models/BookingBookingSource.php +++ b/src/Models/BookingBookingSource.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Supported sources a booking was created from. */ @@ -34,27 +30,4 @@ class BookingBookingSource * The booking was created by a seller or a buyer from the Square Bookings API. */ public const API = 'API'; - - private const _ALL_VALUES = [ - self::FIRST_PARTY_MERCHANT, - self::FIRST_PARTY_BUYER, - self::THIRD_PARTY_BUYER, - self::API, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/BookingCreatorDetails.php b/src/Models/BookingCreatorDetails.php index 5183a106..0ca89c75 100644 --- a/src/Models/BookingCreatorDetails.php +++ b/src/Models/BookingCreatorDetails.php @@ -40,7 +40,6 @@ public function getCreatorType(): ?string * Supported types of a booking creator. * * @maps creator_type - * @factory \Square\Models\BookingCreatorDetailsCreatorType::checkValue */ public function setCreatorType(?string $creatorType): void { @@ -106,7 +105,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; if (isset($this->creatorType)) { - $json['creator_type'] = BookingCreatorDetailsCreatorType::checkValue($this->creatorType); + $json['creator_type'] = $this->creatorType; } if (isset($this->teamMemberId)) { $json['team_member_id'] = $this->teamMemberId; diff --git a/src/Models/BookingCreatorDetailsCreatorType.php b/src/Models/BookingCreatorDetailsCreatorType.php index b9a983a7..a21104a2 100644 --- a/src/Models/BookingCreatorDetailsCreatorType.php +++ b/src/Models/BookingCreatorDetailsCreatorType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Supported types of a booking creator. */ @@ -22,22 +18,4 @@ class BookingCreatorDetailsCreatorType * The creator is of the buyer type. */ public const CUSTOMER = 'CUSTOMER'; - - private const _ALL_VALUES = [self::TEAM_MEMBER, self::CUSTOMER]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/BookingStatus.php b/src/Models/BookingStatus.php index 842dd2fc..3e0ffb5f 100644 --- a/src/Models/BookingStatus.php +++ b/src/Models/BookingStatus.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Supported booking statuses. */ @@ -43,29 +39,4 @@ class BookingStatus * the seller because the client either missed the booking or cancelled it without enough notice. */ public const NO_SHOW = 'NO_SHOW'; - - private const _ALL_VALUES = [ - self::PENDING, - self::CANCELLED_BY_CUSTOMER, - self::CANCELLED_BY_SELLER, - self::DECLINED, - self::ACCEPTED, - self::NO_SHOW, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/BusinessAppointmentSettings.php b/src/Models/BusinessAppointmentSettings.php index 4b10ecb8..718f0244 100644 --- a/src/Models/BusinessAppointmentSettings.php +++ b/src/Models/BusinessAppointmentSettings.php @@ -96,7 +96,6 @@ public function getLocationTypes(): ?array * businessappointmentsettingsbookinglocationtype) for possible values * * @maps location_types - * @factory \Square\Models\BusinessAppointmentSettingsBookingLocationType::checkValue * * @param string[]|null $locationTypes */ @@ -119,7 +118,6 @@ public function getAlignmentTime(): ?string * Time units of a service duration for bookings. * * @maps alignment_time - * @factory \Square\Models\BusinessAppointmentSettingsAlignmentTime::checkValue */ public function setAlignmentTime(?string $alignmentTime): void { @@ -228,7 +226,6 @@ public function getMaxAppointmentsPerDayLimitType(): ?string * Types of daily appointment limits. * * @maps max_appointments_per_day_limit_type - * @factory \Square\Models\BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType::checkValue */ public function setMaxAppointmentsPerDayLimitType(?string $maxAppointmentsPerDayLimitType): void { @@ -321,7 +318,6 @@ public function getCancellationPolicy(): ?string * The category of the seller’s cancellation policy. * * @maps cancellation_policy - * @factory \Square\Models\BusinessAppointmentSettingsCancellationPolicy::checkValue */ public function setCancellationPolicy(?string $cancellationPolicy): void { @@ -383,16 +379,10 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; if (isset($this->locationTypes)) { - $json['location_types'] = - BusinessAppointmentSettingsBookingLocationType::checkValue( - $this->locationTypes - ); + $json['location_types'] = $this->locationTypes; } if (isset($this->alignmentTime)) { - $json['alignment_time'] = - BusinessAppointmentSettingsAlignmentTime::checkValue( - $this->alignmentTime - ); + $json['alignment_time'] = $this->alignmentTime; } if (isset($this->minBookingLeadTimeSeconds)) { $json['min_booking_lead_time_seconds'] = $this->minBookingLeadTimeSeconds; @@ -407,10 +397,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['multiple_service_booking_enabled'] = $this->multipleServiceBookingEnabled; } if (isset($this->maxAppointmentsPerDayLimitType)) { - $json['max_appointments_per_day_limit_type'] = - BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType::checkValue( - $this->maxAppointmentsPerDayLimitType - ); + $json['max_appointments_per_day_limit_type'] = $this->maxAppointmentsPerDayLimitType; } if (isset($this->maxAppointmentsPerDayLimit)) { $json['max_appointments_per_day_limit'] = $this->maxAppointmentsPerDayLimit; @@ -422,10 +409,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['cancellation_fee_money'] = $this->cancellationFeeMoney; } if (isset($this->cancellationPolicy)) { - $json['cancellation_policy'] = - BusinessAppointmentSettingsCancellationPolicy::checkValue( - $this->cancellationPolicy - ); + $json['cancellation_policy'] = $this->cancellationPolicy; } if (isset($this->cancellationPolicyText)) { $json['cancellation_policy_text'] = $this->cancellationPolicyText; diff --git a/src/Models/BusinessAppointmentSettingsAlignmentTime.php b/src/Models/BusinessAppointmentSettingsAlignmentTime.php index d2277e52..794d252e 100644 --- a/src/Models/BusinessAppointmentSettingsAlignmentTime.php +++ b/src/Models/BusinessAppointmentSettingsAlignmentTime.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Time units of a service duration for bookings. */ @@ -32,22 +28,4 @@ class BusinessAppointmentSettingsAlignmentTime * The service duration unit is a 60-minute interval. Bookings can be scheduled every hour. */ public const HOURLY = 'HOURLY'; - - private const _ALL_VALUES = [self::SERVICE_DURATION, self::QUARTER_HOURLY, self::HALF_HOURLY, self::HOURLY]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/BusinessAppointmentSettingsBookingLocationType.php b/src/Models/BusinessAppointmentSettingsBookingLocationType.php index 9019be54..bdb93c32 100644 --- a/src/Models/BusinessAppointmentSettingsBookingLocationType.php +++ b/src/Models/BusinessAppointmentSettingsBookingLocationType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Supported types of location where service is provided. */ @@ -27,22 +23,4 @@ class BusinessAppointmentSettingsBookingLocationType * The service is provided over the phone. */ public const PHONE = 'PHONE'; - - private const _ALL_VALUES = [self::BUSINESS_LOCATION, self::CUSTOMER_LOCATION, self::PHONE]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/BusinessAppointmentSettingsCancellationPolicy.php b/src/Models/BusinessAppointmentSettingsCancellationPolicy.php index 467765da..41d4f08e 100644 --- a/src/Models/BusinessAppointmentSettingsCancellationPolicy.php +++ b/src/Models/BusinessAppointmentSettingsCancellationPolicy.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * The category of the seller’s cancellation policy. */ @@ -23,22 +19,4 @@ class BusinessAppointmentSettingsCancellationPolicy * enforced automatically by Square. */ public const CUSTOM_POLICY = 'CUSTOM_POLICY'; - - private const _ALL_VALUES = [self::CANCELLATION_TREATED_AS_NO_SHOW, self::CUSTOM_POLICY]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType.php b/src/Models/BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType.php index ef08e5fa..661b04c9 100644 --- a/src/Models/BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType.php +++ b/src/Models/BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Types of daily appointment limits. */ @@ -22,22 +18,4 @@ class BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType * The maximum number of daily appointments is set on a per location basis. */ public const PER_LOCATION = 'PER_LOCATION'; - - private const _ALL_VALUES = [self::PER_TEAM_MEMBER, self::PER_LOCATION]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/BusinessBookingProfile.php b/src/Models/BusinessBookingProfile.php index 9724fd9c..6f0407cb 100644 --- a/src/Models/BusinessBookingProfile.php +++ b/src/Models/BusinessBookingProfile.php @@ -122,7 +122,6 @@ public function getCustomerTimezoneChoice(): ?string * Choices of customer-facing time zone used for bookings. * * @maps customer_timezone_choice - * @factory \Square\Models\BusinessBookingProfileCustomerTimezoneChoice::checkValue */ public function setCustomerTimezoneChoice(?string $customerTimezoneChoice): void { @@ -143,7 +142,6 @@ public function getBookingPolicy(): ?string * Policies for accepting bookings. * * @maps booking_policy - * @factory \Square\Models\BusinessBookingProfileBookingPolicy::checkValue */ public function setBookingPolicy(?string $bookingPolicy): void { @@ -234,16 +232,10 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['booking_enabled'] = $this->bookingEnabled; } if (isset($this->customerTimezoneChoice)) { - $json['customer_timezone_choice'] = - BusinessBookingProfileCustomerTimezoneChoice::checkValue( - $this->customerTimezoneChoice - ); + $json['customer_timezone_choice'] = $this->customerTimezoneChoice; } if (isset($this->bookingPolicy)) { - $json['booking_policy'] = - BusinessBookingProfileBookingPolicy::checkValue( - $this->bookingPolicy - ); + $json['booking_policy'] = $this->bookingPolicy; } if (isset($this->allowUserCancel)) { $json['allow_user_cancel'] = $this->allowUserCancel; diff --git a/src/Models/BusinessBookingProfileBookingPolicy.php b/src/Models/BusinessBookingProfileBookingPolicy.php index f0fc0ee2..8515786e 100644 --- a/src/Models/BusinessBookingProfileBookingPolicy.php +++ b/src/Models/BusinessBookingProfileBookingPolicy.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Policies for accepting bookings. */ @@ -22,22 +18,4 @@ class BusinessBookingProfileBookingPolicy * The seller must accept requests to complete bookings. */ public const REQUIRES_ACCEPTANCE = 'REQUIRES_ACCEPTANCE'; - - private const _ALL_VALUES = [self::ACCEPT_ALL, self::REQUIRES_ACCEPTANCE]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/BusinessBookingProfileCustomerTimezoneChoice.php b/src/Models/BusinessBookingProfileCustomerTimezoneChoice.php index e9608bbb..e60c3f1a 100644 --- a/src/Models/BusinessBookingProfileCustomerTimezoneChoice.php +++ b/src/Models/BusinessBookingProfileCustomerTimezoneChoice.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Choices of customer-facing time zone used for bookings. */ @@ -22,22 +18,4 @@ class BusinessBookingProfileCustomerTimezoneChoice * Use the customer-chosen time zone for bookings. */ public const CUSTOMER_CHOICE = 'CUSTOMER_CHOICE'; - - private const _ALL_VALUES = [self::BUSINESS_LOCATION_TIMEZONE, self::CUSTOMER_CHOICE]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/BusinessHoursPeriod.php b/src/Models/BusinessHoursPeriod.php index 1c2e313e..4898066e 100644 --- a/src/Models/BusinessHoursPeriod.php +++ b/src/Models/BusinessHoursPeriod.php @@ -40,7 +40,6 @@ public function getDayOfWeek(): ?string * Indicates the specific day of the week. * * @maps day_of_week - * @factory \Square\Models\DayOfWeek::checkValue */ public function setDayOfWeek(?string $dayOfWeek): void { @@ -108,7 +107,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; if (isset($this->dayOfWeek)) { - $json['day_of_week'] = DayOfWeek::checkValue($this->dayOfWeek); + $json['day_of_week'] = $this->dayOfWeek; } if (isset($this->startLocalTime)) { $json['start_local_time'] = $this->startLocalTime; diff --git a/src/Models/Card.php b/src/Models/Card.php index edd5c039..69d14580 100644 --- a/src/Models/Card.php +++ b/src/Models/Card.php @@ -131,7 +131,6 @@ public function getCardBrand(): ?string * Indicates a card's brand, such as `VISA` or `MASTERCARD`. * * @maps card_brand - * @factory \Square\Models\CardBrand::checkValue */ public function setCardBrand(?string $cardBrand): void { @@ -364,7 +363,6 @@ public function getCardType(): ?string * Indicates a card's type, such as `CREDIT` or `DEBIT`. * * @maps card_type - * @factory \Square\Models\CardType::checkValue */ public function setCardType(?string $cardType): void { @@ -385,7 +383,6 @@ public function getPrepaidType(): ?string * Indicates a card's prepaid type, such as `NOT_PREPAID` or `PREPAID`. * * @maps prepaid_type - * @factory \Square\Models\CardPrepaidType::checkValue */ public function setPrepaidType(?string $prepaidType): void { @@ -454,7 +451,6 @@ public function getCardCoBrand(): ?string * Indicates the brand for a co-branded card. * * @maps card_co_brand - * @factory \Square\Models\CardCoBrand::checkValue */ public function setCardCoBrand(?string $cardCoBrand): void { @@ -477,7 +473,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['id'] = $this->id; } if (isset($this->cardBrand)) { - $json['card_brand'] = CardBrand::checkValue($this->cardBrand); + $json['card_brand'] = $this->cardBrand; } if (isset($this->last4)) { $json['last_4'] = $this->last4; @@ -510,10 +506,10 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['enabled'] = $this->enabled; } if (isset($this->cardType)) { - $json['card_type'] = CardType::checkValue($this->cardType); + $json['card_type'] = $this->cardType; } if (isset($this->prepaidType)) { - $json['prepaid_type'] = CardPrepaidType::checkValue($this->prepaidType); + $json['prepaid_type'] = $this->prepaidType; } if (isset($this->bin)) { $json['bin'] = $this->bin; @@ -522,7 +518,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['version'] = $this->version; } if (isset($this->cardCoBrand)) { - $json['card_co_brand'] = CardCoBrand::checkValue($this->cardCoBrand); + $json['card_co_brand'] = $this->cardCoBrand; } $json = array_filter($json, function ($val) { return $val !== null; diff --git a/src/Models/CardBrand.php b/src/Models/CardBrand.php index 67ded8d2..85337077 100644 --- a/src/Models/CardBrand.php +++ b/src/Models/CardBrand.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates a card's brand, such as `VISA` or `MASTERCARD`. */ @@ -40,37 +36,4 @@ class CardBrand public const FELICA = 'FELICA'; public const EBT = 'EBT'; - - private const _ALL_VALUES = [ - self::OTHER_BRAND, - self::VISA, - self::MASTERCARD, - self::AMERICAN_EXPRESS, - self::DISCOVER, - self::DISCOVER_DINERS, - self::JCB, - self::CHINA_UNIONPAY, - self::SQUARE_GIFT_CARD, - self::SQUARE_CAPITAL_CARD, - self::INTERAC, - self::EFTPOS, - self::FELICA, - self::EBT, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/CardCoBrand.php b/src/Models/CardCoBrand.php index e334e893..f329f535 100644 --- a/src/Models/CardCoBrand.php +++ b/src/Models/CardCoBrand.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates the brand for a co-branded card. */ @@ -18,22 +14,4 @@ class CardCoBrand public const AFTERPAY = 'AFTERPAY'; public const CLEARPAY = 'CLEARPAY'; - - private const _ALL_VALUES = [self::UNKNOWN, self::AFTERPAY, self::CLEARPAY]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/CardPrepaidType.php b/src/Models/CardPrepaidType.php index 937cf7ea..d28a7b21 100644 --- a/src/Models/CardPrepaidType.php +++ b/src/Models/CardPrepaidType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates a card's prepaid type, such as `NOT_PREPAID` or `PREPAID`. */ @@ -18,22 +14,4 @@ class CardPrepaidType public const NOT_PREPAID = 'NOT_PREPAID'; public const PREPAID = 'PREPAID'; - - private const _ALL_VALUES = [self::UNKNOWN_PREPAID_TYPE, self::NOT_PREPAID, self::PREPAID]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/CardSquareProduct.php b/src/Models/CardSquareProduct.php index 2b8858ff..898ca657 100644 --- a/src/Models/CardSquareProduct.php +++ b/src/Models/CardSquareProduct.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - class CardSquareProduct { public const UNKNOWN_SQUARE_PRODUCT = 'UNKNOWN_SQUARE_PRODUCT'; @@ -31,34 +27,4 @@ class CardSquareProduct public const READER_SDK = 'READER_SDK'; public const SQUARE_PROFILE = 'SQUARE_PROFILE'; - - private const _ALL_VALUES = [ - self::UNKNOWN_SQUARE_PRODUCT, - self::CONNECT_API, - self::DASHBOARD, - self::REGISTER_CLIENT, - self::BUYER_DASHBOARD, - self::WEB, - self::INVOICES, - self::GIFT_CARD, - self::VIRTUAL_TERMINAL, - self::READER_SDK, - self::SQUARE_PROFILE, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/CardType.php b/src/Models/CardType.php index f6e1dd72..c72437b1 100644 --- a/src/Models/CardType.php +++ b/src/Models/CardType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates a card's type, such as `CREDIT` or `DEBIT`. */ @@ -18,22 +14,4 @@ class CardType public const CREDIT = 'CREDIT'; public const DEBIT = 'DEBIT'; - - private const _ALL_VALUES = [self::UNKNOWN_CARD_TYPE, self::CREDIT, self::DEBIT]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/CashDrawerEventType.php b/src/Models/CashDrawerEventType.php index c67a52d1..6819de5a 100644 --- a/src/Models/CashDrawerEventType.php +++ b/src/Models/CashDrawerEventType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * The types of events on a CashDrawerShift. * Each event type represents an employee action on the actual cash drawer @@ -76,32 +72,4 @@ class CashDrawerEventType * A CashDrawerEvent of this type must not have a negative amount. */ public const PAID_OUT = 'PAID_OUT'; - - private const _ALL_VALUES = [ - self::NO_SALE, - self::CASH_TENDER_PAYMENT, - self::OTHER_TENDER_PAYMENT, - self::CASH_TENDER_CANCELLED_PAYMENT, - self::OTHER_TENDER_CANCELLED_PAYMENT, - self::CASH_TENDER_REFUND, - self::OTHER_TENDER_REFUND, - self::PAID_IN, - self::PAID_OUT, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/CashDrawerShift.php b/src/Models/CashDrawerShift.php index 5111124f..602d47f7 100644 --- a/src/Models/CashDrawerShift.php +++ b/src/Models/CashDrawerShift.php @@ -138,7 +138,6 @@ public function getState(): ?string * The current state of a cash drawer shift. * * @maps state - * @factory \Square\Models\CashDrawerShiftState::checkValue */ public function setState(?string $state): void { @@ -571,7 +570,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['id'] = $this->id; } if (isset($this->state)) { - $json['state'] = CashDrawerShiftState::checkValue($this->state); + $json['state'] = $this->state; } if (isset($this->openedAt)) { $json['opened_at'] = $this->openedAt; diff --git a/src/Models/CashDrawerShiftEvent.php b/src/Models/CashDrawerShiftEvent.php index 544f92b7..36bfe70b 100644 --- a/src/Models/CashDrawerShiftEvent.php +++ b/src/Models/CashDrawerShiftEvent.php @@ -96,7 +96,6 @@ public function getEventType(): ?string * represented by a CashDrawerShift. * * @maps event_type - * @factory \Square\Models\CashDrawerEventType::checkValue */ public function setEventType(?string $eventType): void { @@ -196,7 +195,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['employee_id'] = $this->employeeId; } if (isset($this->eventType)) { - $json['event_type'] = CashDrawerEventType::checkValue($this->eventType); + $json['event_type'] = $this->eventType; } if (isset($this->eventMoney)) { $json['event_money'] = $this->eventMoney; diff --git a/src/Models/CashDrawerShiftState.php b/src/Models/CashDrawerShiftState.php index af048834..3810b461 100644 --- a/src/Models/CashDrawerShiftState.php +++ b/src/Models/CashDrawerShiftState.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * The current state of a cash drawer shift. */ @@ -28,22 +24,4 @@ class CashDrawerShiftState * content audit and recorded result. */ public const CLOSED = 'CLOSED'; - - private const _ALL_VALUES = [self::OPEN, self::ENDED, self::CLOSED]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/CashDrawerShiftSummary.php b/src/Models/CashDrawerShiftSummary.php index eb971fd8..4a366db2 100644 --- a/src/Models/CashDrawerShiftSummary.php +++ b/src/Models/CashDrawerShiftSummary.php @@ -93,7 +93,6 @@ public function getState(): ?string * The current state of a cash drawer shift. * * @maps state - * @factory \Square\Models\CashDrawerShiftState::checkValue */ public function setState(?string $state): void { @@ -292,7 +291,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['id'] = $this->id; } if (isset($this->state)) { - $json['state'] = CashDrawerShiftState::checkValue($this->state); + $json['state'] = $this->state; } if (isset($this->openedAt)) { $json['opened_at'] = $this->openedAt; diff --git a/src/Models/CatalogCustomAttributeDefinition.php b/src/Models/CatalogCustomAttributeDefinition.php index d049e0a7..711e9c4f 100644 --- a/src/Models/CatalogCustomAttributeDefinition.php +++ b/src/Models/CatalogCustomAttributeDefinition.php @@ -103,7 +103,6 @@ public function getType(): string * * @required * @maps type - * @factory \Square\Models\CatalogCustomAttributeDefinitionType::checkValue */ public function setType(string $type): void { @@ -198,7 +197,6 @@ public function getAllowedObjectTypes(): array * * @required * @maps allowed_object_types - * @factory \Square\Models\CatalogObjectType::checkValue * * @param string[] $allowedObjectTypes */ @@ -225,7 +223,6 @@ public function getSellerVisibility(): ?string * of Sale applications and Square Dashboard). * * @maps seller_visibility - * @factory \Square\Models\CatalogCustomAttributeDefinitionSellerVisibility::checkValue */ public function setSellerVisibility(?string $sellerVisibility): void { @@ -248,7 +245,6 @@ public function getAppVisibility(): ?string * creating application. * * @maps app_visibility - * @factory \Square\Models\CatalogCustomAttributeDefinitionAppVisibility::checkValue */ public function setAppVisibility(?string $appVisibility): void { @@ -377,7 +373,7 @@ public function setKey(?string $key): void public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; - $json['type'] = CatalogCustomAttributeDefinitionType::checkValue($this->type); + $json['type'] = $this->type; $json['name'] = $this->name; if (isset($this->description)) { $json['description'] = $this->description; @@ -385,18 +381,12 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (isset($this->sourceApplication)) { $json['source_application'] = $this->sourceApplication; } - $json['allowed_object_types'] = CatalogObjectType::checkValue($this->allowedObjectTypes); + $json['allowed_object_types'] = $this->allowedObjectTypes; if (isset($this->sellerVisibility)) { - $json['seller_visibility'] = - CatalogCustomAttributeDefinitionSellerVisibility::checkValue( - $this->sellerVisibility - ); + $json['seller_visibility'] = $this->sellerVisibility; } if (isset($this->appVisibility)) { - $json['app_visibility'] = - CatalogCustomAttributeDefinitionAppVisibility::checkValue( - $this->appVisibility - ); + $json['app_visibility'] = $this->appVisibility; } if (isset($this->stringConfig)) { $json['string_config'] = $this->stringConfig; diff --git a/src/Models/CatalogCustomAttributeDefinitionAppVisibility.php b/src/Models/CatalogCustomAttributeDefinitionAppVisibility.php index 9f9f64f6..0d408729 100644 --- a/src/Models/CatalogCustomAttributeDefinitionAppVisibility.php +++ b/src/Models/CatalogCustomAttributeDefinitionAppVisibility.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Defines the visibility of a custom attribute to applications other than their * creating application. @@ -30,26 +26,4 @@ class CatalogCustomAttributeDefinitionAppVisibility * They can read but cannot edit the custom attribute definition. */ public const APP_VISIBILITY_READ_WRITE_VALUES = 'APP_VISIBILITY_READ_WRITE_VALUES'; - - private const _ALL_VALUES = [ - self::APP_VISIBILITY_HIDDEN, - self::APP_VISIBILITY_READ_ONLY, - self::APP_VISIBILITY_READ_WRITE_VALUES, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/CatalogCustomAttributeDefinitionSellerVisibility.php b/src/Models/CatalogCustomAttributeDefinitionSellerVisibility.php index 1d1bb89d..166932fb 100644 --- a/src/Models/CatalogCustomAttributeDefinitionSellerVisibility.php +++ b/src/Models/CatalogCustomAttributeDefinitionSellerVisibility.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Defines the visibility of a custom attribute to sellers in Square * client applications, Square APIs or in Square UIs (including Square Point @@ -26,22 +22,4 @@ class CatalogCustomAttributeDefinitionSellerVisibility * but cannot edit the custom attribute definition. */ public const SELLER_VISIBILITY_READ_WRITE_VALUES = 'SELLER_VISIBILITY_READ_WRITE_VALUES'; - - private const _ALL_VALUES = [self::SELLER_VISIBILITY_HIDDEN, self::SELLER_VISIBILITY_READ_WRITE_VALUES]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/CatalogCustomAttributeDefinitionType.php b/src/Models/CatalogCustomAttributeDefinitionType.php index d16417a1..94592551 100644 --- a/src/Models/CatalogCustomAttributeDefinitionType.php +++ b/src/Models/CatalogCustomAttributeDefinitionType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Defines the possible types for a custom attribute. */ @@ -32,22 +28,4 @@ class CatalogCustomAttributeDefinitionType * One or more choices from `allowed_selections`. */ public const SELECTION = 'SELECTION'; - - private const _ALL_VALUES = [self::STRING, self::BOOLEAN, self::NUMBER, self::SELECTION]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/CatalogCustomAttributeValue.php b/src/Models/CatalogCustomAttributeValue.php index 86e432bb..deab791d 100644 --- a/src/Models/CatalogCustomAttributeValue.php +++ b/src/Models/CatalogCustomAttributeValue.php @@ -130,7 +130,6 @@ public function getType(): ?string * Defines the possible types for a custom attribute. * * @maps type - * @factory \Square\Models\CatalogCustomAttributeDefinitionType::checkValue */ public function setType(?string $type): void { @@ -245,7 +244,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['custom_attribute_definition_id'] = $this->customAttributeDefinitionId; } if (isset($this->type)) { - $json['type'] = CatalogCustomAttributeDefinitionType::checkValue($this->type); + $json['type'] = $this->type; } if (isset($this->numberValue)) { $json['number_value'] = $this->numberValue; diff --git a/src/Models/CatalogDiscount.php b/src/Models/CatalogDiscount.php index 93a464cc..4d7c7bd5 100644 --- a/src/Models/CatalogDiscount.php +++ b/src/Models/CatalogDiscount.php @@ -87,7 +87,6 @@ public function getDiscountType(): ?string * How to apply a CatalogDiscount to a CatalogItem. * * @maps discount_type - * @factory \Square\Models\CatalogDiscountType::checkValue */ public function setDiscountType(?string $discountType): void { @@ -214,7 +213,6 @@ public function getModifyTaxBasis(): ?string * Sets Modify Tax Basis. * * @maps modify_tax_basis - * @factory \Square\Models\CatalogDiscountModifyTaxBasis::checkValue */ public function setModifyTaxBasis(?string $modifyTaxBasis): void { @@ -269,7 +267,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['name'] = $this->name; } if (isset($this->discountType)) { - $json['discount_type'] = CatalogDiscountType::checkValue($this->discountType); + $json['discount_type'] = $this->discountType; } if (isset($this->percentage)) { $json['percentage'] = $this->percentage; @@ -284,7 +282,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['label_color'] = $this->labelColor; } if (isset($this->modifyTaxBasis)) { - $json['modify_tax_basis'] = CatalogDiscountModifyTaxBasis::checkValue($this->modifyTaxBasis); + $json['modify_tax_basis'] = $this->modifyTaxBasis; } if (isset($this->maximumAmountMoney)) { $json['maximum_amount_money'] = $this->maximumAmountMoney; diff --git a/src/Models/CatalogDiscountModifyTaxBasis.php b/src/Models/CatalogDiscountModifyTaxBasis.php index 3288d554..cbc0d5f8 100644 --- a/src/Models/CatalogDiscountModifyTaxBasis.php +++ b/src/Models/CatalogDiscountModifyTaxBasis.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - class CatalogDiscountModifyTaxBasis { /** @@ -19,22 +15,4 @@ class CatalogDiscountModifyTaxBasis * Application of the discount will not modify the tax basis. */ public const DO_NOT_MODIFY_TAX_BASIS = 'DO_NOT_MODIFY_TAX_BASIS'; - - private const _ALL_VALUES = [self::MODIFY_TAX_BASIS, self::DO_NOT_MODIFY_TAX_BASIS]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/CatalogDiscountType.php b/src/Models/CatalogDiscountType.php index 823260b1..4123c3a4 100644 --- a/src/Models/CatalogDiscountType.php +++ b/src/Models/CatalogDiscountType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * How to apply a CatalogDiscount to a CatalogItem. */ @@ -30,31 +26,8 @@ class CatalogDiscountType public const VARIABLE_PERCENTAGE = 'VARIABLE_PERCENTAGE'; /** - * Apply the discount as a variable amount off the item price. The amount will be specified at the - * time of sale. + * Apply the discount as a variable amount off the item price. The amount will be specified at the time + * of sale. */ public const VARIABLE_AMOUNT = 'VARIABLE_AMOUNT'; - - private const _ALL_VALUES = [ - self::FIXED_PERCENTAGE, - self::FIXED_AMOUNT, - self::VARIABLE_PERCENTAGE, - self::VARIABLE_AMOUNT, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/CatalogItem.php b/src/Models/CatalogItem.php index 56bb6177..f30f7cab 100644 --- a/src/Models/CatalogItem.php +++ b/src/Models/CatalogItem.php @@ -7,8 +7,8 @@ use stdClass; /** - * A [CatalogObject]($m/CatalogObject) instance of the `ITEM` type, also referred to as an item, in - * the catalog. + * A [CatalogObject]($m/CatalogObject) instance of the `ITEM` type, also referred to as an item, in the + * catalog. */ class CatalogItem implements \JsonSerializable { @@ -362,7 +362,6 @@ public function getProductType(): ?string * `APPOINTMENTS_SERVICE` items. * * @maps product_type - * @factory \Square\Models\CatalogItemProductType::checkValue */ public function setProductType(?string $productType): void { @@ -535,7 +534,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['variations'] = $this->variations; } if (isset($this->productType)) { - $json['product_type'] = CatalogItemProductType::checkValue($this->productType); + $json['product_type'] = $this->productType; } if (isset($this->skipModifierScreen)) { $json['skip_modifier_screen'] = $this->skipModifierScreen; diff --git a/src/Models/CatalogItemProductType.php b/src/Models/CatalogItemProductType.php index 7908e42c..f1bd17ec 100644 --- a/src/Models/CatalogItemProductType.php +++ b/src/Models/CatalogItemProductType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * The type of a CatalogItem. Connect V2 only allows the creation of `REGULAR` or * `APPOINTMENTS_SERVICE` items. @@ -28,22 +24,4 @@ class CatalogItemProductType * A service that can be booked using the Square Appointments app. */ public const APPOINTMENTS_SERVICE = 'APPOINTMENTS_SERVICE'; - - private const _ALL_VALUES = [self::REGULAR, self::GIFT_CARD, self::APPOINTMENTS_SERVICE]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/CatalogItemVariation.php b/src/Models/CatalogItemVariation.php index 734632a1..cbef861f 100644 --- a/src/Models/CatalogItemVariation.php +++ b/src/Models/CatalogItemVariation.php @@ -273,7 +273,6 @@ public function getPricingType(): ?string * Indicates whether the price of a CatalogItemVariation should be entered manually at the time of sale. * * @maps pricing_type - * @factory \Square\Models\CatalogPricingType::checkValue */ public function setPricingType(?string $pricingType): void { @@ -372,7 +371,6 @@ public function getInventoryAlertType(): ?string * CatalogItemVariation is low. * * @maps inventory_alert_type - * @factory \Square\Models\InventoryAlertType::checkValue */ public function setInventoryAlertType(?string $inventoryAlertType): void { @@ -683,7 +681,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['ordinal'] = $this->ordinal; } if (isset($this->pricingType)) { - $json['pricing_type'] = CatalogPricingType::checkValue($this->pricingType); + $json['pricing_type'] = $this->pricingType; } if (isset($this->priceMoney)) { $json['price_money'] = $this->priceMoney; @@ -695,7 +693,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['track_inventory'] = $this->trackInventory; } if (isset($this->inventoryAlertType)) { - $json['inventory_alert_type'] = InventoryAlertType::checkValue($this->inventoryAlertType); + $json['inventory_alert_type'] = $this->inventoryAlertType; } if (isset($this->inventoryAlertThreshold)) { $json['inventory_alert_threshold'] = $this->inventoryAlertThreshold; diff --git a/src/Models/CatalogModifierList.php b/src/Models/CatalogModifierList.php index 3829f09c..1982054c 100644 --- a/src/Models/CatalogModifierList.php +++ b/src/Models/CatalogModifierList.php @@ -97,7 +97,6 @@ public function getSelectionType(): ?string * Indicates whether a CatalogModifierList supports multiple selections. * * @maps selection_type - * @factory \Square\Models\CatalogModifierListSelectionType::checkValue */ public function setSelectionType(?string $selectionType): void { @@ -181,7 +180,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['ordinal'] = $this->ordinal; } if (isset($this->selectionType)) { - $json['selection_type'] = CatalogModifierListSelectionType::checkValue($this->selectionType); + $json['selection_type'] = $this->selectionType; } if (isset($this->modifiers)) { $json['modifiers'] = $this->modifiers; diff --git a/src/Models/CatalogModifierListSelectionType.php b/src/Models/CatalogModifierListSelectionType.php index dc27c7d2..d18ecb3d 100644 --- a/src/Models/CatalogModifierListSelectionType.php +++ b/src/Models/CatalogModifierListSelectionType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates whether a CatalogModifierList supports multiple selections. */ @@ -24,22 +20,4 @@ class CatalogModifierListSelectionType * CatalogModifier to be selected. */ public const MULTIPLE = 'MULTIPLE'; - - private const _ALL_VALUES = [self::SINGLE, self::MULTIPLE]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/CatalogObject.php b/src/Models/CatalogObject.php index aca6a673..dcb3bb7b 100644 --- a/src/Models/CatalogObject.php +++ b/src/Models/CatalogObject.php @@ -186,7 +186,6 @@ public function getType(): string * * @required * @maps type - * @factory \Square\Models\CatalogObjectType::checkValue */ public function setType(string $type): void { @@ -909,7 +908,7 @@ public function setQuickAmountsSettingsData(?CatalogQuickAmountsSettings $quickA public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; - $json['type'] = CatalogObjectType::checkValue($this->type); + $json['type'] = $this->type; $json['id'] = $this->id; if (isset($this->updatedAt)) { $json['updated_at'] = $this->updatedAt; diff --git a/src/Models/CatalogObjectType.php b/src/Models/CatalogObjectType.php index 9575e375..8770b0b8 100644 --- a/src/Models/CatalogObjectType.php +++ b/src/Models/CatalogObjectType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Possible types of CatalogObjects returned from the catalog, each * containing type-specific properties in the `*_data` field corresponding to the specfied object type. @@ -78,15 +74,15 @@ class CatalogObjectType public const PRICING_RULE = 'PRICING_RULE'; /** - * The `CatalogObject` instance is of the [CatalogProductSet]($m/CatalogProductSet) type and - * represents a product set. + * The `CatalogObject` instance is of the [CatalogProductSet]($m/CatalogProductSet) type and represents + * a product set. * The product-set-specific data will be stored in the `product_set_data` field. */ public const PRODUCT_SET = 'PRODUCT_SET'; /** - * The `CatalogObject` instance is of the [CatalogTimePeriod]($m/CatalogTimePeriod) type and - * represents a time period. + * The `CatalogObject` instance is of the [CatalogTimePeriod]($m/CatalogTimePeriod) type and represents + * a time period. * The time-period-specific data must be set on the `time_period_data` field. */ public const TIME_PERIOD = 'TIME_PERIOD'; @@ -107,8 +103,8 @@ class CatalogObjectType public const SUBSCRIPTION_PLAN = 'SUBSCRIPTION_PLAN'; /** - * The `CatalogObject` instance is of the [CatalogItemOption]($m/CatalogItemOption) type and - * represents a list of options (such as a color or size of a T-shirt) + * The `CatalogObject` instance is of the [CatalogItemOption]($m/CatalogItemOption) type and represents + * a list of options (such as a color or size of a T-shirt) * that can be assigned to item variations. The item-option-specific data must be on the * `item_option_data` field. */ @@ -132,48 +128,11 @@ class CatalogObjectType public const CUSTOM_ATTRIBUTE_DEFINITION = 'CUSTOM_ATTRIBUTE_DEFINITION'; /** - * The `CatalogObject` instance is of the - * [CatalogQuickAmountsSettings]($m/CatalogQuickAmountsSettings) type and represents settings to - * configure preset charges for quick payments at each location. + * The `CatalogObject` instance is of the [CatalogQuickAmountsSettings]($m/CatalogQuickAmountsSettings) + * type and represents settings to configure preset charges for quick payments at each location. * For example, a location may have a list of both AUTO and MANUAL quick amounts that are set to * DISABLED. * The quick-amounts-settings-specific data must be set on the `quick_amounts_settings_data` field. */ public const QUICK_AMOUNTS_SETTINGS = 'QUICK_AMOUNTS_SETTINGS'; - - private const _ALL_VALUES = [ - self::ITEM, - self::IMAGE, - self::CATEGORY, - self::ITEM_VARIATION, - self::TAX, - self::DISCOUNT, - self::MODIFIER_LIST, - self::MODIFIER, - self::PRICING_RULE, - self::PRODUCT_SET, - self::TIME_PERIOD, - self::MEASUREMENT_UNIT, - self::SUBSCRIPTION_PLAN, - self::ITEM_OPTION, - self::ITEM_OPTION_VAL, - self::CUSTOM_ATTRIBUTE_DEFINITION, - self::QUICK_AMOUNTS_SETTINGS, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/CatalogPricingRule.php b/src/Models/CatalogPricingRule.php index 4b0da7bb..37c81c1f 100644 --- a/src/Models/CatalogPricingRule.php +++ b/src/Models/CatalogPricingRule.php @@ -343,7 +343,6 @@ public function getExcludeStrategy(): ?string * will be excluded if the pricing rule uses an exclude set. * * @maps exclude_strategy - * @factory \Square\Models\ExcludeStrategy::checkValue */ public function setExcludeStrategy(?string $excludeStrategy): void { @@ -463,7 +462,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['valid_until_local_time'] = $this->validUntilLocalTime; } if (isset($this->excludeStrategy)) { - $json['exclude_strategy'] = ExcludeStrategy::checkValue($this->excludeStrategy); + $json['exclude_strategy'] = $this->excludeStrategy; } if (isset($this->minimumOrderSubtotalMoney)) { $json['minimum_order_subtotal_money'] = $this->minimumOrderSubtotalMoney; diff --git a/src/Models/CatalogPricingType.php b/src/Models/CatalogPricingType.php index 3ccc128d..d901227d 100644 --- a/src/Models/CatalogPricingType.php +++ b/src/Models/CatalogPricingType.php @@ -4,13 +4,8 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** - * Indicates whether the price of a CatalogItemVariation should be entered manually at the time of - * sale. + * Indicates whether the price of a CatalogItemVariation should be entered manually at the time of sale. */ class CatalogPricingType { @@ -23,22 +18,4 @@ class CatalogPricingType * The catalog item variation's price is entered at the time of sale. */ public const VARIABLE_PRICING = 'VARIABLE_PRICING'; - - private const _ALL_VALUES = [self::FIXED_PRICING, self::VARIABLE_PRICING]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/CatalogQueryRange.php b/src/Models/CatalogQueryRange.php index e6458e0e..eab2b44b 100644 --- a/src/Models/CatalogQueryRange.php +++ b/src/Models/CatalogQueryRange.php @@ -7,8 +7,8 @@ use stdClass; /** - * The query filter to return the search result whose named attribute values fall between the - * specified range. + * The query filter to return the search result whose named attribute values fall between the specified + * range. */ class CatalogQueryRange implements \JsonSerializable { diff --git a/src/Models/CatalogQuerySet.php b/src/Models/CatalogQuerySet.php index 0b932f32..6b8de411 100644 --- a/src/Models/CatalogQuerySet.php +++ b/src/Models/CatalogQuerySet.php @@ -7,8 +7,8 @@ use stdClass; /** - * The query filter to return the search result(s) by exact match of the specified `attribute_name` - * and any of + * The query filter to return the search result(s) by exact match of the specified `attribute_name` and + * any of * the `attribute_values`. */ class CatalogQuerySet implements \JsonSerializable diff --git a/src/Models/CatalogQuerySortedAttribute.php b/src/Models/CatalogQuerySortedAttribute.php index 2ab5422a..9d3f2c5f 100644 --- a/src/Models/CatalogQuerySortedAttribute.php +++ b/src/Models/CatalogQuerySortedAttribute.php @@ -93,7 +93,6 @@ public function getSortOrder(): ?string * The order (e.g., chronological or alphabetical) in which results from a request are returned. * * @maps sort_order - * @factory \Square\Models\SortOrder::checkValue */ public function setSortOrder(?string $sortOrder): void { @@ -117,7 +116,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['initial_attribute_value'] = $this->initialAttributeValue; } if (isset($this->sortOrder)) { - $json['sort_order'] = SortOrder::checkValue($this->sortOrder); + $json['sort_order'] = $this->sortOrder; } $json = array_filter($json, function ($val) { return $val !== null; diff --git a/src/Models/CatalogQuickAmount.php b/src/Models/CatalogQuickAmount.php index 07b1c5ca..e4b72481 100644 --- a/src/Models/CatalogQuickAmount.php +++ b/src/Models/CatalogQuickAmount.php @@ -56,7 +56,6 @@ public function getType(): string * * @required * @maps type - * @factory \Square\Models\CatalogQuickAmountType::checkValue */ public function setType(string $type): void { @@ -150,7 +149,7 @@ public function setOrdinal(?int $ordinal): void public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; - $json['type'] = CatalogQuickAmountType::checkValue($this->type); + $json['type'] = $this->type; $json['amount'] = $this->amount; if (isset($this->score)) { $json['score'] = $this->score; diff --git a/src/Models/CatalogQuickAmountType.php b/src/Models/CatalogQuickAmountType.php index db765acf..41ce0ca4 100644 --- a/src/Models/CatalogQuickAmountType.php +++ b/src/Models/CatalogQuickAmountType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Determines the type of a specific Quick Amount. */ @@ -22,22 +18,4 @@ class CatalogQuickAmountType * Quick Amount is generated automatically by machine learning algorithms. */ public const QUICK_AMOUNT_TYPE_AUTO = 'QUICK_AMOUNT_TYPE_AUTO'; - - private const _ALL_VALUES = [self::QUICK_AMOUNT_TYPE_MANUAL, self::QUICK_AMOUNT_TYPE_AUTO]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/CatalogQuickAmountsSettings.php b/src/Models/CatalogQuickAmountsSettings.php index 56b2c0f4..1670d0d8 100644 --- a/src/Models/CatalogQuickAmountsSettings.php +++ b/src/Models/CatalogQuickAmountsSettings.php @@ -7,8 +7,7 @@ use stdClass; /** - * A parent Catalog Object model represents a set of Quick Amounts and the settings control the - * amounts. + * A parent Catalog Object model represents a set of Quick Amounts and the settings control the amounts. */ class CatalogQuickAmountsSettings implements \JsonSerializable { @@ -50,7 +49,6 @@ public function getOption(): string * * @required * @maps option - * @factory \Square\Models\CatalogQuickAmountsSettingsOption::checkValue */ public function setOption(string $option): void { @@ -115,7 +113,7 @@ public function setAmounts(?array $amounts): void public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; - $json['option'] = CatalogQuickAmountsSettingsOption::checkValue($this->option); + $json['option'] = $this->option; if (isset($this->eligibleForAutoAmounts)) { $json['eligible_for_auto_amounts'] = $this->eligibleForAutoAmounts; } diff --git a/src/Models/CatalogQuickAmountsSettingsOption.php b/src/Models/CatalogQuickAmountsSettingsOption.php index ebf03464..21554101 100644 --- a/src/Models/CatalogQuickAmountsSettingsOption.php +++ b/src/Models/CatalogQuickAmountsSettingsOption.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Determines a seller's option on Quick Amounts feature. */ @@ -27,22 +23,4 @@ class CatalogQuickAmountsSettingsOption * Option for seller to choose automatically created Quick Amounts. */ public const AUTO = 'AUTO'; - - private const _ALL_VALUES = [self::DISABLED, self::MANUAL, self::AUTO]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/CatalogTax.php b/src/Models/CatalogTax.php index 6afc8350..322b66dd 100644 --- a/src/Models/CatalogTax.php +++ b/src/Models/CatalogTax.php @@ -77,7 +77,6 @@ public function getCalculationPhase(): ?string * When to calculate the taxes due on a cart. * * @maps calculation_phase - * @factory \Square\Models\TaxCalculationPhase::checkValue */ public function setCalculationPhase(?string $calculationPhase): void { @@ -98,7 +97,6 @@ public function getInclusionType(): ?string * Whether to the tax amount should be additional to or included in the CatalogItem price. * * @maps inclusion_type - * @factory \Square\Models\TaxInclusionType::checkValue */ public function setInclusionType(?string $inclusionType): void { @@ -189,10 +187,10 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['name'] = $this->name; } if (isset($this->calculationPhase)) { - $json['calculation_phase'] = TaxCalculationPhase::checkValue($this->calculationPhase); + $json['calculation_phase'] = $this->calculationPhase; } if (isset($this->inclusionType)) { - $json['inclusion_type'] = TaxInclusionType::checkValue($this->inclusionType); + $json['inclusion_type'] = $this->inclusionType; } if (isset($this->percentage)) { $json['percentage'] = $this->percentage; diff --git a/src/Models/ChangeTiming.php b/src/Models/ChangeTiming.php index 7c9fc333..48bbbc15 100644 --- a/src/Models/ChangeTiming.php +++ b/src/Models/ChangeTiming.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Supported timings when a pending change, as an action, takes place to a subscription. */ @@ -22,22 +18,4 @@ class ChangeTiming * The action occurs at the end of the billing cycle. */ public const END_OF_BILLING_CYCLE = 'END_OF_BILLING_CYCLE'; - - private const _ALL_VALUES = [self::IMMEDIATE, self::END_OF_BILLING_CYCLE]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/CheckoutOptionsPaymentType.php b/src/Models/CheckoutOptionsPaymentType.php index c507e722..9432bae4 100644 --- a/src/Models/CheckoutOptionsPaymentType.php +++ b/src/Models/CheckoutOptionsPaymentType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - class CheckoutOptionsPaymentType { /** @@ -40,29 +36,4 @@ class CheckoutOptionsPaymentType * allows them to select a specific FeliCa brand or select the check balance screen. */ public const FELICA_ALL = 'FELICA_ALL'; - - private const _ALL_VALUES = [ - self::CARD_PRESENT, - self::MANUAL_CARD_ENTRY, - self::FELICA_ID, - self::FELICA_QUICPAY, - self::FELICA_TRANSPORTATION_GROUP, - self::FELICA_ALL, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/Country.php b/src/Models/Country.php index d2b2dcf6..046a34b7 100644 --- a/src/Models/Country.php +++ b/src/Models/Country.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates the country associated with another entity, such as a business. * Values are in [ISO 3166-1-alpha-2 format](http://www.iso.org/iso/home/standards/country_codes.htm). @@ -1263,273 +1259,4 @@ class Country * Zimbabwe */ public const ZW = 'ZW'; - - private const _ALL_VALUES = [ - self::ZZ, - self::AD, - self::AE, - self::AF, - self::AG, - self::AI, - self::AL, - self::AM, - self::AO, - self::AQ, - self::AR, - self::AS_, - self::AT, - self::AU, - self::AW, - self::AX, - self::AZ, - self::BA, - self::BB, - self::BD, - self::BE, - self::BF, - self::BG, - self::BH, - self::BI, - self::BJ, - self::BL, - self::BM, - self::BN, - self::BO, - self::BQ, - self::BR, - self::BS, - self::BT, - self::BV, - self::BW, - self::BY, - self::BZ, - self::CA, - self::CC, - self::CD, - self::CF, - self::CG, - self::CH, - self::CI, - self::CK, - self::CL, - self::CM, - self::CN, - self::CO, - self::CR, - self::CU, - self::CV, - self::CW, - self::CX, - self::CY, - self::CZ, - self::DE, - self::DJ, - self::DK, - self::DM, - self::DO_, - self::DZ, - self::EC, - self::EE, - self::EG, - self::EH, - self::ER, - self::ES, - self::ET, - self::FI, - self::FJ, - self::FK, - self::FM, - self::FO, - self::FR, - self::GA, - self::GB, - self::GD, - self::GE, - self::GF, - self::GG, - self::GH, - self::GI, - self::GL, - self::GM, - self::GN, - self::GP, - self::GQ, - self::GR, - self::GS, - self::GT, - self::GU, - self::GW, - self::GY, - self::HK, - self::HM, - self::HN, - self::HR, - self::HT, - self::HU, - self::ID, - self::IE, - self::IL, - self::IM, - self::IN, - self::IO, - self::IQ, - self::IR, - self::IS, - self::IT, - self::JE, - self::JM, - self::JO, - self::JP, - self::KE, - self::KG, - self::KH, - self::KI, - self::KM, - self::KN, - self::KP, - self::KR, - self::KW, - self::KY, - self::KZ, - self::LA, - self::LB, - self::LC, - self::LI, - self::LK, - self::LR, - self::LS, - self::LT, - self::LU, - self::LV, - self::LY, - self::MA, - self::MC, - self::MD, - self::ME, - self::MF, - self::MG, - self::MH, - self::MK, - self::ML, - self::MM, - self::MN, - self::MO, - self::MP, - self::MQ, - self::MR, - self::MS, - self::MT, - self::MU, - self::MV, - self::MW, - self::MX, - self::MY, - self::MZ, - self::NA, - self::NC, - self::NE, - self::NF, - self::NG, - self::NI, - self::NL, - self::NO, - self::NP, - self::NR, - self::NU, - self::NZ, - self::OM, - self::PA, - self::PE, - self::PF, - self::PG, - self::PH, - self::PK, - self::PL, - self::PM, - self::PN, - self::PR, - self::PS, - self::PT, - self::PW, - self::PY, - self::QA, - self::RE, - self::RO, - self::RS, - self::RU, - self::RW, - self::SA, - self::SB, - self::SC, - self::SD, - self::SE, - self::SG, - self::SH, - self::SI, - self::SJ, - self::SK, - self::SL, - self::SM, - self::SN, - self::SO, - self::SR, - self::SS, - self::ST, - self::SV, - self::SX, - self::SY, - self::SZ, - self::TC, - self::TD, - self::TF, - self::TG, - self::TH, - self::TJ, - self::TK, - self::TL, - self::TM, - self::TN, - self::TO, - self::TR, - self::TT, - self::TV, - self::TW, - self::TZ, - self::UA, - self::UG, - self::UM, - self::US, - self::UY, - self::UZ, - self::VA, - self::VC, - self::VE, - self::VG, - self::VI, - self::VN, - self::VU, - self::WF, - self::WS, - self::YE, - self::YT, - self::ZA, - self::ZM, - self::ZW, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/CreateDisputeEvidenceFileRequest.php b/src/Models/CreateDisputeEvidenceFileRequest.php index cbc291d2..6288f3f8 100644 --- a/src/Models/CreateDisputeEvidenceFileRequest.php +++ b/src/Models/CreateDisputeEvidenceFileRequest.php @@ -71,7 +71,6 @@ public function getEvidenceType(): ?string * The type of the dispute evidence. * * @maps evidence_type - * @factory \Square\Models\DisputeEvidenceType::checkValue */ public function setEvidenceType(?string $evidenceType): void { @@ -114,7 +113,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json = []; $json['idempotency_key'] = $this->idempotencyKey; if (isset($this->evidenceType)) { - $json['evidence_type'] = DisputeEvidenceType::checkValue($this->evidenceType); + $json['evidence_type'] = $this->evidenceType; } if (isset($this->contentType)) { $json['content_type'] = $this->contentType; diff --git a/src/Models/CreateDisputeEvidenceTextRequest.php b/src/Models/CreateDisputeEvidenceTextRequest.php index cba6fab8..5771a978 100644 --- a/src/Models/CreateDisputeEvidenceTextRequest.php +++ b/src/Models/CreateDisputeEvidenceTextRequest.php @@ -73,7 +73,6 @@ public function getEvidenceType(): ?string * The type of the dispute evidence. * * @maps evidence_type - * @factory \Square\Models\DisputeEvidenceType::checkValue */ public function setEvidenceType(?string $evidenceType): void { @@ -115,7 +114,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json = []; $json['idempotency_key'] = $this->idempotencyKey; if (isset($this->evidenceType)) { - $json['evidence_type'] = DisputeEvidenceType::checkValue($this->evidenceType); + $json['evidence_type'] = $this->evidenceType; } $json['evidence_text'] = $this->evidenceText; $json = array_filter($json, function ($val) { diff --git a/src/Models/Currency.php b/src/Models/Currency.php index 826d82cd..1bbe9b14 100644 --- a/src/Models/Currency.php +++ b/src/Models/Currency.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates the associated currency for an amount of money. Values correspond * to [ISO 4217](https://wikipedia.org/wiki/ISO_4217). @@ -918,204 +914,4 @@ class Currency * Bitcoin */ public const BTC = 'BTC'; - - private const _ALL_VALUES = [ - self::UNKNOWN_CURRENCY, - self::AED, - self::AFN, - self::ALL, - self::AMD, - self::ANG, - self::AOA, - self::ARS, - self::AUD, - self::AWG, - self::AZN, - self::BAM, - self::BBD, - self::BDT, - self::BGN, - self::BHD, - self::BIF, - self::BMD, - self::BND, - self::BOB, - self::BOV, - self::BRL, - self::BSD, - self::BTN, - self::BWP, - self::BYR, - self::BZD, - self::CAD, - self::CDF, - self::CHE, - self::CHF, - self::CHW, - self::CLF, - self::CLP, - self::CNY, - self::COP, - self::COU, - self::CRC, - self::CUC, - self::CUP, - self::CVE, - self::CZK, - self::DJF, - self::DKK, - self::DOP, - self::DZD, - self::EGP, - self::ERN, - self::ETB, - self::EUR, - self::FJD, - self::FKP, - self::GBP, - self::GEL, - self::GHS, - self::GIP, - self::GMD, - self::GNF, - self::GTQ, - self::GYD, - self::HKD, - self::HNL, - self::HRK, - self::HTG, - self::HUF, - self::IDR, - self::ILS, - self::INR, - self::IQD, - self::IRR, - self::ISK, - self::JMD, - self::JOD, - self::JPY, - self::KES, - self::KGS, - self::KHR, - self::KMF, - self::KPW, - self::KRW, - self::KWD, - self::KYD, - self::KZT, - self::LAK, - self::LBP, - self::LKR, - self::LRD, - self::LSL, - self::LTL, - self::LVL, - self::LYD, - self::MAD, - self::MDL, - self::MGA, - self::MKD, - self::MMK, - self::MNT, - self::MOP, - self::MRO, - self::MUR, - self::MVR, - self::MWK, - self::MXN, - self::MXV, - self::MYR, - self::MZN, - self::NAD, - self::NGN, - self::NIO, - self::NOK, - self::NPR, - self::NZD, - self::OMR, - self::PAB, - self::PEN, - self::PGK, - self::PHP, - self::PKR, - self::PLN, - self::PYG, - self::QAR, - self::RON, - self::RSD, - self::RUB, - self::RWF, - self::SAR, - self::SBD, - self::SCR, - self::SDG, - self::SEK, - self::SGD, - self::SHP, - self::SLL, - self::SOS, - self::SRD, - self::SSP, - self::STD, - self::SVC, - self::SYP, - self::SZL, - self::THB, - self::TJS, - self::TMT, - self::TND, - self::TOP, - self::TRY_, - self::TTD, - self::TWD, - self::TZS, - self::UAH, - self::UGX, - self::USD, - self::USN, - self::USS, - self::UYI, - self::UYU, - self::UZS, - self::VEF, - self::VND, - self::VUV, - self::WST, - self::XAF, - self::XAG, - self::XAU, - self::XBA, - self::XBB, - self::XBC, - self::XBD, - self::XCD, - self::XDR, - self::XOF, - self::XPD, - self::XPF, - self::XPT, - self::XTS, - self::XXX, - self::YER, - self::ZAR, - self::ZMK, - self::ZMW, - self::BTC, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/CustomAttribute.php b/src/Models/CustomAttribute.php index 2731bed6..c730a44d 100644 --- a/src/Models/CustomAttribute.php +++ b/src/Models/CustomAttribute.php @@ -177,7 +177,6 @@ public function getVisibility(): ?string * and custom attribute definition. * * @maps visibility - * @factory \Square\Models\CustomAttributeDefinitionVisibility::checkValue */ public function setVisibility(?string $visibility): void { @@ -270,7 +269,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['version'] = $this->version; } if (isset($this->visibility)) { - $json['visibility'] = CustomAttributeDefinitionVisibility::checkValue($this->visibility); + $json['visibility'] = $this->visibility; } if (isset($this->definition)) { $json['definition'] = $this->definition; diff --git a/src/Models/CustomAttributeDefinition.php b/src/Models/CustomAttributeDefinition.php index 33d6b9f4..60a3acb7 100644 --- a/src/Models/CustomAttributeDefinition.php +++ b/src/Models/CustomAttributeDefinition.php @@ -222,7 +222,6 @@ public function getVisibility(): ?string * and custom attribute definition. * * @maps visibility - * @factory \Square\Models\CustomAttributeDefinitionVisibility::checkValue */ public function setVisibility(?string $visibility): void { @@ -345,7 +344,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['source_application'] = $this->sourceApplication; } if (isset($this->visibility)) { - $json['visibility'] = CustomAttributeDefinitionVisibility::checkValue($this->visibility); + $json['visibility'] = $this->visibility; } if (isset($this->version)) { $json['version'] = $this->version; diff --git a/src/Models/CustomAttributeDefinitionVisibility.php b/src/Models/CustomAttributeDefinitionVisibility.php index b6988779..af34bee6 100644 --- a/src/Models/CustomAttributeDefinitionVisibility.php +++ b/src/Models/CustomAttributeDefinitionVisibility.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * The level of permission that a seller or other applications requires to * view this custom attribute definition. @@ -34,26 +30,4 @@ class CustomAttributeDefinitionVisibility * can only be edited or deleted by the application that created it. */ public const VISIBILITY_READ_WRITE_VALUES = 'VISIBILITY_READ_WRITE_VALUES'; - - private const _ALL_VALUES = [ - self::VISIBILITY_HIDDEN, - self::VISIBILITY_READ_ONLY, - self::VISIBILITY_READ_WRITE_VALUES, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/Customer.php b/src/Models/Customer.php index ff385756..32a7ea1f 100644 --- a/src/Models/Customer.php +++ b/src/Models/Customer.php @@ -465,7 +465,6 @@ public function getCreationSource(): ?string * Indicates the method used to create the customer profile. * * @maps creation_source - * @factory \Square\Models\CustomerCreationSource::checkValue */ public function setCreationSource(?string $creationSource): void { @@ -628,7 +627,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['preferences'] = $this->preferences; } if (isset($this->creationSource)) { - $json['creation_source'] = CustomerCreationSource::checkValue($this->creationSource); + $json['creation_source'] = $this->creationSource; } if (isset($this->groupIds)) { $json['group_ids'] = $this->groupIds; diff --git a/src/Models/CustomerCreationSource.php b/src/Models/CustomerCreationSource.php index 28bf779f..8037bdcf 100644 --- a/src/Models/CustomerCreationSource.php +++ b/src/Models/CustomerCreationSource.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates the method used to create the customer profile. */ @@ -127,42 +123,4 @@ class CustomerCreationSource * process. */ public const UNMERGE_RECOVERY = 'UNMERGE_RECOVERY'; - - private const _ALL_VALUES = [ - self::OTHER, - self::APPOINTMENTS, - self::COUPON, - self::DELETION_RECOVERY, - self::DIRECTORY, - self::EGIFTING, - self::EMAIL_COLLECTION, - self::FEEDBACK, - self::IMPORT, - self::INVOICES, - self::LOYALTY, - self::MARKETING, - self::MERGE, - self::ONLINE_STORE, - self::INSTANT_PROFILE, - self::TERMINAL, - self::THIRD_PARTY, - self::THIRD_PARTY_IMPORT, - self::UNMERGE_RECOVERY, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/CustomerCreationSourceFilter.php b/src/Models/CustomerCreationSourceFilter.php index dc0fef3a..dfc360d6 100644 --- a/src/Models/CustomerCreationSourceFilter.php +++ b/src/Models/CustomerCreationSourceFilter.php @@ -42,7 +42,6 @@ public function getValues(): ?array * See [CustomerCreationSource](#type-customercreationsource) for possible values * * @maps values - * @factory \Square\Models\CustomerCreationSource::checkValue * * @param string[]|null $values */ @@ -67,7 +66,6 @@ public function getRule(): ?string * the result set when they match the filtering criteria. * * @maps rule - * @factory \Square\Models\CustomerInclusionExclusion::checkValue */ public function setRule(?string $rule): void { @@ -87,10 +85,10 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; if (isset($this->values)) { - $json['values'] = CustomerCreationSource::checkValue($this->values); + $json['values'] = $this->values; } if (isset($this->rule)) { - $json['rule'] = CustomerInclusionExclusion::checkValue($this->rule); + $json['rule'] = $this->rule; } $json = array_filter($json, function ($val) { return $val !== null; diff --git a/src/Models/CustomerInclusionExclusion.php b/src/Models/CustomerInclusionExclusion.php index f3f235c7..deb61cac 100644 --- a/src/Models/CustomerInclusionExclusion.php +++ b/src/Models/CustomerInclusionExclusion.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates whether customers should be included in, or excluded from, * the result set when they match the filtering criteria. @@ -25,22 +21,4 @@ class CustomerInclusionExclusion * the filtering criteria. */ public const EXCLUDE = 'EXCLUDE'; - - private const _ALL_VALUES = [self::INCLUDE_, self::EXCLUDE]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/CustomerSort.php b/src/Models/CustomerSort.php index 1f385dfb..dc98f789 100644 --- a/src/Models/CustomerSort.php +++ b/src/Models/CustomerSort.php @@ -35,7 +35,6 @@ public function getField(): ?string * Specifies customer attributes as the sort key to customer profiles returned from a search. * * @maps field - * @factory \Square\Models\CustomerSortField::checkValue */ public function setField(?string $field): void { @@ -56,7 +55,6 @@ public function getOrder(): ?string * The order (e.g., chronological or alphabetical) in which results from a request are returned. * * @maps order - * @factory \Square\Models\SortOrder::checkValue */ public function setOrder(?string $order): void { @@ -76,10 +74,10 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; if (isset($this->field)) { - $json['field'] = CustomerSortField::checkValue($this->field); + $json['field'] = $this->field; } if (isset($this->order)) { - $json['order'] = SortOrder::checkValue($this->order); + $json['order'] = $this->order; } $json = array_filter($json, function ($val) { return $val !== null; diff --git a/src/Models/CustomerSortField.php b/src/Models/CustomerSortField.php index d734dcc9..66dd8d6f 100644 --- a/src/Models/CustomerSortField.php +++ b/src/Models/CustomerSortField.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Specifies customer attributes as the sort key to customer profiles returned from a search. */ @@ -26,22 +22,4 @@ class CustomerSortField * Use the creation date attribute (`created_at`) of customer profiles as the sort key. */ public const CREATED_AT = 'CREATED_AT'; - - private const _ALL_VALUES = [self::DEFAULT_, self::CREATED_AT]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/CustomerTaxIds.php b/src/Models/CustomerTaxIds.php index df8c8f22..c817717d 100644 --- a/src/Models/CustomerTaxIds.php +++ b/src/Models/CustomerTaxIds.php @@ -7,8 +7,8 @@ use stdClass; /** - * Represents the tax ID associated with a [customer profile]($m/Customer). The corresponding - * `tax_ids` field is available only for customers of sellers in EU countries or the United Kingdom. + * Represents the tax ID associated with a [customer profile]($m/Customer). The corresponding `tax_ids` + * field is available only for customers of sellers in EU countries or the United Kingdom. * For more information, see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what- * it-does#customer-tax-ids). */ diff --git a/src/Models/DayOfWeek.php b/src/Models/DayOfWeek.php index c249de23..c7e7314e 100644 --- a/src/Models/DayOfWeek.php +++ b/src/Models/DayOfWeek.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates the specific day of the week. */ @@ -47,22 +43,4 @@ class DayOfWeek * Saturday */ public const SAT = 'SAT'; - - private const _ALL_VALUES = [self::SUN, self::MON, self::TUE, self::WED, self::THU, self::FRI, self::SAT]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/DeprecatedCreateDisputeEvidenceFileRequest.php b/src/Models/DeprecatedCreateDisputeEvidenceFileRequest.php index 90344d5a..f76fb926 100644 --- a/src/Models/DeprecatedCreateDisputeEvidenceFileRequest.php +++ b/src/Models/DeprecatedCreateDisputeEvidenceFileRequest.php @@ -71,7 +71,6 @@ public function getEvidenceType(): ?string * The type of the dispute evidence. * * @maps evidence_type - * @factory \Square\Models\DisputeEvidenceType::checkValue */ public function setEvidenceType(?string $evidenceType): void { @@ -114,7 +113,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json = []; $json['idempotency_key'] = $this->idempotencyKey; if (isset($this->evidenceType)) { - $json['evidence_type'] = DisputeEvidenceType::checkValue($this->evidenceType); + $json['evidence_type'] = $this->evidenceType; } if (isset($this->contentType)) { $json['content_type'] = $this->contentType; diff --git a/src/Models/DeprecatedCreateDisputeEvidenceTextRequest.php b/src/Models/DeprecatedCreateDisputeEvidenceTextRequest.php index 6eb9d876..3bec6df9 100644 --- a/src/Models/DeprecatedCreateDisputeEvidenceTextRequest.php +++ b/src/Models/DeprecatedCreateDisputeEvidenceTextRequest.php @@ -73,7 +73,6 @@ public function getEvidenceType(): ?string * The type of the dispute evidence. * * @maps evidence_type - * @factory \Square\Models\DisputeEvidenceType::checkValue */ public function setEvidenceType(?string $evidenceType): void { @@ -115,7 +114,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json = []; $json['idempotency_key'] = $this->idempotencyKey; if (isset($this->evidenceType)) { - $json['evidence_type'] = DisputeEvidenceType::checkValue($this->evidenceType); + $json['evidence_type'] = $this->evidenceType; } $json['evidence_text'] = $this->evidenceText; $json = array_filter($json, function ($val) { diff --git a/src/Models/Destination.php b/src/Models/Destination.php index 663bd200..2a270d0e 100644 --- a/src/Models/Destination.php +++ b/src/Models/Destination.php @@ -35,7 +35,6 @@ public function getType(): ?string * List of possible destinations against which a payout can be made. * * @maps type - * @factory \Square\Models\DestinationType::checkValue */ public function setType(?string $type): void { @@ -75,7 +74,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; if (isset($this->type)) { - $json['type'] = DestinationType::checkValue($this->type); + $json['type'] = $this->type; } if (isset($this->id)) { $json['id'] = $this->id; diff --git a/src/Models/DestinationType.php b/src/Models/DestinationType.php index d3184dcb..81d06f4c 100644 --- a/src/Models/DestinationType.php +++ b/src/Models/DestinationType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * List of possible destinations against which a payout can be made. */ @@ -30,22 +26,4 @@ class DestinationType * Square Compte Courant (FR), Cuenta Corriente Square (ES) */ public const SQUARE_STORED_BALANCE = 'SQUARE_STORED_BALANCE'; - - private const _ALL_VALUES = [self::BANK_ACCOUNT, self::CARD, self::SQUARE_BALANCE, self::SQUARE_STORED_BALANCE]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/DeviceCode.php b/src/Models/DeviceCode.php index 002a7028..3548ef1b 100644 --- a/src/Models/DeviceCode.php +++ b/src/Models/DeviceCode.php @@ -195,7 +195,6 @@ public function getStatus(): ?string * DeviceCode.Status enum. * * @maps status - * @factory \Square\Models\DeviceCodeStatus::checkValue */ public function setStatus(?string $status): void { @@ -311,7 +310,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['location_id'] = $this->locationId; } if (isset($this->status)) { - $json['status'] = DeviceCodeStatus::checkValue($this->status); + $json['status'] = $this->status; } if (isset($this->pairBy)) { $json['pair_by'] = $this->pairBy; diff --git a/src/Models/DeviceCodeStatus.php b/src/Models/DeviceCodeStatus.php index 740b3e04..69344f8b 100644 --- a/src/Models/DeviceCodeStatus.php +++ b/src/Models/DeviceCodeStatus.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * DeviceCode.Status enum. */ @@ -32,22 +28,4 @@ class DeviceCodeStatus * The device code was unpaired and expired before it was paired. */ public const EXPIRED = 'EXPIRED'; - - private const _ALL_VALUES = [self::UNKNOWN, self::UNPAIRED, self::PAIRED, self::EXPIRED]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/Dispute.php b/src/Models/Dispute.php index a11c1e68..4da2f99f 100644 --- a/src/Models/Dispute.php +++ b/src/Models/Dispute.php @@ -179,7 +179,6 @@ public function getReason(): ?string * dispute with their bank. * * @maps reason - * @factory \Square\Models\DisputeReason::checkValue */ public function setReason(?string $reason): void { @@ -200,7 +199,6 @@ public function getState(): ?string * The list of possible dispute states. * * @maps state - * @factory \Square\Models\DisputeState::checkValue */ public function setState(?string $state): void { @@ -285,7 +283,6 @@ public function getCardBrand(): ?string * Indicates a card's brand, such as `VISA` or `MASTERCARD`. * * @maps card_brand - * @factory \Square\Models\CardBrand::checkValue */ public function setCardBrand(?string $cardBrand): void { @@ -454,10 +451,10 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['amount_money'] = $this->amountMoney; } if (isset($this->reason)) { - $json['reason'] = DisputeReason::checkValue($this->reason); + $json['reason'] = $this->reason; } if (isset($this->state)) { - $json['state'] = DisputeState::checkValue($this->state); + $json['state'] = $this->state; } if (isset($this->dueAt)) { $json['due_at'] = $this->dueAt; @@ -469,7 +466,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['evidence_ids'] = $this->evidenceIds; } if (isset($this->cardBrand)) { - $json['card_brand'] = CardBrand::checkValue($this->cardBrand); + $json['card_brand'] = $this->cardBrand; } if (isset($this->createdAt)) { $json['created_at'] = $this->createdAt; diff --git a/src/Models/DisputeEvidence.php b/src/Models/DisputeEvidence.php index 03900f57..be5fab73 100644 --- a/src/Models/DisputeEvidence.php +++ b/src/Models/DisputeEvidence.php @@ -177,7 +177,6 @@ public function getEvidenceType(): ?string * The type of the dispute evidence. * * @maps evidence_type - * @factory \Square\Models\DisputeEvidenceType::checkValue */ public function setEvidenceType(?string $evidenceType): void { @@ -215,7 +214,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['uploaded_at'] = $this->uploadedAt; } if (isset($this->evidenceType)) { - $json['evidence_type'] = DisputeEvidenceType::checkValue($this->evidenceType); + $json['evidence_type'] = $this->evidenceType; } $json = array_filter($json, function ($val) { return $val !== null; diff --git a/src/Models/DisputeEvidenceType.php b/src/Models/DisputeEvidenceType.php index d56c6391..533e97b1 100644 --- a/src/Models/DisputeEvidenceType.php +++ b/src/Models/DisputeEvidenceType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * The type of the dispute evidence. */ @@ -150,38 +146,4 @@ class DisputeEvidenceType * Use when uploading evidence as a string. */ public const TRACKING_NUMBER = 'TRACKING_NUMBER'; - - private const _ALL_VALUES = [ - self::GENERIC_EVIDENCE, - self::ONLINE_OR_APP_ACCESS_LOG, - self::AUTHORIZATION_DOCUMENTATION, - self::CANCELLATION_OR_REFUND_DOCUMENTATION, - self::CARDHOLDER_COMMUNICATION, - self::CARDHOLDER_INFORMATION, - self::PURCHASE_ACKNOWLEDGEMENT, - self::DUPLICATE_CHARGE_DOCUMENTATION, - self::PRODUCT_OR_SERVICE_DESCRIPTION, - self::RECEIPT, - self::SERVICE_RECEIVED_DOCUMENTATION, - self::PROOF_OF_DELIVERY_DOCUMENTATION, - self::RELATED_TRANSACTION_DOCUMENTATION, - self::REBUTTAL_EXPLANATION, - self::TRACKING_NUMBER, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/DisputeReason.php b/src/Models/DisputeReason.php index a6f84155..b732f4fc 100644 --- a/src/Models/DisputeReason.php +++ b/src/Models/DisputeReason.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * The list of possible reasons why a cardholder might initiate a * dispute with their bank. @@ -82,32 +78,4 @@ class DisputeReason * For more information, see [What Is EMV?](https://squareup.com/emv) */ public const EMV_LIABILITY_SHIFT = 'EMV_LIABILITY_SHIFT'; - - private const _ALL_VALUES = [ - self::AMOUNT_DIFFERS, - self::CANCELLED, - self::DUPLICATE, - self::NO_KNOWLEDGE, - self::NOT_AS_DESCRIBED, - self::NOT_RECEIVED, - self::PAID_BY_OTHER_MEANS, - self::CUSTOMER_REQUESTS_CREDIT, - self::EMV_LIABILITY_SHIFT, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/DisputeState.php b/src/Models/DisputeState.php index f49ebaf1..cca1eda8 100644 --- a/src/Models/DisputeState.php +++ b/src/Models/DisputeState.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * The list of possible dispute states. */ @@ -52,31 +48,4 @@ class DisputeState * The seller has accepted the dispute */ public const ACCEPTED = 'ACCEPTED'; - - private const _ALL_VALUES = [ - self::INQUIRY_EVIDENCE_REQUIRED, - self::INQUIRY_PROCESSING, - self::INQUIRY_CLOSED, - self::EVIDENCE_REQUIRED, - self::PROCESSING, - self::WON, - self::LOST, - self::ACCEPTED, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/EcomVisibility.php b/src/Models/EcomVisibility.php index d76e6574..b353858f 100644 --- a/src/Models/EcomVisibility.php +++ b/src/Models/EcomVisibility.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Determines item visibility in Ecom (Online Store) and Online Checkout. */ @@ -32,22 +28,4 @@ class EcomVisibility * Item is synced but available within Ecom (Weebly) and Online Checkout but is hidden from Ecom Store. */ public const VISIBLE = 'VISIBLE'; - - private const _ALL_VALUES = [self::UNINDEXED, self::UNAVAILABLE, self::HIDDEN, self::VISIBLE]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/Employee.php b/src/Models/Employee.php index 03f276f6..a77328d7 100644 --- a/src/Models/Employee.php +++ b/src/Models/Employee.php @@ -199,7 +199,6 @@ public function getStatus(): ?string * The status of the Employee being retrieved. * * @maps status - * @factory \Square\Models\EmployeeStatus::checkValue */ public function setStatus(?string $status): void { @@ -301,7 +300,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['location_ids'] = $this->locationIds; } if (isset($this->status)) { - $json['status'] = EmployeeStatus::checkValue($this->status); + $json['status'] = $this->status; } if (isset($this->isOwner)) { $json['is_owner'] = $this->isOwner; diff --git a/src/Models/EmployeeStatus.php b/src/Models/EmployeeStatus.php index 30903b83..85d22e81 100644 --- a/src/Models/EmployeeStatus.php +++ b/src/Models/EmployeeStatus.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * The status of the Employee being retrieved. */ @@ -22,22 +18,4 @@ class EmployeeStatus * Specifies that the employee is in the Inactive state. */ public const INACTIVE = 'INACTIVE'; - - private const _ALL_VALUES = [self::ACTIVE, self::INACTIVE]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/Error.php b/src/Models/Error.php index c29cea44..1413b305 100644 --- a/src/Models/Error.php +++ b/src/Models/Error.php @@ -61,7 +61,6 @@ public function getCategory(): string * * @required * @maps category - * @factory \Square\Models\ErrorCategory::checkValue */ public function setCategory(string $category): void { @@ -85,7 +84,6 @@ public function getCode(): string * * @required * @maps code - * @factory \Square\Models\ErrorCode::checkValue */ public function setCode(string $code): void { @@ -146,8 +144,8 @@ public function setField(?string $field): void public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; - $json['category'] = ErrorCategory::checkValue($this->category); - $json['code'] = ErrorCode::checkValue($this->code); + $json['category'] = $this->category; + $json['code'] = $this->code; if (isset($this->detail)) { $json['detail'] = $this->detail; } diff --git a/src/Models/ErrorCategory.php b/src/Models/ErrorCategory.php index 5d787375..ca7758d7 100644 --- a/src/Models/ErrorCategory.php +++ b/src/Models/ErrorCategory.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates which high-level category of error has occurred during a * request to the Connect API. @@ -32,8 +28,8 @@ class ErrorCategory public const INVALID_REQUEST_ERROR = 'INVALID_REQUEST_ERROR'; /** - * Your application reached the Square API rate limit. You might receive this error if your - * application sends a high number of requests + * Your application reached the Square API rate limit. You might receive this error if your application + * sends a high number of requests * to Square APIs in a short period of time. * * Your application should monitor responses for `429 RATE_LIMITED` errors and use a retry mechanism @@ -59,30 +55,4 @@ class ErrorCategory * An error occurred when checking a merchant subscription status */ public const MERCHANT_SUBSCRIPTION_ERROR = 'MERCHANT_SUBSCRIPTION_ERROR'; - - private const _ALL_VALUES = [ - self::API_ERROR, - self::AUTHENTICATION_ERROR, - self::INVALID_REQUEST_ERROR, - self::RATE_LIMIT_ERROR, - self::PAYMENT_METHOD_ERROR, - self::REFUND_ERROR, - self::MERCHANT_SUBSCRIPTION_ERROR, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/ErrorCode.php b/src/Models/ErrorCode.php index b0224121..0a1b5fb4 100644 --- a/src/Models/ErrorCode.php +++ b/src/Models/ErrorCode.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates the specific error that occurred during a request to a * Square API. @@ -774,161 +770,4 @@ class ErrorCode * Gateway Timeout - a general error occurred. */ public const GATEWAY_TIMEOUT = 'GATEWAY_TIMEOUT'; - - private const _ALL_VALUES = [ - self::INTERNAL_SERVER_ERROR, - self::UNAUTHORIZED, - self::ACCESS_TOKEN_EXPIRED, - self::ACCESS_TOKEN_REVOKED, - self::CLIENT_DISABLED, - self::FORBIDDEN, - self::INSUFFICIENT_SCOPES, - self::APPLICATION_DISABLED, - self::V1_APPLICATION, - self::V1_ACCESSTOKEN, - self::CARD_PROCESSING_NOT_ENABLED, - self::MERCHANT_SUBSCRIPTION_NOT_FOUND, - self::BAD_REQUEST, - self::MISSING_REQUIRED_PARAMETER, - self::INCORRECT_TYPE, - self::INVALID_TIME, - self::INVALID_TIME_RANGE, - self::INVALID_VALUE, - self::INVALID_CURSOR, - self::UNKNOWN_QUERY_PARAMETER, - self::CONFLICTING_PARAMETERS, - self::EXPECTED_JSON_BODY, - self::INVALID_SORT_ORDER, - self::VALUE_REGEX_MISMATCH, - self::VALUE_TOO_SHORT, - self::VALUE_TOO_LONG, - self::VALUE_TOO_LOW, - self::VALUE_TOO_HIGH, - self::VALUE_EMPTY, - self::ARRAY_LENGTH_TOO_LONG, - self::ARRAY_LENGTH_TOO_SHORT, - self::ARRAY_EMPTY, - self::EXPECTED_BOOLEAN, - self::EXPECTED_INTEGER, - self::EXPECTED_FLOAT, - self::EXPECTED_STRING, - self::EXPECTED_OBJECT, - self::EXPECTED_ARRAY, - self::EXPECTED_MAP, - self::EXPECTED_BASE64_ENCODED_BYTE_ARRAY, - self::INVALID_ARRAY_VALUE, - self::INVALID_ENUM_VALUE, - self::INVALID_CONTENT_TYPE, - self::INVALID_FORM_VALUE, - self::CUSTOMER_NOT_FOUND, - self::ONE_INSTRUMENT_EXPECTED, - self::NO_FIELDS_SET, - self::TOO_MANY_MAP_ENTRIES, - self::MAP_KEY_LENGTH_TOO_SHORT, - self::MAP_KEY_LENGTH_TOO_LONG, - self::CUSTOMER_MISSING_NAME, - self::CUSTOMER_MISSING_EMAIL, - self::INVALID_PAUSE_LENGTH, - self::INVALID_DATE, - self::CARD_EXPIRED, - self::INVALID_EXPIRATION, - self::INVALID_EXPIRATION_YEAR, - self::INVALID_EXPIRATION_DATE, - self::UNSUPPORTED_CARD_BRAND, - self::UNSUPPORTED_ENTRY_METHOD, - self::INVALID_ENCRYPTED_CARD, - self::INVALID_CARD, - self::GENERIC_DECLINE, - self::CVV_FAILURE, - self::ADDRESS_VERIFICATION_FAILURE, - self::INVALID_ACCOUNT, - self::CURRENCY_MISMATCH, - self::INSUFFICIENT_FUNDS, - self::INSUFFICIENT_PERMISSIONS, - self::CARDHOLDER_INSUFFICIENT_PERMISSIONS, - self::INVALID_LOCATION, - self::TRANSACTION_LIMIT, - self::VOICE_FAILURE, - self::PAN_FAILURE, - self::EXPIRATION_FAILURE, - self::CARD_NOT_SUPPORTED, - self::INVALID_PIN, - self::MISSING_PIN, - self::MISSING_ACCOUNT_TYPE, - self::INVALID_POSTAL_CODE, - self::INVALID_FEES, - self::MANUALLY_ENTERED_PAYMENT_NOT_SUPPORTED, - self::PAYMENT_LIMIT_EXCEEDED, - self::GIFT_CARD_AVAILABLE_AMOUNT, - self::ACCOUNT_UNUSABLE, - self::BUYER_REFUSED_PAYMENT, - self::DELAYED_TRANSACTION_EXPIRED, - self::DELAYED_TRANSACTION_CANCELED, - self::DELAYED_TRANSACTION_CAPTURED, - self::DELAYED_TRANSACTION_FAILED, - self::CARD_TOKEN_EXPIRED, - self::CARD_TOKEN_USED, - self::AMOUNT_TOO_HIGH, - self::UNSUPPORTED_INSTRUMENT_TYPE, - self::REFUND_AMOUNT_INVALID, - self::REFUND_ALREADY_PENDING, - self::PAYMENT_NOT_REFUNDABLE, - self::REFUND_DECLINED, - self::INVALID_CARD_DATA, - self::SOURCE_USED, - self::SOURCE_EXPIRED, - self::UNSUPPORTED_LOYALTY_REWARD_TIER, - self::LOCATION_MISMATCH, - self::IDEMPOTENCY_KEY_REUSED, - self::UNEXPECTED_VALUE, - self::SANDBOX_NOT_SUPPORTED, - self::INVALID_EMAIL_ADDRESS, - self::INVALID_PHONE_NUMBER, - self::CHECKOUT_EXPIRED, - self::BAD_CERTIFICATE, - self::INVALID_SQUARE_VERSION_FORMAT, - self::API_VERSION_INCOMPATIBLE, - self::CARD_DECLINED, - self::VERIFY_CVV_FAILURE, - self::VERIFY_AVS_FAILURE, - self::CARD_DECLINED_CALL_ISSUER, - self::CARD_DECLINED_VERIFICATION_REQUIRED, - self::BAD_EXPIRATION, - self::CHIP_INSERTION_REQUIRED, - self::ALLOWABLE_PIN_TRIES_EXCEEDED, - self::RESERVATION_DECLINED, - self::UNKNOWN_BODY_PARAMETER, - self::NOT_FOUND, - self::APPLE_PAYMENT_PROCESSING_CERTIFICATE_HASH_NOT_FOUND, - self::METHOD_NOT_ALLOWED, - self::NOT_ACCEPTABLE, - self::REQUEST_TIMEOUT, - self::CONFLICT, - self::GONE, - self::REQUEST_ENTITY_TOO_LARGE, - self::UNSUPPORTED_MEDIA_TYPE, - self::UNPROCESSABLE_ENTITY, - self::RATE_LIMITED, - self::NOT_IMPLEMENTED, - self::BAD_GATEWAY, - self::SERVICE_UNAVAILABLE, - self::TEMPORARY_ERROR, - self::GATEWAY_TIMEOUT, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/ExcludeStrategy.php b/src/Models/ExcludeStrategy.php index 46a6cd0a..7fae3864 100644 --- a/src/Models/ExcludeStrategy.php +++ b/src/Models/ExcludeStrategy.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates which products matched by a CatalogPricingRule * will be excluded if the pricing rule uses an exclude set. @@ -31,22 +27,4 @@ class ExcludeStrategy * This guarantees that the most expensive product is purchased at full price. */ public const MOST_EXPENSIVE = 'MOST_EXPENSIVE'; - - private const _ALL_VALUES = [self::LEAST_EXPENSIVE, self::MOST_EXPENSIVE]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/GiftCard.php b/src/Models/GiftCard.php index 2097324b..cf5f801a 100644 --- a/src/Models/GiftCard.php +++ b/src/Models/GiftCard.php @@ -94,7 +94,6 @@ public function getType(): string * * @required * @maps type - * @factory \Square\Models\GiftCardType::checkValue */ public function setType(string $type): void { @@ -117,7 +116,6 @@ public function getGanSource(): ?string * account number (GAN). * * @maps gan_source - * @factory \Square\Models\GiftCardGANSource::checkValue */ public function setGanSource(?string $ganSource): void { @@ -138,7 +136,6 @@ public function getState(): ?string * Indicates the gift card state. * * @maps state - * @factory \Square\Models\GiftCardStatus::checkValue */ public function setState(?string $state): void { @@ -266,12 +263,12 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (isset($this->id)) { $json['id'] = $this->id; } - $json['type'] = GiftCardType::checkValue($this->type); + $json['type'] = $this->type; if (isset($this->ganSource)) { - $json['gan_source'] = GiftCardGANSource::checkValue($this->ganSource); + $json['gan_source'] = $this->ganSource; } if (isset($this->state)) { - $json['state'] = GiftCardStatus::checkValue($this->state); + $json['state'] = $this->state; } if (isset($this->balanceMoney)) { $json['balance_money'] = $this->balanceMoney; diff --git a/src/Models/GiftCardActivity.php b/src/Models/GiftCardActivity.php index b504717d..47c4680a 100644 --- a/src/Models/GiftCardActivity.php +++ b/src/Models/GiftCardActivity.php @@ -159,7 +159,6 @@ public function getType(): string * * @required * @maps type - * @factory \Square\Models\GiftCardActivityType::checkValue */ public function setType(string $type): void { @@ -568,7 +567,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (isset($this->id)) { $json['id'] = $this->id; } - $json['type'] = GiftCardActivityType::checkValue($this->type); + $json['type'] = $this->type; $json['location_id'] = $this->locationId; if (isset($this->createdAt)) { $json['created_at'] = $this->createdAt; diff --git a/src/Models/GiftCardActivityAdjustDecrement.php b/src/Models/GiftCardActivityAdjustDecrement.php index 34e0cbe8..403fc3ce 100644 --- a/src/Models/GiftCardActivityAdjustDecrement.php +++ b/src/Models/GiftCardActivityAdjustDecrement.php @@ -79,7 +79,6 @@ public function getReason(): string * * @required * @maps reason - * @factory \Square\Models\GiftCardActivityAdjustDecrementReason::checkValue */ public function setReason(string $reason): void { @@ -99,7 +98,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; $json['amount_money'] = $this->amountMoney; - $json['reason'] = GiftCardActivityAdjustDecrementReason::checkValue($this->reason); + $json['reason'] = $this->reason; $json = array_filter($json, function ($val) { return $val !== null; }); diff --git a/src/Models/GiftCardActivityAdjustDecrementReason.php b/src/Models/GiftCardActivityAdjustDecrementReason.php index 65f3da62..f3a7d3d8 100644 --- a/src/Models/GiftCardActivityAdjustDecrementReason.php +++ b/src/Models/GiftCardActivityAdjustDecrementReason.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates the reason for deducting money from a [gift card]($m/GiftCard). */ @@ -28,22 +24,4 @@ class GiftCardActivityAdjustDecrementReason * accommodate support issues. */ public const SUPPORT_ISSUE = 'SUPPORT_ISSUE'; - - private const _ALL_VALUES = [self::SUSPICIOUS_ACTIVITY, self::BALANCE_ACCIDENTALLY_INCREASED, self::SUPPORT_ISSUE]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/GiftCardActivityAdjustIncrement.php b/src/Models/GiftCardActivityAdjustIncrement.php index e589bfe0..6a0e66b8 100644 --- a/src/Models/GiftCardActivityAdjustIncrement.php +++ b/src/Models/GiftCardActivityAdjustIncrement.php @@ -79,7 +79,6 @@ public function getReason(): string * * @required * @maps reason - * @factory \Square\Models\GiftCardActivityAdjustIncrementReason::checkValue */ public function setReason(string $reason): void { @@ -99,7 +98,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; $json['amount_money'] = $this->amountMoney; - $json['reason'] = GiftCardActivityAdjustIncrementReason::checkValue($this->reason); + $json['reason'] = $this->reason; $json = array_filter($json, function ($val) { return $val !== null; }); diff --git a/src/Models/GiftCardActivityAdjustIncrementReason.php b/src/Models/GiftCardActivityAdjustIncrementReason.php index 9836ae94..14e4434f 100644 --- a/src/Models/GiftCardActivityAdjustIncrementReason.php +++ b/src/Models/GiftCardActivityAdjustIncrementReason.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates the reason for adding money to a [gift card]($m/GiftCard). */ @@ -28,22 +24,4 @@ class GiftCardActivityAdjustIncrementReason * The transaction is voided. */ public const TRANSACTION_VOIDED = 'TRANSACTION_VOIDED'; - - private const _ALL_VALUES = [self::COMPLIMENTARY, self::SUPPORT_ISSUE, self::TRANSACTION_VOIDED]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/GiftCardActivityBlockReason.php b/src/Models/GiftCardActivityBlockReason.php index a4548c3e..fbf34cc2 100644 --- a/src/Models/GiftCardActivityBlockReason.php +++ b/src/Models/GiftCardActivityBlockReason.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates the reason for blocking a [gift card]($m/GiftCard). */ @@ -17,22 +13,4 @@ class GiftCardActivityBlockReason * The gift card is blocked because the buyer initiated a chargeback on the gift card purchase. */ public const CHARGEBACK_BLOCK = 'CHARGEBACK_BLOCK'; - - private const _ALL_VALUES = [self::CHARGEBACK_BLOCK]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/GiftCardActivityClearBalance.php b/src/Models/GiftCardActivityClearBalance.php index 3360b953..ad5bc23b 100644 --- a/src/Models/GiftCardActivityClearBalance.php +++ b/src/Models/GiftCardActivityClearBalance.php @@ -39,7 +39,6 @@ public function getReason(): string * * @required * @maps reason - * @factory \Square\Models\GiftCardActivityClearBalanceReason::checkValue */ public function setReason(string $reason): void { @@ -58,7 +57,7 @@ public function setReason(string $reason): void public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; - $json['reason'] = GiftCardActivityClearBalanceReason::checkValue($this->reason); + $json['reason'] = $this->reason; $json = array_filter($json, function ($val) { return $val !== null; }); diff --git a/src/Models/GiftCardActivityClearBalanceReason.php b/src/Models/GiftCardActivityClearBalanceReason.php index 7a3f5168..136a79d9 100644 --- a/src/Models/GiftCardActivityClearBalanceReason.php +++ b/src/Models/GiftCardActivityClearBalanceReason.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates the reason for clearing the balance of a [gift card]($m/GiftCard). */ @@ -27,22 +23,4 @@ class GiftCardActivityClearBalanceReason * The gift card balance was cleared for an unknown reason. */ public const UNKNOWN_REASON = 'UNKNOWN_REASON'; - - private const _ALL_VALUES = [self::SUSPICIOUS_ACTIVITY, self::REUSE_GIFTCARD, self::UNKNOWN_REASON]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/GiftCardActivityDeactivate.php b/src/Models/GiftCardActivityDeactivate.php index 473387eb..179a17b4 100644 --- a/src/Models/GiftCardActivityDeactivate.php +++ b/src/Models/GiftCardActivityDeactivate.php @@ -39,7 +39,6 @@ public function getReason(): string * * @required * @maps reason - * @factory \Square\Models\GiftCardActivityDeactivateReason::checkValue */ public function setReason(string $reason): void { @@ -58,7 +57,7 @@ public function setReason(string $reason): void public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; - $json['reason'] = GiftCardActivityDeactivateReason::checkValue($this->reason); + $json['reason'] = $this->reason; $json = array_filter($json, function ($val) { return $val !== null; }); diff --git a/src/Models/GiftCardActivityDeactivateReason.php b/src/Models/GiftCardActivityDeactivateReason.php index 02bcd207..285c963f 100644 --- a/src/Models/GiftCardActivityDeactivateReason.php +++ b/src/Models/GiftCardActivityDeactivateReason.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates the reason for deactivating a [gift card]($m/GiftCard). */ @@ -27,22 +23,4 @@ class GiftCardActivityDeactivateReason * A chargeback on the gift card purchase (or the gift card load) was ruled in favor of the buyer. */ public const CHARGEBACK_DEACTIVATE = 'CHARGEBACK_DEACTIVATE'; - - private const _ALL_VALUES = [self::SUSPICIOUS_ACTIVITY, self::UNKNOWN_REASON, self::CHARGEBACK_DEACTIVATE]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/GiftCardActivityRedeem.php b/src/Models/GiftCardActivityRedeem.php index 423d01c1..ca6fb538 100644 --- a/src/Models/GiftCardActivityRedeem.php +++ b/src/Models/GiftCardActivityRedeem.php @@ -140,7 +140,6 @@ public function getStatus(): ?string * status. * * @maps status - * @factory \Square\Models\GiftCardActivityRedeemStatus::checkValue */ public function setStatus(?string $status): void { @@ -167,7 +166,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['reference_id'] = $this->referenceId; } if (isset($this->status)) { - $json['status'] = GiftCardActivityRedeemStatus::checkValue($this->status); + $json['status'] = $this->status; } $json = array_filter($json, function ($val) { return $val !== null; diff --git a/src/Models/GiftCardActivityRedeemStatus.php b/src/Models/GiftCardActivityRedeemStatus.php index 2c7e4cc9..872b0d33 100644 --- a/src/Models/GiftCardActivityRedeemStatus.php +++ b/src/Models/GiftCardActivityRedeemStatus.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates the status of a [gift card]($m/GiftCard) redemption. This status is relevant only for * redemptions made from Square products (such as Square Point of Sale) because Square products use a @@ -34,22 +30,4 @@ class GiftCardActivityRedeemStatus * on the gift card is voided. */ public const CANCELED = 'CANCELED'; - - private const _ALL_VALUES = [self::PENDING, self::COMPLETED, self::CANCELED]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/GiftCardActivityType.php b/src/Models/GiftCardActivityType.php index ed36693e..03ea5aaa 100644 --- a/src/Models/GiftCardActivityType.php +++ b/src/Models/GiftCardActivityType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates the type of [gift card activity]($m/GiftCardActivity). */ @@ -93,36 +89,4 @@ class GiftCardActivityType * cannot be created using the Gift Card Activities API. */ public const IMPORT_REVERSAL = 'IMPORT_REVERSAL'; - - private const _ALL_VALUES = [ - self::ACTIVATE, - self::LOAD, - self::REDEEM, - self::CLEAR_BALANCE, - self::DEACTIVATE, - self::ADJUST_INCREMENT, - self::ADJUST_DECREMENT, - self::REFUND, - self::UNLINKED_ACTIVITY_REFUND, - self::IMPORT, - self::BLOCK, - self::UNBLOCK, - self::IMPORT_REVERSAL, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/GiftCardActivityUnblockReason.php b/src/Models/GiftCardActivityUnblockReason.php index 40dacd84..33965124 100644 --- a/src/Models/GiftCardActivityUnblockReason.php +++ b/src/Models/GiftCardActivityUnblockReason.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates the reason for unblocking a [gift card]($m/GiftCard). */ @@ -17,22 +13,4 @@ class GiftCardActivityUnblockReason * The gift card is unblocked because a chargeback was ruled in favor of the seller. */ public const CHARGEBACK_UNBLOCK = 'CHARGEBACK_UNBLOCK'; - - private const _ALL_VALUES = [self::CHARGEBACK_UNBLOCK]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/GiftCardGANSource.php b/src/Models/GiftCardGANSource.php index 0be043ce..ee773bfa 100644 --- a/src/Models/GiftCardGANSource.php +++ b/src/Models/GiftCardGANSource.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates the source that generated the gift card * account number (GAN). @@ -26,22 +22,4 @@ class GiftCardGANSource * party-gift-cards). */ public const OTHER = 'OTHER'; - - private const _ALL_VALUES = [self::SQUARE, self::OTHER]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/GiftCardStatus.php b/src/Models/GiftCardStatus.php index 47e978d5..108fa738 100644 --- a/src/Models/GiftCardStatus.php +++ b/src/Models/GiftCardStatus.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates the gift card state. */ @@ -34,22 +30,4 @@ class GiftCardStatus * before it can be used. */ public const PENDING = 'PENDING'; - - private const _ALL_VALUES = [self::ACTIVE, self::DEACTIVATED, self::BLOCKED, self::PENDING]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/GiftCardType.php b/src/Models/GiftCardType.php index 5abc0299..3a9ea7b6 100644 --- a/src/Models/GiftCardType.php +++ b/src/Models/GiftCardType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates the gift card type. */ @@ -22,22 +18,4 @@ class GiftCardType * A digital gift card. */ public const DIGITAL = 'DIGITAL'; - - private const _ALL_VALUES = [self::PHYSICAL, self::DIGITAL]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/InventoryAdjustment.php b/src/Models/InventoryAdjustment.php index 4b7b9645..66c48019 100644 --- a/src/Models/InventoryAdjustment.php +++ b/src/Models/InventoryAdjustment.php @@ -167,7 +167,6 @@ public function getFromState(): ?string * Indicates the state of a tracked item quantity in the lifecycle of goods. * * @maps from_state - * @factory \Square\Models\InventoryState::checkValue */ public function setFromState(?string $fromState): void { @@ -188,7 +187,6 @@ public function getToState(): ?string * Indicates the state of a tracked item quantity in the lifecycle of goods. * * @maps to_state - * @factory \Square\Models\InventoryState::checkValue */ public function setToState(?string $toState): void { @@ -566,10 +564,10 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['reference_id'] = $this->referenceId; } if (isset($this->fromState)) { - $json['from_state'] = InventoryState::checkValue($this->fromState); + $json['from_state'] = $this->fromState; } if (isset($this->toState)) { - $json['to_state'] = InventoryState::checkValue($this->toState); + $json['to_state'] = $this->toState; } if (isset($this->locationId)) { $json['location_id'] = $this->locationId; diff --git a/src/Models/InventoryAdjustmentGroup.php b/src/Models/InventoryAdjustmentGroup.php index a8b3767e..7ac6d036 100644 --- a/src/Models/InventoryAdjustmentGroup.php +++ b/src/Models/InventoryAdjustmentGroup.php @@ -84,7 +84,6 @@ public function getFromState(): ?string * Indicates the state of a tracked item quantity in the lifecycle of goods. * * @maps from_state - * @factory \Square\Models\InventoryState::checkValue */ public function setFromState(?string $fromState): void { @@ -105,7 +104,6 @@ public function getToState(): ?string * Indicates the state of a tracked item quantity in the lifecycle of goods. * * @maps to_state - * @factory \Square\Models\InventoryState::checkValue */ public function setToState(?string $toState): void { @@ -131,10 +129,10 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['root_adjustment_id'] = $this->rootAdjustmentId; } if (isset($this->fromState)) { - $json['from_state'] = InventoryState::checkValue($this->fromState); + $json['from_state'] = $this->fromState; } if (isset($this->toState)) { - $json['to_state'] = InventoryState::checkValue($this->toState); + $json['to_state'] = $this->toState; } $json = array_filter($json, function ($val) { return $val !== null; diff --git a/src/Models/InventoryAlertType.php b/src/Models/InventoryAlertType.php index 627768e5..23d5452c 100644 --- a/src/Models/InventoryAlertType.php +++ b/src/Models/InventoryAlertType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates whether Square should alert the merchant when the inventory quantity of a * CatalogItemVariation is low. @@ -23,22 +19,4 @@ class InventoryAlertType * The variation generates an alert when its quantity is low. */ public const LOW_QUANTITY = 'LOW_QUANTITY'; - - private const _ALL_VALUES = [self::NONE, self::LOW_QUANTITY]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/InventoryChange.php b/src/Models/InventoryChange.php index b2d4a893..fef01f89 100644 --- a/src/Models/InventoryChange.php +++ b/src/Models/InventoryChange.php @@ -57,7 +57,6 @@ public function getType(): ?string * Indicates how the inventory change was applied to a tracked product quantity. * * @maps type - * @factory \Square\Models\InventoryChangeType::checkValue */ public function setType(?string $type): void { @@ -191,7 +190,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; if (isset($this->type)) { - $json['type'] = InventoryChangeType::checkValue($this->type); + $json['type'] = $this->type; } if (isset($this->physicalCount)) { $json['physical_count'] = $this->physicalCount; diff --git a/src/Models/InventoryChangeType.php b/src/Models/InventoryChangeType.php index 3226c2a4..3321db5e 100644 --- a/src/Models/InventoryChangeType.php +++ b/src/Models/InventoryChangeType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates how the inventory change was applied to a tracked product quantity. */ @@ -28,22 +24,4 @@ class InventoryChangeType * The change occurred as part of an inventory transfer. */ public const TRANSFER = 'TRANSFER'; - - private const _ALL_VALUES = [self::PHYSICAL_COUNT, self::ADJUSTMENT, self::TRANSFER]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/InventoryCount.php b/src/Models/InventoryCount.php index 2581b81d..f593d9a8 100644 --- a/src/Models/InventoryCount.php +++ b/src/Models/InventoryCount.php @@ -114,7 +114,6 @@ public function getState(): ?string * Indicates the state of a tracked item quantity in the lifecycle of goods. * * @maps state - * @factory \Square\Models\InventoryState::checkValue */ public function setState(?string $state): void { @@ -238,7 +237,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['catalog_object_type'] = $this->catalogObjectType; } if (isset($this->state)) { - $json['state'] = InventoryState::checkValue($this->state); + $json['state'] = $this->state; } if (isset($this->locationId)) { $json['location_id'] = $this->locationId; diff --git a/src/Models/InventoryPhysicalCount.php b/src/Models/InventoryPhysicalCount.php index 52152814..29f7b579 100644 --- a/src/Models/InventoryPhysicalCount.php +++ b/src/Models/InventoryPhysicalCount.php @@ -186,7 +186,6 @@ public function getState(): ?string * Indicates the state of a tracked item quantity in the lifecycle of goods. * * @maps state - * @factory \Square\Models\InventoryState::checkValue */ public function setState(?string $state): void { @@ -372,7 +371,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['catalog_object_type'] = $this->catalogObjectType; } if (isset($this->state)) { - $json['state'] = InventoryState::checkValue($this->state); + $json['state'] = $this->state; } if (isset($this->locationId)) { $json['location_id'] = $this->locationId; diff --git a/src/Models/InventoryState.php b/src/Models/InventoryState.php index 9434a143..f679cf63 100644 --- a/src/Models/InventoryState.php +++ b/src/Models/InventoryState.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates the state of a tracked item quantity in the lifecycle of goods. */ @@ -107,38 +103,4 @@ class InventoryState * client to use the appropriate version of the Square API supporting this state. */ public const SUPPORTED_BY_NEWER_VERSION = 'SUPPORTED_BY_NEWER_VERSION'; - - private const _ALL_VALUES = [ - self::CUSTOM, - self::IN_STOCK, - self::SOLD, - self::RETURNED_BY_CUSTOMER, - self::RESERVED_FOR_SALE, - self::SOLD_ONLINE, - self::ORDERED_FROM_VENDOR, - self::RECEIVED_FROM_VENDOR, - self::IN_TRANSIT_TO, - self::NONE, - self::WASTE, - self::UNLINKED_RETURN, - self::COMPOSED, - self::DECOMPOSED, - self::SUPPORTED_BY_NEWER_VERSION, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/InventoryTransfer.php b/src/Models/InventoryTransfer.php index f3b2bd81..137387b2 100644 --- a/src/Models/InventoryTransfer.php +++ b/src/Models/InventoryTransfer.php @@ -135,7 +135,6 @@ public function getState(): ?string * Indicates the state of a tracked item quantity in the lifecycle of goods. * * @maps state - * @factory \Square\Models\InventoryState::checkValue */ public function setState(?string $state): void { @@ -391,7 +390,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['reference_id'] = $this->referenceId; } if (isset($this->state)) { - $json['state'] = InventoryState::checkValue($this->state); + $json['state'] = $this->state; } if (isset($this->fromLocationId)) { $json['from_location_id'] = $this->fromLocationId; diff --git a/src/Models/Invoice.php b/src/Models/Invoice.php index f35ee63e..ac826647 100644 --- a/src/Models/Invoice.php +++ b/src/Models/Invoice.php @@ -321,7 +321,6 @@ public function getDeliveryMethod(): ?string * Indicates how Square delivers the [invoice]($m/Invoice) to the customer. * * @maps delivery_method - * @factory \Square\Models\InvoiceDeliveryMethod::checkValue */ public function setDeliveryMethod(?string $deliveryMethod): void { @@ -494,7 +493,6 @@ public function getStatus(): ?string * Indicates the status of an invoice. * * @maps status - * @factory \Square\Models\InvoiceStatus::checkValue */ public function setStatus(?string $status): void { @@ -742,7 +740,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['payment_requests'] = $this->paymentRequests; } if (isset($this->deliveryMethod)) { - $json['delivery_method'] = InvoiceDeliveryMethod::checkValue($this->deliveryMethod); + $json['delivery_method'] = $this->deliveryMethod; } if (isset($this->invoiceNumber)) { $json['invoice_number'] = $this->invoiceNumber; @@ -763,7 +761,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['next_payment_amount_money'] = $this->nextPaymentAmountMoney; } if (isset($this->status)) { - $json['status'] = InvoiceStatus::checkValue($this->status); + $json['status'] = $this->status; } if (isset($this->timezone)) { $json['timezone'] = $this->timezone; diff --git a/src/Models/InvoiceAutomaticPaymentSource.php b/src/Models/InvoiceAutomaticPaymentSource.php index 51e03ca7..537ace78 100644 --- a/src/Models/InvoiceAutomaticPaymentSource.php +++ b/src/Models/InvoiceAutomaticPaymentSource.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates the automatic payment method for an [invoice payment request]($m/InvoicePaymentRequest). */ @@ -43,22 +39,4 @@ class InvoiceAutomaticPaymentSource * must be `EMAIL`. */ public const BANK_ON_FILE = 'BANK_ON_FILE'; - - private const _ALL_VALUES = [self::NONE, self::CARD_ON_FILE, self::BANK_ON_FILE]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/InvoiceCustomField.php b/src/Models/InvoiceCustomField.php index 95a37cb9..1baec4f3 100644 --- a/src/Models/InvoiceCustomField.php +++ b/src/Models/InvoiceCustomField.php @@ -88,7 +88,6 @@ public function getPlacement(): ?string * copies of the invoice. * * @maps placement - * @factory \Square\Models\InvoiceCustomFieldPlacement::checkValue */ public function setPlacement(?string $placement): void { @@ -114,7 +113,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['value'] = $this->value; } if (isset($this->placement)) { - $json['placement'] = InvoiceCustomFieldPlacement::checkValue($this->placement); + $json['placement'] = $this->placement; } $json = array_filter($json, function ($val) { return $val !== null; diff --git a/src/Models/InvoiceCustomFieldPlacement.php b/src/Models/InvoiceCustomFieldPlacement.php index 30d5b19a..7058c95f 100644 --- a/src/Models/InvoiceCustomFieldPlacement.php +++ b/src/Models/InvoiceCustomFieldPlacement.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates where to render a custom field on the Square-hosted invoice page and in emailed or PDF * copies of the invoice. @@ -23,22 +19,4 @@ class InvoiceCustomFieldPlacement * Render the custom field below the invoice line items. */ public const BELOW_LINE_ITEMS = 'BELOW_LINE_ITEMS'; - - private const _ALL_VALUES = [self::ABOVE_LINE_ITEMS, self::BELOW_LINE_ITEMS]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/InvoiceDeliveryMethod.php b/src/Models/InvoiceDeliveryMethod.php index 4ddafec9..0d3ef7da 100644 --- a/src/Models/InvoiceDeliveryMethod.php +++ b/src/Models/InvoiceDeliveryMethod.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates how Square delivers the [invoice]($m/Invoice) to the customer. */ @@ -34,22 +30,4 @@ class InvoiceDeliveryMethod * delivery method to `EMAIL` or `SHARE_MANUALLY`. */ public const SMS = 'SMS'; - - private const _ALL_VALUES = [self::EMAIL, self::SHARE_MANUALLY, self::SMS]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/InvoicePaymentReminder.php b/src/Models/InvoicePaymentReminder.php index 9e3ffc1b..8201622b 100644 --- a/src/Models/InvoicePaymentReminder.php +++ b/src/Models/InvoicePaymentReminder.php @@ -118,7 +118,6 @@ public function getStatus(): ?string * The status of a payment request reminder. * * @maps status - * @factory \Square\Models\InvoicePaymentReminderStatus::checkValue */ public function setStatus(?string $status): void { @@ -167,7 +166,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['message'] = $this->message; } if (isset($this->status)) { - $json['status'] = InvoicePaymentReminderStatus::checkValue($this->status); + $json['status'] = $this->status; } if (isset($this->sentAt)) { $json['sent_at'] = $this->sentAt; diff --git a/src/Models/InvoicePaymentReminderStatus.php b/src/Models/InvoicePaymentReminderStatus.php index a9e70725..122eb192 100644 --- a/src/Models/InvoicePaymentReminderStatus.php +++ b/src/Models/InvoicePaymentReminderStatus.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * The status of a payment request reminder. */ @@ -36,22 +32,4 @@ class InvoicePaymentReminderStatus * The reminder is sent. */ public const SENT = 'SENT'; - - private const _ALL_VALUES = [self::PENDING, self::NOT_APPLICABLE, self::SENT]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/InvoicePaymentRequest.php b/src/Models/InvoicePaymentRequest.php index 42a52f51..8e9a877a 100644 --- a/src/Models/InvoicePaymentRequest.php +++ b/src/Models/InvoicePaymentRequest.php @@ -122,7 +122,6 @@ public function getRequestMethod(): ?string * `Invoice.delivery_method` and `InvoicePaymentRequest.automatic_payment_source` fields. * * @maps request_method - * @factory \Square\Models\InvoiceRequestMethod::checkValue */ public function setRequestMethod(?string $requestMethod): void { @@ -145,7 +144,6 @@ public function getRequestType(): ?string * [Payment requests](https://developer.squareup.com/docs/invoices-api/overview#payment-requests). * * @maps request_type - * @factory \Square\Models\InvoiceRequestType::checkValue */ public function setRequestType(?string $requestType): void { @@ -298,7 +296,6 @@ public function getAutomaticPaymentSource(): ?string * Indicates the automatic payment method for an [invoice payment request]($m/InvoicePaymentRequest). * * @maps automatic_payment_source - * @factory \Square\Models\InvoiceAutomaticPaymentSource::checkValue */ public function setAutomaticPaymentSource(?string $automaticPaymentSource): void { @@ -465,10 +462,10 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['uid'] = $this->uid; } if (isset($this->requestMethod)) { - $json['request_method'] = InvoiceRequestMethod::checkValue($this->requestMethod); + $json['request_method'] = $this->requestMethod; } if (isset($this->requestType)) { - $json['request_type'] = InvoiceRequestType::checkValue($this->requestType); + $json['request_type'] = $this->requestType; } if (isset($this->dueDate)) { $json['due_date'] = $this->dueDate; @@ -483,10 +480,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['tipping_enabled'] = $this->tippingEnabled; } if (isset($this->automaticPaymentSource)) { - $json['automatic_payment_source'] = - InvoiceAutomaticPaymentSource::checkValue( - $this->automaticPaymentSource - ); + $json['automatic_payment_source'] = $this->automaticPaymentSource; } if (isset($this->cardId)) { $json['card_id'] = $this->cardId; diff --git a/src/Models/InvoiceRequestMethod.php b/src/Models/InvoiceRequestMethod.php index f98848a0..30dd5a10 100644 --- a/src/Models/InvoiceRequestMethod.php +++ b/src/Models/InvoiceRequestMethod.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Specifies the action for Square to take for processing the invoice. For example, * email the invoice, charge a customer's card on file, or do nothing. DEPRECATED at @@ -61,8 +57,7 @@ class InvoiceRequestMethod public const SMS = 'SMS'; /** - * Directs Square to charge the card on file on the `due_date` specified in the payment request and - * to + * Directs Square to charge the card on file on the `due_date` specified in the payment request and to * use SMS (text message) to send invoices and receipts. * * You cannot set `SMS_CHARGE_CARD_ON_FILE` as a request method using the Invoices API. @@ -81,30 +76,4 @@ class InvoiceRequestMethod * You cannot set `SMS_CHARGE_BANK_ON_FILE` as a request method using the Invoices API. */ public const SMS_CHARGE_BANK_ON_FILE = 'SMS_CHARGE_BANK_ON_FILE'; - - private const _ALL_VALUES = [ - self::EMAIL, - self::CHARGE_CARD_ON_FILE, - self::SHARE_MANUALLY, - self::CHARGE_BANK_ON_FILE, - self::SMS, - self::SMS_CHARGE_CARD_ON_FILE, - self::SMS_CHARGE_BANK_ON_FILE, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/InvoiceRequestType.php b/src/Models/InvoiceRequestType.php index 00a5cca2..7abe8708 100644 --- a/src/Models/InvoiceRequestType.php +++ b/src/Models/InvoiceRequestType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates the type of the payment request. For more information, see * [Payment requests](https://developer.squareup.com/docs/invoices-api/overview#payment-requests). @@ -42,22 +38,4 @@ class InvoiceRequestType * subscription). */ public const INSTALLMENT = 'INSTALLMENT'; - - private const _ALL_VALUES = [self::BALANCE, self::DEPOSIT, self::INSTALLMENT]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/InvoiceSort.php b/src/Models/InvoiceSort.php index 55049343..cdbe0a66 100644 --- a/src/Models/InvoiceSort.php +++ b/src/Models/InvoiceSort.php @@ -55,7 +55,6 @@ public function getOrder(): ?string * The order (e.g., chronological or alphabetical) in which results from a request are returned. * * @maps order - * @factory \Square\Models\SortOrder::checkValue */ public function setOrder(?string $order): void { @@ -76,7 +75,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json = []; $json['field'] = $this->field; if (isset($this->order)) { - $json['order'] = SortOrder::checkValue($this->order); + $json['order'] = $this->order; } $json = array_filter($json, function ($val) { return $val !== null; diff --git a/src/Models/InvoiceSortField.php b/src/Models/InvoiceSortField.php index 2fbe28bd..4b1579c5 100644 --- a/src/Models/InvoiceSortField.php +++ b/src/Models/InvoiceSortField.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * The field to use for sorting. */ @@ -21,22 +17,4 @@ class InvoiceSortField * - If the invoice is published, it uses the invoice publication date. */ public const INVOICE_SORT_DATE = 'INVOICE_SORT_DATE'; - - private const _ALL_VALUES = [self::INVOICE_SORT_DATE]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/InvoiceStatus.php b/src/Models/InvoiceStatus.php index 9473e732..266169c6 100644 --- a/src/Models/InvoiceStatus.php +++ b/src/Models/InvoiceStatus.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates the status of an invoice. */ @@ -71,33 +67,4 @@ class InvoiceStatus * When in this state, invoices cannot be updated and other payments cannot be initiated. */ public const PAYMENT_PENDING = 'PAYMENT_PENDING'; - - private const _ALL_VALUES = [ - self::DRAFT, - self::UNPAID, - self::SCHEDULED, - self::PARTIALLY_PAID, - self::PAID, - self::PARTIALLY_REFUNDED, - self::REFUNDED, - self::CANCELED, - self::FAILED, - self::PAYMENT_PENDING, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/ItemVariationLocationOverrides.php b/src/Models/ItemVariationLocationOverrides.php index a4ec17ba..fa6f93bb 100644 --- a/src/Models/ItemVariationLocationOverrides.php +++ b/src/Models/ItemVariationLocationOverrides.php @@ -117,7 +117,6 @@ public function getPricingType(): ?string * Indicates whether the price of a CatalogItemVariation should be entered manually at the time of sale. * * @maps pricing_type - * @factory \Square\Models\CatalogPricingType::checkValue */ public function setPricingType(?string $pricingType): void { @@ -160,7 +159,6 @@ public function getInventoryAlertType(): ?string * CatalogItemVariation is low. * * @maps inventory_alert_type - * @factory \Square\Models\InventoryAlertType::checkValue */ public function setInventoryAlertType(?string $inventoryAlertType): void { @@ -280,13 +278,13 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['price_money'] = $this->priceMoney; } if (isset($this->pricingType)) { - $json['pricing_type'] = CatalogPricingType::checkValue($this->pricingType); + $json['pricing_type'] = $this->pricingType; } if (isset($this->trackInventory)) { $json['track_inventory'] = $this->trackInventory; } if (isset($this->inventoryAlertType)) { - $json['inventory_alert_type'] = InventoryAlertType::checkValue($this->inventoryAlertType); + $json['inventory_alert_type'] = $this->inventoryAlertType; } if (isset($this->inventoryAlertThreshold)) { $json['inventory_alert_threshold'] = $this->inventoryAlertThreshold; diff --git a/src/Models/JobAssignment.php b/src/Models/JobAssignment.php index 267355fe..c0bf9045 100644 --- a/src/Models/JobAssignment.php +++ b/src/Models/JobAssignment.php @@ -82,7 +82,6 @@ public function getPayType(): string * * @required * @maps pay_type - * @factory \Square\Models\JobAssignmentPayType::checkValue */ public function setPayType(string $payType): void { @@ -186,7 +185,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; $json['job_title'] = $this->jobTitle; - $json['pay_type'] = JobAssignmentPayType::checkValue($this->payType); + $json['pay_type'] = $this->payType; if (isset($this->hourlyRate)) { $json['hourly_rate'] = $this->hourlyRate; } diff --git a/src/Models/JobAssignmentPayType.php b/src/Models/JobAssignmentPayType.php index 3d8f3a3d..56f2be58 100644 --- a/src/Models/JobAssignmentPayType.php +++ b/src/Models/JobAssignmentPayType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Enumerates the possible pay types that a job can be assigned. */ @@ -27,22 +23,4 @@ class JobAssignmentPayType * The job pays an annual salary. */ public const SALARY = 'SALARY'; - - private const _ALL_VALUES = [self::NONE, self::HOURLY, self::SALARY]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/ListCardsRequest.php b/src/Models/ListCardsRequest.php index 6003358c..087e40af 100644 --- a/src/Models/ListCardsRequest.php +++ b/src/Models/ListCardsRequest.php @@ -141,7 +141,6 @@ public function getSortOrder(): ?string * The order (e.g., chronological or alphabetical) in which results from a request are returned. * * @maps sort_order - * @factory \Square\Models\SortOrder::checkValue */ public function setSortOrder(?string $sortOrder): void { @@ -173,7 +172,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['reference_id'] = $this->referenceId; } if (isset($this->sortOrder)) { - $json['sort_order'] = SortOrder::checkValue($this->sortOrder); + $json['sort_order'] = $this->sortOrder; } $json = array_filter($json, function ($val) { return $val !== null; diff --git a/src/Models/ListCashDrawerShiftsRequest.php b/src/Models/ListCashDrawerShiftsRequest.php index 9c4f253e..729f099f 100644 --- a/src/Models/ListCashDrawerShiftsRequest.php +++ b/src/Models/ListCashDrawerShiftsRequest.php @@ -81,7 +81,6 @@ public function getSortOrder(): ?string * The order (e.g., chronological or alphabetical) in which results from a request are returned. * * @maps sort_order - * @factory \Square\Models\SortOrder::checkValue */ public function setSortOrder(?string $sortOrder): void { @@ -184,7 +183,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json = []; $json['location_id'] = $this->locationId; if (isset($this->sortOrder)) { - $json['sort_order'] = SortOrder::checkValue($this->sortOrder); + $json['sort_order'] = $this->sortOrder; } if (isset($this->beginTime)) { $json['begin_time'] = $this->beginTime; diff --git a/src/Models/ListCustomerSegmentsResponse.php b/src/Models/ListCustomerSegmentsResponse.php index cf5f3b14..50221ab6 100644 --- a/src/Models/ListCustomerSegmentsResponse.php +++ b/src/Models/ListCustomerSegmentsResponse.php @@ -7,8 +7,8 @@ use stdClass; /** - * Defines the fields that are included in the response body for requests to the - * `ListCustomerSegments` endpoint. + * Defines the fields that are included in the response body for requests to the `ListCustomerSegments` + * endpoint. * * Either `errors` or `segments` is present in a given response (never both). */ diff --git a/src/Models/ListCustomersRequest.php b/src/Models/ListCustomersRequest.php index cf6fa2f3..71860f25 100644 --- a/src/Models/ListCustomersRequest.php +++ b/src/Models/ListCustomersRequest.php @@ -106,7 +106,6 @@ public function getSortField(): ?string * Specifies customer attributes as the sort key to customer profiles returned from a search. * * @maps sort_field - * @factory \Square\Models\CustomerSortField::checkValue */ public function setSortField(?string $sortField): void { @@ -127,7 +126,6 @@ public function getSortOrder(): ?string * The order (e.g., chronological or alphabetical) in which results from a request are returned. * * @maps sort_order - * @factory \Square\Models\SortOrder::checkValue */ public function setSortOrder(?string $sortOrder): void { @@ -153,10 +151,10 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['limit'] = $this->limit; } if (isset($this->sortField)) { - $json['sort_field'] = CustomerSortField::checkValue($this->sortField); + $json['sort_field'] = $this->sortField; } if (isset($this->sortOrder)) { - $json['sort_order'] = SortOrder::checkValue($this->sortOrder); + $json['sort_order'] = $this->sortOrder; } $json = array_filter($json, function ($val) { return $val !== null; diff --git a/src/Models/ListDeviceCodesRequest.php b/src/Models/ListDeviceCodesRequest.php index 65451969..d2b6f09e 100644 --- a/src/Models/ListDeviceCodesRequest.php +++ b/src/Models/ListDeviceCodesRequest.php @@ -90,7 +90,6 @@ public function getProductType(): ?string * Sets Product Type. * * @maps product_type - * @factory \Square\Models\ProductType::checkValue */ public function setProductType(?string $productType): void { @@ -117,7 +116,6 @@ public function getStatus(): ?array * See [DeviceCodeStatus](#type-devicecodestatus) for possible values * * @maps status - * @factory \Square\Models\DeviceCodeStatus::checkValue * * @param string[]|null $status */ @@ -145,10 +143,10 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['location_id'] = $this->locationId; } if (isset($this->productType)) { - $json['product_type'] = ProductType::checkValue($this->productType); + $json['product_type'] = $this->productType; } if (isset($this->status)) { - $json['status'] = DeviceCodeStatus::checkValue($this->status); + $json['status'] = $this->status; } $json = array_filter($json, function ($val) { return $val !== null; diff --git a/src/Models/ListDisputesRequest.php b/src/Models/ListDisputesRequest.php index a5e88e4c..70650791 100644 --- a/src/Models/ListDisputesRequest.php +++ b/src/Models/ListDisputesRequest.php @@ -74,7 +74,6 @@ public function getStates(): ?array * See [DisputeState](#type-disputestate) for possible values * * @maps states - * @factory \Square\Models\DisputeState::checkValue * * @param string[]|null $states */ @@ -125,7 +124,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['cursor'] = $this->cursor; } if (isset($this->states)) { - $json['states'] = DisputeState::checkValue($this->states); + $json['states'] = $this->states; } if (isset($this->locationId)) { $json['location_id'] = $this->locationId; diff --git a/src/Models/ListEmployeesRequest.php b/src/Models/ListEmployeesRequest.php index 0592d78b..388b841c 100644 --- a/src/Models/ListEmployeesRequest.php +++ b/src/Models/ListEmployeesRequest.php @@ -60,7 +60,6 @@ public function getStatus(): ?string * The status of the Employee being retrieved. * * @maps status - * @factory \Square\Models\EmployeeStatus::checkValue */ public function setStatus(?string $status): void { @@ -123,7 +122,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['location_id'] = $this->locationId; } if (isset($this->status)) { - $json['status'] = EmployeeStatus::checkValue($this->status); + $json['status'] = $this->status; } if (isset($this->limit)) { $json['limit'] = $this->limit; diff --git a/src/Models/ListPayoutEntriesRequest.php b/src/Models/ListPayoutEntriesRequest.php index 96bfa4da..43dd85fe 100644 --- a/src/Models/ListPayoutEntriesRequest.php +++ b/src/Models/ListPayoutEntriesRequest.php @@ -37,7 +37,6 @@ public function getSortOrder(): ?string * The order (e.g., chronological or alphabetical) in which results from a request are returned. * * @maps sort_order - * @factory \Square\Models\SortOrder::checkValue */ public function setSortOrder(?string $sortOrder): void { @@ -113,7 +112,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; if (isset($this->sortOrder)) { - $json['sort_order'] = SortOrder::checkValue($this->sortOrder); + $json['sort_order'] = $this->sortOrder; } if (isset($this->cursor)) { $json['cursor'] = $this->cursor; diff --git a/src/Models/ListPayoutsRequest.php b/src/Models/ListPayoutsRequest.php index 03ff9d48..4fabe760 100644 --- a/src/Models/ListPayoutsRequest.php +++ b/src/Models/ListPayoutsRequest.php @@ -82,7 +82,6 @@ public function getStatus(): ?string * Payout status types * * @maps status - * @factory \Square\Models\PayoutStatus::checkValue */ public function setStatus(?string $status): void { @@ -147,7 +146,6 @@ public function getSortOrder(): ?string * The order (e.g., chronological or alphabetical) in which results from a request are returned. * * @maps sort_order - * @factory \Square\Models\SortOrder::checkValue */ public function setSortOrder(?string $sortOrder): void { @@ -226,7 +224,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['location_id'] = $this->locationId; } if (isset($this->status)) { - $json['status'] = PayoutStatus::checkValue($this->status); + $json['status'] = $this->status; } if (isset($this->beginTime)) { $json['begin_time'] = $this->beginTime; @@ -235,7 +233,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['end_time'] = $this->endTime; } if (isset($this->sortOrder)) { - $json['sort_order'] = SortOrder::checkValue($this->sortOrder); + $json['sort_order'] = $this->sortOrder; } if (isset($this->cursor)) { $json['cursor'] = $this->cursor; diff --git a/src/Models/ListRefundsRequest.php b/src/Models/ListRefundsRequest.php index d52931d0..2d772585 100644 --- a/src/Models/ListRefundsRequest.php +++ b/src/Models/ListRefundsRequest.php @@ -108,7 +108,6 @@ public function getSortOrder(): ?string * The order (e.g., chronological or alphabetical) in which results from a request are returned. * * @maps sort_order - * @factory \Square\Models\SortOrder::checkValue */ public function setSortOrder(?string $sortOrder): void { @@ -162,7 +161,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['end_time'] = $this->endTime; } if (isset($this->sortOrder)) { - $json['sort_order'] = SortOrder::checkValue($this->sortOrder); + $json['sort_order'] = $this->sortOrder; } if (isset($this->cursor)) { $json['cursor'] = $this->cursor; diff --git a/src/Models/ListTransactionsRequest.php b/src/Models/ListTransactionsRequest.php index dcfa9b00..6d1c431f 100644 --- a/src/Models/ListTransactionsRequest.php +++ b/src/Models/ListTransactionsRequest.php @@ -108,7 +108,6 @@ public function getSortOrder(): ?string * The order (e.g., chronological or alphabetical) in which results from a request are returned. * * @maps sort_order - * @factory \Square\Models\SortOrder::checkValue */ public function setSortOrder(?string $sortOrder): void { @@ -162,7 +161,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['end_time'] = $this->endTime; } if (isset($this->sortOrder)) { - $json['sort_order'] = SortOrder::checkValue($this->sortOrder); + $json['sort_order'] = $this->sortOrder; } if (isset($this->cursor)) { $json['cursor'] = $this->cursor; diff --git a/src/Models/Location.php b/src/Models/Location.php index 331a12d8..c1ed8b6f 100644 --- a/src/Models/Location.php +++ b/src/Models/Location.php @@ -256,7 +256,6 @@ public function getCapabilities(): ?array * See [LocationCapability](#type-locationcapability) for possible values * * @maps capabilities - * @factory \Square\Models\LocationCapability::checkValue * * @param string[]|null $capabilities */ @@ -279,7 +278,6 @@ public function getStatus(): ?string * A location's status. * * @maps status - * @factory \Square\Models\LocationStatus::checkValue */ public function setStatus(?string $status): void { @@ -346,7 +344,6 @@ public function getCountry(): ?string * Values are in [ISO 3166-1-alpha-2 format](http://www.iso.org/iso/home/standards/country_codes.htm). * * @maps country - * @factory \Square\Models\Country::checkValue */ public function setCountry(?string $country): void { @@ -395,7 +392,6 @@ public function getCurrency(): ?string * to [ISO 4217](https://wikipedia.org/wiki/ISO_4217). * * @maps currency - * @factory \Square\Models\Currency::checkValue */ public function setCurrency(?string $currency): void { @@ -458,7 +454,6 @@ public function getType(): ?string * A location's type. * * @maps type - * @factory \Square\Models\LocationType::checkValue */ public function setType(?string $type): void { @@ -772,10 +767,10 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['timezone'] = $this->timezone; } if (isset($this->capabilities)) { - $json['capabilities'] = LocationCapability::checkValue($this->capabilities); + $json['capabilities'] = $this->capabilities; } if (isset($this->status)) { - $json['status'] = LocationStatus::checkValue($this->status); + $json['status'] = $this->status; } if (isset($this->createdAt)) { $json['created_at'] = $this->createdAt; @@ -784,13 +779,13 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['merchant_id'] = $this->merchantId; } if (isset($this->country)) { - $json['country'] = Country::checkValue($this->country); + $json['country'] = $this->country; } if (isset($this->languageCode)) { $json['language_code'] = $this->languageCode; } if (isset($this->currency)) { - $json['currency'] = Currency::checkValue($this->currency); + $json['currency'] = $this->currency; } if (isset($this->phoneNumber)) { $json['phone_number'] = $this->phoneNumber; @@ -799,7 +794,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['business_name'] = $this->businessName; } if (isset($this->type)) { - $json['type'] = LocationType::checkValue($this->type); + $json['type'] = $this->type; } if (isset($this->websiteUrl)) { $json['website_url'] = $this->websiteUrl; diff --git a/src/Models/LocationCapability.php b/src/Models/LocationCapability.php index a3e51f1b..84daaa90 100644 --- a/src/Models/LocationCapability.php +++ b/src/Models/LocationCapability.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * The capabilities a location might have. */ @@ -22,22 +18,4 @@ class LocationCapability * The capability to receive automatic transfers from Square. */ public const AUTOMATIC_TRANSFERS = 'AUTOMATIC_TRANSFERS'; - - private const _ALL_VALUES = [self::CREDIT_CARD_PROCESSING, self::AUTOMATIC_TRANSFERS]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/LocationStatus.php b/src/Models/LocationStatus.php index 8e4099c7..a21b7247 100644 --- a/src/Models/LocationStatus.php +++ b/src/Models/LocationStatus.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * A location's status. */ @@ -23,22 +19,4 @@ class LocationStatus * information. Hide inactive locations unless the user has requested to see them. */ public const INACTIVE = 'INACTIVE'; - - private const _ALL_VALUES = [self::ACTIVE, self::INACTIVE]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/LocationType.php b/src/Models/LocationType.php index 0a6bd815..3d0918d6 100644 --- a/src/Models/LocationType.php +++ b/src/Models/LocationType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * A location's type. */ @@ -22,22 +18,4 @@ class LocationType * A place of business that is mobile, such as a food truck or online store. */ public const MOBILE = 'MOBILE'; - - private const _ALL_VALUES = [self::PHYSICAL, self::MOBILE]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/LoyaltyAccountMappingType.php b/src/Models/LoyaltyAccountMappingType.php index e1f3a867..632d2a5b 100644 --- a/src/Models/LoyaltyAccountMappingType.php +++ b/src/Models/LoyaltyAccountMappingType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * The type of mapping. */ @@ -17,22 +13,4 @@ class LoyaltyAccountMappingType * The loyalty account is mapped by phone. */ public const PHONE = 'PHONE'; - - private const _ALL_VALUES = [self::PHONE]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/LoyaltyEvent.php b/src/Models/LoyaltyEvent.php index 28e4924b..1af757df 100644 --- a/src/Models/LoyaltyEvent.php +++ b/src/Models/LoyaltyEvent.php @@ -130,7 +130,6 @@ public function getType(): string * * @required * @maps type - * @factory \Square\Models\LoyaltyEventType::checkValue */ public function setType(string $type): void { @@ -314,7 +313,6 @@ public function getSource(): string * * @required * @maps source - * @factory \Square\Models\LoyaltyEventSource::checkValue */ public function setSource(string $source): void { @@ -374,7 +372,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; $json['id'] = $this->id; - $json['type'] = LoyaltyEventType::checkValue($this->type); + $json['type'] = $this->type; $json['created_at'] = $this->createdAt; if (isset($this->accumulatePoints)) { $json['accumulate_points'] = $this->accumulatePoints; @@ -395,7 +393,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (isset($this->locationId)) { $json['location_id'] = $this->locationId; } - $json['source'] = LoyaltyEventSource::checkValue($this->source); + $json['source'] = $this->source; if (isset($this->expirePoints)) { $json['expire_points'] = $this->expirePoints; } diff --git a/src/Models/LoyaltyEventSource.php b/src/Models/LoyaltyEventSource.php index 542a1b23..0c9044a8 100644 --- a/src/Models/LoyaltyEventSource.php +++ b/src/Models/LoyaltyEventSource.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Defines whether the event was generated by the Square Point of Sale. */ @@ -22,22 +18,4 @@ class LoyaltyEventSource * The event is generated by something other than the Square Point of Sale that used the Loyalty API. */ public const LOYALTY_API = 'LOYALTY_API'; - - private const _ALL_VALUES = [self::SQUARE, self::LOYALTY_API]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/LoyaltyEventType.php b/src/Models/LoyaltyEventType.php index d81901b5..ff650994 100644 --- a/src/Models/LoyaltyEventType.php +++ b/src/Models/LoyaltyEventType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * The type of the loyalty event. */ @@ -48,30 +44,4 @@ class LoyaltyEventType * Some other loyalty event occurred. */ public const OTHER = 'OTHER'; - - private const _ALL_VALUES = [ - self::ACCUMULATE_POINTS, - self::CREATE_REWARD, - self::REDEEM_REWARD, - self::DELETE_REWARD, - self::ADJUST_POINTS, - self::EXPIRE_POINTS, - self::OTHER, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/LoyaltyEventTypeFilter.php b/src/Models/LoyaltyEventTypeFilter.php index 06722f95..486545ef 100644 --- a/src/Models/LoyaltyEventTypeFilter.php +++ b/src/Models/LoyaltyEventTypeFilter.php @@ -47,7 +47,6 @@ public function getTypes(): array * * @required * @maps types - * @factory \Square\Models\LoyaltyEventType::checkValue * * @param string[] $types */ @@ -68,7 +67,7 @@ public function setTypes(array $types): void public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; - $json['types'] = LoyaltyEventType::checkValue($this->types); + $json['types'] = $this->types; $json = array_filter($json, function ($val) { return $val !== null; }); diff --git a/src/Models/LoyaltyProgram.php b/src/Models/LoyaltyProgram.php index 579bbfbc..0ac7689b 100644 --- a/src/Models/LoyaltyProgram.php +++ b/src/Models/LoyaltyProgram.php @@ -129,7 +129,6 @@ public function getStatus(): string * * @required * @maps status - * @factory \Square\Models\LoyaltyProgramStatus::checkValue */ public function setStatus(string $status): void { @@ -307,7 +306,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; $json['id'] = $this->id; - $json['status'] = LoyaltyProgramStatus::checkValue($this->status); + $json['status'] = $this->status; $json['reward_tiers'] = $this->rewardTiers; if (isset($this->expirationPolicy)) { $json['expiration_policy'] = $this->expirationPolicy; diff --git a/src/Models/LoyaltyProgramAccrualRule.php b/src/Models/LoyaltyProgramAccrualRule.php index ccad2c56..d3861783 100644 --- a/src/Models/LoyaltyProgramAccrualRule.php +++ b/src/Models/LoyaltyProgramAccrualRule.php @@ -64,7 +64,6 @@ public function getAccrualType(): string * * @required * @maps accrual_type - * @factory \Square\Models\LoyaltyProgramAccrualRuleType::checkValue */ public function setAccrualType(string $accrualType): void { @@ -185,7 +184,7 @@ public function setCategoryData(?LoyaltyProgramAccrualRuleCategoryData $category public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; - $json['accrual_type'] = LoyaltyProgramAccrualRuleType::checkValue($this->accrualType); + $json['accrual_type'] = $this->accrualType; if (isset($this->points)) { $json['points'] = $this->points; } diff --git a/src/Models/LoyaltyProgramAccrualRuleSpendData.php b/src/Models/LoyaltyProgramAccrualRuleSpendData.php index 87165ae6..0852183c 100644 --- a/src/Models/LoyaltyProgramAccrualRuleSpendData.php +++ b/src/Models/LoyaltyProgramAccrualRuleSpendData.php @@ -155,7 +155,6 @@ public function getTaxMode(): string * * @required * @maps tax_mode - * @factory \Square\Models\LoyaltyProgramAccrualRuleTaxMode::checkValue */ public function setTaxMode(string $taxMode): void { @@ -181,7 +180,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (isset($this->excludedItemVariationIds)) { $json['excluded_item_variation_ids'] = $this->excludedItemVariationIds; } - $json['tax_mode'] = LoyaltyProgramAccrualRuleTaxMode::checkValue($this->taxMode); + $json['tax_mode'] = $this->taxMode; $json = array_filter($json, function ($val) { return $val !== null; }); diff --git a/src/Models/LoyaltyProgramAccrualRuleTaxMode.php b/src/Models/LoyaltyProgramAccrualRuleTaxMode.php index 2b928d83..8a974f6f 100644 --- a/src/Models/LoyaltyProgramAccrualRuleTaxMode.php +++ b/src/Models/LoyaltyProgramAccrualRuleTaxMode.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates how taxes should be treated when calculating the purchase amount used for loyalty points * accrual. @@ -25,22 +21,4 @@ class LoyaltyProgramAccrualRuleTaxMode * Include taxes in the purchase amount used for loyalty points accrual. */ public const AFTER_TAX = 'AFTER_TAX'; - - private const _ALL_VALUES = [self::BEFORE_TAX, self::AFTER_TAX]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/LoyaltyProgramAccrualRuleType.php b/src/Models/LoyaltyProgramAccrualRuleType.php index a8977d2a..efb29208 100644 --- a/src/Models/LoyaltyProgramAccrualRuleType.php +++ b/src/Models/LoyaltyProgramAccrualRuleType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * The type of the accrual rule that defines how buyers can earn points. */ @@ -36,22 +32,4 @@ class LoyaltyProgramAccrualRuleType * for purchasing any item in the "hot drink" category: coffee, tea, or hot cocoa. */ public const CATEGORY = 'CATEGORY'; - - private const _ALL_VALUES = [self::VISIT, self::SPEND, self::ITEM_VARIATION, self::CATEGORY]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/LoyaltyProgramAccrualRuleVisitData.php b/src/Models/LoyaltyProgramAccrualRuleVisitData.php index 8d464df6..52ec22e0 100644 --- a/src/Models/LoyaltyProgramAccrualRuleVisitData.php +++ b/src/Models/LoyaltyProgramAccrualRuleVisitData.php @@ -82,7 +82,6 @@ public function getTaxMode(): string * * @required * @maps tax_mode - * @factory \Square\Models\LoyaltyProgramAccrualRuleTaxMode::checkValue */ public function setTaxMode(string $taxMode): void { @@ -104,7 +103,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (isset($this->minimumAmountMoney)) { $json['minimum_amount_money'] = $this->minimumAmountMoney; } - $json['tax_mode'] = LoyaltyProgramAccrualRuleTaxMode::checkValue($this->taxMode); + $json['tax_mode'] = $this->taxMode; $json = array_filter($json, function ($val) { return $val !== null; }); diff --git a/src/Models/LoyaltyProgramRewardDefinition.php b/src/Models/LoyaltyProgramRewardDefinition.php index 27713a38..f556f2ff 100644 --- a/src/Models/LoyaltyProgramRewardDefinition.php +++ b/src/Models/LoyaltyProgramRewardDefinition.php @@ -7,8 +7,7 @@ use stdClass; /** - * Provides details about the reward tier discount. DEPRECATED at version 2020-12-16. Discount - * details + * Provides details about the reward tier discount. DEPRECATED at version 2020-12-16. Discount details * are now defined using a catalog pricing rule and other catalog objects. For more information, see * [Getting discount details for a reward tier](https://developer.squareup.com/docs/loyalty-api/loyalty- * rewards#get-discount-details). @@ -76,7 +75,6 @@ public function getScope(): string * * @required * @maps scope - * @factory \Square\Models\LoyaltyProgramRewardDefinitionScope::checkValue */ public function setScope(string $scope): void { @@ -104,7 +102,6 @@ public function getDiscountType(): string * * @required * @maps discount_type - * @factory \Square\Models\LoyaltyProgramRewardDefinitionType::checkValue */ public function setDiscountType(string $discountType): void { @@ -247,8 +244,8 @@ public function setMaxDiscountMoney(?Money $maxDiscountMoney): void public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; - $json['scope'] = LoyaltyProgramRewardDefinitionScope::checkValue($this->scope); - $json['discount_type'] = LoyaltyProgramRewardDefinitionType::checkValue($this->discountType); + $json['scope'] = $this->scope; + $json['discount_type'] = $this->discountType; if (isset($this->percentageDiscount)) { $json['percentage_discount'] = $this->percentageDiscount; } diff --git a/src/Models/LoyaltyProgramRewardDefinitionScope.php b/src/Models/LoyaltyProgramRewardDefinitionScope.php index 1a04be9c..6a30903d 100644 --- a/src/Models/LoyaltyProgramRewardDefinitionScope.php +++ b/src/Models/LoyaltyProgramRewardDefinitionScope.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates the scope of the reward tier. DEPRECATED at version 2020-12-16. Discount details * are now defined using a catalog pricing rule and other catalog objects. For more information, see @@ -30,22 +26,4 @@ class LoyaltyProgramRewardDefinitionScope * The discount applies only to items in the given categories. */ public const CATEGORY = 'CATEGORY'; - - private const _ALL_VALUES = [self::ORDER, self::ITEM_VARIATION, self::CATEGORY]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/LoyaltyProgramRewardDefinitionType.php b/src/Models/LoyaltyProgramRewardDefinitionType.php index 3dae37ab..122bf88c 100644 --- a/src/Models/LoyaltyProgramRewardDefinitionType.php +++ b/src/Models/LoyaltyProgramRewardDefinitionType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * The type of discount the reward tier offers. DEPRECATED at version 2020-12-16. Discount details * are now defined using a catalog pricing rule and other catalog objects. For more information, see @@ -25,22 +21,4 @@ class LoyaltyProgramRewardDefinitionType * The fixed percentage discounted. */ public const FIXED_PERCENTAGE = 'FIXED_PERCENTAGE'; - - private const _ALL_VALUES = [self::FIXED_AMOUNT, self::FIXED_PERCENTAGE]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/LoyaltyProgramStatus.php b/src/Models/LoyaltyProgramStatus.php index bace8c30..02711639 100644 --- a/src/Models/LoyaltyProgramStatus.php +++ b/src/Models/LoyaltyProgramStatus.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates whether the program is currently active. */ @@ -23,22 +19,4 @@ class LoyaltyProgramStatus * The program is fully functional. The program has an active subscription. */ public const ACTIVE = 'ACTIVE'; - - private const _ALL_VALUES = [self::INACTIVE, self::ACTIVE]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/LoyaltyReward.php b/src/Models/LoyaltyReward.php index ad823f53..d215e8aa 100644 --- a/src/Models/LoyaltyReward.php +++ b/src/Models/LoyaltyReward.php @@ -103,7 +103,6 @@ public function getStatus(): ?string * The status of the loyalty reward. * * @maps status - * @factory \Square\Models\LoyaltyRewardStatus::checkValue */ public function setStatus(?string $status): void { @@ -268,7 +267,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['id'] = $this->id; } if (isset($this->status)) { - $json['status'] = LoyaltyRewardStatus::checkValue($this->status); + $json['status'] = $this->status; } $json['loyalty_account_id'] = $this->loyaltyAccountId; $json['reward_tier_id'] = $this->rewardTierId; diff --git a/src/Models/LoyaltyRewardStatus.php b/src/Models/LoyaltyRewardStatus.php index 6bafe805..410954c8 100644 --- a/src/Models/LoyaltyRewardStatus.php +++ b/src/Models/LoyaltyRewardStatus.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * The status of the loyalty reward. */ @@ -27,22 +23,4 @@ class LoyaltyRewardStatus * The reward is deleted. */ public const DELETED = 'DELETED'; - - private const _ALL_VALUES = [self::ISSUED, self::REDEEMED, self::DELETED]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/MeasurementUnit.php b/src/Models/MeasurementUnit.php index 7a454b43..48467458 100644 --- a/src/Models/MeasurementUnit.php +++ b/src/Models/MeasurementUnit.php @@ -87,7 +87,6 @@ public function getAreaUnit(): ?string * Unit of area used to measure a quantity. * * @maps area_unit - * @factory \Square\Models\MeasurementUnitArea::checkValue */ public function setAreaUnit(?string $areaUnit): void { @@ -108,7 +107,6 @@ public function getLengthUnit(): ?string * The unit of length used to measure a quantity. * * @maps length_unit - * @factory \Square\Models\MeasurementUnitLength::checkValue */ public function setLengthUnit(?string $lengthUnit): void { @@ -129,7 +127,6 @@ public function getVolumeUnit(): ?string * The unit of volume used to measure a quantity. * * @maps volume_unit - * @factory \Square\Models\MeasurementUnitVolume::checkValue */ public function setVolumeUnit(?string $volumeUnit): void { @@ -150,7 +147,6 @@ public function getWeightUnit(): ?string * Unit of weight used to measure a quantity. * * @maps weight_unit - * @factory \Square\Models\MeasurementUnitWeight::checkValue */ public function setWeightUnit(?string $weightUnit): void { @@ -169,7 +165,6 @@ public function getGenericUnit(): ?string * Sets Generic Unit. * * @maps generic_unit - * @factory \Square\Models\MeasurementUnitGeneric::checkValue */ public function setGenericUnit(?string $genericUnit): void { @@ -190,7 +185,6 @@ public function getTimeUnit(): ?string * Unit of time used to measure a quantity (a duration). * * @maps time_unit - * @factory \Square\Models\MeasurementUnitTime::checkValue */ public function setTimeUnit(?string $timeUnit): void { @@ -213,7 +207,6 @@ public function getType(): ?string * ‘open’ enum. * * @maps type - * @factory \Square\Models\MeasurementUnitUnitType::checkValue */ public function setType(?string $type): void { @@ -236,25 +229,25 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['custom_unit'] = $this->customUnit; } if (isset($this->areaUnit)) { - $json['area_unit'] = MeasurementUnitArea::checkValue($this->areaUnit); + $json['area_unit'] = $this->areaUnit; } if (isset($this->lengthUnit)) { - $json['length_unit'] = MeasurementUnitLength::checkValue($this->lengthUnit); + $json['length_unit'] = $this->lengthUnit; } if (isset($this->volumeUnit)) { - $json['volume_unit'] = MeasurementUnitVolume::checkValue($this->volumeUnit); + $json['volume_unit'] = $this->volumeUnit; } if (isset($this->weightUnit)) { - $json['weight_unit'] = MeasurementUnitWeight::checkValue($this->weightUnit); + $json['weight_unit'] = $this->weightUnit; } if (isset($this->genericUnit)) { - $json['generic_unit'] = MeasurementUnitGeneric::checkValue($this->genericUnit); + $json['generic_unit'] = $this->genericUnit; } if (isset($this->timeUnit)) { - $json['time_unit'] = MeasurementUnitTime::checkValue($this->timeUnit); + $json['time_unit'] = $this->timeUnit; } if (isset($this->type)) { - $json['type'] = MeasurementUnitUnitType::checkValue($this->type); + $json['type'] = $this->type; } $json = array_filter($json, function ($val) { return $val !== null; diff --git a/src/Models/MeasurementUnitArea.php b/src/Models/MeasurementUnitArea.php index 19fae674..a192dfca 100644 --- a/src/Models/MeasurementUnitArea.php +++ b/src/Models/MeasurementUnitArea.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Unit of area used to measure a quantity. */ @@ -52,31 +48,4 @@ class MeasurementUnitArea * The area is measured in square kilometers. */ public const METRIC_SQUARE_KILOMETER = 'METRIC_SQUARE_KILOMETER'; - - private const _ALL_VALUES = [ - self::IMPERIAL_ACRE, - self::IMPERIAL_SQUARE_INCH, - self::IMPERIAL_SQUARE_FOOT, - self::IMPERIAL_SQUARE_YARD, - self::IMPERIAL_SQUARE_MILE, - self::METRIC_SQUARE_CENTIMETER, - self::METRIC_SQUARE_METER, - self::METRIC_SQUARE_KILOMETER, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/MeasurementUnitGeneric.php b/src/Models/MeasurementUnitGeneric.php index d45c02d7..9010d2c0 100644 --- a/src/Models/MeasurementUnitGeneric.php +++ b/src/Models/MeasurementUnitGeneric.php @@ -4,32 +4,10 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - class MeasurementUnitGeneric { /** * The generic unit. */ public const UNIT = 'UNIT'; - - private const _ALL_VALUES = [self::UNIT]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/MeasurementUnitLength.php b/src/Models/MeasurementUnitLength.php index 38280110..5fd9332d 100644 --- a/src/Models/MeasurementUnitLength.php +++ b/src/Models/MeasurementUnitLength.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * The unit of length used to measure a quantity. */ @@ -52,31 +48,4 @@ class MeasurementUnitLength * The length is measured in kilometers. */ public const METRIC_KILOMETER = 'METRIC_KILOMETER'; - - private const _ALL_VALUES = [ - self::IMPERIAL_INCH, - self::IMPERIAL_FOOT, - self::IMPERIAL_YARD, - self::IMPERIAL_MILE, - self::METRIC_MILLIMETER, - self::METRIC_CENTIMETER, - self::METRIC_METER, - self::METRIC_KILOMETER, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/MeasurementUnitTime.php b/src/Models/MeasurementUnitTime.php index 28e14e99..e6aae932 100644 --- a/src/Models/MeasurementUnitTime.php +++ b/src/Models/MeasurementUnitTime.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Unit of time used to measure a quantity (a duration). */ @@ -37,28 +33,4 @@ class MeasurementUnitTime * The time is measured in days. */ public const GENERIC_DAY = 'GENERIC_DAY'; - - private const _ALL_VALUES = [ - self::GENERIC_MILLISECOND, - self::GENERIC_SECOND, - self::GENERIC_MINUTE, - self::GENERIC_HOUR, - self::GENERIC_DAY, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/MeasurementUnitUnitType.php b/src/Models/MeasurementUnitUnitType.php index 51e0e72e..36829850 100644 --- a/src/Models/MeasurementUnitUnitType.php +++ b/src/Models/MeasurementUnitUnitType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Describes the type of this unit and indicates which field contains the unit information. This is an * ‘open’ enum. @@ -43,29 +39,4 @@ class MeasurementUnitUnitType * The unit details are contained in the generic_unit field. */ public const TYPE_GENERIC = 'TYPE_GENERIC'; - - private const _ALL_VALUES = [ - self::TYPE_CUSTOM, - self::TYPE_AREA, - self::TYPE_LENGTH, - self::TYPE_VOLUME, - self::TYPE_WEIGHT, - self::TYPE_GENERIC, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/MeasurementUnitVolume.php b/src/Models/MeasurementUnitVolume.php index e5452f19..dd1abf54 100644 --- a/src/Models/MeasurementUnitVolume.php +++ b/src/Models/MeasurementUnitVolume.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * The unit of volume used to measure a quantity. */ @@ -67,34 +63,4 @@ class MeasurementUnitVolume * The volume is measured in metric liters. */ public const METRIC_LITER = 'METRIC_LITER'; - - private const _ALL_VALUES = [ - self::GENERIC_FLUID_OUNCE, - self::GENERIC_SHOT, - self::GENERIC_CUP, - self::GENERIC_PINT, - self::GENERIC_QUART, - self::GENERIC_GALLON, - self::IMPERIAL_CUBIC_INCH, - self::IMPERIAL_CUBIC_FOOT, - self::IMPERIAL_CUBIC_YARD, - self::METRIC_MILLILITER, - self::METRIC_LITER, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/MeasurementUnitWeight.php b/src/Models/MeasurementUnitWeight.php index b655df0f..020b2fca 100644 --- a/src/Models/MeasurementUnitWeight.php +++ b/src/Models/MeasurementUnitWeight.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Unit of weight used to measure a quantity. */ @@ -42,29 +38,4 @@ class MeasurementUnitWeight * The weight is measured in kilograms. */ public const METRIC_KILOGRAM = 'METRIC_KILOGRAM'; - - private const _ALL_VALUES = [ - self::IMPERIAL_WEIGHT_OUNCE, - self::IMPERIAL_POUND, - self::IMPERIAL_STONE, - self::METRIC_MILLIGRAM, - self::METRIC_GRAM, - self::METRIC_KILOGRAM, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/Merchant.php b/src/Models/Merchant.php index 536fb8e1..ebf3aab4 100644 --- a/src/Models/Merchant.php +++ b/src/Models/Merchant.php @@ -116,7 +116,6 @@ public function getCountry(): string * * @required * @maps country - * @factory \Square\Models\Country::checkValue */ public function setCountry(string $country): void { @@ -163,7 +162,6 @@ public function getCurrency(): ?string * to [ISO 4217](https://wikipedia.org/wiki/ISO_4217). * * @maps currency - * @factory \Square\Models\Currency::checkValue */ public function setCurrency(?string $currency): void { @@ -182,7 +180,6 @@ public function getStatus(): ?string * Sets Status. * * @maps status - * @factory \Square\Models\MerchantStatus::checkValue */ public function setStatus(?string $status): void { @@ -253,15 +250,15 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (isset($this->businessName)) { $json['business_name'] = $this->businessName; } - $json['country'] = Country::checkValue($this->country); + $json['country'] = $this->country; if (isset($this->languageCode)) { $json['language_code'] = $this->languageCode; } if (isset($this->currency)) { - $json['currency'] = Currency::checkValue($this->currency); + $json['currency'] = $this->currency; } if (isset($this->status)) { - $json['status'] = MerchantStatus::checkValue($this->status); + $json['status'] = $this->status; } if (isset($this->mainLocationId)) { $json['main_location_id'] = $this->mainLocationId; diff --git a/src/Models/MerchantStatus.php b/src/Models/MerchantStatus.php index dfb09009..0ee45bc0 100644 --- a/src/Models/MerchantStatus.php +++ b/src/Models/MerchantStatus.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - class MerchantStatus { /** @@ -20,22 +16,4 @@ class MerchantStatus * via Square APIs. The merchant cannot log in or access the seller dashboard. */ public const INACTIVE = 'INACTIVE'; - - private const _ALL_VALUES = [self::ACTIVE, self::INACTIVE]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/Money.php b/src/Models/Money.php index 719158da..dd9ab6ea 100644 --- a/src/Models/Money.php +++ b/src/Models/Money.php @@ -69,7 +69,6 @@ public function getCurrency(): ?string * to [ISO 4217](https://wikipedia.org/wiki/ISO_4217). * * @maps currency - * @factory \Square\Models\Currency::checkValue */ public function setCurrency(?string $currency): void { @@ -92,7 +91,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['amount'] = $this->amount; } if (isset($this->currency)) { - $json['currency'] = Currency::checkValue($this->currency); + $json['currency'] = $this->currency; } $json = array_filter($json, function ($val) { return $val !== null; diff --git a/src/Models/Order.php b/src/Models/Order.php index 38bf2316..5e34f282 100644 --- a/src/Models/Order.php +++ b/src/Models/Order.php @@ -733,7 +733,6 @@ public function getState(): ?string * The state of the order. * * @maps state - * @factory \Square\Models\OrderState::checkValue */ public function setState(?string $state): void { @@ -1077,7 +1076,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['closed_at'] = $this->closedAt; } if (isset($this->state)) { - $json['state'] = OrderState::checkValue($this->state); + $json['state'] = $this->state; } if (isset($this->version)) { $json['version'] = $this->version; diff --git a/src/Models/OrderCreated.php b/src/Models/OrderCreated.php index 1c4c3172..760f9656 100644 --- a/src/Models/OrderCreated.php +++ b/src/Models/OrderCreated.php @@ -117,7 +117,6 @@ public function getState(): ?string * The state of the order. * * @maps state - * @factory \Square\Models\OrderState::checkValue */ public function setState(?string $state): void { @@ -166,7 +165,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['location_id'] = $this->locationId; } if (isset($this->state)) { - $json['state'] = OrderState::checkValue($this->state); + $json['state'] = $this->state; } if (isset($this->createdAt)) { $json['created_at'] = $this->createdAt; diff --git a/src/Models/OrderFulfillment.php b/src/Models/OrderFulfillment.php index b0c32530..29582c18 100644 --- a/src/Models/OrderFulfillment.php +++ b/src/Models/OrderFulfillment.php @@ -85,7 +85,6 @@ public function getType(): ?string * The type of fulfillment. * * @maps type - * @factory \Square\Models\OrderFulfillmentType::checkValue */ public function setType(?string $type): void { @@ -106,7 +105,6 @@ public function getState(): ?string * The current state of this fulfillment. * * @maps state - * @factory \Square\Models\OrderFulfillmentState::checkValue */ public function setState(?string $state): void { @@ -129,7 +127,6 @@ public function getLineItemApplication(): ?string * to. It can be `ALL` or `ENTRY_LIST` with a supplied list of fulfillment entries. * * @maps line_item_application - * @factory \Square\Models\OrderFulfillmentFulfillmentLineItemApplication::checkValue */ public function setLineItemApplication(?string $lineItemApplication): void { @@ -294,16 +291,13 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['uid'] = $this->uid; } if (isset($this->type)) { - $json['type'] = OrderFulfillmentType::checkValue($this->type); + $json['type'] = $this->type; } if (isset($this->state)) { - $json['state'] = OrderFulfillmentState::checkValue($this->state); + $json['state'] = $this->state; } if (isset($this->lineItemApplication)) { - $json['line_item_application'] = - OrderFulfillmentFulfillmentLineItemApplication::checkValue( - $this->lineItemApplication - ); + $json['line_item_application'] = $this->lineItemApplication; } if (isset($this->entries)) { $json['entries'] = $this->entries; diff --git a/src/Models/OrderFulfillmentFulfillmentLineItemApplication.php b/src/Models/OrderFulfillmentFulfillmentLineItemApplication.php index 01c0e86f..98f58b26 100644 --- a/src/Models/OrderFulfillmentFulfillmentLineItemApplication.php +++ b/src/Models/OrderFulfillmentFulfillmentLineItemApplication.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * The `line_item_application` describes what order line items this fulfillment applies * to. It can be `ALL` or `ENTRY_LIST` with a supplied list of fulfillment entries. @@ -23,22 +19,4 @@ class OrderFulfillmentFulfillmentLineItemApplication * If `ENTRY_LIST`, supply a list of `entries`. */ public const ENTRY_LIST = 'ENTRY_LIST'; - - private const _ALL_VALUES = [self::ALL, self::ENTRY_LIST]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/OrderFulfillmentPickupDetails.php b/src/Models/OrderFulfillmentPickupDetails.php index b9a05b6c..041653b4 100644 --- a/src/Models/OrderFulfillmentPickupDetails.php +++ b/src/Models/OrderFulfillmentPickupDetails.php @@ -195,7 +195,6 @@ public function getScheduleType(): ?string * The schedule type of the pickup fulfillment. * * @maps schedule_type - * @factory \Square\Models\OrderFulfillmentPickupDetailsScheduleType::checkValue */ public function setScheduleType(?string $scheduleType): void { @@ -555,10 +554,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['auto_complete_duration'] = $this->autoCompleteDuration; } if (isset($this->scheduleType)) { - $json['schedule_type'] = - OrderFulfillmentPickupDetailsScheduleType::checkValue( - $this->scheduleType - ); + $json['schedule_type'] = $this->scheduleType; } if (isset($this->pickupAt)) { $json['pickup_at'] = $this->pickupAt; diff --git a/src/Models/OrderFulfillmentPickupDetailsScheduleType.php b/src/Models/OrderFulfillmentPickupDetailsScheduleType.php index 92bd9761..21430358 100644 --- a/src/Models/OrderFulfillmentPickupDetailsScheduleType.php +++ b/src/Models/OrderFulfillmentPickupDetailsScheduleType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * The schedule type of the pickup fulfillment. */ @@ -23,22 +19,4 @@ class OrderFulfillmentPickupDetailsScheduleType * should be prepared immediately. */ public const ASAP = 'ASAP'; - - private const _ALL_VALUES = [self::SCHEDULED, self::ASAP]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/OrderFulfillmentState.php b/src/Models/OrderFulfillmentState.php index ff3bca0a..2fd40b4c 100644 --- a/src/Models/OrderFulfillmentState.php +++ b/src/Models/OrderFulfillmentState.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * The current state of this fulfillment. */ @@ -43,29 +39,4 @@ class OrderFulfillmentState * canceled. */ public const FAILED = 'FAILED'; - - private const _ALL_VALUES = [ - self::PROPOSED, - self::RESERVED, - self::PREPARED, - self::COMPLETED, - self::CANCELED, - self::FAILED, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/OrderFulfillmentType.php b/src/Models/OrderFulfillmentType.php index 477c5bcd..0aa973e5 100644 --- a/src/Models/OrderFulfillmentType.php +++ b/src/Models/OrderFulfillmentType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * The type of fulfillment. */ @@ -23,22 +19,4 @@ class OrderFulfillmentType * A fulfillment to be shipped by a shipping carrier. */ public const SHIPMENT = 'SHIPMENT'; - - private const _ALL_VALUES = [self::PICKUP, self::SHIPMENT]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/OrderFulfillmentUpdated.php b/src/Models/OrderFulfillmentUpdated.php index d1caef99..c7a7ca58 100644 --- a/src/Models/OrderFulfillmentUpdated.php +++ b/src/Models/OrderFulfillmentUpdated.php @@ -127,7 +127,6 @@ public function getState(): ?string * The state of the order. * * @maps state - * @factory \Square\Models\OrderState::checkValue */ public function setState(?string $state): void { @@ -220,7 +219,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['location_id'] = $this->locationId; } if (isset($this->state)) { - $json['state'] = OrderState::checkValue($this->state); + $json['state'] = $this->state; } if (isset($this->createdAt)) { $json['created_at'] = $this->createdAt; diff --git a/src/Models/OrderFulfillmentUpdatedUpdate.php b/src/Models/OrderFulfillmentUpdatedUpdate.php index 6ef3e7c1..471b72e4 100644 --- a/src/Models/OrderFulfillmentUpdatedUpdate.php +++ b/src/Models/OrderFulfillmentUpdatedUpdate.php @@ -60,7 +60,6 @@ public function getOldState(): ?string * The current state of this fulfillment. * * @maps old_state - * @factory \Square\Models\OrderFulfillmentState::checkValue */ public function setOldState(?string $oldState): void { @@ -81,7 +80,6 @@ public function getNewState(): ?string * The current state of this fulfillment. * * @maps new_state - * @factory \Square\Models\OrderFulfillmentState::checkValue */ public function setNewState(?string $newState): void { @@ -104,10 +102,10 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['fulfillment_uid'] = $this->fulfillmentUid; } if (isset($this->oldState)) { - $json['old_state'] = OrderFulfillmentState::checkValue($this->oldState); + $json['old_state'] = $this->oldState; } if (isset($this->newState)) { - $json['new_state'] = OrderFulfillmentState::checkValue($this->newState); + $json['new_state'] = $this->newState; } $json = array_filter($json, function ($val) { return $val !== null; diff --git a/src/Models/OrderLineItem.php b/src/Models/OrderLineItem.php index 132d27d3..bf99c62c 100644 --- a/src/Models/OrderLineItem.php +++ b/src/Models/OrderLineItem.php @@ -311,7 +311,6 @@ public function getItemType(): ?string * Represents the line item type. * * @maps item_type - * @factory \Square\Models\OrderLineItemItemType::checkValue */ public function setItemType(?string $itemType): void { @@ -741,7 +740,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['variation_name'] = $this->variationName; } if (isset($this->itemType)) { - $json['item_type'] = OrderLineItemItemType::checkValue($this->itemType); + $json['item_type'] = $this->itemType; } if (isset($this->metadata)) { $json['metadata'] = $this->metadata; diff --git a/src/Models/OrderLineItemDiscount.php b/src/Models/OrderLineItemDiscount.php index a28b44bb..a9d71655 100644 --- a/src/Models/OrderLineItemDiscount.php +++ b/src/Models/OrderLineItemDiscount.php @@ -170,7 +170,6 @@ public function getType(): ?string * Indicates how the discount is applied to the associated line item or order. * * @maps type - * @factory \Square\Models\OrderLineItemDiscountType::checkValue */ public function setType(?string $type): void { @@ -339,7 +338,6 @@ public function getScope(): ?string * Indicates whether this is a line-item or order-level discount. * * @maps scope - * @factory \Square\Models\OrderLineItemDiscountScope::checkValue */ public function setScope(?string $scope): void { @@ -429,7 +427,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['name'] = $this->name; } if (isset($this->type)) { - $json['type'] = OrderLineItemDiscountType::checkValue($this->type); + $json['type'] = $this->type; } if (isset($this->percentage)) { $json['percentage'] = $this->percentage; @@ -444,7 +442,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['metadata'] = $this->metadata; } if (isset($this->scope)) { - $json['scope'] = OrderLineItemDiscountScope::checkValue($this->scope); + $json['scope'] = $this->scope; } if (isset($this->rewardIds)) { $json['reward_ids'] = $this->rewardIds; diff --git a/src/Models/OrderLineItemDiscountScope.php b/src/Models/OrderLineItemDiscountScope.php index e5dad89f..e5b0da14 100644 --- a/src/Models/OrderLineItemDiscountScope.php +++ b/src/Models/OrderLineItemDiscountScope.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates whether this is a line-item or order-level discount. */ @@ -29,22 +25,4 @@ class OrderLineItemDiscountScope * The discount should be applied to the entire order. */ public const ORDER = 'ORDER'; - - private const _ALL_VALUES = [self::OTHER_DISCOUNT_SCOPE, self::LINE_ITEM, self::ORDER]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/OrderLineItemDiscountType.php b/src/Models/OrderLineItemDiscountType.php index 948a9ffc..5bc08ebf 100644 --- a/src/Models/OrderLineItemDiscountType.php +++ b/src/Models/OrderLineItemDiscountType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates how the discount is applied to the associated line item or order. */ @@ -45,28 +41,4 @@ class OrderLineItemDiscountType * is assigned at the time of the purchase. */ public const VARIABLE_AMOUNT = 'VARIABLE_AMOUNT'; - - private const _ALL_VALUES = [ - self::UNKNOWN_DISCOUNT, - self::FIXED_PERCENTAGE, - self::FIXED_AMOUNT, - self::VARIABLE_PERCENTAGE, - self::VARIABLE_AMOUNT, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/OrderLineItemItemType.php b/src/Models/OrderLineItemItemType.php index aa7d7ab1..37196580 100644 --- a/src/Models/OrderLineItemItemType.php +++ b/src/Models/OrderLineItemItemType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Represents the line item type. */ @@ -29,22 +25,4 @@ class OrderLineItemItemType * Gift Cards API using the line item `uid`. */ public const GIFT_CARD = 'GIFT_CARD'; - - private const _ALL_VALUES = [self::ITEM, self::CUSTOM_AMOUNT, self::GIFT_CARD]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/OrderLineItemTax.php b/src/Models/OrderLineItemTax.php index 4c93724a..841acae2 100644 --- a/src/Models/OrderLineItemTax.php +++ b/src/Models/OrderLineItemTax.php @@ -159,7 +159,6 @@ public function getType(): ?string * Indicates how the tax is applied to the associated line item or order. * * @maps type - * @factory \Square\Models\OrderLineItemTaxType::checkValue */ public function setType(?string $type): void { @@ -294,7 +293,6 @@ public function getScope(): ?string * Indicates whether this is a line-item or order-level tax. * * @maps scope - * @factory \Square\Models\OrderLineItemTaxScope::checkValue */ public function setScope(?string $scope): void { @@ -352,7 +350,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['name'] = $this->name; } if (isset($this->type)) { - $json['type'] = OrderLineItemTaxType::checkValue($this->type); + $json['type'] = $this->type; } if (isset($this->percentage)) { $json['percentage'] = $this->percentage; @@ -364,7 +362,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['applied_money'] = $this->appliedMoney; } if (isset($this->scope)) { - $json['scope'] = OrderLineItemTaxScope::checkValue($this->scope); + $json['scope'] = $this->scope; } if (isset($this->autoApplied)) { $json['auto_applied'] = $this->autoApplied; diff --git a/src/Models/OrderLineItemTaxScope.php b/src/Models/OrderLineItemTaxScope.php index 053b3d39..ac052ed0 100644 --- a/src/Models/OrderLineItemTaxScope.php +++ b/src/Models/OrderLineItemTaxScope.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates whether this is a line-item or order-level tax. */ @@ -29,22 +25,4 @@ class OrderLineItemTaxScope * The tax should be applied to the entire order. */ public const ORDER = 'ORDER'; - - private const _ALL_VALUES = [self::OTHER_TAX_SCOPE, self::LINE_ITEM, self::ORDER]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/OrderLineItemTaxType.php b/src/Models/OrderLineItemTaxType.php index 043fd538..5763cdb8 100644 --- a/src/Models/OrderLineItemTaxType.php +++ b/src/Models/OrderLineItemTaxType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates how the tax is applied to the associated line item or order. */ @@ -34,22 +30,4 @@ class OrderLineItemTaxType * the buyer. */ public const INCLUSIVE = 'INCLUSIVE'; - - private const _ALL_VALUES = [self::UNKNOWN_TAX, self::ADDITIVE, self::INCLUSIVE]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/OrderReturn.php b/src/Models/OrderReturn.php index 6a8dac8d..f9838000 100644 --- a/src/Models/OrderReturn.php +++ b/src/Models/OrderReturn.php @@ -7,8 +7,8 @@ use stdClass; /** - * The set of line items, service charges, taxes, discounts, tips, and other items being returned in - * an order. + * The set of line items, service charges, taxes, discounts, tips, and other items being returned in an + * order. */ class OrderReturn implements \JsonSerializable { diff --git a/src/Models/OrderReturnDiscount.php b/src/Models/OrderReturnDiscount.php index 3da0d814..aa64a029 100644 --- a/src/Models/OrderReturnDiscount.php +++ b/src/Models/OrderReturnDiscount.php @@ -180,7 +180,6 @@ public function getType(): ?string * Indicates how the discount is applied to the associated line item or order. * * @maps type - * @factory \Square\Models\OrderLineItemDiscountType::checkValue */ public function setType(?string $type): void { @@ -291,7 +290,6 @@ public function getScope(): ?string * Indicates whether this is a line-item or order-level discount. * * @maps scope - * @factory \Square\Models\OrderLineItemDiscountScope::checkValue */ public function setScope(?string $scope): void { @@ -326,7 +324,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['name'] = $this->name; } if (isset($this->type)) { - $json['type'] = OrderLineItemDiscountType::checkValue($this->type); + $json['type'] = $this->type; } if (isset($this->percentage)) { $json['percentage'] = $this->percentage; @@ -338,7 +336,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['applied_money'] = $this->appliedMoney; } if (isset($this->scope)) { - $json['scope'] = OrderLineItemDiscountScope::checkValue($this->scope); + $json['scope'] = $this->scope; } $json = array_filter($json, function ($val) { return $val !== null; diff --git a/src/Models/OrderReturnLineItem.php b/src/Models/OrderReturnLineItem.php index 3b250374..dbfa817e 100644 --- a/src/Models/OrderReturnLineItem.php +++ b/src/Models/OrderReturnLineItem.php @@ -319,7 +319,6 @@ public function getItemType(): ?string * Represents the line item type. * * @maps item_type - * @factory \Square\Models\OrderLineItemItemType::checkValue */ public function setItemType(?string $itemType): void { @@ -640,7 +639,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['variation_name'] = $this->variationName; } if (isset($this->itemType)) { - $json['item_type'] = OrderLineItemItemType::checkValue($this->itemType); + $json['item_type'] = $this->itemType; } if (isset($this->returnModifiers)) { $json['return_modifiers'] = $this->returnModifiers; diff --git a/src/Models/OrderReturnServiceCharge.php b/src/Models/OrderReturnServiceCharge.php index bb8a07ae..0f70a421 100644 --- a/src/Models/OrderReturnServiceCharge.php +++ b/src/Models/OrderReturnServiceCharge.php @@ -358,7 +358,6 @@ public function getCalculationPhase(): ?string * api/how-it-works#how-totals-are-calculated) * * @maps calculation_phase - * @factory \Square\Models\OrderServiceChargeCalculationPhase::checkValue */ public function setCalculationPhase(?string $calculationPhase): void { @@ -462,10 +461,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['total_tax_money'] = $this->totalTaxMoney; } if (isset($this->calculationPhase)) { - $json['calculation_phase'] = - OrderServiceChargeCalculationPhase::checkValue( - $this->calculationPhase - ); + $json['calculation_phase'] = $this->calculationPhase; } if (isset($this->taxable)) { $json['taxable'] = $this->taxable; diff --git a/src/Models/OrderReturnTax.php b/src/Models/OrderReturnTax.php index 151d8b49..70645e92 100644 --- a/src/Models/OrderReturnTax.php +++ b/src/Models/OrderReturnTax.php @@ -174,7 +174,6 @@ public function getType(): ?string * Indicates how the tax is applied to the associated line item or order. * * @maps type - * @factory \Square\Models\OrderLineItemTaxType::checkValue */ public function setType(?string $type): void { @@ -249,7 +248,6 @@ public function getScope(): ?string * Indicates whether this is a line-item or order-level tax. * * @maps scope - * @factory \Square\Models\OrderLineItemTaxScope::checkValue */ public function setScope(?string $scope): void { @@ -284,7 +282,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['name'] = $this->name; } if (isset($this->type)) { - $json['type'] = OrderLineItemTaxType::checkValue($this->type); + $json['type'] = $this->type; } if (isset($this->percentage)) { $json['percentage'] = $this->percentage; @@ -293,7 +291,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['applied_money'] = $this->appliedMoney; } if (isset($this->scope)) { - $json['scope'] = OrderLineItemTaxScope::checkValue($this->scope); + $json['scope'] = $this->scope; } $json = array_filter($json, function ($val) { return $val !== null; diff --git a/src/Models/OrderServiceCharge.php b/src/Models/OrderServiceCharge.php index a5420c32..0a574c35 100644 --- a/src/Models/OrderServiceCharge.php +++ b/src/Models/OrderServiceCharge.php @@ -337,7 +337,6 @@ public function getCalculationPhase(): ?string * api/how-it-works#how-totals-are-calculated) * * @maps calculation_phase - * @factory \Square\Models\OrderServiceChargeCalculationPhase::checkValue */ public function setCalculationPhase(?string $calculationPhase): void { @@ -484,7 +483,6 @@ public function getType(): ?string * Sets Type. * * @maps type - * @factory \Square\Models\OrderServiceChargeType::checkValue */ public function setType(?string $type): void { @@ -531,7 +529,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['total_tax_money'] = $this->totalTaxMoney; } if (isset($this->calculationPhase)) { - $json['calculation_phase'] = OrderServiceChargeCalculationPhase::checkValue($this->calculationPhase); + $json['calculation_phase'] = $this->calculationPhase; } if (isset($this->taxable)) { $json['taxable'] = $this->taxable; @@ -543,7 +541,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['metadata'] = $this->metadata; } if (isset($this->type)) { - $json['type'] = OrderServiceChargeType::checkValue($this->type); + $json['type'] = $this->type; } $json = array_filter($json, function ($val) { return $val !== null; diff --git a/src/Models/OrderServiceChargeCalculationPhase.php b/src/Models/OrderServiceChargeCalculationPhase.php index 263d221a..96d5072c 100644 --- a/src/Models/OrderServiceChargeCalculationPhase.php +++ b/src/Models/OrderServiceChargeCalculationPhase.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Represents a phase in the process of calculating order totals. * Service charges are applied after the indicated phase. @@ -28,22 +24,4 @@ class OrderServiceChargeCalculationPhase * are applied. */ public const TOTAL_PHASE = 'TOTAL_PHASE'; - - private const _ALL_VALUES = [self::SUBTOTAL_PHASE, self::TOTAL_PHASE]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/OrderServiceChargeType.php b/src/Models/OrderServiceChargeType.php index e502d6ff..57582f6c 100644 --- a/src/Models/OrderServiceChargeType.php +++ b/src/Models/OrderServiceChargeType.php @@ -4,31 +4,9 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - class OrderServiceChargeType { public const AUTO_GRATUITY = 'AUTO_GRATUITY'; public const CUSTOM = 'CUSTOM'; - - private const _ALL_VALUES = [self::AUTO_GRATUITY, self::CUSTOM]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/OrderState.php b/src/Models/OrderState.php index 2457ef09..c8f65554 100644 --- a/src/Models/OrderState.php +++ b/src/Models/OrderState.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * The state of the order. */ @@ -35,22 +31,4 @@ class OrderState * orders). */ public const DRAFT = 'DRAFT'; - - private const _ALL_VALUES = [self::OPEN, self::COMPLETED, self::CANCELED, self::DRAFT]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/OrderUpdated.php b/src/Models/OrderUpdated.php index 813504c2..b303dcf4 100644 --- a/src/Models/OrderUpdated.php +++ b/src/Models/OrderUpdated.php @@ -122,7 +122,6 @@ public function getState(): ?string * The state of the order. * * @maps state - * @factory \Square\Models\OrderState::checkValue */ public function setState(?string $state): void { @@ -191,7 +190,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['location_id'] = $this->locationId; } if (isset($this->state)) { - $json['state'] = OrderState::checkValue($this->state); + $json['state'] = $this->state; } if (isset($this->createdAt)) { $json['created_at'] = $this->createdAt; diff --git a/src/Models/PauseSubscriptionRequest.php b/src/Models/PauseSubscriptionRequest.php index 0a083398..6c575813 100644 --- a/src/Models/PauseSubscriptionRequest.php +++ b/src/Models/PauseSubscriptionRequest.php @@ -127,7 +127,6 @@ public function getResumeChangeTiming(): ?string * Supported timings when a pending change, as an action, takes place to a subscription. * * @maps resume_change_timing - * @factory \Square\Models\ChangeTiming::checkValue */ public function setResumeChangeTiming(?string $resumeChangeTiming): void { @@ -176,7 +175,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['resume_effective_date'] = $this->resumeEffectiveDate; } if (isset($this->resumeChangeTiming)) { - $json['resume_change_timing'] = ChangeTiming::checkValue($this->resumeChangeTiming); + $json['resume_change_timing'] = $this->resumeChangeTiming; } if (isset($this->pauseReason)) { $json['pause_reason'] = $this->pauseReason; diff --git a/src/Models/Payout.php b/src/Models/Payout.php index 922417a6..67553f82 100644 --- a/src/Models/Payout.php +++ b/src/Models/Payout.php @@ -112,7 +112,6 @@ public function getStatus(): ?string * Payout status types * * @maps status - * @factory \Square\Models\PayoutStatus::checkValue */ public function setStatus(?string $status): void { @@ -276,7 +275,6 @@ public function getType(): ?string * and will show up as one of the payout entries in a future BATCH payout. * * @maps type - * @factory \Square\Models\PayoutType::checkValue */ public function setType(?string $type): void { @@ -343,7 +341,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json = []; $json['id'] = $this->id; if (isset($this->status)) { - $json['status'] = PayoutStatus::checkValue($this->status); + $json['status'] = $this->status; } $json['location_id'] = $this->locationId; if (isset($this->createdAt)) { @@ -362,7 +360,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['version'] = $this->version; } if (isset($this->type)) { - $json['type'] = PayoutType::checkValue($this->type); + $json['type'] = $this->type; } if (isset($this->payoutFee)) { $json['payout_fee'] = $this->payoutFee; diff --git a/src/Models/PayoutEntry.php b/src/Models/PayoutEntry.php index 5214cae6..243878fd 100644 --- a/src/Models/PayoutEntry.php +++ b/src/Models/PayoutEntry.php @@ -231,7 +231,6 @@ public function getType(): ?string * Sets Type. * * @maps type - * @factory \Square\Models\ActivityType::checkValue */ public function setType(?string $type): void { @@ -725,7 +724,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['effective_at'] = $this->effectiveAt; } if (isset($this->type)) { - $json['type'] = ActivityType::checkValue($this->type); + $json['type'] = $this->type; } if (isset($this->grossAmountMoney)) { $json['gross_amount_money'] = $this->grossAmountMoney; diff --git a/src/Models/PayoutFee.php b/src/Models/PayoutFee.php index 4bdaea4a..792e736c 100644 --- a/src/Models/PayoutFee.php +++ b/src/Models/PayoutFee.php @@ -92,7 +92,6 @@ public function getType(): ?string * Represents the type of payout fee that can incur as part of a payout. * * @maps type - * @factory \Square\Models\PayoutFeeType::checkValue */ public function setType(?string $type): void { @@ -118,7 +117,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['effective_at'] = $this->effectiveAt; } if (isset($this->type)) { - $json['type'] = PayoutFeeType::checkValue($this->type); + $json['type'] = $this->type; } $json = array_filter($json, function ($val) { return $val !== null; diff --git a/src/Models/PayoutFeeType.php b/src/Models/PayoutFeeType.php index 782d95d5..910c75b2 100644 --- a/src/Models/PayoutFeeType.php +++ b/src/Models/PayoutFeeType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Represents the type of payout fee that can incur as part of a payout. */ @@ -22,22 +18,4 @@ class PayoutFeeType * Taxes associated with the transfer fee. */ public const TAX_ON_TRANSFER_FEE = 'TAX_ON_TRANSFER_FEE'; - - private const _ALL_VALUES = [self::TRANSFER_FEE, self::TAX_ON_TRANSFER_FEE]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/PayoutStatus.php b/src/Models/PayoutStatus.php index 8e63767f..c8923238 100644 --- a/src/Models/PayoutStatus.php +++ b/src/Models/PayoutStatus.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Payout status types */ @@ -27,22 +23,4 @@ class PayoutStatus * Indicates that the payout has successfully completed. */ public const PAID = 'PAID'; - - private const _ALL_VALUES = [self::SENT, self::FAILED, self::PAID]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/PayoutType.php b/src/Models/PayoutType.php index d307646f..b032d19a 100644 --- a/src/Models/PayoutType.php +++ b/src/Models/PayoutType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * The type of payout: “BATCH” or “SIMPLE”. * BATCH payouts include a list of payout entries that can be considered settled. @@ -26,22 +22,4 @@ class PayoutType * show up as one of the payout entries in a future BATCH payout. */ public const SIMPLE = 'SIMPLE'; - - private const _ALL_VALUES = [self::BATCH, self::SIMPLE]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/Product.php b/src/Models/Product.php index 8a9db5fa..20658643 100644 --- a/src/Models/Product.php +++ b/src/Models/Product.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates the Square product used to generate a change. */ @@ -62,33 +58,4 @@ class Product * A Square product that does not match any other value. */ public const OTHER = 'OTHER'; - - private const _ALL_VALUES = [ - self::SQUARE_POS, - self::EXTERNAL_API, - self::BILLING, - self::APPOINTMENTS, - self::INVOICES, - self::ONLINE_STORE, - self::PAYROLL, - self::DASHBOARD, - self::ITEM_LIBRARY_IMPORT, - self::OTHER, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/ProductType.php b/src/Models/ProductType.php index f691c676..3011a88d 100644 --- a/src/Models/ProductType.php +++ b/src/Models/ProductType.php @@ -4,29 +4,7 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - class ProductType { public const TERMINAL_API = 'TERMINAL_API'; - - private const _ALL_VALUES = [self::TERMINAL_API]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/Refund.php b/src/Models/Refund.php index ed1eceb1..d766dbde 100644 --- a/src/Models/Refund.php +++ b/src/Models/Refund.php @@ -257,7 +257,6 @@ public function getStatus(): string * * @required * @maps status - * @factory \Square\Models\RefundStatus::checkValue */ public function setStatus(string $status): void { @@ -345,7 +344,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) } $json['reason'] = $this->reason; $json['amount_money'] = $this->amountMoney; - $json['status'] = RefundStatus::checkValue($this->status); + $json['status'] = $this->status; if (isset($this->processingFeeMoney)) { $json['processing_fee_money'] = $this->processingFeeMoney; } diff --git a/src/Models/RefundStatus.php b/src/Models/RefundStatus.php index 4c3c2507..a9094922 100644 --- a/src/Models/RefundStatus.php +++ b/src/Models/RefundStatus.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates a refund's current status. */ @@ -32,22 +28,4 @@ class RefundStatus * The refund failed. */ public const FAILED = 'FAILED'; - - private const _ALL_VALUES = [self::PENDING, self::APPROVED, self::REJECTED, self::FAILED]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/RegisterDomainResponse.php b/src/Models/RegisterDomainResponse.php index 8a08d930..f31fc47d 100644 --- a/src/Models/RegisterDomainResponse.php +++ b/src/Models/RegisterDomainResponse.php @@ -62,7 +62,6 @@ public function getStatus(): ?string * The status of the domain registration. * * @maps status - * @factory \Square\Models\RegisterDomainResponseStatus::checkValue */ public function setStatus(?string $status): void { @@ -85,7 +84,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['errors'] = $this->errors; } if (isset($this->status)) { - $json['status'] = RegisterDomainResponseStatus::checkValue($this->status); + $json['status'] = $this->status; } $json = array_filter($json, function ($val) { return $val !== null; diff --git a/src/Models/RegisterDomainResponseStatus.php b/src/Models/RegisterDomainResponseStatus.php index f89a3c2b..834703c3 100644 --- a/src/Models/RegisterDomainResponseStatus.php +++ b/src/Models/RegisterDomainResponseStatus.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * The status of the domain registration. */ @@ -22,22 +18,4 @@ class RegisterDomainResponseStatus * The domain is added and verified. It can be used to accept Apple Pay transactions. */ public const VERIFIED = 'VERIFIED'; - - private const _ALL_VALUES = [self::PENDING, self::VERIFIED]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/ResumeSubscriptionRequest.php b/src/Models/ResumeSubscriptionRequest.php index 73f7e89b..5f360462 100644 --- a/src/Models/ResumeSubscriptionRequest.php +++ b/src/Models/ResumeSubscriptionRequest.php @@ -56,7 +56,6 @@ public function getResumeChangeTiming(): ?string * Supported timings when a pending change, as an action, takes place to a subscription. * * @maps resume_change_timing - * @factory \Square\Models\ChangeTiming::checkValue */ public function setResumeChangeTiming(?string $resumeChangeTiming): void { @@ -79,7 +78,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['resume_effective_date'] = $this->resumeEffectiveDate; } if (isset($this->resumeChangeTiming)) { - $json['resume_change_timing'] = ChangeTiming::checkValue($this->resumeChangeTiming); + $json['resume_change_timing'] = $this->resumeChangeTiming; } $json = array_filter($json, function ($val) { return $val !== null; diff --git a/src/Models/RetrieveWageSettingResponse.php b/src/Models/RetrieveWageSettingResponse.php index f138026f..1b1c42f8 100644 --- a/src/Models/RetrieveWageSettingResponse.php +++ b/src/Models/RetrieveWageSettingResponse.php @@ -7,8 +7,8 @@ use stdClass; /** - * Represents a response from a retrieve request containing the specified `WageSetting` object or - * error messages. + * Represents a response from a retrieve request containing the specified `WageSetting` object or error + * messages. */ class RetrieveWageSettingResponse implements \JsonSerializable { diff --git a/src/Models/RiskEvaluation.php b/src/Models/RiskEvaluation.php index 1b643888..49f7ff09 100644 --- a/src/Models/RiskEvaluation.php +++ b/src/Models/RiskEvaluation.php @@ -58,7 +58,6 @@ public function getRiskLevel(): ?string * Sets Risk Level. * * @maps risk_level - * @factory \Square\Models\RiskEvaluationRiskLevel::checkValue */ public function setRiskLevel(?string $riskLevel): void { @@ -81,7 +80,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['created_at'] = $this->createdAt; } if (isset($this->riskLevel)) { - $json['risk_level'] = RiskEvaluationRiskLevel::checkValue($this->riskLevel); + $json['risk_level'] = $this->riskLevel; } $json = array_filter($json, function ($val) { return $val !== null; diff --git a/src/Models/RiskEvaluationRiskLevel.php b/src/Models/RiskEvaluationRiskLevel.php index 2800fe98..8d53ba14 100644 --- a/src/Models/RiskEvaluationRiskLevel.php +++ b/src/Models/RiskEvaluationRiskLevel.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - class RiskEvaluationRiskLevel { /** @@ -29,22 +25,4 @@ class RiskEvaluationRiskLevel * Indicates significantly elevated risk level with the payment. */ public const HIGH = 'HIGH'; - - private const _ALL_VALUES = [self::PENDING, self::NORMAL, self::MODERATE, self::HIGH]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/SearchCatalogItemsRequest.php b/src/Models/SearchCatalogItemsRequest.php index 54b009e0..f708ce06 100644 --- a/src/Models/SearchCatalogItemsRequest.php +++ b/src/Models/SearchCatalogItemsRequest.php @@ -124,7 +124,6 @@ public function getStockLevels(): ?array * values * * @maps stock_levels - * @factory \Square\Models\SearchCatalogItemsRequestStockLevel::checkValue * * @param string[]|null $stockLevels */ @@ -215,7 +214,6 @@ public function getSortOrder(): ?string * The order (e.g., chronological or alphabetical) in which results from a request are returned. * * @maps sort_order - * @factory \Square\Models\SortOrder::checkValue */ public function setSortOrder(?string $sortOrder): void { @@ -240,7 +238,6 @@ public function getProductTypes(): ?array * types. * * @maps product_types - * @factory \Square\Models\CatalogItemProductType::checkValue * * @param string[]|null $productTypes */ @@ -296,7 +293,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['category_ids'] = $this->categoryIds; } if (isset($this->stockLevels)) { - $json['stock_levels'] = SearchCatalogItemsRequestStockLevel::checkValue($this->stockLevels); + $json['stock_levels'] = $this->stockLevels; } if (isset($this->enabledLocationIds)) { $json['enabled_location_ids'] = $this->enabledLocationIds; @@ -308,10 +305,10 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['limit'] = $this->limit; } if (isset($this->sortOrder)) { - $json['sort_order'] = SortOrder::checkValue($this->sortOrder); + $json['sort_order'] = $this->sortOrder; } if (isset($this->productTypes)) { - $json['product_types'] = CatalogItemProductType::checkValue($this->productTypes); + $json['product_types'] = $this->productTypes; } if (isset($this->customAttributeFilters)) { $json['custom_attribute_filters'] = $this->customAttributeFilters; diff --git a/src/Models/SearchCatalogItemsRequestStockLevel.php b/src/Models/SearchCatalogItemsRequestStockLevel.php index 07371451..add19443 100644 --- a/src/Models/SearchCatalogItemsRequestStockLevel.php +++ b/src/Models/SearchCatalogItemsRequestStockLevel.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Defines supported stock levels of the item inventory. */ @@ -22,22 +18,4 @@ class SearchCatalogItemsRequestStockLevel * The item inventory is low. */ public const LOW = 'LOW'; - - private const _ALL_VALUES = [self::OUT, self::LOW]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/SearchCatalogObjectsRequest.php b/src/Models/SearchCatalogObjectsRequest.php index e3f2f7df..3866f40e 100644 --- a/src/Models/SearchCatalogObjectsRequest.php +++ b/src/Models/SearchCatalogObjectsRequest.php @@ -99,7 +99,6 @@ public function getObjectTypes(): ?array * SUBSCRIPTION_PLAN, ITEM_OPTION, CUSTOM_ATTRIBUTE_DEFINITION, QUICK_AMOUNT_SETTINGS. * * @maps object_types - * @factory \Square\Models\CatalogObjectType::checkValue * * @param string[]|null $objectTypes */ @@ -322,7 +321,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['cursor'] = $this->cursor; } if (isset($this->objectTypes)) { - $json['object_types'] = CatalogObjectType::checkValue($this->objectTypes); + $json['object_types'] = $this->objectTypes; } if (isset($this->includeDeletedObjects)) { $json['include_deleted_objects'] = $this->includeDeletedObjects; diff --git a/src/Models/SearchLoyaltyRewardsRequestLoyaltyRewardQuery.php b/src/Models/SearchLoyaltyRewardsRequestLoyaltyRewardQuery.php index 881462d5..825c2c08 100644 --- a/src/Models/SearchLoyaltyRewardsRequestLoyaltyRewardQuery.php +++ b/src/Models/SearchLoyaltyRewardsRequestLoyaltyRewardQuery.php @@ -64,7 +64,6 @@ public function getStatus(): ?string * The status of the loyalty reward. * * @maps status - * @factory \Square\Models\LoyaltyRewardStatus::checkValue */ public function setStatus(?string $status): void { @@ -85,7 +84,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json = []; $json['loyalty_account_id'] = $this->loyaltyAccountId; if (isset($this->status)) { - $json['status'] = LoyaltyRewardStatus::checkValue($this->status); + $json['status'] = $this->status; } $json = array_filter($json, function ($val) { return $val !== null; diff --git a/src/Models/SearchOrdersFulfillmentFilter.php b/src/Models/SearchOrdersFulfillmentFilter.php index e0966581..5a40ecbb 100644 --- a/src/Models/SearchOrdersFulfillmentFilter.php +++ b/src/Models/SearchOrdersFulfillmentFilter.php @@ -43,7 +43,6 @@ public function getFulfillmentTypes(): ?array * See [OrderFulfillmentType](#type-orderfulfillmenttype) for possible values * * @maps fulfillment_types - * @factory \Square\Models\OrderFulfillmentType::checkValue * * @param string[]|null $fulfillmentTypes */ @@ -74,7 +73,6 @@ public function getFulfillmentStates(): ?array * See [OrderFulfillmentState](#type-orderfulfillmentstate) for possible values * * @maps fulfillment_states - * @factory \Square\Models\OrderFulfillmentState::checkValue * * @param string[]|null $fulfillmentStates */ @@ -96,10 +94,10 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; if (isset($this->fulfillmentTypes)) { - $json['fulfillment_types'] = OrderFulfillmentType::checkValue($this->fulfillmentTypes); + $json['fulfillment_types'] = $this->fulfillmentTypes; } if (isset($this->fulfillmentStates)) { - $json['fulfillment_states'] = OrderFulfillmentState::checkValue($this->fulfillmentStates); + $json['fulfillment_states'] = $this->fulfillmentStates; } $json = array_filter($json, function ($val) { return $val !== null; diff --git a/src/Models/SearchOrdersSort.php b/src/Models/SearchOrdersSort.php index 0938a021..4bea212b 100644 --- a/src/Models/SearchOrdersSort.php +++ b/src/Models/SearchOrdersSort.php @@ -45,7 +45,6 @@ public function getSortField(): string * * @required * @maps sort_field - * @factory \Square\Models\SearchOrdersSortField::checkValue */ public function setSortField(string $sortField): void { @@ -66,7 +65,6 @@ public function getSortOrder(): ?string * The order (e.g., chronological or alphabetical) in which results from a request are returned. * * @maps sort_order - * @factory \Square\Models\SortOrder::checkValue */ public function setSortOrder(?string $sortOrder): void { @@ -85,9 +83,9 @@ public function setSortOrder(?string $sortOrder): void public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; - $json['sort_field'] = SearchOrdersSortField::checkValue($this->sortField); + $json['sort_field'] = $this->sortField; if (isset($this->sortOrder)) { - $json['sort_order'] = SortOrder::checkValue($this->sortOrder); + $json['sort_order'] = $this->sortOrder; } $json = array_filter($json, function ($val) { return $val !== null; diff --git a/src/Models/SearchOrdersSortField.php b/src/Models/SearchOrdersSortField.php index 7e2ab1dd..fc714217 100644 --- a/src/Models/SearchOrdersSortField.php +++ b/src/Models/SearchOrdersSortField.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Specifies which timestamp to use to sort `SearchOrder` results. */ @@ -34,22 +30,4 @@ class SearchOrdersSortField * field in your `DateTimeFilter`. */ public const CLOSED_AT = 'CLOSED_AT'; - - private const _ALL_VALUES = [self::CREATED_AT, self::UPDATED_AT, self::CLOSED_AT]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/SearchOrdersStateFilter.php b/src/Models/SearchOrdersStateFilter.php index bc6725a1..babe42c9 100644 --- a/src/Models/SearchOrdersStateFilter.php +++ b/src/Models/SearchOrdersStateFilter.php @@ -43,7 +43,6 @@ public function getStates(): array * * @required * @maps states - * @factory \Square\Models\OrderState::checkValue * * @param string[] $states */ @@ -64,7 +63,7 @@ public function setStates(array $states): void public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; - $json['states'] = OrderState::checkValue($this->states); + $json['states'] = $this->states; $json = array_filter($json, function ($val) { return $val !== null; }); diff --git a/src/Models/SearchTeamMembersFilter.php b/src/Models/SearchTeamMembersFilter.php index 1b91a8e6..0387b0b3 100644 --- a/src/Models/SearchTeamMembersFilter.php +++ b/src/Models/SearchTeamMembersFilter.php @@ -72,7 +72,6 @@ public function getStatus(): ?string * Enumerates the possible statuses the team member can have within a business. * * @maps status - * @factory \Square\Models\TeamMemberStatus::checkValue */ public function setStatus(?string $status): void { @@ -115,7 +114,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['location_ids'] = $this->locationIds; } if (isset($this->status)) { - $json['status'] = TeamMemberStatus::checkValue($this->status); + $json['status'] = $this->status; } if (isset($this->isOwner)) { $json['is_owner'] = $this->isOwner; diff --git a/src/Models/SearchVendorsRequestFilter.php b/src/Models/SearchVendorsRequestFilter.php index bbe62271..d7480ae1 100644 --- a/src/Models/SearchVendorsRequestFilter.php +++ b/src/Models/SearchVendorsRequestFilter.php @@ -63,7 +63,6 @@ public function getStatus(): ?array * See [VendorStatus](#type-vendorstatus) for possible values * * @maps status - * @factory \Square\Models\VendorStatus::checkValue * * @param string[]|null $status */ @@ -88,7 +87,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['name'] = $this->name; } if (isset($this->status)) { - $json['status'] = VendorStatus::checkValue($this->status); + $json['status'] = $this->status; } $json = array_filter($json, function ($val) { return $val !== null; diff --git a/src/Models/SearchVendorsRequestSort.php b/src/Models/SearchVendorsRequestSort.php index cb8ce3dc..68e0e805 100644 --- a/src/Models/SearchVendorsRequestSort.php +++ b/src/Models/SearchVendorsRequestSort.php @@ -35,7 +35,6 @@ public function getField(): ?string * The field to sort the returned [Vendor]($m/Vendor) objects by. * * @maps field - * @factory \Square\Models\SearchVendorsRequestSortField::checkValue */ public function setField(?string $field): void { @@ -56,7 +55,6 @@ public function getOrder(): ?string * The order (e.g., chronological or alphabetical) in which results from a request are returned. * * @maps order - * @factory \Square\Models\SortOrder::checkValue */ public function setOrder(?string $order): void { @@ -76,10 +74,10 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; if (isset($this->field)) { - $json['field'] = SearchVendorsRequestSortField::checkValue($this->field); + $json['field'] = $this->field; } if (isset($this->order)) { - $json['order'] = SortOrder::checkValue($this->order); + $json['order'] = $this->order; } $json = array_filter($json, function ($val) { return $val !== null; diff --git a/src/Models/SearchVendorsRequestSortField.php b/src/Models/SearchVendorsRequestSortField.php index 2603289c..a6e86494 100644 --- a/src/Models/SearchVendorsRequestSortField.php +++ b/src/Models/SearchVendorsRequestSortField.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * The field to sort the returned [Vendor]($m/Vendor) objects by. */ @@ -22,22 +18,4 @@ class SearchVendorsRequestSortField * To sort the result by the creation time of the [Vendor]($m/Vendor) objects. */ public const CREATED_AT = 'CREATED_AT'; - - private const _ALL_VALUES = [self::NAME, self::CREATED_AT]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/Shift.php b/src/Models/Shift.php index 7929ba16..b3b31b73 100644 --- a/src/Models/Shift.php +++ b/src/Models/Shift.php @@ -277,7 +277,6 @@ public function getStatus(): ?string * Enumerates the possible status of a `Shift`. * * @maps status - * @factory \Square\Models\ShiftStatus::checkValue */ public function setStatus(?string $status): void { @@ -405,7 +404,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['breaks'] = $this->breaks; } if (isset($this->status)) { - $json['status'] = ShiftStatus::checkValue($this->status); + $json['status'] = $this->status; } if (isset($this->version)) { $json['version'] = $this->version; diff --git a/src/Models/ShiftFilter.php b/src/Models/ShiftFilter.php index e63f3904..89a74c49 100644 --- a/src/Models/ShiftFilter.php +++ b/src/Models/ShiftFilter.php @@ -122,7 +122,6 @@ public function getStatus(): ?string * Specifies the `status` of `Shift` records to be returned. * * @maps status - * @factory \Square\Models\ShiftFilterStatus::checkValue */ public function setStatus(?string $status): void { @@ -249,7 +248,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['employee_ids'] = $this->employeeIds; } if (isset($this->status)) { - $json['status'] = ShiftFilterStatus::checkValue($this->status); + $json['status'] = $this->status; } if (isset($this->start)) { $json['start'] = $this->start; diff --git a/src/Models/ShiftFilterStatus.php b/src/Models/ShiftFilterStatus.php index 3ffc2f7f..bf9fabdb 100644 --- a/src/Models/ShiftFilterStatus.php +++ b/src/Models/ShiftFilterStatus.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Specifies the `status` of `Shift` records to be returned. */ @@ -22,22 +18,4 @@ class ShiftFilterStatus * Shifts that have been started and ended. */ public const CLOSED = 'CLOSED'; - - private const _ALL_VALUES = [self::OPEN, self::CLOSED]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/ShiftSort.php b/src/Models/ShiftSort.php index 74cf40ef..d1400034 100644 --- a/src/Models/ShiftSort.php +++ b/src/Models/ShiftSort.php @@ -35,7 +35,6 @@ public function getField(): ?string * Enumerates the `Shift` fields to sort on. * * @maps field - * @factory \Square\Models\ShiftSortField::checkValue */ public function setField(?string $field): void { @@ -56,7 +55,6 @@ public function getOrder(): ?string * The order (e.g., chronological or alphabetical) in which results from a request are returned. * * @maps order - * @factory \Square\Models\SortOrder::checkValue */ public function setOrder(?string $order): void { @@ -76,10 +74,10 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; if (isset($this->field)) { - $json['field'] = ShiftSortField::checkValue($this->field); + $json['field'] = $this->field; } if (isset($this->order)) { - $json['order'] = SortOrder::checkValue($this->order); + $json['order'] = $this->order; } $json = array_filter($json, function ($val) { return $val !== null; diff --git a/src/Models/ShiftSortField.php b/src/Models/ShiftSortField.php index 12a16c3f..df424cca 100644 --- a/src/Models/ShiftSortField.php +++ b/src/Models/ShiftSortField.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Enumerates the `Shift` fields to sort on. */ @@ -32,22 +28,4 @@ class ShiftSortField * The most recent date/time that a `Shift` is updated */ public const UPDATED_AT = 'UPDATED_AT'; - - private const _ALL_VALUES = [self::START_AT, self::END_AT, self::CREATED_AT, self::UPDATED_AT]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/ShiftStatus.php b/src/Models/ShiftStatus.php index 77028d4e..4451a59e 100644 --- a/src/Models/ShiftStatus.php +++ b/src/Models/ShiftStatus.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Enumerates the possible status of a `Shift`. */ @@ -22,22 +18,4 @@ class ShiftStatus * Employee started and ended a work shift. */ public const CLOSED = 'CLOSED'; - - private const _ALL_VALUES = [self::OPEN, self::CLOSED]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/ShiftWorkday.php b/src/Models/ShiftWorkday.php index 38684dc3..d1c676c9 100644 --- a/src/Models/ShiftWorkday.php +++ b/src/Models/ShiftWorkday.php @@ -63,7 +63,6 @@ public function getMatchShiftsBy(): ?string * Defines the logic used to apply a workday filter. * * @maps match_shifts_by - * @factory \Square\Models\ShiftWorkdayMatcher::checkValue */ public function setMatchShiftsBy(?string $matchShiftsBy): void { @@ -112,7 +111,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['date_range'] = $this->dateRange; } if (isset($this->matchShiftsBy)) { - $json['match_shifts_by'] = ShiftWorkdayMatcher::checkValue($this->matchShiftsBy); + $json['match_shifts_by'] = $this->matchShiftsBy; } if (isset($this->defaultTimezone)) { $json['default_timezone'] = $this->defaultTimezone; diff --git a/src/Models/ShiftWorkdayMatcher.php b/src/Models/ShiftWorkdayMatcher.php index d0b60237..b6b946a2 100644 --- a/src/Models/ShiftWorkdayMatcher.php +++ b/src/Models/ShiftWorkdayMatcher.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Defines the logic used to apply a workday filter. */ @@ -27,22 +23,4 @@ class ShiftWorkdayMatcher * All shifts that start between the start and end workdays (inclusive) */ public const INTERSECTION = 'INTERSECTION'; - - private const _ALL_VALUES = [self::START_AT, self::END_AT, self::INTERSECTION]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/SortOrder.php b/src/Models/SortOrder.php index 269e313d..65856608 100644 --- a/src/Models/SortOrder.php +++ b/src/Models/SortOrder.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * The order (e.g., chronological or alphabetical) in which results from a request are returned. */ @@ -22,22 +18,4 @@ class SortOrder * The results are returned in ascending (e.g., oldest-first or A-Z) order. */ public const ASC = 'ASC'; - - private const _ALL_VALUES = [self::DESC, self::ASC]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/SourceApplication.php b/src/Models/SourceApplication.php index ed1404bd..e52e6bb8 100644 --- a/src/Models/SourceApplication.php +++ b/src/Models/SourceApplication.php @@ -40,7 +40,6 @@ public function getProduct(): ?string * Indicates the Square product used to generate a change. * * @maps product - * @factory \Square\Models\Product::checkValue */ public function setProduct(?string $product): void { @@ -104,7 +103,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; if (isset($this->product)) { - $json['product'] = Product::checkValue($this->product); + $json['product'] = $this->product; } if (isset($this->applicationId)) { $json['application_id'] = $this->applicationId; diff --git a/src/Models/Subscription.php b/src/Models/Subscription.php index 092e816c..3ab30a26 100644 --- a/src/Models/Subscription.php +++ b/src/Models/Subscription.php @@ -280,7 +280,6 @@ public function getStatus(): ?string * Supported subscription statuses. * * @maps status - * @factory \Square\Models\SubscriptionStatus::checkValue */ public function setStatus(?string $status): void { @@ -551,7 +550,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['charged_through_date'] = $this->chargedThroughDate; } if (isset($this->status)) { - $json['status'] = SubscriptionStatus::checkValue($this->status); + $json['status'] = $this->status; } if (isset($this->taxPercentage)) { $json['tax_percentage'] = $this->taxPercentage; diff --git a/src/Models/SubscriptionAction.php b/src/Models/SubscriptionAction.php index 46824451..8012c66e 100644 --- a/src/Models/SubscriptionAction.php +++ b/src/Models/SubscriptionAction.php @@ -65,7 +65,6 @@ public function getType(): ?string * Supported types of an action as a pending change to a subscription. * * @maps type - * @factory \Square\Models\SubscriptionActionType::checkValue */ public function setType(?string $type): void { @@ -128,7 +127,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['id'] = $this->id; } if (isset($this->type)) { - $json['type'] = SubscriptionActionType::checkValue($this->type); + $json['type'] = $this->type; } if (isset($this->effectiveDate)) { $json['effective_date'] = $this->effectiveDate; diff --git a/src/Models/SubscriptionActionType.php b/src/Models/SubscriptionActionType.php index 52a3edd2..6b26800b 100644 --- a/src/Models/SubscriptionActionType.php +++ b/src/Models/SubscriptionActionType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Supported types of an action as a pending change to a subscription. */ @@ -32,22 +28,4 @@ class SubscriptionActionType * The action to execute a scheduled swap of a subscription plan in a subscription. */ public const SWAP_PLAN = 'SWAP_PLAN'; - - private const _ALL_VALUES = [self::CANCEL, self::PAUSE, self::RESUME, self::SWAP_PLAN]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/SubscriptionCadence.php b/src/Models/SubscriptionCadence.php index d48a24f7..1bcdfcde 100644 --- a/src/Models/SubscriptionCadence.php +++ b/src/Models/SubscriptionCadence.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Determines the billing cadence of a [Subscription]($m/Subscription) */ @@ -77,36 +73,4 @@ class SubscriptionCadence * Once every two years */ public const EVERY_TWO_YEARS = 'EVERY_TWO_YEARS'; - - private const _ALL_VALUES = [ - self::DAILY, - self::WEEKLY, - self::EVERY_TWO_WEEKS, - self::THIRTY_DAYS, - self::SIXTY_DAYS, - self::NINETY_DAYS, - self::MONTHLY, - self::EVERY_TWO_MONTHS, - self::QUARTERLY, - self::EVERY_FOUR_MONTHS, - self::EVERY_SIX_MONTHS, - self::ANNUAL, - self::EVERY_TWO_YEARS, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/SubscriptionEvent.php b/src/Models/SubscriptionEvent.php index 14a214d7..4d649d0e 100644 --- a/src/Models/SubscriptionEvent.php +++ b/src/Models/SubscriptionEvent.php @@ -86,7 +86,6 @@ public function getSubscriptionEventType(): string * * @required * @maps subscription_event_type - * @factory \Square\Models\SubscriptionEventSubscriptionEventType::checkValue */ public function setSubscriptionEventType(string $subscriptionEventType): void { @@ -168,10 +167,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; $json['id'] = $this->id; - $json['subscription_event_type'] = - SubscriptionEventSubscriptionEventType::checkValue( - $this->subscriptionEventType - ); + $json['subscription_event_type'] = $this->subscriptionEventType; $json['effective_date'] = $this->effectiveDate; $json['plan_id'] = $this->planId; if (isset($this->info)) { diff --git a/src/Models/SubscriptionEventInfo.php b/src/Models/SubscriptionEventInfo.php index 7bb77df4..40487c72 100644 --- a/src/Models/SubscriptionEventInfo.php +++ b/src/Models/SubscriptionEventInfo.php @@ -55,7 +55,6 @@ public function getCode(): ?string * Supported info codes of a subscription event. * * @maps code - * @factory \Square\Models\SubscriptionEventInfoCode::checkValue */ public function setCode(?string $code): void { @@ -78,7 +77,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['detail'] = $this->detail; } if (isset($this->code)) { - $json['code'] = SubscriptionEventInfoCode::checkValue($this->code); + $json['code'] = $this->code; } $json = array_filter($json, function ($val) { return $val !== null; diff --git a/src/Models/SubscriptionEventInfoCode.php b/src/Models/SubscriptionEventInfoCode.php index f497ca8c..e31e238d 100644 --- a/src/Models/SubscriptionEventInfoCode.php +++ b/src/Models/SubscriptionEventInfoCode.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Supported info codes of a subscription event. */ @@ -42,29 +38,4 @@ class SubscriptionEventInfoCode * User-provided detail. */ public const USER_PROVIDED = 'USER_PROVIDED'; - - private const _ALL_VALUES = [ - self::LOCATION_NOT_ACTIVE, - self::LOCATION_CANNOT_ACCEPT_PAYMENT, - self::CUSTOMER_DELETED, - self::CUSTOMER_NO_EMAIL, - self::CUSTOMER_NO_NAME, - self::USER_PROVIDED, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/SubscriptionEventSubscriptionEventType.php b/src/Models/SubscriptionEventSubscriptionEventType.php index 6cc16f9c..5431beff 100644 --- a/src/Models/SubscriptionEventSubscriptionEventType.php +++ b/src/Models/SubscriptionEventSubscriptionEventType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Supported types of an event occurred to a subscription. */ @@ -42,29 +38,4 @@ class SubscriptionEventSubscriptionEventType * The subscription was paused. */ public const PAUSE_SUBSCRIPTION = 'PAUSE_SUBSCRIPTION'; - - private const _ALL_VALUES = [ - self::START_SUBSCRIPTION, - self::PLAN_CHANGE, - self::STOP_SUBSCRIPTION, - self::DEACTIVATE_SUBSCRIPTION, - self::RESUME_SUBSCRIPTION, - self::PAUSE_SUBSCRIPTION, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/SubscriptionPhase.php b/src/Models/SubscriptionPhase.php index 96d9149e..7047c87c 100644 --- a/src/Models/SubscriptionPhase.php +++ b/src/Models/SubscriptionPhase.php @@ -83,7 +83,6 @@ public function getCadence(): string * * @required * @maps cadence - * @factory \Square\Models\SubscriptionCadence::checkValue */ public function setCadence(string $cadence): void { @@ -181,7 +180,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (isset($this->uid)) { $json['uid'] = $this->uid; } - $json['cadence'] = SubscriptionCadence::checkValue($this->cadence); + $json['cadence'] = $this->cadence; if (isset($this->periods)) { $json['periods'] = $this->periods; } diff --git a/src/Models/SubscriptionStatus.php b/src/Models/SubscriptionStatus.php index 8624aee2..4b23c877 100644 --- a/src/Models/SubscriptionStatus.php +++ b/src/Models/SubscriptionStatus.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Supported subscription statuses. */ @@ -37,22 +33,4 @@ class SubscriptionStatus * The subscription is paused. */ public const PAUSED = 'PAUSED'; - - private const _ALL_VALUES = [self::PENDING, self::ACTIVE, self::CANCELED, self::DEACTIVATED, self::PAUSED]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/TaxCalculationPhase.php b/src/Models/TaxCalculationPhase.php index 88da8eb2..21d7b355 100644 --- a/src/Models/TaxCalculationPhase.php +++ b/src/Models/TaxCalculationPhase.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * When to calculate the taxes due on a cart. */ @@ -22,22 +18,4 @@ class TaxCalculationPhase * The fee is calculated based on the payment's total. */ public const TAX_TOTAL_PHASE = 'TAX_TOTAL_PHASE'; - - private const _ALL_VALUES = [self::TAX_SUBTOTAL_PHASE, self::TAX_TOTAL_PHASE]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/TaxInclusionType.php b/src/Models/TaxInclusionType.php index e5499075..33be2834 100644 --- a/src/Models/TaxInclusionType.php +++ b/src/Models/TaxInclusionType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Whether to the tax amount should be additional to or included in the CatalogItem price. */ @@ -27,22 +23,4 @@ class TaxInclusionType * that total being the cost of the item and $0.09 (9 cents) being tax. */ public const INCLUSIVE = 'INCLUSIVE'; - - private const _ALL_VALUES = [self::ADDITIVE, self::INCLUSIVE]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/TeamMember.php b/src/Models/TeamMember.php index 2a9c3c41..77889013 100644 --- a/src/Models/TeamMember.php +++ b/src/Models/TeamMember.php @@ -140,7 +140,6 @@ public function getStatus(): ?string * Enumerates the possible statuses the team member can have within a business. * * @maps status - * @factory \Square\Models\TeamMemberStatus::checkValue */ public function setStatus(?string $status): void { @@ -317,7 +316,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['is_owner'] = $this->isOwner; } if (isset($this->status)) { - $json['status'] = TeamMemberStatus::checkValue($this->status); + $json['status'] = $this->status; } if (isset($this->givenName)) { $json['given_name'] = $this->givenName; diff --git a/src/Models/TeamMemberAssignedLocations.php b/src/Models/TeamMemberAssignedLocations.php index b3b41762..fa27a3b6 100644 --- a/src/Models/TeamMemberAssignedLocations.php +++ b/src/Models/TeamMemberAssignedLocations.php @@ -35,7 +35,6 @@ public function getAssignmentType(): ?string * Enumerates the possible assignment types that the team member can have. * * @maps assignment_type - * @factory \Square\Models\TeamMemberAssignedLocationsAssignmentType::checkValue */ public function setAssignmentType(?string $assignmentType): void { @@ -79,7 +78,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; if (isset($this->assignmentType)) { - $json['assignment_type'] = TeamMemberAssignedLocationsAssignmentType::checkValue($this->assignmentType); + $json['assignment_type'] = $this->assignmentType; } if (isset($this->locationIds)) { $json['location_ids'] = $this->locationIds; diff --git a/src/Models/TeamMemberAssignedLocationsAssignmentType.php b/src/Models/TeamMemberAssignedLocationsAssignmentType.php index 0757f56c..c433dc1e 100644 --- a/src/Models/TeamMemberAssignedLocationsAssignmentType.php +++ b/src/Models/TeamMemberAssignedLocationsAssignmentType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Enumerates the possible assignment types that the team member can have. */ @@ -24,22 +20,4 @@ class TeamMemberAssignedLocationsAssignmentType * is the list of locations that the team member is assigned to. */ public const EXPLICIT_LOCATIONS = 'EXPLICIT_LOCATIONS'; - - private const _ALL_VALUES = [self::ALL_CURRENT_AND_FUTURE_LOCATIONS, self::EXPLICIT_LOCATIONS]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/TeamMemberInvitationStatus.php b/src/Models/TeamMemberInvitationStatus.php index 8b7b86f5..76aebd29 100644 --- a/src/Models/TeamMemberInvitationStatus.php +++ b/src/Models/TeamMemberInvitationStatus.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Enumerates the possible invitation statuses the team member can have within a business. */ @@ -27,22 +23,4 @@ class TeamMemberInvitationStatus * The team member has both received and accepted an invitation. */ public const ACCEPTED = 'ACCEPTED'; - - private const _ALL_VALUES = [self::UNINVITED, self::PENDING, self::ACCEPTED]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/TeamMemberStatus.php b/src/Models/TeamMemberStatus.php index 398a1327..5d26b77c 100644 --- a/src/Models/TeamMemberStatus.php +++ b/src/Models/TeamMemberStatus.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Enumerates the possible statuses the team member can have within a business. */ @@ -23,22 +19,4 @@ class TeamMemberStatus * but the team member's sales reports remain available. */ public const INACTIVE = 'INACTIVE'; - - private const _ALL_VALUES = [self::ACTIVE, self::INACTIVE]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/Tender.php b/src/Models/Tender.php index aa4e70f4..5b6b5c00 100644 --- a/src/Models/Tender.php +++ b/src/Models/Tender.php @@ -322,7 +322,6 @@ public function getType(): string * * @required * @maps type - * @factory \Square\Models\TenderType::checkValue */ public function setType(string $type): void { @@ -456,7 +455,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (isset($this->customerId)) { $json['customer_id'] = $this->customerId; } - $json['type'] = TenderType::checkValue($this->type); + $json['type'] = $this->type; if (isset($this->cardDetails)) { $json['card_details'] = $this->cardDetails; } diff --git a/src/Models/TenderCardDetails.php b/src/Models/TenderCardDetails.php index 134943b4..6c97b2fc 100644 --- a/src/Models/TenderCardDetails.php +++ b/src/Models/TenderCardDetails.php @@ -40,7 +40,6 @@ public function getStatus(): ?string * Indicates the card transaction's current status. * * @maps status - * @factory \Square\Models\TenderCardDetailsStatus::checkValue */ public function setStatus(?string $status): void { @@ -83,7 +82,6 @@ public function getEntryMethod(): ?string * Indicates the method used to enter the card's details. * * @maps entry_method - * @factory \Square\Models\TenderCardDetailsEntryMethod::checkValue */ public function setEntryMethod(?string $entryMethod): void { @@ -103,13 +101,13 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; if (isset($this->status)) { - $json['status'] = TenderCardDetailsStatus::checkValue($this->status); + $json['status'] = $this->status; } if (isset($this->card)) { $json['card'] = $this->card; } if (isset($this->entryMethod)) { - $json['entry_method'] = TenderCardDetailsEntryMethod::checkValue($this->entryMethod); + $json['entry_method'] = $this->entryMethod; } $json = array_filter($json, function ($val) { return $val !== null; diff --git a/src/Models/TenderCardDetailsEntryMethod.php b/src/Models/TenderCardDetailsEntryMethod.php index 3b77e833..20b8184b 100644 --- a/src/Models/TenderCardDetailsEntryMethod.php +++ b/src/Models/TenderCardDetailsEntryMethod.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates the method used to enter the card's details. */ @@ -39,22 +35,4 @@ class TenderCardDetailsEntryMethod * with a Square reader. */ public const CONTACTLESS = 'CONTACTLESS'; - - private const _ALL_VALUES = [self::SWIPED, self::KEYED, self::EMV, self::ON_FILE, self::CONTACTLESS]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/TenderCardDetailsStatus.php b/src/Models/TenderCardDetailsStatus.php index a645053f..d7f2586d 100644 --- a/src/Models/TenderCardDetailsStatus.php +++ b/src/Models/TenderCardDetailsStatus.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates the card transaction's current status. */ @@ -32,22 +28,4 @@ class TenderCardDetailsStatus * The card transaction failed. */ public const FAILED = 'FAILED'; - - private const _ALL_VALUES = [self::AUTHORIZED, self::CAPTURED, self::VOIDED, self::FAILED]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/TenderType.php b/src/Models/TenderType.php index bce9d93c..ddf64968 100644 --- a/src/Models/TenderType.php +++ b/src/Models/TenderType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates a tender's type. */ @@ -53,30 +49,4 @@ class TenderType * A form of tender that does not match any other value. */ public const OTHER = 'OTHER'; - - private const _ALL_VALUES = [ - self::CARD, - self::CASH, - self::THIRD_PARTY_CARD, - self::SQUARE_GIFT_CARD, - self::NO_SALE, - self::WALLET, - self::OTHER, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/TerminalAction.php b/src/Models/TerminalAction.php index d52e2efd..4b18fdff 100644 --- a/src/Models/TerminalAction.php +++ b/src/Models/TerminalAction.php @@ -174,7 +174,6 @@ public function getCancelReason(): ?string * Sets Cancel Reason. * * @maps cancel_reason - * @factory \Square\Models\ActionCancelReason::checkValue */ public function setCancelReason(?string $cancelReason): void { @@ -257,7 +256,6 @@ public function getType(): ?string * ‘open’ enum. * * @maps type - * @factory \Square\Models\TerminalActionActionType::checkValue */ public function setType(?string $type): void { @@ -327,7 +325,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['status'] = $this->status; } if (isset($this->cancelReason)) { - $json['cancel_reason'] = ActionCancelReason::checkValue($this->cancelReason); + $json['cancel_reason'] = $this->cancelReason; } if (isset($this->createdAt)) { $json['created_at'] = $this->createdAt; @@ -339,7 +337,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['app_id'] = $this->appId; } if (isset($this->type)) { - $json['type'] = TerminalActionActionType::checkValue($this->type); + $json['type'] = $this->type; } if (isset($this->saveCardOptions)) { $json['save_card_options'] = $this->saveCardOptions; diff --git a/src/Models/TerminalActionActionType.php b/src/Models/TerminalActionActionType.php index 987cb230..f32d31c5 100644 --- a/src/Models/TerminalActionActionType.php +++ b/src/Models/TerminalActionActionType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Describes the type of this unit and indicates which field contains the unit information. This is an * ‘open’ enum. @@ -24,22 +20,4 @@ class TerminalActionActionType * Represents a request to save a card for future card-on-file use. */ public const SAVE_CARD = 'SAVE_CARD'; - - private const _ALL_VALUES = [self::PING, self::SAVE_CARD]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/TerminalActionQueryFilter.php b/src/Models/TerminalActionQueryFilter.php index a4302289..0210f212 100644 --- a/src/Models/TerminalActionQueryFilter.php +++ b/src/Models/TerminalActionQueryFilter.php @@ -116,7 +116,6 @@ public function getType(): ?string * ‘open’ enum. * * @maps type - * @factory \Square\Models\TerminalActionActionType::checkValue */ public function setType(?string $type): void { @@ -145,7 +144,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['status'] = $this->status; } if (isset($this->type)) { - $json['type'] = TerminalActionActionType::checkValue($this->type); + $json['type'] = $this->type; } $json = array_filter($json, function ($val) { return $val !== null; diff --git a/src/Models/TerminalActionQuerySort.php b/src/Models/TerminalActionQuerySort.php index bf336e0b..eab37814 100644 --- a/src/Models/TerminalActionQuerySort.php +++ b/src/Models/TerminalActionQuerySort.php @@ -27,7 +27,6 @@ public function getSortOrder(): ?string * The order (e.g., chronological or alphabetical) in which results from a request are returned. * * @maps sort_order - * @factory \Square\Models\SortOrder::checkValue */ public function setSortOrder(?string $sortOrder): void { @@ -47,7 +46,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; if (isset($this->sortOrder)) { - $json['sort_order'] = SortOrder::checkValue($this->sortOrder); + $json['sort_order'] = $this->sortOrder; } $json = array_filter($json, function ($val) { return $val !== null; diff --git a/src/Models/TerminalCheckout.php b/src/Models/TerminalCheckout.php index ca713767..6ac86b78 100644 --- a/src/Models/TerminalCheckout.php +++ b/src/Models/TerminalCheckout.php @@ -337,7 +337,6 @@ public function getCancelReason(): ?string * Sets Cancel Reason. * * @maps cancel_reason - * @factory \Square\Models\ActionCancelReason::checkValue */ public function setCancelReason(?string $cancelReason): void { @@ -460,7 +459,6 @@ public function getPaymentType(): ?string * Sets Payment Type. * * @maps payment_type - * @factory \Square\Models\CheckoutOptionsPaymentType::checkValue */ public function setPaymentType(?string $paymentType): void { @@ -555,7 +553,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['status'] = $this->status; } if (isset($this->cancelReason)) { - $json['cancel_reason'] = ActionCancelReason::checkValue($this->cancelReason); + $json['cancel_reason'] = $this->cancelReason; } if (isset($this->paymentIds)) { $json['payment_ids'] = $this->paymentIds; @@ -573,7 +571,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['location_id'] = $this->locationId; } if (isset($this->paymentType)) { - $json['payment_type'] = CheckoutOptionsPaymentType::checkValue($this->paymentType); + $json['payment_type'] = $this->paymentType; } if (isset($this->customerId)) { $json['customer_id'] = $this->customerId; diff --git a/src/Models/TerminalCheckoutQuerySort.php b/src/Models/TerminalCheckoutQuerySort.php index 255d99fe..1204cfad 100644 --- a/src/Models/TerminalCheckoutQuerySort.php +++ b/src/Models/TerminalCheckoutQuerySort.php @@ -27,7 +27,6 @@ public function getSortOrder(): ?string * The order (e.g., chronological or alphabetical) in which results from a request are returned. * * @maps sort_order - * @factory \Square\Models\SortOrder::checkValue */ public function setSortOrder(?string $sortOrder): void { @@ -47,7 +46,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; if (isset($this->sortOrder)) { - $json['sort_order'] = SortOrder::checkValue($this->sortOrder); + $json['sort_order'] = $this->sortOrder; } $json = array_filter($json, function ($val) { return $val !== null; diff --git a/src/Models/TerminalRefund.php b/src/Models/TerminalRefund.php index 425ad636..553bd9b1 100644 --- a/src/Models/TerminalRefund.php +++ b/src/Models/TerminalRefund.php @@ -320,7 +320,6 @@ public function getCancelReason(): ?string * Sets Cancel Reason. * * @maps cancel_reason - * @factory \Square\Models\ActionCancelReason::checkValue */ public function setCancelReason(?string $cancelReason): void { @@ -439,7 +438,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['status'] = $this->status; } if (isset($this->cancelReason)) { - $json['cancel_reason'] = ActionCancelReason::checkValue($this->cancelReason); + $json['cancel_reason'] = $this->cancelReason; } if (isset($this->createdAt)) { $json['created_at'] = $this->createdAt; diff --git a/src/Models/Transaction.php b/src/Models/Transaction.php index f151a51e..57429dfa 100644 --- a/src/Models/Transaction.php +++ b/src/Models/Transaction.php @@ -211,7 +211,6 @@ public function getProduct(): ?string * Indicates the Square product used to process a transaction. * * @maps product - * @factory \Square\Models\TransactionProduct::checkValue */ public function setProduct(?string $product): void { @@ -331,7 +330,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['reference_id'] = $this->referenceId; } if (isset($this->product)) { - $json['product'] = TransactionProduct::checkValue($this->product); + $json['product'] = $this->product; } if (isset($this->clientId)) { $json['client_id'] = $this->clientId; diff --git a/src/Models/TransactionProduct.php b/src/Models/TransactionProduct.php index 8f41b209..311ed5ac 100644 --- a/src/Models/TransactionProduct.php +++ b/src/Models/TransactionProduct.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Indicates the Square product used to process a transaction. */ @@ -52,31 +48,4 @@ class TransactionProduct * A Square product that does not match any other value. */ public const OTHER = 'OTHER'; - - private const _ALL_VALUES = [ - self::REGISTER, - self::EXTERNAL_API, - self::BILLING, - self::APPOINTMENTS, - self::INVOICES, - self::ONLINE_STORE, - self::PAYROLL, - self::OTHER, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/TransactionType.php b/src/Models/TransactionType.php index 103ae7cd..081818a4 100644 --- a/src/Models/TransactionType.php +++ b/src/Models/TransactionType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * The transaction type used in the disputed payment. */ @@ -16,22 +12,4 @@ class TransactionType public const DEBIT = 'DEBIT'; public const CREDIT = 'CREDIT'; - - private const _ALL_VALUES = [self::DEBIT, self::CREDIT]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/V1CreateRefundRequest.php b/src/Models/V1CreateRefundRequest.php index f03a8f99..982fafc9 100644 --- a/src/Models/V1CreateRefundRequest.php +++ b/src/Models/V1CreateRefundRequest.php @@ -86,7 +86,6 @@ public function getType(): string * * @required * @maps type - * @factory \Square\Models\V1CreateRefundRequestType::checkValue */ public function setType(string $type): void { @@ -165,7 +164,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; $json['payment_id'] = $this->paymentId; - $json['type'] = V1CreateRefundRequestType::checkValue($this->type); + $json['type'] = $this->type; $json['reason'] = $this->reason; if (isset($this->refundedMoney)) { $json['refunded_money'] = $this->refundedMoney; diff --git a/src/Models/V1CreateRefundRequestType.php b/src/Models/V1CreateRefundRequestType.php index 4442571c..eb69b2d6 100644 --- a/src/Models/V1CreateRefundRequestType.php +++ b/src/Models/V1CreateRefundRequestType.php @@ -4,31 +4,9 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - class V1CreateRefundRequestType { public const FULL = 'FULL'; public const PARTIAL = 'PARTIAL'; - - private const _ALL_VALUES = [self::FULL, self::PARTIAL]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/V1ListOrdersRequest.php b/src/Models/V1ListOrdersRequest.php index 414ae98d..32417458 100644 --- a/src/Models/V1ListOrdersRequest.php +++ b/src/Models/V1ListOrdersRequest.php @@ -37,7 +37,6 @@ public function getOrder(): ?string * The order (e.g., chronological or alphabetical) in which results from a request are returned. * * @maps order - * @factory \Square\Models\SortOrder::checkValue */ public function setOrder(?string $order): void { @@ -99,7 +98,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; if (isset($this->order)) { - $json['order'] = SortOrder::checkValue($this->order); + $json['order'] = $this->order; } if (isset($this->limit)) { $json['limit'] = $this->limit; diff --git a/src/Models/V1ListPaymentsRequest.php b/src/Models/V1ListPaymentsRequest.php index 6bb3fe31..5bec7eab 100644 --- a/src/Models/V1ListPaymentsRequest.php +++ b/src/Models/V1ListPaymentsRequest.php @@ -52,7 +52,6 @@ public function getOrder(): ?string * The order (e.g., chronological or alphabetical) in which results from a request are returned. * * @maps order - * @factory \Square\Models\SortOrder::checkValue */ public function setOrder(?string $order): void { @@ -182,7 +181,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; if (isset($this->order)) { - $json['order'] = SortOrder::checkValue($this->order); + $json['order'] = $this->order; } if (isset($this->beginTime)) { $json['begin_time'] = $this->beginTime; diff --git a/src/Models/V1ListRefundsRequest.php b/src/Models/V1ListRefundsRequest.php index e226d668..8954c630 100644 --- a/src/Models/V1ListRefundsRequest.php +++ b/src/Models/V1ListRefundsRequest.php @@ -47,7 +47,6 @@ public function getOrder(): ?string * The order (e.g., chronological or alphabetical) in which results from a request are returned. * * @maps order - * @factory \Square\Models\SortOrder::checkValue */ public function setOrder(?string $order): void { @@ -161,7 +160,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; if (isset($this->order)) { - $json['order'] = SortOrder::checkValue($this->order); + $json['order'] = $this->order; } if (isset($this->beginTime)) { $json['begin_time'] = $this->beginTime; diff --git a/src/Models/V1ListSettlementsRequest.php b/src/Models/V1ListSettlementsRequest.php index aad5c7ce..da00e1f6 100644 --- a/src/Models/V1ListSettlementsRequest.php +++ b/src/Models/V1ListSettlementsRequest.php @@ -52,7 +52,6 @@ public function getOrder(): ?string * The order (e.g., chronological or alphabetical) in which results from a request are returned. * * @maps order - * @factory \Square\Models\SortOrder::checkValue */ public function setOrder(?string $order): void { @@ -137,7 +136,6 @@ public function getStatus(): ?string * Sets Status. * * @maps status - * @factory \Square\Models\V1ListSettlementsRequestStatus::checkValue */ public function setStatus(?string $status): void { @@ -179,7 +177,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; if (isset($this->order)) { - $json['order'] = SortOrder::checkValue($this->order); + $json['order'] = $this->order; } if (isset($this->beginTime)) { $json['begin_time'] = $this->beginTime; @@ -191,7 +189,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['limit'] = $this->limit; } if (isset($this->status)) { - $json['status'] = V1ListSettlementsRequestStatus::checkValue($this->status); + $json['status'] = $this->status; } if (isset($this->batchToken)) { $json['batch_token'] = $this->batchToken; diff --git a/src/Models/V1ListSettlementsRequestStatus.php b/src/Models/V1ListSettlementsRequestStatus.php index 071acb25..880975c4 100644 --- a/src/Models/V1ListSettlementsRequestStatus.php +++ b/src/Models/V1ListSettlementsRequestStatus.php @@ -4,31 +4,9 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - class V1ListSettlementsRequestStatus { public const SENT = 'SENT'; public const FAILED = 'FAILED'; - - private const _ALL_VALUES = [self::SENT, self::FAILED]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/V1Money.php b/src/Models/V1Money.php index 9fb1390f..5794e2b7 100644 --- a/src/Models/V1Money.php +++ b/src/Models/V1Money.php @@ -56,7 +56,6 @@ public function getCurrencyCode(): ?string * to [ISO 4217](https://wikipedia.org/wiki/ISO_4217). * * @maps currency_code - * @factory \Square\Models\Currency::checkValue */ public function setCurrencyCode(?string $currencyCode): void { @@ -79,7 +78,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['amount'] = $this->amount; } if (isset($this->currencyCode)) { - $json['currency_code'] = Currency::checkValue($this->currencyCode); + $json['currency_code'] = $this->currencyCode; } $json = array_filter($json, function ($val) { return $val !== null; diff --git a/src/Models/V1Order.php b/src/Models/V1Order.php index 9da8bb72..d9f414a7 100644 --- a/src/Models/V1Order.php +++ b/src/Models/V1Order.php @@ -252,7 +252,6 @@ public function getState(): ?string * Sets State. * * @maps state - * @factory \Square\Models\V1OrderState::checkValue */ public function setState(?string $state): void { @@ -709,7 +708,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['recipient_phone_number'] = $this->recipientPhoneNumber; } if (isset($this->state)) { - $json['state'] = V1OrderState::checkValue($this->state); + $json['state'] = $this->state; } if (isset($this->shippingAddress)) { $json['shipping_address'] = $this->shippingAddress; diff --git a/src/Models/V1OrderHistoryEntry.php b/src/Models/V1OrderHistoryEntry.php index c192ccc3..7cbd322d 100644 --- a/src/Models/V1OrderHistoryEntry.php +++ b/src/Models/V1OrderHistoryEntry.php @@ -33,7 +33,6 @@ public function getAction(): ?string * Sets Action. * * @maps action - * @factory \Square\Models\V1OrderHistoryEntryAction::checkValue */ public function setAction(?string $action): void { @@ -73,7 +72,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; if (isset($this->action)) { - $json['action'] = V1OrderHistoryEntryAction::checkValue($this->action); + $json['action'] = $this->action; } if (isset($this->createdAt)) { $json['created_at'] = $this->createdAt; diff --git a/src/Models/V1OrderHistoryEntryAction.php b/src/Models/V1OrderHistoryEntryAction.php index 1e12b737..757e0225 100644 --- a/src/Models/V1OrderHistoryEntryAction.php +++ b/src/Models/V1OrderHistoryEntryAction.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - class V1OrderHistoryEntryAction { public const ORDER_PLACED = 'ORDER_PLACED'; @@ -23,30 +19,4 @@ class V1OrderHistoryEntryAction public const REFUNDED = 'REFUNDED'; public const EXPIRED = 'EXPIRED'; - - private const _ALL_VALUES = [ - self::ORDER_PLACED, - self::DECLINED, - self::PAYMENT_RECEIVED, - self::CANCELED, - self::COMPLETED, - self::REFUNDED, - self::EXPIRED, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/V1OrderState.php b/src/Models/V1OrderState.php index f702b249..291568d6 100644 --- a/src/Models/V1OrderState.php +++ b/src/Models/V1OrderState.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - class V1OrderState { public const PENDING = 'PENDING'; @@ -21,29 +17,4 @@ class V1OrderState public const REFUNDED = 'REFUNDED'; public const REJECTED = 'REJECTED'; - - private const _ALL_VALUES = [ - self::PENDING, - self::OPEN, - self::COMPLETED, - self::CANCELED, - self::REFUNDED, - self::REJECTED, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/V1PaymentItemization.php b/src/Models/V1PaymentItemization.php index 62bad52a..c50c0ee5 100644 --- a/src/Models/V1PaymentItemization.php +++ b/src/Models/V1PaymentItemization.php @@ -149,7 +149,6 @@ public function getItemizationType(): ?string * Sets Itemization Type. * * @maps itemization_type - * @factory \Square\Models\V1PaymentItemizationItemizationType::checkValue */ public function setItemizationType(?string $itemizationType): void { @@ -397,7 +396,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['quantity'] = $this->quantity; } if (isset($this->itemizationType)) { - $json['itemization_type'] = V1PaymentItemizationItemizationType::checkValue($this->itemizationType); + $json['itemization_type'] = $this->itemizationType; } if (isset($this->itemDetail)) { $json['item_detail'] = $this->itemDetail; diff --git a/src/Models/V1PaymentItemizationItemizationType.php b/src/Models/V1PaymentItemizationItemizationType.php index 70534dd7..36f96b90 100644 --- a/src/Models/V1PaymentItemizationItemizationType.php +++ b/src/Models/V1PaymentItemizationItemizationType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - class V1PaymentItemizationItemizationType { public const ITEM = 'ITEM'; @@ -21,29 +17,4 @@ class V1PaymentItemizationItemizationType public const GIFT_CARD_UNKNOWN = 'GIFT_CARD_UNKNOWN'; public const OTHER = 'OTHER'; - - private const _ALL_VALUES = [ - self::ITEM, - self::CUSTOM_AMOUNT, - self::GIFT_CARD_ACTIVATION, - self::GIFT_CARD_RELOAD, - self::GIFT_CARD_UNKNOWN, - self::OTHER, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/V1PaymentSurcharge.php b/src/Models/V1PaymentSurcharge.php index 68122f7a..abdbc0f9 100644 --- a/src/Models/V1PaymentSurcharge.php +++ b/src/Models/V1PaymentSurcharge.php @@ -143,7 +143,6 @@ public function getType(): ?string * Sets Type. * * @maps type - * @factory \Square\Models\V1PaymentSurchargeType::checkValue */ public function setType(?string $type): void { @@ -239,7 +238,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['amount_money'] = $this->amountMoney; } if (isset($this->type)) { - $json['type'] = V1PaymentSurchargeType::checkValue($this->type); + $json['type'] = $this->type; } if (isset($this->taxable)) { $json['taxable'] = $this->taxable; diff --git a/src/Models/V1PaymentSurchargeType.php b/src/Models/V1PaymentSurchargeType.php index fc108a6b..08e790cc 100644 --- a/src/Models/V1PaymentSurchargeType.php +++ b/src/Models/V1PaymentSurchargeType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - class V1PaymentSurchargeType { public const UNKNOWN = 'UNKNOWN'; @@ -15,22 +11,4 @@ class V1PaymentSurchargeType public const AUTO_GRATUITY = 'AUTO_GRATUITY'; public const CUSTOM = 'CUSTOM'; - - private const _ALL_VALUES = [self::UNKNOWN, self::AUTO_GRATUITY, self::CUSTOM]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/V1PaymentTax.php b/src/Models/V1PaymentTax.php index 3b935ea9..c636e00b 100644 --- a/src/Models/V1PaymentTax.php +++ b/src/Models/V1PaymentTax.php @@ -137,7 +137,6 @@ public function getInclusionType(): ?string * Sets Inclusion Type. * * @maps inclusion_type - * @factory \Square\Models\V1PaymentTaxInclusionType::checkValue */ public function setInclusionType(?string $inclusionType): void { @@ -191,7 +190,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['rate'] = $this->rate; } if (isset($this->inclusionType)) { - $json['inclusion_type'] = V1PaymentTaxInclusionType::checkValue($this->inclusionType); + $json['inclusion_type'] = $this->inclusionType; } if (isset($this->feeId)) { $json['fee_id'] = $this->feeId; diff --git a/src/Models/V1PaymentTaxInclusionType.php b/src/Models/V1PaymentTaxInclusionType.php index bf267858..47d7108f 100644 --- a/src/Models/V1PaymentTaxInclusionType.php +++ b/src/Models/V1PaymentTaxInclusionType.php @@ -4,31 +4,9 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - class V1PaymentTaxInclusionType { public const ADDITIVE = 'ADDITIVE'; public const INCLUSIVE = 'INCLUSIVE'; - - private const _ALL_VALUES = [self::ADDITIVE, self::INCLUSIVE]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/V1Refund.php b/src/Models/V1Refund.php index 5e8ae0df..a7e1c87b 100644 --- a/src/Models/V1Refund.php +++ b/src/Models/V1Refund.php @@ -113,7 +113,6 @@ public function getType(): ?string * Sets Type. * * @maps type - * @factory \Square\Models\V1RefundType::checkValue */ public function setType(?string $type): void { @@ -475,7 +474,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; if (isset($this->type)) { - $json['type'] = V1RefundType::checkValue($this->type); + $json['type'] = $this->type; } if (isset($this->reason)) { $json['reason'] = $this->reason; diff --git a/src/Models/V1RefundType.php b/src/Models/V1RefundType.php index 25c4b69e..694eed4f 100644 --- a/src/Models/V1RefundType.php +++ b/src/Models/V1RefundType.php @@ -4,31 +4,9 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - class V1RefundType { public const FULL = 'FULL'; public const PARTIAL = 'PARTIAL'; - - private const _ALL_VALUES = [self::FULL, self::PARTIAL]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/V1Settlement.php b/src/Models/V1Settlement.php index 08de92e8..5bd427f5 100644 --- a/src/Models/V1Settlement.php +++ b/src/Models/V1Settlement.php @@ -73,7 +73,6 @@ public function getStatus(): ?string * Sets Status. * * @maps status - * @factory \Square\Models\V1SettlementStatus::checkValue */ public function setStatus(?string $status): void { @@ -178,7 +177,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['id'] = $this->id; } if (isset($this->status)) { - $json['status'] = V1SettlementStatus::checkValue($this->status); + $json['status'] = $this->status; } if (isset($this->totalMoney)) { $json['total_money'] = $this->totalMoney; diff --git a/src/Models/V1SettlementEntry.php b/src/Models/V1SettlementEntry.php index 6f820428..0dd20176 100644 --- a/src/Models/V1SettlementEntry.php +++ b/src/Models/V1SettlementEntry.php @@ -63,7 +63,6 @@ public function getType(): ?string * Sets Type. * * @maps type - * @factory \Square\Models\V1SettlementEntryType::checkValue */ public function setType(?string $type): void { @@ -122,7 +121,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['payment_id'] = $this->paymentId; } if (isset($this->type)) { - $json['type'] = V1SettlementEntryType::checkValue($this->type); + $json['type'] = $this->type; } if (isset($this->amountMoney)) { $json['amount_money'] = $this->amountMoney; diff --git a/src/Models/V1SettlementEntryType.php b/src/Models/V1SettlementEntryType.php index 22b230c5..feb3e935 100644 --- a/src/Models/V1SettlementEntryType.php +++ b/src/Models/V1SettlementEntryType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - class V1SettlementEntryType { /** @@ -26,9 +22,9 @@ class V1SettlementEntryType public const CHARGE = 'CHARGE'; /** - * Square offers Free Payments Processing for a variety of business scenarios including seller - * referral or when we want to apologize for a bug, customer service, repricing complication, etc. This - * entry represents a credit to the merchant for the purposes of Free Processing. + * Square offers Free Payments Processing for a variety of business scenarios including seller referral + * or when we want to apologize for a bug, customer service, repricing complication, etc. This entry + * represents a credit to the merchant for the purposes of Free Processing. */ public const FREE_PROCESSING = 'FREE_PROCESSING'; @@ -69,8 +65,8 @@ class V1SettlementEntryType public const SQUARE_CAPITAL_ADVANCE = 'SQUARE_CAPITAL_ADVANCE'; /** - * Capital merchant cash advance (MCA) assessment. These are, generally, proportional to the - * merchant's sales but may be issued for other reasons related to the MCA. + * Capital merchant cash advance (MCA) assessment. These are, generally, proportional to the merchant's + * sales but may be issued for other reasons related to the MCA. */ public const SQUARE_CAPITAL_PAYMENT = 'SQUARE_CAPITAL_PAYMENT'; @@ -116,44 +112,4 @@ class V1SettlementEntryType * Settlements to or withdrawals from the Square Card (an asset) */ public const SQUARE_CARD = 'SQUARE_CARD'; - - private const _ALL_VALUES = [ - self::ADJUSTMENT, - self::BALANCE_CHARGE, - self::CHARGE, - self::FREE_PROCESSING, - self::HOLD_ADJUSTMENT, - self::PAID_SERVICE_FEE, - self::PAID_SERVICE_FEE_REFUND, - self::REDEMPTION_CODE, - self::REFUND, - self::RETURNED_PAYOUT, - self::SQUARE_CAPITAL_ADVANCE, - self::SQUARE_CAPITAL_PAYMENT, - self::SQUARE_CAPITAL_REVERSED_PAYMENT, - self::SUBSCRIPTION_FEE, - self::SUBSCRIPTION_FEE_REFUND, - self::OTHER, - self::INCENTED_PAYMENT, - self::RETURNED_ACH_ENTRY, - self::RETURNED_SQUARE_275, - self::SQUARE_275, - self::SQUARE_CARD, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/V1SettlementStatus.php b/src/Models/V1SettlementStatus.php index 49797e61..0be546f0 100644 --- a/src/Models/V1SettlementStatus.php +++ b/src/Models/V1SettlementStatus.php @@ -4,31 +4,9 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - class V1SettlementStatus { public const FAILED = 'FAILED'; public const SENT = 'SENT'; - - private const _ALL_VALUES = [self::FAILED, self::SENT]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/V1Tender.php b/src/Models/V1Tender.php index 4514703b..688e82f6 100644 --- a/src/Models/V1Tender.php +++ b/src/Models/V1Tender.php @@ -144,7 +144,6 @@ public function getType(): ?string * Sets Type. * * @maps type - * @factory \Square\Models\V1TenderType::checkValue */ public function setType(?string $type): void { @@ -225,7 +224,6 @@ public function getCardBrand(): ?string * The brand of a credit card. * * @maps card_brand - * @factory \Square\Models\V1TenderCardBrand::checkValue */ public function setCardBrand(?string $cardBrand): void { @@ -264,7 +262,6 @@ public function getEntryMethod(): ?string * Sets Entry Method. * * @maps entry_method - * @factory \Square\Models\V1TenderEntryMethod::checkValue */ public function setEntryMethod(?string $entryMethod): void { @@ -445,7 +442,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['id'] = $this->id; } if (isset($this->type)) { - $json['type'] = V1TenderType::checkValue($this->type); + $json['type'] = $this->type; } if (isset($this->name)) { $json['name'] = $this->name; @@ -457,13 +454,13 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['receipt_url'] = $this->receiptUrl; } if (isset($this->cardBrand)) { - $json['card_brand'] = V1TenderCardBrand::checkValue($this->cardBrand); + $json['card_brand'] = $this->cardBrand; } if (isset($this->panSuffix)) { $json['pan_suffix'] = $this->panSuffix; } if (isset($this->entryMethod)) { - $json['entry_method'] = V1TenderEntryMethod::checkValue($this->entryMethod); + $json['entry_method'] = $this->entryMethod; } if (isset($this->paymentNote)) { $json['payment_note'] = $this->paymentNote; diff --git a/src/Models/V1TenderCardBrand.php b/src/Models/V1TenderCardBrand.php index 7cf99e87..74486b10 100644 --- a/src/Models/V1TenderCardBrand.php +++ b/src/Models/V1TenderCardBrand.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * The brand of a credit card. */ @@ -30,32 +26,4 @@ class V1TenderCardBrand public const CHINA_UNIONPAY = 'CHINA_UNIONPAY'; public const SQUARE_GIFT_CARD = 'SQUARE_GIFT_CARD'; - - private const _ALL_VALUES = [ - self::OTHER_BRAND, - self::VISA, - self::MASTER_CARD, - self::AMERICAN_EXPRESS, - self::DISCOVER, - self::DISCOVER_DINERS, - self::JCB, - self::CHINA_UNIONPAY, - self::SQUARE_GIFT_CARD, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/V1TenderEntryMethod.php b/src/Models/V1TenderEntryMethod.php index 4284820d..2648dba5 100644 --- a/src/Models/V1TenderEntryMethod.php +++ b/src/Models/V1TenderEntryMethod.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - class V1TenderEntryMethod { public const MANUAL = 'MANUAL'; @@ -23,30 +19,4 @@ class V1TenderEntryMethod public const WEB_FORM = 'WEB_FORM'; public const OTHER = 'OTHER'; - - private const _ALL_VALUES = [ - self::MANUAL, - self::SCANNED, - self::SQUARE_CASH, - self::SQUARE_WALLET, - self::SWIPED, - self::WEB_FORM, - self::OTHER, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/V1TenderType.php b/src/Models/V1TenderType.php index 37b77a33..1e03af95 100644 --- a/src/Models/V1TenderType.php +++ b/src/Models/V1TenderType.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - class V1TenderType { public const CREDIT_CARD = 'CREDIT_CARD'; @@ -25,31 +21,4 @@ class V1TenderType public const UNKNOWN = 'UNKNOWN'; public const OTHER = 'OTHER'; - - private const _ALL_VALUES = [ - self::CREDIT_CARD, - self::CASH, - self::THIRD_PARTY_CARD, - self::NO_SALE, - self::SQUARE_WALLET, - self::SQUARE_GIFT_CARD, - self::UNKNOWN, - self::OTHER, - ]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/V1UpdateOrderRequest.php b/src/Models/V1UpdateOrderRequest.php index 5cb458eb..5532b425 100644 --- a/src/Models/V1UpdateOrderRequest.php +++ b/src/Models/V1UpdateOrderRequest.php @@ -57,7 +57,6 @@ public function getAction(): string * * @required * @maps action - * @factory \Square\Models\V1UpdateOrderRequestAction::checkValue */ public function setAction(string $action): void { @@ -156,7 +155,7 @@ public function setCanceledNote(?string $canceledNote): void public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; - $json['action'] = V1UpdateOrderRequestAction::checkValue($this->action); + $json['action'] = $this->action; if (isset($this->shippedTrackingNumber)) { $json['shipped_tracking_number'] = $this->shippedTrackingNumber; } diff --git a/src/Models/V1UpdateOrderRequestAction.php b/src/Models/V1UpdateOrderRequestAction.php index 0e9efcaa..61933cc1 100644 --- a/src/Models/V1UpdateOrderRequestAction.php +++ b/src/Models/V1UpdateOrderRequestAction.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - class V1UpdateOrderRequestAction { public const COMPLETE = 'COMPLETE'; @@ -15,22 +11,4 @@ class V1UpdateOrderRequestAction public const CANCEL = 'CANCEL'; public const REFUND = 'REFUND'; - - private const _ALL_VALUES = [self::COMPLETE, self::CANCEL, self::REFUND]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/Vendor.php b/src/Models/Vendor.php index 1d826837..3a1b8e8e 100644 --- a/src/Models/Vendor.php +++ b/src/Models/Vendor.php @@ -273,7 +273,6 @@ public function getStatus(): ?string * whether a [Vendor]($m/Vendor) is active or inactive. * * @maps status - * @factory \Square\Models\VendorStatus::checkValue */ public function setStatus(?string $status): void { @@ -320,7 +319,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['version'] = $this->version; } if (isset($this->status)) { - $json['status'] = VendorStatus::checkValue($this->status); + $json['status'] = $this->status; } $json = array_filter($json, function ($val) { return $val !== null; diff --git a/src/Models/VendorStatus.php b/src/Models/VendorStatus.php index 0030c669..93d7ba80 100644 --- a/src/Models/VendorStatus.php +++ b/src/Models/VendorStatus.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * The status of the [Vendor]($m/Vendor), * whether a [Vendor]($m/Vendor) is active or inactive. @@ -23,22 +19,4 @@ class VendorStatus * Vendor is inactive and cannot receive purchase orders. */ public const INACTIVE = 'INACTIVE'; - - private const _ALL_VALUES = [self::ACTIVE, self::INACTIVE]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/VisibilityFilter.php b/src/Models/VisibilityFilter.php index 239edd33..164c1d15 100644 --- a/src/Models/VisibilityFilter.php +++ b/src/Models/VisibilityFilter.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Enumeration of visibility-filter values used to set the ability to view custom attributes or custom * attribute definitions. @@ -30,22 +26,4 @@ class VisibilityFilter * `VISIBILITY_READ_WRITE_VALUES`. */ public const READ_WRITE = 'READ_WRITE'; - - private const _ALL_VALUES = [self::ALL, self::READ, self::READ_WRITE]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/Weekday.php b/src/Models/Weekday.php index 0bf35c49..ec45c2f7 100644 --- a/src/Models/Weekday.php +++ b/src/Models/Weekday.php @@ -4,10 +4,6 @@ namespace Square\Models; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * The days of the week. */ @@ -47,22 +43,4 @@ class Weekday * Sunday */ public const SUN = 'SUN'; - - private const _ALL_VALUES = [self::MON, self::TUE, self::WED, self::THU, self::FRI, self::SAT, self::SUN]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/Models/WorkweekConfig.php b/src/Models/WorkweekConfig.php index 3161051b..474c53eb 100644 --- a/src/Models/WorkweekConfig.php +++ b/src/Models/WorkweekConfig.php @@ -87,7 +87,6 @@ public function getStartOfWeek(): string * * @required * @maps start_of_week - * @factory \Square\Models\Weekday::checkValue */ public function setStartOfWeek(string $startOfWeek): void { @@ -200,7 +199,7 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (isset($this->id)) { $json['id'] = $this->id; } - $json['start_of_week'] = Weekday::checkValue($this->startOfWeek); + $json['start_of_week'] = $this->startOfWeek; $json['start_of_day_local_time'] = $this->startOfDayLocalTime; if (isset($this->version)) { $json['version'] = $this->version; diff --git a/src/Server.php b/src/Server.php index 2f55d53e..78337fa5 100644 --- a/src/Server.php +++ b/src/Server.php @@ -4,32 +4,10 @@ namespace Square; -use Exception; -use Square\ApiHelper; -use stdClass; - /** * Baseurl aliases */ class Server { public const DEFAULT_ = 'default'; - - private const _ALL_VALUES = [self::DEFAULT_]; - - /** - * Ensures that all the given values are present in this Enum. - * - * @param array|stdClass|null|string $value Value or a list/map of values to be checked - * - * @return array|null|string Input value(s), if all are a part of this Enum - * - * @throws Exception Throws exception if any given value is not in this Enum - */ - public static function checkValue($value) - { - $value = json_decode(json_encode($value), true); // converts stdClass into array - ApiHelper::checkValueInEnum($value, self::class, self::_ALL_VALUES); - return $value; - } } diff --git a/src/SquareClient.php b/src/SquareClient.php index 3df21df2..3104928d 100644 --- a/src/SquareClient.php +++ b/src/SquareClient.php @@ -271,7 +271,7 @@ public function getBearerAuthCredentials(): ?BearerAuthCredentials */ public function getSdkVersion(): string { - return '19.1.0.20220616'; + return '19.1.1.20220616'; } /** diff --git a/tests/TestHelper.php b/tests/TestHelper.php index 63d36d6d..2f39020e 100644 --- a/tests/TestHelper.php +++ b/tests/TestHelper.php @@ -37,37 +37,51 @@ public static function isArraySubset( } /** - * Recursively check whether the leftTree is a proper subset of the right tree - * @param mixed $leftTree Left tree - * @param mixed $rightTree Right tree - * @param boolean $checkValues Check primitive values for equality? - * @param boolean $allowExtra Are extra elements allowed in right array? - * @param boolean $isOrdered Should elements in right be compared in order to left? - * @return boolean True if leftTree is a subset of rightTree + * Recursively check whether the left value is a proper subset of the right value + * + * @param mixed $left Left value + * @param mixed $right Right value + * @param boolean $checkValues Check primitive values for equality? + * @param boolean $allowExtra Are extra elements allowed in right array? + * @param boolean $isOrdered Should elements in right be compared in order to the left array? + * + * @return boolean True if leftTree is a subset of rightTree */ public static function isProperSubsetOf( - $leftTree, - $rightTree, + $left, + $right, $checkValues, $allowExtra, $isOrdered ) { - if ($leftTree == null) { + if ($left === null) { return true; } - if (!is_array($leftTree) && !is_array($rightTree)) { - return $leftTree === $rightTree; + + if ($right === null) { + return false; + } + + // If both values are primitive, check if they are equal + if (!is_array($left) && !is_array($right)) { + return $left === $right; + } + + // Check if one of the values is primitive and the other is not + if (!is_array($left) || !is_array($right)) { + return false; } - for ($iterator = new \ArrayIterator($leftTree); $iterator->valid(); $iterator->next()) { + for ($iterator = new \ArrayIterator($left); $iterator->valid(); $iterator->next()) { $key = $iterator->key(); - $leftVal = $leftTree[$key]; - $rightVal = $rightTree[$key]; + $leftVal = $left[$key]; + $rightVal = $right[$key]; // Check if key exists - if (!array_key_exists($key, $rightTree)) { + if (!array_key_exists($key, $right)) { return false; } + if (static::isAssoc($leftVal)) { // If left value is tree, right value should be be tree too if (static::isAssoc($rightVal)) { @@ -83,47 +97,52 @@ public static function isProperSubsetOf( } else { return false; } - } else { - // Value comparison if checkValues - if ($checkValues) { - // If left value is a primitive, check if it equals right value - if (is_array($leftVal)) { - if (!is_array($rightVal)) { + } elseif ($checkValues) { + if (is_array($leftVal)) { + if (!is_array($rightVal)) { + return false; + } + if (count($leftVal) > 0 && static::isAssoc($leftVal[0])) { + if (!static::isArrayOfJsonObjectsProperSubsetOf( + $leftVal, + $rightVal, + $checkValues, + $allowExtra, + $isOrdered + )) { return false; } - if (count($leftVal) > 0 && static::isAssoc($leftVal[0])) { - if (!static::isArrayOfJsonObjectsProperSubsetOf( - $leftVal, - $rightVal, - $checkValues, - $allowExtra, - $isOrdered - )) { - return false; - } - } else { - if (!static::isListProperSubsetOf( - $leftVal, - $rightVal, - $allowExtra, - $isOrdered - )) { - return false; - } + } else { + if (!static::isListProperSubsetOf( + $leftVal, + $rightVal, + $allowExtra, + $isOrdered + )) { + return false; } - } elseif (!$leftVal == $rightTree[$key] && !$leftVal == null) { - return false; } + } elseif ( + !static::isProperSubsetOf( + $leftVal, + $rightVal, + $checkValues, + $allowExtra, + $isOrdered + ) + ) { + return false; } } } + return true; } /** * Recursively check whether the left JSON object is a proper subset of the right JSON object - * @param array $leftObject Left JSON object as string - * @param array $rightObject Right JSON object as string + * @param string $leftObject Left JSON object as string + * @param string $rightObject Right JSON object as string * @param boolean $checkValues Check primitive values for equality? * @param boolean $allowExtra Are extra elements allowed in right array? * @param boolean $isOrdered Should elements in right be compared in order to left?