2016-11-09 12:21:18 +00:00
|
|
|
<?php
|
2018-03-06 08:13:06 +00:00
|
|
|
/**
|
|
|
|
* Coupon Data Store Interface
|
|
|
|
*
|
|
|
|
* @version 3.0.0
|
|
|
|
* @package WooCommerce/Interfaces
|
|
|
|
*/
|
|
|
|
|
2016-11-09 12:21:18 +00:00
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* WC Coupon Data Store Interface
|
|
|
|
*
|
|
|
|
* Functions that must be defined by coupon store classes.
|
|
|
|
*
|
2017-03-15 16:36:53 +00:00
|
|
|
* @version 3.0.0
|
2016-11-09 12:21:18 +00:00
|
|
|
*/
|
2016-11-22 13:54:51 +00:00
|
|
|
interface WC_Coupon_Data_Store_Interface {
|
2016-11-09 12:21:18 +00:00
|
|
|
/**
|
|
|
|
* Increase usage count for current coupon.
|
2018-03-06 08:13:06 +00:00
|
|
|
*
|
|
|
|
* @param WC_Coupon $coupon Coupon object.
|
|
|
|
* @param string $used_by Either user ID or billing email.
|
2016-11-09 12:21:18 +00:00
|
|
|
*/
|
|
|
|
public function increase_usage_count( &$coupon, $used_by = '' );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Decrease usage count for current coupon.
|
2018-03-06 08:13:06 +00:00
|
|
|
*
|
|
|
|
* @param WC_Coupon $coupon Coupon object.
|
|
|
|
* @param string $used_by Either user ID or billing email.
|
2016-11-09 12:21:18 +00:00
|
|
|
*/
|
|
|
|
public function decrease_usage_count( &$coupon, $used_by = '' );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the number of uses for a coupon by user ID.
|
2018-03-06 08:13:06 +00:00
|
|
|
*
|
|
|
|
* @param WC_Coupon $coupon Coupon object.
|
|
|
|
* @param int $user_id User ID.
|
2016-11-09 12:21:18 +00:00
|
|
|
* @return int
|
|
|
|
*/
|
|
|
|
public function get_usage_by_user_id( &$coupon, $user_id );
|
2016-11-14 10:29:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return a coupon code for a specific ID.
|
2018-03-06 08:13:06 +00:00
|
|
|
*
|
|
|
|
* @param int $id Coupon ID.
|
|
|
|
* @return string Coupon Code.
|
2016-11-14 10:29:25 +00:00
|
|
|
*/
|
2018-03-06 08:13:06 +00:00
|
|
|
public function get_code_by_id( $id );
|
2016-11-14 10:29:25 +00:00
|
|
|
|
2018-03-06 08:13:06 +00:00
|
|
|
/**
|
|
|
|
* Return an array of IDs for for a specific coupon code.
|
|
|
|
* Can return multiple to check for existence.
|
|
|
|
*
|
|
|
|
* @param string $code Coupon code.
|
|
|
|
* @return array Array of IDs.
|
|
|
|
*/
|
|
|
|
public function get_ids_by_code( $code );
|
2016-11-09 12:21:18 +00:00
|
|
|
}
|