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 / Cart / interface-cart-service.php

interface-cart-service.php in seQura 4.0.0, at src/Services/Cart/interface-cart-service.php

102 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Cart service interface
4 *
5 * @package SeQura/WC
6 * @subpackage SeQura/WC/Services
7 */
8
9 namespace SeQura\WC\Services\Cart;
10
11 use SeQura\Core\BusinessLogic\Domain\Order\Models\OrderRequest\Item\DiscountItem;
12 use SeQura\Core\BusinessLogic\Domain\Order\Models\OrderRequest\Item\HandlingItem;
13 use SeQura\Core\BusinessLogic\Domain\Order\Models\OrderRequest\Item\OtherPaymentItem;
14 use SeQura\Core\BusinessLogic\Domain\Order\Models\OrderRequest\Item\ProductItem;
15 use SeQura\Core\BusinessLogic\Domain\Order\Models\OrderRequest\Item\RegistrationItem;
16 use SeQura\Core\BusinessLogic\Domain\Order\Models\OrderRequest\Item\ServiceItem;
17 use SeQura\WC\Dto\Cart_Info;
18 use WC_Order;
19 use WC_Product;
20
21 /**
22 * Handle use cases related to cart
23 */
24 interface Interface_Cart_Service {
25
26 /**
27 * Get closest desired first charge date from cart items
28 */
29 public function get_desired_first_charge_on( ?WC_Order $order = null ): ?string;
30
31 /**
32 * Get seQura cart info data from session. If not exists, then initialize it.
33 *
34 * @param bool $initialize_if_not_exists If true, then initialize cart info if not exists.
35 */
36 public function get_cart_info_from_session( $initialize_if_not_exists = true ): ?Cart_Info;
37
38 /**
39 * Attempt to clear seQura cart info data from session.
40 */
41 public function clear_cart_info_from_session(): void;
42
43 /**
44 * Check if cart info is valid
45 *
46 * @param ?Cart_Info $cart_info
47 */
48 public function is_cart_info_valid( $cart_info ): bool;
49
50 /**
51 * Get items in cart
52 *
53 * @return array<ProductItem|ServiceItem|RegistrationItem>
54 */
55 public function get_items( ?WC_Order $order ): array;
56
57 /**
58 * Get products in cart
59 *
60 * @return array<WC_Product>
61 */
62 public function get_products( ?WC_Order $order ): array;
63
64 /**
65 * Get handling items
66 *
67 * @return HandlingItem[]
68 */
69 public function get_handling_items( ?WC_Order $order = null ): array;
70
71 /**
72 * Get discount items
73 *
74 * @return DiscountItem[]
75 */
76 public function get_discount_items( ?WC_Order $order = null ): array;
77
78 /**
79 * Get refund items
80 *
81 * @return OtherPaymentItem[]
82 */
83 public function get_refund_items( ?WC_Order $order = null ): array;
84
85 /**
86 * Create refund item instance
87 */
88 public function create_refund_item( ?int $id, float $amount ): OtherPaymentItem;
89
90 /**
91 * Check if conditions are met for showing seQura in checkout
92 */
93 public function is_available_in_checkout( ?WC_Order $order = null ): bool;
94
95 /**
96 * Get the total amount of the cart
97 *
98 * @return float|int
99 */
100 public function get_total( $in_cents = true );
101 }
102