OrderService
in package
Order creation and management service.
Coordinates cart-to-order conversion, payment processing, and order lifecycle.
Tags
Table of Contents
Properties
- $cartService : CartService
- $orderItemModel : OrderItem
- $orderModel : Order
- $paymentService : PaymentService
Methods
- __construct() : mixed
- Initialize the order service.
- createOrder() : array<string|int, mixed>
- Create an order from cart data and checkout information.
Properties
$cartService
private
CartService
$cartService
Cart service
$orderItemModel
private
OrderItem
$orderItemModel
Order item model
$orderModel
private
Order
$orderModel
Order model
$paymentService
private
PaymentService
$paymentService
Payment service
Methods
__construct()
Initialize the order service.
public
__construct() : mixed
createOrder()
Create an order from cart data and checkout information.
public
createOrder(int $businessId, int|null $customerId, array<string|int, mixed> $cartTotals, array<string|int, mixed> $checkoutData) : array<string|int, mixed>
Parameters
- $businessId : int
-
Business ID
- $customerId : int|null
-
Customer ID (null for guest)
- $cartTotals : array<string|int, mixed>
-
Cart totals from CartService::calculateTotals()
- $checkoutData : array<string|int, mixed>
-
Checkout form data
Return values
array<string|int, mixed> —Result with keys: success, order, error