Skip to content

Commit

Permalink
Work
Browse files Browse the repository at this point in the history
  • Loading branch information
janbarasek committed Feb 2, 2022
1 parent 00338b7 commit f6b0d54
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/DTO/CartInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
namespace Baraja\EcommerceStandard\DTO;


use Baraja\EcommerceStandard\Service\CartRuntimeContextInterface;

interface CartInterface
{
public function getId(): int;
Expand All @@ -25,17 +27,17 @@ public function getPayment(): ?PaymentInterface;

public function setPayment(?PaymentInterface $payment): void;

public function getPrice(): float;
public function getPrice(): PriceInterface;

public function getPriceWithoutVat(): float;
public function getPriceWithoutVat(): PriceInterface;

public function getDeliveryBranchId(): ?int;

public function setDeliveryBranchId(?int $deliveryBranchId): void;

public function getDeliveryPrice(float $itemsPrice = 0): float;
public function getDeliveryPrice(?PriceInterface $itemsPrice = null): PriceInterface;

public function getItemsPrice(bool $withVat = true): float;
public function getItemsPrice(bool $withVat = true): PriceInterface;

public function getCurrency(): CurrencyInterface;

Expand All @@ -50,4 +52,6 @@ public function getAllItems(): array;
* @return array<int, CartItemInterface>
*/
public function getItems(): array;

public function getRuntimeContext(): CartRuntimeContextInterface;
}
15 changes: 15 additions & 0 deletions src/Service/CartRuntimeContextInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

declare(strict_types=1);

namespace Baraja\EcommerceStandard\Service;


interface CartRuntimeContextInterface
{
public function getFreeDeliveryResolver(): FreeDeliveryResolverInterface;

public function getFreeDeliveryLimit(): int;

public function setFreeDeliveryLimit(int $freeDeliveryLimit): void;
}
19 changes: 19 additions & 0 deletions src/Service/FreeDeliveryResolverInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

declare(strict_types=1);

namespace Baraja\EcommerceStandard\Service;


use Baraja\EcommerceStandard\DTO\CartInterface;
use Baraja\EcommerceStandard\DTO\CustomerInterface;
use Baraja\EcommerceStandard\DTO\PriceInterface;

interface FreeDeliveryResolverInterface
{
public function isFreeDelivery(CartInterface $cart, ?CustomerInterface $customer = null): bool;

public function getMinimalPrice(?CartInterface $cart = null, ?CustomerInterface $customer = null): PriceInterface;

public function getDefaultMinimalPrice(): PriceInterface;
}

0 comments on commit f6b0d54

Please sign in to comment.