PluginProbe
seQura / 4.0.0
seQura v4.0.0
4.3.4 4.3.3 4.3.2 4.3.1 trunk 2.0.0 2.0.10 2.0.11 2.0.12 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 3.0.0 3.0.2 3.0.5 3.0.6 3.0.7 3.1.0 3.1.1 3.2.0 3.2.1 3.2.2 4.0.0 All 30 releases
sequra / src / Services / Product / interface-product-service.php

interface-product-service.php in seQura 4.0.0, at src/Services/Product/interface-product-service.php

137 lines 3.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Product service interface
4 *
5 * @package SeQura/WC
6 * @subpackage SeQura/WC/Services
7 */
8
9 namespace SeQura\WC\Services\Product;
10
11 use DateTime;
12 use WC_Product;
13
14 /**
15 * Handle use cases related to products
16 */
17 interface Interface_Product_Service {
18
19 /**
20 * Get desired first charge date for a product
21 *
22 * @param int|WC_Product $product The product ID or product object
23 * @return DateTime|null|string
24 */
25 public function get_desired_first_charge_date( $product, bool $raw_value = false );
26
27 /**
28 * Get product instance
29 *
30 * @param int|WC_Product $product The product ID or product object
31 */
32 public function get_product_instance( $product ): ?WC_Product;
33
34 /**
35 * Check if product is a service
36 *
37 * @param int|WC_Product $product The product ID or product object
38 */
39 public function is_service( $product ): bool;
40
41 /**
42 * Update is service value
43 */
44 public function set_is_service( int $product_id, ?string $value ): void;
45
46 /**
47 * Check if product is banned
48 *
49 * @param int|WC_Product $product The product ID or product object
50 */
51 public function is_banned( $product ): bool;
52
53 /**
54 * Check if product and category ban lists are empty
55 */
56 public function is_ban_list_empty(): bool;
57
58 /**
59 * Update is_banned value
60 */
61 public function set_is_banned( int $product_id, ?string $value ): void;
62
63 /**
64 * Get product is_banned value
65 *
66 * @param int|WC_Product $product The product ID or product object
67 */
68 public function get_is_banned( $product ): bool;
69
70 /**
71 * Get product service end date
72 *
73 * @param WC_Product|int $product the product we are building item info for.
74 */
75 public function get_service_end_date( $product, bool $raw_value = false ): string;
76
77 /**
78 * Update service end date value
79 */
80 public function set_service_end_date( int $product_id, ?string $value ): void;
81
82 /**
83 * Update desired_first_charge_date value
84 */
85 public function set_desired_first_charge_date( int $product_id, ?string $value ): void;
86
87 /**
88 * Get registration amount
89 *
90 * @param WC_Product|int $product the product we are building item info for.
91 */
92 public function get_registration_amount( $product, bool $to_cents = false ): float;
93
94 /**
95 * Update registration amount value
96 */
97 public function set_registration_amount( int $product_id, ?float $value ): void;
98
99 /**
100 * Check if we can display widget of a payment method for a product
101 *
102 * @param WC_Product|int $product the product.
103 * @param array<string, string> $method the payment method. See PaymentMethodsResponse::toArray() output
104 */
105 public function can_display_widget_for_method( $product, $method ): bool;
106
107 /**
108 * Get enabledForServices from general settings.
109 */
110 public function is_enabled_for_services( ?string $country = null ): bool;
111
112 /**
113 * Get allowFirstServicePaymentDelay from general settings.
114 */
115 public function is_allow_first_service_payment_delay( ?string $country = null ): bool;
116
117 /**
118 * Get allowServiceRegistrationItems from general settings.
119 */
120 public function is_allow_service_registration_items( ?string $country = null ): bool;
121
122 /**
123 * Get defaultServicesEndDate from general settings.
124 */
125 public function get_default_services_end_date(): string;
126
127 /**
128 * Get the reference of a given product
129 */
130 public function get_reference( WC_Product $product ): string;
131
132 /**
133 * Get product name
134 */
135 public function get_name( WC_Product $product ): string;
136 }
137