PluginProbe
seQura / 3.1.0
seQura v3.1.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 3.1.0, at src/Services/Product/interface-product-service.php

114 lines 2.7 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 * Update is_banned value
55 */
56 public function set_is_banned( int $product_id, ?string $value ): void;
57
58 /**
59 * Get product is_banned value
60 *
61 * @param int|WC_Product $product The product ID or product object
62 */
63 public function get_is_banned( $product ): bool;
64
65 /**
66 * Get product service end date
67 *
68 * @param WC_Product|int $product the product we are building item info for.
69 */
70 public function get_service_end_date( $product, bool $raw_value = false ): string;
71
72 /**
73 * Update service end date value
74 */
75 public function set_service_end_date( int $product_id, ?string $value ): void;
76
77 /**
78 * Update desired_first_charge_date value
79 */
80 public function set_desired_first_charge_date( int $product_id, ?string $value ): void;
81
82 /**
83 * Get registration amount
84 *
85 * @param WC_Product|int $product the product we are building item info for.
86 */
87 public function get_registration_amount( $product, bool $to_cents = false ): float;
88
89 /**
90 * Update registration amount value
91 */
92 public function set_registration_amount( int $product_id, ?float $value ): void;
93
94 /**
95 * Check if we can display mini widgets
96 */
97 public function can_display_mini_widgets(): bool;
98
99 /**
100 * Check if we can display widgets for a product
101 *
102 * @param WC_Product|int $product the product.
103 */
104 public function can_display_widgets( $product ): bool;
105
106 /**
107 * Check if we can display widget of a payment method for a product
108 *
109 * @param WC_Product|int $product the product.
110 * @param array<string, string> $method the payment method. See PaymentMethodsResponse::toArray() output
111 */
112 public function can_display_widget_for_method( $product, $method ): bool;
113 }
114