Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated PR for Release: 37.0.0.20240515 #134

Merged
merged 1 commit into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 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": "36.0.0.20240417",
"version": "37.0.0.20240515",
"type": "library",
"keywords": [
"Square",
Expand All @@ -23,8 +23,8 @@
"php": "^7.2 || ^8.0",
"ext-json": "*",
"apimatic/unirest-php": "^4.0.0",
"apimatic/core-interfaces": "~0.1.0",
"apimatic/core": "~0.3.0"
"apimatic/core-interfaces": "~0.1.5",
"apimatic/core": "~0.3.9"
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.5",
Expand Down
6 changes: 3 additions & 3 deletions doc/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The following parameters are configurable for the API Client:

| Parameter | Type | Description |
| --- | --- | --- |
| `squareVersion` | `string` | Square Connect API versions<br>*Default*: `'2024-04-17'` |
| `squareVersion` | `string` | Square Connect API versions<br>*Default*: `'2024-05-15'` |
| `customUrl` | `string` | Sets the base URL requests are made to. Defaults to `https://connect.squareup.com`<br>*Default*: `'https://connect.squareup.com'` |
| `environment` | `string` | The API environment. <br> **Default: `production`** |
| `timeout` | `int` | Timeout for API calls in seconds.<br>*Default*: `60` |
Expand All @@ -30,7 +30,7 @@ $client = SquareClientBuilder::init()
'AccessToken'
)
)
->squareVersion('2024-04-17')
->squareVersion('2024-05-15')
->environment('production')
->customUrl('https://connect.squareup.com')
->build();
Expand Down Expand Up @@ -60,7 +60,7 @@ $client = SquareClientBuilder::init()
'AccessToken'
)
)
->squareVersion('2024-04-17')
->squareVersion('2024-05-15')
->build();

$apiResponse = $client->getLocationsApi()->listLocations();
Expand Down
3 changes: 2 additions & 1 deletion doc/models/catalog-item.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ A [CatalogObject](../../doc/models/catalog-object.md) instance of the `ITEM` typ
| `description` | `?string` | Optional | The item's description. This is a searchable attribute for use in applicable query filters, and its value length is of Unicode code points.<br><br>Deprecated at 2022-07-20, this field is planned to retire in 6 months. You should migrate to use `description_html` to set the description<br>of the [CatalogItem](entity:CatalogItem) instance. The `description` and `description_html` field values are kept in sync. If you try to<br>set the both fields, the `description_html` text value overwrites the `description` value. Updates in one field are also reflected in the other,<br>except for when you use an early version before Square API 2022-07-20 and `description_html` is set to blank, setting the `description` value to null<br>does not nullify `description_html`.<br>**Constraints**: *Maximum Length*: `4096` | getDescription(): ?string | setDescription(?string description): void |
| `abbreviation` | `?string` | Optional | The text of the item's display label in the Square Point of Sale app. Only up to the first five characters of the string are used.<br>This attribute is searchable, and its value length is of Unicode code points.<br>**Constraints**: *Maximum Length*: `24` | getAbbreviation(): ?string | setAbbreviation(?string abbreviation): void |
| `labelColor` | `?string` | Optional | The color of the item's display label in the Square Point of Sale app. This must be a valid hex color code. | getLabelColor(): ?string | setLabelColor(?string labelColor): void |
| `isTaxable` | `?bool` | Optional | Indicates whether the item is taxable (`true`) or non-taxable (`false`). Default is `true`. | getIsTaxable(): ?bool | setIsTaxable(?bool isTaxable): void |
| `availableOnline` | `?bool` | Optional | If `true`, the item can be added to shipping orders from the merchant's online store. | getAvailableOnline(): ?bool | setAvailableOnline(?bool availableOnline): void |
| `availableForPickup` | `?bool` | Optional | If `true`, the item can be added to pickup orders from the merchant's online store. | getAvailableForPickup(): ?bool | setAvailableForPickup(?bool availableForPickup): void |
| `availableElectronically` | `?bool` | Optional | If `true`, the item can be added to electronically fulfilled orders from the merchant's online store. | getAvailableElectronically(): ?bool | setAvailableElectronically(?bool availableElectronically): void |
Expand Down Expand Up @@ -44,7 +45,7 @@ A [CatalogObject](../../doc/models/catalog-object.md) instance of the `ITEM` typ
"description": "description6",
"abbreviation": "abbreviation8",
"label_color": "label_color8",
"available_online": false
"is_taxable": false
}
```

4 changes: 3 additions & 1 deletion doc/models/destination-details-card-refund-details.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
| --- | --- | --- | --- | --- | --- |
| `card` | [`?Card`](../../doc/models/card.md) | Optional | Represents the payment details of a card to be used for payments. These<br>details are determined by the payment token generated by Web Payments SDK. | getCard(): ?Card | setCard(?Card card): void |
| `entryMethod` | `?string` | Optional | The method used to enter the card's details for the refund. The method can be<br>`KEYED`, `SWIPED`, `EMV`, `ON_FILE`, or `CONTACTLESS`.<br>**Constraints**: *Maximum Length*: `50` | getEntryMethod(): ?string | setEntryMethod(?string entryMethod): void |
| `authResultCode` | `?string` | Optional | The authorization code provided by the issuer when a refund is approved.<br>**Constraints**: *Maximum Length*: `10` | getAuthResultCode(): ?string | setAuthResultCode(?string authResultCode): void |

## Example (as JSON)

Expand All @@ -23,7 +24,8 @@
"exp_month": 228,
"exp_year": 68
},
"entry_method": "entry_method4"
"entry_method": "entry_method4",
"auth_result_code": "auth_result_code6"
}
```

