Skip to content

Commit

Permalink
Merge pull request #82 from square/release/19.0.1.20220512
Browse files Browse the repository at this point in the history
Generated PR for Release: 19.0.1.20220512
  • Loading branch information
Wolfgang Schuster authored May 25, 2022
2 parents b13aa0e + 44b8528 commit 7852d8a
Show file tree
Hide file tree
Showing 162 changed files with 494 additions and 177 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -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.0.0.20220512",
"version": "19.0.1.20220512",
"type": "library",
"keywords": [
"Square",
Expand All @@ -23,7 +23,7 @@
"ext-json": "*",
"ext-mbstring": "*",
"apimatic/unirest-php": "^2.2.2",
"apimatic/jsonmapper": "^3.0.0"
"apimatic/jsonmapper": "^3.0.1"
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.5",
Expand Down
4 changes: 2 additions & 2 deletions doc/models/catalog-item-variation.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ decreases by 2, and the stockable count automatically decreases by 0.4 bottle ac
| `availableForBooking` | `?bool` | Optional | If the `CatalogItem` that owns this item variation is of type<br>`APPOINTMENTS_SERVICE`, a bool representing whether this service is available for booking. | getAvailableForBooking(): ?bool | setAvailableForBooking(?bool availableForBooking): void |
| `itemOptionValues` | [`?(CatalogItemOptionValueForItemVariation[])`](../../doc/models/catalog-item-option-value-for-item-variation.md) | Optional | List of item option values associated with this item variation. Listed<br>in the same order as the item options of the parent item. | getItemOptionValues(): ?array | setItemOptionValues(?array itemOptionValues): void |
| `measurementUnitId` | `?string` | Optional | ID of the ‘CatalogMeasurementUnit’ that is used to measure the quantity<br>sold of this item variation. If left unset, the item will be sold in<br>whole quantities. | getMeasurementUnitId(): ?string | setMeasurementUnitId(?string measurementUnitId): void |
| `sellable` | `?bool` | Optional | Whether this variation can be sold. The inventory count of a sellable variation indicates<br>the number of units available for sale. When a variation is both stockable and sellable,<br>its sellable inventory count can be smaller than or equal to its stocable count. | getSellable(): ?bool | setSellable(?bool sellable): void |
| `stockable` | `?bool` | Optional | Whether stock is counted directly on this variation (TRUE) or only on its components (FALSE).<br>The inventory count of a stockable variation keeps track of the number of units of this variation in stock<br>and is not an indicator of the number of units of the variation that can be sold. | getStockable(): ?bool | setStockable(?bool stockable): void |
| `sellable` | `?bool` | Optional | Whether this variation can be sold. The inventory count of a sellable variation indicates<br>the number of units available for sale. When a variation is both stockable and sellable,<br>its sellable inventory count can be smaller than or equal to its stockable count. | getSellable(): ?bool | setSellable(?bool sellable): void |
| `stockable` | `?bool` | Optional | Whether stock is counted directly on this variation (TRUE) or only on its components (FALSE).<br>When a variation is both stockable and sellable, the inventory count of a stockable variation keeps track of the number of units of this variation in stock<br>and is not an indicator of the number of units of the variation that can be sold. | getStockable(): ?bool | setStockable(?bool stockable): void |
| `imageIds` | `?(string[])` | Optional | The IDs of images associated with this `CatalogItemVariation` instance.<br>These images will be shown to customers in Square Online Store. | getImageIds(): ?array | setImageIds(?array imageIds): void |
| `teamMemberIds` | `?(string[])` | Optional | Tokens of employees that can perform the service represented by this variation. Only valid for<br>variations of type `APPOINTMENTS_SERVICE`. | getTeamMemberIds(): ?array | setTeamMemberIds(?array teamMemberIds): void |
| `stockableConversion` | [`?CatalogStockConversion`](../../doc/models/catalog-stock-conversion.md) | Optional | Represents the rule of conversion between a stockable [CatalogItemVariation](../../doc/models/catalog-item-variation.md)<br>and a non-stockable sell-by or receive-by `CatalogItemVariation` that<br>share the same underlying stock. | getStockableConversion(): ?CatalogStockConversion | setStockableConversion(?CatalogStockConversion stockableConversion): void |
Expand Down
15 changes: 10 additions & 5 deletions src/ApiHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -284,18 +284,23 @@ private static function getType($value, string $start = '', string $end = ''): s
*/
public static function applySerializationMethods($value, array $serializationMethods)
{
$type = self::getType($value);
$type = empty($serializationMethods) ? null : self::getType($value);
$error = null;
foreach ($serializationMethods as $method) {
$method = explode(' ', $method);
if (is_callable($method[0]) && $type == $method[1]) {
try {
try {
if (is_callable($method[0]) && $type == $method[1]) {
return call_user_func($method[0], $value);
} catch (\Throwable $e) {
$error = $e;
}
} catch (\Throwable $e) {
$error = $e;
}
}
if (is_array($value)) {
return array_map(function ($v) use ($serializationMethods) {
return self::applySerializationMethods($v, $serializationMethods);
}, $value);
}
if (isset($error)) {
throw new InvalidArgumentException($error->getMessage());
}
Expand Down
2 changes: 1 addition & 1 deletion src/Apis/BaseApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class BaseApi
*/
protected $internalUserAgent;

private static $userAgent = 'Square-PHP-SDK/19.0.0.20220512 ({api-version}) {engine}/{engine-version} ({os-info}) {detail}';
private static $userAgent = 'Square-PHP-SDK/19.0.1.20220512 ({api-version}) {engine}/{engine-version} ({os-info}) {detail}';

/**
* Constructor that sets the timeout of requests
Expand Down
4 changes: 3 additions & 1 deletion src/Environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Exception;
use Square\ApiHelper;
use stdClass;

/**
* Environments available for API
Expand All @@ -23,14 +24,15 @@ class Environment
/**
* Ensures that all the given values are present in this Enum.
*
* @param array|null|string $value Value or a list of values to be checked
* @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;
}
Expand Down
4 changes: 3 additions & 1 deletion src/Models/ActionCancelReason.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Exception;
use Square\ApiHelper;
use stdClass;

class ActionCancelReason
{
Expand All @@ -29,14 +30,15 @@ class ActionCancelReason
/**
* Ensures that all the given values are present in this Enum.
*
* @param array|null|string $value Value or a list of values to be checked
* @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;
}
Expand Down
4 changes: 3 additions & 1 deletion src/Models/ActivityType.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Exception;
use Square\ApiHelper;
use stdClass;

class ActivityType
{
Expand Down Expand Up @@ -229,14 +230,15 @@ class ActivityType
/**
* Ensures that all the given values are present in this Enum.
*
* @param array|null|string $value Value or a list of values to be checked
* @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;
}
Expand Down
4 changes: 3 additions & 1 deletion src/Models/ApplicationDetailsExternalSquareProduct.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Exception;
use Square\ApiHelper;
use stdClass;

/**
* A list of products to return to external callers.
Expand Down Expand Up @@ -48,14 +49,15 @@ class ApplicationDetailsExternalSquareProduct
/**
* Ensures that all the given values are present in this Enum.
*
* @param array|null|string $value Value or a list of values to be checked
* @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;
}
Expand Down
4 changes: 3 additions & 1 deletion src/Models/BankAccountStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Exception;
use Square\ApiHelper;
use stdClass;

/**
* Indicates the current verification status of a `BankAccount` object.
Expand Down Expand Up @@ -36,14 +37,15 @@ class BankAccountStatus
/**
* Ensures that all the given values are present in this Enum.
*
* @param array|null|string $value Value or a list of values to be checked
* @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;
}
Expand Down
4 changes: 3 additions & 1 deletion src/Models/BankAccountType.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Exception;
use Square\ApiHelper;
use stdClass;

/**
* Indicates the financial purpose of the bank account.
Expand Down Expand Up @@ -47,14 +48,15 @@ class BankAccountType
/**
* Ensures that all the given values are present in this Enum.
*
* @param array|null|string $value Value or a list of values to be checked
* @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;
}
Expand Down
4 changes: 3 additions & 1 deletion src/Models/BookingBookingSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Exception;
use Square\ApiHelper;
use stdClass;

/**
* Supported sources a booking was created from.
Expand Down Expand Up @@ -44,14 +45,15 @@ class BookingBookingSource
/**
* Ensures that all the given values are present in this Enum.
*
* @param array|null|string $value Value or a list of values to be checked
* @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;
}
Expand Down
4 changes: 3 additions & 1 deletion src/Models/BookingCreatorDetailsCreatorType.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Exception;
use Square\ApiHelper;
use stdClass;

/**
* Supported types of a booking creator.
Expand All @@ -27,14 +28,15 @@ class BookingCreatorDetailsCreatorType
/**
* Ensures that all the given values are present in this Enum.
*
* @param array|null|string $value Value or a list of values to be checked
* @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;
}
Expand Down
4 changes: 3 additions & 1 deletion src/Models/BookingStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Exception;
use Square\ApiHelper;
use stdClass;

/**
* Supported booking statuses.
Expand Down Expand Up @@ -55,14 +56,15 @@ class BookingStatus
/**
* Ensures that all the given values are present in this Enum.
*
* @param array|null|string $value Value or a list of values to be checked
* @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;
}
Expand Down
4 changes: 3 additions & 1 deletion src/Models/BusinessAppointmentSettingsAlignmentTime.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Exception;
use Square\ApiHelper;
use stdClass;

/**
* Time units of a service duration for bookings.
Expand Down Expand Up @@ -37,14 +38,15 @@ class BusinessAppointmentSettingsAlignmentTime
/**
* Ensures that all the given values are present in this Enum.
*
* @param array|null|string $value Value or a list of values to be checked
* @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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Exception;
use Square\ApiHelper;
use stdClass;

/**
* Supported types of location where service is provided.
Expand All @@ -32,14 +33,15 @@ class BusinessAppointmentSettingsBookingLocationType
/**
* Ensures that all the given values are present in this Enum.
*
* @param array|null|string $value Value or a list of values to be checked
* @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;
}
Expand Down
4 changes: 3 additions & 1 deletion src/Models/BusinessAppointmentSettingsCancellationPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Exception;
use Square\ApiHelper;
use stdClass;

/**
* The category of the seller’s cancellation policy.
Expand All @@ -28,14 +29,15 @@ class BusinessAppointmentSettingsCancellationPolicy
/**
* Ensures that all the given values are present in this Enum.
*
* @param array|null|string $value Value or a list of values to be checked
* @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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Exception;
use Square\ApiHelper;
use stdClass;

/**
* Types of daily appointment limits.
Expand All @@ -27,14 +28,15 @@ class BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType
/**
* Ensures that all the given values are present in this Enum.
*
* @param array|null|string $value Value or a list of values to be checked
* @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;
}
Expand Down
Loading

0 comments on commit 7852d8a

Please sign in to comment.