<?php

/**
 * Receipt Payment model.
 *
 * @package northmill-online-shared
 */
declare (strict_types=1);
namespace Northmill_Online_Shared_Checkout\Northmill_Online_Shared\Abstracts\Hub_API\Models\Receipts;

use JsonSerializable;
use Northmill_Online_Shared_Checkout\Northmill_Online_Shared\Helpers\General_Helpers;
/**
 * Class Payment_Model
 */
class Receipt_Payment_Model implements JsonSerializable
{
    /**
     * Name of the payment method.
     *
     * @var string
     */
    protected string $Name;
    /**
     * Amount paid with this payment method.
     *
     * @var string
     */
    protected string $Amount;
    /**
     * Type of payment as registered in Hub. We default to 'NamedPayment', and specify in the Name property.
     *
     * @var string
     */
    protected string $PaymentType;
    /**
     * Transaction ID for the payment.
     *
     * @var string
     */
    protected string $TransactionId;
    /**
     * Origin of the transaction.
     *
     * @var string
     */
    protected string $TransactionOrigin;
    public function __construct(string $name, float|string $amount, string $payment_type, string $transaction_id, string $transaction_origin)
    {
        $this->Name = $name;
        $this->Amount = General_Helpers::round_and_format_number($amount);
        $this->PaymentType = $payment_type;
        $this->TransactionId = $transaction_id;
        $this->TransactionOrigin = $transaction_origin;
    }
    public function jsonSerialize(): array
    {
        return array('Name' => $this->Name, 'Amount' => $this->Amount, 'PaymentType' => $this->PaymentType, 'TransactionId' => $this->TransactionId, 'TransactionOrigin' => $this->TransactionOrigin);
    }
}
