File: D:/HostingSpaces/SBogers10/shop.komma.nl/app/Payment/Clients/MultiSafepay/Models/PaymentDetails.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 details
*
* @see Order
* @package App\Payment\Clients\MultiSafepay\Models
*/
class PaymentDetails
{
/** @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: 6329587967751146 */
private $external_transaction_id;
/** @var string Example: IDEAL */
private $type;
/** @var int Example: 0*/
private $recurring_id;
/** Prevent constructing a new instance with the new keyword */
private function __construct() {}
/**
* Create an instance from a json string
*
* @param string $jsonString
* @return PaymentDetails
* @throws \Exception
*/
public static function FromJsonString(string $jsonString): PaymentDetails {
$instance = new self;
$data = json_decode($jsonString, true);
if($data === null) throw new \Exception('MultiSafepay PaymentDetails: The payment details data is invalid. It does not seem to be a json string.');
$instance->recurring_id = (!empty($data['recurring_id'])) ? $data['recurring_id']: '';
$instance->type = (!empty($data['type'])) ? $data['type']: '';
$instance->account_id = (!empty($data['account_id'])) ? $data['account_id']: 0;
$instance->account_holder_name = (!empty($data['account_holder_name'])) ? $data['account_holder_name']: '';
$instance->external_transaction_id = (!empty($data['external_transaction_id'])) ? $data['external_transaction_id']: 0;
$instance->account_iban = (!empty($data['account_iban'])) ? $data['account_iban']: '';
$instance->account_bic = (!empty($data['account_bic'])) ? $data['account_bic']: '';
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 getExternalTransactionId(): int
{
return $this->external_transaction_id;
}
/**
* @return string
*/
public function getType(): string
{
return $this->type;
}
/**
* @return int
*/
public function getRecurringId(): int
{
return $this->recurring_id;
}
/**
* @param string $account_bic
* @return PaymentDetails
*/
public function setAccountBic(string $account_bic): PaymentDetails
{
$this->account_bic = $account_bic;
return $this;
}
/**
* @param string $account_holder_name
* @return PaymentDetails
*/
public function setAccountHolderName(string $account_holder_name): PaymentDetails
{
$this->account_holder_name = $account_holder_name;
return $this;
}
/**
* @param string $account_iban
* @return PaymentDetails
*/
public function setAccountIban(string $account_iban): PaymentDetails
{
$this->account_iban = $account_iban;
return $this;
}
/**
* @param int $account_id
* @return PaymentDetails
*/
public function setAccountId(int $account_id): PaymentDetails
{
$this->account_id = $account_id;
return $this;
}
/**
* @param int $external_transaction_id
* @return PaymentDetails
*/
public function setExternalTransactionId(int $external_transaction_id): PaymentDetails
{
$this->external_transaction_id = $external_transaction_id;
return $this;
}
/**
* @param string $type
* @return PaymentDetails
*/
public function setType(string $type): PaymentDetails
{
$this->type = $type;
return $this;
}
/**
* @param int $recurring_id
* @return PaymentDetails
*/
public function setRecurringId(int $recurring_id): PaymentDetails
{
$this->recurring_id = $recurring_id;
return $this;
}
}