brandon14/ebay-sdk-php

View on GitHub
src/Sell/Fulfillment/V1/Model/PaymentHold.php

Summary

Maintainability
F
5 days
Test Coverage
<?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);

/**
 * PaymentHold.
 *
 * 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;

/**
 * PaymentHold Class Doc Comment.
 *
 * @category Class
 *
 * @description This type contains information about a hold placed on a payment to a seller for an order, including the reason why the buyer&#39;s payment for the order is being held, the expected release date of the funds into the seller&#39;s account, the current state of the hold, and the actual release date if the payment has been released, and possible actions the seller can take to expedite the payout of funds into their account.
 *
 * @author   OpenAPI Generator team
 *
 * @see     https://openapi-generator.tech
 *
 * @implements \ArrayAccess<TKey, TValue>
 *
 * @template TKey int|null
 * @template TValue mixed|null
 */
class PaymentHold implements ModelInterface, \ArrayAccess, \JsonSerializable
{
    public const DISCRIMINATOR = null;

    /**
     * The original name of the model.
     *
     * @var string
     */
    protected static $openAPIModelName = 'PaymentHold';

    /**
     * Array of property to type mappings. Used for (de)serialization.
     *
     * @var string[]
     */
    protected static $openAPITypes = [
        'expected_release_date' => 'string',
        'hold_amount' => '\TNT\Ebay\Sell\Fulfillment\V1\Model\Amount',
        'hold_reason' => 'string',
        'hold_state' => 'string',
        'release_date' => 'string',
        'seller_actions_to_release' => '\TNT\Ebay\Sell\Fulfillment\V1\Model\SellerActionsToRelease[]',
    ];

    /**
     * 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 = [
        'expected_release_date' => null,
        'hold_amount' => null,
        'hold_reason' => null,
        'hold_state' => null,
        'release_date' => null,
        'seller_actions_to_release' => 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 = [
        'expected_release_date' => 'expectedReleaseDate',
        'hold_amount' => 'holdAmount',
        'hold_reason' => 'holdReason',
        'hold_state' => 'holdState',
        'release_date' => 'releaseDate',
        'seller_actions_to_release' => 'sellerActionsToRelease',
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses).
     *
     * @var string[]
     */
    protected static $setters = [
        'expected_release_date' => 'setExpectedReleaseDate',
        'hold_amount' => 'setHoldAmount',
        'hold_reason' => 'setHoldReason',
        'hold_state' => 'setHoldState',
        'release_date' => 'setReleaseDate',
        'seller_actions_to_release' => 'setSellerActionsToRelease',
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests).
     *
     * @var string[]
     */
    protected static $getters = [
        'expected_release_date' => 'getExpectedReleaseDate',
        'hold_amount' => 'getHoldAmount',
        'hold_reason' => 'getHoldReason',
        'hold_state' => 'getHoldState',
        'release_date' => 'getReleaseDate',
        'seller_actions_to_release' => 'getSellerActionsToRelease',
    ];

    /**
     * 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['expected_release_date'] = $data['expected_release_date'] ?? null;
        $this->container['hold_amount'] = $data['hold_amount'] ?? null;
        $this->container['hold_reason'] = $data['hold_reason'] ?? null;
        $this->container['hold_state'] = $data['hold_state'] ?? null;
        $this->container['release_date'] = $data['release_date'] ?? null;
        $this->container['seller_actions_to_release'] = $data['seller_actions_to_release'] ?? 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 expected_release_date.
     *
     * @return string|null
     */
    public function getExpectedReleaseDate()
    {
        return $this->container['expected_release_date'];
    }

    /**
     * Sets expected_release_date.
     *
     * @param string|null $expected_release_date The date and time that the payment being held is expected to be released to the seller. This timestamp is in ISO 8601 format, which uses the 24-hour Universal Coordinated Time (UTC) clock. This field will be returned if known by eBay. <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 setExpectedReleaseDate($expected_release_date)
    {
        $this->container['expected_release_date'] = $expected_release_date;

        return $this;
    }

    /**
     * Gets hold_amount.
     *
     * @return \TNT\Ebay\Sell\Fulfillment\V1\Model\Amount|null
     */
    public function getHoldAmount()
    {
        return $this->container['hold_amount'];
    }

    /**
     * Sets hold_amount.
     *
     * @param \TNT\Ebay\Sell\Fulfillment\V1\Model\Amount|null $hold_amount hold_amount
     *
     * @return self
     */
    public function setHoldAmount($hold_amount)
    {
        $this->container['hold_amount'] = $hold_amount;

        return $this;
    }

    /**
     * Gets hold_reason.
     *
     * @return string|null
     */
    public function getHoldReason()
    {
        return $this->container['hold_reason'];
    }

    /**
     * Sets hold_reason.
     *
     * @param string|null $hold_reason The reason that the payment is being held. A seller's payment may be held for a number of reasons, including when the seller is new, the seller's level is below standard, or if a return case or 'Significantly not as described' case is pending against the seller. This field is always returned with the <strong>paymentHolds</strong> array.
     *
     * @return self
     */
    public function setHoldReason($hold_reason)
    {
        $this->container['hold_reason'] = $hold_reason;

        return $this;
    }

    /**
     * Gets hold_state.
     *
     * @return string|null
     */
    public function getHoldState()
    {
        return $this->container['hold_state'];
    }

    /**
     * Sets hold_state.
     *
     * @param string|null $hold_state The current stage or condition of the hold. This field is always returned with the <strong>paymentHolds</strong> array.<br /><br /><b>Applicable values:</b><ul><li><code>HELD</code></li><li><code>HELD_PENDING</code></li><li><code>NOT_HELD</code></li><li><code>RELEASE_CONFIRMED</code></li><li><code>RELEASE_FAILED</code></li><li><code>RELEASE_PENDING</code></li><li><code>RELEASED</code></li></ul>
     *
     * @return self
     */
    public function setHoldState($hold_state)
    {
        $this->container['hold_state'] = $hold_state;

        return $this;
    }

    /**
     * Gets release_date.
     *
     * @return string|null
     */
    public function getReleaseDate()
    {
        return $this->container['release_date'];
    }

    /**
     * Sets release_date.
     *
     * @param string|null $release_date The date and time that the payment being held was actually released to the seller. This timestamp is in ISO 8601 format, which uses the 24-hour Universal Coordinated Time (UTC) clock. This field is not returned until the seller's payment is actually released into the seller's account.<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 setReleaseDate($release_date)
    {
        $this->container['release_date'] = $release_date;

        return $this;
    }

    /**
     * Gets seller_actions_to_release.
     *
     * @return \TNT\Ebay\Sell\Fulfillment\V1\Model\SellerActionsToRelease[]|null
     */
    public function getSellerActionsToRelease()
    {
        return $this->container['seller_actions_to_release'];
    }

    /**
     * Sets seller_actions_to_release.
     *
     * @param \TNT\Ebay\Sell\Fulfillment\V1\Model\SellerActionsToRelease[]|null $seller_actions_to_release a list of one or more possible actions that the seller can take to expedite the release of the payment hold
     *
     * @return self
     */
    public function setSellerActionsToRelease($seller_actions_to_release)
    {
        $this->container['seller_actions_to_release'] = $seller_actions_to_release;

        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));
    }
}