![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/mcoil.corals.io/app/Shop/Checkout/ |
<?php namespace App\Shop\Checkout; use App\Events\OrderCreateEvent; use App\Shop\Carts\Repositories\CartRepository; use App\Shop\Carts\ShoppingCart; use App\Shop\Orders\Order; use App\Shop\Orders\Repositories\OrderRepository; class CheckoutRepository { /** * @param array $data * * @return Order */ public function buildCheckoutItems(array $data) : Order { $orderRepo = new OrderRepository(new Order); $order = $orderRepo->createOrder([ 'reference' => $data['reference'], 'courier_id' => $data['courier_id'], 'customer_id' => $data['customer_id'], 'address_id' => $data['address_id'], 'order_status_id' => $data['order_status_id'], 'payment' => $data['payment'], 'discounts' => $data['discount_amount'], // For discount 'discount_coupon_code' => $data['discount_coupon'], 'discount_coupon_type' => $data['discount_type'], 'discount_value' => $data['discount_value'], 'discount_amount' => $data['discount_amount'], 'billing_address_id' => $data['billing_address'], 'delivery_address_id' => $data['delivery_address'], 'delivery_note' => $data['delivery_note'], 'total_products' => $data['total_products'], 'total' => $data['total'], 'total_paid' => $data['total_paid'], 'total_shipping' => isset($data['total_shipping']) ? $data['total_shipping'] : 0, 'tax' => $data['tax'], 'tax_value' => $data['tax'], // Payment related 'transaction_id' => $data['transaction_id'], 'stripe_customer_id'=> $data['stripe_customer_id'], 'transaction_status'=> $data['transaction_status'], ]); return $order; } }