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/brameda/brameda.nl/app/Komma/Shop/Payment/Clients/MultiSafepay/Models/Customer.php
<?php


namespace App\Komma\Shop\Payment\Clients\MultiSafepay\Models;

/**
 * Class Order
 *
 * @see https://docs.multisafepay.com/api/#orders
 * @sidenote Created by Komma
 *
 * MultiSafepay orders have a customer
 *
 * @package App\Komma\Shop\Payment\Clients\MultiSafepay\Models
 */
class Customer
{
    /** @var string Example: nl_NL */
    private $locale;

    /** @var string Example: Jan */
    private $first_name;

    /** @var string Example: Jansen */
    private $last_name;

    /** @var string Example: Randweg-zuid */
    private $address1;

    /** @var string Example: Linker ingang */
    private $address2;

    /** @var string Example: 1A */
    private $house_number;

    /** @var string Example: 6021PW */
    private $zip_code;

    /** @var string Example: Budel */
    private $city;

    /** @var string Example: Noord-Brabant */
    private $state;

    /** @var string Example: NL */
    private $country;

    /** @var string Example: Country name */
    private $country_name;

    /** @var string Example: ??? */
    private $phone1;

    /** @var string Example: ??? */
    private $phone2;

    /** @var string Example: info@komma.pro */
    private $email;

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

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

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

        $instance->locale = (!empty($data['locale'])) ? $data['locale'] : '';
        $instance->first_name = (!empty($data['first_name'])) ? $data['first_name'] : '';
        $instance->last_name = (!empty($data['last_name'])) ? $data['last_name'] : '';
        $instance->address1 = (!empty($data['address1'])) ? $data['address1'] : '';
        $instance->address2 = (!empty($data['address2'])) ? $data['address2'] : '';
        $instance->house_number = (!empty($data['house_number'])) ? $data['house_number'] : '';
        $instance->zip_code = (!empty($data['zip_code'])) ? $data['zip_code'] : '';
        $instance->city = (!empty($data['city'])) ? $data['city'] : '';
        $instance->state = (!empty($data['state'])) ? $data['state'] : '';
        $instance->country = (!empty($data['country'])) ? $data['country'] : '';
        $instance->country_name = (!empty($data['country_name'])) ? $data['country_name'] : '';
        $instance->phone1 = (!empty($data['phone1'])) ? $data['phone1'] : '';
        $instance->phone2 = (!empty($data['phone2'])) ? $data['phone2'] : '';
        $instance->email = (!empty($data['email'])) ? $data['email'] : '';

        return $instance;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    /**
     * @param string $locale
     * @return Customer
     */
    public function setLocale(string $locale): Customer
    {
        $this->locale = $locale;
        return $this;
    }

    /**
     * @param string $first_name
     * @return Customer
     */
    public function setFirstName(string $first_name): Customer
    {
        $this->first_name = $first_name;
        return $this;
    }

    /**
     * @param string $last_name
     * @return Customer
     */
    public function setLastName(string $last_name): Customer
    {
        $this->last_name = $last_name;
        return $this;
    }

    /**
     * @param string $address1
     * @return Customer
     */
    public function setAddress1(string $address1): Customer
    {
        $this->address1 = $address1;
        return $this;
    }

    /**
     * @param string $address2
     * @return Customer
     */
    public function setAddress2(string $address2): Customer
    {
        $this->address2 = $address2;
        return $this;
    }

    /**
     * @param string $house_number
     * @return Customer
     */
    public function setHouseNumber(string $house_number): Customer
    {
        $this->house_number = $house_number;
        return $this;
    }

    /**
     * @param string $zip_code
     * @return Customer
     */
    public function setZipCode(string $zip_code): Customer
    {
        $this->zip_code = $zip_code;
        return $this;
    }

    /**
     * @param string $city
     * @return Customer
     */
    public function setCity(string $city): Customer
    {
        $this->city = $city;
        return $this;
    }

    /**
     * @param string $state
     * @return Customer
     */
    public function setState(string $state): Customer
    {
        $this->state = $state;
        return $this;
    }

    /**
     * @param string $country
     * @return Customer
     */
    public function setCountry(string $country): Customer
    {
        $this->country = $country;
        return $this;
    }

    /**
     * @param string $country_name
     * @return Customer
     */
    public function setCountryName(string $country_name): Customer
    {
        $this->country_name = $country_name;
        return $this;
    }

    /**
     * @param string $phone1
     * @return Customer
     */
    public function setPhone1(string $phone1): Customer
    {
        $this->phone1 = $phone1;
        return $this;
    }

    /**
     * @param string $phone2
     * @return Customer
     */
    public function setPhone2(string $phone2): Customer
    {
        $this->phone2 = $phone2;
        return $this;
    }

    /**
     * @param string $email
     * @return Customer
     */
    public function setEmail(string $email): Customer
    {
        $this->email = $email;
        return $this;
    }
}