-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Merge pull request #139 from square/release/38.2.0.20241017
Generated PR for Release: 38.2.0.20241017
Showing
20 changed files
with
720 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
# Destination Details Cash Refund Details | ||
|
||
Stores details about a cash refund. Contains only non-confidential information. | ||
|
||
## Structure | ||
|
||
`DestinationDetailsCashRefundDetails` | ||
|
||
## Fields | ||
|
||
| Name | Type | Tags | Description | Getter | Setter | | ||
| --- | --- | --- | --- | --- | --- | | ||
| `sellerSuppliedMoney` | [`Money`](../../doc/models/money.md) | Required | Represents an amount of money. `Money` fields can be signed or unsigned.<br>Fields that do not explicitly define whether they are signed or unsigned are<br>considered unsigned and can only hold positive amounts. For signed fields, the<br>sign of the value indicates the purpose of the money transfer. See<br>[Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts)<br>for more information. | getSellerSuppliedMoney(): Money | setSellerSuppliedMoney(Money sellerSuppliedMoney): void | | ||
| `changeBackMoney` | [`?Money`](../../doc/models/money.md) | Optional | Represents an amount of money. `Money` fields can be signed or unsigned.<br>Fields that do not explicitly define whether they are signed or unsigned are<br>considered unsigned and can only hold positive amounts. For signed fields, the<br>sign of the value indicates the purpose of the money transfer. See<br>[Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts)<br>for more information. | getChangeBackMoney(): ?Money | setChangeBackMoney(?Money changeBackMoney): void | | ||
|
||
## Example (as JSON) | ||
|
||
```json | ||
{ | ||
"seller_supplied_money": { | ||
"amount": 36, | ||
"currency": "AZN" | ||
}, | ||
"change_back_money": { | ||
"amount": 78, | ||
"currency": "DJF" | ||
} | ||
} | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
# Destination Details External Refund Details | ||
|
||
Stores details about an external refund. Contains only non-confidential information. | ||
|
||
## Structure | ||
|
||
`DestinationDetailsExternalRefundDetails` | ||
|
||
## Fields | ||
|
||
| Name | Type | Tags | Description | Getter | Setter | | ||
| --- | --- | --- | --- | --- | --- | | ||
| `type` | `string` | Required | The type of external refund the seller paid to the buyer. It can be one of the<br>following:<br><br>- CHECK - Refunded using a physical check.<br>- BANK_TRANSFER - Refunded using external bank transfer.<br>- OTHER\_GIFT\_CARD - Refunded using a non-Square gift card.<br>- CRYPTO - Refunded using a crypto currency.<br>- SQUARE_CASH - Refunded using Square Cash App.<br>- SOCIAL - Refunded using peer-to-peer payment applications.<br>- EXTERNAL - A third-party application gathered this refund outside of Square.<br>- EMONEY - Refunded using an E-money provider.<br>- CARD - A credit or debit card that Square does not support.<br>- STORED_BALANCE - Use for house accounts, store credit, and so forth.<br>- FOOD_VOUCHER - Restaurant voucher provided by employers to employees to pay for meals<br>- OTHER - A type not listed here.<br>**Constraints**: *Maximum Length*: `50` | getType(): string | setType(string type): void | | ||
| `source` | `string` | Required | A description of the external refund source. For example,<br>"Food Delivery Service".<br>**Constraints**: *Maximum Length*: `255` | getSource(): string | setSource(string source): void | | ||
| `sourceId` | `?string` | Optional | An ID to associate the refund to its originating source.<br>**Constraints**: *Maximum Length*: `255` | getSourceId(): ?string | setSourceId(?string sourceId): void | | ||
|
||
## Example (as JSON) | ||
|
||
```json | ||
{ | ||
"type": "type4", | ||
"source": "source2", | ||
"source_id": "source_id0" | ||
} | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
src/Models/Builders/DestinationDetailsCashRefundDetailsBuilder.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Square\Models\Builders; | ||
|
||
use Core\Utils\CoreHelper; | ||
use Square\Models\DestinationDetailsCashRefundDetails; | ||
use Square\Models\Money; | ||
|
||
/** | ||
* Builder for model DestinationDetailsCashRefundDetails | ||
* | ||
* @see DestinationDetailsCashRefundDetails | ||
*/ | ||
class DestinationDetailsCashRefundDetailsBuilder | ||
{ | ||
/** | ||
* @var DestinationDetailsCashRefundDetails | ||
*/ | ||
private $instance; | ||
|
||
private function __construct(DestinationDetailsCashRefundDetails $instance) | ||
{ | ||
$this->instance = $instance; | ||
} | ||
|
||
/** | ||
* Initializes a new destination details cash refund details Builder object. | ||
*/ | ||
public static function init(Money $sellerSuppliedMoney): self | ||
{ | ||
return new self(new DestinationDetailsCashRefundDetails($sellerSuppliedMoney)); | ||
} | ||
|
||
/** | ||
* Sets change back money field. | ||
*/ | ||
public function changeBackMoney(?Money $value): self | ||
{ | ||
$this->instance->setChangeBackMoney($value); | ||
return $this; | ||
} | ||
|
||
/** | ||
* Initializes a new destination details cash refund details object. | ||
*/ | ||
public function build(): DestinationDetailsCashRefundDetails | ||
{ | ||
return CoreHelper::clone($this->instance); | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
src/Models/Builders/DestinationDetailsExternalRefundDetailsBuilder.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Square\Models\Builders; | ||
|
||
use Core\Utils\CoreHelper; | ||
use Square\Models\DestinationDetailsExternalRefundDetails; | ||
|
||
/** | ||
* Builder for model DestinationDetailsExternalRefundDetails | ||
* | ||
* @see DestinationDetailsExternalRefundDetails | ||
*/ | ||
class DestinationDetailsExternalRefundDetailsBuilder | ||
{ | ||
/** | ||
* @var DestinationDetailsExternalRefundDetails | ||
*/ | ||
private $instance; | ||
|
||
private function __construct(DestinationDetailsExternalRefundDetails $instance) | ||
{ | ||
$this->instance = $instance; | ||
} | ||
|
||
/** | ||
* Initializes a new destination details external refund details Builder object. | ||
*/ | ||
public static function init(string $type, string $source): self | ||
{ | ||
return new self(new DestinationDetailsExternalRefundDetails($type, $source)); | ||
} | ||
|
||
/** | ||
* Sets source id field. | ||
*/ | ||
public function sourceId(?string $value): self | ||
{ | ||
$this->instance->setSourceId($value); | ||
return $this; | ||
} | ||
|
||
/** | ||
* Unsets source id field. | ||
*/ | ||
public function unsetSourceId(): self | ||
{ | ||
$this->instance->unsetSourceId(); | ||
return $this; | ||
} | ||
|
||
/** | ||
* Initializes a new destination details external refund details object. | ||
*/ | ||
public function build(): DestinationDetailsExternalRefundDetails | ||
{ | ||
return CoreHelper::clone($this->instance); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Square\Models; | ||
|
||
use stdClass; | ||
|
||
/** | ||
* Stores details about a cash refund. Contains only non-confidential information. | ||
*/ | ||
class DestinationDetailsCashRefundDetails implements \JsonSerializable | ||
{ | ||
/** | ||
* @var Money | ||
*/ | ||
private $sellerSuppliedMoney; | ||
|
||
/** | ||
* @var Money|null | ||
*/ | ||
private $changeBackMoney; | ||
|
||
/** | ||
* @param Money $sellerSuppliedMoney | ||
*/ | ||
public function __construct(Money $sellerSuppliedMoney) | ||
{ | ||
$this->sellerSuppliedMoney = $sellerSuppliedMoney; | ||
} | ||
|
||
/** | ||
* Returns Seller Supplied Money. | ||
* Represents an amount of money. `Money` fields can be signed or unsigned. | ||
* Fields that do not explicitly define whether they are signed or unsigned are | ||
* considered unsigned and can only hold positive amounts. For signed fields, the | ||
* sign of the value indicates the purpose of the money transfer. See | ||
* [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with- | ||
* monetary-amounts) | ||
* for more information. | ||
*/ | ||
public function getSellerSuppliedMoney(): Money | ||
{ | ||
return $this->sellerSuppliedMoney; | ||
} | ||
|
||
/** | ||
* Sets Seller Supplied Money. | ||
* Represents an amount of money. `Money` fields can be signed or unsigned. | ||
* Fields that do not explicitly define whether they are signed or unsigned are | ||
* considered unsigned and can only hold positive amounts. For signed fields, the | ||
* sign of the value indicates the purpose of the money transfer. See | ||
* [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with- | ||
* monetary-amounts) | ||
* for more information. | ||
* | ||
* @required | ||
* @maps seller_supplied_money | ||
*/ | ||
public function setSellerSuppliedMoney(Money $sellerSuppliedMoney): void | ||
{ | ||
$this->sellerSuppliedMoney = $sellerSuppliedMoney; | ||
} | ||
|
||
/** | ||
* Returns Change Back Money. | ||
* Represents an amount of money. `Money` fields can be signed or unsigned. | ||
* Fields that do not explicitly define whether they are signed or unsigned are | ||
* considered unsigned and can only hold positive amounts. For signed fields, the | ||
* sign of the value indicates the purpose of the money transfer. See | ||
* [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with- | ||
* monetary-amounts) | ||
* for more information. | ||
*/ | ||
public function getChangeBackMoney(): ?Money | ||
{ | ||
return $this->changeBackMoney; | ||
} | ||
|
||
/** | ||
* Sets Change Back Money. | ||
* Represents an amount of money. `Money` fields can be signed or unsigned. | ||
* Fields that do not explicitly define whether they are signed or unsigned are | ||
* considered unsigned and can only hold positive amounts. For signed fields, the | ||
* sign of the value indicates the purpose of the money transfer. See | ||
* [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with- | ||
* monetary-amounts) | ||
* for more information. | ||
* | ||
* @maps change_back_money | ||
*/ | ||
public function setChangeBackMoney(?Money $changeBackMoney): void | ||
{ | ||
$this->changeBackMoney = $changeBackMoney; | ||
} | ||
|
||
/** | ||
* 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 = []; | ||
$json['seller_supplied_money'] = $this->sellerSuppliedMoney; | ||
if (isset($this->changeBackMoney)) { | ||
$json['change_back_money'] = $this->changeBackMoney; | ||
} | ||
$json = array_filter($json, function ($val) { | ||
return $val !== null; | ||
}); | ||
|
||
return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Square\Models; | ||
|
||
use stdClass; | ||
|
||
/** | ||
* Stores details about an external refund. Contains only non-confidential information. | ||
*/ | ||
class DestinationDetailsExternalRefundDetails implements \JsonSerializable | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
private $type; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private $source; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
private $sourceId = []; | ||
|
||
/** | ||
* @param string $type | ||
* @param string $source | ||
*/ | ||
public function __construct(string $type, string $source) | ||
{ | ||
$this->type = $type; | ||
$this->source = $source; | ||
} | ||
|
||
/** | ||
* Returns Type. | ||
* The type of external refund the seller paid to the buyer. It can be one of the | ||
* following: | ||
* - CHECK - Refunded using a physical check. | ||
* - BANK_TRANSFER - Refunded using external bank transfer. | ||
* - OTHER\_GIFT\_CARD - Refunded using a non-Square gift card. | ||
* - CRYPTO - Refunded using a crypto currency. | ||
* - SQUARE_CASH - Refunded using Square Cash App. | ||
* - SOCIAL - Refunded using peer-to-peer payment applications. | ||
* - EXTERNAL - A third-party application gathered this refund outside of Square. | ||
* - EMONEY - Refunded using an E-money provider. | ||
* - CARD - A credit or debit card that Square does not support. | ||
* - STORED_BALANCE - Use for house accounts, store credit, and so forth. | ||
* - FOOD_VOUCHER - Restaurant voucher provided by employers to employees to pay for meals | ||
* - OTHER - A type not listed here. | ||
*/ | ||
public function getType(): string | ||
{ | ||
return $this->type; | ||
} | ||
|
||
/** | ||
* Sets Type. | ||
* The type of external refund the seller paid to the buyer. It can be one of the | ||
* following: | ||
* - CHECK - Refunded using a physical check. | ||
* - BANK_TRANSFER - Refunded using external bank transfer. | ||
* - OTHER\_GIFT\_CARD - Refunded using a non-Square gift card. | ||
* - CRYPTO - Refunded using a crypto currency. | ||
* - SQUARE_CASH - Refunded using Square Cash App. | ||
* - SOCIAL - Refunded using peer-to-peer payment applications. | ||
* - EXTERNAL - A third-party application gathered this refund outside of Square. | ||
* - EMONEY - Refunded using an E-money provider. | ||
* - CARD - A credit or debit card that Square does not support. | ||
* - STORED_BALANCE - Use for house accounts, store credit, and so forth. | ||
* - FOOD_VOUCHER - Restaurant voucher provided by employers to employees to pay for meals | ||
* - OTHER - A type not listed here. | ||
* | ||
* @required | ||
* @maps type | ||
*/ | ||
public function setType(string $type): void | ||
{ | ||
$this->type = $type; | ||
} | ||
|
||
/** | ||
* Returns Source. | ||
* A description of the external refund source. For example, | ||
* "Food Delivery Service". | ||
*/ | ||
public function getSource(): string | ||
{ | ||
return $this->source; | ||
} | ||
|
||
/** | ||
* Sets Source. | ||
* A description of the external refund source. For example, | ||
* "Food Delivery Service". | ||
* | ||
* @required | ||
* @maps source | ||
*/ | ||
public function setSource(string $source): void | ||
{ | ||
$this->source = $source; | ||
} | ||
|
||
/** | ||
* Returns Source Id. | ||
* An ID to associate the refund to its originating source. | ||
*/ | ||
public function getSourceId(): ?string | ||
{ | ||
if (count($this->sourceId) == 0) { | ||
return null; | ||
} | ||
return $this->sourceId['value']; | ||
} | ||
|
||
/** | ||
* Sets Source Id. | ||
* An ID to associate the refund to its originating source. | ||
* | ||
* @maps source_id | ||
*/ | ||
public function setSourceId(?string $sourceId): void | ||
{ | ||
$this->sourceId['value'] = $sourceId; | ||
} | ||
|
||
/** | ||
* Unsets Source Id. | ||
* An ID to associate the refund to its originating source. | ||
*/ | ||
public function unsetSourceId(): void | ||
{ | ||
$this->sourceId = []; | ||
} | ||
|
||
/** | ||
* 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 = []; | ||
$json['type'] = $this->type; | ||
$json['source'] = $this->source; | ||
if (!empty($this->sourceId)) { | ||
$json['source_id'] = $this->sourceId['value']; | ||
} | ||
$json = array_filter($json, function ($val) { | ||
return $val !== null; | ||
}); | ||
|
||
return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters