WC_Order_Square.php
| 1 | <?php |
| 2 | /** |
| 3 | * This class solely exists to deal with the deprecated warnings on PHP 8.2+. |
| 4 | * |
| 5 | * In multiple places, the plugin dynamically adds properties on the instance |
| 6 | * of the \WC_Order class, which is no longer supported on PHP 8.2+ |
| 7 | */ |
| 8 | |
| 9 | namespace WooCommerce\Square; |
| 10 | |
| 11 | class WC_Order_Square extends \WC_Order { |
| 12 | /** |
| 13 | * Holds the Square customer ID. |
| 14 | * |
| 15 | * @var string |
| 16 | */ |
| 17 | public $customer_id; |
| 18 | |
| 19 | /** |
| 20 | * Holds the Square customer ID. Same as $customer_id. |
| 21 | * |
| 22 | * @var string |
| 23 | */ |
| 24 | public $square_customer_id; |
| 25 | |
| 26 | /** |
| 27 | * Holds payment information on the order object. |
| 28 | * |
| 29 | * @var object |
| 30 | */ |
| 31 | public $payment; |
| 32 | |
| 33 | /** |
| 34 | * Holds order description. |
| 35 | * |
| 36 | * @var string |
| 37 | */ |
| 38 | public $description; |
| 39 | |
| 40 | /** |
| 41 | * Holds a combination of order number + retry count, should provide |
| 42 | * a unique value for each transaction attempt. |
| 43 | * |
| 44 | * @var string |
| 45 | */ |
| 46 | public $unique_transaction_ref; |
| 47 | |
| 48 | /** |
| 49 | * Holds Square order ID. |
| 50 | * |
| 51 | * @var string |
| 52 | */ |
| 53 | public $square_order_id; |
| 54 | |
| 55 | /** |
| 56 | * Holds plugin version number. |
| 57 | * |
| 58 | * @var string |
| 59 | */ |
| 60 | public $square_version; |
| 61 | |
| 62 | /** |
| 63 | * Holds order payment total. |
| 64 | * |
| 65 | * @var float |
| 66 | */ |
| 67 | public $payment_total; |
| 68 | |
| 69 | /** |
| 70 | * Holds capture transaction type information. |
| 71 | * |
| 72 | * @var object |
| 73 | */ |
| 74 | public $capture; |
| 75 | |
| 76 | /** |
| 77 | * Holds refund order information. |
| 78 | * |
| 79 | * @var object |
| 80 | */ |
| 81 | public $refund; |
| 82 | |
| 83 | /** |
| 84 | * Wrapper around wc_get_order(). |
| 85 | * |
| 86 | * @since 4.3.1 |
| 87 | * |
| 88 | * @param mixed $the_order Post object or post ID of the order. |
| 89 | * |
| 90 | * @return bool|WC_Order|WC_Order_Refund|WC_Order_Square |
| 91 | */ |
| 92 | public static function wc_get_order( $the_order ) { |
| 93 | return \wc_get_order( $the_order ); |
| 94 | } |
| 95 | } |
| 96 |