3 changes: 2 additions & 1 deletion doc/models/destination-details.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ Details about a refund's destination.
"exp_month": 228,
"exp_year": 68
},
"entry_method": "entry_method8"
"entry_method": "entry_method8",
"auth_result_code": "auth_result_code0"
}
}
```
Expand Down
3 changes: 2 additions & 1 deletion doc/models/get-payment-refund-response.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ present or it might be present in a FAILED state.
"exp_month": 228,
"exp_year": 68
},
"entry_method": "entry_method8"
"entry_method": "entry_method8",
"auth_result_code": "auth_result_code0"
}
}
},
Expand Down
3 changes: 2 additions & 1 deletion doc/models/list-payment-refunds-response.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ Either `errors` or `refunds` is present in a given response (never both).
"exp_month": 228,
"exp_year": 68
},
"entry_method": "entry_method8"
"entry_method": "entry_method8",
"auth_result_code": "auth_result_code0"
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion doc/models/payment-refund.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ the original payment and the amount of money refunded.
"exp_month": 228,
"exp_year": 68
},
"entry_method": "entry_method8"
"entry_method": "entry_method8",
"auth_result_code": "auth_result_code0"
}
},
"amount_money": {
Expand Down
1 change: 1 addition & 0 deletions doc/models/payment.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Represents a payment processed by the Square API.
| `receiptUrl` | `?string` | Optional | The URL for the payment's receipt.<br>The field is only populated for COMPLETED payments.<br>**Constraints**: *Maximum Length*: `255` | getReceiptUrl(): ?string | setReceiptUrl(?string receiptUrl): void |
| `deviceDetails` | [`?DeviceDetails`](../../doc/models/device-details.md) | Optional | Details about the device that took the payment. | getDeviceDetails(): ?DeviceDetails | setDeviceDetails(?DeviceDetails deviceDetails): void |
| `applicationDetails` | [`?ApplicationDetails`](../../doc/models/application-details.md) | Optional | Details about the application that took the payment. | getApplicationDetails(): ?ApplicationDetails | setApplicationDetails(?ApplicationDetails applicationDetails): void |
| `isOfflinePayment` | `?bool` | Optional | Whether or not this payment was taken offline. | getIsOfflinePayment(): ?bool | setIsOfflinePayment(?bool isOfflinePayment): void |
| `versionToken` | `?string` | Optional | Used for optimistic concurrency. This opaque token identifies a specific version of the<br>`Payment` object. | getVersionToken(): ?string | setVersionToken(?string versionToken): void |

## Example (as JSON)
Expand Down
3 changes: 2 additions & 1 deletion doc/models/refund-payment-response.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ present, or it might be present with a status of `FAILED`.
"exp_month": 228,
"exp_year": 68
},
"entry_method": "entry_method8"
"entry_method": "entry_method8",
"auth_result_code": "auth_result_code0"
}
}
},
Expand Down
5 changes: 4 additions & 1 deletion src/Authentication/BearerAuthManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Core\Authentication\CoreAuth;
use Core\Request\Parameters\HeaderParam;
use Core\Utils\CoreHelper;
use Square\BearerAuthCredentials;

/**
Expand All @@ -22,7 +23,9 @@ class BearerAuthManager extends CoreAuth implements BearerAuthCredentials
*/
public function __construct(string $accessToken)
{
parent::__construct(HeaderParam::init('Authorization', 'Bearer ' . $accessToken)->required());
parent::__construct(
HeaderParam::init('Authorization', CoreHelper::getBearerAuthString($accessToken))->requiredNonEmpty()
);
$this->accessToken = $accessToken;
}

Expand Down
2 changes: 1 addition & 1 deletion src/ConfigurationDefaults.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ConfigurationDefaults

public const HTTP_METHODS_TO_RETRY = ['GET', 'PUT'];

public const SQUARE_VERSION = '2024-04-17';
public const SQUARE_VERSION = '2024-05-15';

public const ADDITIONAL_HEADERS = [];

Expand Down
18 changes: 18 additions & 0 deletions src/Models/Builders/CatalogItemBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,24 @@ public function unsetLabelColor(): self
return $this;
}

/**
* Sets is taxable field.
*/
public function isTaxable(?bool $value): self
{
$this->instance->setIsTaxable($value);
return $this;
}

/**
* Unsets is taxable field.
*/
public function unsetIsTaxable(): self
{
$this->instance->unsetIsTaxable();
return $this;
}

/**
* Sets available online field.
*/
Expand Down
18 changes: 18 additions & 0 deletions src/Models/Builders/DestinationDetailsCardRefundDetailsBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,24 @@ public function unsetEntryMethod(): self
return $this;
}

/**
* Sets auth result code field.
*/
public function authResultCode(?string $value): self
{
$this->instance->setAuthResultCode($value);
return $this;
}

/**
* Unsets auth result code field.
*/
public function unsetAuthResultCode(): self
{
$this->instance->unsetAuthResultCode();
return $this;
}

/**
* Initializes a new destination details card refund details object.
*/
Expand Down
9 changes: 9 additions & 0 deletions src/Models/Builders/PaymentBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,15 @@ public function applicationDetails(?ApplicationDetails $value): self
return $this;
}

/**
* Sets is offline payment field.
*/
public function isOfflinePayment(?bool $value): self
{
$this->instance->setIsOfflinePayment($value);
return $this;
}

/**
* Sets version token field.
*/
Expand Down
40 changes: 40 additions & 0 deletions src/Models/CatalogItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ class CatalogItem implements \JsonSerializable
*/
private $labelColor = [];

/**
* @var array
*/
private $isTaxable = [];

/**
* @var array
*/
Expand Down Expand Up @@ -305,6 +310,38 @@ public function unsetLabelColor(): void
$this->labelColor = [];
}

/**
* Returns Is Taxable.
* Indicates whether the item is taxable (`true`) or non-taxable (`false`). Default is `true`.
*/
public function getIsTaxable(): ?bool
{
if (count($this->isTaxable) == 0) {
return null;
}
return $this->isTaxable['value'];
}

/**
* Sets Is Taxable.
* Indicates whether the item is taxable (`true`) or non-taxable (`false`). Default is `true`.
*
* @maps is_taxable
*/
public function setIsTaxable(?bool $isTaxable): void
{
$this->isTaxable['value'] = $isTaxable;
}

/**
* Unsets Is Taxable.
* Indicates whether the item is taxable (`true`) or non-taxable (`false`). Default is `true`.
*/
public function unsetIsTaxable(): void
{
$this->isTaxable = [];
}

/**
* Returns Available Online.
* If `true`, the item can be added to shipping orders from the merchant's online store.
Expand Down Expand Up @@ -1096,6 +1133,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false)
if (!empty($this->labelColor)) {
$json['label_color'] = $this->labelColor['value'];
}
if (!empty($this->isTaxable)) {
$json['is_taxable'] = $this->isTaxable['value'];
}
if (!empty($this->availableOnline)) {
$json['available_online'] = $this->availableOnline['value'];
}
Expand Down
44 changes: 42 additions & 2 deletions src/Models/DestinationDetailsCardRefundDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ class DestinationDetailsCardRefundDetails implements \JsonSerializable
*/
private $entryMethod = [];

/**
* @var array
*/
private $authResultCode = [];

/**
* Returns Card.
* Represents the payment details of a card to be used for payments. These
Expand Down Expand Up @@ -75,6 +80,38 @@ public function unsetEntryMethod(): void
$this->entryMethod = [];
}

/**
* Returns Auth Result Code.
* The authorization code provided by the issuer when a refund is approved.
*/
public function getAuthResultCode(): ?string
{
if (count($this->authResultCode) == 0) {
return null;
}
return $this->authResultCode['value'];
}

/**
* Sets Auth Result Code.
* The authorization code provided by the issuer when a refund is approved.
*
* @maps auth_result_code
*/
public function setAuthResultCode(?string $authResultCode): void
{
$this->authResultCode['value'] = $authResultCode;
}

/**
* Unsets Auth Result Code.
* The authorization code provided by the issuer when a refund is approved.
*/
public function unsetAuthResultCode(): void
{
$this->authResultCode = [];
}

/**
* Encode this object to JSON
*
Expand All @@ -88,10 +125,13 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false)
{
$json = [];
if (isset($this->card)) {
$json['card'] = $this->card;
$json['card'] = $this->card;
}
if (!empty($this->entryMethod)) {
$json['entry_method'] = $this->entryMethod['value'];
$json['entry_method'] = $this->entryMethod['value'];
}
if (!empty($this->authResultCode)) {
$json['auth_result_code'] = $this->authResultCode['value'];
}
$json = array_filter($json, function ($val) {
return $val !== null;
Expand Down
Loading
Loading