/var/www/(Del)hsihk.com/wp-content/plugins/woocommerce/includes/class-wc-order-refund.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
/**
 * Order refund
 *
 * @class    WC_Order_Refund
 * @version  2.2.0
 * @package  WooCommerce/Classes
 * @category Class
 * @author   WooThemes
 */
class WC_Order_Refund extends WC_Abstract_Order {

    
/**
     * Initialize the order refund.
     *
     * @param int|WC_Order_Refund $refund
     */
    
public function __construct$refund ) {
        
$this->order_type 'refund';

        if ( 
is_numeric$refund ) ) {
            
$this->id absint$refund );
            
$this->post get_post$refund );
            
$this->get_refund$this->id );
        } elseif ( 
$refund instanceof WC_Order_Refund ) {
            
$this->id absint$refund->id );
            
$this->post $refund->post;
            
$this->get_refund$this->id );
        } elseif ( 
$refund instanceof WC_Order_Refund || isset( $refund->ID ) ) {
            
$this->id absint$refund->ID );
            
$this->post $refund;
            
$this->get_refund$this->id );
        }
    }

    
/**
     * Gets an refund from the database
     *
     * @since 2.2
     * @param int $id
     * @return bool
     */
    
public function get_refund$id ) {
        if ( ! 
$id ) {
            return 
false;
        }

        if ( 
$result get_post$id ) ) {
            
$this->populate$result );

            return 
true;
        }

        return 
false;
    }

    
/**
     * Populates an refund from the loaded post data
     *
     * @since 2.2
     * @param mixed $result
     * @return void
     */
    
public function populate$result ) {
        
// Standard post data
        
$this->id            $result->ID;
        
$this->date          $result->post_date;
        
$this->modified_date $result->post_modified;
        
$this->reason        $result->post_excerpt;
    }

    
/**
     * Get refunded amount
     *
     * @since 2.2
     * @return int|float
     */
    
public function get_refund_amount() {
        return 
apply_filters'woocommerce_refund_amount', (double) $this->refund_amount$this );
    }

    
/**
     * Get refunded amount
     *
     * @since 2.2
     * @return int|float
     */
    
public function get_refund_reason() {
        return 
apply_filters'woocommerce_refund_reason'$this->reason$this );
    }
}