HEX
Server: LiteSpeed
System: Linux s1049.use1.mysecurecloudhost.com 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: xedaptot (3356)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: /home/xedaptot/ai.naniguide.com/vendor/square/square/src/Models/AcceptedPaymentMethods.php
<?php

declare(strict_types=1);

namespace Square\Models;

use stdClass;

class AcceptedPaymentMethods implements \JsonSerializable
{
    /**
     * @var array
     */
    private $applePay = [];

    /**
     * @var array
     */
    private $googlePay = [];

    /**
     * @var array
     */
    private $cashAppPay = [];

    /**
     * @var array
     */
    private $afterpayClearpay = [];

    /**
     * Returns Apple Pay.
     * Whether Apple Pay is accepted at checkout.
     */
    public function getApplePay(): ?bool
    {
        if (count($this->applePay) == 0) {
            return null;
        }
        return $this->applePay['value'];
    }

    /**
     * Sets Apple Pay.
     * Whether Apple Pay is accepted at checkout.
     *
     * @maps apple_pay
     */
    public function setApplePay(?bool $applePay): void
    {
        $this->applePay['value'] = $applePay;
    }

    /**
     * Unsets Apple Pay.
     * Whether Apple Pay is accepted at checkout.
     */
    public function unsetApplePay(): void
    {
        $this->applePay = [];
    }

    /**
     * Returns Google Pay.
     * Whether Google Pay is accepted at checkout.
     */
    public function getGooglePay(): ?bool
    {
        if (count($this->googlePay) == 0) {
            return null;
        }
        return $this->googlePay['value'];
    }

    /**
     * Sets Google Pay.
     * Whether Google Pay is accepted at checkout.
     *
     * @maps google_pay
     */
    public function setGooglePay(?bool $googlePay): void
    {
        $this->googlePay['value'] = $googlePay;
    }

    /**
     * Unsets Google Pay.
     * Whether Google Pay is accepted at checkout.
     */
    public function unsetGooglePay(): void
    {
        $this->googlePay = [];
    }

    /**
     * Returns Cash App Pay.
     * Whether Cash App Pay is accepted at checkout.
     */
    public function getCashAppPay(): ?bool
    {
        if (count($this->cashAppPay) == 0) {
            return null;
        }
        return $this->cashAppPay['value'];
    }

    /**
     * Sets Cash App Pay.
     * Whether Cash App Pay is accepted at checkout.
     *
     * @maps cash_app_pay
     */
    public function setCashAppPay(?bool $cashAppPay): void
    {
        $this->cashAppPay['value'] = $cashAppPay;
    }

    /**
     * Unsets Cash App Pay.
     * Whether Cash App Pay is accepted at checkout.
     */
    public function unsetCashAppPay(): void
    {
        $this->cashAppPay = [];
    }

    /**
     * Returns Afterpay Clearpay.
     * Whether Afterpay/Clearpay is accepted at checkout.
     */
    public function getAfterpayClearpay(): ?bool
    {
        if (count($this->afterpayClearpay) == 0) {
            return null;
        }
        return $this->afterpayClearpay['value'];
    }

    /**
     * Sets Afterpay Clearpay.
     * Whether Afterpay/Clearpay is accepted at checkout.
     *
     * @maps afterpay_clearpay
     */
    public function setAfterpayClearpay(?bool $afterpayClearpay): void
    {
        $this->afterpayClearpay['value'] = $afterpayClearpay;
    }

    /**
     * Unsets Afterpay Clearpay.
     * Whether Afterpay/Clearpay is accepted at checkout.
     */
    public function unsetAfterpayClearpay(): void
    {
        $this->afterpayClearpay = [];
    }

    /**
     * Encode this object to JSON
     *
     * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields
     *        are set. (default: false)
     *
     * @return array|stdClass
     */
    #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1)
    public function jsonSerialize(bool $asArrayWhenEmpty = false)
    {
        $json = [];
        if (!empty($this->applePay)) {
            $json['apple_pay']         = $this->applePay['value'];
        }
        if (!empty($this->googlePay)) {
            $json['google_pay']        = $this->googlePay['value'];
        }
        if (!empty($this->cashAppPay)) {
            $json['cash_app_pay']      = $this->cashAppPay['value'];
        }
        if (!empty($this->afterpayClearpay)) {
            $json['afterpay_clearpay'] = $this->afterpayClearpay['value'];
        }
        $json = array_filter($json, function ($val) {
            return $val !== null;
        });

        return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json;
    }
}