src/Sell/Fulfillment/V1/Model/Payment.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);
/**
* Payment.
*
* PHP version ^7.2 || ^8.0
*
* @category Class
*
* @author OpenAPI Generator team
*
* @see https://openapi-generator.tech
*/
/**
* Fulfillment API.
*
* Use the Fulfillment API to complete the process of packaging, addressing, handling, and shipping each order on behalf of the seller, in accordance with the payment method and timing specified at checkout.
*
* The version of the OpenAPI document: v1.19.17
* 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\Sell\Fulfillment\V1\Model;
use TNT\Ebay\Sell\Fulfillment\V1\ObjectSerializer;
/**
* Payment Class Doc Comment.
*
* @category Class
*
* @description This type is used to provide details about the seller payments for an order.
*
* @author OpenAPI Generator team
*
* @see https://openapi-generator.tech
*
* @implements \ArrayAccess<TKey, TValue>
*
* @template TKey int|null
* @template TValue mixed|null
*/
class Payment implements ModelInterface, \ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'Payment';
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $openAPITypes = [
'amount' => '\TNT\Ebay\Sell\Fulfillment\V1\Model\Amount',
'payment_date' => 'string',
'payment_holds' => '\TNT\Ebay\Sell\Fulfillment\V1\Model\PaymentHold[]',
'payment_method' => 'string',
'payment_reference_id' => 'string',
'payment_status' => '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 = [
'amount' => null,
'payment_date' => null,
'payment_holds' => null,
'payment_method' => null,
'payment_reference_id' => null,
'payment_status' => 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 = [
'amount' => 'amount',
'payment_date' => 'paymentDate',
'payment_holds' => 'paymentHolds',
'payment_method' => 'paymentMethod',
'payment_reference_id' => 'paymentReferenceId',
'payment_status' => 'paymentStatus',
];
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @var string[]
*/
protected static $setters = [
'amount' => 'setAmount',
'payment_date' => 'setPaymentDate',
'payment_holds' => 'setPaymentHolds',
'payment_method' => 'setPaymentMethod',
'payment_reference_id' => 'setPaymentReferenceId',
'payment_status' => 'setPaymentStatus',
];
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @var string[]
*/
protected static $getters = [
'amount' => 'getAmount',
'payment_date' => 'getPaymentDate',
'payment_holds' => 'getPaymentHolds',
'payment_method' => 'getPaymentMethod',
'payment_reference_id' => 'getPaymentReferenceId',
'payment_status' => 'getPaymentStatus',
];
/**
* 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['amount'] = $data['amount'] ?? null;
$this->container['payment_date'] = $data['payment_date'] ?? null;
$this->container['payment_holds'] = $data['payment_holds'] ?? null;
$this->container['payment_method'] = $data['payment_method'] ?? null;
$this->container['payment_reference_id'] = $data['payment_reference_id'] ?? null;
$this->container['payment_status'] = $data['payment_status'] ?? 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 amount.
*
* @return \TNT\Ebay\Sell\Fulfillment\V1\Model\Amount|null
*/
public function getAmount()
{
return $this->container['amount'];
}
/**
* Sets amount.
*
* @param \TNT\Ebay\Sell\Fulfillment\V1\Model\Amount|null $amount amount
*
* @return self
*/
public function setAmount($amount)
{
$this->container['amount'] = $amount;
return $this;
}
/**
* Gets payment_date.
*
* @return string|null
*/
public function getPaymentDate()
{
return $this->container['payment_date'];
}
/**
* Sets payment_date.
*
* @param string|null $payment_date The date and time that the payment was received by the seller. This field will not be returned if buyer has yet to pay for the order. This timestamp is in ISO 8601 format, which uses the 24-hour Universal Coordinated Time (UTC) clock. <br /><br /><b>Format:</b> <code>[YYYY]-[MM]-[DD]T[hh]:[mm]:[ss].[sss]Z</code> <br /><b>Example:</b> <code>2015-08-04T19:09:02.768Z</code>
*
* @return self
*/
public function setPaymentDate($payment_date)
{
$this->container['payment_date'] = $payment_date;
return $this;
}
/**
* Gets payment_holds.
*
* @return \TNT\Ebay\Sell\Fulfillment\V1\Model\PaymentHold[]|null
*/
public function getPaymentHolds()
{
return $this->container['payment_holds'];
}
/**
* Sets payment_holds.
*
* @param \TNT\Ebay\Sell\Fulfillment\V1\Model\PaymentHold[]|null $payment_holds This container is only returned if eBay is temporarily holding the seller's funds for the order. If a payment hold has been placed on the order, this container includes the reason for the payment hold, the expected release date of the funds into the seller's account, the current state of the hold, and as soon as the payment hold has been released, the actual release date.
*
* @return self
*/
public function setPaymentHolds($payment_holds)
{
$this->container['payment_holds'] = $payment_holds;
return $this;
}
/**
* Gets payment_method.
*
* @return string|null
*/
public function getPaymentMethod()
{
return $this->container['payment_method'];
}
/**
* Sets payment_method.
*
* @param string|null $payment_method The payment method used to pay for the order. See the <strong>PaymentMethodTypeEnum</strong> type for more information on the payment methods. For implementation help, refer to <a href='https://developer.ebay.com/api-docs/sell/fulfillment/types/sel:PaymentMethodTypeEnum'>eBay API documentation</a>
*
* @return self
*/
public function setPaymentMethod($payment_method)
{
$this->container['payment_method'] = $payment_method;
return $this;
}
/**
* Gets payment_reference_id.
*
* @return string|null
*/
public function getPaymentReferenceId()
{
return $this->container['payment_reference_id'];
}
/**
* Sets payment_reference_id.
*
* @param string|null $payment_reference_id This field is only returned if payment has been made by the buyer, and the <strong>paymentMethod</strong> is <code>ESCROW</code>. This field contains a special ID for ESCROW.
*
* @return self
*/
public function setPaymentReferenceId($payment_reference_id)
{
$this->container['payment_reference_id'] = $payment_reference_id;
return $this;
}
/**
* Gets payment_status.
*
* @return string|null
*/
public function getPaymentStatus()
{
return $this->container['payment_status'];
}
/**
* Sets payment_status.
*
* @param string|null $payment_status The enumeration value returned in this field indicates the status of the payment for the order. See the <strong>PaymentStatusEnum</strong> type definition for more information on the possible payment states. For implementation help, refer to <a href='https://developer.ebay.com/api-docs/sell/fulfillment/types/sel:PaymentStatusEnum'>eBay API documentation</a>
*
* @return self
*/
public function setPaymentStatus($payment_status)
{
$this->container['payment_status'] = $payment_status;
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));
}
}