HEX
Server: Apache
System: Linux andromeda.lojoweb.com 4.18.0-372.26.1.el8_6.x86_64 #1 SMP Tue Sep 13 06:07:14 EDT 2022 x86_64
User: nakedfoamlojoweb (1056)
PHP: 8.0.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //proc/self/cwd/wp-content/plugins/woocommerce-square/includes/Gateway/API/Responses/Refund.php
<?php

namespace WooCommerce\Square\Gateway\API\Responses;

defined( 'ABSPATH' ) || exit;

/**
 * The refund API response object.
 *
 * @since 2.0.0
 *
 * @method \Square\Models\CreateRefundResponse|\Square\Models\GetPaymentRefundResponse get_data()
 */
class Refund extends \WooCommerce\Square\Gateway\API\Response {

	/**
	 * Determines if the transaction was approved.
	 *
	 * @since 2.0.0
	 *
	 * @return bool
	 */
	public function transaction_approved() {
		return parent::transaction_approved() && ( in_array( $this->get_status_code(), array( 'APPROVED', 'COMPLETED', 'PENDING' ), true ) );
	}

	/**
	 * Gets the transaction ID.
	 *
	 * @since 2.0.0
	 *
	 * @return string
	 */
	public function get_transaction_id() {

		return $this->get_data() && $this->get_data()->getRefund() ? $this->get_data()->getRefund()->getId() : '';
	}

	/**
	 * Gets the response status code.
	 *
	 * @since 2.0.0
	 *
	 * @return string
	 */
	public function get_status_code() {

		if ( ! $this->has_errors() && $this->get_data() ) {
			$code = $this->get_data()->getRefund()->getStatus();
		} else {
			$code = parent::get_status_code();
		}

		return $code;
	}
}