public function __construct($recipient, $type, $data)
{
$this->recipient = $recipient;
$this->type = $type;
switch ($type) {
case self::TYPE_BUTTON:
$this->title = $data['text'];
$this->buttons = $data['buttons'];
break;
case self::TYPE_GENERIC:
$this->elements = $data['elements'];
break;
case self::TYPE_RECEIPT:
$this->recipient_name = $data['recipient_name'];
$this->order_number = $data['order_number'];
$this->currency = $data['currency'];
$this->payment_method = $data['payment_method'];
$this->order_url = $data['order_url'];
$this->timestamp = $data['timestamp'];
$this->elements = $data['elements'];
$this->address = $data['address'];
$this->summary = $data['summary'];
$this->adjustments = $data['adjustments'];
break;
}
}