Skip to content

Commit

Permalink
Merge pull request #93 from square/release/21.1.0.20220823
Browse files Browse the repository at this point in the history
Generated PR for Release: 21.1.0.20220823
  • Loading branch information
Xiao Hu authored Aug 22, 2022
2 parents 1e54ffa + 63ac88f commit eff2315
Show file tree
Hide file tree
Showing 9 changed files with 124 additions and 11 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": "21.0.0.20220817",
"version": "21.1.0.20220823",
"type": "library",
"keywords": [
"Square",
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*: `'2022-08-17'` |
| `squareVersion` | `string` | Square Connect API versions<br>*Default*: `'2022-08-23'` |
| `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 @@ -27,7 +27,7 @@ The API client can be initialized as follows:
$client = new Square\SquareClient([
// Set authentication parameters
'accessToken' => 'AccessToken',
'squareVersion' => '2022-08-17',
'squareVersion' => '2022-08-23',

// Set the environment
'environment' => 'production',
Expand All @@ -54,7 +54,7 @@ require_once "vendor/autoload.php";

$client = new Square\SquareClient([
'accessToken' => 'AccessToken',
'squareVersion' => '2022-08-17',
'squareVersion' => '2022-08-23',
]);

$locationsApi = $client->getLocationsApi();
Expand Down
6 changes: 4 additions & 2 deletions doc/models/buy-now-pay-later-details.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,17 @@ Additional details about a Buy Now Pay Later payment type.

| Name | Type | Tags | Description | Getter | Setter |
| --- | --- | --- | --- | --- | --- |
| `brand` | `?string` | Optional | The brand used for the Buy Now Pay Later payment.<br>The brand can be `AFTERPAY` or `UNKNOWN`.<br>**Constraints**: *Maximum Length*: `50` | getBrand(): ?string | setBrand(?string brand): void |
| `brand` | `?string` | Optional | The brand used for the Buy Now Pay Later payment.<br>The brand can be `AFTERPAY`, `CLEARPAY` or `UNKNOWN`.<br>**Constraints**: *Maximum Length*: `50` | getBrand(): ?string | setBrand(?string brand): void |
| `afterpayDetails` | [`?AfterpayDetails`](../../doc/models/afterpay-details.md) | Optional | Additional details about Afterpay payments. | getAfterpayDetails(): ?AfterpayDetails | setAfterpayDetails(?AfterpayDetails afterpayDetails): void |
| `clearpayDetails` | [`?ClearpayDetails`](../../doc/models/clearpay-details.md) | Optional | Additional details about Clearpay payments. | getClearpayDetails(): ?ClearpayDetails | setClearpayDetails(?ClearpayDetails clearpayDetails): void |

## Example (as JSON)

```json
{
"brand": null,
"afterpay_details": null
"afterpay_details": null,
"clearpay_details": null
}
```

23 changes: 23 additions & 0 deletions doc/models/clearpay-details.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

# Clearpay Details

Additional details about Clearpay payments.

## Structure

`ClearpayDetails`

## Fields

| Name | Type | Tags | Description | Getter | Setter |
| --- | --- | --- | --- | --- | --- |
| `emailAddress` | `?string` | Optional | Email address on the buyer's Clearpay account.<br>**Constraints**: *Maximum Length*: `255` | getEmailAddress(): ?string | setEmailAddress(?string emailAddress): void |

## Example (as JSON)

```json
{
"email_address": null
}
```

2 changes: 1 addition & 1 deletion src/Apis/BaseApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class BaseApi
*/
protected $internalUserAgent;

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

/**
* Constructor that sets the timeout of requests
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 = '2022-08-17';
public const SQUARE_VERSION = '2022-08-23';

public const ADDITIONAL_HEADERS = [];

Expand Down
32 changes: 30 additions & 2 deletions src/Models/BuyNowPayLaterDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,15 @@ class BuyNowPayLaterDetails implements \JsonSerializable
*/
private $afterpayDetails;

/**
* @var ClearpayDetails|null
*/
private $clearpayDetails;

/**
* Returns Brand.
* The brand used for the Buy Now Pay Later payment.
* The brand can be `AFTERPAY` or `UNKNOWN`.
* The brand can be `AFTERPAY`, `CLEARPAY` or `UNKNOWN`.
*/
public function getBrand(): ?string
{
Expand All @@ -34,7 +39,7 @@ public function getBrand(): ?string
/**
* Sets Brand.
* The brand used for the Buy Now Pay Later payment.
* The brand can be `AFTERPAY` or `UNKNOWN`.
* The brand can be `AFTERPAY`, `CLEARPAY` or `UNKNOWN`.
*
* @maps brand
*/
Expand Down Expand Up @@ -63,6 +68,26 @@ public function setAfterpayDetails(?AfterpayDetails $afterpayDetails): void
$this->afterpayDetails = $afterpayDetails;
}

/**
* Returns Clearpay Details.
* Additional details about Clearpay payments.
*/
public function getClearpayDetails(): ?ClearpayDetails
{
return $this->clearpayDetails;
}

/**
* Sets Clearpay Details.
* Additional details about Clearpay payments.
*
* @maps clearpay_details
*/
public function setClearpayDetails(?ClearpayDetails $clearpayDetails): void
{
$this->clearpayDetails = $clearpayDetails;
}

/**
* Encode this object to JSON
*
Expand All @@ -81,6 +106,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false)
if (isset($this->afterpayDetails)) {
$json['afterpay_details'] = $this->afterpayDetails;
}
if (isset($this->clearpayDetails)) {
$json['clearpay_details'] = $this->clearpayDetails;
}
$json = array_filter($json, function ($val) {
return $val !== null;
});
Expand Down
60 changes: 60 additions & 0 deletions src/Models/ClearpayDetails.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php

declare(strict_types=1);

namespace Square\Models;

use stdClass;

/**
* Additional details about Clearpay payments.
*/
class ClearpayDetails implements \JsonSerializable
{
/**
* @var string|null
*/
private $emailAddress;

/**
* Returns Email Address.
* Email address on the buyer's Clearpay account.
*/
public function getEmailAddress(): ?string
{
return $this->emailAddress;
}

/**
* Sets Email Address.
* Email address on the buyer's Clearpay account.
*
* @maps email_address
*/
public function setEmailAddress(?string $emailAddress): void
{
$this->emailAddress = $emailAddress;
}

/**
* Encode this object to JSON
*
* @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields
* are set. (default: false)
*
* @return array|stdClass
*/
#[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1)
public function jsonSerialize(bool $asArrayWhenEmpty = false)
{
$json = [];
if (isset($this->emailAddress)) {
$json['email_address'] = $this->emailAddress;
}
$json = array_filter($json, function ($val) {
return $val !== null;
});

return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json;
}
}
2 changes: 1 addition & 1 deletion src/SquareClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ public function getBearerAuthCredentials(): ?BearerAuthCredentials
*/
public function getSdkVersion(): string
{
return '21.0.0.20220817';
return '21.1.0.20220823';
}

/**
Expand Down

0 comments on commit eff2315

Please sign in to comment.