class-wc-order-data-store-interface.php 2.75 KB
Newer Older
imac's avatar
imac committed
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 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * WC Order Data Store Interface
 *
 * Functions that must be defined by order store classes.
 *
 * @version  3.0.0
 * @category Interface
 * @author   WooThemes
 */
interface WC_Order_Data_Store_Interface {
	/**
	 * Get amount already refunded.
	 *
	 * @param  WC_Order $order
	 * @return string
	 */
	public function get_total_refunded( $order );

	/**
	 * Get the total tax refunded.
	 *
	 * @param  WC_Order $order
	 * @return float
	 */
	public function get_total_tax_refunded( $order );

	/**
	 * Get the total shipping refunded.
	 *
	 * @param  WC_Order $order
	 * @return float
	 */
	public function get_total_shipping_refunded( $order );

	/**
	 * Finds an Order ID based on an order key.
	 *
	 * @param string $order_key An order key has generated by
	 * @return int The ID of an order, or 0 if the order could not be found
	 */
	public function get_order_id_by_order_key( $order_key );

	/**
	 * Return count of orders with a specific status.
	 * @param  string $status
	 * @return int
	 */
	public function get_order_count( $status );

	/**
	 * Get all orders matching the passed in args.
	 *
	 * @see    wc_get_orders()
	 * @param  array $args
	 * @return array of orders
	 */
	public function get_orders( $args = array() );

	/**
	 * Get unpaid orders after a certain date,
	 * @param  int $date timestamp
	 * @return array
	 */
	public function get_unpaid_orders( $date );

	/**
	 * Search order data for a term and return ids.
	 * @param  string $term
	 * @return array of ids
	 */
	public function search_orders( $term );

	/**
	 * Gets information about whether permissions were generated yet.
	 * @param WC_Order $order
	 * @return bool
	 */
	public function get_download_permissions_granted( $order );

	/**
	 * Stores information about whether permissions were generated yet.
	 * @param WC_Order $order
	 * @param bool $set
	 */
	public function set_download_permissions_granted( $order, $set );

	/**
	 * Gets information about whether sales were recorded.
	 * @param WC_Order $order
	 * @return bool
	 */
	public function get_recorded_sales( $order );

	/**
	 * Stores information about whether sales were recorded.
	 * @param WC_Order $order
	 * @param bool $set
	 */
	public function set_recorded_sales( $order, $set );

	/**
	 * Gets information about whether coupon counts were updated.
	 * @param WC_Order $order
	 * @return bool
	 */
	public function get_recorded_coupon_usage_counts( $order );

	/**
	 * Stores information about whether coupon counts were updated.
	 * @param WC_Order $order
	 * @param bool $set
	 */
	public function set_recorded_coupon_usage_counts( $order, $set );

	/**
	 * Get the order type based on Order ID.
	 * @param  int $order_id
	 * @return string
	 */
	public function get_order_type( $order_id );
}