charitable
/
vendor
/
square
/
square
/
src
/
Orders
/
CustomAttributeDefinitions
/
Requests
/
CreateOrderCustomAttributeDefinitionRequest.php
CreateOrderCustomAttributeDefinitionRequest.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.8.13, at vendor/square/square/src/Orders/CustomAttributeDefinitions/Requests/CreateOrderCustomAttributeDefinitionRequest.php
| 1 | <?php |
| 2 | |
| 3 | namespace Square\Orders\CustomAttributeDefinitions\Requests; |
| 4 | |
| 5 | use Square\Core\Json\JsonSerializableType; |
| 6 | use Square\Types\CustomAttributeDefinition; |
| 7 | use Square\Core\Json\JsonProperty; |
| 8 | |
| 9 | class CreateOrderCustomAttributeDefinitionRequest extends JsonSerializableType |
| 10 | { |
| 11 | /** |
| 12 | * The custom attribute definition to create. Note the following: |
| 13 | * - With the exception of the `Selection` data type, the `schema` is specified as a simple URL to the JSON schema |
| 14 | * definition hosted on the Square CDN. For more information, including supported values and constraints, see |
| 15 | * [Specifying the schema](https://developer.squareup.com/docs/customer-custom-attributes-api/custom-attribute-definitions#specify-schema). |
| 16 | * - If provided, `name` must be unique (case-sensitive) across all visible customer-related custom attribute definitions for the seller. |
| 17 | * - All custom attributes are visible in exported customer data, including those set to `VISIBILITY_HIDDEN`. |
| 18 | * |
| 19 | * @var CustomAttributeDefinition $customAttributeDefinition |
| 20 | */ |
| 21 | #[JsonProperty('custom_attribute_definition')] |
| 22 | private CustomAttributeDefinition $customAttributeDefinition; |
| 23 | |
| 24 | /** |
| 25 | * A unique identifier for this request, used to ensure idempotency. |
| 26 | * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). |
| 27 | * |
| 28 | * @var ?string $idempotencyKey |
| 29 | */ |
| 30 | #[JsonProperty('idempotency_key')] |
| 31 | private ?string $idempotencyKey; |
| 32 | |
| 33 | /** |
| 34 | * @param array{ |
| 35 | * customAttributeDefinition: CustomAttributeDefinition, |
| 36 | * idempotencyKey?: ?string, |
| 37 | * } $values |
| 38 | */ |
| 39 | public function __construct( |
| 40 | array $values, |
| 41 | ) { |
| 42 | $this->customAttributeDefinition = $values['customAttributeDefinition']; |
| 43 | $this->idempotencyKey = $values['idempotencyKey'] ?? null; |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * @return CustomAttributeDefinition |
| 48 | */ |
| 49 | public function getCustomAttributeDefinition(): CustomAttributeDefinition |
| 50 | { |
| 51 | return $this->customAttributeDefinition; |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * @param CustomAttributeDefinition $value |
| 56 | */ |
| 57 | public function setCustomAttributeDefinition(CustomAttributeDefinition $value): self |
| 58 | { |
| 59 | $this->customAttributeDefinition = $value; |
| 60 | return $this; |
| 61 | } |
| 62 | |
| 63 | /** |
| 64 | * @return ?string |
| 65 | */ |
| 66 | public function getIdempotencyKey(): ?string |
| 67 | { |
| 68 | return $this->idempotencyKey; |
| 69 | } |
| 70 | |
| 71 | /** |
| 72 | * @param ?string $value |
| 73 | */ |
| 74 | public function setIdempotencyKey(?string $value = null): self |
| 75 | { |
| 76 | $this->idempotencyKey = $value; |
| 77 | return $this; |
| 78 | } |
| 79 | } |
| 80 |