예제 #1
0
 public static function getMockUpProduct()
 {
     $product = new \com\checkout\ApiServices\SharedModels\Product();
     $product->setName('Product-' . TestHelper::getRandName());
     $product->setDescription('Description-' . TestHelper::getRandName());
     $product->setQuantity(rand(0, 5));
     $product->setShippingCost(rand(0, 10));
     $product->setSku('Sku-' . TestHelper::getRandName() . '-' . rand(0, 100));
     $product->setTrackingUrl('http://www.' . TestHelper::getRandName() . '.com');
     return $product;
 }
예제 #2
0
 /**
  * @param mixed $products
  */
 protected function _setProducts($products)
 {
     $productsArray = $products->toArray();
     $productsToReturn = array();
     if ($productsArray) {
         foreach ($productsArray as $item) {
             $product = new \com\checkout\ApiServices\SharedModels\Product();
             $product->setName($item['name']);
             $product->setDescription($item['description']);
             $product->setSku($item['sku']);
             $product->setPrice($item['price']);
             $product->setQuantity($item['quantity']);
             $product->setImage($item['image']);
             $product->setShippingCost($item['shippingCost']);
             $product->setTrackingUrl($item['trackingUrl']);
             $productsToReturn[] = $product;
         }
     }
     $this->_products = $productsToReturn;
 }