Пример #1
0
 /**
  * @param                 $billing
  * @param                 $shipping
  * @param Customer        $customer
  * @param ArrayCollection $item
  * @param CartStatus      $status
  *
  * @return Cart
  */
 protected function createCart($billing, $shipping, Customer $customer, ArrayCollection $item, $status)
 {
     $cart = new Cart();
     $cart->setChannel($this->integration);
     $cart->setDataChannel($this->channel);
     $cart->setBillingAddress($billing);
     $cart->setShippingAddress($shipping);
     $cart->setCustomer($customer);
     $cart->setEmail('*****@*****.**');
     $cart->setCreatedAt(new \DateTime('now'));
     $cart->setUpdatedAt(new \DateTime('now'));
     $cart->setCartItems($item);
     $cart->setStatus($status);
     $cart->setItemsQty(0);
     $cart->setItemsCount(1);
     $cart->setBaseCurrencyCode('code');
     $cart->setStoreCurrencyCode('code');
     $cart->setQuoteCurrencyCode('usd');
     $cart->setStoreToBaseRate(12);
     $cart->setGrandTotal(2.54);
     $cart->setIsGuest(0);
     $cart->setStore($this->store);
     $cart->setOwner($this->getUser());
     $cart->setOrganization($this->organization);
     $this->em->persist($cart);
     return $cart;
 }
Пример #2
0
 /**
  * @param ObjectManager $om
  * @param Store         $store
  * @param Integration   $integration
  * @param Customer      $customer
  * @param CartStatus    $status
  * @param int           $origin
  * @param string        $currency
  * @param int           $rate
  *
  * @return Cart
  */
 protected function generateShoppingCart(ObjectManager $om, Store $store, Integration $integration, Customer $customer, CartStatus $status, $origin, $currency = 'USD', $rate = 1)
 {
     $cart = new Cart();
     $cart->setOrganization($this->organization);
     $cart->setChannel($integration);
     $cart->setCustomer($customer);
     $cart->setOwner($customer->getOwner());
     $cart->setStatus($status);
     $cart->setStore($store);
     $cart->setBaseCurrencyCode($currency);
     $cart->setStoreCurrencyCode($currency);
     $cart->setQuoteCurrencyCode($currency);
     $cart->setStoreToBaseRate($rate);
     $cart->setStoreToQuoteRate($rate);
     $cart->setIsGuest(0);
     $cart->setEmail($customer->getEmail());
     $cart->setCreatedAt(new \DateTime('now'));
     $cart->setUpdatedAt(new \DateTime('now'));
     $cart->setOriginId($origin);
     $cart->setDataChannel($this->dataChannel);
     $om->persist($cart);
     return $cart;
 }