mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +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
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function to_array() : array {
|
public function to_array() : array {
|
||||||
$data = array(
|
$data = array(
|
||||||
'id' => $this->id(),
|
'id' => $this->id(),
|
||||||
'status' => $this->status()->name(),
|
'status' => $this->status()->name(),
|
||||||
'amount' => $this->amount()->to_array(),
|
'amount' => $this->amount()->to_array(),
|
||||||
|
@ -173,8 +173,9 @@ class Capture {
|
||||||
'invoice_id' => $this->invoice_id(),
|
'invoice_id' => $this->invoice_id(),
|
||||||
'custom_id' => $this->custom_id(),
|
'custom_id' => $this->custom_id(),
|
||||||
);
|
);
|
||||||
if ( $this->status()->details() ) {
|
$details = $this->status()->details();
|
||||||
$data['status_details'] = array( 'reason' => $this->status()->details()->reason() );
|
if ( $details ) {
|
||||||
|
$data['status_details'] = array( 'reason' => $details->reason() );
|
||||||
}
|
}
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,8 +55,9 @@ trait PaymentsStatusHandlingTrait {
|
||||||
): void {
|
): void {
|
||||||
$status = $capture->status();
|
$status = $capture->status();
|
||||||
|
|
||||||
if ( $status->details() ) {
|
$details = $status->details();
|
||||||
$this->add_status_details_note( $wc_order, $status->name(), $status->details()->text() );
|
if ( $details ) {
|
||||||
|
$this->add_status_details_note( $wc_order, $status->name(), $details->text() );
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ( $status->name() ) {
|
switch ( $status->name() ) {
|
||||||
|
@ -95,8 +96,9 @@ trait PaymentsStatusHandlingTrait {
|
||||||
): void {
|
): void {
|
||||||
$status = $authorization->status();
|
$status = $authorization->status();
|
||||||
|
|
||||||
if ( $status->details() ) {
|
$details = $status->details();
|
||||||
$this->add_status_details_note( $wc_order, $status->name(), $status->details()->text() );
|
if ( $details ) {
|
||||||
|
$this->add_status_details_note( $wc_order, $status->name(), $details->text() );
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ( $status->name() ) {
|
switch ( $status->name() ) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue