<?php defined('ABSPATH') || exit; class WC_Order_Refund extends WC_Abstract_Order { protected $data_store_name = 'order-refund'; protected $object_type = 'order_refund'; protected $extra_data = array('amount' => '', 'reason' => '', 'refunded_by' => 0, 'refunded_payment' => false); public function get_type() { return 'shop_order_refund'; } public function get_status($context = 'view') { return 'completed'; } public function get_post_title() { return sprintf(__('Refund &ndash; %s', 'woocommerce'), strftime(_x('%b %d, %Y @ %I:%M %p', 'Order date parsed by strftime', 'woocommerce'))); } public function get_amount($context = 'view') { return $this->get_prop('amount', $context); } public function get_reason($context = 'view') { return $this->get_prop('reason', $context); } public function get_refunded_by($context = 'view') { return $this->get_prop('refunded_by', $context); } public function get_refunded_payment($context = 'view') { return $this->get_prop('refunded_payment', $context); } public function get_formatted_refund_amount() { return apply_filters('woocommerce_formatted_refund_amount', wc_price($this->get_amount(), array('currency' => $this->get_currency())), $this); } public function set_amount($value) { $this->set_prop('amount', wc_format_decimal($value)); } public function set_reason($value) { $this->set_prop('reason', $value); } public function set_refunded_by($value) { $this->set_prop('refunded_by', absint($value)); } public function set_refunded_payment($value) { $this->set_prop('refunded_payment', (bool) $value); } public function __get($key) { wc_doing_it_wrong($key, 'Refund properties should not be accessed directly.', '3.0'); if ('reason' === $key) { return $this->get_reason(); } elseif ('refund_amount' === $key) { return $this->get_amount(); } return parent::__get($key); } public function get_refund($id = 0) { wc_deprecated_function('get_refund', '3.0', 'read'); if (!$id) { return false; } $result = get_post($id); if ($result) { $this->populate($result); return true; } return false; } public function get_refund_amount() { wc_deprecated_function('get_refund_amount', '3.0', 'get_amount'); return $this->get_amount(); } public function get_refund_reason() { wc_deprecated_function('get_refund_reason', '3.0', 'get_reason'); return $this->get_reason(); } }