Skip to content

Commit

Permalink
Merge pull request #89 from square/release/20.1.0.20220720
Browse files Browse the repository at this point in the history
Generated PR for Release: 20.1.0.20220720
  • Loading branch information
joanc-sq authored Jul 21, 2022
2 parents 8b222dc + fe35448 commit 9a2bf04
Show file tree
Hide file tree
Showing 7 changed files with 141 additions and 13 deletions.
2 changes: 1 addition & 1 deletion 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": "20.0.0.20220720",
"version": "20.1.0.20220720",
"type": "library",
"keywords": [
"Square",
Expand Down
1 change: 1 addition & 0 deletions doc/models/obtain-token-request.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
| `migrationToken` | `?string` | Optional | A legacy OAuth access token obtained using a Connect API version prior<br>to 2019-03-13. This parameter is required if `grant_type` is set to<br>`migration_token` to indicate that the application wants to get a replacement<br>OAuth access token. The response also returns a refresh token.<br>For more information, see [Migrate to Using Refresh Tokens](https://developer.squareup.com/docs/oauth-api/migrate-to-refresh-tokens).<br>**Constraints**: *Minimum Length*: `2`, *Maximum Length*: `1024` | getMigrationToken(): ?string | setMigrationToken(?string migrationToken): void |
| `scopes` | `?(string[])` | Optional | A JSON list of strings representing the permissions that the application is requesting.<br>For example, "`["MERCHANT_PROFILE_READ","PAYMENTS_READ","BANK_ACCOUNTS_READ"]`".<br><br>The access token returned in the response is granted the permissions<br>that comprise the intersection between the requested list of permissions and those<br>that belong to the provided refresh token. | getScopes(): ?array | setScopes(?array scopes): void |
| `shortLived` | `?bool` | Optional | A Boolean indicating a request for a short-lived access token.<br><br>The short-lived access token returned in the response expires in 24 hours. | getShortLived(): ?bool | setShortLived(?bool shortLived): void |
| `codeVerifier` | `?string` | Optional | Must be provided when using PKCE OAuth flow. The `code_verifier` will be used to verify against the<br>`code_challenge` associated with the `authorization_code`. | getCodeVerifier(): ?string | setCodeVerifier(?string codeVerifier): void |

## Example (as JSON)

Expand Down
3 changes: 3 additions & 0 deletions doc/models/obtain-token-response.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
| `refreshToken` | `?string` | Optional | A refresh token. OAuth refresh tokens are 64 bytes long.<br>For more information, see [Refresh, Revoke, and Limit the Scope of OAuth Tokens](https://developer.squareup.com/docs/oauth-api/refresh-revoke-limit-scope).<br>**Constraints**: *Minimum Length*: `2`, *Maximum Length*: `1024` | getRefreshToken(): ?string | setRefreshToken(?string refreshToken): void |
| `shortLived` | `?bool` | Optional | A Boolean indicating that the access token is a short-lived access token.<br>The short-lived access token returned in the response expires in 24 hours. | getShortLived(): ?bool | setShortLived(?bool shortLived): void |
| `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void |
| `refreshTokenExpiresAt` | `?string` | Optional | The date when the `refresh_token` expires, in [ISO 8601](http://www.iso.org/iso/home/standards/iso8601.htm) format.<br>**Constraints**: *Minimum Length*: `20`, *Maximum Length*: `48` | getRefreshTokenExpiresAt(): ?string | setRefreshTokenExpiresAt(?string refreshTokenExpiresAt): void |
| `appSubscriptionId` | `?string` | Optional | The subscription id of a v2 subscription the merchant signed up<br>for. The subscription id is only present if the merchant signed up for a subscription during authorization. | getAppSubscriptionId(): ?string | setAppSubscriptionId(?string appSubscriptionId): void |
| `appPlanId` | `?string` | Optional | The plan id of a v2 subscription plan the merchant signed up<br>for. The plan id is only present if the merchant signed up for a subscription plan during authorization. | getAppPlanId(): ?string | setAppPlanId(?string appPlanId): void |

## Example (as JSON)

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/20.0.0.20220720 ({api-version}) {engine}/{engine-version} ({os-info}) {detail}';
private static $userAgent = 'Square-PHP-SDK/20.1.0.20220720 ({api-version}) {engine}/{engine-version} ({os-info}) {detail}';

/**
* Constructor that sets the timeout of requests
Expand Down
30 changes: 30 additions & 0 deletions src/Models/ObtainTokenRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ class ObtainTokenRequest implements \JsonSerializable
*/
private $shortLived;

/**
* @var string|null
*/
private $codeVerifier;

/**
* @param string $clientId
* @param string $clientSecret
Expand Down Expand Up @@ -294,6 +299,28 @@ public function setShortLived(?bool $shortLived): void
$this->shortLived = $shortLived;
}

/**
* Returns Code Verifier.
* Must be provided when using PKCE OAuth flow. The `code_verifier` will be used to verify against the
* `code_challenge` associated with the `authorization_code`.
*/
public function getCodeVerifier(): ?string
{
return $this->codeVerifier;
}

/**
* Sets Code Verifier.
* Must be provided when using PKCE OAuth flow. The `code_verifier` will be used to verify against the
* `code_challenge` associated with the `authorization_code`.
*
* @maps code_verifier
*/
public function setCodeVerifier(?string $codeVerifier): void
{
$this->codeVerifier = $codeVerifier;
}

/**
* Encode this object to JSON
*
Expand Down Expand Up @@ -327,6 +354,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false)
if (isset($this->shortLived)) {
$json['short_lived'] = $this->shortLived;
}
if (isset($this->codeVerifier)) {
$json['code_verifier'] = $this->codeVerifier;
}
$json = array_filter($json, function ($val) {
return $val !== null;
});
Expand Down
114 changes: 104 additions & 10 deletions src/Models/ObtainTokenResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,21 @@ class ObtainTokenResponse implements \JsonSerializable
*/
private $errors;

/**
* @var string|null
*/
private $refreshTokenExpiresAt;

/**
* @var string|null
*/
private $appSubscriptionId;

/**
* @var string|null
*/
private $appPlanId;

/**
* Returns Access Token.
* A valid OAuth access token. OAuth access tokens are 64 bytes long.
Expand Down Expand Up @@ -284,6 +299,76 @@ public function setErrors(?array $errors): void
$this->errors = $errors;
}

/**
* Returns Refresh Token Expires At.
* The date when the `refresh_token` expires, in [ISO 8601](http://www.iso.
* org/iso/home/standards/iso8601.htm) format.
*/
public function getRefreshTokenExpiresAt(): ?string
{
return $this->refreshTokenExpiresAt;
}

/**
* Sets Refresh Token Expires At.
* The date when the `refresh_token` expires, in [ISO 8601](http://www.iso.
* org/iso/home/standards/iso8601.htm) format.
*
* @maps refresh_token_expires_at
*/
public function setRefreshTokenExpiresAt(?string $refreshTokenExpiresAt): void
{
$this->refreshTokenExpiresAt = $refreshTokenExpiresAt;
}

/**
* Returns App Subscription Id.
* The subscription id of a v2 subscription the merchant signed up
* for. The subscription id is only present if the merchant signed up for a subscription during
* authorization.
*/
public function getAppSubscriptionId(): ?string
{
return $this->appSubscriptionId;
}

/**
* Sets App Subscription Id.
* The subscription id of a v2 subscription the merchant signed up
* for. The subscription id is only present if the merchant signed up for a subscription during
* authorization.
*
* @maps app_subscription_id
*/
public function setAppSubscriptionId(?string $appSubscriptionId): void
{
$this->appSubscriptionId = $appSubscriptionId;
}

/**
* Returns App Plan Id.
* The plan id of a v2 subscription plan the merchant signed up
* for. The plan id is only present if the merchant signed up for a subscription plan during
* authorization.
*/
public function getAppPlanId(): ?string
{
return $this->appPlanId;
}

/**
* Sets App Plan Id.
* The plan id of a v2 subscription plan the merchant signed up
* for. The plan id is only present if the merchant signed up for a subscription plan during
* authorization.
*
* @maps app_plan_id
*/
public function setAppPlanId(?string $appPlanId): void
{
$this->appPlanId = $appPlanId;
}

/**
* Encode this object to JSON
*
Expand All @@ -297,34 +382,43 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false)
{
$json = [];
if (isset($this->accessToken)) {
$json['access_token'] = $this->accessToken;
$json['access_token'] = $this->accessToken;
}
if (isset($this->tokenType)) {
$json['token_type'] = $this->tokenType;
$json['token_type'] = $this->tokenType;
}
if (isset($this->expiresAt)) {
$json['expires_at'] = $this->expiresAt;
$json['expires_at'] = $this->expiresAt;
}
if (isset($this->merchantId)) {
$json['merchant_id'] = $this->merchantId;
$json['merchant_id'] = $this->merchantId;
}
if (isset($this->subscriptionId)) {
$json['subscription_id'] = $this->subscriptionId;
$json['subscription_id'] = $this->subscriptionId;
}
if (isset($this->planId)) {
$json['plan_id'] = $this->planId;
$json['plan_id'] = $this->planId;
}
if (isset($this->idToken)) {
$json['id_token'] = $this->idToken;
$json['id_token'] = $this->idToken;
}
if (isset($this->refreshToken)) {
$json['refresh_token'] = $this->refreshToken;
$json['refresh_token'] = $this->refreshToken;
}
if (isset($this->shortLived)) {
$json['short_lived'] = $this->shortLived;
$json['short_lived'] = $this->shortLived;
}
if (isset($this->errors)) {
$json['errors'] = $this->errors;
$json['errors'] = $this->errors;
}
if (isset($this->refreshTokenExpiresAt)) {
$json['refresh_token_expires_at'] = $this->refreshTokenExpiresAt;
}
if (isset($this->appSubscriptionId)) {
$json['app_subscription_id'] = $this->appSubscriptionId;
}
if (isset($this->appPlanId)) {
$json['app_plan_id'] = $this->appPlanId;
}
$json = array_filter($json, function ($val) {
return $val !== null;
Expand Down
2 changes: 1 addition & 1 deletion src/SquareClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ public function getBearerAuthCredentials(): ?BearerAuthCredentials
*/
public function getSdkVersion(): string
{
return '20.0.0.20220720';
return '20.1.0.20220720';
}

/**
Expand Down

0 comments on commit 9a2bf04

Please sign in to comment.