HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/shop.komma.nl/app/Payment/Clients/MultiSafepay/Models/PaymentMethod.php
<?php


namespace App\Payment\Clients\MultiSafepay\Models;

/**
 * Class PaymentMethod
 *
 * @see https://docs.multisafepay.com/api/#orders
 * @sidenote Created by Komma
 *
 * MultiSafepay Orders have payment methods
 *
 * @see Order
 * @package App\Payment\Clients\MultiSafepay\Models
 */
class PaymentMethod
{
    /** @var string Example: INGBNL2A */
    private $account_bic;

    /** @var string Example: Jan Jansen*/
    private $account_holder_name;

    /** @var string Example: NL87ABNA0000000001*/
    private $account_iban;

    /** @var int Example: 1*/
    private $account_id;

    /** @var int Example: 799 (7 euro's 99 cents for example) */
    private $amount;

    /** @var string Example: EUR */
    private $currency;

    /** @var string Example: order #13*/
    private $description;

    /** @var int Example: 6329587967751146 */
    private $external_transaction_id;

    /** @var string Example: iDEAL */
    private $payment_description;

    /** @var string Example: completed */
    private $status;

    /** @var string Example: IDEAL */
    private $type;

    /** Prevent constructing a new instance with the new keyword */
    private function __construct() {}

    /**
     * Create an instance from a json string
     *
     * @param string $jsonString
     * @return PaymentMethod
     * @throws \Exception
     */
    public static function FromJsonString(string $jsonString): PaymentMethod {
        $instance = new self;

        $data = json_decode($jsonString, true);
        if($data === null) throw new \Exception('MultiSafepay PaymentMethod: The payment method data is invalid. It does not seem to be a json string.');

        $instance->account_bic = (!empty($data['account_bic'])) ? $data['account_bic']: '';
        $instance->account_holder_name = (!empty($data['account_holder_name'])) ? $data['account_holder_name']: '';
        $instance->account_iban = (!empty($data['account_iban'])) ? $data['account_iban']: '';
        $instance->account_id = (!empty($data['account_id'])) ? $data['account_id']: 0;
        $instance->amount = (!empty($data['amount'])) ? $data['amount']: 0;
        $instance->currency = (!empty($data['currency'])) ? $data['currency']: '';
        $instance->description = (!empty($data['description'])) ? $data['description']: '';
        $instance->external_transaction_id = (!empty($data['external_transaction_id'])) ? $data['external_transaction_id']: 0;
        $instance->payment_description = (!empty($data['payment_description'])) ? $data['payment_description']: '';
        $instance->status = (!empty($data['status'])) ? $data['status']: '';
        $instance->type = (!empty($data['type'])) ? $data['type']: '';

        return $instance;
    }

    /**
     * @return string
     */
    public function getAccountBic(): string
    {
        return $this->account_bic;
    }

    /**
     * @return string
     */
    public function getAccountHolderName(): string
    {
        return $this->account_holder_name;
    }

    /**
     * @return string
     */
    public function getAccountIban(): string
    {
        return $this->account_iban;
    }

    /**
     * @return int
     */
    public function getAccountId(): int
    {
        return $this->account_id;
    }

    /**
     * @return int
     */
    public function getAmount(): int
    {
        return $this->amount;
    }

    /**
     * @return string
     */
    public function getCurrency(): string
    {
        return $this->currency;
    }

    /**
     * @return string
     */
    public function getDescription(): string
    {
        return $this->description;
    }

    /**
     * @return int
     */
    public function getExternalTransactionId(): int
    {
        return $this->external_transaction_id;
    }

    /**
     * @return string
     */
    public function getPaymentDescription(): string
    {
        return $this->payment_description;
    }

    /**
     * @return string
     */
    public function getStatus(): string
    {
        return $this->status;
    }

    /**
     * @return string
     */
    public function getType(): string
    {
        return $this->type;
    }

    /**
     * @param string $account_bic
     * @return PaymentMethod
     */
    public function setAccountBic(string $account_bic): PaymentMethod
    {
        $this->account_bic = $account_bic;
        return $this;
    }

    /**
     * @param string $account_holder_name
     * @return PaymentMethod
     */
    public function setAccountHolderName(string $account_holder_name): PaymentMethod
    {
        $this->account_holder_name = $account_holder_name;
        return $this;
    }

    /**
     * @param string $account_iban
     * @return PaymentMethod
     */
    public function setAccountIban(string $account_iban): PaymentMethod
    {
        $this->account_iban = $account_iban;
        return $this;
    }

    /**
     * @param int $account_id
     * @return PaymentMethod
     */
    public function setAccountId(int $account_id): PaymentMethod
    {
        $this->account_id = $account_id;
        return $this;
    }

    /**
     * @param int $amount
     * @return PaymentMethod
     */
    public function setAmount(int $amount): PaymentMethod
    {
        $this->amount = $amount;
        return $this;
    }

    /**
     * @param string $currency
     * @return PaymentMethod
     */
    public function setCurrency(string $currency): PaymentMethod
    {
        $this->currency = $currency;
        return $this;
    }

    /**
     * @param string $description
     * @return PaymentMethod
     */
    public function setDescription(string $description): PaymentMethod
    {
        $this->description = $description;
        return $this;
    }

    /**
     * @param int $external_transaction_id
     * @return PaymentMethod
     */
    public function setExternalTransactionId(int $external_transaction_id): PaymentMethod
    {
        $this->external_transaction_id = $external_transaction_id;
        return $this;
    }

    /**
     * @param string $payment_description
     * @return PaymentMethod
     */
    public function setPaymentDescription(string $payment_description): PaymentMethod
    {
        $this->payment_description = $payment_description;
        return $this;
    }

    /**
     * @param string $status
     * @return PaymentMethod
     */
    public function setStatus(string $status): PaymentMethod
    {
        $this->status = $status;
        return $this;
    }

    /**
     * @param string $type
     * @return PaymentMethod
     */
    public function setType(string $type): PaymentMethod
    {
        $this->type = $type;
        return $this;
    }
}