public function toArray()
{
$this->checkRecipient();
$payload = ['template_type' => 'receipt', 'recipient_name' => $this->recipient_name, 'order_number' => $this->order_number, 'currency' => $this->currency, 'payment_method' => $this->payment_method, 'summary' => $this->summary, 'elements' => $this->elements];
if (!is_null($this->timestamp)) {
$payload['timestamp'] = $this->timestamp;
}
if (!is_null($this->order_url)) {
$payload['order_url'] = $this->order_url;
}
if (!is_null($this->address)) {
$payload['address'] = $this->address;
}
if (!is_null($this->adjustments)) {
$payload['adjustments'] = $this->adjustments;
}
return ['recipient' => ['id' => $this->recipient_id], 'message' => ['attachment' => ['type' => 'template', 'payload' => $payload]]];
}