v3/src/Model/AlipayTradeOrderPayModel.php
<?php
/**
 * AlipayTradeOrderPayModel
 *
 * PHP version 7.4
 *
 * @category Class
 * @package  Alipay\OpenAPISDK
 * @author   OpenAPI Generator team
 * @link     https://openapi-generator.tech
 */

/**
 * 支付宝开放平台API
 *
 * 支付宝开放平台v3协议文档
 *
 * The version of the OpenAPI document: 2025-08-26
 * Generated by: https://openapi-generator.tech
 * OpenAPI Generator version: 6.2.1
 */

/**
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

namespace Alipay\OpenAPISDK\Model;

use \ArrayAccess;
use \Alipay\OpenAPISDK\ObjectSerializer;

/**
 * AlipayTradeOrderPayModel Class Doc Comment
 *
 * @category Class
 * @package  Alipay\OpenAPISDK
 * @author   OpenAPI Generator team
 * @link     https://openapi-generator.tech
 * @implements \ArrayAccess<TKey, TValue>
 * @template TKey int|null
 * @template TValue mixed|null
 */
class AlipayTradeOrderPayModel implements ModelInterface, ArrayAccess, \JsonSerializable
{
    public const DISCRIMINATOR = null;

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

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $openAPITypes = [
        'advancePaymentType' => 'string',
        'buyerId' => 'string',
        'buyerOpenId' => 'string',
        'buyerPayDetail' => '\Alipay\OpenAPISDK\Model\BuyerPayDetail[]',
        'fulfillmentAmount' => 'string',
        'isAsyncPay' => 'bool',
        'orderPayMode' => 'string',
        'outRequestNo' => 'string',
        'productCode' => 'string',
        'totalAmount' => 'string',
        'tradeNo' => '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 = [
        'advancePaymentType' => null,
        'buyerId' => null,
        'buyerOpenId' => null,
        'buyerPayDetail' => null,
        'fulfillmentAmount' => null,
        'isAsyncPay' => null,
        'orderPayMode' => null,
        'outRequestNo' => null,
        'productCode' => null,
        'totalAmount' => null,
        'tradeNo' => 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 = [
        'advancePaymentType' => 'advance_payment_type',
        'buyerId' => 'buyer_id',
        'buyerOpenId' => 'buyer_open_id',
        'buyerPayDetail' => 'buyer_pay_detail',
        'fulfillmentAmount' => 'fulfillment_amount',
        'isAsyncPay' => 'is_async_pay',
        'orderPayMode' => 'order_pay_mode',
        'outRequestNo' => 'out_request_no',
        'productCode' => 'product_code',
        'totalAmount' => 'total_amount',
        'tradeNo' => 'trade_no'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'advancePaymentType' => 'setAdvancePaymentType',
        'buyerId' => 'setBuyerId',
        'buyerOpenId' => 'setBuyerOpenId',
        'buyerPayDetail' => 'setBuyerPayDetail',
        'fulfillmentAmount' => 'setFulfillmentAmount',
        'isAsyncPay' => 'setIsAsyncPay',
        'orderPayMode' => 'setOrderPayMode',
        'outRequestNo' => 'setOutRequestNo',
        'productCode' => 'setProductCode',
        'totalAmount' => 'setTotalAmount',
        'tradeNo' => 'setTradeNo'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'advancePaymentType' => 'getAdvancePaymentType',
        'buyerId' => 'getBuyerId',
        'buyerOpenId' => 'getBuyerOpenId',
        'buyerPayDetail' => 'getBuyerPayDetail',
        'fulfillmentAmount' => 'getFulfillmentAmount',
        'isAsyncPay' => 'getIsAsyncPay',
        'orderPayMode' => 'getOrderPayMode',
        'outRequestNo' => 'getOutRequestNo',
        'productCode' => 'getProductCode',
        'totalAmount' => 'getTotalAmount',
        'tradeNo' => 'getTradeNo'
    ];

    /**
     * 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['advancePaymentType'] = $data['advancePaymentType'] ?? null;
        $this->container['buyerId'] = $data['buyerId'] ?? null;
        $this->container['buyerOpenId'] = $data['buyerOpenId'] ?? null;
        $this->container['buyerPayDetail'] = $data['buyerPayDetail'] ?? null;
        $this->container['fulfillmentAmount'] = $data['fulfillmentAmount'] ?? null;
        $this->container['isAsyncPay'] = $data['isAsyncPay'] ?? null;
        $this->container['orderPayMode'] = $data['orderPayMode'] ?? null;
        $this->container['outRequestNo'] = $data['outRequestNo'] ?? null;
        $this->container['productCode'] = $data['productCode'] ?? null;
        $this->container['totalAmount'] = $data['totalAmount'] ?? null;
        $this->container['tradeNo'] = $data['tradeNo'] ?? 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 advancePaymentType
     *
     * @return string|null
     */
    public function getAdvancePaymentType()
    {
        return $this->container['advancePaymentType'];
    }

    /**
     * Sets advancePaymentType
     *
     * @param string|null $advancePaymentType 垫资支付模式。支付时需要垫资的场景才传入。具体传参需与支付宝约定。 CREDIT_FULFILLMENT_ZM 表示先用后付产品履约动作支持芝麻垫资。
     *
     * @return self
     */
    public function setAdvancePaymentType($advancePaymentType)
    {
        $this->container['advancePaymentType'] = $advancePaymentType;

        return $this;
    }

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

    /**
     * Sets buyerId
     *
     * @param string|null $buyerId 买家的支付宝用户id    注：  1.用于校验与已存交易中的买家是否相等
     *
     * @return self
     */
    public function setBuyerId($buyerId)
    {
        $this->container['buyerId'] = $buyerId;

        return $this;
    }

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

    /**
     * Sets buyerOpenId
     *
     * @param string|null $buyerOpenId 买家支付宝用户唯一标识  注： 1.用于校验与已存交易中的买家是否相等
     *
     * @return self
     */
    public function setBuyerOpenId($buyerOpenId)
    {
        $this->container['buyerOpenId'] = $buyerOpenId;

        return $this;
    }

    /**
     * Gets buyerPayDetail
     *
     * @return \Alipay\OpenAPISDK\Model\BuyerPayDetail[]|null
     */
    public function getBuyerPayDetail()
    {
        return $this->container['buyerPayDetail'];
    }

    /**
     * Sets buyerPayDetail
     *
     * @param \Alipay\OpenAPISDK\Model\BuyerPayDetail[]|null $buyerPayDetail 买家支付明细    目前支持的支付渠道为：  - offline_pos：本次买家使用的是pos刷卡支付    注：  各支付工具金额总和=订单总金额
     *
     * @return self
     */
    public function setBuyerPayDetail($buyerPayDetail)
    {
        $this->container['buyerPayDetail'] = $buyerPayDetail;

        return $this;
    }

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

    /**
     * Sets fulfillmentAmount
     *
     * @param string|null $fulfillmentAmount 本次履约支付金额，单位为元，精确到小数点后两位。履约支付场景才需要传入。
     *
     * @return self
     */
    public function setFulfillmentAmount($fulfillmentAmount)
    {
        $this->container['fulfillmentAmount'] = $fulfillmentAmount;

        return $this;
    }

    /**
     * Gets isAsyncPay
     *
     * @return bool|null
     */
    public function getIsAsyncPay()
    {
        return $this->container['isAsyncPay'];
    }

    /**
     * Sets isAsyncPay
     *
     * @param bool|null $isAsyncPay 是否异步支付，传入true时，表明本次期望走异步支付，会先将支付请求受理下来，再异步推进。商户可以通过交易的异步通知或者轮询交易的状态来确定最终的交易结果
     *
     * @return self
     */
    public function setIsAsyncPay($isAsyncPay)
    {
        $this->container['isAsyncPay'] = $isAsyncPay;

        return $this;
    }

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

    /**
     * Sets orderPayMode
     *
     * @param string|null $orderPayMode 订单支付模式。特殊支付场景才需要传入。具体传参需与支付宝约定。 CREDIT_FULFILLMENT_ZM表示基于芝麻授信的履约支付模式，比如芝麻先用后付产品。
     *
     * @return self
     */
    public function setOrderPayMode($orderPayMode)
    {
        $this->container['orderPayMode'] = $orderPayMode;

        return $this;
    }

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

    /**
     * Sets outRequestNo
     *
     * @param string|null $outRequestNo 商户请求号，标识一次请求的唯一id，用于幂等控制。
     *
     * @return self
     */
    public function setOutRequestNo($outRequestNo)
    {
        $this->container['outRequestNo'] = $outRequestNo;

        return $this;
    }

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

    /**
     * Sets productCode
     *
     * @param string|null $productCode 销售产品码
     *
     * @return self
     */
    public function setProductCode($productCode)
    {
        $this->container['productCode'] = $productCode;

        return $this;
    }

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

    /**
     * Sets totalAmount
     *
     * @param string|null $totalAmount 订单总金额，单位为元，精确到小数点后两位，取值范围[0.01,100000000]    注：  1.用于校验与已存交易中的金额是否相等
     *
     * @return self
     */
    public function setTotalAmount($totalAmount)
    {
        $this->container['totalAmount'] = $totalAmount;

        return $this;
    }

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

    /**
     * Sets tradeNo
     *
     * @param string|null $tradeNo 支付宝交易号
     *
     * @return self
     */
    public function setTradeNo($tradeNo)
    {
        $this->container['tradeNo'] = $tradeNo;

        return $this;
    }
    /**
     * Returns true if offset exists. False otherwise.
     *
     * @param integer $offset Offset
     *
     * @return boolean
     */
    public function offsetExists($offset): bool
    {
        return isset($this->container[$offset]);
    }

    /**
     * Gets offset.
     *
     * @param integer $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
     *
     * @return void
     */
    public function offsetSet($offset, $value): void
    {
        if (is_null($offset)) {
            $this->container[] = $value;
        } else {
            $this->container[$offset] = $value;
        }
    }

    /**
     * Unsets offset.
     *
     * @param integer $offset Offset
     *
     * @return void
     */
    public function offsetUnset($offset): void
    {
        unset($this->container[$offset]);
    }

    /**
     * Serializes the object to a value that can be serialized natively by json_encode().
     * @link 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));
    }
}


