The Simpay\Model\Response\PaymentTransactionCustomer
class represents an object that contains information about a payment transaction customer.
Name | Type | Description |
---|---|---|
$name |
string|null | The name of the customer |
$email |
string | The email address of the customer |
private function __construct(?string $name, string $email)
This method is the private constructor of the Simpay\Model\Response\PaymentTransactionCustomer
class. It takes in two parameters:
$name
- The name of the customer (string or null)$email
- The email address of the customer (string)
It sets the properties to their respective parameter values.
public static function createFromResponse(array $data): self
This method is a static factory method that creates an instance of the Simpay\Model\Response\PaymentTransactionCustomer
class from an array of data. It takes in one parameter: $data
, which is an array that contains the values for the customer properties. It returns a new instance of the Simpay\Model\Response\PaymentTransactionCustomer
class with the properties set to the corresponding values in $data
.
$responseData = [
'name' => 'John Doe',
'email' => '[email protected]'
];
$customer = PaymentTransactionCustomer::createFromResponse($responseData);
echo $customer->name; // John Doe
echo $customer->email; // [email protected]