| 1 |
<?php |
| 2 |
|
| 3 |
namespace Hyperpay\Gateways\Helpers; |
| 4 |
|
| 5 |
use \WC_Order; |
| 6 |
|
| 7 |
class SubscriptionsManager |
| 8 |
{ |
| 9 |
|
| 10 |
public static function orderContainsSubscription(WC_Order $order) |
| 11 |
{ |
| 12 |
if (!\function_exists('wcs_order_contains_subscription')) { |
| 13 |
return false; |
| 14 |
} |
| 15 |
return wcs_order_contains_subscription($order->get_id()); |
| 16 |
} |
| 17 |
|
| 18 |
public static function getSubscriptionsForOrder(WC_Order $order, $options = []) |
| 19 |
{ |
| 20 |
if (!\function_exists('wcs_get_subscriptions_for_order')) { |
| 21 |
return []; |
| 22 |
} |
| 23 |
return wcs_get_subscriptions_for_order($order, $options); |
| 24 |
} |
| 25 |
|
| 26 |
public static function getUsersSubscriptions($userId) |
| 27 |
{ |
| 28 |
if (!\function_exists('wcs_get_users_subscriptions') || !$userId) { |
| 29 |
return []; |
| 30 |
} |
| 31 |
return wcs_get_users_subscriptions($userId); |
| 32 |
} |
| 33 |
} |
| 34 |
|