src/Buy/Order/V2/Model/OrderLineItemV2.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);
/**
* OrderLineItemV2.
*
* 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;
/**
* OrderLineItemV2 Class Doc Comment.
*
* @category Class
*
* @description A type that defines the fields for line item information in a purchase order.
*
* @author OpenAPI Generator team
*
* @see https://openapi-generator.tech
*
* @implements \ArrayAccess<TKey, TValue>
*
* @template TKey int|null
* @template TValue mixed|null
*/
class OrderLineItemV2 implements ModelInterface, \ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'OrderLineItemV2';
/**
* 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',
'legacy_reference' => '\TNT\Ebay\Buy\Order\V2\Model\LegacyReference',
'line_item_id' => 'string',
'line_item_payment_status' => 'string',
'line_item_status' => 'string',
'net_price' => '\TNT\Ebay\Buy\Order\V2\Model\Amount',
'order_id' => 'string',
'promotions' => '\TNT\Ebay\Buy\Order\V2\Model\Promotion[]',
'quantity' => 'int',
'seller' => '\TNT\Ebay\Buy\Order\V2\Model\Seller',
'shipping_detail' => '\TNT\Ebay\Buy\Order\V2\Model\ShippingDetail',
'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,
'legacy_reference' => null,
'line_item_id' => null,
'line_item_payment_status' => null,
'line_item_status' => null,
'net_price' => null,
'order_id' => null,
'promotions' => null,
'quantity' => 'int32',
'seller' => null,
'shipping_detail' => 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',
'legacy_reference' => 'legacyReference',
'line_item_id' => 'lineItemId',
'line_item_payment_status' => 'lineItemPaymentStatus',
'line_item_status' => 'lineItemStatus',
'net_price' => 'netPrice',
'order_id' => 'orderId',
'promotions' => 'promotions',
'quantity' => 'quantity',
'seller' => 'seller',
'shipping_detail' => 'shippingDetail',
'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',
'legacy_reference' => 'setLegacyReference',
'line_item_id' => 'setLineItemId',
'line_item_payment_status' => 'setLineItemPaymentStatus',
'line_item_status' => 'setLineItemStatus',
'net_price' => 'setNetPrice',
'order_id' => 'setOrderId',
'promotions' => 'setPromotions',
'quantity' => 'setQuantity',
'seller' => 'setSeller',
'shipping_detail' => 'setShippingDetail',
'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',
'legacy_reference' => 'getLegacyReference',
'line_item_id' => 'getLineItemId',
'line_item_payment_status' => 'getLineItemPaymentStatus',
'line_item_status' => 'getLineItemStatus',
'net_price' => 'getNetPrice',
'order_id' => 'getOrderId',
'promotions' => 'getPromotions',
'quantity' => 'getQuantity',
'seller' => 'getSeller',
'shipping_detail' => 'getShippingDetail',
'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['legacy_reference'] = $data['legacy_reference'] ?? null;
$this->container['line_item_id'] = $data['line_item_id'] ?? null;
$this->container['line_item_payment_status'] = $data['line_item_payment_status'] ?? null;
$this->container['line_item_status'] = $data['line_item_status'] ?? null;
$this->container['net_price'] = $data['net_price'] ?? null;
$this->container['order_id'] = $data['order_id'] ?? null;
$this->container['promotions'] = $data['promotions'] ?? null;
$this->container['quantity'] = $data['quantity'] ?? null;
$this->container['seller'] = $data['seller'] ?? null;
$this->container['shipping_detail'] = $data['shipping_detail'] ?? 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.
*
* @return self
*/
public function setItemId($item_id)
{
$this->container['item_id'] = $item_id;
return $this;
}
/**
* Gets legacy_reference.
*
* @return \TNT\Ebay\Buy\Order\V2\Model\LegacyReference|null
*/
public function getLegacyReference()
{
return $this->container['legacy_reference'];
}
/**
* Sets legacy_reference.
*
* @param \TNT\Ebay\Buy\Order\V2\Model\LegacyReference|null $legacy_reference legacy_reference
*
* @return self
*/
public function setLegacyReference($legacy_reference)
{
$this->container['legacy_reference'] = $legacy_reference;
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. This is created by the <a href=\"/api-docs/buy/order/resources/guest_checkout_session/methods/initiateGuestCheckoutSession\">initiateGuestCheckoutSession</a>.
*
* @return self
*/
public function setLineItemId($line_item_id)
{
$this->container['line_item_id'] = $line_item_id;
return $this;
}
/**
* Gets line_item_payment_status.
*
* @return string|null
*/
public function getLineItemPaymentStatus()
{
return $this->container['line_item_payment_status'];
}
/**
* Sets line_item_payment_status.
*
* @param string|null $line_item_payment_status An enumeration value that indicates the payment status of the line item. For implementation help, refer to <a href='https://developer.ebay.com/api-docs/buy/order/types/gct:LineItemPaymentStatusEnum'>eBay API documentation</a>
*
* @return self
*/
public function setLineItemPaymentStatus($line_item_payment_status)
{
$this->container['line_item_payment_status'] = $line_item_payment_status;
return $this;
}
/**
* Gets line_item_status.
*
* @return string|null
*/
public function getLineItemStatus()
{
return $this->container['line_item_status'];
}
/**
* Sets line_item_status.
*
* @param string|null $line_item_status An enumeration value that indicates the fulfillment state of this line item.<br /><br /><span class=\"tablenote\"><b>Note:</b> When there is no tracking information, the status will never change from <code>FULFILLMENT_IN_PROGRESS</code>; without tracking information, eBay has no way of knowing whether the order was delivered.</span> For implementation help, refer to <a href='https://developer.ebay.com/api-docs/buy/order/types/gct:LineItemStatusEnum'>eBay API documentation</a>
*
* @return self
*/
public function setLineItemStatus($line_item_status)
{
$this->container['line_item_status'] = $line_item_status;
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 order_id.
*
* @return string|null
*/
public function getOrderId()
{
return $this->container['order_id'];
}
/**
* Sets order_id.
*
* @param string|null $order_id The unique order ID for the line item.<br /><br /><b>Maximum Length:</b> 40 characters
*
* @return self
*/
public function setOrderId($order_id)
{
$this->container['order_id'] = $order_id;
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_detail.
*
* @return \TNT\Ebay\Buy\Order\V2\Model\ShippingDetail|null
*/
public function getShippingDetail()
{
return $this->container['shipping_detail'];
}
/**
* Sets shipping_detail.
*
* @param \TNT\Ebay\Buy\Order\V2\Model\ShippingDetail|null $shipping_detail shipping_detail
*
* @return self
*/
public function setShippingDetail($shipping_detail)
{
$this->container['shipping_detail'] = $shipping_detail;
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 for 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));
}
}