| 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\ServiceItem; |
| 16 |
use SeQura\WC\Core\BusinessLogic\Domain\Order\Models\OrderRequest\Item\Registration_Item; |
| 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 |
public function get_cart_info_from_session(): ?Cart_Info; |
| 35 |
|
| 36 |
/** |
| 37 |
* Attempt to clear seQura cart info data from session. |
| 38 |
*/ |
| 39 |
public function clear_cart_info_from_session(): void; |
| 40 |
|
| 41 |
/** |
| 42 |
* Get items in cart |
| 43 |
* |
| 44 |
* @return array<ProductItem|ServiceItem|Registration_Item> |
| 45 |
*/ |
| 46 |
public function get_items( ?WC_Order $order ): array; |
| 47 |
|
| 48 |
/** |
| 49 |
* Get products in cart |
| 50 |
* |
| 51 |
* @return array<WC_Product> |
| 52 |
*/ |
| 53 |
public function get_products( ?WC_Order $order ): array; |
| 54 |
|
| 55 |
/** |
| 56 |
* Get handling items |
| 57 |
* |
| 58 |
* @return HandlingItem[] |
| 59 |
*/ |
| 60 |
public function get_handling_items( ?WC_Order $order = null ): array; |
| 61 |
|
| 62 |
/** |
| 63 |
* Get discount items |
| 64 |
* |
| 65 |
* @return DiscountItem[] |
| 66 |
*/ |
| 67 |
public function get_discount_items( ?WC_Order $order = null ): array; |
| 68 |
|
| 69 |
/** |
| 70 |
* Get refund items |
| 71 |
* |
| 72 |
* @return OtherPaymentItem[] |
| 73 |
*/ |
| 74 |
public function get_refund_items( WC_Order $order = null ): array; |
| 75 |
|
| 76 |
/** |
| 77 |
* Create refund item instance |
| 78 |
*/ |
| 79 |
public function create_refund_item( ?int $id, float $amount ): OtherPaymentItem; |
| 80 |
|
| 81 |
/** |
| 82 |
* Check if conditions are met for showing seQura in checkout |
| 83 |
*/ |
| 84 |
public function is_available_in_checkout( ?WC_Order $order = null ): bool; |
| 85 |
} |
| 86 |
|