File: D:/HostingSpaces/farmfun/reserveren.farmfun.be/app/Komma/Shop/Checkout/CheckoutServiceInterface.php
<?php
namespace App\Komma\Shop\Checkout;
use App\Komma\Addresses\Models\Address;
use App\Komma\Shop\Cart\ShoppingCartServiceInterface;
use App\Komma\Shop\Orders\Models\Order;
use App\Komma\Users\Models\SiteUser;
use Illuminate\Http\RedirectResponse;
/**
* Interface CheckoutServiceInterface
*
* A checkout service sits between Order related code and payment related code.
* It directs those two domains to work together.
*/
interface CheckoutServiceInterface
{
/**
* @param ShoppingCartServiceInterface $shoppingCartService
* @param SiteUser $customer
* @param Address $addressForShipping
* @param Address $addressForInvoice
* @return Order|null
*/
public function createOrder(ShoppingCartServiceInterface $shoppingCartService, SiteUser $customer, Address $addressForShipping, Address $addressForInvoice): ?Order;
/**
* Initializes a payment request for the user that owns the order.
*
* @param Order $order
* @return RedirectResponse
*/
public function startPaymentForOrder(Order $order): RedirectResponse;
/**
* Returns the last used shipping address for the user or null if that not exists
*
* @param SiteUser $user
* @return Address
*/
public function getLastUsedShippingAddressForUser(SiteUser $user): ? Address;
/**
* Returns the last used invoice address for the user or null if that not exists
*
* @param SiteUser $user
* @return Address
*/
public function getLastUsedInvoiceAddressForUser(SiteUser $user): ? Address;
/**
* Get the shipping address
*
* @return Address|null
*/
public function getShippingAddress(): ? Address;
/**
* Set the shipping address.
* This will be used to eventually build the order.
*
* @param Address $address
* @return mixed
*/
public function setShippingAddress(Address $address): self;
/**
* Gets the user that checks out.
* This can be a guest user. Or it can be a authenticated recurring customer.
*
* @param bool $updateUserFromRequest Update the user with data from the request if available.
* @return SiteUser
*/
public function getUser($updateUserFromRequest = false): SiteUser;
public function clearCheckoutData(): void;
}