Skip to content

Bugfix: prevent undefined index errors #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 28, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/Message/ChargeResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,27 +38,27 @@ public function getRedirectData()

public function getTransactionId()
{
return $this->data['transactionId'];
return $this->data['transactionId'] ?? null;
}

public function getTenders()
{
return $this->data['tenders'];
return $this->data['tenders'] ?? null;
}

public function getOrderId()
{
return $this->data['orderId'];
return $this->data['orderId'] ?? null;
}

public function getCreatedAt()
{
return $this->data['created_at'];
return $this->data['created_at'] ?? null;
}

public function getReferenceId()
{
return $this->data['referenceId'];
return $this->data['referenceId'] ?? null;
}

public function getMessage()
Expand All @@ -68,7 +68,7 @@ public function getMessage()
$message .= $this->data['code'] . ': ';
}

return $message . ($this->data['error'] ?? '');
return $message . ($this->data['detail'] ?? '');
}

/**
Expand All @@ -84,10 +84,10 @@ public function getTransactionReference()
/**
* Get the tender id that is used for processing refunds
*
* @return string
* @return null|string
*/
public function getBillingId()
{
return $this->getTenders()[0]['id'];
return $this->getTenders()[0]['id'] ?? null;
}
}