Skip to content

Commit d0317ec

Browse files
author
autobot
committed
Generated PR for Release: 19.1.1.20220616
1 parent 4996849 commit d0317ec

File tree

340 files changed

+389
-5252
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

340 files changed

+389
-5252
lines changed

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "square/square",
33
"description": "Use Square APIs to manage and run business including payment, customer, product, inventory, and employee management.",
4-
"version": "19.1.0.20220616",
4+
"version": "19.1.1.20220616",
55
"type": "library",
66
"keywords": [
77
"Square",
@@ -22,8 +22,8 @@
2222
"ext-curl": "*",
2323
"ext-json": "*",
2424
"ext-mbstring": "*",
25-
"apimatic/unirest-php": "^2.2.2",
26-
"apimatic/jsonmapper": "^3.0.3"
25+
"apimatic/unirest-php": "^2.3.0",
26+
"apimatic/jsonmapper": "^3.0.4"
2727
},
2828
"require-dev": {
2929
"squizlabs/php_codesniffer": "^3.5",

doc/apis/catalog.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ function createCatalogImage(
268268

269269
| Parameter | Type | Tags | Description |
270270
| --- | --- | --- | --- |
271-
| `request` | [`?CreateCatalogImageRequest`](../../doc/models/create-catalog-image-request.md) | Form, Optional | - |
271+
| `request` | [`?CreateCatalogImageRequest`](../../doc/models/create-catalog-image-request.md) | Form (JSON-Encoded), Optional | - |
272272
| `imageFile` | `?FileWrapper` | Form, Optional | - |
273273

274274
## Response Type
@@ -325,7 +325,7 @@ function updateCatalogImage(
325325
| Parameter | Type | Tags | Description |
326326
| --- | --- | --- | --- |
327327
| `imageId` | `string` | Template, Required | The ID of the `CatalogImage` object to update the encapsulated image file. |
328-
| `request` | [`?UpdateCatalogImageRequest`](../../doc/models/update-catalog-image-request.md) | Form, Optional | - |
328+
| `request` | [`?UpdateCatalogImageRequest`](../../doc/models/update-catalog-image-request.md) | Form (JSON-Encoded), Optional | - |
329329
| `imageFile` | `?FileWrapper` | Form, Optional | - |
330330

331331
## Response Type

doc/apis/disputes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ function createDisputeEvidenceFile(
192192
| Parameter | Type | Tags | Description |
193193
| --- | --- | --- | --- |
194194
| `disputeId` | `string` | Template, Required | The ID of the dispute you want to upload evidence for. |
195-
| `request` | [`?CreateDisputeEvidenceFileRequest`](../../doc/models/create-dispute-evidence-file-request.md) | Form, Optional | Defines the parameters for a `CreateDisputeEvidenceFile` request. |
195+
| `request` | [`?CreateDisputeEvidenceFileRequest`](../../doc/models/create-dispute-evidence-file-request.md) | Form (JSON-Encoded), Optional | Defines the parameters for a `CreateDisputeEvidenceFile` request. |
196196
| `imageFile` | `?FileWrapper` | Form, Optional | - |
197197

198198
## Response Type

doc/apis/subscriptions.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,6 @@ function updateSubscription(string $subscriptionId, UpdateSubscriptionRequest $b
202202
```php
203203
$subscriptionId = 'subscription_id0';
204204
$body = new Models\UpdateSubscriptionRequest;
205-
$body->setSubscription(new Models\Subscription);
206-
$body->getSubscription()->setTaxPercentage('null');
207-
$body->getSubscription()->setPriceOverrideMoney(new Models\Money);
208-
$body->getSubscription()->getPriceOverrideMoney()->setAmount(2000);
209-
$body->getSubscription()->getPriceOverrideMoney()->setCurrency(Models\Currency::USD);
210-
$body->getSubscription()->setVersion(1594155459464);
211205

212206
$apiResponse = $subscriptionsApi->updateSubscription($subscriptionId, $body);
213207

doc/models/list-bookings-response.md

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,9 @@
1717

1818
```json
1919
{
20-
"bookings": [
21-
{
22-
"appointment_segments": [
23-
{
24-
"duration_minutes": 60,
25-
"service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC",
26-
"service_variation_version": 1599775456731,
27-
"team_member_id": "TMXUrsBWWcHTt79t"
28-
}
29-
],
30-
"created_at": "2020-10-28T15:47:41Z",
31-
"customer_id": "EX2QSVGTZN4K1E5QE1CBFNVQ8M",
32-
"customer_note": "",
33-
"id": "zkras0xv0xwswx",
34-
"location_id": "LEQHH0YY8B42M",
35-
"seller_note": "",
36-
"start_at": "2020-11-26T13:00:00Z",
37-
"status": "ACCEPTED",
38-
"updated_at": "2020-10-28T15:49:25Z",
39-
"version": 1
40-
}
41-
],
42-
"cursor": "null",
43-
"errors": []
20+
"bookings": null,
21+
"cursor": null,
22+
"errors": null
4423
}
4524
```
4625

doc/models/update-subscription-request.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,7 @@ Defines input parameters in a request to the
1818

1919
```json
2020
{
21-
"subscription": {
22-
"price_override_money": {
23-
"amount": 2000,
24-
"currency": "USD"
25-
},
26-
"tax_percentage": "null",
27-
"version": 1594155459464
28-
}
21+
"subscription": null
2922
}
3023
```
3124

src/ApiHelper.php

Lines changed: 24 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -124,30 +124,6 @@ public static function mapClass(
124124
}
125125
}
126126

127-
/**
128-
* Try mapping the class onto the value,
129-
* If mapping failed due to the invalid oneOf or anyOf types,
130-
* throw ApiException
131-
*
132-
* @param array $json value to be verified against the types
133-
* @param string $classname name of the class to map
134-
* @param string $namespace namespace name for the model classes, Default: global namespace
135-
*
136-
* @throws InvalidArgumentException
137-
*/
138-
public static function verifyClass(
139-
array $json,
140-
string $classname,
141-
string $namespace = 'Square\Models'
142-
) {
143-
try {
144-
$value = empty($json) ? new stdClass() : json_decode(json_encode($json));
145-
self::getJsonMapper()->mapClass($value, "$namespace\\$classname");
146-
} catch (Exception $e) {
147-
throw new InvalidArgumentException($e->getMessage());
148-
}
149-
}
150-
151127
/**
152128
* Map the types onto the value,
153129
* If mapping failed due to the invalid oneOf or anyOf types,
@@ -179,35 +155,43 @@ public static function mapTypes(
179155
}
180156

181157
/**
182-
* Try mapping the types onto the value,
183-
* If mapping failed due to the invalid oneOf or anyOf types,
184-
* throw InvalidArgumentException
158+
* Checks if type of the given value is present in the type group, also updates the value when
159+
* $serializationMethods for the value's type are given.
185160
*
186-
* @param mixed $value value to be verified against the types
187-
* @param string $types types to be mapped in format OneOf(...) or AnyOf(...)
188-
* @param string[] $serializationMethods Specify methods required for serialization instead of json_encode,
189-
* should be a string path to the accessible method along with the type,
190-
* separated by a space.
191-
* @param string[] $facMethods Specify if any methods are required to map this value into any type
192-
* @param string $namespace namespace name for the model classes, Default: global namespace
161+
* @param mixed $value value to be verified against the types
162+
* @param string $types types to be mapped in format OneOf(...) or AnyOf(...)
163+
* @param string[] $serializationMethods Specify methods required for serialization of specific types in
164+
* in the type group, should be an array in the format:
165+
* ['path/to/method argumentType', ...]. Default: []
193166
*
194167
* @return mixed
195168
* @throws InvalidArgumentException
196169
*/
197170
public static function verifyTypes(
198171
$value,
199172
string $types,
200-
array $serializationMethods = [],
201-
array $facMethods = [],
202-
string $namespace = 'Square\Models'
173+
array $serializationMethods = []
203174
) {
204175
try {
205-
$value = self::applySerializationMethods($value, $serializationMethods);
206-
self::getJsonMapper()->mapFor(json_decode(json_encode($value)), $types, $namespace, $facMethods);
176+
return self::getJsonMapper()->checkTypeGroupFor($types, $value, $serializationMethods);
207177
} catch (Exception $e) {
208178
throw new InvalidArgumentException($e->getMessage());
209179
}
210-
return $value;
180+
}
181+
182+
/**
183+
* Serialize any given mixed value.
184+
*
185+
* @param mixed $value Any value to be serialized
186+
*
187+
* @return string|null serialized value
188+
*/
189+
public static function serialize($value): ?string
190+
{
191+
if (is_string($value) || is_null($value)) {
192+
return $value;
193+
}
194+
return json_encode($value);
211195
}
212196

213197
/**
@@ -235,93 +219,6 @@ public static function checkValueInEnum($value, string $enumName, array $enumVal
235219
}
236220
}
237221

238-
/**
239-
* Extract type from any given value.
240-
*
241-
* @param mixed $value should be an array to be checked for inner type
242-
* @param string $start string to be appended at the start of the extracted type, Default: ''
243-
* @param string $end string to be appended at the end of the extracted type, Default: ''
244-
*
245-
* @return string Returns the type that could be mapped on the given value.
246-
*/
247-
private static function getType($value, string $start = '', string $end = ''): string
248-
{
249-
if (is_array($value)) {
250-
if (self::isAssociative($value)) {
251-
// if value is associative array
252-
$start .= 'array<string,';
253-
$end = '>' . $end;
254-
} else {
255-
// if value is indexed array
256-
if (empty($value)) {
257-
return 'array';
258-
}
259-
$end = '[]' . $end;
260-
}
261-
return self::getType(array_pop($value), $start, $end);
262-
} elseif (is_object($value)) {
263-
$type = get_class($value); // returns full path of class
264-
$slashPos = strrpos($type, '\\');
265-
if ($slashPos !== false) {
266-
$slashPos++; // to get the type after last slash
267-
} else {
268-
$slashPos = 0; // if did not have any slashes
269-
}
270-
$type = substr($type, $slashPos);
271-
return $start . $type . $end;
272-
}
273-
return $start . gettype($value) . $end;
274-
}
275-
276-
/**
277-
* Apply serialization methods onto any given value.
278-
*
279-
* @param mixed $value Any value to be serialized
280-
* @param string[] $serializationMethods Specify methods required for serialization instead of json_encode,
281-
* should be a string path to the accessible method along with the type,
282-
* separated by a space.
283-
* @return mixed value after applying serialization method if applicable
284-
*/
285-
public static function applySerializationMethods($value, array $serializationMethods)
286-
{
287-
$type = empty($serializationMethods) ? null : self::getType($value);
288-
$error = null;
289-
foreach ($serializationMethods as $method) {
290-
$method = explode(' ', $method);
291-
try {
292-
if (is_callable($method[0]) && $type == $method[1]) {
293-
return call_user_func($method[0], $value);
294-
}
295-
} catch (\Throwable $e) {
296-
$error = $e;
297-
}
298-
}
299-
if (is_array($value)) {
300-
return array_map(function ($v) use ($serializationMethods) {
301-
return self::applySerializationMethods($v, $serializationMethods);
302-
}, $value);
303-
}
304-
if (isset($error)) {
305-
throw new InvalidArgumentException($error->getMessage());
306-
}
307-
return $value;
308-
}
309-
310-
/**
311-
* Serialize any given mixed value.
312-
*
313-
* @param mixed $value Any value to be serialized
314-
*
315-
* @return string|null serialized value
316-
*/
317-
public static function serialize($value): ?string
318-
{
319-
if (is_string($value) || is_null($value)) {
320-
return $value;
321-
}
322-
return json_encode($value);
323-
}
324-
325222
/**
326223
* Deserialize a Json string
327224
*

src/Apis/BaseApi.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class BaseApi
4343
*/
4444
protected $internalUserAgent;
4545

46-
private static $userAgent = 'Square-PHP-SDK/19.1.0.20220616 ({api-version}) {engine}/{engine-version} ({os-info}) {detail}';
46+
private static $userAgent = 'Square-PHP-SDK/19.1.1.20220616 ({api-version}) {engine}/{engine-version} ({os-info}) {detail}';
4747

4848
/**
4949
* Constructor that sets the timeout of requests

src/Apis/CardsApi.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function listCards(
6363
'include_disabled' => (null != $includeDisabled) ?
6464
var_export($includeDisabled, true) : false,
6565
'reference_id' => $referenceId,
66-
'sort_order' => Models\SortOrder::checkValue($sortOrder),
66+
'sort_order' => $sortOrder,
6767
]);
6868

6969
//prepare headers

src/Apis/CashDrawersApi.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use Square\Exceptions\ApiException;
88
use Square\ConfigurationInterface;
99
use Square\ApiHelper;
10-
use Square\Models;
1110
use Square\Http\ApiResponse;
1211
use Square\Http\HttpRequest;
1312
use Square\Http\HttpResponse;
@@ -57,7 +56,7 @@ public function listCashDrawerShifts(
5756
//process query parameters
5857
ApiHelper::appendUrlWithQueryParameters($_queryUrl, [
5958
'location_id' => $locationId,
60-
'sort_order' => Models\SortOrder::checkValue($sortOrder),
59+
'sort_order' => $sortOrder,
6160
'begin_time' => $beginTime,
6261
'end_time' => $endTime,
6362
'limit' => $limit,

src/Apis/CustomersApi.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ public function listCustomers(
6767
ApiHelper::appendUrlWithQueryParameters($_queryUrl, [
6868
'cursor' => $cursor,
6969
'limit' => $limit,
70-
'sort_field' => Models\CustomerSortField::checkValue($sortField),
71-
'sort_order' => Models\SortOrder::checkValue($sortOrder),
70+
'sort_field' => $sortField,
71+
'sort_order' => $sortOrder,
7272
]);
7373

7474
//prepare headers
@@ -272,8 +272,8 @@ public function searchCustomers(Models\SearchCustomersRequest $body): ApiRespons
272272
}
273273

274274
/**
275-
* Deletes a customer profile from a business. This operation also unlinks any associated cards on
276-
* file.
275+
* Deletes a customer profile from a business. This operation also unlinks any associated cards on file.
276+
*
277277
*
278278
* As a best practice, you should include the `version` field in the request to enable [optimistic
279279
* concurrency](https://developer.squareup.com/docs/working-with-apis/optimistic-concurrency) control.

src/Apis/DevicesApi.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ public function listDeviceCodes(
5757
ApiHelper::appendUrlWithQueryParameters($_queryUrl, [
5858
'cursor' => $cursor,
5959
'location_id' => $locationId,
60-
'product_type' => Models\ProductType::checkValue($productType),
61-
'status' => Models\DeviceCodeStatus::checkValue($status),
60+
'product_type' => $productType,
61+
'status' => $status,
6262
]);
6363

6464
//prepare headers

src/Apis/DisputesApi.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function listDisputes(
5555
//process query parameters
5656
ApiHelper::appendUrlWithQueryParameters($_queryUrl, [
5757
'cursor' => $cursor,
58-
'states' => Models\DisputeState::checkValue($states),
58+
'states' => $states,
5959
'location_id' => $locationId,
6060
]);
6161

src/Apis/EmployeesApi.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use Square\Exceptions\ApiException;
88
use Square\ConfigurationInterface;
99
use Square\ApiHelper;
10-
use Square\Models;
1110
use Square\Http\ApiResponse;
1211
use Square\Http\HttpRequest;
1312
use Square\Http\HttpResponse;
@@ -51,7 +50,7 @@ public function listEmployees(
5150
//process query parameters
5251
ApiHelper::appendUrlWithQueryParameters($_queryUrl, [
5352
'location_id' => $locationId,
54-
'status' => Models\EmployeeStatus::checkValue($status),
53+
'status' => $status,
5554
'limit' => $limit,
5655
'cursor' => $cursor,
5756
]);

src/Apis/LocationsApi.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ public function __construct(ConfigurationInterface $config, array $authManagers,
2424
}
2525

2626
/**
27-
* Provides details about all of the seller's [locations](https://developer.squareup.
28-
* com/docs/locations-api),
27+
* Provides details about all of the seller's [locations](https://developer.squareup.com/docs/locations-
28+
* api),
2929
* including those with an inactive status.
3030
*
3131
* @return ApiResponse Response from the API call

0 commit comments

Comments
 (0)