mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 14:57:26 +08:00
Fix null access
This commit is contained in:
parent
92eef9ceb9
commit
d91131cb06
2 changed files with 10 additions and 7 deletions
|
@ -164,7 +164,7 @@ class Capture {
|
|||
* @return array
|
||||
*/
|
||||
public function to_array() : array {
|
||||
$data = array(
|
||||
$data = array(
|
||||
'id' => $this->id(),
|
||||
'status' => $this->status()->name(),
|
||||
'amount' => $this->amount()->to_array(),
|
||||
|
@ -173,8 +173,9 @@ class Capture {
|
|||
'invoice_id' => $this->invoice_id(),
|
||||
'custom_id' => $this->custom_id(),
|
||||
);
|
||||
if ( $this->status()->details() ) {
|
||||
$data['status_details'] = array( 'reason' => $this->status()->details()->reason() );
|
||||
$details = $this->status()->details();
|
||||
if ( $details ) {
|
||||
$data['status_details'] = array( 'reason' => $details->reason() );
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue