src/Buy/Order/V2/Model/LineItem.php
<?php
/**
* This file is part of the trollandtoad/ebay-sdk-php package.
*
* MIT License
*
* Copyright (c) 2022 Brandon Clothier
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
declare(strict_types=1);
/**
* LineItem.
*
* PHP version ^7.2 || ^8.0
*
* @category Class
*
* @author OpenAPI Generator team
*
* @see https://openapi-generator.tech
*/
/**
* Order API.
*
* <span class=\"tablenote\"><b>Note:</b> The Order API (v2) currently only supports the guest payment/checkout flow. If you need to support member payment/checkout flow, use the <a href=\"/api-docs/buy/order_v1/resources/methods\">v1_beta version</a> of the Order API.</span><br /><br /><span class=\"tablenote\"><b>Note:</b> This is a <a href=\"https://developer.ebay.com/api-docs/static/versioning.html#limited\" target=\"_blank\"><img src=\"/cms/img/docs/partners-api.svg\" class=\"legend-icon partners-icon\" alt=\"Limited Release\" title=\"Limited Release\" />(Limited Release)</a> API available only to select developers approved by business units.</span><br /><br />The Order API provides interfaces that let shoppers pay for items. It also returns payment and shipping status of the order.
*
* The version of the OpenAPI document: v2.1.0
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 5.4.0
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace TNT\Ebay\Buy\Order\V2\Model;
use TNT\Ebay\Buy\Order\V2\ObjectSerializer;
/**
* LineItem Class Doc Comment.
*
* @category Class
*
* @description A type that defines the fields for an individual line item.
*
* @author OpenAPI Generator team
*
* @see https://openapi-generator.tech
*
* @implements \ArrayAccess<TKey, TValue>
*
* @template TKey int|null
* @template TValue mixed|null
*/
class LineItem implements ModelInterface, \ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'LineItem';
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $openAPITypes = [
'authenticity_verification' => '\TNT\Ebay\Buy\Order\V2\Model\AuthenticityVerificationProgram',
'base_unit_price' => '\TNT\Ebay\Buy\Order\V2\Model\Amount',
'fees' => '\TNT\Ebay\Buy\Order\V2\Model\Fee[]',
'image' => '\TNT\Ebay\Buy\Order\V2\Model\Image',
'item_id' => 'string',
'line_item_id' => 'string',
'net_price' => '\TNT\Ebay\Buy\Order\V2\Model\Amount',
'promotions' => '\TNT\Ebay\Buy\Order\V2\Model\Promotion[]',
'quantity' => 'int',
'seller' => '\TNT\Ebay\Buy\Order\V2\Model\Seller',
'shipping_options' => '\TNT\Ebay\Buy\Order\V2\Model\ShippingOption[]',
'tax_details' => '\TNT\Ebay\Buy\Order\V2\Model\TaxDetail[]',
'title' => 'string',
];
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @var string[]
*
* @phpstan-var array<string, string|null>
*
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'authenticity_verification' => null,
'base_unit_price' => null,
'fees' => null,
'image' => null,
'item_id' => null,
'line_item_id' => null,
'net_price' => null,
'promotions' => null,
'quantity' => 'int32',
'seller' => null,
'shipping_options' => null,
'tax_details' => null,
'title' => null,
];
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @var string[]
*/
protected static $attributeMap = [
'authenticity_verification' => 'authenticityVerification',
'base_unit_price' => 'baseUnitPrice',
'fees' => 'fees',
'image' => 'image',
'item_id' => 'itemId',
'line_item_id' => 'lineItemId',
'net_price' => 'netPrice',
'promotions' => 'promotions',
'quantity' => 'quantity',
'seller' => 'seller',
'shipping_options' => 'shippingOptions',
'tax_details' => 'taxDetails',
'title' => 'title',
];
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @var string[]
*/
protected static $setters = [
'authenticity_verification' => 'setAuthenticityVerification',
'base_unit_price' => 'setBaseUnitPrice',
'fees' => 'setFees',
'image' => 'setImage',
'item_id' => 'setItemId',
'line_item_id' => 'setLineItemId',
'net_price' => 'setNetPrice',
'promotions' => 'setPromotions',
'quantity' => 'setQuantity',
'seller' => 'setSeller',
'shipping_options' => 'setShippingOptions',
'tax_details' => 'setTaxDetails',
'title' => 'setTitle',
];
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @var string[]
*/
protected static $getters = [
'authenticity_verification' => 'getAuthenticityVerification',
'base_unit_price' => 'getBaseUnitPrice',
'fees' => 'getFees',
'image' => 'getImage',
'item_id' => 'getItemId',
'line_item_id' => 'getLineItemId',
'net_price' => 'getNetPrice',
'promotions' => 'getPromotions',
'quantity' => 'getQuantity',
'seller' => 'getSeller',
'shipping_options' => 'getShippingOptions',
'tax_details' => 'getTaxDetails',
'title' => 'getTitle',
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values.
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor.
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->container['authenticity_verification'] = $data['authenticity_verification'] ?? null;
$this->container['base_unit_price'] = $data['base_unit_price'] ?? null;
$this->container['fees'] = $data['fees'] ?? null;
$this->container['image'] = $data['image'] ?? null;
$this->container['item_id'] = $data['item_id'] ?? null;
$this->container['line_item_id'] = $data['line_item_id'] ?? null;
$this->container['net_price'] = $data['net_price'] ?? null;
$this->container['promotions'] = $data['promotions'] ?? null;
$this->container['quantity'] = $data['quantity'] ?? null;
$this->container['seller'] = $data['seller'] ?? null;
$this->container['shipping_options'] = $data['shipping_options'] ?? null;
$this->container['tax_details'] = $data['tax_details'] ?? null;
$this->container['title'] = $data['title'] ?? null;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed.
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets authenticity_verification.
*
* @return \TNT\Ebay\Buy\Order\V2\Model\AuthenticityVerificationProgram|null
*/
public function getAuthenticityVerification()
{
return $this->container['authenticity_verification'];
}
/**
* Sets authenticity_verification.
*
* @param \TNT\Ebay\Buy\Order\V2\Model\AuthenticityVerificationProgram|null $authenticity_verification authenticity_verification
*
* @return self
*/
public function setAuthenticityVerification($authenticity_verification)
{
$this->container['authenticity_verification'] = $authenticity_verification;
return $this;
}
/**
* Gets base_unit_price.
*
* @return \TNT\Ebay\Buy\Order\V2\Model\Amount|null
*/
public function getBaseUnitPrice()
{
return $this->container['base_unit_price'];
}
/**
* Sets base_unit_price.
*
* @param \TNT\Ebay\Buy\Order\V2\Model\Amount|null $base_unit_price base_unit_price
*
* @return self
*/
public function setBaseUnitPrice($base_unit_price)
{
$this->container['base_unit_price'] = $base_unit_price;
return $this;
}
/**
* Gets fees.
*
* @return \TNT\Ebay\Buy\Order\V2\Model\Fee[]|null
*/
public function getFees()
{
return $this->container['fees'];
}
/**
* Sets fees.
*
* @param \TNT\Ebay\Buy\Order\V2\Model\Fee[]|null $fees a breakdown of the fees applicable to the line item
*
* @return self
*/
public function setFees($fees)
{
$this->container['fees'] = $fees;
return $this;
}
/**
* Gets image.
*
* @return \TNT\Ebay\Buy\Order\V2\Model\Image|null
*/
public function getImage()
{
return $this->container['image'];
}
/**
* Sets image.
*
* @param \TNT\Ebay\Buy\Order\V2\Model\Image|null $image image
*
* @return self
*/
public function setImage($image)
{
$this->container['image'] = $image;
return $this;
}
/**
* Gets item_id.
*
* @return string|null
*/
public function getItemId()
{
return $this->container['item_id'];
}
/**
* Sets item_id.
*
* @param string|null $item_id The eBay identifier of an item. This ID is returned by the <b>Browse</b> and <b>Feed</b> API methods. The ID is in RESTful item ID format.<br /><br /><b>For example:</b> <code>v1|2**********6|5**********4</code> or <code>v1|1**********9|0</code>.<br /><br />For more information about item IDs for RESTful APIs, see <a href=\"/api-docs/buy/static/api-browse.html#Legacy\">Legacy API compatibility</a>.
*
* @return self
*/
public function setItemId($item_id)
{
$this->container['item_id'] = $item_id;
return $this;
}
/**
* Gets line_item_id.
*
* @return string|null
*/
public function getLineItemId()
{
return $this->container['line_item_id'];
}
/**
* Sets line_item_id.
*
* @param string|null $line_item_id a unique eBay-assigned ID value that identifies a line item in a checkout session
*
* @return self
*/
public function setLineItemId($line_item_id)
{
$this->container['line_item_id'] = $line_item_id;
return $this;
}
/**
* Gets net_price.
*
* @return \TNT\Ebay\Buy\Order\V2\Model\Amount|null
*/
public function getNetPrice()
{
return $this->container['net_price'];
}
/**
* Sets net_price.
*
* @param \TNT\Ebay\Buy\Order\V2\Model\Amount|null $net_price net_price
*
* @return self
*/
public function setNetPrice($net_price)
{
$this->container['net_price'] = $net_price;
return $this;
}
/**
* Gets promotions.
*
* @return \TNT\Ebay\Buy\Order\V2\Model\Promotion[]|null
*/
public function getPromotions()
{
return $this->container['promotions'];
}
/**
* Sets promotions.
*
* @param \TNT\Ebay\Buy\Order\V2\Model\Promotion[]|null $promotions an array of promotions applied to the line item
*
* @return self
*/
public function setPromotions($promotions)
{
$this->container['promotions'] = $promotions;
return $this;
}
/**
* Gets quantity.
*
* @return int|null
*/
public function getQuantity()
{
return $this->container['quantity'];
}
/**
* Sets quantity.
*
* @param int|null $quantity the quantity ordered for the line item
*
* @return self
*/
public function setQuantity($quantity)
{
$this->container['quantity'] = $quantity;
return $this;
}
/**
* Gets seller.
*
* @return \TNT\Ebay\Buy\Order\V2\Model\Seller|null
*/
public function getSeller()
{
return $this->container['seller'];
}
/**
* Sets seller.
*
* @param \TNT\Ebay\Buy\Order\V2\Model\Seller|null $seller seller
*
* @return self
*/
public function setSeller($seller)
{
$this->container['seller'] = $seller;
return $this;
}
/**
* Gets shipping_options.
*
* @return \TNT\Ebay\Buy\Order\V2\Model\ShippingOption[]|null
*/
public function getShippingOptions()
{
return $this->container['shipping_options'];
}
/**
* Sets shipping_options.
*
* @param \TNT\Ebay\Buy\Order\V2\Model\ShippingOption[]|null $shipping_options An array of shipping options that are available for the line item. By default, the first one will be selected.<br /><br /><span class=\"tablenote\"><b>Note:</b> The <b>updateGuestShippingOption</b> method can be used to change the shipping option.</span>
*
* @return self
*/
public function setShippingOptions($shipping_options)
{
$this->container['shipping_options'] = $shipping_options;
return $this;
}
/**
* Gets tax_details.
*
* @return \TNT\Ebay\Buy\Order\V2\Model\TaxDetail[]|null
*/
public function getTaxDetails()
{
return $this->container['tax_details'];
}
/**
* Sets tax_details.
*
* @param \TNT\Ebay\Buy\Order\V2\Model\TaxDetail[]|null $tax_details a container that returns the tax information for the line item
*
* @return self
*/
public function setTaxDetails($tax_details)
{
$this->container['tax_details'] = $tax_details;
return $this;
}
/**
* Gets title.
*
* @return string|null
*/
public function getTitle()
{
return $this->container['title'];
}
/**
* Sets title.
*
* @param string|null $title the seller-created title of the item
*
* @return self
*/
public function setTitle($title)
{
$this->container['title'] = $title;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param int $offset Offset
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param int $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*/
public function offsetSet($offset, $value): void
{
if (null === $offset) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param int $offset Offset
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
*
* @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object.
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object.
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}